Update to 1.0.0-1
This commit is contained in:
parent
7dcdcd6917
commit
098fd15371
|
@ -5,11 +5,11 @@
|
||||||
#include "Process.h"
|
#include "Process.h"
|
||||||
#include "crc.h"
|
#include "crc.h"
|
||||||
|
|
||||||
#define CUBE_VERSION "0.9.1-4"
|
#define CUBE_VERSION "1.0.0-1"
|
||||||
#define CUBE_PACKED_CRC 0x4CC03A4E
|
#define CUBE_PACKED_CRC 0xC7682619
|
||||||
#define CUBE_UNPACKED_CRC 0x6F879A76
|
#define CUBE_UNPACKED_CRC 0xBA092543
|
||||||
|
|
||||||
#define MODLOADER_CRC 0x2201A3EA
|
#define MODLOADER_CRC 0x39D18E98
|
||||||
|
|
||||||
#define CUBE_EXECUTABLE "cubeworld.exe"
|
#define CUBE_EXECUTABLE "cubeworld.exe"
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ class DLL
|
||||||
|
|
||||||
// Callbacks
|
// Callbacks
|
||||||
FARPROC HandleChat;
|
FARPROC HandleChat;
|
||||||
|
FARPROC HandleP2PRequest;
|
||||||
|
|
||||||
DLL(std::string fileName);
|
DLL(std::string fileName);
|
||||||
HMODULE Load();
|
HMODULE Load();
|
||||||
|
|
|
@ -30,9 +30,9 @@ void no_optimize ASMChatHandler() {
|
||||||
POP_ALL
|
POP_ALL
|
||||||
|
|
||||||
// original code
|
// original code
|
||||||
"mov qword ptr [rbp+0x78], 7 \n"
|
"mov qword ptr [rbp+0x88], 7 \n"
|
||||||
"mov [rbp+0x70], r12 \n"
|
"mov [rbp+0x80], r12 \n"
|
||||||
"mov [rbp+0x60], r12w \n"
|
"mov [rbp+0x70], r12w \n"
|
||||||
"jmp [ASMChatHandler_jmpback] \n"
|
"jmp [ASMChatHandler_jmpback] \n"
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ void no_optimize ASMChatHandler() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
void SetupChatHandler() {
|
void SetupChatHandler() {
|
||||||
WriteFarJMP(base+0x97108, (void*)&ASMChatHandler);
|
WriteFarJMP(base+0x97198, (void*)&ASMChatHandler);
|
||||||
ASMChatHandler_jmpback = (void*)base+0x9711A;
|
ASMChatHandler_jmpback = (void*)base+0x971B0;
|
||||||
ASMChatHandler_bail = (void*)base+0x9785A;
|
ASMChatHandler_bail = (void*)base+0x9777A;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
int P2PRequestHandler(long long steamID) {
|
||||||
|
for (DLL* dll: modDLLs) {
|
||||||
|
if (dll->HandleP2PRequest) {
|
||||||
|
if ( int result = ((int(*)(long long))dll->HandleP2PRequest)(steamID) ){
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
void* P2PRequestHandler_ptr = (void*)&P2PRequestHandler;
|
||||||
|
|
||||||
|
void* ASMP2PRequestHandler_jmpback;
|
||||||
|
void* ASMP2PRequestHandler_block;
|
||||||
|
void* ASMP2PRequestHandler_allow;
|
||||||
|
void no_optimize ASMP2PRequestHandler() {
|
||||||
|
asm(PUSH_ALL
|
||||||
|
|
||||||
|
"mov rcx, [rdi] \n" //incoming steam id
|
||||||
|
|
||||||
|
PREPARE_STACK
|
||||||
|
|
||||||
|
"call [P2PRequestHandler_ptr] \n"
|
||||||
|
|
||||||
|
RESTORE_STACK
|
||||||
|
|
||||||
|
// Did the handler return 1? block
|
||||||
|
"cmp eax, 1 \n"
|
||||||
|
"je 1f \n"
|
||||||
|
|
||||||
|
// Did the handler return 2? allow
|
||||||
|
"cmp eax, 2 \n"
|
||||||
|
"je 2f \n"
|
||||||
|
|
||||||
|
// Otherwise? Do nothing
|
||||||
|
|
||||||
|
POP_ALL
|
||||||
|
|
||||||
|
// original code
|
||||||
|
"mov edx, 4 \n"
|
||||||
|
"mov rcx, [rax] \n"
|
||||||
|
"mov rax, [rcx] \n"
|
||||||
|
"call qword ptr [rax+0x18] \n"
|
||||||
|
|
||||||
|
"jmp [ASMP2PRequestHandler_jmpback] \n"
|
||||||
|
|
||||||
|
|
||||||
|
"1: \n" //block
|
||||||
|
POP_ALL
|
||||||
|
"jmp [ASMP2PRequestHandler_block] \n"
|
||||||
|
|
||||||
|
"2: \n" //allow
|
||||||
|
POP_ALL
|
||||||
|
"jmp [ASMP2PRequestHandler_allow] \n"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
void SetupP2PRequestHandler() {
|
||||||
|
WriteFarJMP(base+0x9F6DF, (void*)&ASMP2PRequestHandler);
|
||||||
|
ASMP2PRequestHandler_jmpback = (void*)base+0x9F6ED;
|
||||||
|
ASMP2PRequestHandler_block = (void*)base+0x9F7A6;
|
||||||
|
ASMP2PRequestHandler_allow = (void*)base+0x9F783;
|
||||||
|
}
|
|
@ -3,7 +3,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "DLL.h"
|
#include "DLL.h"
|
||||||
|
|
||||||
#define MOD_MAJOR_VERSION 3
|
#define MOD_MAJOR_VERSION 4
|
||||||
#define MOD_MINOR_VERSION 1
|
#define MOD_MINOR_VERSION 1
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,9 +50,11 @@ void WriteFarJMP(void* source, void* destination) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "callbacks/ChatHandler.h"
|
#include "callbacks/ChatHandler.h"
|
||||||
|
#include "callbacks/P2PRequestHandler.h"
|
||||||
|
|
||||||
void SetupHandlers() {
|
void SetupHandlers() {
|
||||||
SetupChatHandler();
|
SetupChatHandler();
|
||||||
|
SetupP2PRequestHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Popup(char* title, char* msg ){
|
void Popup(char* title, char* msg ){
|
||||||
|
@ -90,6 +92,7 @@ extern "C" __declspec(dllexport) BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD
|
||||||
MUST_IMPORT(dll, ModPreInitialize);
|
MUST_IMPORT(dll, ModPreInitialize);
|
||||||
IMPORT(dll, ModInitialize);
|
IMPORT(dll, ModInitialize);
|
||||||
IMPORT(dll, HandleChat);
|
IMPORT(dll, HandleChat);
|
||||||
|
IMPORT(dll, HandleP2PRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure version compatibility
|
// Ensure version compatibility
|
||||||
|
|
Loading…
Reference in New Issue