//
// GameManager::setUGV from 0x5ecb9c to 0x5ecd6c (464 bytes)
//
// 42 xrefs:
// > PlayLayer::destroyPlayer @ 0x5d212c
// > GameManager::firstLoad @ 0x5f0c9c
// > GameManager::applicationWillEnterForeground @ 0x5f3f14
// > GameManager::applicationWillEnterForeground @ 0x5f3f48
// > GameManager::applicationWillEnterForeground @ 0x5f3f7c
// > GameManager::applicationWillEnterForeground @ 0x5f3f98
// > GameManager::applicationWillEnterForeground @ 0x5f3fb4
// > GameManager::applicationWillEnterForeground @ 0x5f3fcc
// > GameManager::dataLoaded @ 0x5fb4e0
// > GameManager::dataLoaded @ 0x5fb4f4
// > CreatorLayer::dialogClosed @ 0x6ca948
// > LevelPage::onTheTower @ 0x79b88c
// > LevelPage::dialogClosed @ 0x79bcf8
// > LevelPage::onSecretDoor @ 0x79be00
// > LevelSelectLayer::init @ 0x79e4e8
// > TOSPopup::onClose @ 0x8c32ec
// > SecretLayer::getThreadMessage @ 0x9033f0
// > GJShopLayer::showReactMessage @ 0x92cf30
// > SecretLayer2::dialogClosed @ 0x93a794
// > SecretLayer3::onClick @ 0x93e66c
// > SecretLayer3::onClick @ 0x93e850
// > SecretLayer3::onClick @ 0x93ef68
// > SecretLayer3::onClick @ 0x93ef8c
// > SecretLayer3::onClick @ 0x93efb0
// > SecretLayer2::showSecretLevel @ 0x93f834
// > SecretLayer2::getThreadMessage @ 0x940690
// > SecretLayer3::dialogClosed @ 0x941fd8
// > SecretLayer3::dialogClosed @ 0x942014
// > SecretLayer4::showFirstDialog @ 0x9469d0
// > WorldSelectLayer::showCompleteDialog @ 0x95e9e4
// > LevelAreaLayer::showDialog @ 0xa2daa4
// > LevelAreaInnerLayer::showFloor1CompleteDialog @ 0xa2de00
// > SecretRewardsLayer::dialogClosed @ 0xa61540
// > SecretRewardsLayer::dialogClosed @ 0xa6156c
// > SecretRewardsLayer::dialogClosed @ 0xa61598
// > SecretRewardsLayer::dialogClosed @ 0xa615c4
// > SecretRewardsLayer::showDialog01 @ 0xa64d0c
// > SecretRewardsLayer::showDialog03 @ 0xa669b4
// > SecretRewardsLayer::showDialogMechanic @ 0xa680b0
// > SecretRewardsLayer::showDialogDiamond @ 0xa694d4
// > SecretLayer5::showFirstDialog @ 0xa901ec
// > ??> @ 0x2aa80
//
// 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 GameManager::setUGV(GameManager *a1, const char *a2, bool a3)
{
_BOOL4 v5; // w24
size_t v6; // x0
cocos2d::CCDictionary *m_unlockValueKeeper; // x22
cocos2d::CCObject *v8; // x19
void *v9; // x0
char *v10; // x0
unsigned int *v11; // x1
int v12; // w2
unsigned int *v13; // x1
int v14; // w2
char *v15; // [xsp+58h] [xbp+58h] BYREF
__int64 v16; // [xsp+60h] [xbp+60h] BYREF
v5 = a3;
sub_D153B8((int)&v15, "ugv_");
v6 = strlen(a2);
sub_D15FD4(&v15, a2, v6);
m_unlockValueKeeper = a1->m_unlockValueKeeper;
v8 = (cocos2d::CCObject *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", (const char *)v5);
sub_D153B8((int)&v16, v15);
cocos2d::CCDictionary::setObject((int)m_unlockValueKeeper, v8);
v9 = (void *)(v16 - 24);
if ( (__int64 *)(v16 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v11 = (unsigned int *)(v16 - 8);
do
v12 = __ldaxr(v11);
while ( __stlxr(v12 - 1, v11) );
}
else
{
v12 = *(_DWORD *)(v16 - 8);
*(_DWORD *)(v16 - 8) = v12 - 1;
}
if ( v12 <= 0 )
operator delete(v9);
}
v10 = v15 - 24;
if ( v15 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v13 = (unsigned int *)(v15 - 8);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
}
else
{
v14 = *((_DWORD *)v15 - 2);
*((_DWORD *)v15 - 2) = v14 - 1;
}
if ( v14 <= 0 )
operator delete(v10);
}
}