// // GJSmartTemplate::getRandomPrefab from 0x66f4b0 to 0x66f596 (230 bytes) // // 3 xrefs: // > GJSmartTemplate::getPrefab @ 0x670f04 // > GJSmartTemplate::scanForPrefab @ 0x671c8a // > BrowseSmartTemplateLayer::addPrefabMenuItem @ 0x673bf4 // // 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:55:49 +0000 // int __fastcall GJSmartTemplate::getRandomPrefab(int a1, int a2) { cocos2d::CCArray *Prefabs; // r5 int v5; // r2 int v6; // r3 int TotalChanceForPrefab; // s16 unsigned int v8; // r6 int v9; // r8 float v10; // s16 int v11; // r4 int v13[3]; // [sp+0h] [bp-10h] BYREF std::string::basic_string(v13, a2); Prefabs = (cocos2d::CCArray *)GJSmartTemplate::getPrefabs(a1, (int)v13); std::string::~string((int)v13); if ( !Prefabs || !cocos2d::CCArray::count(Prefabs) ) return 0; if ( cocos2d::CCArray::count(Prefabs) > 1u ) { std::string::basic_string(v13, a2); TotalChanceForPrefab = GJSmartTemplate::getTotalChanceForPrefab(a1, (int)v13, v5, v6); std::string::~string((int)v13); v8 = 0; v9 = 0; v10 = vcvts_n_f32_s32(rand(), 0x1Fu) * (float)TotalChanceForPrefab; while ( v8 < cocos2d::CCArray::count(Prefabs) ) { v11 = cocos2d::CCArray::objectAtIndex(Prefabs, v8); v9 += *(_DWORD *)(v11 + 80); if ( (float)v9 >= v10 || v8 == cocos2d::CCArray::count(Prefabs) - 1 ) return v11; ++v8; } return 0; } return cocos2d::CCArray::objectAtIndex(Prefabs, 0); }
GD Web Decomp Icon

GD Web Decomp

Raw Source