mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Removed all WorldmapSpeed patches except the default one, fixed global worldmap scripts not working when speed patch is disabled
This commit is contained in:
@@ -169,21 +169,6 @@ WorldMapDelay2=66
|
||||
WorldMapEncounterFix=0
|
||||
WorldMapEncounterRate=5
|
||||
|
||||
;XX OBSOLETE XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
;XX
|
||||
;XX ;This will change the physical speed at which you move across the map
|
||||
;XX ;Set to 0 to leave at the default. (i.e. limited by vwait in windowed mode, or by processor speed in fullscreen)
|
||||
;XX ;If set to something other than 0, it enforces a maximum fps on the world map screen.
|
||||
;XX ;Changing this to something other than 0 is not recommended if you've already applied a world map speed patch to your Fallout exe.
|
||||
;XX WorldMapFPS=0
|
||||
;XX
|
||||
;XX ;Only set to 1 if your systems high performance timer is unreliable for some reason
|
||||
;XX ForceLowResolutionTimer=0
|
||||
;XX
|
||||
;XX ;Obsolete, but can still be used if you know what it does.
|
||||
;XX ;WorldMapDelay=0
|
||||
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
|
||||
;The number of slots available in the locations list panel of the world map
|
||||
;Set to 0 to leave unchanged. 17 is default.
|
||||
;Setting this greater than 17 requires a replacement background frm, or you'll get glitched graphics
|
||||
|
||||
+27
-108
@@ -80,12 +80,12 @@ static void __stdcall WorldmapLoopHook() {
|
||||
Worldmap::onWorldmapLoop.invoke();
|
||||
}
|
||||
|
||||
static DWORD wp_delay;
|
||||
static DWORD worldMapDelay;
|
||||
static void __declspec(naked) WorldMapFpsPatch() {
|
||||
__asm {
|
||||
pushad;
|
||||
call WorldmapLoopHook;
|
||||
mov ecx, wp_delay;
|
||||
mov ecx, worldMapDelay;
|
||||
tck:
|
||||
mov eax, ds : [0x50fb08];
|
||||
call fo::funcoffs::elapsed_time_;
|
||||
@@ -98,6 +98,16 @@ tck:
|
||||
}
|
||||
}
|
||||
|
||||
//Only used if the world map speed patch is disabled, so that world map scripts are still run
|
||||
static void __declspec(naked) WorldMapHook() {
|
||||
__asm {
|
||||
pushad;
|
||||
call WorldmapLoopHook;
|
||||
popad;
|
||||
jmp fo::funcoffs::get_input_;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) WorldMapEncPatch1() {
|
||||
__asm {
|
||||
inc dword ptr ds : [FO_VAR_wmLastRndTime]
|
||||
@@ -136,69 +146,6 @@ static void __declspec(naked) wmRndEncounterOccurred_hack() {
|
||||
}
|
||||
}
|
||||
|
||||
static double wm_nexttick;
|
||||
static double wm_wait;
|
||||
static bool wm_usingperf;
|
||||
static __int64 wm_perfadd;
|
||||
static __int64 wm_perfnext;
|
||||
static DWORD WorldMapLoopCount;
|
||||
static void WorldMapSpeedPatch3() {
|
||||
WorldmapLoopHook();
|
||||
if (wm_usingperf) {
|
||||
__int64 timer;
|
||||
while (true) {
|
||||
QueryPerformanceCounter((LARGE_INTEGER*)&timer);
|
||||
if (timer > wm_perfnext) break;
|
||||
Sleep(0);
|
||||
}
|
||||
if (wm_perfnext + wm_perfadd < timer) wm_perfnext = timer + wm_perfadd;
|
||||
else wm_perfnext += wm_perfadd;
|
||||
} else {
|
||||
DWORD tick;
|
||||
DWORD nexttick = (DWORD)wm_nexttick;
|
||||
while ((tick = GetTickCount()) < nexttick) Sleep(0);
|
||||
if (nexttick + wm_wait < tick) wm_nexttick = tick + wm_wait;
|
||||
else wm_nexttick += wm_wait;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) WorldMapSpeedPatch2() {
|
||||
__asm {
|
||||
pushad;
|
||||
call WorldMapSpeedPatch3;
|
||||
popad;
|
||||
call fo::funcoffs::get_input_;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) WorldMapSpeedPatch() {
|
||||
__asm {
|
||||
pushad;
|
||||
call WorldmapLoopHook;
|
||||
popad;
|
||||
push ecx;
|
||||
mov ecx, WorldMapLoopCount;
|
||||
ls:
|
||||
mov eax, eax;
|
||||
loop ls;
|
||||
pop ecx;
|
||||
call fo::funcoffs::get_input_;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
//Only used if the world map speed patch is disabled, so that world map scripts are still run
|
||||
static void WorldMapHook() {
|
||||
__asm {
|
||||
pushad;
|
||||
call WorldmapLoopHook;
|
||||
popad;
|
||||
call fo::funcoffs::get_input_;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ViewportHook() {
|
||||
__asm {
|
||||
call fo::funcoffs::wmWorldMapLoadTempData_;
|
||||
@@ -373,59 +320,31 @@ void ApplyTownMapsHotkeyFix() {
|
||||
}
|
||||
|
||||
void ApplyWorldmapFpsPatch() {
|
||||
DWORD tmp;
|
||||
if (GetConfigInt("Misc", "WorldMapFPSPatch", 0)) {
|
||||
dlog("Applying world map fps patch.", DL_INIT);
|
||||
if (*(DWORD*)0x004BFE5E != 0x8d16) {
|
||||
if (*(DWORD*)0x4BFE5E != 0x8d16) {
|
||||
dlogr(" Failed", DL_INIT);
|
||||
} else {
|
||||
wp_delay = GetConfigInt("Misc", "WorldMapDelay2", 66);
|
||||
HookCall(0x004BFE5D, WorldMapFpsPatch);
|
||||
worldMapDelay = GetConfigInt("Misc", "WorldMapDelay2", 66);
|
||||
HookCall(0x4BFE5D, WorldMapFpsPatch);
|
||||
::sfall::availableGlobalScriptTypes |= 2;
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
} else {
|
||||
tmp = GetConfigInt("Misc", "WorldMapFPS", 0);
|
||||
if (tmp) {
|
||||
dlog("Applying world map fps patch.", DL_INIT);
|
||||
if (*((WORD*)0x004CAFB9) == 0x0000) {
|
||||
::sfall::availableGlobalScriptTypes |= 2;
|
||||
SafeWrite32(0x004BFE5E, ((DWORD)&WorldMapSpeedPatch2) - 0x004BFE62);
|
||||
if (GetConfigInt("Misc", "ForceLowResolutionTimer", 0) || !QueryPerformanceFrequency((LARGE_INTEGER*)&wm_perfadd) || wm_perfadd <= 1000) {
|
||||
wm_wait = 1000.0 / (double)tmp;
|
||||
wm_nexttick = GetTickCount();
|
||||
wm_usingperf = false;
|
||||
} else {
|
||||
wm_usingperf = true;
|
||||
wm_perfadd /= tmp;
|
||||
wm_perfnext = 0;
|
||||
}
|
||||
}
|
||||
dlogr(" Done", DL_INIT);
|
||||
} else {
|
||||
tmp = GetConfigInt("Misc", "WorldMapDelay", 0);
|
||||
if (tmp) {
|
||||
if (*((WORD*)0x004CAFB9) == 0x3d40)
|
||||
SafeWrite32(0x004CAFBB, tmp);
|
||||
else if (*((WORD*)0x004CAFB9) == 0x0000) {
|
||||
SafeWrite32(0x004BFE5E, ((DWORD)&WorldMapSpeedPatch) - 0x004BFE62);
|
||||
WorldMapLoopCount = tmp;
|
||||
}
|
||||
} else {
|
||||
if (*(DWORD*)0x004BFE5E == 0x0000d816) {
|
||||
SafeWrite32(0x004BFE5E, ((DWORD)&WorldMapHook) - 0x004BFE62);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (GetConfigInt("Misc", "WorldMapEncounterFix", 0)) {
|
||||
dlog("Applying world map encounter patch.", DL_INIT);
|
||||
WorldMapEncounterRate = GetConfigInt("Misc", "WorldMapEncounterRate", 5);
|
||||
SafeWrite32(0x4C232D, 0x01EBC031); // xor eax, eax; jmps 0x4C2332
|
||||
HookCall(0x4BFEE0, &wmWorldMapFunc_hook);
|
||||
MakeCall(0x4C0667, &wmRndEncounterOccurred_hack, false);
|
||||
dlogr(" Done", DL_INIT);
|
||||
if (*(DWORD*)0x4BFE5E == 0x8d16) {
|
||||
HookCall(0x4BFE5D, WorldMapHook);
|
||||
::sfall::availableGlobalScriptTypes |= 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (GetConfigInt("Misc", "WorldMapEncounterFix", 0)) {
|
||||
dlog("Applying world map encounter patch.", DL_INIT);
|
||||
WorldMapEncounterRate = GetConfigInt("Misc", "WorldMapEncounterRate", 5);
|
||||
SafeWrite32(0x4C232D, 0x01EBC031); // xor eax, eax; jmps 0x4C2332
|
||||
HookCall(0x4BFEE0, &wmWorldMapFunc_hook);
|
||||
MakeCall(0x4C0667, &wmRndEncounterOccurred_hack, false);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
}
|
||||
|
||||
void ApplyPathfinderFix() {
|
||||
|
||||
Reference in New Issue
Block a user