1
0
mirror of synced 2024-11-14 23:07:36 +01:00

Merge pull request #1 from ghkkk090/master

WMMT stuff
This commit is contained in:
dmr 2022-10-10 15:39:43 +07:00 committed by GitHub
commit 6ee49c6289
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 402 additions and 740 deletions

View File

@ -18,7 +18,10 @@
extern LPCSTR hookPort;
uintptr_t imageBase;
static unsigned char hasp_buffer[0xD40];
const char *ipaddr;
static bool isFreePlay;
static bool isEventMode2P;
static bool isEventMode4P;
const char* ipaddr;
// Data for IC card, Force Feedback etc OFF.
unsigned char settingData[408] = {
@ -58,6 +61,7 @@ unsigned char settingData[408] = {
0x8F, 0x3D, 0x7F, 0x00, 0x10, 0x1E, 0x34, 0xD9, 0xB5, 0x03, 0x00, 0x00
};
#define HASP_STATUS_OK 0
unsigned int Hook_hasp_login(int feature_id, void* vendor_code, int hasp_handle) {
#ifdef _DEBUG
@ -91,7 +95,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;
}
@ -107,10 +111,10 @@ 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);
typedef int (WINAPI* BIND)(SOCKET, CONST SOCKADDR*, INT);
BIND pbind = NULL;
unsigned int WINAPI Hook_bind(SOCKET s, const sockaddr *addr, int namelen) {
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");
@ -124,7 +128,73 @@ unsigned int WINAPI Hook_bind(SOCKET s, const sockaddr *addr, int namelen) {
}
else {
return pbind(s, addr, namelen);
}
}
// ******************************************** //
// ************ Debug Data Logging ************ //
// ******************************************** //
// ************* Global Variables ************* //
// **** String Variables
// Debugging event log file
std::string logfile = "wmmt5_errors.txt";
// writeLog(filename: String, message: String): Int
// Given a filename string and a message string, appends
// the message to the given file.
static int writeLog(std::string filename, std::string message)
{
// Log file to write to
std::ofstream eventLog;
// Open the filename provided (append mode)
eventLog.open(filename, std::ios_base::app);
// File open success
if (eventLog.is_open())
{
// Write the message to the file
eventLog << message;
// Close the log file handle
eventLog.close();
// Success
return 0;
}
else // File open failed
{
// Failure
return 1;
}
}
// 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;
}
}
@ -152,7 +222,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;
@ -166,8 +236,6 @@ void GenerateDongleData(bool isTerminal)
}
}
char customName[256];
extern int* ffbOffset;
extern int* ffbOffset2;
extern int* ffbOffset3;
@ -178,150 +246,153 @@ 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([]()
{
FILE* fileF = _wfopen(L"Fsetting.lua.gz", L"r");
if (fileF == NULL)
{
FILE* settingsF = _wfopen(L"Fsetting.lua.gz", L"wb");
fwrite(settingData, 1, sizeof(settingData), settingsF);
fclose(settingsF);
}
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);
}
bool isTerminal = false;
if (ToBool(config["General"]["TerminalMode"]))
{
isTerminal = true;
}
std::string networkip = config["General"]["NetworkAdapterIP"];
if (!networkip.empty())
{
//strcpy(ipaddr, networkip.c_str());
ipaddr = networkip.c_str();
}
hookPort = "COM3";
imageBase = (uintptr_t)GetModuleHandleA(0);
MH_Initialize();
// Hook dongle funcs
MH_CreateHookApi(L"hasp_windows_x64_109906.dll", "hasp_write", Hook_hasp_write, NULL);
MH_CreateHookApi(L"hasp_windows_x64_109906.dll", "hasp_read", Hook_hasp_read, NULL);
MH_CreateHookApi(L"hasp_windows_x64_109906.dll", "hasp_get_size", Hook_hasp_get_size, NULL);
MH_CreateHookApi(L"hasp_windows_x64_109906.dll", "hasp_decrypt", Hook_hasp_decrypt, NULL);
MH_CreateHookApi(L"hasp_windows_x64_109906.dll", "hasp_encrypt", Hook_hasp_encrypt, NULL);
MH_CreateHookApi(L"hasp_windows_x64_109906.dll", "hasp_logout", Hook_hasp_logout, NULL);
MH_CreateHookApi(L"hasp_windows_x64_109906.dll", "hasp_login", Hook_hasp_login, NULL);
MH_CreateHookApi(L"WS2_32", "bind", Hook_bind, reinterpret_cast<LPVOID*>(&pbind));
GenerateDongleData(isTerminal);
//Load banapass emu
LoadLibraryA(".\\openBanaW5p.dll");
//restore old patches
injector::WriteMemory<uint8_t>(hook::get_pattern("0F 94 C0 84 C0 0F 94 C0 84 C0 75 05 45 32 ? EB", 0x13), 0, true);
injector::MakeNOP(hook::get_pattern("83 C0 FD 83 F8 01 0F 87 B4 00 00 00", 6), 6);
injector::WriteMemory<uint8_t>(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);
injector::MakeNOP(hook::get_pattern("45 33 C0 BA 65 09 00 00 48 8D 4D B0 E8 ? ? ? ? 48 8B 08", 12), 5);
auto location = hook::get_pattern<char>("48 83 EC 28 33 D2 B9 70 00 02 00 E8 ? ? ? ? 85 C0 79 06");
injector::WriteMemory<uint8_t>(location + 0x12, 0xEB, true);
// Skip weird camera init that stucks entire pc on certain brands. TESTED ONLY ON 05!!!!
if (ToBool(config["General"]["WhiteScreenFix"]))
{
injector::WriteMemory<DWORD>(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);
}
{
auto location = hook::get_pattern<char>("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");
injector::WriteMemory<uint8_t>(location + 3, 0xEB, true); //patches content router
injector::MakeNOP(location + 0x22, 2); //patches ip addr
injector::MakeNOP(location + 0x33, 2); //patches ip addr
}
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);
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
{
FILE* fileF = _wfopen(L"Fsetting.lua.gz", L"r");
if (fileF == NULL)
{
auto location = hook::get_pattern<char>("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
FILE* settingsF = _wfopen(L"Fsetting.lua.gz", L"wb");
fwrite(settingData, 1, sizeof(settingData), settingsF);
fclose(settingsF);
}
}
auto chars = { 'F', 'G' };
for (auto cha : chars)
{
auto patterns = hook::pattern(va("%02X 3A 2F", cha));
if (patterns.size() > 0)
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);
}
bool isTerminal = false;
if (ToBool(config["General"]["TerminalMode"]))
{
isTerminal = true;
}
std::string networkip = config["General"]["NetworkAdapterIP"];
if (!networkip.empty())
{
//strcpy(ipaddr, networkip.c_str());
ipaddr = networkip.c_str();
}
hookPort = "COM3";
imageBase = (uintptr_t)GetModuleHandleA(0);
MH_Initialize();
// Hook dongle funcs
MH_CreateHookApi(L"hasp_windows_x64_109906.dll", "hasp_write", Hook_hasp_write, NULL);
MH_CreateHookApi(L"hasp_windows_x64_109906.dll", "hasp_read", Hook_hasp_read, NULL);
MH_CreateHookApi(L"hasp_windows_x64_109906.dll", "hasp_get_size", Hook_hasp_get_size, NULL);
MH_CreateHookApi(L"hasp_windows_x64_109906.dll", "hasp_decrypt", Hook_hasp_decrypt, NULL);
MH_CreateHookApi(L"hasp_windows_x64_109906.dll", "hasp_encrypt", Hook_hasp_encrypt, NULL);
MH_CreateHookApi(L"hasp_windows_x64_109906.dll", "hasp_logout", Hook_hasp_logout, NULL);
MH_CreateHookApi(L"hasp_windows_x64_109906.dll", "hasp_login", Hook_hasp_login, NULL);
MH_CreateHookApi(L"WS2_32", "bind", Hook_bind, reinterpret_cast<LPVOID*>(&pbind));
GenerateDongleData(isTerminal);
//load banapass emu
LoadLibraryA(".\\openBanaW5p.dll");
injector::WriteMemory<uint8_t>(hook::get_pattern("0F 94 C0 84 C0 0F 94 C0 84 C0 75 05 45 32 ? EB", 0x13), 0, true);
injector::MakeNOP(hook::get_pattern("83 C0 FD 83 F8 01 0F 87 B4 00 00 00", 6), 6);
// Skip weird camera init that stucks entire pc on certain brands. TESTED ONLY ON 05!!!!
if (ToBool(config["General"]["WhiteScreenFix"]))
{
injector::WriteMemory<DWORD>(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);
}
{
auto location = hook::get_pattern<char>("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");
injector::WriteMemory<uint8_t>(location + 3, 0xEB, true);
injector::MakeNOP(location + 0x22, 2);
injector::MakeNOP(location + 0x33, 2);
}
{
auto location = hook::get_pattern<char>("48 83 EC 28 33 D2 B9 70 00 02 00 E8 ? ? ? ? 85 C0 79 06");
injector::WriteMemory<uint8_t>(location + 0x12, 0xEB, true);
}
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);
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
{
for (int i = 0; i < patterns.size(); i++)
{
char* text = patterns.get(i).get<char>(0);
std::string text_str(text);
std::string to_replace = va("%c:/", cha);
std::string replace_with = va("./%c", cha);
std::string replaced = text_str.replace(0, to_replace.length(), replace_with);
injector::WriteMemoryRaw(text, (char*)replaced.c_str(), replaced.length() + 1, true);
auto location = hook::get_pattern<char>("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
}
}
}
if (ToBool(config["General"]["SkipMovies"]))
{
// Skip movies fuck you wmmt5 (what the fuck is this for?)
safeJMP(imageBase + 0x806020, ReturnTrue);
}
auto chars = { 'F', 'G' };
// Save story stuff (only 05)
{
for (auto cha : chars)
{
auto patterns = hook::pattern(va("%02X 3A 2F", cha));
if (patterns.size() > 0)
{
for (int i = 0; i < patterns.size(); i++)
{
char* text = patterns.get(i).get<char>(0);
std::string text_str(text);
CreateThread(0, 0, Wmmt5FfbCollector, 0, 0, 0);
}
std::string to_replace = va("%c:/", cha);
std::string replace_with = va("./%c", cha);
MH_EnableHook(MH_ALL_HOOKS);
std::string replaced = text_str.replace(0, to_replace.length(), replace_with);
}, GameID::WMMT5);
injector::WriteMemoryRaw(text, (char*)replaced.c_str(), replaced.length() + 1, true);
}
}
}
if (ToBool(config["General"]["SkipMovies"]))
{
// Skip movies fuck you wmmt5
safeJMP(imageBase + 0x806020, ReturnTrue);
}
// Save story stuff (only 05)
{
CreateThread(0, 0, Wmmt5FfbCollector, 0, 0, 0);
}
MH_EnableHook(MH_ALL_HOOKS);
}, GameID::WMMT5);
#endif
#pragma optimize("", on)

View File

@ -23,9 +23,6 @@ bool isUpdate5 = false;
// MUST DISABLE IC CARD, FFB MANUALLY N MT5DX+
#define HASP_STATUS_OK 0
unsigned int dxpHook_hasp_login(int feature_id, void* vendor_code, int hasp_handle) {
#ifdef _DEBUG
@ -323,23 +320,16 @@ unsigned int WINAPI Hook_bind_w5p(SOCKET s, const sockaddr* addr, int namelen) {
}
}
// Wmmt5Func([]()): InitFunction
// Performs the initial startup tasks for
// maximum tune 5, including the starting
// of required subprocesses.
static InitFunction Wmmt5Func([]()
{
if (ToBool(config["Update5"]["Enable Update5"]))
{
isUpdate5 = true;
}
// Alloc debug console
FreeConsole();
AllocConsole();
SetConsoleTitle(L"Maxitune6 Console");
SetConsoleTitle(L"Maxitune5DX+ Console");
FILE* pNewStdout = nullptr;
FILE* pNewStderr = nullptr;
@ -357,6 +347,11 @@ static InitFunction Wmmt5Func([]()
puts("hello there, maxitune");
if (ToBool(config["Update5"]["Enable Update5"]))
{
isUpdate5 = true;
}
// Records if terminal mode is enabled
bool isTerminal = false;
@ -396,13 +391,16 @@ static InitFunction Wmmt5Func([]()
// Give me the HWND please maxitune
MH_CreateHookApi(L"user32", "ShowWindow", Hook_ShowWindow, reinterpret_cast<LPVOID*>(&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) {
if (!isUpdate5)
{
LoadLibraryA(".\\openBanaW5p.dll");
}
else {
else
{
LoadLibraryA(".\\openBanaW5p5.dll");
}
@ -411,8 +409,6 @@ static InitFunction Wmmt5Func([]()
GenerateDongleDataDxp(isTerminal);
injector::WriteMemory<uint8_t>(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);
@ -438,11 +434,6 @@ static InitFunction Wmmt5Func([]()
{
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
// If terminal emulator is enabled
if (ToBool(config["General"]["TerminalEmulator"]))
{
CreateThread(0, 0, SpamMulticast, 0, 0, 0);
}
}
else
{ //terminal mode patches
@ -474,16 +465,19 @@ static InitFunction Wmmt5Func([]()
}
}
if (!isUpdate5) {
if (!isUpdate5)
{
// Enable all print
injector::MakeNOP(imageBasedxplus + 0x898BD3, 6);
//Fix crash when saving story mode and Time attack
injector::MakeNOP(imageBasedxplus + 0xE90C7, 5);
}
else {
else
{
// Enable all print
injector::MakeNOP(imageBasedxplus + 0x8F15A3, 6);
//Fix crash when saving story mode and Time attack
injector::MakeNOP(imageBasedxplus + 0xE8DE7, 5);
}

View File

@ -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);
@ -244,131 +233,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);
static __int64 __fastcall MileageFix(__int64 a1)
@ -431,84 +295,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();
@ -527,11 +313,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<LPVOID*>(&gWsaStringToAddressA));
MH_CreateHookApi(L"Ws2_32", "getaddrinfo", Hook_getaddrinfo, reinterpret_cast<LPVOID*>(&ggetaddrinfo));
// Give me the HWND please maxitune
MH_CreateHookApi(L"user32", "ShowWindow", Hook_ShowWindow, reinterpret_cast<LPVOID*>(&pShowWindow));
//MH_CreateHookApi(L"kernel32", "ReadFile", Hook_ReadFile, reinterpret_cast<LPVOID*>(&pReadFile));
@ -552,6 +333,10 @@ static InitFunction Wmmt6Func([]()
injector::WriteMemory<DWORD>(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<BYTE>(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);

View File

@ -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);
}
@ -509,381 +498,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<LPVOID*>(&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<LPVOID*>(&pShowWindow));
//MH_CreateHookApi(L"kernel32", "ReadFile", Hook_ReadFile, reinterpret_cast<LPVOID*>(&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<uint8_t>(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<DWORD>(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<LPVOID*>(&pbind));
// First auth error skip
injector::WriteMemory<BYTE>(imageBase + 0x71839B, 0xEB, true);
// Network hooks
MH_CreateHookApi(L"Ws2_32", "WSAStringToAddressA", Hook_WsaStringToAddressA, reinterpret_cast<LPVOID*>(&gWsaStringToAddressA));
MH_CreateHookApi(L"Ws2_32", "getaddrinfo", Hook_getaddrinfo, reinterpret_cast<LPVOID*>(&ggetaddrinfo));
// Give me the HWND please maxitune
MH_CreateHookApi(L"user32", "ShowWindow", Hook_ShowWindow, reinterpret_cast<LPVOID*>(&pShowWindow));
//MH_CreateHookApi(L"kernel32", "ReadFile", Hook_ReadFile, reinterpret_cast<LPVOID*>(&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<uint8_t>(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<DWORD>(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<BYTE>(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<WORD>(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<BYTE>(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<BYTE>(imageBase + 0x9891B3, 0xEB, true);
}
else
{
//injector::WriteMemory<WORD>(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<BYTE>(imageBase + 0x71683A, 0xEB, true);
injector::WriteMemory<WORD>(imageBase + 0x716978, 0xE990, true);
// Enable all print
injector::WriteMemory<BYTE>(imageBase + 0x9891B3, 0xEB, true);
// Skip error modals
injector::MakeNOP(imageBase + 0x7089F4, 2);
// Dongle crap
injector::WriteMemory<BYTE>(imageBase + 0x71683A, 0xEB, true);
injector::WriteMemory<WORD>(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<uint8_t>(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<uint8_t>(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)