// // GJAccountManager::onSyncAccountCompleted from 0x848688 to 0x8490e4 (2652 bytes) // // 2 xrefs: // > GJAccountManager::handleIt @ 0x84935c // > @ 0x9c018 // // 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 // __int64 __fastcall GJAccountManager::onSyncAccountCompleted(GJAccountManager *a1, const void **a2) { _DWORD *v4; // x27 unsigned __int64 v5; // x28 unsigned __int64 v6; // x20 size_t v7; // x2 int v8; // w24 __int64 v9; // x20 __int64 *v10; // x0 GJAccountSyncDelegate *v11; // x0 cocos2d::CCString *v13; // x0 char *CString; // x0 _DWORD *v15; // x28 unsigned __int64 v16; // x27 size_t v17; // x2 int v18; // w24 __int64 v19; // x27 char *v20; // x0 cocos2d::CCArray *v21; // x24 GameLevelManager *v22; // x0 bool m_skipIncrementChallenge; // w28 GameStatsManager *v24; // x0 cocos2d::CCString *v25; // x0 char *v26; // x0 cocos2d::CCString *v27; // x0 cocos2d::CCString *v28; // x0 char *v29; // x0 cocos2d::CCString *v30; // x0 GameManager *v31; // x0 LocalLevelManager *v32; // x0 cocos2d::CCString *v33; // x0 cocos2d::CCString *v34; // x0 cocos2d::CCString *v35; // x0 char *v36; // x0 unsigned __int64 v37; // x4 int v38; // w3 cocos2d::CCString *v39; // x0 char *v40; // x0 char *v41; // x27 unsigned __int64 v42; // x4 int v43; // w3 GameLevelManager *v44; // x24 cocos2d::CCArray *MapPacks; // x24 unsigned int i; // w22 GJMapPack *v47; // x25 GameStatsManager *v48; // x0 GameStatsManager *v49; // x0 GJAccountSyncDelegate *m_syncDelegate; // x0 unsigned int *v51; // x27 int v52; // w1 double v53; // d0 long double v54; // q0 GJAccountDelegate *m_accountDelegate; // x0 GJAccountSyncDelegate *v56; // x0 unsigned int *v57; // x28 int v58; // w1 GameManager *v59; // x24 GameStatsManager *v60; // x0 GameStatsManager *v61; // x0 GameStatsManager *v62; // x0 GameManager *v63; // x24 GameStatsManager *v64; // x0 AchievementManager *v65; // x0 GJAccountSyncDelegate *v66; // x1 char *v67; // [xsp+60h] [xbp+60h] unsigned __int64 v68; // [xsp+68h] [xbp+68h] bool m_dontNotify; // [xsp+68h] [xbp+68h] __int64 v70; // [xsp+80h] [xbp+80h] BYREF __int64 v71; // [xsp+88h] [xbp+88h] BYREF __int64 v72; // [xsp+90h] [xbp+90h] BYREF char *v73; // [xsp+98h] [xbp+98h] BYREF __int64 v74; // [xsp+A0h] [xbp+A0h] BYREF __int64 v75; // [xsp+A8h] [xbp+A8h] BYREF char *v76; // [xsp+B0h] [xbp+B0h] BYREF __int64 v77; // [xsp+B8h] [xbp+B8h] BYREF char *v78; // [xsp+C0h] [xbp+C0h] BYREF __int64 v79; // [xsp+C8h] [xbp+C8h] BYREF void *v80; // [xsp+D0h] [xbp+D0h] BYREF GJAccountManager::removeDLFromActive(a1, "sync_account"); sub_D153B8((int)&v80, "-1"); v4 = v80; v5 = *((_QWORD *)v80 - 3); v6 = *((_QWORD *)*a2 - 3); if ( v5 > v6 ) v7 = *((_QWORD *)*a2 - 3); else v7 = *((_QWORD *)v80 - 3); v8 = memcmp(*a2, v80, v7); if ( v8 || (v8 = 0x7FFFFFFF, v9 = v6 - v5, v9 > 0x7FFFFFFF) ) { v10 = (__int64 *)(v4 - 6); if ( v4 - 6 == (_DWORD *)&qword_124B6B0 ) goto LABEL_7; } else { v10 = (__int64 *)(v4 - 6); if ( v9 >= (__int64)0xFFFFFFFF80000000LL ) v8 = v9; else v8 = 0x80000000; if ( v10 == &qword_124B6B0 ) goto LABEL_7; } if ( &pthread_create ) { v51 = v4 - 2; do v52 = __ldaxr(v51); while ( __stlxr(v52 - 1, v51) ); } else { v52 = *(v4 - 2); *(v4 - 2) = v52 - 1; } if ( v52 <= 0 ) operator delete(v10); LABEL_7: if ( !v8 ) goto LABEL_8; v13 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", (const char *)0xFFFFFFFELL); CString = (char *)cocos2d::CCString::getCString(v13); sub_D153B8((int)&v80, CString); v15 = v80; v16 = *((_QWORD *)*a2 - 3); v68 = *((_QWORD *)v80 - 3); if ( v68 > v16 ) v17 = *((_QWORD *)*a2 - 3); else v17 = *((_QWORD *)v80 - 3); v18 = memcmp(*a2, v80, v17); if ( !v18 ) { v18 = 0x7FFFFFFF; v19 = v16 - v68; if ( v19 <= 0x7FFFFFFF ) { if ( v19 >= (__int64)0xFFFFFFFF80000000LL ) v18 = v19; else v18 = 0x80000000; } } v20 = (char *)(v15 - 6); if ( v15 - 6 != (_DWORD *)&qword_124B6B0 ) { if ( &pthread_create ) { v57 = v15 - 2; do v58 = __ldaxr(v57); while ( __stlxr(v58 - 1, v57) ); } else { v58 = *(v15 - 2); *(v15 - 2) = v58 - 1; } if ( v58 <= 0 ) operator delete(v20); } if ( v18 ) { if ( *((_QWORD *)*a2 - 3) <= 9u && atoi((const char *)*a2) < 0 ) { m_syncDelegate = a1->m_syncDelegate; if ( m_syncDelegate ) ((void (__fastcall *)(GJAccountSyncDelegate *, __int64))m_syncDelegate->syncAccountFailed)( m_syncDelegate, 4294967293LL); } else { v21 = sub_844C0C(a2, ";"); if ( (unsigned int)cocos2d::CCArray::count(v21) <= 5 ) { LABEL_8: v11 = a1->m_syncDelegate; if ( v11 ) v11->syncAccountFailed(v11, GenericError, 0); return _stack_chk_guard; } v22 = GameLevelManager::sharedState(); GameLevelManager::makeTimeStamp(v22, "sync_account"); m_dontNotify = AchievementManager::sharedState()->m_dontNotify; AchievementManager::sharedState()->m_dontNotify = 1; m_skipIncrementChallenge = GameStatsManager::sharedState()->m_skipIncrementChallenge; GameStatsManager::sharedState()->m_skipIncrementChallenge = 1; v24 = GameStatsManager::sharedState(); GameStatsManager::preSaveGameStats(v24); GameStatsManager::sharedState()->m_usePlayerStatsCCDictionary = 1; v25 = cocos2d::CCArray::stringAtIndex(v21, 0); v26 = (char *)cocos2d::CCString::getCString(v25); sub_D153B8((int)&v70, v26); v27 = cocos2d::CCArray::stringAtIndex(v21, 0); sub_D174B8(&v27->m_sString, 0, *((_QWORD *)v27->m_sString.m_data.m_data - 3), 0); v28 = cocos2d::CCArray::stringAtIndex(v21, 1u); v29 = (char *)cocos2d::CCString::getCString(v28); sub_D153B8((int)&v71, v29); v30 = cocos2d::CCArray::stringAtIndex(v21, 1u); sub_D174B8(&v30->m_sString, 0, *((_QWORD *)v30->m_sString.m_data.m_data - 3), 0); v31 = GameManager::sharedState(); GManager::loadFromCompressedString((__int64)v31, (cocos2d::ZipUtils *)&v70); v32 = LocalLevelManager::sharedState(); GManager::loadFromCompressedString((__int64)v32, (cocos2d::ZipUtils *)&v71); v33 = cocos2d::CCArray::stringAtIndex(v21, 2u); cocos2d::CCString::intValue(v33); v34 = cocos2d::CCArray::stringAtIndex(v21, 3u); cocos2d::CCString::intValue(v34); sub_D153B8((int)&v72, &byte_F288A0); v35 = cocos2d::CCArray::stringAtIndex(v21, 4u); v36 = (char *)cocos2d::CCString::getCString(v35); sub_D153B8((int)&v73, v36); v67 = v73; if ( strlen(v73) > 0x28 ) { v37 = *((_QWORD *)v67 - 3); if ( v37 <= 0x13 ) sub_D13C5C( "%s: __pos (which is %zu) > this->size() (which is %zu)", "basic_string::substr", 0x14u, *((_QWORD *)v67 - 3)); sub_D14F84(&v80, &v73, 20, v37 - 40); sub_D174B8(&v73, 0, *((_QWORD *)v73 - 3), 0); cocos2d::ZipUtils::decompressString((cocos2d::ZipUtils *)&v80, nullptr, 11, v38); sub_D163D4(&v72, &v74); if ( (__int64 *)(v74 - 24) != &qword_124B6B0 ) sub_844A20((void *)(v74 - 24)); sub_D174B8(&v80, 0, *((_QWORD *)v80 - 3), 0); if ( (char *)v80 - 24 != (char *)&qword_124B6B0 ) sub_844A20((char *)v80 - 24); } sub_D153B8((int)&v75, &byte_F288A0); v39 = cocos2d::CCArray::stringAtIndex(v21, 5u); v40 = (char *)cocos2d::CCString::getCString(v39); sub_D153B8((int)&v76, v40); v41 = v76; if ( strlen(v76) > 0x28 ) { v42 = *((_QWORD *)v41 - 3); if ( v42 <= 0x13 ) sub_D13C5C( "%s: __pos (which is %zu) > this->size() (which is %zu)", "basic_string::substr", 0x14u, *((_QWORD *)v41 - 3)); sub_D14F84(&v80, &v76, 20, v42 - 40); sub_D174B8(&v76, 0, *((_QWORD *)v76 - 3), 0); cocos2d::ZipUtils::decompressString((cocos2d::ZipUtils *)&v80, nullptr, 11, v43); sub_D163D4(&v75, &v77); if ( (__int64 *)(v77 - 24) != &qword_124B6B0 ) sub_844A20((void *)(v77 - 24)); sub_D174B8(&v80, 0, *((_QWORD *)v80 - 3), 0); if ( (char *)v80 - 24 != (char *)&qword_124B6B0 ) sub_844A20((char *)v80 - 24); } v44 = GameLevelManager::sharedState(); sub_D18D28(&v78); MapPacks = GameLevelManager::createAndGetMapPacks((__int64)v44, &v78); if ( v78 - 24 != (char *)&qword_124B6B0 ) sub_844A20(v78 - 24); sub_D174B8(&v75, 0, *(_QWORD *)(v75 - 24), 0); for ( i = 0; i < (unsigned int)cocos2d::CCArray::count(MapPacks); ++i ) { v47 = (GJMapPack *)cocos2d::CCArray::objectAtIndex(MapPacks, i); if ( GJMapPack::hasCompletedMapPack(v47) ) { v48 = GameStatsManager::sharedState(); GameStatsManager::completedMapPack(v48, v47); } v49 = GameStatsManager::sharedState(); GameStatsManager::setStarsForMapPack(v49, v47->m_packID, v47->m_stars); } v59 = GameManager::sharedState(); sub_D18D28(&v79); GameManager::recountUserStats(v59, &v79); if ( (__int64 *)(v79 - 24) != &qword_124B6B0 ) sub_844A20((void *)(v79 - 24)); v60 = GameStatsManager::sharedState(); GameStatsManager::verifyUserCoins(v60); v61 = GameStatsManager::sharedState(); GameStatsManager::tryFixPathBug(v61); v62 = GameStatsManager::sharedState(); GameStatsManager::verifyPathAchievements(v62); v63 = GameManager::sharedState(); GJAccountManager::sharedState(); sub_D18D28(&v80); sub_D18EA8(&v63->m_playerName, &v80); if ( (char *)v80 - 24 != (char *)&qword_124B6B0 ) sub_844A20((char *)v80 - 24); GameStatsManager::sharedState()->m_usePlayerStatsCCDictionary = 0; v64 = GameStatsManager::sharedState(); GameStatsManager::postLoadGameStats(v64); GameStatsManager::sharedState()->m_skipIncrementChallenge = m_skipIncrementChallenge; v65 = AchievementManager::sharedState(); v66 = a1->m_syncDelegate; v65->m_dontNotify = m_dontNotify; if ( v66 ) v66->syncAccountFinished(v66); if ( v76 - 24 != (char *)&qword_124B6B0 ) sub_844A20(v76 - 24); if ( (__int64 *)(v75 - 24) != &qword_124B6B0 ) sub_844A20((void *)(v75 - 24)); if ( v73 - 24 != (char *)&qword_124B6B0 ) sub_844A20(v73 - 24); if ( (__int64 *)(v72 - 24) != &qword_124B6B0 ) sub_844A20((void *)(v72 - 24)); if ( (__int64 *)(v71 - 24) != &qword_124B6B0 ) sub_844A20((void *)(v71 - 24)); if ( (__int64 *)(v70 - 24) != &qword_124B6B0 ) sub_844A20((void *)(v70 - 24)); } } else { *(_QWORD *)&v53 = sub_D1798C(&a1->m_password, &byte_F288A0, 0).n128_u64[0]; *(__n128 *)&v54 = sub_D1798C(&a1->m_GJP2, &byte_F288A0, 0, v53); m_accountDelegate = a1->m_accountDelegate; if ( m_accountDelegate ) ((void (__fastcall *)(GJAccountDelegate *, long double))m_accountDelegate->accountStatusChanged)( m_accountDelegate, v54); v56 = a1->m_syncDelegate; if ( v56 ) ((void (__fastcall *)(GJAccountSyncDelegate *, __int64, _QWORD, long double))v56->syncAccountFailed)( v56, 4294967294LL, 0, v54); } return _stack_chk_guard; }
GD Web Decomp Icon

GD Web Decomp

Raw Source