// // SecretRewardsLayer::onSelectItem from 0x14056bb80 to 0x14056c124 (1444 bytes) // // 2 xrefs: // > SecretRewardsLayer::generateChestItems @ 0x14056b8d6 // > @ 0x14092c654 // // 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:34:20 +0000 // // Hidden C++ exception states: #wind=6 void __fastcall SecretRewardsLayer::onSelectItem(_QWORD *a1, __int64 a2) { __int64 v4; // rcx int Stat; // edi int v6; // ebx __int64 v7; // rax int v8; // r15d __int64 v9; // rcx int v10; // eax int v11; // ebx char *v12; // rdx __int64 v13; // rcx cocos2d::CCString *v14; // rax char *v15; // rax size_t v16; // r8 int v17; // esi void **v18; // r14 unsigned __int64 v19; // rdi __int64 v20; // rbx void **v21; // rax cocos2d::CCLayerColor *DialogLayer; // rsi __int64 v23; // rcx __int64 v24; // rax __int64 v25; // rdi __int64 v26; // rbx __int64 v27; // rax void *v28; // rcx struct cocos2d::CCObject *v29; // rax __int64 v30; // rcx struct cocos2d::CCObject *v31; // rdi _QWORD *v32; // rbx cocos2d::CCObject *v33; // rcx __int64 v34; // rcx void (__fastcall **v35)(__int64, const char *); // rdi __int64 v36; // rbx unsigned int v37; // eax cocos2d::CCString *v38; // rax const char *CString; // rax __int16 v40; // [rsp+30h] [rbp-59h] BYREF char v41; // [rsp+32h] [rbp-57h] __int128 *v42; // [rsp+40h] [rbp-49h] BYREF void *v43; // [rsp+48h] [rbp-41h] BYREF __int128 v44; // [rsp+50h] [rbp-39h] BYREF unsigned __int64 v45; // [rsp+60h] [rbp-29h] __int64 v46; // [rsp+68h] [rbp-21h] _WORD v47[8]; // [rsp+70h] [rbp-19h] BYREF __int64 v48; // [rsp+80h] [rbp-9h] __int64 v49; // [rsp+88h] [rbp-1h] void *Block[2]; // [rsp+90h] [rbp+7h] BYREF unsigned __int64 v51; // [rsp+A0h] [rbp+17h] unsigned __int64 v52; // [rsp+A8h] [rbp+1Fh] v4 = qword_14090BFE0; if ( !qword_14090BFE0 ) { v42 = (__int128 *)operator new(0x3E8u); qword_14090BFE0 = sub_1402D6480((__int64)v42); (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0); v4 = qword_14090BFE0; } Stat = GameStatsManager::getStat(v4, &word_140737620); v6 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 56LL))(a2); v7 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 952LL))(a2); v8 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v7 + 56LL))(v7); v9 = qword_14090BFE0; if ( !qword_14090BFE0 ) { v42 = (__int128 *)operator new(0x3E8u); qword_14090BFE0 = sub_1402D6480((__int64)v42); (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0); v9 = qword_14090BFE0; } if ( v6 <= 6000 ) { if ( v6 <= 5000 ) { if ( v6 <= 4000 ) { if ( v6 <= 3000 ) { if ( v6 <= 2000 ) { v10 = 1; if ( v6 > 1000 ) v10 = 5; } else { v10 = 10; } } else { v10 = 25; } } else { v10 = 50; } } else { v10 = 100; } } else { v10 = 1; } if ( Stat >= v10 ) { if ( !v9 ) { v43 = operator new(0x3E8u); qword_14090BFE0 = sub_1402D6480((__int64)v43); (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0); v9 = qword_14090BFE0; } v29 = GameStatsManager::unlockSecretChest(v9, v6); v31 = v29; if ( v29 ) { *((_DWORD *)v29 + 14) = v8; SecretRewardsLayer::switchToOpenedState(v30, a2); v32 = RewardUnlockLayer::create(*((_DWORD *)v31 + 16), 0); (*(void (__fastcall **)(_QWORD *, _QWORD *, __int64))(*a1 + 456LL))(a1, v32, 100); v33 = (cocos2d::CCObject *)v32[88]; if ( v33 ) cocos2d::CCObject::release(v33); v32[88] = v31; cocos2d::CCObject::retain(v31); if ( !*((_BYTE *)v31 + 80) || *((_DWORD *)v31 + 16) == *((_DWORD *)v32 + 174) ) { (*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)v32[90] + 336LL))(v32[90], 0); (*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)v32[90] + 936LL))(v32[90], 0); (*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)v32[89] + 336LL))(v32[89], 0); *((_BYTE *)v32 + 700) = 1; if ( *((_BYTE *)v32 + 701) ) RewardUnlockLayer::playRewardEffect((cocos2d::CCNode *)v32); } v34 = qword_14090BFE0; if ( !qword_14090BFE0 ) { v43 = operator new(0x3E8u); qword_14090BFE0 = sub_1402D6480((__int64)v43); (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0); v34 = qword_14090BFE0; } v35 = *(void (__fastcall ***)(__int64, const char *))(a1[59] + 360LL); v36 = a1[59]; v37 = GameStatsManager::getStat(v34, &word_140737620); v38 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, v37); CString = cocos2d::CCString::getCString(v38); (*v35)(v36 + 360, CString); SecretRewardsLayer::updateUnlockedLabel(a1); } } else { v11 = v10 - Stat; *(_OWORD *)Block = 0; v51 = 0; v52 = 15; LOBYTE(Block[0]) = 0; if ( v10 == 1 ) { v12 = (char *)sub_14003D460(0x40u); v51 = 52; v52 = 63; strcpy(v12, "You need a key to unlock this chest."); v13 = 775840559; Block[0] = v12; } else { v14 = cocos2d::CCString::createWithFormat( "You need %i more keys to unlock this chest", v11); v15 = (char *)cocos2d::CCString::getCString(v14); v16 = -1; do ++v16; while ( v15[v16] ); sub_1400405A0(Block, v15, v16); v12 = (char *)Block[0]; } if ( v11 <= 50 ) { if ( v11 <= 25 ) { v17 = 2; if ( v11 > 10 ) v17 = 4; } else { v17 = 17; } } else { v17 = 18; } v42 = &v44; v40 = -1; v41 = -1; v44 = 0; v45 = 0; v46 = 0; v18 = Block; if ( v52 > 0xF ) v18 = (void **)v12; v19 = v51; v20 = 0x7FFFFFFFFFFFFFFFLL; if ( v51 > 0x7FFFFFFFFFFFFFFFLL ) sub_140009D90(v13); if ( v51 > 0xF ) { if ( (v51 | 0xF) <= 0x7FFFFFFFFFFFFFFFLL ) { v20 = v51 | 0xF; if ( (v51 | 0xF) < 0x16 ) v20 = 22; } *(_QWORD *)&v44 = sub_14003D460(v20 + 1); v45 = v19; v46 = v20; memcpy((void *)v44, v18, v19 + 1); } else { v45 = v51; v46 = 15; v44 = *(_OWORD *)v18; } v47[7] = 0; v48 = 13; v49 = 15; strcpy((char *)v47, "The Keymaster"); v21 = DialogObject::create((__int64)v47, (__int64)&v44, v17, 1.0, 0, (__int64)&v40); DialogLayer = DialogLayer::createDialogLayer((__int64)v21, 0, 2u); DialogLayer::addToMainScene((__int64)DialogLayer); v24 = cocos2d::CCDirector::sharedDirector(v23); cocos2d::CCDirector::getWinSize(v24, &v42); v25 = **((_QWORD **)DialogLayer + 70); v26 = *((_QWORD *)DialogLayer + 70); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v43, *(float *)&v42 * 0.5, *((float *)&v42 + 1) * 0.5); (*(void (__fastcall **)(__int64, __int64))(v25 + 184))(v26, v27); DialogLayer::animateInRandomSide(DialogLayer); if ( v52 > 0xF ) { v28 = Block[0]; if ( v52 + 1 >= 0x1000 ) { v28 = *((void **)Block[0] - 1); if ( (unsigned __int64)((char *)Block[0] - (char *)v28 - 8) > 0x1F ) invoke_watson(nullptr, nullptr, nullptr, 0, 0); } j_j_free(v28); } } }
GD Web Decomp Icon

GD Web Decomp

Raw Source