//
// LevelControlConfig::createFromGlobal from 0x799404 to 0x7995d0 (460 bytes)
//
// 3 xrefs:
// > TouchControlEditLayer::onReset @ 0x7a47a4
// > TouchControlEditLayer::onApplyGlobal @ 0x7a4b3e
// > TouchControlEditLayer::onCopy @ 0x7a50a4
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:59:48 +0000
//
int __fastcall LevelControlConfig::createFromGlobal(LevelControlConfig *this, bool a2)
{
int v3; // r4
cocos2d::CCDirector *v4; // r0
GameManager *WinSize; // r0
int v6; // r3
int v7; // r5
int v8; // r0
bool v9; // r2
unsigned int v10; // r0
int *v11; // r0
int v12; // r0
GameManager *v13; // r0
int v14; // r0
GameManager *v15; // r0
int v16; // r0
unsigned int v17; // r0
GameManager *v18; // r0
int v19; // r0
unsigned int v20; // r0
bool v21; // r2
float v23[2]; // [sp+10h] [bp-98h] BYREF
_BYTE v24[28]; // [sp+18h] [bp-90h] BYREF
float v25; // [sp+34h] [bp-74h]
_BYTE v26[28]; // [sp+40h] [bp-68h] BYREF
float v27; // [sp+5Ch] [bp-4Ch]
int v28[15]; // [sp+68h] [bp-40h] BYREF
v3 = LevelControlConfig::create(this);
v4 = (cocos2d::CCDirector *)LevelControlConfig::seedBase((LevelControlConfig *)v3);
cocos2d::CCDirector::sharedDirector(v4);
WinSize = (GameManager *)cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v23);
v6 = *(_DWORD *)(v3 + 108);
while ( 1 )
{
v7 = *(_DWORD *)(v3 + 112);
if ( v6 == v7 )
break;
*(_DWORD *)(v3 + 112) = v7 - 60;
}
if ( this )
{
v12 = GameManager::sharedState(WinSize);
UIButtonConfig::UIButtonConfig((UIButtonConfig *)v24, (const UIButtonConfig *)(v12 + 1088));
v25 = v23[0] - v25;
v14 = GameManager::sharedState(v13);
UIButtonConfig::UIButtonConfig((UIButtonConfig *)v26, (const UIButtonConfig *)(v14 + 1168));
v27 = v23[0] - v27;
v16 = GameManager::sharedState(v15);
LevelControlConfig::slotFromConfig(
(LevelControlConfig *)v28,
(const UIButtonConfig *)v3,
(const cocos2d::CCSize *)(v16 + 1048),
v23,
0,
0,
1,
1);
v17 = *(_DWORD *)(v3 + 112);
if ( v17 >= *(_DWORD *)(v3 + 116) )
{
std::vector::__push_back_slow_path((int *)(v3 + 108), v28);
}
else
{
if ( v17 )
LevelTouchSlot::LevelTouchSlot(v17, v28);
*(_DWORD *)(v3 + 112) += 60;
}
LevelControlConfig::slotFromConfig(
(LevelControlConfig *)v28,
(const UIButtonConfig *)v3,
(const cocos2d::CCSize *)v24,
v23,
0,
0,
1,
1);
v18 = *(GameManager **)(v3 + 112);
if ( (unsigned int)v18 >= *(_DWORD *)(v3 + 116) )
{
v18 = (GameManager *)std::vector::__push_back_slow_path((int *)(v3 + 108), v28);
}
else
{
if ( v18 )
v18 = (GameManager *)LevelTouchSlot::LevelTouchSlot((int)v18, v28);
*(_DWORD *)(v3 + 112) += 60;
}
v19 = GameManager::sharedState(v18);
LevelControlConfig::slotFromConfig(
(LevelControlConfig *)v28,
(const UIButtonConfig *)v3,
(const cocos2d::CCSize *)(v19 + 1128),
v23,
0,
0,
1,
1);
v20 = *(_DWORD *)(v3 + 112);
if ( v20 >= *(_DWORD *)(v3 + 116) )
{
std::vector::__push_back_slow_path((int *)(v3 + 108), v28);
}
else
{
if ( v20 )
LevelTouchSlot::LevelTouchSlot(v20, v28);
*(_DWORD *)(v3 + 112) += 60;
}
LevelControlConfig::slotFromConfig(
(LevelControlConfig *)v28,
(const UIButtonConfig *)v3,
(const cocos2d::CCSize *)v26,
v23,
0,
0,
1,
1);
v10 = *(_DWORD *)(v3 + 112);
if ( v10 >= *(_DWORD *)(v3 + 116) )
{
v11 = (int *)(v3 + 108);
goto LABEL_27;
}
}
else
{
v8 = GameManager::sharedState(WinSize);
LevelControlConfig::slotFromConfig(
(LevelControlConfig *)v28,
(const UIButtonConfig *)v3,
(const cocos2d::CCSize *)(v8 + 1008),
v23,
0,
0,
1,
1);
v10 = *(_DWORD *)(v3 + 112);
if ( v10 >= *(_DWORD *)(v3 + 116) )
{
v11 = (int *)(v3 + 108);
LABEL_27:
std::vector::__push_back_slow_path(v11, v28);
goto LABEL_28;
}
}
if ( v10 )
LevelTouchSlot::LevelTouchSlot(v10, v28);
*(_DWORD *)(v3 + 112) += 60;
LABEL_28:
LevelControlConfig::bindGlobalBinds((char **)(v3 + 68), nullptr, v9);
LevelControlConfig::bindGlobalBinds((char **)(v3 + 88), (KeybindSource *)((char *)&dword_0 + 1), v21);
return v3;
}