//
// GameManager::setUGV from 0x140183340 to 0x140183498 (344 bytes)
//
// 42 xrefs:
// > CreatorLayer::dialogClosed @ 0x14009f7c0
// > GameManager::dataLoaded @ 0x140188531
// > GameManager::dataLoaded @ 0x140188543
// > GameManager::firstLoad @ 0x140188f6b
// > GameManager::applicationWillEnterForeground @ 0x140189ce4
// > GameManager::applicationWillEnterForeground @ 0x140189d88
// > GameManager::applicationWillEnterForeground @ 0x140189e2c
// > GameManager::applicationWillEnterForeground @ 0x140189ecc
// > GameManager::applicationWillEnterForeground @ 0x140189f1f
// > GameManager::applicationWillEnterForeground @ 0x140189f72
// > TOSPopup::onClose @ 0x14029e66e
// > GJShopLayer::showReactMessage @ 0x1402ae574
// > LevelAreaLayer::showDialog @ 0x1402c52dc
// > LevelAreaInnerLayer::showFloor1CompleteDialog @ 0x1402c7624
// > LevelSelectLayer::init @ 0x1403184c7
// > LevelPage::onTheTower @ 0x14031c23d
// > LevelPage::onSecretDoor @ 0x14031cd93
// > LevelPage::dialogClosed @ 0x14031d807
// > PlayLayer::destroyPlayer @ 0x1403b4408
// > SecretRewardsLayer::dialogClosed @ 0x1403d6943
// > SecretRewardsLayer::dialogClosed @ 0x1403d69a5
// > SecretRewardsLayer::dialogClosed @ 0x1403d6a07
// > SecretRewardsLayer::dialogClosed @ 0x1403d6a6a
// > SecretRewardsLayer::showDialog01 @ 0x1403d93f6
// > SecretRewardsLayer::showDialog03 @ 0x1403da105
// > SecretRewardsLayer::showDialogMechanic @ 0x1403db636
// > SecretRewardsLayer::showDialogDiamond @ 0x1403dc4c6
// > SecretLayer::getThreadMessage @ 0x1403e0731
// > SecretLayer2::showSecretLevel @ 0x1403e37fc
// > SecretLayer2::dialogClosed @ 0x1403e4612
// > SecretLayer2::getThreadMessage @ 0x1403e772c
// > SecretLayer3::onClick @ 0x1403ec4b6
// > SecretLayer3::onClick @ 0x1403ec843
// > SecretLayer3::onClick @ 0x1403ecbb3
// > SecretLayer3::onClick @ 0x1403ed140
// > SecretLayer3::onClick @ 0x1403ed18b
// > SecretLayer3::dialogClosed @ 0x1403ef388
// > SecretLayer3::dialogClosed @ 0x1403ef5cd
// > SecretLayer4::showFirstDialog @ 0x1403f28be
// > SecretLayer5::showFirstDialog @ 0x1403f78be
// > ??> @ 0x1406cb58c
// > ??> @ 0x1406cb598
//
// 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
//
// Hidden C++ exception states: #wind=2
void GameManager::setUGV(GameManager *a1, const char *a2, bool a3)
{
BOOL v3; // esi
size_t v5; // rbx
size_t v6; // r8
void **v7; // rdx
struct cocos2d::CCString *v8; // rax
void *v9; // rcx
void *v10; // rcx
void *Src[2]; // [rsp+20h] [rbp-68h] BYREF
__int64 v12; // [rsp+30h] [rbp-58h]
unsigned __int64 v13; // [rsp+38h] [rbp-50h]
void *Block[2]; // [rsp+40h] [rbp-48h] BYREF
__int128 v15; // [rsp+50h] [rbp-38h]
v3 = a3;
*(_OWORD *)Src = 0;
v12 = 4;
v13 = 15;
strcpy((char *)Src, "ugv_");
v5 = -1;
v6 = -1;
do
++v6;
while ( a2[v6] );
sub_140041270(Src, (void *)a2, v6);
v7 = Src;
if ( v13 > 0xF )
v7 = (void **)Src[0];
*(_OWORD *)Block = 0;
v15 = 0;
do
++v5;
while ( *((_BYTE *)v7 + v5) );
sub_14003A930(Block, v7, v5);
v8 = cocos2d::CCString::createWithFormat("%i", v3);
cocos2d::CCDictionary::setObject(a1->m_unlockValueKeeper, v8, Block);
if ( *((_QWORD *)&v15 + 1) > 0xFu )
{
v9 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v15 + 1) + 1LL) >= 0x1000 )
{
v9 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v9 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v9);
}
if ( v13 > 0xF )
{
v10 = Src[0];
if ( v13 + 1 >= 0x1000 )
{
v10 = *((void **)Src[0] - 1);
if ( (unsigned __int64)((char *)Src[0] - (char *)v10 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v10);
}
}