From 4861481ca9dbbc8cc863eed37b790b0a308150f6 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Wed, 3 Jun 2026 19:53:08 -0400 Subject: [PATCH 01/18] gcc 2.95 workflow --- .github/workflows/build.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2f993e39..fb8df78e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -377,3 +377,30 @@ jobs: with: name: butterscotch-ps3 path: build/butterscotch.elf + + build-old-gcc: + matrix: + include: + - name: GCC 3.0 + compiler: gcc-3.0 + flags: '-std=gnu99 -w' + - name: GCC 2.95 + compiler: g++-2.95 + flags: '-fpermissive -w' + name: Build (${{ matrix.name }}) + runs-on: ubuntu-latest + steps: + - name: Create Debian Woody chroot + id: create-chroot + uses: NekoSekaiMoe/debchroot@main + with: + distro: 'debian' + version: 'woody' + arch: 'i386' + packages: '${{ matrix.compiler }} make libsdl1.2-dev' + + - name: Checkout repo into chroot + run: git clone https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git ${{ steps.create-chroot.outputs.rootfs }}/butterscotch + + - name: Build + run: debsh make -C /butterscotch CC='${{ matrix.compiler }} ${{ matrix.flags }}' DESKTOP_BACKEND=sdl1 AUDIO_BACKEND=none SDL1_LIBS='-lSDL' DISABLE_MMD=1 From c818f15de11d51c9288862411fbf41f105b7048e Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Wed, 3 Jun 2026 19:54:41 -0400 Subject: [PATCH 02/18] fix maybe --- .github/workflows/build.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fb8df78e..788ed799 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -379,14 +379,15 @@ jobs: path: build/butterscotch.elf build-old-gcc: - matrix: - include: - - name: GCC 3.0 - compiler: gcc-3.0 - flags: '-std=gnu99 -w' - - name: GCC 2.95 - compiler: g++-2.95 - flags: '-fpermissive -w' + strategy: + matrix: + include: + - name: GCC 3.0 + compiler: gcc-3.0 + flags: '-std=gnu99 -w' + - name: GCC 2.95 + compiler: g++-2.95 + flags: '-fpermissive -w' name: Build (${{ matrix.name }}) runs-on: ubuntu-latest steps: From 4759b678bbc7ae3efa4dd0656461606a86349132 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Wed, 3 Jun 2026 20:01:17 -0400 Subject: [PATCH 03/18] fix --- .github/workflows/build.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 788ed799..95bfb971 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -392,16 +392,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Create Debian Woody chroot - id: create-chroot - uses: NekoSekaiMoe/debchroot@main - with: - distro: 'debian' - version: 'woody' - arch: 'i386' - packages: '${{ matrix.compiler }} make libsdl1.2-dev' + run: | + sudo apt-get install --no-install-recommends -y debootstrap + sudo debootstrap --arch=i386 woody ~/woody http://archive.debian.org/debian - name: Checkout repo into chroot - run: git clone https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git ${{ steps.create-chroot.outputs.rootfs }}/butterscotch + run: sudo git clone https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git ~/woody/butterscotch - name: Build - run: debsh make -C /butterscotch CC='${{ matrix.compiler }} ${{ matrix.flags }}' DESKTOP_BACKEND=sdl1 AUDIO_BACKEND=none SDL1_LIBS='-lSDL' DISABLE_MMD=1 + run: sudo chroot ~/woody /bin/sh --login -c 'make -C /butterscotch CC="${{ matrix.compiler }} ${{ matrix.flags }}" DESKTOP_BACKEND=sdl1 AUDIO_BACKEND=none SDL1_LIBS='-lSDL' DISABLE_MMD=1' From 8995b373558ebbd76ac428a396b0159fcc654763 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Wed, 3 Jun 2026 20:06:29 -0400 Subject: [PATCH 04/18] install packages --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 95bfb971..93a313e2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -394,7 +394,7 @@ jobs: - name: Create Debian Woody chroot run: | sudo apt-get install --no-install-recommends -y debootstrap - sudo debootstrap --arch=i386 woody ~/woody http://archive.debian.org/debian + sudo debootstrap --arch=i386 woody ~/woody http://archive.debian.org/debian --include='${{ matrix.compiler }},make,libsdl1.2-dev' - name: Checkout repo into chroot run: sudo git clone https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git ~/woody/butterscotch From 1ad43544fede8c4d40f28519d503f88a35c6eb6d Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Wed, 3 Jun 2026 20:07:21 -0400 Subject: [PATCH 05/18] fix --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 93a313e2..f1fa1ab9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -394,7 +394,7 @@ jobs: - name: Create Debian Woody chroot run: | sudo apt-get install --no-install-recommends -y debootstrap - sudo debootstrap --arch=i386 woody ~/woody http://archive.debian.org/debian --include='${{ matrix.compiler }},make,libsdl1.2-dev' + sudo debootstrap --arch=i386 --include='${{ matrix.compiler }},make,libsdl1.2-dev' woody ~/woody http://archive.debian.org/debian - name: Checkout repo into chroot run: sudo git clone https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git ~/woody/butterscotch From 37240dd72901465ca0f2177b68dd1e574d47b802 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Wed, 3 Jun 2026 20:08:35 -0400 Subject: [PATCH 06/18] fix --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f1fa1ab9..8c1ce8ee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -380,6 +380,7 @@ jobs: build-old-gcc: strategy: + fail-fast: false matrix: include: - name: GCC 3.0 From 8f9090f4e8059c84ad53475a3e56b99cea01b6da Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Wed, 3 Jun 2026 20:15:15 -0400 Subject: [PATCH 07/18] fix gcc 2.95 bools --- src/audio/ps2/ps2_audio_system.h | 2 +- src/audio_system.h | 2 +- src/binary_reader.h | 2 +- src/bool.h | 5 +++++ src/clock_gettime_macos.h | 2 +- src/common.h | 2 +- src/data_win.c | 2 +- src/data_win.h | 2 +- src/desktop/platformdefs.h | 2 +- src/int_int_hashmap.h | 2 +- src/int_rvalue_hashmap.h | 2 +- src/ps3/ps3_textures.h | 2 +- src/runner_gamepad.h | 2 +- src/runner_keyboard.h | 2 +- src/runner_mouse.c | 2 +- src/text_utils.h | 2 +- 16 files changed, 20 insertions(+), 15 deletions(-) create mode 100644 src/bool.h diff --git a/src/audio/ps2/ps2_audio_system.h b/src/audio/ps2/ps2_audio_system.h index 1c547242..8bb8342a 100644 --- a/src/audio/ps2/ps2_audio_system.h +++ b/src/audio/ps2/ps2_audio_system.h @@ -4,7 +4,7 @@ #include "audio_system.h" #include -#include +#include "bool.h" #include #define MAX_PS2_SOUND_INSTANCES 64 diff --git a/src/audio_system.h b/src/audio_system.h index 82dcd266..fcbba284 100644 --- a/src/audio_system.h +++ b/src/audio_system.h @@ -2,7 +2,7 @@ #include "common.h" #include -#include +#include "bool.h" #include "data_win.h" #include "file_system.h" diff --git a/src/binary_reader.h b/src/binary_reader.h index e61f6e0e..b48c4a86 100644 --- a/src/binary_reader.h +++ b/src/binary_reader.h @@ -4,7 +4,7 @@ #include #include #include -#include +#include "bool.h" typedef struct { FILE* file; diff --git a/src/bool.h b/src/bool.h new file mode 100644 index 00000000..655e5fe1 --- /dev/null +++ b/src/bool.h @@ -0,0 +1,5 @@ +#pragma once + +#ifndef __cplusplus +#include +#endif diff --git a/src/clock_gettime_macos.h b/src/clock_gettime_macos.h index d5f6d8a6..1145604e 100644 --- a/src/clock_gettime_macos.h +++ b/src/clock_gettime_macos.h @@ -19,7 +19,7 @@ #include #include #include -#include +#include "bool.h" #include #include diff --git a/src/common.h b/src/common.h index 53f82562..dc429cce 100644 --- a/src/common.h +++ b/src/common.h @@ -1,6 +1,6 @@ #pragma once -#include +#include "bool.h" #ifndef nullptr #define nullptr NULL #endif diff --git a/src/data_win.c b/src/data_win.c index d06babf1..a291ec10 100644 --- a/src/data_win.c +++ b/src/data_win.c @@ -1,7 +1,7 @@ #include "data_win.h" #include "binary_reader.h" -#include +#include "bool.h" #include #include #include diff --git a/src/data_win.h b/src/data_win.h index 814a412c..8914ec65 100644 --- a/src/data_win.h +++ b/src/data_win.h @@ -3,7 +3,7 @@ #include "common.h" #include #include -#include +#include "bool.h" #include #include diff --git a/src/desktop/platformdefs.h b/src/desktop/platformdefs.h index 5d2ec2dc..9f018962 100644 --- a/src/desktop/platformdefs.h +++ b/src/desktop/platformdefs.h @@ -1,6 +1,6 @@ #pragma once -#include +#include "bool.h" #include "runner.h" #include "input_recording.h" diff --git a/src/int_int_hashmap.h b/src/int_int_hashmap.h index dce3d11d..b5a50592 100644 --- a/src/int_int_hashmap.h +++ b/src/int_int_hashmap.h @@ -3,7 +3,7 @@ #include "common.h" #include "utils.h" #include -#include +#include "bool.h" // Open-addressing, linear-probing hashmap from int32_t to RValue. // diff --git a/src/int_rvalue_hashmap.h b/src/int_rvalue_hashmap.h index a9d5c4e7..c6a3c2c8 100644 --- a/src/int_rvalue_hashmap.h +++ b/src/int_rvalue_hashmap.h @@ -4,7 +4,7 @@ #include "utils.h" #include "rvalue.h" #include -#include +#include "bool.h" // Open-addressing, linear-probing hashmap from int32_t to RValue. // diff --git a/src/ps3/ps3_textures.h b/src/ps3/ps3_textures.h index b075524d..44749678 100644 --- a/src/ps3/ps3_textures.h +++ b/src/ps3/ps3_textures.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include "bool.h" #include // Loader for the PS3 textures.bin bundle produced by ButterscotchPreprocessor. diff --git a/src/runner_gamepad.h b/src/runner_gamepad.h index 97b67fee..72afc8f9 100644 --- a/src/runner_gamepad.h +++ b/src/runner_gamepad.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include "bool.h" #define MAX_GAMEPADS 16 diff --git a/src/runner_keyboard.h b/src/runner_keyboard.h index 2ad58508..5daebe4e 100644 --- a/src/runner_keyboard.h +++ b/src/runner_keyboard.h @@ -2,7 +2,7 @@ #include "common.h" #include -#include +#include "bool.h" // GML uses key codes 0-255 (vk_nokey=0, vk_anykey=1, ASCII codes, etc.) #define GML_KEY_COUNT 256 diff --git a/src/runner_mouse.c b/src/runner_mouse.c index e6ce6aa2..428c13bd 100644 --- a/src/runner_mouse.c +++ b/src/runner_mouse.c @@ -1,6 +1,6 @@ #include "runner_mouse.h" #include "utils.h" -#include +#include "bool.h" #include #include #include diff --git a/src/text_utils.h b/src/text_utils.h index bc0d6563..b7687835 100644 --- a/src/text_utils.h +++ b/src/text_utils.h @@ -2,7 +2,7 @@ #include "common.h" #include -#include +#include "bool.h" #include #include #include "data_win.h" From 64dcd2108e6b5c074ca8fef3807426e7ca5264c9 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Wed, 3 Jun 2026 20:19:27 -0400 Subject: [PATCH 08/18] comment --- src/bool.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bool.h b/src/bool.h index 655e5fe1..13d1b63e 100644 --- a/src/bool.h +++ b/src/bool.h @@ -1,5 +1,10 @@ #pragma once +/* + * GCC 2.95 requires building in C++ mode. + * GCC 2.95's stdbool.h doesn't work in C++ mode. + * C++ defines bool as a built-in keyword anyway. + */ #ifndef __cplusplus #include #endif From d9e5de433eeb066fc539e93afa3e9c95d895a0e8 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Wed, 3 Jun 2026 20:22:06 -0400 Subject: [PATCH 09/18] tweak comment --- src/bool.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bool.h b/src/bool.h index 13d1b63e..a697a27c 100644 --- a/src/bool.h +++ b/src/bool.h @@ -3,7 +3,7 @@ /* * GCC 2.95 requires building in C++ mode. * GCC 2.95's stdbool.h doesn't work in C++ mode. - * C++ defines bool as a built-in keyword anyway. + * C++ defines bool as a built-in type anyway. */ #ifndef __cplusplus #include From b9a14617733bd37fe5a7dba7daabde648172671f Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Wed, 3 Jun 2026 20:31:46 -0400 Subject: [PATCH 10/18] use common.h instead of a new header --- src/audio/ps2/ps2_audio_system.h | 1 - src/audio_system.h | 1 - src/binary_reader.h | 1 - src/bool.h | 10 ---------- src/clock_gettime_macos.h | 2 +- src/common.h | 9 ++++++++- src/data_win.c | 1 - src/data_win.h | 1 - src/desktop/platformdefs.h | 2 -- src/int_int_hashmap.h | 1 - src/int_rvalue_hashmap.h | 1 - src/ps3/ps3_textures.h | 2 +- src/runner_gamepad.h | 4 ++-- src/runner_keyboard.h | 1 - src/runner_mouse.c | 1 - src/text_utils.h | 1 - 16 files changed, 12 insertions(+), 27 deletions(-) delete mode 100644 src/bool.h diff --git a/src/audio/ps2/ps2_audio_system.h b/src/audio/ps2/ps2_audio_system.h index 8bb8342a..ec88620c 100644 --- a/src/audio/ps2/ps2_audio_system.h +++ b/src/audio/ps2/ps2_audio_system.h @@ -4,7 +4,6 @@ #include "audio_system.h" #include -#include "bool.h" #include #define MAX_PS2_SOUND_INSTANCES 64 diff --git a/src/audio_system.h b/src/audio_system.h index fcbba284..1f43a3df 100644 --- a/src/audio_system.h +++ b/src/audio_system.h @@ -2,7 +2,6 @@ #include "common.h" #include -#include "bool.h" #include "data_win.h" #include "file_system.h" diff --git a/src/binary_reader.h b/src/binary_reader.h index b48c4a86..6f05bcae 100644 --- a/src/binary_reader.h +++ b/src/binary_reader.h @@ -4,7 +4,6 @@ #include #include #include -#include "bool.h" typedef struct { FILE* file; diff --git a/src/bool.h b/src/bool.h deleted file mode 100644 index a697a27c..00000000 --- a/src/bool.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -/* - * GCC 2.95 requires building in C++ mode. - * GCC 2.95's stdbool.h doesn't work in C++ mode. - * C++ defines bool as a built-in type anyway. - */ -#ifndef __cplusplus -#include -#endif diff --git a/src/clock_gettime_macos.h b/src/clock_gettime_macos.h index 1145604e..b86778db 100644 --- a/src/clock_gettime_macos.h +++ b/src/clock_gettime_macos.h @@ -19,9 +19,9 @@ #include #include #include -#include "bool.h" #include #include +#include "common.h" #ifndef CLOCK_REALTIME typedef int clockid_t; diff --git a/src/common.h b/src/common.h index dc429cce..4cd161d0 100644 --- a/src/common.h +++ b/src/common.h @@ -1,6 +1,13 @@ #pragma once -#include "bool.h" +/* + * GCC 2.95 requires building in C++ mode. + * GCC 2.95's stdbool.h doesn't work in C++ mode. + * C++ defines bool as a built-in type anyway. + */ +#ifndef __cplusplus +#include +#endif #ifndef nullptr #define nullptr NULL #endif diff --git a/src/data_win.c b/src/data_win.c index a291ec10..471fa439 100644 --- a/src/data_win.c +++ b/src/data_win.c @@ -1,7 +1,6 @@ #include "data_win.h" #include "binary_reader.h" -#include "bool.h" #include #include #include diff --git a/src/data_win.h b/src/data_win.h index 8914ec65..2c4a98fe 100644 --- a/src/data_win.h +++ b/src/data_win.h @@ -3,7 +3,6 @@ #include "common.h" #include #include -#include "bool.h" #include #include diff --git a/src/desktop/platformdefs.h b/src/desktop/platformdefs.h index 9f018962..84484021 100644 --- a/src/desktop/platformdefs.h +++ b/src/desktop/platformdefs.h @@ -1,7 +1,5 @@ #pragma once -#include "bool.h" - #include "runner.h" #include "input_recording.h" diff --git a/src/int_int_hashmap.h b/src/int_int_hashmap.h index b5a50592..3ec1c81e 100644 --- a/src/int_int_hashmap.h +++ b/src/int_int_hashmap.h @@ -3,7 +3,6 @@ #include "common.h" #include "utils.h" #include -#include "bool.h" // Open-addressing, linear-probing hashmap from int32_t to RValue. // diff --git a/src/int_rvalue_hashmap.h b/src/int_rvalue_hashmap.h index c6a3c2c8..d20f09a2 100644 --- a/src/int_rvalue_hashmap.h +++ b/src/int_rvalue_hashmap.h @@ -4,7 +4,6 @@ #include "utils.h" #include "rvalue.h" #include -#include "bool.h" // Open-addressing, linear-probing hashmap from int32_t to RValue. // diff --git a/src/ps3/ps3_textures.h b/src/ps3/ps3_textures.h index 44749678..a04ba25b 100644 --- a/src/ps3/ps3_textures.h +++ b/src/ps3/ps3_textures.h @@ -1,7 +1,7 @@ #pragma once +#include "common.h" #include -#include "bool.h" #include // Loader for the PS3 textures.bin bundle produced by ButterscotchPreprocessor. diff --git a/src/runner_gamepad.h b/src/runner_gamepad.h index 72afc8f9..4f79059d 100644 --- a/src/runner_gamepad.h +++ b/src/runner_gamepad.h @@ -1,7 +1,7 @@ #pragma once #include -#include "bool.h" +#include "common.h" #define MAX_GAMEPADS 16 @@ -74,4 +74,4 @@ void RunnerGamepad_setAxisDeadzone(RunnerGamepadState* gp, int device, float dea int RunnerGamepad_getAxisCount(RunnerGamepadState* gp, int device); int RunnerGamepad_getButtonCount(RunnerGamepadState* gp, int device); int RunnerGamepad_getHatCount(RunnerGamepadState* gp, int device); -int RunnerGamepad_getHatValue(RunnerGamepadState* gp, int device, int hat); \ No newline at end of file +int RunnerGamepad_getHatValue(RunnerGamepadState* gp, int device, int hat); diff --git a/src/runner_keyboard.h b/src/runner_keyboard.h index 5daebe4e..a5aca7be 100644 --- a/src/runner_keyboard.h +++ b/src/runner_keyboard.h @@ -2,7 +2,6 @@ #include "common.h" #include -#include "bool.h" // GML uses key codes 0-255 (vk_nokey=0, vk_anykey=1, ASCII codes, etc.) #define GML_KEY_COUNT 256 diff --git a/src/runner_mouse.c b/src/runner_mouse.c index 428c13bd..fcec3445 100644 --- a/src/runner_mouse.c +++ b/src/runner_mouse.c @@ -1,6 +1,5 @@ #include "runner_mouse.h" #include "utils.h" -#include "bool.h" #include #include #include diff --git a/src/text_utils.h b/src/text_utils.h index b7687835..37ca8778 100644 --- a/src/text_utils.h +++ b/src/text_utils.h @@ -2,7 +2,6 @@ #include "common.h" #include -#include "bool.h" #include #include #include "data_win.h" From fd329f725efe87c2fcba0399f4a67649fa91bee5 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Fri, 5 Jun 2026 01:44:23 -0400 Subject: [PATCH 11/18] fix building on old sdl 1.2 versions --- src/desktop/backends/sdl1.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/desktop/backends/sdl1.c b/src/desktop/backends/sdl1.c index c5785707..564ab7e5 100644 --- a/src/desktop/backends/sdl1.c +++ b/src/desktop/backends/sdl1.c @@ -9,6 +9,13 @@ #include "input_recording.h" #include "desktop/platformdefs.h" +#ifndef SDL_BUTTON_WHEELUP +#define SDL_BUTTON_WHEELUP 4 +#endif +#ifndef SDL_BUTTON_WHEELDOWN +#define SDL_BUTTON_WHEELDOWN 5 +#endif + static Runner *g_runner; static int32_t fbWidth, fbHeight; static SDL_Surface* scr; From 229a659f3353417fdaabe10bab73b1a56b0b570c Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Fri, 5 Jun 2026 02:08:31 -0400 Subject: [PATCH 12/18] some files i missed the first time around --- src/ps2/gs_renderer.c | 121 ++++++++++++++++++++++---------------- src/ps2/ps2_file_system.c | 41 +++++++------ src/ps2/ps2_utils.c | 6 +- 3 files changed, 91 insertions(+), 77 deletions(-) diff --git a/src/ps2/gs_renderer.c b/src/ps2/gs_renderer.c index a146b9df..b9523e75 100644 --- a/src/ps2/gs_renderer.c +++ b/src/ps2/gs_renderer.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -15,9 +16,16 @@ #include "matrix_math.h" #ifdef ENABLE_PS2_RENDERER_LOGS -#define rendererPrintf(...) fprintf(stderr, __VA_ARGS__) +static void rendererPrintf(const char* fmt, ...) { + va_list args; + va_start(args, fmt); + vfprintf(stderr, fmt, args); + va_end(args); +} #else -#define rendererPrintf(...) ((void) 0) +static void rendererPrintf(const char* fmt, ...) { + (void)fmt; +} #endif // ===[ Constants ]=== @@ -149,7 +157,12 @@ static void loadAtlas(GsRenderer* gs) { gs->tileEntryMap = nullptr; repeat(gs->atlasTileCount, i) { AtlasTileEntry* entry = &gs->atlasTileEntries[i]; - TileLookupKey key = { .bgDef = entry->bgDef, .srcX = entry->srcX, .srcY = entry->srcY, .srcW = entry->srcW, .srcH = entry->srcH }; + TileLookupKey key = {0}; + key.bgDef = entry->bgDef; + key.srcX = entry->srcX; + key.srcY = entry->srcY; + key.srcW = entry->srcW; + key.srcH = entry->srcH; hmput(gs->tileEntryMap, key, entry); } @@ -910,7 +923,12 @@ static bool setupTextureForTPAG(GsRenderer* gs, GSTEXTURE* tex, int32_t tpagInde // Finds a tile entry by (bgDef, srcX, srcY, srcW, srcH). Returns nullptr if not found. static AtlasTileEntry* findTileEntry(GsRenderer* gs, int16_t bgDef, uint16_t srcX, uint16_t srcY, uint16_t srcW, uint16_t srcH) { - TileLookupKey key = { .bgDef = bgDef, .srcX = srcX, .srcY = srcY, .srcW = srcW, .srcH = srcH }; + TileLookupKey key = {0}; + key.bgDef = bgDef; + key.srcX = srcX; + key.srcY = srcY; + key.srcW = srcW; + key.srcH = srcH; ptrdiff_t idx = hmgeti(gs->tileEntryMap, key); if (idx == -1) return nullptr; return gs->tileEntryMap[idx].value; @@ -2947,54 +2965,7 @@ static bool gsSurfaceGetPixels(MAYBE_UNUSED Renderer* renderer, MAYBE_UNUSED int // ===[ Vtable ]=== -static RendererVtable gsVtable = { - .init = gsInit, - .destroy = gsDestroy, - .beginFrame = gsBeginFrame, - .endFrameInit = gsEndFrameInit, - .endFrameEnd = gsEndFrameEnd, - .beginView = gsBeginView, - .endView = gsEndView, - .applyProjection = gsApplyProjection, - .beginGUI = gsBeginGUI, - .endGUI = gsEndGUI, - .drawSprite = gsDrawSprite, - .drawSpritePos = gsDrawSpritePos, - .drawSpritePart = gsDrawSpritePart, - .drawRectangle = gsDrawRectangle, - .drawRectangleColor = gsDrawRectangleColor, - .drawLine = gsDrawLine, - .drawLineColor = gsDrawLineColor, - .drawText = gsDrawText, - .drawTextColor = gsDrawTextColor, - .drawTriangle = gsDrawTriangle, - .flush = gsFlush, - .clearScreen = gsClearScreen, - .createSpriteFromSurface = gsCreateSpriteFromSurface, - .deleteSprite = gsDeleteSprite, - .gpuSetBlendMode = gsGpuSetBlendMode, - .gpuSetBlendModeExt = gsGpuSetBlendModeExt, - .gpuSetBlendEnable = gsGpuSetBlendEnable, - .gpuGetBlendEnable = gsGpuGetBlendEnable, - .gpuSetAlphaTestEnable = gsGpuSetAlphaTestEnable, - .gpuSetAlphaTestRef = gsGpuSetAlphaTestRef, - .gpuSetColorWriteEnable = gsGpuSetColorWriteEnable, - .gpuGetColorWriteEnable = gsGpuGetColorWriteEnable, - .drawTile = gsDrawTile, - .drawTiled = gsDrawTiled, - .drawTiledPart = gsDrawTiledPart, - .createSurface = gsCreateSurface, - .surfaceExists = gsSurfaceExists, - .setRenderTarget = gsSetRenderTarget, - .ensureApplicationSurface = gsEnsureApplicationSurface, - .getSurfaceWidth = gsGetSurfaceWidth, - .getSurfaceHeight = gsGetSurfaceHeight, - .drawSurface = gsDrawSurface, - .surfaceResize = gsSurfaceResize, - .surfaceFree = gsSurfaceFree, - .surfaceCopy = gsSurfaceCopy, - .surfaceGetPixels = gsSurfaceGetPixels, -}; +static RendererVtable gsVtable; // ===[ Public API ]=== @@ -3002,6 +2973,52 @@ Renderer* GsRenderer_create(GSGLOBAL* gsGlobal, int64_t eeAtlasCacheMiB) { GsRenderer* gs = safeCalloc(1, sizeof(GsRenderer)); gs->eeAtlasCacheBytes = eeAtlasCacheMiB; gs->base.vtable = &gsVtable; + gsVtable.init = gsInit; + gsVtable.destroy = gsDestroy; + gsVtable.beginFrame = gsBeginFrame; + gsVtable.endFrameInit = gsEndFrameInit; + gsVtable.endFrameEnd = gsEndFrameEnd; + gsVtable.beginView = gsBeginView; + gsVtable.endView = gsEndView; + gsVtable.applyProjection = gsApplyProjection; + gsVtable.beginGUI = gsBeginGUI; + gsVtable.endGUI = gsEndGUI; + gsVtable.drawSprite = gsDrawSprite; + gsVtable.drawSpritePart = gsDrawSpritePart; + gsVtable.drawSpritePos = gsDrawSpritePos; + gsVtable.drawRectangle = gsDrawRectangle; + gsVtable.drawRectangleColor = gsDrawRectangleColor; + gsVtable.drawLine = gsDrawLine; + gsVtable.drawTriangle = gsDrawTriangle; + gsVtable.drawLineColor = gsDrawLineColor; + gsVtable.drawText = gsDrawText; + gsVtable.drawTextColor = gsDrawTextColor; + gsVtable.flush = gsFlush; + gsVtable.clearScreen = gsClearScreen; + gsVtable.createSpriteFromSurface = gsCreateSpriteFromSurface; + gsVtable.deleteSprite = gsDeleteSprite; + gsVtable.gpuSetBlendMode = gsGpuSetBlendMode; + gsVtable.gpuSetBlendModeExt = gsGpuSetBlendModeExt; + gsVtable.gpuSetBlendEnable = gsGpuSetBlendEnable; + gsVtable.gpuSetAlphaTestEnable = gsGpuSetAlphaTestEnable; + gsVtable.gpuSetAlphaTestRef = gsGpuSetAlphaTestRef; + gsVtable.gpuSetColorWriteEnable = gsGpuSetColorWriteEnable; + gsVtable.gpuGetColorWriteEnable = gsGpuGetColorWriteEnable; + gsVtable.gpuGetBlendEnable = gsGpuGetBlendEnable; + gsVtable.drawTile = gsDrawTile; + gsVtable.drawTiled = gsDrawTiled; + gsVtable.drawTiledPart = gsDrawTiledPart; + gsVtable.createSurface = gsCreateSurface; + gsVtable.surfaceExists = gsSurfaceExists; + gsVtable.setRenderTarget = gsSetRenderTarget; + gsVtable.ensureApplicationSurface = gsEnsureApplicationSurface; + gsVtable.getSurfaceWidth = gsGetSurfaceWidth; + gsVtable.getSurfaceHeight = gsGetSurfaceHeight; + gsVtable.drawSurface = gsDrawSurface; + gsVtable.surfaceResize = gsSurfaceResize; + gsVtable.surfaceFree = gsSurfaceFree; + gsVtable.surfaceCopy = gsSurfaceCopy; + gsVtable.surfaceGetPixels = gsSurfaceGetPixels; gs->gsGlobal = gsGlobal; gs->scaleX = 2.0f; gs->scaleY = 2.0f; diff --git a/src/ps2/ps2_file_system.c b/src/ps2/ps2_file_system.c index dbea9e48..f87b45e6 100644 --- a/src/ps2/ps2_file_system.c +++ b/src/ps2/ps2_file_system.c @@ -503,27 +503,7 @@ static FileSystemDirEntry* ps2ListDirectory(MAYBE_UNUSED FileSystem* fs, MAYBE_U // ===[ Vtable ]=== -static FileSystemVtable ps2FileSystemVtable = { - .resolvePath = resolvePath, - .fileExists = fileExists, - .readFileText = readFileText, - .writeFileText = writeFileText, - .deleteFile = deleteFile, - .readFileBinary = ps2ReadFileBinary, - .writeFileBinary = ps2WriteFileBinary, - .binaryOpen = ps2BinaryOpen, - .binaryClose = ps2BinaryClose, - .binaryRead = ps2BinaryRead, - .binaryWrite = ps2BinaryWrite, - .binaryTell = ps2BinaryTell, - .binarySeek = ps2BinarySeek, - .binarySize = ps2BinarySize, - .binaryRewrite = ps2BinaryRewrite, - .directoryExists = ps2DirectoryExists, - .createDirectory = ps2CreateDirectory, - .deleteDirectory = ps2DeleteDirectory, - .listDirectory = ps2ListDirectory, -}; +static FileSystemVtable ps2FileSystemVtable; // ===[ Lifecycle ]=== @@ -584,6 +564,25 @@ FileSystem* Ps2FileSystem_create(JsonValue* configRoot, const char* gameTitle) { Ps2FileSystem* pfs = safeCalloc(1, sizeof(Ps2FileSystem)); pfs->base.vtable = &ps2FileSystemVtable; + ps2FileSystemVtable.resolvePath = resolvePath; + ps2FileSystemVtable.fileExists = fileExists; + ps2FileSystemVtable.readFileText = readFileText; + ps2FileSystemVtable.writeFileText = writeFileText; + ps2FileSystemVtable.deleteFile = deleteFile; + ps2FileSystemVtable.readFileBinary = ps2ReadFileBinary; + ps2FileSystemVtable.writeFileBinary = ps2WriteFileBinary; + ps2FileSystemVtable.binaryOpen = ps2BinaryOpen; + ps2FileSystemVtable.binaryClose = ps2BinaryClose; + ps2FileSystemVtable.binaryRead = ps2BinaryRead; + ps2FileSystemVtable.binaryWrite = ps2BinaryWrite; + ps2FileSystemVtable.binaryTell = ps2BinaryTell; + ps2FileSystemVtable.binarySeek = ps2BinarySeek; + ps2FileSystemVtable.binarySize = ps2BinarySize; + ps2FileSystemVtable.binaryRewrite = ps2BinaryRewrite; + ps2FileSystemVtable.directoryExists = ps2DirectoryExists; + ps2FileSystemVtable.createDirectory = ps2CreateDirectory; + ps2FileSystemVtable.deleteDirectory = ps2DeleteDirectory; + ps2FileSystemVtable.listDirectory = ps2ListDirectory; pfs->gameTitle = safeStrdup(gameTitle); pfs->saveIconConfig = parseSaveIconConfig(configRoot); pfs->mappings = nullptr; diff --git a/src/ps2/ps2_utils.c b/src/ps2/ps2_utils.c index 39ac083d..9d293fd4 100644 --- a/src/ps2/ps2_utils.c +++ b/src/ps2/ps2_utils.c @@ -21,10 +21,8 @@ void PS2Utils_extractDeviceKey(const char* path) { result[length] = '\0'; // The "result" is the device key as a string (example: "mass" or "host") - deviceKey = (PS2DeviceKey) { - .key = result, - .usesISO9660 = strncmp(result, "cdrom", strlen("cdrom")) == 0, - }; + deviceKey.key = result; + deviceKey.usesISO9660 = strncmp(result, "cdrom", strlen("cdrom")) == 0; deviceKeyLoaded = true; } From 172e2a409723b462325d72f98343efd11d159ee7 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Fri, 5 Jun 2026 02:11:47 -0400 Subject: [PATCH 13/18] dont evaluate arguments when not in debug mode saves performance --- src/ps2/gs_renderer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ps2/gs_renderer.c b/src/ps2/gs_renderer.c index b9523e75..c7113ef0 100644 --- a/src/ps2/gs_renderer.c +++ b/src/ps2/gs_renderer.c @@ -23,9 +23,10 @@ static void rendererPrintf(const char* fmt, ...) { va_end(args); } #else -static void rendererPrintf(const char* fmt, ...) { +static void _rendererPrintf(const char* fmt, ...) { (void)fmt; } +#define rendererPrintf if (0) _rendererPrintf #endif // ===[ Constants ]=== From 7cf7a611ed9318b86616b4cf0c09d9a6486e67cb Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Fri, 5 Jun 2026 02:16:07 -0400 Subject: [PATCH 14/18] another file i missed --- src/web/main.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/web/main.c b/src/web/main.c index 59d648e1..6be2ab20 100644 --- a/src/web/main.c +++ b/src/web/main.c @@ -171,10 +171,9 @@ void* loop() { double remainingMs = nextFrameTimeMs - emscripten_get_now(); // Sleep for most of the remaining time, then spin-wait for precision. if (remainingMs > 2.0) { - struct timespec ts = { - .tv_sec = 0, - .tv_nsec = (long) ((remainingMs - 1.0) * 1000000.0) - }; + struct timespec ts; + ts.tv_sec = 0; + ts.tv_nsec = (long) ((remainingMs - 1.0) * 1000000.0); nanosleep(&ts, nullptr); } while (emscripten_get_now() < nextFrameTimeMs) { From d8936b0474526755727425c6f3aa44aa5948a62e Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Fri, 5 Jun 2026 02:18:16 -0400 Subject: [PATCH 15/18] no need to zero init --- src/json_reader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/json_reader.c b/src/json_reader.c index fca05643..72378698 100644 --- a/src/json_reader.c +++ b/src/json_reader.c @@ -357,7 +357,7 @@ JsonValue* JsonReader_parse(const char* json) { pos = 3; } - JsonParser parser = {0}; + JsonParser parser; parser.input = json; parser.position = pos; parser.length = len; From e34629f8a89e79522abbface22b32ef8a92370cf Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Fri, 5 Jun 2026 23:46:52 -0400 Subject: [PATCH 16/18] fix redefined warnings --- src/common.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/common.h b/src/common.h index 4cd161d0..6f135de0 100644 --- a/src/common.h +++ b/src/common.h @@ -12,6 +12,8 @@ #define nullptr NULL #endif +#include + #ifndef UINT32_MAX #define UINT32_MAX 0xFFFFFFFFU #endif From 95b5a29e447501c99ece1f918334f873dfe4c50e Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Sat, 6 Jun 2026 03:24:58 -0400 Subject: [PATCH 17/18] fix --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d729b27d..367a970a 100644 --- a/Makefile +++ b/Makefile @@ -75,7 +75,7 @@ LIBS += $(SDL1_LIBS) DEFINES += -DUSE_SDL1 endif ifeq ($(DESKTOP_BACKEND),sdl2) -SDL2_LIBS += $(shell pkg-config --libs sdl2) +SDL2_LIBS += $(shell pkg-config $(PKG_CONFIG_FLAGS) --libs sdl2) LIBS += $(SDL2_LIBS) DEFINES += -DUSE_SDL2 endif From 34096529c64a396dabcedab86975ac64770abdc5 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Sat, 6 Jun 2026 03:25:20 -0400 Subject: [PATCH 18/18] dont need this else --- Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Makefile b/Makefile index 367a970a..65c76ac2 100644 --- a/Makefile +++ b/Makefile @@ -53,8 +53,6 @@ endif SRCS += $(wildcard src/desktop/*.c) $(wildcard src/desktop/backends/$(DESKTOP_BACKEND).c) ifeq ($(OS),Windows) PKG_CONFIG_FLAGS := --static -else -PKG_CONFIG_FLAGS := endif INCLUDES += -Isrc/desktop ifeq ($(DESKTOP_BACKEND),glfw3)