Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,29 @@ jobs:
include:
- name: x86_64 SDL 2 (OGL)
flags: '-DNBC_PLATFORM=sdl2 -DNBC_GFX_API=OGL'
packages: 'libsdl2-dev libopenal-dev zlib1g-dev'
packages: 'libsdl2-dev libopenal-dev'
runner: ubuntu-24.04
- name: x86_64 SDL 2 (OGL + Shaders)
flags: '-DNBC_PLATFORM=sdl2 -DNBC_GFX_API=OGL_SHADERS'
packages: 'libsdl2-dev libopenal-dev zlib1g-dev'
packages: 'libsdl2-dev libopenal-dev'
runner: ubuntu-24.04
- name: i686 SDL 2 (OGL)
flags: '-DNBC_PLATFORM=sdl2 -DNBC_GFX_API=OGL -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32'
packages: 'gcc-multilib g++-multilib libsdl2-dev:i386 libopenal-dev:i386 zlib1g-dev:i386'
packages: 'gcc-multilib g++-multilib libsdl2-dev:i386 libopenal-dev:i386'
runner: ubuntu-22.04
i386: true
- name: i686 SDL 2 (OGL + Shaders)
flags: '-DNBC_PLATFORM=sdl2 -DNBC_GFX_API=OGL -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32'
packages: 'gcc-multilib g++-multilib libsdl2-dev:i386 libopenal-dev:i386 zlib1g-dev:i386'
packages: 'gcc-multilib g++-multilib libsdl2-dev:i386 libopenal-dev:i386'
runner: ubuntu-22.04
i386: true
- name: aarch64 SDL 2 (OGL)
flags: '-DNBC_PLATFORM=sdl2 -DNBC_GFX_API=OGL'
packages: 'libsdl2-dev libopenal-dev zlib1g-dev'
packages: 'libsdl2-dev libopenal-dev'
runner: ubuntu-24.04-arm
- name: aarch64 SDL 2 (OGL + Shaders)
flags: '-DNBC_PLATFORM=sdl2 -DNBC_GFX_API=OGL_SHADERS'
packages: 'libsdl2-dev libopenal-dev zlib1g-dev'
packages: 'libsdl2-dev libopenal-dev'
runner: ubuntu-24.04-arm
name: Linux (${{ matrix.name }})
runs-on: ${{ matrix.runner }}
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ jobs:
cmake ninja-build \
ccache \
libopenal-dev \
zlib1g-dev \
${{ matrix.packages }}
- name: Build
run: |
Expand Down Expand Up @@ -239,8 +238,8 @@ jobs:
- uses: actions/cache@v5
with:
path: ~/ccache.tar.xz
key: switch-${{ steps.get-time.outputs.time }}
restore-keys: switch-
key: mingw-${{ steps.get-time.outputs.time }}
restore-keys: mingw-
- name: Unpack cache
run: cd ~ && [ -f ccache.tar.xz ] && tar xf ccache.tar.xz || true
- name: Checkout Repository
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ jobs:
include:
- name: x86_64 SDL 2
flags: '-DNBC_PLATFORM=sdl2 -DNBC_GFX_API=OGL'
packages: 'libsdl2-dev libopenal-dev zlib1g-dev'
packages: 'libsdl2-dev libopenal-dev'
runner: ubuntu-24.04
arch: x86_64
- name: i686 SDL 2
flags: '-DNBC_PLATFORM=sdl2 -DNBC_GFX_API=OGL -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32'
packages: 'gcc-multilib g++-multilib libsdl2-dev:i386 libopenal-dev:i386 zlib1g-dev:i386'
packages: 'gcc-multilib g++-multilib libsdl2-dev:i386 libopenal-dev:i386'
runner: ubuntu-22.04
arch: i686
- name: aarch64 SDL 2
flags: '-DNBC_PLATFORM=sdl2 -DNBC_GFX_API=OGL'
packages: 'libsdl2-dev libopenal-dev zlib1g-dev'
packages: 'libsdl2-dev libopenal-dev'
runner: ubuntu-24.04-arm
arch: aarch64
name: Linux (${{ matrix.name }})
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ if(NOT NINTENDO_SWITCH)
endif()

# Warnings
add_compile_options(-Wall -Wignored-qualifiers -Wvariadic-macros -pedantic -Wno-long-long -Wno-c++11-long-long -Wno-newline-eof -Wno-empty-translation-unit)

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
set(ENABLE_WCXX11_EXTENSIONS ON)
Expand All @@ -24,6 +22,8 @@ if (ENABLE_WCXX11_EXTENSIONS)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wc++11-extensions>)
endif()

add_compile_options(-Wall -Wignored-qualifiers -Wvariadic-macros -pedantic -Wno-long-long -Wno-c++11-long-long -Wno-newline-eof -Wno-empty-translation-unit)

if(WERROR)
add_compile_options(-Werror)
endif()
Expand Down
1 change: 0 additions & 1 deletion platforms/ios/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ for target in $targets; do
-DCMAKE_SYSTEM_NAME=Darwin \
-DNBC_PLATFORM=ios \
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY \
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
-DCMAKE_AR="$(command -v "$ar")" \
-DCMAKE_RANLIB="$(command -v "$ranlib")" \
Expand Down
3 changes: 2 additions & 1 deletion platforms/sdl/sdl2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ if(NBC_GFX_API STREQUAL "OGL")
target_link_libraries(nbcraft-core PUBLIC "${GLES_LIB}")
target_compile_definitions(nbcraft-core PUBLIC USE_GLES)
elseif(NINTENDO_SWITCH)
target_link_libraries(nbcraft-core PUBLIC glapi GLESv1_CM drm_nouveau)
find_package(OpenGL REQUIRED)
target_link_libraries(nbcraft-core PUBLIC OpenGL::EGL GLESv1_CM)
target_compile_definitions(nbcraft-core PUBLIC USE_GLES)
else()
find_package(OpenGL REQUIRED)
Expand Down
14 changes: 7 additions & 7 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -624,19 +624,19 @@ target_link_libraries(nbcraft-core PUBLIC raknet)

# zlib
add_library(zlib-interface INTERFACE)
if(NBC_WIN32 OR XENON) # @TODO: libXenon has zlib included, how do we get to it?
# Compile Vendored ZLib
add_subdirectory(../thirdparty/zlib zlib)
target_link_libraries(zlib-interface INTERFACE zlib)
if (NBC_SYSTEM_ZLIB)
# Use System ZLib, might be useful for some weird platform that needs to patch zlib
find_package(ZLIB REQUIRED)
target_link_libraries(zlib-interface INTERFACE ZLIB::ZLIB)
elseif(EMSCRIPTEN)
# Use Emscripten's ZLib
set(ZLIB_FLAG -sUSE_ZLIB=1)
target_compile_options(zlib-interface INTERFACE "${ZLIB_FLAG}")
target_link_options(zlib-interface INTERFACE "${ZLIB_FLAG}")
else()
# Use System ZLib
find_package(ZLIB REQUIRED)
target_link_libraries(zlib-interface INTERFACE ZLIB::ZLIB)
# Compile Vendored ZLib
add_subdirectory(../thirdparty/zlib zlib)
target_link_libraries(zlib-interface INTERFACE zlib)
endif()
target_link_libraries(nbcraft-core PUBLIC zlib-interface)

Expand Down
2 changes: 1 addition & 1 deletion thirdparty/zlib/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Copyright notice:

(C) 1995-2022 Jean-loup Gailly and Mark Adler
(C) 1995-2026 Jean-loup Gailly and Mark Adler

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
Expand Down
44 changes: 34 additions & 10 deletions thirdparty/zlib/compress.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* compress.c -- compress a memory buffer
* Copyright (C) 1995-2005, 2014, 2016 Jean-loup Gailly, Mark Adler
* Copyright (C) 1995-2026 Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/

Expand All @@ -18,13 +18,19 @@
compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
Z_STREAM_ERROR if the level parameter is invalid.

The _z versions of the functions take size_t length arguments.
*/
int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,
uLong sourceLen, int level) {
int ZEXPORT compress2_z(Bytef *dest, z_size_t *destLen, const Bytef *source,
z_size_t sourceLen, int level) {
z_stream stream;
int err;
const uInt max = (uInt)-1;
uLong left;
z_size_t left;

if ((sourceLen > 0 && source == NULL) ||
destLen == NULL || (*destLen > 0 && dest == NULL))
return Z_STREAM_ERROR;

left = *destLen;
*destLen = 0;
Expand All @@ -43,23 +49,36 @@ int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,

do {
if (stream.avail_out == 0) {
stream.avail_out = left > (uLong)max ? max : (uInt)left;
stream.avail_out = left > (z_size_t)max ? max : (uInt)left;
left -= stream.avail_out;
}
if (stream.avail_in == 0) {
stream.avail_in = sourceLen > (uLong)max ? max : (uInt)sourceLen;
stream.avail_in = sourceLen > (z_size_t)max ? max :
(uInt)sourceLen;
sourceLen -= stream.avail_in;
}
err = deflate(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH);
} while (err == Z_OK);

*destLen = stream.total_out;
*destLen = (z_size_t)(stream.next_out - dest);
deflateEnd(&stream);
return err == Z_STREAM_END ? Z_OK : err;
}

int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,
uLong sourceLen, int level) {
int ret;
z_size_t got = *destLen;
ret = compress2_z(dest, &got, source, sourceLen, level);
*destLen = (uLong)got;
return ret;
}
/* ===========================================================================
*/
int ZEXPORT compress_z(Bytef *dest, z_size_t *destLen, const Bytef *source,
z_size_t sourceLen) {
return compress2_z(dest, destLen, source, sourceLen,
Z_DEFAULT_COMPRESSION);
}
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source,
uLong sourceLen) {
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
Expand All @@ -69,7 +88,12 @@ int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source,
If the default memLevel or windowBits for deflateInit() is changed, then
this function needs to be updated.
*/
z_size_t ZEXPORT compressBound_z(z_size_t sourceLen) {
z_size_t bound = sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
(sourceLen >> 25) + 13;
return bound < sourceLen ? (z_size_t)-1 : bound;
}
uLong ZEXPORT compressBound(uLong sourceLen) {
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
(sourceLen >> 25) + 13;
z_size_t bound = compressBound_z(sourceLen);
return (uLong)bound != bound ? (uLong)-1 : (uLong)bound;
}
Loading
Loading