//
// BrowseSmartKeyLayer::addChanceToSelected from 0x1004ebad0 to 0x1004ebc8d (445 bytes)
//
// 2 xrefs:
// > BrowseSmartKeyLayer::onButton @ 0x1004eb757
// > BrowseSmartKeyLayer::onButton @ 0x1004eb76c
//
// 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
//
void __fastcall BrowseSmartKeyLayer::addChanceToSelected(BrowseSmartKeyLayer *a1, int a2, bool a3)
{
__int128 v3; // xmm0
cocos2d::CCArray *AllSelectedBlocks; // r14
unsigned int v6; // r15d
__int64 v7; // r12
GJSmartTemplate *m_template; // r13
int v9; // eax
__int64 PrefabWithID; // r12
unsigned int v11; // r12d
__int64 v12; // r13
GJSmartTemplate *v13; // r15
int v14; // eax
__int64 v15; // r15
std::string *p_m_prefabKey; // [rsp+0h] [rbp-50h]
__int128 v17; // [rsp+10h] [rbp-40h] BYREF
void *__p; // [rsp+20h] [rbp-30h]
AllSelectedBlocks = BrowseSmartKeyLayer::getAllSelectedBlocks(a1);
if ( (unsigned int)sub_100720070(AllSelectedBlocks) )
{
p_m_prefabKey = &a1->m_prefabKey;
if ( a3 )
{
v6 = 0;
do
{
v7 = sub_1007200C0(AllSelectedBlocks, v6);
m_template = a1->m_template;
if ( (a1->m_prefabKey.m_data.m_short.sizex2 & 1) != 0 )
{
sub_100006B70(
&v17,
a1->m_prefabKey.m_data.m_long.longStorage,
a1->m_prefabKey.m_data.m_long.size,
*(double *)&v3);
}
else
{
__p = a1->m_prefabKey.m_data.m_long.longStorage;
v3 = *(_OWORD *)&p_m_prefabKey->m_data.m_short.sizex2;
v17 = *(_OWORD *)&p_m_prefabKey->m_data.m_short.sizex2;
}
v9 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v7 + 64LL))(v7);
PrefabWithID = GJSmartTemplate::getPrefabWithID((__int64)m_template, (char *)&v17, v9);
if ( (v17 & 1) != 0 )
operator delete(__p);
if ( PrefabWithID )
*(_DWORD *)(PrefabWithID + 108) = 0;
++v6;
}
while ( v6 < (unsigned int)sub_100720070(AllSelectedBlocks) );
}
else
{
v11 = 0;
do
{
v12 = sub_1007200C0(AllSelectedBlocks, v11);
v13 = a1->m_template;
if ( (a1->m_prefabKey.m_data.m_short.sizex2 & 1) != 0 )
{
sub_100006B70(
&v17,
a1->m_prefabKey.m_data.m_long.longStorage,
a1->m_prefabKey.m_data.m_long.size,
*(double *)&v3);
}
else
{
__p = a1->m_prefabKey.m_data.m_long.longStorage;
v3 = *(_OWORD *)&p_m_prefabKey->m_data.m_short.sizex2;
v17 = *(_OWORD *)&p_m_prefabKey->m_data.m_short.sizex2;
}
v14 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v12 + 64LL))(v12);
v15 = GJSmartTemplate::getPrefabWithID((__int64)v13, (char *)&v17, v14);
if ( (v17 & 1) != 0 )
operator delete(__p);
if ( v15 )
*(_DWORD *)(v15 + 108) += a2;
++v11;
}
while ( v11 < (unsigned int)sub_100720070(AllSelectedBlocks) );
}
}
BrowseSmartKeyLayer::updateChanceValues(a1);
}