//
// GJSmartTemplate::getTotalChanceForPrefab from 0x66f43c to 0x66f4ac (112 bytes)
//
// 3 xrefs:
// > GJSmartTemplate::getRandomPrefab @ 0x66f510
// > BrowseSmartKeyLayer::updateChanceValues @ 0x673e06
// > BrowseSmartKeyLayer::init @ 0x674d4a
//
// 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::getTotalChanceForPrefab(int a1, int a2, int a3, int a4)
{
cocos2d::CCArray *Prefabs; // r6
int *v6; // r3
int result; // r0
int *v8; // r2
int v9; // r3
int *v10; // r3
int v11; // r1
int v12; // t1
int v13[4]; // [sp+0h] [bp-10h] BYREF
v13[0] = a1;
v13[1] = a2;
v13[2] = a3;
v13[3] = a4;
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;
v6 = *((int **)Prefabs + 13);
result = *v6;
if ( *v6 )
{
v8 = (int *)v6[3];
v9 = result + 0x3FFFFFFF;
result = 0;
v10 = &v8[v9];
while ( v8 <= v10 )
{
v12 = *v8++;
v11 = v12;
if ( !v12 )
break;
result += *(_DWORD *)(v11 + 80);
}
}
return result;
}