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/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/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" 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: