// // GJSmartTemplate::getRandomPrefab from 0x10000608c to 0x100006214 (392 bytes) // // 3 xrefs: // > GJSmartTemplate::scanForPrefab @ 0x100005e44 // > GJSmartTemplate::getPrefab @ 0x100006bf0 // > BrowseSmartTemplateLayer::addPrefabMenuItem @ 0x100071e48 // // 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 // __int64 __fastcall GJSmartTemplate::getRandomPrefab(__int64 a1, __int64 a2) { __int64 v4; // x0 __int64 v5; // x19 __int64 v6; // x21 int TotalChanceForPrefab; // w21 unsigned int v8; // w22 __int64 v9; // x20 int v10; // w23 float v11; // s8 void *v13[2]; // [xsp+0h] [xbp-80h] BYREF __int64 v14; // [xsp+10h] [xbp-70h] void *__p[2]; // [xsp+20h] [xbp-60h] BYREF __int64 v16; // [xsp+30h] [xbp-50h] if ( *(char *)(a2 + 23) < 0 ) { sub_1000097D0(__p, *(void **)a2); } else { *(_OWORD *)__p = *(_OWORD *)a2; v16 = *(_QWORD *)(a2 + 16); } v4 = cocos2d::CCDictionary::objectForKey_1(*(_QWORD *)(a1 + 56), __p); v5 = v4; if ( SHIBYTE(v16) < 0 ) { operator delete(__p[0]); if ( !v5 ) return 0; } else if ( !v4 ) { return 0; } if ( !(unsigned int)sub_10024A36C(v5) ) return 0; if ( (unsigned int)sub_10024A36C(v5) < 2 ) return sub_10024A388(v5, 0); if ( *(char *)(a2 + 23) < 0 ) { sub_1000097D0(v13, *(void **)a2); } else { *(_OWORD *)v13 = *(_OWORD *)a2; v14 = *(_QWORD *)(a2 + 16); } TotalChanceForPrefab = GJSmartTemplate::getTotalChanceForPrefab(a1, v13); if ( SHIBYTE(v14) < 0 ) operator delete(v13[0]); v8 = rand(); if ( !(unsigned int)sub_10024A36C(v5) ) return 0; v9 = 0; v10 = 0; v11 = vcvts_n_f32_s32(v8, 0x1Fu) * (float)TotalChanceForPrefab; while ( 1 ) { v6 = sub_10024A388(v5, v9); v10 += *(_DWORD *)(v6 + 108); if ( v11 <= (float)v10 || (_DWORD)v9 == (unsigned int)sub_10024A36C(v5) - 1 ) break; v9 = (unsigned int)(v9 + 1); if ( (unsigned int)v9 >= (unsigned int)sub_10024A36C(v5) ) return 0; } return v6; }
GD Web Decomp Icon

GD Web Decomp

Raw Source