//
// SecretLayer5::onlineRewardStatusFinished from 0x1004722a0 to 0x1004723aa (266 bytes)
//
// 2 xrefs:
// > sub_1004723D0 @ 0x1004723dc
// > ??> @ 0x100b458d0
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:30:33 +0000
//
std::string *__fastcall SecretLayer5::onlineRewardStatusFinished(__int64 a1, const std::string *a2)
{
__int64 v2; // r15
__int64 RewardForSpecialChest; // r15
__int64 v4; // r15
bool isSpecialChestUnlocked; // r15
std::string *result; // rax
__int128 v7; // [rsp+0h] [rbp-60h] BYREF
void *__p; // [rsp+10h] [rbp-50h]
__int128 v9; // [rsp+20h] [rbp-40h] BYREF
void *data; // [rsp+30h] [rbp-30h]
v2 = GameStatsManager::sharedState();
if ( (*(_BYTE *)&a2->__r_.__value_.__s.0 & 1) != 0 )
{
sub_10001AD30(&v7, a2->__r_.__value_.__l.__data_, a2->__r_.__value_.__l.__size_);
}
else
{
__p = a2->__r_.__value_.__l.__data_;
v7 = *(_OWORD *)&a2->__r_.__value_.__l.0;
}
RewardForSpecialChest = GameStatsManager::getRewardForSpecialChest(v2, (__int64)&v7);
if ( (v7 & 1) != 0 )
operator delete(__p);
if ( !RewardForSpecialChest )
return (std::string *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1 + 1200LL))(a1);
v4 = GameStatsManager::sharedState();
if ( (*(_BYTE *)&a2->__r_.__value_.__s.0 & 1) != 0 )
{
sub_10001AD30(&v9, a2->__r_.__value_.__l.__data_, a2->__r_.__value_.__l.__size_);
}
else
{
data = a2->__r_.__value_.__l.__data_;
v9 = *(_OWORD *)&a2->__r_.__value_.__l.0;
}
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked(v4, (__int64)&v9);
if ( (v9 & 1) != 0 )
operator delete(data);
if ( isSpecialChestUnlocked )
return (std::string *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1 + 1200LL))(a1);
*(_DWORD *)(a1 + 516) = 1;
result = std::string::operator=((std::string *)(a1 + 520), a2);
if ( !*(_BYTE *)(a1 + 512) )
return (std::string *)SecretLayer5::handleSecretResponse(a1);
return result;
}