Merge branch 'master' into swbp
This commit is contained in:
commit
4bfe0702e3
@ -49,4 +49,51 @@ static InitFunction Tekken7Func([]()
|
||||
injector::WriteMemory<DWORD>(imageBase + 0x115E757 + 0x08, 0xC6FFC6FF, true);
|
||||
}
|
||||
}, GameID::TER);
|
||||
|
||||
static InitFunction Tekken7Update00Func([]()
|
||||
{
|
||||
hookPort = "COM3";
|
||||
uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0);
|
||||
|
||||
// Skip all errors
|
||||
injector::MakeNOP(imageBase + 0x16D3D1, 5);
|
||||
|
||||
// Force Offline mode
|
||||
safeJMP(imageBase + 0xACB190, ReturnTrue);
|
||||
|
||||
// First Check Error
|
||||
injector::MakeNOP(imageBase + 0x17B400, 5);
|
||||
|
||||
// Windowed
|
||||
if (ToBool(config["General"]["Windowed"]))
|
||||
{
|
||||
// doesn't seem to work?
|
||||
injector::WriteMemory<LONGLONG>(imageBase + 0xBCB2D3, 0xF633C1FFC1FFC933, true);
|
||||
injector::WriteMemory<DWORD>(imageBase + 0xBCB2D3 + 0x08, 0xC6FFC6FF, true);
|
||||
}
|
||||
|
||||
}, GameID::Tekken7Update00);
|
||||
|
||||
static InitFunction Tekken7Upd12Func([]()
|
||||
{
|
||||
hookPort = "COM3";
|
||||
uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0);
|
||||
|
||||
// Skip all errors
|
||||
injector::MakeNOP(imageBase + 0x16BC41, 5);
|
||||
|
||||
// Force Offline mode
|
||||
safeJMP(imageBase + 0x147380, ReturnTrue);
|
||||
|
||||
// First Check Error
|
||||
injector::MakeNOP(imageBase + 0x179050, 5);
|
||||
|
||||
// Windowed
|
||||
if (ToBool(config["General"]["Windowed"]))
|
||||
{
|
||||
injector::WriteMemory<LONGLONG>(imageBase + 0xBF0F33, 0xF633C1FFC1FFC933, true);
|
||||
injector::WriteMemory<DWORD>(imageBase + 0xBF0F33 + 0x08, 0xC6FFC6FF, true);
|
||||
}
|
||||
|
||||
}, GameID::Tekken7Update12);
|
||||
#endif
|
151
OpenParrot/src/Functions/Games/Other/DirtyDrivin.cpp
Normal file
151
OpenParrot/src/Functions/Games/Other/DirtyDrivin.cpp
Normal file
@ -0,0 +1,151 @@
|
||||
#include <StdInc.h>
|
||||
#include "Utility/InitFunction.h"
|
||||
#include "Functions/Global.h"
|
||||
#include "Utility\Hooking.Patterns.h"
|
||||
#include <Xinput.h>
|
||||
#include <math.h>
|
||||
#include <dinput.h>
|
||||
#pragma optimize("", off)
|
||||
|
||||
#pragma comment(lib, "Ws2_32.lib")
|
||||
#if _M_IX86
|
||||
typedef unsigned int U32;
|
||||
typedef unsigned char U8;
|
||||
|
||||
DWORD BaseAddress9 = 0x00400000;
|
||||
int horizontal9 = 0;
|
||||
int vertical9 = 0;
|
||||
HWND hWndRT9 = 0;
|
||||
|
||||
static bool button1pressed = false;
|
||||
static bool button2pressed = false;
|
||||
static bool button3pressed = false;
|
||||
static bool button4pressed = false;
|
||||
static bool STARTpressed = false;
|
||||
|
||||
// controls
|
||||
extern int* ffbOffset;
|
||||
extern int* ffbOffset2;
|
||||
extern int* ffbOffset3;
|
||||
extern int* ffbOffset4;
|
||||
|
||||
DWORD WINAPI InputRT9(LPVOID lpParam)
|
||||
{
|
||||
int deltaTimer = 16;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (hWndRT9 == 0)
|
||||
{
|
||||
hWndRT9 = FindWindowW(NULL, TEXT("Project Vulcan"));
|
||||
SetWindowTextW(hWndRT9, TEXT("Dirty Drivin"));
|
||||
}
|
||||
|
||||
// ESCAPE QUITS GAME
|
||||
if (GetAsyncKeyState(VK_ESCAPE) & 0x8000)
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// buttons see bitwise values in TPui//RawThrills.cs
|
||||
// START
|
||||
if (*ffbOffset & 0x08)
|
||||
{
|
||||
if (STARTpressed == false)
|
||||
{
|
||||
keybd_event(VK_SPACE, 0, 0, 0);
|
||||
STARTpressed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (STARTpressed == true)
|
||||
{
|
||||
keybd_event(VK_SPACE, 0, KEYEVENTF_KEYUP, 0);
|
||||
STARTpressed = false;
|
||||
}
|
||||
}
|
||||
|
||||
// BUTTON 1/ CRANK UP
|
||||
if (*ffbOffset & 0x100)
|
||||
{
|
||||
if (button1pressed == false)
|
||||
{
|
||||
keybd_event(VK_SPACE, 0, 0, 0);
|
||||
button1pressed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (button1pressed == true)
|
||||
{
|
||||
keybd_event(VK_SPACE, 0, KEYEVENTF_KEYUP, 0);
|
||||
button1pressed = false;
|
||||
}
|
||||
}
|
||||
|
||||
// BUTTON 3/ VIEW
|
||||
if (*ffbOffset & 0x400)
|
||||
{
|
||||
if (button3pressed == false)
|
||||
{
|
||||
keybd_event(0x56, 0, 0, 0);
|
||||
button3pressed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (button3pressed == true)
|
||||
{
|
||||
keybd_event(0x56, 0, KEYEVENTF_KEYUP, 0);
|
||||
button3pressed = false;
|
||||
}
|
||||
}
|
||||
|
||||
// WHEEL
|
||||
int iWheel = (((float)* ffbOffset2) - 128);
|
||||
float wheel = (iWheel * 0.0078125f);
|
||||
injector::WriteMemory<float>((0x4AD0FC + BaseAddress9), wheel, true);
|
||||
//// GAS
|
||||
float gas = (float)* ffbOffset3 / 255.0f;
|
||||
injector::WriteMemory<float>((0x4AD0F8 + BaseAddress9), gas, true);
|
||||
|
||||
//DEBUG//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// info(true, "test value %f %f ", *ffbOffset2, x);
|
||||
//DEBUG//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Sleep(deltaTimer);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static InitFunction DirtyDrivinFunc([]()
|
||||
{
|
||||
// PATCHING EXE AT RUNTIME (reboots, network, filepath, config, CRC...
|
||||
injector::WriteMemoryRaw((0x3B00 + BaseAddress9), "\xEB", 1, true);
|
||||
injector::WriteMemoryRaw((0x43B88 + BaseAddress9), "\xC6\x05\x6C\xFE\x96\x00\x01\x90\x90\xC6\x05\x58\x4A\x88\x00\x01\xB8\x58\x2A\x74\x00\xEB", 22, true);
|
||||
injector::WriteMemoryRaw((0x65447 + BaseAddress9), "\xEB\x0B\x90\x90", 4, true);
|
||||
injector::WriteMemoryRaw((0xBC9E8 + BaseAddress9), "\xEB", 1, true);
|
||||
injector::WriteMemoryRaw((0x1B5BF5 + BaseAddress9), "\x90\x90", 2, true);
|
||||
injector::WriteMemoryRaw((0x239B5C + BaseAddress9), "\xEB", 1, true);
|
||||
injector::WriteMemoryRaw((0x2F236E + BaseAddress9), "\x90\x90\x90", 3, true);
|
||||
injector::WriteMemoryRaw((0x2FB88F + BaseAddress9), "\x90\x90", 2, true);
|
||||
injector::WriteMemoryRaw((0x337A07 + BaseAddress9), "\x35", 1, true);
|
||||
|
||||
//CONTROLS PATCH
|
||||
injector::MakeNOP((0x005159A + BaseAddress9), 6, true);
|
||||
injector::MakeNOP((0x00515AC + BaseAddress9), 6, true);
|
||||
injector::MakeNOP((0x00514BB + BaseAddress9), 4, true);
|
||||
injector::MakeNOP((0x00514C0 + BaseAddress9), 3, true);
|
||||
|
||||
CreateThread(NULL, 0, InputRT9, NULL, 0, NULL);
|
||||
|
||||
// auto accl off
|
||||
if (ToBool(config["General"]["AutoAcclOff"]))
|
||||
{
|
||||
injector::MakeNOP(BaseAddress9 + 0xAA6E6, 6, true);
|
||||
}
|
||||
}, GameID::DirtyDrivin);
|
||||
#endif
|
||||
#pragma optimize("", on)
|
225
OpenParrot/src/Functions/Games/Other/H2Overdrive.cpp
Normal file
225
OpenParrot/src/Functions/Games/Other/H2Overdrive.cpp
Normal file
@ -0,0 +1,225 @@
|
||||
#include <StdInc.h>
|
||||
#include "Utility/InitFunction.h"
|
||||
#include "Functions/Global.h"
|
||||
#include "Utility\Hooking.Patterns.h"
|
||||
#include <Xinput.h>
|
||||
#include <math.h>
|
||||
#include <dinput.h>
|
||||
|
||||
#pragma comment(lib, "Ws2_32.lib")
|
||||
#if _M_IX86
|
||||
typedef unsigned int U32;
|
||||
typedef unsigned char U8;
|
||||
|
||||
DWORD BaseAddress10 = 0x00400000;
|
||||
HWND hWndRT10 = 0;
|
||||
|
||||
static bool button1pressed = false;
|
||||
static bool button2pressed = false;
|
||||
static bool button3pressed = false;
|
||||
static bool button4pressed = false;
|
||||
static bool STARTpressed = false;
|
||||
|
||||
// controls
|
||||
extern int* ffbOffset;
|
||||
extern int* ffbOffset2;
|
||||
extern int* ffbOffset3;
|
||||
extern int* ffbOffset4;
|
||||
|
||||
CREATE_PROCESS_DEBUG_INFO gProcDbgInfo = { 0 };
|
||||
|
||||
LPVOID GetTranslatedOffset(int offset)
|
||||
{
|
||||
return reinterpret_cast<LPVOID>((int)gProcDbgInfo.lpBaseOfImage + offset);
|
||||
}
|
||||
|
||||
DWORD WINAPI InputRT10(LPVOID lpParam)
|
||||
{
|
||||
int deltaTimer = 16;
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
||||
// ESCAPE QUITS GAME
|
||||
if (GetAsyncKeyState(VK_ESCAPE) & 0x8000)
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// REAL NUMERIC KEYPAD
|
||||
int keys[] = { VK_NUMPAD1, VK_NUMPAD2, VK_NUMPAD3, VK_NUMPAD4, VK_NUMPAD5, VK_NUMPAD6, VK_NUMPAD7, VK_NUMPAD8, VK_NUMPAD9, VK_MULTIPLY, VK_NUMPAD0, VK_DIVIDE };
|
||||
for (int i = 0; i < sizeof(keys) / sizeof(int); i++)
|
||||
{
|
||||
SHORT res = GetAsyncKeyState(keys[i]);
|
||||
if (res)
|
||||
{
|
||||
injector::WriteMemory<INT32>((0x2BAA04 + i * 4 + BaseAddress10), 1, true);
|
||||
if (res & 1)
|
||||
{
|
||||
injector::WriteMemory<INT32>((0x392BA8 + BaseAddress10), 1, true);
|
||||
injector::WriteMemory<INT32>((0x392B70 + 0x10 + BaseAddress10), i, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
// FAKE KEYPAD FROM NUMBERS
|
||||
int fakekeys[] = { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, VK_RETURN, 0x30, VK_BACK };
|
||||
for (int i = 0; i < sizeof(fakekeys) / sizeof(int); i++)
|
||||
{
|
||||
SHORT res2 = GetAsyncKeyState(fakekeys[i]);
|
||||
if (res2)
|
||||
{
|
||||
injector::WriteMemory<INT32>((0x2BAA04 + i * 4 + BaseAddress10), 1, true);
|
||||
if (res2 & 1)
|
||||
{
|
||||
injector::WriteMemory<INT32>((0x392BA8 + BaseAddress10), 1, true);
|
||||
injector::WriteMemory<INT32>((0x392B70 + 0x10 + BaseAddress10), i, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// buttons see bitwise values in TPui//RawThrills.cs
|
||||
// START+NITRO
|
||||
if (*ffbOffset & 0x08)
|
||||
{
|
||||
if (STARTpressed == false)
|
||||
{
|
||||
injector::WriteMemory<INT32>((0x398CB0 + BaseAddress10), 1, true);
|
||||
injector::WriteMemory<INT32>((0x398CB4 + BaseAddress10), 0, true);
|
||||
STARTpressed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (STARTpressed == true)
|
||||
{
|
||||
injector::WriteMemory<INT32>((0x398CB0 + BaseAddress10), 0, true);
|
||||
injector::WriteMemory<INT32>((0x398CB4 + BaseAddress10), 1, true);
|
||||
STARTpressed = false;
|
||||
}
|
||||
}
|
||||
|
||||
// BUTTON 1 / START+NITRO
|
||||
if (*ffbOffset & 0x100)
|
||||
{
|
||||
if (button1pressed == false)
|
||||
{
|
||||
injector::WriteMemory<INT32>((0x398CB0 + BaseAddress10), 1, true);
|
||||
injector::WriteMemory<INT32>((0x398CB4 + BaseAddress10), 0, true);
|
||||
button1pressed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (button1pressed == true)
|
||||
{
|
||||
injector::WriteMemory<INT32>((0x398CB0 + BaseAddress10), 0, true);
|
||||
injector::WriteMemory<INT32>((0x398CB4 + BaseAddress10), 1, true);
|
||||
button1pressed = false;
|
||||
}
|
||||
}
|
||||
|
||||
// BUTTON 3/ VIEW
|
||||
int ptr = *(DWORD*)(0x38C2D0 + BaseAddress10);
|
||||
if (*ffbOffset & 0x400)
|
||||
{
|
||||
if (button3pressed == false)
|
||||
{
|
||||
injector::WriteMemory<INT32>((0x398CB8 + BaseAddress10), 1, true);
|
||||
injector::WriteMemory<INT32>((0x398CBC + BaseAddress10), 0, true);
|
||||
button3pressed = true;
|
||||
|
||||
if (0 != ptr)
|
||||
{
|
||||
injector::WriteMemory<INT32>((ptr + 0x840), 1, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (button3pressed == true)
|
||||
{
|
||||
injector::WriteMemory<INT32>((0x398CB8 + BaseAddress10), 0, true);
|
||||
injector::WriteMemory<INT32>((0x398CBC + BaseAddress10), 1, true);
|
||||
button3pressed = false;
|
||||
}
|
||||
}
|
||||
|
||||
// WHEEL
|
||||
int iWheel = (((float)* ffbOffset2) - 128);
|
||||
float wheel = (iWheel * 0.0078125f);
|
||||
injector::WriteMemory<float>((0x398CC8 + BaseAddress10), wheel * 0.5f + 0.5f, true); // MENU WHEEL
|
||||
injector::WriteMemory<float>((0x29D4D8 + BaseAddress10), wheel, true); // GAME WHEEL
|
||||
//// GAS
|
||||
float gas = (float)* ffbOffset3 / 255.0f;
|
||||
injector::WriteMemory<float>((0x398CD0 + BaseAddress10), gas, true);
|
||||
|
||||
//DEBUG//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// info(true, "test value %08X", ptr);
|
||||
//DEBUG//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Sleep(deltaTimer);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static InitFunction H2OverdriveFunc([]()
|
||||
{
|
||||
// PATCHING EXE AT RUNTIME (reboots, network, filepath, config, CRC...
|
||||
injector::WriteMemoryRaw((0x24713C + BaseAddress10), "\x48\x32\x4F\x76\x65\x72\x64\x72\x69\x76\x65", 11, true);
|
||||
injector::WriteMemoryRaw((0x004DB1 + BaseAddress10), "\xEB", 1, true);
|
||||
injector::WriteMemoryRaw((0x0B423B + BaseAddress10), "\xEB", 1, true);
|
||||
injector::WriteMemoryRaw((0x101B70 + BaseAddress10), "\xEB", 1, true);
|
||||
injector::WriteMemoryRaw((0x12AB6F + BaseAddress10), "\xEB", 1, true);
|
||||
injector::WriteMemoryRaw((0x19C240 + BaseAddress10), "\xC2\x04\x00\x90\x90\x90", 6, true);
|
||||
injector::WriteMemoryRaw((0x251744 + BaseAddress10), "\x2E\x5C\x00", 3, true);
|
||||
|
||||
//CONTROLS PATCH
|
||||
// BOOST BUTTON
|
||||
injector::MakeNOP((0x151594 + BaseAddress10), 5, true); // PATCH BUTTON IN MENU
|
||||
injector::MakeNOP((0x1515BB + BaseAddress10), 5, true);
|
||||
U8 patchBoostButton[] = { 0xA1, 0xB0, 0x8C, 0x79, 0x00, 0xC3 };
|
||||
LPVOID* ptr3 = (LPVOID*)& patchBoostButton[1];
|
||||
*ptr3 = GetTranslatedOffset(0x398CB0 + BaseAddress10);
|
||||
injector::WriteMemoryRaw((0x109BA3 + BaseAddress10), patchBoostButton, sizeof(patchBoostButton), true); // PATCH BOOST BUTTON IN GAME
|
||||
injector::WriteMemory<INT32>((0x257B94 + 0x2C + BaseAddress10), (int)GetTranslatedOffset(0x109BA3 + BaseAddress10), true); // PATCH JUMP TABLE FOR BOOST BUTTON
|
||||
// VIEW BUTTON
|
||||
injector::MakeNOP((0x151599 + BaseAddress10), 6, true); // PATCH VIEW BUTTON IN MENU
|
||||
injector::MakeNOP((0x1515DC + BaseAddress10), 5, true);
|
||||
U8 patchViewButton[] = { 0xA1, 0xB8, 0x8C, 0x79, 0x00, 0xC3 };
|
||||
LPVOID* ptr4 = (LPVOID*)& patchViewButton[1];
|
||||
*ptr4 = GetTranslatedOffset(0x398CB8 + BaseAddress10);
|
||||
injector::WriteMemoryRaw((0x109BA9 + BaseAddress10), patchViewButton, sizeof(patchViewButton), true); // PATCH VIEW BUTTON IN GAME
|
||||
injector::WriteMemory<INT32>((0x257B94 + 0x44 + BaseAddress10), (int)GetTranslatedOffset(0x109BA9 + BaseAddress10), true); // PATCH JUMP TABLE FOR VIEW BUTTON
|
||||
// WHEEL AND PEDAL
|
||||
injector::MakeNOP((0x151698 + BaseAddress10), 10, true); // PATCH WHEEL WRITE IN MENU
|
||||
U8 patchPedal[] = { 0xD9, 0x05, 0xD0, 0x8C, 0x79, 0x00, 0xC2, 0x04, 0x00 };
|
||||
LPVOID* ptrPedal = (LPVOID*)& patchPedal[2];
|
||||
*ptrPedal = GetTranslatedOffset(0x00398CD0 + BaseAddress10);
|
||||
injector::WriteMemoryRaw((0x000859B7 + BaseAddress10), patchPedal, sizeof(patchPedal), true); // PATCH PEDAL
|
||||
injector::WriteMemory<INT32>((0x257B94 + 0x20 + BaseAddress10), (int)GetTranslatedOffset(0x000859B7 + BaseAddress10), true); // PATCH JUMP TABLE FOR GAS
|
||||
U8 patchWheel[] = { 0xD9, 0x05, 0xD8, 0xD4, 0x69, 0x00, 0xC2, 0x04, 0x00 };
|
||||
LPVOID* ptrWheel = (LPVOID*)& patchWheel[2];
|
||||
*ptrWheel = GetTranslatedOffset(0x0029D4D8 + BaseAddress10);
|
||||
injector::WriteMemoryRaw((0x000859C7 + BaseAddress10), patchWheel, sizeof(patchWheel), true); // PATCH WHEEL
|
||||
injector::WriteMemory<INT32>((0x257B94 + 0x1C + BaseAddress10), (int)GetTranslatedOffset(0x000859C7 + BaseAddress10), true); // PATCH JUMP TABLE FOR WHEEL
|
||||
|
||||
//TEST REMAP to DELETE
|
||||
injector::WriteMemoryRaw((0x146E68 + BaseAddress10), "\x6A\x2E", 2, true);
|
||||
//SERVICE REMAP to INSERT
|
||||
injector::WriteMemoryRaw((0x146EB2 + BaseAddress10), "\x6A\x2D", 2, true);
|
||||
//VOL+- REMAP to UP/DOWN
|
||||
injector::WriteMemoryRaw((0x146F03 + BaseAddress10), "\x6A\x26", 2, true);
|
||||
injector::WriteMemoryRaw((0x146F54 + BaseAddress10), "\x6A\x28", 2, true);
|
||||
//ENABLE KEYPAD
|
||||
injector::WriteMemoryRaw((0x186302 + BaseAddress10), "\xEB", 1, true);
|
||||
//KEYPAD HACK
|
||||
U8 patchKeypadButton[] = { 0x8B, 0x44, 0x24, 0x04, 0x8B, 0x04, 0x85, 0x04, 0xAA, 0x6B, 0x00 ,0xC2, 0x04, 0x00 };
|
||||
injector::WriteMemoryRaw((0x0023CE37 + BaseAddress10), patchKeypadButton, sizeof(patchKeypadButton), true);
|
||||
injector::WriteMemory<INT32>((0x257B94 + 0x78 + BaseAddress10), (int)GetTranslatedOffset(0x23CE37 + BaseAddress10), true); // PATCH JUMP TABLE FOR KEYPAD BUTTON
|
||||
|
||||
CreateThread(NULL, 0, InputRT10, NULL, 0, NULL);
|
||||
|
||||
}, GameID::H2Overdrive);
|
||||
#endif
|
613
OpenParrot/src/Functions/Games/Other/SnoCross.cpp
Normal file
613
OpenParrot/src/Functions/Games/Other/SnoCross.cpp
Normal file
@ -0,0 +1,613 @@
|
||||
#include <StdInc.h>
|
||||
#include "Utility/InitFunction.h"
|
||||
#include "Functions/Global.h"
|
||||
#include "Utility\Hooking.Patterns.h"
|
||||
#include <Xinput.h>
|
||||
#include <math.h>
|
||||
#include <dinput.h>
|
||||
|
||||
#pragma comment(lib, "Ws2_32.lib")
|
||||
#if _M_IX86
|
||||
#define clamp( x, xmin, xmax ) min( xmax, max( x, xmin ) )
|
||||
typedef unsigned int U32;
|
||||
typedef unsigned char U8;
|
||||
|
||||
DWORD BaseAddress7 = 0x00400000;
|
||||
int horizontal7 = 0;
|
||||
int vertical7 = 0;
|
||||
HWND hWndRT7 = 0;
|
||||
|
||||
static bool previousLeft = false;
|
||||
static bool previousRight = false;
|
||||
static bool previousUp = false;
|
||||
static bool previousDown = false;
|
||||
static bool button1pressed = false;
|
||||
static bool button2pressed = false;
|
||||
static bool button3pressed = false;
|
||||
static bool button4pressed = false;
|
||||
static bool PINpressed = false;
|
||||
static bool NUMpressed = false;
|
||||
static bool NUMpressed0 = false;
|
||||
static bool NUMpressed1 = false;
|
||||
static bool NUMpressed2 = false;
|
||||
static bool NUMpressed3 = false;
|
||||
static bool NUMpressed4 = false;
|
||||
static bool NUMpressed5 = false;
|
||||
static bool NUMpressed6 = false;
|
||||
static bool NUMpressed7 = false;
|
||||
static bool NUMpressed8 = false;
|
||||
static bool NUMpressed9 = false;
|
||||
|
||||
// controls
|
||||
extern int* ffbOffset;
|
||||
extern int* ffbOffset2;
|
||||
extern int* ffbOffset3;
|
||||
extern int* ffbOffset4;
|
||||
// hooks ori
|
||||
BOOL(__stdcall* original_SetWindowPos7)(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags);
|
||||
BOOL(__stdcall* original_CreateWindowExA7)(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam);
|
||||
|
||||
DWORD WINAPI InputRT7(LPVOID lpParam)
|
||||
{
|
||||
int deltaTimer = 16;
|
||||
INT_PTR keyboardBuffer = (0x5CA700 + BaseAddress7);
|
||||
INT_PTR keyboardBuffer2 = (0x5CA1F0 + BaseAddress7);
|
||||
|
||||
while (true)
|
||||
{
|
||||
// ESCAPE QUITS GAME
|
||||
if (GetAsyncKeyState(VK_ESCAPE) & 0x8000)
|
||||
{
|
||||
HWND hWndTMP = GetForegroundWindow();
|
||||
if (hWndRT7 == 0)
|
||||
{
|
||||
hWndRT7 = FindWindowA(NULL, "X-Games SnoCross");
|
||||
}
|
||||
if (hWndTMP == hWndRT7)
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (GetAsyncKeyState(VK_NUMPAD1) & 0x0001)
|
||||
{
|
||||
if (NUMpressed1 == false)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x1A634 + BaseAddress7), "\xB8\x01\x00\x00\x00\x90", 6, true);
|
||||
NUMpressed1 = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NUMpressed1 == true)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x1A634 + BaseAddress7), "\x8D\x87\x80\xFF\xFE\xFF", 6, true);
|
||||
NUMpressed1 = false;
|
||||
}
|
||||
}
|
||||
if (GetAsyncKeyState(VK_NUMPAD2) & 0x0001)
|
||||
{
|
||||
if (NUMpressed2 == false)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x1A634 + BaseAddress7), "\xB8\x02\x00\x00\x00\x90", 6, true);
|
||||
NUMpressed2 = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NUMpressed2 == true)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x1A634 + BaseAddress7), "\x8D\x87\x80\xFF\xFE\xFF", 6, true);
|
||||
NUMpressed2 = false;
|
||||
}
|
||||
}
|
||||
if (GetAsyncKeyState(VK_NUMPAD3) & 0x0001)
|
||||
{
|
||||
if (NUMpressed3 == false)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x1A634 + BaseAddress7), "\xB8\x03\x00\x00\x00\x90", 6, true);
|
||||
NUMpressed3 = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NUMpressed3 == true)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x1A634 + BaseAddress7), "\x8D\x87\x80\xFF\xFE\xFF", 6, true);
|
||||
NUMpressed3 = false;
|
||||
}
|
||||
}
|
||||
if (GetAsyncKeyState(VK_NUMPAD4) & 0x0001)
|
||||
{
|
||||
if (NUMpressed4 == false)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x1A634 + BaseAddress7), "\xB8\x04\x00\x00\x00\x90", 6, true);
|
||||
NUMpressed4 = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NUMpressed4 == true)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x1A634 + BaseAddress7), "\x8D\x87\x80\xFF\xFE\xFF", 6, true);
|
||||
NUMpressed4 = false;
|
||||
}
|
||||
}
|
||||
if (GetAsyncKeyState(VK_NUMPAD5) & 0x0001)
|
||||
{
|
||||
if (NUMpressed5 == false)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x1A634 + BaseAddress7), "\xB8\x05\x00\x00\x00\x90", 6, true);
|
||||
NUMpressed5 = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NUMpressed5 == true)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x1A634 + BaseAddress7), "\x8D\x87\x80\xFF\xFE\xFF", 6, true);
|
||||
NUMpressed5 = false;
|
||||
}
|
||||
}
|
||||
if (GetAsyncKeyState(VK_NUMPAD6) & 0x0001)
|
||||
{
|
||||
if (NUMpressed6 == false)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x1A634 + BaseAddress7), "\xB8\x06\x00\x00\x00\x90", 6, true);
|
||||
NUMpressed6 = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NUMpressed6 == true)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x1A634 + BaseAddress7), "\x8D\x87\x80\xFF\xFE\xFF", 6, true);
|
||||
NUMpressed6 = false;
|
||||
}
|
||||
}
|
||||
if (GetAsyncKeyState(VK_NUMPAD7) & 0x0001)
|
||||
{
|
||||
if (NUMpressed7 == false)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x1A634 + BaseAddress7), "\xB8\x07\x00\x00\x00\x90", 6, true);
|
||||
NUMpressed7 = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NUMpressed7 == true)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x1A634 + BaseAddress7), "\x8D\x87\x80\xFF\xFE\xFF", 6, true);
|
||||
NUMpressed7 = false;
|
||||
}
|
||||
}
|
||||
if (GetAsyncKeyState(VK_NUMPAD8) & 0x0001)
|
||||
{
|
||||
if (NUMpressed8 == false)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x1A634 + BaseAddress7), "\xB8\x08\x00\x00\x00\x90", 6, true);
|
||||
NUMpressed8 = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NUMpressed8 == true)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x1A634 + BaseAddress7), "\x8D\x87\x80\xFF\xFE\xFF", 6, true);
|
||||
NUMpressed8 = false;
|
||||
}
|
||||
}
|
||||
if (GetAsyncKeyState(VK_NUMPAD9) & 0x0001)
|
||||
{
|
||||
if (NUMpressed9 == false)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x1A634 + BaseAddress7), "\xB8\x09\x00\x00\x00\x90", 6, true);
|
||||
NUMpressed9 = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NUMpressed9 == true)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x1A634 + BaseAddress7), "\x8D\x87\x80\xFF\xFE\xFF", 6, true);
|
||||
NUMpressed9 = false;
|
||||
}
|
||||
}
|
||||
if (GetAsyncKeyState(VK_NUMPAD0) & 0x0001)
|
||||
{
|
||||
if (NUMpressed0 == false)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x1A634 + BaseAddress7), "\xB8\x00\x00\x00\x00\x90", 6, true);
|
||||
NUMpressed0 = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NUMpressed0 == true)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x1A634 + BaseAddress7), "\x8D\x87\x80\xFF\xFE\xFF", 6, true);
|
||||
NUMpressed0 = false;
|
||||
}
|
||||
}
|
||||
if (GetAsyncKeyState(VK_RETURN) & 0x0001)
|
||||
{
|
||||
if (NUMpressed == false)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x1A634 + BaseAddress7), "\xB8\x0A\x00\x00\x00\x90", 6, true);
|
||||
injector::WriteMemoryRaw((0x1A77D + BaseAddress7), "\x90\x90", 2, true);
|
||||
NUMpressed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NUMpressed == true)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x1A634 + BaseAddress7), "\x8D\x87\x80\xFF\xFE\xFF", 6, true);
|
||||
injector::WriteMemoryRaw((0x1A77D + BaseAddress7), "\x7C\x49", 2, true);
|
||||
NUMpressed = false;
|
||||
}
|
||||
}
|
||||
|
||||
// buttons see bitwise values in TPui//RawThrills.cs
|
||||
// START
|
||||
if (*ffbOffset & 0x08)
|
||||
{
|
||||
injector::WriteMemory<BYTE>((keyboardBuffer + 4 * 0x00), 2, true);
|
||||
if (NUMpressed == false)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x1A634 + BaseAddress7), "\xB8\x0A\x00\x00\x00\x90", 6, true);
|
||||
injector::WriteMemoryRaw((0x1A77D + BaseAddress7), "\x90\x90", 2, true);
|
||||
NUMpressed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NUMpressed == true)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x1A634 + BaseAddress7), "\x8D\x87\x80\xFF\xFE\xFF", 6, true);
|
||||
injector::WriteMemoryRaw((0x1A77D + BaseAddress7), "\x7C\x49", 2, true);
|
||||
NUMpressed = false;
|
||||
}
|
||||
}
|
||||
// TEST
|
||||
if (*ffbOffset & 0x01)
|
||||
{
|
||||
injector::WriteMemory<BYTE>((keyboardBuffer + 4 * 0x0B), 2, true);
|
||||
}
|
||||
// NITRO
|
||||
if (*ffbOffset & 0x100)
|
||||
{
|
||||
if (button1pressed == false)
|
||||
{
|
||||
injector::WriteMemory<BYTE>((keyboardBuffer + 4 * 0x00), 2, true);
|
||||
button1pressed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (button1pressed == true)
|
||||
{
|
||||
button1pressed = false;
|
||||
}
|
||||
}
|
||||
// BUTTON 1/ VIEW
|
||||
if (*ffbOffset & 0x200)
|
||||
{
|
||||
if (button2pressed == false)
|
||||
{
|
||||
injector::WriteMemory<BYTE>((keyboardBuffer + 4 * 0x04), 2, true);
|
||||
button2pressed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (button2pressed == true)
|
||||
{
|
||||
button2pressed = false;
|
||||
}
|
||||
}
|
||||
// BUTTON 2/ SNOWBALLS
|
||||
if (*ffbOffset & 0x400)
|
||||
{
|
||||
if (button3pressed == false)
|
||||
{
|
||||
injector::WriteMemory<BYTE>((keyboardBuffer + 4 * 0x01), 2, true);
|
||||
button3pressed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (button3pressed == true)
|
||||
{
|
||||
button3pressed = false;
|
||||
}
|
||||
}
|
||||
// BUTTON 3/ CREDITS
|
||||
if (*ffbOffset & 0x800)
|
||||
{
|
||||
if (button4pressed == false)
|
||||
{
|
||||
injector::WriteMemory<BYTE>((keyboardBuffer2 + 0x2C), 3, true);
|
||||
button4pressed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (button4pressed == true)
|
||||
{
|
||||
button4pressed = false;
|
||||
}
|
||||
}
|
||||
// BUTTON ENTER-PIN
|
||||
if (*ffbOffset & 0x20)
|
||||
{
|
||||
if (PINpressed == false)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x26614 + BaseAddress7), "\x90\x90", 2, true);
|
||||
injector::WriteMemoryRaw((0x2661F + BaseAddress7), "\x90\x90", 2, true);
|
||||
injector::WriteMemoryRaw((0x26638 + BaseAddress7), "\x90\x90", 2, true);
|
||||
|
||||
injector::WriteMemoryRaw((0x28BE2 + BaseAddress7), "\x90\x90", 2, true);
|
||||
injector::WriteMemoryRaw((0x28BED + BaseAddress7), "\x90\x90", 2, true);
|
||||
injector::WriteMemoryRaw((0x28C08 + BaseAddress7), "\x90\x90", 2, true);
|
||||
|
||||
injector::WriteMemoryRaw((0x2A5A4 + BaseAddress7), "\x90\x90", 2, true);
|
||||
injector::WriteMemoryRaw((0x2A5AF + BaseAddress7), "\x90\x90", 2, true);
|
||||
injector::WriteMemoryRaw((0x2A5C8 + BaseAddress7), "\x90\x90", 2, true);
|
||||
PINpressed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PINpressed == true)
|
||||
{
|
||||
injector::WriteMemoryRaw((0x26614 + BaseAddress7), "\x75\x3F", 2, true);
|
||||
injector::WriteMemoryRaw((0x2661F + BaseAddress7), "\x74\x34", 2, true);
|
||||
injector::WriteMemoryRaw((0x26638 + BaseAddress7), "\x75\x07", 2, true);
|
||||
|
||||
injector::WriteMemoryRaw((0x28BE2 + BaseAddress7), "\x75\x41", 2, true);
|
||||
injector::WriteMemoryRaw((0x28BED + BaseAddress7), "\x74\x36", 2, true);
|
||||
injector::WriteMemoryRaw((0x28C08 + BaseAddress7), "\x75\x07", 2, true);
|
||||
|
||||
injector::WriteMemoryRaw((0x2A5A4 + BaseAddress7), "\x75\x3F", 2, true);
|
||||
injector::WriteMemoryRaw((0x2A5AF + BaseAddress7), "\x74\x34", 2, true);
|
||||
injector::WriteMemoryRaw((0x2A5C8 + BaseAddress7), "\x75\x07", 2, true);
|
||||
PINpressed = false;
|
||||
}
|
||||
}
|
||||
// MENU LEFT
|
||||
if (*ffbOffset & 0x4000)
|
||||
{
|
||||
if (previousLeft == false)
|
||||
{
|
||||
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_LEFT), 2, true);
|
||||
previousLeft = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (previousLeft == true)
|
||||
{
|
||||
previousLeft = false;
|
||||
}
|
||||
}
|
||||
// MENU RIGHT
|
||||
if (*ffbOffset & 0x8000)
|
||||
{
|
||||
if (previousRight == false)
|
||||
{
|
||||
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_RIGHT), 2, true);
|
||||
previousRight = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (previousRight == true)
|
||||
{
|
||||
previousRight = false;
|
||||
}
|
||||
}
|
||||
|
||||
// WHEEL
|
||||
int iWheel0 = (((float)* ffbOffset2) - 128);
|
||||
float wheel = (iWheel0 * 0.0078125f);
|
||||
int iWheel = (int)(2047.5 + 2047.5 * wheel);
|
||||
injector::WriteMemory<INT32>(((0x5CA300 + BaseAddress7) + 4 * 0x20), iWheel, true);
|
||||
//// GAS
|
||||
float gas = (float)* ffbOffset3 / 255.0f;
|
||||
int iGas = (int)(gas * 4095);
|
||||
injector::WriteMemory<INT32>(((0x5CA300 + BaseAddress7) + 4 * 0x21), iGas, true);
|
||||
//// BRAKE
|
||||
float brake = (float)* ffbOffset4 / 255.0f;
|
||||
int iBrake = (int)(brake * 4095);
|
||||
injector::WriteMemory<INT32>(((0x5CA300 + BaseAddress7) + 4 * 0x22), iBrake, true);
|
||||
|
||||
//DEBUG//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// info(true, "test value %f ", test);
|
||||
//DEBUG//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Sleep(deltaTimer);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD WINAPI WindowRT7(LPVOID lpParam)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
// RIGHT-CLICK MINIMIZES WINDOW
|
||||
if (GetAsyncKeyState(VK_RBUTTON) & 0x8000)
|
||||
{
|
||||
HWND hWndTMP = GetForegroundWindow();
|
||||
if (hWndRT7 == 0)
|
||||
{
|
||||
hWndRT7 = FindWindowA(NULL, "X-Games SnoCross");
|
||||
}
|
||||
if (hWndTMP == hWndRT7)
|
||||
{
|
||||
RECT rect;
|
||||
GetWindowRect(hWndRT7, &rect);
|
||||
int currentwidth = rect.right - rect.left;
|
||||
int currentheight = rect.bottom - rect.top;
|
||||
original_SetWindowPos7(hWndRT7, HWND_BOTTOM, 0, 0, 1366, 768, SWP_NOSIZE);
|
||||
ShowWindow(hWndRT7, SW_MINIMIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOL(__stdcall* original_DefWindowProcA7)(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
DWORD WINAPI DefWindowProcART7(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static int xClick;
|
||||
static int yClick;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_LBUTTONDOWN:
|
||||
SetCapture(hWnd);
|
||||
xClick = LOWORD(lParam);
|
||||
yClick = HIWORD(lParam);
|
||||
break;
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
ReleaseCapture();
|
||||
break;
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
if (GetCapture() == hWnd)
|
||||
{
|
||||
RECT rcWindow;
|
||||
GetWindowRect(hWnd, &rcWindow);
|
||||
int xMouse = LOWORD(lParam);
|
||||
int yMouse = HIWORD(lParam);
|
||||
int xWindow = rcWindow.left + xMouse - xClick;
|
||||
int yWindow = rcWindow.top + yMouse - yClick;
|
||||
if (xWindow >= (horizontal7 - 100))
|
||||
xWindow = 0;
|
||||
if (yWindow >= (vertical7 - 100))
|
||||
yWindow = 0;
|
||||
original_SetWindowPos7(hWnd, NULL, xWindow, yWindow, 1366, 768, SWP_NOSIZE | SWP_NOZORDER);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
return original_DefWindowProcA7(hWnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
DWORD WINAPI CreateWindowExART7(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam)
|
||||
{
|
||||
return original_CreateWindowExA7(dwExStyle, lpClassName, "X-Games SnoCross", 0x94000000, 0, 0, 1366, 768, hWndParent, hMenu, hInstance, lpParam);
|
||||
}
|
||||
|
||||
DWORD WINAPI SetCursorPosRT7(int X, int Y)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
DWORD WINAPI SetWindowPosRT7(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool windowed = false;
|
||||
|
||||
static InitFunction SnoCrossFunc([]()
|
||||
{
|
||||
MH_Initialize();
|
||||
MH_CreateHookApi(L"user32.dll", "CreateWindowExA", CreateWindowExART7, (void**)& original_CreateWindowExA7);
|
||||
MH_CreateHookApi(L"user32.dll", "SetWindowPos", SetWindowPosRT7, (void**)& original_SetWindowPos7);
|
||||
if (ToBool(config["General"]["Windowed"]))
|
||||
{
|
||||
windowed = true;
|
||||
MH_CreateHookApi(L"user32.dll", "DefWindowProcA", DefWindowProcART7, (void**)& original_DefWindowProcA7);
|
||||
MH_CreateHookApi(L"user32.dll", "SetCursorPos", SetCursorPosRT7, NULL);
|
||||
}
|
||||
|
||||
GetDesktopResolution(horizontal7, vertical7);
|
||||
|
||||
// PATCHING EXE AT RUNTIME (reboots, network, filepath, config, CRC...36DF3D
|
||||
injector::WriteMemoryRaw((0x36DF3D + BaseAddress7), "\x75\x0D", 2, true);
|
||||
injector::WriteMemoryRaw((0x6C7EB + BaseAddress7), "\xF0", 1, true);
|
||||
injector::WriteMemoryRaw((0x6CAF0 + BaseAddress7), "\xC3\x90\x90", 3, true);
|
||||
injector::WriteMemoryRaw((0x6D020 + BaseAddress7), "\xC3", 1, true);
|
||||
injector::WriteMemoryRaw((0x6F6D0 + BaseAddress7), "\xE9\xCB\x00\x00\x00\x90", 6, true);
|
||||
injector::WriteMemoryRaw((0x6FFE0 + BaseAddress7), "\xC3\x90", 2, true);
|
||||
injector::WriteMemoryRaw((0x70DE0 + BaseAddress7), "\x90\x90", 2, true);
|
||||
injector::WriteMemoryRaw((0x71499 + BaseAddress7), "\xE9\x9A\x00\x00\x00\x90", 6, true);
|
||||
injector::WriteMemoryRaw((0x3783AD + BaseAddress7), "\x31\xC0\x40", 3, true);
|
||||
injector::WriteMemoryRaw((0x3A8F90 + BaseAddress7), "\x2E\x5C\x63\x6F\x70\x73\x32\x2E\x68\x73\x74\x00", 12, true);
|
||||
injector::WriteMemoryRaw((0x3A9D48 + BaseAddress7), "\x2E\x5C\x61\x75\x64\x62\x61\x6B\x00\x00\x00\x00\x61\x75\x64\x69\x74\x73\x00\x00\x2E\x5C\x61\x75\x64\x69\x74\x73\x00", 29, true);
|
||||
injector::WriteMemoryRaw((0x3A9D5C + BaseAddress7), "\x2E\x5C\x41\x75\x64\x69\x74\x4C\x6F\x67\x30\x30\x30\x2E\x74\x78\x74\x00\x00", 19, true);
|
||||
injector::WriteMemoryRaw((0x3ACE14 + BaseAddress7), "\x2E\x5C\x70\x72\x65\x66\x73\x62\x61\x6B\x00\x00\x70\x72\x65\x66\x73\x00\x00\x00\x2E\x5C\x70\x72\x65\x66\x73\x00", 28, true);
|
||||
injector::WriteMemoryRaw((0x3AF5C8 + BaseAddress7), "\x2E\x5C\x6D\x70\x2E\x70\x64\x74\x00", 9, true);
|
||||
|
||||
// REPLACE SPACE KEY WITH ESC TO PREVENT EXITING LEVEL PREMATURELY
|
||||
injector::WriteMemory<BYTE>((0x77328 + BaseAddress7), DIK_ESCAPE, true);
|
||||
|
||||
// REMOVE ESC BOX
|
||||
injector::MakeNOP((0x476999), 5, true);
|
||||
|
||||
CreateThread(NULL, 0, InputRT7, NULL, 0, NULL);
|
||||
|
||||
if (windowed)
|
||||
{
|
||||
// NO HIDE CURSOR
|
||||
injector::WriteMemory<BYTE>((0x14A9F + BaseAddress7), 0x01, true);
|
||||
|
||||
CreateThread(NULL, 0, WindowRT7, NULL, 0, NULL);
|
||||
}
|
||||
|
||||
// MACHINE ID setting
|
||||
if ((strcmp(config["Network"]["MachineID"].c_str(), "2") == 0))
|
||||
{
|
||||
injector::WriteMemory<DWORD>((0x4A4490 + BaseAddress7), 0x01, true);
|
||||
}
|
||||
else if ((strcmp(config["Network"]["MachineID"].c_str(), "3") == 0))
|
||||
{
|
||||
injector::WriteMemory<DWORD>((0x4A4490 + BaseAddress7), 0x02, true);
|
||||
}
|
||||
else if ((strcmp(config["Network"]["MachineID"].c_str(), "4") == 0))
|
||||
{
|
||||
injector::WriteMemory<DWORD>((0x4A4490 + BaseAddress7), 0x03, true);
|
||||
}
|
||||
else // MACHINE ID = 1
|
||||
{
|
||||
injector::WriteMemory<DWORD>((0x4A4490 + BaseAddress7), 0x00, true);
|
||||
}
|
||||
|
||||
// FPS Fix
|
||||
if ((strcmp(config["General"]["FPSFix"].c_str(), "0") != 0))
|
||||
{
|
||||
std::string FPSstring = (LPCSTR)(config["General"]["FPSFix"].c_str());
|
||||
int FPSvalue = std::stoi(FPSstring);
|
||||
if (FPSvalue > 255)
|
||||
{
|
||||
FPSvalue = 0;
|
||||
}
|
||||
if (FPSvalue < 0)
|
||||
{
|
||||
FPSvalue = 0;
|
||||
}
|
||||
injector::WriteMemoryRaw((0xF0140 + BaseAddress7), "\x6A", 1, true);
|
||||
injector::WriteMemory<BYTE>((0xF0141 + BaseAddress7), FPSvalue, true);
|
||||
injector::WriteMemoryRaw((0xF0142 + BaseAddress7), "\xFF\x15\x7C\x71\x71\x00", 6, true);
|
||||
injector::WriteMemoryRaw((0xF0148 + BaseAddress7), "\xC3", 1, true);
|
||||
}
|
||||
|
||||
// redirect messages.txt
|
||||
injector::WriteMemoryRaw(BaseAddress7 + 0x4A9EF4, "./messages.txt", 14, true);
|
||||
|
||||
// redirect auditlog.txt
|
||||
injector::WriteMemoryRaw(BaseAddress7 + 0x3AA054, ".//AuditLog%.3d.txt", 19, true);
|
||||
|
||||
//graphics crashfix
|
||||
injector::WriteMemory<BYTE>(BaseAddress7 + 0xC7FE2, 0xEB, true);
|
||||
injector::MakeNOP(BaseAddress7 + 0xC7FDB, 2, true);
|
||||
|
||||
MH_EnableHook(MH_ALL_HOOKS);
|
||||
}, GameID::SnoCross);
|
||||
#endif
|
@ -5,6 +5,9 @@
|
||||
#include "dx8/d3d8.h"
|
||||
#include "Utility/GameDetect.h"
|
||||
|
||||
static bool swShaderHack = false;
|
||||
static bool windowed = false;
|
||||
|
||||
IDirect3D8*(WINAPI* g_origDirect3DCreate8)(UINT SDKVersion);
|
||||
|
||||
template<typename T>
|
||||
@ -25,12 +28,15 @@ static HRESULT(WINAPI* g_oldReset)(IDirect3DDevice8* self, D3DPRESENT_PARAMETERS
|
||||
|
||||
HRESULT WINAPI ResetWrap(IDirect3DDevice8* self, D3DPRESENT_PARAMETERS* pPresentationParameters)
|
||||
{
|
||||
pPresentationParameters->Windowed = TRUE;
|
||||
pPresentationParameters->FullScreen_RefreshRateInHz = 0;
|
||||
pPresentationParameters->BackBufferWidth = 0;
|
||||
pPresentationParameters->BackBufferHeight = 0;
|
||||
pPresentationParameters->Flags = 0;
|
||||
pPresentationParameters->FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
|
||||
if (windowed)
|
||||
{
|
||||
pPresentationParameters->Windowed = TRUE;
|
||||
pPresentationParameters->FullScreen_RefreshRateInHz = 0;
|
||||
pPresentationParameters->BackBufferWidth = 0;
|
||||
pPresentationParameters->BackBufferHeight = 0;
|
||||
pPresentationParameters->Flags = 0;
|
||||
pPresentationParameters->FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
|
||||
}
|
||||
|
||||
return g_oldReset(self, pPresentationParameters);
|
||||
}
|
||||
@ -39,13 +45,17 @@ static HRESULT(WINAPI* g_oldCreateDevice)(IDirect3D8* self, UINT Adapter, D3DDEV
|
||||
|
||||
HRESULT WINAPI CreateDeviceWrap(IDirect3D8* self, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DDevice8** ppReturnedDeviceInterface)
|
||||
{
|
||||
pPresentationParameters->Windowed = TRUE;
|
||||
pPresentationParameters->FullScreen_RefreshRateInHz = 0;
|
||||
pPresentationParameters->BackBufferWidth = 0;
|
||||
pPresentationParameters->BackBufferHeight = 0;
|
||||
pPresentationParameters->Flags = 0;
|
||||
pPresentationParameters->FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
|
||||
|
||||
if (windowed)
|
||||
{
|
||||
pPresentationParameters->Windowed = TRUE;
|
||||
pPresentationParameters->FullScreen_RefreshRateInHz = 0;
|
||||
pPresentationParameters->BackBufferWidth = 0;
|
||||
pPresentationParameters->BackBufferHeight = 0;
|
||||
pPresentationParameters->Flags = 0;
|
||||
pPresentationParameters->FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
|
||||
}
|
||||
if (swShaderHack)
|
||||
BehaviorFlags = D3DCREATE_SOFTWARE_VERTEXPROCESSING;
|
||||
HRESULT hr = g_oldCreateDevice(self, Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface);
|
||||
|
||||
if (*ppReturnedDeviceInterface)
|
||||
@ -84,6 +94,12 @@ static InitFunction initFunc([]()
|
||||
return;
|
||||
if (GameDetect::currentGame == GameID::FNFSC)
|
||||
InitD3D8WindowHook();
|
||||
if (GameDetect::currentGame == GameID::SnoCross)
|
||||
{
|
||||
swShaderHack = ToBool(config["General"]["SoftwareVertexShaders"]);
|
||||
if (swShaderHack)
|
||||
InitD3D8WindowHook();
|
||||
}
|
||||
if (ToBool(config["General"]["Windowed"]))
|
||||
{
|
||||
InitD3D8WindowHook();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -64,5 +64,10 @@ enum class GameID
|
||||
StarWarsJapEs3XLauncher,
|
||||
StarWarsEs3XLauncher,
|
||||
StarWarsEs3X,
|
||||
StarWarsJapEs3X
|
||||
StarWarsJapEs3X,
|
||||
SnoCross,
|
||||
DirtyDrivin,
|
||||
H2Overdrive,
|
||||
Tekken7Update00,
|
||||
Tekken7Update12
|
||||
};
|
Loading…
Reference in New Issue
Block a user