Alpha dedicated

This commit is contained in:
Amos 2021-10-21 15:56:45 -07:00
parent ab12789faf
commit a4273fedfd
3 changed files with 32 additions and 27 deletions

View File

@ -41,22 +41,20 @@ void DisableRenderer()
void DisableClient() void DisableClient()
{ {
Sleep(5000);
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// JNZ --> JMP | Prevent EbisuSDK from initializing on the engine and server. // JNZ --> JMP | Prevent EbisuSDK from initializing on the engine and server.
Origin_Init.Offset(0x0B).Patch({ 0xE9, 0x63, 0x02, 0x00, 0x00, 0x00 }); Origin_Init.Offset(0x0B).Patch({ 0xE9, 0x63, 0x02, 0x00, 0x00, 0x00 });
Origin_SetState.Offset(0x0E).Patch({ 0xE9, 0xCB, 0x03, 0x00, 0x00 }); Origin_SetState.Offset(0x0E).Patch({ 0xE9, 0xCB, 0x03, 0x00, 0x00 });
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// JE --> JMP | Skip CreateGameWindow initialization code. // JE --> JMP | Skip CreateGameWindow initialization code.
CreateGameWindow.Offset(0x3DD).Patch({ 0xEB, 0x6D }); //CreateGameWindow.Offset(0x3DD).Patch({ 0xEB, 0x6D });
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// JNZ --> JMP | Skip CreateGameWindow validation code. // JNZ --> JMP | Skip CreateGameWindow validation code.
CreateGameWindow.Offset(0x44C).Patch({ 0xEB, 0x49 }); CreateGameWindow.Offset(0x44C).Patch({ 0xEB, 0x49 });
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// PUS --> XOR | Prevent ShowWindow and CreateGameWindow from being initialized. // PUS --> XOR | Prevent ShowWindow and CreateGameWindow from being initialized.
c1.Patch({ 0x30, 0xC0, 0xC3 }); c1.Offset(0x2C).Patch({ 0xE9, 0x9A, 0x00, 0x00, 0x00 });
//-------------------------------------------------------------------------
// PUS --> XOR | Prevent ShowWindow and CreateGameWindow from being initialized.
c1.Patch({ 0x30, 0xC0, 0xC3 });
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// JNE --> NOP | TODO: NOP 'particle_script' instead. // JNE --> NOP | TODO: NOP 'particle_script' instead.
c2.Offset(0x23C).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); c2.Offset(0x23C).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 });
@ -66,6 +64,16 @@ void DisableClient()
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// MOV --> NOP | TODO: NOP 'highlight_system' instead. // MOV --> NOP | TODO: NOP 'highlight_system' instead.
c3.Offset(0xA9).Patch({ 0x90, 0x90, 0x90, 0x90 }); c3.Offset(0xA9).Patch({ 0x90, 0x90, 0x90, 0x90 });
//-------------------------------------------------------------------------
// FUN --> RET |
c4.Patch({ 0xC3 });
c5.Patch({ 0xC3 });
c7.Patch({ 0xC3 });
//-------------------------------------------------------------------------
// JNE --> JMP |
c6.Offset(0x23).Patch({ 0xEB, 0x23 });
} }
void DisableVGUI() void DisableVGUI()
@ -120,7 +128,7 @@ void Hooks::DedicatedPatch()
//s1.Offset(0x1C6).Patch({ 0xE9, 0xAD, 0x11, 0x00, 0x00 }); // <-- this one was only used to debug. //s1.Offset(0x1C6).Patch({ 0xE9, 0xAD, 0x11, 0x00, 0x00 }); // <-- this one was only used to debug.
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// JNE --> JMP | Return early in _Host_RunFrame() for debugging perposes. // JNE --> JMP | Return early in _Host_RunFrame() for debugging perposes.
s1.Offset(0x1010).Patch({ 0xEB, 0x14 }); //s1.Offset(0x1010).Patch({ 0xEB, 0x14 });
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// CAL --> NOP | NOP NULL call as client is never initialized. // CAL --> NOP | NOP NULL call as client is never initialized.
s1.Offset(0x1023).Patch({ 0x90, 0x90, 0x90 }); s1.Offset(0x1023).Patch({ 0x90, 0x90, 0x90 });
@ -133,29 +141,22 @@ void Hooks::DedicatedPatch()
e0.Offset(0x182).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); e0.Offset(0x182).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 });
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// JNE --> JNP | Skip client.dll library initialization. // JNE --> JNP | Skip client.dll library initialization.
e0.Offset(0xA7D).Patch({ 0xE9, 0xF0, 0x01, 0x00, 0x00 }); //e0.Offset(0xA7D).Patch({ 0xE9, 0xF0, 0x01, 0x00, 0x00 });
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// JNE --> NOP | Skip settings field loading for client texture assets. // JNE --> NOP | Skip settings field loading for client texture assets.
// TODO: this is also used by server.dll library. // TODO: this is also used by server.dll library.
e1.Offset(0x213).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); e1.Offset(0x213).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 });
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// RET // CAL --> NOP | NOP call to unused VGUI code to prevent crash at SIGNONSTATE_PRESPAWN.
c4.Patch({ 0xC3 }); e3.Offset(0xFB0).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 });
c5.Patch({ 0xC3 });
c7.Patch({ 0xC3 });
//-------------------------------------------------------------------------
// JNE --> JMP |
c6.Offset(0x23).Patch({ 0xEB, 0x23 });
//-------------------------------------------------------------------------
// JNE --> JMP | (TEMP) jump over some settings block issues. not sure what to do here
s3.Offset(0x16C).Patch({ 0xE9, 0x47, 0x01, 0x00 });
//MemoryAddress(0x140E157F0).Patch({ 0xC3 });
//e4.Offset(0x20).Patch({ 0xE9, 0xE3, 0x00, 0x00, 0x00 });
//e5.Offset(0x21).Patch({ 0xE9, 0x35, 0x04, 0x00, 0x00 });
//e5.Offset(0x59).Patch({ 0xEB, 0x0A });
//e6.Offset(0x1B0).Patch({0x90, 0x90, 0x90});
OnLevelLoadingStarted.Offset(0x61).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); OnLevelLoadingStarted.Offset(0x61).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 });

View File

@ -54,6 +54,10 @@ namespace
MemoryAddress e0 = 0x0000000140236E40; // main Host_Init()? MemoryAddress e0 = 0x0000000140236E40; // main Host_Init()?
MemoryAddress e1 = 0x0000000140FB2F10; // also used by CServerGameDLL MemoryAddress e1 = 0x0000000140FB2F10; // also used by CServerGameDLL
MemoryAddress addr_CEngine_Frame = 0x00000001402970E0; MemoryAddress addr_CEngine_Frame = 0x00000001402970E0;
MemoryAddress e3 = 0x0000000140231C00;
MemoryAddress e4 = 0x0000000140BE1970;
MemoryAddress e5 = 0x0000000140DBBAF0;
MemoryAddress e6 = 0x0000000140DBE610;
// SERVER // SERVER
MemoryAddress s0 = 0x0000000140237B00; // server Host_Init()? MemoryAddress s0 = 0x0000000140237B00; // server Host_Init()?
@ -67,9 +71,9 @@ namespace
MemoryAddress c2 = 0x00000001403F4360; // 1403DF870 --> 1403F4360 MemoryAddress c2 = 0x00000001403F4360; // 1403DF870 --> 1403F4360
MemoryAddress c3 = 0x00000001403F8A80; // 1403DF870 --> 1403F8A40 MemoryAddress c3 = 0x00000001403F8A80; // 1403DF870 --> 1403F8A40
MemoryAddress c4 = 0x00000001405C27B0; // CHLClient + 1000 MemoryAddress c4 = 0x00000001405C27B0; // CHLClient + 1000
MemoryAddress c5 = 0x00000001405BAC00; // MemoryAddress c5 = 0x00000001405BAC00; // CHudMessage
MemoryAddress c6 = 0x00000001403CA2D0; // MemoryAddress c6 = 0x00000001403CA2D0; //
MemoryAddress c7 = 0x00000001403CC750; // lightmaps? MemoryAddress c7 = 0x00000001403CC750; // LightmapsInit
MemoryAddress CreateGameWindow = 0x0000000140343DE0; MemoryAddress CreateGameWindow = 0x0000000140343DE0;
// VGUI // VGUI

View File

@ -1,9 +1,9 @@
#include "pch.h" #include "pch.h"
#include "main.h" #include "main.h"
//---------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Print the error message to the console if any. // Print the error message to the console if any.
//---------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void PrintLastError() void PrintLastError()
{ {
DWORD errorMessageID = ::GetLastError(); DWORD errorMessageID = ::GetLastError();
@ -221,7 +221,7 @@ int main(int argc, char* argv[], char* envp[])
std::cout << "--------------------------------------------------------------------------------------------------------" << std::endl; std::cout << "--------------------------------------------------------------------------------------------------------" << std::endl;
spdlog::warn("Use DEBUG [1] for development and debugging perposes.\n"); spdlog::warn("Use DEBUG [1] for development and debugging perposes.\n");
spdlog::warn("Use RELEASE [2] for normal playing and server hosting.\n"); spdlog::warn("Use RELEASE [2] for normal playing and server hosting.\n");
spdlog::warn("Use DEDICATED [3] for running the server only without the client/ui components.\n"); spdlog::warn("Use DEDICATED [3] for running a dedicated server.\n");
std::cout << "--------------------------------------------------------------------------------------------------------" << std::endl; std::cout << "--------------------------------------------------------------------------------------------------------" << std::endl;
spdlog::info("Enter 1 for DEBUG. Enter 2 for RELEASE. Enter 3 for DEDICATED: "); spdlog::info("Enter 1 for DEBUG. Enter 2 for RELEASE. Enter 3 for DEDICATED: ");