// // GJSmartTemplate::getRandomPrefab from 0xb0d484 to 0xb0d66c (488 bytes) // // 4 xrefs: // > GJSmartTemplate::getPrefab @ 0xb10cc0 // > GJSmartTemplate::scanForPrefab @ 0xb12924 // > BrowseSmartTemplateLayer::addPrefabMenuItem @ 0xb177ac // > @ 0xd9198 // // This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True! // // 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 13:01:26 +0000 // __int64 __fastcall GJSmartTemplate::getRandomPrefab(__int64 a1, char *a2) { char v4; // w0 __int64 v5; // x0 __int64 v6; // x1 cocos2d::CCArray *Prefabs; // x22 char v9; // w0 __int64 v10; // x0 __int64 v11; // x1 int TotalChanceForPrefab; // w24 unsigned int v13; // w19 int v14; // w21 float v15; // s8 __int64 v16; // x20 __int64 v17; // [xsp+50h] [xbp+50h] BYREF __int64 v18; // [xsp+58h] [xbp+58h] void *v19; // [xsp+60h] [xbp+60h] v17 = 0; v4 = *a2; v18 = 0; v19 = nullptr; if ( (v4 & 1) != 0 ) { std::string::__init(&v17, *((void **)a2 + 2), *((_QWORD *)a2 + 1)); } else { v5 = *(_QWORD *)a2; v6 = *((_QWORD *)a2 + 1); v19 = *((void **)a2 + 2); v17 = v5; v18 = v6; } Prefabs = (cocos2d::CCArray *)GJSmartTemplate::getPrefabs(a1, (__int64)&v17); if ( (v17 & 1) != 0 ) operator delete(v19); if ( !Prefabs || !(unsigned int)cocos2d::CCArray::count(Prefabs) ) return 0; if ( (unsigned int)cocos2d::CCArray::count(Prefabs) > 1 ) { v9 = *a2; v17 = 0; v18 = 0; v19 = nullptr; if ( (v9 & 1) != 0 ) { std::string::__init(&v17, *((void **)a2 + 2), *((_QWORD *)a2 + 1)); } else { v10 = *(_QWORD *)a2; v11 = *((_QWORD *)a2 + 1); v19 = *((void **)a2 + 2); v17 = v10; v18 = v11; } TotalChanceForPrefab = GJSmartTemplate::getTotalChanceForPrefab(a1, (char *)&v17); if ( (v17 & 1) != 0 ) operator delete(v19); v13 = 0; v14 = 0; v15 = (float)((float)rand() * 4.6566e-10) * (float)TotalChanceForPrefab; while ( v13 < (unsigned int)cocos2d::CCArray::count(Prefabs) ) { v16 = cocos2d::CCArray::objectAtIndex(Prefabs, v13); v14 += *(_DWORD *)(v16 + 108); if ( v15 <= (float)v14 || v13 == (unsigned int)cocos2d::CCArray::count(Prefabs) - 1 ) return v16; ++v13; } return 0; } return cocos2d::CCArray::objectAtIndex(Prefabs, 0); }
GD Web Decomp Icon

GD Web Decomp

Raw Source