// // SecretRewardsLayer::onGoldChest from 0x1403d7390 to 0x1403d7a25 (1685 bytes) // // 2 xrefs: // > SecretRewardsLayer::init @ 0x1403d3b25 // > @ 0x1406d7db4 // // 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=8 void SecretRewardsLayer::onGoldChest(SecretRewardsLayer *a1, cocos2d::CCObject *a2) { GameStatsManager *v3; // rcx int Stat; // esi GameStatsManager *v5; // rdi int v6; // ebx GameStatsManager *v7; // rsi struct cocos2d::CCObject *v8; // rdi int v9; // eax cocos2d::CCString *v10; // rax const char *CString; // rax size_t v12; // r8 void *v13; // rcx RewardUnlockLayer *v14; // rbx cocos2d::CCObject *m_rewardItem; // rcx GameStatsManager *v16; // rcx cocos2d::CCLabelProtocol_vtbl *v17; // rbx int v18; // eax cocos2d::CCString *v19; // rax const char *v20; // rax int v21; // r8d FMODAudioEngine *v22; // rcx __int64 v23; // rbx struct cocos2d::CCDelayTime *v24; // rax struct cocos2d::CCSequence *v25; // rax cocos2d::ccColor3B *v26; // r8 int v27; // edi char *v28; // rax char *v29; // rsi __int64 v30; // rbx int v31; // r14d __int64 v32; // rdi char *v33; // rax DialogLayer *DialogLayer; // rdi __int64 v35; // rcx cocos2d::CCDirector *v36; // rax cocos2d::CCLayer_vtbl *v37; // rbx const cocos2d::CCPoint *v38; // rax float v39; // [rsp+20h] [rbp-59h] void *v40; // [rsp+30h] [rbp-49h] void *v41; // [rsp+30h] [rbp-49h] void *v42; // [rsp+30h] [rbp-49h] void *v43; // [rsp+30h] [rbp-49h] FMODAudioEngine *v44; // [rsp+30h] [rbp-49h] __int16 v45; // [rsp+40h] [rbp-39h] BYREF char v46; // [rsp+42h] [rbp-37h] __int128 v47; // [rsp+50h] [rbp-29h] BYREF __int64 v48; // [rsp+60h] [rbp-19h] __int64 v49; // [rsp+68h] [rbp-11h] void *Block[2]; // [rsp+78h] [rbp-1h] BYREF __int64 v51; // [rsp+88h] [rbp+Fh] unsigned __int64 v52; // [rsp+90h] [rbp+17h] __int128 v53; // [rsp+98h] [rbp+1Fh] __int64 v54; // [rsp+A8h] [rbp+2Fh] __int64 v55; // [rsp+B0h] [rbp+37h] v3 = (GameStatsManager *)qword_1406C2EE8; if ( !qword_1406C2EE8 ) { v40 = operator new(0x3E0u); qword_1406C2EE8 = sub_1401D0AE0((__int64)v40); (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8); v3 = (GameStatsManager *)qword_1406C2EE8; } Stat = GameStatsManager::getStat(v3, "43"); v5 = (GameStatsManager *)qword_1406C2EE8; if ( !qword_1406C2EE8 ) { v41 = operator new(0x3E0u); qword_1406C2EE8 = sub_1401D0AE0((__int64)v41); (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8); v5 = (GameStatsManager *)qword_1406C2EE8; } v6 = 6001; while ( GameStatsManager::isSecretChestUnlocked(v5, v6) ) { if ( ++v6 - 6001 >= 20 ) { v6 = 0; break; } } if ( Stat >= 1 && v6 ) { v7 = (GameStatsManager *)qword_1406C2EE8; if ( !qword_1406C2EE8 ) { v42 = operator new(0x3E0u); qword_1406C2EE8 = sub_1401D0AE0((__int64)v42); (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8); v7 = (GameStatsManager *)qword_1406C2EE8; } if ( !GameStatsManager::isSecretChestUnlocked(v7, v6) ) { v8 = cocos2d::CCDictionary::objectForKey(v7->m_allTreasureRoomChests, v6); if ( v8 ) { v9 = GameStatsManager::getStat(v7, "43"); if ( v9 >= 1 ) { GameStatsManager::setStat(v7, "43", v9 - 1); GameStatsManager::preProcessReward(v7, (GJRewardItem *)v8); GameStatsManager::registerRewardsFromItem(v7, (GJRewardItem *)v8); v10 = cocos2d::CCString::createWithFormat("%i", v6); CString = cocos2d::CCString::getCString(v10); *(_OWORD *)Block = 0; v51 = 0; v52 = 0; v12 = -1; do ++v12; while ( CString[v12] ); sub_14003A930(Block, CString, v12); cocos2d::CCDictionary::setObject(v7->m_treasureRoomChests, v8, Block); if ( v52 > 0xF ) { v13 = Block[0]; if ( v52 + 1 >= 0x1000 ) { v13 = *((void **)Block[0] - 1); if ( (unsigned __int64)((char *)Block[0] - (char *)v13 - 8) > 0x1F ) invalid_parameter_noinfo_noreturn(); } j_j_free(v13); } v14 = RewardUnlockLayer::create(v8[1].m_uID, nullptr); a1->addChild_0(a1, v14, 100); m_rewardItem = v14->m_rewardItem; if ( m_rewardItem ) cocos2d::CCObject::release(m_rewardItem); v14->m_rewardItem = (GJRewardItem *)v8; cocos2d::CCObject::retain(v8); if ( !LOBYTE(v8[1].m_uAutoReleaseCount) || v8[1].m_uID == v14->m_chestType ) { v14->m_closeBtn->setVisible(v14->m_closeBtn, 0); v14->m_closeBtn->setEnabled(v14->m_closeBtn, 0); v14->m_wrongLabel->setVisible(v14->m_wrongLabel, 0); v14->m_rewardCollected = 1; if ( v14->m_animationPlayed ) RewardUnlockLayer::playRewardEffect(v14); } v16 = (GameStatsManager *)qword_1406C2EE8; if ( !qword_1406C2EE8 ) { v43 = operator new(0x3E0u); qword_1406C2EE8 = sub_1401D0AE0((__int64)v43); (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8); v16 = (GameStatsManager *)qword_1406C2EE8; } v17 = a1->m_goldKeysLabel->__vftable; v18 = GameStatsManager::getStat(v16, "43"); v19 = cocos2d::CCString::createWithFormat("%i", v18); v20 = cocos2d::CCString::getCString(v19); v17->setString(&a1->m_goldKeysLabel->cocos2d::CCLabelProtocol, v20); SecretRewardsLayer::updateUnlockedGoldLabel(a1); v22 = (FMODAudioEngine *)qword_1406C2E88; if ( !qword_1406C2E88 ) { v44 = (FMODAudioEngine *)operator new(0x888u); qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v44); (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88); v22 = (FMODAudioEngine *)qword_1406C2E88; } FMODAudioEngine::fadeMusic(v22, 1.0, v21, 1.0, 0.2); v23 = cocos2d::CCCallFunc::create(a1, SecretRewardsLayer::fadeInOutMusic); v24 = cocos2d::CCDelayTime::create(3.2); v25 = cocos2d::CCSequence::create(v24, v23, 0); cocos2d::CCNode::runAction((CCLightFlash *)a1, (cocos2d::CCPoint)v25, v26, 1.0, v39); } } } } else { v27 = 1 - Stat; v53 = 0; v54 = 0; v28 = (char *)sub_14003AA10(0x40u); v29 = v28; v55 = 63; *(_QWORD *)&v53 = v28; if ( v6 ) { v30 = 57; strcpy(v28, "You need a Gold Key to unlock this chest."); } else { v30 = 58; strcpy(v28, "All out of Gold Chests right now. Come back later."); } v54 = v30; if ( v27 <= 50 ) { if ( v27 <= 25 ) { v31 = 2; if ( v27 > 10 ) v31 = 4; } else { v31 = 17; } } else { v31 = 18; } v45 = -1; v46 = -1; v47 = 0; v48 = 0; v32 = 0x7FFFFFFFFFFFFFFFLL; v49 = 15; if ( (v30 | 0xFuLL) <= 0x7FFFFFFFFFFFFFFFLL ) { v32 = v30 | 0xF; if ( (v30 | 0xFuLL) < 0x16 ) v32 = 22; } *(_QWORD *)&v47 = sub_14003AA10(v32 + 1); v48 = v30; v49 = v32; memcpy((void *)v47, v29, v30 + 1); v51 = 13; v52 = 15; strcpy((char *)Block, "The Keymaster"); HIWORD(Block[1]) = 0; v33 = DialogObject::create((__int64)Block, (__int64)&v47, v31, 1.0, 0, (__int64)&v45); DialogLayer = DialogLayer::createDialogLayer((DialogObject *)v33, nullptr, 2); DialogLayer::addToMainScene(DialogLayer); v36 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v35); cocos2d::CCDirector::getWinSize(v36); v37 = DialogLayer->m_mainLayer->__vftable; cocos2d::CCPoint::CCPoint(1.9431574e-19, COERCE_FLOAT(&v47) * 0.5); v37->setPosition_0(DialogLayer->m_mainLayer, v38); DialogLayer::animateInRandomSide(DialogLayer); j_j_free(v29); } }
GD Web Decomp Icon

GD Web Decomp

Raw Source