Extra dedicated server optimizations

This commit is contained in:
Kawe Mazidjatari 2022-04-17 02:00:06 +02:00
parent 73a3748e7c
commit 7d869ca189
3 changed files with 16 additions and 2 deletions

View File

@ -40,7 +40,8 @@ void Dedicated_Init()
// CGAME
//-------------------------------------------------------------------------
{
p_CVideoMode_Common__CreateGameWindow.Offset(0x2C).Patch({ 0xE9, 0x9A, 0x00, 0x00, 0x00 }); // PUS --> XOR | Prevent ShowWindow and CreateGameWindow from being initialized (STGS RPak datatype is registered here).
p_CVideoMode_Common__CreateGameWindow.Offset(0x2C).Patch({ 0xE9, 0x9A, 0x00, 0x00, 0x00 }); // PUS --> XOR | Prevent ShowWindow and CreateGameWindow from being initialized (STGS RPak datatype is registered here).
p_CVideoMode_Common__CreateWindowClass.Offset(0x0).Patch({ 0xB8, 0x01, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Prevent CreateWindowClass from being initialized (returned true to satisy condition that checks window handle).
}
//-------------------------------------------------------------------------

View File

@ -6,9 +6,15 @@
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
inline CMemory p_CVideoMode_Common__CreateGameWindow = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x40\x56\x57\x48\x83\xEC\x38\x48\x8B\xF9\xE8\x00\x00\x00\x00"), "xxxxxxxxxxx????");
inline auto CVideoMode_Common__CreateGameWindow = p_CVideoMode_Common__CreateGameWindow.RCast<bool (*)(int* pnRect)>(); /*40 56 57 48 83 EC 38 48 8B F9 E8 ? ? ? ?*/
inline CMemory p_CVideoMode_Common__CreateWindowClass = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x40\x55\x53\x57\x41\x56\x48\x8D\xAC\x24\x00\x00\x00\x00\x48\x81\xEC\x00\x00\x00\x00\x4C\x8B\xF1"), "xxxxxxxxxx????xxx????xxx");
inline auto CVideoMode_Common__CreateWindowClass = p_CVideoMode_Common__CreateWindowClass.RCast<HWND(*)(vrect_t* pnRect)>(); /*40 55 53 57 41 56 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 4C 8B F1*/
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
inline CMemory p_CVideoMode_Common__CreateGameWindow = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x40\x56\x57\x48\x83\xEC\x28\x48\x8B\xF9\xE8\x00\x00\x00\x00\x48\x8B\xF0"), "xxxxxxxxxxx????xxx");
inline auto CVideoMode_Common__CreateGameWindow = p_CVideoMode_Common__CreateGameWindow.RCast<bool (*)(int* pnRect)>(); /*40 56 57 48 83 EC 28 48 8B F9 E8 ? ? ? ? 48 8B F0*/
inline CMemory p_CVideoMode_Common__CreateWindowClass = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x40\x55\x53\x57\x48\x8D\xAC\x24\x00\x00\x00\x00\x48\x81\xEC\x00\x00\x00\x00\x48\x8B\xF9\xFF\x15\x00\x00\x00\x00"), "xxxxxxxx????xxx????xxxxx????");
inline auto CVideoMode_Common__CreateWindowClass = p_CVideoMode_Common__CreateWindowClass.RCast<HWND(*)(vrect_t* pnRect)>(); /*40 55 53 57 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 48 8B F9 FF 15 ? ? ? ?*/
#endif
void HCVideoMode_Common_Attach();
@ -19,7 +25,8 @@ class HVideoMode_Common : public IDetour
{
virtual void GetAdr(void) const
{
std::cout << "| FUN: CVideoMode_Common::CreateGameWindow : 0x" << std::hex << std::uppercase << p_CVideoMode_Common__CreateGameWindow.GetPtr() << std::setw(nPad) << " |" << std::endl;
std::cout << "| FUN: CVideoMode_Common::CreateGameWindow : 0x" << std::hex << std::uppercase << p_CVideoMode_Common__CreateGameWindow.GetPtr() << std::setw(nPad) << " |" << std::endl;
std::cout << "| FUN: CVideoMode_Common::CreateWindowClass : 0x" << std::hex << std::uppercase << p_CVideoMode_Common__CreateWindowClass.GetPtr() << std::setw(nPad) << " |" << std::endl;
std::cout << "+----------------------------------------------------------------+" << std::endl;
}
virtual void GetFun(void) const { }

View File

@ -35,5 +35,11 @@
#define MAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
#endif
struct vrect_t
{
int x, y, width, height;
vrect_t* pnext;
};
constexpr int MAX_NETCONSOLE_INPUT_LEN = 4096;
constexpr int MSG_NOSIGNAL = 0;