//
// SecretLayer5::onlineRewardStatusFinished from 0x100076b70 to 0x100076c8c (284 bytes)
//
// 2 xrefs:
// > sub_100076CC0 @ 0x100076cc4
// > ??> @ 0x10077a150
//
// 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
//
void __fastcall SecretLayer5::onlineRewardStatusFinished(SecretLayer5 *a1, __int64 a2)
{
GameStatsManager *v4; // x21
__int64 RewardForSpecialChest; // x0
__int64 v6; // x21
GameStatsManager *v7; // x21
char isSpecialChestUnlocked; // w0
char v9; // w21
void *v10[2]; // [xsp+0h] [xbp-60h] BYREF
__int64 v11; // [xsp+10h] [xbp-50h]
void *__p[2]; // [xsp+20h] [xbp-40h] BYREF
__int64 v13; // [xsp+30h] [xbp-30h]
v4 = GameStatsManager::sharedState();
if ( *(char *)(a2 + 23) < 0 )
{
sub_1000097D0(__p, *(void **)a2, *(_QWORD *)(a2 + 8));
}
else
{
*(_OWORD *)__p = *(_OWORD *)a2;
v13 = *(_QWORD *)(a2 + 16);
}
RewardForSpecialChest = GameStatsManager::getRewardForSpecialChest(v4, __p);
v6 = RewardForSpecialChest;
if ( SHIBYTE(v13) < 0 )
{
operator delete(__p[0]);
if ( !v6 )
{
LABEL_13:
((void (__fastcall *)(SecretLayer5 *))a1->onlineRewardStatusFailed)(a1);
return;
}
}
else if ( !RewardForSpecialChest )
{
goto LABEL_13;
}
v7 = GameStatsManager::sharedState();
if ( *(char *)(a2 + 23) < 0 )
{
sub_1000097D0(v10, *(void **)a2, *(_QWORD *)(a2 + 8));
}
else
{
*(_OWORD *)v10 = *(_OWORD *)a2;
v11 = *(_QWORD *)(a2 + 16);
}
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked(v7, v10);
v9 = isSpecialChestUnlocked;
if ( SHIBYTE(v11) < 0 )
{
operator delete(v10[0]);
if ( (v9 & 1) != 0 )
goto LABEL_13;
}
else if ( (isSpecialChestUnlocked & 1) != 0 )
{
goto LABEL_13;
}
a1->m_rewardStatus = 1;
std::string::operator=((std::string *)&a1->m_chestID, (const std::string *)a2);
if ( !a1->m_loading )
SecretLayer5::handleSecretResponse(a1);
}