diff --git a/OpenParrot/src/Functions/Games/ES3X/WMMT5.cpp b/OpenParrot/src/Functions/Games/ES3X/WMMT5.cpp index 9ccbc16..ac46442 100644 --- a/OpenParrot/src/Functions/Games/ES3X/WMMT5.cpp +++ b/OpenParrot/src/Functions/Games/ES3X/WMMT5.cpp @@ -1,17 +1,14 @@ #include #include "Utility/InitFunction.h" #include "Functions/Global.h" -#include -#include -#include -#include #include "MinHook.h" #include -#include #include - +#include +#include +#include +#include #ifdef _M_AMD64 - #pragma optimize("", off) #pragma comment(lib, "Ws2_32.lib") @@ -21,7 +18,7 @@ static unsigned char hasp_buffer[0xD40]; static bool isFreePlay; static bool isEventMode2P; static bool isEventMode4P; -const char *ipaddr; +const char* ipaddr; // Data for IC card, Force Feedback etc OFF. unsigned char settingData[408] = { @@ -61,304 +58,6 @@ unsigned char settingData[408] = { 0x8F, 0x3D, 0x7F, 0x00, 0x10, 0x1E, 0x34, 0xD9, 0xB5, 0x03, 0x00, 0x00 }; -// FOR FREEPLAY -unsigned char terminalPackage1_Free[79] = { - 0x01, 0x04, 0x4B, 0x00, 0x12, 0x14, 0x0A, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x00, 0x1A, 0x02, 0x5A, 0x00, 0x2A, 0x12, 0x08, 0x12, 0x12, 0x0C, - 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, 0x39, 0x30, 0x30, 0x30, 0x32, - 0x18, 0x00, 0x30, 0x03, 0x4A, 0x08, 0x08, 0x01, 0x10, 0x01, 0x18, 0x00, - 0x20, 0x00, 0x52, 0x0B, 0x08, 0x64, 0x10, 0xDE, 0x0F, 0x18, 0x05, 0x20, - 0x00, 0x28, 0x00, 0xEC, 0x72, 0x00, 0x41 -}; - -unsigned char terminalPackage2_Free[139] = { - 0x01, 0x04, 0x87, 0x00, 0x12, 0x14, 0x0A, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x00, 0x1A, 0x02, 0x5A, 0x00, 0x2A, 0x12, 0x08, 0x14, 0x12, 0x0C, - 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, 0x39, 0x30, 0x30, 0x30, 0x32, - 0x18, 0x00, 0x30, 0x03, 0x42, 0x3A, 0x08, 0x01, 0x10, 0x03, 0x18, 0x02, - 0x20, 0x02, 0x28, 0x04, 0x30, 0x01, 0x38, 0x01, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x02, 0x58, 0x60, 0x60, 0x60, 0x68, 0x60, 0x70, 0x60, 0x78, 0x60, - 0x80, 0x01, 0x60, 0x88, 0x01, 0x60, 0x90, 0x01, 0x60, 0x98, 0x01, 0x00, - 0xA0, 0x01, 0xE2, 0xBA, 0xAC, 0xD4, 0x05, 0xA8, 0x01, 0x04, 0xB0, 0x01, - 0x24, 0xB8, 0x01, 0x00, 0x4A, 0x08, 0x08, 0x01, 0x10, 0x01, 0x18, 0x00, - 0x20, 0x00, 0x52, 0x0B, 0x08, 0x64, 0x10, 0xDE, 0x0F, 0x18, 0x05, 0x20, - 0x00, 0x28, 0x00, 0x99, 0x4E, 0xC6, 0x14 -}; - -unsigned char terminalPackage3_Free[79] = { - 0x01, 0x04, 0x4B, 0x00, 0x12, 0x14, 0x0A, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x00, 0x1A, 0x02, 0x5A, 0x00, 0x2A, 0x12, 0x08, 0x19, 0x12, 0x0C, - 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, 0x39, 0x30, 0x30, 0x30, 0x32, - 0x18, 0x00, 0x30, 0x03, 0x4A, 0x08, 0x08, 0x01, 0x10, 0x01, 0x18, 0x00, - 0x20, 0x00, 0x52, 0x0B, 0x08, 0x64, 0x10, 0xDE, 0x0F, 0x18, 0x05, 0x20, - 0x00, 0x28, 0x00, 0x89, 0x93, 0x3A, 0x22 -}; - -unsigned char terminalPackage4_Free[139] = { - 0x01, 0x04, 0x87, 0x00, 0x12, 0x14, 0x0A, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x00, 0x1A, 0x02, 0x5A, 0x00, 0x2A, 0x12, 0x08, 0x2E, 0x12, 0x0C, - 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, 0x39, 0x30, 0x30, 0x30, 0x32, - 0x18, 0x00, 0x30, 0x03, 0x42, 0x3A, 0x08, 0x01, 0x10, 0x03, 0x18, 0x02, - 0x20, 0x02, 0x28, 0x04, 0x30, 0x01, 0x38, 0x01, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x02, 0x58, 0x60, 0x60, 0x60, 0x68, 0x60, 0x70, 0x60, 0x78, 0x60, - 0x80, 0x01, 0x60, 0x88, 0x01, 0x60, 0x90, 0x01, 0x60, 0x98, 0x01, 0x00, - 0xA0, 0x01, 0xF0, 0xBA, 0xAC, 0xD4, 0x05, 0xA8, 0x01, 0x04, 0xB0, 0x01, - 0x24, 0xB8, 0x01, 0x00, 0x4A, 0x08, 0x08, 0x01, 0x10, 0x01, 0x18, 0x00, - 0x20, 0x00, 0x52, 0x0B, 0x08, 0x64, 0x10, 0xDE, 0x0F, 0x18, 0x05, 0x20, - 0x00, 0x28, 0x00, 0x55, 0x42, 0x47, 0xD5 -}; - -unsigned char terminalPackage5_Free[79] = { - 0x01, 0x04, 0x4B, 0x00, 0x12, 0x14, 0x0A, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x00, 0x1A, 0x02, 0x5A, 0x00, 0x2A, 0x12, 0x08, 0x2F, 0x12, 0x0C, - 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, 0x39, 0x30, 0x30, 0x30, 0x32, - 0x18, 0x00, 0x30, 0x03, 0x4A, 0x08, 0x08, 0x01, 0x10, 0x01, 0x18, 0x00, - 0x20, 0x00, 0x52, 0x0B, 0x08, 0x64, 0x10, 0xDE, 0x0F, 0x18, 0x05, 0x20, - 0x00, 0x28, 0x00, 0x9C, 0xC9, 0xE0, 0x73 -}; - -unsigned char terminalPackage6_Free[139] = { - 0x01, 0x04, 0x87, 0x00, 0x12, 0x14, 0x0A, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x00, 0x1A, 0x02, 0x5A, 0x00, 0x2A, 0x12, 0x08, 0x6A, 0x12, 0x0C, - 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, 0x39, 0x30, 0x30, 0x30, 0x32, - 0x18, 0x00, 0x30, 0x03, 0x42, 0x3A, 0x08, 0x01, 0x10, 0x03, 0x18, 0x02, - 0x20, 0x02, 0x28, 0x04, 0x30, 0x01, 0x38, 0x01, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x02, 0x58, 0x60, 0x60, 0x60, 0x68, 0x60, 0x70, 0x60, 0x78, 0x60, - 0x80, 0x01, 0x60, 0x88, 0x01, 0x60, 0x90, 0x01, 0x60, 0x98, 0x01, 0x00, - 0xA0, 0x01, 0xF1, 0xBA, 0xAC, 0xD4, 0x05, 0xA8, 0x01, 0x04, 0xB0, 0x01, - 0x24, 0xB8, 0x01, 0x00, 0x4A, 0x08, 0x08, 0x01, 0x10, 0x01, 0x18, 0x00, - 0x20, 0x00, 0x52, 0x0B, 0x08, 0x64, 0x10, 0xDE, 0x0F, 0x18, 0x05, 0x20, - 0x00, 0x28, 0x00, 0x26, 0xB7, 0x89, 0xD0 -}; - -// FOR COIN ENTRY! -unsigned char terminalPackage1_Coin[75] = { - 0x01, 0x04, 0x47, 0x00, 0x12, 0x14, 0x0A, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x00, 0x1A, 0x00, 0x2A, 0x12, 0x08, 0x0B, 0x12, 0x0C, 0x32, 0x37, - 0x32, 0x32, 0x31, 0x31, 0x39, 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, - 0x4A, 0x08, 0x08, 0x01, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0B, - 0x08, 0x64, 0x10, 0xDE, 0x0F, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0x09, - 0x06, 0x41, 0x0B -}; - -unsigned char terminalPackage2_Coin[135] = { - 0x01, 0x04, 0x83, 0x00, 0x12, 0x14, 0x0A, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x00, 0x1A, 0x00, 0x2A, 0x12, 0x08, 0x39, 0x12, 0x0C, 0x32, 0x37, - 0x32, 0x32, 0x31, 0x31, 0x39, 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, - 0x42, 0x3A, 0x08, 0x01, 0x10, 0x03, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, - 0x30, 0x00, 0x38, 0x01, 0x40, 0x00, 0x48, 0x00, 0x50, 0x02, 0x58, 0x60, - 0x60, 0x60, 0x68, 0x60, 0x70, 0x60, 0x78, 0x60, 0x80, 0x01, 0x60, 0x88, - 0x01, 0x60, 0x90, 0x01, 0x60, 0x98, 0x01, 0x00, 0xA0, 0x01, 0xD5, 0xBE, - 0x8F, 0xD2, 0x05, 0xA8, 0x01, 0x04, 0xB0, 0x01, 0x24, 0xB8, 0x01, 0x00, - 0x4A, 0x08, 0x08, 0x01, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0B, - 0x08, 0x64, 0x10, 0xDE, 0x0F, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0xF5, - 0xF1, 0x0D, 0xB2 -}; - -unsigned char terminalPackage3_Coin[75] = { - 0x01, 0x04, 0x47, 0x00, 0x12, 0x14, 0x0A, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x00, 0x1A, 0x00, 0x2A, 0x12, 0x08, 0x3A, 0x12, 0x0C, 0x32, 0x37, - 0x32, 0x32, 0x31, 0x31, 0x39, 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, - 0x4A, 0x08, 0x08, 0x01, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0B, - 0x08, 0x64, 0x10, 0xDE, 0x0F, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0x22, - 0x25, 0x31, 0x0D -}; - -unsigned char terminalPackage4_Coin[135] = { - 0x01, 0x04, 0x83, 0x00, 0x12, 0x14, 0x0A, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x00, 0x1A, 0x00, 0x2A, 0x12, 0x08, 0x57, 0x12, 0x0C, 0x32, 0x37, - 0x32, 0x32, 0x31, 0x31, 0x39, 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, - 0x42, 0x3A, 0x08, 0x01, 0x10, 0x03, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, - 0x30, 0x00, 0x38, 0x01, 0x40, 0x00, 0x48, 0x00, 0x50, 0x02, 0x58, 0x60, - 0x60, 0x60, 0x68, 0x60, 0x70, 0x60, 0x78, 0x60, 0x80, 0x01, 0x60, 0x88, - 0x01, 0x60, 0x90, 0x01, 0x60, 0x98, 0x01, 0x00, 0xA0, 0x01, 0xD6, 0xBE, - 0x8F, 0xD2, 0x05, 0xA8, 0x01, 0x04, 0xB0, 0x01, 0x24, 0xB8, 0x01, 0x00, - 0x4A, 0x08, 0x08, 0x01, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0B, - 0x08, 0x64, 0x10, 0xDE, 0x0F, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0xCA, - 0x8B, 0x15, 0xCB -}; - -unsigned char terminalPackage5_Coin[79] = { - 0x01, 0x04, 0x4B, 0x00, 0x12, 0x14, 0x0A, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x00, 0x1A, 0x02, 0x5A, 0x00, 0x2A, 0x12, 0x08, 0x58, 0x12, 0x0C, - 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, 0x39, 0x30, 0x30, 0x30, 0x32, - 0x18, 0x00, 0x30, 0x03, 0x4A, 0x08, 0x08, 0x01, 0x10, 0x01, 0x18, 0x00, - 0x20, 0x00, 0x52, 0x0B, 0x08, 0x64, 0x10, 0xDE, 0x0F, 0x18, 0x05, 0x20, - 0x00, 0x28, 0x00, 0x3E, 0xB1, 0xB7, 0x22 -}; - -unsigned char terminalPackage6_Coin[139] = { - 0x01, 0x04, 0x87, 0x00, 0x12, 0x14, 0x0A, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x00, 0x1A, 0x02, 0x5A, 0x00, 0x2A, 0x12, 0x08, 0x77, 0x12, 0x0C, - 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, 0x39, 0x30, 0x30, 0x30, 0x32, - 0x18, 0x00, 0x30, 0x03, 0x42, 0x3A, 0x08, 0x01, 0x10, 0x03, 0x18, 0x02, - 0x20, 0x02, 0x28, 0x04, 0x30, 0x00, 0x38, 0x01, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x02, 0x58, 0x60, 0x60, 0x60, 0x68, 0x60, 0x70, 0x60, 0x78, 0x60, - 0x80, 0x01, 0x60, 0x88, 0x01, 0x60, 0x90, 0x01, 0x60, 0x98, 0x01, 0x00, - 0xA0, 0x01, 0xD7, 0xBE, 0x8F, 0xD2, 0x05, 0xA8, 0x01, 0x04, 0xB0, 0x01, - 0x24, 0xB8, 0x01, 0x00, 0x4A, 0x08, 0x08, 0x01, 0x10, 0x01, 0x18, 0x00, - 0x20, 0x00, 0x52, 0x0B, 0x08, 0x64, 0x10, 0xDE, 0x0F, 0x18, 0x05, 0x20, - 0x00, 0x28, 0x00, 0xBD, 0x07, 0xCF, 0xDC -}; - - -//Event mode 2P -unsigned char terminalPackage1_Event4P[79] = { - 0x01, 0x04, 0x44, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13, - 0x08, 0xd1, 0x0b, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, - 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x4a, 0x08, 0x08, - 0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10, - 0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0xc1, 0x96, 0xc9, 0x2e -}; - -unsigned char terminalPackage2_Event4P[139] = { - 0x01, 0x04, 0x80, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13, - 0x08, 0xd2, 0x0b, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, - 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x42, 0x3a, 0x08, - 0x01, 0x10, 0x03, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, 0x30, 0x01, 0x38, - 0x01, 0x40, 0x01, 0x48, 0x00, 0x50, 0x02, 0x58, 0x60, 0x60, 0x60, 0x68, - 0x60, 0x70, 0x60, 0x78, 0x60, 0x80, 0x01, 0x60, 0x88, 0x01, 0x60, 0x90, - 0x01, 0x60, 0x98, 0x01, 0x00, 0xa0, 0x01, 0xd8, 0xc3, 0xd6, 0xe1, 0x05, - 0xa8, 0x01, 0x04, 0xb0, 0x01, 0x24, 0xb8, 0x01, 0x00, 0x4a, 0x08, 0x08, - 0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10, - 0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0x91, 0x74, 0xca, 0x1e - -}; - -unsigned char terminalPackage3_Event4P[79] = { - 0x01, 0x04, 0x44, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13, - 0x08, 0x8d, 0x0c, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, - 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x4a, 0x08, 0x08, - 0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10, - 0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0x86, 0xb1, 0x27, 0x9e -}; - -unsigned char terminalPackage4_Event4P[139] = { - 0x01, 0x04, 0x80, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13, - 0x08, 0x8e, 0x0c, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, - 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x42, 0x3a, 0x08, - 0x01, 0x10, 0x03, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, 0x30, 0x01, 0x38, - 0x01, 0x40, 0x01, 0x48, 0x00, 0x50, 0x02, 0x58, 0x60, 0x60, 0x60, 0x68, - 0x60, 0x70, 0x60, 0x78, 0x60, 0x80, 0x01, 0x60, 0x88, 0x01, 0x60, 0x90, - 0x01, 0x60, 0x98, 0x01, 0x00, 0xa0, 0x01, 0xd9, 0xc3, 0xd6, 0xe1, 0x05, - 0xa8, 0x01, 0x04, 0xb0, 0x01, 0x24, 0xb8, 0x01, 0x00, 0x4a, 0x08, 0x08, - 0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10, - 0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0xc2, 0x11, 0x2a, 0x66 - -}; - -unsigned char terminalPackage5_Event4P[79] = { - 0x01, 0x04, 0x44, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13, - 0x08, 0xc9, 0x0c, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, - 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x4a, 0x08, 0x08, - 0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10, - 0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0x5d, 0x49, 0x01, 0x1e -}; - -unsigned char terminalPackage6_Event4P[139] = { - 0x01, 0x04, 0x80, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13, - 0x08, 0xca, 0x0c, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, - 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x42, 0x3a, 0x08, - 0x01, 0x10, 0x03, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, 0x30, 0x01, 0x38, - 0x01, 0x40, 0x01, 0x48, 0x00, 0x50, 0x02, 0x58, 0x60, 0x60, 0x60, 0x68, - 0x60, 0x70, 0x60, 0x78, 0x60, 0x80, 0x01, 0x60, 0x88, 0x01, 0x60, 0x90, - 0x01, 0x60, 0x98, 0x01, 0x00, 0xa0, 0x01, 0xda, 0xc3, 0xd6, 0xe1, 0x05, - 0xa8, 0x01, 0x04, 0xb0, 0x01, 0x24, 0xb8, 0x01, 0x00, 0x4a, 0x08, 0x08, - 0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10, - 0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0xd4, 0x80, 0x16, 0xc2 -}; - - -//Event mode 2P -unsigned char terminalPackage1_Event2P[79] = { - 0x01, 0x04, 0x44, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13, - 0x08, 0xfe, 0x0e, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, - 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x4a, 0x08, 0x08, - 0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10, - 0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0xaf, 0xa1, 0x42, 0x3d -}; - -unsigned char terminalPackage2_Event2P[139] = { - 0x01, 0x04, 0x80, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13, - 0x08, 0xff, 0x0e, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, - 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x42, 0x3a, 0x08, - 0x01, 0x10, 0x03, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, 0x30, 0x01, 0x38, - 0x01, 0x40, 0x02, 0x48, 0x00, 0x50, 0x02, 0x58, 0x60, 0x60, 0x60, 0x68, - 0x60, 0x70, 0x60, 0x78, 0x60, 0x80, 0x01, 0x60, 0x88, 0x01, 0x60, 0x90, - 0x01, 0x60, 0x98, 0x01, 0x00, 0xa0, 0x01, 0xa7, 0xc2, 0xa5, 0xe1, 0x05, - 0xa8, 0x01, 0x02, 0xb0, 0x01, 0x24, 0xb8, 0x01, 0x00, 0x4a, 0x08, 0x08, - 0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10, - 0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0xe8, 0x94, 0x41, 0x46 - -}; - -unsigned char terminalPackage3_Event2P[79] = { - 0x01, 0x04, 0x44, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13, - 0x08, 0x80, 0x0f, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, - 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x4a, 0x08, 0x08, - 0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10, - 0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0xa3, 0x94, 0x12, 0x9b -}; - -unsigned char terminalPackage4_Event2P[139] = { - 0x01, 0x04, 0x80, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13, - 0x08, 0x8d, 0x0f, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, - 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x42, 0x3a, 0x08, - 0x01, 0x10, 0x03, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, 0x30, 0x01, 0x38, - 0x01, 0x40, 0x02, 0x48, 0x00, 0x50, 0x02, 0x58, 0x60, 0x60, 0x60, 0x68, - 0x60, 0x70, 0x60, 0x78, 0x60, 0x80, 0x01, 0x60, 0x88, 0x01, 0x60, 0x90, - 0x01, 0x60, 0x98, 0x01, 0x00, 0xa0, 0x01, 0xa8, 0xc2, 0xa5, 0xe1, 0x05, - 0xa8, 0x01, 0x02, 0xb0, 0x01, 0x24, 0xb8, 0x01, 0x00, 0x4a, 0x08, 0x08, - 0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10, - 0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0x8b, 0x02, 0xdf, 0xad - -}; - -unsigned char terminalPackage5_Event2P[79] = { - 0x01, 0x04, 0x44, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13, - 0x08, 0x8e, 0x0f, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, - 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x4a, 0x08, 0x08, - 0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10, - 0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0xa3, 0xc2, 0x27, 0x9c -}; - -unsigned char terminalPackage6_Event2P[139] = { - 0x01, 0x04, 0x80, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13, - 0x08, 0xf0, 0x0e, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, - 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x42, 0x3a, 0x08, - 0x01, 0x10, 0x03, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, 0x30, 0x01, 0x38, - 0x01, 0x40, 0x02, 0x48, 0x00, 0x50, 0x02, 0x58, 0x60, 0x60, 0x60, 0x68, - 0x60, 0x70, 0x60, 0x78, 0x60, 0x80, 0x01, 0x60, 0x88, 0x01, 0x60, 0x90, - 0x01, 0x60, 0x98, 0x01, 0x00, 0xa0, 0x01, 0xa6, 0xc2, 0xa5, 0xe1, 0x05, - 0xa8, 0x01, 0x02, 0xb0, 0x01, 0x24, 0xb8, 0x01, 0x00, 0x4a, 0x08, 0x08, - 0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10, - 0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0x97, 0xd5, 0x79, 0xa6 -}; - #define HASP_STATUS_OK 0 unsigned int Hook_hasp_login(int feature_id, void* vendor_code, int hasp_handle) { @@ -393,7 +92,7 @@ unsigned int Hook_hasp_get_size(int hasp_handle, int hasp_fileid, unsigned int* #ifdef _DEBUG OutputDebugStringA("hasp_get_size\n"); #endif - *hasp_size = 0xD40; // Max addressable size by the game... absmax is 4k + * hasp_size = 0xD40; // Max addressable size by the game... absmax is 4k return HASP_STATUS_OK; } @@ -409,153 +108,6 @@ unsigned int Hook_hasp_write(int hasp_handle, int hasp_fileid, unsigned int offs return HASP_STATUS_OK; } -typedef int (WINAPI *BIND)(SOCKET, CONST SOCKADDR *, INT); -BIND pbind = NULL; - -unsigned int WINAPI Hook_bind(SOCKET s, const sockaddr *addr, int namelen) { - sockaddr_in bindAddr = { 0 }; - bindAddr.sin_family = AF_INET; - bindAddr.sin_addr.s_addr = inet_addr("192.168.96.20"); - bindAddr.sin_port = htons(50765); - if (addr == (sockaddr*)&bindAddr) { - sockaddr_in bindAddr2 = { 0 }; - bindAddr2.sin_family = AF_INET; - bindAddr2.sin_addr.s_addr = inet_addr(ipaddr); - bindAddr2.sin_port = htons(50765); - return pbind(s, (sockaddr*)&bindAddr2, namelen); - } - else { - return pbind(s, addr, namelen); - - } -} - -// Save data dump memory block -unsigned char saveData[0x2000]; - -// BASE: 0x24E0 -// Campaing honor data: 2998, save 0xB8 -// Story Mode Honor data: 25F0, save 0x98 -// StoryModeNoLoseHonorData: 2C80, Copy 0,0x10, Copy 0x18,0x28 maybe 8 bytes more -// OtherHonorData: 2A90, Copy 0x60 -// CampaignHonorData: 2698, Copy 0x48 - -//static int SaveCampaingHonorData2() -//{ -// memset(saveData, 0, 0x1000); -// uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0); -// uintptr_t value = *(uintptr_t*)(imageBase + 0x1948F10); -// value += 0x2698; -// FILE* file = fopen(V("CampaignHonorData.sav"), V("wb")); -// memcpy(saveData, (void *)value, 0x48); -// fwrite(saveData, 1, 0x100, file); -// fclose(file); -// return 1; -//} -// -//static int SaveOtherHonorData() -//{ -// memset(saveData, 0, 0x1000); -// uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0); -// uintptr_t value = *(uintptr_t*)(imageBase + 0x1948F10); -// value += 0x2A90; -// FILE* file = fopen(V("OtherHonorData.sav"), V("wb")); -// memcpy(saveData, (void *)value, 0x60); -// fwrite(saveData, 1, 0x100, file); -// fclose(file); -// return 1; -//} -// -//static int SaveStoryModeNoLoseHonorData() -//{ -// memset(saveData, 0, 0x1000); -// uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0); -// uintptr_t value = *(uintptr_t*)(imageBase + 0x1948F10); -// value += 0x2C80; -// FILE* file = fopen(V("StoryModeNoLoseHonorData.sav"), V("wb")); -// memcpy(saveData, (void *)value, 0x10); -// value += 0x18; -// memcpy(saveData, (void *)value, 0x28); -// fwrite(saveData, 1, 0x100, file); -// fclose(file); -// return 1; -//} -// -//static int SaveCampaingHonorData() -//{ -// memset(saveData, 0, 0x1000); -// uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0); -// uintptr_t value = *(uintptr_t*)(imageBase + 0x1948F10); -// value += 0x2998; -// FILE* file = fopen(V("campaing.sav"), V("wb")); -// memcpy(saveData, (void *)value, 0xB8); -// fwrite(saveData, 1, 0x100, file); -// fclose(file); -// return 1; -//} -// -//static int SaveStoryData() -//{ -// memset(saveData, 0, 0x1000); -// uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0); -// uintptr_t value = *(uintptr_t*)(imageBase + 0x1948F10); -// value += 0x25F0; -// FILE* file = fopen(V("story.sav"), V("wb")); -// memcpy(saveData, (void *)value, 0x98); -// fwrite(saveData, 1, 0x100, file); -// fclose(file); -// return 1; -//} - -// setFullTune(void): Int -// If the currently loaded car is NOT fully tuned, -// updates the power and handling values to be fully -// tuned (16 for each). If they are already fully tuned, -// does not change any values. -static int setFullTune() -{ - // Car save hex address - auto carSaveBase = (uintptr_t*)((*(uintptr_t*)(imageBase + 0x1948F10)) + 0x180 + 0xa8 + 0x18); - auto powerAddress = (uintptr_t*)(*(uintptr_t*)(carSaveBase)+0x98); - auto handleAddress = (uintptr_t*)(*(uintptr_t*)(carSaveBase)+0x9C); - - // Dereference the power value from the memory address - auto powerValue = injector::ReadMemory(powerAddress, true); - auto handleValue = injector::ReadMemory(handleAddress, true); - - // If the power and handling values do not add up to fully tuned - if (powerValue + handleValue < 0x20) - { - // Car is not fully tuned, force it to the default full tune - injector::WriteMemory(powerAddress, 0x10, true); - injector::WriteMemory(handleAddress, 0x10, true); - - // Updated - return 1; - } - - // Not updated - return 0; -} - -// forceFullTune(pArguments: void*): DWORD WINAPI -// Function which runs in a secondary thread if the forceFullTune -// option is selected in the compiler. If the player's car is not fully -// tuned, it is forcibly set to max tune. If the player's car is already -// fully tuned, it is left alone. -static DWORD WINAPI forceFullTune(void* pArguments) -{ - // Loops while the program is running - while (true) { - - // Sleep for 16ms - Sleep(16); - - // Run the set full tune process - setFullTune(); - } -} - // ******************************************** // // ************ Debug Data Logging ************ // // ******************************************** // @@ -597,490 +149,6 @@ static int writeLog(std::string filename, std::string message) } } -// writeDump(filename: Char*, data: unsigned char *, size: size_t): Int -static int writeDump(char* filename, unsigned char* data, size_t size) -{ - // Open the file with the provided filename - FILE* file = fopen(filename, "wb"); - - // File opened successfully - if (file) - { - // Write the data to the file - fwrite((void*)data, 1, size, file); - - // Close the file - fclose(file); - - // Return success status - return 0; - } - else // Failed to open - { - // Return failure status - return 1; - } -} - -// Sets if saving is allowed or not -static bool saveOk = false; - -// If custom car is used -bool customCar = false; - -// Sets if loading is allowed -bool loadOk = false; - -// Car save data reserved memory -unsigned char carData[0xFF]; - -// Car filename string -char carFileName[0xFF]; - -// SaveOk(void): Void -// Enables saving -static int SaveOk() -{ - saveOk = true; - return 1; -} - -// loadCarFile(filename: char*): Int -// Given a filename, loads the data from -// the car file into memory. -static int loadCarFile(char* filename) -{ - // Open the file with the filename - FILE* file = fopen(filename, "rb"); - - // File open OK - if (file) - { - // Get the length of the file - fseek(file, 0, SEEK_END); - int fsize = ftell(file); - - // If the file has the right size - if (fsize == 0xE0) - { - // Reset to start of the file and read it into the car data variable - fseek(file, 0, SEEK_SET); - fread(carData, fsize, 1, file); - - // Dereference the memory location for the car save data - uintptr_t carSaveLocation = *(uintptr_t*)((*(uintptr_t*)(imageBase + 0x1948F10)) + 0x180 + 0xa8 + 0x18); - - memcpy((void*)(carSaveLocation + 0x08), carData + 0x08, 8); // ?? - memcpy((void*)(carSaveLocation + 0x10), carData + 0x10, 8); // ?? - memcpy((void*)(carSaveLocation + 0x20), carData + 0x20, 8); // ?? - memcpy((void*)(carSaveLocation + 0x28), carData + 0x28, 8); // ?? - // memcpy((void*)(carSaveLocation + 0x30), carData + 0x30, 8); // Stock Colour (0x30), Custom Colour (0x34) - memcpy((void*)(carSaveLocation + 0x34), carData + 0x34, 4); // Custom Colour (0x34) - memcpy((void*)(carSaveLocation + 0x38), carData + 0x38, 8); // Rims Type (0x38), Rims Colour (0x3C) - memcpy((void*)(carSaveLocation + 0x40), carData + 0x40, 8); // Aero Type (0x40), Hood Type (0x44) - memcpy((void*)(carSaveLocation + 0x50), carData + 0x50, 8); // Wing Type (0x50), Mirror Type (0x54) - memcpy((void*)(carSaveLocation + 0x58), carData + 0x58, 8); // Body Sticker Type (0x58), Variant (0x5C) - memcpy((void*)(carSaveLocation + 0x68), carData + 0x68, 8); // ?? - memcpy((void*)(carSaveLocation + 0x7C), carData + 0x7C, 1); // Neon Type - memcpy((void*)(carSaveLocation + 0x80), carData + 0x80, 8); // Trunk Colour (0x80), Plate Frame (0x84) - memcpy((void*)(carSaveLocation + 0x88), carData + 0x88, 8); // Plate Frame Colour (0x8A) - memcpy((void*)(carSaveLocation + 0x90), carData + 0x90, 8); // ?? - memcpy((void*)(carSaveLocation + 0x98), carData + 0x98, 8); // Power (0x98), Handling (0x9C) - memcpy((void*)(carSaveLocation + 0xA0), carData + 0xA0, 8); // Rank (0xA4) - memcpy((void*)(carSaveLocation + 0xA8), carData + 0xA8, 8); // ?? - memcpy((void*)(carSaveLocation + 0xB8), carData + 0xB8, 8); // ?? - memcpy((void*)(carSaveLocation + 0xC8), carData + 0xC8, 8); // ?? - memcpy((void*)(carSaveLocation + 0xD8), carData + 0xD8, 8); // ?? - } - - // Disable loading - loadOk = false; - - // Close the file - fclose(file); - - // Success - return 1; - } - - // Failed - return 0; -} - -// loadCarData(filepath: char*): Void -// Given a filepath, attempts to load a -// car file (either custom.car or specific -// car file) from that folder. -static int loadCarData(char* filepath) -{ - // Sleep for 1 second - std::this_thread::sleep_for(std::chrono::milliseconds(1000)); - - // Custom car disabled by default - customCar = false; - - // Miles path string - char carPath[0xFF]; - - // Set the milepath memory to zero - memset(carPath, 0, 0xFF); - - // Copy the file path to the miles path - strcpy(carPath, filepath); - - // Append the mileage filename to the string - strcat(carPath, "\\OpenParrot_Cars"); - - // Create the OpenParrot_cars directory at the given filepath - std::filesystem::create_directories(carPath); - - // Get the path to the custom car file - sprintf(carFileName, "%s\\custom.car", carPath); - - // If the custom car file exists - if (FileExists(carFileName)) - { - // Load the custom car file - loadCarFile(carFileName); - - // Enable custom car switch - customCar = true; - } - - // Empty the car filename string - memset(carFileName, 0, 0xFF); - - // Get the path to the specific car file - sprintf(carFileName, "%s\\%08X.car", carPath, *(DWORD*)(*(uintptr_t*)(*(uintptr_t*)(imageBase + 0x1948F10) + 0x180 + 0xa8 + 0x18) + 0x2C)); - - // If the specific car file exists - if (FileExists(carFileName)) - { - // Load the car file - loadCarFile(carFileName); - } - - // If the force full tune switch is set - if (ToBool(config["Tune"]["Force Full Tune"])) - { - // Create the force full tune thread - // CreateThread(0, 0, forceFullTune, 0, 0, 0); - - // Set the car to be fully tuned - setFullTune(); - } - - // Success - return 1; -} - -static int saveCarData(char* filepath) -{ - // Car Profile saving - memset(carData, 0, 0xFF); - memset(carFileName, 0, 0xFF); - - // Get the hex address for the start of the save data block - uintptr_t saveDataBase = *(uintptr_t*)(imageBase + 0x1948F10); - - // Address where car save data starts - uintptr_t carSaveBase = *(uintptr_t*)(saveDataBase + 0x108); - - // Miles path string - char carPath[0xFF]; - - // Set the milepath memory to zero - memset(carPath, 0, 0xFF); - - // Copy the file path to the miles path - strcpy(carPath, filepath); - - // Append the mileage filename to the string - strcat(carPath, "\\OpenParrot_Cars"); - - // CreateDirectoryA(carPath, nullptr); - - // Create the cars path folder - std::filesystem::create_directories(carPath); - - // Copy the 0xE0 bytes from memory to the car data array - memcpy(carData, (void*)*(uintptr_t*)(saveDataBase + 0x180 + 0xa8 + 0x18), 0xE0); - - // If custom car is set - if (customCar) - { - // Save the file to custom.car - sprintf(carPath, "%s\\custom.car", carPath); - } - else // Custom car is not set - { - // Save the file to the specific car filename - sprintf(carPath, "%s\\%08X.car", carPath, *(DWORD*)(*(uintptr_t*)(*(uintptr_t*)(imageBase + 0x1948F10) + 0x180 + 0xa8 + 0x18) + 0x2C)); - } - - // Open the file at the given car path - FILE* carFile = fopen(carPath, "wb"); - - // Write the data from the array to the file - fwrite(carData, 1, 0xE0, carFile); - fclose(carFile); - - // Success - return 1; -} - -static int saveStoryData(char* filepath) -{ - // Miles path string - char storyPath[0xFF]; - - // Set the milepath memory to zero - memset(storyPath, 0, 0xFF); - - // Copy the file path to the miles path - strcpy(storyPath, filepath); - - // Append the mileage filename to the string - strcat(storyPath, "\\openprogress.sav"); - - // Save story data - - // Address where player save data starts - uintptr_t saveDataBase = *(uintptr_t*)(imageBase + 0x1948F10); - - // Zero out save data binary - memset(saveData, 0, 0x2000); - - // Address where the story save data starts - uintptr_t storySaveBase = *(uintptr_t*)(saveDataBase + 0x108); - - // Copy to saveData from the story save data index - memcpy(saveData, (void*)storySaveBase, 0x340); - - // Dump the save data to openprogress.sav - writeDump(storyPath, saveData, 0x2000); - - //SaveStoryData(); - //SaveCampaingHonorData(); - //SaveStoryModeNoLoseHonorData(); - //SaveOtherHonorData(); - //SaveCampaingHonorData2(); - - // Success - return 1; -} - -static int loadStoryData(char* filepath) -{ - // Zero out the save data array - memset(saveData, 0x0, 0x2000); - - // Miles path string - char storyPath[0xFF]; - - // Set the milepath memory to zero - memset(storyPath, 0, 0xFF); - - // Copy the file path to the miles path - strcpy(storyPath, filepath); - - // Append the mileage filename to the string - strcat(storyPath, "\\openprogress.sav"); - - // Address where player save data starts - uintptr_t saveDataBase = *(uintptr_t*)(imageBase + 0x1948F10); - - // Open the openprogress file with read privileges - FILE* file = fopen(storyPath, "rb"); - - // If the file exists - if (file) - { - // Get all of the contents from the file - fseek(file, 0, SEEK_END); - - // Get the size of the file - int fsize = ftell(file); - - // Check file is correct size - if (fsize == 0x2000) - { - // Reset seek index to start - fseek(file, 0, SEEK_SET); - - // Read all of the contents of the file into saveData - fread(saveData, fsize, 1, file); - - // Story save data offset - uintptr_t saveStoryBase = *(uintptr_t*)(saveDataBase + 0x108); - - // 0x00 - 70 23 - Should be able to use this to figure out what game a save is from - - // (Mostly) discovered story data - - memcpy((void*)(saveStoryBase + 0x118), saveData + 0x118, 0x8); // Total Wins (0x118) - memcpy((void*)(saveStoryBase + 0x120), saveData + 0x120, 0x8); // Chapter Progress (0x120) (Bitmask), Current Chapter (0x124) - memcpy((void*)(saveStoryBase + 0x128), saveData + 0x128, 0x8); // ?? - memcpy((void*)(saveStoryBase + 0x130), saveData + 0x130, 0x8); // ?? - memcpy((void*)(saveStoryBase + 0x138), saveData + 0x138, 0x8); // Win Streak (0x138) - memcpy((void*)(saveStoryBase + 0x140), saveData + 0x140, 0x8); // ?? - memcpy((void*)(saveStoryBase + 0x148), saveData + 0x148, 0x8); // ?? - memcpy((void*)(saveStoryBase + 0x150), saveData + 0x150, 0x8); // Locked Chapters (0x150) (Bitmask) - memcpy((void*)(saveStoryBase + 0x158), saveData + 0x158, 0x8); // ?? - - // Save data loaded successfully - loadOk = true; - } - fclose(file); - } - - //LoadStoryData(); - //LoadCampaingHonorData(); - //LoadStoryModeNoLoseHonorData(); - //LoadOtherHonorData(); - //LoadCampaingHonorData2(); - - // Success status - return 1; -} - -static int SaveGameData() -{ - // Saving is disabled - if (!saveOk) - return 1; - - // Miles path string - char savePath[0xFF]; - - // Set the milepath memory to zero - memset(savePath, 0, 0xFF); - - // Write the '.' into the load path - // sprintf(savePath, ".\\SaveData"); - sprintf(savePath, "."); - - // Seperate save file / cars per user profile - if (ToBool(config["Save"]["Save Per Custom Name"])) - { - // Get the profile name from the - std::string name = config["General"]["CustomName"]; - - // Add the c string version of the profile name to the path - sprintf(savePath, "%s\\%s", savePath, name.c_str()); - } - - // Seperate miles / story per car - if (ToBool(config["Save"]["Save Per Car"])) - { - // Need to get the hex code for the selected car - - // Address where player save data starts - uintptr_t saveDataBase = *(uintptr_t*)(imageBase + 0x1948F10); - - // Address where the car save data starts - uintptr_t carSaveBase = *(uintptr_t*)(saveDataBase + 0x108); - - // If custom car is set - if (customCar) - { - // Add the car id to the save path - sprintf(savePath, "%s\\custom", savePath); - } - else // Custom car is not set - { - // Add the custom folder to the save path - sprintf(savePath, "%s\\%08X", savePath, *(DWORD*)(*(uintptr_t*)(*(uintptr_t*)(imageBase + 0x1948F10) + 0x180 + 0xa8 + 0x18) + 0x2C)); - } - } - - // Ensure the directory exists - std::filesystem::create_directories(savePath); - - // Save the car save file - saveCarData(savePath); - - // Save the openprogress.sav file - saveStoryData(savePath); - - // Disable saving - saveOk = false; - - // Success - return 1; -} - -static int loadGameData() -{ - // Disable saving - saveOk = false; - - // Miles path string - char loadPath[0xFF]; - - // Set the milepath memory to zero - memset(loadPath, 0, 0xFF); - - // Write the '.' into the load path - // sprintf(loadPath, ".\\SaveData"); - sprintf(loadPath, "."); - - // Seperate save file / cars per user profile - if (ToBool(config["Save"]["Save Per Custom Name"])) - { - // Get the profile name from the - std::string name = config["General"]["CustomName"]; - - // Add the c string version of the profile name to the path - sprintf(loadPath, "%s\\%s", loadPath, name.c_str()); - } - - // Seperate miles / story per car - if (ToBool(config["Save"]["Save Per Car"])) - { - // Need to get the hex code for the selected car - - // Address where player save data starts - uintptr_t saveDataBase = *(uintptr_t*)(imageBase + 0x1948F10); - - // Address where the car save data starts - uintptr_t carSaveBase = *(uintptr_t*)(saveDataBase + 0x108); - - // If custom car is set - if (customCar) - { - // Add the car id to the save path - sprintf(loadPath, "%s\\custom", loadPath); - } - else // Custom car is not set - { - // Add the custom folder to the save path - sprintf(loadPath, "%s\\%08X", loadPath, *(DWORD*)(*(uintptr_t*)(*(uintptr_t*)(imageBase + 0x1948F10) + 0x180 + 0xa8 + 0x18) + 0x2C)); - } - } - - // Ensure the directory exists - std::filesystem::create_directories(loadPath); - - // Load the car save file - loadCarData(loadPath); - - // Load the openprogress.sav file - loadStoryData(loadPath); - - // Success - return 1; -} - -static void loadGame() -{ - // Runs after car data is loaded - - // Load story data thread - std::thread t1(loadGameData); - t1.detach(); -} - static int ReturnTrue() { return 1; @@ -1105,7 +173,7 @@ void GenerateDongleData(bool isTerminal) hasp_buffer[0x2D] = 0x6B; hasp_buffer[0x2E] = 0x40; hasp_buffer[0x2F] = 0x87; - if(isTerminal) + if (isTerminal) { memcpy(hasp_buffer + 0xD00, "272211990002", 12); hasp_buffer[0xD3E] = 0x63; @@ -1119,158 +187,100 @@ void GenerateDongleData(bool isTerminal) } } -char customName[256]; +static HWND mt6Hwnd; + +typedef BOOL(WINAPI* ShowWindow_t)(HWND, int); +static ShowWindow_t pShowWindow; -static DWORD WINAPI SpamCustomName(LPVOID) +// Hello Win32 my old friend... +typedef LRESULT(WINAPI* WindowProcedure_t)(HWND, UINT, WPARAM, LPARAM); +static WindowProcedure_t pMaxituneWndProc; + +static BOOL gotWindowSize = FALSE; +static unsigned displaySizeX = 0; +static unsigned displaySizeY = 0; +static float scaleFactorX = 0.0f; +static float scaleFactorY = 0.0f; + +static LRESULT Hook_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - while (true) + if (!gotWindowSize) { - Sleep(50); - void *value = (void *)(imageBase + 0x194C230); - memcpy(value, customName, strlen(customName) + 1); + displaySizeX = GetSystemMetrics(SM_CXSCREEN); + displaySizeY = GetSystemMetrics(SM_CYSCREEN); + scaleFactorX = static_cast(displaySizeX) / 1360.0f; + scaleFactorY = static_cast(displaySizeY) / 768.0f; + printf("display is %dx%d (scale factor of %f, %f)\n", displaySizeX, displaySizeY, scaleFactorX, scaleFactorY); + gotWindowSize = TRUE; } + + if (msg == WM_LBUTTONDOWN || + msg == WM_LBUTTONUP) + { + unsigned short mx = GET_X_LPARAM(lParam); + unsigned short my = GET_Y_LPARAM(lParam); + + //unsigned short trueMy = 768 - my; + + float scaledMx = static_cast(mx) / 1360.f; + float scaledMy = static_cast(my) / 768.f; + + scaledMy = 1.0f - scaledMy; + + scaledMx *= scaleFactorX; + scaledMy *= scaleFactorY; + + unsigned short trueMx = static_cast(scaledMx * 16383.0f); + unsigned short trueMy = static_cast(scaledMy * 16383.0f); + trueMy += 9500; // Cheap hack, todo do the math better!! + + //mx *= (16383 / 1360); + //trueMy *= (16383 / 1360); + + printf("%d %d\n", trueMx, trueMy); + mt6SetTouchParams(trueMx, trueMy, msg == WM_LBUTTONDOWN); + + printf("MOUSE %s (%d, %d)\n", msg == WM_LBUTTONDOWN ? "DOWN" : "UP ", mx, my); + return 0; + } + + return pMaxituneWndProc(hwnd, msg, wParam, lParam); } -static DWORD WINAPI SpamMulticast(LPVOID) +static BOOL Hook_ShowWindow(HWND hwnd, int nCmdShow) { - WSADATA wsaData; - WSAStartup(MAKEWORD(2, 2), &wsaData); + SetWindowLongPtrW(hwnd, -4, (LONG_PTR)Hook_WndProc); + ShowCursor(1); - SOCKET sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + mt6Hwnd = hwnd; + return pShowWindow(hwnd, nCmdShow); +} - int ttl = 255; - setsockopt(sock, IPPROTO_IP, IP_MULTICAST_TTL, (char*)&ttl, sizeof(ttl)); +typedef void (WINAPI* OutputDebugStringA_t)(LPCSTR); +static void Hook_OutputDebugStringA(LPCSTR str) +{ + printf("debug> %s", str); +} - int reuse = 1; - setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char*)&reuse, sizeof(reuse)); - - setsockopt(sock, IPPROTO_IP, IP_MULTICAST_LOOP, (char*)&reuse, sizeof(reuse)); +typedef int (WINAPI* BIND)(SOCKET, CONST SOCKADDR*, INT); +BIND pbind = NULL; +unsigned int WINAPI Hook_bind(SOCKET s, const sockaddr* addr, int namelen) { sockaddr_in bindAddr = { 0 }; bindAddr.sin_family = AF_INET; - bindAddr.sin_addr.s_addr = inet_addr(ipaddr); + bindAddr.sin_addr.s_addr = inet_addr("192.168.96.20"); bindAddr.sin_port = htons(50765); - bind(sock, (sockaddr*)&bindAddr, sizeof(bindAddr)); - - - ip_mreq mreq; - mreq.imr_multiaddr.s_addr = inet_addr("225.0.0.1"); - mreq.imr_interface.s_addr = inet_addr(ipaddr); - - setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char*)&mreq, sizeof(mreq)); - - const uint8_t* byteSequences_Free[] = { - terminalPackage1_Free, - terminalPackage2_Free, - terminalPackage3_Free, - terminalPackage4_Free, - terminalPackage5_Free, - terminalPackage6_Free, - }; - - const size_t byteSizes_Free[] = { - sizeof(terminalPackage1_Free), - sizeof(terminalPackage2_Free), - sizeof(terminalPackage3_Free), - sizeof(terminalPackage4_Free), - sizeof(terminalPackage5_Free), - sizeof(terminalPackage6_Free), - }; - - const uint8_t* byteSequences_Event2P[] = { - terminalPackage1_Event2P, - terminalPackage2_Event2P, - terminalPackage3_Event2P, - terminalPackage4_Event2P, - terminalPackage5_Event2P, - terminalPackage6_Event2P, - }; - - const size_t byteSizes_Event2P[] = { - sizeof(terminalPackage1_Event2P), - sizeof(terminalPackage2_Event2P), - sizeof(terminalPackage3_Event2P), - sizeof(terminalPackage4_Event2P), - sizeof(terminalPackage5_Event2P), - sizeof(terminalPackage6_Event2P), - }; - - const uint8_t* byteSequences_Event4P[] = { - terminalPackage1_Event4P, - terminalPackage2_Event4P, - terminalPackage3_Event4P, - terminalPackage4_Event4P, - terminalPackage5_Event4P, - terminalPackage6_Event4P, - }; - - const size_t byteSizes_Event4P[] = { - sizeof(terminalPackage1_Event4P), - sizeof(terminalPackage2_Event4P), - sizeof(terminalPackage3_Event4P), - sizeof(terminalPackage4_Event4P), - sizeof(terminalPackage5_Event4P), - sizeof(terminalPackage6_Event4P), - }; - - const uint8_t* byteSequences_Coin[] = { - terminalPackage1_Coin, - terminalPackage2_Coin, - terminalPackage3_Coin, - terminalPackage4_Coin, - terminalPackage5_Coin, - terminalPackage6_Coin, - }; - - const size_t byteSizes_Coin[] = { - sizeof(terminalPackage1_Coin), - sizeof(terminalPackage2_Coin), - sizeof(terminalPackage3_Coin), - sizeof(terminalPackage4_Coin), - sizeof(terminalPackage5_Coin), - sizeof(terminalPackage6_Coin), - }; - - sockaddr_in toAddr = { 0 }; - toAddr.sin_family = AF_INET; - toAddr.sin_addr.s_addr = inet_addr("225.0.0.1"); - toAddr.sin_port = htons(50765); - - - isFreePlay = ToBool(config["General"]["FreePlay"]); - isEventMode2P = ToBool(config["TerminalEmuConfig"]["2P Event Mode"]); - isEventMode4P = ToBool(config["TerminalEmuConfig"]["4P Event Mode"]); - - if (isFreePlay) - { - if (isEventMode2P) { - while (true) for (int i = 0; i < _countof(byteSequences_Event2P); i++) - { - sendto(sock, (const char*)byteSequences_Event2P[i], byteSizes_Event2P[i], 0, (sockaddr*)&toAddr, sizeof(toAddr)); - Sleep(8); - } - } - else if (isEventMode4P) { - while (true) for (int i = 0; i < _countof(byteSequences_Event4P); i++) - { - sendto(sock, (const char*)byteSequences_Event4P[i], byteSizes_Event4P[i], 0, (sockaddr*)&toAddr, sizeof(toAddr)); - Sleep(8); - } - } - else { - while (true) for (int i = 0; i < _countof(byteSequences_Free); i++) - { - sendto(sock, (const char*)byteSequences_Free[i], byteSizes_Free[i], 0, (sockaddr*)&toAddr, sizeof(toAddr)); - Sleep(8); - } - } + if (addr == (sockaddr*)&bindAddr) { + sockaddr_in bindAddr2 = { 0 }; + bindAddr2.sin_family = AF_INET; + bindAddr2.sin_addr.s_addr = inet_addr(ipaddr); + bindAddr2.sin_port = htons(50765); + return pbind(s, (sockaddr*)&bindAddr2, namelen); } - - while (true) for (int i = 0; i < _countof(byteSequences_Coin); i++) - { - sendto(sock, (const char*)byteSequences_Coin[i], byteSizes_Coin[i], 0, (sockaddr*)&toAddr, sizeof(toAddr)); - Sleep(8); + else { + return pbind(s, addr, namelen); + } } @@ -1284,16 +294,35 @@ DWORD WINAPI Wmmt5FfbCollector(void* ctx) uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0); while (true) { - *ffbOffset = *(DWORD *)(imageBase + 0x196F188); - *ffbOffset2 = *(DWORD *)(imageBase + 0x196F18c); - *ffbOffset3 = *(DWORD *)(imageBase + 0x196F190); - *ffbOffset4 = *(DWORD *)(imageBase + 0x196F194); + *ffbOffset = *(DWORD*)(imageBase + 0x196F188); + *ffbOffset2 = *(DWORD*)(imageBase + 0x196F18c); + *ffbOffset3 = *(DWORD*)(imageBase + 0x196F190); + *ffbOffset4 = *(DWORD*)(imageBase + 0x196F194); Sleep(10); } } static InitFunction Wmmt5Func([]() { + // Alloc debug console + FreeConsole(); + AllocConsole(); + SetConsoleTitle(L"Maxitune5 Console"); + + FILE* pNewStdout = nullptr; + FILE* pNewStderr = nullptr; + FILE* pNewStdin = nullptr; + + ::freopen_s(&pNewStdout, "CONOUT$", "w", stdout); + ::freopen_s(&pNewStderr, "CONOUT$", "w", stderr); + ::freopen_s(&pNewStdin, "CONIN$", "r", stdin); + std::cout.clear(); + std::cerr.clear(); + std::cin.clear(); + std::wcout.clear(); + std::wcerr.clear(); + std::wcin.clear(); + FILE* fileF = _wfopen(L"Fsetting.lua.gz", L"r"); if (fileF == NULL) { @@ -1324,7 +353,7 @@ static InitFunction Wmmt5Func([]() { isTerminal = true; } - + std::string networkip = config["General"]["NetworkAdapterIP"]; if (!networkip.empty()) { @@ -1347,108 +376,58 @@ static InitFunction Wmmt5Func([]() MH_CreateHookApi(L"hasp_windows_x64_109906.dll", "hasp_login", Hook_hasp_login, NULL); MH_CreateHookApi(L"WS2_32", "bind", Hook_bind, reinterpret_cast(&pbind)); + // Give me the HWND please maxitune + MH_CreateHookApi(L"user32", "ShowWindow", Hook_ShowWindow, reinterpret_cast(&pShowWindow)); + //pMaxituneWndProc = (WindowProcedure_t)(imageBasedxplus + 0xB78B90); + pMaxituneWndProc = (WindowProcedure_t)(hook::get_pattern("48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 48 83 EC 30 8B EA BA EB FF FF FF 49 8B F9 49 8B F0 48 8B D9 FF 15 ? ? ? 00 48 85 C0 74 1D 4C", 0)); + + //load banapass emu + LoadLibraryA(".\\openBanaW5p.dll"); + + // disable assert errors + uintptr_t wassertPtr = (*(uintptr_t*)(imageBase + 0xc840c0)); + safeJMP(wassertPtr, ReturnTrue); + GenerateDongleData(isTerminal); - - // Patch some check - // 0F 94 C0 84 C0 0F 94 C0 84 C0 75 05 45 32 E4 EB 03 41 B4 01 - // FOUND ON 21, 10 - // NOT WORKING 1 - // 0F 94 C0 84 C0 0F 94 C0 84 C0 75 05 45 32 ?? EB - // FOUND ON 1 - //injector::WriteMemory(imageBase + 0x6286EC, 0, true); + injector::WriteMemory(hook::get_pattern("0F 94 C0 84 C0 0F 94 C0 84 C0 75 05 45 32 ? EB", 0x13), 0, true); - - // Patch some jnz - // 83 C0 FD 83 F8 01 0F 87 B4 00 00 00 83 BF D0 06 00 00 3C 73 29 48 8D 8D 60 06 00 00 - // FOUND ON 21, 10 - // NOT FOUND: 1 - // 83 C0 FD 83 F8 01 0F 87 B4 00 00 00 - // FOUND ON 1 - //injector::MakeNOP(imageBase + 0x628AE0, 6); injector::MakeNOP(hook::get_pattern("83 C0 FD 83 F8 01 0F 87 B4 00 00 00", 6), 6); - // Patch some shit - // 83 FA 04 0F 8C 1E 01 00 00 4C 89 44 24 18 4C 89 4C 24 20 - // FOUND ON 21, 10, 1 - // NOT FOUND: - //injector::WriteMemory(imageBase + 0x7B9882, 0, true); - injector::WriteMemory(hook::get_pattern("83 FA 04 0F 8C 1E 01 00 00 4C 89 44 24 18 4C 89 4C 24 20", 2), 0, true); - // Skip weird camera init that stucks entire pc on certain brands. TESTED ONLY ON 05!!!! if (ToBool(config["General"]["WhiteScreenFix"])) { injector::WriteMemory(hook::get_pattern("48 8B C4 55 57 41 54 41 55 41 56 48 8D 68 A1 48 81 EC 90 00 00 00 48 C7 45 D7 FE FF FF FF 48 89 58 08 48 89 70 18 45 33 F6 4C 89 75 DF 33 C0 48 89 45 E7", 0), 0x90C3C032, true); } - // Patch some call - // 45 33 C0 BA 65 09 00 00 48 8D 4D B0 E8 ?? ?? ?? ?? 48 8B 08 - // FOUND ON 21, 10, 1 - //injector::MakeNOP(imageBase + 0x7DADED, 5); - injector::MakeNOP(hook::get_pattern("45 33 C0 BA 65 09 00 00 48 8D 4D B0 E8 ? ? ? ? 48 8B 08", 12), 5); - { - // 199AE18 TIME OFFSET RVA - auto location = hook::get_pattern("41 3B C7 74 0E 48 8D 8F B8 00 00 00 BA F6 01 00 00 EB 6E 48 8D 8F A0 00 00 00"); - // Patch some jnz - // 41 3B C7 74 0E 48 8D 8F B8 00 00 00 BA F6 01 00 00 EB 6E 48 8D 8F A0 00 00 00 - // FOUND ON 21, 10, 1 - //injector::WriteMemory(imageBase + 0x943F52, 0xEB, true); + injector::WriteMemory(location + 3, 0xEB, true); - // Skip some jnz - //injector::MakeNOP(imageBase + 0x943F71, 2); injector::MakeNOP(location + 0x22, 2); - // Skip some jnz - //injector::MakeNOP(imageBase + 0x943F82, 2); injector::MakeNOP(location + 0x33, 2); } - // Skip DebugBreak on MFStartup fail - // 48 83 EC 28 33 D2 B9 70 00 02 00 E8 ?? ?? ?? ?? 85 C0 79 06 - // FOUND on 21, 1 { auto location = hook::get_pattern("48 83 EC 28 33 D2 B9 70 00 02 00 E8 ? ? ? ? 85 C0 79 06"); injector::WriteMemory(location + 0x12, 0xEB, true); } - //safeJMP(hook::get_pattern(V("48 83 EC 28 33 D2 B9 70 00 02 00 E8 ? ? ? ? 85 C0 79 06")), ReturnTrue); if (isTerminal) { - // Patch some func to 1 - // - // FOUND ON 21, 10, 1 - // NOT FOUND: - //safeJMP(imageBase + 0x7BE440, ReturnTrue); safeJMP(hook::get_pattern("0F B6 41 05 2C 30 3C 09 77 04 0F BE C0 C3 83 C8 FF C3"), ReturnTrue); - // Patch some func to 1 - // 40 53 48 83 EC 20 48 83 39 00 48 8B D9 75 28 48 8D ?? ?? ?? ?? 00 48 8D ?? ?? ?? ?? 00 41 B8 ?? ?? 00 00 FF 15 ?? ?? ?? ?? 4C 8B 1B 41 0F B6 43 78 - // FOUND ON 21, 10, 1 - //safeJMP(imageBase + 0x7CF8D0, ReturnTrue); safeJMP(hook::get_pattern("40 53 48 83 EC 20 48 83 39 00 48 8B D9 75 28 48 8D ? ? ? ? 00 48 8D ? ? ? ? 00 41 B8 ? ? 00 00 FF 15 ? ? ? ? 4C 8B 1B 41 0F B6 43 78"), ReturnTrue); } else { - // Disregard terminal scanner stuff. - // 48 8B 18 48 3B D8 0F 84 88 00 00 00 39 7B 1C 74 60 80 7B 31 00 75 4F 48 8B 43 10 80 78 31 00 - // FOUND ON 21, 10, 1 - //injector::MakeNOP(imageBase + 0x91E1AE, 6); - //injector::MakeNOP(imageBase + 0x91E1B7, 2); - //injector::MakeNOP(imageBase + 0x91E1BD, 2); { auto location = hook::get_pattern("48 8B 18 48 3B D8 0F 84 88 00 00 00 39 7B 1C 74 60 80 7B 31 00 75 4F 48 8B 43 10 80 78 31 00"); injector::MakeNOP(location + 6, 6); // 6 injector::MakeNOP(location + 0xF, 2); // 0xF injector::MakeNOP(location + 0x15, 2); // 0x15 } - - // spam thread - if (ToBool(config["General"]["TerminalEmulator"])) - { - CreateThread(0, 0, SpamMulticast, 0, 0, 0); - } } auto chars = { 'F', 'G' }; @@ -1480,62 +459,10 @@ static InitFunction Wmmt5Func([]() safeJMP(imageBase + 0x806020, ReturnTrue); } - - std::string value = config["General"]["CustomName"]; - if (!value.empty()) - { - memset(customName, 0, 256); - strcpy(customName, value.c_str()); - CreateThread(0, 0, SpamCustomName, 0, 0, 0); - } - // Save story stuff (only 05) { - // skip erasing of temp card data - injector::WriteMemory(imageBase + 0x8DEBC3, 0xEB, true); - // Skip erasing of temp card - - // Old story load func - // safeJMP(imageBase + 0x54DCE1, LoadGameData); - safeJMP(imageBase + 0x5612F0, ReturnTrue); - safeJMP(imageBase + 0x5753C0, ReturnTrue); - safeJMP(imageBase + 0x57DF10, ReturnTrue); - - safeJMP(imageBase + 0x92DB20, ReturnTrue); - safeJMP(imageBase + 0x5628C0, ReturnTrue); - safeJMP(imageBase + 0x579090, ReturnTrue); - - // Skip more - safeJMP(imageBase + 0x54B0F0, ReturnTrue); - safeJMP(imageBase + 0x909DB0, ReturnTrue); - safeJMP(imageBase + 0x59FD90, ReturnTrue); - safeJMP(imageBase + 0x5A0030, ReturnTrue); - safeJMP(imageBase + 0x915370, ReturnTrue); - safeJMP(imageBase + 0x5507A0, ReturnTrue); - safeJMP(imageBase + 0x561290, ReturnTrue); - - - // safeJMP(imageBase + 0x5A0AE8, LoadWmmt5CarData); - - // Load story and car data - safeJMP(imageBase + 0x5A0AE8, loadGame); - - // crash fix - //safeJMP(imageBase + 0xAD6F28, WmmtOperatorDelete); - //safeJMP(imageBase + 0xAD6F4C, WmmtMemset); - - // Save progress trigger - injector::WriteMemory(imageBase + 0x556CE3, 0xB848, true); - injector::WriteMemory(imageBase + 0x556CE3 + 2, (uintptr_t)SaveOk, true); - injector::WriteMemory(imageBase + 0x556CED, 0x9090D0FF, true); - - // Try save later! - injector::MakeNOP(imageBase + 0x308546, 0x12); - injector::WriteMemory(imageBase + 0x308546, 0xB848, true); - injector::WriteMemory(imageBase + 0x308546 + 2, (uintptr_t)SaveGameData, true); - injector::WriteMemory(imageBase + 0x308550, 0x3348D0FF, true); - injector::WriteMemory(imageBase + 0x308550 + 4, 0x90C0, true); - + // Fix F and G drive crash on mileage screen + injector::MakeNOP(imageBase + 0xCE5DF, 5); CreateThread(0, 0, Wmmt5FfbCollector, 0, 0, 0); } diff --git a/OpenParrot/src/Functions/Games/ES3X/WMMT5DX.cpp b/OpenParrot/src/Functions/Games/ES3X/WMMT5DX.cpp index 9a31072..7034f95 100644 --- a/OpenParrot/src/Functions/Games/ES3X/WMMT5DX.cpp +++ b/OpenParrot/src/Functions/Games/ES3X/WMMT5DX.cpp @@ -894,7 +894,8 @@ static InitFunction Wmmt5DXFunc([]() MH_CreateHookApi(L"hasp_windows_x64_98199.dll", "hasp_login", Hook_hasp_login, NULL); MH_CreateHookApi(L"WS2_32", "bind", Hook_bind, reinterpret_cast(&pbind)); - + //load banapass emu + LoadLibraryA(".\\openBanaW5p.dll"); GenerateDongleData(isTerminal); diff --git a/OpenParrot/src/Functions/Games/ES3X/WMMT5DXPlus.cpp b/OpenParrot/src/Functions/Games/ES3X/WMMT5DXPlus.cpp index 519ba00..567fd3a 100644 --- a/OpenParrot/src/Functions/Games/ES3X/WMMT5DXPlus.cpp +++ b/OpenParrot/src/Functions/Games/ES3X/WMMT5DXPlus.cpp @@ -1,14 +1,13 @@ #include #include "Utility/InitFunction.h" #include "Functions/Global.h" -#include -#include -#include -#include #include "MinHook.h" #include -#include #include +#include +#include +#include +#include #ifdef _M_AMD64 #pragma optimize("", off) #pragma comment(lib, "Ws2_32.lib") @@ -20,307 +19,10 @@ static bool isFreePlay; static bool isEventMode2P; static bool isEventMode4P; const char *ipaddrdxplus; +bool isUpdate5 = false; // MUST DISABLE IC CARD, FFB MANUALLY N MT5DX+ -// FOR FREEPLAY -unsigned char dxpterminalPackage1_Free[79] = { - 0x01, 0x04, 0x4B, 0x00, 0x12, 0x14, 0x0A, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x00, 0x1A, 0x02, 0x5A, 0x00, 0x2A, 0x12, 0x08, 0x12, 0x12, 0x0C, - 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, 0x39, 0x30, 0x30, 0x30, 0x32, - 0x18, 0x00, 0x30, 0x03, 0x4A, 0x08, 0x08, 0x01, 0x10, 0x01, 0x18, 0x00, - 0x20, 0x00, 0x52, 0x0B, 0x08, 0x64, 0x10, 0xDE, 0x0F, 0x18, 0x05, 0x20, - 0x00, 0x28, 0x00, 0xEC, 0x72, 0x00, 0x41 -}; - -unsigned char dxpterminalPackage2_Free[139] = { - 0x01, 0x04, 0x87, 0x00, 0x12, 0x14, 0x0A, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x00, 0x1A, 0x02, 0x5A, 0x00, 0x2A, 0x12, 0x08, 0x14, 0x12, 0x0C, - 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, 0x39, 0x30, 0x30, 0x30, 0x32, - 0x18, 0x00, 0x30, 0x03, 0x42, 0x3A, 0x08, 0x01, 0x10, 0x03, 0x18, 0x02, - 0x20, 0x02, 0x28, 0x04, 0x30, 0x01, 0x38, 0x01, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x02, 0x58, 0x60, 0x60, 0x60, 0x68, 0x60, 0x70, 0x60, 0x78, 0x60, - 0x80, 0x01, 0x60, 0x88, 0x01, 0x60, 0x90, 0x01, 0x60, 0x98, 0x01, 0x00, - 0xA0, 0x01, 0xE2, 0xBA, 0xAC, 0xD4, 0x05, 0xA8, 0x01, 0x04, 0xB0, 0x01, - 0x24, 0xB8, 0x01, 0x00, 0x4A, 0x08, 0x08, 0x01, 0x10, 0x01, 0x18, 0x00, - 0x20, 0x00, 0x52, 0x0B, 0x08, 0x64, 0x10, 0xDE, 0x0F, 0x18, 0x05, 0x20, - 0x00, 0x28, 0x00, 0x99, 0x4E, 0xC6, 0x14 -}; - -unsigned char dxpterminalPackage3_Free[79] = { - 0x01, 0x04, 0x4B, 0x00, 0x12, 0x14, 0x0A, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x00, 0x1A, 0x02, 0x5A, 0x00, 0x2A, 0x12, 0x08, 0x19, 0x12, 0x0C, - 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, 0x39, 0x30, 0x30, 0x30, 0x32, - 0x18, 0x00, 0x30, 0x03, 0x4A, 0x08, 0x08, 0x01, 0x10, 0x01, 0x18, 0x00, - 0x20, 0x00, 0x52, 0x0B, 0x08, 0x64, 0x10, 0xDE, 0x0F, 0x18, 0x05, 0x20, - 0x00, 0x28, 0x00, 0x89, 0x93, 0x3A, 0x22 -}; - -unsigned char dxpterminalPackage4_Free[139] = { - 0x01, 0x04, 0x87, 0x00, 0x12, 0x14, 0x0A, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x00, 0x1A, 0x02, 0x5A, 0x00, 0x2A, 0x12, 0x08, 0x2E, 0x12, 0x0C, - 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, 0x39, 0x30, 0x30, 0x30, 0x32, - 0x18, 0x00, 0x30, 0x03, 0x42, 0x3A, 0x08, 0x01, 0x10, 0x03, 0x18, 0x02, - 0x20, 0x02, 0x28, 0x04, 0x30, 0x01, 0x38, 0x01, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x02, 0x58, 0x60, 0x60, 0x60, 0x68, 0x60, 0x70, 0x60, 0x78, 0x60, - 0x80, 0x01, 0x60, 0x88, 0x01, 0x60, 0x90, 0x01, 0x60, 0x98, 0x01, 0x00, - 0xA0, 0x01, 0xF0, 0xBA, 0xAC, 0xD4, 0x05, 0xA8, 0x01, 0x04, 0xB0, 0x01, - 0x24, 0xB8, 0x01, 0x00, 0x4A, 0x08, 0x08, 0x01, 0x10, 0x01, 0x18, 0x00, - 0x20, 0x00, 0x52, 0x0B, 0x08, 0x64, 0x10, 0xDE, 0x0F, 0x18, 0x05, 0x20, - 0x00, 0x28, 0x00, 0x55, 0x42, 0x47, 0xD5 -}; - -unsigned char dxpterminalPackage5_Free[79] = { - 0x01, 0x04, 0x4B, 0x00, 0x12, 0x14, 0x0A, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x00, 0x1A, 0x02, 0x5A, 0x00, 0x2A, 0x12, 0x08, 0x2F, 0x12, 0x0C, - 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, 0x39, 0x30, 0x30, 0x30, 0x32, - 0x18, 0x00, 0x30, 0x03, 0x4A, 0x08, 0x08, 0x01, 0x10, 0x01, 0x18, 0x00, - 0x20, 0x00, 0x52, 0x0B, 0x08, 0x64, 0x10, 0xDE, 0x0F, 0x18, 0x05, 0x20, - 0x00, 0x28, 0x00, 0x9C, 0xC9, 0xE0, 0x73 -}; - -unsigned char dxpterminalPackage6_Free[139] = { - 0x01, 0x04, 0x87, 0x00, 0x12, 0x14, 0x0A, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x00, 0x1A, 0x02, 0x5A, 0x00, 0x2A, 0x12, 0x08, 0x6A, 0x12, 0x0C, - 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, 0x39, 0x30, 0x30, 0x30, 0x32, - 0x18, 0x00, 0x30, 0x03, 0x42, 0x3A, 0x08, 0x01, 0x10, 0x03, 0x18, 0x02, - 0x20, 0x02, 0x28, 0x04, 0x30, 0x01, 0x38, 0x01, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x02, 0x58, 0x60, 0x60, 0x60, 0x68, 0x60, 0x70, 0x60, 0x78, 0x60, - 0x80, 0x01, 0x60, 0x88, 0x01, 0x60, 0x90, 0x01, 0x60, 0x98, 0x01, 0x00, - 0xA0, 0x01, 0xF1, 0xBA, 0xAC, 0xD4, 0x05, 0xA8, 0x01, 0x04, 0xB0, 0x01, - 0x24, 0xB8, 0x01, 0x00, 0x4A, 0x08, 0x08, 0x01, 0x10, 0x01, 0x18, 0x00, - 0x20, 0x00, 0x52, 0x0B, 0x08, 0x64, 0x10, 0xDE, 0x0F, 0x18, 0x05, 0x20, - 0x00, 0x28, 0x00, 0x26, 0xB7, 0x89, 0xD0 -}; - -// FOR COIN ENTRY! -unsigned char dxpterminalPackage1_Coin[75] = { - 0x01, 0x04, 0x47, 0x00, 0x12, 0x14, 0x0A, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x00, 0x1A, 0x00, 0x2A, 0x12, 0x08, 0x0B, 0x12, 0x0C, 0x32, 0x37, - 0x32, 0x32, 0x31, 0x31, 0x39, 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, - 0x4A, 0x08, 0x08, 0x01, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0B, - 0x08, 0x64, 0x10, 0xDE, 0x0F, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0x09, - 0x06, 0x41, 0x0B -}; - -unsigned char dxpterminalPackage2_Coin[135] = { - 0x01, 0x04, 0x83, 0x00, 0x12, 0x14, 0x0A, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x00, 0x1A, 0x00, 0x2A, 0x12, 0x08, 0x39, 0x12, 0x0C, 0x32, 0x37, - 0x32, 0x32, 0x31, 0x31, 0x39, 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, - 0x42, 0x3A, 0x08, 0x01, 0x10, 0x03, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, - 0x30, 0x00, 0x38, 0x01, 0x40, 0x00, 0x48, 0x00, 0x50, 0x02, 0x58, 0x60, - 0x60, 0x60, 0x68, 0x60, 0x70, 0x60, 0x78, 0x60, 0x80, 0x01, 0x60, 0x88, - 0x01, 0x60, 0x90, 0x01, 0x60, 0x98, 0x01, 0x00, 0xA0, 0x01, 0xD5, 0xBE, - 0x8F, 0xD2, 0x05, 0xA8, 0x01, 0x04, 0xB0, 0x01, 0x24, 0xB8, 0x01, 0x00, - 0x4A, 0x08, 0x08, 0x01, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0B, - 0x08, 0x64, 0x10, 0xDE, 0x0F, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0xF5, - 0xF1, 0x0D, 0xB2 -}; - -unsigned char dxpterminalPackage3_Coin[75] = { - 0x01, 0x04, 0x47, 0x00, 0x12, 0x14, 0x0A, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x00, 0x1A, 0x00, 0x2A, 0x12, 0x08, 0x3A, 0x12, 0x0C, 0x32, 0x37, - 0x32, 0x32, 0x31, 0x31, 0x39, 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, - 0x4A, 0x08, 0x08, 0x01, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0B, - 0x08, 0x64, 0x10, 0xDE, 0x0F, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0x22, - 0x25, 0x31, 0x0D -}; - -unsigned char dxpterminalPackage4_Coin[135] = { - 0x01, 0x04, 0x83, 0x00, 0x12, 0x14, 0x0A, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x00, 0x1A, 0x00, 0x2A, 0x12, 0x08, 0x57, 0x12, 0x0C, 0x32, 0x37, - 0x32, 0x32, 0x31, 0x31, 0x39, 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, - 0x42, 0x3A, 0x08, 0x01, 0x10, 0x03, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, - 0x30, 0x00, 0x38, 0x01, 0x40, 0x00, 0x48, 0x00, 0x50, 0x02, 0x58, 0x60, - 0x60, 0x60, 0x68, 0x60, 0x70, 0x60, 0x78, 0x60, 0x80, 0x01, 0x60, 0x88, - 0x01, 0x60, 0x90, 0x01, 0x60, 0x98, 0x01, 0x00, 0xA0, 0x01, 0xD6, 0xBE, - 0x8F, 0xD2, 0x05, 0xA8, 0x01, 0x04, 0xB0, 0x01, 0x24, 0xB8, 0x01, 0x00, - 0x4A, 0x08, 0x08, 0x01, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0B, - 0x08, 0x64, 0x10, 0xDE, 0x0F, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0xCA, - 0x8B, 0x15, 0xCB -}; - -unsigned char dxpterminalPackage5_Coin[79] = { - 0x01, 0x04, 0x4B, 0x00, 0x12, 0x14, 0x0A, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x00, 0x1A, 0x02, 0x5A, 0x00, 0x2A, 0x12, 0x08, 0x58, 0x12, 0x0C, - 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, 0x39, 0x30, 0x30, 0x30, 0x32, - 0x18, 0x00, 0x30, 0x03, 0x4A, 0x08, 0x08, 0x01, 0x10, 0x01, 0x18, 0x00, - 0x20, 0x00, 0x52, 0x0B, 0x08, 0x64, 0x10, 0xDE, 0x0F, 0x18, 0x05, 0x20, - 0x00, 0x28, 0x00, 0x3E, 0xB1, 0xB7, 0x22 -}; - -unsigned char dxpterminalPackage6_Coin[139] = { - 0x01, 0x04, 0x87, 0x00, 0x12, 0x14, 0x0A, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x00, 0x1A, 0x02, 0x5A, 0x00, 0x2A, 0x12, 0x08, 0x77, 0x12, 0x0C, - 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, 0x39, 0x30, 0x30, 0x30, 0x32, - 0x18, 0x00, 0x30, 0x03, 0x42, 0x3A, 0x08, 0x01, 0x10, 0x03, 0x18, 0x02, - 0x20, 0x02, 0x28, 0x04, 0x30, 0x00, 0x38, 0x01, 0x40, 0x00, 0x48, 0x00, - 0x50, 0x02, 0x58, 0x60, 0x60, 0x60, 0x68, 0x60, 0x70, 0x60, 0x78, 0x60, - 0x80, 0x01, 0x60, 0x88, 0x01, 0x60, 0x90, 0x01, 0x60, 0x98, 0x01, 0x00, - 0xA0, 0x01, 0xD7, 0xBE, 0x8F, 0xD2, 0x05, 0xA8, 0x01, 0x04, 0xB0, 0x01, - 0x24, 0xB8, 0x01, 0x00, 0x4A, 0x08, 0x08, 0x01, 0x10, 0x01, 0x18, 0x00, - 0x20, 0x00, 0x52, 0x0B, 0x08, 0x64, 0x10, 0xDE, 0x0F, 0x18, 0x05, 0x20, - 0x00, 0x28, 0x00, 0xBD, 0x07, 0xCF, 0xDC -}; - -//Event mode 2P -unsigned char dxpterminalPackage1_Event4P[79] = { - 0x01, 0x04, 0x44, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13, - 0x08, 0xd1, 0x0b, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, - 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x4a, 0x08, 0x08, - 0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10, - 0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0xc1, 0x96, 0xc9, 0x2e -}; - -unsigned char dxpterminalPackage2_Event4P[139] = { - 0x01, 0x04, 0x80, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13, - 0x08, 0xd2, 0x0b, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, - 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x42, 0x3a, 0x08, - 0x01, 0x10, 0x03, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, 0x30, 0x01, 0x38, - 0x01, 0x40, 0x01, 0x48, 0x00, 0x50, 0x02, 0x58, 0x60, 0x60, 0x60, 0x68, - 0x60, 0x70, 0x60, 0x78, 0x60, 0x80, 0x01, 0x60, 0x88, 0x01, 0x60, 0x90, - 0x01, 0x60, 0x98, 0x01, 0x00, 0xa0, 0x01, 0xd8, 0xc3, 0xd6, 0xe1, 0x05, - 0xa8, 0x01, 0x04, 0xb0, 0x01, 0x24, 0xb8, 0x01, 0x00, 0x4a, 0x08, 0x08, - 0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10, - 0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0x91, 0x74, 0xca, 0x1e - -}; - -unsigned char dxpterminalPackage3_Event4P[79] = { - 0x01, 0x04, 0x44, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13, - 0x08, 0x8d, 0x0c, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, - 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x4a, 0x08, 0x08, - 0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10, - 0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0x86, 0xb1, 0x27, 0x9e -}; - -unsigned char dxpterminalPackage4_Event4P[139] = { - 0x01, 0x04, 0x80, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13, - 0x08, 0x8e, 0x0c, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, - 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x42, 0x3a, 0x08, - 0x01, 0x10, 0x03, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, 0x30, 0x01, 0x38, - 0x01, 0x40, 0x01, 0x48, 0x00, 0x50, 0x02, 0x58, 0x60, 0x60, 0x60, 0x68, - 0x60, 0x70, 0x60, 0x78, 0x60, 0x80, 0x01, 0x60, 0x88, 0x01, 0x60, 0x90, - 0x01, 0x60, 0x98, 0x01, 0x00, 0xa0, 0x01, 0xd9, 0xc3, 0xd6, 0xe1, 0x05, - 0xa8, 0x01, 0x04, 0xb0, 0x01, 0x24, 0xb8, 0x01, 0x00, 0x4a, 0x08, 0x08, - 0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10, - 0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0xc2, 0x11, 0x2a, 0x66 - -}; - -unsigned char dxpterminalPackage5_Event4P[79] = { - 0x01, 0x04, 0x44, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13, - 0x08, 0xc9, 0x0c, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, - 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x4a, 0x08, 0x08, - 0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10, - 0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0x5d, 0x49, 0x01, 0x1e -}; - -unsigned char dxpterminalPackage6_Event4P[139] = { - 0x01, 0x04, 0x80, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13, - 0x08, 0xca, 0x0c, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, - 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x42, 0x3a, 0x08, - 0x01, 0x10, 0x03, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, 0x30, 0x01, 0x38, - 0x01, 0x40, 0x01, 0x48, 0x00, 0x50, 0x02, 0x58, 0x60, 0x60, 0x60, 0x68, - 0x60, 0x70, 0x60, 0x78, 0x60, 0x80, 0x01, 0x60, 0x88, 0x01, 0x60, 0x90, - 0x01, 0x60, 0x98, 0x01, 0x00, 0xa0, 0x01, 0xda, 0xc3, 0xd6, 0xe1, 0x05, - 0xa8, 0x01, 0x04, 0xb0, 0x01, 0x24, 0xb8, 0x01, 0x00, 0x4a, 0x08, 0x08, - 0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10, - 0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0xd4, 0x80, 0x16, 0xc2 -}; - - -//Event mode 2P -unsigned char dxpterminalPackage1_Event2P[79] = { - 0x01, 0x04, 0x44, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13, - 0x08, 0xfe, 0x0e, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, - 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x4a, 0x08, 0x08, - 0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10, - 0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0xaf, 0xa1, 0x42, 0x3d -}; - -unsigned char dxpterminalPackage2_Event2P[139] = { - 0x01, 0x04, 0x80, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13, - 0x08, 0xff, 0x0e, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, - 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x42, 0x3a, 0x08, - 0x01, 0x10, 0x03, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, 0x30, 0x01, 0x38, - 0x01, 0x40, 0x02, 0x48, 0x00, 0x50, 0x02, 0x58, 0x60, 0x60, 0x60, 0x68, - 0x60, 0x70, 0x60, 0x78, 0x60, 0x80, 0x01, 0x60, 0x88, 0x01, 0x60, 0x90, - 0x01, 0x60, 0x98, 0x01, 0x00, 0xa0, 0x01, 0xa7, 0xc2, 0xa5, 0xe1, 0x05, - 0xa8, 0x01, 0x02, 0xb0, 0x01, 0x24, 0xb8, 0x01, 0x00, 0x4a, 0x08, 0x08, - 0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10, - 0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0xe8, 0x94, 0x41, 0x46 - -}; - -unsigned char dxpterminalPackage3_Event2P[79] = { - 0x01, 0x04, 0x44, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13, - 0x08, 0x80, 0x0f, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, - 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x4a, 0x08, 0x08, - 0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10, - 0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0xa3, 0x94, 0x12, 0x9b -}; - -unsigned char dxpterminalPackage4_Event2P[139] = { - 0x01, 0x04, 0x80, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13, - 0x08, 0x8d, 0x0f, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, - 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x42, 0x3a, 0x08, - 0x01, 0x10, 0x03, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, 0x30, 0x01, 0x38, - 0x01, 0x40, 0x02, 0x48, 0x00, 0x50, 0x02, 0x58, 0x60, 0x60, 0x60, 0x68, - 0x60, 0x70, 0x60, 0x78, 0x60, 0x80, 0x01, 0x60, 0x88, 0x01, 0x60, 0x90, - 0x01, 0x60, 0x98, 0x01, 0x00, 0xa0, 0x01, 0xa8, 0xc2, 0xa5, 0xe1, 0x05, - 0xa8, 0x01, 0x02, 0xb0, 0x01, 0x24, 0xb8, 0x01, 0x00, 0x4a, 0x08, 0x08, - 0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10, - 0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0x8b, 0x02, 0xdf, 0xad - -}; - -unsigned char dxpterminalPackage5_Event2P[79] = { - 0x01, 0x04, 0x44, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13, - 0x08, 0x8e, 0x0f, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, - 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x4a, 0x08, 0x08, - 0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10, - 0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0xa3, 0xc2, 0x27, 0x9c -}; - -unsigned char dxpterminalPackage6_Event2P[139] = { - 0x01, 0x04, 0x80, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00, - 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13, - 0x08, 0xf0, 0x0e, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39, - 0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x42, 0x3a, 0x08, - 0x01, 0x10, 0x03, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, 0x30, 0x01, 0x38, - 0x01, 0x40, 0x02, 0x48, 0x00, 0x50, 0x02, 0x58, 0x60, 0x60, 0x60, 0x68, - 0x60, 0x70, 0x60, 0x78, 0x60, 0x80, 0x01, 0x60, 0x88, 0x01, 0x60, 0x90, - 0x01, 0x60, 0x98, 0x01, 0x00, 0xa0, 0x01, 0xa6, 0xc2, 0xa5, 0xe1, 0x05, - 0xa8, 0x01, 0x02, 0xb0, 0x01, 0x24, 0xb8, 0x01, 0x00, 0x4a, 0x08, 0x08, - 0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10, - 0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0x97, 0xd5, 0x79, 0xa6 -}; - - #define HASP_STATUS_OK 0 unsigned int dxpHook_hasp_login(int feature_id, void* vendor_code, int hasp_handle) { #ifdef _DEBUG @@ -370,15 +72,6 @@ unsigned int dxpHook_hasp_write(int hasp_handle, int hasp_fileid, unsigned int o return HASP_STATUS_OK; } -// Save data dump memory block -unsigned char saveDatadxp[0x2000]; - -// Mile data dump memory block -unsigned char mileDatadxp[0x08]; - -// Star data dump memory block -unsigned char starDataDxp[0x40]; - //set system date patch by pockywitch typedef bool (WINAPI* SETSYSTEMTIME)(SYSTEMTIME* in); SETSYSTEMTIME pSetSystemTime = NULL; @@ -388,128 +81,6 @@ bool WINAPI Hook_SetSystemTime(SYSTEMTIME* in) return TRUE; } -// BASE: 0x24E0 -// Campaing honor data: 2998, save 0xB8 -// Story Mode Honor data: 25F0, save 0x98 -// StoryModeNoLoseHonorData: 2C80, Copy 0,0x10, Copy 0x18,0x28 maybe 8 bytes more -// OtherHonorData: 2A90, Copy 0x60 -// CampaignHonorData: 2698, Copy 0x48 - -//static int SaveCampaingHonorData2() -//{ -// memset(saveData, 0, 0x1000); -// uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0); -// uintptr_t value = *(uintptr_t*)(imageBase + 0x1948F10); -// value += 0x2698; -// FILE* file = fopen(V("CampaignHonorData.sav"), V("wb")); -// memcpy(saveData, (void *)value, 0x48); -// fwrite(saveData, 1, 0x100, file); -// fclose(file); -// return 1; -//} -// -//static int SaveOtherHonorData() -//{ -// memset(saveData, 0, 0x1000); -// uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0); -// uintptr_t value = *(uintptr_t*)(imageBase + 0x1948F10); -// value += 0x2A90; -// FILE* file = fopen(V("OtherHonorData.sav"), V("wb")); -// memcpy(saveData, (void *)value, 0x60); -// fwrite(saveData, 1, 0x100, file); -// fclose(file); -// return 1; -//} -// -//static int SaveStoryModeNoLoseHonorData() -//{ -// memset(saveData, 0, 0x1000); -// uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0); -// uintptr_t value = *(uintptr_t*)(imageBase + 0x1948F10); -// value += 0x2C80; -// FILE* file = fopen(V("StoryModeNoLoseHonorData.sav"), V("wb")); -// memcpy(saveData, (void *)value, 0x10); -// value += 0x18; -// memcpy(saveData, (void *)value, 0x28); -// fwrite(saveData, 1, 0x100, file); -// fclose(file); -// return 1; -//} -// -//static int SaveCampaingHonorData() -//{ -// memset(saveData, 0, 0x1000); -// uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0); -// uintptr_t value = *(uintptr_t*)(imageBase + 0x1948F10); -// value += 0x2998; -// FILE* file = fopen(V("campaing.sav"), V("wb")); -// memcpy(saveData, (void *)value, 0xB8); -// fwrite(saveData, 1, 0x100, file); -// fclose(file); -// return 1; -//} -// -//static int SaveStoryData() -//{ -// memset(saveData, 0, 0x1000); -// uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0); -// uintptr_t value = *(uintptr_t*)(imageBase + 0x1948F10); -// value += 0x25F0; -// FILE* file = fopen(V("story.sav"), V("wb")); -// memcpy(saveData, (void *)value, 0x98); -// fwrite(saveData, 1, 0x100, file); -// fclose(file); -// return 1; -//} - -// setFullTune(void): Int -// If the currently loaded car is NOT fully tuned, -// updates the power and handling values to be fully -// tuned (16 for each). If they are already fully tuned, -// does not change any values. -static int setFullTune() -{ - // Get the memory addresses for the car base save, power and handling values - auto carSaveBase = (uintptr_t*)(*(uintptr_t*)(imageBasedxplus + 0x01F7D578) + 0x268); - auto powerAddress = (uintptr_t*)(*(uintptr_t*)(carSaveBase)+0xAC); - auto handleAddress = (uintptr_t*)(*(uintptr_t*)(carSaveBase)+0xB8); - - // Dereference the power value from the memory address - auto powerValue = injector::ReadMemory(powerAddress, true); - auto handleValue = injector::ReadMemory(handleAddress, true); - - // If the power and handling values do not add up to fully tuned - if (powerValue + handleValue < 0x20) - { - // Car is not fully tuned, force it to the default full tune - injector::WriteMemory(powerAddress, 0x10, true); - injector::WriteMemory(handleAddress, 0x10, true); - - // Updated - return 1; - } - - // Not updated - return 0; -} - -// forceFullTune(pArguments: void*): DWORD WINAPI -// Function which runs in a secondary thread if the forceFullTune -// option is selected in the menu. If the player's car is not fully -// tuned, it is forcibly set to max tune. If the player's car is already -// fully tuned, it is left alone. -static DWORD WINAPI forceFullTune(void* pArguments) -{ - // Loops while the program is running - while (true) { - - // Only runs every 16th frame - Sleep(16); - - // Run the set full tune process - setFullTune(); - } -} // ******************************************** // // ************ Debug Data Logging ************ // @@ -577,914 +148,6 @@ static int writeDump(char * filename, unsigned char * data, size_t size) } } -// Sets if saving is allowed or not -static bool saveOk = false; - -// If custom car is used -bool customCarDxp = false; - -// Sets if loading is allowed -bool loadOkDxp = false; - -// Car save data reserved memory -unsigned char carDataDxp[0xFF]; - -// Car filename string -char carFileNameDxp[0xFF]; - -// SaveOk(void): Void -// Enables saving -static int SaveOk() -{ - saveOk = true; - return 1; -} - -// loadCarFile(filename: char*): Int -// Given a filename, loads the data from -// the car file into memory. -static int loadCarFile(char* filename) -{ - // Open the file with the filename - FILE* file = fopen(filename, "rb"); - - // File open OK - if (file) - { - // Get the length of the file - fseek(file, 0, SEEK_END); - int fsize = ftell(file); - - // If the file has the right size - if (fsize == 0xFF) - { - // Reset to start of the file and read it into the car data variable - fseek(file, 0, SEEK_SET); - fread(carDataDxp, fsize, 1, file); - - // Dereference the memory location for the car save data - uintptr_t carSaveLocation = *(uintptr_t*)((*(uintptr_t*)(imageBasedxplus + 0x1F7D578)) + 0x268); - - // memcpy((void*)(carSaveLocation + 0x00), carDataDxp + 0x00, 8); // ?? - // memcpy((void*)(carSaveLocation + 0x08), carDataDxp + 0x08, 8); // ?? - // memcpy((void*)(carSaveLocation + 0x10), carDataDxp + 0x10, 8); // ?? - // memcpy((void*)(carSaveLocation + 0x18), carDataDxp + 0x18, 8); // ?? - // memcpy((void*)(carSaveLocation + 0x20), carDataDxp + 0x20, 8); // Crash - memcpy((void*)(carSaveLocation + 0x28), carDataDxp + 0x28, 8); // Region (0x28) - memcpy((void*)(carSaveLocation + 0x30), carDataDxp + 0x30, 8); // CarID (0x34) - // memcpy((void*)(carSaveLocation + 0x38), carDataDxp + 0x38, 4); // defaultColor - memcpy((void*)(carSaveLocation + 0x3C), carDataDxp + 0x3C, 4); // CustomColor (0x3C) - memcpy((void*)(carSaveLocation + 0x40), carDataDxp + 0x40, 8); // Rims (0x40), Rims Colour (0x44) - memcpy((void*)(carSaveLocation + 0x48), carDataDxp + 0x48, 8); // Aero (0x48), Hood (0x4C) - // memcpy((void*)(carSaveLocation + 0x50), carDataDxp + 0x50, 8); // Crash - memcpy((void*)(carSaveLocation + 0x58), carDataDxp + 0x58, 8); // Wing (0x58), Mirror (0x5C) - memcpy((void*)(carSaveLocation + 0x60), carDataDxp + 0x60, 8); // Sticker (0x60), Sticker Type (0x64) - // memcpy((void*)(carSaveLocation + 0x68), carDataDxp + 0x60, 8); // Crash - memcpy((void*)(carSaveLocation + 0x88), carDataDxp + 0x88, 8); // Roof Sticker (0x88), Roof Sticker Type (0x8C) - memcpy((void*)(carSaveLocation + 0x90), carDataDxp + 0x90, 8); // Neon (0x90), Trunk (0x94) - memcpy((void*)(carSaveLocation + 0x98), carDataDxp + 0x98, 8); // Plate Frame (0x98) - memcpy((void*)(carSaveLocation + 0xA0), carDataDxp + 0xA0, 8); // Plate Number (0xA0), vinyl_body_challenge_prefecture_1~15 (0xA4) - memcpy((void*)(carSaveLocation + 0xA8), carDataDxp + 0xA8, 8); // vinyl_body_challenge_prefecture (0xA8), Power (0xAC) - memcpy((void*)(carSaveLocation + 0xB8), carDataDxp + 0xB8, 8); // Handling (0xB8), Rank (0xBC) - // memcpy((void*)(carSaveLocation + 0xC0), carDataDxp + 0xC0, 8); // ?? - // memcpy((void*)(carSaveLocation + 0xC8), carDataDxp + 0xC8, 8); // ?? - // memcpy((void*)(carSaveLocation + 0xD0), carDataDxp + 0xD0, 8); // Crash - // memcpy((void*)(carSaveLocation + 0xD8), carDataDxp + 0xD8, 8); // ?? - // memcpy((void*)(carSaveLocation + 0xE0), carDataDxp + 0xE0, 8); // ?? - // memcpy((void*)(carSaveLocation + 0xE8), carDataDxp + 0xE8, 8); // ?? - // memcpy((void*)(carSaveLocation + 0xF0), carDataDxp + 0xF0, 8); // ?? - // memcpy((void*)(carSaveLocation + 0xF8), carDataDxp + 0xF8, 8); // ?? - } - - // Disable loading - loadOkDxp = false; - - // Close the file - fclose(file); - - // Success - return 1; - } - - // Failed - return 0; -} - -// loadCarData(filepath: char*): Void -// Given a filepath, attempts to load a -// car file (either custom.car or specific -// car file) from that folder. -static int loadCarData(char * filepath) -{ - // Custom car disabled by default - customCarDxp = false; - - // Miles path string - char carpath[0xFF]; - - // Set the milepath memory to zero - memset(carpath, 0, 0xFF); - - // Copy the file path to the miles path - strcpy(carpath, filepath); - - // Append the mileage filename to the string - strcat(carpath, "\\OpenParrot_Cars"); - - // Create the OpenParrot_cars directory at the given filepath - std::filesystem::create_directories(carpath); - - // Get the path to the custom car file - sprintf(carFileNameDxp, "%s\\custom.car", carpath); - - // If the custom car file exists - if (FileExists(carFileNameDxp)) - { - // Load the custom car file - loadCarFile(carFileNameDxp); - - // Enable custom car switch - customCarDxp = true; - } - - // Empty the car filename string - memset(carFileNameDxp, 0, 0xFF); - - // Get the path to the specific car file - sprintf(carFileNameDxp, "%s\\%08X.car", carpath, *(DWORD*)(*(uintptr_t*)(*(uintptr_t*)(imageBasedxplus + 0x1F7D578) + 0x268) + 0x34)); - - // If the specific car file exists - if (FileExists(carFileNameDxp)) - { - // Load the car file - loadCarFile(carFileNameDxp); - } - - // If the force full tune switch is set - if (ToBool(config["Tune"]["Force Full Tune"])) - { - // Create the force full tune thread - // CreateThread(0, 0, forceFullTune, 0, 0, 0); - - // Set the car to be fully tuned - setFullTune(); - } - - // Success - return 1; -} - -static int saveCarData(char* filepath) -{ - // Car Profile saving - memset(carDataDxp, 0, 0xFF); - memset(carFileNameDxp, 0, 0xFF); - - // Address where player save data starts - uintptr_t saveDataBase = *(uintptr_t*)(imageBasedxplus + 0x1F7D578); - - // Address where car save data starts - uintptr_t carSaveBase = *(uintptr_t*)(saveDataBase + 0x268); - - // Miles path string - char carpath[0xFF]; - - // Set the milepath memory to zero - memset(carpath, 0, 0xFF); - - // Copy the file path to the miles path - strcpy(carpath, filepath); - - // Append the mileage filename to the string - strcat(carpath, "\\OpenParrot_Cars"); - - // CreateDirectoryA(carpath, nullptr); - - // Create the cars path folder - std::filesystem::create_directories(carpath); - - // Copy the 0xFF bytes from memory to the car data array - memcpy(carDataDxp + 0x00, (void*)(carSaveBase + 0x0), 0xFF); - - // If custom car is set - if (customCarDxp) - { - // Save the file to custom.car - sprintf(carpath, "%s\\custom.car", carpath); - } - else // Custom car is not set - { - // Save the file to the specific car filename - sprintf(carpath, "%s\\%08X.car", carpath, *(DWORD*)(*(uintptr_t*)(*(uintptr_t*)(imageBasedxplus + 0x1F7D578) + 0x268) + 0x34)); - } - - // Open the file at the given car path - FILE* carFile = fopen(carpath, "wb"); - - // Write the data from the array to the file - fwrite(carDataDxp, 1, 0xFF, carFile); - fclose(carFile); - - // Success - return 1; - - /* - - // Legacy MT5 car saving code reference - - memset(saveData, 0, 0x2000); - uintptr_t value = *(uintptr_t*)(imageBase + 0x1948F10); - value = *(uintptr_t*)(value + 0x108); - memcpy(saveData, (void *)value, 0x340); - FILE* file = fopen("openprogress.sav", "wb"); - fwrite(saveData, 1, 0x2000, file); - fclose(file); - - // Car Profile saving - memset(carData, 0, 0xFF); - memset(carFileNamedxp, 0, 0xFF); - memcpy(carData, (void *)*(uintptr_t*)(*(uintptr_t*)(imageBase + 0x1948F10) + 0x180 + 0xa8 + 0x18), 0xE0); - CreateDirectoryA("OpenParrot_Cars", nullptr); - - if(customCardxp) - { - sprintf(carFileNamedxp, ".\\OpenParrot_Cars\\custom.car"); - } - else - { - sprintf(carFileNamedxp, ".\\OpenParrot_Cars\\%08X.car", *(DWORD*)(*(uintptr_t*)(*(uintptr_t*)(imageBase + 0x1948F10) + 0x180 + 0xa8 + 0x18) + 0x2C)); - } - - FILE *carSave = fopen(carFileNamedxp, "wb"); - fwrite(carData, 1, 0xE0, file); - fclose(carSave); - - //SaveStoryData(); - //SaveCampaingHonorData(); - //SaveStoryModeNoLoseHonorData(); - //SaveOtherHonorData(); - //SaveCampaingHonorData2(); - - saveOk = false; - return 1; - */ -} - -// loadStoryData(filepath: char *): Void -// Given a filepath, loads the story data -// from the file into memory. -static int loadStoryData(char* filepath) -{ - // Zero out the save data array - memset(saveDatadxp, 0x0, 0x2000); - - // Miles path string - char storyPath[0xFF]; - - // Set the milepath memory to zero - memset(storyPath, 0, 0xFF); - - // Copy the file path to the miles path - strcpy(storyPath, filepath); - - // Append the mileage filename to the string - strcat(storyPath, "\\openprogress.sav"); - - // Address where player save data starts - uintptr_t saveDataBase = *(uintptr_t*)(imageBasedxplus + 0x1F7D578); - - // Open the openprogress file with read privileges - FILE* file = fopen(storyPath, "rb"); - - // If the file exists - if (file) - { - // Get all of the contents from the file - fseek(file, 0, SEEK_END); - - // Get the size of the file - int fsize = ftell(file); - - // Check file is correct size - if (fsize == 0x2000) - { - // Reset seek index to start - fseek(file, 0, SEEK_SET); - - // Read all of the contents of the file into saveDatadxp - fread(saveDatadxp, fsize, 1, file); - - // Story save data offset - uintptr_t saveStoryBase = *(uintptr_t*)(saveDataBase + 0x108); - - // 0x00 - 08 4C - Should be able to use this to figure out what game a save is from - - // (Mostly) discovered story data - - memcpy((void*)(saveStoryBase + 0x48), saveDatadxp + 0x48, 0x8); // Story Bit - memcpy((void*)(saveStoryBase + 0xE0), saveDatadxp + 0xE0, 0x8); // ?? - memcpy((void*)(saveStoryBase + 0xE8), saveDatadxp + 0xE8, 0x8); // Chapter Progress (0xE8) (Bitmask) - memcpy((void*)(saveStoryBase + 0xF0), saveDatadxp + 0xF0, 0x8); // Current Chapter (0xF0), Total Wins (0xF4) - memcpy((void*)(saveStoryBase + 0xF8), saveDatadxp + 0xF8, 0x8); // ?? - memcpy((void*)(saveStoryBase + 0x100), saveDatadxp + 0x100, 0x8); // Win Streak (0x104) - memcpy((void*)(saveStoryBase + 0x108), saveDatadxp + 0x108, 0x8); // ?? - memcpy((void*)(saveStoryBase + 0x110), saveDatadxp + 0x110, 0x8); // Locked Chapters (0x110) (Bitmask) - - // Can't tell if the data past this point does anything - - // memcpy((void*)(saveStoryBase + 0x118), saveDatadxp + 0x118, 0x8); // ?? - // memcpy((void*)(saveStoryBase + 0x120), saveDatadxp + 0x120, 0x8); // ?? - // memcpy((void*)(saveStoryBase + 0x128), saveDatadxp + 0x128, 0x8); // ?? - // memcpy((void*)(saveStoryBase + 0x130), saveDatadxp + 0x130, 0x8); // ?? - // memcpy((void*)(saveStoryBase + 0x138), saveDatadxp + 0x138, 0x8); // ?? - // memcpy((void*)(saveStoryBase + 0x140), saveDatadxp + 0x140, 0x8); // ?? - // memcpy((void*)(saveStoryBase + 0x148), saveDatadxp + 0x148, 0x8); // ?? - // memcpy((void*)(saveStoryBase + 0x150), saveDatadxp + 0x150, 0x8); // ?? - // memcpy((void*)(saveStoryBase + 0x158), saveDatadxp + 0x158, 0x8); // ?? - - // Save data loaded successfully - loadOkDxp = true; - - //+ 0x80 - - //+ [0x340] - - // [[[[0000000005CE5850] + 108] + 340] + 50] + 50 - // [[[[0000000005CE5850] + 108] + 340] + 50] + 54 - // wmn5r.exe + 1948BF8 - //TA stuff - - //[[[[magic_rva]+108]+340]+50] - - // memcpy((void*)(saveStoryBase + 0x24E0 + 0x16), saveDatadxp + 0x16, 0x1000); - - //value += 0x24E0; - // First chunk - //memcpy((void *)(value + 0x16), saveData + 0x16, 0x28); - //// - //memcpy((void *)(value + 0x40), saveData + 0x40, 0x18); - //// - //memcpy((void *)(value + 0x60), saveData + 0x60, 0x20); - //// - //memcpy((void *)(value + 0x90), saveData + 0x90, 0x28); - //// - //memcpy((void *)(value + 0xC0), saveData + 0xC0, 0x10); - //// - //memcpy((void *)(value + 0xD8), saveData + 0xD8, 0x28); // OK - //// - //memcpy((void *)(value + 0x110), saveData + 0x110, 0x98); - //// - //memcpy((void *)(value + 0x1B8), saveData + 0x1B8, 0x48); - //// - //memcpy((void *)(value + 0x208), saveData + 0x208, 0x28); - //// - //memcpy((void *)(value + 0x240), saveData + 0x240, 0x68); - //// - //memcpy((void *)(value + 0x2B8), saveData + 0x2B8, 0x88); - // - //memcpy((void *)(value + 0x370), saveData + 0x370, 0x10); - //// - //memcpy((void *)(value + 0x388), saveData + 0x388, 0x90); - //// - //memcpy((void *)(value + 0x420), saveData + 0x420, 0x18); - //// - //memcpy((void *)(value + 0x440), saveData + 0x440, 0x18); - //// - //memcpy((void *)(value + 0x460), saveData + 0x460, 0x48); - //// - //memcpy((void *)(value + 0x4B8), saveData + 0x4B8, 0xB8); - //// - //memcpy((void *)(value + 0x578), saveData + 0x578, 0x08); - //// - //memcpy((void *)(value + 0x5A8), saveData + 0x5A8, 0x68); - //// - //memcpy((void *)(value + 0x628), saveData + 0x628, 0x48); - //// - //memcpy((void *)(value + 0x688), saveData + 0x688, 0x48); - //// - //memcpy((void *)(value + 0x6E8), saveData + 0x6E8, 0xA8); - //// - //memcpy((void *)(value + 0x7A0), saveData + 0x7A0, 0x10); - //// - //memcpy((void *)(value + 0x7B8), saveData + 0x7B8, 0x28); - //// - //memcpy((void *)(value + 0x7E8), saveData + 0x7E8, 0x10); - //// - ////memcpy((void *)(value + 0x800), saveData + 0x800, 0x48); // Problem - ////// - //memcpy((void *)(value + 0x850), saveData + 0x850, 0x08); - // - //memcpy((void *)(value + 0x860), saveData + 0x860, 0x08); - ////// - //memcpy((void *)(value + 0x870), saveData + 0x870, 0x18); - //// - //memcpy((void *)(value + 0x890), saveData + 0x890, 0x40); - //// - //memcpy((void *)(value + 0x8E0), saveData + 0x8E0, 0x10); - //// - //memcpy((void *)(value + 0x8F8), saveData + 0x8F8, 0x28); - //// - //memcpy((void *)(value + 0x928), saveData + 0x928, 0x10); - //// - //memcpy((void *)(value + 0x940), saveData + 0x940, 0x48); // Problem - } - fclose(file); - } - - //LoadStoryData(); - //LoadCampaingHonorData(); - //LoadStoryModeNoLoseHonorData(); - //LoadOtherHonorData(); - //LoadCampaingHonorData2(); - - // Success status - return 1; -} - -//static int LoadCampaingHonorData2() -//{ -// memset(saveData, 0x0, 0x1000); -// FILE* file = fopen(V("CampaignHonorData.sav"), V("rb")); -// if (file) -// { -// fseek(file, 0, SEEK_END); -// int fsize = ftell(file); -// if (fsize == 0x100) -// { -// fseek(file, 0, SEEK_SET); -// fread(saveData, fsize, 1, file); -// uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0); -// uintptr_t value = *(uintptr_t*)(imageBase + 0x1948F10); -// value += 0x2698; -// memcpy((void *)value, saveData, 0x48); -// } -// fclose(file); -// } -// return 1; -//} -// -//static int LoadOtherHonorData() -//{ -// memset(saveData, 0x0, 0x1000); -// FILE* file = fopen(V("OtherHonorData.sav"), V("rb")); -// if (file) -// { -// fseek(file, 0, SEEK_END); -// int fsize = ftell(file); -// if (fsize == 0x100) -// { -// fseek(file, 0, SEEK_SET); -// fread(saveData, fsize, 1, file); -// uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0); -// uintptr_t value = *(uintptr_t*)(imageBase + 0x1948F10); -// value += 0x2A90; -// memcpy((void *)value, saveData, 0x60); -// } -// fclose(file); -// } -// return 1; -//} -// -//static int LoadStoryModeNoLoseHonorData() -//{ -// memset(saveData, 0x0, 0x1000); -// FILE* file = fopen(V("StoryModeNoLoseHonorData.sav"), V("rb")); -// if (file) -// { -// fseek(file, 0, SEEK_END); -// int fsize = ftell(file); -// if (fsize == 0x100) -// { -// fseek(file, 0, SEEK_SET); -// fread(saveData, fsize, 1, file); -// uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0); -// uintptr_t value = *(uintptr_t*)(imageBase + 0x1948F10); -// value += 0x2C80; -// //memcpy((void *)value, saveData, 0x10); -// value += 0x18; -// memcpy((void *)value, saveData, 0x28); -// } -// fclose(file); -// } -// return 1; -//} -// -//static int LoadCampaingHonorData() -//{ -// memset(saveData, 0x0, 0x1000); -// FILE* file = fopen(V("campaing.sav"), V("rb")); -// if (file) -// { -// fseek(file, 0, SEEK_END); -// int fsize = ftell(file); -// if (fsize == 0x100) -// { -// fseek(file, 0, SEEK_SET); -// fread(saveData, fsize, 1, file); -// uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0); -// uintptr_t value = *(uintptr_t*)(imageBase + 0x1948F10); -// value += 0x24E0; -// memcpy((void *)value, saveData, 0xB8); -// } -// fclose(file); -// } -// return 1; -//} -// -//static int LoadStoryData() -//{ -// memset(saveData, 0x0, 0x1000); -// FILE* file = fopen(V("story.sav"), V("rb")); -// if (file) -// { -// fseek(file, 0, SEEK_END); -// int fsize = ftell(file); -// if (fsize == 0x100) -// { -// fseek(file, 0, SEEK_SET); -// fread(saveData, fsize, 1, file); -// uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0); -// uintptr_t value = *(uintptr_t*)(imageBase + 0x1948F10); -// value += 0x25F0; -// memcpy((void *)value, saveData, 0x98); -// } -// fclose(file); -// } -// return 1; -//} - -static int saveStoryData(char* filepath) -{ - // Miles path string - char storyPath[0xFF]; - - // Set the milepath memory to zero - memset(storyPath, 0, 0xFF); - - // Copy the file path to the miles path - strcpy(storyPath, filepath); - - // Append the mileage filename to the string - strcat(storyPath, "\\openprogress.sav"); - - // Save story data - - // Address where player save data starts - uintptr_t saveDataBase = *(uintptr_t*)(imageBasedxplus + 0x1F7D578); - - // Zero out save data binary - memset(saveDatadxp, 0, 0x2000); - - // Address where the player story data starts - uintptr_t storySaveBase = *(uintptr_t*)(saveDataBase + 0x108); - - // Copy to saveDatadxp from the story save data index - memcpy(saveDatadxp, (void*)storySaveBase, 0x340); - - // Dump the save data to openprogress.sav - writeDump(storyPath, saveDatadxp, 0x2000); - - // Success - return 1; -} - -static int loadMileData(char* filepath) -{ - // Zero out the mile data memory - memset(mileDatadxp, 0, 0x08); - - // Miles path string - char milepath[0xFF]; - - // Set the milepath memory to zero - memset(milepath, 0, 0xFF); - - // Copy the file path to the miles path - strcpy(milepath, filepath); - - // Append the mileage filename to the string - strcat(milepath, "\\mileage.dat"); - - // Path to the miles file - FILE* miles = fopen(milepath, "rb"); - - // File loaded OK - if (miles) - { - // Get the size of the file - fseek(miles, 0, SEEK_END); - int mileSize = ftell(miles); - - // If the file size is correct - if (mileSize == 0x08) - { - // Load the content from the file into mileDatadxp - fseek(miles, 0, SEEK_SET); - fread(mileDatadxp, mileSize, 1, miles); - - // Get the pointer to the memory location storing the miles - uintptr_t mileMemory = *(uintptr_t*)(imageBasedxplus + 0x1F7D578); - - // Copy the mile data from the file into the memory location - memcpy((void*)(mileMemory + 0x280), mileDatadxp + 0x00, 0x04); - - fclose(miles); - } - } - - // Success - return 1; -} - -static int saveMileData(char* filepath) -{ - // Get the pointer to the memory location storing the miles - auto mileageLocation = (uintptr_t*)(*(uintptr_t*)(imageBasedxplus + 0x1F7D578) + 0x280); - - // Miles path string - char milepath[0xFF]; - - // Set the milepath memory to zero - memset(milepath, 0, 0xFF); - - // Copy the file path to the miles path - strcpy(milepath, filepath); - - // Append the mileage filename to the string - strcat(milepath, "\\mileage.dat"); - - // Load the miles file - FILE* tempFile = fopen(milepath, "wb"); - - // Write the miles data from memory to the miles file - fwrite(mileageLocation, 1, sizeof(mileageLocation), tempFile); - - fclose(tempFile); - - // Success - return 1; -} - -// Credits to chery vtec tuning club for figuring out star loading / saving -static int saveStarData(char* filepath) -{ - // Star path saving - char starPath[0xFF]; - - // Set the storyPath memory to zero - memset(starPath, 0, 0xFF); - - // Copy the file path to the stars path - strcpy(starPath, filepath); - - // Append the mileage filename to the string - strcat(starPath, "\\stars.bin"); - - // Clear star data memory - memset(starDataDxp, 0, 0x40); - - // Save Star Data - - // Dereference the star pointer - uintptr_t starBase = *(uintptr_t*)((*(uintptr_t*)(imageBasedxplus + 0x1F7D578)) + 0x110); - - // Dumps first 2 bytes from star pointer - memcpy(starDataDxp + 0x00, (void*)(starBase + 0x248), 0x2); - - // Dumps medal offsets from star pointer, 16 bytes - memcpy(starDataDxp + 0x04, (void*)(starBase + 0x254), 0x10); - - // Dump the contents of the star data array to the file - writeDump(starPath, starDataDxp, sizeof(starDataDxp)); - - // Success - return 1; -} - -static int loadStarData(char* filepath) -{ - // Star path loading - char starPath[0xFF]; - - // Set the storyPath memory to zero - memset(starPath, 0, 0xFF); - - // Copy the file path to the stars path - strcpy(starPath, filepath); - - // Append the mileage filename to the string - strcat(starPath, "\\stars.bin"); - - // Clear star data memory - memset(starDataDxp, 0, 0x40); - - // Open the star binary file - FILE* starFile = fopen(starPath, "rb"); - - // saveStarData(".\\preloadstars"); - writeLog(logfileDxp, "Loading stars ...\n"); - - // If the file opened successfully - if (starFile) - { - // saveStarData(".\\preloadstars"); - writeLog(logfileDxp, "success.\n"); - - // If the file size is correct - fseek(starFile, 0, SEEK_END); - int starSize = ftell(starFile); - if (starSize == 0x40) - { - // Reset the file pointer to the start - fseek(starFile, 0, SEEK_SET); - - // Read all of the contents into the array - fread(starDataDxp, starSize, 1, starFile); - - // Dereference the star pointer in the game memory - uintptr_t starBase = *(uintptr_t*)((*(uintptr_t*)(imageBasedxplus + 0x1F7D578)) + 0x110); - - // Dumps first 2 bytes from star pointer - memcpy((void*)(starBase + 0x248), starDataDxp + 0x00, 0x2); - - // Dumps medal offsets from star pointer, 16 bytes - memcpy((void*)(starBase + 0x254), starDataDxp + 0x04, 0x10); - - // Close the stars file - fclose(starFile); - } - } - - // saveStarData(".\\postloadstars"); - - // Delay another ten seconds - // std::this_thread::sleep_for(std::chrono::seconds(10)); - - // saveStarData(".\\delayloadstars"); - - // Success - return 1; -} - -static int loadGameData() -{ - // Disable saving - saveOk = false; - - // Miles path string - char loadPath[0xFF]; - - // Set the milepath memory to zero - memset(loadPath, 0, 0xFF); - - // Wirte the '.' into the load path - // sprintf(loadPath, ".\\SaveData"); - sprintf(loadPath, "."); - - // Seperate save file / cars per user profile - if (ToBool(config["Save"]["Save Per Custom Name"])) - { - // Get the profile name from the - std::string name = config["General"]["CustomName"]; - - // Add the c string version of the profile name to the path - sprintf(loadPath, "%s\\%s", loadPath, name.c_str()); - } - - // Seperate miles / story per car - if (ToBool(config["Save"]["Save Per Car"])) - { - // Need to get the hex code for the selected car - - // Address where player save data starts - uintptr_t saveDataBase = *(uintptr_t*)(imageBasedxplus + 0x1F7D578); - - // Address where the car save data starts - uintptr_t carSaveBase = *(uintptr_t*)(saveDataBase + 0x268); - - // If custom car is set - if (customCarDxp) - { - // Add the car id to the save path - sprintf(loadPath, "%s\\custom", loadPath); - } - else // Custom car is not set - { - // Add the custom folder to the save path - sprintf(loadPath, "%s\\%08X", loadPath, *(DWORD*)(*(uintptr_t*)(*(uintptr_t*)(imageBasedxplus + 0x1F7D578) + 0x268) + 0x34)); - } - } - - // Ensure the directory exists - std::filesystem::create_directories(loadPath); - - // Sleep for 1 second - std::this_thread::sleep_for(std::chrono::seconds(1)); - - // Load the car save file - loadCarData(loadPath); - - // Load the openprogress.sav file - loadStoryData(loadPath); - - // Load the miles save file - loadMileData(loadPath); - - // Sleep for 14 seconds - std::this_thread::sleep_for(std::chrono::seconds(14)); - - // Load the stars save file - loadStarData(loadPath); - - // Success - return 1; -} - - - -// SaveGameData(void): Int -// If saving is enabled, loads the -// player story data -static int SaveGameData() -{ - // Saving is disabled - if (!saveOk) - return 1; - - // Miles path string - char savePath[0xFF]; - - // Set the milepath memory to zero - memset(savePath, 0, 0xFF); - - // Wirte the '.' into the load path - // sprintf(savePath, ".\\SaveData"); - sprintf(savePath, "."); - - // Seperate save file / cars per user profile - if (ToBool(config["Save"]["Save Per Custom Name"])) - { - // Get the profile name from the - std::string name = config["General"]["CustomName"]; - - // Add the c string version of the profile name to the path - sprintf(savePath, "%s\\%s", savePath, name.c_str()); - } - - // Seperate miles / story per car - if (ToBool(config["Save"]["Save Per Car"])) - { - // Need to get the hex code for the selected car - - // Address where player save data starts - uintptr_t saveDataBase = *(uintptr_t*)(imageBasedxplus + 0x1F7D578); - - // Address where the car save data starts - uintptr_t carSaveBase = *(uintptr_t*)(saveDataBase + 0x268); - - // If custom car is set - if (customCarDxp) - { - // Add the car id to the save path - sprintf(savePath, "%s\\custom", savePath); - } - else // Custom car is not set - { - // Add the custom folder to the save path - sprintf(savePath, "%s\\%08X", savePath, *(DWORD*)(*(uintptr_t*)(*(uintptr_t*)(imageBasedxplus + 0x1F7D578) + 0x268) + 0x34)); - } - } - - // Ensure the directory exists - std::filesystem::create_directories(savePath); - - // Load the car save file - saveCarData(savePath); - - // Load the openprogress.sav file - saveStoryData(savePath); - - // Load the miles save file - saveMileData(savePath); - - // Load the miles save file - saveStarData(savePath); - - // Disable saving - saveOk = false; - - // Success - return 1; -} - -static void loadGame() -{ - // Runs after car data is loaded - - // Load story data thread - std::thread t1(loadGameData); - t1.detach(); -} static int ReturnTrue() { @@ -1526,19 +189,80 @@ void GenerateDongleDataDxp(bool isTerminal) } -char customNamedxp[256]; +static HWND mt6Hwnd; + +typedef BOOL(WINAPI* ShowWindow_t)(HWND, int); +static ShowWindow_t pShowWindow; -static DWORD WINAPI SpamcustomNamedxp(LPVOID) +// Hello Win32 my old friend... +typedef LRESULT(WINAPI* WindowProcedure_t)(HWND, UINT, WPARAM, LPARAM); +static WindowProcedure_t pMaxituneWndProc; + +static BOOL gotWindowSize = FALSE; +static unsigned displaySizeX = 0; +static unsigned displaySizeY = 0; +static float scaleFactorX = 0.0f; +static float scaleFactorY = 0.0f; + +static LRESULT Hook_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - while (true) + if (!gotWindowSize) { - - Sleep(50); - void *value = (void *)(imageBasedxplus + 0x1F846F0); - memcpy(value, customNamedxp, strlen(customNamedxp) + 1); - + displaySizeX = GetSystemMetrics(SM_CXSCREEN); + displaySizeY = GetSystemMetrics(SM_CYSCREEN); + scaleFactorX = static_cast(displaySizeX) / 1360.0f; + scaleFactorY = static_cast(displaySizeY) / 768.0f; + printf("display is %dx%d (scale factor of %f, %f)\n", displaySizeX, displaySizeY, scaleFactorX, scaleFactorY); + gotWindowSize = TRUE; } + + if (msg == WM_LBUTTONDOWN || + msg == WM_LBUTTONUP) + { + unsigned short mx = GET_X_LPARAM(lParam); + unsigned short my = GET_Y_LPARAM(lParam); + + //unsigned short trueMy = 768 - my; + + float scaledMx = static_cast(mx) / 1360.f; + float scaledMy = static_cast(my) / 768.f; + + scaledMy = 1.0f - scaledMy; + + scaledMx *= scaleFactorX; + scaledMy *= scaleFactorY; + + unsigned short trueMx = static_cast(scaledMx * 16383.0f); + unsigned short trueMy = static_cast(scaledMy * 16383.0f); + trueMy += 9500; // Cheap hack, todo do the math better!! + + //mx *= (16383 / 1360); + //trueMy *= (16383 / 1360); + + printf("%d %d\n", trueMx, trueMy); + mt6SetTouchParams(trueMx, trueMy, msg == WM_LBUTTONDOWN); + + printf("MOUSE %s (%d, %d)\n", msg == WM_LBUTTONDOWN ? "DOWN" : "UP ", mx, my); + return 0; + } + + return pMaxituneWndProc(hwnd, msg, wParam, lParam); +} + +static BOOL Hook_ShowWindow(HWND hwnd, int nCmdShow) +{ + SetWindowLongPtrW(hwnd, -4, (LONG_PTR)Hook_WndProc); + ShowCursor(1); + + mt6Hwnd = hwnd; + return pShowWindow(hwnd, nCmdShow); +} + +typedef void (WINAPI* OutputDebugStringA_t)(LPCSTR); +static void Hook_OutputDebugStringA(LPCSTR str) +{ + printf("debug> %s", str); } static DWORD WINAPI SpamMulticast(LPVOID) @@ -1561,7 +285,7 @@ static DWORD WINAPI SpamMulticast(LPVOID) bindAddr.sin_addr.s_addr = inet_addr(ipaddrdxplus); bindAddr.sin_port = htons(50765); bind(sock, (sockaddr*)&bindAddr, sizeof(bindAddr)); - + ip_mreq mreq; mreq.imr_multiaddr.s_addr = inet_addr("225.0.0.1"); @@ -1569,139 +293,32 @@ static DWORD WINAPI SpamMulticast(LPVOID) setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char*)&mreq, sizeof(mreq)); - const uint8_t* byteSequences_Free[] = { - dxpterminalPackage1_Free, - dxpterminalPackage2_Free, - dxpterminalPackage3_Free, - dxpterminalPackage4_Free, - dxpterminalPackage5_Free, - dxpterminalPackage6_Free, - }; - - const size_t byteSizes_Free[] = { - sizeof(dxpterminalPackage1_Free), - sizeof(dxpterminalPackage2_Free), - sizeof(dxpterminalPackage3_Free), - sizeof(dxpterminalPackage4_Free), - sizeof(dxpterminalPackage5_Free), - sizeof(dxpterminalPackage6_Free), - }; - - const uint8_t* byteSequences_Event2P[] = { - dxpterminalPackage1_Event2P, - dxpterminalPackage2_Event2P, - dxpterminalPackage3_Event2P, - dxpterminalPackage4_Event2P, - dxpterminalPackage5_Event2P, - dxpterminalPackage6_Event2P, - }; - - const size_t byteSizes_Event2P[] = { - sizeof(dxpterminalPackage1_Event2P), - sizeof(dxpterminalPackage2_Event2P), - sizeof(dxpterminalPackage3_Event2P), - sizeof(dxpterminalPackage4_Event2P), - sizeof(dxpterminalPackage5_Event2P), - sizeof(dxpterminalPackage6_Event2P), - }; - - const uint8_t* byteSequences_Event4P[] = { - dxpterminalPackage1_Event4P, - dxpterminalPackage2_Event4P, - dxpterminalPackage3_Event4P, - dxpterminalPackage4_Event4P, - dxpterminalPackage5_Event4P, - dxpterminalPackage6_Event4P, - }; - - const size_t byteSizes_Event4P[] = { - sizeof(dxpterminalPackage1_Event4P), - sizeof(dxpterminalPackage2_Event4P), - sizeof(dxpterminalPackage3_Event4P), - sizeof(dxpterminalPackage4_Event4P), - sizeof(dxpterminalPackage5_Event4P), - sizeof(dxpterminalPackage6_Event4P), - }; - - const uint8_t* byteSequences_Coin[] = { - dxpterminalPackage1_Coin, - dxpterminalPackage2_Coin, - dxpterminalPackage3_Coin, - dxpterminalPackage4_Coin, - dxpterminalPackage5_Coin, - dxpterminalPackage6_Coin, - }; - - const size_t byteSizes_Coin[] = { - sizeof(dxpterminalPackage1_Coin), - sizeof(dxpterminalPackage2_Coin), - sizeof(dxpterminalPackage3_Coin), - sizeof(dxpterminalPackage4_Coin), - sizeof(dxpterminalPackage5_Coin), - sizeof(dxpterminalPackage6_Coin), - }; - sockaddr_in toAddr = { 0 }; toAddr.sin_family = AF_INET; toAddr.sin_addr.s_addr = inet_addr("225.0.0.1"); toAddr.sin_port = htons(50765); - - - isFreePlay = ToBool(config["General"]["FreePlay"]); - isEventMode2P = ToBool(config["TerminalEmuConfig"]["2P Event Mode"]); - isEventMode4P = ToBool(config["TerminalEmuConfig"]["4P Event Mode"]); - - - if (isFreePlay) - { - if (isEventMode2P) { - while (true) for (int i = 0; i < _countof(byteSequences_Event2P); i++) - { - sendto(sock, (const char*)byteSequences_Event2P[i], byteSizes_Event2P[i], 0, (sockaddr*)&toAddr, sizeof(toAddr)); - Sleep(8); - } - } - else if (isEventMode4P) { - while (true) for (int i = 0; i < _countof(byteSequences_Event4P); i++) - { - sendto(sock, (const char*)byteSequences_Event4P[i], byteSizes_Event4P[i], 0, (sockaddr*)&toAddr, sizeof(toAddr)); - Sleep(8); - } - } - else { - while (true) for (int i = 0; i < _countof(byteSequences_Free); i++) - { - sendto(sock, (const char*)byteSequences_Free[i], byteSizes_Free[i], 0, (sockaddr*)&toAddr, sizeof(toAddr)); - Sleep(8); - } - } - } - - while (true) for (int i = 0; i < _countof(byteSequences_Coin); i++) - { - sendto(sock, (const char*)byteSequences_Coin[i], byteSizes_Coin[i], 0, (sockaddr*)&toAddr, sizeof(toAddr)); - Sleep(8); - } + return true; } -/* -extern int* ffbOffset; -extern int* ffbOffset2; -extern int* ffbOffset3; -extern int* ffbOffset4; -DWORD WINAPI Wmmt5FfbCollector(void* ctx) -{ - uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0); - while (true) - { - *ffbOffset = *(DWORD *)(imageBase + 0x196F188); - *ffbOffset2 = *(DWORD *)(imageBase + 0x196F18c); - *ffbOffset3 = *(DWORD *)(imageBase + 0x196F190); - *ffbOffset4 = *(DWORD *)(imageBase + 0x196F194); - Sleep(10); +typedef int (WINAPI* BINDw5p)(SOCKET, CONST SOCKADDR*, INT); +static BINDw5p pbindw5p = NULL; +unsigned int WINAPI Hook_bind_w5p(SOCKET s, const sockaddr* addr, int namelen) { + sockaddr_in bindAddr = { 0 }; + bindAddr.sin_family = AF_INET; + bindAddr.sin_addr.s_addr = inet_addr("192.168.96.20"); + bindAddr.sin_port = htons(50765); + if (addr == (sockaddr*)&bindAddr) { + sockaddr_in bindAddr2 = { 0 }; + bindAddr2.sin_family = AF_INET; + bindAddr2.sin_addr.s_addr = inet_addr(ipaddrdxplus); + bindAddr2.sin_port = htons(50765); + return pbindw5p(s, (sockaddr*)&bindAddr2, namelen); } -}*/ + else { + return pbindw5p(s, addr, namelen); + } +} // Wmmt5Func([]()): InitFunction // Performs the initial startup tasks for @@ -1709,30 +326,31 @@ DWORD WINAPI Wmmt5FfbCollector(void* ctx) // of required subprocesses. static InitFunction Wmmt5Func([]() { - /* - FILE* fileF = _wfopen(L"Fsetting.lua.gz", L"r"); - if (fileF == NULL) + // Alloc debug console + FreeConsole(); + AllocConsole(); + SetConsoleTitle(L"Maxitune5DX+ Console"); + + FILE* pNewStdout = nullptr; + FILE* pNewStderr = nullptr; + FILE* pNewStdin = nullptr; + + ::freopen_s(&pNewStdout, "CONOUT$", "w", stdout); + ::freopen_s(&pNewStderr, "CONOUT$", "w", stderr); + ::freopen_s(&pNewStdin, "CONIN$", "r", stdin); + std::cout.clear(); + std::cerr.clear(); + std::cin.clear(); + std::wcout.clear(); + std::wcerr.clear(); + std::wcin.clear(); + + puts("hello there, maxitune"); + + if (ToBool(config["Update5"]["Enable Update5"])) { - FILE* settingsF = _wfopen(L"Fsetting.lua.gz", L"wb"); - fwrite(settingData, 1, sizeof(settingData), settingsF); - fclose(settingsF); + isUpdate5 = true; } - else - { - fclose(fileF); - } - FILE* fileG = _wfopen(L"Gsetting.lua.gz", L"r"); - if (fileG == NULL) - { - FILE* settingsG = _wfopen(L"Gsetting.lua.gz", L"wb"); - fwrite(settingData, 1, sizeof(settingData), settingsG); - fclose(settingsG); - } - else - { - fclose(fileG); - } - */ // Records if terminal mode is enabled bool isTerminal = false; @@ -1767,56 +385,41 @@ static InitFunction Wmmt5Func([]() MH_CreateHookApi(L"hasp_windows_x64_106482.dll", "hasp_encrypt", dxpHook_hasp_encrypt, NULL); MH_CreateHookApi(L"hasp_windows_x64_106482.dll", "hasp_logout", dxpHook_hasp_logout, NULL); MH_CreateHookApi(L"hasp_windows_x64_106482.dll", "hasp_login", dxpHook_hasp_login, NULL); + MH_CreateHookApi(L"WS2_32", "bind", Hook_bind_w5p, reinterpret_cast(&pbindw5p)); - GenerateDongleDataDxp(isTerminal); + MH_CreateHookApi(L"kernel32", "OutputDebugStringA", Hook_OutputDebugStringA, NULL); + + // Give me the HWND please maxitune + MH_CreateHookApi(L"user32", "ShowWindow", Hook_ShowWindow, reinterpret_cast(&pShowWindow)); + //pMaxituneWndProc = (WindowProcedure_t)(imageBasedxplus + 0xB78B90); + pMaxituneWndProc = (WindowProcedure_t)(hook::get_pattern("48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 48 83 EC 30 8B EA BA EB FF FF FF 49 8B F9 49 8B F0 48 8B D9 FF 15 ? ? ? 00 48 85 C0 74 1D 4C", 0)); + + //load banapass emu + if (!isUpdate5) + { + LoadLibraryA(".\\openBanaW5p.dll"); + } + else + { + LoadLibraryA(".\\openBanaW5p5.dll"); + } // Prevents game from setting time, thanks pockywitch! MH_CreateHookApi(L"KERNEL32", "SetSystemTime", Hook_SetSystemTime, reinterpret_cast(&pSetSystemTime)); - // Patch some check TEMP DISABLE AS WELL OVER HERE - // 0F 94 C0 84 C0 0F 94 C0 84 C0 75 05 45 32 E4 EB 03 41 B4 01 - // FOUND ON 21, 10 - // NOT WORKING 1 - // 0F 94 C0 84 C0 0F 94 C0 84 C0 75 05 45 32 ?? EB - // FOUND ON 1 - //injector::WriteMemory(imageBase + 0x6286EC, 0, true); - injector::WriteMemory(hook::get_pattern("85 C9 0F 94 C0 84 C0 0F 94 C0 84 C0 75 ? 40 32 F6 EB ?", 0x15), 0, true); //patches out dongle error2 (doomer) + GenerateDongleDataDxp(isTerminal); - // Patch some jnz - // 83 C0 FD 83 F8 01 0F 87 B4 00 00 00 83 BF D0 06 00 00 3C 73 29 48 8D 8D 60 06 00 00 - // FOUND ON 21, 10 - // NOT FOUND: 1 - // 83 C0 FD 83 F8 01 0F 87 B4 00 00 00 - // FOUND ON 1 - //injector::MakeNOP(imageBase + 0x628AE0, 6); - //THIS injector::MakeNOP(hook::get_pattern("83 C0 FD 83 F8 01 0F 87 B4 00 00 00", 6), 6); + injector::WriteMemory(hook::get_pattern("85 C9 0F 94 C0 84 C0 0F 94 C0 84 C0 75 ? 40 32 F6 EB ?", 0x15), 0, true); //patches out dongle error2 (doomer) injector::MakeNOP(hook::get_pattern("83 C0 FD 83 F8 01 76 ? 49 8D ? ? ? ? 00 00"), 6); - // Patch some shit - // 83 FA 04 0F 8C 1E 01 00 00 4C 89 44 24 18 4C 89 4C 24 20 - // FOUND ON 21, 10, 1 - // NOT FOUND: - //injector::WriteMemory(imageBase + 0x7B9882, 0, true); - //THIS injector::WriteMemory(hook::get_pattern("83 FA 04 0F 8C 1E 01 00 00 4C 89 44 24 18 4C 89 4C 24 20", 2), 0, true); - - // Skip weird camera init that stucks entire pc on certain brands. TESTED ONLY ON 05!!!! if (ToBool(config["General"]["WhiteScreenFix"])) { injector::WriteMemory(hook::get_pattern("48 8B C4 55 57 41 54 41 55 41 56 48 8D 68 A1 48 81 EC 90 00 00 00 48 C7 45 D7 FE FF FF FF 48 89 58 08 48 89 70 18 45 33 F6 4C 89 75 DF 33 C0 48 89 45 E7", 0), 0x90C3C032, true); } - // Patch some call - // 45 33 C0 BA 65 09 00 00 48 8D 4D B0 E8 ?? ?? ?? ?? 48 8B 08 - // FOUND ON 21, 10, 1 - { - // 199AE18 TIME OFFSET RVA temp disable ALL JNZ PATCH - auto location = hook::get_pattern("41 3B C7 74 0E 48 8D 8F B8 00 00 00 BA F6 01 00 00 EB 6E 48 8D 8F A0 00 00 00"); - // Patch some jnz - // 41 3B C7 74 0E 48 8D 8F B8 00 00 00 BA F6 01 00 00 EB 6E 48 8D 8F A0 00 00 00 - // FOUND ON 21, 10, 1 injector::WriteMemory(location + 3, 0xEB, true); //patches content router (doomer) // Skip some jnz @@ -1829,48 +432,15 @@ static InitFunction Wmmt5Func([]() // Terminal mode is off if (!isTerminal) { - // Disregard terminal scanner stuff. - // 48 8B 18 48 3B D8 0F 84 88 00 00 00 39 7B 1C 74 60 80 7B 31 00 75 4F 48 8B 43 10 80 78 31 00 - // FOUND ON 21, 10, 1 - //injector::MakeNOP(imageBase + 0x91E1AE, 6); - //injector::MakeNOP(imageBase + 0x91E1B7, 2); - //injector::MakeNOP(imageBase + 0x91E1BD, 2); + injector::MakeNOP(hook::get_pattern("74 ? 80 7B 31 00 75 ? 48 8B 43 10 80 78 31 00 75 1A 48 8B D8 48 8B 00 80 78 31 00 75 ? 48 8B D8"), 2); //terminal on same machine patch - /* - auto location = hook::get_pattern("48 8B 18 48 3B D8 0F 84 8B 00 00 00 0F 1F 80 00 00 00 00 39 73 1C 74 5C 80 7B 31 00"); - // injector::MakeNOP(location + 6, 6); // 6 - injector::MakeNOP(location + 0xF, 2); // 0xF - // injector::MakeNOP(location + 0x15, 2); // 0x15 - */ - - injector::MakeNOP(imageBasedxplus + 0x9F2BB3, 2); - - // If terminal emulator is enabled - if (ToBool(config["General"]["TerminalEmulator"])) - { - // Start the multicast spam thread - CreateThread(0, 0, SpamMulticast, 0, 0, 0); - } } - /* else - { - // Patch some func to 1 - // - // FOUND ON 21, 10, 1 - // NOT FOUND: - //safeJMP(imageBase + 0x7BE440, ReturnTrue); - //safeJMP(hook::get_pattern("0F B6 41 05 2C 30 3C 09 77 04 0F BE C0 C3 83 C8 FF C3"), ReturnTrue); - //safeJMP(imageBase + 0x89D420, ReturnTrue); - - // Patch some func to 1 - // 40 53 48 83 EC 20 48 83 39 00 48 8B D9 75 28 48 8D ?? ?? ?? ?? 00 48 8D ?? ?? ?? ?? 00 41 B8 ?? ?? 00 00 FF 15 ?? ?? ?? ?? 4C 8B 1B 41 0F B6 43 78 - // FOUND ON 21, 10, 1 - //safeJMP(imageBase + 0x7CF8D0, ReturnTrue); - //safeJMP(hook::get_pattern("40 53 48 83 EC 20 48 83 39 00 48 8B D9 75 11 48 8B 0D C2"), ReturnTrue); - //safeJMP(imageBase + 0x8B5190, ReturnTrue); + { //terminal mode patches + safeJMP(hook::get_pattern("0F B6 41 05 2C 30 3C 09 77 04 0F BE C0 C3 83 C8 FF C3"), ReturnTrue); + safeJMP(hook::get_pattern("8B 01 0F B6 40 78 C3 CC CC CC CC"), ReturnTrue); } - */ + auto chars = { 'F', 'G' }; @@ -1895,88 +465,21 @@ static InitFunction Wmmt5Func([]() } } - // Get the custom name specified in the config file - std::string value = config["General"]["CustomName"]; - - // If a custom name is set - if (!value.empty()) + if (!isUpdate5) { - // Zero out the custom name variable - memset(customNamedxp, 0, 256); - - // Copy the custom name to the custom name block - strcpy(customNamedxp, value.c_str()); - - // Create the spam custom name thread - CreateThread(0, 0, SpamcustomNamedxp, 0, 0, 0); - } - - // Save story stuff (only 05) - { - // Skip erasing of temp card data - // injector::WriteMemory(imageBase + 0xA35CA3, 0xEB, true); - - /* - // Skip erasing of temp card - safeJMP(imageBase + 0x54DCE1, LoadGameData); - safeJMP(imageBase + 0x5612F0, ReturnTrue); - safeJMP(imageBase + 0x5753C0, ReturnTrue); - safeJMP(imageBase + 0x57DF10, ReturnTrue); - safeJMP(imageBase + 0x92DB20, ReturnTrue); - safeJMP(imageBase + 0x5628C0, ReturnTrue); - safeJMP(imageBase + 0x579090, ReturnTrue); - - // Skip more - safeJMP(imageBase + 0x54B0F0, ReturnTrue); - safeJMP(imageBase + 0x909DB0, ReturnTrue); - safeJMP(imageBase + 0x59FD90, ReturnTrue); - safeJMP(imageBase + 0x5A0030, ReturnTrue); - safeJMP(imageBase + 0x915370, ReturnTrue); - safeJMP(imageBase + 0x5507A0, ReturnTrue); - safeJMP(imageBase + 0x561290, ReturnTrue); - safeJMP(imageBase + 0x5A0AE8, LoadWmmt5CarData); - - // crash fix - //safeJMP(imageBase + 0xAD6F28, WmmtOperatorDelete); - //safeJMP(imageBase + 0xAD6F4C, WmmtMemset); - - // Save progress trigger - injector::WriteMemory(imageBase + 0x556CE3, 0xB848, true); - injector::WriteMemory(imageBase + 0x556CE3 + 2, (uintptr_t)SaveOk, true); - injector::WriteMemory(imageBase + 0x556CED, 0x9090D0FF, true); - - // Try save later! - injector::MakeNOP(imageBase + 0x308546, 0x12); - injector::WriteMemory(imageBase + 0x308546, 0xB848, true); - injector::WriteMemory(imageBase + 0x308546 + 2, (uintptr_t)SaveGameData, true); - injector::WriteMemory(imageBase + 0x308550, 0x3348D0FF, true); - injector::WriteMemory(imageBase + 0x308550 + 4, 0x90C0, true); - CreateThread(0, 0, Wmmt5FfbCollector, 0, 0, 0); - */ - // Enable all print injector::MakeNOP(imageBasedxplus + 0x898BD3, 6); - // Load car and story data at once - safeJMP(imageBasedxplus + 0x72AB90, loadGame); + //Fix crash when saving story mode and Time attack + injector::MakeNOP(imageBasedxplus + 0xE90C7, 5); + } + else + { + // Enable all print + injector::MakeNOP(imageBasedxplus + 0x8F15A3, 6); - // Save car trigger - // injector::WriteMemory(imageBase + 0x376F80 + 2, (uintptr_t)SaveGameData, true); - // safeJMP(imageBase + 0x376F76, SaveGameData); - - // Save car trigger - injector::MakeNOP(imageBasedxplus + 0x376F76, 0x12); - injector::WriteMemory(imageBasedxplus + 0x376F76, 0xB848, true); - injector::WriteMemory(imageBasedxplus + 0x376F76 + 2, (uintptr_t)SaveGameData, true); - injector::WriteMemory(imageBasedxplus + 0x376F80, 0x3348D0FF, true); - injector::WriteMemory(imageBasedxplus + 0x376F80 + 4, 0x90C0, true); - - // Prevents startup saving - // injector::MakeNOP(imageBase + 0x6B908C, 0x0D); - // safeJMP(imageBase + 0x6B908C, SaveOk); - injector::WriteMemory(imageBasedxplus + 0x6B909A, 0xB848, true); - injector::WriteMemory(imageBasedxplus + 0x6B909A + 2, (uintptr_t)SaveOk, true); - injector::WriteMemory(imageBasedxplus + 0x6B90A4, 0x9090D0FF, true); + //Fix crash when saving story mode and Time attack + injector::MakeNOP(imageBasedxplus + 0xE8DE7, 5); } MH_EnableHook(MH_ALL_HOOKS); diff --git a/OpenParrot/src/Functions/Games/ES3X/WMMT6.cpp b/OpenParrot/src/Functions/Games/ES3X/WMMT6.cpp index 72e9a9c..8cdf4bd 100644 --- a/OpenParrot/src/Functions/Games/ES3X/WMMT6.cpp +++ b/OpenParrot/src/Functions/Games/ES3X/WMMT6.cpp @@ -22,13 +22,6 @@ static bool ForceNeon; static bool CarTuneNeonThread; static const char* ipaddr; -static LPSTR terminalIP; -static LPSTR routerIP; -static LPSTR cab1IP; -static LPSTR cab2IP; -static LPSTR cab3IP; -static LPSTR cab4IP; - static DWORD mileageValue = 0; static int NeonColour; @@ -89,16 +82,12 @@ static unsigned int WINAPI Hook_bind(SOCKET s, const sockaddr* addr, int namelen bindAddr.sin_family = AF_INET; bindAddr.sin_addr.s_addr = inet_addr("192.168.96.20"); bindAddr.sin_port = htons(50765); - if (addr == (sockaddr*)& bindAddr) { - // terminal proxy - // redirect this to localhost - - auto localhost = inet_addr(terminalIP); + if (addr == (sockaddr*)&bindAddr) { sockaddr_in bindAddr2 = { 0 }; bindAddr2.sin_family = AF_INET; - bindAddr2.sin_addr.s_addr = localhost; + bindAddr2.sin_addr.s_addr = inet_addr(ipaddr); bindAddr2.sin_port = htons(50765); - return pbind(s, (sockaddr*)& bindAddr2, namelen); + return pbind(s, (sockaddr*)&bindAddr2, namelen); } else { return pbind(s, addr, namelen); @@ -219,127 +208,6 @@ extern int* ffbOffset2; extern int* ffbOffset3; extern int* ffbOffset4; -typedef INT (WSAAPI* WsaStringToAddressA_t)(LPSTR, INT, LPWSAPROTOCOL_INFOA, LPSOCKADDR, LPINT); -static WsaStringToAddressA_t gWsaStringToAddressA; - - -//#define LOCAL_IP "192.168.100.10" -//#define ROUTER_IP "192.168.100.1" -#define LOCALHOST "127.0.0.1" - -static INT WSAAPI Hook_WsaStringToAddressA( - _In_ LPSTR AddressString, - _In_ INT AddressFamily, - _In_opt_ LPWSAPROTOCOL_INFOA lpProtocolInfo, - _Out_ LPSOCKADDR lpAddress, - _Inout_ LPINT lpAddressLength -) -{ - - - if (strcmp(AddressString, "192.168.92.254") == 0) - { - return gWsaStringToAddressA( - routerIP, - AddressFamily, - lpProtocolInfo, - lpAddress, - lpAddressLength - ); - } - - if (strcmp(AddressString, "192.168.92.253") == 0) - { - return gWsaStringToAddressA( - routerIP, - AddressFamily, - lpProtocolInfo, - lpAddress, - lpAddressLength - ); - } - - if (strcmp(AddressString, "192.168.92.11") == 0) - { - return gWsaStringToAddressA( - cab1IP, - AddressFamily, - lpProtocolInfo, - lpAddress, - lpAddressLength - ); - } - - if (strcmp(AddressString, "192.168.92.12") == 0) - { - return gWsaStringToAddressA( - cab2IP, - AddressFamily, - lpProtocolInfo, - lpAddress, - lpAddressLength - ); - } - - if (strcmp(AddressString, "192.168.92.13") == 0) - { - return gWsaStringToAddressA( - cab3IP, - AddressFamily, - lpProtocolInfo, - lpAddress, - lpAddressLength - ); - } - - if (strcmp(AddressString, "192.168.92.14") == 0) - { - return gWsaStringToAddressA( - cab4IP, - AddressFamily, - lpProtocolInfo, - lpAddress, - lpAddressLength - ); - } - - if (strcmp(AddressString, "192.168.92.20") == 0) - { - return gWsaStringToAddressA( - terminalIP, - AddressFamily, - lpProtocolInfo, - lpAddress, - lpAddressLength - ); - } - - return gWsaStringToAddressA( - AddressString, - AddressFamily, - lpProtocolInfo, - lpAddress, - lpAddressLength - ); -} - -typedef INT (WSAAPI* getaddrinfo_t)(PCSTR, PCSTR, const ADDRINFOA*, PADDRINFOA*); -static getaddrinfo_t ggetaddrinfo; - -static INT WSAAPI Hook_getaddrinfo( - _In_opt_ PCSTR pNodeName, - _In_opt_ PCSTR pServiceName, - _In_opt_ const ADDRINFOA* pHints, - _Out_ PADDRINFOA* ppResult -) -{ - if (pNodeName && strcmp(pNodeName, "192.168.92.253") == 0) - { - return ggetaddrinfo(routerIP, pServiceName, pHints, ppResult); - } - - return ggetaddrinfo(pNodeName, pServiceName, pHints, ppResult); -} static __int64(__fastcall* g_origMileageFix)(__int64); @@ -403,84 +271,6 @@ static InitFunction Wmmt6Func([]() ipaddr = networkip.c_str(); } - std::string TERMINAL_IP = config["General"]["TerminalIP"]; - if (!TERMINAL_IP.empty()) - { - char* theIp = (char*)malloc(sizeof(char)*255); - memset(theIp, 0, sizeof(char) * 255); - strcpy(theIp, TERMINAL_IP.c_str()); - terminalIP = (LPSTR)theIp; - } - else - { - terminalIP = "127.0.0.1"; - } - - std::string ROUTER_IP = config["General"]["RouterIP"]; - if (!ROUTER_IP.empty()) - { - char* theIp = (char*)malloc(sizeof(char) * 255); - memset(theIp, 0, sizeof(char) * 255); - strcpy(theIp, ROUTER_IP.c_str()); - routerIP = (LPSTR)theIp; - } - else - { - routerIP = "192.168.86.1"; - } - - std::string Cab_1_IP = config["General"]["Cab1IP"]; - if (!Cab_1_IP.empty()) - { - char* theIp = (char*)malloc(sizeof(char) * 255); - memset(theIp, 0, sizeof(char) * 255); - strcpy(theIp, Cab_1_IP.c_str()); - cab1IP = (LPSTR)theIp; - } - else - { - cab1IP = "192.168.255.255"; - } - - std::string Cab_2_IP = config["General"]["Cab2IP"]; - if (!Cab_2_IP.empty()) - { - char* theIp = (char*)malloc(sizeof(char) * 255); - memset(theIp, 0, sizeof(char) * 255); - strcpy(theIp, Cab_2_IP.c_str()); - cab2IP = (LPSTR)theIp; - } - else - { - cab2IP = "192.168.255.255"; - } - - std::string Cab_3_IP = config["General"]["Cab3IP"]; - if (!Cab_3_IP.empty()) - { - char* theIp = (char*)malloc(sizeof(char) * 255); - memset(theIp, 0, sizeof(char) * 255); - strcpy(theIp, Cab_3_IP.c_str()); - cab3IP = (LPSTR)theIp; - } - else - { - cab3IP = "192.168.255.255"; - } - - std::string Cab_4_IP = config["General"]["Cab4IP"]; - if (!Cab_4_IP.empty()) - { - char* theIp = (char*)malloc(sizeof(char) * 255); - memset(theIp, 0, sizeof(char) * 255); - strcpy(theIp, Cab_4_IP.c_str()); - cab4IP = (LPSTR)theIp; - } - else - { - cab4IP = "192.168.255.255"; - } - hookPort = "COM3"; imageBase = (uintptr_t)GetModuleHandleA(0); MH_Initialize(); @@ -499,10 +289,6 @@ static InitFunction Wmmt6Func([]() MH_CreateHookApi(L"kernel32", "OutputDebugStringA", Hook_OutputDebugStringA, NULL); // CreateFile* hooks are in the JVS FILE - // Network hooks - MH_CreateHookApi(L"Ws2_32", "WSAStringToAddressA", Hook_WsaStringToAddressA, reinterpret_cast(&gWsaStringToAddressA)); - MH_CreateHookApi(L"Ws2_32", "getaddrinfo", Hook_getaddrinfo, reinterpret_cast(&ggetaddrinfo)); - // Give me the HWND please maxitune MH_CreateHookApi(L"user32", "ShowWindow", Hook_ShowWindow, reinterpret_cast(&pShowWindow)); //MH_CreateHookApi(L"kernel32", "ReadFile", Hook_ReadFile, reinterpret_cast(&pReadFile)); @@ -523,6 +309,10 @@ static InitFunction Wmmt6Func([]() injector::WriteMemory(hook::get_pattern("48 8B C4 55 57 41 54 41 55 41 56 48 8D 68 A1 48 81 EC 90 00 00 00 48 C7 45 D7 FE FF FF FF 48 89 58 08 48 89 70 18 45 33 F6 4C 89 75 DF 33 C0 48 89 45 E7", 0), 0x90C3C032, true); } + // Best LAN setting by doomertheboomer + injector::WriteMemory(imageBase + 0xA36CAA, 0xEB, true); //content router patch + injector::MakeNOP(imageBase + 0x690876, 2, true); + // wtf is this? //injector::MakeNOP(hook::get_pattern("45 33 C0 BA 65 09 00 00 48 8D 4D B0 E8 ? ? ? ? 48 8B 08", 12), 5); diff --git a/OpenParrot/src/Functions/Games/ES3X/WMMT6R.cpp b/OpenParrot/src/Functions/Games/ES3X/WMMT6R.cpp index 38bfcfb..6dcc318 100644 --- a/OpenParrot/src/Functions/Games/ES3X/WMMT6R.cpp +++ b/OpenParrot/src/Functions/Games/ES3X/WMMT6R.cpp @@ -19,13 +19,6 @@ static bool isEventMode2P; static bool isEventMode4P; static const char* ipaddr; -static LPSTR terminalIP; -static LPSTR routerIP; -static LPSTR cab1IP; -static LPSTR cab2IP; -static LPSTR cab3IP; -static LPSTR cab4IP; - // Data for IC card, Force Feedback etc OFF. static unsigned char settingData[405] = { 0x1F, 0x8B, 0x08, 0x08, 0x53, 0x6A, 0x8B, 0x5A, 0x00, 0x00, 0x73, 0x65, @@ -274,13 +267,9 @@ static unsigned int WINAPI Hook_bind(SOCKET s, const sockaddr* addr, int namelen bindAddr.sin_addr.s_addr = inet_addr("192.168.96.20"); bindAddr.sin_port = htons(50765); if (addr == (sockaddr*)&bindAddr) { - // terminal proxy - // redirect this to localhost - - auto localhost = inet_addr(terminalIP); sockaddr_in bindAddr2 = { 0 }; bindAddr2.sin_family = AF_INET; - bindAddr2.sin_addr.s_addr = localhost; + bindAddr2.sin_addr.s_addr = inet_addr(ipaddr); bindAddr2.sin_port = htons(50765); return pbind(s, (sockaddr*)&bindAddr2, namelen); } @@ -485,381 +474,204 @@ static BOOL Hook_ShowWindow(HWND hwnd, int nCmdShow) return pShowWindow(hwnd, nCmdShow); } -typedef INT(WSAAPI* WsaStringToAddressA_t)(LPSTR, INT, LPWSAPROTOCOL_INFOA, LPSOCKADDR, LPINT); -static WsaStringToAddressA_t gWsaStringToAddressA; - -static INT WSAAPI Hook_WsaStringToAddressA( - _In_ LPSTR AddressString, - _In_ INT AddressFamily, - _In_opt_ LPWSAPROTOCOL_INFOA lpProtocolInfo, - _Out_ LPSOCKADDR lpAddress, - _Inout_ LPINT lpAddressLength -) -{ - - - if (strcmp(AddressString, "192.168.92.254") == 0) - { - return gWsaStringToAddressA( - routerIP, - AddressFamily, - lpProtocolInfo, - lpAddress, - lpAddressLength - ); - } - - if (strcmp(AddressString, "192.168.92.253") == 0) - { - return gWsaStringToAddressA( - routerIP, - AddressFamily, - lpProtocolInfo, - lpAddress, - lpAddressLength - ); - } - - if (strcmp(AddressString, "192.168.92.11") == 0) - { - return gWsaStringToAddressA( - cab1IP, - AddressFamily, - lpProtocolInfo, - lpAddress, - lpAddressLength - ); - } - - if (strcmp(AddressString, "192.168.92.12") == 0) - { - return gWsaStringToAddressA( - cab2IP, - AddressFamily, - lpProtocolInfo, - lpAddress, - lpAddressLength - ); - } - - if (strcmp(AddressString, "192.168.92.13") == 0) - { - return gWsaStringToAddressA( - cab3IP, - AddressFamily, - lpProtocolInfo, - lpAddress, - lpAddressLength - ); - } - - if (strcmp(AddressString, "192.168.92.14") == 0) - { - return gWsaStringToAddressA( - cab4IP, - AddressFamily, - lpProtocolInfo, - lpAddress, - lpAddressLength - ); - } - - if (strcmp(AddressString, "192.168.92.20") == 0) - { - return gWsaStringToAddressA( - terminalIP, - AddressFamily, - lpProtocolInfo, - lpAddress, - lpAddressLength - ); - } - - return gWsaStringToAddressA( - AddressString, - AddressFamily, - lpProtocolInfo, - lpAddress, - lpAddressLength - ); -} - -typedef INT(WSAAPI* getaddrinfo_t)(PCSTR, PCSTR, const ADDRINFOA*, PADDRINFOA*); -static getaddrinfo_t ggetaddrinfo; - -static INT WSAAPI Hook_getaddrinfo( - _In_opt_ PCSTR pNodeName, - _In_opt_ PCSTR pServiceName, - _In_opt_ const ADDRINFOA* pHints, - _Out_ PADDRINFOA* ppResult -) -{ - if (pNodeName && strcmp(pNodeName, "192.168.92.253") == 0) - { - return ggetaddrinfo(routerIP, pServiceName, pHints, ppResult); - } - - return ggetaddrinfo(pNodeName, pServiceName, pHints, ppResult); -} - - static InitFunction Wmmt6RFunc([]() +{ + // Alloc debug console + FreeConsole(); + AllocConsole(); + SetConsoleTitle(L"Maxitune6R Console"); + + FILE* pNewStdout = nullptr; + FILE* pNewStderr = nullptr; + FILE* pNewStdin = nullptr; + + ::freopen_s(&pNewStdout, "CONOUT$", "w", stdout); + ::freopen_s(&pNewStderr, "CONOUT$", "w", stderr); + ::freopen_s(&pNewStdin, "CONIN$", "r", stdin); + std::cout.clear(); + std::cerr.clear(); + std::cin.clear(); + std::wcout.clear(); + std::wcerr.clear(); + std::wcin.clear(); + + puts("hello there, maxitune"); + + // folder for path redirections + CreateDirectoryA(".\\TP", nullptr); + + FILE* fileF = _wfopen(L".\\TP\\setting.lua.gz", L"r"); + if (fileF == NULL) { - // folder for path redirections - CreateDirectoryA(".\\TP", nullptr); + FILE* settingsF = _wfopen(L".\\TP\\setting.lua.gz", L"wb"); + fwrite(settingData, 1, sizeof(settingData), settingsF); + fclose(settingsF); + } + else + { + fclose(fileF); + } - FILE* fileF = _wfopen(L".\\TP\\setting.lua.gz", L"r"); - if (fileF == NULL) - { - FILE* settingsF = _wfopen(L".\\TP\\setting.lua.gz", L"wb"); - fwrite(settingData, 1, sizeof(settingData), settingsF); - fclose(settingsF); - } - else - { - fclose(fileF); - } + bool isTerminal = false; + if (ToBool(config["General"]["TerminalMode"])) + { + isTerminal = true; + } - bool isTerminal = false; - if (ToBool(config["General"]["TerminalMode"])) - { - isTerminal = true; - } + std::string networkip = config["General"]["NetworkAdapterIP"]; + if (!networkip.empty()) + { + ipaddr = networkip.c_str(); + } - std::string networkip = config["General"]["NetworkAdapterIP"]; - if (!networkip.empty()) - { - ipaddr = networkip.c_str(); - } + hookPort = "COM3"; + imageBase = (uintptr_t)GetModuleHandleA(0); + MH_Initialize(); - std::string TERMINAL_IP = config["General"]["TerminalIP"]; - if (!TERMINAL_IP.empty()) - { - char* theIp = (char*)malloc(sizeof(char) * 255); - memset(theIp, 0, sizeof(char) * 255); - strcpy(theIp, TERMINAL_IP.c_str()); - terminalIP = (LPSTR)theIp; - } - else - { - terminalIP = "127.0.0.1"; - } + // Hook dongle funcs + MH_CreateHookApi(L"hasp_windows_x64_28756.dll", "hasp_write", Hook_hasp_write, NULL); + MH_CreateHookApi(L"hasp_windows_x64_28756.dll", "hasp_read", Hook_hasp_read, NULL); + MH_CreateHookApi(L"hasp_windows_x64_28756.dll", "hasp_get_size", Hook_hasp_get_size, NULL); + MH_CreateHookApi(L"hasp_windows_x64_28756.dll", "hasp_decrypt", Hook_hasp_decrypt, NULL); + MH_CreateHookApi(L"hasp_windows_x64_28756.dll", "hasp_encrypt", Hook_hasp_encrypt, NULL); + MH_CreateHookApi(L"hasp_windows_x64_28756.dll", "hasp_logout", Hook_hasp_logout, NULL); + MH_CreateHookApi(L"hasp_windows_x64_28756.dll", "hasp_login", Hook_hasp_login, NULL); + MH_CreateHookApi(L"nbamUsbFinder.dll", "nbamUsbFinderGetSerialNumber", nbamUsbFinderGetSerialNumber, NULL); + MH_CreateHookApi(L"nbamUsbFinder.dll", "nbamUsbFinderInitialize", nbamUsbFinderInitialize, NULL); + MH_CreateHookApi(L"nbamUsbFinder.dll", "nbamUsbFinderRelease", nbamUsbFinderRelease, NULL); - std::string ROUTER_IP = config["General"]["RouterIP"]; - if (!ROUTER_IP.empty()) - { - char* theIp = (char*)malloc(sizeof(char) * 255); - memset(theIp, 0, sizeof(char) * 255); - strcpy(theIp, ROUTER_IP.c_str()); - routerIP = (LPSTR)theIp; - } - else - { - routerIP = "192.168.86.1"; - } + MH_CreateHookApi(L"WS2_32", "bind", Hook_bind, reinterpret_cast(&pbind)); - std::string Cab_1_IP = config["General"]["Cab1IP"]; - if (!Cab_1_IP.empty()) - { - char* theIp = (char*)malloc(sizeof(char) * 255); - memset(theIp, 0, sizeof(char) * 255); - strcpy(theIp, Cab_1_IP.c_str()); - cab1IP = (LPSTR)theIp; - } - else - { - cab1IP = "192.168.255.255"; - } + // Give me the HWND please maxitune + MH_CreateHookApi(L"user32", "ShowWindow", Hook_ShowWindow, reinterpret_cast(&pShowWindow)); + //MH_CreateHookApi(L"kernel32", "ReadFile", Hook_ReadFile, reinterpret_cast(&pReadFile)); - std::string Cab_2_IP = config["General"]["Cab2IP"]; - if (!Cab_2_IP.empty()) - { - char* theIp = (char*)malloc(sizeof(char) * 255); - memset(theIp, 0, sizeof(char) * 255); - strcpy(theIp, Cab_2_IP.c_str()); - cab2IP = (LPSTR)theIp; - } - else - { - cab2IP = "192.168.255.255"; - } + // Hook the window procedure + // (The image starts at 0x140000000) + //MH_CreateHook((void*)(imageBase + 0xB7C030), Hook_WndProc, (void**)&pMaxituneWndProc); + pMaxituneWndProc = (WindowProcedure_t)(imageBase + 0xC69BB0); - std::string Cab_3_IP = config["General"]["Cab3IP"]; - if (!Cab_3_IP.empty()) - { - char* theIp = (char*)malloc(sizeof(char) * 255); - memset(theIp, 0, sizeof(char) * 255); - strcpy(theIp, Cab_3_IP.c_str()); - cab3IP = (LPSTR)theIp; - } - else - { - cab3IP = "192.168.255.255"; - } + GenerateDongleData(isTerminal); - std::string Cab_4_IP = config["General"]["Cab4IP"]; - if (!Cab_4_IP.empty()) - { - char* theIp = (char*)malloc(sizeof(char) * 255); - memset(theIp, 0, sizeof(char) * 255); - strcpy(theIp, Cab_4_IP.c_str()); - cab4IP = (LPSTR)theIp; - } - else - { - cab4IP = "192.168.255.255"; - } + injector::WriteMemory(imageBase + 0x716BC6, 0, true); // pls check - hookPort = "COM3"; - imageBase = (uintptr_t)GetModuleHandleA(0); - MH_Initialize(); + // Skip weird camera init that stucks entire pc on certain brands. TESTED ONLY ON 05!!!! + if (ToBool(config["General"]["WhiteScreenFix"])) + { + injector::WriteMemory(hook::get_pattern("48 8B C4 55 57 41 54 41 55 41 56 48 8D 68 A1 48 81 EC 90 00 00 00 48 C7 45 D7 FE FF FF FF 48 89 58 08 48 89 70 18 45 33 F6 4C 89 75 DF 33 C0 48 89 45 E7", 0), 0x90C3C032, true); + } - // Hook dongle funcs - MH_CreateHookApi(L"hasp_windows_x64_28756.dll", "hasp_write", Hook_hasp_write, NULL); - MH_CreateHookApi(L"hasp_windows_x64_28756.dll", "hasp_read", Hook_hasp_read, NULL); - MH_CreateHookApi(L"hasp_windows_x64_28756.dll", "hasp_get_size", Hook_hasp_get_size, NULL); - MH_CreateHookApi(L"hasp_windows_x64_28756.dll", "hasp_decrypt", Hook_hasp_decrypt, NULL); - MH_CreateHookApi(L"hasp_windows_x64_28756.dll", "hasp_encrypt", Hook_hasp_encrypt, NULL); - MH_CreateHookApi(L"hasp_windows_x64_28756.dll", "hasp_logout", Hook_hasp_logout, NULL); - MH_CreateHookApi(L"hasp_windows_x64_28756.dll", "hasp_login", Hook_hasp_login, NULL); - MH_CreateHookApi(L"nbamUsbFinder.dll", "nbamUsbFinderGetSerialNumber", nbamUsbFinderGetSerialNumber, NULL); - MH_CreateHookApi(L"nbamUsbFinder.dll", "nbamUsbFinderInitialize", nbamUsbFinderInitialize, NULL); - MH_CreateHookApi(L"nbamUsbFinder.dll", "nbamUsbFinderRelease", nbamUsbFinderRelease, NULL); + //injector::MakeNOP(hook::get_pattern("45 33 C0 BA 65 09 00 00 48 8D 4D B0 E8 ? ? ? ? 48 8B 08", 12), 5); - MH_CreateHookApi(L"WS2_32", "bind", Hook_bind, reinterpret_cast(&pbind)); + // First auth error skip + injector::WriteMemory(imageBase + 0x71839B, 0xEB, true); - - // Network hooks - MH_CreateHookApi(L"Ws2_32", "WSAStringToAddressA", Hook_WsaStringToAddressA, reinterpret_cast(&gWsaStringToAddressA)); - MH_CreateHookApi(L"Ws2_32", "getaddrinfo", Hook_getaddrinfo, reinterpret_cast(&ggetaddrinfo)); - - // Give me the HWND please maxitune - MH_CreateHookApi(L"user32", "ShowWindow", Hook_ShowWindow, reinterpret_cast(&pShowWindow)); - //MH_CreateHookApi(L"kernel32", "ReadFile", Hook_ReadFile, reinterpret_cast(&pReadFile)); - - // Hook the window procedure - // (The image starts at 0x140000000) - //MH_CreateHook((void*)(imageBase + 0xB7C030), Hook_WndProc, (void**)&pMaxituneWndProc); - pMaxituneWndProc = (WindowProcedure_t)(imageBase + 0xC69BB0); - - GenerateDongleData(isTerminal); - - injector::WriteMemory(imageBase + 0x716BC6, 0, true); // pls check - - // Skip weird camera init that stucks entire pc on certain brands. TESTED ONLY ON 05!!!! - if (ToBool(config["General"]["WhiteScreenFix"])) - { - injector::WriteMemory(hook::get_pattern("48 8B C4 55 57 41 54 41 55 41 56 48 8D 68 A1 48 81 EC 90 00 00 00 48 C7 45 D7 FE FF FF FF 48 89 58 08 48 89 70 18 45 33 F6 4C 89 75 DF 33 C0 48 89 45 E7", 0), 0x90C3C032, true); - } - - //injector::MakeNOP(hook::get_pattern("45 33 C0 BA 65 09 00 00 48 8D 4D B0 E8 ? ? ? ? 48 8B 08", 12), 5); - - // First auth error skip - injector::WriteMemory(imageBase + 0x71839B, 0xEB, true); - - if (isTerminal) - { + if (isTerminal) + { //safeJMP(hook::get_pattern("0F B6 41 05 2C 30 3C 09 77 04 0F BE C0 C3 83 C8 FF C3"), ReturnTrue); - injector::MakeNOP((imageBase + 0x710445), 5); - safeJMP(hook::get_pattern("8B 01 0F B6 40 78 C3 CC CC CC CC"), ReturnTrue); + injector::MakeNOP((imageBase + 0x710445), 5); + safeJMP(hook::get_pattern("8B 01 0F B6 40 78 C3 CC CC CC CC"), ReturnTrue); + } + else + { + //injector::WriteMemory(imageBase + 0x718FA1, 0x00D2, true); // terminal skip (whyyyyyyyyyyyyyyyy) + // spam thread + //injector::MakeNOP(hook::get_pattern("74 ? 80 7B 31 00 75 ? 48 8B 43 10 80 78 31 00 75 1A 48 8B D8 48 8B 00 80 78 31 00 75 ? 48 8B D8"), 2); //this should be the terminal on same machine patch + + // Best LAN setting by doomertheboomer + injector::WriteMemory(imageBase + 0xB0EB4A, 0xEB, true); //content router patch + injector::MakeNOP(imageBase + 0x7084A6, 2, true); + injector::MakeNOP(hook::get_pattern("74 ? 80 7B 31 00 75 ? 48 8B 43 10 80 78 31 00 75 1A 48 8B D8 48 8B 00 80 78 31 00 75 ? 48 8B D8"), 2); + } + // Enable all print + injector::WriteMemory(imageBase + 0x9891B3, 0xEB, true); - } - else - { - //injector::WriteMemory(imageBase + 0x718FA1, 0x00D2, true); // terminal skip (whyyyyyyyyyyyyyyyy) - // spam thread - injector::MakeNOP(hook::get_pattern("74 ? 80 7B 31 00 75 ? 48 8B 43 10 80 78 31 00 75 1A 48 8B D8 48 8B 00 80 78 31 00 75 ? 48 8B D8"), 2); //this should be the terminal on same machine patch - } + // Dongle crap + injector::WriteMemory(imageBase + 0x71683A, 0xEB, true); + injector::WriteMemory(imageBase + 0x716978, 0xE990, true); - // Enable all print - injector::WriteMemory(imageBase + 0x9891B3, 0xEB, true); + // Skip error modals + injector::MakeNOP(imageBase + 0x7089F4, 2); - // Dongle crap - injector::WriteMemory(imageBase + 0x71683A, 0xEB, true); - injector::WriteMemory(imageBase + 0x716978, 0xE990, true); + // path fixes + injector::WriteMemoryRaw(imageBase + 0x1412758, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x1412778, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x1412798, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14127B8, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14127D8, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14127F8, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x1412818, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x1412838, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x1412858, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x1412870, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14C7388, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14C73A0, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14C73B8, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14C73E0, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14C7408, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14C7420, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14C7438, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14C7448, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14C7458, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14C7470, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14C7488, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14C74A8, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14C74C8, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14C74D8, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14C74E8, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14C7500, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14C7518, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14C7530, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14C7548, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14C7560, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14C7578, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14C7590, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14C75A8, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14C75C0, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14CFC48, "TP", 2, true); // F:/contents/ + injector::WriteMemoryRaw(imageBase + 0x151F6D0, "TP/contents/", 12, true); // F:contents/ + injector::WriteMemoryRaw(imageBase + 0x151F6E0, "TP/contents/", 12, true); // G:contents/ + injector::WriteMemoryRaw(imageBase + 0x1575C50, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x1575C68, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x15769C8, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x15769E0, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x15769F8, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x1576A20, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x1576A48, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x1576A60, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x15774C0, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x15774E0, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x157699C, "TP", 2, true); // F:/ + injector::WriteMemoryRaw(imageBase + 0x14D2318, "TP", 2, true); + injector::WriteMemoryRaw(imageBase + 0x14D2B20, "TP", 2, true); - // Skip error modals - injector::MakeNOP(imageBase + 0x7089F4, 2); + if (ToBool(config["General"]["SkipMovies"])) + { + // Skip movies fuck you wmmt5 + //safeJMP(imageBase + 0xA7D400, ReturnTrue); + } - // path fixes - injector::WriteMemoryRaw(imageBase + 0x1412758, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x1412778, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x1412798, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14127B8, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14127D8, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14127F8, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x1412818, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x1412838, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x1412858, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x1412870, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14C7388, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14C73A0, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14C73B8, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14C73E0, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14C7408, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14C7420, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14C7438, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14C7448, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14C7458, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14C7470, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14C7488, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14C74A8, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14C74C8, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14C74D8, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14C74E8, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14C7500, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14C7518, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14C7530, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14C7548, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14C7560, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14C7578, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14C7590, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14C75A8, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14C75C0, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14CFC48, "TP", 2, true); // F:/contents/ - injector::WriteMemoryRaw(imageBase + 0x151F6D0, "TP/contents/", 12, true); // F:contents/ - injector::WriteMemoryRaw(imageBase + 0x151F6E0, "TP/contents/", 12, true); // G:contents/ - injector::WriteMemoryRaw(imageBase + 0x1575C50, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x1575C68, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x15769C8, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x15769E0, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x15769F8, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x1576A20, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x1576A48, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x1576A60, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x15774C0, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x15774E0, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x157699C, "TP", 2, true); // F:/ - injector::WriteMemoryRaw(imageBase + 0x14D2318, "TP", 2, true); - injector::WriteMemoryRaw(imageBase + 0x14D2B20, "TP", 2, true); + std::string value = config["General"]["CustomName"]; + if (!value.empty()) + { - if (ToBool(config["General"]["SkipMovies"])) - { - // Skip movies fuck you wmmt5 - //safeJMP(imageBase + 0xA7D400, ReturnTrue); - } + } - std::string value = config["General"]["CustomName"]; - if (!value.empty()) - { + // Fix dongle error (can be triggered by various USB hubs, dongles + injector::MakeNOP(imageBase + 0x993FFF, 2, true); - } + // Save story stuff (only 05) + { + // skip erasing of temp card data + //injector::WriteMemory(imageBase + 0xB2CF33, 0xEB, true); + // Skip erasing of temp card + //safeJMP(imageBase + 0x6ADBF0, LoadGameData); //Disabled temporary to stop users copying WMMT6 save to 6R until save works correctly so load has a purpose!! + //safeJMP(imageBase + 0x6C7270, ReturnTrue); + } - // Fix dongle error (can be triggered by various USB hubs, dongles - injector::MakeNOP(imageBase + 0x993FFF, 2, true); + MH_EnableHook(MH_ALL_HOOKS); - // Save story stuff (only 05) - { - // skip erasing of temp card data - //injector::WriteMemory(imageBase + 0xB2CF33, 0xEB, true); - // Skip erasing of temp card - //safeJMP(imageBase + 0x6ADBF0, LoadGameData); //Disabled temporary to stop users copying WMMT6 save to 6R until save works correctly so load has a purpose!! - //safeJMP(imageBase + 0x6C7270, ReturnTrue); - } - - MH_EnableHook(MH_ALL_HOOKS); - - }, GameID::WMMT6R); +}, GameID::WMMT6R); #endif #pragma optimize("", on) \ No newline at end of file diff --git a/OpenParrot/src/Utility/GameDetect.cpp b/OpenParrot/src/Utility/GameDetect.cpp index af8d304..5c49686 100644 --- a/OpenParrot/src/Utility/GameDetect.cpp +++ b/OpenParrot/src/Utility/GameDetect.cpp @@ -456,7 +456,7 @@ void GameDetect::DetectCurrentGame() // PATCHES 10-21 & 5DX+ if (*(uint32_t*)(moduleBase + 0x2F00) == 0x084AFF48) { - if (newCrcResult == 0x1BB6F051) + if (newCrcResult == 0x1BB6F051 || newCrcResult == 0x7E61F32D) { SetGameId(GameID::WMMT5DXPlus, "WMMT5DX+"); }