//
// BrowseSmartKeyLayer::updateChanceValues from 0x1004ebd80 to 0x1004ebf2d (429 bytes)
//
// 2 xrefs:
// > BrowseSmartKeyLayer::deletedSelectedItems @ 0x1004ebaa2
// > BrowseSmartKeyLayer::addChanceToSelected @ 0x1004ebc79
//
// 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::updateChanceValues(BrowseSmartKeyLayer *a1)
{
__int128 v1; // xmm0
GJSmartTemplate *m_template; // r14
std::string *p_m_prefabKey; // r15
unsigned int v5; // r14d
cocos2d::CCArray *m_pages; // rdi
__int64 v7; // r13
unsigned int v8; // r15d
__int64 v9; // rax
GJSmartBlockPreview *v10; // r14
GJSmartTemplate *v11; // r12
int v12; // eax
__int64 PrefabWithID; // r12
std::string *v14; // [rsp+8h] [rbp-78h]
__int128 v15; // [rsp+10h] [rbp-70h] BYREF
void *__p; // [rsp+20h] [rbp-60h]
__int128 v17; // [rsp+30h] [rbp-50h] BYREF
void *v18[2]; // [rsp+40h] [rbp-40h] BYREF
int TotalChanceForPrefab; // [rsp+50h] [rbp-30h]
unsigned int v20; // [rsp+54h] [rbp-2Ch]
m_template = a1->m_template;
p_m_prefabKey = &a1->m_prefabKey;
if ( (a1->m_prefabKey.m_data.m_short.sizex2 & 1) != 0 )
{
sub_100006B70(&v15, a1->m_prefabKey.m_data.m_long.longStorage, a1->m_prefabKey.m_data.m_long.size, *(double *)&v1);
}
else
{
__p = a1->m_prefabKey.m_data.m_long.longStorage;
v1 = *(_OWORD *)&p_m_prefabKey->m_data.m_short.sizex2;
v15 = *(_OWORD *)&p_m_prefabKey->m_data.m_short.sizex2;
}
TotalChanceForPrefab = GJSmartTemplate::getTotalChanceForPrefab((__int64)m_template, &v15, *(double *)&v1);
v14 = &a1->m_prefabKey;
if ( (v15 & 1) != 0 )
operator delete(__p);
if ( (unsigned int)sub_100720070(a1->m_pages) )
{
v5 = 0;
v18[1] = v18;
do
{
m_pages = a1->m_pages;
v20 = v5;
v7 = sub_1007200C0(m_pages, v5);
if ( (unsigned int)sub_100720070(v7) )
{
v8 = 0;
do
{
v9 = sub_1007200C0(v7, v8);
v10 = (GJSmartBlockPreview *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v9 + 1056LL))(v9);
v11 = 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 *)&v1);
}
else
{
v18[0] = v14->m_data.m_long.longStorage;
v1 = *(_OWORD *)&v14->m_data.m_short.sizex2;
v17 = *(_OWORD *)&v14->m_data.m_short.sizex2;
}
v12 = ((__int64 (__fastcall *)(GJSmartBlockPreview *))v10->getTag)(v10);
PrefabWithID = GJSmartTemplate::getPrefabWithID((__int64)v11, (char *)&v17, v12);
if ( (v17 & 1) != 0 )
operator delete(v18[0]);
if ( PrefabWithID )
GJSmartBlockPreview::addChance(v10, *(_DWORD *)(PrefabWithID + 108), TotalChanceForPrefab);
++v8;
}
while ( v8 < (unsigned int)sub_100720070(v7) );
}
v5 = v20 + 1;
}
while ( v5 < (unsigned int)sub_100720070(a1->m_pages) );
}
}