Added performance patches, some code moved to MiscPathes module

Minor edits to ddraw.ini.
This commit is contained in:
NovaRain
2020-03-22 09:00:25 +08:00
parent 349cffac0c
commit ffd397d9aa
5 changed files with 37 additions and 21 deletions
+3 -3
View File
@@ -85,7 +85,7 @@ GraphicsHeight=0
;Set to 0 to reset if the window position is incorrect
WindowData=0
;Uncomment the option to use a hardware shader (requires DX9 graphics mode 4 or 5)
;Uncomment the option to use a hardware shader (requires DX9 graphics mode)
;The shader file <name>.fx must be placed in <GameRoot>\<master_patches>\shaders\ and must contain one technique with one or more passes
;GlobalShaderFile=global.fx
@@ -103,7 +103,7 @@ GPUBlt=0
Use32BitHeadGraphics=0
;Set to 1 to automatically search for alternative avi video files when Fallout tries to play the game movies
;Requires DX9 graphics mode 4 or 5
;Requires DX9 graphics mode
AllowDShowMovies=0
;Fade effect time percentage modifier
@@ -188,7 +188,7 @@ SpeedKey7=0x00
SpeedKey8=0x00
SpeedKey9=0x00
;A key to hold down to move the window around when using graphics mode 5
;A key to hold down to move the window around when using DX9 graphics mode 5
;Set to 0 if you don't want to use a modifier key, or a DX scancode otherwise
;Set to -1 for either ctrl key, -2 for either alt key or -3 for either shift key
WindowScrollKey=0
-3
View File
@@ -3265,9 +3265,6 @@ void BugFixes::init()
// Place the player on a nearby empty tile if the entrance tile is blocked by another object when entering a map
HookCall(0x4836F8, map_check_state_hook);
// Remove duplicate code from intface_redraw_ engine function
BlockCall(0x45EBBF);
// Fix for critter_add/rm_trait functions ignoring the value of the "amount" argument
// Note: pass negative amount values to critter_rm_trait to remove all ranks of the perk (vanilla behavior)
HookCall(0x458CDB, op_critter_rm_trait_hook);
-12
View File
@@ -352,16 +352,6 @@ static void __declspec(naked) debug_log_hack() {
}
}
static void __declspec(naked) op_display_msg_hook() {
__asm {
cmp dword ptr ds:FO_VAR_debug_func, 0;
jne debug;
retn;
debug:
jmp fo::funcoffs::config_get_value_;
}
}
static void DebugModePatch() {
int dbgMode = iniGetInt("Debugging", "DebugMode", 0, ::sfall::ddrawIni);
if (dbgMode > 0) {
@@ -402,8 +392,6 @@ static void DebugModePatch() {
dlogr(" Done", DL_INIT);
}
// Just for speeding up display_msg function (optional)
HookCall(0x455404, op_display_msg_hook);
}
static void DontDeleteProtosPatch() {
+31
View File
@@ -596,7 +596,38 @@ void F1EngineBehaviorPatch() {
}
}
static void __declspec(naked) op_display_msg_hook() {
__asm {
cmp dword ptr ds:FO_VAR_debug_func, 0;
jne debug;
retn;
debug:
jmp fo::funcoffs::config_get_value_;
}
}
void EngineOptimizationPatches() {
// Speed up display_msg script function
HookCall(0x455404, op_display_msg_hook);
// Remove duplicate code from intface_redraw_ engine function
BlockCall(0x45EBBF);
// Improve performance of the data conversion of script interpreter
// mov eax, [edx+eax]; bswap eax; ret;
SafeWrite32(0x4672A4, 0x0F02048B);
SafeWrite16(0x4672A8, 0xC3C8);
// mov eax, [edx+eax]; bswap eax;
SafeWrite32(0x4673E5, 0x0F02048B);
SafeWrite8(0x4673E9, 0xC8);
// mov ax, [eax]; rol ax, 8; ret;
SafeWrite32(0x467292, 0x66008B66);
SafeWrite32(0x467296, 0xC308C0C1);
}
void MiscPatches::init() {
EngineOptimizationPatches();
if (GetConfigString("Misc", "StartingMap", "", mapName, 64)) {
dlog("Applying starting map patch.", DL_INIT);
SafeWrite32(0x480AAA, (DWORD)&mapName);
+3 -3
View File
@@ -44,7 +44,7 @@ result:
// retn;
error:
xor edx, edx;
jmp result;
jmp result;
}
}
@@ -60,7 +60,7 @@ result:
// retn;
error:
xor edx, edx;
jmp result;
jmp result;
}
}
@@ -76,7 +76,7 @@ result:
// retn;
error:
xor edx, edx;
jmp result;
jmp result;
}
}