Merge remote-tracking branch 'origin/master' into limit-http-redirs

This commit is contained in:
Alam Ed Arias 2025-04-12 10:59:35 -04:00
commit 3fa79ed99b
55 changed files with 1251 additions and 660 deletions

View file

@ -12,6 +12,7 @@ variables:
stages:
- build
- osxcross
default:
interruptible: true

View file

@ -58,26 +58,24 @@ Alpine 3 GCC Makefile:
- - |
# ccache_config
echo -e "\e[0Ksection_start:`date +%s`:ccache_config[collapsed=true]\r\e[0KSetting up ccache config"
- mkdir --parents --verbose ~/.ccache/
- touch ~/.ccache/ccache.conf
- |
# cache.conf
echo Adding ccache configution option
- |
# base_dir
echo base_dir = $PWD | tee -a ~/.ccache/ccache.conf
ccache --set-config base_dir=$CI_PROJECT_DIR
- |
# cache_dir
echo cache_dir = $PWD/ccache | tee -a ~/.ccache/ccache.conf
ccache --set-config cache_dir=$CI_PROJECT_DIR/build/ccache
- |
# compiler_check
echo compiler_check = content | tee -a ~/.ccache/ccache.conf
ccache --set-config compiler_check=content
- |
# stats_log
echo stats_log = $PWD/ccache_statslog | tee -a ~/.ccache/ccache.conf
ccache --set-config stats_log=$CI_PROJECT_DIR/build/ccache_statslog
- |
# max_size
echo max_size = 50M | tee -a ~/.ccache/ccache.conf
ccache --set-config max_size=300M
- |
# ccache_config
echo -e "\e[0Ksection_end:`date +%s`:ccache_config\r\e[0K"
@ -103,7 +101,7 @@ Alpine 3 GCC Makefile:
- - |
# apk_development
echo -e "\e[0Ksection_start:`date +%s`:apk_development[collapsed=true]\r\e[0KInstalling development packages"
- apk add cmake musl-dev sdl2_mixer-dev libpng-dev curl-dev libgme-dev libopenmpt-dev miniupnpc-dev elfutils-dev
- apk add musl-dev sdl2_mixer-dev libpng-dev curl-dev libgme-dev libopenmpt-dev miniupnpc-dev elfutils-dev
- |
# apk_development
echo -e "\e[0Ksection_end:`date +%s`:apk_development\r\e[0K"

View file

@ -15,8 +15,8 @@ Alpine 3 GCC:
artifacts:
paths:
- "build.alpine3/bin/"
- "build.alpine3/src/config.h"
- "build.cmake/bin/"
- "build.cmake/src/config.h"
expose_as: "Apline-3"
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-Apline-3"
@ -58,26 +58,24 @@ Alpine 3 GCC:
- - |
# ccache_config
echo -e "\e[0Ksection_start:`date +%s`:ccache_config[collapsed=true]\r\e[0KSetting up ccache config"
- mkdir --parents --verbose ~/.ccache/
- touch ~/.ccache/ccache.conf
- |
# cache.conf
echo Adding ccache configution option
- |
# base_dir
echo base_dir = $PWD | tee -a ~/.ccache/ccache.conf
ccache --set-config base_dir=$CI_PROJECT_DIR
- |
# cache_dir
echo cache_dir = $PWD/ccache | tee -a ~/.ccache/ccache.conf
ccache --set-config cache_dir=$CI_PROJECT_DIR/build/ccache
- |
# compiler_check
echo compiler_check = content | tee -a ~/.ccache/ccache.conf
ccache --set-config compiler_check=content
- |
# stats_log
echo stats_log = $PWD/ccache_statslog | tee -a ~/.ccache/ccache.conf
ccache --set-config stats_log=$CI_PROJECT_DIR/build/ccache_statslog
- |
# max_size
echo max_size = 50M | tee -a ~/.ccache/ccache.conf
ccache --set-config max_size=300M
- |
# ccache_config
echo -e "\e[0Ksection_end:`date +%s`:ccache_config\r\e[0K"
@ -111,7 +109,15 @@ Alpine 3 GCC:
- - |
# cmake
echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles"
- cmake -B build.alpine3 -DSRB2_USE_CCACHE=YES -DSRB2_CONFIG_ERRORMODE=ON -DSRB2_CONFIG_EXECINFO=NO -G "Unix Makefiles"
- |
cmake \
-B build.cmake \
-G "Unix Makefiles" \
-DCMAKE_COLOR_DIAGNOSTICS=OFF \
-DSRB2_CONFIG_ENABLE_WEBM_MOVIES=OFF \
-DSRB2_CONFIG_ERRORMODE=ON \
-DSRB2_CONFIG_EXECINFO=NO \
-DSRB2_CONFIG_USE_GME:BOOL=ON
- |
# cmake
echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K"
@ -119,7 +125,7 @@ Alpine 3 GCC:
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=build.alpine3 --keep-going || make --directory=build.alpine3 --keep-going
- cmake --build build.cmake --parallel 1 -- --keep-going
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"

View file

@ -1,6 +1,8 @@
batocera:arm64 Makefile:
extends: Debian stable:arm64 Makefile
stage: build
when: manual
allow_failure: true

View file

@ -1,6 +1,8 @@
batocera:arm64:
extends: Debian stable:arm64
stage: build
when: manual
allow_failure: true
@ -32,7 +34,15 @@ batocera:arm64:
- - |
# cmake
echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles"
- cmake -B build.cmake -DSRB2_USE_CCACHE=YES -DSRB2_CONFIG_ERRORMODE=ON -DSRB2_CONFIG_FORCE_NO_MS_BITFIELDS=ON -DSRB2_CONFIG_USE_GME=OFF -G "Unix Makefiles"
- |
cmake \
-B build.cmake \
-G "Unix Makefiles" \
-DCMAKE_COLOR_DIAGNOSTICS=OFF \
-DSRB2_CONFIG_ENABLE_WEBM_MOVIES=OFF \
-DSRB2_CONFIG_ERRORMODE=ON \
-DSRB2_CONFIG_FORCE_NO_MS_BITFIELDS=ON \
-DSRB2_CONFIG_USE_GME:BOOL=OFF
- |
# cmake
echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K"
@ -40,7 +50,7 @@ batocera:arm64:
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=build.cmake --keep-going || make --directory=build.cmake --keep-going
- cmake --build build.cmake --parallel 1 -- --keep-going
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"

View file

@ -1,6 +1,8 @@
Debian oldstable:amd64 Makefile:
extends: Debian stable:amd64 Makefile
stage: build
when: manual
image: git.do.srb2.org:5050/stjr/srb2ci/srb2ci:oldstable

View file

@ -1,6 +1,8 @@
Debian oldstable:amd64:
extends: Debian stable:amd64
stage: build
when: manual
image: git.do.srb2.org:5050/stjr/srb2ci/srb2ci:oldstable
@ -18,7 +20,7 @@ Debian oldstable:amd64:
- - |
# apt_toolchain
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
- apt-get install ++-x86-64-linux-gnu || apt-get install g++
- apt-get install g++-x86-64-linux-gnu || apt-get install g++
- |
# apt_toolchain
echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K"
@ -34,7 +36,14 @@ Debian oldstable:amd64:
- - |
# cmake
echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles"
- cmake -B build.cmake -DSRB2_USE_CCACHE=YES -DSRB2_CONFIG_ERRORMODE=ON -DSRB2_CONFIG_USE_GME=OFF -G "Unix Makefiles"
- |
cmake \
-B build.cmake \
-G "Unix Makefiles" \
-DCMAKE_COLOR_DIAGNOSTICS=OFF \
-DSRB2_CONFIG_ENABLE_WEBM_MOVIES=OFF \
-DSRB2_CONFIG_ERRORMODE=ON \
-DSRB2_CONFIG_USE_GME:BOOL=ON
- |
# cmake
echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K"
@ -42,7 +51,7 @@ Debian oldstable:amd64:
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=build.cmake --keep-going || make --directory=build.cmake --keep-going
- cmake --build build.cmake --parallel 1 -- --keep-going
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"

View file

@ -1,6 +1,8 @@
Debian oldstable:arm64 Makefile:
extends: Debian stable:arm64 Makefile
stage: build
when: manual
image: git.do.srb2.org:5050/stjr/srb2ci/srb2ci:oldstable

View file

@ -1,6 +1,8 @@
Debian oldstable:arm64:
extends: Debian stable:arm64
stage: build
when: manual
image: git.do.srb2.org:5050/stjr/srb2ci/srb2ci:oldstable
@ -34,7 +36,15 @@ Debian oldstable:arm64:
- - |
# cmake
echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles"
- cmake -B build.cmake -DSRB2_USE_CCACHE=YES -DSRB2_CONFIG_ERRORMODE=ON -DSRB2_CONFIG_FORCE_NO_MS_BITFIELDS=ON -DSRB2_CONFIG_USE_GME=OFF -G "Unix Makefiles"
- |
cmake \
-B build.cmake \
-G "Unix Makefiles" \
-DCMAKE_COLOR_DIAGNOSTICS=OFF \
-DSRB2_CONFIG_ENABLE_WEBM_MOVIES=OFF \
-DSRB2_CONFIG_ERRORMODE=ON \
-DSRB2_CONFIG_FORCE_NO_MS_BITFIELDS=ON \
-DSRB2_CONFIG_USE_GME:BOOL=ON
- |
# cmake
echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K"
@ -42,7 +52,7 @@ Debian oldstable:arm64:
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=build.cmake --keep-going || make --directory=build.cmake --keep-going
- cmake --build build.cmake --parallel 1 -- --keep-going
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"

View file

@ -13,7 +13,6 @@ Debian stable:amd64 Makefile:
variables:
CC: x86_64-linux-gnu-gcc
CXX: x86_64-linux-gnu-g++
LDFLAGS: -Wl,-fuse-ld=gold
OBJCOPY: x86_64-linux-gnu-objcopy
OBJDUMP: x86_64-linux-gnu-objdump
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig

View file

@ -13,7 +13,6 @@ Debian stable:amd64:
variables:
CC: x86_64-linux-gnu-gcc
CXX: x86_64-linux-gnu-g++
LDFLAGS: -Wl,-fuse-ld=gold
OBJCOPY: x86_64-linux-gnu-objcopy
OBJDUMP: x86_64-linux-gnu-objdump
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig
@ -40,7 +39,14 @@ Debian stable:amd64:
- - |
# cmake
echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles"
- cmake -B build.cmake -DSRB2_USE_CCACHE=YES -DSRB2_CONFIG_ERRORMODE=ON -G "Unix Makefiles"
- |
cmake \
-B build.cmake \
-G "Unix Makefiles" \
-DCMAKE_COLOR_DIAGNOSTICS=OFF \
-DSRB2_CONFIG_ENABLE_WEBM_MOVIES=OFF \
-DSRB2_CONFIG_ERRORMODE=ON \
-DSRB2_CONFIG_USE_GME:BOOL=ON
- |
# cmake
echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K"
@ -48,7 +54,7 @@ Debian stable:amd64:
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=build.cmake --keep-going || make --directory=build.cmake --keep-going
- cmake --build build.cmake --parallel 1 -- --keep-going
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"

View file

@ -15,7 +15,6 @@ Debian stable:arm64 Makefile:
variables:
CC: aarch64-linux-gnu-gcc
CXX: aarch64-linux-gnu-g++
LDFLAGS: -Wl,-fuse-ld=gold
OBJCOPY: aarch64-linux-gnu-objcopy
OBJDUMP: aarch64-linux-gnu-objdump
LD: aarch64-linux-gnu-ld

View file

@ -15,7 +15,6 @@ Debian stable:arm64:
variables:
CC: aarch64-linux-gnu-gcc
CXX: aarch64-linux-gnu-g++
LDFLAGS: -Wl,-fuse-ld=gold
OBJCOPY: aarch64-linux-gnu-objcopy
OBJDUMP: aarch64-linux-gnu-objdump
LD: aarch64-linux-gnu-ld
@ -41,7 +40,15 @@ Debian stable:arm64:
- - |
# cmake
echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles"
- cmake -B build.cmake -DSRB2_USE_CCACHE=YES -DSRB2_CONFIG_ERRORMODE=ON -DSRB2_CONFIG_FORCE_NO_MS_BITFIELDS=ON -G "Unix Makefiles"
- |
cmake \
-B build.cmake \
-G "Unix Makefiles" \
-DCMAKE_COLOR_DIAGNOSTICS=OFF \
-DSRB2_CONFIG_ENABLE_WEBM_MOVIES=OFF \
-DSRB2_CONFIG_ERRORMODE=ON \
-DSRB2_CONFIG_FORCE_NO_MS_BITFIELDS=ON \
-DSRB2_CONFIG_USE_GME:BOOL=ON
- |
# cmake
echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K"
@ -49,7 +56,7 @@ Debian stable:arm64:
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=build.cmake --keep-going || make --directory=build.cmake --keep-going
- cmake --build build.cmake --parallel 1 -- --keep-going
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"

View file

@ -9,17 +9,16 @@ Debian stable Clang:
artifacts:
paths:
- "build.clang/bin/"
- "build.clang/src/config.h"
- "build.cmake/bin/"
- "build.cmake/src/config.h"
expose_as: "clang"
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-clang"
variables:
CC: clang
CXX: clang
CXX: clang++
WFLAGS: -Wno-cast-align -Wno-implicit-const-int-float-conversion -Werror
CFLAGS: -Wno-cast-align -Wno-implicit-const-int-float-conversion -Werror
LDFLAGS: -Wl,-fuse-ld=gold
script:
- - |
@ -41,7 +40,17 @@ Debian stable Clang:
- - |
# cmake
echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles"
- cmake -B build.clang -DCPM_USE_LOCAL_PACKAGES:BOOL=ON -DSRB2_CONFIG_ENABLE_TESTS:BOOL=OFF -DSRB2_CONFIG_SYSTEM_LIBRARIES:BOOL=ON -DSRB2_USE_LIBGME:BOOL=OFF -G "Unix Makefiles"
- |
cmake \
-B build.cmake \
-G "Unix Makefiles" \
-DCMAKE_COLOR_DIAGNOSTICS=OFF \
-DSRB2_CONFIG_ENABLE_WEBM_MOVIES=OFF \
-DCPM_USE_LOCAL_PACKAGES:BOOL=ON \
-DSRB2_CONFIG_ENABLE_TESTS:BOOL=OFF \
-DSRB2_CONFIG_SYSTEM_LIBRARIES:BOOL=ON \
-DSRB2_USE_LIBGME:BOOL=OFF \
-DSRB2_CONFIG_USE_GME:BOOL=ON
- |
# cmake
echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K"
@ -49,7 +58,7 @@ Debian stable Clang:
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=build.clang --keep-going || make --directory=build.clang --keep-going
- cmake --build build.cmake --parallel 1 -- --keep-going
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"

View file

@ -40,7 +40,14 @@ Debian stable:i386:
- - |
# cmake
echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles"
- cmake -B build.cmake -DSRB2_USE_CCACHE=YES -DSRB2_CONFIG_ERRORMODE=ON -G "Unix Makefiles"
- |
cmake \
-B build.cmake \
-G "Unix Makefiles" \
-DCMAKE_COLOR_DIAGNOSTICS=OFF \
-DSRB2_CONFIG_ENABLE_WEBM_MOVIES=OFF \
-DSRB2_CONFIG_ERRORMODE=ON \
-DSRB2_CONFIG_USE_GME:BOOL=ON
- |
# cmake
echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K"
@ -48,7 +55,7 @@ Debian stable:i386:
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=build.cmake --keep-going || make --directory=build.cmake --keep-going
- cmake --build build.cmake --parallel 1 -- --keep-going
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"

View file

@ -16,7 +16,6 @@ Debian testing Clang:
variables:
CC: clang
CXX: clang
CXX: clang++
WFLAGS: -Wno-cast-align -Wno-implicit-const-int-float-conversion -Werror -Wno-deprecated-non-prototype -Wno-single-bit-bitfield-constant-conversion
CFLAGS: -Wno-cast-align -Wno-implicit-const-int-float-conversion -Werror -Wno-deprecated-non-prototype -Wno-single-bit-bitfield-constant-conversion
LDFLAGS: -Wl,-fuse-ld=gold

View file

@ -19,7 +19,6 @@ Debian testing GCC Makefile:
variables:
CC: gcc
CXX: g++
LDFLAGS: -Wl,-fuse-ld=gold
script:
- - |

View file

@ -19,7 +19,6 @@ Debian testing GCC:
variables:
CC: gcc
CXX: g++
LDFLAGS: -Wl,-fuse-ld=gold
script:
- - |
@ -41,7 +40,14 @@ Debian testing GCC:
- - |
# cmake
echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles"
- cmake -B build.cmake -DSRB2_USE_CCACHE=YES -DSRB2_CONFIG_ERRORMODE=ON -G "Unix Makefiles"
- |
cmake \
-B build.cmake \
-G "Unix Makefiles" \
-DCMAKE_COLOR_DIAGNOSTICS=OFF \
-DSRB2_CONFIG_ENABLE_WEBM_MOVIES=OFF \
-DSRB2_CONFIG_ERRORMODE=ON \
-DSRB2_CONFIG_USE_GME:BOOL=ON
- |
# cmake
echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K"
@ -49,7 +55,7 @@ Debian testing GCC:
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=build.cmake --keep-going || make --directory=build.cmake --keep-going
- cmake --build build.cmake --parallel 1 -- --keep-going
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"

View file

@ -3,26 +3,30 @@ osxcross arm64:
stage: build
when: manual
allow_failure: true
artifacts:
paths:
- "build.osxcross/bin/"
- "build.osxcross/src/config.h"
expose_as: "Mac arm64"
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-clang"
- "build.arm64/bin/"
- "build.arm64/dist/arm64.h"
- "build.arm64/src/config.h"
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-arm64-apple-darwin"
variables:
OSXCROSS_HOST: arm64-apple-darwin21.4
LD: arm64-apple-darwin21.4-ld
OSXCROSS_HOST: oa64
CMAKE_TOOLCHAIN_FILE: /osxcross/toolchain.cmake
LD: /opt/osxcross.arm64/ld
script:
- - |
# apt_development
echo -e "\e[0Ksection_start:`date +%s`:macports_development[collapsed=true]\r\e[0KInstalling development packages"
- osxcross-macports install --arm64 curl libopenmpt libsdl2_mixer
- osxcross-macports install --arm64 libopenmpt || osxcross-macports install --verbose --arm64 libopenmpt || true
- osxcross-macports install --arm64 wavpack || osxcross-macports install --verbose --arm64 wavpack || true
- osxcross-macports install --arm64 libxmp opusfile || osxcross-macports install --verbose --arm64 libxmp opusfile
- osxcross-macports install --static --arm64 libsdl2_mixer || osxcross-macports install --verbose --static --arm64 libsdl2_mixer || true
- osxcross-macports install --static --arm64 curl || osxcross-macports install --verbose --static --arm64 curl || true
- osxcross-macports install --static --arm64 miniupnpc libpng || osxcross-macports install --verbose --static --arm64 miniupnpc libpng
- |
# apt_development
echo -e "\e[0Ksection_end:`date +%s`:macports_development\r\e[0K"
@ -30,7 +34,20 @@ osxcross arm64:
- - |
# cmake
echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles"
- cmake -B build.osxcross --toolchain /osxcross/toolchain.cmake -DCPM_USE_LOCAL_PACKAGES:BOOL=ON -DOPENMPT_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/include" -DSDL2_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/lib" -DSRB2_CONFIG_ENABLE_TESTS:BOOL=OFF -DSRB2_CONFIG_SYSTEM_LIBRARIES:BOOL=ON -DSRB2_CONFIG_FORCE_NO_MS_BITFIELDS:BOOL=ON -DSRB2_CONFIG_USE_GME:BOOL=OFF -G "Unix Makefiles"
- |
cmake \
-B build.arm64 \
-G "Unix Makefiles" \
-DCMAKE_COLOR_DIAGNOSTICS=OFF \
-DSRB2_CONFIG_ENABLE_WEBM_MOVIES=OFF \
-DCPM_USE_LOCAL_PACKAGES:BOOL=ON \
-DOPENMPT_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/include" \
-DSDL2_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/lib" \
-DSRB2_CONFIG_ENABLE_TESTS:BOOL=OFF \
-DSRB2_CONFIG_SYSTEM_LIBRARIES:BOOL=ON \
-DSRB2_CONFIG_USE_GME:BOOL=OFF \
-DSRB2_SDL2_EXE_NAME=srb2_$CI_PIPELINE_ID \
-DSRB2_CONFIG_FORCE_NO_MS_BITFIELDS:BOOL=ON
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
@ -38,7 +55,35 @@ osxcross arm64:
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=build.osxcross --keep-going || make --directory=build.osxcross --keep-going
- cmake --build build.arm64 --parallel 1 -- --keep-going
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
- - |
# copy config.h
echo -e "\e[0Ksection_start:`date +%s`:copy[collapsed=false]\r\e[0KCopying config.h"
- mkdir --parents --verbose build.arm64/dist
- cp --reflink=auto --sparse=always --verbose build.arm64/src/config.h build.arm64/dist/arm64.h
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:copy\r\e[0K"
after_script:
- - |
# apt_clean
echo -e "\e[0Ksection_start:`date +%s`:apt_clean[collapsed=true]\r\e[0KCleaning of unneeded APT packages"
- apt-get autoclean
- |
# apt_clean
echo -e "\e[0Ksection_end:`date +%s`:apt_clean\r\e[0K"
- - |
# ccache_stats
echo -e "\e[0Ksection_start:`date +%s`:ccache_stats[collapsed=true]\r\e[0Kccache statistics:"
- ccache --show-stats
- ccache --show-log-stats || true
- |
# ccahe_stats
echo -e "\e[0Ksection_end:`date +%s`:ccache_stats\r\e[0K"

View file

@ -3,67 +3,30 @@ osxcross x86_64:
stage: build
cache:
- key: ccache-$CI_JOB_NAME_SLUG-$CI_COMMIT_REF_SLUG
fallback_keys:
- ccache-$CI_JOB_NAME_SLUG-$CI_DEFAULT_BRANCH
- ccache-$CI_JOB_NAME_SLUG-master
paths:
- build/ccache
- build/ccache_statslog
- key: apt-$CI_JOB_IMAGE
paths:
- build/apt-cache
unprotect: true
- key: vcpkg-root
paths:
- build/vcpkg-root
unprotect: true
- key: vcpkg-binary-cache-x64-osx
paths:
- build/vcpkg-binary-cache
unprotect: true
allow_failure: true
artifacts:
paths:
- "build.osxcross/bin/"
- "build.osxcross/src/config.h"
expose_as: "Mac x86_64"
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-clang"
- "build.x86_64/bin/"
- "build.x86_64/dist/x86_64.h"
- "build.x86_64/src/config.h"
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-x86_64-apple-darwin"
variables:
OSXCROSS_HOST: x86_64-apple-darwin21.4
LD: x86_64-apple-darwin21.4-ld
OSXCROSS_HOST: o64
CMAKE_TOOLCHAIN_FILE: /osxcross/toolchain.cmake
LD: /opt/osxcross.x86_64/ld
script:
- |
# vcpkg
echo -e "\e[0Ksection_start:`date +%s`:vcpkg-root[collapsed=true]\r\e[0KUpdating vcpkg"
if [ -d "build/vcpkg-root" ]; then
pushd build/vcpkg-root
git fetch https://github.com/Microsoft/vcpkg master
git reset --hard FETCH_HEAD
popd
else
mkdir -p build
git clone https://github.com/Microsoft/vcpkg build/vcpkg-root
fi
export VCPKG_ROOT=$(pwd)/build/vcpkg-root
export VCPKG_BINARY_SOURCES="clear;files,$(pwd)/build/vcpkg-binary-cache,readwrite"
mkdir -p "build/vcpkg-binary-cache"
echo -e "\e[0Ksection_end:`date +%s`:vcpkg-root\r\e[0K"
- - |
# apt_development
echo -e "\e[0Ksection_start:`date +%s`:macports_development[collapsed=true]\r\e[0KInstalling development packages"
- osxcross-macports install curl libopenmpt libsdl2_mixer
- osxcross-macports install libopenmpt || osxcross-macports install --verbose libopenmpt || true
- osxcross-macports install wavpack || osxcross-macports install --verbose wavpack || true
- osxcross-macports install libxmp opusfile || osxcross-macports install --verbose libxmp opusfile
- osxcross-macports install --static libsdl2_mixer || osxcross-macports install --verbose --static libsdl2_mixer || true
- osxcross-macports install --static curl || osxcross-macports install --verbose --static curl || true
- osxcross-macports install --static miniupnpc libpng || osxcross-macports install --verbose --static miniupnpc libpng
- |
# apt_development
echo -e "\e[0Ksection_end:`date +%s`:macports_development\r\e[0K"
@ -71,7 +34,19 @@ osxcross x86_64:
- - |
# cmake
echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles"
- cmake -B build.osxcross --toolchain /osxcross/toolchain.cmake -DCPM_USE_LOCAL_PACKAGES:BOOL=ON -DOPENMPT_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/include" -DSDL2_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/lib" -DSRB2_CONFIG_ENABLE_TESTS:BOOL=OFF -DSRB2_CONFIG_SYSTEM_LIBRARIES:BOOL=ON -DSRB2_CONFIG_USE_GME:BOOL=OFF -G "Unix Makefiles"
- |
cmake \
-B build.x86_64 \
-G "Unix Makefiles" \
-DCMAKE_COLOR_DIAGNOSTICS=OFF \
-DSRB2_CONFIG_ENABLE_WEBM_MOVIES=OFF \
-DCPM_USE_LOCAL_PACKAGES:BOOL=ON \
-DOPENMPT_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/include" \
-DSDL2_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/lib" \
-DSRB2_CONFIG_ENABLE_TESTS:BOOL=OFF \
-DSRB2_CONFIG_SYSTEM_LIBRARIES:BOOL=ON \
-DSRB2_CONFIG_USE_GME:BOOL=OFF \
-DSRB2_SDL2_EXE_NAME=srb2_$CI_PIPELINE_ID
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
@ -79,11 +54,21 @@ osxcross x86_64:
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=build.osxcross --keep-going || make --directory=build.osxcross --keep-going
- cmake --build build.x86_64 --parallel 1 -- --keep-going
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
- - |
# copy config.h
echo -e "\e[0Ksection_start:`date +%s`:copy[collapsed=false]\r\e[0KCopying config.h"
- mkdir --parents --verbose build.x86_64/dist
- cp --reflink=auto --sparse=always --verbose build.x86_64/src/config.h build.x86_64/dist/x86_64.h
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:copy\r\e[0K"
after_script:
- - |
# apt_clean
@ -93,18 +78,6 @@ osxcross x86_64:
# apt_clean
echo -e "\e[0Ksection_end:`date +%s`:apt_clean\r\e[0K"
- - |
# vcpkg_clean
echo -e "\e[0Ksection_start:`date +%s`:vcpkg_clean[collapsed=true]\r\e[0KCleaning vcpkg-root"
if [ -d "build/vcpkg-root" ]; then
pushd "build/vcpkg-root"
git clean
popd
fi
echo -e "\e[0Ksection_end:`date +%s`:vcpkg_clean\r\e[0K"
- - |
# ccache_stats
echo -e "\e[0Ksection_start:`date +%s`:ccache_stats[collapsed=true]\r\e[0Kccache statistics:"

View file

@ -0,0 +1,69 @@
osxcross universal:
image: git.do.srb2.org:5050/stjr/srb2ci/srb2ci:stable
dependencies:
- osxcross arm64
- osxcross x86_64
needs:
- job: osxcross arm64
- job: osxcross x86_64
stage: osxcross
allow_failure: true
artifacts:
paths:
- "dist/bin"
- "dist/src"
expose_as: "Mac Universal"
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-lipo-apple-darwin"
script:
- - |
# mkdir
echo -e "\e[0Ksection_start:`date +%s`:mkdir[collapsed=true]\r\e[0KMaking dist folder"
mkdir --parents --verbose dist/src dist/bin
- |
# mkdir
echo -e "\e[0Ksection_end:`date +%s`:mkdir\r\e[0K"
- - |
# copy-config
echo -e "\e[0Ksection_start:`date +%s`:x86_64-config[collapsed=true]\r\e[0KCopying x86_64 config"
- cp --reflink=auto --sparse=always --verbose --target-directory=dist/src/ build.*/dist/*.h
- |
# x86_64-config
echo -e "\e[0Ksection_end:`date +%s`:x86_64-config\r\e[0K"
- - |
# copy-build
echo -e "\e[0Ksection_start:`date +%s`:copy-build[collapsed=true]\r\e[0KCopying ALL build"
- cp --reflink=auto --sparse=always --recursive --verbose --target-directory=dist/ build.*/bin/
- |
# copy-build
echo -e "\e[0Ksection_end:`date +%s`:copy-build\r\e[0K"
- - |
# link-build
echo -e "\e[0Ksection_start:`date +%s`:link-build[collapsed=true]\r\e[0KLinking universal build"
- lipo -create -output dist/bin/srb2_$CI_PIPELINE_ID.app/Contents/MacOS/srb2_$CI_PIPELINE_ID build.*/bin/srb2_$CI_PIPELINE_ID.app/Contents/MacOS/srb2_$CI_PIPELINE_ID
- |
# universal-build
echo -e "\e[0Ksection_end:`date +%s`:link-build\r\e[0K"
- - |
# arm64-verify
echo -e "\e[0Ksection_start:`date +%s`:arm64-verify[collapsed=true]\r\e[0KVerifying arm64"
- lipo dist/bin/srb2_$CI_PIPELINE_ID.app/Contents/MacOS/srb2_$CI_PIPELINE_ID -verify_arch arm64
- |
# arm64-verify
echo -e "\e[0Ksection_end:`date +%s`:arm64-verify\r\e[0K"
- - |
# x86_64-verify
echo -e "\e[0Ksection_start:`date +%s`:x86_64-verify[collapsed=true]\r\e[0KVerifying x86_64"
- lipo dist/bin/srb2_$CI_PIPELINE_ID.app/Contents/MacOS/srb2_$CI_PIPELINE_ID -verify_arch x86_64
- |
# x86_64-verify
echo -e "\e[0Ksection_end:`date +%s`:x86_64-verify\r\e[0K"

View file

@ -16,6 +16,8 @@ Windows x64 Makefile:
variables:
PREFIX: x86_64-w64-mingw32
CC: /usr/bin/x86_64-w64-mingw32-gcc
CXX: /usr/bin/x86_64-w64-mingw32-g++
script:
- - |

View file

@ -7,6 +7,25 @@ Windows x64:
allow_failure: true
cache:
- key: ccache-$CI_JOB_NAME_SLUG-$CI_COMMIT_REF_SLUG
fallback_keys:
- ccache-$CI_JOB_NAME_SLUG-$CI_DEFAULT_BRANCH
- ccache-$CI_JOB_NAME_SLUG-master
paths:
- build/ccache
- build/ccache_statslog
- key: apt-$CI_JOB_IMAGE
paths:
- build/apt-cache
unprotect: true
- key: vcpkg-binary-cache-x64-mingw-static
paths:
- build/vcpkg-binary-cache
unprotect: true
artifacts:
paths:
- "build.cmake/bin/"
@ -15,9 +34,22 @@ Windows x64:
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-Win64"
variables:
PREFIX: x86_64-w64-mingw32
VCPKG_TARGET_TRIPLET: x64-mingw-static
CC: x86_64-w64-mingw32-gcc
CXX: x86_64-w64-mingw32-g++
LD: x86_64-w64-mingw32-ld
script:
- |
# vcpkg
echo -e "\e[0Ksection_start:`date +%s`:vcpkg-root[collapsed=true]\r\e[0KSetting vcpkg cache"
export VCPKG_DEFAULT_BINARY_CACHE="$(pwd)/build/vcpkg-binary-cache"
mkdir -p "build/vcpkg-binary-cache"
echo -e "\e[0Ksection_end:`date +%s`:vcpkg-root\r\e[0K"
- - |
# apt_toolchain
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
@ -37,7 +69,16 @@ Windows x64:
- - |
# cmake
echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles"
- cmake -B build.cmake -DSRB2_USE_CCACHE=YES -DSRB2_CONFIG_ERRORMODE=ON -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/toolchains/mingw.cmake
- |
cmake \
-B build.cmake \
-G "Unix Makefiles" \
-DCMAKE_COLOR_DIAGNOSTICS=OFF \
-DSRB2_CONFIG_ENABLE_WEBM_MOVIES=OFF \
-DSRB2_CONFIG_ERRORMODE=ON \
-DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake \
-DVCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET} \
-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/toolchains/mingw.cmake
- |
# cmake
echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K"
@ -45,7 +86,7 @@ Windows x64:
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=build.cmake --keep-going || make --directory=build.cmake --keep-going
- cmake --build build.cmake --parallel 1 -- --keep-going
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"

View file

@ -3,10 +3,6 @@ Windows x86:
stage: build
when: manual
allow_failure: true
cache:
- key: ccache-$CI_JOB_NAME_SLUG-$CI_COMMIT_REF_SLUG
fallback_keys:
@ -21,11 +17,6 @@ Windows x86:
- build/apt-cache
unprotect: true
- key: vcpkg-root
paths:
- build/vcpkg-root
unprotect: true
- key: vcpkg-binary-cache-x86-mingw-static
paths:
- build/vcpkg-binary-cache
@ -33,33 +24,23 @@ Windows x86:
artifacts:
paths:
- "build/ninja-x86_mingw_static_vcpkg-debug/bin/"
- "build/ninja-x86_mingw_static_vcpkg-debug/src/config.h"
- "build.cmake/bin/"
- "build.cmake/src/config.h"
expose_as: "Win32"
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-Win32"
variables:
PREFIX: i686-w64-mingw32
CC: /usr/bin/i686-w64-mingw32-gcc-posix
CXX: /usr/bin/i686-w64-mingw32-g++-posix
VCPKG_TARGET_TRIPLET: x86-mingw-static
CC: i686-w64-mingw32-gcc
CXX: i686-w64-mingw32-g++
LD: i686-w64-mingw32-ld
script:
- |
# vcpkg
echo -e "\e[0Ksection_start:`date +%s`:vcpkg-root[collapsed=true]\r\e[0KUpdating vcpkg"
echo -e "\e[0Ksection_start:`date +%s`:vcpkg-root[collapsed=true]\r\e[0KSetting vcpkg cache"
if [ -d "build/vcpkg-root" ]; then
pushd build/vcpkg-root
git fetch https://github.com/Microsoft/vcpkg master
git reset --hard FETCH_HEAD
popd
else
mkdir -p build
git clone https://github.com/Microsoft/vcpkg build/vcpkg-root
fi
export VCPKG_ROOT=$(pwd)/build/vcpkg-root
export VCPKG_BINARY_SOURCES="clear;files,$(pwd)/build/vcpkg-binary-cache,readwrite"
export VCPKG_DEFAULT_BINARY_CACHE="$(pwd)/build/vcpkg-binary-cache"
mkdir -p "build/vcpkg-binary-cache"
@ -84,9 +65,16 @@ Windows x86:
- - |
# cmake
echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles"
# cmake
echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles"
- cmake --preset ninja-x86_mingw_static_vcpkg-debug -G "Unix Makefiles" -DSRB2_USE_CCACHE=YES -DSRB2_CONFIG_ERRORMODE=ON -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake
- |
cmake \
-B build.cmake \
-G "Unix Makefiles" \
-DCMAKE_COLOR_DIAGNOSTICS=OFF \
-DSRB2_CONFIG_ENABLE_WEBM_MOVIES=OFF \
-DSRB2_CONFIG_ERRORMODE=ON \
-DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake \
-DVCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET} \
-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/toolchains/mingw.cmake
- |
# cmake
echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K"
@ -94,37 +82,7 @@ Windows x86:
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- cmake --build --preset ninja-x86_mingw_static_vcpkg-debug --parallel 1 -- --keep-going || cmake --build --preset ninja-x86_mingw_static_vcpkg-debug --parallel 1 -- --keep-going
- cmake --build build.cmake --parallel 1 -- --keep-going
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
after_script:
- - |
# apt_clean
echo -e "\e[0Ksection_start:`date +%s`:apt_clean[collapsed=true]\r\e[0KCleaning of unneeded APT packages"
- apt-get autoclean
- |
# apt_clean
echo -e "\e[0Ksection_end:`date +%s`:apt_clean\r\e[0K"
- - |
# vcpkg_clean
echo -e "\e[0Ksection_start:`date +%s`:vcpkg_clean[collapsed=true]\r\e[0KCleaning vcpkg-root"
if [ -d "build/vcpkg-root" ]; then
pushd "build/vcpkg-root"
git clean -f
popd
fi
echo -e "\e[0Ksection_end:`date +%s`:vcpkg_clean\r\e[0K"
- - |
# ccache_stats
echo -e "\e[0Ksection_start:`date +%s`:ccache_stats[collapsed=true]\r\e[0Kccache statistics:"
- ccache --show-stats
- ccache --show-log-stats || true
- |
# ccahe_stats
echo -e "\e[0Ksection_end:`date +%s`:ccache_stats\r\e[0K"

View file

@ -93,26 +93,24 @@
- - |
# ccache_config
echo -e "\e[0Ksection_start:`date +%s`:ccache_config[collapsed=true]\r\e[0KSetting up ccache config"
- mkdir --parents --verbose ~/.ccache/
- touch ~/.ccache/ccache.conf
- |
# cache.conf
echo Adding ccache configution option
- |
# base_dir
echo base_dir = $CI_PROJECT_DIR | tee --append ~/.ccache/ccache.conf
ccache --set-config base_dir=$CI_PROJECT_DIR
- |
# cache_dir
echo cache_dir = $CI_PROJECT_DIR/build/ccache | tee --append ~/.ccache/ccache.conf
ccache --set-config cache_dir=$CI_PROJECT_DIR/build/ccache
- |
# compiler_check
echo compiler_check = content | tee --append ~/.ccache/ccache.conf
ccache --set-config compiler_check=content
- |
# stats_log
echo stats_log = $CI_PROJECT_DIR/build/ccache_statslog | tee --append ~/.ccache/ccache.conf
ccache --set-config stats_log=$CI_PROJECT_DIR/build/ccache_statslog || true
- |
# max_size
echo max_size = 300M | tee --append ~/.ccache/ccache.conf
ccache --set-config max_size=300M
- |
# ccache_config
echo -e "\e[0Ksection_end:`date +%s`:ccache_config\r\e[0K"

View file

@ -192,9 +192,6 @@ endif()
target_compile_definitions(SRB2SDL2 PRIVATE -D_LARGEFILE64_SOURCE)
set(SRB2_HAVE_THREADS ON)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_THREADS)
if("${SRB2_CONFIG_HWRENDER}")
target_compile_definitions(SRB2SDL2 PRIVATE -DHWRENDER)
add_subdirectory(hardware)
@ -464,8 +461,13 @@ else()
endif()
if(TARGET miniupnpc::miniupnpc)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MINIUPNPC)
target_link_libraries(SRB2SDL2 PRIVATE miniupnpc::miniupnpc)
if("${VCPKG_TARGET_TRIPLET}" MATCHES "-mingw-static$")
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MINIUPNPC -DMINIUPNP_STATICLIB)
target_link_libraries(SRB2SDL2 PRIVATE miniupnpc::miniupnpc -liphlpapi)
else()
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MINIUPNPC)
target_link_libraries(SRB2SDL2 PRIVATE miniupnpc::miniupnpc)
endif()
message(STATUS "miniupnpc Found")
else()
message(STATUS "No miniupnpc Found")

View file

@ -13,10 +13,7 @@ ifdef MINGW
libs+=-mconsole
endif
ifndef NOTHREADS
opts+=-DHAVE_THREADS
sources+=dedicated/i_threads.c
endif
NOOPENMPT=1
NOGME=1

View file

@ -43,10 +43,7 @@ sources+=sdl/mixer_sound.c
endif
endif
ifndef NOTHREADS
opts+=-DHAVE_THREADS
sources+=sdl/i_threads.c
endif
ifdef SDL_PKGCONFIG
$(eval $(call Use_pkg_config,SDL))

View file

@ -16,6 +16,10 @@
///
/// code shamelessly inspired by the QuakeC sources, thanks Id :)
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
#include "doomdef.h"
#include "doomstat.h"
#include "command.h"
@ -277,7 +281,11 @@ void COM_BufExecute(void)
/** Executes a string immediately. Used for skirting around WAIT commands.
*/
void COM_ImmedExecute(const char *ptext)
void
#ifdef __EMSCRIPTEN__
EMSCRIPTEN_KEEPALIVE
#endif
COM_ImmedExecute(const char *ptext)
{
size_t i = 0, j = 0;
char line[1024] = "";

View file

@ -45,15 +45,10 @@
#define MAXHUDLINES 20
#ifdef HAVE_THREADS
I_mutex con_mutex;
# define Lock_state() I_lock_mutex(&con_mutex)
# define Unlock_state() I_unlock_mutex(con_mutex)
#else/*HAVE_THREADS*/
# define Lock_state()
# define Unlock_state()
#endif/*HAVE_THREADS*/
static boolean con_started = false; // console has been initialised
boolean con_startup = false; // true at game startup

View file

@ -21,9 +21,7 @@ void CON_StopRefresh(void);
boolean CON_Responder(event_t *ev);
#ifdef HAVE_THREADS
extern I_mutex con_mutex;
#endif
// set true when screen size has changed, to adapt console
extern boolean con_recalc;

View file

@ -15,6 +15,10 @@
/// plus functions to parse command line parameters, configure game
/// parameters, and call the startup functions.
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
#include <sys/stat.h>
#include <sys/types.h>
@ -244,15 +248,11 @@ void D_ProcessEvents(void)
}
// Menu input
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex);
#endif
{
eaten = M_Responder(ev);
}
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex);
#endif
if (eaten)
continue; // menu ate the event
@ -264,15 +264,11 @@ void D_ProcessEvents(void)
}
// console input
#ifdef HAVE_THREADS
I_lock_mutex(&con_mutex);
#endif
{
eaten = CON_Responder(ev);
}
#ifdef HAVE_THREADS
I_unlock_mutex(con_mutex);
#endif
if (eaten)
continue; // ate the event
@ -596,13 +592,9 @@ static void D_Display(void)
// vid size change is now finished if it was on...
vid.recalc = 0;
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex);
#endif
M_Drawer(); // menu is drawn even on top of everything
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex);
#endif
// focus lost moved to M_Drawer
CON_Drawer();
@ -705,16 +697,11 @@ static void D_Display(void)
tic_t rendergametic;
static void D_RunFrame(void);
static tic_t oldentertics = 0;
void D_SRB2Loop(void)
{
tic_t entertic = 0, oldentertics = 0, realtics = 0, rendertimeout = INFTICS;
double deltatics = 0.0;
double deltasecs = 0.0;
static lumpnum_t gstartuplumpnum;
boolean interp = false;
boolean doDisplay = false;
if (dedicated)
server = true;
@ -750,21 +737,68 @@ void D_SRB2Loop(void)
// hack to start on a nice clear console screen.
COM_ImmedExecute("cls;version");
#ifdef __EMSCRIPTEN__
EM_ASM(
try {
StartedMainLoopCallback();
} catch (err) {
console.log('Faild to find StartedMainLoopCallback()');
}
);
#endif
I_FinishUpdate(); // page flip or blit buffer
/*
LMFAO this was showing garbage under OpenGL
because I_FinishUpdate was called afterward
*/
/* Smells like a hack... Don't fade Sonic's ass into the title screen. */
if (gamestate != GS_TITLESCREEN)
{
gstartuplumpnum = W_CheckNumForPatchName("STARTUP");
lumpnum_t gstartuplumpnum = W_CheckNumForPatchName("STARTUP");
if (gstartuplumpnum == LUMPERROR)
gstartuplumpnum = W_GetNumForPatchName("MISSING");
V_DrawScaledPatch(0, 0, 0, W_CachePatchNum(gstartuplumpnum, PU_PATCH));
}
#ifdef __EMSCRIPTEN__
emscripten_set_main_loop(D_RunFrame, 0, 1);
#else
for (;;)
{
D_RunFrame();
}
#endif
}
static boolean D_LockFrame = false;
#ifdef __EMSCRIPTEN__
int EMSCRIPTEN_KEEPALIVE pause_loop(void)
{
D_LockFrame = true;
emscripten_pause_main_loop();
return 0;
}
int EMSCRIPTEN_KEEPALIVE resume_loop(void)
{
D_LockFrame = false;
emscripten_resume_main_loop();
return 0;
}
#endif
static void D_RunFrame(void)
{
static tic_t entertic = 0, realtics = 0, rendertimeout = INFTICS;
static double deltatics = 0.0;
static double deltasecs = 0.0;
static boolean interp = false;
static boolean doDisplay = false;
if (!D_LockFrame)
{
// capbudget is the minimum precise_t duration of a single loop iteration
precise_t capbudget;
@ -920,6 +954,7 @@ void D_SRB2Loop(void)
deltasecs = (double)((INT64)(finishprecise - enterprecise)) / I_GetPrecisePrecision();
deltatics = deltasecs * NEWTICRATE;
}
return;
}
//

View file

@ -1181,10 +1181,8 @@ static void I_RegisterSignals (void)
INT32 I_StartupSystem(void)
{
#ifdef HAVE_THREADS
I_start_threads();
I_AddExitFunc(I_stop_threads);
#endif
I_StartupConsole();
I_RegisterSignals();
#ifndef NOMUMBLE

View file

@ -15,7 +15,6 @@
#include "../i_threads.h"
#include "../doomdef.h"
#include "../doomtype.h"
typedef struct thread_s thread_t;
@ -42,10 +41,11 @@ static void *HandleThread(void *data)
return NULL;
}
void I_spawn_thread(const char *name, I_thread_fn entry, void *userdata)
int I_spawn_thread(const char *name, I_thread_fn entry, void *userdata)
{
thread_t *thread;
(void)name;
pthread_mutex_lock(&thread_lock);
thread = thread_list;
while (thread != NULL)
@ -69,6 +69,13 @@ void I_spawn_thread(const char *name, I_thread_fn entry, void *userdata)
thread->userdata = userdata;
pthread_create(&thread->thread, NULL, HandleThread, thread);
pthread_mutex_unlock(&thread_lock);
return true;
}
int I_can_thread(void)
{
return true;
}
int I_thread_is_stopped(void)

View file

@ -703,7 +703,9 @@ extern int
/// This stops the game from storing backups of the states, sprites, and mobjinfo tables.
/// Though this info is compressed under normal circumstances, it's still a lot of extra
/// memory that never gets touched.
#if !(defined (__EMSCRIPTEN__) && (__SIZEOF_SIZE_T__ == 4))
#define ALLOW_RESETDATA
#endif
/// Experimental tweaks to analog mode. (Needs a lot of work before it's ready for primetime.)
//#define REDSANALOG
@ -731,7 +733,7 @@ extern int
/// Maintain compatibility with older 2.2 demos
#define OLD22DEMOCOMPAT
#ifdef HAVE_CURL
#if defined (HAVE_CURL) && !(defined(__EMSCRIPTEN__) && !defined(__EMSCRIPTEN_PTHREADS__))
#define MASTERSERVER
#else
#undef UPDATE_ALERT

View file

@ -110,7 +110,7 @@ int startswith (const char *base, const char *tag);
int endswith (const char *base, const char *tag);
char *xstrtok(char *line, const char *delims);
#if defined (_WIN32) || defined (__HAIKU__)
#if defined (_WIN32) || defined (__HAIKU__) || defined (__EMSCRIPTEN__)
#define HAVE_DOSSTR_FUNCS
#endif
@ -156,6 +156,7 @@ typedef int32_t boolean;
#endif
#ifndef __cplusplus
#ifndef __bool_true_false_are_defined
#ifndef _WIN32
enum {false = 0, true = 1};
#else
@ -163,6 +164,7 @@ enum {false = 0, true = 1};
#define true TRUE
#endif
#endif
#endif
/* 7.18.2.1 Limits of exact-width integer types */
@ -245,6 +247,8 @@ enum {false = 0, true = 1};
#define FUNCNOINLINE __attribute__((noinline))
#define FUNCWARNRV __attribute__((warn_unused_result))
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) // >= GCC 4.4
#ifdef __i386__ // i386 only
#define FUNCTARGET(X) __attribute__ ((__target__ (X)))
@ -296,6 +300,9 @@ enum {false = 0, true = 1};
#ifndef FUNCTARGET
#define FUNCTARGET(x)
#endif
#ifndef FUNCWARNRV
#define FUNCWARNRV
#endif
#ifndef ATTRPACK
#define ATTRPACK
#endif

View file

@ -919,13 +919,9 @@ void F_IntroTicker(void)
I_OsPolling();
I_UpdateNoBlit();
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex);
#endif
M_Drawer(); // menu is drawn even on top of wipes
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex);
#endif
I_FinishUpdate(); // Update the screen with the image Tails 06-19-2001
if (moviemode) // make sure we save frames for the white hold too

View file

@ -601,13 +601,9 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
if (drawMenu)
{
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex);
#endif
M_Drawer(); // menu is drawn even on top of wipes
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex);
#endif
}
I_FinishUpdate(); // page flip or blit buffer

View file

@ -227,7 +227,6 @@ FUNCPRINTF static void GL_MSG_Error(const char *format, ...)
/* 1.0 functions */
/* Miscellaneous */
#define pglClearColor glClearColor
//glClear
#define pglColorMask glColorMask
#define pglAlphaFunc glAlphaFunc
#define pglBlendFunc glBlendFunc
@ -237,9 +236,7 @@ FUNCPRINTF static void GL_MSG_Error(const char *format, ...)
#define pglEnable glEnable
#define pglDisable glDisable
#define pglGetFloatv glGetFloatv
//glGetIntegerv
//glGetString
#define pglHint glHint
#define pglPolygonMode glPolygonMode
/* Depth Buffer */
#define pglClearDepth glClearDepth
@ -283,6 +280,7 @@ FUNCPRINTF static void GL_MSG_Error(const char *format, ...)
/* Texture mapping */
#define pglTexEnvi glTexEnvi
#define pglTexParameteri glTexParameteri
#define pglTexImage1D glTexImage1D
#define pglTexImage2D glTexImage2D
#define pglTexSubImage2D glTexSubImage2D
@ -668,6 +666,7 @@ void SetupGLFunc4(void)
{
/* 1.2 funcs */
pglTexImage3D = GetGLFunc("glTexImage3D");
/* 1.3 funcs */
pglActiveTexture = GetGLFunc("glActiveTexture");
pglMultiTexCoord2f = GetGLFunc("glMultiTexCoord2f");

View file

@ -9,20 +9,21 @@
/// \file i_threads.h
/// \brief Multithreading abstraction
#ifdef HAVE_THREADS
#ifndef I_THREADS_H
#define I_THREADS_H
#include "doomtype.h"
typedef void (*I_thread_fn)(void *userdata);
typedef void * I_mutex;
typedef void * I_cond;
int I_can_thread (void) FUNCWARNRV;
void I_start_threads (void);
void I_stop_threads (void);
void I_spawn_thread (const char *name, I_thread_fn, void *userdata);
int I_spawn_thread (const char *name, I_thread_fn, void *userdata) FUNCWARNRV;
/* check in your thread whether to return early */
int I_thread_is_stopped (void);
@ -36,4 +37,3 @@ void I_wake_one_cond (I_cond *);
void I_wake_all_cond (I_cond *);
#endif/*I_THREADS_H*/
#endif/*HAVE_THREADS*/

View file

@ -123,9 +123,7 @@ typedef enum
NUM_QUITMESSAGES
} text_enum;
#ifdef HAVE_THREADS
I_mutex m_menu_mutex;
#endif
M_waiting_mode_t m_waiting_mode = M_NOT_WAITING;
@ -3802,29 +3800,32 @@ void M_SetupNextMenu(menu_t *menudef)
{
INT16 i;
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
if (currentMenu == &MP_RoomDef || currentMenu == &MP_ConnectDef)
#if defined (MASTERSERVER)
if (I_can_thread())
{
I_lock_mutex(&ms_QueryId_mutex);
if (currentMenu == &MP_RoomDef || currentMenu == &MP_ConnectDef)
{
ms_QueryId++;
}
I_unlock_mutex(ms_QueryId_mutex);
}
if (currentMenu == &MP_ConnectDef)
{
I_lock_mutex(&ms_ServerList_mutex);
{
if (ms_ServerList)
I_lock_mutex(&ms_QueryId_mutex);
{
free(ms_ServerList);
ms_ServerList = NULL;
ms_QueryId++;
}
I_unlock_mutex(ms_QueryId_mutex);
}
if (currentMenu == &MP_ConnectDef)
{
I_lock_mutex(&ms_ServerList_mutex);
{
if (ms_ServerList)
{
free(ms_ServerList);
ms_ServerList = NULL;
}
}
I_unlock_mutex(ms_ServerList_mutex);
}
I_unlock_mutex(ms_ServerList_mutex);
}
#endif/*HAVE_THREADS*/
#endif/*MASTERSERVER*/
if (currentMenu->quitroutine)
{
@ -3891,7 +3892,10 @@ void M_Ticker(void)
if (currentMenu == &OP_ScreenshotOptionsDef)
M_SetupScreenshotMenu();
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
#if defined (MASTERSERVER)
if (!netgame)
return;
I_lock_mutex(&ms_ServerList_mutex);
{
if (ms_ServerList)
@ -11375,7 +11379,7 @@ static boolean M_CheckMODVersion(int id)
}
#endif/*UPDATE_ALERT*/
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
#if defined (MASTERSERVER)
static void
Check_new_version_thread (int *id)
{
@ -11432,7 +11436,7 @@ Check_new_version_thread (int *id)
free(id);
}
#endif/*defined (MASTERSERVER) && defined (HAVE_THREADS)*/
#endif/*defined (MASTERSERVER)*/
static void M_ConnectMenu(INT32 choice)
{
@ -11474,7 +11478,7 @@ UINT32 roomIds[NUM_LIST_ROOMS];
static void M_RoomMenu(INT32 choice)
{
INT32 i;
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
#if defined (MASTERSERVER)
int *id;
#endif
@ -11497,44 +11501,53 @@ static void M_RoomMenu(INT32 choice)
M_SetupNextMenu(&MP_RoomDef);
#ifdef MASTERSERVER
#ifdef HAVE_THREADS
if (I_can_thread())
{
#ifdef UPDATE_ALERT
m_waiting_mode = M_WAITING_VERSION;
m_waiting_mode = M_WAITING_VERSION;
#else/*UPDATE_ALERT*/
m_waiting_mode = M_WAITING_ROOMS;
m_waiting_mode = M_WAITING_ROOMS;
#endif/*UPDATE_ALERT*/
MP_RoomMenu[0].text = "";
MP_RoomMenu[0].text = "";
id = malloc(sizeof *id);
id = malloc(sizeof *id);
I_lock_mutex(&ms_QueryId_mutex);
{
*id = ms_QueryId;
I_lock_mutex(&ms_QueryId_mutex);
{
*id = ms_QueryId;
}
I_unlock_mutex(ms_QueryId_mutex);
if(!I_spawn_thread("check-new-version",
(I_thread_fn)Check_new_version_thread, id))
{
free(id);
}
}
I_unlock_mutex(ms_QueryId_mutex);
I_spawn_thread("check-new-version",
(I_thread_fn)Check_new_version_thread, id);
#else/*HAVE_THREADS*/
else
{
#ifdef UPDATE_ALERT
if (M_CheckMODVersion(0))
if (M_CheckMODVersion(0))
#endif/*UPDATE_ALERT*/
{
GetRoomsList(currentMenu->prevMenu == &MP_ServerDef, 0);
{
GetRoomsList(currentMenu->prevMenu == &MP_ServerDef, 0);
}
}
#endif/*HAVE_THREADS*/
#endif/*MASTERSERVER*/
}
static void M_ChooseRoom(INT32 choice)
{
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
I_lock_mutex(&ms_QueryId_mutex);
#if defined (MASTERSERVER)
if (I_can_thread())
{
ms_QueryId++;
I_lock_mutex(&ms_QueryId_mutex);
{
ms_QueryId++;
}
I_unlock_mutex(ms_QueryId_mutex);
}
I_unlock_mutex(ms_QueryId_mutex);
#endif
if (choice == 0)

View file

@ -352,9 +352,7 @@ void M_ClearMenus(boolean callexitmenufunc);
// Maybe this goes here????? Who knows.
boolean M_MouseNeeded(void);
#ifdef HAVE_THREADS
extern I_mutex m_menu_mutex;
#endif
extern menu_t *currentMenu;

View file

@ -392,7 +392,7 @@ static void SL_InsertServer(serverinfo_pak* info, SINT8 node)
M_SortServerList();
}
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
#if defined (MASTERSERVER)
struct Fetch_servers_ctx
{
int room;
@ -437,7 +437,7 @@ Fetch_servers_thread (struct Fetch_servers_ctx *ctx)
free(ctx);
}
#endif // defined (MASTERSERVER) && defined (HAVE_THREADS)
#endif // defined (MASTERSERVER)
void CL_QueryServerList (msg_server_t *server_list)
{
@ -493,34 +493,41 @@ void CL_UpdateServerList(boolean internetsearch, INT32 room)
#ifdef MASTERSERVER
if (internetsearch)
{
#ifdef HAVE_THREADS
struct Fetch_servers_ctx *ctx;
ctx = malloc(sizeof *ctx);
// This called from M_Refresh so I don't use a mutex
m_waiting_mode = M_WAITING_SERVERS;
I_lock_mutex(&ms_QueryId_mutex);
if (I_can_thread())
{
ctx->id = ms_QueryId;
struct Fetch_servers_ctx *ctx;
ctx = malloc(sizeof *ctx);
// This called from M_Refresh so I don't use a mutex
m_waiting_mode = M_WAITING_SERVERS;
I_lock_mutex(&ms_QueryId_mutex);
{
ctx->id = ms_QueryId;
}
I_unlock_mutex(ms_QueryId_mutex);
ctx->room = room;
if (!I_spawn_thread("fetch-servers", (I_thread_fn)Fetch_servers_thread, ctx))
{
free(ctx);
}
}
I_unlock_mutex(ms_QueryId_mutex);
ctx->room = room;
I_spawn_thread("fetch-servers", (I_thread_fn)Fetch_servers_thread, ctx);
#else
msg_server_t *server_list;
server_list = GetShortServersList(room, 0);
if (server_list)
else
{
CL_QueryServerList(server_list);
free(server_list);
msg_server_t *server_list;
server_list = GetShortServersList(room, 0);
if (server_list)
{
CL_QueryServerList(server_list);
free(server_list);
}
}
#endif
}
#endif // MASTERSERVER
}
@ -1187,13 +1194,9 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
F_TitleScreenDrawer();
}
CL_DrawConnectionStatus();
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex);
#endif
M_Drawer(); //Needed for drawing messageboxes on the connection screen
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex);
#endif
I_UpdateNoVsync(); // page flip or blit buffer
if (moviemode)
M_SaveFrame();

View file

@ -1645,13 +1645,9 @@ void NetUpdate(void)
if (nowtime != resptime)
{
resptime = nowtime;
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex);
#endif
M_Ticker();
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex);
#endif
CON_Ticker();
}

View file

@ -112,6 +112,7 @@ static pauseddownload_t *pauseddownload = NULL;
file_download_t filedownload;
static CURL *http_handle;
static char curl_errbuf[CURL_ERROR_SIZE];
static CURLM *multi_handle;
static UINT32 curl_dlnow;
static UINT32 curl_dltotal;
@ -1604,6 +1605,10 @@ static int curlprogress_callback(void *clientp, curl_off_t dltotal, curl_off_t d
boolean CURLPrepareFile(const char* url, int dfilenum)
{
HTTP_login *login;
CURLcode cc;
if (!I_can_thread())
return false;
#ifdef PARANOIA
if (M_CheckParm("-nodownload"))
@ -1612,13 +1617,32 @@ boolean CURLPrepareFile(const char* url, int dfilenum)
if (!multi_handle)
{
curl_global_init(CURL_GLOBAL_ALL);
multi_handle = curl_multi_init();
cc = curl_global_init(CURL_GLOBAL_ALL);
if (cc < 0)
{
I_OutputMsg("libcurl: curl_global_init() returned %d\n", cc);
}
else
{
multi_handle = curl_multi_init();
}
if (!multi_handle)
{
I_OutputMsg("libcurl: curl_multi_init() failed\n");
curl_global_cleanup();
return false;
}
}
http_handle = curl_easy_init();
if (http_handle && multi_handle)
if (http_handle)
{
CURLMcode mc;
cc = curl_easy_setopt(http_handle, CURLOPT_ERRORBUFFER, curl_errbuf);
if (cc != CURLE_OK) I_OutputMsg("libcurl: CURLOPT_ERRORBUFFER failed\n");
curl_errbuf[0] = 0x00;
I_mkdir(downloaddir, 0755);
curl_curfile = &fileneeded[dfilenum];
@ -1632,50 +1656,76 @@ boolean CURLPrepareFile(const char* url, int dfilenum)
for (INT32 j = 0; j < 16; j++)
sprintf(&md5tmp[j*2], "%02x", curl_curfile->md5sum[j]);
curl_easy_setopt(http_handle, CURLOPT_URL, va("%s/%s?md5=%s", url, curl_realname, md5tmp));
cc = curl_easy_setopt(http_handle, CURLOPT_URL, va("%s/%s?md5=%s", url, curl_realname, md5tmp));
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
// Only allow HTTP and HTTPS
#if (LIBCURL_VERSION_MAJOR <= 7) && (LIBCURL_VERSION_MINOR < 85)
curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS);
cc = curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS);
#else
curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS_STR, "http,https");
cc = curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS_STR, "http,https");
#endif
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
// Set user agent, as some servers won't accept invalid user agents.
curl_easy_setopt(http_handle, CURLOPT_USERAGENT, va("Sonic Robo Blast 2/%s", VERSIONSTRING));
cc = curl_easy_setopt(http_handle, CURLOPT_USERAGENT, va("Sonic Robo Blast 2/%s", VERSIONSTRING));
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
// Authenticate if the user so wishes
login = CURLGetLogin(url, NULL);
if (login)
{
curl_easy_setopt(http_handle, CURLOPT_USERPWD, login->auth);
cc = curl_easy_setopt(http_handle, CURLOPT_USERPWD, login->auth);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
}
// Follow a redirect request, if sent by the server.
curl_easy_setopt(http_handle, CURLOPT_FOLLOWLOCATION, 1L);
cc = curl_easy_setopt(http_handle, CURLOPT_FOLLOWLOCATION, 1L);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
curl_easy_setopt(http_handle, CURLOPT_FAILONERROR, 1L);
cc = curl_easy_setopt(http_handle, CURLOPT_FAILONERROR, 1L);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
CONS_Printf("Downloading addon \"%s\" from %s\n", curl_realname, url);
strcatbf(curl_curfile->filename, downloaddir, "/");
curl_curfile->file = fopen(curl_curfile->filename, "wb");
curl_easy_setopt(http_handle, CURLOPT_WRITEDATA, curl_curfile->file);
curl_easy_setopt(http_handle, CURLOPT_WRITEFUNCTION, curlwrite_data);
curl_easy_setopt(http_handle, CURLOPT_NOPROGRESS, 0L);
curl_easy_setopt(http_handle, CURLOPT_XFERINFOFUNCTION, curlprogress_callback);
cc = curl_easy_setopt(http_handle, CURLOPT_WRITEDATA, curl_curfile->file);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
cc = curl_easy_setopt(http_handle, CURLOPT_WRITEFUNCTION, curlwrite_data);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
cc = curl_easy_setopt(http_handle, CURLOPT_NOPROGRESS, 0L);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
cc = curl_easy_setopt(http_handle, CURLOPT_XFERINFOFUNCTION, curlprogress_callback);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
curl_curfile->status = FS_DOWNLOADING;
curl_multi_add_handle(multi_handle, http_handle);
curl_multi_perform(multi_handle, &curl_runninghandles);
mc = curl_multi_add_handle(multi_handle, http_handle);
if (mc != CURLM_OK) I_OutputMsg("libcurl: %s\n", curl_multi_strerror(mc));
mc = curl_multi_perform(multi_handle, &curl_runninghandles);
if (mc != CURLM_OK) I_OutputMsg("libcurl: %s\n", curl_multi_strerror(mc));
curl_starttime = time(NULL);
filedownload.current = dfilenum;
filedownload.http_running = true;
I_spawn_thread("http-download", (I_thread_fn)CURLGetFile, NULL);
if (!I_spawn_thread("http-download", (I_thread_fn)CURLGetFile, NULL))
{
mc = curl_multi_cleanup(multi_handle);
if (mc != CURLM_OK) I_OutputMsg("libcurl: %s\n", curl_multi_strerror(mc));
curl_global_cleanup();
multi_handle = NULL;
filedownload.http_running = false;
return false;
}
return true;
}
@ -1709,14 +1759,15 @@ void CURLGetFile(void)
{
if (curl_runninghandles)
{
curl_multi_perform(multi_handle, &curl_runninghandles);
mc = curl_multi_perform(multi_handle, &curl_runninghandles);
if (mc != CURLM_OK) I_OutputMsg("libcurl: %s\n", curl_multi_strerror(mc));
/* wait for activity, timeout or "nothing" */
mc = curl_multi_wait(multi_handle, NULL, 0, 1000, NULL);
if (mc != CURLM_OK)
{
CONS_Alert(CONS_WARNING, "curl_multi_wait() failed, code %d.\n", mc);
CONS_Alert(CONS_WARNING, "curl_multi_wait() failed: %s.\n", curl_multi_strerror(mc));
continue;
}
curl_curfile->currentsize = curl_dlnow;
@ -1740,7 +1791,10 @@ void CURLGetFile(void)
long response_code = 0;
if (easyres == CURLE_HTTP_RETURNED_ERROR)
curl_easy_getinfo(e, CURLINFO_RESPONSE_CODE, &response_code);
{
CURLcode cc = curl_easy_getinfo(e, CURLINFO_RESPONSE_CODE, &response_code);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
}
if (response_code == 404)
curl_curfile->failed = FDOWNLOAD_FAIL_NOTFOUND;
@ -1781,7 +1835,8 @@ void CURLGetFile(void)
curl_curfile->file = NULL;
filedownload.remaining--;
curl_multi_remove_handle(multi_handle, e);
mc = curl_multi_remove_handle(multi_handle, e);
if (mc != CURLM_OK) I_OutputMsg("libcurl: %s\n", curl_multi_strerror(mc));
curl_easy_cleanup(e);
if (!filedownload.remaining)
@ -1792,7 +1847,8 @@ void CURLGetFile(void)
if (!filedownload.remaining || !filedownload.http_running)
{
curl_multi_cleanup(multi_handle);
mc = curl_multi_cleanup(multi_handle);
if (mc != CURLM_OK) I_OutputMsg("libcurl: %s\n", curl_multi_strerror(mc));
curl_global_cleanup();
multi_handle = NULL;
}

View file

@ -63,12 +63,14 @@ consvar_t cv_masterserver_token = CVAR_INIT
static int hms_started;
static boolean hms_args_checked;
#ifndef NO_IPV6
static boolean hms_allow_ipv6;
#endif
static boolean hms_allow_ipv4;
static char *hms_api;
#ifdef HAVE_THREADS
static I_mutex hms_api_mutex;
#endif
static char *hms_server_token;
#ifndef NO_IPV6
@ -82,7 +84,8 @@ struct HMS_buffer
CURL *curl;
char *buffer;
int needle;
int end;
int end;
char *errbuf;
};
static void
@ -134,6 +137,18 @@ HMS_on_read (char *s, size_t _1, size_t n, void *userdata)
return n;
}
static void HMS_check_args_once(void)
{
if (hms_args_checked)
return;
#ifndef NO_IPV6
hms_allow_ipv6 = !M_CheckParm("-noipv6");
#endif
hms_allow_ipv4 = !M_CheckParm("-noipv4");
hms_args_checked = true;
}
FUNCDEBUG static struct HMS_buffer *
HMS_connect (int proto, const char *format, ...)
{
@ -144,6 +159,7 @@ HMS_connect (int proto, const char *format, ...)
size_t seek;
size_t token_length;
struct HMS_buffer *buffer;
CURLcode cc;
#ifdef NO_IPV6
if (proto == PROTO_V6)
@ -152,7 +168,6 @@ HMS_connect (int proto, const char *format, ...)
if (! hms_started)
{
hms_allow_ipv6 = !M_CheckParm("-noipv6");
if (curl_global_init(CURL_GLOBAL_ALL) != 0)
{
Contact_error();
@ -168,7 +183,7 @@ HMS_connect (int proto, const char *format, ...)
curl = curl_easy_init();
if (! curl)
if (!curl)
{
Contact_error();
Blame("From curl_easy_init.\n");
@ -186,9 +201,7 @@ HMS_connect (int proto, const char *format, ...)
token_length = 0;
}
#ifdef HAVE_THREADS
I_lock_mutex(&hms_api_mutex);
#endif
init_user_agent_once();
@ -200,9 +213,7 @@ HMS_connect (int proto, const char *format, ...)
sprintf(url, "%s/", hms_api);
#ifdef HAVE_THREADS
I_unlock_mutex(hms_api_mutex);
#endif
va_start (ap, format);
seek += vsprintf(&url[seek], format, ap);
@ -218,34 +229,65 @@ HMS_connect (int proto, const char *format, ...)
buffer->end = DEFAULT_BUFFER_SIZE;
buffer->buffer = malloc(buffer->end);
buffer->needle = 0;
buffer->errbuf = malloc(CURL_ERROR_SIZE);
buffer->errbuf[0] = 0x00;
cc = curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, buffer->errbuf);
if (cv_masterserver_debug.value)
{
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_STDERR, logstream);
cc = curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
cc = curl_easy_setopt(curl, CURLOPT_STDERR, logstream);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
}
if (M_CheckParm("-bindaddr") && M_IsNextParm())
{
curl_easy_setopt(curl, CURLOPT_INTERFACE, M_GetNextParm());
}
cc = curl_easy_setopt(curl, CURLOPT_URL, url);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 30L);
cc = curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
#ifndef NO_IPV6
if (proto == PROTO_V6)
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6);
if (proto == PROTO_V4)
if (proto == PROTO_V6 || (proto == PROTO_ANY && !hms_allow_ipv4))
{
cc = curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
if (M_CheckParm("-bindaddr6") && M_IsNextParm())
{
cc = curl_easy_setopt(curl, CURLOPT_INTERFACE, M_GetNextParm());
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
}
}
if (proto == PROTO_V4 || (proto == PROTO_ANY && !hms_allow_ipv6))
#endif
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
{
cc = curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, cv_masterserver_timeout.value);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, HMS_on_read);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, buffer);
if (M_CheckParm("-bindaddr") && M_IsNextParm())
{
cc = curl_easy_setopt(curl, CURLOPT_INTERFACE, M_GetNextParm());
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
}
}
curl_easy_setopt(curl, CURLOPT_USERAGENT, hms_useragent);
cc = curl_easy_setopt(curl, CURLOPT_TIMEOUT, cv_masterserver_timeout.value);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
cc = curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 30L);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
cc = curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, HMS_on_read);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
cc = curl_easy_setopt(curl, CURLOPT_WRITEDATA, buffer);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
cc = curl_easy_setopt(curl, CURLOPT_USERAGENT, hms_useragent);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
curl_free(quack_token);
free(url);
@ -267,15 +309,15 @@ HMS_do (struct HMS_buffer *buffer)
{
Contact_error();
Blame(
"From curl_easy_perform: %s\n",
curl_easy_strerror(cc)
"From curl_easy_perform: %s\n", buffer->errbuf
);
return 0;
}
buffer->buffer[buffer->needle] = '\0';
curl_easy_getinfo(buffer->curl, CURLINFO_RESPONSE_CODE, &status);
cc = curl_easy_getinfo(buffer->curl, CURLINFO_RESPONSE_CODE, &status);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
if (status != 200)
{
@ -327,6 +369,8 @@ HMS_fetch_rooms (int joining, int query_id)
(void)query_id;
HMS_check_args_once();
hms = HMS_connect(PROTO_ANY, "rooms");
if (! hms)
@ -356,7 +400,6 @@ HMS_fetch_rooms (int joining, int query_id)
*/
if (joining || id_no != 0)
{
#ifdef HAVE_THREADS
I_lock_mutex(&ms_QueryId_mutex);
{
if (query_id != ms_QueryId)
@ -366,7 +409,6 @@ HMS_fetch_rooms (int joining, int query_id)
if (! doing_shit)
break;
#endif
room_list[i].header.buffer[0] = 1;
@ -390,9 +432,7 @@ HMS_fetch_rooms (int joining, int query_id)
if (doing_shit)
{
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex);
#endif
{
for (i = 0; room_list[i].header.buffer[0]; i++)
{
@ -404,9 +444,7 @@ HMS_fetch_rooms (int joining, int query_id)
}
}
}
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex);
#endif
}
}
else
@ -421,18 +459,15 @@ int
HMS_register (void)
{
struct HMS_buffer *hms;
int ok;
int ok = 0;
char post[256];
char *title;
hms = HMS_connect(PROTO_V4, "rooms/%d/register", cv_masterserver_room_id.value);
HMS_check_args_once();
if (! hms)
return 0;
title = curl_easy_escape(hms->curl, cv_servername.string, 0);
title = curl_easy_escape(NULL, cv_servername.string, 0);
snprintf(post, sizeof post,
"port=%d&"
@ -448,16 +483,24 @@ HMS_register (void)
curl_free(title);
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDS, post);
ok = HMS_do(hms);
if (ok)
if (hms_allow_ipv4)
{
hms_server_token = strdup(strtok(hms->buffer, "\n"));
}
hms = HMS_connect(PROTO_V4, "rooms/%d/register", cv_masterserver_room_id.value);
HMS_end(hms);
if (! hms)
return 0;
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDS, post);
ok = HMS_do(hms);
if (ok)
{
hms_server_token = strdup(strtok(hms->buffer, "\n"));
}
HMS_end(hms);
}
#ifndef NO_IPV6
if (!hms_allow_ipv6)
@ -489,7 +532,9 @@ HMS_unlist (void)
struct HMS_buffer *hms;
int ok = 0;
if (hms_server_token)
HMS_check_args_once();
if (hms_server_token && hms_allow_ipv4)
{
hms = HMS_connect(PROTO_V4, "servers/%s/unlist", hms_server_token);
@ -536,6 +581,7 @@ HMS_update (void)
char *title;
HMS_check_args_once();
title = curl_easy_escape(NULL, cv_servername.string, 0);
snprintf(post, sizeof post,
@ -545,7 +591,7 @@ HMS_update (void)
curl_free(title);
if (hms_server_token)
if (hms_server_token && hms_allow_ipv4)
{
hms = HMS_connect(PROTO_V4, "servers/%s/update", hms_server_token);
@ -584,6 +630,8 @@ HMS_list_servers (void)
char *list;
char *p;
HMS_check_args_once();
hms = HMS_connect(PROTO_ANY, "servers");
if (! hms)
@ -629,6 +677,8 @@ HMS_fetch_servers (msg_server_t *list, int room_number, int query_id)
int i;
HMS_check_args_once();
(void)query_id;
if (room_number > 0)
@ -675,7 +725,6 @@ HMS_fetch_servers (msg_server_t *list, int room_number, int query_id)
if (address && port && title && version)
{
#ifdef HAVE_THREADS
I_lock_mutex(&ms_QueryId_mutex);
{
if (query_id != ms_QueryId)
@ -685,7 +734,6 @@ HMS_fetch_servers (msg_server_t *list, int room_number, int query_id)
if (! doing_shit)
break;
#endif
if (strcmp(version, local_version) == 0)
{
@ -740,6 +788,8 @@ HMS_compare_mod_version (char *buffer, size_t buffer_size)
char *version;
char *version_name;
HMS_check_args_once();
hms = HMS_connect(PROTO_ANY, "versions/%d", MODID);
if (! hms)
@ -772,16 +822,12 @@ HMS_compare_mod_version (char *buffer, size_t buffer_size)
void
HMS_set_api (char *api)
{
#ifdef HAVE_THREADS
I_lock_mutex(&hms_api_mutex);
#endif
{
free(hms_api);
hms_api = api;
}
#ifdef HAVE_THREADS
I_unlock_mutex(hms_api_mutex);
#endif
}
#endif/*MASTERSERVER*/

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2024 by Sonic Team Junior.
// Copyright (C) 1999-2025 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@ -274,9 +274,18 @@ static void init_upnpc_once(struct upnpdata *upnpdata);
static void I_InitUPnP(void)
{
if (!I_can_thread())
{
UPNP_support = false;
return;
}
upnpuser = malloc(sizeof *upnpuser);
upnpuser->upnpc_started = 0;
I_spawn_thread("init_upnpc_once", (I_thread_fn)init_upnpc_once, upnpuser);
if (!I_spawn_thread("init_upnpc_once", (I_thread_fn)init_upnpc_once, upnpuser))
{
UPNP_support = false;
free(upnpuser);
}
}
static void
@ -386,6 +395,7 @@ static const char *SOCK_AddrToStr(mysockaddr_t *sk)
int v6 = 0;
#endif
void *addr;
int e = 0; // save error code so it can't be modified later code and avoid calling WSAGetLastError() more then once
if(sk->any.sa_family == AF_INET)
addr = &sk->ip4.sin_addr;
@ -399,7 +409,10 @@ static const char *SOCK_AddrToStr(mysockaddr_t *sk)
if(addr == NULL)
sprintf(s, "No address");
else if(inet_ntop(sk->any.sa_family, addr, &s[v6], sizeof (s) - v6) == NULL)
sprintf(s, "Unknown family type, error #%u", errno);
{
e = errno;
sprintf(s, "Unknown family type, error #%u: %s", e, strerror(e));
}
#ifdef HAVE_IPV6
else if(sk->any.sa_family == AF_INET6)
{
@ -456,6 +469,8 @@ static boolean SOCK_cmpipv6(mysockaddr_t *a, mysockaddr_t *b, UINT8 mask)
{
UINT8 bitmask;
I_Assert(mask <= 128);
if (mask == 0)
mask = 128;
if (memcmp(&a->ip6.sin6_addr.s6_addr, &b->ip6.sin6_addr.s6_addr, mask / 8) != 0)
return false;
if (mask % 8 == 0)
@ -650,11 +665,12 @@ static inline ssize_t SOCK_SendToAddr(SOCKET_TYPE socket, mysockaddr_t *sockaddr
return sendto(socket, (char *)&doomcom->data, doomcom->datalength, 0, &sockaddr->any, d);
}
#define ALLOWEDERROR(x) ((x) == ECONNREFUSED || (x) == EWOULDBLOCK || (x) == EHOSTUNREACH || (x) == ENETUNREACH)
#define ALLOWEDERROR(x) ((x) == ECONNREFUSED || (x) == EWOULDBLOCK || (x) == EHOSTUNREACH || (x) == ENETUNREACH || (x) == EADDRNOTAVAIL)
static void SOCK_Send(void)
{
ssize_t c = ERRSOCKET;
int e = 0; // save error code so it can't be modified later code and avoid calling WSAGetLastError() more then once
if (!nodeconnected[doomcom->remotenode])
return;
@ -668,8 +684,12 @@ static void SOCK_Send(void)
if (myfamily[i] == broadcastaddress[j].any.sa_family)
{
c = SOCK_SendToAddr(mysockets[i], &broadcastaddress[j]);
if (c == ERRSOCKET && !ALLOWEDERROR(errno))
break;
if (c == ERRSOCKET)
{
e = errno;
if (!ALLOWEDERROR(e))
break;
}
}
}
}
@ -681,21 +701,28 @@ static void SOCK_Send(void)
if (myfamily[i] == clientaddress[doomcom->remotenode].any.sa_family)
{
c = SOCK_SendToAddr(mysockets[i], &clientaddress[doomcom->remotenode]);
if (c == ERRSOCKET && !ALLOWEDERROR(errno))
break;
if (c == ERRSOCKET)
{
e = errno;
if (!ALLOWEDERROR(e))
break;
}
}
}
}
else
{
c = SOCK_SendToAddr(nodesocket[doomcom->remotenode], &clientaddress[doomcom->remotenode]);
if (c == ERRSOCKET)
{
e = errno;
}
}
if (c == ERRSOCKET)
if (c == ERRSOCKET && e != 0) // 0 means no socket for the address family was found
{
int e = errno; // save error code so it can't be modified later
if (!ALLOWEDERROR(e))
I_Error("SOCK_Send, error sending to node %d (%s) #%u: %s", doomcom->remotenode,
I_Error("SOCK_Send, error sending to node %d (%s) #%u, %s", doomcom->remotenode,
SOCK_GetNodeAddress(doomcom->remotenode), e, strerror(e));
}
}
@ -726,6 +753,8 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
{
SOCKET_TYPE s = socket(family, SOCK_DGRAM, IPPROTO_UDP);
int opt;
int rc;
int e = 0; // save error code so it can't be modified later code and avoid calling WSAGetLastError() more then once
socklen_t opts;
#ifdef FIONBIO
unsigned long trueval = true;
@ -740,12 +769,17 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
#ifdef USE_WINSOCK2
DWORD dwBytesReturned = 0;
BOOL bfalse = FALSE;
WSAIoctl(s, SIO_UDP_CONNRESET, &bfalse, sizeof(bfalse),
rc = WSAIoctl(s, SIO_UDP_CONNRESET, &bfalse, sizeof(bfalse),
NULL, 0, &dwBytesReturned, NULL, NULL);
#else
unsigned long falseval = false;
ioctl(s, SIO_UDP_CONNRESET, &falseval);
rc = ioctl(s, SIO_UDP_CONNRESET, &falseval);
#endif
if (rc == -1)
{
e = errno;
I_OutputMsg("SIO_UDP_CONNRESET failed: #%u, %s\n", e, strerror(e));
}
}
#endif
@ -758,14 +792,22 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
{
opt = true;
opts = (socklen_t)sizeof(opt);
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, opts);
rc = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, opts);
if (rc <= -1)
{
e = errno;
I_OutputMsg("setting SO_REUSEADDR failed: #%u, %s\n", e, strerror(e));
}
}
// make it broadcastable
opt = true;
opts = (socklen_t)sizeof(opt);
if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, (char *)&opt, opts))
rc = setsockopt(s, SOL_SOCKET, SO_BROADCAST, (char *)&opt, opts);
if (rc <= -1)
{
e = errno;
CONS_Alert(CONS_WARNING, M_GetText("Could not get broadcast rights\n")); // I do not care anymore
I_OutputMsg("setting SO_BROADCAST failed: #%u, %s\n", e, strerror(e));
}
}
#ifdef HAVE_IPV6
@ -775,24 +817,34 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
{
opt = true;
opts = (socklen_t)sizeof(opt);
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, opts);
rc = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, opts);
if (rc <= -1)
{
e = errno;
I_OutputMsg("setting SO_REUSEADDR failed: #%u, %s\n", e, strerror(e));
}
}
#ifdef IPV6_V6ONLY
// make it IPv6 ony
opt = true;
opts = (socklen_t)sizeof(opt);
if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&opt, opts))
rc = setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&opt, opts);
if (rc <= -1)
{
e = errno;
CONS_Alert(CONS_WARNING, M_GetText("Could not limit IPv6 bind\n")); // I do not care anymore
I_OutputMsg("setting IPV6_V6ONLY failed: #%u, %s\n", e, strerror(e));
}
#endif
}
#endif
if (bind(s, addr, addrlen) == ERRSOCKET)
rc = bind(s, addr, addrlen);
if (rc == ERRSOCKET)
{
e = errno;
close(s);
I_OutputMsg("Binding failed\n");
I_OutputMsg("Binding failed: #%u, %s\n", e, strerror(e));
return (SOCKET_TYPE)ERRSOCKET;
}
@ -806,9 +858,18 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
inet_pton(AF_INET6, IPV6_MULTICAST_ADDRESS, &maddr.ipv6mr_multiaddr);
maddr.ipv6mr_interface = 0;
if (setsockopt(s, IPPROTO_IPV6, IPV6_JOIN_GROUP, (const char *)&maddr, sizeof(maddr)) != 0)
rc = setsockopt(s, IPPROTO_IPV6, IPV6_JOIN_GROUP, (const char *)&maddr, sizeof(maddr));
if (rc <= -1)
{
e = errno;
CONS_Alert(CONS_WARNING, M_GetText("Could not register multicast address\n"));
if (e == ENODEV)
{
close(s);
I_OutputMsg("Binding failed: no IPv6 device\n");
return (SOCKET_TYPE)ERRSOCKET;
}
I_OutputMsg("setting IPV6_JOIN_GROUP failed: #%u, %s \n", e, strerror(e));
}
}
}
@ -816,33 +877,56 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
#ifdef FIONBIO
// make it non blocking
opt = true;
if (ioctl(s, FIONBIO, &trueval) != 0)
rc = ioctl(s, FIONBIO, &trueval);
if (rc == -1)
{
e = errno;
close(s);
I_OutputMsg("Seting FIOBIO on failed\n");
I_OutputMsg("FIOBIO failed: #%u, %s\n", e, strerror(e));
return (SOCKET_TYPE)ERRSOCKET;
}
#endif
opt = 0;
opts = (socklen_t)sizeof(opt);
getsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&opt, &opts);
rc = getsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&opt, &opts);
if (rc <= -1)
{
e = errno;
I_OutputMsg("getting SO_RCVBUF failed: #%u, %s\n", e, strerror(e));
}
CONS_Printf(M_GetText("Network system buffer: %dKb\n"), opt>>10);
if (opt < 64<<10) // 64k
{
opt = 64<<10;
opts = (socklen_t)sizeof(opt);
setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&opt, opts);
getsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&opt, &opts);
if (opt < 64<<10)
rc = setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&opt, opts);
if (rc <= -1)
{
e = errno;
I_OutputMsg("setting SO_RCVBUF failed: #%u, %s\n", e, strerror(e));
}
opt = 0;
rc = getsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&opt, &opts);
if (rc <= -1)
{
e = errno;
I_OutputMsg("getting SO_RCVBUF failed: #%u, %s\n", e, strerror(e));
}
if (opt <= 64<<10)
CONS_Alert(CONS_WARNING, M_GetText("Can't set buffer length to 64k, file transfer will be bad\n"));
else
CONS_Printf(M_GetText("Network system buffer set to: %dKb\n"), opt>>10);
}
if (getsockname(s, &straddr.any, &len) == -1)
rc = getsockname(s, &straddr.any, &len);
if (rc != 0)
{
e = errno;
CONS_Alert(CONS_WARNING, M_GetText("Failed to get port number\n"));
I_OutputMsg("getsockname failed: #%u, %s\n", e, strerror(e));
}
else
{
if (family == AF_INET)
@ -864,6 +948,7 @@ static boolean UDP_Socket(void)
#ifdef HAVE_IPV6
const INT32 b_ipv6 = !M_CheckParm("-noipv6");
#endif
const INT32 b_ipv4 = !M_CheckParm("-noipv4");
const char *serv;
@ -879,16 +964,45 @@ static boolean UDP_Socket(void)
hints.ai_socktype = SOCK_DGRAM;
hints.ai_protocol = IPPROTO_UDP;
#ifdef HAVE_IPV6
if (!b_ipv6)
I_OutputMsg("Disabling IPv6 support at runtime\n");
#else
I_OutputMsg("Compiled without IPv6 support\n");
#endif
if (serverrunning)
serv = serverport_name;
else
serv = clientport_name;
if (M_CheckParm("-bindaddr"))
if (b_ipv4)
{
while (M_IsNextParm())
if (M_CheckParm("-bindaddr"))
{
gaie = I_getaddrinfo(M_GetNextParm(), serv, &hints, &ai);
while (M_IsNextParm())
{
gaie = I_getaddrinfo(M_GetNextParm(), serv, &hints, &ai);
if (gaie == 0)
{
runp = ai;
while (runp != NULL && s < MAXNETNODES+1)
{
mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen);
if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET)
{
myfamily[s] = hints.ai_family;
s++;
}
runp = runp->ai_next;
}
I_freeaddrinfo(ai);
}
}
}
else
{
gaie = I_getaddrinfo("0.0.0.0", serv, &hints, &ai);
if (gaie == 0)
{
runp = ai;
@ -899,6 +1013,13 @@ static boolean UDP_Socket(void)
{
myfamily[s] = hints.ai_family;
s++;
#ifdef HAVE_MINIUPNPC
if (UPNP_support)
{
I_UPnP_rem(serverport_name, "UDP");
I_UPnP_add(NULL, serverport_name, "UDP");
}
#endif
}
runp = runp->ai_next;
}
@ -906,32 +1027,6 @@ static boolean UDP_Socket(void)
}
}
}
else
{
gaie = I_getaddrinfo("0.0.0.0", serv, &hints, &ai);
if (gaie == 0)
{
runp = ai;
while (runp != NULL && s < MAXNETNODES+1)
{
mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen);
if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET)
{
myfamily[s] = hints.ai_family;
s++;
#ifdef HAVE_MINIUPNPC
if (UPNP_support)
{
I_UPnP_rem(serverport_name, "UDP");
I_UPnP_add(NULL, serverport_name, "UDP");
}
#endif
}
runp = runp->ai_next;
}
I_freeaddrinfo(ai);
}
}
#ifdef HAVE_IPV6
if (b_ipv6)
{
@ -996,11 +1091,14 @@ static boolean UDP_Socket(void)
s = 0;
// setup broadcast adress to BROADCASTADDR entry
broadcastaddress[s].any.sa_family = AF_INET;
broadcastaddress[s].ip4.sin_port = htons(atoi(DEFAULTPORT));
broadcastaddress[s].ip4.sin_addr.s_addr = htonl(INADDR_BROADCAST);
s++;
if (b_ipv4)
{
// setup broadcast adress to BROADCASTADDR entry
broadcastaddress[s].any.sa_family = AF_INET;
broadcastaddress[s].ip4.sin_port = htons(atoi(DEFAULTPORT));
broadcastaddress[s].ip4.sin_addr.s_addr = htonl(INADDR_BROADCAST);
s++;
}
#ifdef HAVE_IPV6
if (b_ipv6)
@ -1024,6 +1122,12 @@ static boolean UDP_Socket(void)
boolean I_InitTcpDriver(void)
{
boolean tcp_was_up = init_tcp_driver;
#ifdef __EMSCRIPTEN__
I_OutputMsg("Compiled without networking support\n");
return false;
#endif
if (!init_tcp_driver)
{
#ifdef USE_WINSOCK
@ -1129,7 +1233,7 @@ static SINT8 SOCK_NetMakeNodewPort(const char *address, const char *port)
DEBFILE(va("Creating new node: %s@%s\n", address, port));
memset (&hints, 0x00, sizeof (hints));
hints.ai_flags = 0;
hints.ai_flags = AI_ADDRCONFIG;
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_DGRAM;
hints.ai_protocol = IPPROTO_UDP;
@ -1159,7 +1263,7 @@ static SINT8 SOCK_NetMakeNodewPort(const char *address, const char *port)
}
}
if (i < mysocketses)
if (i >= mysocketses)
runp = runp->ai_next;
else
break;

View file

@ -35,16 +35,11 @@ static boolean MSUpdateAgain;
static time_t MSLastPing;
#ifdef HAVE_THREADS
static I_mutex MSMutex;
static I_cond MSCond;
# define Lock_state() I_lock_mutex (&MSMutex)
# define Unlock_state() I_unlock_mutex (MSMutex)
#else/*HAVE_THREADS*/
# define Lock_state()
# define Unlock_state()
#endif/*HAVE_THREADS*/
static void Command_Listserv_f(void);
@ -72,13 +67,11 @@ consvar_t cv_masterserver_room_id = CVAR_INIT ("masterserver_room_id", "-1", CV_
static INT16 ms_RoomId = -1;
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
int ms_QueryId;
I_mutex ms_QueryId_mutex;
msg_server_t *ms_ServerList;
I_mutex ms_ServerList_mutex;
#endif
UINT16 current_port = 0;
@ -110,13 +103,9 @@ void AddMServCommands(void)
static void WarnGUI (void)
{
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex);
#endif
M_StartMessage(M_GetText("There was a problem connecting to\nthe Master Server\n\nCheck the console for details.\n"), NULL, MM_NOTHING);
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex);
#endif
}
#define NUM_LIST_SERVER MAXSERVERLIST
@ -160,14 +149,12 @@ char *GetMODVersion(int id)
c = HMS_compare_mod_version(buffer, 16);
#ifdef HAVE_THREADS
I_lock_mutex(&ms_QueryId_mutex);
{
if (id != ms_QueryId)
c = -1;
}
I_unlock_mutex(ms_QueryId_mutex);
#endif
if (c > 0)
return buffer;
@ -294,9 +281,7 @@ Finish_unlist (void)
}
Unlock_state();
#ifdef HAVE_THREADS
I_wake_all_cond(&MSCond);
#endif
}
Lock_state();
@ -307,7 +292,6 @@ Finish_unlist (void)
Unlock_state();
}
#ifdef HAVE_THREADS
static int *
Server_id (void)
{
@ -402,53 +386,67 @@ Change_masterserver_thread (char *api)
HMS_set_api(api);
}
#endif/*HAVE_THREADS*/
void RegisterServer(void)
{
#ifdef MASTERSERVER
#ifdef HAVE_THREADS
I_spawn_thread(
"register-server",
(I_thread_fn)Register_server_thread,
New_server_id()
);
#else
Finish_registration();
#endif
#endif/*MASTERSERVER*/
if (I_can_thread())
{
void *nsid = New_server_id();
if (!I_spawn_thread(
"register-server",
(I_thread_fn)Register_server_thread,
nsid
))
{
free(nsid);
}
}
else
{
Finish_registration();
}
}
static void UpdateServer(void)
{
#ifdef HAVE_THREADS
I_spawn_thread(
"update-server",
(I_thread_fn)Update_server_thread,
Server_id()
);
#else
Finish_update();
#endif
if (I_can_thread())
{
void *sid = Server_id();
if (!I_spawn_thread(
"update-server",
(I_thread_fn)Update_server_thread,
sid
))
{
free(sid);
}
}
else
{
Finish_update();
}
}
void UnregisterServer(void)
{
#ifdef MASTERSERVER
#ifdef HAVE_THREADS
I_spawn_thread(
"unlist-server",
(I_thread_fn)Unlist_server_thread,
Server_id()
);
#else
Finish_unlist();
#endif
#endif/*MASTERSERVER*/
if (I_can_thread())
{
if (!I_spawn_thread(
"unlist-server",
(I_thread_fn)Unlist_server_thread,
Server_id()
))
{
;
}
}
else
{
Finish_unlist();
}
}
static boolean
Online (void)
static boolean Online(void)
{
return ( serverrunning && cv_masterserver_room_id.value > 0 );
}
@ -482,26 +480,35 @@ static inline void SendPingToMasterServer(void)
void MasterClient_Ticker(void)
{
#ifdef MASTERSERVER
SendPingToMasterServer();
#endif
}
static void
Set_api (const char *api)
{
#ifdef HAVE_THREADS
I_spawn_thread(
"change-masterserver",
(I_thread_fn)Change_masterserver_thread,
strdup(api)
);
#else
HMS_set_api(strdup(api));
#endif
char *dapi = strdup(api);
if (I_can_thread())
{
if (!I_spawn_thread(
"change-masterserver",
(I_thread_fn)Change_masterserver_thread,
dapi
))
{
free(dapi);
}
}
else
{
HMS_set_api(dapi);
}
}
#else /*MASTERSERVER*/
#endif/*MASTERSERVER*/
void RegisterServer(void) {}
void UnregisterServer(void) {}
#endif
static boolean ServerName_CanChange(const char* newvalue)
{
@ -544,7 +551,9 @@ static void RoomId_OnChange(void)
{
UnregisterServer();
ms_RoomId = cv_masterserver_room_id.value;
#ifdef MASTERSERVER
if (Online())
#endif
RegisterServer();
}
}

View file

@ -71,13 +71,11 @@ extern consvar_t cv_masterserver_timeout;
extern consvar_t cv_masterserver_debug;
extern consvar_t cv_masterserver_token;
#ifdef HAVE_THREADS
extern int ms_QueryId;
extern I_mutex ms_QueryId_mutex;
extern msg_server_t *ms_ServerList;
extern I_mutex ms_ServerList_mutex;
#endif
void RegisterServer(void);
void UnregisterServer(void);

View file

@ -302,7 +302,7 @@ typedef enum
DRONE = 0x80,
} player_saveflags;
static inline void P_ArchivePlayer(save_t *save_p)
FUNCINLINE static ATTRINLINE void P_ArchivePlayer(save_t *save_p)
{
const player_t *player = &players[consoleplayer];
SINT8 pllives = player->lives;
@ -334,7 +334,7 @@ static inline void P_ArchivePlayer(save_t *save_p)
P_WriteINT32(save_p, player->continues);
}
static inline void P_UnArchivePlayer(save_t *save_p)
FUNCINLINE static ATTRINLINE void P_UnArchivePlayer(save_t *save_p)
{
#ifdef NEWSKINSAVES
INT16 backwardsCompat = P_ReadUINT16(save_p);
@ -2088,7 +2088,7 @@ typedef enum
tc_end
} specials_e;
static inline UINT32 SaveMobjnum(const mobj_t *mobj)
FUNCINLINE static ATTRINLINE UINT32 SaveMobjnum(const mobj_t *mobj)
{
if (mobj) return mobj->mobjnum;
return 0;
@ -2106,7 +2106,7 @@ static UINT32 SaveLine(const line_t *line)
return 0xFFFFFFFF;
}
static inline UINT32 SavePlayer(const player_t *player)
FUNCINLINE static ATTRINLINE UINT32 SavePlayer(const player_t *player)
{
if (player) return (UINT32)(player - players);
return 0xFFFFFFFF;
@ -2646,7 +2646,7 @@ static void SaveGlowThinker(save_t *save_p, const thinker_t *th, const UINT8 typ
P_WriteINT16(save_p, ht->speed);
}
static inline void SaveFireflickerThinker(save_t *save_p, const thinker_t *th, const UINT8 type)
FUNCINLINE static ATTRINLINE void SaveFireflickerThinker(save_t *save_p, const thinker_t *th, const UINT8 type)
{
const fireflicker_t *ht = (const void *)th;
P_WriteUINT8(save_p, type);
@ -2696,7 +2696,7 @@ static void SaveCrumbleThinker(save_t *save_p, const thinker_t *th, const UINT8
P_WriteUINT8(save_p, ht->flags);
}
static inline void SaveScrollThinker(save_t *save_p, const thinker_t *th, const UINT8 type)
FUNCINLINE static ATTRINLINE void SaveScrollThinker(save_t *save_p, const thinker_t *th, const UINT8 type)
{
const scroll_t *ht = (const void *)th;
P_WriteUINT8(save_p, type);
@ -2712,7 +2712,7 @@ static inline void SaveScrollThinker(save_t *save_p, const thinker_t *th, const
P_WriteUINT8(save_p, ht->type);
}
static inline void SaveFrictionThinker(save_t *save_p, const thinker_t *th, const UINT8 type)
FUNCINLINE static ATTRINLINE void SaveFrictionThinker(save_t *save_p, const thinker_t *th, const UINT8 type)
{
const friction_t *ht = (const void *)th;
P_WriteUINT8(save_p, type);
@ -2723,7 +2723,7 @@ static inline void SaveFrictionThinker(save_t *save_p, const thinker_t *th, cons
P_WriteUINT8(save_p, ht->roverfriction);
}
static inline void SavePusherThinker(save_t *save_p, const thinker_t *th, const UINT8 type)
FUNCINLINE static ATTRINLINE void SavePusherThinker(save_t *save_p, const thinker_t *th, const UINT8 type)
{
const pusher_t *ht = (const void *)th;
P_WriteUINT8(save_p, type);
@ -2828,7 +2828,7 @@ static void SavePlaneDisplaceThinker(save_t *save_p, const thinker_t *th, const
P_WriteUINT8(save_p, ht->type);
}
static inline void SaveDynamicLineSlopeThinker(save_t *save_p, const thinker_t *th, const UINT8 type)
FUNCINLINE static ATTRINLINE void SaveDynamicLineSlopeThinker(save_t *save_p, const thinker_t *th, const UINT8 type)
{
const dynlineplanethink_t* ht = (const void*)th;
@ -2839,7 +2839,7 @@ static inline void SaveDynamicLineSlopeThinker(save_t *save_p, const thinker_t *
P_WriteFixed(save_p, ht->extent);
}
static inline void SaveDynamicVertexSlopeThinker(save_t *save_p, const thinker_t *th, const UINT8 type)
FUNCINLINE static ATTRINLINE void SaveDynamicVertexSlopeThinker(save_t *save_p, const thinker_t *th, const UINT8 type)
{
size_t i;
const dynvertexplanethink_t* ht = (const void*)th;
@ -2854,7 +2854,7 @@ static inline void SaveDynamicVertexSlopeThinker(save_t *save_p, const thinker_t
P_WriteUINT8(save_p, ht->relative);
}
static inline void SavePolyrotatetThinker(save_t *save_p, const thinker_t *th, const UINT8 type)
FUNCINLINE static ATTRINLINE void SavePolyrotatetThinker(save_t *save_p, const thinker_t *th, const UINT8 type)
{
const polyrotate_t *ht = (const void *)th;
P_WriteUINT8(save_p, type);
@ -3219,7 +3219,7 @@ mobj_t *P_FindNewPosition(UINT32 oldposition)
return NULL;
}
static inline mobj_t *LoadMobj(UINT32 mobjnum)
FUNCINLINE static ATTRINLINE mobj_t *LoadMobj(UINT32 mobjnum)
{
if (mobjnum == 0) return NULL;
return (mobj_t *)(size_t)mobjnum;
@ -3237,13 +3237,13 @@ static line_t *LoadLine(UINT32 line)
return &lines[line];
}
static inline player_t *LoadPlayer(UINT32 player)
FUNCINLINE static ATTRINLINE player_t *LoadPlayer(UINT32 player)
{
if (player >= MAXPLAYERS) return NULL;
return &players[player];
}
static inline pslope_t *LoadSlope(UINT32 slopeid)
FUNCINLINE static ATTRINLINE pslope_t* LoadSlope(UINT32 slopeid)
{
pslope_t *p = slopelist;
if (slopeid > slopecount) return NULL;
@ -3887,7 +3887,7 @@ static thinker_t* LoadScrollThinker(save_t *save_p, actionf_p1 thinker)
return &ht->thinker;
}
static inline thinker_t* LoadFrictionThinker(save_t *save_p, actionf_p1 thinker)
FUNCINLINE static ATTRINLINE thinker_t *LoadFrictionThinker(save_t *save_p, actionf_p1 thinker)
{
friction_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
ht->thinker.function.acp1 = thinker;
@ -3915,7 +3915,7 @@ static thinker_t* LoadPusherThinker(save_t *save_p, actionf_p1 thinker)
return &ht->thinker;
}
static inline thinker_t* LoadLaserThinker(save_t *save_p, actionf_p1 thinker)
FUNCINLINE static ATTRINLINE thinker_t *LoadLaserThinker(save_t *save_p, actionf_p1 thinker)
{
laserthink_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
ht->thinker.function.acp1 = thinker;
@ -3925,7 +3925,7 @@ static inline thinker_t* LoadLaserThinker(save_t *save_p, actionf_p1 thinker)
return &ht->thinker;
}
static inline thinker_t* LoadLightlevelThinker(save_t *save_p, actionf_p1 thinker)
FUNCINLINE static ATTRINLINE thinker_t *LoadLightlevelThinker(save_t *save_p, actionf_p1 thinker)
{
lightlevel_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
ht->thinker.function.acp1 = thinker;
@ -3940,7 +3940,7 @@ static inline thinker_t* LoadLightlevelThinker(save_t *save_p, actionf_p1 thinke
return &ht->thinker;
}
static inline thinker_t* LoadExecutorThinker(save_t *save_p, actionf_p1 thinker)
FUNCINLINE static ATTRINLINE thinker_t *LoadExecutorThinker(save_t *save_p, actionf_p1 thinker)
{
executor_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
ht->thinker.function.acp1 = thinker;
@ -3951,7 +3951,7 @@ static inline thinker_t* LoadExecutorThinker(save_t *save_p, actionf_p1 thinker)
return &ht->thinker;
}
static inline thinker_t* LoadDisappearThinker(save_t *save_p, actionf_p1 thinker)
FUNCINLINE static ATTRINLINE thinker_t *LoadDisappearThinker(save_t *save_p, actionf_p1 thinker)
{
disappear_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
ht->thinker.function.acp1 = thinker;
@ -3965,7 +3965,7 @@ static inline thinker_t* LoadDisappearThinker(save_t *save_p, actionf_p1 thinker
return &ht->thinker;
}
static inline thinker_t* LoadFadeThinker(save_t *save_p, actionf_p1 thinker)
FUNCINLINE static ATTRINLINE thinker_t *LoadFadeThinker(save_t *save_p, actionf_p1 thinker)
{
sector_t *ss;
fade_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -4007,7 +4007,7 @@ static inline thinker_t* LoadFadeThinker(save_t *save_p, actionf_p1 thinker)
return &ht->thinker;
}
static inline thinker_t* LoadFadeColormapThinker(save_t *save_p, actionf_p1 thinker)
FUNCINLINE static ATTRINLINE thinker_t *LoadFadeColormapThinker(save_t *save_p, actionf_p1 thinker)
{
fadecolormap_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
ht->thinker.function.acp1 = thinker;
@ -4022,7 +4022,7 @@ static inline thinker_t* LoadFadeColormapThinker(save_t *save_p, actionf_p1 thin
return &ht->thinker;
}
static inline thinker_t* LoadPlaneDisplaceThinker(save_t *save_p, actionf_p1 thinker)
FUNCINLINE static ATTRINLINE thinker_t *LoadPlaneDisplaceThinker(save_t *save_p, actionf_p1 thinker)
{
planedisplace_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
ht->thinker.function.acp1 = thinker;
@ -4035,7 +4035,7 @@ static inline thinker_t* LoadPlaneDisplaceThinker(save_t *save_p, actionf_p1 thi
return &ht->thinker;
}
static inline thinker_t* LoadDynamicLineSlopeThinker(save_t *save_p, actionf_p1 thinker)
FUNCINLINE static ATTRINLINE thinker_t *LoadDynamicLineSlopeThinker(save_t *save_p, actionf_p1 thinker)
{
dynlineplanethink_t* ht = Z_Malloc(sizeof(*ht), PU_LEVSPEC, NULL);
ht->thinker.function.acp1 = thinker;
@ -4047,7 +4047,7 @@ static inline thinker_t* LoadDynamicLineSlopeThinker(save_t *save_p, actionf_p1
return &ht->thinker;
}
static inline thinker_t* LoadDynamicVertexSlopeThinker(save_t *save_p, actionf_p1 thinker)
FUNCINLINE static ATTRINLINE thinker_t *LoadDynamicVertexSlopeThinker(save_t *save_p, actionf_p1 thinker)
{
size_t i;
dynvertexplanethink_t* ht = Z_Malloc(sizeof(*ht), PU_LEVSPEC, NULL);
@ -4063,7 +4063,7 @@ static inline thinker_t* LoadDynamicVertexSlopeThinker(save_t *save_p, actionf_p
return &ht->thinker;
}
static inline thinker_t* LoadPolyrotatetThinker(save_t *save_p, actionf_p1 thinker)
FUNCINLINE static ATTRINLINE thinker_t *LoadPolyrotatetThinker(save_t *save_p, actionf_p1 thinker)
{
polyrotate_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
ht->thinker.function.acp1 = thinker;
@ -4087,7 +4087,7 @@ static thinker_t* LoadPolymoveThinker(save_t *save_p, actionf_p1 thinker)
return &ht->thinker;
}
static inline thinker_t* LoadPolywaypointThinker(save_t *save_p, actionf_p1 thinker)
FUNCINLINE static ATTRINLINE thinker_t *LoadPolywaypointThinker(save_t *save_p, actionf_p1 thinker)
{
polywaypoint_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
ht->thinker.function.acp1 = thinker;
@ -4102,7 +4102,7 @@ static inline thinker_t* LoadPolywaypointThinker(save_t *save_p, actionf_p1 thin
return &ht->thinker;
}
static inline thinker_t* LoadPolyslidedoorThinker(save_t *save_p, actionf_p1 thinker)
FUNCINLINE static ATTRINLINE thinker_t *LoadPolyslidedoorThinker(save_t *save_p, actionf_p1 thinker)
{
polyslidedoor_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
ht->thinker.function.acp1 = thinker;
@ -4122,7 +4122,7 @@ static inline thinker_t* LoadPolyslidedoorThinker(save_t *save_p, actionf_p1 thi
return &ht->thinker;
}
static inline thinker_t* LoadPolyswingdoorThinker(save_t *save_p, actionf_p1 thinker)
FUNCINLINE static ATTRINLINE thinker_t *LoadPolyswingdoorThinker(save_t *save_p, actionf_p1 thinker)
{
polyswingdoor_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
ht->thinker.function.acp1 = thinker;
@ -4137,7 +4137,7 @@ static inline thinker_t* LoadPolyswingdoorThinker(save_t *save_p, actionf_p1 thi
return &ht->thinker;
}
static inline thinker_t* LoadPolydisplaceThinker(save_t *save_p, actionf_p1 thinker)
FUNCINLINE static ATTRINLINE thinker_t *LoadPolydisplaceThinker(save_t *save_p, actionf_p1 thinker)
{
polydisplace_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
ht->thinker.function.acp1 = thinker;
@ -4149,7 +4149,7 @@ static inline thinker_t* LoadPolydisplaceThinker(save_t *save_p, actionf_p1 thin
return &ht->thinker;
}
static inline thinker_t* LoadPolyrotdisplaceThinker(save_t *save_p, actionf_p1 thinker)
FUNCINLINE static ATTRINLINE thinker_t *LoadPolyrotdisplaceThinker(save_t *save_p, actionf_p1 thinker)
{
polyrotdisplace_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
ht->thinker.function.acp1 = thinker;
@ -4432,7 +4432,7 @@ static void P_NetUnArchiveThinkers(save_t *save_p)
#define PD_FLAGS 0x01
#define PD_TRANS 0x02
static inline void P_ArchivePolyObj(save_t *save_p, polyobj_t *po)
FUNCINLINE static ATTRINLINE void P_ArchivePolyObj(save_t *save_p, polyobj_t *po)
{
UINT8 diff = 0;
P_WriteINT32(save_p, po->id);
@ -4454,7 +4454,7 @@ static inline void P_ArchivePolyObj(save_t *save_p, polyobj_t *po)
P_WriteINT32(save_p, po->translucency);
}
static inline void P_UnArchivePolyObj(save_t *save_p, polyobj_t *po)
FUNCINLINE static ATTRINLINE void P_UnArchivePolyObj(save_t *save_p, polyobj_t *po)
{
INT32 id;
UINT32 angle;
@ -4489,7 +4489,7 @@ static inline void P_UnArchivePolyObj(save_t *save_p, polyobj_t *po)
Polyobj_MoveOnLoad(po, angle, x, y);
}
static inline void P_ArchivePolyObjects(save_t *save_p)
FUNCINLINE static ATTRINLINE void P_ArchivePolyObjects(save_t *save_p)
{
INT32 i;
@ -4502,7 +4502,7 @@ static inline void P_ArchivePolyObjects(save_t *save_p)
P_ArchivePolyObj(save_p, &PolyObjects[i]);
}
static inline void P_UnArchivePolyObjects(save_t *save_p)
FUNCINLINE static ATTRINLINE void P_UnArchivePolyObjects(save_t *save_p)
{
INT32 i, numSavedPolys;
@ -4518,7 +4518,7 @@ static inline void P_UnArchivePolyObjects(save_t *save_p)
P_UnArchivePolyObj(save_p, &PolyObjects[i]);
}
static inline void P_FinishMobjs(void)
FUNCINLINE static ATTRINLINE void P_FinishMobjs(void)
{
thinker_t *currentthinker;
mobj_t *mobj;
@ -4633,7 +4633,7 @@ static void P_RelinkPointers(void)
}
}
static inline void P_NetArchiveSpecials(save_t *save_p)
FUNCINLINE static ATTRINLINE void P_NetArchiveSpecials(save_t *save_p)
{
size_t i, z;
@ -4719,7 +4719,7 @@ static void P_NetUnArchiveSpecials(save_t *save_p)
// =======================================================================
// Misc
// =======================================================================
static inline void P_ArchiveMisc(save_t *save_p, INT16 mapnum)
FUNCINLINE static ATTRINLINE void P_ArchiveMisc(save_t *save_p, INT16 mapnum)
{
//lastmapsaved = mapnum;
lastmaploaded = mapnum;
@ -4732,7 +4732,7 @@ static inline void P_ArchiveMisc(save_t *save_p, INT16 mapnum)
P_WriteStringN(save_p, timeattackfolder, sizeof(timeattackfolder));
}
static inline void P_UnArchiveSPGame(save_t *save_p, INT16 mapoverride)
FUNCINLINE static ATTRINLINE void P_UnArchiveSPGame(save_t *save_p, INT16 mapoverride)
{
char testname[sizeof(timeattackfolder)];
@ -4862,7 +4862,7 @@ static void P_NetArchiveMisc(save_t *save_p, boolean resending)
}
}
static inline boolean P_NetUnArchiveMisc(save_t *save_p, boolean reloading)
FUNCINLINE static ATTRINLINE boolean P_NetUnArchiveMisc(save_t *save_p, boolean reloading)
{
INT32 i;
@ -4966,7 +4966,7 @@ static inline boolean P_NetUnArchiveMisc(save_t *save_p, boolean reloading)
return true;
}
static inline void P_NetArchiveEmblems(save_t *save_p)
FUNCINLINE static ATTRINLINE void P_NetArchiveEmblems(save_t *save_p)
{
gamedata_t *data = serverGamedata;
INT32 i, j;
@ -5087,7 +5087,7 @@ static inline void P_NetArchiveEmblems(save_t *save_p)
}
}
static inline void P_NetUnArchiveEmblems(save_t *save_p)
FUNCINLINE static ATTRINLINE void P_NetUnArchiveEmblems(save_t *save_p)
{
gamedata_t *data = serverGamedata;
INT32 i, j;
@ -5307,7 +5307,7 @@ static void P_NetUnArchiveSectorPortals(save_t *save_p)
}
}
static inline void P_ArchiveLuabanksAndConsistency(save_t *save_p)
FUNCINLINE static ATTRINLINE void P_ArchiveLuabanksAndConsistency(save_t *save_p)
{
UINT8 i, banksinuse = NUM_LUABANKS;
@ -5325,7 +5325,7 @@ static inline void P_ArchiveLuabanksAndConsistency(save_t *save_p)
P_WriteUINT8(save_p, 0x1d); // consistency marker
}
static inline boolean P_UnArchiveLuabanksAndConsistency(save_t *save_p)
FUNCINLINE static ATTRINLINE boolean P_UnArchiveLuabanksAndConsistency(save_t *save_p)
{
switch (P_ReadUINT8(save_p))
{

View file

@ -23,6 +23,10 @@
/// \file
/// \brief SRB2 system stuff for SDL
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
#include <signal.h>
#ifdef _WIN32
@ -79,7 +83,7 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
#define HAVE_SDLCPUINFO
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
#if defined (__linux__) || defined (__HAIKU__)
#if defined (__linux__) || defined (__HAIKU__) || defined (__EMSCRIPTEN__)
#include <sys/statvfs.h>
#else
#include <sys/statvfs.h>
@ -103,6 +107,10 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
#endif
#endif
#ifdef __EMSCRIPTEN__
#undef HAVE_TERMIOS // do not read on /dev/tty, JavaScript alert() are blocking
#endif
#if defined(UNIXCOMMON)
#include <poll.h>
#endif
@ -111,9 +119,11 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
#include <errno.h>
#include <sys/wait.h>
#ifndef __HAIKU__ // haiku's crash dialog is just objectively better
#ifndef __EMSCRIPTEN__ // WASM does not have a rell fork()
#define NEWSIGNALHANDLER
#endif
#endif
#endif
#ifndef NOMUMBLE
#ifdef __linux__ // need -lrt
@ -145,12 +155,14 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
#endif
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
#if !defined (__EMSCRIPTEN__)
#ifndef NOEXECINFO
#include <execinfo.h>
#endif
#include <time.h>
#define UNIXBACKTRACE
#endif
#endif
// Locations to directly check for srb2.pk3 in
const char *wadDefaultPaths[] = {
@ -967,8 +979,13 @@ void I_OutputMsg(const char *fmt, ...)
}
#endif
#ifdef __EMSCRIPTEN__
fprintf(stdout, "%s", txt);
#else
if (!framebuffer)
fprintf(stderr, "%s", txt);
#endif
#ifdef HAVE_TERMIOS
if (consolevent && txt[len-1] == '\n')
{
@ -2295,6 +2312,12 @@ void I_StartupTimer(void)
void I_Sleep(UINT32 ms)
{
#if defined (__EMSCRIPTEN__)
if (emscripten_has_asyncify())
{
return emscripten_sleep(ms);
}
#endif
SDL_Delay(ms);
}
@ -2440,10 +2463,8 @@ INT32 I_StartupSystem(void)
SDL_version SDLlinked;
SDL_VERSION(&SDLcompiled)
SDL_GetVersion(&SDLlinked);
#ifdef HAVE_THREADS
I_start_threads();
I_AddExitFunc(I_stop_threads);
#endif
I_StartupConsole();
#ifdef NEWSIGNALHANDLER
// This is useful when debugging. It lets GDB attach to
@ -2506,6 +2527,10 @@ void I_Quit(void)
free(myargv); // Deallocate allocated memory
death:
W_Shutdown();
#ifdef __EMSCRIPTEN__
emscripten_cancel_main_loop();
emscripten_force_exit(0);
#endif
exit(0);
}
@ -3218,7 +3243,13 @@ size_t I_GetFreeMem(size_t *total)
#else
// Guess 48 MB.
if (total)
{
#if SDL_VERSION_ATLEAST(2,0,1)
*total = SDL_GetSystemRAM();
#else
*total = 48<<20;
#endif
}
return 48<<20;
#endif
}

View file

@ -155,7 +155,7 @@ Worker (
return 0;
}
void
int
I_spawn_thread (
const char * name,
I_thread_fn entry,
@ -164,10 +164,16 @@ I_spawn_thread (
Link link;
Thread th;
if (! I_can_thread())
return false;
th = malloc(sizeof *th);
if (! th)
abort();/* this is pretty GNU of me */
{
I_OutputMsg("Failed to make memory for Thread: %s", name);
return false;
}
th->entry = entry;
th->userdata = userdata;
@ -185,10 +191,30 @@ I_spawn_thread (
);
if (! th->thread)
abort();
{
I_OutputMsg("I_spawn_thread failed to make thread %s: %s\n", name, SDL_GetError());
}
}
}
I_unlock_mutex(i_thread_pool_mutex);
if (! th->thread)
{
free(th);
return false;
}
return true;
}
int
I_can_thread (void)
{
#ifdef __EMSCRIPTEN_PTHREADS__
return true;
#else
return SDL_ThreadID() != 0;
#endif
}
int
@ -204,6 +230,9 @@ I_start_threads (void)
i_mutex_pool_mutex = SDL_CreateMutex();
i_cond_pool_mutex = SDL_CreateMutex();
if (! I_can_thread())
return;
if (!(
i_thread_pool_mutex &&
i_mutex_pool_mutex &&
@ -284,6 +313,9 @@ I_lock_mutex (
){
SDL_mutex * mutex;
if (! I_can_thread())
return;
mutex = Identity(
&i_mutex_pool,
i_mutex_pool_mutex,
@ -299,6 +331,9 @@ void
I_unlock_mutex (
I_mutex id
){
if (! I_can_thread())
return;
if (SDL_UnlockMutex(id) == -1)
abort();
}
@ -327,6 +362,9 @@ I_wake_one_cond (
){
SDL_cond * cond;
if (! I_can_thread())
return;
cond = Identity(
&i_cond_pool,
i_cond_pool_mutex,
@ -344,6 +382,9 @@ I_wake_all_cond (
){
SDL_cond * cond;
if (! I_can_thread())
return;
cond = Identity(
&i_cond_pool,
i_cond_pool_mutex,

View file

@ -20,6 +20,10 @@
/// \file
/// \brief SRB2 graphics stuff for SDL
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
#include <stdlib.h>
#include <signal.h>
@ -475,6 +479,35 @@ static void SurfaceInfo(const SDL_Surface *infoSurface, const char *SurfaceText)
CONS_Printf("%s", M_GetText(" Colorkey RLE acceleration blit\n"));
}
static void TimingInfo(void)
{
#ifdef __EMSCRIPTEN__
int mode = -1, value = -1;
emscripten_get_main_loop_timing(&mode, &value);
CONS_Printf("\x82" "Currect Timing Mode\n");
if (mode == -1)
{
CONS_Printf(" Unknown\n");
}
else if (mode == EM_TIMING_SETTIMEOUT)
{
CONS_Printf(" everty %d ms\n", value);
}
else if (mode == EM_TIMING_RAF)
{
CONS_Printf(" every %d vsync\n", value);
}
else if (mode == EM_TIMING_SETIMMEDIATE)
{
CONS_Printf(" Unknown value %d\n", value);
}
else
{
CONS_Printf(" Unknown mode %d\n", mode);
}
#endif
}
static void VID_Command_Info_f (void)
{
#if 0
@ -522,6 +555,7 @@ static void VID_Command_Info_f (void)
SurfaceInfo(bufSurface, M_GetText("Current Engine Mode"));
SurfaceInfo(vidSurface, M_GetText("Current Video Mode"));
#endif
TimingInfo();
}
static void VID_Command_ModeList_f(void)
@ -1832,7 +1866,11 @@ void I_StartupGraphics(void)
I_ShutdownTTF();
#endif
#ifdef __EMSCRIPTEN__
VID_SetMode(VID_GetModeForSize(BASEVIDWIDTH*2, BASEVIDHEIGHT*2));
#else
VID_SetMode(VID_GetModeForSize(BASEVIDWIDTH, BASEVIDHEIGHT));
#endif
if (M_CheckParm("-nomousegrab"))
mousegrabok = SDL_FALSE;
@ -1973,3 +2011,79 @@ UINT32 I_GetRefreshRate(void)
// trouble querying mode over and over again.
return refresh_rate;
}
#ifdef __EMSCRIPTEN__
int EMSCRIPTEN_KEEPALIVE change_resolution(int x, int y)
{
int newmode = -1;
if ( x < BASEVIDWIDTH*1 && y < BASEVIDHEIGHT*1)
newmode = VID_GetModeForSize(BASEVIDWIDTH*1, BASEVIDHEIGHT*1);
else if (x < BASEVIDWIDTH*2 && y < BASEVIDHEIGHT*2)
newmode = VID_GetModeForSize(BASEVIDWIDTH*1, BASEVIDHEIGHT*1);
else if (x < BASEVIDWIDTH*3 && y < BASEVIDHEIGHT*3)
newmode = VID_GetModeForSize(BASEVIDWIDTH*2, BASEVIDHEIGHT*2);
#if 0
else if (x < BASEVIDWIDTH*4 && y < BASEVIDHEIGHT*4)
newmode = VID_GetModeForSize(BASEVIDWIDTH*3, BASEVIDHEIGHT*3);
else if (x < BASEVIDWIDTH*5 && y < BASEVIDHEIGHT*5)
newmode = VID_GetModeForSize(BASEVIDWIDTH*4, BASEVIDHEIGHT*4);
else if (x < BASEVIDWIDTH*6 && y < BASEVIDHEIGHT*6)
newmode = VID_GetModeForSize(BASEVIDWIDTH*5, BASEVIDHEIGHT*5);
else
newmode = VID_GetModeForSize(BASEVIDWIDTH*6, BASEVIDHEIGHT*6);
#else
else
newmode = VID_GetModeForSize(BASEVIDWIDTH*2, BASEVIDHEIGHT*2);
#endif
if (newmode != -1)
setmodeneeded = newmode;
if (setmodeneeded)
return 1;
return 0;
}
void EMSCRIPTEN_KEEPALIVE inject_text(const char *text)
{
event_t event;
size_t len = 0;
event.type = ev_text;
{
event.key = text[len];
D_PostEvent(&event);
len++;
} while (text[len] != 0x00);
}
void EMSCRIPTEN_KEEPALIVE inject_keycode(int key, int type)
{
event_t event;
if (type == true)
{
event.type = ev_keyup;
}
else if (type == false)
{
event.type = ev_keydown;
}
else
{
return;
}
event.key = key;
if (event.key) D_PostEvent(&event);
}
void EMSCRIPTEN_KEEPALIVE unlock_mouse(void)
{
SDLforceUngrabMouse();
}
void EMSCRIPTEN_KEEPALIVE lock_mouse(void)
{
SDLdoGrabMouse();
}
#endif

View file

@ -135,7 +135,7 @@ static void Midiplayer_Onchange(void)
if (Mix_GetMidiPlayer() != cv_midiplayer.value)
{
if (Mix_SetMidiPlayer(cv_midiplayer.value)) // <> 0 means error
CONS_Alert(CONS_ERROR, "Midi player error: %s", Mix_GetError());
CONS_Alert(CONS_ERROR, "Midi player error: %s\n", Mix_GetError());
else
restart = true;
}
@ -143,7 +143,7 @@ static void Midiplayer_Onchange(void)
if (!Mix_GetSoundFonts() || stricmp(Mix_GetSoundFonts(), cv_midisoundfontpath.string))
{
if (!Mix_SetSoundFonts(cv_midisoundfontpath.string)) // == 0 means error
CONS_Alert(CONS_ERROR, "Sound font error: %s", Mix_GetError());
CONS_Alert(CONS_ERROR, "Sound font error: %s\n", Mix_GetError());
else
restart = true;
}
@ -190,7 +190,7 @@ static void MidiSoundfontPath_Onchange(void)
if (proceed)
{
if (!Mix_SetSoundFonts(cv_midisoundfontpath.string))
CONS_Alert(CONS_ERROR, "Sound font error: %s", Mix_GetError());
CONS_Alert(CONS_ERROR, "Sound font error: %s\n", Mix_GetError());
else
S_StartEx(true);
}
@ -199,7 +199,18 @@ static void MidiSoundfontPath_Onchange(void)
// make sure that s_sound.c does not already verify these
// which happens when: defined(HAVE_MIXERX) && !defined(HAVE_MIXER)
static CV_PossibleValue_t midiplayer_cons_t[] = {{MIDI_OPNMIDI, "OPNMIDI"}, {MIDI_Fluidsynth, "Fluidsynth"}, {MIDI_Timidity, "Timidity"}, {MIDI_Native, "Native"}, {0, NULL}};
static CV_PossibleValue_t midiplayer_cons_t[] = {
{MIDI_ADLMIDI, "ADLMIDI"},
{MIDI_OPNMIDI, "OPNMIDI"},
{MIDI_Timidity, "Timidity"},
{MIDI_Fluidsynth, "Fluidsynth"},
#if SDL_MIXER_VERSION_ATLEAST(2,6,0)
{MIDI_EDMIDI, "EDMIDI"},
#endif
{MIDI_Native, "Native"},
{MIDI_ANY, "Any"},
{0, NULL}
};
consvar_t cv_midiplayer = CVAR_INIT ("midiplayer", "OPNMIDI" /*MIDI_OPNMIDI*/, CV_CALL|CV_NOINIT|CV_SAVE, midiplayer_cons_t, Midiplayer_Onchange);
consvar_t cv_midisoundfontpath = CVAR_INIT ("midisoundfont", "sf2/8bitsf.SF2", CV_CALL|CV_NOINIT|CV_SAVE, NULL, MidiSoundfontPath_Onchange);
consvar_t cv_miditimiditypath = CVAR_INIT ("midisoundbank", "./timidity", CV_SAVE, NULL, NULL);

View file

@ -2,84 +2,61 @@
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"name": "srb2",
"version": "1.0.0",
"builtin-baseline": "c823fd3e57035b10d970a96da2796a2db55e5df5",
"builtin-baseline": "d5ec528843d29e3a52d745a64b469f810b2cedbf",
"dependencies": [
"curl",
{
"name": "libgme",
"platform": "!(windows & mingw) & !native"
"name": "curl",
"platform": "!wasm32"
},
{
"name": "libopenmpt",
"platform": "!(windows & mingw)"
"name": "curl",
"default-features": false,
"features": [
"mbedtls"
],
"platform": "wasm32",
"version>=": "7.74.0#5"
},
"libgme",
"libopenmpt",
"libpng",
"miniupnpc",
"sdl2",
{
"name": "sdl2",
"platform": "!linux"
},
{
"name": "sdl2",
"default-features": false,
"features": [
"wayland",
"x11"
],
"platform": "linux",
"version>=": "2.30.6#2"
},
{
"name": "sdl2-mixer-ext",
"features": [
{
"name": "cmd",
"platform": "linux"
"name": "fluidsynth",
"platform": "!static"
},
{
"name": "libflac",
"platform": "!(windows & mingw & !static)"
"platform": "!emscripten"
},
{
"name": "libgme",
"platform": "!(windows & mingw) & !native"
},
{
"name": "libmodplug",
"platform": "!(windows & mingw)"
},
{
"name": "libopnmidi",
"platform": "!(windows & mingw)"
},
{
"name": "libvorbis",
"platform": "!(windows & mingw & !static)"
},
{
"name": "libxmp",
"platform": "!(windows & mingw)"
},
{
"name": "mpg123",
"platform": "!(windows & mingw)"
},
{
"name": "nativemidi",
"platform": "!(windows & mingw)"
},
{
"name": "opusfile",
"platform": "!(windows & mingw)"
},
{
"name": "pxtone",
"platform": "!(windows & mingw)"
},
{
"name": "timidity",
"platform": "!(windows & mingw)"
},
{
"name": "wavpack",
"platform": "!(windows & mingw)"
}
]
"libgme",
"libmodplug",
"libvorbis",
"libxmp",
"mpg123",
"opusfile",
"pxtone",
"timidity"
],
"version>=": "2.6.0#0"
},
"zlib"
],
"overrides": [
{
"name": "sdl2",
"version": "2.28.5",
"port-version": 1
}
]
}