//
// LevelListLayer::onClaimReward from 0x14042df10 to 0x14042e4d3 (1475 bytes)
//
// 2 xrefs:
// > LevelListLayer::updateStatsArt @ 0x14042db85
// > ??> @ 0x140926b4c
//
// 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 11:32:14 +0000
//
// Hidden C++ exception states: #wind=7
void __fastcall LevelListLayer::onClaimReward(__int64 *a1, __int64 a2)
{
int v4; // edi
int v5; // edi
__int64 v6; // rdi
_DWORD *v7; // rbx
int v8; // eax
int v9; // ecx
signed int v10; // r15d
cocos2d::CCString *v11; // rax
const char *v12; // rax
size_t v13; // rbx
__int64 v14; // rbx
struct cocos2d::CCString *v15; // rax
void *v16; // rcx
int v17; // ecx
int v18; // ebx
const struct cocos2d::CCPoint *v19; // rax
char *v20; // rax
const char *v21; // rdx
size_t v22; // rbx
size_t v23; // r8
void **v24; // r8
cocos2d::CCString *v25; // rax
const char *CString; // rax
__int64 v27; // rcx
void **v28; // rsi
char *v29; // r14
unsigned __int64 v30; // r15
__int64 v31; // rbx
unsigned __int64 v32; // rdi
void **v33; // rax
cocos2d::CCLayerColor *DialogLayer; // rsi
__int64 v35; // rcx
__int64 v36; // rax
__int64 v37; // rdi
__int64 v38; // rbx
__int64 v39; // rax
char *v40; // rax
void *v41; // rcx
__int64 v42[2]; // [rsp+60h] [rbp-69h] BYREF
__int128 *v43; // [rsp+70h] [rbp-59h] BYREF
__int128 v44; // [rsp+78h] [rbp-51h] BYREF
unsigned __int64 v45; // [rsp+88h] [rbp-41h]
__int64 v46; // [rsp+90h] [rbp-39h]
void *v47[2]; // [rsp+98h] [rbp-31h] BYREF
__int64 v48; // [rsp+A8h] [rbp-21h]
unsigned __int64 v49; // [rsp+B0h] [rbp-19h]
void *Block[2]; // [rsp+B8h] [rbp-11h] BYREF
__int64 v51; // [rsp+C8h] [rbp-1h]
unsigned __int64 v52; // [rsp+D0h] [rbp+7h]
void *Src[2]; // [rsp+D8h] [rbp+Fh] BYREF
unsigned __int64 v54; // [rsp+E8h] [rbp+1Fh]
unsigned __int64 v55; // [rsp+F0h] [rbp+27h]
v4 = *(_DWORD *)(a1[115] + 388);
v5 = v4 - GJLevelList::completedLevels(a1[115]);
if ( v5 > 0 )
{
v21 = "levels";
if ( v5 == 1 )
v21 = "level";
*(_OWORD *)v47 = 0;
v48 = 0;
v49 = 0;
v22 = -1;
v23 = -1;
do
++v23;
while ( v21[v23] );
sub_14003D230(v47, v21, v23);
v24 = v47;
if ( v49 > 0xF )
v24 = (void **)v47[0];
v25 = cocos2d::CCString::createWithFormat(
"Complete %i more %s from this list to claim the reward!",
v5,
(const char *)v24);
CString = cocos2d::CCString::getCString(v25);
*(_OWORD *)Src = 0;
v54 = 0;
v55 = 0;
do
++v22;
while ( CString[v22] );
sub_14003D230(Src, CString, v22);
v43 = &v44;
LOWORD(v42[0]) = -1;
BYTE2(v42[0]) = -1;
v44 = 0;
v45 = 0;
v46 = 0;
v28 = Src;
v29 = (char *)Src[0];
v30 = v55;
if ( v55 > 0xF )
v28 = (void **)Src[0];
v31 = 0x7FFFFFFFFFFFFFFFLL;
v32 = v54;
if ( v54 > 0x7FFFFFFFFFFFFFFFLL )
sub_140009D90(v27);
if ( v54 > 0xF )
{
if ( (v54 | 0xF) <= 0x7FFFFFFFFFFFFFFFLL )
{
v31 = v54 | 0xF;
if ( (v54 | 0xF) < 0x16 )
v31 = 22;
}
*(_QWORD *)&v44 = sub_14003D460(v31 + 1);
v45 = v32;
v46 = v31;
memcpy((void *)v44, v28, v32 + 1);
}
else
{
v45 = v54;
v46 = 15;
v44 = *(_OWORD *)v28;
}
v51 = 12;
v52 = 15;
strcpy((char *)Block, "The Mechanic");
BYTE5(Block[1]) = 0;
HIWORD(Block[1]) = 0;
v33 = DialogObject::create((__int64)Block, (__int64)&v44, 37, 1.0, 0, (__int64)v42);
DialogLayer = DialogLayer::createDialogLayer((__int64)v33, 0, 4u);
DialogLayer::addToMainScene((__int64)DialogLayer);
v36 = cocos2d::CCDirector::sharedDirector(v35);
cocos2d::CCDirector::getWinSize(v36, v42);
v37 = **((_QWORD **)DialogLayer + 70);
v38 = *((_QWORD *)DialogLayer + 70);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v43, *(float *)v42 * 0.5, *((float *)v42 + 1) * 0.5);
(*(void (__fastcall **)(__int64, __int64))(v37 + 184))(v38, v39);
DialogLayer::animateIn(DialogLayer, 1);
if ( v30 > 0xF )
{
v40 = v29;
if ( v30 + 1 >= 0x1000 )
{
v29 = *((char **)v29 - 1);
if ( (unsigned __int64)(v40 - v29 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v29);
}
if ( v49 > 0xF )
{
v41 = v47[0];
if ( v49 + 1 >= 0x1000 )
{
v41 = *((void **)v47[0] - 1);
if ( (unsigned __int64)((char *)v47[0] - (char *)v41 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v41);
}
}
else
{
v6 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v42[0] = (__int64)operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480(v42[0]);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v6 = qword_14090BFE0;
}
v7 = (_DWORD *)a1[115];
v8 = GJLevelList::completedLevels((__int64)v7);
v9 = v7[97];
v10 = v7[96];
if ( v10 > 0 && v9 > 0 && v8 >= v9 && !GameStatsManager::hasClaimedListReward(v6, (__int64)v7) )
{
v11 = cocos2d::CCString::createWithFormat("lr_%i", v7[86]);
v12 = cocos2d::CCString::getCString(v11);
*(_OWORD *)Block = 0;
v51 = 0;
v52 = 0;
v13 = -1;
do
++v13;
while ( v12[v13] );
sub_14003D230(Block, v12, v13);
v14 = *(_QWORD *)(v6 + 832);
v15 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, (unsigned int)v10);
cocos2d::CCDictionary::setObject(v14, v15, Block);
if ( v52 > 0xF )
{
v16 = Block[0];
if ( v52 + 1 >= 0x1000 )
{
v16 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v16 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v16);
}
GameStatsManager::incrementStat(v6, "13", v10);
GameStatsManager::incrementStat(v6, "41", 1u);
v42[0] = (__int64)v47;
v47[1] = (void *)26471;
v48 = 10;
v49 = 15;
v47[0] = (void *)0x6F2E3230646C6F67LL;
v17 = qword_14090BF60;
if ( !qword_14090BF60 )
{
v43 = (__int128 *)operator new(0x8A8u);
qword_14090BF60 = FMODAudioEngine::FMODAudioEngine((__int64)v43);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BF60 + 72LL))(qword_14090BF60);
v17 = qword_14090BF60;
}
FMODAudioEngine::playEffect_1(v17, (__int64)v47);
v18 = *(_DWORD *)(a1[115] + 384);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v43, (const struct cocos2d::CCPoint *)(a1 + 127));
v20 = CurrencyRewardLayer::create(0, 0, 0, v18, 0, 0, 0, 0, v19, 0, 0, 1065353216);
(*(void (__fastcall **)(__int64 *, char *, __int64))(*a1 + 456))(a1, v20, 14);
}
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a2 + 936LL))(a2, 0);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a2 + 336LL))(a2, 0);
}
}