//
// SecretLayer5::onlineRewardStatusFinished from 0x10047d940 to 0x10047da4a (266 bytes)
//
// 2 xrefs:
// > sub_10047DA70 @ 0x10047da7c
// > ??> @ 0x10093b708
//
// 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(__int64 a1, const std::string *a2, __m128 a3)
{
GameStatsManager *v3; // r15
__int64 RewardForSpecialChest; // r15
GameStatsManager *v5; // r15
bool isSpecialChestUnlocked; // r15
__m128 v7; // [rsp+0h] [rbp-60h] BYREF
void *__p; // [rsp+10h] [rbp-50h]
__m128 v9; // [rsp+20h] [rbp-40h] BYREF
void *data; // [rsp+30h] [rbp-30h]
v3 = GameStatsManager::sharedState();
if ( (*(_BYTE *)&a2->__r_.__value_.__s.0 & 1) != 0 )
{
sub_100006B70(&v7, a2->__r_.__value_.__l.__data_, a2->__r_.__value_.__l.__size_, *(double *)a3.i64);
}
else
{
__p = a2->__r_.__value_.__l.__data_;
a3 = *(__m128 *)&a2->__r_.__value_.__l.0;
v7 = *(__m128 *)&a2->__r_.__value_.__l.0;
}
RewardForSpecialChest = GameStatsManager::getRewardForSpecialChest((__int64)v3, (__int64)&v7);
if ( (v7.i8[0] & 1) != 0 )
operator delete(__p);
if ( !RewardForSpecialChest )
goto LABEL_13;
v5 = GameStatsManager::sharedState();
if ( (*(_BYTE *)&a2->__r_.__value_.__s.0 & 1) != 0 )
{
sub_100006B70(&v9, a2->__r_.__value_.__l.__data_, a2->__r_.__value_.__l.__size_, *(double *)a3.i64);
}
else
{
data = a2->__r_.__value_.__l.__data_;
a3 = *(__m128 *)&a2->__r_.__value_.__l.0;
v9 = *(__m128 *)&a2->__r_.__value_.__l.0;
}
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked((__int64)v5, (__int64)&v9, *(double *)a3.i64);
if ( (v9.i8[0] & 1) != 0 )
operator delete(data);
if ( !isSpecialChestUnlocked )
{
*(_DWORD *)(a1 + 516) = 1;
std::string::operator=((std::string *)(a1 + 520), a2);
if ( !*(_BYTE *)(a1 + 512) )
SecretLayer5::handleSecretResponse((SecretLayer5 *)a1);
}
else
{
LABEL_13:
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1184LL))(a1);
}
}