// // SecretRewardsLayer::generateChestItems from 0x1002ead0c to 0x1002eb360 (1620 bytes) // // 1 xrefs: // > SecretRewardsLayer::createSecondaryLayer @ 0x1002eac30 // // 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 // cocos2d::CCArray *__fastcall SecretRewardsLayer::generateChestItems(SecretRewardsLayer *a1, int a2) { cocos2d::CCDirector *v2; // x0 __n128 v3; // q0 __n128 v4; // q1 cocos2d::CCDictionary *m_treasureRoomChests; // x21 unsigned int v6; // w25 unsigned int v7; // w19 unsigned int v8; // w26 __int64 v9; // x23 __int128 v10; // kr10_16 char *v11; // x1 __int64 v12; // x0 __int64 v13; // x24 int v14; // w8 _QWORD *v15; // x10 int v16; // w11 int v17; // w10 _QWORD *v18; // x11 int v19; // w12 unsigned int v21; // w24 bool v22; // cf cocos2d::CCArray *v23; // x21 unsigned int v24; // w20 unsigned int v25; // w26 cocos2d::CCNode *v26; // x27 cocos2d::CCLayer *v27; // x23 _QWORD *i; // x8 signed int v29; // w9 unsigned int v30; // w0 __int64 v31; // x11 signed int v32; // w12 unsigned __int64 v33; // x11 signed int v34; // w10 unsigned int *v35; // x23 __int64 v36; // x25 signed __int64 v37; // x24 GameStatsManager *v38; // x0 _BOOL4 isSecretChestUnlocked; // w28 GJChestSprite *v40; // x24 CCMenuItemSpriteExtra *v41; // x23 float v42; // s12 __int64 v43; // x0 __n128 v44; // q0 __n128 v45; // q1 signed int v46; // w8 int v47; // w9 __n128 v48; // q0 __n128 v49; // q1 double v50; // d0 SecretRewardsLayer *v51; // x0 cocos2d::CCObject *v54; // [xsp+10h] [xbp-360h] unsigned int v56; // [xsp+2Ch] [xbp-344h] std::string __str; // [xsp+30h] [xbp-340h] BYREF int v58; // [xsp+4Ch] [xbp-324h] BYREF void *__p[2]; // [xsp+50h] [xbp-320h] BYREF char v60; // [xsp+67h] [xbp-309h] void *v61[2]; // [xsp+68h] [xbp-308h] BYREF char v62; // [xsp+7Fh] [xbp-2F1h] unsigned int v63; // [xsp+84h] [xbp-2ECh] BYREF _QWORD **v64; // [xsp+88h] [xbp-2E8h] BYREF _QWORD *v65[2]; // [xsp+90h] [xbp-2E0h] BYREF void *v66; // [xsp+A0h] [xbp-2D0h] BYREF unsigned int *v67; // [xsp+A8h] [xbp-2C8h] __int64 v68; // [xsp+B0h] [xbp-2C0h] cocos2d::CCPoint v69; // [xsp+BCh] [xbp-2B4h] BYREF float v70; // [xsp+C4h] [xbp-2ACh] float v71; // [xsp+C8h] [xbp-2A8h] __int128 v72; // [xsp+D0h] [xbp-2A0h] BYREF char *__s; // [xsp+E0h] [xbp-290h] _BYTE v74[504]; // [xsp+E8h] [xbp-288h] BYREF cocos2d::SEL_MenuHandler v75; // 0:x3.16 v2 = cocos2d::CCDirector::sharedDirector(); cocos2d::CCDirector::getWinSize(v2); v3.n128_f32[0] = v70 * 0.5; v4.n128_f32[0] = (float)(v71 * 0.5) + 80.0; sub_100022980(v3, v4, &v69); m_treasureRoomChests = GameStatsManager::sharedState()->m_treasureRoomChests; v66 = nullptr; v67 = nullptr; v68 = 0; v65[0] = nullptr; v65[1] = nullptr; v6 = a2 - 3; v64 = v65; if ( (unsigned int)(a2 - 3) <= 5 ) { v8 = dword_100644AD0[v6]; v7 = (1000 * v6) | 1; v56 = v8 + 1000 * v6; v9 = v7; while ( 1 ) { v63 = v9; v72 = xmmword_1006350E0; __s = v74; LODWORD(v61[0]) = v9; sub_100009A40((int)&v72, v9, (int)v61); v10 = v72; if ( *((_QWORD *)&v72 + 1) < (unsigned __int64)(v72 + 1) ) sub_100009ED4((__int64)&v72, v72 + 1); __s[v10] = 0; sub_100009900(v61, __s); if ( v62 >= 0 ) v11 = (char *)v61; else v11 = (char *)v61[0]; sub_100009900(__p, v11); v12 = cocos2d::CCDictionary::objectForKey_1(m_treasureRoomChests, __p); v13 = v12; if ( v60 < 0 ) { operator delete(__p[0]); if ( !v13 ) { LABEL_21: sub_10000CBA8((__int64)&v66, (int *)&v63); goto LABEL_33; } } else if ( !v12 ) { goto LABEL_21; } v14 = *(_DWORD *)(v13 + 56); if ( v14 > v8 ) { v14 = 1; *(_DWORD *)(v13 + 56) = 1; } if ( v65[0] ) { v15 = v65[0]; while ( 1 ) { v16 = *((_DWORD *)v15 + 7); if ( v14 >= v16 ) break; LABEL_18: v15 = (_QWORD *)*v15; if ( !v15 ) goto LABEL_19; } if ( v16 < v14 ) { ++v15; goto LABEL_18; } v17 = 1; LABEL_23: v18 = v65[0]; while ( 1 ) { v19 = *((_DWORD *)v18 + 7); if ( v17 >= v19 ) { if ( v19 >= v17 ) { if ( v17++ == v8 ) break; goto LABEL_23; } ++v18; } v18 = (_QWORD *)*v18; if ( !v18 ) { *(_DWORD *)(v13 + 56) = v17; goto LABEL_32; } } } LABEL_19: v17 = v14; LABEL_32: v21 = v63; v58 = v17; __p[0] = &v58; *((_DWORD *)sub_1001A6048((__int64)&v64, &v58, (__int64)&unk_100644AB3, (unsigned int **)__p) + 8) = v21; LABEL_33: if ( v62 < 0 ) operator delete(v61[0]); if ( __s != v74 && __s ) operator delete[](__s); v22 = (unsigned int)v9 >= v56; v9 = (unsigned int)(v9 + 1); if ( v22 ) goto LABEL_40; } } v56 = 0; v7 = 1; LABEL_40: v23 = (cocos2d::CCArray *)sub_10024A15C(); v54 = sub_10024A15C(); if ( v6 <= 5 ) { v24 = 0; do { v25 = vcvtms_s32_f32((float)v24 / 12.0); if ( (unsigned int)sub_10024A36C((__int64)v23) <= v25 ) { v27 = cocos2d::CCLayer::create(); v26 = cocos2d::CCMenu::create(); ((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCNode *))v27->addChild)(v27, v26); sub_10024A2D0((__int64)v23); sub_10024A2D0((__int64)v54); } else { sub_10024A388((__int64)v23, v25); v26 = (cocos2d::CCNode *)sub_10024A388((__int64)v54, v25); } v63 = v24 + 1; for ( i = v65[0]; i; i = (_QWORD *)*i ) { v29 = *((_DWORD *)i + 7); if ( (int)(v24 + 1) >= v29 ) { if ( v29 > (int)v24 ) { *(_QWORD *)&v72 = &v63; v36 = *((unsigned int *)sub_1001A6048( (__int64)&v64, (int *)&v63, (__int64)&unk_100644AB3, (unsigned int **)&v72) + 8); goto LABEL_60; } ++i; } } if ( v67 == v66 ) { v36 = 0; } else { v30 = rand(); v31 = ((char *)v67 - (_BYTE *)v66) >> 2; v32 = vcvtms_s32_f32(vcvts_n_f32_s32(v30, 0x1Fu) * (float)(unsigned __int64)v31); v33 = v31 - 1; v34 = ((unsigned __int64)((char *)v67 - (_BYTE *)v66) >> 2) - 1; if ( !v33 ) v34 = 0; if ( v33 > v32 ) v34 = v32; v35 = (unsigned int *)((char *)v66 + 4 * v34); v36 = *v35; v37 = (char *)v67 - (char *)(v35 + 1); if ( v67 != v35 + 1 ) memmove((char *)v66 + 4 * v34, v35 + 1, (char *)v67 - (char *)(v35 + 1)); v67 = (unsigned int *)((char *)v35 + v37); } LABEL_60: v38 = GameStatsManager::sharedState(); isSecretChestUnlocked = GameStatsManager::isSecretChestUnlocked(v38, v36); v40 = GJChestSprite::create(a2); GJChestSprite::switchToState(v40, Closed, 0); ((void (__fastcall *)(GJChestSprite *, float))v40->setScale)(v40, 0.55); v75.ptr = (void (__cdecl *)(cocos2d::CCObject *))SecretRewardsLayer::onSelectItem; v75.adj = 0; v41 = CCMenuItemSpriteExtra::create(v40, nullptr, a1, v75); sub_100009900(&__str, "chestClick.ogg"); std::string::operator=((std::string *)&v41->m_selectSound, &__str); if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 ) operator delete(__str.__r_.__value_.__l.__data_); sub_100022988((float *)&v72, 55.0, 44.0); ((void (__fastcall *)(CCMenuItemSpriteExtra *, __int128 *))v41->setContentSize)(v41, &v72); v42 = *(float *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v41->getContentSize)(v41); v43 = ((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v41->getContentSize)(v41); v44.n128_f32[0] = v42 * 0.5; v45.n128_f32[0] = *(float *)(v43 + 4) * 0.5; sub_100022980(v44, v45, &v72); ((void (__fastcall *)(GJChestSprite *, __int128 *))v40->setPosition)(v40, &v72); ((void (__fastcall *)(cocos2d::CCNode *, CCMenuItemSpriteExtra *))v26->addChild)(v26, v41); ((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v41->setTag)(v41, v36); ((void (__fastcall *)(GJChestSprite *, _QWORD))v40->setTag)(v40, v63); cocos2d::CCNode::convertToNodeSpace(v26, &v69); v46 = v24 - 12 * v25; v48.n128_f32[0] = (float)((float)(int)(v46 - (v47 & 0xFFFFFFFC)) + -1.5) * 90.0; v49.n128_f32[0] = (float)-(int)(float)(v46 / 4) * 80.0; sub_100022980(v48, v49, __p); *(float32x2_t *)&v50 = sub_1000229DC((float32x2_t *)v61, (float32x2_t *)__p, (float32x2_t *)&v72); v51 = (SecretRewardsLayer *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *, __int128 *, double))v41->setPosition)( v41, &v72, v50); if ( isSecretChestUnlocked ) SecretRewardsLayer::switchToOpenedState(v51, v41); ++v24; v22 = v7++ >= v56; } while ( !v22 ); } sub_100017D70((__int64)&v64, v65[0]); if ( v66 ) { v67 = (unsigned int *)v66; operator delete(v66); } return v23; }
GD Web Decomp Icon

GD Web Decomp

Raw Source