mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Changed the implementation of ProcessorIdle
* now the same as CPU_USAGE_FIX in Mash's HRP, with a simpler toggle setting. * also avoids slowdowns if the player happens to enable both of them.
This commit is contained in:
+3
-6
@@ -1,5 +1,5 @@
|
|||||||
;sfall configuration settings
|
;sfall configuration settings
|
||||||
;v4.4.6
|
;v4.4.6.1
|
||||||
|
|
||||||
[Main]
|
[Main]
|
||||||
;Set to 1 to enable the built-in High Resolution Patch mode that is similar to the hi-res patch by Mash
|
;Set to 1 to enable the built-in High Resolution Patch mode that is similar to the hi-res patch by Mash
|
||||||
@@ -455,11 +455,8 @@ PlayIdleAnimOnReload=0
|
|||||||
;Default is 6. Set to 0 for a 12-hour timer
|
;Default is 6. Set to 0 for a 12-hour timer
|
||||||
CorpseDeleteTime=6
|
CorpseDeleteTime=6
|
||||||
|
|
||||||
;Set a number of milliseconds to idle each input loop
|
;Set to 1 to allow the game to go idle during each input loop, preventing 100% CPU usage
|
||||||
;Set to -1 to disable
|
ProcessorIdle=0
|
||||||
;Set to 0 to idle only if other processes are waiting for processor time (WinXP/2000: if processes have equal priority)
|
|
||||||
;Set to 1 (or some higher number if needed) to prevent 100% CPU use. The maximum is 50
|
|
||||||
ProcessorIdle=-1
|
|
||||||
|
|
||||||
;Set to 1 if using the hero appearance mod
|
;Set to 1 if using the hero appearance mod
|
||||||
;Set to 2 for backward compatibility with scripts that manually fix obj_art_fid/art_change_fid_num script functions for dude_obj
|
;Set to 2 for backward compatibility with scripts that manually fix obj_art_fid/art_change_fid_num script functions for dude_obj
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ static long __fastcall CreateWinDialog(long height, long yPos, long xPos, long c
|
|||||||
|
|
||||||
static __declspec(naked) void gdCreateHeadWindow_hook_win_add() {
|
static __declspec(naked) void gdCreateHeadWindow_hook_win_add() {
|
||||||
__asm {
|
__asm {
|
||||||
pop ebx; // ret addr
|
pop ebx; // ret addr
|
||||||
push eax; // xPos
|
push eax; // xPos
|
||||||
push ebx;
|
push ebx;
|
||||||
jmp CreateWinDialog;
|
jmp CreateWinDialog;
|
||||||
|
|||||||
+2
-11
@@ -155,15 +155,7 @@ static __declspec(naked) void gmouse_bk_process() {
|
|||||||
jmp fo::funcoffs::gmouse_bk_process_;
|
jmp fo::funcoffs::gmouse_bk_process_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
static __declspec(naked) void GNW95_process_message_hack() {
|
|
||||||
__asm {
|
|
||||||
call sfall::WinProc::WaitMessageWindow;
|
|
||||||
xor eax, eax;
|
|
||||||
retn
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
void Setting::init(const char* exeFileName, std::string &cmdline) {
|
void Setting::init(const char* exeFileName, std::string &cmdline) {
|
||||||
ViewMap::RedrawFix();
|
ViewMap::RedrawFix();
|
||||||
|
|
||||||
@@ -306,8 +298,7 @@ void Setting::init(const char* exeFileName, std::string &cmdline) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sf::IniReader::GetInt("OTHER_SETTINGS", "CPU_USAGE_FIX", 1, f2ResIni) != 0) {
|
if (sf::IniReader::GetInt("OTHER_SETTINGS", "CPU_USAGE_FIX", 1, f2ResIni)) {
|
||||||
//sf::MakeCall(0x4C9DA9, GNW95_process_message_hack, 11); // implementation by Mash
|
|
||||||
sf::MiscPatches::SetIdle(1);
|
sf::MiscPatches::SetIdle(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "..\FalloutEngine\Fallout2.h"
|
#include "..\FalloutEngine\Fallout2.h"
|
||||||
#include "..\SimplePatch.h"
|
#include "..\SimplePatch.h"
|
||||||
#include "..\Translate.h"
|
#include "..\Translate.h"
|
||||||
|
#include "..\WinProc.h"
|
||||||
|
|
||||||
#include "LoadGameHook.h"
|
#include "LoadGameHook.h"
|
||||||
|
|
||||||
@@ -37,11 +38,10 @@ static char versionString[65] = {};
|
|||||||
static int* scriptDialog = nullptr;
|
static int* scriptDialog = nullptr;
|
||||||
|
|
||||||
static __declspec(naked) void GNW95_process_message_hack() {
|
static __declspec(naked) void GNW95_process_message_hack() {
|
||||||
|
static const DWORD GNW95_process_message_Ret = 0x4C9DE6;
|
||||||
__asm {
|
__asm {
|
||||||
push idle;
|
call WinProc::WaitMessageWindow;
|
||||||
call Sleep;
|
jmp GNW95_process_message_Ret;
|
||||||
cmp dword ptr ds:[FO_VAR_GNW95_isActive], 0;
|
|
||||||
retn;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -894,7 +894,7 @@ static void EngineOptimizationPatches() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MiscPatches::SetIdle(int value) {
|
void MiscPatches::SetIdle(int value) {
|
||||||
idle = (value > 50) ? 50 : value;
|
idle = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MiscPatches::init() {
|
void MiscPatches::init() {
|
||||||
@@ -949,9 +949,8 @@ void MiscPatches::init() {
|
|||||||
fo::var::idle_func = reinterpret_cast<void*>(Sleep);
|
fo::var::idle_func = reinterpret_cast<void*>(Sleep);
|
||||||
SafeWrite16(0x4C9F12, 0x7D6A); // push 125 (ms)
|
SafeWrite16(0x4C9F12, 0x7D6A); // push 125 (ms)
|
||||||
|
|
||||||
int ms = IniReader::GetConfigInt("Misc", "ProcessorIdle", -1);
|
if (idle <= 0) idle = IniReader::GetConfigInt("Misc", "ProcessorIdle", -1);
|
||||||
if (ms > idle) SetIdle(ms);
|
if (idle > 0) MakeJump(0x4C9DA9, GNW95_process_message_hack, 3); // replace hack function from HRP by Mash
|
||||||
if (idle >= 0) MakeCall(0x4C9CF8, GNW95_process_message_hack, 2);
|
|
||||||
|
|
||||||
BlockCall(0x4425E6); // Patch out ereg call
|
BlockCall(0x4425E6); // Patch out ereg call
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ static bool isClosing = false;
|
|||||||
static bool cCursorShow = true;
|
static bool cCursorShow = true;
|
||||||
static bool bkgndErased = false;
|
static bool bkgndErased = false;
|
||||||
|
|
||||||
|
// Implementation from HRP by Mash
|
||||||
void __stdcall WinProc::MessageWindow() {
|
void __stdcall WinProc::MessageWindow() {
|
||||||
MSG msg;
|
MSG msg;
|
||||||
while (PeekMessageA(&msg, 0, 0, 0, 0)) {
|
while (PeekMessageA(&msg, 0, 0, 0, 0)) {
|
||||||
@@ -49,6 +50,7 @@ void __stdcall WinProc::MessageWindow() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Implementation from HRP by Mash
|
||||||
void __stdcall WinProc::WaitMessageWindow() {
|
void __stdcall WinProc::WaitMessageWindow() {
|
||||||
MsgWaitForMultipleObjectsEx(0, 0, 1, 0xFF, 0);
|
MsgWaitForMultipleObjectsEx(0, 0, 1, 0xFF, 0);
|
||||||
MessageWindow();
|
MessageWindow();
|
||||||
|
|||||||
Reference in New Issue
Block a user