Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • STJr/SRB2
  • Sryder/SRB2
  • wolfy852/SRB2
  • Alpha2244/SRB2
  • Inuyasha/SRB2
  • yoshibot/SRB2
  • TehRealSalt/SRB2
  • PrisimaTF/SRB2
  • Hatninja/SRB2
  • SteelT/SRB2
  • james/SRB2
  • ShaderWraith/SRB2
  • SinnamonLat/SRB2
  • mazmazz_/SRB2
  • filpAM/SRB2
  • chaoloveicemdboy/SRB2
  • Whooa21/SRB2
  • Machturne/SRB2
  • Golden/SRB2
  • Tatsuru/SRB2
  • Snu/SRB2
  • Zwip-Zwap_Zapony/SRB2
  • fickleheart/SRB2
  • alphaRexJames/SRB2
  • JJK/SRB2
  • diskpoppy/SRB2
  • Hannu_Hanhi/SRB2
  • ZipperQR/SRB2
  • kays/SRB2
  • spherallic/SRB2
  • Zippy_Zolton/SRB2
  • namiishere/SRB2
  • Ors/SRB2
  • SMS_Alfredo/SRB2
  • sonic_edge/SRB2
  • lavla/SRB2
  • ashi/SRB2
  • X.organic/SRB2
  • Fafabis/SRB2
  • Meziu/SRB2
  • v-rob/SRB2
  • tertu/SRB2
  • bitten2up/SRB2
  • flarn2006/SRB2
  • Krabs/SRB2
  • clairebun/SRB2
  • Lactozilla/SRB2
  • thehackstack/SRB2
  • Spice/SRB2
  • win8linux/SRB2
  • JohnFrostFox/SRB2
  • talktoneon726/SRB2
  • Wane/SRB2
  • Lamibe/SRB2
  • spectrumuk2/srb-2
  • nerdyminer18/srb-2
  • 256nil/SRB2
  • ARJr/SRB2
  • Alam/SRB2
  • Zenya/srb-2-marathon-demos
  • Acelite/srb-2-archivedmodifications
  • MIDIMan/SRB2
  • Lach/SRB2
  • Frostiikin/bounce-tweaks
  • Jaden/SRB2
  • Tyron/SRB2
  • Astronight/SRB2
  • Mari0shi06/SRB2
  • aiire/SRB2
  • Galactice/SRB2
  • srb2-ports/srb2-dreamcast
  • sdasdas/SRB2
  • chreas/srb-2-vr
  • StarManiaKG/the-story-of-sinically-rocketing-and-botching-the-2nd
  • LoganAir/SRB2
  • NepDisk/srb-2
  • alufolie91/SRB2
  • Felicia.iso/SRB2
  • twi/SRB2
  • BarrelsOFun/SRB2
  • Speed2411/SRB2
  • Leather_Realms/SRB2
  • Ayemar/SRB2
  • Acelite/SRB2
  • VladDoc/SRB2
  • kaldrum/model-features
  • strawberryfox417/SRB2
  • Lugent/SRB2
  • Rem/SRB2
  • Refrag/SRB2
  • Henry_3230/srb-3230
  • TehPuertoRicanSpartan2/tprs-srb2
  • Leminn/srb-2-marathon-stuff
  • chromaticpipe2/SRB2
  • MiguelGustavo15/SRB2
  • Maru/srb-2-tests
  • SilicDev/SRB2
  • UnmatchedBracket/SRB2
  • HybridDog/SRB2
  • xordspar0/SRB2
  • jsjhbewfhh/SRB2
  • Fancy2209/SRB2
  • Lorsoen/SRB2
  • shindoukin/SRB2
  • GamerOfDays/SRB2
  • Craftyawesome/SRB2
  • tenshi-tensai-tennoji/SRB2
  • Scarfdudebalder/SRB2
  • luigi-budd/srb-2-fix-interplag-lockon
  • mskluesner/SRB2
  • johnpetersa19/SRB2
  • Pheazant/SRB2
  • chromaticpipe2/srb2classic
  • romoney5/SRB2
  • PAS/SRB2Classic
  • BlueStaggo/SRB2
  • Jisk/srb-2-beef-jerky
117 results
Select Git revision
Show changes
Showing with 566 additions and 100 deletions
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"
...@@ -16,6 +16,8 @@ Windows x64 Makefile: ...@@ -16,6 +16,8 @@ Windows x64 Makefile:
variables: variables:
PREFIX: x86_64-w64-mingw32 PREFIX: x86_64-w64-mingw32
CC: /usr/bin/x86_64-w64-mingw32-gcc
CXX: /usr/bin/x86_64-w64-mingw32-g++
script: script:
- - | - - |
......
...@@ -7,6 +7,25 @@ Windows x64: ...@@ -7,6 +7,25 @@ Windows x64:
allow_failure: true 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: artifacts:
paths: paths:
- "build.cmake/bin/" - "build.cmake/bin/"
...@@ -15,9 +34,22 @@ Windows x64: ...@@ -15,9 +34,22 @@ Windows x64:
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-Win64" name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-Win64"
variables: 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: 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 # apt_toolchain
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages" echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
...@@ -37,7 +69,16 @@ Windows x64: ...@@ -37,7 +69,16 @@ Windows x64:
- - | - - |
# cmake # cmake
echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles" 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 # cmake
echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K" echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K"
...@@ -45,7 +86,7 @@ Windows x64: ...@@ -45,7 +86,7 @@ Windows x64:
- - | - - |
# make # make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" 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 # make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
...@@ -3,10 +3,6 @@ Windows x86: ...@@ -3,10 +3,6 @@ Windows x86:
stage: build stage: build
when: manual
allow_failure: true
cache: cache:
- key: ccache-$CI_JOB_NAME_SLUG-$CI_COMMIT_REF_SLUG - key: ccache-$CI_JOB_NAME_SLUG-$CI_COMMIT_REF_SLUG
fallback_keys: fallback_keys:
...@@ -21,11 +17,6 @@ Windows x86: ...@@ -21,11 +17,6 @@ Windows x86:
- build/apt-cache - build/apt-cache
unprotect: true unprotect: true
- key: vcpkg-root
paths:
- build/vcpkg-root
unprotect: true
- key: vcpkg-binary-cache-x86-mingw-static - key: vcpkg-binary-cache-x86-mingw-static
paths: paths:
- build/vcpkg-binary-cache - build/vcpkg-binary-cache
...@@ -33,33 +24,23 @@ Windows x86: ...@@ -33,33 +24,23 @@ Windows x86:
artifacts: artifacts:
paths: paths:
- "build/ninja-x86_mingw_static_vcpkg-debug/bin/" - "build.cmake/bin/"
- "build/ninja-x86_mingw_static_vcpkg-debug/src/config.h" - "build.cmake/src/config.h"
expose_as: "Win32" expose_as: "Win32"
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-Win32" name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-Win32"
variables: variables:
PREFIX: i686-w64-mingw32 VCPKG_TARGET_TRIPLET: x86-mingw-static
CC: /usr/bin/i686-w64-mingw32-gcc-posix CC: i686-w64-mingw32-gcc
CXX: /usr/bin/i686-w64-mingw32-g++-posix CXX: i686-w64-mingw32-g++
LD: i686-w64-mingw32-ld
script: script:
- | - |
# vcpkg # 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 export VCPKG_DEFAULT_BINARY_CACHE="$(pwd)/build/vcpkg-binary-cache"
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" mkdir -p "build/vcpkg-binary-cache"
...@@ -84,9 +65,16 @@ Windows x86: ...@@ -84,9 +65,16 @@ Windows x86:
- - | - - |
# cmake # cmake
echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles" 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 \
- 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 -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 # cmake
echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K" echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K"
...@@ -94,37 +82,7 @@ Windows x86: ...@@ -94,37 +82,7 @@ Windows x86:
- - | - - |
# make # make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" 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 # make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" 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"
...@@ -93,26 +93,24 @@ ...@@ -93,26 +93,24 @@
- - | - - |
# ccache_config # ccache_config
echo -e "\e[0Ksection_start:`date +%s`:ccache_config[collapsed=true]\r\e[0KSetting up 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 # cache.conf
echo Adding ccache configution option echo Adding ccache configution option
- | - |
# base_dir # base_dir
echo base_dir = $CI_PROJECT_DIR | tee --append ~/.ccache/ccache.conf ccache --set-config base_dir=$CI_PROJECT_DIR
- | - |
# cache_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 # compiler_check
echo compiler_check = content | tee --append ~/.ccache/ccache.conf ccache --set-config compiler_check=content
- | - |
# stats_log # 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 # max_size
echo max_size = 300M | tee --append ~/.ccache/ccache.conf ccache --set-config max_size=300M
- | - |
# ccache_config # ccache_config
echo -e "\e[0Ksection_end:`date +%s`:ccache_config\r\e[0K" echo -e "\e[0Ksection_end:`date +%s`:ccache_config\r\e[0K"
......
version: 2.2.14.{branch}-{build} version: 2.2.16.{branch}-{build}
os: MinGW os: MinGW
environment: environment:
......
...@@ -104,6 +104,7 @@ add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32 ...@@ -104,6 +104,7 @@ add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32
lua_hudlib_drawlist.c lua_hudlib_drawlist.c
lua_colorlib.c lua_colorlib.c
lua_inputlib.c lua_inputlib.c
lua_interceptlib.c
) )
# This updates the modification time for comptime.c at the # This updates the modification time for comptime.c at the
...@@ -464,8 +465,13 @@ else() ...@@ -464,8 +465,13 @@ else()
endif() endif()
if(TARGET miniupnpc::miniupnpc) if(TARGET 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_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MINIUPNPC)
target_link_libraries(SRB2SDL2 PRIVATE miniupnpc::miniupnpc) target_link_libraries(SRB2SDL2 PRIVATE miniupnpc::miniupnpc)
endif()
message(STATUS "miniupnpc Found") message(STATUS "miniupnpc Found")
else() else()
message(STATUS "No miniupnpc Found") message(STATUS "No miniupnpc Found")
......
...@@ -98,3 +98,4 @@ lua_hudlib.c ...@@ -98,3 +98,4 @@ lua_hudlib.c
lua_hudlib_drawlist.c lua_hudlib_drawlist.c
lua_inputlib.c lua_inputlib.c
lua_colorlib.c lua_colorlib.c
lua_interceptlib.c
target_sources(SRB2SDL2 PRIVATE target_sources(SRB2SDL2 PRIVATE
lapi.c lapi.c
lbaselib.c lbaselib.c
ldblib.c
ldo.c ldo.c
lfunc.c lfunc.c
linit.c linit.c
......
lapi.c lapi.c
lbaselib.c lbaselib.c
ldo.c ldo.c
ldblib.c
lfunc.c lfunc.c
linit.c linit.c
liolib.c liolib.c
......
/*
** $Id: ldblib.c,v 1.104.1.4 2009/08/04 18:50:18 roberto Exp $
** Interface from Lua to its debug API
** See Copyright Notice in lua.h
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ldblib_c
#define LUA_LIB
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
static void settabss (lua_State *L, const char *i, const char *v) {
lua_pushstring(L, v);
lua_setfield(L, -2, i);
}
static void settabsi (lua_State *L, const char *i, int v) {
lua_pushinteger(L, v);
lua_setfield(L, -2, i);
}
static lua_State *getthread (lua_State *L, int *arg) {
if (lua_isthread(L, 1)) {
*arg = 1;
return lua_tothread(L, 1);
}
else {
*arg = 0;
return L;
}
}
static void treatstackoption (lua_State *L, lua_State *L1, const char *fname) {
if (L == L1) {
lua_pushvalue(L, -2);
lua_remove(L, -3);
}
else
lua_xmove(L1, L, 1);
lua_setfield(L, -2, fname);
}
static int db_getinfo (lua_State *L) {
lua_Debug ar;
int arg;
lua_State *L1 = getthread(L, &arg);
const char *options = luaL_optstring(L, arg+2, "flnSu");
if (lua_isnumber(L, arg+1)) {
if (!lua_getstack(L1, (int)lua_tointeger(L, arg+1), &ar)) {
lua_pushnil(L); /* level out of range */
return 1;
}
}
else if (lua_isfunction(L, arg+1)) {
lua_pushfstring(L, ">%s", options);
options = lua_tostring(L, -1);
lua_pushvalue(L, arg+1);
lua_xmove(L, L1, 1);
}
else
return luaL_argerror(L, arg+1, "function or level expected");
if (!lua_getinfo(L1, options, &ar))
return luaL_argerror(L, arg+2, "invalid option");
lua_createtable(L, 0, 2);
if (strchr(options, 'S')) {
settabss(L, "source", ar.source);
settabss(L, "short_src", ar.short_src);
settabsi(L, "linedefined", ar.linedefined);
settabsi(L, "lastlinedefined", ar.lastlinedefined);
settabss(L, "what", ar.what);
}
if (strchr(options, 'l'))
settabsi(L, "currentline", ar.currentline);
if (strchr(options, 'u'))
settabsi(L, "nups", ar.nups);
if (strchr(options, 'n')) {
settabss(L, "name", ar.name);
settabss(L, "namewhat", ar.namewhat);
}
if (strchr(options, 'L'))
treatstackoption(L, L1, "activelines");
if (strchr(options, 'f'))
treatstackoption(L, L1, "func");
return 1; /* return table */
}
static int db_getlocal (lua_State *L) {
int arg;
lua_State *L1 = getthread(L, &arg);
lua_Debug ar;
const char *name;
if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar)) /* out of range? */
return luaL_argerror(L, arg+1, "level out of range");
name = lua_getlocal(L1, &ar, luaL_checkint(L, arg+2));
if (name) {
lua_xmove(L1, L, 1);
lua_pushstring(L, name);
lua_pushvalue(L, -2);
return 2;
}
else {
lua_pushnil(L);
return 1;
}
}
static int auxupvalue (lua_State *L, int get) {
const char *name;
int n = luaL_checkint(L, 2);
luaL_checktype(L, 1, LUA_TFUNCTION);
if (lua_iscfunction(L, 1)) return 0; /* cannot touch C upvalues from Lua */
name = get ? lua_getupvalue(L, 1, n) : lua_setupvalue(L, 1, n);
if (name == NULL) return 0;
lua_pushstring(L, name);
lua_insert(L, -(get+1));
return get + 1;
}
static int db_getupvalue (lua_State *L) {
return auxupvalue(L, 1);
}
static char KEY_HOOK = 'h';
static void hookf (lua_State *L, lua_Debug *ar) {
static const char *const hooknames[] =
{"call", "return", "line", "count", "tail return"};
lua_pushlightuserdata(L, (void *)&KEY_HOOK);
lua_rawget(L, LUA_REGISTRYINDEX);
lua_pushlightuserdata(L, L);
lua_rawget(L, -2);
if (lua_isfunction(L, -1)) {
lua_pushstring(L, hooknames[(int)ar->event]);
if (ar->currentline >= 0)
lua_pushinteger(L, ar->currentline);
else lua_pushnil(L);
lua_assert(lua_getinfo(L, "lS", ar));
lua_call(L, 2, 0);
}
}
static int makemask (const char *smask, int count) {
int mask = 0;
if (strchr(smask, 'c')) mask |= LUA_MASKCALL;
if (strchr(smask, 'r')) mask |= LUA_MASKRET;
if (strchr(smask, 'l')) mask |= LUA_MASKLINE;
if (count > 0) mask |= LUA_MASKCOUNT;
return mask;
}
static char *unmakemask (int mask, char *smask) {
int i = 0;
if (mask & LUA_MASKCALL) smask[i++] = 'c';
if (mask & LUA_MASKRET) smask[i++] = 'r';
if (mask & LUA_MASKLINE) smask[i++] = 'l';
smask[i] = '\0';
return smask;
}
static void gethooktable (lua_State *L) {
lua_pushlightuserdata(L, (void *)&KEY_HOOK);
lua_rawget(L, LUA_REGISTRYINDEX);
if (!lua_istable(L, -1)) {
lua_pop(L, 1);
lua_createtable(L, 0, 1);
lua_pushlightuserdata(L, (void *)&KEY_HOOK);
lua_pushvalue(L, -2);
lua_rawset(L, LUA_REGISTRYINDEX);
}
}
static int db_sethook (lua_State *L) {
int arg, mask, count;
lua_Hook func;
lua_State *L1 = getthread(L, &arg);
if (lua_isnoneornil(L, arg+1)) {
lua_settop(L, arg+1);
func = NULL; mask = 0; count = 0; /* turn off hooks */
}
else {
const char *smask = luaL_checkstring(L, arg+2);
luaL_checktype(L, arg+1, LUA_TFUNCTION);
count = luaL_optint(L, arg+3, 0);
func = hookf; mask = makemask(smask, count);
}
gethooktable(L);
lua_pushlightuserdata(L, L1);
lua_pushvalue(L, arg+1);
lua_rawset(L, -3); /* set new hook */
lua_pop(L, 1); /* remove hook table */
lua_sethook(L1, func, mask, count); /* set hooks */
return 0;
}
static int db_gethook (lua_State *L) {
int arg;
lua_State *L1 = getthread(L, &arg);
char buff[5];
int mask = lua_gethookmask(L1);
lua_Hook hook = lua_gethook(L1);
if (hook != NULL && hook != hookf) /* external hook? */
lua_pushliteral(L, "external hook");
else {
gethooktable(L);
lua_pushlightuserdata(L, L1);
lua_rawget(L, -2); /* get hook */
lua_remove(L, -2); /* remove hook table */
}
lua_pushstring(L, unmakemask(mask, buff));
lua_pushinteger(L, lua_gethookcount(L1));
return 3;
}
#define LEVELS1 12 /* size of the first part of the stack */
#define LEVELS2 10 /* size of the second part of the stack */
static int db_errorfb (lua_State *L) {
int level;
int firstpart = 1; /* still before eventual `...' */
int arg;
lua_State *L1 = getthread(L, &arg);
lua_Debug ar;
if (lua_isnumber(L, arg+2)) {
level = (int)lua_tointeger(L, arg+2);
lua_pop(L, 1);
}
else
level = (L == L1) ? 1 : 0; /* level 0 may be this own function */
if (lua_gettop(L) == arg)
lua_pushliteral(L, "");
else if (!lua_isstring(L, arg+1)) return 1; /* message is not a string */
else lua_pushliteral(L, "\n");
lua_pushliteral(L, "stack traceback:");
while (lua_getstack(L1, level++, &ar)) {
if (level > LEVELS1 && firstpart) {
/* no more than `LEVELS2' more levels? */
if (!lua_getstack(L1, level+LEVELS2, &ar))
level--; /* keep going */
else {
lua_pushliteral(L, "\n\t..."); /* too many levels */
while (lua_getstack(L1, level+LEVELS2, &ar)) /* find last levels */
level++;
}
firstpart = 0;
continue;
}
lua_pushliteral(L, "\n\t");
lua_getinfo(L1, "Snl", &ar);
lua_pushfstring(L, "%s:", ar.short_src);
if (ar.currentline > 0)
lua_pushfstring(L, "%d:", ar.currentline);
if (*ar.namewhat != '\0') /* is there a name? */
lua_pushfstring(L, " in function " LUA_QS, ar.name);
else {
if (*ar.what == 'm') /* main? */
lua_pushfstring(L, " in main chunk");
else if (*ar.what == 'C' || *ar.what == 't')
lua_pushliteral(L, " ?"); /* C function or tail call */
else
lua_pushfstring(L, " in function <%s:%d>",
ar.short_src, ar.linedefined);
}
lua_concat(L, lua_gettop(L) - arg);
}
lua_concat(L, lua_gettop(L) - arg);
return 1;
}
static const luaL_Reg dblib[] = {
{"gethook", db_gethook},
{"getinfo", db_getinfo},
{"getlocal", db_getlocal},
{"getupvalue", db_getupvalue},
{"sethook", db_sethook},
{"traceback", db_errorfb},
{NULL, NULL}
};
LUALIB_API int luaopen_debug (lua_State *L) {
luaL_register(L, LUA_DBLIBNAME, dblib);
return 1;
}
...@@ -20,6 +20,7 @@ static const luaL_Reg lualibs[] = { ...@@ -20,6 +20,7 @@ static const luaL_Reg lualibs[] = {
{LUA_IOLIBNAME, luaopen_io}, {LUA_IOLIBNAME, luaopen_io},
{LUA_OSLIBNAME, luaopen_os}, {LUA_OSLIBNAME, luaopen_os},
{LUA_STRLIBNAME, luaopen_string}, {LUA_STRLIBNAME, luaopen_string},
{LUA_DBLIBNAME, luaopen_debug},
{NULL, NULL} {NULL, NULL}
}; };
......
...@@ -39,13 +39,26 @@ ...@@ -39,13 +39,26 @@
// Allow scripters to write files of these types to SRB2's folder // Allow scripters to write files of these types to SRB2's folder
static const char *whitelist[] = { static const char *whitelist[] = {
".bmp",
".cfg",
".csv",
".dat", ".dat",
".bin",
".bmp",
".png", ".png",
".sav2",
".obj",
".json",
".yaml",
".xml",
".csv",
".soc",
".cfg",
".ini",
".txt", ".txt",
".log",
".md",
".sav2",
}; };
...@@ -183,7 +196,7 @@ void MakePathDirs(char *path) ...@@ -183,7 +196,7 @@ void MakePathDirs(char *path)
} }
static int CheckFileName(lua_State *L, const char *filename) static int CheckFileName(lua_State* L, const char* filename, boolean extensioncheck)
{ {
int length = strlen(filename); int length = strlen(filename);
boolean pass = false; boolean pass = false;
...@@ -195,12 +208,20 @@ static int CheckFileName(lua_State *L, const char *filename) ...@@ -195,12 +208,20 @@ static int CheckFileName(lua_State *L, const char *filename)
return pushresult(L, 0, filename); return pushresult(L, 0, filename);
} }
if (extensioncheck)
{
for (i = 0; i < (sizeof(whitelist) / sizeof(const char*)); i++) for (i = 0; i < (sizeof(whitelist) / sizeof(const char*)); i++)
if (!stricmp(&filename[length - strlen(whitelist[i])], whitelist[i])) if (!stricmp(&filename[length - strlen(whitelist[i])], whitelist[i]))
{ {
pass = true; pass = true;
break; break;
} }
}
else
{
pass = true;
}
if (strstr(filename, "./") if (strstr(filename, "./")
|| strstr(filename, "..") || strchr(filename, ':') || strstr(filename, "..") || strchr(filename, ':')
|| filename[0] == '/' || filename[0] == '/'
...@@ -218,7 +239,7 @@ static int io_open (lua_State *L) { ...@@ -218,7 +239,7 @@ static int io_open (lua_State *L) {
const char *mode = luaL_optstring(L, 2, "r"); const char *mode = luaL_optstring(L, 2, "r");
int checkresult; int checkresult;
checkresult = CheckFileName(L, filename); checkresult = CheckFileName(L, filename, false);
if (checkresult) if (checkresult)
return checkresult; return checkresult;
...@@ -241,7 +262,10 @@ static int io_openlocal (lua_State *L) { ...@@ -241,7 +262,10 @@ static int io_openlocal (lua_State *L) {
luafiletransfer_t *filetransfer; luafiletransfer_t *filetransfer;
int checkresult; int checkresult;
checkresult = CheckFileName(L, filename); // Decision was made for normal reading (binary + text) to have no whitelist restrictions
boolean readcheck = (strchr(mode, 'w') != NULL) || (strchr(mode, 'a') != NULL) || (strchr(mode, '+') != NULL);
checkresult = CheckFileName(L, filename, readcheck);
if (checkresult) if (checkresult)
return checkresult; return checkresult;
......
...@@ -30,6 +30,9 @@ LUALIB_API int (luaopen_os) (lua_State *L); ...@@ -30,6 +30,9 @@ LUALIB_API int (luaopen_os) (lua_State *L);
#define LUA_STRLIBNAME "string" #define LUA_STRLIBNAME "string"
LUALIB_API int (luaopen_string) (lua_State *L); LUALIB_API int (luaopen_string) (lua_State *L);
#define LUA_DBLIBNAME "debug"
LUALIB_API int (luaopen_debug) (lua_State *L);
/* open all previous libraries */ /* open all previous libraries */
LUALIB_API void (luaL_openlibs) (lua_State *L); LUALIB_API void (luaL_openlibs) (lua_State *L);
......
...@@ -2482,6 +2482,22 @@ static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr) ...@@ -2482,6 +2482,22 @@ static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr)
if (!CV_FilterJoyAxisVars(v, valstr)) if (!CV_FilterJoyAxisVars(v, valstr))
return false; return false;
} }
if (GETMAJOREXECVERSION(cv_execversion.value) < 57) // 57 = 2.2.16
{
if (
(!stricmp(v->name, "movebob") && atoi(valstr) == FRACUNIT) ||
(!stricmp(v->name, "playersforexit") && atoi(valstr) == 4) || // 4 = all
(!stricmp(v->name, "advancemap") && atoi(valstr) == 1) || // 1 = next
(!stricmp(v->name, "cam_speed") && !stricmp(valstr, "0.3")) ||
(!stricmp(v->name, "cam2_speed") && !stricmp(valstr, "0.3")) ||
(!stricmp(v->name, "timerres") && atoi(valstr) == 0) || // 0 = classic
(!stricmp(v->name, "gr_modelinterpolation")) || // Force reset
(!stricmp(v->name, "fov") && atoi(valstr) == 90)
)
return false;
}
return true; return true;
} }
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "m_menu.h" #include "m_menu.h"
#include "filesrch.h" #include "filesrch.h"
#include "m_misc.h" #include "m_misc.h"
#include "lua_libs.h"
#ifdef _WINDOWS #ifdef _WINDOWS
#include "win32/win_main.h" #include "win32/win_main.h"
...@@ -918,6 +919,22 @@ static void CON_InputDelChar(void) ...@@ -918,6 +919,22 @@ static void CON_InputDelChar(void)
// ---- // ----
// //
//
// Same as CON_Responder, but is process before everything else, so it cannot be blocked.
//
boolean CON_PreResponder(event_t *ev)
{
if (ev->type == ev_keydown && shiftdown == 1 && ev->key == KEY_ESCAPE)
{
I_SetTextInputMode(con_destlines == 0 ? true : textinputmodeenabledbylua); // inverse, since this is changed next tic.
consoletoggle = true;
return true;
}
return false;
}
//
// Handles console key input // Handles console key input
// //
boolean CON_Responder(event_t *ev) boolean CON_Responder(event_t *ev)
...@@ -954,7 +971,10 @@ boolean CON_Responder(event_t *ev) ...@@ -954,7 +971,10 @@ boolean CON_Responder(event_t *ev)
if ((key == gamecontrol[GC_CONSOLE][0] || key == gamecontrol[GC_CONSOLE][1]) && !shiftdown) if ((key == gamecontrol[GC_CONSOLE][0] || key == gamecontrol[GC_CONSOLE][1]) && !shiftdown)
{ {
I_SetTextInputMode(con_destlines == 0); // inverse, since this is changed next tic. if (con_destlines == 0 && I_GetTextInputMode())
return false; // some other component is holding keyboard input, don't hijack it!
I_SetTextInputMode(con_destlines == 0 ? true : textinputmodeenabledbylua); // inverse, since this is changed next tic.
consoletoggle = true; consoletoggle = true;
return true; return true;
} }
...@@ -974,7 +994,7 @@ boolean CON_Responder(event_t *ev) ...@@ -974,7 +994,7 @@ boolean CON_Responder(event_t *ev)
// escape key toggle off console // escape key toggle off console
if (key == KEY_ESCAPE) if (key == KEY_ESCAPE)
{ {
I_SetTextInputMode(false); I_SetTextInputMode(textinputmodeenabledbylua);
consoletoggle = true; consoletoggle = true;
return true; return true;
} }
...@@ -1737,6 +1757,8 @@ static void CON_DrawBackpic(void) ...@@ -1737,6 +1757,8 @@ static void CON_DrawBackpic(void)
// Cache the patch. // Cache the patch.
con_backpic = W_CachePatchNum(piclump, PU_PATCH); con_backpic = W_CachePatchNum(piclump, PU_PATCH);
if (con_backpic == NULL)
return;
// Center the backpic, and draw a vertically cropped patch. // Center the backpic, and draw a vertically cropped patch.
w = con_backpic->width * vid.dup; w = con_backpic->width * vid.dup;
......
...@@ -19,6 +19,7 @@ void CON_Init(void); ...@@ -19,6 +19,7 @@ void CON_Init(void);
void CON_StartRefresh(void); void CON_StartRefresh(void);
void CON_StopRefresh(void); void CON_StopRefresh(void);
boolean CON_PreResponder(event_t *ev);
boolean CON_Responder(event_t *ev); boolean CON_Responder(event_t *ev);
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
......
...@@ -93,6 +93,7 @@ ...@@ -93,6 +93,7 @@
#endif #endif
#include "lua_script.h" #include "lua_script.h"
#include "lua_hud.h"
// Version numbers for netplay :upside_down_face: // Version numbers for netplay :upside_down_face:
int VERSION; int VERSION;
...@@ -227,6 +228,9 @@ void D_ProcessEvents(void) ...@@ -227,6 +228,9 @@ void D_ProcessEvents(void)
} }
} }
if (CON_PreResponder(ev))
continue;
// Screenshots over everything so that they can be taken anywhere. // Screenshots over everything so that they can be taken anywhere.
if (M_ScreenshotResponder(ev)) if (M_ScreenshotResponder(ev))
continue; // ate the event continue; // ate the event
...@@ -575,7 +579,7 @@ static void D_Display(void) ...@@ -575,7 +579,7 @@ static void D_Display(void)
V_SetPalette(0); V_SetPalette(0);
// draw pause pic // draw pause pic
if (paused && cv_showhud.value && (!menuactive || netgame)) if (paused && cv_showhud.value && LUA_HudEnabled(hud_pause) && (!menuactive || netgame))
{ {
#if 0 #if 0
INT32 py; INT32 py;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // 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 // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
...@@ -47,13 +47,14 @@ typedef enum ...@@ -47,13 +47,14 @@ typedef enum
SF_DASHMODE = 1<<11, // Sonic Advance 2 style top speed increase? SF_DASHMODE = 1<<11, // Sonic Advance 2 style top speed increase?
SF_FASTWAIT = 1<<12, // Faster wait animation? SF_FASTWAIT = 1<<12, // Faster wait animation?
SF_FASTEDGE = 1<<13, // Faster edge teeter? SF_FASTEDGE = 1<<13, // Faster edge teeter?
SF_MULTIABILITY = 1<<14, // Revenge of Final Demo. SF_JETFUME = 1<<14, // Follow item uses Metal Sonic's jet fume behavior
SF_NONIGHTSROTATION = 1<<15, // Disable sprite rotation for NiGHTS SF_MULTIABILITY = 1<<15, // Revenge of Final Demo.
SF_NONIGHTSSUPER = 1<<16, // Disable super colors for NiGHTS (if you have SF_SUPER) SF_NONIGHTSROTATION = 1<<16, // Disable sprite rotation for NiGHTS
SF_NOSUPERSPRITES = 1<<17, // Don't use super sprites while super SF_NONIGHTSSUPER = 1<<17, // Disable super sprites and colors for NiGHTS
SF_NOSUPERJUMPBOOST = 1<<18, // Disable the jump boost given while super (i.e. Knuckles) SF_NOSUPERSPRITES = 1<<18, // Don't use super sprites while super
SF_CANBUSTWALLS = 1<<19, // Can naturally bust walls on contact? (i.e. Knuckles) SF_NOSUPERJUMPBOOST = 1<<19, // Disable the jump boost given while super (i.e. Knuckles)
SF_NOSHIELDABILITY = 1<<20, // Disable shield abilities SF_CANBUSTWALLS = 1<<20, // Can naturally bust walls on contact? (i.e. Knuckles)
SF_NOSHIELDABILITY = 1<<21, // Disable shield abilities
// free up to and including 1<<31 // free up to and including 1<<31
} skinflags_t; } skinflags_t;
......
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // 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 // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "g_game.h" // Joystick axes (for lua) #include "g_game.h" // Joystick axes (for lua)
#include "i_joy.h" #include "i_joy.h"
#include "g_input.h" // Game controls (for lua) #include "g_input.h" // Game controls (for lua)
#include "p_maputl.h" // P_PathTraverse constants (for lua)
#include "deh_tables.h" #include "deh_tables.h"
...@@ -5260,6 +5261,7 @@ struct int_const_s const INT_CONST[] = { ...@@ -5260,6 +5261,7 @@ struct int_const_s const INT_CONST[] = {
{"SF_DASHMODE",SF_DASHMODE}, {"SF_DASHMODE",SF_DASHMODE},
{"SF_FASTWAIT",SF_FASTWAIT}, {"SF_FASTWAIT",SF_FASTWAIT},
{"SF_FASTEDGE",SF_FASTEDGE}, {"SF_FASTEDGE",SF_FASTEDGE},
{"SF_JETFUME",SF_JETFUME},
{"SF_MULTIABILITY",SF_MULTIABILITY}, {"SF_MULTIABILITY",SF_MULTIABILITY},
{"SF_NONIGHTSROTATION",SF_NONIGHTSROTATION}, {"SF_NONIGHTSROTATION",SF_NONIGHTSROTATION},
{"SF_NONIGHTSSUPER",SF_NONIGHTSSUPER}, {"SF_NONIGHTSSUPER",SF_NONIGHTSSUPER},
...@@ -5829,6 +5831,11 @@ struct int_const_s const INT_CONST[] = { ...@@ -5829,6 +5831,11 @@ struct int_const_s const INT_CONST[] = {
{"MB_SCROLLUP",MB_SCROLLUP}, {"MB_SCROLLUP",MB_SCROLLUP},
{"MB_SCROLLDOWN",MB_SCROLLDOWN}, {"MB_SCROLLDOWN",MB_SCROLLDOWN},
// P_PathTraverse constants
{"PT_ADDLINES",PT_ADDLINES},
{"PT_ADDTHINGS",PT_ADDTHINGS},
{"PT_EARLYOUT",PT_EARLYOUT},
// screen.h constants // screen.h constants
{"BASEVIDWIDTH",BASEVIDWIDTH}, {"BASEVIDWIDTH",BASEVIDWIDTH},
{"BASEVIDHEIGHT",BASEVIDHEIGHT}, {"BASEVIDHEIGHT",BASEVIDHEIGHT},
......