//
// BrowseSmartKeyLayer::updateChanceValues from 0xb163a8 to 0xb16598 (496 bytes)
//
// 3 xrefs:
// > BrowseSmartKeyLayer::deletedSelectedItems @ 0xb166c8
// > BrowseSmartKeyLayer::addChanceToSelected @ 0xb16828
// > ??> @ 0xcc9e8
//
// 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:32 +0000
//
__int64 __fastcall BrowseSmartKeyLayer::updateChanceValues(BrowseSmartKeyLayer *this)
{
char *v1; // x22
char v3; // w0
__int64 v4; // x20
__int64 v5; // x0
__int64 v6; // x1
unsigned int TotalChanceForPrefab; // w26
unsigned int i; // w27
unsigned int v9; // w20
cocos2d::CCArray *v10; // x24
__int64 v11; // x0
GJSmartBlockPreview *v12; // x21
char v13; // w0
__int64 v14; // x23
__int64 v15; // x0
__int64 v16; // x1
int v17; // w0
__int64 PrefabWithID; // x23
__int64 v20; // [xsp+60h] [xbp+60h] BYREF
__int64 v21; // [xsp+68h] [xbp+68h]
void *v22; // [xsp+70h] [xbp+70h]
v1 = (char *)this + 712;
v20 = 0;
v3 = *((_BYTE *)this + 712);
v21 = 0;
v22 = nullptr;
v4 = *((_QWORD *)this + 83);
if ( (v3 & 1) != 0 )
{
std::string::__init(&v20, *((void **)v1 + 2), *((_QWORD *)v1 + 1));
}
else
{
v5 = *(_QWORD *)v1;
v6 = *((_QWORD *)v1 + 1);
v22 = *((void **)v1 + 2);
v20 = v5;
v21 = v6;
}
TotalChanceForPrefab = GJSmartTemplate::getTotalChanceForPrefab(v4, (char *)&v20);
if ( (v20 & 1) != 0 )
operator delete(v22);
for ( i = 0; i < (unsigned int)cocos2d::CCArray::count(*((cocos2d::CCArray **)this + 84)); ++i )
{
v9 = 0;
v10 = (cocos2d::CCArray *)cocos2d::CCArray::objectAtIndex(*((cocos2d::CCArray **)this + 84), i);
if ( (unsigned int)cocos2d::CCArray::count(v10) )
{
do
{
v11 = cocos2d::CCArray::objectAtIndex(v10, v9);
v12 = (GJSmartBlockPreview *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v11 + 1072LL))(v11);
v13 = *v1;
v20 = 0;
v21 = 0;
v22 = nullptr;
v14 = *((_QWORD *)this + 83);
if ( (v13 & 1) != 0 )
{
std::string::__init(&v20, *((void **)v1 + 2), *((_QWORD *)v1 + 1));
}
else
{
v15 = *(_QWORD *)v1;
v16 = *((_QWORD *)v1 + 1);
v22 = *((void **)v1 + 2);
v20 = v15;
v21 = v16;
}
v17 = (*(__int64 (__fastcall **)(GJSmartBlockPreview *))(*(_QWORD *)v12 + 64LL))(v12);
PrefabWithID = GJSmartTemplate::getPrefabWithID(v14, (__int64)&v20, v17);
if ( (v20 & 1) != 0 )
operator delete(v22);
if ( PrefabWithID )
GJSmartBlockPreview::addChance(v12, *(_DWORD *)(PrefabWithID + 108), (const char *)TotalChanceForPrefab);
++v9;
}
while ( v9 < (unsigned int)cocos2d::CCArray::count(v10) );
}
}
return _stack_chk_guard;
}