Merge branch 'gitlab-ci' into 'master'

Add support for GitLab CI

See merge request KartKrew/Kart-Public!331
This commit is contained in:
Sal 2024-03-31 20:40:01 +00:00
commit 44b4a68528
11 changed files with 684 additions and 32 deletions

505
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,505 @@
variables:
GIT_STRATEGY: clone
GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_CONCURRENT_ID/$CI_PROJECT_PATH
default:
image: debian:stable-slim
cache:
- key: ccache-$CI_PROJECT_PATH_SLUG-$CI_JOB_NAME_SLUG
fallback_keys:
- cache-$CI_PROJECT_PATH_SLUG-$CI_DEFAULT_BRANCH
- cache-$CI_PROJECT_PATH_SLUG-default
paths:
- ccache
- ccache_statslog
- key: apt-$CI_JOB_IMAGE
paths:
- apt-cache
unprotect: true
before_script:
- - |
# debconf
echo -e "\e[0Ksection_start:`date +%s`:debconf[collapsed=true]\r\e[0KSetup debconf's environment"
- export DEBIAN_FRONTEND="noninteractive"
- export DEBIAN_PRIORITY="low"
- export DEBCONF_NONINTERACTIVE_SEEN="true"
- |
# debconf
echo -e "\e[0Ksection_end:`date +%s`:debconf\r\e[0K"
- - |
# dpkg_aa
echo -e "\e[0Ksection_start:`date +%s`:dpkg_aa[collapsed=true]\r\e[0KAdding architectures to dpkg"
- dpkg --add-architecture i386
- dpkg --add-architecture amd64
- dpkg --add-architecture arm64
- |
# dpkg_aa
echo -e "\e[0Ksection_end:`date +%s`:dpkg_aa\r\e[0K"
- - |
# apt_conf
echo -e "\e[0Ksection_start:`date +%s`:apt_conf[collapsed=true]\r\e[0KSetting up APT conf"
- export APT_CACHE_DIR=`pwd`/apt-cache
- mkdir --parents --verbose $APT_CACHE_DIR/partial/
- touch /etc/apt/apt.conf.d/99build
- |
# apt.conf
echo Adding options to apt.conf':'
- |
# APT::Install-Recommends
echo APT::Install-Recommends "false"\; | tee --append /etc/apt/apt.conf.d/99build
- |
# quit
echo quiet "1"\; | tee --append /etc/apt/apt.conf.d/99build
- |
# APT::Get::Assume-Yes
echo APT::Get::Assume-Yes "true"\; | tee --append /etc/apt/apt.conf.d/99build
- |
# Dir::Cache::Archives
echo Dir::Cache::Archives "$APT_CACHE_DIR"\; | tee --append /etc/apt/apt.conf.d/99build
- |
# apt_conf
echo -e "\e[0Ksection_end:`date +%s`:apt_conf\r\e[0K"
- - |
# apt_update
echo -e "\e[0Ksection_start:`date +%s`:apt_update[collapsed=true]\r\e[0KUpdating APT listing"
- apt-get update
- |
# apt_update
echo -e "\e[0Ksection_end:`date +%s`:apt_update\r\e[0K"
- - |
# apt_pre
echo -e "\e[0Ksection_start:`date +%s`:apt_pre[collapsed=true]\r\e[0KInstalling pre packages"
- apt-get install apt-utils
- |
# apt_pre
echo -e "\e[0Ksection_end:`date +%s`:apt_pre\r\e[0K"
- - |
# apt_upgrade
echo -e "\e[0Ksection_start:`date +%s`:apt_upgrade[collapsed=true]\r\e[0KUpdating existing packages"
- apt-get upgrade
- |
# apt_update
echo -e "\e[0Ksection_end:`date +%s`:apt_upgrade\r\e[0K"
- - |
# apt_common
echo -e "\e[0Ksection_start:`date +%s`:apt_common[collapsed=true]\r\e[0KInstalling common packages"
- apt-get install make git ccache nasm
- |
# apt_common
echo -e "\e[0Ksection_end:`date +%s`:apt_common\r\e[0K"
- - |
# 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 --append ~/.ccache/ccache.conf
- |
# cache_dir
echo cache_dir = $PWD/ccache | tee --append ~/.ccache/ccache.conf
- |
# compiler_check
echo compiler_check = content | tee --append ~/.ccache/ccache.conf
- |
# stats_log
echo stats_log = $PWD/ccache_statslog | tee --append ~/.ccache/ccache.conf
- |
# max_size
echo max_size = 50M | tee --append ~/.ccache/ccache.conf
- |
# ccache_config
echo -e "\e[0Ksection_end:`date +%s`:ccache_config\r\e[0K"
- - |
# cache_reset
echo -e "\e[0Ksection_start:`date +%s`:ccache_reset[collapsed=true]\r\e[0KResetting ccache statistics"
- ccache --zero-stats
- ccache --show-stats
- |
# ccache_reset
echo -e "\e[0Ksection_end:`date +%s`:ccache_reset\r\e[0K"
artifacts:
paths:
- "bin/"
- "src/comptime.h"
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-$CI_JOB_NAME_SLUG"
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 --verbose
- ccache --show-log-stats --verbose
- |
# ccahe_stats
echo -e "\e[0Ksection_end:`date +%s`:ccache_stats\r\e[0K"
stages:
- build
Debian testing GCC:
stage: build
when: manual
image: debian:testing-slim
allow_failure: true
artifacts:
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-testing-gcc"
variables:
CC: gcc
LDFLAGS: -Wl,-fuse-ld=gold
script:
- - |
# apt_toolchain
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
- apt-get install gcc
- |
# apt_toolchain
echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K"
- - |
# apt_development
echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages"
- apt-get install libsdl2-mixer-dev libpng-dev libcurl4-openssl-dev libgme-dev libopenmpt-dev
- |
# apt_development
echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K"
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
Windows x86:
stage: build
when: on_success
artifacts:
paths:
- "bin/"
- "src/comptime.h"
expose_as: "Win32"
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-Win32"
variables:
PREFIX: i686-w64-mingw32
script:
- - |
# apt_toolchain
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
- apt-get install gcc-mingw-w64-i686-win32
- |
# apt_toolchain
echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K"
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=src --keep-going CCACHE=1 ERRORMODE=1 MINGW=1 SDL=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 MINGW=1 SDL=1
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
Debian stable:amd64:
stage: build
when: on_success
artifacts:
paths:
- "bin/"
- "src/comptime.h"
expose_as: "Debian amd64"
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-x86-64"
variables:
CC: x86_64-linux-gnu-gcc
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
script:
- - |
# apt_toolchain
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
- apt-get install gcc-x86-64-linux-gnu || apt-get install gcc
- |
# apt_toolchain
echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K"
- - |
# apt_development
echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages"
- apt-get install libsdl2-mixer-dev:amd64 libpng-dev:amd64 libcurl4-openssl-dev:amd64 libgme-dev:amd64 libopenmpt-dev:amd64
- |
# apt_development
echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K"
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
Debian stable:i386:
stage: build
when: manual
artifacts:
paths:
- "bin/"
- "src/comptime.h"
expose_as: "Debian i386"
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-i686"
variables:
CC: i686-linux-gnu-gcc
OBJCOPY: i686-linux-gnu-objcopy
OBJDUMP: i686-linux-gnu-objdump
PKG_CONFIG_PATH: /usr/lib/i386-linux-gnu/pkgconfig
script:
- - |
# apt_toolchain
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
- apt-get install gcc-i686-linux-gnu || apt-get install gcc
- |
# apt_toolchain
echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K"
- - |
# apt_development
echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages"
- apt-get install libsdl2-mixer-dev:i386 libpng-dev:i386 libcurl4-openssl-dev:i386 libgme-dev:i386 libopenmpt-dev:i386
- |
# apt_development
echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K"
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX=1
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
Debian stable:arm64:
stage: build
when: manual
artifacts:
paths:
- "bin/"
- "src/comptime.h"
expose_as: "Debian arm64"
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-aarch64"
variables:
CC: aarch64-linux-gnu-gcc
LDFLAGS: -Wl,-fuse-ld=gold
OBJCOPY: aarch64-linux-gnu-objcopy
OBJDUMP: aarch64-linux-gnu-objdump
PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig
script:
- - |
# apt_toolchain
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
- apt-get install gcc-aarch64-linux-gnu || apt-get install gcc
- |
# apt_toolchain
echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K"
- - |
# apt_development
echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages"
- apt-get install libsdl2-mixer-dev:arm64 libpng-dev:arm64 libcurl4-openssl-dev:arm64 libgme-dev:arm64 libopenmpt-dev:arm64
- |
# apt_development
echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K"
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 ERRORMODE=1 NONX86=1 ARM64=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 NONX86=1 ARM64=1
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
Windows x64:
stage: build
when: manual
artifacts:
paths:
- "bin/"
- "src/comptime.h"
expose_as: "Win64"
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-Win64"
variables:
PREFIX: x86_64-w64-mingw32
script:
- - |
# apt_toolchain
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
- apt-get install gcc-mingw-w64-x86-64-win32
- |
# apt_toolchain
echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K"
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=src --keep-going CCACHE=1 ERRORMODE=1 MINGW64=1 SDL=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 MINGW64=1 SDL=1
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
Debian stable Clang:
stage: build
when: manual
allow_failure: true
artifacts:
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-clang"
variables:
CC: clang
WFLAGS: -Wno-cast-align
CFLAGS: -Wno-cast-align
LDFLAGS: -Wl,-fuse-ld=gold
script:
- - |
# apt_toolchain
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
- apt-get install clang
- |
# apt_toolchain
echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K"
- - |
# apt_development
echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages"
- apt-get install libsdl2-mixer-dev libpng-dev libcurl4-openssl-dev libgme-dev libopenmpt-dev
- |
# apt_development
echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K"
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
Debian stable musl:
stage: build
when: manual
allow_failure: true
artifacts:
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-musl"
variables:
CC: musl-gcc
LDD: musl-ldd
script:
- - |
# apt_toolchain
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
- apt-get install gcc
- |
# apt_toolchain
echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K"
- - |
# apt_development
echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages"
- apt-get install musl-tools
- |
# apt_development
echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K"
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 SDL=0 NOHW=1 NOZLIB=1 NOCURL=1 NOGME=1 NOOPENMPT=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 SDL=0 NOHW=1 NOZLIB=1 NOCURL=1 NOGME=1 NOOPENMPT=1
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
Debian testing Clang:
extends: Debian stable Clang
when: manual
image: debian:testing-slim
artifacts:
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-testing-clang"
variables:
CC: clang
WFLAGS: -Wno-cast-align -Wno-deprecated-non-prototype
CFLAGS: -Wno-cast-align -Wno-deprecated-non-prototype
LDFLAGS: -Wl,-fuse-ld=gold
Debian testing musl:
extends: Debian stable musl
when: manual
image: debian:testing-slim
artifacts:
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-testing-musl"
variables:
CC: musl-gcc
LDD: musl-ldd
LDFLAGS: -Wl,-fuse-ld=gold

View file

@ -12,29 +12,32 @@
# to avoid a false positive with the version detection... # to avoid a false positive with the version detection...
SUPPORTED_GCC_VERSIONS:=\ SUPPORTED_GCC_VERSIONS:=\
101 102\ 132 131 130 13\
91 92 93\ 123 122 121 120 12\
81 82 83 84\ 114 113 112 111 110 11\
71 72 73 74 75\ 105 104 103 102 101 100 10\
61 62 63 64\ 95 94 93 92 91 90\
51 52 53 54 55\ 85 84 83 82 81 80\
40 41 42 43 44 45 46 47 48 49 75 74 73 72 71 70\
64 63 62 61 60\
55 54 53 52 51 50\
49 48 47 46 45 44 43 42 41 40
LATEST_GCC_VERSION=10.2 LATEST_GCC_VERSION=13.2
# gcc or g++ # gcc or g++
ifdef PREFIX ifdef PREFIX
CC=$(PREFIX)-gcc CC:=$(PREFIX)-gcc
CXX=$(PREFIX)-g++ CXX:=$(PREFIX)-g++
OBJCOPY=$(PREFIX)-objcopy OBJCOPY?=$(PREFIX)-objcopy
OBJDUMP=$(PREFIX)-objdump OBJDUMP?=$(PREFIX)-objdump
STRIP=$(PREFIX)-strip STRIP?=$(PREFIX)-strip
WINDRES=$(PREFIX)-windres WINDRES?=$(PREFIX)-windres
else else
OBJCOPY=objcopy OBJCOPY?=objcopy
OBJDUMP=objdump OBJDUMP?=objdump
STRIP=strip STRIP?=strip
WINDRES=windres WINDRES?=windres
endif endif
# because Apple screws with us on this # because Apple screws with us on this
@ -51,7 +54,10 @@ ifeq (,$(filter GCC%,$(.VARIABLES)))
version:=$(shell $(CC) --version) version:=$(shell $(CC) --version)
# check if this is in fact GCC # check if this is in fact GCC
ifneq (,$(or $(findstring gcc,$(version)),$(findstring GCC,$(version)))) ifneq (,$(or $(findstring gcc,$(version)),$(findstring GCC,$(version))))
version:=$(shell $(CC) -dumpversion) shellversion:=$(shell $(CC) -dumpversion)
# Try to remove "-win32"
version:=$(subst -win32,.0,$(shellversion))
# Turn version into words of major, minor # Turn version into words of major, minor
v:=$(subst ., ,$(version)) v:=$(subst ., ,$(version))
@ -71,11 +77,99 @@ ifeq (,$(filter GCC%,$(.VARIABLES)))
endif endif
endif endif
ifdef GCC132
GCC131=1
endif
ifdef GCC131
GCC130=1
endif
ifdef GCC13
GCC130=1
endif
ifdef GCC130
GCC123=1
endif
ifdef GCC123
GCC122=1
endif
ifdef GCC122
GCC121=1
endif
ifdef GCC121
GCC120=1
endif
ifdef GCC12
GCC120=1
endif
ifdef GCC120
GCC114=1
endif
ifdef GCC114
GCC113=1
endif
ifdef GCC113
GCC112=1
endif
ifdef GCC112
GCC111=1
endif
ifdef GCC111
GCC110=1
endif
ifdef GCC11
GCC110=1
endif
ifdef GCC110
GCC105=1
endif
ifdef GCC105
GCC104=1
endif
ifdef GCC104
GCC103=1
endif
ifdef GCC103
GCC102=1
endif
ifdef GCC102 ifdef GCC102
GCC101=1 GCC101=1
endif endif
ifdef GCC101 ifdef GCC101
GCC100=1
endif
ifdef GCC10
GCC100=1
endif
ifdef GCC100
GCC93=1
endif
ifdef GCC95
GCC94=1
endif
ifdef GCC94
GCC93=1 GCC93=1
endif endif
@ -88,6 +182,14 @@ GCC91=1
endif endif
ifdef GCC91 ifdef GCC91
GCC90=1
endif
ifdef GCC90
GCC85=1
endif
ifdef GCC85
GCC84=1 GCC84=1
endif endif
@ -104,6 +206,10 @@ GCC81=1
endif endif
ifdef GCC81 ifdef GCC81
GCC80=1
endif
ifdef GCC80
GCC75=1 GCC75=1
endif endif
@ -124,6 +230,10 @@ GCC71=1
endif endif
ifdef GCC71 ifdef GCC71
GCC70=1
endif
ifdef GCC70
GCC64=1 GCC64=1
endif endif
@ -140,6 +250,10 @@ GCC61=1
endif endif
ifdef GCC61 ifdef GCC61
GCC60=1
endif
ifdef GCC60
GCC55=1 GCC55=1
endif endif
@ -160,6 +274,10 @@ GCC51=1
endif endif
ifdef GCC51 ifdef GCC51
GCC50=1
endif
ifdef GCC50
GCC49=1 GCC49=1
endif endif

View file

@ -445,7 +445,6 @@ static int io_readline (lua_State *L) {
static int g_write (lua_State *L, FILE *f, int arg) { static int g_write (lua_State *L, FILE *f, int arg) {
int nargs = lua_gettop(L) - 1; int nargs = lua_gettop(L) - 1;
int status = 1; int status = 1;
size_t count;
for (; nargs--; arg++) { for (; nargs--; arg++) {
if (lua_type(L, arg) == LUA_TNUMBER) { if (lua_type(L, arg) == LUA_TNUMBER) {
/* optimization: could be done exactly as for strings */ /* optimization: could be done exactly as for strings */
@ -455,7 +454,6 @@ static int g_write (lua_State *L, FILE *f, int arg) {
else { else {
size_t l; size_t l;
const char *s = luaL_checklstring(L, arg, &l); const char *s = luaL_checklstring(L, arg, &l);
count += l;
if (ftell(f) + l > FILELIMIT) if (ftell(f) + l > FILELIMIT)
{ {
luaL_error(L,"write limit bypassed in file. Changes have been discarded."); luaL_error(L,"write limit bypassed in file. Changes have been discarded.");

View file

@ -72,8 +72,13 @@ static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid);
#ifdef HAVE_CURL #ifdef HAVE_CURL
size_t curlwrite_data(void *ptr, size_t size, size_t nmemb, FILE *stream); size_t curlwrite_data(void *ptr, size_t size, size_t nmemb, FILE *stream);
#if defined(CURL_AT_LEAST_VERSION) && CURL_AT_LEAST_VERSION(7, 35, 0)
int curlprogress_callbackx(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow);
#define XFERINFOFUNCTION
#else
int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow); int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
#endif #endif
#endif
// Sender structure // Sender structure
typedef struct filetx_s typedef struct filetx_s
@ -489,7 +494,6 @@ INT32 CL_CheckFiles(void)
{ {
INT32 i, j; INT32 i, j;
char wadfilename[MAX_WADPATH]; char wadfilename[MAX_WADPATH];
size_t packetsize = 0;
size_t filestoload = 0; size_t filestoload = 0;
boolean downloadrequired = false; boolean downloadrequired = false;
@ -561,8 +565,6 @@ INT32 CL_CheckFiles(void)
} }
} }
packetsize += nameonlylength(fileneeded[i].filename) + 22;
fileneeded[i].status = findfile(fileneeded[i].filename, fileneeded[i].md5sum, true); fileneeded[i].status = findfile(fileneeded[i].filename, fileneeded[i].md5sum, true);
CONS_Debug(DBG_NETPLAY, "found %d\n", fileneeded[i].status); CONS_Debug(DBG_NETPLAY, "found %d\n", fileneeded[i].status);
return 4; return 4;
@ -1220,6 +1222,18 @@ size_t curlwrite_data(void *ptr, size_t size, size_t nmemb, FILE *stream)
return written; return written;
} }
#ifdef XFERINFOFUNCTION
int curlprogress_callbackx(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)
{
(void)clientp;
(void)ultotal;
(void)ulnow; // Function prototype requires these but we won't use, so just discard
curl_dlnow = dlnow;
curl_dltotal = dltotal;
getbytes = curl_dlnow / (time(NULL) - curl_starttime); // To-do: Make this more accurate???
return 0;
}
#else
int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
{ {
(void)clientp; (void)clientp;
@ -1230,6 +1244,7 @@ int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ul
getbytes = curl_dlnow / (time(NULL) - curl_starttime); // To-do: Make this more accurate??? getbytes = curl_dlnow / (time(NULL) - curl_starttime); // To-do: Make this more accurate???
return 0; return 0;
} }
#endif
void CURLPrepareFile(const char* url, int dfilenum) void CURLPrepareFile(const char* url, int dfilenum)
{ {
@ -1259,7 +1274,11 @@ void CURLPrepareFile(const char* url, int dfilenum)
curl_easy_setopt(http_handle, CURLOPT_URL, va("%s/%s", url, curl_realname)); curl_easy_setopt(http_handle, CURLOPT_URL, va("%s/%s", url, curl_realname));
// Only allow HTTP and HTTPS // Only allow HTTP and HTTPS
#if defined(CURL_AT_LEAST_VERSION) && CURL_AT_LEAST_VERSION(7, 85, 0)
curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS_STR, "http,https");
#else
curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS); curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS);
#endif
curl_easy_setopt(http_handle, CURLOPT_USERAGENT, va("SRB2Kart/v%d.%d", VERSION, SUBVERSION)); // Set user agent as some servers won't accept invalid user agents. curl_easy_setopt(http_handle, CURLOPT_USERAGENT, va("SRB2Kart/v%d.%d", VERSION, SUBVERSION)); // Set user agent as some servers won't accept invalid user agents.
@ -1283,7 +1302,11 @@ void CURLPrepareFile(const char* url, int dfilenum)
curl_easy_setopt(http_handle, CURLOPT_WRITEDATA, curl_curfile->file); 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_WRITEFUNCTION, curlwrite_data);
curl_easy_setopt(http_handle, CURLOPT_NOPROGRESS, 0L); curl_easy_setopt(http_handle, CURLOPT_NOPROGRESS, 0L);
#ifdef XFERINFOFUNCTION
curl_easy_setopt(http_handle, CURLOPT_XFERINFOFUNCTION, curlprogress_callbackx);
#else
curl_easy_setopt(http_handle, CURLOPT_PROGRESSFUNCTION, curlprogress_callback); curl_easy_setopt(http_handle, CURLOPT_PROGRESSFUNCTION, curlprogress_callback);
#endif
curl_curfile->status = FS_DOWNLOADING; curl_curfile->status = FS_DOWNLOADING;
lastfilenum = dfilenum; lastfilenum = dfilenum;

View file

@ -519,6 +519,9 @@ void GeneratePolygonNormals(model_t *model, int ztag)
for (k = 0; k < mesh->numTriangles; k++) for (k = 0; k < mesh->numTriangles; k++)
{ {
/// TODO: normalize vectors
(void)vertices;
(void)polyNormals;
// Vector::Normal(vertices, polyNormals); // Vector::Normal(vertices, polyNormals);
vertices += 3 * 3; vertices += 3 * 3;
polyNormals++; polyNormals++;

View file

@ -8312,7 +8312,9 @@ static void M_EraseGuest(INT32 choice)
/*if (currentMenu == &SP_NightsGuestReplayDef) /*if (currentMenu == &SP_NightsGuestReplayDef)
M_SetupNextMenu(&SP_NightsAttackDef); M_SetupNextMenu(&SP_NightsAttackDef);
else*/ else*/
{
M_SetupNextMenu(&SP_TimeAttackDef); M_SetupNextMenu(&SP_TimeAttackDef);
}
CV_AddValue(&cv_nextmap, -1); CV_AddValue(&cv_nextmap, -1);
CV_AddValue(&cv_nextmap, 1); CV_AddValue(&cv_nextmap, 1);
M_StartMessage(M_GetText("Guest replay data erased.\n"),NULL,MM_NOTHING); M_StartMessage(M_GetText("Guest replay data erased.\n"),NULL,MM_NOTHING);

View file

@ -60,7 +60,7 @@ UINT8 M_RandomByte(void)
*/ */
INT32 M_RandomKey(INT32 a) INT32 M_RandomKey(INT32 a)
{ {
return (INT32)((rand()/((unsigned)RAND_MAX+1.0f))*a); return (INT32)((rand()/((float)(RAND_MAX)+1.0f))*a);
} }
/** Provides a random integer in a given range. /** Provides a random integer in a given range.
@ -73,7 +73,7 @@ INT32 M_RandomKey(INT32 a)
*/ */
INT32 M_RandomRange(INT32 a, INT32 b) INT32 M_RandomRange(INT32 a, INT32 b)
{ {
return (INT32)((rand()/((unsigned)RAND_MAX+1.0f))*(b-a+1))+a; return (INT32)((rand()/((float)(RAND_MAX)+1.0f))*(b-a+1))+a;
} }

View file

@ -494,7 +494,6 @@ static void P_NetUnArchivePlayers(void)
static void P_NetArchiveWorld(void) static void P_NetArchiveWorld(void)
{ {
size_t i; size_t i;
INT32 statsec = 0, statline = 0;
const line_t *li = lines; const line_t *li = lines;
const side_t *si; const side_t *si;
UINT8 *put; UINT8 *put;
@ -587,8 +586,6 @@ static void P_NetArchiveWorld(void)
if (diff) if (diff)
{ {
statsec++;
WRITEUINT16(put, i); WRITEUINT16(put, i);
WRITEUINT8(put, diff); WRITEUINT8(put, diff);
if (diff & SD_DIFF2) if (diff & SD_DIFF2)
@ -705,7 +702,6 @@ static void P_NetArchiveWorld(void)
if (diff) if (diff)
{ {
statline++;
WRITEINT16(put, i); WRITEINT16(put, i);
WRITEUINT8(put, diff); WRITEUINT8(put, diff);
if (diff & LD_DIFF2) if (diff & LD_DIFF2)

View file

@ -2309,7 +2309,9 @@ static void P_CheckInvincibilityTimer(player_t *player)
return; return;
//if (mariomode && !player->powers[pw_super]) // SRB2kart //if (mariomode && !player->powers[pw_super]) // SRB2kart
{
player->mo->color = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1))); player->mo->color = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1)));
}
/*if (leveltime % (TICRATE/7) == 0) /*if (leveltime % (TICRATE/7) == 0)
{ {
mobj_t *sparkle = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_IVSP); mobj_t *sparkle = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_IVSP);

View file

@ -58,8 +58,11 @@ char logfilename[1024];
#endif #endif
#endif #endif
#if defined (_WIN32) #ifdef _WIN32
#ifndef _AMD64_
#include "exchndl.h" #include "exchndl.h"
#define DRMINGW
#endif
#endif #endif
#if defined (_WIN32) #if defined (_WIN32)
@ -174,7 +177,9 @@ int main(int argc, char **argv)
) )
#endif #endif
{ {
#ifdef DRMINGW
ExcHndlInit(); ExcHndlInit();
#endif
} }
} }
#ifndef __MINGW32__ #ifndef __MINGW32__

View file

@ -3031,7 +3031,7 @@ void I_Sleep(UINT32 ms)
} }
#ifdef NEWSIGNALHANDLER #ifdef NEWSIGNALHANDLER
static void newsignalhandler_Warn(const char *pr) FUNCNORETURN static ATTRNORETURN void newsignalhandler_Warn(const char *pr)
{ {
char text[128]; char text[128];