// // GJSmartTemplate::getRandomPrefab from 0x9d0ec4 to 0x9d1110 (588 bytes) // // 4 xrefs: // > GJSmartTemplate::getPrefab @ 0x9d3540 // > GJSmartTemplate::scanForPrefab @ 0x9d9330 // > BrowseSmartTemplateLayer::addPrefabMenuItem @ 0x9deb30 // > @ 0x64b30 // // 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) { cocos2d::CCArray *Prefabs; // x22 char *v3; // x0 int TotalChanceForPrefab; // w24 char *v5; // x0 unsigned int v6; // w19 int v7; // w21 float v8; // s8 __int64 v9; // x20 unsigned int *v11; // x1 int v12; // w2 unsigned int *v13; // x19 int v14; // w1 std::string v15; // [xsp+60h] [xbp+60h] BYREF sub_D18D28(&v15); Prefabs = (cocos2d::CCArray *)GJSmartTemplate::getPrefabs(a1, &v15); v3 = (char *)v15.m_data.m_data - 24; if ( (__int64 *)v15.m_data.m_data - 3 != &qword_124B6B0 ) { if ( &pthread_create ) { v11 = (unsigned int *)((char *)v15.m_data.m_data - 8); do v12 = __ldaxr(v11); while ( __stlxr(v12 - 1, v11) ); } else { v12 = *((_DWORD *)v15.m_data.m_data - 2); *((_DWORD *)v15.m_data.m_data - 2) = v12 - 1; } if ( v12 <= 0 ) operator delete(v3); } if ( !Prefabs || !(unsigned int)cocos2d::CCArray::count(Prefabs) ) return 0; if ( (unsigned int)cocos2d::CCArray::count(Prefabs) > 1 ) { sub_D18D28(&v15); TotalChanceForPrefab = GJSmartTemplate::getTotalChanceForPrefab(a1); v5 = (char *)v15.m_data.m_data - 24; if ( (__int64 *)v15.m_data.m_data - 3 != &qword_124B6B0 ) { if ( &pthread_create ) { v13 = (unsigned int *)((char *)v15.m_data.m_data - 8); do v14 = __ldaxr(v13); while ( __stlxr(v14 - 1, v13) ); } else { v14 = *((_DWORD *)v15.m_data.m_data - 2); *((_DWORD *)v15.m_data.m_data - 2) = v14 - 1; } if ( v14 <= 0 ) operator delete(v5); } v6 = 0; v7 = 0; v8 = (float)((float)rand() * 4.6566e-10) * (float)TotalChanceForPrefab; while ( v6 < (unsigned int)cocos2d::CCArray::count(Prefabs) ) { v9 = cocos2d::CCArray::objectAtIndex(Prefabs, v6); v7 += *(_DWORD *)(v9 + 76); if ( v8 <= (float)v7 || v6 == (unsigned int)cocos2d::CCArray::count(Prefabs) - 1 ) return v9; ++v6; } return 0; } return cocos2d::CCArray::objectAtIndex(Prefabs, 0); }
GD Web Decomp Icon

GD Web Decomp

Raw Source