Update to 0.9.1-3

This commit is contained in:
ChrisMiuchiz 2019-09-24 19:03:07 -04:00
parent 0b4c458041
commit 5a7596f4d2
3 changed files with 19 additions and 15 deletions

View File

@ -5,11 +5,11 @@
#include "Process.h" #include "Process.h"
#include "crc.h" #include "crc.h"
#define CUBE_VERSION "0.9.1-2" #define CUBE_VERSION "0.9.1-3"
#define CUBE_PACKED_CRC 0xBB798CFC #define CUBE_PACKED_CRC 0x63C289B0
#define CUBE_UNPACKED_CRC 0x0EED2125 #define CUBE_UNPACKED_CRC 0x55E44BE4
#define MODLOADER_CRC 0xEC586C83 #define MODLOADER_CRC 0x2345B6B7
#define CUBE_EXECUTABLE "cubeworld.exe" #define CUBE_EXECUTABLE "cubeworld.exe"

View File

@ -15,7 +15,7 @@ void* ASMChatHandler_bail;
void no_optimize ASMChatHandler() { void no_optimize ASMChatHandler() {
asm(PUSH_ALL asm(PUSH_ALL
"mov rcx, rdi \n" // The message "mov rcx, rbx \n" // The message
PREPARE_STACK PREPARE_STACK
@ -32,6 +32,7 @@ void no_optimize ASMChatHandler() {
// original code // original code
"mov qword ptr [rbp+0x78], 7 \n" "mov qword ptr [rbp+0x78], 7 \n"
"mov [rbp+0x70], r12 \n" "mov [rbp+0x70], r12 \n"
"mov [rbp+0x60], r12w \n"
"jmp [ASMChatHandler_jmpback] \n" "jmp [ASMChatHandler_jmpback] \n"
@ -41,7 +42,7 @@ void no_optimize ASMChatHandler() {
); );
} }
void SetupChatHandler() { void SetupChatHandler() {
WriteFarJMP(base+0x95F88, (void*)&ASMChatHandler); WriteFarJMP(base+0x95FE8, (void*)&ASMChatHandler);
ASMChatHandler_jmpback = (void*)base+0x95F95; ASMChatHandler_jmpback = (void*)base+0x95FFA;
ASMChatHandler_bail = (void*)base+0x966D3; ASMChatHandler_bail = (void*)base+0x96733;
} }

View File

@ -3,7 +3,7 @@
#include <vector> #include <vector>
#include "DLL.h" #include "DLL.h"
#define MOD_MAJOR_VERSION 1 #define MOD_MAJOR_VERSION 2
#define MOD_MINOR_VERSION 1 #define MOD_MINOR_VERSION 1
@ -12,7 +12,9 @@
#define MUST_IMPORT(dllname, name)\ #define MUST_IMPORT(dllname, name)\
dllname->name = GetProcAddress(dllname->handle, #name);\ dllname->name = GetProcAddress(dllname->handle, #name);\
if (!dllname->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);\ exit(1);\
} }
@ -53,9 +55,7 @@ void SetupHandlers() {
SetupChatHandler(); SetupChatHandler();
} }
void Popup(char* title, char* format, ... ){ void Popup(char* title, char* msg ){
char msg[512] = {0};
sprintf(msg, format);
MessageBoxA(0, msg, title, MB_OK | MB_ICONINFORMATION); 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 // Ensure version compatibility
char msg[512] = {0};
for (DLL* dll: modDLLs) { for (DLL* dll: modDLLs) {
int majorVersion = ((int(*)())dll->ModMajorVersion)(); int majorVersion = ((int(*)())dll->ModMajorVersion)();
int minorVersion = ((int(*)())dll->ModMinorVersion)(); int minorVersion = ((int(*)())dll->ModMinorVersion)();
if (majorVersion != MOD_MAJOR_VERSION) { 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); exit(1);
} }
if (minorVersion > MOD_MINOR_VERSION) { 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); exit(1);
} }
} }