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

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
nzgamer41 2021-08-25 18:41:39 +12:00
commit 3caa6df704
27 changed files with 5049 additions and 832 deletions

View File

@ -0,0 +1,869 @@
#include <Utility/InitFunction.h>
#include <StdInc.h>
#include <thread>
#ifdef _M_AMD64
#include "Functions\Global.h"
#include "APM3.h"
#include "Aime.h"
#include "Backup.h"
#include "Auth.h"
#include "Sequence.h"
static uint8_t g_APM3IOValues[256];
bool __fastcall ApmSystemSetting_getAdvertizeSound(bool *enable)
{
#ifdef _LOGAPM3
info(true, "ApmSystemSetting_getAdvertizeSound");
#endif
*enable = true;
return ApmSystemSetting_getAdvertizeSoundReturnValue;
}
bool __fastcall ApmSystemSetting_getClosingTimes(__int64 *closingTimes)
{
#ifdef _LOGAPM3
info(true, "ApmSystemSetting_getClosingTimes");
#endif
*closingTimes = 0;
return ApmSystemSetting_getClosingTimesReturnValue;
}
char __fastcall ApmSystemSetting_getEmoneySetting(__int64 a1)
{
#ifdef _LOGAPM3
info(true, "ApmSystemSetting_getEmoneySetting");
#endif
return ApmSystemSetting_getEmoneySettingReturnValue;
}
bool __fastcall ApmSystemSetting_getFixedTitle(bool *enable)
{
#ifdef _LOGAPM3
info(true, "ApmSystemSetting_getFixedTitle");
#endif
*enable = false;
return ApmSystemSetting_getFixedTitleReturnValue;
}
char __fastcall ApmSystemSetting_getGamePadSetting(WORD* a1)
{
#ifdef _LOGAPM3
info(true, "ApmSystemSetting_getGamePadSetting");
#endif
return ApmSystemSetting_getGamePadSettingReturnValue;
}
struct MatchingGroup
{
char alphabet[1];
char number[1];
};
bool __fastcall ApmSystemSetting_getMatchingGroup(MatchingGroup* matchingGroup)
{
#ifdef _LOGAPM3
info(true, "ApmSystemSetting_getMatchingGroup");
#endif
return ApmSystemSetting_getMatchingGroupReturnValue;
}
bool __fastcall ApmSystemSetting_getTimeToClosingTime(unsigned int* seconds)
{
#ifdef _LOGAPM3
info(true, "ApmSystemSetting_getTimeToClosingTime");
#endif
*seconds = 0;
return ApmSystemSetting_getTimeToClosingTimeReturnValue;
}
char __fastcall ApmSystemSetting_getUiSetting(__int64 a1)
{
#ifdef _LOGAPM3
info(true, "ApmSystemSetting_getUiSetting");
#endif
return ApmSystemSetting_getUiSettingReturnValue;
}
void Core_execute()
{
#ifdef _LOGAPM3
info(true, "Core_execute");
#endif
}
bool __fastcall Core_exitGame(bool isTest)
{
#ifdef _LOGAPM3
info(true, "Core_exitGame");
#endif
return Core_exitGameReturnValue;
}
__int64 Core_hookException()
{
#ifdef _LOGAPM3
info(true, "Core_hookException");
#endif
return Core_hookExceptionReturnValue;
}
bool Core_isExitNeeded()
{
#ifdef _LOGAPM3
info(true, "Core_isExitNeeded");
#endif
return Core_isExitNeededReturnValue;
}
void Core_resetCount()
{
#ifdef _LOGAPM3
info(true, "Core_resetCount");
#endif
}
__int64 Core_resetException()
{
#ifdef _LOGAPM3
info(true, "Core_resetException");
#endif
return Core_resetExceptionReturnValue;
}
__int64 Credit_getAddableCoin()
{
#ifdef _LOGAPM3
info(true, "Credit_getAddableCoin");
#endif
return Credit_getAddableCoinReturnValue;
}
__int64 Credit_getCoinMultipliers()
{
#ifdef _LOGAPM3
info(true, "Credit_getCoinMultipliers");
#endif
return Credit_getCoinMultipliersReturnValue;
}
__int64 Credit_getCoinToCredit()
{
#ifdef _LOGAPM3
info(true, "Credit_getCoinToCredit");
#endif
return Credit_getCoinToCreditReturnValue;
}
__int64 Credit_getCredit()
{
#ifdef _LOGAPM3
info(true, "Credit_getCredit");
#endif
return Credit_getCreditReturnValue;
}
__int64 Credit_getRemain()
{
#ifdef _LOGAPM3
info(true, "Credit_getRemain");
#endif
return Credit_getRemainReturnValue;
}
__int64 Credit_isFreePlay()
{
#ifdef _LOGAPM3
info(true, "Credit_isFreePlay");
#endif
return Credit_isFreePlayReturnValue;
}
__int64 __fastcall Credit_isGameCostEnough(__int64 a1)
{
#ifdef _LOGAPM3
info(true, "Credit_isGameCostEnough");
#endif
return Credit_isGameCostEnoughReturnValue; // 1
}
__int64 Credit_isZero()
{
#ifdef _LOGAPM3
info(true, "Credit_isZero");
#endif
return Credit_isZeroReturnValue;
}
__int64 __fastcall Credit_payGameCost(__int64 a1)
{
#ifdef _LOGAPM3
info(true, "Credit_payGameCost");
#endif
return Credit_payGameCostReturnValue;
}
__int64 Credit_resetCoinInHook()
{
#ifdef _LOGAPM3
info(true, "Credit_resetCoinInHook");
#endif
return Credit_resetCoinInHookReturnValue;
}
__int64 Credit_setCoinInHook()
{
#ifdef _LOGAPM3
info(true, "Credit_setCoinInHook");
#endif
return Credit_setCoinInHookReturnValue;
}
wchar_t* Credit_toString()
{
#ifdef _LOGAPM3
info(true, "Credit_toString");
#endif
static wchar_t lol[64];
lol[0] = '1';
return lol;
}
void Emoney_close()
{
#ifdef _LOGAPM3
info(true, "Emoney_close");
#endif
}
__int64 Emoney_isOpenMainWindow()
{
#ifdef _LOGAPM3
info(true, "Emoney_isOpenMainWindow");
#endif
return Emoney_isOpenMainWindowReturnValue;
}
char Emoney_launch()
{
#ifdef _LOGAPM3
info(true, "Emoney_launch");
#endif
return Emoney_launchReturnValue;
}
void __fastcall Emoney_setSoundHook(__int64 a1)
{
#ifdef _LOGAPM3
info(true, "Emoney_setSoundHook");
#endif
}
void __fastcall Emoney_update(BYTE* a1)
{
#ifdef _LOGAPM3
info(true, "Emoney_update");
#endif
}
__int64 Error_isOccurred()
{
#ifdef _LOGAPM3
info(true, "Error_isOccurred");
#endif
return Error_isOccurredReturnValue;
}
__int64 Error_setDeviceLost()
{
#ifdef _LOGAPM3
info(true, "Error_setDeviceLost");
#endif
return Error_setDeviceLostReturnValue;
}
struct GamepadInfo
{
unsigned short vid;
unsigned short pid;
char name[260];
};
GamepadInfo* Input_getGamepadInfo()
{
#ifdef _LOGAPM3
info(true, "Input_getGamepadInfo");
#endif
static GamepadInfo *_gamePad;
if (_gamePad == nullptr)
{
_gamePad = (GamepadInfo*)malloc(sizeof(GamepadInfo));
}
_gamePad->vid = 1337;
_gamePad->pid = 1337;
memset(_gamePad->name, 0, 260);
strcpy(_gamePad->name, "ParrotJoyCon");
return _gamePad;
}
char __fastcall Input_isFlipNow(unsigned int a1)
{
#ifdef _LOGAPM3
info(true, "Input_isFlipNow");
#endif
return Input_isFlipNowReturnValue;
}
__int64 Input_isGamepadDetect()
{
#ifdef _LOGAPM3
info(true, "Input_isGamepadDetect");
#endif
return Input_isGamepadDetectReturnValue;
}
char __fastcall Input_isOffNow(unsigned int a1)
{
#ifdef _LOGAPM3
info(true, "Input_isOffNow");
#endif
return Input_isOffNowReturnValue;
}
int __fastcall Input_isOn(unsigned int buttonId)
{
#ifdef _LOGAPM3
info(true, "Input_isOn id: %u", buttonId);
#endif
return g_APM3IOValues[buttonId];
}
char __fastcall Input_isOnNow(unsigned int buttonId)
{
#ifdef _LOGAPM3
info(true, "Input_isOnNow id: %u", buttonId);
#endif
return g_APM3IOValues[buttonId];
}
__int64 Input_isOpenPewviewWindow()
{
#ifdef _LOGAPM3
info(true, "Input_isOpenPewviewWindow");
#endif
return Input_isOpenPewviewWindowReturnValue;
}
char __fastcall Input_setGamepadConfig(__int64 a1)
{
#ifdef _LOGAPM3
info(true, "Input_setGamepadConfig");
#endif
return Input_setGamepadConfigReturnValue;
}
char* NetworkProperty_getAddressString()
{
#ifdef _DEBUG
info(true, "NetworkProperty_getAddressString");
#endif
return NetworkProperty_getAddressStringReturnValue;
}
__int64 NetworkProperty_getAddressValue()
{
#ifdef _DEBUG
info(true, "NetworkProperty_getAddressValue");
#endif
return NetworkProperty_getAddressValueReturnValue;
}
__int64 System_getAppRootPath()
{
#ifdef _LOGAPM3
info(true, "System_getAppRootPath");
#endif
return System_getAppRootPathReturnValue;
}
struct StandardSerialID
{
const BYTE LENGTH = 16;
wchar_t Value[15];
};
struct ShortSerialID
{
const BYTE LENGTH = 12;
wchar_t Value[12];
};
struct SerialID
{
StandardSerialID ID;
ShortSerialID ShortId;
};
SerialID* System_getBoardId()
{
#ifdef _LOGAPM3
info(true, "System_getBoardId");
#endif
static SerialID *_serialId;
if (_serialId == nullptr)
{
_serialId = (SerialID*)malloc(sizeof(SerialID));
wcscpy(_serialId->ID.Value, L"IAMGODBEAVER");
wcscpy(_serialId->ShortId.Value, L"IAMGODBEAVER");
}
return _serialId;
}
wchar_t* System_getGameId()
{
#ifdef _LOGAPM3
info(true, "System_getGameId");
#endif
return APM3GameId;
}
struct GameVersion
{
unsigned int Major;
unsigned int Minor;
};
GameVersion* System_getGameVersion()
{
#ifdef _LOGAPM3
info(true, "System_getGameVersion");
#endif
static GameVersion *_gameVersion;
if (_gameVersion == nullptr)
{
_gameVersion = (GameVersion*)malloc(sizeof(GameVersion));
_gameVersion->Minor = 0;
_gameVersion->Major = 1;
}
return _gameVersion;
}
SerialID* System_getKeychipId()
{
#ifdef _LOGAPM3
info(true, "System_getKeychipId");
#endif
static SerialID* _serialId;
if (_serialId == nullptr)
{
_serialId = (SerialID*)malloc(sizeof(SerialID));
wcscpy(_serialId->ID.Value, L"IAMGODBEAVER");
wcscpy(_serialId->ShortId.Value, L"IAMGODBEAVER");
}
return _serialId;
}
enum class SystemRegionCode
{
Unknown,
Japan,
China,
Export,
};
SystemRegionCode System_getRegionCode()
{
#ifdef _LOGAPM3
info(true, "System_getRegionCode");
#endif
return SystemRegionCode::Japan;
}
__int64 System_getResolution()
{
#ifdef _LOGAPM3
info(true, "System_getResolution");
#endif
return System_getResolutionReturnValue;
}
__int64 System_isDevelop()
{
#ifdef _LOGAPM3
info(true, "System_isDevelop");
#endif
return System_isDevelopReturnValue;
}
char __fastcall apmGamepadConfig(__int64 a1)
{
#ifdef _LOGAPM3
info(true, "apmGamepadConfig");
#endif
return apmGamepadConfigReturnValue;
}
char __fastcall apmGamepadGetApmInput(DWORD* a1)
{
#ifdef _LOGAPM3
info(true, "apmGamepadGetApmInput");
#endif
return apmGamepadGetApmInputReturnValue;
}
//__int128* apmGamepadGetConfig()
__int64* apmGamepadGetConfig()
{
#ifdef _LOGAPM3
info(true, "apmGamepadGetConfig");
#endif
static __int64 dumb = 0;
return &dumb;
}
char __fastcall apmGamepadGetDeviceCaps(__int64 a1)
{
#ifdef _LOGAPM3
info(true, "apmGamepadGetDeviceCaps");
#endif
return apmGamepadGetDeviceCapsReturnValue;
}
//errno_t __fastcall apmGamepadGetInfo(__int64 a1)
__int64 __fastcall apmGamepadGetInfo(__int64 a1)
{
#ifdef _LOGAPM3
info(true, "apmGamepadGetInfo");
#endif
return apmGamepadGetInfoReturnValue;
}
//char __fastcall apmGamepadGetRawInput(_QWORD* a1)
char __fastcall apmGamepadGetRawInput(__int64* a1)
{
#ifdef _LOGAPM3
info(true, "apmGamepadGetRawInput");
#endif
return apmGamepadGetRawInputReturnValue;
}
__int64 apmGamepadInitConfig()
{
#ifdef _LOGAPM3
info(true, "apmGamepadInitConfig");
#endif
return apmGamepadInitConfigReturnValue;
}
char apmGamepadIsDetected()
{
#ifdef _LOGAPM3
info(true, "apmGamepadIsDetected");
#endif
return apmGamepadIsDetectedReturnValue;
}
__int64 apmGamepadIsXInputDevice()
{
#ifdef _LOGAPM3
info(true, "apmGamepadIsXInputDevice");
#endif
return apmGamepadIsXInputDeviceReturnValue;
}
int apmGamepadUpdate()
{
#ifdef _LOGAPM3
info(true, "apmGamepadUpdate");
#endif
return apmGamepadUpdateReturnValue;
}
static void HookAPM3()
{
wcscpy(ServerName, L"localhost");
wcscpy(LinkServerName, L"localhost");
wcscpy(LocationNickName, L"Flatty");
wcscpy(LocationName, L"Flatearth");
wcscpy(RegionName, L"Santaland");
Credit_isGameCostEnoughReturnValue = 1;
MH_Initialize();
MH_CreateHookApi(L"apm.dll", "Aime_acceptConfirm", Aime_acceptConfirm, NULL);
MH_CreateHookApi(L"apm.dll", "Aime_cancel", Aime_cancel, NULL);
MH_CreateHookApi(L"apm.dll", "Aime_getAccessCode", Aime_getAccessCode, NULL);
MH_CreateHookApi(L"apm.dll", "Aime_getAimeId", Aime_getAimeId, NULL);
MH_CreateHookApi(L"apm.dll", "Aime_getConfirm", Aime_getConfirm, NULL);
MH_CreateHookApi(L"apm.dll", "Aime_getErrorCategory", Aime_getErrorCategory, NULL);
MH_CreateHookApi(L"apm.dll", "Aime_hasConfirm", Aime_hasConfirm, NULL);
MH_CreateHookApi(L"apm.dll", "Aime_hasError", Aime_hasError, NULL);
MH_CreateHookApi(L"apm.dll", "Aime_hasResult", Aime_hasResult, NULL);
MH_CreateHookApi(L"apm.dll", "Aime_isBusy", Aime_isBusy, NULL);
MH_CreateHookApi(L"apm.dll", "Aime_isDBAlive", Aime_isDBAlive, NULL);
MH_CreateHookApi(L"apm.dll", "Aime_isMobile", Aime_isMobile, NULL);
MH_CreateHookApi(L"apm.dll", "Aime_isReaderDetected", Aime_isReaderDetected, NULL);
MH_CreateHookApi(L"apm.dll", "Aime_sendLog", Aime_sendLog, NULL);
MH_CreateHookApi(L"apm.dll", "Aime_setLedError", Aime_setLedError, NULL);
MH_CreateHookApi(L"apm.dll", "Aime_setLedSuccess", Aime_setLedSuccess, NULL);
MH_CreateHookApi(L"apm.dll", "Aime_start", Aime_start, NULL);
MH_CreateHookApi(L"apm.dll", "AllnetAccounting_beginPlay", AllnetAccounting_beginPlay, NULL);
MH_CreateHookApi(L"apm.dll", "AllnetAccounting_endPlay", AllnetAccounting_endPlay, NULL);
MH_CreateHookApi(L"apm.dll", "AllnetAuth_getAbaasGsServerName", AllnetAuth_getAbaasGsServerName, NULL);
MH_CreateHookApi(L"apm.dll", "AllnetAuth_getAbaasLinkServerName", AllnetAuth_getAbaasLinkServerName, NULL);
MH_CreateHookApi(L"apm.dll", "AllnetAuth_getCountryCode", AllnetAuth_getCountryCode, NULL);
MH_CreateHookApi(L"apm.dll", "AllnetAuth_getLocationId", AllnetAuth_getLocationId, NULL);
MH_CreateHookApi(L"apm.dll", "AllnetAuth_getLocationName", AllnetAuth_getLocationName, NULL);
MH_CreateHookApi(L"apm.dll", "AllnetAuth_getLocationNickname", AllnetAuth_getLocationNickname, NULL);
MH_CreateHookApi(L"apm.dll", "AllnetAuth_getLocationNicknamePartCount", AllnetAuth_getLocationNicknamePartCount, NULL);
MH_CreateHookApi(L"apm.dll", "AllnetAuth_getRegionCode", AllnetAuth_getRegionCode, NULL);
MH_CreateHookApi(L"apm.dll", "AllnetAuth_getRegionName", AllnetAuth_getRegionName, NULL);
MH_CreateHookApi(L"apm.dll", "AllnetAuth_getRegionNamePartCount", AllnetAuth_getRegionNamePartCount, NULL);
MH_CreateHookApi(L"apm.dll", "AllnetAuth_isDevelop", AllnetAuth_isDevelop, NULL);
MH_CreateHookApi(L"apm.dll", "AllnetAuth_isGood", AllnetAuth_isGood, NULL);
MH_CreateHookApi(L"apm.dll", "ApmSystemSetting_getAdvertizeSound", ApmSystemSetting_getAdvertizeSound, NULL);
MH_CreateHookApi(L"apm.dll", "ApmSystemSetting_getClosingTimes", ApmSystemSetting_getClosingTimes, NULL);
MH_CreateHookApi(L"apm.dll", "ApmSystemSetting_getEmoneySetting", ApmSystemSetting_getEmoneySetting, NULL);
MH_CreateHookApi(L"apm.dll", "ApmSystemSetting_getFixedTitle", ApmSystemSetting_getFixedTitle, NULL);
MH_CreateHookApi(L"apm.dll", "ApmSystemSetting_getGamePadSetting", ApmSystemSetting_getGamePadSetting, NULL);
MH_CreateHookApi(L"apm.dll", "ApmSystemSetting_getMatchingGroup", ApmSystemSetting_getMatchingGroup, NULL);
MH_CreateHookApi(L"apm.dll", "ApmSystemSetting_getTimeToClosingTime", ApmSystemSetting_getTimeToClosingTime, NULL);
MH_CreateHookApi(L"apm.dll", "ApmSystemSetting_getUiSetting", ApmSystemSetting_getUiSetting, NULL);
MH_CreateHookApi(L"apm.dll", "Backup_getRecordStatus", Backup_getRecordStatus, NULL);
MH_CreateHookApi(L"apm.dll", "Backup_isSetupSucceeded", Backup_isSetupSucceeded, NULL);
MH_CreateHookApi(L"apm.dll", "Backup_saveRecord", Backup_saveRecord, NULL);
MH_CreateHookApi(L"apm.dll", "Backup_saveRecordByAddress", Backup_saveRecordByAddress, NULL);
MH_CreateHookApi(L"apm.dll", "Backup_setupRecords", Backup_setupRecords, NULL);
MH_CreateHookApi(L"apm.dll", "Core_execute", Core_execute, NULL);
MH_CreateHookApi(L"apm.dll", "Core_exitGame", Core_exitGame, NULL);
MH_CreateHookApi(L"apm.dll", "Core_hookException", Core_hookException, NULL);
MH_CreateHookApi(L"apm.dll", "Core_isExitNeeded", Core_isExitNeeded, NULL);
MH_CreateHookApi(L"apm.dll", "Core_resetCount", Core_resetCount, NULL);
MH_CreateHookApi(L"apm.dll", "Core_resetException", Core_resetException, NULL);
MH_CreateHookApi(L"apm.dll", "Credit_getAddableCoin", Credit_getAddableCoin, NULL);
MH_CreateHookApi(L"apm.dll", "Credit_getCoinMultipliers", Credit_getCoinMultipliers, NULL);
MH_CreateHookApi(L"apm.dll", "Credit_getCoinToCredit", Credit_getCoinToCredit, NULL);
MH_CreateHookApi(L"apm.dll", "Credit_getCredit", Credit_getCredit, NULL);
MH_CreateHookApi(L"apm.dll", "Credit_getRemain", Credit_getRemain, NULL);
MH_CreateHookApi(L"apm.dll", "Credit_isFreePlay", Credit_isFreePlay, NULL);
MH_CreateHookApi(L"apm.dll", "Credit_isGameCostEnough", Credit_isGameCostEnough, NULL);
MH_CreateHookApi(L"apm.dll", "Credit_isZero", Credit_isZero, NULL);
MH_CreateHookApi(L"apm.dll", "Credit_payGameCost", Credit_payGameCost, NULL);
MH_CreateHookApi(L"apm.dll", "Credit_resetCoinInHook", Credit_resetCoinInHook, NULL);
MH_CreateHookApi(L"apm.dll", "Credit_setCoinInHook", Credit_setCoinInHook, NULL);
MH_CreateHookApi(L"apm.dll", "Credit_toString", Credit_toString, NULL);
MH_CreateHookApi(L"apm.dll", "Emoney_close", Emoney_close, NULL);
MH_CreateHookApi(L"apm.dll", "Emoney_isOpenMainWindow", Emoney_isOpenMainWindow, NULL);
MH_CreateHookApi(L"apm.dll", "Emoney_launch", Emoney_launch, NULL);
MH_CreateHookApi(L"apm.dll", "Emoney_setSoundHook", Emoney_setSoundHook, NULL);
MH_CreateHookApi(L"apm.dll", "Emoney_update", Emoney_update, NULL);
MH_CreateHookApi(L"apm.dll", "Error_isOccurred", Error_isOccurred, NULL);
MH_CreateHookApi(L"apm.dll", "Error_setDeviceLost", Error_setDeviceLost, NULL);
MH_CreateHookApi(L"apm.dll", "Input_getGamepadInfo", Input_getGamepadInfo, NULL);
MH_CreateHookApi(L"apm.dll", "Input_isFlipNow", Input_isFlipNow, NULL);
MH_CreateHookApi(L"apm.dll", "Input_isGamepadDetect", Input_isGamepadDetect, NULL);
MH_CreateHookApi(L"apm.dll", "Input_isOffNow", Input_isOffNow, NULL);
MH_CreateHookApi(L"apm.dll", "Input_isOn", Input_isOn, NULL);
MH_CreateHookApi(L"apm.dll", "Input_isOnNow", Input_isOnNow, NULL);
MH_CreateHookApi(L"apm.dll", "Input_isOpenPewviewWindow", Input_isOpenPewviewWindow, NULL);
MH_CreateHookApi(L"apm.dll", "Input_setGamepadConfig", Input_setGamepadConfig, NULL);
MH_CreateHookApi(L"apm.dll", "NetworkProperty_getAddressString", NetworkProperty_getAddressString, NULL);
MH_CreateHookApi(L"apm.dll", "NetworkProperty_getAddressValue", NetworkProperty_getAddressValue, NULL);
MH_CreateHookApi(L"apm.dll", "Sequence_beginPlay", Sequence_beginPlay, NULL);
MH_CreateHookApi(L"apm.dll", "Sequence_clearBackup", Sequence_clearBackup, NULL);
MH_CreateHookApi(L"apm.dll", "Sequence_continuePlay", Sequence_continuePlay, NULL);
MH_CreateHookApi(L"apm.dll", "Sequence_endPlay", Sequence_endPlay, NULL);
MH_CreateHookApi(L"apm.dll", "Sequence_getBookkeeping", Sequence_getBookkeeping, NULL);
MH_CreateHookApi(L"apm.dll", "Sequence_getPlayingAimeId", Sequence_getPlayingAimeId, NULL);
MH_CreateHookApi(L"apm.dll", "Sequence_isAccountingPlaying", Sequence_isAccountingPlaying, NULL);
MH_CreateHookApi(L"apm.dll", "Sequence_isPlaying", Sequence_isPlaying, NULL);
MH_CreateHookApi(L"apm.dll", "Sequence_isTest", Sequence_isTest, NULL);
MH_CreateHookApi(L"apm.dll", "System_getAppRootPath", System_getAppRootPath, NULL);
MH_CreateHookApi(L"apm.dll", "System_getBoardId", System_getBoardId, NULL);
MH_CreateHookApi(L"apm.dll", "System_getGameId", System_getGameId, NULL);
MH_CreateHookApi(L"apm.dll", "System_getGameVersion", System_getGameVersion, NULL);
MH_CreateHookApi(L"apm.dll", "System_getKeychipId", System_getKeychipId, NULL);
MH_CreateHookApi(L"apm.dll", "System_getRegionCode", System_getRegionCode, NULL);
MH_CreateHookApi(L"apm.dll", "System_getResolution", System_getResolution, NULL);
MH_CreateHookApi(L"apm.dll", "System_isDevelop", System_isDevelop, NULL);
MH_CreateHookApi(L"apm.dll", "apmGamepadConfig", apmGamepadConfig, NULL);
MH_CreateHookApi(L"apm.dll", "apmGamepadGetApmInput", apmGamepadGetApmInput, NULL);
MH_CreateHookApi(L"apm.dll", "apmGamepadGetConfig", apmGamepadGetConfig, NULL);
MH_CreateHookApi(L"apm.dll", "apmGamepadGetDeviceCaps", apmGamepadGetDeviceCaps, NULL);
MH_CreateHookApi(L"apm.dll", "apmGamepadGetInfo", apmGamepadGetInfo, NULL);
MH_CreateHookApi(L"apm.dll", "apmGamepadGetRawInput", apmGamepadGetRawInput, NULL);
MH_CreateHookApi(L"apm.dll", "apmGamepadInitConfig", apmGamepadInitConfig, NULL);
MH_CreateHookApi(L"apm.dll", "apmGamepadIsDetected", apmGamepadIsDetected, NULL);
MH_CreateHookApi(L"apm.dll", "apmGamepadIsXInputDevice", apmGamepadIsXInputDevice, NULL);
MH_CreateHookApi(L"apm.dll", "apmGamepadUpdate", apmGamepadUpdate, NULL);
MH_EnableHook(MH_ALL_HOOKS);
memset(g_APM3IOValues, 0, 256);
CreateThread(nullptr, 0, [](LPVOID) -> DWORD
{
HANDLE hPipe = CreateFileA("\\\\.\\pipe\\TeknoParrotPipe", GENERIC_READ, 0, nullptr, OPEN_EXISTING, 0, NULL);
if (hPipe != INVALID_HANDLE_VALUE)
{
DWORD read;
while (true)
{
ReadFile(hPipe, g_APM3IOValues, sizeof(g_APM3IOValues), &read, nullptr);
}
}
return 0;
}, nullptr, 0, nullptr);
}
static InitFunction initFuncTapping([]()
{
HookAPM3();
wcscpy(APM3GameId, L"SDFJ");
__int64 mainModuleBase = (__int64)GetModuleHandle(0);
}, GameID::TappingSkillTest);
void __fastcall printPengo(const char* format, ...)
{
__try
{
va_list args;
char buffer[1024];
va_start(args, format);
int len = _vsnprintf(buffer, sizeof(buffer), format, args);
va_end(args);
buffer[len] = '\n';
buffer[len + 1] = '\0';
OutputDebugStringA(buffer);
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
}
}
static InitFunction initFunc([]()
{
HookAPM3();
wcscpy(APM3GameId, L"SDFH");
__int64 mainModuleBase = (__int64)GetModuleHandle(0);
MH_Initialize();
//MH_CreateHook((void*)(mainModuleBase + 0x1944B0), (void *)printPengo, NULL);
MH_EnableHook(MH_ALL_HOOKS);
/// PATTERNS BELOW
// Skip joysticks
injector::MakeRET(mainModuleBase + 0x15C5B0);
// Skip keyboard
injector::MakeRET(mainModuleBase + 0x15CBA0);
}, GameID::Pengoe5);
static InitFunction initFuncPengoe511([]()
{
HookAPM3();
wcscpy(APM3GameId, L"SDFH");
__int64 mainModuleBase = (__int64)GetModuleHandle(0);
// Skip joysticks
injector::MakeRET(mainModuleBase + 0x16A7C0); // CC 48 89 5C 24 10 48 89 6C 24 18 48 89 74 24 20 57 48 83 EC 40
// Skip keyboard
injector::MakeRET(mainModuleBase + 0x16ADB0); // 48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 41 54 41 55 41 56 41 57 48 81 EC A0 00 00 00
}, GameID::Pengoe511);
static InitFunction initTestFunc([]()
{
HookAPM3();
wcscpy(APM3GameId, L"SDFH");
__int64 mainModuleBase = (__int64)GetModuleHandle(0);
// Skip joysticks
injector::MakeRET(mainModuleBase + 0x158820);
// Skip keyboard
injector::MakeRET(mainModuleBase + 0x158E10);
Sequence_isTestReturnValue = 1;
}, GameID::Pengoe5_Test);
static InitFunction initVF5Func([]()
{
HookAPM3();
wcscpy(APM3GameId, L"SDHF");
__int64 mainModuleBase = (__int64)GetModuleHandle(0);
BackupSaveFileName = ".\\vf5fs\\save";
}, GameID::VF5Esports);
static InitFunction initVF5TestFunc([]()
{
HookAPM3();
wcscpy(APM3GameId, L"SDHF");
__int64 mainModuleBase = (__int64)GetModuleHandle(0);
if (strstr(GetCommandLineA(), "-tptest") != NULL)
Sequence_isTestReturnValue = 1;
}, GameID::VF5EsportsTest);
static InitFunction initGoonyaFunc([]()
{
auto d = LoadLibraryA("apm.dll");
if (d == nullptr)
{
MessageBoxA(0, "Cannot load apm.dll!", "Error", 0);
ExitProcess(0);
}
HookAPM3();
wcscpy(APM3GameId, L"SDGX");
__int64 mainModuleBase = (__int64)GetModuleHandle(0);
}, GameID::GoonyaFighter);
static InitFunction initPuyoFunc([]()
{
HookAPM3();
wcscpy(APM3GameId, L"SDFF");
__int64 mainModuleBase = (__int64)GetModuleHandle(0);
}, GameID::PuyoPuyoEsports);
static InitFunction initDoa6FM14Func([]()
{
HookAPM3();
wcscpy(APM3GameId, L"SDFM");
__int64 mainModuleBase = (__int64)GetModuleHandle(0);
}, GameID::Doa6FM14);
static InitFunction initDoa6TestFunc([]()
{
auto d = LoadLibraryA("apm.dll");
if (d == nullptr)
{
MessageBoxA(0, "Cannot load apm.dll!", "Error", 0);
ExitProcess(0);
}
HookAPM3();
wcscpy(APM3GameId, L"SDFM");
__int64 mainModuleBase = (__int64)GetModuleHandle(0);
}, GameID::Doa6Test);
#endif

View File

@ -0,0 +1,98 @@
#ifdef _M_AMD64
static __int64 System_getResolutionReturnValue = 0;
static bool ApmSystemSetting_getAdvertizeSoundReturnValue = false;
static bool ApmSystemSetting_getClosingTimesReturnValue = false;
static char ApmSystemSetting_getEmoneySettingReturnValue = 0;
static bool ApmSystemSetting_getFixedTitleReturnValue = false;
static char ApmSystemSetting_getGamePadSettingReturnValue = 0;
static bool ApmSystemSetting_getMatchingGroupReturnValue = false;
static char ApmSystemSetting_getTimeToClosingTimeReturnValue = 0;
static char ApmSystemSetting_getUiSettingReturnValue = 0;
static bool Core_exitGameReturnValue = 0;
static __int64 Core_hookExceptionReturnValue = 0;
static bool Core_isExitNeededReturnValue = false;
static __int64 Core_resetExceptionReturnValue = 0;
static __int64 Credit_getAddableCoinReturnValue = 0;
static __int64 Credit_getCoinMultipliersReturnValue = 0;
static __int64 Credit_getCoinToCreditReturnValue = 0;
static __int64 Credit_getCreditReturnValue = 0;
static __int64 Credit_getRemainReturnValue = 0;
static __int64 Credit_isFreePlayReturnValue = 1;
static __int64 Credit_isGameCostEnoughReturnValue = 0;
static __int64 Credit_isZeroReturnValue = 0;
static __int64 Credit_payGameCostReturnValue = 0;
static __int64 Credit_resetCoinInHookReturnValue = 0;
static __int64 Credit_setCoinInHookReturnValue = 0;
static __int64 Emoney_isOpenMainWindowReturnValue = 0;
static char Emoney_launchReturnValue = 0;
static __int64 Error_isOccurredReturnValue = 0;
static __int64 Error_setDeviceLostReturnValue = 0;
static char Input_isFlipNowReturnValue = 0;
static __int64 Input_isGamepadDetectReturnValue = 0;
static char Input_isOffNowReturnValue = 0;
static char Input_isOnNowReturnValue = 0;
static __int64 Input_isOpenPewviewWindowReturnValue = 0;
static char Input_setGamepadConfigReturnValue = 0;
static char *NetworkProperty_getAddressStringReturnValue = "192.168.0.1";
static __int64 NetworkProperty_getAddressValueReturnValue = 0;
static __int64 System_getAppRootPathReturnValue = 0;
static __int64 System_getRegionCodeReturnValue = 0;
static __int64 System_isDevelopReturnValue = 0;
static char apmGamepadConfigReturnValue = 0;
static char apmGamepadGetApmInputReturnValue = 0;
static char apmGamepadGetDeviceCapsReturnValue = 0;
static __int64 apmGamepadGetInfoReturnValue = 0;
static char apmGamepadGetRawInputReturnValue = 0;
static __int64 apmGamepadInitConfigReturnValue = 0;
static char apmGamepadIsDetectedReturnValue = 0;
static __int64 apmGamepadIsXInputDeviceReturnValue = 0;
static int apmGamepadUpdateReturnValue = 0;
#endif

View File

@ -0,0 +1,146 @@
#include <Utility/InitFunction.h>
#include <StdInc.h>
#include <thread>
#ifdef _M_AMD64
#include "Functions\Global.h"
#include "Aime.h"
bool Aime_acceptConfirm()
{
#ifdef _LOGAPM3AIME
info(true, "Aime_acceptConfirm");
#endif
return 0;
}
bool Aime_cancel()
{
#ifdef _LOGAPM3AIME
info(true, "Aime_cancel");
#endif
return 0;
}
bool __fastcall Aime_getAccessCode(AccessCode *accessCode)
{
#ifdef _LOGAPM3AIME
info(true, "Aime_getAccessCode");
#endif
return 0;
}
bool __fastcall Aime_getAimeId(unsigned int* uid)
{
#ifdef _LOGAPM3AIME
info(true, "Aime_getAimeId");
#endif
return 0;
}
AIME_CONFIRM Aime_getConfirm()
{
#ifdef _LOGAPM3AIME
info(true, "Aime_getConfirm");
#endif
return AIME_CONFIRM::AimeDB;
}
AIME_ERROR_CATEGORY Aime_getErrorCategory()
{
#ifdef _LOGAPM3AIME
info(true, "Aime_getErrorCategory");
#endif
return AIME_ERROR_CATEGORY::NONE;
}
bool Aime_hasConfirm()
{
#ifdef _LOGAPM3AIME
info(true, "Aime_hasConfirm");
#endif
return false;
}
bool Aime_hasError()
{
#ifdef _LOGAPM3AIME
info(true, "Aime_hasError");
#endif
return false;
}
bool Aime_hasResult()
{
#ifdef _LOGAPM3AIME
info(true, "Aime_hasResult");
#endif
return false;
}
bool Aime_isBusy()
{
#ifdef _LOGAPM3AIME
info(true, "Aime_isBusy");
#endif
return false;
}
bool Aime_isDBAlive()
{
#ifdef _LOGAPM3AIME
info(true, "Aime_isDBAlive");
#endif
return true;
}
bool Aime_isMobile()
{
#ifdef _LOGAPM3AIME
info(true, "Aime_isMobile");
#endif
return false;
}
bool Aime_isReaderDetected()
{
#ifdef _LOGAPM3AIME
info(true, "Aime_isReaderDetected");
#endif
return true;
}
bool __fastcall Aime_sendLog(unsigned int uid, AIME_LOG_STATUS status, unsigned __int64 count)
{
#ifdef _LOGAPM3AIME
info(true, "Aime_sendLog");
#endif
return true;
}
bool Aime_setLedError()
{
#ifdef _LOGAPM3AIME
info(true, "Aime_setLedError");
#endif
return true;
}
bool Aime_setLedSuccess()
{
#ifdef _LOGAPM3AIME
info(true, "Aime_setLedSuccess");
#endif
return true;
}
bool Aime_start()
{
#ifdef _LOGAPM3AIME
info(true, "Aime_start");
#endif
return true;
}
#endif

View File

@ -0,0 +1,64 @@
#ifdef _M_AMD64
bool Aime_acceptConfirm();
bool Aime_cancel();
struct AccessCode
{
const int DigitCount = 20;
const int Size = 10;
const int StrSize = 41;
char values[10];
char valueStr[41];
};
bool __fastcall Aime_getAccessCode(AccessCode* accessCode);
bool __fastcall Aime_getAimeId(unsigned int* uid);
enum class AIME_CONFIRM
{
NoneDB,
FeliCaDB,
AimeDB,
};
AIME_CONFIRM Aime_getConfirm();
enum class AIME_ERROR_CATEGORY
{
NONE,
WARNING,
NETWORK,
FATAL,
UNKNOWN,
};
AIME_ERROR_CATEGORY Aime_getErrorCategory();
bool Aime_hasConfirm();
bool Aime_hasError();
bool Aime_hasResult();
bool Aime_isBusy();
bool Aime_isDBAlive();
bool Aime_isMobile();
bool Aime_isReaderDetected();
enum class AIME_LOG_STATUS
{
BEGIN,
CONTINUE,
END,
};
bool __fastcall Aime_sendLog(unsigned int uid, AIME_LOG_STATUS status, unsigned __int64 count);
bool Aime_setLedError();
bool Aime_setLedSuccess();
bool Aime_start();
#endif

View File

@ -0,0 +1,129 @@
#include <Utility/InitFunction.h>
#include <StdInc.h>
#include <thread>
#ifdef _M_AMD64
#include "Functions\Global.h"
#include "Auth.h"
wchar_t APM3GameId[10];
wchar_t RegionName[64];
wchar_t LocationNickName[64];
wchar_t LocationName[64];
wchar_t LinkServerName[64];
wchar_t ServerName[64];
__int64 __fastcall AllnetAccounting_beginPlay(unsigned int a1)
{
#ifdef _LOGAPM3AUTH
info(true, "AllnetAccounting_beginPlay");
#endif
return AllnetAccounting_beginPlayReturnValue;
}
__int64 __fastcall AllnetAccounting_endPlay(int a1, int a2, int a3)
{
#ifdef _LOGAPM3AUTH
info(true, "AllnetAccounting_endPlay");
#endif
return AllnetAccounting_endPlayReturnValue;
}
wchar_t* AllnetAuth_getAbaasGsServerName()
{
#ifdef _LOGAPM3AUTH
info(true, "AllnetAuth_getAbaasGsServerName");
#endif
return ServerName;
}
wchar_t* AllnetAuth_getAbaasLinkServerName()
{
#ifdef _LOGAPM3AUTH
info(true, "AllnetAuth_getAbaasLinkServerName");
#endif
return LinkServerName;
}
char countryCode[4] = "JPN";
char *AllnetAuth_getCountryCode()
{
#ifdef _LOGAPM3AUTH
info(true, "AllnetAuth_getCountryCode");
#endif
return countryCode;
}
unsigned int AllnetAuth_getLocationId()
{
#ifdef _LOGAPM3AUTH
info(true, "AllnetAuth_getLocationId");
#endif
return AllnetAuth_getLocationIdReturnValue;
}
wchar_t* AllnetAuth_getLocationName()
{
#ifdef _LOGAPM3AUTH
info(true, "AllnetAuth_getLocationName");
#endif
return LocationName;
}
wchar_t* __fastcall AllnetAuth_getLocationNickname(int index)
{
#ifdef _LOGAPM3AUTH
info(true, "AllnetAuth_getLocationNickname");
#endif
return LocationNickName;
}
int AllnetAuth_getLocationNicknamePartCount()
{
#ifdef _LOGAPM3AUTH
info(true, "AllnetAuth_getLocationNicknamePartCount");
#endif
return AllnetAuth_getLocationNicknamePartCountReturnValue;
}
int AllnetAuth_getRegionCode()
{
#ifdef _LOGAPM3AUTH
info(true, "AllnetAuth_getRegionCode");
#endif
return AllnetAuth_getRegionCodeReturnValue;
}
wchar_t* __fastcall AllnetAuth_getRegionName(int index)
{
#ifdef _LOGAPM3AUTH
info(true, "AllnetAuth_getRegionName");
#endif
return RegionName;
}
int AllnetAuth_getRegionNamePartCount()
{
#ifdef _LOGAPM3AUTH
info(true, "AllnetAuth_getRegionNamePartCount");
#endif
return AllnetAuth_getRegionNamePartCountReturnValue;
}
bool AllnetAuth_isDevelop()
{
#ifdef _LOGAPM3AUTH
info(true, "AllnetAuth_isDevelop");
#endif
return AllnetAuth_isDevelopReturnValue;
}
bool AllnetAuth_isGood()
{
#ifdef _LOGAPM3AUTH
info(true, "AllnetAuth_isGood");
#endif
return true;
}
#endif

View File

@ -0,0 +1,43 @@
#ifdef _M_AMD64
extern wchar_t APM3GameId[10];
extern wchar_t RegionName[64];
extern wchar_t LocationNickName[64];
extern wchar_t LocationName[64];
extern wchar_t LinkServerName[64];
extern wchar_t ServerName[64];
static __int64 AllnetAccounting_beginPlayReturnValue = 0;
static __int64 AllnetAccounting_endPlayReturnValue = 0;
static __int64 AllnetAuth_getCountryCodeReturnValue = 0;
static __int64 AllnetAuth_getLocationIdReturnValue = 0;
static int AllnetAuth_getLocationNicknamePartCountReturnValue = 0;
static __int64 AllnetAuth_getRegionCodeReturnValue = 0;
static int AllnetAuth_getRegionNamePartCountReturnValue = 0;
static bool AllnetAuth_isDevelopReturnValue = false;
static bool AllnetAuth_isGoodReturnValue = false;
bool AllnetAuth_isGood();
bool AllnetAuth_isDevelop();
int AllnetAuth_getRegionNamePartCount();
wchar_t* __fastcall AllnetAuth_getRegionName(int index);
int AllnetAuth_getRegionCode();
int AllnetAuth_getLocationNicknamePartCount();
wchar_t* __fastcall AllnetAuth_getLocationNickname(int index);
wchar_t* AllnetAuth_getLocationName();
unsigned int AllnetAuth_getLocationId();
char *AllnetAuth_getCountryCode();
wchar_t* AllnetAuth_getAbaasLinkServerName();
wchar_t* AllnetAuth_getAbaasGsServerName();
__int64 __fastcall AllnetAccounting_endPlay(int a1, int a2, int a3);
__int64 __fastcall AllnetAccounting_beginPlay(unsigned int a1);
#endif

View File

@ -0,0 +1,89 @@
#include <Utility/InitFunction.h>
#include <StdInc.h>
#include <thread>
#ifdef _M_AMD64
#include "Functions\Global.h"
#include "Backup.h"
char* BackupSaveFileName = "save";
char fileBuffer[256];
BackupRecord* internal_Records;
unsigned int internal_recordCount;
BackupRecordStatus __fastcall Backup_getRecordStatus(__int64 recordIndex)
{
#ifdef _LOGAPM3BACKUP
info(true, "Backup_getRecordStatus %llx", recordIndex);
#endif
return BackupRecordStatus::BackupRecordStatus_Valid;
}
bool Backup_isSetupSucceeded()
{
#ifdef _LOGAPM3BACKUP
info(true, "Backup_isSetupSucceeded");
#endif
return Backup_isSetupSucceededReturnValue;
}
bool __fastcall Backup_saveRecord(unsigned long recordIndex)
{
#ifdef _LOGAPM3BACKUP
info(true, "Backup_saveRecord recordIndex: %llx", recordIndex);
#endif
memset(fileBuffer, 0, sizeof(fileBuffer));
sprintf(fileBuffer, "%s%02d.bin", BackupSaveFileName, recordIndex);
auto file = fopen(fileBuffer, "wb+");
if (file)
{
fwrite(internal_Records[recordIndex].Address, 1, internal_Records[recordIndex].Size, file);
fclose(file);
}
return Backup_saveRecordReturnValue;
}
__int64 __fastcall Backup_saveRecordByAddress(__int64 recordAddress)
{
#ifdef _LOGAPM3BACKUP
info(true, "Backup_saveRecordByAddress %llx", recordAddress);
#endif
return Backup_saveRecordByAddressReturnValue;
}
//__int64 __fastcall Backup_setupRecords(__int128* a1, unsigned int a2)
bool __fastcall Backup_setupRecords(BackupRecord* records, unsigned int recordCount)
{
for (int i = 0; i < recordCount; i++)
{
memset(fileBuffer, 0, sizeof(fileBuffer));
sprintf(fileBuffer, "%s%02d.bin", BackupSaveFileName, i);
FILE* fsave = fopen(fileBuffer, "r");
internal_Records = records;
internal_recordCount = recordCount;
if (fsave != NULL)
{
#ifdef _LOGAPM3BACKUP
info(true, "Backup setuprecords %02d of %02d, loading file %s", i, recordCount, fileBuffer);
#endif
fread(records[i].Address, 1, records[i].Size, fsave); // add file size check noob
fclose(fsave);
}
else
{
#ifdef _LOGAPM3BACKUP
info(true, "Backup setuprecords %02d of %02d, saving file %s", i, recordCount, fileBuffer);
#endif
auto file = fopen(fileBuffer, "wb+");
if (file)
{
fwrite(records[i].Address, 1, records[i].Size, file);
fclose(file);
}
}
}
return true;
}
#endif

View File

@ -0,0 +1,37 @@
#ifdef _M_AMD64
#pragma once
extern char* BackupSaveFileName;
extern char fileBuffer[256];
struct BackupRecord
{
void* Address;
unsigned long Size;
};
extern BackupRecord* internal_Records;
extern unsigned int internal_recordCount;
enum class BackupRecordStatus
{
BackupRecordStatus_InvalidCall = -1, // 0xFFFFFFFF
BackupRecordStatus_Valid = 0,
BackupRecordStatus_DiffApp = 1,
BackupRecordStatus_BrokenData = 2,
};
static bool Backup_isSetupSucceededReturnValue = true;
static __int64 Backup_saveRecordReturnValue = 0;
static __int64 Backup_saveRecordByAddressReturnValue = 0;
static __int64 Backup_setupRecordsReturnValue = 0;
BackupRecordStatus __fastcall Backup_getRecordStatus(__int64 recordIndex);
bool Backup_isSetupSucceeded();
bool __fastcall Backup_saveRecord(unsigned long recordIndex);
__int64 __fastcall Backup_saveRecordByAddress(__int64 recordAddress);
bool __fastcall Backup_setupRecords(BackupRecord* records, unsigned int recordCount);
#endif

View File

@ -0,0 +1,85 @@
#include <Utility/InitFunction.h>
#include <StdInc.h>
#include <thread>
#ifdef _M_AMD64
#include "Functions\Global.h"
#include "Sequence.h"
bool __fastcall Sequence_beginPlay(SequenceAccountingBegin beginPlay, unsigned int uid, SEQUENCE_PLAY_ERROR_ID* errorID, unsigned long count)
{
#ifdef _LOGAPM3SEQUENCE
info(true, "Sequence_beginPlay");
#endif
return Sequence_beginPlayReturnValue;
}
bool Sequence_clearBackup()
{
#ifdef _LOGAPM3SEQUENCE
info(true, "Sequence_clearBackup");
#endif
return Sequence_clearBackupReturnValue;
}
bool __fastcall Sequence_continuePlay(SequenceAccountingBegin beginPlay, SequenceAccountingEnd endPlay, SEQUENCE_PLAY_ERROR_ID* errorId, unsigned long count)
{
#ifdef _LOGAPM3SEQUENCE
info(true, "Sequence_continuePlay");
#endif
return Sequence_continuePlayReturnValue;
}
bool __fastcall Sequence_endPlay(SequenceAccountingEnd endPlay, SEQUENCE_PLAY_ERROR_ID* errorID)
{
#ifdef _LOGAPM3SEQUENCE
info(true, "Sequence_endPlay");
#endif
return Sequence_endPlayReturnValue;
}
SequenceBookkeeping* Sequence_getBookkeeping()
{
#ifdef _LOGAPM3SEQUENCE
info(true, "Sequence_getBookkeeping");
#endif
static SequenceBookkeeping* _sequenceBookkeeping;
if (_sequenceBookkeeping == nullptr)
{
_sequenceBookkeeping = (SequenceBookkeeping*)malloc(sizeof(SequenceBookkeeping));
memset(_sequenceBookkeeping, 0, sizeof(SequenceBookkeeping));
}
return _sequenceBookkeeping;
}
unsigned int Sequence_getPlayingAimeId()
{
#ifdef _LOGAPM3SEQUENCE
info(true, "Sequence_getPlayingAimeId");
#endif
return Sequence_getPlayingAimeIdReturnValue;
}
bool Sequence_isAccountingPlaying()
{
#ifdef _LOGAPM3SEQUENCE
info(true, "Sequence_isAccountingPlaying");
#endif
return Sequence_isAccountingPlayingReturnValue;
}
bool Sequence_isPlaying()
{
#ifdef _LOGAPM3SEQUENCE
info(true, "Sequence_isPlaying");
#endif
return Sequence_isPlayingReturnValue;
}
bool Sequence_isTest()
{
#ifdef _LOGAPM3SEQUENCE
info(true, "Sequence_isTest");
#endif
return Sequence_isTestReturnValue;
}
#endif

View File

@ -0,0 +1,72 @@
#ifdef _M_AMD64
struct SequenceAccountingBegin
{
bool AccountingBeginValid;
unsigned int AccountingBeginKindCode;
};
struct SequenceAccountingEnd
{
bool accountingEndValid;
unsigned int accountingEndKindCode;
unsigned int accountingEndItemCount;
};
enum class SEQUENCE_PLAY_ERROR_ID
{
NONE,
INVALID_PARAM,
INVALID_STATE,
CREDIT_PAY,
ACCOUNTING_BEGIN,
ACCOUNTING_END,
};
struct SequenceTimeHistogramItem
{
unsigned int TimeRangeMin;
unsigned int TimeRangeMax;
unsigned int Count;
};
struct SequenceBookkeeping
{
const unsigned long MaxTimeHistogramCount = 32;
unsigned int NumberOfGames;
unsigned int TotalTime;
unsigned int PlayTime;
unsigned int AveragePlayTime;
unsigned int LongestPlayTime;
unsigned int ShortestPlayTime;
unsigned int TimeHistogramCount;
SequenceTimeHistogramItem TimeHistogram[32];
};
static bool Sequence_beginPlayReturnValue = true;
static bool Sequence_clearBackupReturnValue = false;
static bool Sequence_continuePlayReturnValue = 0;
static bool Sequence_endPlayReturnValue = false;
static unsigned int Sequence_getPlayingAimeIdReturnValue = 0;
static bool Sequence_isAccountingPlayingReturnValue = false;
static bool Sequence_isPlayingReturnValue = false;
static bool Sequence_isTestReturnValue = 0;
bool Sequence_isTest();
bool Sequence_isPlaying();
bool Sequence_isAccountingPlaying();
unsigned int Sequence_getPlayingAimeId();
SequenceBookkeeping* Sequence_getBookkeeping();
bool __fastcall Sequence_endPlay(SequenceAccountingEnd endPlay, SEQUENCE_PLAY_ERROR_ID* errorID);
bool __fastcall Sequence_continuePlay(SequenceAccountingBegin beginPlay, SequenceAccountingEnd endPlay, SEQUENCE_PLAY_ERROR_ID* errorId, unsigned long count);
bool Sequence_clearBackup();
bool __fastcall Sequence_beginPlay(SequenceAccountingBegin beginPlay, unsigned int uid, SEQUENCE_PLAY_ERROR_ID* errorID, unsigned long count);
#endif

View File

@ -22,19 +22,90 @@ static int ReturnTrue()
return 1; return 1;
} }
DWORD windowStyle = WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
int centeredX;
int centeredY;
static HWND WINAPI CreateWindowExAHook(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam)
{
centeredX = (GetSystemMetrics(SM_CXSCREEN) - nWidth) / 2;
centeredY = (GetSystemMetrics(SM_CYSCREEN) - nHeight) / 2;
lpWindowName = "OpenParrot - Pokken Tournament";
return CreateWindowExA(dwExStyle, lpClassName, lpWindowName, windowStyle, centeredX, centeredY, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
}
static HWND WINAPI CreateWindowExWHook(DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam)
{
centeredX = (GetSystemMetrics(SM_CXSCREEN) - nWidth) / 2;
centeredY = (GetSystemMetrics(SM_CYSCREEN) - nHeight) / 2;
lpWindowName = L"OpenParrot - Pokken Tournament";
return CreateWindowExW(dwExStyle, lpClassName, lpWindowName, windowStyle, centeredX, centeredY, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
}
enum class INIT_STATE : int32_t
{
CHECKING = 0,
OK = 1,
NG = 2,
NOT_CHECKED = 3,
OFFLINE = 4,
DASH = 5
};
class InitData
{
public:
uint64_t StateFunctionCurrent; //0x0000
uint64_t StateFunctionNext; //0x0008
uint32_t StateFunctionRV; //0x0010
INIT_STATE StateSN; //0x0014
INIT_STATE StateIO; //0x0018
INIT_STATE StateBackupMemory; //0x001C
INIT_STATE StateCardReader; //0x0020
INIT_STATE StateUsbController; //0x0024
INIT_STATE StateLocalNetwork; //0x0028
INIT_STATE StateAllNet; //0x002C
INIT_STATE StateGameServer; //0x0030
INIT_STATE StateMatchingServer; //0x0034
INIT_STATE StateVersion; //0x0038
INIT_STATE StateClock; //0x003C
uint32_t Timer1; //0x0040
uint32_t Timer2; //0x0044
bool Done; //0x0048
char SerialNumber[13]; //0x0049
}; //Size: 0x0056
static uintptr_t imageBase;
static __int64 __fastcall StateFunctionSN(InitData* a1)
{
a1->StateSN = INIT_STATE::OK;
sprintf(a1->SerialNumber, "TEKNOPARROT");
a1->StateFunctionNext = imageBase + 0x5902E0;
return 1;
}
static InitFunction PokkenFunc([]() static InitFunction PokkenFunc([]()
{ {
hookPort = "COM3"; hookPort = "COM3";
uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0); imageBase = (uintptr_t)GetModuleHandleA(0);
// force windowed // force windowed
// BE 01 00 00 00 8B CE -0x8 // ok 10-24 // BE 01 00 00 00 8B CE -0x8 // ok 00-24
// 18: imageBase + 0x5A5A2A // 18: imageBase + 0x5A5A2A
char* windowedPattern = hook::get_pattern<char>("BE 01 00 00 00 8B CE", -0x8); char* windowedPattern = hook::get_pattern<char>("BE 01 00 00 00 8B CE", -0x8);
if (ToBool(config["General"]["Windowed"])) if (ToBool(config["General"]["Windowed"]))
{ {
injector::MakeNOP(windowedPattern, 8); injector::MakeNOP(windowedPattern, 8);
injector::WriteMemory<BYTE>(windowedPattern + 0x48, 0x00, true); injector::WriteMemory<BYTE>(windowedPattern + 0x48, 0x00, true);
iatHook("user32.dll", CreateWindowExAHook, "CreateWindowExA");
iatHook("user32.dll", CreateWindowExWHook, "CreateWindowExW");
} }
// Remove BlockInput // Remove BlockInput
@ -42,7 +113,7 @@ static InitFunction PokkenFunc([]()
// make english into japanese // make english into japanese
// TODO: other system locales // TODO: other system locales
// 65 6E 00 00 6A 61 00 00 // ok 10-24 // 65 6E 00 00 6A 61 00 00 // ok 00-24
// 18: imageBase + 0x9AC1FC // 18: imageBase + 0x9AC1FC
char* localePattern = hook::get_pattern<char>("65 6E 00 00 6A 61 00 00"); char* localePattern = hook::get_pattern<char>("65 6E 00 00 6A 61 00 00");
injector::WriteMemory<char>(localePattern, 'j', true); injector::WriteMemory<char>(localePattern, 'j', true);
@ -50,27 +121,27 @@ static InitFunction PokkenFunc([]()
// dongle // dongle
// 41 B8 28 06 00 00 49 8B CE -0x42 // ok 10-24 // 41 B8 28 06 00 00 49 8B CE -0x42 // ok 00-24
// 18: imageBase + 0x318610 // 18: imageBase + 0x318610
safeJMP(hook::get_pattern("41 B8 28 06 00 00 49 8B CE", -0x42), PokkenGetSerial); safeJMP(hook::get_pattern("41 B8 28 06 00 00 49 8B CE", -0x42), PokkenGetSerial);
// icmp pinging // icmp pinging
// 44 89 4C 24 20 53 41 54 48 83 EC 58 // ok 10-24 // 44 89 4C 24 20 53 41 54 48 83 EC 58 // ok 00-24
// 18: imageBase + 0x609450 // 18: imageBase + 0x609450
safeJMP(hook::get_pattern("44 89 4C 24 20 53 41 54 48 83 EC 58"), ReturnTrue); safeJMP(hook::get_pattern("44 89 4C 24 20 53 41 54 48 83 EC 58"), ReturnTrue);
// subnet check (don't force 192.168.123.xxx) // subnet check (don't force 192.168.123.xxx)
// 48 8B C4 55 48 8D 68 A1 48 81 EC B0 00 00 00 48 C7 45 D7 FE // ok 10-24 // 48 8B C4 55 48 8D 68 A1 48 81 EC B0 00 00 00 48 C7 45 D7 FE // ok 00-24
// 18: imageBase + 0x60A5E0 // 18: imageBase + 0x60A5E0
safeJMP(hook::get_pattern("48 8B C4 55 48 8D 68 A1 48 81 EC B0 00 00 00 48 C7 45 D7 FE"), ReturnTrue); safeJMP(hook::get_pattern("48 8B C4 55 48 8D 68 A1 48 81 EC B0 00 00 00 48 C7 45 D7 FE"), ReturnTrue);
// no cpuid detection (crashes on Core 2?) // no cpuid detection (crashes on Core 2?)
// 48 89 5C 24 08 4C 8B C9 C7 41 08 FF FF FF FF // ok 10-24 // 48 89 5C 24 08 4C 8B C9 C7 41 08 FF FF FF FF // ok 00-24
// 18: imageBase + 0x6F7C80 // 18: imageBase + 0x6F7C80
injector::MakeRET(hook::get_pattern("48 89 5C 24 08 4C 8B C9 C7 41 08 FF FF FF FF")); injector::MakeRET(hook::get_pattern("48 89 5C 24 08 4C 8B C9 C7 41 08 FF FF FF FF"));
// don't give usb controller error #2 // don't give usb controller error #2
// 48 8D 8F F8 00 00 00 88 9F 05 01 00 00 -0x2 // ok 10-24 // 48 8D 8F F8 00 00 00 88 9F 05 01 00 00 -0x2 // ok 00-24
// 18: imageBase + 0x661820 // 18: imageBase + 0x661820
injector::MakeNOP(hook::get_pattern("48 8D 8F F8 00 00 00 88 9F 05 01 00 00", -0x2), 2); injector::MakeNOP(hook::get_pattern("48 8D 8F F8 00 00 00 88 9F 05 01 00 00", -0x2), 2);
@ -97,4 +168,10 @@ static InitFunction PokkenFunc([]()
} }
} }
}, GameID::PokkenTournament); }, GameID::PokkenTournament);
static InitFunction PokkenFunc26([]()
{
InitFunction::RunFunctions(GameID::PokkenTournament);
safeJMP(imageBase + 0x590320, StateFunctionSN);
}, GameID::PokkenTournament26);
#endif #endif

View File

@ -17,41 +17,41 @@ static bool isEventMode4P;
const char *ipaddr; const char *ipaddr;
// Data for IC card, Force Feedback etc OFF. // Data for IC card, Force Feedback etc OFF.
unsigned char settingData[406] = { unsigned char settingData[408] = {
0x1F, 0x8B, 0x08, 0x08, 0x53, 0x6A, 0x8B, 0x5A, 0x00, 0x03, 0x46, 0x73, 0x1F, 0x8B, 0x08, 0x08, 0x53, 0x6A, 0x8B, 0x5A, 0x00, 0x03, 0x46, 0x73,
0x65, 0x74, 0x74, 0x69, 0x6E, 0x67, 0x2E, 0x6C, 0x75, 0x61, 0x00, 0x85, 0x65, 0x74, 0x74, 0x69, 0x6E, 0x67, 0x2E, 0x6C, 0x75, 0x61, 0x00, 0x85,
0x93, 0xC9, 0x6E, 0xC2, 0x30, 0x10, 0x86, 0xEF, 0x79, 0x0A, 0x5E, 0x80, 0x93, 0x5B, 0x6F, 0x82, 0x30, 0x14, 0xC7, 0xDF, 0xF9, 0x14, 0x7E, 0x01,
0x8A, 0x90, 0x80, 0xE8, 0xA1, 0x07, 0x08, 0xA4, 0x20, 0x11, 0x81, 0x20, 0x17, 0x11, 0xE7, 0xDC, 0xC3, 0x1E, 0x14, 0x65, 0x9A, 0x48, 0x66, 0x94,
0x2A, 0x52, 0x6F, 0xC6, 0x19, 0x88, 0x85, 0x17, 0xE4, 0xD8, 0xAD, 0x78, 0x68, 0xB2, 0xB7, 0x5A, 0x8E, 0xD2, 0xD8, 0x8B, 0x29, 0xED, 0x16, 0xBF,
0xFB, 0xDA, 0x59, 0x1D, 0xB5, 0x2A, 0x39, 0x44, 0xF9, 0xBF, 0x59, 0x32, 0xFD, 0x5A, 0xA8, 0x50, 0xB2, 0x65, 0xF2, 0x40, 0xF8, 0xFF, 0xCE, 0x85,
0x8B, 0x3D, 0x1C, 0xFE, 0xFF, 0x78, 0xF6, 0x35, 0x28, 0x40, 0x29, 0xC2, 0x73, 0x69, 0xFB, 0xFD, 0xFF, 0x9F, 0xC0, 0xBE, 0x7A, 0x25, 0x28, 0x45,
0xAF, 0x2F, 0x54, 0x23, 0xEF, 0x49, 0xC0, 0xD0, 0xF3, 0x58, 0x84, 0x28, 0xF8, 0xF9, 0x89, 0x6A, 0x14, 0x3C, 0x08, 0xE8, 0x07, 0x01, 0x8B, 0x11,
0x39, 0xAF, 0x11, 0xCF, 0x28, 0x44, 0xC0, 0x15, 0xC8, 0xC1, 0xDB, 0x20, 0x25, 0xC7, 0x25, 0xE2, 0x39, 0x85, 0x18, 0xB8, 0x02, 0xD9, 0x7B, 0xEB,
0x08, 0x27, 0xD3, 0x51, 0x6D, 0x9A, 0x63, 0x0C, 0xB4, 0xB5, 0x34, 0x74, 0x45, 0xC3, 0x97, 0xF1, 0xC4, 0x99, 0xA6, 0x18, 0x03, 0x6D, 0x2C, 0x03,
0x21, 0xD1, 0x0D, 0x7E, 0xD1, 0x44, 0x28, 0x21, 0x5B, 0x3A, 0xF1, 0xFD, 0x47, 0x67, 0x12, 0x5D, 0xE0, 0x17, 0x4D, 0x85, 0x12, 0xB2, 0xA1, 0xCF,
0x9A, 0xA7, 0x42, 0xE3, 0x7C, 0x0B, 0x17, 0x65, 0xE8, 0x78, 0x14, 0xCE, 0x61, 0xE8, 0x78, 0x26, 0x34, 0x2E, 0xD6, 0x70, 0x52, 0x86, 0x0E, 0x07,
0x5C, 0x7C, 0x20, 0xD7, 0xDC, 0x72, 0x3F, 0x0C, 0x82, 0xA9, 0x6B, 0x48, 0xA3, 0x89, 0x8F, 0xB7, 0xE4, 0x5C, 0x58, 0x1E, 0x8E, 0xA2, 0x68, 0xEC,
0xC5, 0xFD, 0x2F, 0xBC, 0x10, 0x4A, 0x09, 0xD6, 0x25, 0x12, 0x84, 0x47, 0x1B, 0x32, 0x71, 0xFD, 0x0B, 0xCF, 0x84, 0x52, 0x82, 0xB5, 0x89, 0x04,
0xB9, 0x56, 0x60, 0x7D, 0x3D, 0xB6, 0xD0, 0x8F, 0x08, 0xC9, 0x2C, 0x12, 0xE1, 0x71, 0xA1, 0x15, 0x58, 0xDF, 0x80, 0xCD, 0xF4, 0x2D, 0x46, 0x32,
0x85, 0xCD, 0x19, 0x78, 0xEC, 0x1D, 0x31, 0xA8, 0xD5, 0xD8, 0x7A, 0x73, 0x8F, 0x45, 0x69, 0x73, 0x46, 0x01, 0x7B, 0x47, 0x0C, 0x9C, 0x1A, 0x5A,
0x33, 0x1B, 0xED, 0x90, 0x58, 0x53, 0x1A, 0x09, 0x2D, 0x8B, 0x86, 0x85, 0x6F, 0x6E, 0x66, 0xA3, 0x3D, 0x92, 0x68, 0x4A, 0x63, 0xA1, 0x65, 0x79,
0x86, 0x49, 0x80, 0x3D, 0x45, 0x8F, 0x2A, 0xE5, 0x1E, 0x9F, 0x37, 0x59, 0x67, 0x23, 0xC3, 0x24, 0xC0, 0x86, 0xA2, 0x5B, 0x9D, 0x72, 0x83, 0x8F,
0xD5, 0xE4, 0x06, 0xDB, 0xE4, 0x87, 0x6F, 0x57, 0x7D, 0x00, 0xCF, 0x9A, 0xAB, 0xBC, 0x6E, 0x72, 0x85, 0x6D, 0xF2, 0xED, 0xB7, 0xAF, 0xF6, 0xC0,
0x21, 0x24, 0x57, 0xD7, 0x1E, 0x0B, 0x89, 0x21, 0x06, 0xC8, 0xCE, 0x08, 0xF3, 0xFB, 0x10, 0xD2, 0xB3, 0x6F, 0x4F, 0x84, 0xC4, 0x90, 0x00, 0xE4,
0xDF, 0x2A, 0x74, 0x22, 0xBC, 0x98, 0xF3, 0xEC, 0x00, 0x0C, 0x99, 0xAF, 0x47, 0x84, 0x2F, 0x35, 0x3A, 0x10, 0x5E, 0x4E, 0x79, 0xBE, 0x05, 0x86,
0x2A, 0xFF, 0xEA, 0xCB, 0x0C, 0x2C, 0x11, 0x19, 0x54, 0x2E, 0xAD, 0x5C, 0xCC, 0x57, 0x9D, 0x7F, 0xF1, 0x65, 0x06, 0x96, 0x8A, 0x1C, 0x6A, 0x97,
0x92, 0xB2, 0x1E, 0x17, 0x99, 0x42, 0x79, 0x5D, 0x63, 0x44, 0x45, 0x01, 0x46, 0xCE, 0x49, 0x55, 0x8F, 0x8F, 0x4C, 0xA1, 0xDC, 0xD5, 0x18, 0x53,
0xE9, 0xE3, 0x0E, 0x75, 0x63, 0x56, 0x1E, 0x35, 0x37, 0xEA, 0x75, 0x5A, 0x51, 0x42, 0x76, 0xBB, 0x82, 0x6B, 0xCC, 0xCA, 0x9D, 0xE6, 0x46, 0xBD,
0xCB, 0x44, 0xF4, 0x64, 0xAA, 0xC1, 0x95, 0x27, 0xC8, 0x7A, 0xD6, 0x5C, 0x8E, 0x9D, 0x4C, 0x45, 0x47, 0x66, 0x1A, 0x7C, 0x79, 0x80, 0xBC, 0x63,
0xBB, 0x32, 0x96, 0xC4, 0x95, 0x47, 0xA4, 0x5C, 0xB9, 0x2C, 0x67, 0x63, 0x2D, 0xB4, 0x2F, 0x13, 0x49, 0x7C, 0xB9, 0x43, 0xCA, 0x97, 0xF3, 0x6A,
0x65, 0xB9, 0x92, 0x3D, 0xE2, 0x40, 0xAB, 0x52, 0xED, 0xB8, 0x3F, 0x84, 0x36, 0x56, 0x56, 0x2B, 0xD9, 0x20, 0x0E, 0xB4, 0x2E, 0xD5, 0x8E, 0x7B,
0x15, 0xBE, 0x51, 0x73, 0xA5, 0x24, 0xC2, 0xAA, 0x03, 0xBB, 0xCB, 0x85, 0x2F, 0xAC, 0x08, 0x8D, 0x9A, 0x2A, 0x25, 0x11, 0x56, 0x2D, 0xF8, 0x38,
0x12, 0x0E, 0x5D, 0xB7, 0x26, 0x1D, 0xBE, 0x19, 0x6A, 0x0E, 0x6D, 0x05, 0x9D, 0x28, 0xE1, 0xD0, 0x76, 0x6B, 0xD2, 0xE1, 0x8B, 0xA1, 0xE6, 0xD0,
0x52, 0xC2, 0xE0, 0x53, 0xF0, 0xA6, 0x35, 0xBB, 0x7B, 0x8B, 0xCC, 0x1F, 0xD6, 0x20, 0x23, 0x0C, 0x3E, 0x05, 0xBF, 0xB7, 0x66, 0x77, 0x6F, 0x91,
0xB7, 0xF5, 0x41, 0x71, 0x9C, 0xD6, 0x66, 0x71, 0x6D, 0xF0, 0xAC, 0xE3, 0xF9, 0xE3, 0xDA, 0x1D, 0x14, 0xCF, 0x69, 0x69, 0x16, 0xD7, 0x04, 0x4F,
0x09, 0xE1, 0x6E, 0xCE, 0xA3, 0x66, 0x0C, 0xA4, 0x35, 0xF6, 0x02, 0x7A, 0x5A, 0x9E, 0x12, 0xEE, 0xE7, 0xDC, 0x69, 0xC6, 0x40, 0x5A, 0x63, 0x27,
0x96, 0x7E, 0xC8, 0xD3, 0x7B, 0x53, 0xDE, 0xB4, 0xD5, 0x2E, 0x7E, 0xEE, 0xA0, 0x63, 0xE9, 0x86, 0x3C, 0xBC, 0x37, 0xD5, 0x4D, 0x5B, 0x7C, 0x24,
0xF9, 0x03, 0x44, 0x94, 0xFB, 0x8E, 0xB5, 0x03, 0x00, 0x00 0x8F, 0x3D, 0x7F, 0x00, 0x10, 0x1E, 0x34, 0xD9, 0xB5, 0x03, 0x00, 0x00
}; };
// FOR FREEPLAY // FOR FREEPLAY

View File

@ -6,6 +6,9 @@
#pragma comment(lib, "Ws2_32.lib") #pragma comment(lib, "Ws2_32.lib")
static const char* EnterYourName = ("ENTER YOUR NAME!");
static const char* HighScoreName = ("PLAYER BEST TIMES");
typedef unsigned int U32; typedef unsigned int U32;
typedef unsigned char U8; typedef unsigned char U8;
@ -13,10 +16,18 @@ DWORD BaseAddress10 = 0x00400000;
HWND hWndRT10 = 0; HWND hWndRT10 = 0;
static bool button1pressed = false; static bool button1pressed = false;
static bool button1pressed2 = false;
static bool button2pressed = false; static bool button2pressed = false;
static bool button3pressed = false; static bool button3pressed = false;
static bool button4pressed = false; static bool button4pressed = false;
static bool button5pressed = false;
static bool button6pressed = false;
static bool STARTpressed = false; static bool STARTpressed = false;
static bool STARTpressed2 = false;
static bool NameChoosing = false;
static bool NameViewButton = false;
static int ViewCount;
static int View2Count;
// controls // controls
extern int* ffbOffset; extern int* ffbOffset;
@ -39,13 +50,50 @@ DWORD WINAPI InputRT10(LPVOID lpParam)
while (true) while (true)
{ {
// ESCAPE QUITS GAME // ESCAPE QUITS GAME
if (GetAsyncKeyState(VK_ESCAPE) & 0x8000) if (GetAsyncKeyState(VK_ESCAPE) & 0x8000)
{ {
exit(0); exit(0);
} }
// FIX FOR NAME CHOOSING
if (strcmp((char*)0x3CB4F8 + BaseAddress10, EnterYourName) == 0 || strcmp((char*)0x3CB4FE + BaseAddress10, HighScoreName) == 0 || strcmp((char*)0x3CB4FF + BaseAddress10, HighScoreName) == 0)
NameChoosing = true;
else
NameChoosing = false;
BYTE ViewName = *(BYTE*)(0x398CB8 + BaseAddress10);
if (NameChoosing && NameViewButton)
{
if (ViewName)
{
++ViewCount;
if (ViewCount == 2)
{
injector::WriteMemory<INT32>((0x398CB8 + BaseAddress10), 0, true);
ViewCount = 0;
}
}
else
if (ViewCount > 0)
ViewCount = 0;
}
if (*ffbOffset & 0x200)
{
if (!NameChoosing && !ViewName)
{
++View2Count;
if (View2Count == 2)
{
injector::WriteMemory<INT32>((0x398CB8 + BaseAddress10), 1, true);
View2Count = 0;
}
}
}
// REAL NUMERIC KEYPAD // REAL NUMERIC KEYPAD
int keys[] = { VK_NUMPAD1, VK_NUMPAD2, VK_NUMPAD3, VK_NUMPAD4, VK_NUMPAD5, VK_NUMPAD6, VK_NUMPAD7, VK_NUMPAD8, VK_NUMPAD9, VK_MULTIPLY, VK_NUMPAD0, VK_DIVIDE }; int keys[] = { VK_NUMPAD1, VK_NUMPAD2, VK_NUMPAD3, VK_NUMPAD4, VK_NUMPAD5, VK_NUMPAD6, VK_NUMPAD7, VK_NUMPAD8, VK_NUMPAD9, VK_MULTIPLY, VK_NUMPAD0, VK_DIVIDE };
for (int i = 0; i < sizeof(keys) / sizeof(int); i++) for (int i = 0; i < sizeof(keys) / sizeof(int); i++)
@ -87,6 +135,15 @@ DWORD WINAPI InputRT10(LPVOID lpParam)
injector::WriteMemory<INT32>((0x398CB4 + BaseAddress10), 0, true); injector::WriteMemory<INT32>((0x398CB4 + BaseAddress10), 0, true);
STARTpressed = true; STARTpressed = true;
} }
else
{
if (NameChoosing && !STARTpressed2)
{
injector::WriteMemory<INT32>((0x398CB0 + BaseAddress10), 0, true);
injector::WriteMemory<INT32>((0x398CB4 + BaseAddress10), 1, true);
STARTpressed2 = true;
}
}
} }
else else
{ {
@ -95,6 +152,7 @@ DWORD WINAPI InputRT10(LPVOID lpParam)
injector::WriteMemory<INT32>((0x398CB0 + BaseAddress10), 0, true); injector::WriteMemory<INT32>((0x398CB0 + BaseAddress10), 0, true);
injector::WriteMemory<INT32>((0x398CB4 + BaseAddress10), 1, true); injector::WriteMemory<INT32>((0x398CB4 + BaseAddress10), 1, true);
STARTpressed = false; STARTpressed = false;
STARTpressed2 = false;
} }
} }
@ -107,6 +165,15 @@ DWORD WINAPI InputRT10(LPVOID lpParam)
injector::WriteMemory<INT32>((0x398CB4 + BaseAddress10), 0, true); injector::WriteMemory<INT32>((0x398CB4 + BaseAddress10), 0, true);
button1pressed = true; button1pressed = true;
} }
else
{
if (NameChoosing && !button1pressed2)
{
injector::WriteMemory<INT32>((0x398CB0 + BaseAddress10), 0, true);
injector::WriteMemory<INT32>((0x398CB4 + BaseAddress10), 1, true);
button1pressed2 = true;
}
}
} }
else else
{ {
@ -115,6 +182,7 @@ DWORD WINAPI InputRT10(LPVOID lpParam)
injector::WriteMemory<INT32>((0x398CB0 + BaseAddress10), 0, true); injector::WriteMemory<INT32>((0x398CB0 + BaseAddress10), 0, true);
injector::WriteMemory<INT32>((0x398CB4 + BaseAddress10), 1, true); injector::WriteMemory<INT32>((0x398CB4 + BaseAddress10), 1, true);
button1pressed = false; button1pressed = false;
button1pressed2 = false;
} }
} }
@ -124,7 +192,6 @@ DWORD WINAPI InputRT10(LPVOID lpParam)
{ {
if (button2pressed == false) if (button2pressed == false)
{ {
// injector::WriteMemory<INT32>((0x398CB8 + BaseAddress10), 0, true);
injector::WriteMemory<INT32>((0x398CBC + BaseAddress10), 1, true); injector::WriteMemory<INT32>((0x398CBC + BaseAddress10), 1, true);
button2pressed = true; button2pressed = true;
@ -132,6 +199,12 @@ DWORD WINAPI InputRT10(LPVOID lpParam)
{ {
injector::WriteMemory<INT32>((ptr + 0x840), 1, true); injector::WriteMemory<INT32>((ptr + 0x840), 1, true);
} }
if (NameChoosing && !NameViewButton)
{
NameViewButton = true;
injector::WriteMemory<INT32>((0x398CB8 + BaseAddress10), 1, true);
}
} }
else if (button2pressed == true) else if (button2pressed == true)
{ {
@ -142,7 +215,6 @@ DWORD WINAPI InputRT10(LPVOID lpParam)
{ {
if (button2pressed == true) if (button2pressed == true)
{ {
// injector::WriteMemory<INT32>((0x398CB8 + BaseAddress10), 1, true);
injector::WriteMemory<INT32>((0x398CBC + BaseAddress10), 0, true); injector::WriteMemory<INT32>((0x398CBC + BaseAddress10), 0, true);
button2pressed = false; button2pressed = false;
@ -150,6 +222,14 @@ DWORD WINAPI InputRT10(LPVOID lpParam)
{ {
injector::WriteMemory<INT32>((ptr + 0x840), 0, true); injector::WriteMemory<INT32>((ptr + 0x840), 0, true);
} }
if (NameViewButton)
{
NameViewButton = false;
}
if (!NameChoosing && ViewName)
injector::WriteMemory<INT32>((0x398CB8 + BaseAddress10), 0, true);
} }
} }
@ -175,7 +255,6 @@ DWORD WINAPI InputRT10(LPVOID lpParam)
{ {
if (button4pressed == false) if (button4pressed == false)
{ {
injector::WriteMemory<INT32>((0x398CB8 + BaseAddress10), 1, true); // MENU COUNTDOWN HACK
keybd_event(0x2D, MapVirtualKey(0x2D, MAPVK_VK_TO_VSC), 0, 0); keybd_event(0x2D, MapVirtualKey(0x2D, MAPVK_VK_TO_VSC), 0, 0);
button4pressed = true; button4pressed = true;
} }
@ -184,11 +263,44 @@ DWORD WINAPI InputRT10(LPVOID lpParam)
{ {
if (button4pressed == true) if (button4pressed == true)
{ {
injector::WriteMemory<INT32>((0x398CB8 + BaseAddress10), 0, true); // MENU COUNTDOWN HACK
keybd_event(0x2D, MapVirtualKey(0x2D, MAPVK_VK_TO_VSC), KEYEVENTF_KEYUP, 0); keybd_event(0x2D, MapVirtualKey(0x2D, MAPVK_VK_TO_VSC), KEYEVENTF_KEYUP, 0);
button4pressed = false; button4pressed = false;
} }
} }
// BUTTON 5/ VOL/MENU UP
if (*ffbOffset & 0x10)
{
if (button5pressed == false)
{
keybd_event(0x21, MapVirtualKey(0x21, MAPVK_VK_TO_VSC), 0, 0);
button5pressed = true;
}
}
else
{
if (button5pressed == true)
{
keybd_event(0x21, MapVirtualKey(0x21, MAPVK_VK_TO_VSC), KEYEVENTF_KEYUP, 0);
button5pressed = false;
}
}
// BUTTON 6/ VOL/MENU DOWN
if (*ffbOffset & 0x20)
{
if (button6pressed == false)
{
keybd_event(0x22, MapVirtualKey(0x22, MAPVK_VK_TO_VSC), 0, 0);
button6pressed = true;
}
}
else
{
if (button6pressed == true)
{
keybd_event(0x22, MapVirtualKey(0x22, MAPVK_VK_TO_VSC), KEYEVENTF_KEYUP, 0);
button6pressed = false;
}
}
// WHEEL // WHEEL
int iWheel = (((float)* ffbOffset2) - 128); int iWheel = (((float)* ffbOffset2) - 128);
@ -272,9 +384,9 @@ static InitFunction H2OverdriveFunc([]()
injector::WriteMemoryRaw((0x146E68 + BaseAddress10), "\x6A\x2E", 2, true); injector::WriteMemoryRaw((0x146E68 + BaseAddress10), "\x6A\x2E", 2, true);
//SERVICE REMAP to INSERT //SERVICE REMAP to INSERT
injector::WriteMemoryRaw((0x146EB2 + BaseAddress10), "\x6A\x2D", 2, true); injector::WriteMemoryRaw((0x146EB2 + BaseAddress10), "\x6A\x2D", 2, true);
//VOL+- REMAP to UP/DOWN //VOL+- REMAP to Page Up/Down
injector::WriteMemoryRaw((0x146F03 + BaseAddress10), "\x6A\x26", 2, true); injector::WriteMemoryRaw((0x146F03 + BaseAddress10), "\x6A\x21", 2, true);
injector::WriteMemoryRaw((0x146F54 + BaseAddress10), "\x6A\x28", 2, true); injector::WriteMemoryRaw((0x146F54 + BaseAddress10), "\x6A\x22", 2, true);
//ENABLE KEYPAD //ENABLE KEYPAD
injector::WriteMemoryRaw((0x186302 + BaseAddress10), "\xEB", 1, true); injector::WriteMemoryRaw((0x186302 + BaseAddress10), "\xEB", 1, true);
//KEYPAD HACK //KEYPAD HACK
@ -289,6 +401,36 @@ static InitFunction H2OverdriveFunc([]()
MH_EnableHook(MH_ALL_HOOKS); MH_EnableHook(MH_ALL_HOOKS);
} }
if (ToBool(config["Network"]["Enable"]))
{
injector::MakeNOP(0xF78AE + BaseAddress10, 6); // Stop game writing to cabinet id values
int PC1 = FetchDwordInformation("Network", "Cabinet 1 IP X.X.X.???", 256);
int PC2 = FetchDwordInformation("Network", "Cabinet 2 IP X.X.X.???", 256);
int PC3 = FetchDwordInformation("Network", "Cabinet 3 IP X.X.X.???", 256);
int PC4 = FetchDwordInformation("Network", "Cabinet 4 IP X.X.X.???", 256);
int PC5 = FetchDwordInformation("Network", "Cabinet 5 IP X.X.X.???", 256);
int PC6 = FetchDwordInformation("Network", "Cabinet 6 IP X.X.X.???", 256);
int PC7 = FetchDwordInformation("Network", "Cabinet 7 IP X.X.X.???", 256);
int PC8 = FetchDwordInformation("Network", "Cabinet 8 IP X.X.X.???", 256);
for (int i = 0; i < 255; i++) {
injector::WriteMemory<BYTE>((0x329728 + BaseAddress10) + i, 0x00, true);
}
if (PC1 > 0 && PC1 < 256) injector::WriteMemory<BYTE>((0x329728 + BaseAddress10) + PC1, 0x01, true);
if (PC2 > 0 && PC2 < 256) injector::WriteMemory<BYTE>((0x329728 + BaseAddress10) + PC2, 0x02, true);
if (PC3 > 0 && PC3 < 256) injector::WriteMemory<BYTE>((0x329728 + BaseAddress10) + PC3, 0x03, true);
if (PC4 > 0 && PC4 < 256) injector::WriteMemory<BYTE>((0x329728 + BaseAddress10) + PC4, 0x04, true);
if (PC5 > 0 && PC5 < 256) injector::WriteMemory<BYTE>((0x329728 + BaseAddress10) + PC5, 0x05, true);
if (PC6 > 0 && PC6 < 256) injector::WriteMemory<BYTE>((0x329728 + BaseAddress10) + PC6, 0x06, true);
if (PC7 > 0 && PC7 < 256) injector::WriteMemory<BYTE>((0x329728 + BaseAddress10) + PC7, 0x07, true);
if (PC8 > 0 && PC8 < 256) injector::WriteMemory<BYTE>((0x329728 + BaseAddress10) + PC8, 0x08, true);
}
injector::MakeNOP(0x1457F3 + BaseAddress10, 5); // Stop game adding certain ips if user has specific adapter
injector::MakeNOP(0x1457FB + BaseAddress10, 5); // Stop game adding certain ips if user has specific adapter
CreateThread(NULL, 0, InputRT10, NULL, 0, NULL); CreateThread(NULL, 0, InputRT10, NULL, 0, NULL);
}, GameID::H2Overdrive); }, GameID::H2Overdrive);

View File

@ -0,0 +1,505 @@
#include <StdInc.h>
#include "Utility/GameDetect.h"
#include "Utility/InitFunction.h"
#include "Functions/Global.h"
#include "Utility/Helper.h"
static bool CoinPressed;
static bool TestPressed;
static bool ServicePressed;
static bool TimeStartPressed;
static bool StartPressed;
static bool ViewPressed;
static bool HazardPressed;
static bool OverTakePressed;
static bool ShiftLeftPressed;
static bool ShiftRightPressed;
static bool SideBrakePressed;
static bool SeatSwitch1Pressed;
static bool SeatSwitch2Pressed;
static bool Gear1Pressed;
static bool Gear2Pressed;
static bool Gear3Pressed;
static bool Gear4Pressed;
static bool Gear5Pressed;
static bool Gear6Pressed;
static bool KeyPressed;
static bool init;
static bool MenuHack;
static bool MenuHackDelay;
static bool TestMode;
static DWORD imageBase;
extern int* wheelSection;
extern int* ffbOffset;
extern int* ffbOffset3;
extern int* ffbOffset4;
extern int* ffbOffset5;
void BG4ManualHack(Helpers* helpers) //Hack to allow us to select Manual
{
INT_PTR MenuTimerBase = helpers->ReadIntPtr(0x4C2924, true);
INT_PTR MenuTimerBaseA = helpers->ReadIntPtr(MenuTimerBase + 0x08, false);
INT_PTR MenuTime = helpers->ReadIntPtr(MenuTimerBaseA + 0x45C, false);
if (MenuTime == 0x1194)
{
if (!MenuHack)
{
MenuHack = true;
}
}
if (MenuTime == 0x00)
{
if (MenuHack)
{
MenuHack = false;
MenuHackDelay = false;
}
}
if (MenuHack)
{
if (!MenuHackDelay)
{
MenuHackDelay = true;
Sleep(2500);
}
helpers->WriteByte(MenuTimerBaseA + 0x454, 0x03, false);
}
}
static void BG4ProManualHack(Helpers* helpers) //Hack to allow us to select Manual and Manual with Clutch
{
INT_PTR MenuTimerBase = helpers->ReadIntPtr(0x4C2924, true);
INT_PTR MenuTimerBaseA = helpers->ReadIntPtr(MenuTimerBase + 0x08, false);
INT_PTR MenuTime = helpers->ReadIntPtr(MenuTimerBaseA + 0x45C, false);
INT_PTR VehicleSelectionBase = helpers->ReadIntPtr(0x42D4A0, true);
INT_PTR VehicleSelectionOff1 = helpers->ReadIntPtr(VehicleSelectionBase + 0x78, false);
INT_PTR VehicleSelectionOff2 = helpers->ReadIntPtr(VehicleSelectionOff1 + 0x190, false);
UINT8 VehicleSelection = helpers->ReadByte(VehicleSelectionOff2 + 0x20, false);
if (VehicleSelection)
{
if (!MenuHack)
{
MenuHack = true;
}
}
if (MenuTime == 0x00)
{
if (MenuHack)
{
MenuHack = false;
}
}
if (MenuHack)
{
helpers->WriteByte(MenuTimerBaseA + 0x454, 0x04, false);
BYTE This = helpers->ReadByte(MenuTimerBaseA + 0x44C, false);
switch (This)
{
case 0x02:
helpers->WriteByte(0x42E341, 0xD0, true); //Set Shift SEN 2 to ON or error
break;
case 0x03:
helpers->WriteByte(0x42E341, 0xE0, true); //Set Shift SEN 1 to ON or error
break;
}
}
}
void BG4ProInputs(Helpers* helpers)
{
if (!init)
{
imageBase = (DWORD)GetModuleHandleA(0);
UINT8 WaitForAttract = helpers->ReadByte(0x42D964, true);
if (WaitForAttract)
{
helpers->WriteByte(0x42E296, 0x01, true);
helpers->WriteByte(0x42E295, 0x80, true);
injector::MakeNOP(imageBase + 0x27400, 6);
init = true;
}
}
BG4ProManualHack(0);
UINT8 KeyInput = helpers->ReadByte(0x42E296, true);
if (*ffbOffset & 0x01) //Test
{
if (!TestPressed)
{
TestPressed = true;
TestMode = true;
*(BYTE*)(imageBase + 0x42E297) += 0x80;
}
}
else
{
if (TestPressed)
{
TestPressed = false;
*(BYTE*)(imageBase + 0x42E297) -= 0x80;
}
}
if (*ffbOffset & 0x02) //Service
{
if (!ServicePressed)
{
ServicePressed = true;
*(BYTE*)(imageBase + 0x42E296) += 0x40;
}
}
else
{
if (ServicePressed)
{
ServicePressed = false;
*(BYTE*)(imageBase + 0x42E296) -= 0x40;
}
}
if (*ffbOffset & 0x04) //Coin Chute 1
{
if (!CoinPressed)
{
CoinPressed = true;
*(BYTE*)(imageBase + 0x42E294) += 0x40;
if (!TestMode) //Let's get that sweet sweet sexy coin sound
{
*(BYTE*)(imageBase + 0x42E296) += 0x40;
}
}
}
else
{
if (CoinPressed)
{
CoinPressed = false;
*(BYTE*)(imageBase + 0x42E294) -= 0x40;
if (!TestMode)
{
*(BYTE*)(imageBase + 0x42E296) -= 0x40;
}
}
}
if (*ffbOffset & 0x08) //Start
{
if (!StartPressed)
{
StartPressed = true;
*(BYTE*)(imageBase + 0x42E296) += 0x80;
}
}
else
{
if (StartPressed)
{
StartPressed = false;
*(BYTE*)(imageBase + 0x42E296) -= 0x80;
}
}
if (*ffbOffset & 0x10) //Key
{
if (!KeyPressed)
{
KeyPressed = true;
if (!(KeyInput & 0x04))
{
*(BYTE*)(imageBase + 0x42E296) += 0x04;
}
else
{
*(BYTE*)(imageBase + 0x42E296) -= 0x04;
}
}
}
else
{
if (KeyPressed)
{
KeyPressed = false;
}
}
if (*ffbOffset & 0x20) //View
{
if (!ViewPressed)
{
ViewPressed = true;
*(BYTE*)(imageBase + 0x42E296) += 0x20;
}
}
else
{
if (ViewPressed)
{
ViewPressed = false;
*(BYTE*)(imageBase + 0x42E296) -= 0x20;
}
}
if (*ffbOffset & 0x40) //Hazard
{
if (!HazardPressed)
{
HazardPressed = true;
*(BYTE*)(imageBase + 0x42E296) += 0x10;
}
}
else
{
if (HazardPressed)
{
HazardPressed = false;
*(BYTE*)(imageBase + 0x42E296) -= 0x10;
}
}
if (*ffbOffset & 0x80) //Overtake
{
if (!OverTakePressed)
{
OverTakePressed = true;
*(BYTE*)(imageBase + 0x42E296) += 0x08;
}
}
else
{
if (OverTakePressed)
{
OverTakePressed = false;
*(BYTE*)(imageBase + 0x42E296) -= 0x08;
}
}
if (*ffbOffset & 0x100) //SideBrake
{
if (!SideBrakePressed)
{
SideBrakePressed = true;
*(BYTE*)(imageBase + 0x42E296) += 0x02;
}
}
else
{
if (SideBrakePressed)
{
SideBrakePressed = false;
*(BYTE*)(imageBase + 0x42E296) -= 0x02;
}
}
if (*ffbOffset & 0x200) //Shift Right
{
if (!ShiftRightPressed)
{
ShiftRightPressed = true;
*(BYTE*)(imageBase + 0x42E341) -= 0x40;
}
}
else
{
if (ShiftRightPressed)
{
ShiftRightPressed = false;
*(BYTE*)(imageBase + 0x42E341) += 0x40;
}
}
if (*ffbOffset & 0x400) //Shift Left
{
if (!ShiftLeftPressed)
{
ShiftLeftPressed = true;
*(BYTE*)(imageBase + 0x42E341) -= 0x80;
}
}
else
{
if (ShiftLeftPressed)
{
ShiftLeftPressed = false;
*(BYTE*)(imageBase + 0x42E341) += 0x80;
}
}
if (*ffbOffset & 0x800) //Timer Start
{
if (!TimeStartPressed)
{
TimeStartPressed = true;
*(BYTE*)(imageBase + 0x42E295) += 0x01;
}
}
else
{
if (TimeStartPressed)
{
TimeStartPressed = false;
*(BYTE*)(imageBase + 0x42E295) -= 0x01;
}
}
if (*ffbOffset & 0x1000) //Seat Switch 1
{
if (!SeatSwitch1Pressed)
{
SeatSwitch1Pressed = true;
*(BYTE*)(imageBase + 0x42E295) += 0x04;
}
}
else
{
if (SeatSwitch1Pressed)
{
SeatSwitch1Pressed = false;
*(BYTE*)(imageBase + 0x42E295) -= 0x04;
}
}
if (*ffbOffset & 0x2000) //Seat Switch 2
{
if (!SeatSwitch2Pressed)
{
SeatSwitch2Pressed = true;
*(BYTE*)(imageBase + 0x42E295) += 0x02;
}
}
else
{
if (SeatSwitch2Pressed)
{
SeatSwitch2Pressed = false;
*(BYTE*)(imageBase + 0x42E295) -= 0x02;
}
}
if (*ffbOffset & 0x4000) //Gear 1
{
if ((!Gear1Pressed) && (!Gear2Pressed) && (!Gear3Pressed) && (!Gear4Pressed) && (!Gear5Pressed) && (!Gear6Pressed))
{
Gear1Pressed = true;
*(BYTE*)(imageBase + 0x42E295) -= 0x80;
*(BYTE*)(imageBase + 0x42E341) -= 0x80;
}
}
else
{
if (Gear1Pressed)
{
Gear1Pressed = false;
*(BYTE*)(imageBase + 0x42E295) += 0x80;
*(BYTE*)(imageBase + 0x42E341) += 0x80;
}
}
if (*ffbOffset & 0x8000) //Gear 2
{
if ((!Gear2Pressed) && (!Gear1Pressed) && (!Gear3Pressed) && (!Gear4Pressed) && (!Gear5Pressed) && (!Gear6Pressed))
{
Gear2Pressed = true;
*(BYTE*)(imageBase + 0x42E296) -= 0x01;
*(BYTE*)(imageBase + 0x42E341) -= 0x80;
}
}
else
{
if (Gear2Pressed)
{
Gear2Pressed = false;
*(BYTE*)(imageBase + 0x42E296) += 0x01;
*(BYTE*)(imageBase + 0x42E341) += 0x80;
}
}
if (*ffbOffset & 0x10000) //Gear 3 / Shift Up
{
if ((!Gear3Pressed) && (!Gear2Pressed) && (!Gear1Pressed) && (!Gear4Pressed) && (!Gear5Pressed) && (!Gear6Pressed))
{
Gear3Pressed = true;
*(BYTE*)(imageBase + 0x42E296) -= 0x01;
}
}
else
{
if (Gear3Pressed)
{
Gear3Pressed = false;
*(BYTE*)(imageBase + 0x42E296) += 0x01;
}
}
if (*ffbOffset & 0x20000) //Gear 4 / Shift Down
{
if ((!Gear4Pressed) && (!Gear2Pressed) && (!Gear3Pressed) && (!Gear1Pressed) && (!Gear5Pressed) && (!Gear6Pressed))
{
Gear4Pressed = true;
*(BYTE*)(imageBase + 0x42E295) -= 0x80;
}
}
else
{
if (Gear4Pressed)
{
Gear4Pressed = false;
*(BYTE*)(imageBase + 0x42E295) += 0x80;
}
}
if (*ffbOffset & 0x40000) //Gear 5
{
if ((!Gear5Pressed) && (!Gear2Pressed) && (!Gear3Pressed) && (!Gear4Pressed) && (!Gear1Pressed) && (!Gear6Pressed))
{
Gear5Pressed = true;
*(BYTE*)(imageBase + 0x42E295) -= 0x80;
*(BYTE*)(imageBase + 0x42E341) -= 0x40;
}
}
else
{
if (Gear5Pressed)
{
Gear5Pressed = false;
*(BYTE*)(imageBase + 0x42E295) += 0x80;
*(BYTE*)(imageBase + 0x42E341) += 0x40;
}
}
if (*ffbOffset & 0x80000) //Gear 6/Reverse
{
if ((!Gear6Pressed) && (!Gear2Pressed) && (!Gear3Pressed) && (!Gear4Pressed) && (!Gear5Pressed) && (!Gear1Pressed))
{
Gear6Pressed = true;
*(BYTE*)(imageBase + 0x42E296) -= 0x01;
*(BYTE*)(imageBase + 0x42E341) -= 0x40;
}
}
else
{
if (Gear6Pressed)
{
Gear6Pressed = false;
*(BYTE*)(imageBase + 0x42E296) += 0x01;
*(BYTE*)(imageBase + 0x42E341) += 0x40;
}
}
*(float*)(imageBase + 0x42D994) = (*wheelSection - 128) / 128.0; // Steering
*(float*)(imageBase + 0x42D998) = (*ffbOffset3) / 255.0; // Gas
*(float*)(imageBase + 0x42D99C) = (*ffbOffset4) / 255.0; // Brake
*(float*)(imageBase + 0x42D9A0) = (*ffbOffset5) / 255.0; // Clutch
}

View File

@ -376,7 +376,16 @@ HRESULT __stdcall Hook_DirectInput8Create(HINSTANCE hinst, DWORD dwVersion, REFI
static InitFunction initFunc([]() static InitFunction initFunc([]()
{ {
if (GameDetect::currentGame == GameID::PokkenTournament || GameDetect::currentGame == GameID::FNFDrift || GameDetect::currentGame == GameID::FNFSC || GameDetect::currentGame == GameID::FNF || GameDetect::currentGame == GameID::FNFSB || GameDetect::currentGame == GameID::FNFSB2 || GameDetect::currentGame == GameID::JLeague) if (GameDetect::currentGame == GameID::PokkenTournament
|| GameDetect::currentGame == GameID::PokkenTournament26
|| GameDetect::currentGame == GameID::FNFDrift
|| GameDetect::currentGame == GameID::FNFSC
|| GameDetect::currentGame == GameID::FNF
|| GameDetect::currentGame == GameID::FNFSB
|| GameDetect::currentGame == GameID::FNFSB2
|| GameDetect::currentGame == GameID::JLeague
|| GameDetect::currentGame == GameID::VF5Esports
|| GameDetect::currentGame == GameID::VF5EsportsTest)
return; return;
MH_Initialize(); MH_Initialize();

View File

@ -0,0 +1,163 @@
#include <StdInc.h>
#include "Utility/GameDetect.h"
#include "Utility/InitFunction.h"
#include "Functions/Global.h"
#include "Utility/Helper.h"
void KOFSkyStageInputs(Helpers* helpers)
{
UINT8 JVSInput1 = helpers->ReadByte(0x2DF304, true);
UINT8 JVSInput1A = helpers->ReadByte(0x2DF305, true);
UINT8 Joystick1Up = helpers->ReadByte(0x37085A, true);
UINT8 Joystick1Down = helpers->ReadByte(0x370860, true);
UINT8 Joystick1Left = helpers->ReadByte(0x370866, true);
UINT8 Joystick1Right = helpers->ReadByte(0x37086C, true);
UINT8 Joystick1Start = helpers->ReadByte(0x37088A, true);
UINT8 Joystick1Button1 = helpers->ReadByte(0x370890, true);
UINT8 Joystick1Button2 = helpers->ReadByte(0x370896, true);
UINT8 Joystick1Button3 = helpers->ReadByte(0x37089C, true);
UINT8 JVSInput2 = helpers->ReadByte(0x2DF306, true);
UINT8 JVSInput2A = helpers->ReadByte(0x2DF307, true);
UINT8 Joystick2Up = helpers->ReadByte(0x370950, true);
UINT8 Joystick2Down = helpers->ReadByte(0x370956, true);
UINT8 Joystick2Left = helpers->ReadByte(0x37095C, true);
UINT8 Joystick2Right = helpers->ReadByte(0x370962, true);
UINT8 Joystick2Start = helpers->ReadByte(0x370980, true);
UINT8 Joystick2Button1 = helpers->ReadByte(0x370986, true);
UINT8 Joystick2Button2 = helpers->ReadByte(0x37098C, true);
UINT8 Joystick2Button3 = helpers->ReadByte(0x370992, true);
if (!(JVSInput1 & 0x20))
{
if (Joystick1Up == 0x01)
{
helpers->WriteByte(0x37085A, 0x00, true);
}
}
if (!(JVSInput1 & 0x10))
{
if (Joystick1Down == 0x01)
{
helpers->WriteByte(0x370860, 0x00, true);
}
}
if (!(JVSInput1 & 0x08))
{
if (Joystick1Left == 0x01)
{
helpers->WriteByte(0x370866, 0x00, true);
}
}
if (!(JVSInput1 & 0x04))
{
if (Joystick1Right == 0x01)
{
helpers->WriteByte(0x37086C, 0x00, true);
}
}
if (!(JVSInput1 & 0x80))
{
if (Joystick1Start == 0x01)
{
helpers->WriteByte(0x37088A, 0x00, true);
}
}
if (!(JVSInput1 & 0x02))
{
if (Joystick1Button1 == 0x01)
{
helpers->WriteByte(0x370890, 0x00, true);
helpers->WriteByte(0x370872, 0x00, true);
}
}
if (!(JVSInput1 & 0x01))
{
if (Joystick1Button2 == 0x01)
{
helpers->WriteByte(0x370896, 0x00, true);
helpers->WriteByte(0x370878, 0x00, true);
}
}
if (!(JVSInput1A & 0x80))
{
if (Joystick1Button3 == 0x01)
{
helpers->WriteByte(0x37089C, 0x00, true);
helpers->WriteByte(0x370884, 0x00, true);
}
}
if (!(JVSInput2 & 0x20))
{
if (Joystick2Up == 0x01)
{
helpers->WriteByte(0x370950, 0x00, true);
}
}
if (!(JVSInput2 & 0x10))
{
if (Joystick2Down == 0x01)
{
helpers->WriteByte(0x370956, 0x00, true);
}
}
if (!(JVSInput2 & 0x08))
{
if (Joystick2Left == 0x01)
{
helpers->WriteByte(0x37095C, 0x00, true);
}
}
if (!(JVSInput2 & 0x04))
{
if (Joystick2Right == 0x01)
{
helpers->WriteByte(0x370962, 0x00, true);
}
}
if (!(JVSInput2 & 0x80))
{
if (Joystick2Start == 0x01)
{
helpers->WriteByte(0x370980, 0x00, true);
}
}
if (!(JVSInput2 & 0x02))
{
if (Joystick2Button1 == 0x01)
{
helpers->WriteByte(0x370986, 0x00, true);
helpers->WriteByte(0x370968, 0x00, true);
}
}
if (!(JVSInput2 & 0x01))
{
if (Joystick2Button2 == 0x01)
{
helpers->WriteByte(0x37098C, 0x00, true);
helpers->WriteByte(0x37096E, 0x00, true);
}
}
if (!(JVSInput2A & 0x80))
{
if (Joystick2Button3 == 0x01)
{
helpers->WriteByte(0x370992, 0x00, true);
helpers->WriteByte(0x37097A, 0x00, true);
}
}
}

View File

@ -11,32 +11,11 @@ extern int* ffbOffset;
extern int* ffbOffset3; extern int* ffbOffset3;
extern int* ffbOffset4; extern int* ffbOffset4;
extern int* ffbOffset5; extern int* ffbOffset5;
static Helpers* myHelpers;
static bool CoinPressed = false; extern void BG4ManualHack(Helpers* helpers);
static bool TestPressed = false; extern void BG4ProInputs(Helpers* helpers);
static bool ServicePressed = false; extern void KOFSkyStageInputs(Helpers* helpers);
static bool TimeStartPressed = false; static bool ProMode;
static bool StartPressed = false;
static bool ViewPressed = false;
static bool HazardPressed = false;
static bool OverTakePressed = false;
static bool ShiftLeftPressed = false;
static bool ShiftRightPressed = false;
static bool SideBrakePressed = false;
static bool SeatSwitch1Pressed = false;
static bool SeatSwitch2Pressed = false;
static bool Gear1Pressed = false;
static bool Gear2Pressed = false;
static bool Gear3Pressed = false;
static bool Gear4Pressed = false;
static bool Gear5Pressed = false;
static bool Gear6Pressed = false;
static bool KeyPressed = false;
static bool init = false;
static bool MenuHack = false;
static bool MenuHackDelay = false;
static bool TestMode = false;
void AddCommOverride(HANDLE hFile); void AddCommOverride(HANDLE hFile);
@ -396,661 +375,22 @@ BOOL __stdcall WriteFileWrapTx2(HANDLE hFile,
return WriteFile(hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, lpOverlapped); return WriteFile(hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, lpOverlapped);
} }
static DWORD WINAPI ChangeValues(LPVOID lpParam) static DWORD WINAPI RunningLoop(LPVOID lpParam)
{ {
Sleep(10000); while (true)
DWORD imageBase = (DWORD)GetModuleHandleA(0);
myHelpers->WriteByte(0x42E296, 0x01, true);
myHelpers->WriteByte(0x42E295, 0x80, true);
injector::MakeNOP(imageBase + 0x27400, 6);
return 0;
}
static int BG4ThreadLoop(Helpers* helpers)
{
//Hack to allow us to select Manual
INT_PTR MenuTimerBase = helpers->ReadIntPtr(0x4C2924, true);
INT_PTR MenuTimerBaseA = helpers->ReadIntPtr(MenuTimerBase + 0x08, false);
INT_PTR MenuTime = helpers->ReadIntPtr(MenuTimerBaseA + 0x45C, false);
if (MenuTime == 0x1194)
{ {
if (!MenuHack) switch (GameDetect::currentGame)
{ {
MenuHack = true; case GameID::BG4:
} if (ProMode)
} BG4ProInputs(0);
if (MenuTime == 0x00)
{
if (MenuHack)
{
MenuHack = false;
MenuHackDelay = false;
}
}
if (MenuHack)
{
if (!MenuHackDelay)
{
MenuHackDelay = true;
Sleep(2500);
}
helpers->WriteByte(MenuTimerBaseA + 0x454, 0x03, false);
}
return 0;
}
static int BG4ProThreadLoop(Helpers* helpers)
{
if (!init)
{
init = true;
myHelpers = helpers;
CreateThread(NULL, 0, ChangeValues, NULL, 0, NULL);
}
//Hack to allow us to select Manual and Manual with Clutch
INT_PTR MenuTimerBase = helpers->ReadIntPtr(0x4C2924, true);
INT_PTR MenuTimerBaseA = helpers->ReadIntPtr(MenuTimerBase + 0x08, false);
INT_PTR MenuTime = helpers->ReadIntPtr(MenuTimerBaseA + 0x45C, false);
if (MenuTime == 0x1194)
{
if (!MenuHack)
{
MenuHack = true;
}
}
if (MenuTime == 0x00)
{
if (MenuHack)
{
MenuHack = false;
MenuHackDelay = false;
}
}
if (MenuHack)
{
if (!MenuHackDelay)
{
MenuHackDelay = true;
Sleep(2500);
}
helpers->WriteByte(MenuTimerBaseA + 0x454, 0x04, false);
BYTE This = helpers->ReadByte(MenuTimerBaseA + 0x44C,false);
if (This == 0x02)
{
helpers->WriteByte(0x42E341, 0xD0, true); //Set Shift SEN 2 to ON or error
}
else if (This == 0x03)
{
helpers->WriteByte(0x42E341, 0xE0, true); //Set Shift SEN 1 to ON or error
}
}
DWORD imageBase = (DWORD)GetModuleHandleA(0);
UINT8 KeyInput = helpers->ReadByte(imageBase + 0x42E296, false);
if (*ffbOffset & 0x100) //Test
{
if (!TestPressed)
{
TestPressed = true;
TestMode = true;
*(BYTE*)(imageBase + 0x42E297) += 0x80;
}
}
else
{
if (TestPressed)
{
TestPressed = false;
*(BYTE*)(imageBase + 0x42E297) -= 0x80;
}
}
if (*ffbOffset & 0x200) //Service
{
if (!ServicePressed)
{
ServicePressed = true;
*(BYTE*)(imageBase + 0x42E296) += 0x40;
}
}
else
{
if (ServicePressed)
{
ServicePressed = false;
*(BYTE*)(imageBase + 0x42E296) -= 0x40;
}
}
if (*ffbOffset & 0x800) //Shift Left
{
if (!ShiftLeftPressed)
{
ShiftLeftPressed = true;
*(BYTE*)(imageBase + 0x42E341) -= 0x80;
}
}
else
{
if (ShiftLeftPressed)
{
ShiftLeftPressed = false;
*(BYTE*)(imageBase + 0x42E341) += 0x80;
}
}
if (*ffbOffset & 0x4000) //Shift Right
{
if (!ShiftRightPressed)
{
ShiftRightPressed = true;
*(BYTE*)(imageBase + 0x42E341) -= 0x40;
}
}
else
{
if (ShiftRightPressed)
{
ShiftRightPressed = false;
*(BYTE*)(imageBase + 0x42E341) += 0x40;
}
}
if (*ffbOffset & 0x40) //Start
{
if (!StartPressed)
{
StartPressed = true;
*(BYTE*)(imageBase + 0x42E296) += 0x80;
}
}
else
{
if (StartPressed)
{
StartPressed = false;
*(BYTE*)(imageBase + 0x42E296) -= 0x80;
}
}
if (*ffbOffset & 0x8000) //View
{
if (!ViewPressed)
{
ViewPressed = true;
*(BYTE*)(imageBase + 0x42E296) += 0x20;
}
}
else
{
if (ViewPressed)
{
ViewPressed = false;
*(BYTE*)(imageBase + 0x42E296) -= 0x20;
}
}
if (*ffbOffset & 0x01) //Hazard
{
if (!HazardPressed)
{
HazardPressed = true;
*(BYTE*)(imageBase + 0x42E296) += 0x10;
}
}
else
{
if (HazardPressed)
{
HazardPressed = false;
*(BYTE*)(imageBase + 0x42E296) -= 0x10;
}
}
if (*ffbOffset & 0x20) //Overtake
{
if (!OverTakePressed)
{
OverTakePressed = true;
*(BYTE*)(imageBase + 0x42E296) += 0x08;
}
}
else
{
if (OverTakePressed)
{
OverTakePressed = false;
*(BYTE*)(imageBase + 0x42E296) -= 0x08;
}
}
if (*ffbOffset & 0x02) //SideBrake
{
if (!SideBrakePressed)
{
SideBrakePressed = true;
*(BYTE*)(imageBase + 0x42E296) += 0x02;
}
}
else
{
if (SideBrakePressed)
{
SideBrakePressed = false;
*(BYTE*)(imageBase + 0x42E296) -= 0x02;
}
}
if (*ffbOffset & 0x10000) //Timer Start
{
if (!TimeStartPressed)
{
TimeStartPressed = true;
*(BYTE*)(imageBase + 0x42E295) += 0x01;
}
}
else
{
if (TimeStartPressed)
{
TimeStartPressed = false;
*(BYTE*)(imageBase + 0x42E295) -= 0x01;
}
}
if (*ffbOffset & 0x20000) //Seat Switch 1
{
if (!SeatSwitch1Pressed)
{
SeatSwitch1Pressed = true;
*(BYTE*)(imageBase + 0x42E295) += 0x04;
}
}
else
{
if (SeatSwitch1Pressed)
{
SeatSwitch1Pressed = false;
*(BYTE*)(imageBase + 0x42E295) -= 0x04;
}
}
if (*ffbOffset & 0x40000) //Seat Switch 2
{
if (!SeatSwitch2Pressed)
{
SeatSwitch2Pressed = true;
*(BYTE*)(imageBase + 0x42E295) += 0x02;
}
}
else
{
if (SeatSwitch2Pressed)
{
SeatSwitch2Pressed = false;
*(BYTE*)(imageBase + 0x42E295) -= 0x02;
}
}
if (*ffbOffset & 0x400) //Coin Chute 1
{
if (!CoinPressed)
{
CoinPressed = true;
*(BYTE*)(imageBase + 0x42E294) += 0x40;
if (!TestMode) //Let's get that sweet sweet sexy coin sound
{
*(BYTE*)(imageBase + 0x42E296) += 0x40;
}
}
}
else
{
if (CoinPressed)
{
CoinPressed = false;
*(BYTE*)(imageBase + 0x42E294) -= 0x40;
if (!TestMode)
{
*(BYTE*)(imageBase + 0x42E296) -= 0x40;
}
}
}
if (*ffbOffset & 0x2000) //Key
{
if (!KeyPressed)
{
KeyPressed = true;
if (!(KeyInput & 0x04))
{
*(BYTE*)(imageBase + 0x42E296) += 0x04;
}
else else
{ BG4ManualHack(0);
*(BYTE*)(imageBase + 0x42E296) -= 0x04; break;
} case GameID::KOFSkyStage100J:
KOFSkyStageInputs(0);
break;
} }
}
else
{
if (KeyPressed)
{
KeyPressed = false;
}
}
if (*ffbOffset & 0x100000) //Gear 1
{
if ((!Gear1Pressed) && (!Gear2Pressed) && (!Gear3Pressed) && (!Gear4Pressed) && (!Gear5Pressed) && (!Gear6Pressed))
{
Gear1Pressed = true;
*(BYTE*)(imageBase + 0x42E295) -= 0x80;
*(BYTE*)(imageBase + 0x42E341) -= 0x80;
}
}
else
{
if (Gear1Pressed)
{
Gear1Pressed = false;
*(BYTE*)(imageBase + 0x42E295) += 0x80;
*(BYTE*)(imageBase + 0x42E341) += 0x80;
}
}
if (*ffbOffset & 0x200000) //Gear 2
{
if ((!Gear2Pressed) && (!Gear1Pressed) && (!Gear3Pressed) && (!Gear4Pressed) && (!Gear5Pressed) && (!Gear6Pressed))
{
Gear2Pressed = true;
*(BYTE*)(imageBase + 0x42E296) -= 0x01;
*(BYTE*)(imageBase + 0x42E341) -= 0x80;
}
}
else
{
if (Gear2Pressed)
{
Gear2Pressed = false;
*(BYTE*)(imageBase + 0x42E296) += 0x01;
*(BYTE*)(imageBase + 0x42E341) += 0x80;
}
}
if (*ffbOffset & 0x08) //Gear 3 / Shift Up
{
if ((!Gear3Pressed) && (!Gear2Pressed) && (!Gear1Pressed) && (!Gear4Pressed) && (!Gear5Pressed) && (!Gear6Pressed))
{
Gear3Pressed = true;
*(BYTE*)(imageBase + 0x42E296) -= 0x01;
}
}
else
{
if (Gear3Pressed)
{
Gear3Pressed = false;
*(BYTE*)(imageBase + 0x42E296) += 0x01;
}
}
if (*ffbOffset & 0x04) //Gear 4 / Shift Down
{
if ((!Gear4Pressed) && (!Gear2Pressed) && (!Gear3Pressed) && (!Gear1Pressed) && (!Gear5Pressed) && (!Gear6Pressed))
{
Gear4Pressed = true;
*(BYTE*)(imageBase + 0x42E295) -= 0x80;
}
}
else
{
if (Gear4Pressed)
{
Gear4Pressed = false;
*(BYTE*)(imageBase + 0x42E295) += 0x80;
}
}
if (*ffbOffset & 0x1000000) //Gear 5
{
if ((!Gear5Pressed) && (!Gear2Pressed) && (!Gear3Pressed) && (!Gear4Pressed) && (!Gear1Pressed) && (!Gear6Pressed))
{
Gear5Pressed = true;
*(BYTE*)(imageBase + 0x42E295) -= 0x80;
*(BYTE*)(imageBase + 0x42E341) -= 0x40;
}
}
else
{
if (Gear5Pressed)
{
Gear5Pressed = false;
*(BYTE*)(imageBase + 0x42E295) += 0x80;
*(BYTE*)(imageBase + 0x42E341) += 0x40;
}
}
if (*ffbOffset & 0x2000000) //Gear 6/Reverse
{
if ((!Gear6Pressed) && (!Gear2Pressed) && (!Gear3Pressed) && (!Gear4Pressed) && (!Gear5Pressed) && (!Gear1Pressed))
{
Gear6Pressed = true;
*(BYTE*)(imageBase + 0x42E296) -= 0x01;
*(BYTE*)(imageBase + 0x42E341) -= 0x40;
}
}
else
{
if (Gear6Pressed)
{
Gear6Pressed = false;
*(BYTE*)(imageBase + 0x42E296) += 0x01;
*(BYTE*)(imageBase + 0x42E341) += 0x40;
}
}
*(float*)(imageBase + 0x42D994) = (*wheelSection - 128) / 128.0; // Steering
*(float*)(imageBase + 0x42D998) = (*ffbOffset3) / 255.0; // Gas
*(float*)(imageBase + 0x42D99C) = (*ffbOffset4) / 255.0; // Brake
*(float*)(imageBase + 0x42D9A0) = (*ffbOffset5) / 255.0; // Clutch
return 0;
}
static int KOFSkyStageThreadLoop(Helpers* helpers) // Temp Fix for turbo fire (Remove when proper fix sorted)
{
UINT8 JVSInput1 = helpers->ReadByte(0x2DF304, true);
UINT8 JVSInput1A = helpers->ReadByte(0x2DF305, true);
UINT8 Joystick1Up = helpers->ReadByte(0x37085A, true);
UINT8 Joystick1Down = helpers->ReadByte(0x370860, true);
UINT8 Joystick1Left = helpers->ReadByte(0x370866, true);
UINT8 Joystick1Right = helpers->ReadByte(0x37086C, true);
UINT8 Joystick1Start = helpers->ReadByte(0x37088A, true);
UINT8 Joystick1Button1 = helpers->ReadByte(0x370890, true);
UINT8 Joystick1Button2 = helpers->ReadByte(0x370896, true);
UINT8 Joystick1Button3 = helpers->ReadByte(0x37089C, true);
UINT8 JVSInput2 = helpers->ReadByte(0x2DF306, true);
UINT8 JVSInput2A = helpers->ReadByte(0x2DF307, true);
UINT8 Joystick2Up = helpers->ReadByte(0x370950, true);
UINT8 Joystick2Down = helpers->ReadByte(0x370956, true);
UINT8 Joystick2Left = helpers->ReadByte(0x37095C, true);
UINT8 Joystick2Right = helpers->ReadByte(0x370962, true);
UINT8 Joystick2Start = helpers->ReadByte(0x370980, true);
UINT8 Joystick2Button1 = helpers->ReadByte(0x370986, true);
UINT8 Joystick2Button2 = helpers->ReadByte(0x37098C, true);
UINT8 Joystick2Button3 = helpers->ReadByte(0x370992, true);
if (!(JVSInput1 & 0x20))
{
if (Joystick1Up == 0x01)
{
helpers->WriteByte(0x37085A, 0x00, true);
}
}
if (!(JVSInput1 & 0x10))
{
if (Joystick1Down == 0x01)
{
helpers->WriteByte(0x370860, 0x00, true);
}
}
if (!(JVSInput1 & 0x08))
{
if (Joystick1Left == 0x01)
{
helpers->WriteByte(0x370866, 0x00, true);
}
}
if (!(JVSInput1 & 0x04))
{
if (Joystick1Right == 0x01)
{
helpers->WriteByte(0x37086C, 0x00, true);
}
}
if (!(JVSInput1 & 0x80))
{
if (Joystick1Start == 0x01)
{
helpers->WriteByte(0x37088A, 0x00, true);
}
}
if (!(JVSInput1 & 0x02))
{
if (Joystick1Button1 == 0x01)
{
helpers->WriteByte(0x370890, 0x00, true);
helpers->WriteByte(0x370872, 0x00, true);
}
}
if (!(JVSInput1 & 0x01))
{
if (Joystick1Button2 == 0x01)
{
helpers->WriteByte(0x370896, 0x00, true);
helpers->WriteByte(0x370878, 0x00, true);
}
}
if (!(JVSInput1A & 0x80))
{
if (Joystick1Button3 == 0x01)
{
helpers->WriteByte(0x37089C, 0x00, true);
helpers->WriteByte(0x370884, 0x00, true);
}
}
if (!(JVSInput2 & 0x20))
{
if (Joystick2Up == 0x01)
{
helpers->WriteByte(0x370950, 0x00, true);
}
}
if (!(JVSInput2 & 0x10))
{
if (Joystick2Down == 0x01)
{
helpers->WriteByte(0x370956, 0x00, true);
}
}
if (!(JVSInput2 & 0x08))
{
if (Joystick2Left == 0x01)
{
helpers->WriteByte(0x37095C, 0x00, true);
}
}
if (!(JVSInput2 & 0x04))
{
if (Joystick2Right == 0x01)
{
helpers->WriteByte(0x370962, 0x00, true);
}
}
if (!(JVSInput2 & 0x80))
{
if (Joystick2Start == 0x01)
{
helpers->WriteByte(0x370980, 0x00, true);
}
}
if (!(JVSInput2 & 0x02))
{
if (Joystick2Button1 == 0x01)
{
helpers->WriteByte(0x370986, 0x00, true);
helpers->WriteByte(0x370968, 0x00, true);
}
}
if (!(JVSInput2 & 0x01))
{
if (Joystick2Button2 == 0x01)
{
helpers->WriteByte(0x37098C, 0x00, true);
helpers->WriteByte(0x37096E, 0x00, true);
}
}
if (!(JVSInput2A & 0x80))
{
if (Joystick2Button3 == 0x01)
{
helpers->WriteByte(0x370992, 0x00, true);
helpers->WriteByte(0x37097A, 0x00, true);
}
}
return 0;
}
static DWORD WINAPI BG4ProRunningLoop(LPVOID lpParam)
{
while (true)
{
BG4ProThreadLoop(0);
Sleep(16);
}
}
static DWORD WINAPI BG4RunningLoop(LPVOID lpParam)
{
while (true)
{
BG4ThreadLoop(0);
Sleep(16);
}
}
static DWORD WINAPI KOFSkyStageRunningLoop(LPVOID lpParam)
{
while (true)
{
KOFSkyStageThreadLoop(0);
Sleep(16); Sleep(16);
} }
} }
@ -1184,7 +524,9 @@ static InitFunction initFunction([]()
injector::MakeRET(0x5F21B0, 4); injector::MakeRET(0x5F21B0, 4);
} }
if (ToBool(config["General"]["Professional Edition Enable"])) ProMode = (ToBool(config["General"]["Professional Edition Enable"]));
if (ProMode)
{ {
injector::MakeNOP(imageBase + 0x1E7AB, 6); injector::MakeNOP(imageBase + 0x1E7AB, 6);
injector::MakeNOP(imageBase + 0x1E7DC, 6); injector::MakeNOP(imageBase + 0x1E7DC, 6);
@ -1195,18 +537,17 @@ static InitFunction initFunction([]()
injector::MakeNOP(imageBase + 0x1E799, 6); injector::MakeNOP(imageBase + 0x1E799, 6);
injector::MakeNOP(imageBase + 0x1E880, 6); injector::MakeNOP(imageBase + 0x1E880, 6);
injector::MakeNOP(imageBase + 0x27447, 3); injector::MakeNOP(imageBase + 0x27447, 3);
// Fix 6MT warning upon key entry
injector::WriteMemoryRaw(imageBase + 0xD4AC3, "\xE9\x0E\x01\x00", 4, true);
if (ToBool(config["General"]["Professional Edition Hold Gear"])) if (ToBool(config["General"]["Professional Edition Hold Gear"]))
{ {
injector::MakeNOP(imageBase + 0x8ADFF, 10); injector::MakeNOP(imageBase + 0x8ADFF, 10);
} }
}
CreateThread(NULL, 0, BG4ProRunningLoop, NULL, 0, NULL); CreateThread(NULL, 0, RunningLoop, NULL, 0, NULL);
}
else
{
CreateThread(NULL, 0, BG4RunningLoop, NULL, 0, NULL);
}
// IP stuff for working LAN // IP stuff for working LAN
static const char* BroadcastAddress = config["Network"]["BroadcastAddress"].c_str(); static const char* BroadcastAddress = config["Network"]["BroadcastAddress"].c_str();
@ -1502,7 +843,7 @@ static InitFunction initFunction([]()
//Temp Fix (Remove when properly sorted) //Temp Fix (Remove when properly sorted)
injector::MakeNOP(imageBase + 0xBD675, 3); injector::MakeNOP(imageBase + 0xBD675, 3);
CreateThread(NULL, 0, KOFSkyStageRunningLoop, NULL, 0, NULL); CreateThread(NULL, 0, RunningLoop, NULL, 0, NULL);
// don't hide windows and don't break desktop // don't hide windows and don't break desktop
injector::WriteMemory<BYTE>(imageBase + 0x12F6E2, 0xEB, true); injector::WriteMemory<BYTE>(imageBase + 0x12F6E2, 0xEB, true);

File diff suppressed because it is too large Load Diff

View File

@ -28,54 +28,61 @@ NesysEmu::NesysEmu()
m_commandHandlers[LCOMMAND_CONNECT_REQUEST] = [=](const uint8_t* data, size_t length) m_commandHandlers[LCOMMAND_CONNECT_REQUEST] = [=](const uint8_t* data, size_t length)
{ {
SendResponse(SCOMMAND_CONNECT_REPLY, nullptr); if (GameDetect::currentGame != GameID::SFV)
Sleep(100);
// h
struct __declspec(align(4)) NESYS_TENPO_TABLE
{ {
int tenpo_id; SendResponse(SCOMMAND_CONNECT_REPLY, nullptr);
char tenpo_name[31];
char tenpo_addr[33];
char ticket[33];
char pref_name[17];
};
struct NESYS_NEWS_TABLE
Sleep(100);
// h
struct __declspec(align(4)) NESYS_TENPO_TABLE
{
int tenpo_id;
char tenpo_name[31];
char tenpo_addr[33];
char ticket[33];
char pref_name[17];
};
struct NESYS_NEWS_TABLE
{
int type;
int size;
char iFilePath[1024];
};
struct nesys_cert_init_response
{
NESYS_TENPO_TABLE tenpo;
NESYS_NEWS_TABLE news;
uint32_t serverSize;
char server[];
};
const char* wat = "card_id=7020392010281502";
nesys_cert_init_response* response = (nesys_cert_init_response*)malloc(sizeof(nesys_cert_init_response) + strlen(wat));
response->tenpo.tenpo_id = 1337;
strcpy(response->tenpo.tenpo_name, "leet");
strcpy(response->tenpo.tenpo_addr, "l33t");
strcpy(response->tenpo.ticket, "teel");
strcpy(response->tenpo.pref_name, "t33l");
response->news.type = 0;
response->news.size = strlen("./OpenParrot/news.png");
strcpy(response->news.iFilePath, "./OpenParrot/news.png");
response->serverSize = strlen(wat);
memcpy(response->server, wat, strlen(wat));
SendResponse(SCOMMAND_CERT_INIT_NOTICE, response, sizeof(nesys_cert_init_response) + strlen(wat));
free(response);
}
else
{ {
int type; SendResponse(SCOMMAND_CERT_ERROR, nullptr);
int size; }
char iFilePath[1024];
};
struct nesys_cert_init_response
{
NESYS_TENPO_TABLE tenpo;
NESYS_NEWS_TABLE news;
uint32_t serverSize;
char server[];
};
const char* wat = "card_id=7020392010281502";
nesys_cert_init_response* response = (nesys_cert_init_response*)malloc(sizeof(nesys_cert_init_response) + strlen(wat));
response->tenpo.tenpo_id = 1337;
strcpy(response->tenpo.tenpo_name, "leet");
strcpy(response->tenpo.tenpo_addr, "l33t");
strcpy(response->tenpo.ticket, "teel");
strcpy(response->tenpo.pref_name, "t33l");
response->news.type = 0;
response->news.size = strlen("./OpenParrot/news.png");
strcpy(response->news.iFilePath, "./OpenParrot/news.png");
response->serverSize = strlen(wat);
memcpy(response->server, wat, strlen(wat));
SendResponse(SCOMMAND_CERT_INIT_NOTICE, response, sizeof(nesys_cert_init_response) + strlen(wat));
free(response);
}; };
m_commandHandlers[LCOMMAND_DISCONNECT_REQUEST] = [=](const uint8_t* data, size_t length) m_commandHandlers[LCOMMAND_DISCONNECT_REQUEST] = [=](const uint8_t* data, size_t length)

View File

@ -8,8 +8,16 @@ DWORD IOErrorCoin = 0;
DWORD IOErrorCredit = 0; DWORD IOErrorCredit = 0;
DWORD EventModeEnable = 0; DWORD EventModeEnable = 0;
DWORD SystemType = 0; DWORD SystemType = 0;
DWORD GameKind = 0;
DWORD EventNextTime = 0;
DWORD ConditionTime = 0;
DWORD TrafficCount = 0;
DWORD LogLevel = 0;
DWORD NewsPath = 0;
DWORD EventPath = 0;
DWORD LogPath = 0;
DWORD FillDwordInformation(const char *setting, const char *subkey, DWORD defaultValue) DWORD FillDwordInformation(const char* setting, const char* subkey, DWORD defaultValue)
{ {
if (strcmp(config[setting][subkey].c_str(), "1") == 0) if (strcmp(config[setting][subkey].c_str(), "1") == 0)
return 1; return 1;
@ -104,9 +112,9 @@ LSTATUS __stdcall RegCreateKeyExWWrap(
LPDWORD lpdwDisposition LPDWORD lpdwDisposition
) )
{ {
if(hKey == HKEY_LOCAL_MACHINE) if (hKey == HKEY_LOCAL_MACHINE)
{ {
if(wcsicmp(lpSubKey, L"SOFTWARE\\TAITO\\NESiCAxLive") == 0) if (wcsicmp(lpSubKey, L"SOFTWARE\\TAITO\\NESiCAxLive") == 0)
{ {
*phkResult = (HKEY)0x8101; *phkResult = (HKEY)0x8101;
return ERROR_SUCCESS; return ERROR_SUCCESS;
@ -128,15 +136,15 @@ void PromptError(DWORD errorCode, int errorType)
memset(tempBuf, 0, 256); memset(tempBuf, 0, 256);
switch (errorType) switch (errorType)
{ {
case 0: case 0:
sprintf(tempBuf, "Game sent NESiCA GameResult error code to %08X to launcher!", errorCode); sprintf(tempBuf, "Game sent NESiCA GameResult error code to %08X to launcher!", errorCode);
break; break;
case 1: case 1:
sprintf(tempBuf, "Game sent NESiCA IOErrorCoin error code to %08X to launcher!", errorCode); sprintf(tempBuf, "Game sent NESiCA IOErrorCoin error code to %08X to launcher!", errorCode);
break; break;
case 2: case 2:
sprintf(tempBuf, "Game sent NESiCA IOErrorCredit error code to %08X to launcher!", errorCode); sprintf(tempBuf, "Game sent NESiCA IOErrorCredit error code to %08X to launcher!", errorCode);
break; break;
} }
MessageBoxA(0, tempBuf, "NESiCA ERROR!", 0); MessageBoxA(0, tempBuf, "NESiCA ERROR!", 0);
} }
@ -146,7 +154,7 @@ LSTATUS __stdcall RegSetValueExAWrap(
LPCSTR lpValueName, LPCSTR lpValueName,
DWORD Reserved, DWORD Reserved,
DWORD dwType, DWORD dwType,
CONST BYTE *lpData, CONST BYTE* lpData,
DWORD cbData DWORD cbData
) )
{ {
@ -155,7 +163,7 @@ LSTATUS __stdcall RegSetValueExAWrap(
{ {
if (stricmp(lpValueName, "GameResult") == 0) if (stricmp(lpValueName, "GameResult") == 0)
{ {
GameResult = *(DWORD *)lpData; GameResult = *(DWORD*)lpData;
if (GameResult != 0) if (GameResult != 0)
{ {
PromptError(GameResult, 0); PromptError(GameResult, 0);
@ -163,7 +171,7 @@ LSTATUS __stdcall RegSetValueExAWrap(
} }
else if (stricmp(lpValueName, "IOErrorCoin") == 0) else if (stricmp(lpValueName, "IOErrorCoin") == 0)
{ {
IOErrorCoin = *(DWORD *)lpData;; IOErrorCoin = *(DWORD*)lpData;;
if (IOErrorCoin != 0) if (IOErrorCoin != 0)
{ {
PromptError(IOErrorCoin, 1); PromptError(IOErrorCoin, 1);
@ -171,7 +179,7 @@ LSTATUS __stdcall RegSetValueExAWrap(
} }
else if (stricmp(lpValueName, "IOErrorCredit") == 0) else if (stricmp(lpValueName, "IOErrorCredit") == 0)
{ {
IOErrorCredit = *(DWORD *)lpData;; IOErrorCredit = *(DWORD*)lpData;;
if (IOErrorCredit != 0) if (IOErrorCredit != 0)
{ {
PromptError(IOErrorCredit, 2); PromptError(IOErrorCredit, 2);
@ -203,33 +211,33 @@ LSTATUS __stdcall RegSetValueExWWrap(
LPCWSTR lpValueName, LPCWSTR lpValueName,
DWORD Reserved, DWORD Reserved,
DWORD dwType, DWORD dwType,
CONST BYTE *lpData, CONST BYTE* lpData,
DWORD cbData DWORD cbData
) )
{ {
// These are for the NESiCA Launcher and no need to handle them in any way! // These are for the NESiCA Launcher and no need to handle them in any way!
if(hKey == (HKEY)0x8101) if (hKey == (HKEY)0x8101)
{ {
if (wcsicmp(lpValueName, L"GameResult") == 0) if (wcsicmp(lpValueName, L"GameResult") == 0)
{ {
GameResult = *(DWORD *)lpData; GameResult = *(DWORD*)lpData;
if(GameResult != 0) if (GameResult != 0)
{ {
PromptError(GameResult, 0); PromptError(GameResult, 0);
} }
} }
else if(wcsicmp(lpValueName, L"IOErrorCoin") == 0) else if (wcsicmp(lpValueName, L"IOErrorCoin") == 0)
{ {
IOErrorCoin = *(DWORD *)lpData;; IOErrorCoin = *(DWORD*)lpData;;
if(IOErrorCoin != 0) if (IOErrorCoin != 0)
{ {
PromptError(IOErrorCoin, 1); PromptError(IOErrorCoin, 1);
} }
} }
else if (wcsicmp(lpValueName, L"IOErrorCredit") == 0) else if (wcsicmp(lpValueName, L"IOErrorCredit") == 0)
{ {
IOErrorCredit = *(DWORD *)lpData;; IOErrorCredit = *(DWORD*)lpData;;
if(IOErrorCredit != 0) if (IOErrorCredit != 0)
{ {
PromptError(IOErrorCredit, 2); PromptError(IOErrorCredit, 2);
} }
@ -246,7 +254,7 @@ LSTATUS __stdcall RegSetValueExWWrap(
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
if(hKey == (HKEY)0x8102) if (hKey == (HKEY)0x8102)
{ {
MessageBoxA(0, "RegSetValueExW for TYPEX, Please contact devs!", "Error unhandled registry change", 0); MessageBoxA(0, "RegSetValueExW for TYPEX, Please contact devs!", "Error unhandled registry change", 0);
return ERROR_FILE_NOT_FOUND; return ERROR_FILE_NOT_FOUND;
@ -320,7 +328,7 @@ LSTATUS __stdcall RegQueryValueExAWrap(
} }
else if (stricmp(lpValueName, "Country") == 0) // REG_DWORD else if (stricmp(lpValueName, "Country") == 0) // REG_DWORD
{ {
*(DWORD *)lpData = FillDwordInformation("TYPEX", "Country", 1); // UNK *(DWORD*)lpData = FillDwordInformation("TYPEX", "Country", 1); // UNK
*lpcbData = 1; *lpcbData = 1;
} }
else else
@ -381,9 +389,65 @@ LSTATUS __stdcall RegQueryValueExAWrap(
} }
else if (stricmp(lpValueName, "SystemType") == 0) // REG_DWORD else if (stricmp(lpValueName, "SystemType") == 0) // REG_DWORD
{ {
*lpData = FillDwordInformation("NESiCA", "SystemType", SystemType);; // UNK *lpData = FillDwordInformation("NESiCA", "SystemType", SystemType); // UNK
*lpcbData = 4; *lpcbData = 4;
} }
else if (stricmp(lpValueName, "ConditionTime") == 0) // REG_DWORD
{
*lpData = FillDwordInformation("NESiCA", "ConditionTime", 300); // UNK
*lpcbData = 4;
}
else if (stricmp(lpValueName, "EventNextTime") == 0) // REG_DWORD
{
*lpData = FillDwordInformation("NESiCA", "EventNextTime", 900); // UNK
*lpcbData = 4;
}
else if (stricmp(lpValueName, "EventPath") == 0) // REG_SZ
{
// TODO
return ERROR_FILE_NOT_FOUND;
}
else if (stricmp(lpValueName, "GameKind") == 0) // REG_DWORD
{
// TODO: ADD EACH AND EVERY SINGLE TYPE X GAMEKIND HERE!
*lpData = FillDwordInformation("NESiCA", "GameKind", 1234); // UNK
*lpcbData = 4;
}
else if (stricmp(lpValueName, "LogLevel") == 0) // REG_DWORD
{
*lpData = FillDwordInformation("NESiCA", "LogLevel", 0); // UNK
*lpcbData = 4;
}
else if (stricmp(lpValueName, "LogPath") == 0) // REG_SZ
{
// TODO
return ERROR_FILE_NOT_FOUND;
}
else if (stricmp(lpValueName, "NewsPath") == 0) // REG_SZ
{
// TODO
return ERROR_FILE_NOT_FOUND;
}
else if (stricmp(lpValueName, "TrafficCount") == 0) // REG_DWORD
{
*lpData = FillDwordInformation("NESiCA", "TrafficCount", 2); // UNK
*lpcbData = 4;
}
else if (stricmp(lpValueName, "UpdateStep") == 0) // REG_DWORD
{
*lpData = FillDwordInformation("NESiCA", "UpdateStep", 0); // UNK
*lpcbData = 4;
}
else if (stricmp(lpValueName, "Country") == 0) // REG_DWORD
{
*(DWORD*)lpData = FillDwordInformation("NESiCA", "Country", 1); // UNK
*lpcbData = 1;
}
else if (stricmp(lpValueName, "AppVer") == 0) // REG_DWORD
{
*(DWORD*)lpData = FillDwordInformation("NESiCA", "AppVer", 1); // UNK
*lpcbData = 1;
}
else else
{ {
MessageBoxA(0, "UNKNOWN REG QUERY FROM SOFTWARE\\TAITO\\NESiCAxLive, contact devs!", "Error", 0); MessageBoxA(0, "UNKNOWN REG QUERY FROM SOFTWARE\\TAITO\\NESiCAxLive, contact devs!", "Error", 0);
@ -460,7 +524,7 @@ LSTATUS __stdcall RegQueryValueExWWrap(
} }
else if (wcsicmp(lpValueName, L"Country") == 0) // REG_DWORD else if (wcsicmp(lpValueName, L"Country") == 0) // REG_DWORD
{ {
*(DWORD *)lpData = FillDwordInformation("TYPEX", "Country", 0); // UNK *(DWORD*)lpData = FillDwordInformation("TYPEX", "Country", 0); // UNK
*lpcbData = 4; *lpcbData = 4;
} }
else else
@ -472,14 +536,14 @@ LSTATUS __stdcall RegQueryValueExWWrap(
} }
// SOFTWARE\\TAITO\\NESiCAxLive // SOFTWARE\\TAITO\\NESiCAxLive
if(hKey == (HKEY)0x8101) if (hKey == (HKEY)0x8101)
{ {
if (lpData == nullptr) if (lpData == nullptr)
{ {
*lpcbData = 4; *lpcbData = 4;
return ERROR_MORE_DATA; return ERROR_MORE_DATA;
} }
if(wcsicmp(lpValueName, L"CoinCredit") == 0) // REG_DWORD if (wcsicmp(lpValueName, L"CoinCredit") == 0) // REG_DWORD
{ {
*lpData = FillDwordInformation("NESiCA", "CoinCredit", 0); // 0 = FREE PLAY *lpData = FillDwordInformation("NESiCA", "CoinCredit", 0); // 0 = FREE PLAY
*lpcbData = 4; *lpcbData = 4;
@ -524,6 +588,62 @@ LSTATUS __stdcall RegQueryValueExWWrap(
*lpData = FillDwordInformation("NESiCA", "SystemType", SystemType);; // UNK *lpData = FillDwordInformation("NESiCA", "SystemType", SystemType);; // UNK
*lpcbData = 4; *lpcbData = 4;
} }
else if (wcsicmp(lpValueName, L"ConditionTime") == 0) // REG_DWORD
{
*lpData = FillDwordInformation("NESiCA", "ConditionTime", 300); // UNK
*lpcbData = 4;
}
else if (wcsicmp(lpValueName, L"EventNextTime") == 0) // REG_DWORD
{
*lpData = FillDwordInformation("NESiCA", "EventNextTime", 900); // UNK
*lpcbData = 4;
}
else if (wcsicmp(lpValueName, L"EventPath") == 0) // REG_SZ
{
// TODO
return ERROR_FILE_NOT_FOUND;
}
else if (wcsicmp(lpValueName, L"GameKind") == 0) // REG_DWORD
{
// TODO: ADD EACH AND EVERY SINGLE TYPE X GAMEKIND HERE!
*lpData = FillDwordInformation("NESiCA", "GameKind", 1234); // UNK
*lpcbData = 4;
}
else if (wcsicmp(lpValueName, L"LogLevel") == 0) // REG_DWORD
{
*lpData = FillDwordInformation("NESiCA", "LogLevel", 0); // UNK
*lpcbData = 4;
}
else if (wcsicmp(lpValueName, L"LogPath") == 0) // REG_SZ
{
// TODO
return ERROR_FILE_NOT_FOUND;
}
else if (wcsicmp(lpValueName, L"NewsPath") == 0) // REG_SZ
{
// TODO
return ERROR_FILE_NOT_FOUND;
}
else if (wcsicmp(lpValueName, L"TrafficCount") == 0) // REG_DWORD
{
*lpData = FillDwordInformation("NESiCA", "TrafficCount", 2); // UNK
*lpcbData = 4;
}
else if (wcsicmp(lpValueName, L"UpdateStep") == 0) // REG_DWORD
{
*lpData = FillDwordInformation("NESiCA", "UpdateStep", 0); // UNK
*lpcbData = 4;
}
else if (wcsicmp(lpValueName, L"Country") == 0) // REG_DWORD
{
*(DWORD*)lpData = FillDwordInformation("NESiCA", "Country", 1); // UNK
*lpcbData = 4;
}
else if (wcsicmp(lpValueName, L"AppVer") == 0) // REG_DWORD
{
*(DWORD*)lpData = FillDwordInformation("NESiCA", "Appver", 1); // UNK
*lpcbData = 4;
}
else else
{ {
MessageBoxA(0, "UNKNOWN REG QUERY FROM SOFTWARE\\TAITO\\NESiCAxLive, contact devs!", "Error", 0); MessageBoxA(0, "UNKNOWN REG QUERY FROM SOFTWARE\\TAITO\\NESiCAxLive, contact devs!", "Error", 0);
@ -547,7 +667,7 @@ LSTATUS __stdcall RegCloseKeyWrap(
} }
void init_RegHooks() void init_RegHooks()
{ {
// ASCII // ASCII
iatHook("advapi32.dll", RegCreateKeyExAWrap, "RegCreateKeyExA"); iatHook("advapi32.dll", RegCreateKeyExAWrap, "RegCreateKeyExA");
iatHook("advapi32.dll", RegOpenKeyExAWrap, "RegOpenKeyExA"); iatHook("advapi32.dll", RegOpenKeyExAWrap, "RegOpenKeyExA");

View File

@ -340,6 +340,8 @@ static InitFunction jvsInit([]()
{ {
return; return;
} }
if (GameDetect::currentGame == GameID::SFV)
return;
if (GameDetect::IsTypeX()) if (GameDetect::IsTypeX())
hookPort = "COM2"; hookPort = "COM2";

View File

@ -241,8 +241,9 @@ extern linb::ini config;
static InitFunction initFunc([]() static InitFunction initFunc([]()
{ {
if (GameDetect::currentGame == GameID::PokkenTournament || GameDetect::currentGame == GameID::SchoolOfRagnarok || GameDetect::currentGame == GameID::TER || GameDetect::currentGame == GameID::Tekken7Update00) if (GameDetect::currentGame == GameID::PokkenTournament || GameDetect::currentGame == GameID::PokkenTournament26 || GameDetect::currentGame == GameID::SchoolOfRagnarok || GameDetect::currentGame == GameID::TER || GameDetect::currentGame == GameID::Tekken7Update00 || GameDetect::currentGame == GameID::SFV)
return; return;
if (ToBool(config["General"]["Windowed"])) if (ToBool(config["General"]["Windowed"]))
{ {
InitDXGIWindowHook(); InitDXGIWindowHook();

View File

@ -81,9 +81,9 @@ DWORD WINAPI XInputGetState
} }
if (controllerInit && dwUserIndex == 0) if (controllerInit && dwUserIndex == 0)
{ {
if (GameDetect::currentGame == GameID::Daytona3 || GameDetect::currentGame == GameID::PokkenTournament) if (GameDetect::currentGame == GameID::Daytona3 || GameDetect::currentGame == GameID::PokkenTournament || GameDetect::currentGame == GameID::PokkenTournament26)
{ {
gamepadState.wButtons |= *ffbOffset; gamepadState.wButtons = *ffbOffset;
} }
else if (GameDetect::currentGame == GameID::GHA) else if (GameDetect::currentGame == GameID::GHA)
{ {
@ -362,7 +362,7 @@ DWORD WINAPI XInputGetStateEx
{ {
XINPUT_GAMEPAD gamepadState = { 0 }; XINPUT_GAMEPAD gamepadState = { 0 };
if (GameDetect::currentGame == GameID::Daytona3 || GameDetect::currentGame == GameID::PokkenTournament) if (GameDetect::currentGame == GameID::Daytona3 || GameDetect::currentGame == GameID::PokkenTournament || GameDetect::currentGame == GameID::PokkenTournament26)
gamepadState.wButtons = *ffbOffset; gamepadState.wButtons = *ffbOffset;
else else
gamepadState.wButtons = 0; gamepadState.wButtons = 0;
@ -419,7 +419,7 @@ LPCWSTR ptrToUse;
static InitFunction XInputHook([]() static InitFunction XInputHook([]()
{ {
if (GameDetect::currentGame == GameID::PokkenTournament || GameDetect::currentGame == GameID::SchoolOfRagnarok || GameDetect::currentGame == GameID::Daytona3 || GameDetect::currentGame == GameID::GHA || GameDetect::currentGame == GameID::JLeague) if (GameDetect::currentGame == GameID::PokkenTournament || GameDetect::currentGame == GameID::PokkenTournament26 || GameDetect::currentGame == GameID::SchoolOfRagnarok || GameDetect::currentGame == GameID::Daytona3 || GameDetect::currentGame == GameID::GHA || GameDetect::currentGame == GameID::JLeague)
{ {
controllerInit = true; controllerInit = true;

View File

@ -444,21 +444,16 @@ void GameDetect::DetectCurrentGame()
// currentGame = GameID::SchoolOfRagnarok; // currentGame = GameID::SchoolOfRagnarok;
// isNesica = true; // isNesica = true;
//} //}
if (*(uint32_t*)(moduleBase + 0x1C04) == 0x7401C3F6)
{
currentGame = GameID::PokkenTournament;
break;
}
// PATCHES 0-9 // PATCHES 0-9
if (*(uint32_t*)(moduleBase + 0x2F00) == 0xFFCB8B48) if (*(uint32_t*)(moduleBase + 0x2F00) == 0xFFCB8B48)
{ {
currentGame = GameID::WMMT5; SetGameId(GameID::WMMT5, "WMMT5");
break; break;
} }
// PATCHES 10-21 // PATCHES 10-21
if (*(uint32_t*)(moduleBase + 0x2F00) == 0x084AFF48) if (*(uint32_t*)(moduleBase + 0x2F00) == 0x084AFF48)
{ {
currentGame = GameID::WMMT5; SetGameId(GameID::WMMT5, "WMMT5");
break; break;
} }
#endif #endif
@ -474,8 +469,24 @@ void GameDetect::DetectCurrentGame()
#endif #endif
* (DWORD*)(newCrc + pePTR + 54) = 0x00000000; * (DWORD*)(newCrc + pePTR + 54) = 0x00000000;
uint32_t newCrcResult = GetCRC32(newCrc, 0x400); uint32_t newCrcResult = GetCRC32(newCrc, 0x400);
#ifdef _AMD64_
if (getenv("TP_DIRECTHOOK") == nullptr)
{
// Pokken update 08-26
if (*(uint32_t*)(moduleBase + 0x1C04) == 0x7401C3F6)
{
if (newCrcResult == 0x4D4F1EBF)
SetGameId(GameID::PokkenTournament26, "PokkenTournament26");
else
SetGameId(GameID::PokkenTournament, "PokkenTournament");
break;
}
}
#endif
switch (newCrcResult) switch (newCrcResult)
{ {
#ifndef _AMD64_
case 0xfe7afff4: case 0xfe7afff4:
currentGame = GameID::FNFSB2; currentGame = GameID::FNFSB2;
break; break;
@ -595,34 +606,87 @@ void GameDetect::DetectCurrentGame()
NesicaKey = NesicaKey::BlazBlueCentralFiction; NesicaKey = NesicaKey::BlazBlueCentralFiction;
isNesica = true; isNesica = true;
break; break;
#endif
#ifdef _AMD64_ #ifdef _AMD64_
case 0xf322d053:
SetGameId(GameID::SFV, "SFV");
break;
case 0x80ebd207: case 0x80ebd207:
currentGame = GameID::Theatrhythm; SetGameId(GameID::Theatrhythm, "Theatrhythm");
break; break;
case 0xdb9c3a90: case 0xdb9c3a90:
currentGame = GameID::TER; SetGameId(GameID::TER, "TER");
break; break;
case 0xf3d3f699: case 0xf3d3f699:
currentGame = GameID::StarWarsEs3XLauncher; SetGameId(GameID::StarWarsEs3XLauncher, "StarWarsEs3XLauncher");
break; break;
case 0x5424a6d8: case 0x5424a6d8:
currentGame = GameID::StarWarsJapEs3XLauncher; SetGameId(GameID::StarWarsJapEs3XLauncher, "StarWarsJapEs3XLauncher");
break; break;
case 0x8505c794: case 0x8505c794:
currentGame = GameID::StarWarsEs3X; SetGameId(GameID::StarWarsEs3X, "StarWarsEs3X");
break; break;
case 0xe1e9e32c: // JPN case 0xe1e9e32c: // JPN
currentGame = GameID::StarWarsJapEs3X; SetGameId(GameID::StarWarsJapEs3X, "StarWarsJapEs3X");
break; break;
case 0x30F676AD: case 0x30F676AD:
currentGame = GameID::SchoolOfRagnarok; SetGameId(GameID::SchoolOfRagnarok, "SchoolOfRagnarok");
isNesica = true; isNesica = true;
break; break;
case 0x00ed2300: case 0x00ed2300:
currentGame = GameID::Tekken7Update12; SetGameId(GameID::Tekken7Update12, "Tekken7Update12");
break; break;
case 0xce9718fd: case 0xce9718fd:
currentGame = GameID::Tekken7Update00; SetGameId(GameID::Tekken7Update00, "Tekken7Update00");
break;
case 0xC017F0BE: // 00 doesn't work, broken dump?
case 0x17059CF3: // 01
case 0xE325036F: // 02
case 0x652FEE7D: // 03
case 0x246B5F7E: // 04
case 0x94D16CCC: // 05
case 0x3CC1BE43: // 06
case 0x247B6F8C: // 07
SetGameId(GameID::PokkenTournament, "Pokken Tournament");
break;
case 0xcb9c4353:
SetGameId(GameID::Pengoe5_Test, "Pengoe5_Test");
break;
case 0x0f98a7a2:
SetGameId(GameID::Pengoe5, "Pengoe5");
break;
case 0x3f67d5b2:
SetGameId(GameID::Pengoe511, "Pengoe511");
break;
case 0x6fc27eed: // Original
SetGameId(GameID::VF5Esports, "VF5Esports");
break;
case 0x3b3fc3ab: // TEST MENU VF5E
SetGameId(GameID::VF5EsportsTest, "VF5EsportsTest");
break;
case 0x1ab0f981:
SetGameId(GameID::GoonyaFighter, "GoonyaFighter");
break;
case 0x8c30fa5a:
SetGameId(GameID::PuyoPuyoEsports, "PuyoPuyoEsports");
break;
case 0xe000b287: // Ver 10
case 0x4f878b4e: // Ver 10 TEST
case 0x29a4a185: // Ver 11
case 0x9c7bb2e1: // Ver 11 TEST
SetGameId(GameID::TappingSkillTest, "Tapping Skill Test Generic");
break;
case 0x0bad58c2: // FM14
case 0x65753fe4: // FM13
case 0xd7028acd: // FM12
case 0xf9df097f: // FM11
case 0x03577d43: // FM10
SetGameId(GameID::Doa6FM14, "Dead or Alive 6 Generic");
break;
case 0x94aababc: // FM14 Test
case 0x4286c538: // FM12 Test
case 0x0e285533: // FM13 Test
SetGameId(GameID::Doa6Test, "Dead or Alive 6 Test Generic");
break; break;
#endif #endif
default: default:
@ -633,6 +697,7 @@ void GameDetect::DetectCurrentGame()
#else #else
memset(errorBuffer, 0, 256); memset(errorBuffer, 0, 256);
sprintf_s(errorBuffer, 256, "Unsupported Executable, NEW CRC: %08X!", newCrcResult); sprintf_s(errorBuffer, 256, "Unsupported Executable, NEW CRC: %08X!", newCrcResult);
WritePrivateProfileStringA("Error", "Unsupported Executable", errorBuffer, ".\\teknoparrot.ini");
MessageBoxA(0, errorBuffer, "Error", MB_ICONERROR); MessageBoxA(0, errorBuffer, "Error", MB_ICONERROR);
ExitProcess(0); ExitProcess(0);
#endif #endif
@ -641,6 +706,17 @@ void GameDetect::DetectCurrentGame()
break; break;
} }
} }
void GameDetect::SetGameId(GameID gameId, char* name)
{
currentGame = gameId;
#ifdef _DEBUG
info(true, "---------------------------------");
info(true, "Game CRC %s detected", name);
info(true, "---------------------------------");
#endif
}
bool GameDetect::IsNesicaGame() bool GameDetect::IsNesicaGame()
{ {
return isNesica; return isNesica;

View File

@ -11,6 +11,7 @@ public:
static X2Type X2Type; static X2Type X2Type;
static bool IsTypeX(); static bool IsTypeX();
static bool IsNesicaGame(); static bool IsNesicaGame();
static void SetGameId(GameID gameId, char* name);
static NesicaKey NesicaKey; static NesicaKey NesicaKey;
static std::string GetGameName(); static std::string GetGameName();
static std::string GameDetect::GetGameName(GameID game); static std::string GameDetect::GetGameName(GameID game);

View File

@ -40,6 +40,7 @@ enum class GameID
VirtuaRLimit, VirtuaRLimit,
SchoolOfRagnarok, SchoolOfRagnarok,
PokkenTournament, PokkenTournament,
PokkenTournament26,
ExBoardGeneric, ExBoardGeneric,
GrooveCoaster2, GrooveCoaster2,
PuzzleBobble, PuzzleBobble,
@ -95,5 +96,20 @@ enum class GameID
DarkAwake, DarkAwake,
ChaosBreakerNXL, ChaosBreakerNXL,
LinuxEmulation, LinuxEmulation,
RadikalBikers RadikalBikers,
Pengoe5,
Pengoe5_Test,
VF5Esports,
GoonyaFighter,
PuyoPuyoEsports,
SFV,
TappingSkillTest,
Pengoe511,
VF5EsportsTest,
Doa6FM10,
Doa6FM11,
Doa6FM12,
Doa6FM13,
Doa6FM14,
Doa6Test
}; };

View File

@ -114,6 +114,11 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReser
{ {
if (ul_reason_for_call == DLL_PROCESS_ATTACH) if (ul_reason_for_call == DLL_PROCESS_ATTACH)
{ {
if (getenv("TP_DIRECTHOOK") != nullptr)
{
RunMain();
return TRUE;
}
#ifdef DEVMODE #ifdef DEVMODE
RunMain(); RunMain();
#else #else