From a4273fedfdfe347eb21954becf0d1a96d45ed259 Mon Sep 17 00:00:00 2001 From: Amos <48657826+Mauler125@users.noreply.github.com> Date: Thu, 21 Oct 2021 15:56:45 -0700 Subject: [PATCH] Alpha dedicated --- r5dedicated/opcodes.cpp | 43 +++++++++++++++++++++-------------------- r5dedicated/opcodes.h | 8 ++++++-- r5launcher/main.cpp | 8 ++++---- 3 files changed, 32 insertions(+), 27 deletions(-) diff --git a/r5dedicated/opcodes.cpp b/r5dedicated/opcodes.cpp index f53a53df..11ee8f11 100644 --- a/r5dedicated/opcodes.cpp +++ b/r5dedicated/opcodes.cpp @@ -41,22 +41,20 @@ void DisableRenderer() void DisableClient() { + Sleep(5000); //------------------------------------------------------------------------- // JNZ --> JMP | Prevent EbisuSDK from initializing on the engine and server. Origin_Init.Offset(0x0B).Patch({ 0xE9, 0x63, 0x02, 0x00, 0x00, 0x00 }); Origin_SetState.Offset(0x0E).Patch({ 0xE9, 0xCB, 0x03, 0x00, 0x00 }); //------------------------------------------------------------------------- // JE --> JMP | Skip CreateGameWindow initialization code. - CreateGameWindow.Offset(0x3DD).Patch({ 0xEB, 0x6D }); + //CreateGameWindow.Offset(0x3DD).Patch({ 0xEB, 0x6D }); //------------------------------------------------------------------------- // JNZ --> JMP | Skip CreateGameWindow validation code. CreateGameWindow.Offset(0x44C).Patch({ 0xEB, 0x49 }); //------------------------------------------------------------------------- // PUS --> XOR | Prevent ShowWindow and CreateGameWindow from being initialized. - c1.Patch({ 0x30, 0xC0, 0xC3 }); - //------------------------------------------------------------------------- - // PUS --> XOR | Prevent ShowWindow and CreateGameWindow from being initialized. - c1.Patch({ 0x30, 0xC0, 0xC3 }); + c1.Offset(0x2C).Patch({ 0xE9, 0x9A, 0x00, 0x00, 0x00 }); //------------------------------------------------------------------------- // JNE --> NOP | TODO: NOP 'particle_script' instead. c2.Offset(0x23C).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); @@ -66,6 +64,16 @@ void DisableClient() //------------------------------------------------------------------------- // MOV --> NOP | TODO: NOP 'highlight_system' instead. 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() @@ -120,7 +128,7 @@ void Hooks::DedicatedPatch() //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. - s1.Offset(0x1010).Patch({ 0xEB, 0x14 }); + //s1.Offset(0x1010).Patch({ 0xEB, 0x14 }); //------------------------------------------------------------------------- // CAL --> NOP | NOP NULL call as client is never initialized. s1.Offset(0x1023).Patch({ 0x90, 0x90, 0x90 }); @@ -133,29 +141,22 @@ void Hooks::DedicatedPatch() e0.Offset(0x182).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); //------------------------------------------------------------------------- // 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. // TODO: this is also used by server.dll library. e1.Offset(0x213).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); - //------------------------------------------------------------------------- - // RET - c4.Patch({ 0xC3 }); - 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 }); + // CAL --> NOP | NOP call to unused VGUI code to prevent crash at SIGNONSTATE_PRESPAWN. + e3.Offset(0xFB0).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); + //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 }); diff --git a/r5dedicated/opcodes.h b/r5dedicated/opcodes.h index e32e3877..de8e9a7a 100644 --- a/r5dedicated/opcodes.h +++ b/r5dedicated/opcodes.h @@ -54,6 +54,10 @@ namespace MemoryAddress e0 = 0x0000000140236E40; // main Host_Init()? MemoryAddress e1 = 0x0000000140FB2F10; // also used by CServerGameDLL MemoryAddress addr_CEngine_Frame = 0x00000001402970E0; + MemoryAddress e3 = 0x0000000140231C00; + MemoryAddress e4 = 0x0000000140BE1970; + MemoryAddress e5 = 0x0000000140DBBAF0; + MemoryAddress e6 = 0x0000000140DBE610; // SERVER MemoryAddress s0 = 0x0000000140237B00; // server Host_Init()? @@ -67,9 +71,9 @@ namespace MemoryAddress c2 = 0x00000001403F4360; // 1403DF870 --> 1403F4360 MemoryAddress c3 = 0x00000001403F8A80; // 1403DF870 --> 1403F8A40 MemoryAddress c4 = 0x00000001405C27B0; // CHLClient + 1000 - MemoryAddress c5 = 0x00000001405BAC00; // + MemoryAddress c5 = 0x00000001405BAC00; // CHudMessage MemoryAddress c6 = 0x00000001403CA2D0; // - MemoryAddress c7 = 0x00000001403CC750; // lightmaps? + MemoryAddress c7 = 0x00000001403CC750; // LightmapsInit MemoryAddress CreateGameWindow = 0x0000000140343DE0; // VGUI diff --git a/r5launcher/main.cpp b/r5launcher/main.cpp index 6dbaa7fd..fe00c562 100644 --- a/r5launcher/main.cpp +++ b/r5launcher/main.cpp @@ -1,9 +1,9 @@ #include "pch.h" #include "main.h" - //---------------------------------------------------------------------------- - // Print the error message to the console if any. - //---------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +// Print the error message to the console if any. +//----------------------------------------------------------------------------- void PrintLastError() { DWORD errorMessageID = ::GetLastError(); @@ -221,7 +221,7 @@ int main(int argc, char* argv[], char* envp[]) std::cout << "--------------------------------------------------------------------------------------------------------" << std::endl; 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 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; spdlog::info("Enter 1 for DEBUG. Enter 2 for RELEASE. Enter 3 for DEDICATED: ");