//
// BrowseSmartKeyLayer::addChanceToSelected from 0xb16744 to 0xb168b0 (364 bytes)
//
// 3 xrefs:
// > BrowseSmartKeyLayer::onButton @ 0xb16914
// > BrowseSmartKeyLayer::onButton @ 0xb1694c
// > ??> @ 0xfbc38
//
// 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::addChanceToSelected(BrowseSmartKeyLayer *this, int a2, unsigned __int8 a3)
{
int v4; // w24
unsigned int v6; // w20
cocos2d::CCArray *AllSelectedBlocks; // x23
__int64 v8; // x21
char v9; // w0
__int64 v10; // x27
__int64 v11; // x0
__int64 v12; // x1
int v13; // w0
__int64 PrefabWithID; // x21
__int64 v16; // [xsp+60h] [xbp+60h] BYREF
__int64 v17; // [xsp+68h] [xbp+68h]
void *v18; // [xsp+70h] [xbp+70h]
v4 = a3;
v6 = 0;
AllSelectedBlocks = BrowseSmartKeyLayer::getAllSelectedBlocks((cocos2d::CCArray **)this);
if ( (unsigned int)cocos2d::CCArray::count(AllSelectedBlocks) )
{
do
{
v8 = cocos2d::CCArray::objectAtIndex(AllSelectedBlocks, v6);
v9 = *((_BYTE *)this + 712);
v16 = 0;
v17 = 0;
v18 = nullptr;
v10 = *((_QWORD *)this + 83);
if ( (v9 & 1) != 0 )
{
std::string::__init(&v16, *((void **)this + 91), *((_QWORD *)this + 90));
}
else
{
v11 = *((_QWORD *)this + 89);
v12 = *((_QWORD *)this + 90);
v18 = *((void **)this + 91);
v16 = v11;
v17 = v12;
}
v13 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v8 + 64LL))(v8);
PrefabWithID = GJSmartTemplate::getPrefabWithID(v10, (__int64)&v16, v13);
if ( (v16 & 1) != 0 )
operator delete(v18);
if ( PrefabWithID )
{
if ( !v4 )
{
++v6;
*(_DWORD *)(PrefabWithID + 108) += a2;
continue;
}
*(_DWORD *)(PrefabWithID + 108) = 0;
}
++v6;
}
while ( v6 < (unsigned int)cocos2d::CCArray::count(AllSelectedBlocks) );
}
BrowseSmartKeyLayer::updateChanceValues(this);
return _stack_chk_guard;
}