//
// GJGameLevel::getLastBuildPageForTab from 0x701da0 to 0x701eb0 (272 bytes)
//
// 2 xrefs:
// > EditorUI::setupCreateMenu @ 0x6b35a0
// > ??> @ 0x362a0
//
// 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
//
// local variable allocation has failed, the output may be wrong!
int GJGameLevel::getLastBuildPageForTab(GJGameLevel *a1, int a2)
{
cocos2d::CCDictionary *m_lastBuildSave; // x21
cocos2d::CCString *v3; // x0
char *CString; // x0
cocos2d::CCString *v5; // x0
int v6; // w20
char *v7; // x0
unsigned int *v9; // x2
int v10; // w1
std::string v11; // [xsp+40h] [xbp+40h] BYREF
m_lastBuildSave = a1->m_lastBuildSave;
v3 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", *(const char **)&a2);
CString = (char *)cocos2d::CCString::getCString(v3);
sub_D153B8((int)&v11, CString);
v5 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(m_lastBuildSave, &v11);
v6 = cocos2d::CCString::intValue(v5);
v7 = (char *)v11.m_data.m_data - 24;
if ( (__int64 *)v11.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v9 = (unsigned int *)((char *)v11.m_data.m_data - 8);
do
v10 = __ldaxr(v9);
while ( __stlxr(v10 - 1, v9) );
}
else
{
v10 = *((_DWORD *)v11.m_data.m_data - 2);
*((_DWORD *)v11.m_data.m_data - 2) = v10 - 1;
}
if ( v10 <= 0 )
operator delete(v7);
}
return v6;
}