From 05819bf68367f167a641888ec0bb90ca9f41a803 Mon Sep 17 00:00:00 2001 From: Nico Giansanti Date: Thu, 15 Jul 2021 19:21:23 +0300 Subject: [PATCH] APM3 Separate AUTH, Sequence and fix stuff APM3 Separate AUTH, Sequence and fix stuff --- OpenParrot/src/Functions/Games/APM3/APM3.cpp | 224 +----------------- OpenParrot/src/Functions/Games/APM3/APM3.h | 42 ---- OpenParrot/src/Functions/Games/APM3/Aime.cpp | 2 - OpenParrot/src/Functions/Games/APM3/Auth.cpp | 119 ++++++++++ OpenParrot/src/Functions/Games/APM3/Auth.h | 43 ++++ .../src/Functions/Games/APM3/Sequence.cpp | 85 +++++++ .../src/Functions/Games/APM3/Sequence.h | 72 ++++++ 7 files changed, 326 insertions(+), 261 deletions(-) create mode 100644 OpenParrot/src/Functions/Games/APM3/Auth.cpp create mode 100644 OpenParrot/src/Functions/Games/APM3/Auth.h create mode 100644 OpenParrot/src/Functions/Games/APM3/Sequence.cpp create mode 100644 OpenParrot/src/Functions/Games/APM3/Sequence.h diff --git a/OpenParrot/src/Functions/Games/APM3/APM3.cpp b/OpenParrot/src/Functions/Games/APM3/APM3.cpp index 0663000..99682d6 100644 --- a/OpenParrot/src/Functions/Games/APM3/APM3.cpp +++ b/OpenParrot/src/Functions/Games/APM3/APM3.cpp @@ -6,121 +6,11 @@ #include "APM3.h" #include "Aime.h" #include "Backup.h" +#include "Auth.h" +#include "Sequence.h" static uint8_t g_APM3IOValues[256]; -__int64 __fastcall AllnetAccounting_beginPlay(unsigned int a1) -{ -#ifdef _DEBUG - info(true, "AllnetAccounting_beginPlay"); -#endif - return AllnetAccounting_beginPlayReturnValue; -} - -__int64 __fastcall AllnetAccounting_endPlay(int a1, int a2, int a3) -{ -#ifdef _DEBUG - info(true, "AllnetAccounting_endPlay"); -#endif - return AllnetAccounting_endPlayReturnValue; -} - -char* AllnetAuth_getAbaasGsServerName() -{ -#ifdef _DEBUG - info(true, "AllnetAuth_getAbaasGsServerName"); -#endif - return ServerName; -} - -char* AllnetAuth_getAbaasLinkServerName() -{ -#ifdef _DEBUG - info(true, "AllnetAuth_getAbaasLinkServerName"); -#endif - return LinkServerName; -} - -__int64 AllnetAuth_getCountryCode() -{ -#ifdef _DEBUG - info(true, "AllnetAuth_getCountryCode"); -#endif - return AllnetAuth_getCountryCodeReturnValue; -} - -__int64 AllnetAuth_getLocationId() -{ -#ifdef _DEBUG - info(true, "AllnetAuth_getLocationId"); -#endif - return AllnetAuth_getLocationIdReturnValue; -} - -char* AllnetAuth_getLocationName() -{ -#ifdef _DEBUG - info(true, "AllnetAuth_getLocationName"); -#endif - return LocationName; -} - -char* __fastcall AllnetAuth_getLocationNickname(int a1) -{ -#ifdef _DEBUG - info(true, "AllnetAuth_getLocationNickname"); -#endif - return LocationNickName; -} - -__int64 AllnetAuth_getLocationNicknamePartCount() -{ -#ifdef _DEBUG - info(true, "AllnetAuth_getLocationNicknamePartCount"); -#endif - return AllnetAuth_getLocationNicknamePartCountReturnValue; -} - -__int64 AllnetAuth_getRegionCode() -{ -#ifdef _DEBUG - info(true, "AllnetAuth_getRegionCode"); -#endif - return AllnetAuth_getRegionCodeReturnValue; -} - -char* __fastcall AllnetAuth_getRegionName(int a1) -{ -#ifdef _DEBUG - info(true, "AllnetAuth_getRegionName"); -#endif - return RegionName; -} - -__int64 AllnetAuth_getRegionNamePartCount() -{ -#ifdef _DEBUG - info(true, "AllnetAuth_getRegionNamePartCount"); -#endif - return AllnetAuth_getRegionNamePartCountReturnValue; -} - -__int64 AllnetAuth_isDevelop() -{ -#ifdef _DEBUG - info(true, "AllnetAuth_isDevelop"); -#endif - return AllnetAuth_isDevelopReturnValue; -} - -__int64 AllnetAuth_isGood() -{ -#ifdef _DEBUG - info(true, "AllnetAuth_isGood"); -#endif - return AllnetAuth_isGoodReturnValue; -} - bool __fastcall ApmSystemSetting_getAdvertizeSound(bool *enable) { #ifdef _DEBUG @@ -489,106 +379,6 @@ __int64 NetworkProperty_getAddressValue() return NetworkProperty_getAddressValueReturnValue; } -//__int64 __fastcall Sequence_beginPlay(__int64 a1, struct Concurrency::details::_CancellationTokenState* a2, _DWORD* a3, __int64 a4) -__int64 __fastcall Sequence_beginPlay(__int64 a1, void* a2, DWORD* a3, __int64 a4) -{ -#ifdef _DEBUG - info(true, "Sequence_beginPlay"); -#endif - return Sequence_beginPlayReturnValue; -} - -__int64 Sequence_clearBackup() -{ -#ifdef _DEBUG - info(true, "Sequence_clearBackup"); -#endif - return Sequence_clearBackupReturnValue; -} - -__int64 __fastcall Sequence_continuePlay(__int64 a1, __int64 a2, DWORD* a3, __int64 a4) -{ -#ifdef _DEBUG - info(true, "Sequence_continuePlay"); -#endif - return Sequence_continuePlayReturnValue; -} - -//__int64 __fastcall Sequence_endPlay(__int64 a1, struct Concurrency::details::_CancellationTokenState* a2) -__int64 __fastcall Sequence_endPlay(__int64 a1, void* a2) -{ -#ifdef _DEBUG - info(true, "Sequence_endPlay"); -#endif - return Sequence_endPlayReturnValue; -} - -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]; -}; - -SequenceBookkeeping* Sequence_getBookkeeping() -{ -#ifdef _DEBUG - info(true, "Sequence_getBookkeeping"); -#endif - static SequenceBookkeeping *_sequenceBookkeeping; - if (_sequenceBookkeeping == nullptr) - { - _sequenceBookkeeping = (SequenceBookkeeping*)malloc(sizeof(SequenceBookkeeping)); - memset(_sequenceBookkeeping, 0, sizeof(SequenceBookkeeping)); - } - return _sequenceBookkeeping; -} - -__int64 Sequence_getPlayingAimeId() -{ -#ifdef _DEBUG - info(true, "Sequence_getPlayingAimeId"); -#endif - return Sequence_getPlayingAimeIdReturnValue; -} - -__int64 Sequence_isAccountingPlaying() -{ -#ifdef _DEBUG - info(true, "Sequence_isAccountingPlaying"); -#endif - return Sequence_isAccountingPlayingReturnValue; -} - -__int64 Sequence_isPlaying() -{ -#ifdef _DEBUG - info(true, "Sequence_isPlaying"); -#endif - return Sequence_isPlayingReturnValue; -} - -__int64 Sequence_isTest() -{ -#ifdef _DEBUG - info(true, "Sequence_isTest"); -#endif - return Sequence_isTestReturnValue; -} - __int64 System_getAppRootPath() { #ifdef _DEBUG @@ -791,11 +581,11 @@ int apmGamepadUpdate() static void HookAPM3() { - strcpy(ServerName, "TeknoParrot Server Hi!"); - strcpy(LinkServerName, "TeknoParrot Link Server Hi!"); - strcpy(LocationNickName, "Flatty"); - strcpy(LocationName, "Flatearth"); - strcpy(RegionName, "Santaland"); + wcscpy(ServerName, L"TeknoParrot Server Hi!"); + wcscpy(LinkServerName, L"TeknoParrot Link Server Hi!"); + wcscpy(LocationNickName, L"Flatty"); + wcscpy(LocationName, L"Flatearth"); + wcscpy(RegionName, L"Santaland"); Credit_isGameCostEnoughReturnValue = 1; MH_Initialize(); diff --git a/OpenParrot/src/Functions/Games/APM3/APM3.h b/OpenParrot/src/Functions/Games/APM3/APM3.h index 09e9772..650b4c8 100644 --- a/OpenParrot/src/Functions/Games/APM3/APM3.h +++ b/OpenParrot/src/Functions/Games/APM3/APM3.h @@ -1,31 +1,7 @@ #ifdef _M_AMD64 -static char APM3GameId[5]; -static char RegionName[64]; -static char LocationNickName[64]; -static char LocationName[64]; -static char LinkServerName[64]; -static char ServerName[64]; static __int64 System_getResolutionReturnValue = 0; -static __int64 AllnetAccounting_beginPlayReturnValue = 0; - -static __int64 AllnetAccounting_endPlayReturnValue = 0; - -static __int64 AllnetAuth_getCountryCodeReturnValue = 0; - -static __int64 AllnetAuth_getLocationIdReturnValue = 0; - -static __int64 AllnetAuth_getLocationNicknamePartCountReturnValue = 0; - -static __int64 AllnetAuth_getRegionCodeReturnValue = 0; - -static __int64 AllnetAuth_getRegionNamePartCountReturnValue = 0; - -static __int64 AllnetAuth_isDevelopReturnValue = 0; - -static __int64 AllnetAuth_isGoodReturnValue = 0; - static bool ApmSystemSetting_getAdvertizeSoundReturnValue = false; static bool ApmSystemSetting_getClosingTimesReturnValue = false; @@ -96,24 +72,6 @@ static void** NetworkProperty_getAddressStringReturnValue = nullptr; static __int64 NetworkProperty_getAddressValueReturnValue = 0; -static __int64 Sequence_beginPlayReturnValue = 1; - -static __int64 Sequence_clearBackupReturnValue = 0; - -static __int64 Sequence_continuePlayReturnValue = 0; - -static __int64 Sequence_endPlayReturnValue = 0; - -static __int64 Sequence_getBookkeepingReturnValue = 0; - -static __int64 Sequence_getPlayingAimeIdReturnValue = 0; - -static __int64 Sequence_isAccountingPlayingReturnValue = 0; - -static __int64 Sequence_isPlayingReturnValue = 0; - -static __int64 Sequence_isTestReturnValue = 0; - static __int64 System_getAppRootPathReturnValue = 0; static __int64 System_getRegionCodeReturnValue = 0; diff --git a/OpenParrot/src/Functions/Games/APM3/Aime.cpp b/OpenParrot/src/Functions/Games/APM3/Aime.cpp index 5af9864..0db442d 100644 --- a/OpenParrot/src/Functions/Games/APM3/Aime.cpp +++ b/OpenParrot/src/Functions/Games/APM3/Aime.cpp @@ -5,8 +5,6 @@ #include "Functions\Global.h" #include "Aime.h" -static uint8_t g_APM3IOValues[256]; - bool Aime_acceptConfirm() { #ifdef _DEBUG diff --git a/OpenParrot/src/Functions/Games/APM3/Auth.cpp b/OpenParrot/src/Functions/Games/APM3/Auth.cpp new file mode 100644 index 0000000..5419e24 --- /dev/null +++ b/OpenParrot/src/Functions/Games/APM3/Auth.cpp @@ -0,0 +1,119 @@ +#include +#include +#include +#ifdef _M_AMD64 +#include "Functions\Global.h" +#include "Auth.h" + +__int64 __fastcall AllnetAccounting_beginPlay(unsigned int a1) +{ +#ifdef _DEBUG + info(true, "AllnetAccounting_beginPlay"); +#endif + return AllnetAccounting_beginPlayReturnValue; +} + +__int64 __fastcall AllnetAccounting_endPlay(int a1, int a2, int a3) +{ +#ifdef _DEBUG + info(true, "AllnetAccounting_endPlay"); +#endif + return AllnetAccounting_endPlayReturnValue; +} + +wchar_t* AllnetAuth_getAbaasGsServerName() +{ +#ifdef _DEBUG + info(true, "AllnetAuth_getAbaasGsServerName"); +#endif + return ServerName; +} + +wchar_t* AllnetAuth_getAbaasLinkServerName() +{ +#ifdef _DEBUG + info(true, "AllnetAuth_getAbaasLinkServerName"); +#endif + return LinkServerName; +} + +int AllnetAuth_getCountryCode() +{ +#ifdef _DEBUG + info(true, "AllnetAuth_getCountryCode"); +#endif + return AllnetAuth_getCountryCodeReturnValue; +} + +unsigned int AllnetAuth_getLocationId() +{ +#ifdef _DEBUG + info(true, "AllnetAuth_getLocationId"); +#endif + return AllnetAuth_getLocationIdReturnValue; +} + +wchar_t* AllnetAuth_getLocationName() +{ +#ifdef _DEBUG + info(true, "AllnetAuth_getLocationName"); +#endif + return LocationName; +} + +wchar_t* __fastcall AllnetAuth_getLocationNickname(int index) +{ +#ifdef _DEBUG + info(true, "AllnetAuth_getLocationNickname"); +#endif + return LocationNickName; +} + +int AllnetAuth_getLocationNicknamePartCount() +{ +#ifdef _DEBUG + info(true, "AllnetAuth_getLocationNicknamePartCount"); +#endif + return AllnetAuth_getLocationNicknamePartCountReturnValue; +} + +int AllnetAuth_getRegionCode() +{ +#ifdef _DEBUG + info(true, "AllnetAuth_getRegionCode"); +#endif + return AllnetAuth_getRegionCodeReturnValue; +} + +wchar_t* __fastcall AllnetAuth_getRegionName(int index) +{ +#ifdef _DEBUG + info(true, "AllnetAuth_getRegionName"); +#endif + return RegionName; +} + +int AllnetAuth_getRegionNamePartCount() +{ +#ifdef _DEBUG + info(true, "AllnetAuth_getRegionNamePartCount"); +#endif + return AllnetAuth_getRegionNamePartCountReturnValue; +} + +bool AllnetAuth_isDevelop() +{ +#ifdef _DEBUG + info(true, "AllnetAuth_isDevelop"); +#endif + return AllnetAuth_isDevelopReturnValue; +} + +bool AllnetAuth_isGood() +{ +#ifdef _DEBUG + info(true, "AllnetAuth_isGood"); +#endif + return AllnetAuth_isGoodReturnValue; +} +#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..c94cefd --- /dev/null +++ b/OpenParrot/src/Functions/Games/APM3/Auth.h @@ -0,0 +1,43 @@ +#ifdef _M_AMD64 +static char APM3GameId[5]; +static wchar_t RegionName[64]; +static wchar_t LocationNickName[64]; +static wchar_t LocationName[64]; +static wchar_t LinkServerName[64]; +static 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(); +int 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/Sequence.cpp b/OpenParrot/src/Functions/Games/APM3/Sequence.cpp new file mode 100644 index 0000000..a710756 --- /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 _DEBUG + info(true, "Sequence_beginPlay"); +#endif + return Sequence_beginPlayReturnValue; +} + +bool Sequence_clearBackup() +{ +#ifdef _DEBUG + 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 _DEBUG + info(true, "Sequence_continuePlay"); +#endif + return Sequence_continuePlayReturnValue; +} + +bool __fastcall Sequence_endPlay(SequenceAccountingEnd endPlay, SEQUENCE_PLAY_ERROR_ID* errorID) +{ +#ifdef _DEBUG + info(true, "Sequence_endPlay"); +#endif + return Sequence_endPlayReturnValue; +} + +SequenceBookkeeping* Sequence_getBookkeeping() +{ +#ifdef _DEBUG + 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 _DEBUG + info(true, "Sequence_getPlayingAimeId"); +#endif + return Sequence_getPlayingAimeIdReturnValue; +} + +bool Sequence_isAccountingPlaying() +{ +#ifdef _DEBUG + info(true, "Sequence_isAccountingPlaying"); +#endif + return Sequence_isAccountingPlayingReturnValue; +} + +bool Sequence_isPlaying() +{ +#ifdef _DEBUG + info(true, "Sequence_isPlaying"); +#endif + return Sequence_isPlayingReturnValue; +} + +bool Sequence_isTest() +{ +#ifdef _DEBUG + 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