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"
|
|
|
|
|
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;
|
2020-05-22 14:59:21 +02:00
|
|
|
|
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
|
|
|
|
2019-06-20 06:59:31 +02:00
|
|
|
static bool init = 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;
|
|
|
|
|
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;
|
|
|
|
|
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
|
|
|
|
2020-07-18 10:56:19 +02:00
|
|
|
HWND hWnd1 = FindWindowA(0, ("Sega Rally Championship"));
|
|
|
|
HWND hWnd2 = FindWindowA(0, ("Daytona USA"));
|
|
|
|
HWND hWnd3 = FindWindowA(0, ("Indianapolis 500 (Rev A, Deluxe)"));
|
|
|
|
HWND hWnd4 = FindWindowA(0, ("Sega Touring Car Championship (Rev A)"));
|
|
|
|
HWND hWnd5 = FindWindowA(0, ("Over Rev"));
|
|
|
|
HWND hWnd6 = FindWindowA(0, ("Super GT 24h"));
|
|
|
|
HWND hWnd7 = FindWindowA(0, ("Daytona USA '93 Edition"));
|
|
|
|
HWND hWnd8 = FindWindowA(0, ("Daytona USA (Saturn Ads)"));
|
|
|
|
HWND hWnd9 = FindWindowA(0, ("Daytona USA Special Edition"));
|
|
|
|
HWND hWnd10 = FindWindowA(0, ("Daytona USA Turbo"));
|
|
|
|
HWND hWnd11 = FindWindowA(0, ("Daytona USA Turbo (Rev A)"));
|
|
|
|
HWND hWnd12 = FindWindowA(0, ("Daytona USA: GTX 2004"));
|
|
|
|
HWND hWnd13 = FindWindowA(0, ("Daytona USA: To The Maxx"));
|
|
|
|
HWND hWnd14 = FindWindowA(0, ("Sega Rally Championship (Rev B)"));
|
|
|
|
HWND hWnd15 = FindWindowA(0, ("Sega Rally Pro Drivin'"));
|
|
|
|
HWND hWnd16 = FindWindowA(0, ("Indianapolis 500 (Rev A, Twin, Newer rev)"));
|
|
|
|
HWND hWnd17 = FindWindowA(0, ("Indianapolis 500 (Rev A, Twin, Older rev)"));
|
|
|
|
HWND hWnd18 = FindWindowA(0, ("Sega Touring Car Championship"));
|
|
|
|
HWND hWnd19 = FindWindowA(0, ("Sega Touring Car Championship (Rev B)"));
|
|
|
|
HWND hWnd20 = FindWindowA(0, ("Over Rev (Model 2B)"));
|
2020-07-03 13:23:35 +02:00
|
|
|
|
|
|
|
romnameM2 = new char[256];
|
|
|
|
|
|
|
|
if (hWnd1 > NULL)
|
|
|
|
{
|
2020-07-18 10:56:19 +02:00
|
|
|
sprintf(romnameM2, "%s", "Sega Rally Championship");
|
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");
|
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)");
|
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)");
|
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");
|
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");
|
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");
|
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)");
|
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");
|
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");
|
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)");
|
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");
|
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");
|
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)");
|
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'");
|
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)");
|
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)");
|
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");
|
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)");
|
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)");
|
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)
|
|
|
|
{
|
|
|
|
if (EnableOutputs == 1)
|
|
|
|
{
|
|
|
|
HMODULE lib = LoadLibraryA("OutputBlaster.dll");
|
2020-05-22 14:59:21 +02:00
|
|
|
outputinit = true;
|
|
|
|
}
|
2020-03-13 23:05:19 +01:00
|
|
|
}
|
|
|
|
|
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: ");
|
|
|
|
|
|
|
|
if ((ff1 > 0xBF) && (ff1 < 0xDF))
|
2019-04-07 07:16:19 +02:00
|
|
|
{
|
2019-11-02 09:35:28 +01:00
|
|
|
helpers->log("moving wheel left");
|
2020-05-22 14:59:21 +02:00
|
|
|
double percentForce = (ff1 - 191) / 31.0;
|
2019-11-02 09:35:28 +01:00
|
|
|
double percentLength = 100;
|
|
|
|
triggers->Rumble(0, percentForce, percentLength);
|
|
|
|
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
2019-04-07 07:16:19 +02:00
|
|
|
}
|
2020-05-22 14:59:21 +02:00
|
|
|
else if ((ff1 > 0x7F) && (ff1 < 0x9F))
|
2019-04-07 07:16:19 +02:00
|
|
|
{
|
2019-11-02 09:35:28 +01:00
|
|
|
helpers->log("moving wheel right");
|
2020-05-22 14:59:21 +02:00
|
|
|
double percentForce = (ff1 - 127) / 31.0;
|
2019-11-02 09:35:28 +01:00
|
|
|
double percentLength = 100;
|
|
|
|
triggers->Rumble(percentForce, 0, percentLength);
|
|
|
|
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
2019-11-01 21:34:57 +01:00
|
|
|
}
|
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);
|
|
|
|
}
|
|
|
|
if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00))
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01))
|
|
|
|
{
|
|
|
|
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
|
|
|
{
|
2019-11-01 21:34:57 +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
|
|
|
}
|
2019-11-01 21:34:57 +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
|
|
|
|
2019-11-02 09:35:28 +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);
|
|
|
|
}
|
2019-11-02 09:35:28 +01:00
|
|
|
if ((gamestatetimer > 4294964133)& (gamestate == 0x12))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false);
|
|
|
|
}
|
|
|
|
if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00))
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01))
|
|
|
|
{
|
|
|
|
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
|
|
|
}
|
2019-11-01 21:34:57 +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
|
|
|
}
|
2019-11-01 21:34:57 +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);
|
|
|
|
}
|
2019-11-02 09:35:28 +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)
|
|
|
|
{
|
|
|
|
if ((gamestate == 0x1A) & (gamestatetimer < 100))
|
|
|
|
{
|
|
|
|
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true);
|
|
|
|
}
|
|
|
|
else if ((gamestate == 0x1A) & (gamestatetimer > 100))
|
|
|
|
{
|
|
|
|
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
|
|
|
|
2019-11-02 09:35:28 +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);
|
|
|
|
}
|
|
|
|
if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00))
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01))
|
|
|
|
{
|
|
|
|
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-02 09:35:28 +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
|
|
|
{
|
2019-11-01 21:34:57 +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
|
|
|
}
|
2019-11-01 21:34:57 +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
|
|
|
|
2019-11-02 09:35:28 +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
|
|
|
}
|
2019-11-02 09:35:28 +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);
|
|
|
|
}
|
|
|
|
if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00))
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01))
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02))
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00))
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01))
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02))
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
2019-11-02 09:35:28 +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)
|
|
|
|
{
|
|
|
|
if ((gamestate == 0x1A) & (gamestatetimer < 100))
|
|
|
|
{
|
|
|
|
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true);
|
|
|
|
}
|
|
|
|
else if ((gamestate == 0x1A) & (gamestatetimer > 100))
|
|
|
|
{
|
|
|
|
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
|
|
|
|
2019-11-02 09:35:28 +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);
|
|
|
|
}
|
|
|
|
if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00))
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02))
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01))
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
2019-11-02 09:35:28 +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)
|
|
|
|
{
|
|
|
|
if ((gamestate == 0x1A) & (gamestatetimer < 100))
|
|
|
|
{
|
|
|
|
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true);
|
|
|
|
}
|
|
|
|
else if ((gamestate == 0x1A) & (gamestatetimer > 100))
|
|
|
|
{
|
|
|
|
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
|
|
|
|
2019-11-02 09:35:28 +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);
|
|
|
|
}
|
|
|
|
if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00))
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01))
|
|
|
|
{
|
|
|
|
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-02 09:35:28 +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)
|
|
|
|
{
|
|
|
|
if ((gamestate == 0x1A) & (gamestatetimer < 100))
|
|
|
|
{
|
|
|
|
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
|
|
|
|
helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true);
|
|
|
|
}
|
|
|
|
else if ((gamestate == 0x1A) & (gamestatetimer > 100))
|
|
|
|
{
|
|
|
|
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
|
|
|
|
2019-11-02 09:35:28 +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);
|
|
|
|
}
|
2019-11-02 09:35:28 +01:00
|
|
|
if ((gamestatetimer > 4294964133)& (gamestate == 0x12))
|
2019-11-01 21:34:57 +01:00
|
|
|
{
|
|
|
|
helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false);
|
|
|
|
}
|
|
|
|
if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00))
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01))
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02))
|
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|