r5sdk/r5dev/resource/patch/r5apex_ds.patch
Kawe Mazidjatari 47ffee0043 Resource: additional dedicated build patches to improve runtime performance
Disabled additional unnecessary DX code from patched dedicated server executable, this allows the dedicated server to run RPaks containing models without any material or texture data. This also allows us to fully rebuild all RPaks for dedicated while also omitting material/texture data to further reduce memory usage during the parsing thereof, and overall disk size.
2024-06-01 11:52:53 +02:00

36 lines
2.0 KiB
Diff

//////////////////////////////////////////////////////////
// Dedicated server executable patch file; this executable
// also contains all patches listed in 'r5apex.exe.patch'.
/////////////////////////////
/////////////////////////////
//// Optimizations ////
/////////////////////////////
/////////////////////////////
// Unnecessary loop called from 'CModelLoader::UnloadModel'. This calls a 'nullsub' CMaterialGlue vtable method.
0x2553C0: "mov qword ptr ss:[rsp+0x10], rsi" --> "xor rax, rax; ret";
// CClientState constructor; Removed due to high mem allocation during init (100MiB+). 'CClientState' is useless on dedicated, and all its feature are thereof disabled.
0x6DA10: "sub rsp, 28h" --> "xor rax, rax; ret";
// RPak array contains 2 elements: 1='common_early', 2='ui'. Changing size to 1 only loads 'common_early'. 'ui' is not needed for dedi.
0x236354: "mov edi, 0x2" --> "mov edi, 0x1";
// Prevent 'g_pszMultiplayerUiPakName' from being assigned to string "ui_mp.rpak" (prevents it from loading this pak file).
0x340D07: "mov cs:g_pszMultiplayerUiPakName, rcx" --> "nop"
0x340FEA: "mov cs:g_pszMultiplayerUiPakName, rcx" --> "nop"
// Prevent 'fps_max' from being reset in 'CEngine::Frame' if 'sv_cheats' isn't set; this is bound to the server's tickrate in sdk code to save CPU time.
0x296587: "jnz short loc_1402971B7" --> "jmp short loc_1402971B7"
// Disable pak asset streaming system by calling Pak_Initialize() with mode 0,
// since the dedicated server doesn't use model or texture streaming, and as a
// result the files aren't shipped.
0x44BE87: "mov ecx, 0x1" --> "mov ecx, 0x0"
// Prevent this global bool from being set, as setting this enables CMaterialRenderContext code which shouldn't run on the dedicated server.
0x1E4CE0: "mov cs:byte_165C4D15B, al" --> "mov cs:byte_165C4D15B, 0x0"
// Prevent VFTable global pointer from being initialized to HardwareConfigDX11, which disables additional DX/Render code.
0x44A460: "lea rax, ds:off_141F03730" --> "nop"
0x44A467: "mov ds:off_141F03730, rax" --> "nop"