diff --git a/OpenParrot/src/Functions/Games/APM3/APM3.cpp b/OpenParrot/src/Functions/Games/APM3/APM3.cpp new file mode 100644 index 0000000..21e6bba --- /dev/null +++ b/OpenParrot/src/Functions/Games/APM3/APM3.cpp @@ -0,0 +1,869 @@ +#include +#include +#include +#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 \ No newline at end of file diff --git a/OpenParrot/src/Functions/Games/APM3/APM3.h b/OpenParrot/src/Functions/Games/APM3/APM3.h new file mode 100644 index 0000000..3da13cf --- /dev/null +++ b/OpenParrot/src/Functions/Games/APM3/APM3.h @@ -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 \ No newline at end of file diff --git a/OpenParrot/src/Functions/Games/APM3/Aime.cpp b/OpenParrot/src/Functions/Games/APM3/Aime.cpp new file mode 100644 index 0000000..9be371f --- /dev/null +++ b/OpenParrot/src/Functions/Games/APM3/Aime.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#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 \ No newline at end of file diff --git a/OpenParrot/src/Functions/Games/APM3/Aime.h b/OpenParrot/src/Functions/Games/APM3/Aime.h new file mode 100644 index 0000000..8c4eed8 --- /dev/null +++ b/OpenParrot/src/Functions/Games/APM3/Aime.h @@ -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 \ No newline at end of file diff --git a/OpenParrot/src/Functions/Games/APM3/Auth.cpp b/OpenParrot/src/Functions/Games/APM3/Auth.cpp new file mode 100644 index 0000000..aebf97d --- /dev/null +++ b/OpenParrot/src/Functions/Games/APM3/Auth.cpp @@ -0,0 +1,129 @@ +#include +#include +#include +#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 \ No newline at end of file diff --git a/OpenParrot/src/Functions/Games/APM3/Auth.h b/OpenParrot/src/Functions/Games/APM3/Auth.h new file mode 100644 index 0000000..5cb944f --- /dev/null +++ b/OpenParrot/src/Functions/Games/APM3/Auth.h @@ -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 \ No newline at end of file diff --git a/OpenParrot/src/Functions/Games/APM3/Backup.cpp b/OpenParrot/src/Functions/Games/APM3/Backup.cpp new file mode 100644 index 0000000..3cd4963 --- /dev/null +++ b/OpenParrot/src/Functions/Games/APM3/Backup.cpp @@ -0,0 +1,89 @@ +#include +#include +#include +#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 \ No newline at end of file diff --git a/OpenParrot/src/Functions/Games/APM3/Backup.h b/OpenParrot/src/Functions/Games/APM3/Backup.h new file mode 100644 index 0000000..cc46c4a --- /dev/null +++ b/OpenParrot/src/Functions/Games/APM3/Backup.h @@ -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 \ No newline at end of file diff --git a/OpenParrot/src/Functions/Games/APM3/Sequence.cpp b/OpenParrot/src/Functions/Games/APM3/Sequence.cpp new file mode 100644 index 0000000..cf7bec2 --- /dev/null +++ b/OpenParrot/src/Functions/Games/APM3/Sequence.cpp @@ -0,0 +1,85 @@ +#include +#include +#include +#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 \ No newline at end of file diff --git a/OpenParrot/src/Functions/Games/APM3/Sequence.h b/OpenParrot/src/Functions/Games/APM3/Sequence.h new file mode 100644 index 0000000..ee20382 --- /dev/null +++ b/OpenParrot/src/Functions/Games/APM3/Sequence.h @@ -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 \ No newline at end of file diff --git a/OpenParrot/src/Functions/Games/ES3B/PokkenTournament.cpp b/OpenParrot/src/Functions/Games/ES3B/PokkenTournament.cpp index 2b4f2fc..8149530 100644 --- a/OpenParrot/src/Functions/Games/ES3B/PokkenTournament.cpp +++ b/OpenParrot/src/Functions/Games/ES3B/PokkenTournament.cpp @@ -22,19 +22,90 @@ static int ReturnTrue() 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([]() { hookPort = "COM3"; - uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0); + imageBase = (uintptr_t)GetModuleHandleA(0); // 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 char* windowedPattern = hook::get_pattern("BE 01 00 00 00 8B CE", -0x8); if (ToBool(config["General"]["Windowed"])) { injector::MakeNOP(windowedPattern, 8); injector::WriteMemory(windowedPattern + 0x48, 0x00, true); + + iatHook("user32.dll", CreateWindowExAHook, "CreateWindowExA"); + iatHook("user32.dll", CreateWindowExWHook, "CreateWindowExW"); } // Remove BlockInput @@ -42,7 +113,7 @@ static InitFunction PokkenFunc([]() // make english into japanese // 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 char* localePattern = hook::get_pattern("65 6E 00 00 6A 61 00 00"); injector::WriteMemory(localePattern, 'j', true); @@ -50,27 +121,27 @@ static InitFunction PokkenFunc([]() // 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 safeJMP(hook::get_pattern("41 B8 28 06 00 00 49 8B CE", -0x42), PokkenGetSerial); // 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 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) - // 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 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?) - // 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 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 - // 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 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); + +static InitFunction PokkenFunc26([]() +{ + InitFunction::RunFunctions(GameID::PokkenTournament); + safeJMP(imageBase + 0x590320, StateFunctionSN); +}, GameID::PokkenTournament26); #endif \ No newline at end of file diff --git a/OpenParrot/src/Functions/Games/ES3X/WMMT5.cpp b/OpenParrot/src/Functions/Games/ES3X/WMMT5.cpp index 7d9cbeb..a2b9fda 100644 --- a/OpenParrot/src/Functions/Games/ES3X/WMMT5.cpp +++ b/OpenParrot/src/Functions/Games/ES3X/WMMT5.cpp @@ -17,41 +17,41 @@ static bool isEventMode4P; const char *ipaddr; // 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, 0x65, 0x74, 0x74, 0x69, 0x6E, 0x67, 0x2E, 0x6C, 0x75, 0x61, 0x00, 0x85, - 0x93, 0xC9, 0x6E, 0xC2, 0x30, 0x10, 0x86, 0xEF, 0x79, 0x0A, 0x5E, 0x80, - 0x8A, 0x90, 0x80, 0xE8, 0xA1, 0x07, 0x08, 0xA4, 0x20, 0x11, 0x81, 0x20, - 0x2A, 0x52, 0x6F, 0xC6, 0x19, 0x88, 0x85, 0x17, 0xE4, 0xD8, 0xAD, 0x78, - 0xFB, 0xDA, 0x59, 0x1D, 0xB5, 0x2A, 0x39, 0x44, 0xF9, 0xBF, 0x59, 0x32, - 0x8B, 0x3D, 0x1C, 0xFE, 0xFF, 0x78, 0xF6, 0x35, 0x28, 0x40, 0x29, 0xC2, - 0xAF, 0x2F, 0x54, 0x23, 0xEF, 0x49, 0xC0, 0xD0, 0xF3, 0x58, 0x84, 0x28, - 0x39, 0xAF, 0x11, 0xCF, 0x28, 0x44, 0xC0, 0x15, 0xC8, 0xC1, 0xDB, 0x20, - 0x08, 0x27, 0xD3, 0x51, 0x6D, 0x9A, 0x63, 0x0C, 0xB4, 0xB5, 0x34, 0x74, - 0x21, 0xD1, 0x0D, 0x7E, 0xD1, 0x44, 0x28, 0x21, 0x5B, 0x3A, 0xF1, 0xFD, - 0x9A, 0xA7, 0x42, 0xE3, 0x7C, 0x0B, 0x17, 0x65, 0xE8, 0x78, 0x14, 0xCE, - 0x5C, 0x7C, 0x20, 0xD7, 0xDC, 0x72, 0x3F, 0x0C, 0x82, 0xA9, 0x6B, 0x48, - 0xC5, 0xFD, 0x2F, 0xBC, 0x10, 0x4A, 0x09, 0xD6, 0x25, 0x12, 0x84, 0x47, - 0xB9, 0x56, 0x60, 0x7D, 0x3D, 0xB6, 0xD0, 0x8F, 0x08, 0xC9, 0x2C, 0x12, - 0x85, 0xCD, 0x19, 0x78, 0xEC, 0x1D, 0x31, 0xA8, 0xD5, 0xD8, 0x7A, 0x73, - 0x33, 0x1B, 0xED, 0x90, 0x58, 0x53, 0x1A, 0x09, 0x2D, 0x8B, 0x86, 0x85, - 0x86, 0x49, 0x80, 0x3D, 0x45, 0x8F, 0x2A, 0xE5, 0x1E, 0x9F, 0x37, 0x59, - 0xD5, 0xE4, 0x06, 0xDB, 0xE4, 0x87, 0x6F, 0x57, 0x7D, 0x00, 0xCF, 0x9A, - 0x21, 0x24, 0x57, 0xD7, 0x1E, 0x0B, 0x89, 0x21, 0x06, 0xC8, 0xCE, 0x08, - 0xDF, 0x2A, 0x74, 0x22, 0xBC, 0x98, 0xF3, 0xEC, 0x00, 0x0C, 0x99, 0xAF, - 0x2A, 0xFF, 0xEA, 0xCB, 0x0C, 0x2C, 0x11, 0x19, 0x54, 0x2E, 0xAD, 0x5C, - 0x92, 0xB2, 0x1E, 0x17, 0x99, 0x42, 0x79, 0x5D, 0x63, 0x44, 0x45, 0x01, - 0xE9, 0xE3, 0x0E, 0x75, 0x63, 0x56, 0x1E, 0x35, 0x37, 0xEA, 0x75, 0x5A, - 0xCB, 0x44, 0xF4, 0x64, 0xAA, 0xC1, 0x95, 0x27, 0xC8, 0x7A, 0xD6, 0x5C, - 0xBB, 0x32, 0x96, 0xC4, 0x95, 0x47, 0xA4, 0x5C, 0xB9, 0x2C, 0x67, 0x63, - 0x65, 0xB9, 0x92, 0x3D, 0xE2, 0x40, 0xAB, 0x52, 0xED, 0xB8, 0x3F, 0x84, - 0x15, 0xBE, 0x51, 0x73, 0xA5, 0x24, 0xC2, 0xAA, 0x03, 0xBB, 0xCB, 0x85, - 0x12, 0x0E, 0x5D, 0xB7, 0x26, 0x1D, 0xBE, 0x19, 0x6A, 0x0E, 0x6D, 0x05, - 0x52, 0xC2, 0xE0, 0x53, 0xF0, 0xA6, 0x35, 0xBB, 0x7B, 0x8B, 0xCC, 0x1F, - 0xB7, 0xF5, 0x41, 0x71, 0x9C, 0xD6, 0x66, 0x71, 0x6D, 0xF0, 0xAC, 0xE3, - 0x09, 0xE1, 0x6E, 0xCE, 0xA3, 0x66, 0x0C, 0xA4, 0x35, 0xF6, 0x02, 0x7A, - 0x96, 0x7E, 0xC8, 0xD3, 0x7B, 0x53, 0xDE, 0xB4, 0xD5, 0x2E, 0x7E, 0xEE, - 0xF9, 0x03, 0x44, 0x94, 0xFB, 0x8E, 0xB5, 0x03, 0x00, 0x00 + 0x93, 0x5B, 0x6F, 0x82, 0x30, 0x14, 0xC7, 0xDF, 0xF9, 0x14, 0x7E, 0x01, + 0x17, 0x11, 0xE7, 0xDC, 0xC3, 0x1E, 0x14, 0x65, 0x9A, 0x48, 0x66, 0x94, + 0x68, 0xB2, 0xB7, 0x5A, 0x8E, 0xD2, 0xD8, 0x8B, 0x29, 0xED, 0x16, 0xBF, + 0xFD, 0x5A, 0xA8, 0x50, 0xB2, 0x65, 0xF2, 0x40, 0xF8, 0xFF, 0xCE, 0x85, + 0x73, 0x69, 0xFB, 0xFD, 0xFF, 0x9F, 0xC0, 0xBE, 0x7A, 0x25, 0x28, 0x45, + 0xF8, 0xF9, 0x89, 0x6A, 0x14, 0x3C, 0x08, 0xE8, 0x07, 0x01, 0x8B, 0x11, + 0x25, 0xC7, 0x25, 0xE2, 0x39, 0x85, 0x18, 0xB8, 0x02, 0xD9, 0x7B, 0xEB, + 0x45, 0xC3, 0x97, 0xF1, 0xC4, 0x99, 0xA6, 0x18, 0x03, 0x6D, 0x2C, 0x03, + 0x47, 0x67, 0x12, 0x5D, 0xE0, 0x17, 0x4D, 0x85, 0x12, 0xB2, 0xA1, 0xCF, + 0x61, 0xE8, 0x78, 0x26, 0x34, 0x2E, 0xD6, 0x70, 0x52, 0x86, 0x0E, 0x07, + 0xA3, 0x89, 0x8F, 0xB7, 0xE4, 0x5C, 0x58, 0x1E, 0x8E, 0xA2, 0x68, 0xEC, + 0x1B, 0x32, 0x71, 0xFD, 0x0B, 0xCF, 0x84, 0x52, 0x82, 0xB5, 0x89, 0x04, + 0xE1, 0x71, 0xA1, 0x15, 0x58, 0xDF, 0x80, 0xCD, 0xF4, 0x2D, 0x46, 0x32, + 0x8F, 0x45, 0x69, 0x73, 0x46, 0x01, 0x7B, 0x47, 0x0C, 0x9C, 0x1A, 0x5A, + 0x6F, 0x6E, 0x66, 0xA3, 0x3D, 0x92, 0x68, 0x4A, 0x63, 0xA1, 0x65, 0x79, + 0x67, 0x23, 0xC3, 0x24, 0xC0, 0x86, 0xA2, 0x5B, 0x9D, 0x72, 0x83, 0x8F, + 0xAB, 0xBC, 0x6E, 0x72, 0x85, 0x6D, 0xF2, 0xED, 0xB7, 0xAF, 0xF6, 0xC0, + 0xF3, 0xFB, 0x10, 0xD2, 0xB3, 0x6F, 0x4F, 0x84, 0xC4, 0x90, 0x00, 0xE4, + 0x47, 0x84, 0x2F, 0x35, 0x3A, 0x10, 0x5E, 0x4E, 0x79, 0xBE, 0x05, 0x86, + 0xCC, 0x57, 0x9D, 0x7F, 0xF1, 0x65, 0x06, 0x96, 0x8A, 0x1C, 0x6A, 0x97, + 0x46, 0xCE, 0x49, 0x55, 0x8F, 0x8F, 0x4C, 0xA1, 0xDC, 0xD5, 0x18, 0x53, + 0x51, 0x42, 0x76, 0xBB, 0x82, 0x6B, 0xCC, 0xCA, 0x9D, 0xE6, 0x46, 0xBD, + 0x8E, 0x9D, 0x4C, 0x45, 0x47, 0x66, 0x1A, 0x7C, 0x79, 0x80, 0xBC, 0x63, + 0x2D, 0xB4, 0x2F, 0x13, 0x49, 0x7C, 0xB9, 0x43, 0xCA, 0x97, 0xF3, 0x6A, + 0x36, 0x56, 0x56, 0x2B, 0xD9, 0x20, 0x0E, 0xB4, 0x2E, 0xD5, 0x8E, 0x7B, + 0x2F, 0xAC, 0x08, 0x8D, 0x9A, 0x2A, 0x25, 0x11, 0x56, 0x2D, 0xF8, 0x38, + 0x9D, 0x28, 0xE1, 0xD0, 0x76, 0x6B, 0xD2, 0xE1, 0x8B, 0xA1, 0xE6, 0xD0, + 0xD6, 0x20, 0x23, 0x0C, 0x3E, 0x05, 0xBF, 0xB7, 0x66, 0x77, 0x6F, 0x91, + 0xF9, 0xE3, 0xDA, 0x1D, 0x14, 0xCF, 0x69, 0x69, 0x16, 0xD7, 0x04, 0x4F, + 0x5A, 0x9E, 0x12, 0xEE, 0xE7, 0xDC, 0x69, 0xC6, 0x40, 0x5A, 0x63, 0x27, + 0xA0, 0x63, 0xE9, 0x86, 0x3C, 0xBC, 0x37, 0xD5, 0x4D, 0x5B, 0x7C, 0x24, + 0x8F, 0x3D, 0x7F, 0x00, 0x10, 0x1E, 0x34, 0xD9, 0xB5, 0x03, 0x00, 0x00 }; // FOR FREEPLAY diff --git a/OpenParrot/src/Functions/Games/Other/H2Overdrive.cpp b/OpenParrot/src/Functions/Games/Other/H2Overdrive.cpp index 8dbfede..b829513 100644 --- a/OpenParrot/src/Functions/Games/Other/H2Overdrive.cpp +++ b/OpenParrot/src/Functions/Games/Other/H2Overdrive.cpp @@ -6,6 +6,9 @@ #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 char U8; @@ -13,10 +16,18 @@ DWORD BaseAddress10 = 0x00400000; HWND hWndRT10 = 0; static bool button1pressed = false; +static bool button1pressed2 = false; static bool button2pressed = false; static bool button3pressed = false; static bool button4pressed = false; +static bool button5pressed = false; +static bool button6pressed = false; static bool STARTpressed = false; +static bool STARTpressed2 = false; +static bool NameChoosing = false; +static bool NameViewButton = false; +static int ViewCount; +static int View2Count; // controls extern int* ffbOffset; @@ -39,13 +50,50 @@ DWORD WINAPI InputRT10(LPVOID lpParam) while (true) { - // ESCAPE QUITS GAME if (GetAsyncKeyState(VK_ESCAPE) & 0x8000) { 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((0x398CB8 + BaseAddress10), 0, true); + ViewCount = 0; + } + + } + else + if (ViewCount > 0) + ViewCount = 0; + } + + if (*ffbOffset & 0x200) + { + if (!NameChoosing && !ViewName) + { + ++View2Count; + if (View2Count == 2) + { + injector::WriteMemory((0x398CB8 + BaseAddress10), 1, true); + View2Count = 0; + } + } + } + // REAL NUMERIC KEYPAD int keys[] = { VK_NUMPAD1, VK_NUMPAD2, VK_NUMPAD3, VK_NUMPAD4, VK_NUMPAD5, VK_NUMPAD6, VK_NUMPAD7, VK_NUMPAD8, VK_NUMPAD9, VK_MULTIPLY, VK_NUMPAD0, VK_DIVIDE }; for (int i = 0; i < sizeof(keys) / sizeof(int); i++) @@ -87,6 +135,15 @@ DWORD WINAPI InputRT10(LPVOID lpParam) injector::WriteMemory((0x398CB4 + BaseAddress10), 0, true); STARTpressed = true; } + else + { + if (NameChoosing && !STARTpressed2) + { + injector::WriteMemory((0x398CB0 + BaseAddress10), 0, true); + injector::WriteMemory((0x398CB4 + BaseAddress10), 1, true); + STARTpressed2 = true; + } + } } else { @@ -95,6 +152,7 @@ DWORD WINAPI InputRT10(LPVOID lpParam) injector::WriteMemory((0x398CB0 + BaseAddress10), 0, true); injector::WriteMemory((0x398CB4 + BaseAddress10), 1, true); STARTpressed = false; + STARTpressed2 = false; } } @@ -107,6 +165,15 @@ DWORD WINAPI InputRT10(LPVOID lpParam) injector::WriteMemory((0x398CB4 + BaseAddress10), 0, true); button1pressed = true; } + else + { + if (NameChoosing && !button1pressed2) + { + injector::WriteMemory((0x398CB0 + BaseAddress10), 0, true); + injector::WriteMemory((0x398CB4 + BaseAddress10), 1, true); + button1pressed2 = true; + } + } } else { @@ -115,6 +182,7 @@ DWORD WINAPI InputRT10(LPVOID lpParam) injector::WriteMemory((0x398CB0 + BaseAddress10), 0, true); injector::WriteMemory((0x398CB4 + BaseAddress10), 1, true); button1pressed = false; + button1pressed2 = false; } } @@ -124,7 +192,6 @@ DWORD WINAPI InputRT10(LPVOID lpParam) { if (button2pressed == false) { - // injector::WriteMemory((0x398CB8 + BaseAddress10), 0, true); injector::WriteMemory((0x398CBC + BaseAddress10), 1, true); button2pressed = true; @@ -132,6 +199,12 @@ DWORD WINAPI InputRT10(LPVOID lpParam) { injector::WriteMemory((ptr + 0x840), 1, true); } + + if (NameChoosing && !NameViewButton) + { + NameViewButton = true; + injector::WriteMemory((0x398CB8 + BaseAddress10), 1, true); + } } else if (button2pressed == true) { @@ -142,7 +215,6 @@ DWORD WINAPI InputRT10(LPVOID lpParam) { if (button2pressed == true) { - // injector::WriteMemory((0x398CB8 + BaseAddress10), 1, true); injector::WriteMemory((0x398CBC + BaseAddress10), 0, true); button2pressed = false; @@ -150,6 +222,14 @@ DWORD WINAPI InputRT10(LPVOID lpParam) { injector::WriteMemory((ptr + 0x840), 0, true); } + + if (NameViewButton) + { + NameViewButton = false; + } + + if (!NameChoosing && ViewName) + injector::WriteMemory((0x398CB8 + BaseAddress10), 0, true); } } @@ -175,7 +255,6 @@ DWORD WINAPI InputRT10(LPVOID lpParam) { if (button4pressed == false) { - injector::WriteMemory((0x398CB8 + BaseAddress10), 1, true); // MENU COUNTDOWN HACK keybd_event(0x2D, MapVirtualKey(0x2D, MAPVK_VK_TO_VSC), 0, 0); button4pressed = true; } @@ -184,11 +263,44 @@ DWORD WINAPI InputRT10(LPVOID lpParam) { if (button4pressed == true) { - injector::WriteMemory((0x398CB8 + BaseAddress10), 0, true); // MENU COUNTDOWN HACK keybd_event(0x2D, MapVirtualKey(0x2D, MAPVK_VK_TO_VSC), KEYEVENTF_KEYUP, 0); 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 int iWheel = (((float)* ffbOffset2) - 128); @@ -272,9 +384,9 @@ static InitFunction H2OverdriveFunc([]() injector::WriteMemoryRaw((0x146E68 + BaseAddress10), "\x6A\x2E", 2, true); //SERVICE REMAP to INSERT injector::WriteMemoryRaw((0x146EB2 + BaseAddress10), "\x6A\x2D", 2, true); - //VOL+- REMAP to UP/DOWN - injector::WriteMemoryRaw((0x146F03 + BaseAddress10), "\x6A\x26", 2, true); - injector::WriteMemoryRaw((0x146F54 + BaseAddress10), "\x6A\x28", 2, true); + //VOL+- REMAP to Page Up/Down + injector::WriteMemoryRaw((0x146F03 + BaseAddress10), "\x6A\x21", 2, true); + injector::WriteMemoryRaw((0x146F54 + BaseAddress10), "\x6A\x22", 2, true); //ENABLE KEYPAD injector::WriteMemoryRaw((0x186302 + BaseAddress10), "\xEB", 1, true); //KEYPAD HACK @@ -289,6 +401,36 @@ static InitFunction H2OverdriveFunc([]() 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((0x329728 + BaseAddress10) + i, 0x00, true); + } + + if (PC1 > 0 && PC1 < 256) injector::WriteMemory((0x329728 + BaseAddress10) + PC1, 0x01, true); + if (PC2 > 0 && PC2 < 256) injector::WriteMemory((0x329728 + BaseAddress10) + PC2, 0x02, true); + if (PC3 > 0 && PC3 < 256) injector::WriteMemory((0x329728 + BaseAddress10) + PC3, 0x03, true); + if (PC4 > 0 && PC4 < 256) injector::WriteMemory((0x329728 + BaseAddress10) + PC4, 0x04, true); + if (PC5 > 0 && PC5 < 256) injector::WriteMemory((0x329728 + BaseAddress10) + PC5, 0x05, true); + if (PC6 > 0 && PC6 < 256) injector::WriteMemory((0x329728 + BaseAddress10) + PC6, 0x06, true); + if (PC7 > 0 && PC7 < 256) injector::WriteMemory((0x329728 + BaseAddress10) + PC7, 0x07, true); + if (PC8 > 0 && PC8 < 256) injector::WriteMemory((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); }, GameID::H2Overdrive); diff --git a/OpenParrot/src/Functions/Games/TypeX2/BattleGear4InputMisc.cpp b/OpenParrot/src/Functions/Games/TypeX2/BattleGear4InputMisc.cpp new file mode 100644 index 0000000..47aece0 --- /dev/null +++ b/OpenParrot/src/Functions/Games/TypeX2/BattleGear4InputMisc.cpp @@ -0,0 +1,505 @@ +#include +#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 +} \ No newline at end of file diff --git a/OpenParrot/src/Functions/Games/TypeX2/DirectInputWrapper.cpp b/OpenParrot/src/Functions/Games/TypeX2/DirectInputWrapper.cpp index 9b55f57..f18dca1 100644 --- a/OpenParrot/src/Functions/Games/TypeX2/DirectInputWrapper.cpp +++ b/OpenParrot/src/Functions/Games/TypeX2/DirectInputWrapper.cpp @@ -376,7 +376,16 @@ HRESULT __stdcall Hook_DirectInput8Create(HINSTANCE hinst, DWORD dwVersion, REFI 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; MH_Initialize(); diff --git a/OpenParrot/src/Functions/Games/TypeX2/KOFSkyStageInput.cpp b/OpenParrot/src/Functions/Games/TypeX2/KOFSkyStageInput.cpp new file mode 100644 index 0000000..16e95ea --- /dev/null +++ b/OpenParrot/src/Functions/Games/TypeX2/KOFSkyStageInput.cpp @@ -0,0 +1,163 @@ +#include +#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); + } + } +} \ No newline at end of file diff --git a/OpenParrot/src/Functions/Games/TypeX2/TypeX2Generic.cpp b/OpenParrot/src/Functions/Games/TypeX2/TypeX2Generic.cpp index d3ad070..e0f8f71 100644 --- a/OpenParrot/src/Functions/Games/TypeX2/TypeX2Generic.cpp +++ b/OpenParrot/src/Functions/Games/TypeX2/TypeX2Generic.cpp @@ -11,32 +11,11 @@ extern int* ffbOffset; extern int* ffbOffset3; extern int* ffbOffset4; extern int* ffbOffset5; -static Helpers* myHelpers; -static bool CoinPressed = false; -static bool TestPressed = false; -static bool ServicePressed = false; -static bool TimeStartPressed = false; -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; +extern void BG4ManualHack(Helpers* helpers); +extern void BG4ProInputs(Helpers* helpers); +extern void KOFSkyStageInputs(Helpers* helpers); +static bool ProMode; void AddCommOverride(HANDLE hFile); @@ -396,661 +375,22 @@ BOOL __stdcall WriteFileWrapTx2(HANDLE hFile, return WriteFile(hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, lpOverlapped); } -static DWORD WINAPI ChangeValues(LPVOID lpParam) +static DWORD WINAPI RunningLoop(LPVOID lpParam) { - Sleep(10000); - - 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) + while (true) { - if (!MenuHack) + switch (GameDetect::currentGame) { - 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); - } - 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; - } + case GameID::BG4: + if (ProMode) + BG4ProInputs(0); else - { - *(BYTE*)(imageBase + 0x42E296) -= 0x04; - } + BG4ManualHack(0); + 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); } } @@ -1184,7 +524,9 @@ static InitFunction initFunction([]() 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 + 0x1E7DC, 6); @@ -1195,18 +537,17 @@ static InitFunction initFunction([]() injector::MakeNOP(imageBase + 0x1E799, 6); injector::MakeNOP(imageBase + 0x1E880, 6); 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"])) { injector::MakeNOP(imageBase + 0x8ADFF, 10); } + } - CreateThread(NULL, 0, BG4ProRunningLoop, NULL, 0, NULL); - } - else - { - CreateThread(NULL, 0, BG4RunningLoop, NULL, 0, NULL); - } + CreateThread(NULL, 0, RunningLoop, NULL, 0, NULL); // IP stuff for working LAN static const char* BroadcastAddress = config["Network"]["BroadcastAddress"].c_str(); @@ -1502,7 +843,7 @@ static InitFunction initFunction([]() //Temp Fix (Remove when properly sorted) 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 injector::WriteMemory(imageBase + 0x12F6E2, 0xEB, true); diff --git a/OpenParrot/src/Functions/Games/TypeX4/SFV.cpp b/OpenParrot/src/Functions/Games/TypeX4/SFV.cpp new file mode 100644 index 0000000..d112ca7 --- /dev/null +++ b/OpenParrot/src/Functions/Games/TypeX4/SFV.cpp @@ -0,0 +1,2120 @@ +#include +#include "Utility/InitFunction.h" +#include "Functions/Global.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if _M_AMD64 +#pragma optimize("", off) +static DWORD_PTR imageBase = 0; +static wchar_t FullPathWithExeName[MAX_PATH]; +static wchar_t ResX[16]; +static wchar_t ResY[16]; +extern int* ffbOffset; + +std::string to_hex_string(DWORD_PTR i) { + std::stringstream s; + s << std::hex << i; + return s.str(); +} + +// TODO: The emulation code should be moved to a separate file and this code should be used for all nxl2 games. + +__int64 (WINAPI* g_origUIO_AMIC_Close)(); +__int64 (WINAPI* g_origUIO_AMIC_GetDeviceVersion)(); +__int64 (WINAPI* g_origUIO_AMIC_GetStatus)(); +__int64 (WINAPI* g_origUIO_AMIC_IsPadMode)(); +__int64 (WINAPI* g_origUIO_AMIC_Open)(); +__int64 (WINAPI* g_origUIO_AMIC_Update)(__int64 a1); +__int64 (WINAPI* g_origUIO_AMIC_WdtClear)(); +__int64 (WINAPI* g_origUIO_AMIC_WdtDisable)(); +__int64 (WINAPI* g_origUIO_AMIC_WdtEnable)(unsigned __int16 a1, __int64 a2); +__int64 (WINAPI* g_origUIO_AMIC_WdtGetDIP)(); + +__int64 (WINAPI* g_origNESiCAUtilLibIsOnlineMode)(); +__int64 (WINAPI* g_origNESiCAUtilLibGetStatus)(); +__int64 (WINAPI* g_origNESiCAUtilLibDelete)(); +__int64 (WINAPI* g_origNESiCAUtilLibGetCenterInformation)(); +__int64 (WINAPI* g_origNESiCAUtilLibGetInformation)(); +__int64 (WINAPI* g_origNESiCAUtilLibGetPlayerAskInformation)(); +__int64 (WINAPI* g_origNESiCAUtilLibGetPlayerInformation)(); +__int64 (WINAPI* g_origNESiCAUtilLibGetPlayerTime)(); +__int64 (WINAPI* g_origNESiCAUtilLibGetStatusStringUTF16)(); +__int64 (WINAPI* g_origNESiCAUtilLibInit)(); +__int64 (WINAPI* g_origNESiCAUtilLibIsExistInstance)(); +__int64 (WINAPI* g_origNESiCAUtilLibUpdate)(); +__int64 (WINAPI* g_origNESiCAUtilLib_NESiCA_BData_Get)(); +__int64 (WINAPI* g_origNESiCAUtilLib_NESiCA_BData_Set)(); +__int64 (WINAPI* g_origNESiCAUtilLib_NESiCA_BData_SetDefault)(); +__int64 (WINAPI* g_origNESiCAUtilLib_NESiCA_TData_GetBuf)(); +__int64 (WINAPI* g_origNESiCAUtilLib_NESiCA_TData_GetSize)(); +__int64 (WINAPI* g_origBeginPlay)(); +__int64 (WINAPI* g_origContinuePlay)(); +__int64 (WINAPI* g_origEndPlay)(); +__int64 (WINAPI* g_origGetGlobalIP)(); +__int64 (WINAPI* g_origGetKeyConfig)(); +__int64 (WINAPI* g_origGetLanInterface)(); +__int64 (WINAPI* g_origGetLibraryVersion)(); +__int64 (WINAPI* g_origGetNWInfo)(); +__int64 (WINAPI* g_origGetNewsImagePath)(); +__int64 (WINAPI* g_origGetRanking)(signed int a1, __int64 a2, signed int a3, DWORD_PTR a4, DWORD_PTR a5); +__int64 (WINAPI* g_origGetResponseTime)(); +__int64 (WINAPI* g_origGetServerInfo)(); +__int64 (WINAPI* g_origGetServiceVersion)(); +__int64 (WINAPI* g_origGetTenpoInfo)(); +__int64 (WINAPI* g_origIsBeginningProcessFinished)(); +__int64 (WINAPI* g_origIsDisactive)(); +__int64 (WINAPI* g_origIsEndingProcessFinished)(); +__int64 (WINAPI* g_origIsEventMode)(); +__int64 (WINAPI* g_origIsReadyDownloadRanking)(); +__int64 (WINAPI* g_origIsTestMode)(); +__int64 (WINAPI* g_origIsUploaded)(); +__int64 (WINAPI* g_origLockProcess)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailCharacterBattlePointMonth)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailCharacterBattlePointTotal)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailCharacterDrawCountMonth)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailCharacterDrawCountTotal)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailCharacterLastColorID)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailCharacterLastComment)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailCharacterLastCostumeID)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailCharacterLastVTrigger)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailCharacterLoseCountMonth)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailCharacterLoseCountTotal)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailCharacterUseCountMonth)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailCharacterUseCountTotal)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailCharacterWinCountMonth)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailCharacterWinCountTotal)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailControlType)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailCurrentWins)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailHighScore)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailHighScoreCharacterID)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailKeyConfigHK)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailKeyConfigHP)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailKeyConfigHPHK)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailKeyConfigK3)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailKeyConfigLK)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailKeyConfigLKMK)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailKeyConfigLP)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailKeyConfigLPLK)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailKeyConfigLPMK)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailKeyConfigLPMP)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailKeyConfigMK)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailKeyConfigMP)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailKeyConfigMPLK)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailKeyConfigMPMK)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailKeyConfigP3)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailLastCharacterID)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailLeaguePoint)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailMaxWins)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailPlayerPointMonth)(); +__int64 (WINAPI* g_origNESiCA_Card_GetDetailPlayerPointTotal)(); +__int64 (WINAPI* g_origNESiCA_Card_GetPlayerComment)(); +__int64 (WINAPI* g_origNESiCA_Card_GetPlayerCommentUTF16)(); +__int64 (WINAPI* g_origNESiCA_Card_GetPlayerMyStoreID)(); +__int64 (WINAPI* g_origNESiCA_Card_GetPlayerName)(); +__int64 (WINAPI* g_origNESiCA_Card_GetPlayerNameUTF16)(); +__int64 (WINAPI* g_origNESiCA_Card_GetPlayerTitleID)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailCharacterBattlePointMonth)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailCharacterBattlePointTotal)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailCharacterDrawCountMonth)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailCharacterDrawCountTotal)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailCharacterLastColorID)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailCharacterLastComment)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailCharacterLastCostumeID)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailCharacterLastVTrigger)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailCharacterLoseCountMonth)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailCharacterLoseCountTotal)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailCharacterUseCountMonth)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailCharacterUseCountTotal)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailCharacterWinCountMonth)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailCharacterWinCountTotal)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailControlType)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailCurrentWins)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailHighScore)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailHighScoreCharacterID)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailKeyConfigHK)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailKeyConfigHP)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailKeyConfigHPHK)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailKeyConfigK3)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailKeyConfigLK)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailKeyConfigLKMK)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailKeyConfigLP)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailKeyConfigLPLK)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailKeyConfigLPMK)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailKeyConfigLPMP)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailKeyConfigMK)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailKeyConfigMP)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailKeyConfigMPLK)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailKeyConfigMPMK)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailKeyConfigP3)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailLastCharacterID)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailLeaguePoint)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailMaxWins)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailPlayerPointMonth)(); +__int64 (WINAPI* g_origNESiCA_Card_SetDetailPlayerPointTotal)(); +__int64 (WINAPI* g_origNESiCA_Card_SetPlayerComment)(); +__int64 (WINAPI* g_origNESiCA_Card_SetPlayerCommentUTF16)(); +__int64 (WINAPI* g_origNESiCA_Card_SetPlayerMyStoreID)(); +__int64 (WINAPI* g_origNESiCA_Card_SetPlayerName)(); +__int64 (WINAPI* g_origNESiCA_Card_SetPlayerNameUTF16)(); +__int64 (WINAPI* g_origNESiCA_Card_SetPlayerTitleID)(); +__int64 (WINAPI* g_origNESiCA_GetNESiCAID)(); +__int64 (WINAPI* g_origNESiCA_GetNESiCAType)(); +__int64 (WINAPI* g_origNESiCA_IsCardPlayer)(); +__int64 (WINAPI* g_origNESiCA_Rank_GetBattlePointRank)(); +__int64 (WINAPI* g_origNESiCA_Rank_GetBattlePointRankPref)(); +__int64 (WINAPI* g_origNESiCA_Rank_GetBattlePointRankPrefId)(); +__int64 (WINAPI* g_origNESiCA_Rank_GetBattlePointRankPrefName)(); +__int64 (WINAPI* g_origNESiCA_Rank_GetBattlePointRankPrefNameUTF16)(); +__int64 (WINAPI* g_origReconnect)(); +__int64 (WINAPI* g_origSaveOnTheWay)(); +__int64 (WINAPI* g_origSetCharacterID)(); +__int64 (WINAPI* g_origSetEventMode)(); +__int64 (WINAPI* g_origSetEventModeResult)(); +__int64 (WINAPI* g_origSetOpenCloseTime)(); +__int64 (WINAPI* g_origStartTestMode)(); +__int64 (WINAPI* g_origTypeXGetTelop)(); +__int64 (WINAPI* g_origTypeXMatching_ChangeWinLimit)(); +__int64 (WINAPI* g_origTypeXMatching_CreateInstance)(); +__int64 (WINAPI* g_origTypeXMatching_DeleteInstance)(); +__int64 (WINAPI* g_origTypeXMatching_GetEnemyAddr)(); +__int64 (WINAPI* g_origTypeXMatching_GetEnemyEntryId)(); +__int64 (WINAPI* g_origTypeXMatching_GetEnemyOption)(); +__int64 (WINAPI* g_origTypeXMatching_GetEnemyPlayerName)(); +__int64 (WINAPI* g_origTypeXMatching_GetEnemyPlayerNameUTF16)(); +__int64 (WINAPI* g_origTypeXMatching_GetEnemyTenpoName)(); +__int64 (WINAPI* g_origTypeXMatching_GetEnemyTenpoNameUTF16)(); +__int64 (WINAPI* g_origTypeXMatching_GetFighterInfoInStore)(); +__int64 (WINAPI* g_origTypeXMatching_GetMyAddr)(); +__int64 (WINAPI* g_origTypeXMatching_GetMyEntryId)(); +__int64 (WINAPI* g_origTypeXMatching_GetRTT)(); +__int64 (WINAPI* g_origTypeXMatching_GetStatus)(); +__int64 (WINAPI* g_origTypeXMatching_GetWinLimit)(); +__int64 (WINAPI* g_origTypeXMatching_GetWins)(); +__int64 (WINAPI* g_origTypeXMatching_GetWinsAll)(); +__int64 (WINAPI* g_origTypeXMatching_IsMatchingDesignatedFailed)(); +__int64 (WINAPI* g_origTypeXMatching_Register_NESiCAUtilLibCancelRequestRFID)(); +__int64 (WINAPI* g_origTypeXMatching_Register_NESiCAUtilLibGetRFIDID)(); +__int64 (WINAPI* g_origTypeXMatching_Register_NESiCAUtilLibIsRFIDRead)(); +__int64 (WINAPI* g_origTypeXMatching_Register_NESiCAUtilLibIsRFIDReadSuccess)(); +__int64 (WINAPI* g_origTypeXMatching_Register_NESiCAUtilLibRequestRFID)(); +__int64 (WINAPI* g_origTypeXMatching_ResetWins)(); +__int64 (WINAPI* g_origTypeXMatching_Resume)(); +__int64 (WINAPI* g_origTypeXMatching_StartMatchingDesignated)(); +__int64 (WINAPI* g_origTypeXMatching_StartMathingInternetOnly)(); +__int64 (WINAPI* g_origTypeXMatching_StartMathingStoreOnly)(); +__int64 (WINAPI* g_origTypeXMatching_StartMathingStorePriority)(); +__int64 (WINAPI* g_origTypeXMatching_StopMatching)(); +__int64 (WINAPI* g_origTypeXMatching_Suspend)(); +__int64 (WINAPI* g_origTypeXMatching_Update)(); +__int64 (WINAPI* g_origTypeXMatching_UpdateWins)(); +__int64 (WINAPI* g_origTypeXPlayRecordAddToSend)(); +__int64 (WINAPI* g_origTypeXPlayRecordReset)(); +__int64 (WINAPI* g_origTypeXPlayRecordResetRevenge)(); +__int64 (WINAPI* g_origTypeXPlayRecordSetPlayerInfo)(); +__int64 (WINAPI* g_origTypeXPlayRecordSetRoundResult)(); +__int64 (WINAPI* g_origTypeXSafeFileIsFinished)(); +__int64 (WINAPI* g_origTypeXSafeFileRead)(); +__int64 (WINAPI* g_origTypeXSafeFileWrite)(); +__int64 (WINAPI* g_origTypeXSafeFileWriteUpdate)(); +__int64 (WINAPI* g_origUnlockProcess)(); + +__int64 UIO_AMIC_Close() +{ +// auto result = g_origUIO_AMIC_Close(); +// info(true, "UIO_AMIC_Close result: %08X", result); + return 0; +} + +__int64 UIO_AMIC_GetDeviceVersion() +{ +// auto result = g_origUIO_AMIC_GetDeviceVersion(); +// info(true, "UIO_AMIC_GetDeviceVersion result: %08X", result); + return 0x66; +} + +__int64 UIO_AMIC_GetStatus() +{ +// auto result = g_origUIO_AMIC_GetStatus(); +// info(true, "UIO_AMIC_GetStatus result: %08X", result); + return 0x200; +} + +__int64 UIO_AMIC_IsPadMode() +{ +// auto result = g_origUIO_AMIC_IsPadMode(); +// info(true, "UIO_AMIC_IsPadMode result: %08X", result); + return 0; +} + +__int64 UIO_AMIC_Open() +{ +// auto result = g_origUIO_AMIC_Open(); +// info(true, "UIO_AMIC_Open result: %08X", result); + return 0; +} + +__int64 UIO_AMIC_Update(__int64 a1) +{ +// auto result = g_origUIO_AMIC_Update(a1); +// info(true, "UIO_AMIC_Update result: %08X", result); + + // ESCAPE QUITS GAME + if (GetAsyncKeyState(VK_ESCAPE) & 0x8000) + { + HWND hWndTmp = GetForegroundWindow(); + if ((hWndTmp == FindWindowA(NULL, "StreetFighterV"))) + { + exit(0); + } + } + + BYTE ButtonStateByte1 = 0; + BYTE ButtonStateByte2 = 0; + BYTE ButtonStateByte3 = 7; + + if (*ffbOffset & 0x80) // START + { + ButtonStateByte1 += 0x04; + } + if (*ffbOffset & 0x400000) // TEST + { + ButtonStateByte1 += 0x10; + } + if (*ffbOffset & 0x100) // COIN + { + ButtonStateByte1 += 0x20; + } + if (*ffbOffset & 0x20) // Button UP + { + ButtonStateByte2 += 0x01; + } + if (*ffbOffset & 0x10) // Button DOWN + { + ButtonStateByte2 += 0x02; + } + if (*ffbOffset & 0x08) // Button LEFT + { + ButtonStateByte2 += 0x04; + } + if (*ffbOffset & 0x04) // Button RIGHT + { + ButtonStateByte2 += 0x08; + } + if (*ffbOffset & 0x02) // Button#1 + { + ButtonStateByte2 += 0x10; + } + if (*ffbOffset & 0x01) // Button#2 + { + ButtonStateByte2 += 0x20; + } + if (*ffbOffset & 0x8000) // Button#3 + { + ButtonStateByte2 += 0x40; + } + if (*ffbOffset & 0x4000) // Button#4 + { + ButtonStateByte2 += 0x80; + } + if (*ffbOffset & 0x2000) // Button#5 + { + ButtonStateByte1 += 0x01; + } + if (*ffbOffset & 0x1000) // Button#6 + { + ButtonStateByte1 += 0x02; + } + if (*ffbOffset & 0x20000000) // Button#EX1 + { + ButtonStateByte3 = 6; + } + if (*ffbOffset & 0x10000000) // Button#EX2 + { + ButtonStateByte3 ^= 2; + } + if (*ffbOffset & 0x40)// GAMEPAD STATUS BYTE: 0=OFF , 1=ON + { + ButtonStateByte3 ^= 4; + } + + injector::WriteMemory((a1 + 16), ButtonStateByte1, true); + injector::WriteMemory((a1 + 18), ButtonStateByte2, true); + injector::WriteMemory((a1 + 19), ButtonStateByte3, true); + return 0; +} + +__int64 UIO_AMIC_WdtClear() +{ +// auto result = g_origUIO_AMIC_WdtClear(); +// info(true, "UIO_AMIC_WdtClear result: %08X", result); + return 1; +} + +__int64 UIO_AMIC_WdtDisable() +{ +// auto result = g_origUIO_AMIC_WdtDisable(); +// info(true, "UIO_AMIC_WdtDisable result: %08X", result); + return 1; +} + +__int64 UIO_AMIC_WdtEnable(unsigned __int16 a1, __int64 a2) +{ +// auto result = g_origUIO_AMIC_WdtEnable(a1, a2); +// info(true, "UIO_AMIC_WdtEnable result: %08X", result); + return 1; +} + +__int64 UIO_AMIC_WdtGetDIP() +{ +// auto result = g_origUIO_AMIC_WdtGetDIP(); +// info(true, "UIO_AMIC_WdtGetDIP result: %08X", result); + return 0xABCD; +} + +#ifndef _DEBUG +static void info(...) +{ + +} +#endif + +__int64 NESiCAUtilLibIsOnlineMode() +{ + auto result = g_origNESiCAUtilLibIsOnlineMode(); + info(true, "NESiCAUtilLibIsOnlineMode result: %08X", result); + return result; +} + +__int64 NESiCAUtilLibGetStatus() +{ + auto result = g_origNESiCAUtilLibGetStatus(); + info(true, "NESiCAUtilLibGetStatus result: %08X", result); + return 1; // can be anything thats not 0? +} + +__int64 NESiCAUtilLibDelete() +{ + auto result = g_origNESiCAUtilLibDelete(); + info(true, "NESiCAUtilLibDelete result: %08X", result); + return result; +} + +__int64 NESiCAUtilLibGetCenterInformation() +{ + auto result = g_origNESiCAUtilLibGetCenterInformation(); + info(true, "NESiCAUtilLibGetCenterInformation result: %08X", result); + return result; +} + +__int64 NESiCAUtilLibGetInformation() +{ + auto result = g_origNESiCAUtilLibGetInformation(); + info(true, "NESiCAUtilLibGetInformation result: %08X", result); + return result; +} + +__int64 NESiCAUtilLibGetPlayerAskInformation() +{ + auto result = g_origNESiCAUtilLibGetPlayerAskInformation(); + info(true, "NESiCAUtilLibGetPlayerAskInformation result: %08X", result); + return result; +} + +__int64 NESiCAUtilLibGetPlayerInformation() +{ + auto result = g_origNESiCAUtilLibGetPlayerInformation(); + info(true, "NESiCAUtilLibGetPlayerInformation result: %08X", result); + return result; +} + +__int64 NESiCAUtilLibGetPlayerTime() +{ + auto result = g_origNESiCAUtilLibGetPlayerTime(); + info(true, "NESiCAUtilLibGetPlayerTime result: %08X", result); + return result; +} + +__int64 NESiCAUtilLibGetStatusStringUTF16() +{ + auto result = g_origNESiCAUtilLibGetStatusStringUTF16(); + info(true, "NESiCAUtilLibGetStatusStringUTF16 result: %08X", result); + return result; +} + +__int64 NESiCAUtilLibInit() +{ + auto result = g_origNESiCAUtilLibInit(); + info(true, "NESiCAUtilLibInit result: %08X", result); + return result; +} + +__int64 NESiCAUtilLibIsExistInstance() +{ + auto result = g_origNESiCAUtilLibIsExistInstance(); + info(true, "NESiCAUtilLibIsExistInstance result: %08X", result); + return result; +} + +__int64 NESiCAUtilLibUpdate() +{ + auto result = g_origNESiCAUtilLibUpdate(); + info(true, "NESiCAUtilLibUpdate result: %08X", result); + return result; +} + +__int64 NESiCAUtilLib_NESiCA_BData_Get() +{ + auto result = g_origNESiCAUtilLib_NESiCA_BData_Get(); + info(true, "NESiCAUtilLib_NESiCA_BData_Get result: %08X", result); + return result; +} + +__int64 NESiCAUtilLib_NESiCA_BData_Set() +{ + auto result = g_origNESiCAUtilLib_NESiCA_BData_Set(); + info(true, "NESiCAUtilLib_NESiCA_BData_Set result: %08X", result); + return result; +} + +__int64 NESiCAUtilLib_NESiCA_BData_SetDefault() +{ + auto result = g_origNESiCAUtilLib_NESiCA_BData_SetDefault(); + info(true, "NESiCAUtilLib_NESiCA_BData_SetDefault result: %08X", result); + return result; +} + +__int64 NESiCAUtilLib_NESiCA_TData_GetBuf() +{ + auto result = g_origNESiCAUtilLib_NESiCA_TData_GetBuf(); + info(true, "NESiCAUtilLib_NESiCA_TData_GetBuf result: %08X", result); + return result; +} + +__int64 NESiCAUtilLib_NESiCA_TData_GetSize() +{ + auto result = g_origNESiCAUtilLib_NESiCA_TData_GetSize(); + info(true, "NESiCAUtilLib_NESiCA_TData_GetSize result: %08X", result); + return result; +} + +__int64 BeginPlay() +{ + auto result = g_origBeginPlay(); + info(true, "BeginPlay result: %08X", result); + return result; +} + +__int64 ContinuePlay() +{ + auto result = g_origContinuePlay(); + info(true, "ContinuePlay result: %08X", result); + return result; +} + +__int64 EndPlay() +{ + auto result = g_origEndPlay(); + info(true, "EndPlay result: %08X", result); + return result; +} + +__int64 GetGlobalIP() +{ + auto result = g_origGetGlobalIP(); + info(true, "GetGlobalIP result: %08X", result); + return result; +} + +__int64 GetKeyConfig() +{ + auto result = g_origGetKeyConfig(); + info(true, "GetKeyConfig result: %08X", result); + return result; +} + +__int64 GetLanInterface() +{ + auto result = g_origGetLanInterface(); + info(true, "GetLanInterface result: %08X", result); + return result; +} + +__int64 GetLibraryVersion() +{ + auto result = g_origGetLibraryVersion(); + info(true, "GetLibraryVersion result: %08X", result); + return result; +} + +__int64 GetNWInfo() +{ + auto result = g_origGetNWInfo(); + info(true, "GetNWInfo result: %08X", result); + return result; +} + +__int64 GetNewsImagePath() +{ + auto result = g_origGetNewsImagePath(); + info(true, "GetNewsImagePath result: %08X", result); + return result; +} + +__int64 GetRanking(signed int a1, __int64 a2, signed int a3, DWORD_PTR a4, DWORD_PTR a5) +{ + auto result = g_origGetRanking(a1, a2, a3, a4, a5); + info(true, "GetRanking result: %08X", result); + return result; +} + +__int64 GetResponseTime() +{ + auto result = g_origGetResponseTime(); + info(true, "GetResponseTime result: %08X", result); + return result; +} + +__int64 GetServerInfo() +{ + auto result = g_origGetServerInfo(); + info(true, "GetServerInfo result: %08X", result); + return result; +} + +__int64 GetServiceVersion() +{ + auto result = g_origGetServiceVersion(); + info(true, "GetServiceVersion result: %08X", result); + return result; +} + +__int64 GetTenpoInfo() +{ + auto result = g_origGetTenpoInfo(); + info(true, "GetTenpoInfo result: %08X", result); + return result; +} + +__int64 IsBeginningProcessFinished() +{ + auto result = g_origIsBeginningProcessFinished(); + info(true, "IsBeginningProcessFinished result: %08X", result); + return result; +} + +__int64 IsDisactive() +{ + auto result = g_origIsDisactive(); + info(true, "IsDisactive result: %08X", result); + return result; +} + +__int64 IsEndingProcessFinished() +{ + auto result = g_origIsEndingProcessFinished(); + info(true, "IsEndingProcessFinished result: %08X", result); + return result; +} + +__int64 IsEventMode() +{ + auto result = g_origIsEventMode(); + info(true, "IsEventMode result: %08X", result); + return result; +} + +__int64 IsReadyDownloadRanking() +{ + auto result = g_origIsReadyDownloadRanking(); + info(true, "IsReadyDownloadRanking result: %08X", result); + return result; +} + +__int64 IsTestMode() +{ + auto result = g_origIsTestMode(); + info(true, "IsTestMode result: %08X", result); + return result; +} + +__int64 IsUploaded() +{ + auto result = g_origIsUploaded(); + info(true, "IsUploaded result: %08X", result); + return result; +} + +__int64 LockProcess() +{ + auto result = g_origLockProcess(); + info(true, "LockProcess result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailCharacterBattlePointMonth() +{ + auto result = g_origNESiCA_Card_GetDetailCharacterBattlePointMonth(); + info(true, "NESiCA_Card_GetDetailCharacterBattlePointMonth result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailCharacterBattlePointTotal() +{ + auto result = g_origNESiCA_Card_GetDetailCharacterBattlePointTotal(); + info(true, "NESiCA_Card_GetDetailCharacterBattlePointTotal result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailCharacterDrawCountMonth() +{ + auto result = g_origNESiCA_Card_GetDetailCharacterDrawCountMonth(); + info(true, "NESiCA_Card_GetDetailCharacterDrawCountMonth result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailCharacterDrawCountTotal() +{ + auto result = g_origNESiCA_Card_GetDetailCharacterDrawCountTotal(); + info(true, "NESiCA_Card_GetDetailCharacterDrawCountTotal result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailCharacterLastColorID() +{ + auto result = g_origNESiCA_Card_GetDetailCharacterLastColorID(); + info(true, "NESiCA_Card_GetDetailCharacterLastColorID result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailCharacterLastComment() +{ + auto result = g_origNESiCA_Card_GetDetailCharacterLastComment(); + info(true, "NESiCA_Card_GetDetailCharacterLastComment result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailCharacterLastCostumeID() +{ + auto result = g_origNESiCA_Card_GetDetailCharacterLastCostumeID(); + info(true, "NESiCA_Card_GetDetailCharacterLastCostumeID result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailCharacterLastVTrigger() +{ + auto result = g_origNESiCA_Card_GetDetailCharacterLastVTrigger(); + info(true, "NESiCA_Card_GetDetailCharacterLastVTrigger result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailCharacterLoseCountMonth() +{ + auto result = g_origNESiCA_Card_GetDetailCharacterLoseCountMonth(); + info(true, "NESiCA_Card_GetDetailCharacterLoseCountMonth result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailCharacterLoseCountTotal() +{ + auto result = g_origNESiCA_Card_GetDetailCharacterLoseCountTotal(); + info(true, "NESiCA_Card_GetDetailCharacterLoseCountTotal result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailCharacterUseCountMonth() +{ + auto result = g_origNESiCA_Card_GetDetailCharacterUseCountMonth(); + info(true, "NESiCA_Card_GetDetailCharacterUseCountMonth result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailCharacterUseCountTotal() +{ + auto result = g_origNESiCA_Card_GetDetailCharacterUseCountTotal(); + info(true, "NESiCA_Card_GetDetailCharacterUseCountTotal result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailCharacterWinCountMonth() +{ + auto result = g_origNESiCA_Card_GetDetailCharacterWinCountMonth(); + info(true, "NESiCA_Card_GetDetailCharacterWinCountMonth result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailCharacterWinCountTotal() +{ + auto result = g_origNESiCA_Card_GetDetailCharacterWinCountTotal(); + info(true, "NESiCA_Card_GetDetailCharacterWinCountTotal result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailControlType() +{ + auto result = g_origNESiCA_Card_GetDetailControlType(); + info(true, "NESiCA_Card_GetDetailControlType result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailCurrentWins() +{ + auto result = g_origNESiCA_Card_GetDetailCurrentWins(); + info(true, "NESiCA_Card_GetDetailCurrentWins result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailHighScore() +{ + auto result = g_origNESiCA_Card_GetDetailHighScore(); + info(true, "NESiCA_Card_GetDetailHighScore result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailHighScoreCharacterID() +{ + auto result = g_origNESiCA_Card_GetDetailHighScoreCharacterID(); + info(true, "NESiCA_Card_GetDetailHighScoreCharacterID result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailKeyConfigHK() +{ + auto result = g_origNESiCA_Card_GetDetailKeyConfigHK(); + info(true, "NESiCA_Card_GetDetailKeyConfigHK result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailKeyConfigHP() +{ + auto result = g_origNESiCA_Card_GetDetailKeyConfigHP(); + info(true, "NESiCA_Card_GetDetailKeyConfigHP result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailKeyConfigHPHK() +{ + auto result = g_origNESiCA_Card_GetDetailKeyConfigHPHK(); + info(true, "NESiCA_Card_GetDetailKeyConfigHPHK result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailKeyConfigK3() +{ + auto result = g_origNESiCA_Card_GetDetailKeyConfigK3(); + info(true, "NESiCA_Card_GetDetailKeyConfigK3 result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailKeyConfigLK() +{ + auto result = g_origNESiCA_Card_GetDetailKeyConfigLK(); + info(true, "NESiCA_Card_GetDetailKeyConfigLK result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailKeyConfigLKMK() +{ + auto result = g_origNESiCA_Card_GetDetailKeyConfigLKMK(); + info(true, "NESiCA_Card_GetDetailKeyConfigLKMK result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailKeyConfigLP() +{ + auto result = g_origNESiCA_Card_GetDetailKeyConfigLP(); + info(true, "NESiCA_Card_GetDetailKeyConfigLP result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailKeyConfigLPLK() +{ + auto result = g_origNESiCA_Card_GetDetailKeyConfigLPLK(); + info(true, "NESiCA_Card_GetDetailKeyConfigLPLK result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailKeyConfigLPMK() +{ + auto result = g_origNESiCA_Card_GetDetailKeyConfigLPMK(); + info(true, "NESiCA_Card_GetDetailKeyConfigLPMK result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailKeyConfigLPMP() +{ + auto result = g_origNESiCA_Card_GetDetailKeyConfigLPMP(); + info(true, "NESiCA_Card_GetDetailKeyConfigLPMP result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailKeyConfigMK() +{ + auto result = g_origNESiCA_Card_GetDetailKeyConfigMK(); + info(true, "NESiCA_Card_GetDetailKeyConfigMK result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailKeyConfigMP() +{ + auto result = g_origNESiCA_Card_GetDetailKeyConfigMP(); + info(true, "NESiCA_Card_GetDetailKeyConfigMP result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailKeyConfigMPLK() +{ + auto result = g_origNESiCA_Card_GetDetailKeyConfigMPLK(); + info(true, "NESiCA_Card_GetDetailKeyConfigMPLK result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailKeyConfigMPMK() +{ + auto result = g_origNESiCA_Card_GetDetailKeyConfigMPMK(); + info(true, "NESiCA_Card_GetDetailKeyConfigMPMK result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailKeyConfigP3() +{ + auto result = g_origNESiCA_Card_GetDetailKeyConfigP3(); + info(true, "NESiCA_Card_GetDetailKeyConfigP3 result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailLastCharacterID() +{ + auto result = g_origNESiCA_Card_GetDetailLastCharacterID(); + info(true, "NESiCA_Card_GetDetailLastCharacterID result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailLeaguePoint() +{ + auto result = g_origNESiCA_Card_GetDetailLeaguePoint(); + info(true, "NESiCA_Card_GetDetailLeaguePoint result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailMaxWins() +{ + auto result = g_origNESiCA_Card_GetDetailMaxWins(); + info(true, "NESiCA_Card_GetDetailMaxWins result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailPlayerPointMonth() +{ + auto result = g_origNESiCA_Card_GetDetailPlayerPointMonth(); + info(true, "NESiCA_Card_GetDetailPlayerPointMonth result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetDetailPlayerPointTotal() +{ + auto result = g_origNESiCA_Card_GetDetailPlayerPointTotal(); + info(true, "NESiCA_Card_GetDetailPlayerPointTotal result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetPlayerComment() +{ + auto result = g_origNESiCA_Card_GetPlayerComment(); + info(true, "NESiCA_Card_GetPlayerComment result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetPlayerCommentUTF16() +{ + auto result = g_origNESiCA_Card_GetPlayerCommentUTF16(); + info(true, "NESiCA_Card_GetPlayerCommentUTF16 result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetPlayerMyStoreID() +{ + auto result = g_origNESiCA_Card_GetPlayerMyStoreID(); + info(true, "NESiCA_Card_GetPlayerMyStoreID result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetPlayerName() +{ + auto result = g_origNESiCA_Card_GetPlayerName(); + info(true, "NESiCA_Card_GetPlayerName result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetPlayerNameUTF16() +{ + auto result = g_origNESiCA_Card_GetPlayerNameUTF16(); + info(true, "NESiCA_Card_GetPlayerNameUTF16 result: %08X", result); + return result; +} + +__int64 NESiCA_Card_GetPlayerTitleID() +{ + auto result = g_origNESiCA_Card_GetPlayerTitleID(); + info(true, "NESiCA_Card_GetPlayerTitleID result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailCharacterBattlePointMonth() +{ + auto result = g_origNESiCA_Card_SetDetailCharacterBattlePointMonth(); + info(true, "NESiCA_Card_SetDetailCharacterBattlePointMonth result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailCharacterBattlePointTotal() +{ + auto result = g_origNESiCA_Card_SetDetailCharacterBattlePointTotal(); + info(true, "NESiCA_Card_SetDetailCharacterBattlePointTotal result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailCharacterDrawCountMonth() +{ + auto result = g_origNESiCA_Card_SetDetailCharacterDrawCountMonth(); + info(true, "NESiCA_Card_SetDetailCharacterDrawCountMonth result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailCharacterDrawCountTotal() +{ + auto result = g_origNESiCA_Card_SetDetailCharacterDrawCountTotal(); + info(true, "NESiCA_Card_SetDetailCharacterDrawCountTotal result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailCharacterLastColorID() +{ + auto result = g_origNESiCA_Card_SetDetailCharacterLastColorID(); + info(true, "NESiCA_Card_SetDetailCharacterLastColorID result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailCharacterLastComment() +{ + auto result = g_origNESiCA_Card_SetDetailCharacterLastComment(); + info(true, "NESiCA_Card_SetDetailCharacterLastComment result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailCharacterLastCostumeID() +{ + auto result = g_origNESiCA_Card_SetDetailCharacterLastCostumeID(); + info(true, "NESiCA_Card_SetDetailCharacterLastCostumeID result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailCharacterLastVTrigger() +{ + auto result = g_origNESiCA_Card_SetDetailCharacterLastVTrigger(); + info(true, "NESiCA_Card_SetDetailCharacterLastVTrigger result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailCharacterLoseCountMonth() +{ + auto result = g_origNESiCA_Card_SetDetailCharacterLoseCountMonth(); + info(true, "NESiCA_Card_SetDetailCharacterLoseCountMonth result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailCharacterLoseCountTotal() +{ + auto result = g_origNESiCA_Card_SetDetailCharacterLoseCountTotal(); + info(true, "NESiCA_Card_SetDetailCharacterLoseCountTotal result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailCharacterUseCountMonth() +{ + auto result = g_origNESiCA_Card_SetDetailCharacterUseCountMonth(); + info(true, "NESiCA_Card_SetDetailCharacterUseCountMonth result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailCharacterUseCountTotal() +{ + auto result = g_origNESiCA_Card_SetDetailCharacterUseCountTotal(); + info(true, "NESiCA_Card_SetDetailCharacterUseCountTotal result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailCharacterWinCountMonth() +{ + auto result = g_origNESiCA_Card_SetDetailCharacterWinCountMonth(); + info(true, "NESiCA_Card_SetDetailCharacterWinCountMonth result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailCharacterWinCountTotal() +{ + auto result = g_origNESiCA_Card_SetDetailCharacterWinCountTotal(); + info(true, "NESiCA_Card_SetDetailCharacterWinCountTotal result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailControlType() +{ + auto result = g_origNESiCA_Card_SetDetailControlType(); + info(true, "NESiCA_Card_SetDetailControlType result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailCurrentWins() +{ + auto result = g_origNESiCA_Card_SetDetailCurrentWins(); + info(true, "NESiCA_Card_SetDetailCurrentWins result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailHighScore() +{ + auto result = g_origNESiCA_Card_SetDetailHighScore(); + info(true, "NESiCA_Card_SetDetailHighScore result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailHighScoreCharacterID() +{ + auto result = g_origNESiCA_Card_SetDetailHighScoreCharacterID(); + info(true, "NESiCA_Card_SetDetailHighScoreCharacterID result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailKeyConfigHK() +{ + auto result = g_origNESiCA_Card_SetDetailKeyConfigHK(); + info(true, "NESiCA_Card_SetDetailKeyConfigHK result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailKeyConfigHP() +{ + auto result = g_origNESiCA_Card_SetDetailKeyConfigHP(); + info(true, "NESiCA_Card_SetDetailKeyConfigHP result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailKeyConfigHPHK() +{ + auto result = g_origNESiCA_Card_SetDetailKeyConfigHPHK(); + info(true, "NESiCA_Card_SetDetailKeyConfigHPHK result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailKeyConfigK3() +{ + auto result = g_origNESiCA_Card_SetDetailKeyConfigK3(); + info(true, "NESiCA_Card_SetDetailKeyConfigK3 result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailKeyConfigLK() +{ + auto result = g_origNESiCA_Card_SetDetailKeyConfigLK(); + info(true, "NESiCA_Card_SetDetailKeyConfigLK result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailKeyConfigLKMK() +{ + auto result = g_origNESiCA_Card_SetDetailKeyConfigLKMK(); + info(true, "NESiCA_Card_SetDetailKeyConfigLKMK result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailKeyConfigLP() +{ + auto result = g_origNESiCA_Card_SetDetailKeyConfigLP(); + info(true, "NESiCA_Card_SetDetailKeyConfigLP result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailKeyConfigLPLK() +{ + auto result = g_origNESiCA_Card_SetDetailKeyConfigLPLK(); + info(true, "NESiCA_Card_SetDetailKeyConfigLPLK result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailKeyConfigLPMK() +{ + auto result = g_origNESiCA_Card_SetDetailKeyConfigLPMK(); + info(true, "NESiCA_Card_SetDetailKeyConfigLPMK result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailKeyConfigLPMP() +{ + auto result = g_origNESiCA_Card_SetDetailKeyConfigLPMP(); + info(true, "NESiCA_Card_SetDetailKeyConfigLPMP result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailKeyConfigMK() +{ + auto result = g_origNESiCA_Card_SetDetailKeyConfigMK(); + info(true, "NESiCA_Card_SetDetailKeyConfigMK result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailKeyConfigMP() +{ + auto result = g_origNESiCA_Card_SetDetailKeyConfigMP(); + info(true, "NESiCA_Card_SetDetailKeyConfigMP result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailKeyConfigMPLK() +{ + auto result = g_origNESiCA_Card_SetDetailKeyConfigMPLK(); + info(true, "NESiCA_Card_SetDetailKeyConfigMPLK result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailKeyConfigMPMK() +{ + auto result = g_origNESiCA_Card_SetDetailKeyConfigMPMK(); + info(true, "NESiCA_Card_SetDetailKeyConfigMPMK result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailKeyConfigP3() +{ + auto result = g_origNESiCA_Card_SetDetailKeyConfigP3(); + info(true, "NESiCA_Card_SetDetailKeyConfigP3 result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailLastCharacterID() +{ + auto result = g_origNESiCA_Card_SetDetailLastCharacterID(); + info(true, "NESiCA_Card_SetDetailLastCharacterID result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailLeaguePoint() +{ + auto result = g_origNESiCA_Card_SetDetailLeaguePoint(); + info(true, "NESiCA_Card_SetDetailLeaguePoint result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailMaxWins() +{ + auto result = g_origNESiCA_Card_SetDetailMaxWins(); + info(true, "NESiCA_Card_SetDetailMaxWins result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailPlayerPointMonth() +{ + auto result = g_origNESiCA_Card_SetDetailPlayerPointMonth(); + info(true, "NESiCA_Card_SetDetailPlayerPointMonth result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetDetailPlayerPointTotal() +{ + auto result = g_origNESiCA_Card_SetDetailPlayerPointTotal(); + info(true, "NESiCA_Card_SetDetailPlayerPointTotal result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetPlayerComment() +{ + auto result = g_origNESiCA_Card_SetPlayerComment(); + info(true, "NESiCA_Card_SetPlayerComment result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetPlayerCommentUTF16() +{ + auto result = g_origNESiCA_Card_SetPlayerCommentUTF16(); + info(true, "NESiCA_Card_SetPlayerCommentUTF16 result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetPlayerMyStoreID() +{ + auto result = g_origNESiCA_Card_SetPlayerMyStoreID(); + info(true, "NESiCA_Card_SetPlayerMyStoreID result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetPlayerName() +{ + auto result = g_origNESiCA_Card_SetPlayerName(); + info(true, "NESiCA_Card_SetPlayerName result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetPlayerNameUTF16() +{ + auto result = g_origNESiCA_Card_SetPlayerNameUTF16(); + info(true, "NESiCA_Card_SetPlayerNameUTF16 result: %08X", result); + return result; +} + +__int64 NESiCA_Card_SetPlayerTitleID() +{ + auto result = g_origNESiCA_Card_SetPlayerTitleID(); + info(true, "NESiCA_Card_SetPlayerTitleID result: %08X", result); + return result; +} + +__int64 NESiCA_GetNESiCAID() +{ + auto result = g_origNESiCA_GetNESiCAID(); + info(true, "NESiCA_GetNESiCAID result: %08X", result); + return result; +} + +__int64 NESiCA_GetNESiCAType() +{ + auto result = g_origNESiCA_GetNESiCAType(); + info(true, "NESiCA_GetNESiCAType result: %08X", result); + return result; +} + +__int64 NESiCA_IsCardPlayer() +{ + auto result = g_origNESiCA_IsCardPlayer(); + info(true, "NESiCA_IsCardPlayer result: %08X", result); + return result; +} + +__int64 NESiCA_Rank_GetBattlePointRank() +{ + auto result = g_origNESiCA_Rank_GetBattlePointRank(); + info(true, "NESiCA_Rank_GetBattlePointRank result: %08X", result); + return result; +} + +__int64 NESiCA_Rank_GetBattlePointRankPref() +{ + auto result = g_origNESiCA_Rank_GetBattlePointRankPref(); + info(true, "NESiCA_Rank_GetBattlePointRankPref result: %08X", result); + return result; +} + +__int64 NESiCA_Rank_GetBattlePointRankPrefId() +{ + auto result = g_origNESiCA_Rank_GetBattlePointRankPrefId(); + info(true, "NESiCA_Rank_GetBattlePointRankPrefId result: %08X", result); + return result; +} + +__int64 NESiCA_Rank_GetBattlePointRankPrefName() +{ + auto result = g_origNESiCA_Rank_GetBattlePointRankPrefName(); + info(true, "NESiCA_Rank_GetBattlePointRankPrefName result: %08X", result); + return result; +} + +__int64 NESiCA_Rank_GetBattlePointRankPrefNameUTF16() +{ + auto result = g_origNESiCA_Rank_GetBattlePointRankPrefNameUTF16(); + info(true, "NESiCA_Rank_GetBattlePointRankPrefNameUTF16 result: %08X", result); + return result; +} + +__int64 Reconnect() +{ + auto result = g_origReconnect(); + info(true, "Reconnect result: %08X", result); + return result; +} + +__int64 SaveOnTheWay() +{ + auto result = g_origSaveOnTheWay(); + info(true, "SaveOnTheWay result: %08X", result); + return result; +} + +__int64 SetCharacterID() +{ + auto result = g_origSetCharacterID(); + info(true, "SetCharacterID result: %08X", result); + return result; +} + +__int64 SetEventMode() +{ + auto result = g_origSetEventMode(); + info(true, "SetEventMode result: %08X", result); + return result; +} + +__int64 SetEventModeResult() +{ + auto result = g_origSetEventModeResult(); + info(true, "SetEventModeResult result: %08X", result); + return result; +} + +__int64 SetOpenCloseTime() +{ + auto result = g_origSetOpenCloseTime(); + info(true, "SetOpenCloseTime result: %08X", result); + return result; +} + +__int64 StartTestMode() +{ + auto result = g_origStartTestMode(); + info(true, "StartTestMode result: %08X", result); + return result; +} + +__int64 TypeXGetTelop() +{ + auto result = g_origTypeXGetTelop(); + info(true, "TypeXGetTelop result: %08X", result); + return result; +} + +__int64 TypeXMatching_ChangeWinLimit() +{ + auto result = g_origTypeXMatching_ChangeWinLimit(); + info(true, "TypeXMatching_ChangeWinLimit result: %08X", result); + return result; +} + +__int64 TypeXMatching_CreateInstance() +{ + auto result = g_origTypeXMatching_CreateInstance(); + info(true, "TypeXMatching_CreateInstance result: %08X", result); + return result; +} + +__int64 TypeXMatching_DeleteInstance() +{ + auto result = g_origTypeXMatching_DeleteInstance(); + info(true, "TypeXMatching_DeleteInstance result: %08X", result); + return result; +} + +__int64 TypeXMatching_GetEnemyAddr() +{ + auto result = g_origTypeXMatching_GetEnemyAddr(); + info(true, "TypeXMatching_GetEnemyAddr result: %08X", result); + return result; +} + +__int64 TypeXMatching_GetEnemyEntryId() +{ + auto result = g_origTypeXMatching_GetEnemyEntryId(); + info(true, "TypeXMatching_GetEnemyEntryId result: %08X", result); + return result; +} + +__int64 TypeXMatching_GetEnemyOption() +{ + auto result = g_origTypeXMatching_GetEnemyOption(); + info(true, "TypeXMatching_GetEnemyOption result: %08X", result); + return result; +} + +__int64 TypeXMatching_GetEnemyPlayerName() +{ + auto result = g_origTypeXMatching_GetEnemyPlayerName(); + info(true, "TypeXMatching_GetEnemyPlayerName result: %08X", result); + return result; +} + +__int64 TypeXMatching_GetEnemyPlayerNameUTF16() +{ + auto result = g_origTypeXMatching_GetEnemyPlayerNameUTF16(); + info(true, "TypeXMatching_GetEnemyPlayerNameUTF16 result: %08X", result); + return result; +} + +__int64 TypeXMatching_GetEnemyTenpoName() +{ + auto result = g_origTypeXMatching_GetEnemyTenpoName(); + info(true, "TypeXMatching_GetEnemyTenpoName result: %08X", result); + return result; +} + +__int64 TypeXMatching_GetEnemyTenpoNameUTF16() +{ + auto result = g_origTypeXMatching_GetEnemyTenpoNameUTF16(); + info(true, "TypeXMatching_GetEnemyTenpoNameUTF16 result: %08X", result); + return result; +} + +__int64 TypeXMatching_GetFighterInfoInStore() +{ + auto result = g_origTypeXMatching_GetFighterInfoInStore(); + info(true, "TypeXMatching_GetFighterInfoInStore result: %08X", result); + return result; +} + +__int64 TypeXMatching_GetMyAddr() +{ + auto result = g_origTypeXMatching_GetMyAddr(); + info(true, "TypeXMatching_GetMyAddr result: %08X", result); + return result; +} + +__int64 TypeXMatching_GetMyEntryId() +{ + auto result = g_origTypeXMatching_GetMyEntryId(); + info(true, "TypeXMatching_GetMyEntryId result: %08X", result); + return result; +} + +__int64 TypeXMatching_GetRTT() +{ + auto result = g_origTypeXMatching_GetRTT(); + info(true, "TypeXMatching_GetRTT result: %08X", result); + return result; +} + +__int64 TypeXMatching_GetStatus() +{ + auto result = g_origTypeXMatching_GetStatus(); + info(true, "TypeXMatching_GetStatus result: %08X", result); + return result; +} + +__int64 TypeXMatching_GetWinLimit() +{ + auto result = g_origTypeXMatching_GetWinLimit(); + info(true, "TypeXMatching_GetWinLimit result: %08X", result); + return result; +} + +__int64 TypeXMatching_GetWins() +{ + auto result = g_origTypeXMatching_GetWins(); + info(true, "TypeXMatching_GetWins result: %08X", result); + return result; +} + +__int64 TypeXMatching_GetWinsAll() +{ + auto result = g_origTypeXMatching_GetWinsAll(); + info(true, "TypeXMatching_GetWinsAll result: %08X", result); + return result; +} + +__int64 TypeXMatching_IsMatchingDesignatedFailed() +{ + auto result = g_origTypeXMatching_IsMatchingDesignatedFailed(); + info(true, "TypeXMatching_IsMatchingDesignatedFailed result: %08X", result); + return result; +} + +__int64 TypeXMatching_Register_NESiCAUtilLibCancelRequestRFID() +{ + auto result = g_origTypeXMatching_Register_NESiCAUtilLibCancelRequestRFID(); + info(true, "TypeXMatching_Register_NESiCAUtilLibCancelRequestRFID result: %08X", result); + return result; +} + +__int64 TypeXMatching_Register_NESiCAUtilLibGetRFIDID() +{ + auto result = g_origTypeXMatching_Register_NESiCAUtilLibGetRFIDID(); + info(true, "TypeXMatching_Register_NESiCAUtilLibGetRFIDID result: %08X", result); + return result; +} + +__int64 TypeXMatching_Register_NESiCAUtilLibIsRFIDRead() +{ + auto result = g_origTypeXMatching_Register_NESiCAUtilLibIsRFIDRead(); + info(true, "TypeXMatching_Register_NESiCAUtilLibIsRFIDRead result: %08X", result); + return result; +} + +__int64 TypeXMatching_Register_NESiCAUtilLibIsRFIDReadSuccess() +{ + auto result = g_origTypeXMatching_Register_NESiCAUtilLibIsRFIDReadSuccess(); + info(true, "TypeXMatching_Register_NESiCAUtilLibIsRFIDReadSuccess result: %08X", result); + return result; +} + +__int64 TypeXMatching_Register_NESiCAUtilLibRequestRFID() +{ + auto result = g_origTypeXMatching_Register_NESiCAUtilLibRequestRFID(); + info(true, "TypeXMatching_Register_NESiCAUtilLibRequestRFID result: %08X", result); + return result; +} + +__int64 TypeXMatching_ResetWins() +{ + auto result = g_origTypeXMatching_ResetWins(); + info(true, "TypeXMatching_ResetWins result: %08X", result); + return result; +} + +__int64 TypeXMatching_Resume() +{ + auto result = g_origTypeXMatching_Resume(); + info(true, "TypeXMatching_Resume result: %08X", result); + return result; +} + +__int64 TypeXMatching_StartMatchingDesignated() +{ + auto result = g_origTypeXMatching_StartMatchingDesignated(); + info(true, "TypeXMatching_StartMatchingDesignated result: %08X", result); + return result; +} + +__int64 TypeXMatching_StartMathingInternetOnly() +{ + auto result = g_origTypeXMatching_StartMathingInternetOnly(); + info(true, "TypeXMatching_StartMathingInternetOnly result: %08X", result); + return result; +} + +__int64 TypeXMatching_StartMathingStoreOnly() +{ + auto result = g_origTypeXMatching_StartMathingStoreOnly(); + info(true, "TypeXMatching_StartMathingStoreOnly result: %08X", result); + return result; +} + +__int64 TypeXMatching_StartMathingStorePriority() +{ + auto result = g_origTypeXMatching_StartMathingStorePriority(); + info(true, "TypeXMatching_StartMathingStorePriority result: %08X", result); + return result; +} + +__int64 TypeXMatching_StopMatching() +{ + auto result = g_origTypeXMatching_StopMatching(); + info(true, "TypeXMatching_StopMatching result: %08X", result); + return result; +} + +__int64 TypeXMatching_Suspend() +{ + auto result = g_origTypeXMatching_Suspend(); + info(true, "TypeXMatching_Suspend result: %08X", result); + return result; +} + +__int64 TypeXMatching_Update() +{ + auto result = g_origTypeXMatching_Update(); + info(true, "TypeXMatching_Update result: %08X", result); + return result; +} + +__int64 TypeXMatching_UpdateWins() +{ + auto result = g_origTypeXMatching_UpdateWins(); + info(true, "TypeXMatching_UpdateWins result: %08X", result); + return result; +} + +__int64 TypeXPlayRecordAddToSend() +{ + auto result = g_origTypeXPlayRecordAddToSend(); + info(true, "TypeXPlayRecordAddToSend result: %08X", result); + return result; +} + +__int64 TypeXPlayRecordReset() +{ + auto result = g_origTypeXPlayRecordReset(); + info(true, "TypeXPlayRecordReset result: %08X", result); + return result; +} + +__int64 TypeXPlayRecordResetRevenge() +{ + auto result = g_origTypeXPlayRecordResetRevenge(); + info(true, "TypeXPlayRecordResetRevenge result: %08X", result); + return result; +} + +__int64 TypeXPlayRecordSetPlayerInfo() +{ + auto result = g_origTypeXPlayRecordSetPlayerInfo(); + info(true, "TypeXPlayRecordSetPlayerInfo result: %08X", result); + return result; +} + +__int64 TypeXPlayRecordSetRoundResult() +{ + auto result = g_origTypeXPlayRecordSetRoundResult(); + info(true, "TypeXPlayRecordSetRoundResult result: %08X", result); + return result; +} + +__int64 TypeXSafeFileIsFinished() +{ + auto result = g_origTypeXSafeFileIsFinished(); + info(true, "TypeXSafeFileIsFinished result: %08X", result); + return result; +} + +__int64 TypeXSafeFileRead() +{ + auto result = g_origTypeXSafeFileRead(); + info(true, "TypeXSafeFileRead result: %08X", result); + return result; +} + +__int64 TypeXSafeFileWrite() +{ + auto result = g_origTypeXSafeFileWrite(); + info(true, "TypeXSafeFileWrite result: %08X", result); + return result; +} + +__int64 TypeXSafeFileWriteUpdate() +{ + auto result = g_origTypeXSafeFileWriteUpdate(); + info(true, "TypeXSafeFileWriteUpdate result: %08X", result); + return result; +} + +__int64 UnlockProcess() +{ + auto result = g_origUnlockProcess(); + info(true, "UnlockProcess result: %08X", result); + return result; +} + +static wchar_t FullPathWithArgsFinal[MAX_PATH + 74] = { 0 }; +LPWSTR(__stdcall* original_GetCommandLineWSFV)(); +LPWSTR WINAPI GetCommandLineWSFV() +{ + return FullPathWithArgsFinal; +} + +void ReplaceStringInPlaceWSFV(std::wstring& subject, const std::wstring& search, const std::wstring& replace) +{ + size_t pos = 0; + while ((pos = subject.find(search, pos)) != std::wstring::npos) + { + subject.replace(pos, search.length(), replace); + pos += replace.length(); + } +} + +HRESULT(__cdecl* original_SHGetFolderPathWSFV)(HWND hwnd, int csidl, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath); +HRESULT __cdecl SHGetFolderPathWSFV(HWND hwnd, int csidl, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath) +{ + HRESULT result = original_SHGetFolderPathWSFV(hwnd, csidl, hToken, dwFlags, pszPath); + if (csidl == 0x1C) + { + std::wstring tempPath = pszPath; + std::wstring exePath = FullPathWithExeName; + ReplaceStringInPlaceWSFV(exePath, L"\\StreetFighterV.exe", L"\\AppData\\"); + ReplaceStringInPlaceWSFV(exePath, L"\\", L"/"); + wcscpy(pszPath, exePath.c_str()); + } + + return result; +} + +HANDLE(__stdcall* original_CreateFileWSFV)(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile); +HANDLE WINAPI CreateFileWSFV(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) +{ + if (wcsncmp(lpFileName, L"D:\\db", 5) == 0) + { + std::wstring tempFileName = lpFileName; + std::wstring exePath = FullPathWithExeName; + ReplaceStringInPlaceWSFV(exePath, L"\\StreetFighterV.exe", L"\\"); + ReplaceStringInPlaceWSFV(exePath, L"\\", L"/"); + ReplaceStringInPlaceWSFV(tempFileName, L"D:\\", exePath); + LPCWSTR finalFileName = tempFileName.c_str(); +// MessageBoxW(0, finalFileName, L"nesica db file", 0); + return original_CreateFileWSFV(finalFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); + } + + if (wcsncmp(lpFileName, L"Z:", 2) == 0) + { + std::wstring tempFileName = lpFileName; + std::wstring exePath = FullPathWithExeName; + ReplaceStringInPlaceWSFV(exePath, L"\\StreetFighterV.exe", L"\\"); + // ReplaceStringInPlaceWSFV(exePath, VMProtectDecryptStringW(L"\\"), VMProtectDecryptStringW(L"/")); + ReplaceStringInPlaceWSFV(tempFileName, L"Z:\\", exePath); + LPCWSTR finalFileName = tempFileName.c_str(); + return original_CreateFileWSFV(finalFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); + } + + return original_CreateFileWSFV(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); +} + +BOOL(__stdcall* original_DeleteFileWSFV)(LPCWSTR lpFileName); +BOOL WINAPI DeleteFileWSFV(LPCWSTR lpFileName) +{ + if (wcsncmp(lpFileName, L"D:\\db", 5) == 0) + { + std::wstring tempFileName = lpFileName; + std::wstring exePath = FullPathWithExeName; + ReplaceStringInPlaceWSFV(exePath, L"\\StreetFighterV.exe", L"\\"); + ReplaceStringInPlaceWSFV(exePath, L"\\", L"/"); + ReplaceStringInPlaceWSFV(tempFileName, L"D:\\", exePath); + LPCWSTR finalFileName = tempFileName.c_str(); + return original_DeleteFileWSFV(finalFileName); + } + + if (wcsncmp(lpFileName, L"Z:", 2) == 0) + { + std::wstring tempFileName = lpFileName; + std::wstring exePath = FullPathWithExeName; + ReplaceStringInPlaceWSFV(exePath, L"\\StreetFighterV.exe", L"\\"); + // ReplaceStringInPlaceWSFV(exePath, VMProtectDecryptStringW(L"\\"), VMProtectDecryptStringW(L"/")); + ReplaceStringInPlaceWSFV(tempFileName, L"Z:\\", exePath); + LPCWSTR finalFileName = tempFileName.c_str(); + return original_DeleteFileWSFV(finalFileName); + } + + return original_DeleteFileWSFV(lpFileName); +} + +HANDLE(__stdcall* original_FindFirstFileWSFV)(LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData); +HANDLE WINAPI FindFirstFileWSFV(LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData) +{ + if (wcsncmp(lpFileName, L"D:\\db", 5) == 0) + { + std::wstring tempFileName = lpFileName; + std::wstring exePath = FullPathWithExeName; + ReplaceStringInPlaceWSFV(exePath, L"\\StreetFighterV.exe", L"\\NesicaData"); + ReplaceStringInPlaceWSFV(tempFileName, L"D:", exePath); + LPCWSTR finalFileName = tempFileName.c_str(); + return original_FindFirstFileWSFV(finalFileName, lpFindFileData); + } + + return original_FindFirstFileWSFV(lpFileName, lpFindFileData); +} + +DWORD WINAPI XInputGetStateSFV(__int64 a1, __int64 a2) +{ + return ERROR_DEVICE_NOT_CONNECTED; +} + +bool replace(std::string& str, const std::string& from, const std::string& to) { + size_t start_pos = str.find(from); + if (start_pos == std::string::npos) + return false; + str.replace(start_pos, from.length(), to); + return true; +} + +void FixJapaneseFont() +{ + char working_directory[MAX_PATH + 1]; + GetCurrentDirectoryA(sizeof(working_directory), working_directory); + std::string strDIR = working_directory; + std::string strCFG = strDIR + "\\AppData\\StreetFighterV\\Saved\\Config\\WindowsNoEditor\\Engine.ini"; + std::string strToFind = "[Internationalization]\nCulture=ja\n"; + std::string strInsertBefore = "[WindowsApplication.Accessibility]\n"; + std::string strToInsert = "[Internationalization]\nCulture=ja\n\n[WindowsApplication.Accessibility]\n"; + //OPEN FILE AS STRING + std::ifstream inFile; + inFile.open(strCFG.c_str(), std::ifstream::in); + std::stringstream strStream; + strStream << inFile.rdbuf(); + std::string CFGread = strStream.str(); + inFile.close(); + // EDIT STRING + std::size_t found; + found = CFGread.find(strToFind); + if (found != std::string::npos) + { + if (!ToBool(config["General"]["FixJapaneseFont"])) + replace(CFGread, strToFind, ""); + } + else + { + if (ToBool(config["General"]["FixJapaneseFont"])) + replace(CFGread, strInsertBefore, strToInsert); + } + //SAVE STRING AS FILE + std::ofstream outFile; + outFile.open(strCFG.c_str(), std::ofstream::out | std::ofstream::trunc); + outFile << CFGread; + outFile.close(); + return; +} + +void SetCommandLineSFV() +{ + std::wstring FullPath = FullPathWithExeName; + std::wstring ResX = L"1280"; + std::wstring ResY = L"720"; + std::wstring Args; + + if (ToBool(config["General"]["CustomResolution"])) + { + std::string resWidth = config["General"]["CustomWidth"]; + std::string resHeight = config["General"]["CustomHeight"]; + std::wstring resWidthW(resWidth.begin(), resWidth.end()); + std::wstring resHeightW(resHeight.begin(), resHeight.end()); + ResX = resWidthW; + ResY = resHeightW; + } + + if (ToBool(config["General"]["Windowed"])) + { + Args = L"\" -ResX=" + ResX + L" -ResY=" + ResY + L" -WINDOWED\0"; + } + else + { + Args = L"\" -ResX=" + ResX + L" -ResY=" + ResY + L" -FULLSCREEN\0"; + } + std::wstring FullPathWithArgs = L"\"" + FullPath + Args; + LPWSTR FullPathWithArgsTemp = (LPWSTR)(FullPathWithArgs.c_str()); + wcscpy(FullPathWithArgsFinal, FullPathWithArgsTemp); + return; +} + +static InitFunction SFVFunc([]() + { + imageBase = (DWORD_PTR)GetModuleHandleA(0); + + DWORD_PTR iobase = (DWORD_PTR)LoadLibraryA("..\\..\\Plugins\\USBIOPlugin\\UIO_AMIC.dll"); + MH_Initialize(); + MH_CreateHookApi(L"UIO_AMIC.dll", "UIO_AMIC_Close", UIO_AMIC_Close, (void**)&g_origUIO_AMIC_Close); + MH_CreateHookApi(L"UIO_AMIC.dll", "UIO_AMIC_GetDeviceVersion", UIO_AMIC_GetDeviceVersion, (void**)&g_origUIO_AMIC_GetDeviceVersion); + MH_CreateHookApi(L"UIO_AMIC.dll", "UIO_AMIC_GetStatus", UIO_AMIC_GetStatus, (void**)&g_origUIO_AMIC_GetStatus); + MH_CreateHookApi(L"UIO_AMIC.dll", "UIO_AMIC_IsPadMode", UIO_AMIC_IsPadMode, (void**)&g_origUIO_AMIC_IsPadMode); + MH_CreateHookApi(L"UIO_AMIC.dll", "UIO_AMIC_Open", UIO_AMIC_Open, (void**)&g_origUIO_AMIC_Open); + MH_CreateHookApi(L"UIO_AMIC.dll", "UIO_AMIC_Update", UIO_AMIC_Update, (void**)&g_origUIO_AMIC_Update); + MH_CreateHookApi(L"UIO_AMIC.dll", "UIO_AMIC_WdtClear", UIO_AMIC_WdtClear, (void**)&g_origUIO_AMIC_WdtClear); + MH_CreateHookApi(L"UIO_AMIC.dll", "UIO_AMIC_WdtDisable", UIO_AMIC_WdtDisable, (void**)&g_origUIO_AMIC_WdtDisable); + MH_CreateHookApi(L"UIO_AMIC.dll", "UIO_AMIC_WdtEnable", UIO_AMIC_WdtEnable, (void**)&g_origUIO_AMIC_WdtEnable); + MH_CreateHookApi(L"UIO_AMIC.dll", "UIO_AMIC_WdtGetDIP", UIO_AMIC_WdtGetDIP, (void**)&g_origUIO_AMIC_WdtGetDIP); + MH_EnableHook(MH_ALL_HOOKS); + + DWORD_PTR nesysbase = (DWORD_PTR)LoadLibraryA("..\\..\\Plugins\\NESYSUtil\\\NESiCAUtilLib.dll"); + MH_Initialize(); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCAUtilLibIsOnlineMode", NESiCAUtilLibIsOnlineMode, (void**)&g_origNESiCAUtilLibIsOnlineMode); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCAUtilLibGetStatus", NESiCAUtilLibGetStatus, (void**)&g_origNESiCAUtilLibGetStatus); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCAUtilLibDelete", NESiCAUtilLibDelete, (void**)&g_origNESiCAUtilLibDelete); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCAUtilLibGetCenterInformation", NESiCAUtilLibGetCenterInformation, (void**)&g_origNESiCAUtilLibGetCenterInformation); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCAUtilLibGetInformation", NESiCAUtilLibGetInformation, (void**)&g_origNESiCAUtilLibGetInformation); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCAUtilLibGetPlayerAskInformation", NESiCAUtilLibGetPlayerAskInformation, (void**)&g_origNESiCAUtilLibGetPlayerAskInformation); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCAUtilLibGetPlayerInformation", NESiCAUtilLibGetPlayerInformation, (void**)&g_origNESiCAUtilLibGetPlayerInformation); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCAUtilLibGetPlayerTime", NESiCAUtilLibGetPlayerTime, (void**)&g_origNESiCAUtilLibGetPlayerTime); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCAUtilLibGetStatusStringUTF16", NESiCAUtilLibGetStatusStringUTF16, (void**)&g_origNESiCAUtilLibGetStatusStringUTF16); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCAUtilLibInit", NESiCAUtilLibInit, (void**)&g_origNESiCAUtilLibInit); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCAUtilLibIsExistInstance", NESiCAUtilLibIsExistInstance, (void**)&g_origNESiCAUtilLibIsExistInstance); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCAUtilLibUpdate", NESiCAUtilLibUpdate, (void**)&g_origNESiCAUtilLibUpdate); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCAUtilLib_NESiCA_BData_Get", NESiCAUtilLib_NESiCA_BData_Get, (void**)&g_origNESiCAUtilLib_NESiCA_BData_Get); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCAUtilLib_NESiCA_BData_Set", NESiCAUtilLib_NESiCA_BData_Set, (void**)&g_origNESiCAUtilLib_NESiCA_BData_Set); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCAUtilLib_NESiCA_BData_SetDefault", NESiCAUtilLib_NESiCA_BData_SetDefault, (void**)&g_origNESiCAUtilLib_NESiCA_BData_SetDefault); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCAUtilLib_NESiCA_TData_GetBuf", NESiCAUtilLib_NESiCA_TData_GetBuf, (void**)&g_origNESiCAUtilLib_NESiCA_TData_GetBuf); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCAUtilLib_NESiCA_TData_GetSize", NESiCAUtilLib_NESiCA_TData_GetSize, (void**)&g_origNESiCAUtilLib_NESiCA_TData_GetSize); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "BeginPlay", BeginPlay, (void**)&g_origBeginPlay); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "ContinuePlay", ContinuePlay, (void**)&g_origContinuePlay); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "EndPlay", EndPlay, (void**)&g_origEndPlay); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "GetGlobalIP", GetGlobalIP, (void**)&g_origGetGlobalIP); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "GetKeyConfig", GetKeyConfig, (void**)&g_origGetKeyConfig); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "GetLanInterface", GetLanInterface, (void**)&g_origGetLanInterface); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "GetLibraryVersion", GetLibraryVersion, (void**)&g_origGetLibraryVersion); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "GetNWInfo", GetNWInfo, (void**)&g_origGetNWInfo); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "GetNewsImagePath", GetNewsImagePath, (void**)&g_origGetNewsImagePath); + MH_CreateHookApi(L"NESiCAUtilLib.dll", "GetRanking", GetRanking, (void**)&g_origGetRanking); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "GetResponseTime", GetResponseTime, (void**)&g_origGetResponseTime); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "GetServerInfo", GetServerInfo, (void**)&g_origGetServerInfo); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "GetServiceVersion", GetServiceVersion, (void**)&g_origGetServiceVersion); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "GetTenpoInfo", GetTenpoInfo, (void**)&g_origGetTenpoInfo); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "IsBeginningProcessFinished", IsBeginningProcessFinished, (void**)&g_origIsBeginningProcessFinished); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "IsDisactive", IsDisactive, (void**)&g_origIsDisactive); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "IsEndingProcessFinished", IsEndingProcessFinished, (void**)&g_origIsEndingProcessFinished); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "IsEventMode", IsEventMode, (void**)&g_origIsEventMode); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "IsReadyDownloadRanking", IsReadyDownloadRanking, (void**)&g_origIsReadyDownloadRanking); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "IsTestMode", IsTestMode, (void**)&g_origIsTestMode); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "IsUploaded", IsUploaded, (void**)&g_origIsUploaded); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "LockProcess", LockProcess, (void**)&g_origLockProcess); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailCharacterBattlePointMonth", NESiCA_Card_GetDetailCharacterBattlePointMonth, (void**)&g_origNESiCA_Card_GetDetailCharacterBattlePointMonth); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailCharacterBattlePointTotal", NESiCA_Card_GetDetailCharacterBattlePointTotal, (void**)&g_origNESiCA_Card_GetDetailCharacterBattlePointTotal); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailCharacterDrawCountMonth", NESiCA_Card_GetDetailCharacterDrawCountMonth, (void**)&g_origNESiCA_Card_GetDetailCharacterDrawCountMonth); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailCharacterDrawCountTotal", NESiCA_Card_GetDetailCharacterDrawCountTotal, (void**)&g_origNESiCA_Card_GetDetailCharacterDrawCountTotal); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailCharacterLastColorID", NESiCA_Card_GetDetailCharacterLastColorID, (void**)&g_origNESiCA_Card_GetDetailCharacterLastColorID); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailCharacterLastComment", NESiCA_Card_GetDetailCharacterLastComment, (void**)&g_origNESiCA_Card_GetDetailCharacterLastComment); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailCharacterLastCostumeID", NESiCA_Card_GetDetailCharacterLastCostumeID, (void**)&g_origNESiCA_Card_GetDetailCharacterLastCostumeID); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailCharacterLastVTrigger", NESiCA_Card_GetDetailCharacterLastVTrigger, (void**)&g_origNESiCA_Card_GetDetailCharacterLastVTrigger); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailCharacterLoseCountMonth", NESiCA_Card_GetDetailCharacterLoseCountMonth, (void**)&g_origNESiCA_Card_GetDetailCharacterLoseCountMonth); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailCharacterLoseCountTotal", NESiCA_Card_GetDetailCharacterLoseCountTotal, (void**)&g_origNESiCA_Card_GetDetailCharacterLoseCountTotal); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailCharacterUseCountMonth", NESiCA_Card_GetDetailCharacterUseCountMonth, (void**)&g_origNESiCA_Card_GetDetailCharacterUseCountMonth); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailCharacterUseCountTotal", NESiCA_Card_GetDetailCharacterUseCountTotal, (void**)&g_origNESiCA_Card_GetDetailCharacterUseCountTotal); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailCharacterWinCountMonth", NESiCA_Card_GetDetailCharacterWinCountMonth, (void**)&g_origNESiCA_Card_GetDetailCharacterWinCountMonth); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailCharacterWinCountTotal", NESiCA_Card_GetDetailCharacterWinCountTotal, (void**)&g_origNESiCA_Card_GetDetailCharacterWinCountTotal); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailControlType", NESiCA_Card_GetDetailControlType, (void**)&g_origNESiCA_Card_GetDetailControlType); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailCurrentWins", NESiCA_Card_GetDetailCurrentWins, (void**)&g_origNESiCA_Card_GetDetailCurrentWins); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailHighScore", NESiCA_Card_GetDetailHighScore, (void**)&g_origNESiCA_Card_GetDetailHighScore); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailHighScoreCharacterID", NESiCA_Card_GetDetailHighScoreCharacterID, (void**)&g_origNESiCA_Card_GetDetailHighScoreCharacterID); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailKeyConfigHK", NESiCA_Card_GetDetailKeyConfigHK, (void**)&g_origNESiCA_Card_GetDetailKeyConfigHK); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailKeyConfigHP", NESiCA_Card_GetDetailKeyConfigHP, (void**)&g_origNESiCA_Card_GetDetailKeyConfigHP); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailKeyConfigHPHK", NESiCA_Card_GetDetailKeyConfigHPHK, (void**)&g_origNESiCA_Card_GetDetailKeyConfigHPHK); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailKeyConfigK3", NESiCA_Card_GetDetailKeyConfigK3, (void**)&g_origNESiCA_Card_GetDetailKeyConfigK3); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailKeyConfigLK", NESiCA_Card_GetDetailKeyConfigLK, (void**)&g_origNESiCA_Card_GetDetailKeyConfigLK); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailKeyConfigLKMK", NESiCA_Card_GetDetailKeyConfigLKMK, (void**)&g_origNESiCA_Card_GetDetailKeyConfigLKMK); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailKeyConfigLP", NESiCA_Card_GetDetailKeyConfigLP, (void**)&g_origNESiCA_Card_GetDetailKeyConfigLP); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailKeyConfigLPLK", NESiCA_Card_GetDetailKeyConfigLPLK, (void**)&g_origNESiCA_Card_GetDetailKeyConfigLPLK); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailKeyConfigLPMK", NESiCA_Card_GetDetailKeyConfigLPMK, (void**)&g_origNESiCA_Card_GetDetailKeyConfigLPMK); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailKeyConfigLPMP", NESiCA_Card_GetDetailKeyConfigLPMP, (void**)&g_origNESiCA_Card_GetDetailKeyConfigLPMP); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailKeyConfigMK", NESiCA_Card_GetDetailKeyConfigMK, (void**)&g_origNESiCA_Card_GetDetailKeyConfigMK); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailKeyConfigMP", NESiCA_Card_GetDetailKeyConfigMP, (void**)&g_origNESiCA_Card_GetDetailKeyConfigMP); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailKeyConfigMPLK", NESiCA_Card_GetDetailKeyConfigMPLK, (void**)&g_origNESiCA_Card_GetDetailKeyConfigMPLK); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailKeyConfigMPMK", NESiCA_Card_GetDetailKeyConfigMPMK, (void**)&g_origNESiCA_Card_GetDetailKeyConfigMPMK); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailKeyConfigP3", NESiCA_Card_GetDetailKeyConfigP3, (void**)&g_origNESiCA_Card_GetDetailKeyConfigP3); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailLastCharacterID", NESiCA_Card_GetDetailLastCharacterID, (void**)&g_origNESiCA_Card_GetDetailLastCharacterID); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailLeaguePoint", NESiCA_Card_GetDetailLeaguePoint, (void**)&g_origNESiCA_Card_GetDetailLeaguePoint); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailMaxWins", NESiCA_Card_GetDetailMaxWins, (void**)&g_origNESiCA_Card_GetDetailMaxWins); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailPlayerPointMonth", NESiCA_Card_GetDetailPlayerPointMonth, (void**)&g_origNESiCA_Card_GetDetailPlayerPointMonth); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetDetailPlayerPointTotal", NESiCA_Card_GetDetailPlayerPointTotal, (void**)&g_origNESiCA_Card_GetDetailPlayerPointTotal); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetPlayerComment", NESiCA_Card_GetPlayerComment, (void**)&g_origNESiCA_Card_GetPlayerComment); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetPlayerCommentUTF16", NESiCA_Card_GetPlayerCommentUTF16, (void**)&g_origNESiCA_Card_GetPlayerCommentUTF16); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetPlayerMyStoreID", NESiCA_Card_GetPlayerMyStoreID, (void**)&g_origNESiCA_Card_GetPlayerMyStoreID); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetPlayerName", NESiCA_Card_GetPlayerName, (void**)&g_origNESiCA_Card_GetPlayerName); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetPlayerNameUTF16", NESiCA_Card_GetPlayerNameUTF16, (void**)&g_origNESiCA_Card_GetPlayerNameUTF16); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_GetPlayerTitleID", NESiCA_Card_GetPlayerTitleID, (void**)&g_origNESiCA_Card_GetPlayerTitleID); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailCharacterBattlePointMonth", NESiCA_Card_SetDetailCharacterBattlePointMonth, (void**)&g_origNESiCA_Card_SetDetailCharacterBattlePointMonth); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailCharacterBattlePointTotal", NESiCA_Card_SetDetailCharacterBattlePointTotal, (void**)&g_origNESiCA_Card_SetDetailCharacterBattlePointTotal); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailCharacterDrawCountMonth", NESiCA_Card_SetDetailCharacterDrawCountMonth, (void**)&g_origNESiCA_Card_SetDetailCharacterDrawCountMonth); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailCharacterDrawCountTotal", NESiCA_Card_SetDetailCharacterDrawCountTotal, (void**)&g_origNESiCA_Card_SetDetailCharacterDrawCountTotal); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailCharacterLastColorID", NESiCA_Card_SetDetailCharacterLastColorID, (void**)&g_origNESiCA_Card_SetDetailCharacterLastColorID); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailCharacterLastComment", NESiCA_Card_SetDetailCharacterLastComment, (void**)&g_origNESiCA_Card_SetDetailCharacterLastComment); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailCharacterLastCostumeID", NESiCA_Card_SetDetailCharacterLastCostumeID, (void**)&g_origNESiCA_Card_SetDetailCharacterLastCostumeID); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailCharacterLastVTrigger", NESiCA_Card_SetDetailCharacterLastVTrigger, (void**)&g_origNESiCA_Card_SetDetailCharacterLastVTrigger); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailCharacterLoseCountMonth", NESiCA_Card_SetDetailCharacterLoseCountMonth, (void**)&g_origNESiCA_Card_SetDetailCharacterLoseCountMonth); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailCharacterLoseCountTotal", NESiCA_Card_SetDetailCharacterLoseCountTotal, (void**)&g_origNESiCA_Card_SetDetailCharacterLoseCountTotal); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailCharacterUseCountMonth", NESiCA_Card_SetDetailCharacterUseCountMonth, (void**)&g_origNESiCA_Card_SetDetailCharacterUseCountMonth); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailCharacterUseCountTotal", NESiCA_Card_SetDetailCharacterUseCountTotal, (void**)&g_origNESiCA_Card_SetDetailCharacterUseCountTotal); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailCharacterWinCountMonth", NESiCA_Card_SetDetailCharacterWinCountMonth, (void**)&g_origNESiCA_Card_SetDetailCharacterWinCountMonth); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailCharacterWinCountTotal", NESiCA_Card_SetDetailCharacterWinCountTotal, (void**)&g_origNESiCA_Card_SetDetailCharacterWinCountTotal); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailControlType", NESiCA_Card_SetDetailControlType, (void**)&g_origNESiCA_Card_SetDetailControlType); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailCurrentWins", NESiCA_Card_SetDetailCurrentWins, (void**)&g_origNESiCA_Card_SetDetailCurrentWins); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailHighScore", NESiCA_Card_SetDetailHighScore, (void**)&g_origNESiCA_Card_SetDetailHighScore); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailHighScoreCharacterID", NESiCA_Card_SetDetailHighScoreCharacterID, (void**)&g_origNESiCA_Card_SetDetailHighScoreCharacterID); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailKeyConfigHK", NESiCA_Card_SetDetailKeyConfigHK, (void**)&g_origNESiCA_Card_SetDetailKeyConfigHK); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailKeyConfigHP", NESiCA_Card_SetDetailKeyConfigHP, (void**)&g_origNESiCA_Card_SetDetailKeyConfigHP); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailKeyConfigHPHK", NESiCA_Card_SetDetailKeyConfigHPHK, (void**)&g_origNESiCA_Card_SetDetailKeyConfigHPHK); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailKeyConfigK3", NESiCA_Card_SetDetailKeyConfigK3, (void**)&g_origNESiCA_Card_SetDetailKeyConfigK3); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailKeyConfigLK", NESiCA_Card_SetDetailKeyConfigLK, (void**)&g_origNESiCA_Card_SetDetailKeyConfigLK); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailKeyConfigLKMK", NESiCA_Card_SetDetailKeyConfigLKMK, (void**)&g_origNESiCA_Card_SetDetailKeyConfigLKMK); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailKeyConfigLP", NESiCA_Card_SetDetailKeyConfigLP, (void**)&g_origNESiCA_Card_SetDetailKeyConfigLP); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailKeyConfigLPLK", NESiCA_Card_SetDetailKeyConfigLPLK, (void**)&g_origNESiCA_Card_SetDetailKeyConfigLPLK); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailKeyConfigLPMK", NESiCA_Card_SetDetailKeyConfigLPMK, (void**)&g_origNESiCA_Card_SetDetailKeyConfigLPMK); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailKeyConfigLPMP", NESiCA_Card_SetDetailKeyConfigLPMP, (void**)&g_origNESiCA_Card_SetDetailKeyConfigLPMP); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailKeyConfigMK", NESiCA_Card_SetDetailKeyConfigMK, (void**)&g_origNESiCA_Card_SetDetailKeyConfigMK); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailKeyConfigMP", NESiCA_Card_SetDetailKeyConfigMP, (void**)&g_origNESiCA_Card_SetDetailKeyConfigMP); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailKeyConfigMPLK", NESiCA_Card_SetDetailKeyConfigMPLK, (void**)&g_origNESiCA_Card_SetDetailKeyConfigMPLK); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailKeyConfigMPMK", NESiCA_Card_SetDetailKeyConfigMPMK, (void**)&g_origNESiCA_Card_SetDetailKeyConfigMPMK); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailKeyConfigP3", NESiCA_Card_SetDetailKeyConfigP3, (void**)&g_origNESiCA_Card_SetDetailKeyConfigP3); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailLastCharacterID", NESiCA_Card_SetDetailLastCharacterID, (void**)&g_origNESiCA_Card_SetDetailLastCharacterID); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailLeaguePoint", NESiCA_Card_SetDetailLeaguePoint, (void**)&g_origNESiCA_Card_SetDetailLeaguePoint); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailMaxWins", NESiCA_Card_SetDetailMaxWins, (void**)&g_origNESiCA_Card_SetDetailMaxWins); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailPlayerPointMonth", NESiCA_Card_SetDetailPlayerPointMonth, (void**)&g_origNESiCA_Card_SetDetailPlayerPointMonth); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetDetailPlayerPointTotal", NESiCA_Card_SetDetailPlayerPointTotal, (void**)&g_origNESiCA_Card_SetDetailPlayerPointTotal); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetPlayerComment", NESiCA_Card_SetPlayerComment, (void**)&g_origNESiCA_Card_SetPlayerComment); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetPlayerCommentUTF16", NESiCA_Card_SetPlayerCommentUTF16, (void**)&g_origNESiCA_Card_SetPlayerCommentUTF16); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetPlayerMyStoreID", NESiCA_Card_SetPlayerMyStoreID, (void**)&g_origNESiCA_Card_SetPlayerMyStoreID); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetPlayerName", NESiCA_Card_SetPlayerName, (void**)&g_origNESiCA_Card_SetPlayerName); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetPlayerNameUTF16", NESiCA_Card_SetPlayerNameUTF16, (void**)&g_origNESiCA_Card_SetPlayerNameUTF16); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Card_SetPlayerTitleID", NESiCA_Card_SetPlayerTitleID, (void**)&g_origNESiCA_Card_SetPlayerTitleID); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_GetNESiCAID", NESiCA_GetNESiCAID, (void**)&g_origNESiCA_GetNESiCAID); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_GetNESiCAType", NESiCA_GetNESiCAType, (void**)&g_origNESiCA_GetNESiCAType); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_IsCardPlayer", NESiCA_IsCardPlayer, (void**)&g_origNESiCA_IsCardPlayer); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Rank_GetBattlePointRank", NESiCA_Rank_GetBattlePointRank, (void**)&g_origNESiCA_Rank_GetBattlePointRank); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Rank_GetBattlePointRankPref", NESiCA_Rank_GetBattlePointRankPref, (void**)&g_origNESiCA_Rank_GetBattlePointRankPref); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Rank_GetBattlePointRankPrefId", NESiCA_Rank_GetBattlePointRankPrefId, (void**)&g_origNESiCA_Rank_GetBattlePointRankPrefId); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Rank_GetBattlePointRankPrefName", NESiCA_Rank_GetBattlePointRankPrefName, (void**)&g_origNESiCA_Rank_GetBattlePointRankPrefName); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "NESiCA_Rank_GetBattlePointRankPrefNameUTF16", NESiCA_Rank_GetBattlePointRankPrefNameUTF16, (void**)&g_origNESiCA_Rank_GetBattlePointRankPrefNameUTF16); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "Reconnect", Reconnect, (void**)&g_origReconnect); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "SaveOnTheWay", SaveOnTheWay, (void**)&g_origSaveOnTheWay); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "SetCharacterID", SetCharacterID, (void**)&g_origSetCharacterID); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "SetEventMode", SetEventMode, (void**)&g_origSetEventMode); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "SetEventModeResult", SetEventModeResult, (void**)&g_origSetEventModeResult); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "SetOpenCloseTime", SetOpenCloseTime, (void**)&g_origSetOpenCloseTime); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "StartTestMode", StartTestMode, (void**)&g_origStartTestMode); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXGetTelop", TypeXGetTelop, (void**)&g_origTypeXGetTelop); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_ChangeWinLimit", TypeXMatching_ChangeWinLimit, (void**)&g_origTypeXMatching_ChangeWinLimit); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_CreateInstance", TypeXMatching_CreateInstance, (void**)&g_origTypeXMatching_CreateInstance); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_DeleteInstance", TypeXMatching_DeleteInstance, (void**)&g_origTypeXMatching_DeleteInstance); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_GetEnemyAddr", TypeXMatching_GetEnemyAddr, (void**)&g_origTypeXMatching_GetEnemyAddr); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_GetEnemyEntryId", TypeXMatching_GetEnemyEntryId, (void**)&g_origTypeXMatching_GetEnemyEntryId); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_GetEnemyOption", TypeXMatching_GetEnemyOption, (void**)&g_origTypeXMatching_GetEnemyOption); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_GetEnemyPlayerName", TypeXMatching_GetEnemyPlayerName, (void**)&g_origTypeXMatching_GetEnemyPlayerName); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_GetEnemyPlayerNameUTF16", TypeXMatching_GetEnemyPlayerNameUTF16, (void**)&g_origTypeXMatching_GetEnemyPlayerNameUTF16); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_GetEnemyTenpoName", TypeXMatching_GetEnemyTenpoName, (void**)&g_origTypeXMatching_GetEnemyTenpoName); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_GetEnemyTenpoNameUTF16", TypeXMatching_GetEnemyTenpoNameUTF16, (void**)&g_origTypeXMatching_GetEnemyTenpoNameUTF16); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_GetFighterInfoInStore", TypeXMatching_GetFighterInfoInStore, (void**)&g_origTypeXMatching_GetFighterInfoInStore); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_GetMyAddr", TypeXMatching_GetMyAddr, (void**)&g_origTypeXMatching_GetMyAddr); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_GetMyEntryId", TypeXMatching_GetMyEntryId, (void**)&g_origTypeXMatching_GetMyEntryId); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_GetRTT", TypeXMatching_GetRTT, (void**)&g_origTypeXMatching_GetRTT); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_GetStatus", TypeXMatching_GetStatus, (void**)&g_origTypeXMatching_GetStatus); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_GetWinLimit", TypeXMatching_GetWinLimit, (void**)&g_origTypeXMatching_GetWinLimit); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_GetWins", TypeXMatching_GetWins, (void**)&g_origTypeXMatching_GetWins); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_GetWinsAll", TypeXMatching_GetWinsAll, (void**)&g_origTypeXMatching_GetWinsAll); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_IsMatchingDesignatedFailed", TypeXMatching_IsMatchingDesignatedFailed, (void**)&g_origTypeXMatching_IsMatchingDesignatedFailed); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_Register_NESiCAUtilLibCancelRequestRFID", TypeXMatching_Register_NESiCAUtilLibCancelRequestRFID, (void**)&g_origTypeXMatching_Register_NESiCAUtilLibCancelRequestRFID); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_Register_NESiCAUtilLibGetRFIDID", TypeXMatching_Register_NESiCAUtilLibGetRFIDID, (void**)&g_origTypeXMatching_Register_NESiCAUtilLibGetRFIDID); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_Register_NESiCAUtilLibIsRFIDRead", TypeXMatching_Register_NESiCAUtilLibIsRFIDRead, (void**)&g_origTypeXMatching_Register_NESiCAUtilLibIsRFIDRead); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_Register_NESiCAUtilLibIsRFIDReadSuccess", TypeXMatching_Register_NESiCAUtilLibIsRFIDReadSuccess, (void**)&g_origTypeXMatching_Register_NESiCAUtilLibIsRFIDReadSuccess); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_Register_NESiCAUtilLibRequestRFID", TypeXMatching_Register_NESiCAUtilLibRequestRFID, (void**)&g_origTypeXMatching_Register_NESiCAUtilLibRequestRFID); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_ResetWins", TypeXMatching_ResetWins, (void**)&g_origTypeXMatching_ResetWins); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_Resume", TypeXMatching_Resume, (void**)&g_origTypeXMatching_Resume); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_StartMatchingDesignated", TypeXMatching_StartMatchingDesignated, (void**)&g_origTypeXMatching_StartMatchingDesignated); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_StartMathingInternetOnly", TypeXMatching_StartMathingInternetOnly, (void**)&g_origTypeXMatching_StartMathingInternetOnly); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_StartMathingStoreOnly", TypeXMatching_StartMathingStoreOnly, (void**)&g_origTypeXMatching_StartMathingStoreOnly); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_StartMathingStorePriority", TypeXMatching_StartMathingStorePriority, (void**)&g_origTypeXMatching_StartMathingStorePriority); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_StopMatching", TypeXMatching_StopMatching, (void**)&g_origTypeXMatching_StopMatching); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_Suspend", TypeXMatching_Suspend, (void**)&g_origTypeXMatching_Suspend); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_Update", TypeXMatching_Update, (void**)&g_origTypeXMatching_Update); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXMatching_UpdateWins", TypeXMatching_UpdateWins, (void**)&g_origTypeXMatching_UpdateWins); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXPlayRecordAddToSend", TypeXPlayRecordAddToSend, (void**)&g_origTypeXPlayRecordAddToSend); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXPlayRecordReset", TypeXPlayRecordReset, (void**)&g_origTypeXPlayRecordReset); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXPlayRecordResetRevenge", TypeXPlayRecordResetRevenge, (void**)&g_origTypeXPlayRecordResetRevenge); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXPlayRecordSetPlayerInfo", TypeXPlayRecordSetPlayerInfo, (void**)&g_origTypeXPlayRecordSetPlayerInfo); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXPlayRecordSetRoundResult", TypeXPlayRecordSetRoundResult, (void**)&g_origTypeXPlayRecordSetRoundResult); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXSafeFileIsFinished", TypeXSafeFileIsFinished, (void**)&g_origTypeXSafeFileIsFinished); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXSafeFileRead", TypeXSafeFileRead, (void**)&g_origTypeXSafeFileRead); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXSafeFileWrite", TypeXSafeFileWrite, (void**)&g_origTypeXSafeFileWrite); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "TypeXSafeFileWriteUpdate", TypeXSafeFileWriteUpdate, (void**)&g_origTypeXSafeFileWriteUpdate); + // MH_CreateHookApi(L"NESiCAUtilLib.dll", "UnlockProcess", UnlockProcess, (void**)&g_origUnlockProcess); + MH_EnableHook(MH_ALL_HOOKS); + + // remove all kanji onscreen nesys messages + if (ToBool(config["General"]["RemoveNesysMessages"])) + injector::WriteMemoryRaw((nesysbase + 0x1EBE2), "\xE9\xE4\x01\x00\x00", 5, true); + + // NESYS INIT + init_RegHooks(); + init_NesysEmu(false); + + // JAP FONT FIX + FixJapaneseFont(); + + // SET COMMAND LINE SWITCHES FOR FULLSCREEN/WINDOWED MODE + GetModuleFileNameW(NULL, FullPathWithExeName, MAX_PATH); + SetCommandLineSFV(); + + MH_Initialize(); + MH_CreateHookApi(L"kernel32.dll", "CreateFileW", &CreateFileWSFV, (void**)&original_CreateFileWSFV); + MH_CreateHookApi(L"kernel32.dll", "DeleteFileW", &DeleteFileWSFV, (void**)&original_DeleteFileWSFV); + MH_CreateHookApi(L"kernel32.dll", "FindFirstFileW", &FindFirstFileWSFV, (void**)&original_FindFirstFileWSFV); + MH_CreateHookApi(L"shell32.dll", "SHGetFolderPathW", &SHGetFolderPathWSFV, (void**)&original_SHGetFolderPathWSFV); + MH_CreateHookApi(L"kernel32.dll", "GetCommandLineW", &GetCommandLineWSFV, (void**)&original_GetCommandLineWSFV); + MH_CreateHookApi(L"xinput1_3.dll", "XInputGetState", &XInputGetStateSFV, NULL); + MH_EnableHook(MH_ALL_HOOKS); + }, GameID::SFV); +#endif \ No newline at end of file diff --git a/OpenParrot/src/Functions/Nesica_Libs/NesysEmu.cpp b/OpenParrot/src/Functions/Nesica_Libs/NesysEmu.cpp index 44a6023..6cf5f69 100644 --- a/OpenParrot/src/Functions/Nesica_Libs/NesysEmu.cpp +++ b/OpenParrot/src/Functions/Nesica_Libs/NesysEmu.cpp @@ -28,54 +28,61 @@ NesysEmu::NesysEmu() m_commandHandlers[LCOMMAND_CONNECT_REQUEST] = [=](const uint8_t* data, size_t length) { - SendResponse(SCOMMAND_CONNECT_REPLY, nullptr); - - - Sleep(100); - - // h - struct __declspec(align(4)) NESYS_TENPO_TABLE + if (GameDetect::currentGame != GameID::SFV) { - int tenpo_id; - char tenpo_name[31]; - char tenpo_addr[33]; - char ticket[33]; - char pref_name[17]; - }; + SendResponse(SCOMMAND_CONNECT_REPLY, nullptr); - 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; - 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); + SendResponse(SCOMMAND_CERT_ERROR, nullptr); + } }; m_commandHandlers[LCOMMAND_DISCONNECT_REQUEST] = [=](const uint8_t* data, size_t length) diff --git a/OpenParrot/src/Functions/Nesica_Libs/RegHooks.cpp b/OpenParrot/src/Functions/Nesica_Libs/RegHooks.cpp index f0823b6..4ce7898 100644 --- a/OpenParrot/src/Functions/Nesica_Libs/RegHooks.cpp +++ b/OpenParrot/src/Functions/Nesica_Libs/RegHooks.cpp @@ -8,8 +8,16 @@ DWORD IOErrorCoin = 0; DWORD IOErrorCredit = 0; DWORD EventModeEnable = 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) return 1; @@ -104,9 +112,9 @@ LSTATUS __stdcall RegCreateKeyExWWrap( 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; return ERROR_SUCCESS; @@ -128,15 +136,15 @@ void PromptError(DWORD errorCode, int errorType) memset(tempBuf, 0, 256); switch (errorType) { - case 0: - sprintf(tempBuf, "Game sent NESiCA GameResult error code to %08X to launcher!", errorCode); - break; - case 1: - sprintf(tempBuf, "Game sent NESiCA IOErrorCoin error code to %08X to launcher!", errorCode); - break; - case 2: - sprintf(tempBuf, "Game sent NESiCA IOErrorCredit error code to %08X to launcher!", errorCode); - break; + case 0: + sprintf(tempBuf, "Game sent NESiCA GameResult error code to %08X to launcher!", errorCode); + break; + case 1: + sprintf(tempBuf, "Game sent NESiCA IOErrorCoin error code to %08X to launcher!", errorCode); + break; + case 2: + sprintf(tempBuf, "Game sent NESiCA IOErrorCredit error code to %08X to launcher!", errorCode); + break; } MessageBoxA(0, tempBuf, "NESiCA ERROR!", 0); } @@ -146,7 +154,7 @@ LSTATUS __stdcall RegSetValueExAWrap( LPCSTR lpValueName, DWORD Reserved, DWORD dwType, - CONST BYTE *lpData, + CONST BYTE* lpData, DWORD cbData ) { @@ -155,7 +163,7 @@ LSTATUS __stdcall RegSetValueExAWrap( { if (stricmp(lpValueName, "GameResult") == 0) { - GameResult = *(DWORD *)lpData; + GameResult = *(DWORD*)lpData; if (GameResult != 0) { PromptError(GameResult, 0); @@ -163,7 +171,7 @@ LSTATUS __stdcall RegSetValueExAWrap( } else if (stricmp(lpValueName, "IOErrorCoin") == 0) { - IOErrorCoin = *(DWORD *)lpData;; + IOErrorCoin = *(DWORD*)lpData;; if (IOErrorCoin != 0) { PromptError(IOErrorCoin, 1); @@ -171,7 +179,7 @@ LSTATUS __stdcall RegSetValueExAWrap( } else if (stricmp(lpValueName, "IOErrorCredit") == 0) { - IOErrorCredit = *(DWORD *)lpData;; + IOErrorCredit = *(DWORD*)lpData;; if (IOErrorCredit != 0) { PromptError(IOErrorCredit, 2); @@ -203,33 +211,33 @@ LSTATUS __stdcall RegSetValueExWWrap( LPCWSTR lpValueName, DWORD Reserved, DWORD dwType, - CONST BYTE *lpData, + CONST BYTE* lpData, DWORD cbData ) { // 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) { - GameResult = *(DWORD *)lpData; - if(GameResult != 0) + GameResult = *(DWORD*)lpData; + if (GameResult != 0) { PromptError(GameResult, 0); } } - else if(wcsicmp(lpValueName, L"IOErrorCoin") == 0) + else if (wcsicmp(lpValueName, L"IOErrorCoin") == 0) { - IOErrorCoin = *(DWORD *)lpData;; - if(IOErrorCoin != 0) + IOErrorCoin = *(DWORD*)lpData;; + if (IOErrorCoin != 0) { PromptError(IOErrorCoin, 1); } } else if (wcsicmp(lpValueName, L"IOErrorCredit") == 0) { - IOErrorCredit = *(DWORD *)lpData;; - if(IOErrorCredit != 0) + IOErrorCredit = *(DWORD*)lpData;; + if (IOErrorCredit != 0) { PromptError(IOErrorCredit, 2); } @@ -246,7 +254,7 @@ LSTATUS __stdcall RegSetValueExWWrap( return ERROR_SUCCESS; } - if(hKey == (HKEY)0x8102) + if (hKey == (HKEY)0x8102) { MessageBoxA(0, "RegSetValueExW for TYPEX, Please contact devs!", "Error unhandled registry change", 0); return ERROR_FILE_NOT_FOUND; @@ -320,7 +328,7 @@ LSTATUS __stdcall RegQueryValueExAWrap( } else if (stricmp(lpValueName, "Country") == 0) // REG_DWORD { - *(DWORD *)lpData = FillDwordInformation("TYPEX", "Country", 1); // UNK + *(DWORD*)lpData = FillDwordInformation("TYPEX", "Country", 1); // UNK *lpcbData = 1; } else @@ -381,9 +389,65 @@ LSTATUS __stdcall RegQueryValueExAWrap( } else if (stricmp(lpValueName, "SystemType") == 0) // REG_DWORD { - *lpData = FillDwordInformation("NESiCA", "SystemType", SystemType);; // UNK + *lpData = FillDwordInformation("NESiCA", "SystemType", SystemType); // UNK *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 { 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 { - *(DWORD *)lpData = FillDwordInformation("TYPEX", "Country", 0); // UNK + *(DWORD*)lpData = FillDwordInformation("TYPEX", "Country", 0); // UNK *lpcbData = 4; } else @@ -472,14 +536,14 @@ LSTATUS __stdcall RegQueryValueExWWrap( } // SOFTWARE\\TAITO\\NESiCAxLive - if(hKey == (HKEY)0x8101) + if (hKey == (HKEY)0x8101) { if (lpData == nullptr) { *lpcbData = 4; 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 *lpcbData = 4; @@ -524,6 +588,62 @@ LSTATUS __stdcall RegQueryValueExWWrap( *lpData = FillDwordInformation("NESiCA", "SystemType", SystemType);; // UNK *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 { MessageBoxA(0, "UNKNOWN REG QUERY FROM SOFTWARE\\TAITO\\NESiCAxLive, contact devs!", "Error", 0); @@ -547,7 +667,7 @@ LSTATUS __stdcall RegCloseKeyWrap( } void init_RegHooks() -{ +{ // ASCII iatHook("advapi32.dll", RegCreateKeyExAWrap, "RegCreateKeyExA"); iatHook("advapi32.dll", RegOpenKeyExAWrap, "RegOpenKeyExA"); diff --git a/OpenParrot/src/Functions/Ring_amLib/amJvs.cpp b/OpenParrot/src/Functions/Ring_amLib/amJvs.cpp index ef983de..5f036bd 100644 --- a/OpenParrot/src/Functions/Ring_amLib/amJvs.cpp +++ b/OpenParrot/src/Functions/Ring_amLib/amJvs.cpp @@ -340,6 +340,8 @@ static InitFunction jvsInit([]() { return; } + if (GameDetect::currentGame == GameID::SFV) + return; if (GameDetect::IsTypeX()) hookPort = "COM2"; diff --git a/OpenParrot/src/Functions/WindowedDxgi.cpp b/OpenParrot/src/Functions/WindowedDxgi.cpp index 883fc63..86ff3db 100644 --- a/OpenParrot/src/Functions/WindowedDxgi.cpp +++ b/OpenParrot/src/Functions/WindowedDxgi.cpp @@ -241,8 +241,9 @@ extern linb::ini config; 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; + if (ToBool(config["General"]["Windowed"])) { InitDXGIWindowHook(); diff --git a/OpenParrot/src/Functions/XInputEmu.cpp b/OpenParrot/src/Functions/XInputEmu.cpp index 16f8ee7..c8f9963 100644 --- a/OpenParrot/src/Functions/XInputEmu.cpp +++ b/OpenParrot/src/Functions/XInputEmu.cpp @@ -81,9 +81,9 @@ DWORD WINAPI XInputGetState } 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) { @@ -362,7 +362,7 @@ DWORD WINAPI XInputGetStateEx { 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; else gamepadState.wButtons = 0; @@ -419,7 +419,7 @@ LPCWSTR ptrToUse; 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; diff --git a/OpenParrot/src/Utility/GameDetect.cpp b/OpenParrot/src/Utility/GameDetect.cpp index 948127e..e3516f0 100644 --- a/OpenParrot/src/Utility/GameDetect.cpp +++ b/OpenParrot/src/Utility/GameDetect.cpp @@ -444,21 +444,16 @@ void GameDetect::DetectCurrentGame() // currentGame = GameID::SchoolOfRagnarok; // isNesica = true; //} - if (*(uint32_t*)(moduleBase + 0x1C04) == 0x7401C3F6) - { - currentGame = GameID::PokkenTournament; - break; - } // PATCHES 0-9 if (*(uint32_t*)(moduleBase + 0x2F00) == 0xFFCB8B48) { - currentGame = GameID::WMMT5; + SetGameId(GameID::WMMT5, "WMMT5"); break; } // PATCHES 10-21 if (*(uint32_t*)(moduleBase + 0x2F00) == 0x084AFF48) { - currentGame = GameID::WMMT5; + SetGameId(GameID::WMMT5, "WMMT5"); break; } #endif @@ -474,8 +469,24 @@ void GameDetect::DetectCurrentGame() #endif * (DWORD*)(newCrc + pePTR + 54) = 0x00000000; 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) { +#ifndef _AMD64_ case 0xfe7afff4: currentGame = GameID::FNFSB2; break; @@ -595,34 +606,87 @@ void GameDetect::DetectCurrentGame() NesicaKey = NesicaKey::BlazBlueCentralFiction; isNesica = true; break; +#endif #ifdef _AMD64_ + case 0xf322d053: + SetGameId(GameID::SFV, "SFV"); + break; case 0x80ebd207: - currentGame = GameID::Theatrhythm; + SetGameId(GameID::Theatrhythm, "Theatrhythm"); break; case 0xdb9c3a90: - currentGame = GameID::TER; + SetGameId(GameID::TER, "TER"); break; case 0xf3d3f699: - currentGame = GameID::StarWarsEs3XLauncher; + SetGameId(GameID::StarWarsEs3XLauncher, "StarWarsEs3XLauncher"); break; case 0x5424a6d8: - currentGame = GameID::StarWarsJapEs3XLauncher; + SetGameId(GameID::StarWarsJapEs3XLauncher, "StarWarsJapEs3XLauncher"); break; case 0x8505c794: - currentGame = GameID::StarWarsEs3X; + SetGameId(GameID::StarWarsEs3X, "StarWarsEs3X"); break; case 0xe1e9e32c: // JPN - currentGame = GameID::StarWarsJapEs3X; + SetGameId(GameID::StarWarsJapEs3X, "StarWarsJapEs3X"); break; case 0x30F676AD: - currentGame = GameID::SchoolOfRagnarok; + SetGameId(GameID::SchoolOfRagnarok, "SchoolOfRagnarok"); isNesica = true; break; case 0x00ed2300: - currentGame = GameID::Tekken7Update12; + SetGameId(GameID::Tekken7Update12, "Tekken7Update12"); break; 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; #endif default: @@ -633,6 +697,7 @@ void GameDetect::DetectCurrentGame() #else memset(errorBuffer, 0, 256); sprintf_s(errorBuffer, 256, "Unsupported Executable, NEW CRC: %08X!", newCrcResult); + WritePrivateProfileStringA("Error", "Unsupported Executable", errorBuffer, ".\\teknoparrot.ini"); MessageBoxA(0, errorBuffer, "Error", MB_ICONERROR); ExitProcess(0); #endif @@ -641,6 +706,17 @@ void GameDetect::DetectCurrentGame() 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() { return isNesica; diff --git a/OpenParrot/src/Utility/GameDetect.h b/OpenParrot/src/Utility/GameDetect.h index 708e0ad..c216da4 100644 --- a/OpenParrot/src/Utility/GameDetect.h +++ b/OpenParrot/src/Utility/GameDetect.h @@ -11,6 +11,7 @@ public: static X2Type X2Type; static bool IsTypeX(); static bool IsNesicaGame(); + static void SetGameId(GameID gameId, char* name); static NesicaKey NesicaKey; static std::string GetGameName(); static std::string GameDetect::GetGameName(GameID game); diff --git a/OpenParrot/src/Utility/GameID.h b/OpenParrot/src/Utility/GameID.h index a471ea6..021f09c 100644 --- a/OpenParrot/src/Utility/GameID.h +++ b/OpenParrot/src/Utility/GameID.h @@ -40,6 +40,7 @@ enum class GameID VirtuaRLimit, SchoolOfRagnarok, PokkenTournament, + PokkenTournament26, ExBoardGeneric, GrooveCoaster2, PuzzleBobble, @@ -95,5 +96,20 @@ enum class GameID DarkAwake, ChaosBreakerNXL, LinuxEmulation, - RadikalBikers + RadikalBikers, + Pengoe5, + Pengoe5_Test, + VF5Esports, + GoonyaFighter, + PuyoPuyoEsports, + SFV, + TappingSkillTest, + Pengoe511, + VF5EsportsTest, + Doa6FM10, + Doa6FM11, + Doa6FM12, + Doa6FM13, + Doa6FM14, + Doa6Test }; \ No newline at end of file diff --git a/OpenParrot/src/dllmain.cpp b/OpenParrot/src/dllmain.cpp index 187d4b9..61f922a 100644 --- a/OpenParrot/src/dllmain.cpp +++ b/OpenParrot/src/dllmain.cpp @@ -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 (getenv("TP_DIRECTHOOK") != nullptr) + { + RunMain(); + return TRUE; + } #ifdef DEVMODE RunMain(); #else