//
// GameStatsManager::preSaveGameStats from 0x1401f3b00 to 0x1401f3cd1 (465 bytes)
//
// 3 xrefs:
// > GameStatsManager::encodeDataTo @ 0x1401f21b0
// > GJAccountManager::onSyncAccountCompleted @ 0x140202f1c
// > ??> @ 0x1406cc714
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Hidden C++ exception states: #wind=2
void GameStatsManager::preSaveGameStats(GameStatsManager *a1)
{
bool m_dontNotify; // si
int i; // ebx
cocos2d::CCString *v4; // rax
const char *CString; // rax
size_t v6; // r8
__int128 *v7; // rdx
size_t v8; // r8
const char *v9; // rdx
int Stat; // eax
struct cocos2d::CCString *v11; // rax
void *v12; // rcx
void *v13; // rcx
__int128 v14; // [rsp+20h] [rbp-58h] BYREF
__int64 v15; // [rsp+30h] [rbp-48h]
unsigned __int64 v16; // [rsp+38h] [rbp-40h]
__int128 v17; // [rsp+40h] [rbp-38h] BYREF
__int64 v18; // [rsp+50h] [rbp-28h]
unsigned __int64 v19; // [rsp+58h] [rbp-20h]
m_dontNotify = AchievementManager::sharedState()->m_dontNotify;
AchievementManager::sharedState()->m_dontNotify = 1;
for ( i = 1; i <= 43; ++i )
{
v4 = cocos2d::CCString::createWithFormat("%i", i);
CString = cocos2d::CCString::getCString(v4);
v14 = 0;
v15 = 0;
v16 = 0;
v6 = -1;
do
++v6;
while ( CString[v6] );
sub_14003A930(&v14, CString, v6);
v7 = &v14;
if ( v16 > 0xF )
v7 = (__int128 *)v14;
v17 = 0;
v18 = 0;
v19 = 0;
v8 = -1;
do
++v8;
while ( *((_BYTE *)v7 + v8) );
sub_14003A930(&v17, v7, v8);
v9 = (const char *)&v14;
if ( v16 > 0xF )
v9 = (const char *)v14;
Stat = GameStatsManager::getStat(a1, v9);
v11 = cocos2d::CCString::createWithFormat("%i", Stat);
cocos2d::CCDictionary::setObject(a1->m_playerStats, v11, &v17);
if ( v19 > 0xF )
{
v12 = (void *)v17;
if ( v19 + 1 >= 0x1000 )
{
v12 = *(void **)(v17 - 8);
if ( (unsigned __int64)(v17 - (_QWORD)v12 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v12);
}
if ( v16 > 0xF )
{
v13 = (void *)v14;
if ( v16 + 1 >= 0x1000 )
{
v13 = *(void **)(v14 - 8);
if ( (unsigned __int64)(v14 - (_QWORD)v13 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v13);
}
}
AchievementManager::sharedState()->m_dontNotify = m_dontNotify;
}