From 5a7596f4d2b61ae53b6425b09c8356c56416c7b5 Mon Sep 17 00:00:00 2001 From: ChrisMiuchiz Date: Tue, 24 Sep 2019 19:03:07 -0400 Subject: [PATCH] Update to 0.9.1-3 --- CubeModLauncher/main.cpp | 8 ++++---- CubeModLoader/callbacks/ChatHandler.h | 9 +++++---- CubeModLoader/main.cpp | 17 ++++++++++------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/CubeModLauncher/main.cpp b/CubeModLauncher/main.cpp index 6fe56d0..201471e 100644 --- a/CubeModLauncher/main.cpp +++ b/CubeModLauncher/main.cpp @@ -5,11 +5,11 @@ #include "Process.h" #include "crc.h" -#define CUBE_VERSION "0.9.1-2" -#define CUBE_PACKED_CRC 0xBB798CFC -#define CUBE_UNPACKED_CRC 0x0EED2125 +#define CUBE_VERSION "0.9.1-3" +#define CUBE_PACKED_CRC 0x63C289B0 +#define CUBE_UNPACKED_CRC 0x55E44BE4 -#define MODLOADER_CRC 0xEC586C83 +#define MODLOADER_CRC 0x2345B6B7 #define CUBE_EXECUTABLE "cubeworld.exe" diff --git a/CubeModLoader/callbacks/ChatHandler.h b/CubeModLoader/callbacks/ChatHandler.h index f74530b..61767b9 100644 --- a/CubeModLoader/callbacks/ChatHandler.h +++ b/CubeModLoader/callbacks/ChatHandler.h @@ -15,7 +15,7 @@ void* ASMChatHandler_bail; void no_optimize ASMChatHandler() { asm(PUSH_ALL - "mov rcx, rdi \n" // The message + "mov rcx, rbx \n" // The message PREPARE_STACK @@ -32,6 +32,7 @@ void no_optimize ASMChatHandler() { // original code "mov qword ptr [rbp+0x78], 7 \n" "mov [rbp+0x70], r12 \n" + "mov [rbp+0x60], r12w \n" "jmp [ASMChatHandler_jmpback] \n" @@ -41,7 +42,7 @@ void no_optimize ASMChatHandler() { ); } void SetupChatHandler() { - WriteFarJMP(base+0x95F88, (void*)&ASMChatHandler); - ASMChatHandler_jmpback = (void*)base+0x95F95; - ASMChatHandler_bail = (void*)base+0x966D3; + WriteFarJMP(base+0x95FE8, (void*)&ASMChatHandler); + ASMChatHandler_jmpback = (void*)base+0x95FFA; + ASMChatHandler_bail = (void*)base+0x96733; } diff --git a/CubeModLoader/main.cpp b/CubeModLoader/main.cpp index 2c80307..1ac54b3 100644 --- a/CubeModLoader/main.cpp +++ b/CubeModLoader/main.cpp @@ -3,7 +3,7 @@ #include #include "DLL.h" -#define MOD_MAJOR_VERSION 1 +#define MOD_MAJOR_VERSION 2 #define MOD_MINOR_VERSION 1 @@ -12,7 +12,9 @@ #define MUST_IMPORT(dllname, name)\ dllname->name = GetProcAddress(dllname->handle, #name);\ if (!dllname->name) {\ - Popup("Error", "%s does not export " #name ".\n", dllname->fileName.c_str());\ + char ERROR_MESSAGE_POPUP[512] = {0};\ + sprintf(ERROR_MESSAGE_POPUP, "%s does not export " #name ".\n", dllname->fileName.c_str());\ + Popup("Error", ERROR_MESSAGE_POPUP);\ exit(1);\ } @@ -53,9 +55,7 @@ void SetupHandlers() { SetupChatHandler(); } -void Popup(char* title, char* format, ... ){ - char msg[512] = {0}; - sprintf(msg, format); +void Popup(char* title, char* msg ){ MessageBoxA(0, msg, title, MB_OK | MB_ICONINFORMATION); } @@ -93,16 +93,19 @@ extern "C" __declspec(dllexport) BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD } // Ensure version compatibility + char msg[512] = {0}; for (DLL* dll: modDLLs) { int majorVersion = ((int(*)())dll->ModMajorVersion)(); int minorVersion = ((int(*)())dll->ModMinorVersion)(); if (majorVersion != MOD_MAJOR_VERSION) { - Popup("Error", "%s has major version %d but requires %d.\n", dll->fileName.c_str(), majorVersion, MOD_MAJOR_VERSION); + sprintf(msg, "%s has major version %d but requires %d.\n", dll->fileName.c_str(), majorVersion, MOD_MAJOR_VERSION); + Popup("Error", msg); exit(1); } if (minorVersion > MOD_MINOR_VERSION) { - Popup("Error", "%s has minor version %d but requires %d or lower.\n", dll->fileName.c_str(), minorVersion, MOD_MINOR_VERSION); + sprintf(msg, "%s has minor version %d but requires %d or lower.\n", dll->fileName.c_str(), minorVersion, MOD_MINOR_VERSION); + Popup("Error", msg); exit(1); } }