// // GJSmartTemplate::getRandomPrefab from 0x539b3c to 0x539c22 (230 bytes) // // 3 xrefs: // > GJSmartTemplate::getPrefab @ 0x53a86e // > GJSmartTemplate::scanForPrefab @ 0x53c3c0 // > BrowseSmartTemplateLayer::addPrefabMenuItem @ 0x53ea94 // // 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 // int __fastcall GJSmartTemplate::getRandomPrefab(stl::StringData::Internal *a1) { cocos2d::CCArray *Prefabs; // r5 signed int TotalChanceForPrefab; // s16 unsigned int v4; // r6 int v5; // r8 float v6; // s16 int v7; // r4 std::string v9; // [sp+0h] [bp-8h] BYREF sub_775C20(&v9); Prefabs = (cocos2d::CCArray *)GJSmartTemplate::getPrefabs((int)a1, &v9); sub_774008(&v9); if ( !Prefabs || !cocos2d::CCArray::count(Prefabs) ) return 0; if ( cocos2d::CCArray::count(Prefabs) > 1u ) { sub_775C20(&v9); TotalChanceForPrefab = GJSmartTemplate::getTotalChanceForPrefab(a1, (stl::StringData::Internal *)&v9); sub_774008(&v9); v4 = 0; v5 = 0; v6 = vcvts_n_f32_s32(rand(), 0x1Fu) * (float)TotalChanceForPrefab; while ( v4 < cocos2d::CCArray::count(Prefabs) ) { v7 = cocos2d::CCArray::objectAtIndex(Prefabs, v4); v5 += *(_DWORD *)(v7 + 64); if ( (float)v5 >= v6 || v4 == cocos2d::CCArray::count(Prefabs) - 1 ) return v7; ++v4; } return 0; } return cocos2d::CCArray::objectAtIndex(Prefabs, 0); }
GD Web Decomp Icon

GD Web Decomp

Raw Source