diff --git a/sfall/Modules/MiscPatches.cpp b/sfall/Modules/MiscPatches.cpp index d4384547..d33b0a42 100644 --- a/sfall/Modules/MiscPatches.cpp +++ b/sfall/Modules/MiscPatches.cpp @@ -509,17 +509,16 @@ static void PipboyAvailableAtStartPatch() { }; break; case 2: - SafeWrite8(0x497011, 0xEB); // skip the vault suit movie check + SafeWrite8(0x497011, CodeType::JumpShort); // skip the vault suit movie check break; } } static void DisableHorriganPatch() { if (GetConfigInt("Misc", "DisableHorrigan", 0)) { - LoadGameHook::OnAfterNewGame() += []() { + LoadGameHook::OnAfterGameStarted() += []() { fo::var::Meet_Frank_Horrigan = true; }; - SafeWrite8(0x4C06D8, 0xEB); // skip the Horrigan encounter check } } diff --git a/sfall/Modules/Movies.cpp b/sfall/Modules/Movies.cpp index ea2fc137..dead6d8b 100644 --- a/sfall/Modules/Movies.cpp +++ b/sfall/Modules/Movies.cpp @@ -472,20 +472,22 @@ void Movies::init() { if (*((DWORD*)0x00518DA0) != 0x00503300) { dlog("Error: The value at address 0x001073A0 is not equal to 0x00503300.", DL_INIT); } + + char optName[8] = "Movie"; for (int i = 0; i < MaxMovies; i++) { - MoviePtrs[i] = (DWORD)&MoviePaths[65 * i]; - MoviePaths[i * 65 + 64] = 0; - char ininame[8]; - strcpy_s(ininame, "Movie"); - _itoa_s(i + 1, &ininame[5], 3, 10); + int index = 65 * i; + MoviePtrs[i] = (DWORD)&MoviePaths[index]; + MoviePaths[index + 64] = '\0'; + + _itoa_s(i + 1, &optName[5], 3, 10); if (i < 17) { - GetConfigString("Misc", ininame, fo::var::movie_list[i], &MoviePaths[i * 65], 65); + GetConfigString("Misc", optName, fo::var::movie_list[i], &MoviePaths[index], 65); } else { - GetConfigString("Misc", ininame, "", &MoviePaths[i * 65], 65); + GetConfigString("Misc", optName, "", &MoviePaths[index], 65); } } dlog(".", DL_INIT); - SafeWriteBatch((DWORD)MoviePtrs, {0x44E6AE, 0x44E721, 0x44E75E, 0x44E78A}); + SafeWriteBatch((DWORD)MoviePtrs, {0x44E6AE, 0x44E721, 0x44E75E, 0x44E78A}); // gmovie_play_ dlog(".", DL_INIT); /* diff --git a/sfall/SafeWrite.cpp b/sfall/SafeWrite.cpp index a90b3d2d..13870e22 100644 --- a/sfall/SafeWrite.cpp +++ b/sfall/SafeWrite.cpp @@ -1,15 +1,8 @@ -#include "main.h" -#include "CheckAddress.h" +#include "SafeWrite.h" namespace sfall { -enum CodeType : BYTE { - Call = 0xE8, - Jump = 0xE9, - Nop = 0x90 -}; - static void __stdcall SafeWriteFunc(BYTE code, DWORD addr, void* func) { DWORD oldProtect, data = (DWORD)func - (addr + 5); diff --git a/sfall/SafeWrite.h b/sfall/SafeWrite.h index 530aab8c..f302c502 100644 --- a/sfall/SafeWrite.h +++ b/sfall/SafeWrite.h @@ -7,6 +7,15 @@ namespace sfall { +enum CodeType : BYTE { + Call = 0xE8, + Jump = 0xE9, + Nop = 0x90, + JumpShort = 0xEB, // 0xEB [jmp short ...] + JumpNZ = 0x75, // 0x75 [jnz short ...] + JumpZ = 0x74, // 0x74 [jz short ...] +}; + template void __stdcall SafeWrite(DWORD addr, T data) { DWORD oldProtect;