commit
6ee49c6289
@ -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");
|
||||
@ -128,6 +132,72 @@ unsigned int WINAPI Hook_bind(SOCKET s, const sockaddr *addr, int 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;
|
||||
}
|
||||
}
|
||||
|
||||
static int ReturnTrue()
|
||||
{
|
||||
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,16 +246,16 @@ 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)
|
||||
{
|
||||
@ -243,17 +311,13 @@ static InitFunction Wmmt5Func([]()
|
||||
|
||||
GenerateDongleData(isTerminal);
|
||||
|
||||
|
||||
//Load banapass emu
|
||||
//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"]))
|
||||
@ -263,15 +327,23 @@ static InitFunction Wmmt5Func([]()
|
||||
|
||||
{
|
||||
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
|
||||
|
||||
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
|
||||
@ -309,19 +381,18 @@ static InitFunction Wmmt5Func([]()
|
||||
|
||||
if (ToBool(config["General"]["SkipMovies"]))
|
||||
{
|
||||
// Skip movies fuck you wmmt5 (what the fuck is this for?)
|
||||
// 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);
|
||||
}, GameID::WMMT5);
|
||||
#endif
|
||||
#pragma optimize("", on)
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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,126 +498,29 @@ 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);
|
||||
|
||||
@ -656,84 +548,6 @@ static InitFunction Wmmt6RFunc([]()
|
||||
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();
|
||||
@ -752,11 +566,6 @@ static InitFunction Wmmt6RFunc([]()
|
||||
|
||||
MH_CreateHookApi(L"WS2_32", "bind", Hook_bind, reinterpret_cast<LPVOID*>(&pbind));
|
||||
|
||||
|
||||
// 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));
|
||||
@ -786,14 +595,17 @@ static InitFunction Wmmt6RFunc([]()
|
||||
//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);
|
||||
|
||||
|
||||
}
|
||||
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
|
||||
//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
|
||||
@ -884,6 +696,6 @@ static InitFunction Wmmt6RFunc([]()
|
||||
|
||||
MH_EnableHook(MH_ALL_HOOKS);
|
||||
|
||||
}, GameID::WMMT6R);
|
||||
}, GameID::WMMT6R);
|
||||
#endif
|
||||
#pragma optimize("", on)
|
Loading…
Reference in New Issue
Block a user