// // SecretRewardsLayer::generateChestItems from 0x6cf4b0 to 0x6cfaca (1562 bytes) // // 1 xrefs: // > SecretRewardsLayer::createSecondaryLayer @ 0x6cfd02 // // This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False! // // 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:57:02 +0000 // cocos2d::CCArray *__fastcall SecretRewardsLayer::generateChestItems(SecretRewardsLayer *this, GJChestSprite *a2) { GameStatsManager *v2; // r0 cocos2d::CCArray *v3; // r0 char *v4; // r3 int v5; // r8 int v6; // r1 int v7; // r7 int v8; // r4 size_t v9; // r0 const char *v10; // r11 size_t v11; // r0 int v12; // r11 int v13; // r3 unsigned int ***v14; // r12 _DWORD *v15; // r0 unsigned int *v16; // r4 int v17; // r11 signed int v18; // r3 unsigned int *v19; // r3 unsigned int v20; // r3 _DWORD *v21; // r0 int v22; // r1 cocos2d::CCArray *v23; // r11 cocos2d::CCLayer *v24; // r0 cocos2d::CCObject *v25; // r10 cocos2d::CCMenu *v26; // r4 int v27; // r9 unsigned int v28; // r0 unsigned int **v29; // r4 int v30; // r3 unsigned int *v31; // r3 unsigned int *v32; // r5 unsigned int *v33; // r0 unsigned int v34; // r2 int v35; // r5 int v36; // r0 char *v37; // r4 char *v38; // r5 int v39; // r6 int *v40; // r3 size_t v41; // r4 GameStatsManager *v42; // r0 int v43; // r1 cocos2d::CCSprite *v44; // r7 unsigned __int8 *v45; // r4 void (__fastcall *v46)(unsigned __int8 *, _DWORD *); // r8 void (__fastcall *v47)(cocos2d::CCSprite *, _DWORD *); // r8 float v48; // s16 int v49; // r0 signed int v50; // r6 float v51; // r0 int v52; // r5 void (__fastcall *v53)(unsigned __int8 *, _DWORD *); // r6 int v54; // r7 int v56; // [sp+8h] [bp-294h] int v57; // [sp+8h] [bp-294h] int v58; // [sp+Ch] [bp-290h] unsigned int v59; // [sp+10h] [bp-28Ch] unsigned int v60; // [sp+10h] [bp-28Ch] unsigned int v61; // [sp+10h] [bp-28Ch] int v62; // [sp+14h] [bp-288h] cocos2d::CCArray *v63; // [sp+18h] [bp-284h] cocos2d::CCArray *v64; // [sp+18h] [bp-284h] int isSecretChestUnlocked; // [sp+24h] [bp-278h] int v68; // [sp+30h] [bp-26Ch] BYREF float v69[2]; // [sp+34h] [bp-268h] BYREF char v70[8]; // [sp+3Ch] [bp-260h] BYREF _DWORD v71[2]; // [sp+44h] [bp-258h] BYREF _DWORD v72[2]; // [sp+4Ch] [bp-250h] BYREF _DWORD v73[2]; // [sp+54h] [bp-248h] BYREF _DWORD v74[2]; // [sp+5Ch] [bp-240h] BYREF void *v75; // [sp+64h] [bp-238h] BYREF char *v76; // [sp+68h] [bp-234h] char *v77; // [sp+6Ch] [bp-230h] unsigned int **v78; // [sp+70h] [bp-22Ch] BYREF unsigned int *v79; // [sp+74h] [bp-228h] BYREF int v80; // [sp+78h] [bp-224h] int v81[2]; // [sp+7Ch] [bp-220h] BYREF const char *v82; // [sp+84h] [bp-218h] int v83[3]; // [sp+88h] [bp-214h] BYREF int v84; // [sp+94h] [bp-208h] BYREF unsigned int v85; // [sp+98h] [bp-204h] void *v86; // [sp+9Ch] [bp-200h] _BYTE v87[500]; // [sp+A0h] [bp-1FCh] BYREF cocos2d::CCDirector::sharedDirector(this); cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v69); v2 = (GameStatsManager *)cocos2d::CCPoint::CCPoint( (cocos2d::CCPoint *)v70, v69[0] * 0.5, (float)(v69[1] * 0.5) + 80.0); v3 = (cocos2d::CCArray *)GameStatsManager::sharedState(v2); v78 = &v79; v75 = nullptr; v76 = nullptr; v77 = nullptr; v79 = nullptr; v80 = 0; v56 = *((_DWORD *)v3 + 122); if ( (unsigned int)a2 - 3 > 5 ) { v6 = 0; v5 = 0; } else { v4 = (char *)&unk_BEFE20 + 2 * ((_DWORD)a2 - 3); v5 = *((__int16 *)v4 + 10); v6 = *((__int16 *)v4 + 16); } v58 = v6 + 1; v7 = v6 + 1; v62 = v6 + v5; while ( v7 <= v62 ) { v84 = 0; v85 = 500; v86 = v87; v73[0] = v7; v71[0] = v7; fmt::BasicWriter::FormatInt,char>>((unsigned int *)&v84, v7); v8 = v84; if ( v84 + 1 > v85 ) fmt::internal::Array::grow((int)&v84, v84 + 1); *((_BYTE *)v86 + v8) = 0; v81[0] = 0; v81[1] = 0; v82 = nullptr; v9 = strlen((const char *)v86); std::string::__init(v81, v86, v9); if ( (v81[0] & 1) != 0 ) v10 = v82; else v10 = (char *)v81 + 1; memset(v83, 0, sizeof(v83)); v11 = strlen(v10); std::string::__init(v83, v10, v11); v12 = cocos2d::CCDictionary::objectForKey(v56, v83); std::string::~string((int)v83); if ( v12 ) { v13 = *(_DWORD *)(v12 + 52); if ( v13 > v5 || v13 < 0 ) *(_DWORD *)(v12 + 52) = 1; v74[0] = *(_DWORD *)(v12 + 52); if ( std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::__count_unique( &v78, v74) ) { v14 = &v78; for ( v74[0] = 1; v74[0] <= v5; v74[0] = (char *)v63 + 1 ) { v63 = (cocos2d::CCArray *)v74[0]; v59 = (unsigned int)v14; v15 = std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::__count_unique( v14, v74); v14 = (unsigned int ***)v59; if ( !v15 ) { *(_DWORD *)(v12 + 52) = v63; break; } } } v16 = v79; v17 = *(_DWORD *)(v12 + 52); if ( v79 ) { while ( 1 ) { v18 = v16[4]; if ( v17 >= v18 ) { if ( v18 >= v17 ) { v72[0] = v16; v16 = v72; goto LABEL_30; } v19 = (unsigned int *)v16[1]; if ( !v19 ) { v72[0] = v16++; goto LABEL_30; } } else { v19 = (unsigned int *)*v16; if ( !*v16 ) goto LABEL_29; } v16 = v19; } } v16 = (unsigned int *)&v79; LABEL_29: v72[0] = v16; LABEL_30: v20 = *v16; if ( !*v16 ) { v21 = (_DWORD *)operator new(0x18u); v21[4] = v17; v21[5] = 0; v22 = v72[0]; *v21 = 0; v21[1] = 0; v21[2] = v22; *v16 = (unsigned int)v21; if ( *v78 ) v78 = (unsigned int **)*v78; v60 = (unsigned int)v21; std::__tree_balance_after_insert *>(v79, (_DWORD *)*v16); v20 = v60; ++v80; } *(_DWORD *)(v20 + 20) = v73[0]; } else if ( v76 == v77 ) { std::vector::__push_back_slow_path((int)&v75, v73); } else { if ( v76 ) *(_DWORD *)v76 = v73[0]; v76 += 4; } std::string::~string((int)v81); v3 = (cocos2d::CCArray *)v86; if ( v86 != v87 ) { if ( v86 ) operator delete[](v86); } ++v7; } v23 = (cocos2d::CCArray *)cocos2d::CCArray::create(v3); v57 = 0; v64 = (cocos2d::CCArray *)cocos2d::CCArray::create(v23); while ( v58 <= v62 ) { v61 = (int)floorf((float)v57 / 12.0); v24 = (cocos2d::CCLayer *)cocos2d::CCArray::count(v23); if ( (unsigned int)v24 <= v61 ) { v26 = (cocos2d::CCMenu *)cocos2d::CCLayer::create(v24); v25 = (cocos2d::CCObject *)cocos2d::CCMenu::create(v26); (*(void (__fastcall **)(cocos2d::CCMenu *, cocos2d::CCObject *))(*(_DWORD *)v26 + 228))(v26, v25); cocos2d::CCArray::addObject(v23, v26); cocos2d::CCArray::addObject(v64, v25); } else { cocos2d::CCArray::objectAtIndex(v23, v61); v25 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(v64, v61); } v27 = v57 + 1; v68 = v57 + 1; v28 = (unsigned int)std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::__count_unique( &v78, &v68); if ( v28 ) { v29 = (unsigned int **)v79; if ( v79 ) { while ( 1 ) { v30 = (int)v29[4]; if ( v27 >= v30 ) { if ( v30 >= v27 ) { v73[0] = v29; v29 = (unsigned int **)v73; goto LABEL_60; } v31 = v29[1]; if ( !v31 ) { v73[0] = v29++; goto LABEL_60; } } else { v31 = *v29; if ( !*v29 ) { v73[0] = v29; goto LABEL_60; } } v29 = (unsigned int **)v31; } } v29 = &v79; v73[0] = &v79; LABEL_60: v32 = *v29; if ( !*v29 ) { v33 = (unsigned int *)operator new(0x18u); v33[4] = v27; v33[5] = 0; v34 = v73[0]; v32 = v33; *v33 = 0; v33[1] = 0; v33[2] = v34; *v29 = v33; if ( *v78 ) v78 = (unsigned int **)*v78; v28 = (unsigned int)std::__tree_balance_after_insert *>(v79, *v29); ++v80; } v35 = v32[5]; } else { v35 = (v76 - (_BYTE *)v75) >> 2; if ( v35 ) { v36 = rand(); v37 = v76; v38 = (char *)v75; v39 = (v76 - (_BYTE *)v75) >> 2; v28 = (int)floorf((float)((float)v36 * 4.6566e-10) * (float)(unsigned int)v39); if ( v39 - 1 <= v28 ) { if ( v39 == 1 ) v28 = 0; else v28 = v39 - 1; } v40 = (int *)&v38[4 * v28]; v35 = *v40; v41 = v37 - (char *)(v40 + 1); if ( v41 >> 2 ) { v28 = (unsigned int)memmove(v40, v40 + 1, v41); v40 = (int *)v28; } v76 -= 4 * ((unsigned int)(v76 - ((char *)v40 + v41)) >> 2); } } v42 = (GameStatsManager *)GameStatsManager::sharedState((GameStatsManager *)v28); isSecretChestUnlocked = GameStatsManager::isSecretChestUnlocked(v42, (const char *)v35); v44 = GJChestSprite::create(a2, v43); GJChestSprite::switchToState(v44, 2, 0); (*(void (__fastcall **)(cocos2d::CCSprite *, int))(*(_DWORD *)v44 + 80))(v44, 1057803469); v74[1] = 0; v74[0] = SecretRewardsLayer::onSelectItem; v45 = (unsigned __int8 *)CCMenuItemSpriteExtra::create( (int)v44, 0, (int)this, (int)SecretRewardsLayer::onSelectItem, 0); v84 = 0; v85 = 0; v86 = nullptr; std::string::__init(&v84, "chestClick.ogg", 0xEu); std::string::operator=(v45 + 340, (unsigned __int8 *)&v84); std::string::~string((int)&v84); v46 = *(void (__fastcall **)(unsigned __int8 *, _DWORD *))(*(_DWORD *)v45 + 160); cocos2d::CCSize::CCSize((cocos2d::CCSize *)v73, 55.0, 44.0); v46(v45, v73); v47 = *(void (__fastcall **)(cocos2d::CCSprite *, _DWORD *))(*(_DWORD *)v44 + 92); v48 = *(float *)(*(int (__fastcall **)(unsigned __int8 *))(*(_DWORD *)v45 + 164))(v45); v49 = (*(int (__fastcall **)(unsigned __int8 *))(*(_DWORD *)v45 + 164))(v45); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v73, v48 * 0.5, *(float *)(v49 + 4) * 0.5); v47(v44, v73); (*(void (__fastcall **)(cocos2d::CCObject *, unsigned __int8 *))(*(_DWORD *)v25 + 228))(v25, v45); (*(void (__fastcall **)(unsigned __int8 *, int))(*(_DWORD *)v45 + 36))(v45, v35); (*(void (__fastcall **)(cocos2d::CCSprite *, int))(*(_DWORD *)v44 + 36))(v44, v27); v50 = v57 - 12 * v61; v51 = floorf((float)(v50 / 4)); v52 = v50 % 4; v53 = *(void (__fastcall **)(unsigned __int8 *, _DWORD *))(*(_DWORD *)v45 + 92); v54 = (int)v51; cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v71, v25); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v72, (float)((float)v52 - 1.5) * 90.0, (float)-v54 * 80.0); cocos2d::CCPoint::operator+(v73, v71, v72); v53(v45, v73); if ( isSecretChestUnlocked ) SecretRewardsLayer::switchToOpenedState(this, (CCMenuItemSpriteExtra *)v45); ++v57; ++v58; } std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::destroy( (int)&v78, v79); if ( v75 ) { v76 -= 4 * ((unsigned int)(v76 - (_BYTE *)v75) >> 2); operator delete(v75); } return v23; }
GD Web Decomp Icon

GD Web Decomp

Raw Source