// // SecretRewardsLayer::onSelectItem from 0x1403d6140 to 0x1403d66c8 (1416 bytes) // // 2 xrefs: // > SecretRewardsLayer::generateChestItems @ 0x1403d5e8a // > @ 0x1406d7d3c // // 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 // // Hidden C++ exception states: #wind=6 void SecretRewardsLayer::onSelectItem(SecretRewardsLayer *a1, cocos2d::CCObject *a2) { GameStatsManager *v4; // rcx int Stat; // r15d int v6; // ebx __int64 v7; // rax int v8; // r12d GameStatsManager *v9; // rcx int v10; // eax int v11; // edi __int64 v12; // rdx __int64 v13; // rcx char *v14; // rsi __int64 v15; // r8 __int64 v16; // r9 unsigned __int64 v17; // rbx unsigned __int64 v18; // r15 cocos2d::CCString *v19; // rax char *v20; // rax size_t v21; // r8 int v22; // r14d char *v23; // r12 __int64 v24; // rdi char *v25; // rax DialogLayer *DialogLayer; // rdi __int64 v27; // rcx cocos2d::CCDirector *v28; // rax cocos2d::CCLayer_vtbl *v29; // rbx const cocos2d::CCPoint *v30; // rax char *v31; // rax GJRewardItem *v32; // rax SecretRewardsLayer *v33; // rcx GJRewardItem *v34; // rdi RewardUnlockLayer *v35; // rbx cocos2d::CCObject *m_rewardItem; // rcx GameStatsManager *v37; // rcx cocos2d::CCLabelProtocol_vtbl *v38; // rbx int v39; // eax cocos2d::CCString *v40; // rax const char *CString; // rax __int16 v42; // [rsp+30h] [rbp-69h] BYREF char v43; // [rsp+32h] [rbp-67h] __int128 *v44; // [rsp+40h] [rbp-59h] void *v45; // [rsp+48h] [rbp-51h] __int128 v46; // [rsp+50h] [rbp-49h] BYREF unsigned __int64 v47; // [rsp+60h] [rbp-39h] __int64 v48; // [rsp+68h] [rbp-31h] _WORD v49[8]; // [rsp+70h] [rbp-29h] BYREF __int64 v50; // [rsp+80h] [rbp-19h] __int64 v51; // [rsp+88h] [rbp-11h] __int128 v52; // [rsp+90h] [rbp-9h] BYREF __int64 v53; // [rsp+A0h] [rbp+7h] __int64 v54; // [rsp+A8h] [rbp+Fh] v4 = (GameStatsManager *)qword_1406C2EE8; if ( !qword_1406C2EE8 ) { v44 = (__int128 *)operator new(0x3E0u); qword_1406C2EE8 = sub_1401D0AE0((__int64)v44); (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8); v4 = (GameStatsManager *)qword_1406C2EE8; } Stat = GameStatsManager::getStat(v4, (const char *)&word_140543238); v6 = a2->getTag(a2); v7 = ((__int64 (__fastcall *)(cocos2d::CCObject *))a2->__vftable[13].copyWithZone)(a2); v8 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v7 + 56LL))(v7); v9 = (GameStatsManager *)qword_1406C2EE8; if ( !qword_1406C2EE8 ) { v44 = (__int128 *)operator new(0x3E0u); qword_1406C2EE8 = sub_1401D0AE0((__int64)v44); (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8); v9 = (GameStatsManager *)qword_1406C2EE8; } 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 ) { v45 = operator new(0x3E0u); qword_1406C2EE8 = sub_1401D0AE0((__int64)v45); (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8); v9 = (GameStatsManager *)qword_1406C2EE8; } v32 = GameStatsManager::unlockSecretChest(v9, v6); v34 = v32; if ( v32 ) { v32->m_chestID = v8; SecretRewardsLayer::switchToOpenedState(v33, (CCMenuItemSpriteExtra *)a2); v35 = RewardUnlockLayer::create(v34->m_rewardType, nullptr); a1->addChild_0(a1, v35, 100); m_rewardItem = v35->m_rewardItem; if ( m_rewardItem ) cocos2d::CCObject::release(m_rewardItem); v35->m_rewardItem = v34; cocos2d::CCObject::retain(v34); if ( !v34->m_unk || v34->m_rewardType == v35->m_chestType ) { v35->m_closeBtn->setVisible(v35->m_closeBtn, 0); v35->m_closeBtn->setEnabled(v35->m_closeBtn, 0); v35->m_wrongLabel->setVisible(v35->m_wrongLabel, 0); v35->m_rewardCollected = 1; if ( v35->m_animationPlayed ) RewardUnlockLayer::playRewardEffect(v35); } v37 = (GameStatsManager *)qword_1406C2EE8; if ( !qword_1406C2EE8 ) { v45 = operator new(0x3E0u); qword_1406C2EE8 = sub_1401D0AE0((__int64)v45); (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8); v37 = (GameStatsManager *)qword_1406C2EE8; } v38 = a1->m_keysLabel->__vftable; v39 = GameStatsManager::getStat(v37, (const char *)&word_140543238); v40 = cocos2d::CCString::createWithFormat("%i", v39); CString = cocos2d::CCString::getCString(v40); v38->setString(&a1->m_keysLabel->cocos2d::CCLabelProtocol, CString); SecretRewardsLayer::updateUnlockedLabel(a1); } } else { v11 = v10 - Stat; v52 = 0; v53 = 0; v54 = 15; LOBYTE(v52) = 0; if ( v10 == 1 ) { v14 = (char *)sub_14003AA10(0x40u); v17 = 52; v53 = 52; v18 = 63; v54 = 63; strcpy(v14, "You need a key to unlock this chest."); *(_QWORD *)&v52 = v14; } else { v19 = cocos2d::CCString::createWithFormat( "You need %i more keys to unlock this chest", v11); v20 = (char *)cocos2d::CCString::getCString(v19); v21 = -1; do ++v21; while ( v20[v21] ); sub_14003CCE0((void **)&v52, v20, v21); v18 = v54; v17 = v53; v14 = (char *)v52; } if ( v11 <= 50 ) { if ( v11 <= 25 ) { v22 = 2; if ( v11 > 10 ) v22 = 4; } else { v22 = 17; } } else { v22 = 18; } v44 = &v46; v42 = -1; v43 = -1; v46 = 0; v47 = 0; v48 = 0; v23 = (char *)&v52; if ( v18 > 0xF ) v23 = v14; v24 = 0x7FFFFFFFFFFFFFFFLL; if ( v17 > 0x7FFFFFFFFFFFFFFFLL ) sub_140007B50(v13, v12, v15, v16); v48 = 15; if ( v17 > 0xF ) { if ( (v17 | 0xF) <= 0x7FFFFFFFFFFFFFFFLL ) { v24 = v17 | 0xF; if ( (v17 | 0xF) < 0x16 ) v24 = 22; } *(_QWORD *)&v46 = sub_14003AA10(v24 + 1); v47 = v17; v48 = v24; memcpy((void *)v46, v23, v17 + 1); } else { v47 = v17; v46 = *(_OWORD *)v23; } v49[7] = 0; v50 = 13; v51 = 15; strcpy((char *)v49, "The Keymaster"); v25 = DialogObject::create((__int64)v49, (__int64)&v46, v22, 1.0, 0, (__int64)&v42); DialogLayer = DialogLayer::createDialogLayer((DialogObject *)v25, nullptr, 2); DialogLayer::addToMainScene(DialogLayer); v28 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v27); cocos2d::CCDirector::getWinSize(v28); v29 = DialogLayer->m_mainLayer->__vftable; cocos2d::CCPoint::CCPoint(1.9431574e-19, *(float *)&v44 * 0.5); v29->setPosition_0(DialogLayer->m_mainLayer, v30); DialogLayer::animateInRandomSide(DialogLayer); if ( v18 > 0xF ) { v31 = v14; if ( v18 + 1 >= 0x1000 ) { v14 = *((char **)v14 - 1); if ( (unsigned __int64)(v31 - v14 - 8) > 0x1F ) invalid_parameter_noinfo_noreturn(); } j_j_free(v14); } } }
GD Web Decomp Icon

GD Web Decomp

Raw Source