//
// SetGroupIDLayer::onGroupIDOptions from 0x9757ec to 0x975af8 (780 bytes)
//
// 3 xrefs:
// > ??> @ 0x80e50
// > SetGroupIDLayer::init @ 0x977d88
// > ??> @ 0x122c578
//
// 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 SetGroupIDLayer::onGroupIDOptions(SetGroupIDLayer *a1, cocos2d::CCObject *a2)
{
ConfigureValuePopupDelegate *v2; // x19
float m_nextFreeID; // s8
__int64 v4; // x20
void *v5; // x0
void *v6; // x0
void *v7; // x0
void *v8; // x0
unsigned int *v9; // x1
int v10; // w2
unsigned int *v11; // x1
int v12; // w2
unsigned int *v13; // x1
int v14; // w2
unsigned int *v15; // x1
int v16; // w2
__int64 v17; // [xsp+68h] [xbp+68h] BYREF
__int64 v18; // [xsp+70h] [xbp+70h] BYREF
v2 = &a1->ConfigureValuePopupDelegate;
m_nextFreeID = (float)GameManager::sharedState()->m_levelEditorLayer->m_levelSettings->m_nextFreeID;
sub_D153B8((int)&v17, "GroupID Offset");
sub_D153B8((int)&v18, &byte_F288A0);
v4 = ConfigureValuePopup::create((__int64)v2, m_nextFreeID, 0.0, 9999.0, (__int64)&v17, (__int64)&v18, 1u);
v5 = (void *)(v18 - 24);
if ( (__int64 *)(v18 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v9 = (unsigned int *)(v18 - 8);
do
v10 = __ldaxr(v9);
while ( __stlxr(v10 - 1, v9) );
}
else
{
v10 = *(_DWORD *)(v18 - 8);
*(_DWORD *)(v18 - 8) = v10 - 1;
}
if ( v10 <= 0 )
operator delete(v5);
}
v6 = (void *)(v17 - 24);
if ( (__int64 *)(v17 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v11 = (unsigned int *)(v17 - 8);
do
v12 = __ldaxr(v11);
while ( __stlxr(v12 - 1, v11) );
}
else
{
v12 = *(_DWORD *)(v17 - 8);
*(_DWORD *)(v17 - 8) = v12 - 1;
}
if ( v12 <= 0 )
operator delete(v6);
}
sub_D153B8((int)&v17, "Help");
sub_D153B8(
(int)&v18,
"This lets you set a Group ID offset that Next Free will take into account and start from. Useful for collaborations.");
ConfigureValuePopup::addInfoAlertButton(v4);
v7 = (void *)(v18 - 24);
if ( (__int64 *)(v18 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v13 = (unsigned int *)(v18 - 8);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
}
else
{
v14 = *(_DWORD *)(v18 - 8);
*(_DWORD *)(v18 - 8) = v14 - 1;
}
if ( v14 <= 0 )
operator delete(v7);
}
v8 = (void *)(v17 - 24);
if ( (__int64 *)(v17 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v15 = (unsigned int *)(v17 - 8);
do
v16 = __ldaxr(v15);
while ( __stlxr(v16 - 1, v15) );
}
else
{
v16 = *(_DWORD *)(v17 - 8);
*(_DWORD *)(v17 - 8) = v16 - 1;
}
if ( v16 <= 0 )
operator delete(v8);
}
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v4 + 72LL))(v4, 26);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v4 + 1288LL))(v4);
}