//
// GameLevelManager::onUpdateUserScoreCompleted from 0x100520480 to 0x100520786 (774 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x10051c44f
//
// 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 GameLevelManager::onUpdateUserScoreCompleted(GameLevelManager *a1, unsigned __int8 *a2)
{
unsigned int v3; // r12d
unsigned __int64 v4; // r12
const void *v5; // r14
size_t v6; // r15
_QWORD *v7; // rdi
__int64 result; // rax
GameLevelManager *v9; // rdi
char *v10; // r14
int v11; // r14d
GameManager *v12; // r15
float v13; // xmm0_4
LeaderboardManagerDelegate *m_leaderboardManagerDelegate; // rdi
_WORD __s2[31]; // [rsp+1h] [rbp-3Fh] BYREF
GameLevelManager::removeDLFromActive(a1, "user_score");
strcpy((char *)__s2, "-1");
v3 = *a2;
if ( (v3 & 1) != 0 )
{
v4 = *((_QWORD *)a2 + 1);
v5 = *((const void **)a2 + 2);
}
else
{
v4 = v3 >> 1;
v5 = a2 + 1;
}
v6 = 2;
if ( v4 < 2 )
v6 = v4;
if ( !((v4 != 2) | (memcmp(v5, __s2, v6) != 0)) )
{
v7 = &a1->m_leaderboardManagerDelegate->__vftable;
result = 8;
if ( !v7 )
return result;
return (*(__int64 (**)(void))(*v7 + result))();
}
strcpy((char *)__s2, "-9");
if ( (v4 != 2) | (memcmp(v5, __s2, v6) != 0) )
{
v11 = atoi((const char *)v5);
v12 = GameManager::sharedState();
v12->m_playerUserID.value = v11;
v13 = (float)((float)rand() * 4.6566129e-10) * 1000.0;
v12->m_playerUserID.seed = (int)v13;
v12->m_playerUserID.random = (int)v13 + v11;
}
else
{
v9 = (GameLevelManager *)qword_1009A28E0;
if ( !qword_1009A28E0 )
{
v10 = (char *)operator new(0x3C8u);
cocos2d::CCNode::CCNode((__int64)v10);
*(_QWORD *)v10 = off_100960890;
*(_OWORD *)(v10 + 328) = 0;
*((_QWORD *)v10 + 40) = v10 + 328;
*((_QWORD *)v10 + 62) = 0;
*((_OWORD *)v10 + 32) = 0;
*(_OWORD *)(v10 + 344) = 0;
*(_OWORD *)(v10 + 360) = 0;
*(_OWORD *)(v10 + 376) = 0;
*(_OWORD *)(v10 + 392) = 0;
*(_OWORD *)(v10 + 408) = 0;
*(_OWORD *)(v10 + 424) = 0;
*(_OWORD *)(v10 + 440) = 0;
*(_OWORD *)(v10 + 456) = 0;
*(_OWORD *)(v10 + 472) = 0;
*((_DWORD *)v10 + 122) = 0;
*((_QWORD *)v10 + 63) = v10 + 512;
*((_OWORD *)v10 + 33) = 0;
*((_OWORD *)v10 + 34) = 0;
*((_OWORD *)v10 + 35) = 0;
*((_OWORD *)v10 + 36) = 0;
*(_OWORD *)(v10 + 696) = 0;
*(_OWORD *)(v10 + 680) = 0;
*(_OWORD *)(v10 + 664) = 0;
*(_OWORD *)(v10 + 648) = 0;
*(_OWORD *)(v10 + 632) = 0;
*(_OWORD *)(v10 + 616) = 0;
*(_OWORD *)(v10 + 600) = 0;
v10[712] = 0;
*((_OWORD *)v10 + 48) = 0;
*((_OWORD *)v10 + 47) = 0;
*((_OWORD *)v10 + 46) = 0;
*((_OWORD *)v10 + 45) = 0;
*(_OWORD *)(v10 + 945) = 0;
*(_OWORD *)(v10 + 936) = 0;
*(_OWORD *)(v10 + 920) = 0;
*(_OWORD *)(v10 + 904) = 0;
*(_OWORD *)(v10 + 888) = 0;
*(_OWORD *)(v10 + 872) = 0;
*(_OWORD *)(v10 + 856) = 0;
*(_OWORD *)(v10 + 840) = 0;
*(_OWORD *)(v10 + 824) = 0;
*(_OWORD *)(v10 + 808) = 0;
*(_OWORD *)(v10 + 792) = 0;
qword_1009A28E0 = (__int64)v10;
GameLevelManager::init((GameLevelManager *)v10);
v9 = (GameLevelManager *)qword_1009A28E0;
}
GameLevelManager::submitUserInfo(v9);
}
GameManager::sharedState()->m_scoreValid = 1;
m_leaderboardManagerDelegate = a1->m_leaderboardManagerDelegate;
if ( m_leaderboardManagerDelegate )
((void (__fastcall *)(LeaderboardManagerDelegate *))m_leaderboardManagerDelegate->updateUserScoreFinished)(m_leaderboardManagerDelegate);
v7 = &a1->m_levelCommentDelegate->__vftable;
result = 16;
if ( v7 )
return (*(__int64 (**)(void))(*v7 + result))();
return result;
}