From bb3f903f8d40c8fb13073cdb2d39d96bf2369d1a Mon Sep 17 00:00:00 2001 From: RAZER <79311432+CnCRAZER@users.noreply.github.com> Date: Sat, 23 Aug 2025 02:41:28 -0500 Subject: [PATCH 01/10] Add patch to rename ARTMD.INI to ARTYR.INI Introduces src/artyr_ini_patch.asm to overwrite the string at address 0x00826254, renaming ARTMD.INI to ARTYR.INI. Adds a SETSTRING macro for convenience in patch.inc and updates the Makefile to include the new object file. --- Makefile | 1 + inc/macros/patch.inc | 6 ++++++ src/artyr_ini_patch.asm | 5 +++++ 3 files changed, 12 insertions(+) create mode 100644 src/artyr_ini_patch.asm diff --git a/Makefile b/Makefile index b15d511..373da45 100644 --- a/Makefile +++ b/Makefile @@ -51,6 +51,7 @@ EXE_OBJS = \ src/online_optimizations.o \ src/rage_quit.o \ src/silent_cheer.o \ + src/artyr_ini_patch.o \ res/res.o \ sym.o diff --git a/inc/macros/patch.inc b/inc/macros/patch.inc index 4a1f9d5..bfad5bd 100644 --- a/inc/macros/patch.inc +++ b/inc/macros/patch.inc @@ -26,6 +26,12 @@ %endif %endmacro +; Convenience macro to overwrite a null-terminated ASCII string at an absolute address +; Usage: SETSTRING , "STRING" +%macro SETSTRING 2 + @SET %1, { db %2, 0 } +%endmacro + %macro @ENDPATCH 0 %ifctx __patch %$end: diff --git a/src/artyr_ini_patch.asm b/src/artyr_ini_patch.asm new file mode 100644 index 0000000..b4357b8 --- /dev/null +++ b/src/artyr_ini_patch.asm @@ -0,0 +1,5 @@ +%include "macros/patch.inc" + +; Rename ARTMD.INI -> ARTYR.INI at address 0x00826254 +; Based on original constant at that address (length 10 incl. NUL) +SETSTRING 0x00826254, "ARTYR.INI" From b03ef8ddd9137084664d344aab6cd2f7eab9160d Mon Sep 17 00:00:00 2001 From: RAZER <79311432+CnCRAZER@users.noreply.github.com> Date: Sat, 23 Aug 2025 20:31:50 -0500 Subject: [PATCH 02/10] Add option to hide FPS slider in in-game menu Introduces the HideFPSSlider variable and associated logic to conditionally hide the FPS/gamespeed slider in the in-game menu based on a spawn.ini setting. Includes a new assembly patch and updates to configuration loading to support this feature. --- inc/RA.h | 1 + src/hide_fps_slider.asm | 24 ++++++++++++++++++++++++ src/spawner/load_spawn.c | 4 +++- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 src/hide_fps_slider.asm diff --git a/inc/RA.h b/inc/RA.h index 84356e9..eca2827 100644 --- a/inc/RA.h +++ b/inc/RA.h @@ -23,6 +23,7 @@ extern bool RunAutoSS; extern bool DoingAutoSS; extern bool UsePNG; extern bool DisableChat; +extern bool HideFPSSlider; void *new(int32_t size); void __thiscall ScenarioClass_ReadLightingAndBasic(void *this, void *ini); diff --git a/src/hide_fps_slider.asm b/src/hide_fps_slider.asm new file mode 100644 index 0000000..65dbb40 --- /dev/null +++ b/src/hide_fps_slider.asm @@ -0,0 +1,24 @@ +%include "macros/patch.inc" +%include "macros/hack.inc" +%include "macros/datatypes.inc" +%include "session.inc" + +; Hide FPS/Gamespeed Slider from in-game menu based on spawn.ini setting +; This patch allows control over the FPS/gamespeed slider visibility in the pause/in-game menu +; +; Note: This patch works in conjunction with the spectators.asm patch and should be +; applied after it in the build order. + +cextern HideFPSSlider + +@HACK 0x004E20C0, _Hide_FPS_Slider_InGame_Menu_Override + cmp byte[HideFPSSlider], 1 + jz .HideSlider + + mov eax, dword [0x00A8B538] + test eax, eax + jmp 0x004E20C5 + +.HideSlider: + jmp 0x004E211A +@ENDHACK \ No newline at end of file diff --git a/src/spawner/load_spawn.c b/src/spawner/load_spawn.c index a6a4c95..8a1c4ce 100644 --- a/src/spawner/load_spawn.c +++ b/src/spawner/load_spawn.c @@ -185,6 +185,7 @@ int32_t ReconnectTimeout; bool QuickMatch = false; bool Ra2Mode = false; bool RunAutoSS; +bool HideFPSSlider = false; int __fastcall InitGame(int argc, char **argv); @@ -267,6 +268,7 @@ signed int Initialize_Spawn() MPSYNCDEBUG = MPDEBUG1 = MPDEBUG = false; RunAutoSS = INIClass__GetBool(&INIClass_SPAWN, "Settings", "RunAutoSS", false); + HideFPSSlider = INIClass__GetBool(&INIClass_SPAWN, "Settings", "HideFPSSlider", false); ConnTimeout = INIClass__GetInt(&INIClass_SPAWN, "Settings", "ConnTimeout", 3600); ReconnectTimeout=INIClass__GetInt(&INIClass_SPAWN, "Settings", "ReconnectTimeout", 2400); if (!DisableChat) @@ -473,4 +475,4 @@ void Load_Sides_Stuff() { HouseTypeClassArray[i]->vtable->Read_INI(HouseTypeClassArray[i], RulesINI); } -} +} \ No newline at end of file From 1b93997f010b8bb39e943c4c07249ca409bd723b Mon Sep 17 00:00:00 2001 From: RAZER <79311432+CnCRAZER@users.noreply.github.com> Date: Sat, 23 Aug 2025 21:06:31 -0500 Subject: [PATCH 03/10] Attempt #2 --- Makefile | 1 + src/hide_fps_slider.asm | 22 ++++++++++++++++------ src/spawner/spectators.asm | 14 -------------- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index b15d511..8420794 100644 --- a/Makefile +++ b/Makefile @@ -76,6 +76,7 @@ DLL_OBJS = src/ares.o \ SPAWNER_OBJS = \ src/custom_connection_timeout.o \ src/Hook_Main_Loop.o \ + src/hide_fps_slider.o \ src/spawner/add_player_node.o \ src/spawner/chat_ignore.o \ src/spawner/coop.o \ diff --git a/src/hide_fps_slider.asm b/src/hide_fps_slider.asm index 65dbb40..d430c8c 100644 --- a/src/hide_fps_slider.asm +++ b/src/hide_fps_slider.asm @@ -6,19 +6,29 @@ ; Hide FPS/Gamespeed Slider from in-game menu based on spawn.ini setting ; This patch allows control over the FPS/gamespeed slider visibility in the pause/in-game menu ; -; Note: This patch works in conjunction with the spectators.asm patch and should be -; applied after it in the build order. +; Note: This patch replaces the spectators.asm patch logic for the FPS slider cextern HideFPSSlider -@HACK 0x004E20C0, _Hide_FPS_Slider_InGame_Menu_Override +; This replaces the spectators.asm patch at 0x004E20BA +@HACK 0x004E20BA, _Hide_FPS_Slider_InGame_Menu_Override + ; First check if HideFPSSlider is enabled cmp byte[HideFPSSlider], 1 jz .HideSlider - mov eax, dword [0x00A8B538] - test eax, eax - jmp 0x004E20C5 + ; Then check for spectator mode (original spectators.asm logic) + cmp dword [SessionType], 5 + jnz .ShowSlider + + cmp dword [ObserverMode], 1 + jnz .ShowSlider .HideSlider: + ; Hide the slider (jump to the code that skips slider creation) jmp 0x004E211A + +.ShowSlider: + ; Show the slider (normal code path) + mov eax, dword [0x00A8B538] + jmp 0x004E20BF @ENDHACK \ No newline at end of file diff --git a/src/spawner/spectators.asm b/src/spawner/spectators.asm index c1efe57..3dc1ad5 100644 --- a/src/spawner/spectators.asm +++ b/src/spawner/spectators.asm @@ -55,20 +55,6 @@ jmp 0x004FC9E6 @ENDHACK -@HACK 0x004E20BA, _Dlg_Stuff_Show_Gamespeed_Slider_Skirmish_Spectator - cmp dword [SessionType], 5 - jnz .Normal_Code - - cmp dword [ObserverMode], 1 - jnz .Normal_Code - - jmp 0x004E211A - -.Normal_Code: - mov eax, dword [0x00A8B538] - jmp 0x004E20BF -@ENDHACK - @HACK 0x005533EA, _Select_Load_Screen_Skirmish_Spectator cmp dword [SessionType], 5 jnz .Normal_Code From 70d574a871c7dbf53e140e57d08771ab7d5a01fb Mon Sep 17 00:00:00 2001 From: RAZER <79311432+CnCRAZER@users.noreply.github.com> Date: Sat, 23 Aug 2025 21:40:00 -0500 Subject: [PATCH 04/10] Attempt #3 --- Makefile | 1 - src/hide_fps_slider.asm | 34 ---------------------------------- src/spawner/spectators.asm | 25 ++++++++++++++++++++++++- 3 files changed, 24 insertions(+), 36 deletions(-) delete mode 100644 src/hide_fps_slider.asm diff --git a/Makefile b/Makefile index 8420794..b15d511 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,6 @@ DLL_OBJS = src/ares.o \ SPAWNER_OBJS = \ src/custom_connection_timeout.o \ src/Hook_Main_Loop.o \ - src/hide_fps_slider.o \ src/spawner/add_player_node.o \ src/spawner/chat_ignore.o \ src/spawner/coop.o \ diff --git a/src/hide_fps_slider.asm b/src/hide_fps_slider.asm deleted file mode 100644 index d430c8c..0000000 --- a/src/hide_fps_slider.asm +++ /dev/null @@ -1,34 +0,0 @@ -%include "macros/patch.inc" -%include "macros/hack.inc" -%include "macros/datatypes.inc" -%include "session.inc" - -; Hide FPS/Gamespeed Slider from in-game menu based on spawn.ini setting -; This patch allows control over the FPS/gamespeed slider visibility in the pause/in-game menu -; -; Note: This patch replaces the spectators.asm patch logic for the FPS slider - -cextern HideFPSSlider - -; This replaces the spectators.asm patch at 0x004E20BA -@HACK 0x004E20BA, _Hide_FPS_Slider_InGame_Menu_Override - ; First check if HideFPSSlider is enabled - cmp byte[HideFPSSlider], 1 - jz .HideSlider - - ; Then check for spectator mode (original spectators.asm logic) - cmp dword [SessionType], 5 - jnz .ShowSlider - - cmp dword [ObserverMode], 1 - jnz .ShowSlider - -.HideSlider: - ; Hide the slider (jump to the code that skips slider creation) - jmp 0x004E211A - -.ShowSlider: - ; Show the slider (normal code path) - mov eax, dword [0x00A8B538] - jmp 0x004E20BF -@ENDHACK \ No newline at end of file diff --git a/src/spawner/spectators.asm b/src/spawner/spectators.asm index 3dc1ad5..65f894c 100644 --- a/src/spawner/spectators.asm +++ b/src/spawner/spectators.asm @@ -3,11 +3,11 @@ %include "macros/string.inc" %include "session.inc" +cextern HideFPSSlider ; Prevent losing/winning in skirmish spectator mode ; And allow skirmish spectators to control gamespeed ; Show observer loading screen for skirmish spectators -; TODO: Allow multiple spectators to watch an AI fight in multiplayer @HACK 0x004FCBD0, _HouseClass__Flag_To_Lose_Skirmsh_Spectator_Patch cmp dword [SessionType], 5 jnz .Normal_Code @@ -55,6 +55,29 @@ jmp 0x004FC9E6 @ENDHACK +@HACK 0x004E20BA, _Dlg_Stuff_Show_Gamespeed_Slider_Skirmish_Spectator + ; If HideFPSSlider is enabled, hide for everyone by forcing EAX=0 + cmp byte [HideFPSSlider], 1 + jnz .Check_Spectator + xor eax, eax + jmp 0x004E20BF + +.Check_Spectator: + ; When not hiding globally, keep original spectator force-show + cmp dword [SessionType], 5 + jnz .Normal_Code + + cmp dword [ObserverMode], 1 + jnz .Normal_Code + + ; Force show slider for spectators (original behavior) + jmp 0x004E211A + +.Normal_Code: + mov eax, dword [0x00A8B538] + jmp 0x004E20BF +@ENDHACK + @HACK 0x005533EA, _Select_Load_Screen_Skirmish_Spectator cmp dword [SessionType], 5 jnz .Normal_Code From 145a117e13dc7a68ce9f0bed085a9674f7752572 Mon Sep 17 00:00:00 2001 From: RAZER <79311432+CnCRAZER@users.noreply.github.com> Date: Sat, 23 Aug 2025 22:12:35 -0500 Subject: [PATCH 05/10] Update spectators.asm --- src/spawner/spectators.asm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/spawner/spectators.asm b/src/spawner/spectators.asm index 65f894c..a7f4af7 100644 --- a/src/spawner/spectators.asm +++ b/src/spawner/spectators.asm @@ -56,11 +56,18 @@ cextern HideFPSSlider @ENDHACK @HACK 0x004E20BA, _Dlg_Stuff_Show_Gamespeed_Slider_Skirmish_Spectator - ; If HideFPSSlider is enabled, hide for everyone by forcing EAX=0 + ; If HideFPSSlider is enabled, hide the slider control and skip its initialization cmp byte [HideFPSSlider], 1 jnz .Check_Spectator - xor eax, eax - jmp 0x004E20BF + ; Get handle of control 0x52A (the gamespeed/FPS slider) and hide it + push 0x52A ; nIDDlgItem + push esi ; hDlg + call edi ; GetDlgItem + push 0 ; nCmdShow = SW_HIDE + push eax ; hWnd + call ebp ; ShowWindow + ; Skip the slider initialization block entirely + jmp 0x004E215B .Check_Spectator: ; When not hiding globally, keep original spectator force-show From 646a27e3eaf9d2b1254a42d986f2781bf9e2178b Mon Sep 17 00:00:00 2001 From: RAZER <79311432+CnCRAZER@users.noreply.github.com> Date: Sat, 23 Aug 2025 22:46:55 -0500 Subject: [PATCH 06/10] Update spectators.asm --- src/spawner/spectators.asm | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/spawner/spectators.asm b/src/spawner/spectators.asm index a7f4af7..10d3b25 100644 --- a/src/spawner/spectators.asm +++ b/src/spawner/spectators.asm @@ -56,18 +56,30 @@ cextern HideFPSSlider @ENDHACK @HACK 0x004E20BA, _Dlg_Stuff_Show_Gamespeed_Slider_Skirmish_Spectator - ; If HideFPSSlider is enabled, hide the slider control and skip its initialization + ; If HideFPSSlider is enabled, hide the GameSpeed (FPS) slider group (IDs 0x529/0x714/0x671) cmp byte [HideFPSSlider], 1 jnz .Check_Spectator - ; Get handle of control 0x52A (the gamespeed/FPS slider) and hide it - push 0x52A ; nIDDlgItem - push esi ; hDlg - call edi ; GetDlgItem - push 0 ; nCmdShow = SW_HIDE - push eax ; hWnd - call ebp ; ShowWindow - ; Skip the slider initialization block entirely - jmp 0x004E215B + ; Hide gamespeed group controls + push 0x529 + push esi + call edi + push 0 + push eax + call ebp + push 0x714 + push esi + call edi + push 0 + push eax + call ebp + push 0x671 + push esi + call edi + push 0 + push eax + call ebp + ; Continue to initialize the remaining slider path + jmp 0x004E211A .Check_Spectator: ; When not hiding globally, keep original spectator force-show From cc23c5c218aa5d37f97ef5e30fc7c4cd9c99c611 Mon Sep 17 00:00:00 2001 From: RAZER <79311432+CnCRAZER@users.noreply.github.com> Date: Sat, 23 Aug 2025 23:56:04 -0500 Subject: [PATCH 07/10] rename HideFPSSlider to DisableGameSpeed --- inc/RA.h | 2 +- src/spawner/load_spawn.c | 4 ++-- src/spawner/spectators.asm | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/inc/RA.h b/inc/RA.h index eca2827..bfac8df 100644 --- a/inc/RA.h +++ b/inc/RA.h @@ -23,7 +23,7 @@ extern bool RunAutoSS; extern bool DoingAutoSS; extern bool UsePNG; extern bool DisableChat; -extern bool HideFPSSlider; +extern bool DisableGameSpeed; void *new(int32_t size); void __thiscall ScenarioClass_ReadLightingAndBasic(void *this, void *ini); diff --git a/src/spawner/load_spawn.c b/src/spawner/load_spawn.c index 8a1c4ce..37fa9d9 100644 --- a/src/spawner/load_spawn.c +++ b/src/spawner/load_spawn.c @@ -185,7 +185,7 @@ int32_t ReconnectTimeout; bool QuickMatch = false; bool Ra2Mode = false; bool RunAutoSS; -bool HideFPSSlider = false; +bool DisableGameSpeed = false; int __fastcall InitGame(int argc, char **argv); @@ -268,7 +268,7 @@ signed int Initialize_Spawn() MPSYNCDEBUG = MPDEBUG1 = MPDEBUG = false; RunAutoSS = INIClass__GetBool(&INIClass_SPAWN, "Settings", "RunAutoSS", false); - HideFPSSlider = INIClass__GetBool(&INIClass_SPAWN, "Settings", "HideFPSSlider", false); + DisableGameSpeed = INIClass__GetBool(&INIClass_SPAWN, "Settings", "DisableGameSpeed", false); ConnTimeout = INIClass__GetInt(&INIClass_SPAWN, "Settings", "ConnTimeout", 3600); ReconnectTimeout=INIClass__GetInt(&INIClass_SPAWN, "Settings", "ReconnectTimeout", 2400); if (!DisableChat) diff --git a/src/spawner/spectators.asm b/src/spawner/spectators.asm index 10d3b25..2edf7bd 100644 --- a/src/spawner/spectators.asm +++ b/src/spawner/spectators.asm @@ -3,7 +3,7 @@ %include "macros/string.inc" %include "session.inc" -cextern HideFPSSlider +cextern DisableGameSpeed ; Prevent losing/winning in skirmish spectator mode ; And allow skirmish spectators to control gamespeed @@ -56,8 +56,8 @@ cextern HideFPSSlider @ENDHACK @HACK 0x004E20BA, _Dlg_Stuff_Show_Gamespeed_Slider_Skirmish_Spectator - ; If HideFPSSlider is enabled, hide the GameSpeed (FPS) slider group (IDs 0x529/0x714/0x671) - cmp byte [HideFPSSlider], 1 + ; If DisableGameSpeed is enabled, hide the GameSpeed (FPS) slider group (IDs 0x529/0x714/0x671) + cmp byte [DisableGameSpeed], 1 jnz .Check_Spectator ; Hide gamespeed group controls push 0x529 From 470e9b38c5b91bc2543c3cf184026890ba28c073 Mon Sep 17 00:00:00 2001 From: RAZER <79311432+CnCRAZER@users.noreply.github.com> Date: Sun, 24 Aug 2025 10:50:08 -0500 Subject: [PATCH 08/10] Update spectators.asm --- src/spawner/spectators.asm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/spawner/spectators.asm b/src/spawner/spectators.asm index 2edf7bd..b87bc4a 100644 --- a/src/spawner/spectators.asm +++ b/src/spawner/spectators.asm @@ -97,6 +97,21 @@ cextern DisableGameSpeed jmp 0x004E20BF @ENDHACK +; Drop incoming GAMESPEED network events entirely when DisableGameSpeed is enabled +; Disassembly context (004C794B .. 004C79FE) shows this block is within Networking_RespondToEvent's +; case handler for GAMESPEED. We early out to the common epilogue at 0x004C79F4 to ignore it. +@HACK 0x004C794B, _Networking_HandleEvent_GAMESPEED_Block + cmp byte [DisableGameSpeed], 1 + jnz .Normal_Code + ; Discard the event: jump to epilogue/return of this handler + jmp 0x004C79F4 + +.Normal_Code: + ; Original first instruction we overwrote, then continue + mov edx, [esi+7] + jmp 0x004C794E +@ENDHACK + @HACK 0x005533EA, _Select_Load_Screen_Skirmish_Spectator cmp dword [SessionType], 5 jnz .Normal_Code From b52b605e2fc23d0152ec89cd2fd9d71dd106d516 Mon Sep 17 00:00:00 2001 From: RAZER <79311432+CnCRAZER@users.noreply.github.com> Date: Fri, 5 Sep 2025 17:12:13 -0500 Subject: [PATCH 09/10] Disable network patch Disable network patch --- src/spawner/spectators.asm | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/spawner/spectators.asm b/src/spawner/spectators.asm index b87bc4a..2edf7bd 100644 --- a/src/spawner/spectators.asm +++ b/src/spawner/spectators.asm @@ -97,21 +97,6 @@ cextern DisableGameSpeed jmp 0x004E20BF @ENDHACK -; Drop incoming GAMESPEED network events entirely when DisableGameSpeed is enabled -; Disassembly context (004C794B .. 004C79FE) shows this block is within Networking_RespondToEvent's -; case handler for GAMESPEED. We early out to the common epilogue at 0x004C79F4 to ignore it. -@HACK 0x004C794B, _Networking_HandleEvent_GAMESPEED_Block - cmp byte [DisableGameSpeed], 1 - jnz .Normal_Code - ; Discard the event: jump to epilogue/return of this handler - jmp 0x004C79F4 - -.Normal_Code: - ; Original first instruction we overwrote, then continue - mov edx, [esi+7] - jmp 0x004C794E -@ENDHACK - @HACK 0x005533EA, _Select_Load_Screen_Skirmish_Spectator cmp dword [SessionType], 5 jnz .Normal_Code From 2ed76956d4534384dc3bae176059d0463884d479 Mon Sep 17 00:00:00 2001 From: RAZER <79311432+CnCRAZER@users.noreply.github.com> Date: Sun, 21 Sep 2025 12:27:07 -0500 Subject: [PATCH 10/10] Squashed commit of the following: commit b52b605e2fc23d0152ec89cd2fd9d71dd106d516 Author: RAZER <79311432+CnCRAZER@users.noreply.github.com> Date: Fri Sep 5 17:12:13 2025 -0500 Disable network patch Disable network patch commit 470e9b38c5b91bc2543c3cf184026890ba28c073 Author: RAZER <79311432+CnCRAZER@users.noreply.github.com> Date: Sun Aug 24 10:50:08 2025 -0500 Update spectators.asm commit cc23c5c218aa5d37f97ef5e30fc7c4cd9c99c611 Author: RAZER <79311432+CnCRAZER@users.noreply.github.com> Date: Sat Aug 23 23:56:04 2025 -0500 rename HideFPSSlider to DisableGameSpeed commit 646a27e3eaf9d2b1254a42d986f2781bf9e2178b Author: RAZER <79311432+CnCRAZER@users.noreply.github.com> Date: Sat Aug 23 22:46:55 2025 -0500 Update spectators.asm commit 145a117e13dc7a68ce9f0bed085a9674f7752572 Author: RAZER <79311432+CnCRAZER@users.noreply.github.com> Date: Sat Aug 23 22:12:35 2025 -0500 Update spectators.asm commit 70d574a871c7dbf53e140e57d08771ab7d5a01fb Author: RAZER <79311432+CnCRAZER@users.noreply.github.com> Date: Sat Aug 23 21:40:00 2025 -0500 Attempt #3 commit 1b93997f010b8bb39e943c4c07249ca409bd723b Author: RAZER <79311432+CnCRAZER@users.noreply.github.com> Date: Sat Aug 23 21:06:31 2025 -0500 Attempt #2 commit b03ef8ddd9137084664d344aab6cd2f7eab9160d Author: RAZER <79311432+CnCRAZER@users.noreply.github.com> Date: Sat Aug 23 20:31:50 2025 -0500 Add option to hide FPS slider in in-game menu Introduces the HideFPSSlider variable and associated logic to conditionally hide the FPS/gamespeed slider in the in-game menu based on a spawn.ini setting. Includes a new assembly patch and updates to configuration loading to support this feature. --- inc/RA.h | 1 + src/spawner/load_spawn.c | 4 +++- src/spawner/spectators.asm | 30 +++++++++++++++++++++++++++++- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/inc/RA.h b/inc/RA.h index 84356e9..bfac8df 100644 --- a/inc/RA.h +++ b/inc/RA.h @@ -23,6 +23,7 @@ extern bool RunAutoSS; extern bool DoingAutoSS; extern bool UsePNG; extern bool DisableChat; +extern bool DisableGameSpeed; void *new(int32_t size); void __thiscall ScenarioClass_ReadLightingAndBasic(void *this, void *ini); diff --git a/src/spawner/load_spawn.c b/src/spawner/load_spawn.c index a6a4c95..37fa9d9 100644 --- a/src/spawner/load_spawn.c +++ b/src/spawner/load_spawn.c @@ -185,6 +185,7 @@ int32_t ReconnectTimeout; bool QuickMatch = false; bool Ra2Mode = false; bool RunAutoSS; +bool DisableGameSpeed = false; int __fastcall InitGame(int argc, char **argv); @@ -267,6 +268,7 @@ signed int Initialize_Spawn() MPSYNCDEBUG = MPDEBUG1 = MPDEBUG = false; RunAutoSS = INIClass__GetBool(&INIClass_SPAWN, "Settings", "RunAutoSS", false); + DisableGameSpeed = INIClass__GetBool(&INIClass_SPAWN, "Settings", "DisableGameSpeed", false); ConnTimeout = INIClass__GetInt(&INIClass_SPAWN, "Settings", "ConnTimeout", 3600); ReconnectTimeout=INIClass__GetInt(&INIClass_SPAWN, "Settings", "ReconnectTimeout", 2400); if (!DisableChat) @@ -473,4 +475,4 @@ void Load_Sides_Stuff() { HouseTypeClassArray[i]->vtable->Read_INI(HouseTypeClassArray[i], RulesINI); } -} +} \ No newline at end of file diff --git a/src/spawner/spectators.asm b/src/spawner/spectators.asm index c1efe57..2edf7bd 100644 --- a/src/spawner/spectators.asm +++ b/src/spawner/spectators.asm @@ -3,11 +3,11 @@ %include "macros/string.inc" %include "session.inc" +cextern DisableGameSpeed ; Prevent losing/winning in skirmish spectator mode ; And allow skirmish spectators to control gamespeed ; Show observer loading screen for skirmish spectators -; TODO: Allow multiple spectators to watch an AI fight in multiplayer @HACK 0x004FCBD0, _HouseClass__Flag_To_Lose_Skirmsh_Spectator_Patch cmp dword [SessionType], 5 jnz .Normal_Code @@ -56,12 +56,40 @@ @ENDHACK @HACK 0x004E20BA, _Dlg_Stuff_Show_Gamespeed_Slider_Skirmish_Spectator + ; If DisableGameSpeed is enabled, hide the GameSpeed (FPS) slider group (IDs 0x529/0x714/0x671) + cmp byte [DisableGameSpeed], 1 + jnz .Check_Spectator + ; Hide gamespeed group controls + push 0x529 + push esi + call edi + push 0 + push eax + call ebp + push 0x714 + push esi + call edi + push 0 + push eax + call ebp + push 0x671 + push esi + call edi + push 0 + push eax + call ebp + ; Continue to initialize the remaining slider path + jmp 0x004E211A + +.Check_Spectator: + ; When not hiding globally, keep original spectator force-show cmp dword [SessionType], 5 jnz .Normal_Code cmp dword [ObserverMode], 1 jnz .Normal_Code + ; Force show slider for spectators (original behavior) jmp 0x004E211A .Normal_Code: