2019-09-14 03:13:05 +02:00
|
|
|
/*This file is part of FFB Arcade Plugin.
|
|
|
|
FFB Arcade Plugin is free software : you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
FFB Arcade Plugin is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2019-04-07 07:16:19 +02:00
|
|
|
#include <string>
|
|
|
|
#include <tchar.h>
|
|
|
|
#include "M2Emulator.h"
|
|
|
|
#include "math.h"
|
|
|
|
#include "SDL.h"
|
|
|
|
|
2021-05-27 08:18:12 +02:00
|
|
|
extern void M2EmulatorDaytonaUSAInputsEnabled(Helpers* helpers);
|
|
|
|
extern void M2EmulatorSegaRallyInputsEnabled(Helpers* helpers);
|
|
|
|
extern void M2EmulatorIndy500InputsEnabled(Helpers* helpers);
|
|
|
|
|
2020-07-03 13:23:35 +02:00
|
|
|
//M2 Emulator Games
|
|
|
|
std::string SegaRallyChampionship("Sega Rally Championship");
|
|
|
|
std::string SegaRallyChampionshipRevB("Sega Rally Championship (Rev B)");
|
|
|
|
std::string SegaRallyProDrivin("Sega Rally Pro Drivin'");
|
|
|
|
std::string DaytonaUSA("Daytona USA");
|
|
|
|
std::string DaytonaUSA93Edition("Daytona USA '93 Edition");
|
|
|
|
std::string DaytonaUSASaturnAds("Daytona USA (Saturn Ads)");
|
|
|
|
std::string DaytonaUSASpecialEdition("Daytona USA Special Edition");
|
|
|
|
std::string DaytonaUSATurbo("Daytona USA Turbo");
|
|
|
|
std::string DaytonaUSATurboRevA("Daytona USA Turbo (Rev A)");
|
|
|
|
std::string DaytonaUSAGTX2004("Daytona USA: GTX 2004");
|
|
|
|
std::string DaytonaUSAToTheMaxx("Daytona USA: To The Maxx");
|
|
|
|
std::string Indianapolis500RevADeluxe("Indianapolis 500 (Rev A, Deluxe)");
|
|
|
|
std::string Indianapolis500RevATwinNewerrev("Indianapolis 500 (Rev A, Twin, Newer rev)");
|
|
|
|
std::string Indianapolis500RevATwinOlderrev("Indianapolis 500 (Rev A, Twin, Older rev)");
|
|
|
|
std::string OverRev("Over Rev");
|
|
|
|
std::string OverRevModel2B("Over Rev (Model 2B)");
|
|
|
|
std::string SuperGT24h("Super GT 24h");
|
|
|
|
std::string SegaTouringCarChampionship("Sega Touring Car Championship");
|
|
|
|
std::string SegaTouringCarChampionshipRevA("Sega Touring Car Championship (Rev A)");
|
|
|
|
std::string SegaTouringCarChampionshipRevB("Sega Touring Car Championship (Rev B)");
|
|
|
|
|
2020-05-22 14:59:21 +02:00
|
|
|
//Config Settings
|
|
|
|
extern wchar_t* settingsFilename;
|
|
|
|
extern int DeviceGUID;
|
|
|
|
extern int configFeedbackLength;
|
|
|
|
extern int configGameId;
|
|
|
|
extern int configMinForce;
|
|
|
|
extern int configMaxForce;
|
|
|
|
extern int PowerMode;
|
|
|
|
extern int EnableRumble;
|
|
|
|
extern int ReverseRumble;
|
|
|
|
extern int configFeedbackLength;
|
|
|
|
extern int configAlternativeMinForceLeft;
|
|
|
|
extern int configAlternativeMaxForceLeft;
|
|
|
|
extern int configAlternativeMinForceRight;
|
|
|
|
extern int configAlternativeMaxForceRight;
|
|
|
|
extern int EnableForceSpringEffect;
|
|
|
|
extern int ForceSpringStrength;
|
2021-02-20 09:34:03 +01:00
|
|
|
extern int EnableDamper;
|
|
|
|
extern int DamperStrength;
|
2021-05-27 08:18:12 +02:00
|
|
|
static DWORD hookAddressM2A;
|
|
|
|
static DWORD hookAddressM2B;
|
|
|
|
static DWORD hookAddressM2C;
|
2022-03-23 05:01:01 +01:00
|
|
|
static UINT8 OldFFB;
|
2020-05-22 14:59:21 +02:00
|
|
|
|
2021-05-27 08:18:12 +02:00
|
|
|
static int InputDeviceWheelEnable = GetPrivateProfileInt(TEXT("Settings"), TEXT("InputDeviceWheelEnable"), 0, settingsFilename);
|
2019-12-12 23:05:01 +01:00
|
|
|
static int DaytonaAIMultiplayerHack = GetPrivateProfileInt(TEXT("Settings"), TEXT("DaytonaAIMultiplayerHack"), 0, settingsFilename);
|
|
|
|
static int DaytonaForcePanoramicAttract = GetPrivateProfileInt(TEXT("Settings"), TEXT("DaytonaForcePanoramicAttract"), 0, settingsFilename);
|
2020-03-13 23:05:19 +01:00
|
|
|
static int EnableOutputs = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableOutputs"), 0, settingsFilename);
|
2019-12-12 23:05:01 +01:00
|
|
|
|
2020-05-22 14:59:21 +02:00
|
|
|
static int configMinForceDaytona = GetPrivateProfileInt(TEXT("Settings"), TEXT("MinForceDaytona"), 0, settingsFilename);
|
|
|
|
static int configMaxForceDaytona = GetPrivateProfileInt(TEXT("Settings"), TEXT("MaxForceDaytona"), 100, settingsFilename);
|
|
|
|
static int configAlternativeMinForceLeftDaytona = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceLeftDaytona"), 0, settingsFilename);
|
|
|
|
static int configAlternativeMaxForceLeftDaytona = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceLeftDaytona"), 100, settingsFilename);
|
|
|
|
static int configAlternativeMinForceRightDaytona = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceRightDaytona"), 0, settingsFilename);
|
|
|
|
static int configAlternativeMaxForceRightDaytona = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceRightDaytona"), 100, settingsFilename);
|
|
|
|
static int configFeedbackLengthDaytona = GetPrivateProfileInt(TEXT("Settings"), TEXT("FeedbackLengthDaytona"), 120, settingsFilename);
|
|
|
|
static int PowerModeDaytona = GetPrivateProfileInt(TEXT("Settings"), TEXT("PowerModeDaytona"), 0, settingsFilename);
|
|
|
|
static int EnableForceSpringEffectDaytona = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceSpringEffectDaytona"), 0, settingsFilename);
|
|
|
|
static int ForceSpringStrengthDaytona = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrengthDaytona"), 0, settingsFilename);
|
2021-02-20 09:34:03 +01:00
|
|
|
static int EnableDamperDaytona = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableDamperDaytona"), 0, settingsFilename);
|
|
|
|
static int DamperStrengthDaytona = GetPrivateProfileInt(TEXT("Settings"), TEXT("DamperStrengthDaytona"), 100, settingsFilename);
|
2020-05-22 14:59:21 +02:00
|
|
|
|
|
|
|
static int configMinForceSRally = GetPrivateProfileInt(TEXT("Settings"), TEXT("MinForceSRally"), 0, settingsFilename);
|
|
|
|
static int configMaxForceSRally = GetPrivateProfileInt(TEXT("Settings"), TEXT("MaxForceSRally"), 100, settingsFilename);
|
|
|
|
static int configAlternativeMinForceLeftSRally = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceLeftSRally"), 0, settingsFilename);
|
|
|
|
static int configAlternativeMaxForceLeftSRally = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceLeftSRally"), 100, settingsFilename);
|
|
|
|
static int configAlternativeMinForceRightSRally = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceRightSRally"), 0, settingsFilename);
|
|
|
|
static int configAlternativeMaxForceRightSRally = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceRightSRally"), 100, settingsFilename);
|
|
|
|
static int configFeedbackLengthSRally = GetPrivateProfileInt(TEXT("Settings"), TEXT("FeedbackLengthSRally"), 120, settingsFilename);
|
|
|
|
static int PowerModeSRally = GetPrivateProfileInt(TEXT("Settings"), TEXT("PowerModeSRally"), 0, settingsFilename);
|
|
|
|
static int EnableForceSpringEffectSRally = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceSpringEffectSRally"), 0, settingsFilename);
|
|
|
|
static int ForceSpringStrengthSRally = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrengthSRally"), 0, settingsFilename);
|
2021-02-20 09:34:03 +01:00
|
|
|
static int EnableDamperSRally = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableDamperSRally"), 0, settingsFilename);
|
|
|
|
static int DamperStrengthSRally = GetPrivateProfileInt(TEXT("Settings"), TEXT("DamperStrengthSRally"), 100, settingsFilename);
|
2020-05-22 14:59:21 +02:00
|
|
|
|
|
|
|
static int configMinForceIndy500 = GetPrivateProfileInt(TEXT("Settings"), TEXT("MinForceIndy500"), 0, settingsFilename);
|
|
|
|
static int configMaxForceIndy500 = GetPrivateProfileInt(TEXT("Settings"), TEXT("MaxForceIndy500"), 100, settingsFilename);
|
|
|
|
static int configAlternativeMinForceLeftIndy500 = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceLeftIndy500"), 0, settingsFilename);
|
|
|
|
static int configAlternativeMaxForceLeftIndy500 = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceLeftIndy500"), 100, settingsFilename);
|
|
|
|
static int configAlternativeMinForceRightIndy500 = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceRightIndy500"), 0, settingsFilename);
|
|
|
|
static int configAlternativeMaxForceRightIndy500 = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceRightIndy500"), 100, settingsFilename);
|
|
|
|
static int configFeedbackLengthIndy500 = GetPrivateProfileInt(TEXT("Settings"), TEXT("FeedbackLengthIndy500"), 120, settingsFilename);
|
|
|
|
static int PowerModeIndy500 = GetPrivateProfileInt(TEXT("Settings"), TEXT("PowerModeIndy500"), 0, settingsFilename);
|
|
|
|
static int EnableForceSpringEffectIndy500 = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceSpringEffectIndy500"), 0, settingsFilename);
|
|
|
|
static int ForceSpringStrengthIndy500 = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrengthIndy500"), 0, settingsFilename);
|
2021-02-20 09:34:03 +01:00
|
|
|
static int EnableDamperIndy500 = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableDamperIndy500"), 0, settingsFilename);
|
|
|
|
static int DamperStrengthIndy500 = GetPrivateProfileInt(TEXT("Settings"), TEXT("DamperStrengthIndy500"), 100, settingsFilename);
|
2020-05-22 14:59:21 +02:00
|
|
|
|
|
|
|
static int configMinForceSTCC = GetPrivateProfileInt(TEXT("Settings"), TEXT("MinForceSTCC"), 0, settingsFilename);
|
|
|
|
static int configMaxForceSTCC = GetPrivateProfileInt(TEXT("Settings"), TEXT("MaxForceSTCC"), 100, settingsFilename);
|
|
|
|
static int configAlternativeMinForceLeftSTCC = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceLeftSTCC"), 0, settingsFilename);
|
|
|
|
static int configAlternativeMaxForceLeftSTCC = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceLeftSTCC"), 100, settingsFilename);
|
|
|
|
static int configAlternativeMinForceRightSTCC = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceRightSTCC"), 0, settingsFilename);
|
|
|
|
static int configAlternativeMaxForceRightSTCC = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceRightSTCC"), 100, settingsFilename);
|
|
|
|
static int configFeedbackLengthSTCC = GetPrivateProfileInt(TEXT("Settings"), TEXT("FeedbackLengthSTCC"), 120, settingsFilename);
|
|
|
|
static int PowerModeSTCC = GetPrivateProfileInt(TEXT("Settings"), TEXT("PowerModeSTCC"), 0, settingsFilename);
|
|
|
|
static int EnableForceSpringEffectSTCC = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceSpringEffectSTCC"), 0, settingsFilename);
|
|
|
|
static int ForceSpringStrengthSTCC = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrengthSTCC"), 0, settingsFilename);
|
2021-02-20 09:34:03 +01:00
|
|
|
static int EnableDamperSTCC = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableDamperSTCC"), 0, settingsFilename);
|
|
|
|
static int DamperStrengthSTCC = GetPrivateProfileInt(TEXT("Settings"), TEXT("DamperStrengthSTCC"), 100, settingsFilename);
|
2020-05-22 14:59:21 +02:00
|
|
|
|
|
|
|
static int configMinForceOverRev = GetPrivateProfileInt(TEXT("Settings"), TEXT("MinForceOverRev"), 0, settingsFilename);
|
|
|
|
static int configMaxForceOverRev = GetPrivateProfileInt(TEXT("Settings"), TEXT("MaxForceOverRev"), 100, settingsFilename);
|
|
|
|
static int configAlternativeMinForceLeftOverRev = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceLeftOverRev"), 0, settingsFilename);
|
|
|
|
static int configAlternativeMaxForceLeftOverRev = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceLeftOverRev"), 100, settingsFilename);
|
|
|
|
static int configAlternativeMinForceRightOverRev = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceRightOverRev"), 0, settingsFilename);
|
|
|
|
static int configAlternativeMaxForceRightOverRev = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceRightOverRev"), 100, settingsFilename);
|
|
|
|
static int configFeedbackLengthOverRev = GetPrivateProfileInt(TEXT("Settings"), TEXT("FeedbackLengthOverRev"), 120, settingsFilename);
|
|
|
|
static int PowerModeOverRev = GetPrivateProfileInt(TEXT("Settings"), TEXT("PowerModeOverRev"), 0, settingsFilename);
|
|
|
|
static int EnableForceSpringEffectOverRev = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceSpringEffectOverRev"), 0, settingsFilename);
|
|
|
|
static int ForceSpringStrengthOverRev = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrengthOverRev"), 0, settingsFilename);
|
2021-02-20 09:34:03 +01:00
|
|
|
static int EnableDamperOverRev = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableDamperOverRev"), 0, settingsFilename);
|
|
|
|
static int DamperStrengthOverRev = GetPrivateProfileInt(TEXT("Settings"), TEXT("DamperStrengthOverRev"), 100, settingsFilename);
|
2020-05-22 14:59:21 +02:00
|
|
|
|
|
|
|
static int configMinForceSuperGT = GetPrivateProfileInt(TEXT("Settings"), TEXT("MinForceSuperGT"), 0, settingsFilename);
|
|
|
|
static int configMaxForceSuperGT = GetPrivateProfileInt(TEXT("Settings"), TEXT("MaxForceSuperGT"), 100, settingsFilename);
|
|
|
|
static int configAlternativeMinForceLeftSuperGT = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceLeftSuperGT"), 0, settingsFilename);
|
|
|
|
static int configAlternativeMaxForceLeftSuperGT = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceLeftSuperGT"), 100, settingsFilename);
|
|
|
|
static int configAlternativeMinForceRightSuperGT = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceRightSuperGT"), 0, settingsFilename);
|
|
|
|
static int configAlternativeMaxForceRightSuperGT = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceRightSuperGT"), 100, settingsFilename);
|
|
|
|
static int configFeedbackLengthSuperGT = GetPrivateProfileInt(TEXT("Settings"), TEXT("FeedbackLengthSuperGT"), 120, settingsFilename);
|
|
|
|
static int PowerModeSuperGT = GetPrivateProfileInt(TEXT("Settings"), TEXT("PowerModeSuperGT"), 0, settingsFilename);
|
|
|
|
static int EnableForceSpringEffectSuperGT = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceSpringEffectSuperGT"), 0, settingsFilename);
|
|
|
|
static int ForceSpringStrengthSuperGT = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrengthSuperGT"), 0, settingsFilename);
|
2021-02-20 09:34:03 +01:00
|
|
|
static int EnableDamperSuperGT = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableDamperSuperGT"), 0, settingsFilename);
|
|
|
|
static int DamperStrengthSuperGT = GetPrivateProfileInt(TEXT("Settings"), TEXT("DamperStrengthSuperGT"), 100, settingsFilename);
|
2020-05-22 14:59:21 +02:00
|
|
|
|
2021-05-27 08:18:12 +02:00
|
|
|
static HWND hWnd1;
|
|
|
|
static HWND hWnd2;
|
|
|
|
static HWND hWnd3;
|
|
|
|
static HWND hWnd4;
|
|
|
|
static HWND hWnd5;
|
|
|
|
static HWND hWnd6;
|
|
|
|
static HWND hWnd7;
|
|
|
|
static HWND hWnd8;
|
|
|
|
static HWND hWnd9;
|
|
|
|
static HWND hWnd10;
|
|
|
|
static HWND hWnd11;
|
|
|
|
static HWND hWnd12;
|
|
|
|
static HWND hWnd13;
|
|
|
|
static HWND hWnd14;
|
|
|
|
static HWND hWnd15;
|
|
|
|
static HWND hWnd16;
|
|
|
|
static HWND hWnd17;
|
|
|
|
static HWND hWnd18;
|
|
|
|
static HWND hWnd19;
|
|
|
|
static HWND hWnd20;
|
|
|
|
HWND hWndM2;
|
|
|
|
|
2019-06-20 06:59:31 +02:00
|
|
|
static bool init = false;
|
2021-05-27 08:18:12 +02:00
|
|
|
static bool inputinit = false;
|
2020-05-22 14:59:21 +02:00
|
|
|
static bool CustomStrengthInit = false;
|
2020-03-13 23:05:19 +01:00
|
|
|
static bool outputinit = false;
|
2019-06-20 06:59:31 +02:00
|
|
|
|
2020-05-22 14:59:21 +02:00
|
|
|
static UINT8 ff;
|
|
|
|
|
2021-05-27 08:18:12 +02:00
|
|
|
static void OldInputs(){}
|
|
|
|
|
2019-06-20 06:59:31 +02:00
|
|
|
static bool __stdcall ExitHook(UINT uExitCode)
|
|
|
|
{
|
2020-01-05 10:21:12 +01:00
|
|
|
ExitProcess(0);
|
2019-06-20 06:59:31 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-11-01 21:34:57 +01:00
|
|
|
static bool Hook(void * toHook, void * ourFunct, int len) {
|
2019-06-20 06:59:31 +02:00
|
|
|
if (len < 5) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD curProtection;
|
|
|
|
VirtualProtect(toHook, len, PAGE_EXECUTE_READWRITE, &curProtection);
|
|
|
|
|
|
|
|
memset(toHook, 0x90, len);
|
|
|
|
|
|
|
|
DWORD relativeAddress = ((DWORD)ourFunct - (DWORD)toHook) - 5;
|
|
|
|
|
|
|
|
*(BYTE*)toHook = 0xE9;
|
|
|
|
*(DWORD*)((DWORD)toHook + 1) = relativeAddress;
|
|
|
|
|
|
|
|
DWORD temp;
|
|
|
|
VirtualProtect(toHook, len, curProtection, &temp);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static DWORD jmpBackAddy;
|
2019-04-07 07:16:19 +02:00
|
|
|
|
2020-07-03 13:23:35 +02:00
|
|
|
char* romnameM2;
|
|
|
|
|
2021-05-27 08:18:12 +02:00
|
|
|
static int ThreadLoop()
|
|
|
|
{
|
|
|
|
if (hWnd1 > NULL || hWnd14 > NULL || hWnd15 > NULL)
|
|
|
|
{
|
|
|
|
if (InputDeviceWheelEnable)
|
|
|
|
M2EmulatorSegaRallyInputsEnabled(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hWnd2 > NULL || hWnd7 > NULL || hWnd8 > NULL || hWnd9 > NULL || hWnd10 > NULL || hWnd11 > NULL || hWnd12 > NULL || hWnd13 > NULL)
|
|
|
|
{
|
|
|
|
if (InputDeviceWheelEnable)
|
|
|
|
M2EmulatorDaytonaUSAInputsEnabled(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hWnd3 > NULL || hWnd4 > NULL || hWnd5 > NULL || hWnd6 > NULL || hWnd16 > NULL || hWnd17 > NULL || hWnd18 > NULL || hWnd19 > NULL || hWnd20 > NULL)
|
|
|
|
{
|
|
|
|
if (InputDeviceWheelEnable)
|
|
|
|
M2EmulatorIndy500InputsEnabled(0);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static DWORD WINAPI InputLoop(LPVOID lpParam)
|
|
|
|
{
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
ThreadLoop();
|
|
|
|
Sleep(16);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-01 21:34:57 +01:00
|
|
|
void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers) {
|
2019-12-12 23:05:01 +01:00
|
|
|
|
2021-05-27 08:18:12 +02:00
|
|
|
hWnd1 = FindWindowA(0, ("Sega Rally Championship"));
|
|
|
|
hWnd2 = FindWindowA(0, ("Daytona USA"));
|
|
|
|
hWnd3 = FindWindowA(0, ("Indianapolis 500 (Rev A, Deluxe)"));
|
|
|
|
hWnd4 = FindWindowA(0, ("Sega Touring Car Championship (Rev A)"));
|
|
|
|
hWnd5 = FindWindowA(0, ("Over Rev"));
|
|
|
|
hWnd6 = FindWindowA(0, ("Super GT 24h"));
|
|
|
|
hWnd7 = FindWindowA(0, ("Daytona USA '93 Edition"));
|
|
|
|
hWnd8 = FindWindowA(0, ("Daytona USA (Saturn Ads)"));
|
|
|
|
hWnd9 = FindWindowA(0, ("Daytona USA Special Edition"));
|
|
|
|
hWnd10 = FindWindowA(0, ("Daytona USA Turbo"));
|
|
|
|
hWnd11 = FindWindowA(0, ("Daytona USA Turbo (Rev A)"));
|
|
|
|
hWnd12 = FindWindowA(0, ("Daytona USA: GTX 2004"));
|
|
|
|
hWnd13 = FindWindowA(0, ("Daytona USA: To The Maxx"));
|
|
|
|
hWnd14 = FindWindowA(0, ("Sega Rally Championship (Rev B)"));
|
|
|
|
hWnd15 = FindWindowA(0, ("Sega Rally Pro Drivin'"));
|
|
|
|
hWnd16 = FindWindowA(0, ("Indianapolis 500 (Rev A, Twin, Newer rev)"));
|
|
|
|
hWnd17 = FindWindowA(0, ("Indianapolis 500 (Rev A, Twin, Older rev)"));
|
|
|
|
hWnd18 = FindWindowA(0, ("Sega Touring Car Championship"));
|
|
|
|
hWnd19 = FindWindowA(0, ("Sega Touring Car Championship (Rev B)"));
|
|
|
|
hWnd20 = FindWindowA(0, ("Over Rev (Model 2B)"));
|
2020-07-03 13:23:35 +02:00
|
|
|
|
|
|
|
romnameM2 = new char[256];
|
|
|
|
|
2021-05-27 08:18:12 +02:00
|
|
|
if (hWnd1 > NULL || hWnd2 > NULL || hWnd3 > NULL || hWnd4 > NULL || hWnd5 > NULL || hWnd6 > NULL || hWnd7 > NULL || hWnd8 > NULL || hWnd9 > NULL || hWnd10 > NULL ||
|
|
|
|
hWnd11 > NULL || hWnd12 > NULL || hWnd13 > NULL || hWnd14 > NULL || hWnd15 > NULL || hWnd16 > NULL || hWnd17 > NULL || hWnd18 > NULL || hWnd19 > NULL || hWnd20 > NULL)
|
|
|
|
{
|
|
|
|
if (InputDeviceWheelEnable)
|
|
|
|
{
|
|
|
|
hookAddressM2A = 0x4CA450;
|
|
|
|
hookAddressM2B = 0x4CB870;
|
|
|
|
hookAddressM2C = 0x4C9080;
|
|
|
|
helpers->WriteNop(0xCCA6B, 6, true);
|
|
|
|
|
|
|
|
int hookLength = 6;
|
|
|
|
|
|
|
|
if (hookAddressM2A)
|
|
|
|
{
|
|
|
|
jmpBackAddy = hookAddressM2A + hookLength;
|
|
|
|
Hook((void*)hookAddressM2A, OldInputs, hookLength);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hookAddressM2B)
|
|
|
|
{
|
|
|
|
jmpBackAddy = hookAddressM2B + hookLength;
|
|
|
|
Hook((void*)hookAddressM2B, OldInputs, hookLength);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hookAddressM2C)
|
|
|
|
{
|
|
|
|
jmpBackAddy = hookAddressM2C + hookLength;
|
|
|
|
Hook((void*)hookAddressM2C, OldInputs, hookLength);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-03 13:23:35 +02:00
|
|
|
if (hWnd1 > NULL)
|
|
|
|
{
|
2020-07-18 10:56:19 +02:00
|
|
|
sprintf(romnameM2, "%s", "Sega Rally Championship");
|
2021-05-27 08:18:12 +02:00
|
|
|
hWndM2 = hWnd1;
|
2020-07-03 13:23:35 +02:00
|
|
|
}
|
|
|
|
else if(hWnd2 > NULL)
|
|
|
|
{
|
2020-07-18 10:56:19 +02:00
|
|
|
sprintf(romnameM2, "%s", "Daytona USA");
|
2021-05-27 08:18:12 +02:00
|
|
|
hWndM2 = hWnd2;
|
2020-07-03 13:23:35 +02:00
|
|
|
}
|
|
|
|
else if (hWnd3 > NULL)
|
|
|
|
{
|
2020-07-18 10:56:19 +02:00
|
|
|
sprintf(romnameM2, "%s", "Indianapolis 500 (Rev A, Deluxe)");
|
2021-05-27 08:18:12 +02:00
|
|
|
hWndM2 = hWnd3;
|
2020-07-03 13:23:35 +02:00
|
|
|
}
|
|
|
|
else if (hWnd4 > NULL)
|
|
|
|
{
|
2020-07-18 10:56:19 +02:00
|
|
|
sprintf(romnameM2, "%s", "Sega Touring Car Championship (Rev A)");
|
2021-05-27 08:18:12 +02:00
|
|
|
hWndM2 = hWnd4;
|
2020-07-03 13:23:35 +02:00
|
|
|
}
|
|
|
|
else if (hWnd5 > NULL)
|
|
|
|
{
|
2020-07-18 10:56:19 +02:00
|
|
|
sprintf(romnameM2, "%s", "Over Rev");
|
2021-05-27 08:18:12 +02:00
|
|
|
hWndM2 = hWnd5;
|
2020-07-03 13:23:35 +02:00
|
|
|
}
|
|
|
|
else if (hWnd6 > NULL)
|
|
|
|
{
|
2020-07-18 10:56:19 +02:00
|
|
|
sprintf(romnameM2, "%s", "Super GT 24h");
|
2021-05-27 08:18:12 +02:00
|
|
|
hWndM2 = hWnd6;
|
2020-07-03 13:23:35 +02:00
|
|
|
}
|
|
|
|
else if (hWnd7 > NULL)
|
|
|
|
{
|
2020-07-18 10:56:19 +02:00
|
|
|
sprintf(romnameM2, "%s", "Daytona USA '93 Edition");
|
2021-05-27 08:18:12 +02:00
|
|
|
hWndM2 = hWnd7;
|
2020-07-03 13:23:35 +02:00
|
|
|
}
|
|
|
|
else if (hWnd8 > NULL)
|
|
|
|
{
|
2020-07-18 10:56:19 +02:00
|
|
|
sprintf(romnameM2, "%s", "Daytona USA (Saturn Ads)");
|
2021-05-27 08:18:12 +02:00
|
|
|
hWndM2 = hWnd8;
|
2020-07-03 13:23:35 +02:00
|
|
|
}
|
|
|
|
else if (hWnd9 > NULL)
|
|
|
|
{
|
2020-07-18 10:56:19 +02:00
|
|
|
sprintf(romnameM2, "%s", "Daytona USA Special Edition");
|
2021-05-27 08:18:12 +02:00
|
|
|
hWndM2 = hWnd9;
|
2020-07-03 13:23:35 +02:00
|
|
|
}
|
|
|
|
else if (hWnd10 > NULL)
|
|
|
|
{
|
2020-07-18 10:56:19 +02:00
|
|
|
sprintf(romnameM2, "%s", "Daytona USA Turbo");
|
2021-05-27 08:18:12 +02:00
|
|
|
hWndM2 = hWnd10;
|
2020-07-03 13:23:35 +02:00
|
|
|
}
|
|
|
|
else if (hWnd11 > NULL)
|
|
|
|
{
|
2020-07-18 10:56:19 +02:00
|
|
|
sprintf(romnameM2, "%s", "Daytona USA Turbo (Rev A)");
|
2021-05-27 08:18:12 +02:00
|
|
|
hWndM2 = hWnd11;
|
2020-07-03 13:23:35 +02:00
|
|
|
}
|
|
|
|
else if (hWnd12 > NULL)
|
|
|
|
{
|
2020-07-18 10:56:19 +02:00
|
|
|
sprintf(romnameM2, "%s", "Daytona USA: GTX 2004");
|
2021-05-27 08:18:12 +02:00
|
|
|
hWndM2 = hWnd12;
|
2020-07-03 13:23:35 +02:00
|
|
|
}
|
|
|
|
else if (hWnd13 > NULL)
|
|
|
|
{
|
2020-07-18 10:56:19 +02:00
|
|
|
sprintf(romnameM2, "%s", "Daytona USA: To The Maxx");
|
2021-05-27 08:18:12 +02:00
|
|
|
hWndM2 = hWnd13;
|
2020-07-03 13:23:35 +02:00
|
|
|
}
|
|
|
|
else if (hWnd14 > NULL)
|
|
|
|
{
|
2020-07-18 10:56:19 +02:00
|
|
|
sprintf(romnameM2, "%s", "Sega Rally Championship (Rev B)");
|
2021-05-27 08:18:12 +02:00
|
|
|
hWndM2 = hWnd14;
|
2020-07-03 13:23:35 +02:00
|
|
|
}
|
|
|
|
else if (hWnd15 > NULL)
|
|
|
|
{
|
2020-07-18 10:56:19 +02:00
|
|
|
sprintf(romnameM2, "%s", "Sega Rally Pro Drivin'");
|
2021-05-27 08:18:12 +02:00
|
|
|
hWndM2 = hWnd15;
|
2020-07-03 13:23:35 +02:00
|
|
|
}
|
|
|
|
else if (hWnd16 > NULL)
|
|
|
|
{
|
2020-07-18 10:56:19 +02:00
|
|
|
sprintf(romnameM2, "%s", "Indianapolis 500 (Rev A, Twin, Newer rev)");
|
2021-05-27 08:18:12 +02:00
|
|
|
hWndM2 = hWnd16;
|
2020-07-03 13:23:35 +02:00
|
|
|
}
|
|
|
|
else if (hWnd17 > NULL)
|
|
|
|
{
|
2020-07-18 10:56:19 +02:00
|
|
|
sprintf(romnameM2, "%s", "Indianapolis 500 (Rev A, Twin, Older rev)");
|
2021-05-27 08:18:12 +02:00
|
|
|
hWndM2 = hWnd17;
|
2020-07-03 13:23:35 +02:00
|
|
|
}
|
|
|
|
else if (hWnd18 > NULL)
|
|
|
|
{
|
2020-07-18 10:56:19 +02:00
|
|
|
sprintf(romnameM2, "%s", "Sega Touring Car Championship");
|
2021-05-27 08:18:12 +02:00
|
|
|
hWndM2 = hWnd18;
|
2020-07-03 13:23:35 +02:00
|
|
|
}
|
|
|
|
else if (hWnd19 > NULL)
|
|
|
|
{
|
2020-07-18 10:56:19 +02:00
|
|
|
sprintf(romnameM2, "%s", "Sega Touring Car Championship (Rev B)");
|
2021-05-27 08:18:12 +02:00
|
|
|
hWndM2 = hWnd19;
|
2020-07-03 13:23:35 +02:00
|
|
|
}
|
|
|
|
else if (hWnd20 > NULL)
|
|
|
|
{
|
2020-07-18 10:56:19 +02:00
|
|
|
sprintf(romnameM2, "%s", "Over Rev (Model 2B)");
|
2021-05-27 08:18:12 +02:00
|
|
|
hWndM2 = hWnd20;
|
2020-07-03 13:23:35 +02:00
|
|
|
}
|
2019-11-01 21:34:57 +01:00
|
|
|
|
2019-12-12 23:05:01 +01:00
|
|
|
if (EnableForceSpringEffect == 1)
|
|
|
|
{
|
|
|
|
triggers->Springi(ForceSpringStrength / 100.0);
|
|
|
|
}
|
2019-11-01 21:34:57 +01:00
|
|
|
|
2021-02-20 09:34:03 +01:00
|
|
|
if (EnableDamper == 1)
|
|
|
|
{
|
|
|
|
triggers->Damper(DamperStrength / 100.0);
|
|
|
|
}
|
|
|
|
|
2020-03-13 23:05:19 +01:00
|
|
|
if (!outputinit)
|
|
|
|
{
|
2021-05-27 08:18:12 +02:00
|
|
|
if (EnableOutputs)
|
2020-03-13 23:05:19 +01:00
|
|
|
{
|
|
|
|
HMODULE lib = LoadLibraryA("OutputBlaster.dll");
|
2020-05-22 14:59:21 +02:00
|
|
|
outputinit = true;
|
|
|
|
}
|
2020-03-13 23:05:19 +01:00
|
|
|
}
|
|
|
|
|
2021-05-27 08:18:12 +02:00
|
|
|
if (!inputinit)
|
|
|
|
{
|
|
|
|
if (InputDeviceWheelEnable)
|
|
|
|
CreateThread(NULL, 0, InputLoop, NULL, 0, NULL);
|
|
|
|
inputinit = true;
|
|
|
|
}
|
|
|
|
|
2019-11-01 21:34:57 +01:00
|
|
|
HMODULE hMod = GetModuleHandleA("KERNEL32.dll");
|
|
|
|
if (hMod)
|
2019-06-20 06:59:31 +02:00
|
|
|
{
|
2019-11-01 21:34:57 +01:00
|
|
|
if (!init)
|
2019-06-20 06:59:31 +02:00
|
|
|
{
|
2019-11-01 21:34:57 +01:00
|
|
|
int hookLength = 6;
|
|
|
|
DWORD hookAddress = (DWORD)GetProcAddress(GetModuleHandle(L"KERNEL32.dll"), "ExitProcess");
|
|
|
|
if (hookAddress)
|
2019-06-20 06:59:31 +02:00
|
|
|
{
|
2019-11-01 21:34:57 +01:00
|
|
|
jmpBackAddy = hookAddress + hookLength;
|
|
|
|
Hook((void*)hookAddress, ExitHook, hookLength);
|
|
|
|
init = true;
|
2019-06-20 06:59:31 +02:00
|
|
|
}
|
|
|
|
}
|
2019-11-01 21:34:57 +01:00
|
|
|
}
|
2019-06-20 06:59:31 +02:00
|
|
|
|
2020-05-22 14:59:21 +02:00
|
|
|
if ((hWnd2 > NULL) || (hWnd3 > NULL) || (hWnd4 > NULL) || (hWnd5 > NULL) || (hWnd6 > NULL) || (hWnd7 > NULL) || (hWnd8 > NULL) || (hWnd9 > NULL) || (hWnd10 > NULL) || (hWnd11 > NULL) || (hWnd12 > NULL) || (hWnd13 > NULL) ||(hWnd16 > NULL) || (hWnd17 > NULL) || (hWnd18 > NULL) || (hWnd19 > NULL) || (hWnd20 > NULL))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
std::string ffs = std::to_string(ff);
|
2019-11-02 09:35:28 +01:00
|
|
|
helpers->log((char*)ffs.c_str());
|
2019-11-01 21:34:57 +01:00
|
|
|
helpers->log("got value: ");
|
2019-11-02 09:35:28 +01:00
|
|
|
|
2020-05-22 14:59:21 +02:00
|
|
|
if ((ff > 0x09) && (ff < 0x18))
|
|
|
|
{
|
|
|
|
//Spring
|
|
|
|
double percentForce = (ff - 15) / 8.0;
|
|
|
|
double percentLength = 100;
|
|
|
|
triggers->Spring(percentForce);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((ff > 0x1F) && (ff < 0x28))
|
|
|
|
{
|
|
|
|
//Clutch
|
|
|
|
double percentForce = (ff - 31) / 8.0;
|
|
|
|
double percentLength = 100;
|
|
|
|
triggers->Friction(percentForce);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((ff > 0x2F) && (ff < 0x3D))
|
|
|
|
{
|
|
|
|
//Centering
|
|
|
|
double percentForce = (ff - 47) / 13.0;
|
|
|
|
double percentLength = 100;
|
|
|
|
triggers->Spring(percentForce);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((ff > 0x3F) && (ff < 0x48))
|
|
|
|
{
|
|
|
|
//Uncentering
|
|
|
|
double percentForce = (ff - 63) / 8.0;
|
|
|
|
double percentLength = 100;
|
2020-05-23 02:20:07 +02:00
|
|
|
triggers->Sine(40, 0, percentForce);
|
2020-05-22 14:59:21 +02:00
|
|
|
triggers->Rumble(percentForce, percentForce, percentLength);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((ff > 0x4F) && (ff < 0x58))
|
|
|
|
{
|
|
|
|
//Roll Left
|
|
|
|
double percentForce = (ff - 79) / 8.0;
|
|
|
|
double percentLength = 100;
|
|
|
|
triggers->Rumble(0, percentForce, percentLength);
|
|
|
|
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
|
|
|
}
|
|
|
|
else if ((ff > 0x5F) && (ff < 0x68))
|
|
|
|
{
|
|
|
|
//Roll Right
|
|
|
|
double percentForce = (ff - 95) / 8.0;
|
|
|
|
double percentLength = 100;
|
|
|
|
triggers->Rumble(percentForce, 0, percentLength);
|
|
|
|
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((hWnd1 > NULL) || (hWnd14 > NULL) || (hWnd15 > NULL))
|
|
|
|
{
|
|
|
|
if (!CustomStrengthInit)
|
|
|
|
{
|
|
|
|
CustomStrengthInit = true;
|
|
|
|
configMinForce = configMinForceSRally;
|
|
|
|
configMaxForce = configMaxForceSRally;
|
|
|
|
configAlternativeMinForceLeft = configAlternativeMinForceLeftSRally;
|
|
|
|
configAlternativeMaxForceLeft = configAlternativeMaxForceLeftSRally;
|
|
|
|
configAlternativeMinForceRight = configAlternativeMinForceRightSRally;
|
|
|
|
configAlternativeMaxForceRight = configAlternativeMaxForceRightSRally;
|
|
|
|
configFeedbackLength = configFeedbackLengthSRally;
|
|
|
|
PowerMode = PowerModeSRally;
|
|
|
|
EnableForceSpringEffect = EnableForceSpringEffectSRally;
|
|
|
|
ForceSpringStrength = ForceSpringStrengthSRally;
|
2021-02-20 09:34:03 +01:00
|
|
|
EnableDamper = EnableDamperSRally;
|
|
|
|
DamperStrength = DamperStrengthSRally;
|
2020-05-22 14:59:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
UINT8 ff1 = helpers->ReadByte(0x174CF4, /* isRelativeOffset*/ true); //SegaRallyChampionship
|
|
|
|
std::string ffs = std::to_string(ff1);
|
|
|
|
helpers->log((char*)ffs.c_str());
|
|
|
|
helpers->log("got value: ");
|
|
|
|
|
2022-03-23 05:01:01 +01:00
|
|
|
if (OldFFB != ff1)
|
2019-04-07 07:16:19 +02:00
|
|
|
{
|
2022-03-23 05:01:01 +01:00
|
|
|
if (ff1 >= 0xC0 && ff1 <= 0xDF)
|
|
|
|
{
|
|
|
|
helpers->log("moving wheel left");
|
|
|
|
double percentForce = (ff1 - 191) / 32.0;
|
|
|
|
double percentLength = 100;
|
|
|
|
|
|
|
|
triggers->Rumble(0, percentForce, percentLength);
|
|
|
|
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ff1 >= 0x80 && ff1 <= 0x9F)
|
|
|
|
{
|
|
|
|
helpers->log("moving wheel right");
|
|
|
|
double percentForce = (ff1 - 127) / 32.0;
|
|
|
|
double percentLength = 100;
|
|
|
|
|
|
|
|
triggers->Rumble(percentForce, 0, percentLength);
|
|
|
|
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
|
|
|
}
|
2019-11-01 21:34:57 +01:00
|
|
|
}
|
2022-03-23 05:01:01 +01:00
|
|
|
OldFFB = ff1;
|
2020-05-22 14:59:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((hWnd2 > NULL) || (hWnd7 > NULL) || (hWnd8 > NULL) || (hWnd9 > NULL) || (hWnd10 > NULL) || (hWnd11 > NULL) || (hWnd12 > NULL) || (hWnd13 > NULL))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
2020-05-22 14:59:21 +02:00
|
|
|
if (!CustomStrengthInit)
|
|
|
|
{
|
|
|
|
CustomStrengthInit = true;
|
|
|
|
configMinForce = configMinForceDaytona;
|
|
|
|
configMaxForce = configMaxForceDaytona;
|
|
|
|
configAlternativeMinForceLeft = configAlternativeMinForceLeftDaytona;
|
|
|
|
configAlternativeMaxForceLeft = configAlternativeMaxForceLeftDaytona;
|
|
|
|
configAlternativeMinForceRight = configAlternativeMinForceRightDaytona;
|
|
|
|
configAlternativeMaxForceRight = configAlternativeMaxForceRightDaytona;
|
|
|
|
configFeedbackLength = configFeedbackLengthDaytona;
|
|
|
|
PowerMode = PowerModeDaytona;
|
|
|
|
EnableForceSpringEffect = EnableForceSpringEffectDaytona;
|
|
|
|
ForceSpringStrength = ForceSpringStrengthDaytona;
|
2021-02-20 09:34:03 +01:00
|
|
|
EnableDamper = EnableDamperDaytona;
|
|
|
|
DamperStrength = DamperStrengthDaytona;
|
2020-05-22 14:59:21 +02:00
|
|
|
}
|
|
|
|
|
2019-11-01 21:34:57 +01:00
|
|
|
if (DaytonaForcePanoramicAttract == 1)
|
|
|
|
{
|
|
|
|
INT_PTR Rambase = helpers->ReadIntPtr(0x1AA888, /* isRelativeOffset*/ true);
|
|
|
|
INT_PTR Rambase1 = helpers->ReadIntPtr(Rambase + 0x100, /* isRelativeOffset */ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1070, 0x00, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2019-04-07 07:16:19 +02:00
|
|
|
|
2019-11-01 21:34:57 +01:00
|
|
|
if (DaytonaAIMultiplayerHack == 1)
|
|
|
|
{
|
|
|
|
INT_PTR Rambase = helpers->ReadIntPtr(0x1AA888, /* isRelativeOffset*/ true);
|
|
|
|
INT_PTR Rambase1 = helpers->ReadIntPtr(Rambase + 0x100, /* isRelativeOffset */ false);
|
|
|
|
UINT8 gamestate = helpers->ReadByte(Rambase1 + 0x10A4, /* isRelativeOffset*/ false);
|
|
|
|
UINT8 track = helpers->ReadByte(Rambase1 + 0x1460, /* isRelativeOffset*/ false);
|
|
|
|
UINT8 trackselect = helpers->ReadByte(Rambase1 + 0x1468, /* isRelativeOffset*/ false);
|
|
|
|
UINT8 countdown = helpers->ReadByte(Rambase1 + 0x1850, /* isRelativeOffset*/ false);
|
|
|
|
UINT8 linksize = helpers->ReadByte(Rambase1 + 0x40001, /* isRelativeOffset*/ false);
|
|
|
|
UINT8 linkID = helpers->ReadByte(Rambase1 + 0x40002, /* isRelativeOffset*/ false);
|
|
|
|
INT_PTR gamestatetimer = helpers->ReadIntPtr(Rambase1 + 0x10A8, /* isRelativeOffset*/ false);
|
|
|
|
UINT8 camhack = helpers->ReadByte(Rambase1 + 0x14A4, /* isRelativeOffset*/ false);
|
|
|
|
UINT8 carsinfront = helpers->ReadByte(Rambase1 + 0x51EC, /* isRelativeOffset*/ false);
|
|
|
|
UINT8 mpposition = helpers->ReadByte(Rambase1 + 0x51ED, /* isRelativeOffset*/ false);
|
|
|
|
float cary = helpers->ReadFloat32(Rambase1 + 0x519C, /* isRelativeOffset */ false);
|
|
|
|
float carx = helpers->ReadFloat32(Rambase1 + 0x51A4, /* isRelativeOffset */ false);
|
|
|
|
UINT8 nop1 = helpers->ReadByte(0xC2130, /* isRelativeOffset*/ true);
|
|
|
|
UINT8 nop2 = helpers->ReadByte(0xC2131, /* isRelativeOffset*/ true);
|
|
|
|
UINT8 nop3 = helpers->ReadByte(0xC2132, /* isRelativeOffset*/ true);
|
|
|
|
|
|
|
|
|
|
|
|
if (gamestate == 0x1A)
|
|
|
|
{
|
|
|
|
helpers->WriteByte(Rambase1 + 0x51ED, carsinfront, /* isRelativeOffset*/ false);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (trackselect == 0x01)
|
|
|
|
{
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1460, 0x02, /* isRelativeOffset*/ false);
|
|
|
|
}
|
|
|
|
else if (trackselect == 0x02)
|
|
|
|
{
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1460, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (linksize == 0x02)
|
|
|
|
{
|
|
|
|
if (linkID == 0x02)
|
2019-04-07 07:16:19 +02:00
|
|
|
{
|
2019-11-01 21:34:57 +01:00
|
|
|
if (gamestate > 0x07)
|
|
|
|
{
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540C80, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestate == 0x16) && (countdown == 0x00) && (track == 0x00))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
Sleep(150);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x02 || track == 0x01))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2019-11-01 06:30:36 +01:00
|
|
|
}
|
2019-11-01 21:34:57 +01:00
|
|
|
else if (linkID == 0x01)
|
2019-11-01 06:30:36 +01:00
|
|
|
{
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestate == 0x1A) && (gamestatetimer < 100))
|
2019-11-01 06:30:36 +01:00
|
|
|
{
|
2019-11-01 21:34:57 +01:00
|
|
|
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true);
|
2019-11-01 06:30:36 +01:00
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
else if ((gamestate == 0x1A) && (gamestatetimer > 100))
|
2019-11-01 06:30:36 +01:00
|
|
|
{
|
2019-11-01 21:34:57 +01:00
|
|
|
Sleep(100);
|
2020-06-06 10:08:40 +02:00
|
|
|
helpers->WriteNop(0xC2130, 3, true);
|
2019-11-01 21:34:57 +01:00
|
|
|
}
|
2019-11-01 06:30:36 +01:00
|
|
|
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestate > 0x1A) && (gamestate < 0x1A))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true);
|
|
|
|
}
|
2019-11-01 06:30:36 +01:00
|
|
|
|
2019-11-01 21:34:57 +01:00
|
|
|
if (gamestate > 0x07)
|
|
|
|
{
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540C80, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestatetimer > 4294964133) && (gamestate == 0x12))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestate == 0x16) && (countdown == 0x00) && (track == 0x00))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x02 || track == 0x01))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteFloat32(Rambase1 + 0x519C, 0.0, /* isRelativeOffset */ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false);
|
2019-04-07 07:16:19 +02:00
|
|
|
}
|
2019-11-01 06:30:36 +01:00
|
|
|
}
|
2019-11-01 21:34:57 +01:00
|
|
|
}
|
|
|
|
else if (linksize == 0x03)
|
|
|
|
{
|
|
|
|
if (linkID == 0x03)
|
2019-11-01 06:30:36 +01:00
|
|
|
{
|
2019-11-01 21:34:57 +01:00
|
|
|
if (gamestate > 0x07)
|
2019-11-01 06:30:36 +01:00
|
|
|
{
|
2019-11-01 21:34:57 +01:00
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540CC0, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540CC0, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false);
|
2019-11-01 06:30:36 +01:00
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestate == 0x16) && (countdown == 0x00) && (track == 0x00))
|
2019-11-01 06:30:36 +01:00
|
|
|
{
|
2019-11-01 21:34:57 +01:00
|
|
|
Sleep(250);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false);
|
2019-11-01 06:30:36 +01:00
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x02 || track == 0x01))
|
2019-11-01 06:30:36 +01:00
|
|
|
{
|
2019-11-01 21:34:57 +01:00
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestatetimer > 4294964133) && (gamestate == 0x12))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (linkID == 0x02)
|
|
|
|
{
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestate == 0x1A) && (gamestatetimer < 100))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
else if ((gamestate == 0x1A) && (gamestatetimer > 100))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
Sleep(100);
|
2020-06-06 10:08:40 +02:00
|
|
|
helpers->WriteNop(0xC2130, 3, true);
|
2019-11-01 21:34:57 +01:00
|
|
|
}
|
2019-11-01 06:30:36 +01:00
|
|
|
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestate > 0x1A) && (gamestate < 0x1A))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true);
|
|
|
|
}
|
|
|
|
if (gamestate > 0x07)
|
|
|
|
{
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5784, 0x00, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestate == 0x16) && (countdown == 0x00) && (track == 0x00))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
Sleep(150);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x02 || track == 0x01))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestatetimer > 4294964133) && (gamestate == 0x12))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false);
|
2019-04-07 07:16:19 +02:00
|
|
|
}
|
2019-11-01 06:30:36 +01:00
|
|
|
}
|
2019-11-01 21:34:57 +01:00
|
|
|
else if (linkID == 0x01)
|
2019-11-01 06:30:36 +01:00
|
|
|
{
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestate == 0x1A) && (gamestatetimer < 100))
|
2019-11-01 06:30:36 +01:00
|
|
|
{
|
2019-11-01 21:34:57 +01:00
|
|
|
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true);
|
2019-11-01 06:30:36 +01:00
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
else if ((gamestate == 0x1A) && (gamestatetimer > 100))
|
2019-11-01 06:30:36 +01:00
|
|
|
{
|
2019-11-01 21:34:57 +01:00
|
|
|
Sleep(100);
|
2020-06-06 10:08:40 +02:00
|
|
|
helpers->WriteNop(0xC2130, 3, true);
|
2019-11-01 21:34:57 +01:00
|
|
|
}
|
2019-11-01 06:30:36 +01:00
|
|
|
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestate > 0x1A) && (gamestate < 0x1A))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true);
|
|
|
|
}
|
2019-11-01 06:30:36 +01:00
|
|
|
|
2019-11-01 21:34:57 +01:00
|
|
|
if (gamestate > 0x07)
|
|
|
|
{
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C80, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false);
|
2019-11-01 06:30:36 +01:00
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestatetimer > 4294964133) && (gamestate == 0x12))
|
2019-11-01 06:30:36 +01:00
|
|
|
{
|
2019-11-01 21:34:57 +01:00
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestate == 0x16) && (countdown == 0x00) && (track == 0x00))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x01))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC2F195E8, /* isRelativeOffset */ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x02))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37E0001, /* isRelativeOffset */ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (linksize == 0x04)
|
|
|
|
{
|
|
|
|
if (linkID == 0x04)
|
|
|
|
{
|
|
|
|
if (gamestate > 0x07)
|
|
|
|
{
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540D00, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540D00, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestate == 0x16) && (countdown == 0x00) && (track == 0x00))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
Sleep(250);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x01))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC302CAF4, /* isRelativeOffset */ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x02))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37C0001, /* isRelativeOffset */ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestatetimer > 4294964133) && (gamestate == 0x12))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (linkID == 0x03)
|
|
|
|
{
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestate == 0x1A) && (gamestatetimer < 100))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
else if ((gamestate == 0x1A) && (gamestatetimer > 100))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
Sleep(100);
|
2020-06-06 10:08:40 +02:00
|
|
|
helpers->WriteNop(0xC2130, 3, true);
|
2019-11-01 21:34:57 +01:00
|
|
|
}
|
2019-11-01 06:30:36 +01:00
|
|
|
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestate > 0x1A) && (gamestate < 0x1A))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true);
|
2019-11-01 06:30:36 +01:00
|
|
|
}
|
2019-11-01 21:34:57 +01:00
|
|
|
|
|
|
|
if (gamestate > 0x07)
|
2019-11-01 06:30:36 +01:00
|
|
|
{
|
2019-11-01 21:34:57 +01:00
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5A84, 0x00, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestate == 0x16) && (countdown == 0x00) && (track == 0x00))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
Sleep(350);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x02))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false);
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37CF3D0, /* isRelativeOffset */ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x01))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestatetimer > 4294964133) && (gamestate == 0x12))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (linkID == 0x02)
|
|
|
|
{
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestate == 0x1A) && (gamestatetimer < 100))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
else if ((gamestate == 0x1A) && (gamestatetimer > 100))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
Sleep(100);
|
2020-06-06 10:08:40 +02:00
|
|
|
helpers->WriteNop(0xC2130, 3, true);
|
2019-11-01 21:34:57 +01:00
|
|
|
}
|
2019-11-01 06:30:36 +01:00
|
|
|
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestate > 0x1A) && (gamestate < 0x1A))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true);
|
|
|
|
}
|
|
|
|
if (gamestate > 0x07)
|
|
|
|
{
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C80, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5784, 0x00, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestate == 0x16) && (countdown == 0x00) && (track == 0x00))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
Sleep(150);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x02 || track == 0x01))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestatetimer > 4294964133) && (gamestate == 0x12))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (linkID == 0x01)
|
|
|
|
{
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestate == 0x1A) && (gamestatetimer < 100))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
else if ((gamestate == 0x1A) && (gamestatetimer > 100))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
Sleep(100);
|
2020-06-06 10:08:40 +02:00
|
|
|
helpers->WriteNop(0xC2130, 3, true);
|
2019-11-01 21:34:57 +01:00
|
|
|
}
|
2019-11-01 06:30:36 +01:00
|
|
|
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestate > 0x1A) && (gamestate < 0x1A))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gamestate > 0x07)
|
|
|
|
{
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540CC0, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540CC0, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestatetimer > 4294964133) && (gamestate == 0x12))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
if ((gamestate == 0x16) && (countdown == 0x00) && (track == 0x00))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x01))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC2F195E8, /* isRelativeOffset */ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
}
|
2023-03-05 04:27:08 +01:00
|
|
|
else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x02))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
|
|
|
|
Sleep(50);
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37E0001, /* isRelativeOffset */ false);
|
|
|
|
helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-22 14:59:21 +02:00
|
|
|
ff = helpers->ReadByte(0x0057285B, /* isRelativeOffset*/ false); //DaytonaUSA
|
|
|
|
}
|
2019-11-01 21:34:57 +01:00
|
|
|
|
2020-05-22 14:59:21 +02:00
|
|
|
if ((hWnd3 > NULL) || (hWnd16 > NULL) || (hWnd17 > NULL))
|
2019-11-01 21:48:38 +01:00
|
|
|
{
|
2020-05-22 14:59:21 +02:00
|
|
|
if (!CustomStrengthInit)
|
2019-11-02 09:35:28 +01:00
|
|
|
{
|
2020-05-22 14:59:21 +02:00
|
|
|
CustomStrengthInit = true;
|
|
|
|
configMinForce = configMinForceIndy500;
|
|
|
|
configMaxForce = configMaxForceIndy500;
|
|
|
|
configAlternativeMinForceLeft = configAlternativeMinForceLeftIndy500;
|
|
|
|
configAlternativeMaxForceLeft = configAlternativeMaxForceLeftIndy500;
|
|
|
|
configAlternativeMinForceRight = configAlternativeMinForceRightIndy500;
|
|
|
|
configAlternativeMaxForceRight = configAlternativeMaxForceRightIndy500;
|
|
|
|
configFeedbackLength = configFeedbackLengthIndy500;
|
|
|
|
PowerMode = PowerModeIndy500;
|
|
|
|
EnableForceSpringEffect = EnableForceSpringEffectIndy500;
|
|
|
|
ForceSpringStrength = ForceSpringStrengthIndy500;
|
2021-02-20 09:34:03 +01:00
|
|
|
EnableDamper = EnableDamperIndy500;
|
|
|
|
DamperStrength = DamperStrengthIndy500;
|
2019-11-02 09:35:28 +01:00
|
|
|
}
|
|
|
|
|
2020-05-22 14:59:21 +02:00
|
|
|
ff = helpers->ReadByte(0x17285B, /* isRelativeOffset*/ true); //Indy500
|
|
|
|
}
|
2019-11-02 09:35:28 +01:00
|
|
|
|
2020-05-22 14:59:21 +02:00
|
|
|
if ((hWnd4 > NULL) || (hWnd18 > NULL) || (hWnd19 > NULL))
|
|
|
|
{
|
|
|
|
if (!CustomStrengthInit)
|
2019-11-02 09:35:28 +01:00
|
|
|
{
|
2020-05-22 14:59:21 +02:00
|
|
|
CustomStrengthInit = true;
|
|
|
|
configMinForce = configMinForceSTCC;
|
|
|
|
configMaxForce = configMaxForceSTCC;
|
|
|
|
configAlternativeMinForceLeft = configAlternativeMinForceLeftSTCC;
|
|
|
|
configAlternativeMaxForceLeft = configAlternativeMaxForceLeftSTCC;
|
|
|
|
configAlternativeMinForceRight = configAlternativeMinForceRightSTCC;
|
|
|
|
configAlternativeMaxForceRight = configAlternativeMaxForceRightSTCC;
|
|
|
|
configFeedbackLength = configFeedbackLengthSTCC;
|
|
|
|
PowerMode = PowerModeSTCC;
|
|
|
|
EnableForceSpringEffect = EnableForceSpringEffectSTCC;
|
|
|
|
ForceSpringStrength = ForceSpringStrengthSTCC;
|
2021-02-20 09:34:03 +01:00
|
|
|
EnableDamper = EnableDamperSTCC;
|
|
|
|
DamperStrength = DamperStrengthSTCC;
|
2019-11-02 09:35:28 +01:00
|
|
|
}
|
2020-05-22 14:59:21 +02:00
|
|
|
|
|
|
|
ff = helpers->ReadByte(0x17285B, /* isRelativeOffset*/ true); //Sega Touring Car Championship
|
2019-11-02 09:35:28 +01:00
|
|
|
}
|
|
|
|
|
2020-05-22 14:59:21 +02:00
|
|
|
if ((hWnd5 > NULL) || (hWnd20 > NULL))
|
|
|
|
{
|
|
|
|
if (!CustomStrengthInit)
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
2020-05-22 14:59:21 +02:00
|
|
|
CustomStrengthInit = true;
|
|
|
|
configMinForce = configMinForceOverRev;
|
|
|
|
configMaxForce = configMaxForceOverRev;
|
|
|
|
configAlternativeMinForceLeft = configAlternativeMinForceLeftOverRev;
|
|
|
|
configAlternativeMaxForceLeft = configAlternativeMaxForceLeftOverRev;
|
|
|
|
configAlternativeMinForceRight = configAlternativeMinForceRightOverRev;
|
|
|
|
configAlternativeMaxForceRight = configAlternativeMaxForceRightOverRev;
|
|
|
|
configFeedbackLength = configFeedbackLengthOverRev;
|
|
|
|
PowerMode = PowerModeOverRev;
|
|
|
|
EnableForceSpringEffect = EnableForceSpringEffectOverRev;
|
|
|
|
ForceSpringStrength = ForceSpringStrengthOverRev;
|
2021-02-20 09:34:03 +01:00
|
|
|
EnableDamper = EnableDamperOverRev;
|
|
|
|
DamperStrength = DamperStrengthOverRev;
|
2019-11-01 21:34:57 +01:00
|
|
|
}
|
2020-05-22 14:59:21 +02:00
|
|
|
|
|
|
|
ff = helpers->ReadByte(0x17285B, /* isRelativeOffset*/ true); //OverRev
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hWnd6 > NULL)
|
|
|
|
{
|
|
|
|
if (!CustomStrengthInit)
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
2020-05-22 14:59:21 +02:00
|
|
|
CustomStrengthInit = true;
|
|
|
|
configMinForce = configMinForceSuperGT;
|
|
|
|
configMaxForce = configMaxForceSuperGT;
|
|
|
|
configAlternativeMinForceLeft = configAlternativeMinForceLeftSuperGT;
|
|
|
|
configAlternativeMaxForceLeft = configAlternativeMaxForceLeftSuperGT;
|
|
|
|
configAlternativeMinForceRight = configAlternativeMinForceRightSuperGT;
|
|
|
|
configAlternativeMaxForceRight = configAlternativeMaxForceRightSuperGT;
|
|
|
|
configFeedbackLength = configFeedbackLengthSuperGT;
|
|
|
|
PowerMode = PowerModeSuperGT;
|
|
|
|
EnableForceSpringEffect = EnableForceSpringEffectSuperGT;
|
|
|
|
ForceSpringStrength = ForceSpringStrengthSuperGT;
|
2021-02-20 09:34:03 +01:00
|
|
|
EnableDamper = EnableDamperSuperGT;
|
|
|
|
DamperStrength = DamperStrengthSuperGT;
|
2019-11-01 21:34:57 +01:00
|
|
|
}
|
2019-11-02 09:35:28 +01:00
|
|
|
|
2020-05-22 14:59:21 +02:00
|
|
|
ff = helpers->ReadByte(0x17285B, /* isRelativeOffset*/ true); //Super GT 24h
|
2019-11-02 09:35:28 +01:00
|
|
|
}
|
|
|
|
}
|