//
// GameManager::saveDPadLayout from 0x72abbc to 0x72b3d0 (2068 bytes)
//
// 3 xrefs:
// > UISaveLoadLayer::onSave @ 0xa2eaa4
// > ControlSlotsPopup::onSave @ 0xd075a8
// > ??> @ 0xf7228
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 12:52:33 +0000
//
__int64 __fastcall GameManager::saveDPadLayout(GameManager *this, int a2, char a3)
{
size_t v5; // x24
const char *v6; // x27
size_t v7; // x0
size_t v8; // x26
unsigned __int64 v9; // x25
char *v10; // x0
size_t v11; // x24
unsigned __int64 v12; // x22
size_t v14; // x24
char *v15; // x27
size_t v16; // x0
size_t v17; // x26
unsigned __int64 v18; // x25
char *v19; // x0
size_t v20; // x24
unsigned __int64 v21; // x22
int v22; // w0
char *v23; // x28
size_t v24; // x24
size_t v25; // x27
unsigned __int64 v26; // x26
char *v27; // x0
size_t v28; // x26
unsigned __int64 v29; // x24
int v30; // w0
char *v31; // x28
size_t v32; // x24
size_t v33; // x27
unsigned __int64 v34; // x26
char *v35; // x0
size_t v36; // x26
unsigned __int64 v37; // x24
int v38; // w0
char *v39; // x27
size_t v40; // x24
size_t v41; // x26
unsigned __int64 v42; // x25
char *v43; // x0
size_t v44; // x22
__int64 *v45; // x20
unsigned __int64 v46; // x1
char *v47; // x0
int v48; // w0
char *v49; // x0
int v50; // w0
size_t v51; // x0
char *v52; // x0
size_t v53; // x0
char *v54; // x0
size_t v55; // x0
char *v56; // x0
unsigned int GameVariable; // [xsp+68h] [xbp+68h]
__int64 v58; // [xsp+70h] [xbp+70h] BYREF
size_t v59; // [xsp+78h] [xbp+78h]
char *v60; // [xsp+80h] [xbp+80h]
__int64 v61; // [xsp+88h] [xbp+88h] BYREF
size_t v62; // [xsp+90h] [xbp+90h]
char *v63; // [xsp+98h] [xbp+98h]
__int64 v64; // [xsp+A0h] [xbp+A0h] BYREF
size_t v65; // [xsp+A8h] [xbp+A8h]
char *v66; // [xsp+B0h] [xbp+B0h]
__int64 v67; // [xsp+B8h] [xbp+B8h] BYREF
size_t v68; // [xsp+C0h] [xbp+C0h]
char *v69; // [xsp+C8h] [xbp+C8h]
__int64 v70; // [xsp+D0h] [xbp+D0h] BYREF
size_t v71; // [xsp+D8h] [xbp+D8h]
char *v72; // [xsp+E0h] [xbp+E0h]
size_t v73; // [xsp+E8h] [xbp+E8h] BYREF
size_t v74; // [xsp+F0h] [xbp+F0h]
char *v75; // [xsp+F8h] [xbp+F8h]
_BYTE v76[504]; // [xsp+100h] [xbp+100h] BYREF
v74 = 500;
v73 = 0;
v75 = v76;
if ( a3 )
{
GameManager::dpadConfigToString((__int64)this + 1356, &v61);
if ( (v61 & 1) != 0 )
{
v14 = v62;
v15 = v63;
if ( v62 )
{
v17 = v73;
v18 = v73 + v62;
if ( v74 >= v73 + v62 )
{
v73 += v62;
v47 = &v75[v17];
goto LABEL_51;
}
goto LABEL_49;
}
if ( !v63 )
{
v17 = v73;
if ( v73 <= v74 )
goto LABEL_52;
v18 = v73;
goto LABEL_49;
}
}
else
{
v48 = (int)(unsigned __int8)v61 >> 1;
v15 = (char *)&v61 + 1;
v14 = v48;
if ( v48 )
{
v17 = v73;
v18 = v48 + v73;
if ( v18 <= v74 )
{
LABEL_20:
v73 = v18;
v19 = v75;
if ( !v14 )
goto LABEL_21;
LABEL_50:
v47 = &v19[v17];
LABEL_51:
memmove(v47, v15, v14);
if ( (v61 & 1) == 0 )
{
LABEL_22:
v20 = v73;
v21 = v73 + 1;
if ( v73 + 1 <= v74 )
goto LABEL_23;
LABEL_53:
fmt::internal::Array::grow(&v73, v21);
LABEL_23:
v73 = v21;
v75[v20] = aLjavaLangClass[24];
GameManager::dpadConfigToString((__int64)this + 1396, &v64);
if ( (v64 & 1) != 0 )
{
v24 = v65;
v23 = v66;
if ( v65 )
{
v25 = v73;
v26 = v73 + v65;
if ( v74 >= v73 + v65 )
{
v73 += v65;
v56 = &v75[v25];
LABEL_85:
memmove(v56, v23, v24);
if ( (v64 & 1) == 0 )
{
LABEL_28:
v28 = v73;
v29 = v73 + 1;
if ( v73 + 1 <= v74 )
goto LABEL_29;
LABEL_87:
fmt::internal::Array::grow(&v73, v29);
LABEL_29:
v73 = v29;
v75[v28] = aLjavaLangClass[24];
GameManager::dpadConfigToString((__int64)this + 1436, &v67);
if ( (v67 & 1) != 0 )
{
v32 = v68;
v31 = v69;
if ( v68 )
{
v33 = v73;
v34 = v73 + v68;
if ( v73 + v68 <= v74 )
{
v73 += v68;
v54 = &v75[v33];
LABEL_77:
memmove(v54, v31, v32);
if ( (v67 & 1) == 0 )
{
LABEL_34:
v36 = v73;
v37 = v73 + 1;
if ( v73 + 1 <= v74 )
goto LABEL_35;
LABEL_79:
fmt::internal::Array::grow(&v73, v37);
LABEL_35:
v73 = v37;
v75[v36] = aLjavaLangClass[24];
GameManager::dpadConfigToString((__int64)this + 1476, &v70);
if ( (v70 & 1) != 0 )
{
v40 = v71;
v39 = v72;
if ( v71 )
{
v41 = v73;
v42 = v73 + v71;
if ( v73 + v71 <= v74 )
{
v73 += v71;
v52 = &v75[v41];
LABEL_68:
memmove(v52, v39, v40);
if ( (v70 & 1) == 0 )
{
LABEL_40:
if ( a2 != 2 )
goto LABEL_41;
goto LABEL_70;
}
LABEL_69:
operator delete(v72);
if ( a2 != 2 )
{
LABEL_41:
if ( a2 == 3 )
{
v44 = v73;
v45 = (__int64 *)((char *)this + 1640);
v46 = v73 + 1;
if ( v73 + 1 <= v74 )
goto LABEL_96;
goto LABEL_95;
}
if ( a2 != 1 )
goto LABEL_12;
v44 = v73;
v45 = (__int64 *)((char *)this + 1592);
v46 = v73 + 1;
if ( v73 + 1 > v74 )
LABEL_95:
fmt::internal::Array::grow(&v73, v46);
LABEL_96:
v75[v44] = 0;
std::string::assign(v45, v75);
goto LABEL_12;
}
LABEL_70:
v44 = v73;
v45 = (__int64 *)((char *)this + 1616);
v46 = v73 + 1;
if ( v73 + 1 <= v74 )
goto LABEL_96;
goto LABEL_95;
}
goto LABEL_66;
}
if ( !v72 )
{
v41 = v73;
if ( v73 <= v74 )
goto LABEL_69;
v42 = v73;
goto LABEL_66;
}
}
else
{
v38 = (int)(unsigned __int8)v70 >> 1;
v39 = (char *)&v70 + 1;
v40 = v38;
if ( v38 )
{
v41 = v73;
v42 = v38 + v73;
if ( v42 <= v74 )
goto LABEL_38;
goto LABEL_66;
}
}
v51 = strlen(v39);
v41 = v73;
v40 = v51;
v42 = v51 + v73;
if ( v51 + v73 <= v74 )
{
LABEL_38:
v73 = v42;
v43 = v75;
if ( !v40 )
goto LABEL_39;
LABEL_67:
v52 = &v43[v41];
goto LABEL_68;
}
LABEL_66:
fmt::internal::Array::grow(&v73, v42);
v73 = v42;
v43 = v75;
if ( !v40 )
{
LABEL_39:
if ( (v70 & 1) == 0 )
goto LABEL_40;
goto LABEL_69;
}
goto LABEL_67;
}
LABEL_78:
operator delete(v69);
v36 = v73;
v37 = v73 + 1;
if ( v73 + 1 <= v74 )
goto LABEL_35;
goto LABEL_79;
}
goto LABEL_75;
}
if ( !v69 )
{
v33 = v73;
if ( v73 <= v74 )
goto LABEL_78;
v34 = v73;
goto LABEL_75;
}
}
else
{
v30 = (int)(unsigned __int8)v67 >> 1;
v31 = (char *)&v67 + 1;
v32 = v30;
if ( v30 )
{
v33 = v73;
v34 = v30 + v73;
if ( v34 <= v74 )
goto LABEL_32;
goto LABEL_75;
}
}
v53 = strlen(v31);
v33 = v73;
v32 = v53;
v34 = v53 + v73;
if ( v53 + v73 <= v74 )
{
LABEL_32:
v73 = v34;
v35 = v75;
if ( !v32 )
goto LABEL_33;
LABEL_76:
v54 = &v35[v33];
goto LABEL_77;
}
LABEL_75:
fmt::internal::Array::grow(&v73, v34);
v73 = v34;
v35 = v75;
if ( !v32 )
{
LABEL_33:
if ( (v67 & 1) == 0 )
goto LABEL_34;
goto LABEL_78;
}
goto LABEL_76;
}
LABEL_86:
operator delete(v66);
v28 = v73;
v29 = v73 + 1;
if ( v73 + 1 <= v74 )
goto LABEL_29;
goto LABEL_87;
}
goto LABEL_83;
}
if ( !v66 )
{
v25 = v73;
if ( v73 <= v74 )
goto LABEL_86;
v26 = v73;
goto LABEL_83;
}
}
else
{
v22 = (int)(unsigned __int8)v64 >> 1;
v23 = (char *)&v64 + 1;
v24 = v22;
if ( v22 )
{
v25 = v73;
v26 = v22 + v73;
if ( v26 <= v74 )
goto LABEL_26;
goto LABEL_83;
}
}
v55 = strlen(v23);
v25 = v73;
v24 = v55;
v26 = v55 + v73;
if ( v55 + v73 <= v74 )
{
LABEL_26:
v73 = v26;
v27 = v75;
if ( !v24 )
goto LABEL_27;
LABEL_84:
v56 = &v27[v25];
goto LABEL_85;
}
LABEL_83:
fmt::internal::Array::grow(&v73, v26);
v73 = v26;
v27 = v75;
if ( !v24 )
{
LABEL_27:
if ( (v64 & 1) == 0 )
goto LABEL_28;
goto LABEL_86;
}
goto LABEL_84;
}
LABEL_52:
operator delete(v63);
v20 = v73;
v21 = v73 + 1;
if ( v73 + 1 <= v74 )
goto LABEL_23;
goto LABEL_53;
}
LABEL_49:
fmt::internal::Array::grow(&v73, v18);
v73 = v18;
v19 = v75;
if ( !v14 )
{
LABEL_21:
if ( (v61 & 1) == 0 )
goto LABEL_22;
goto LABEL_52;
}
goto LABEL_50;
}
}
v16 = strlen(v15);
v17 = v73;
v14 = v16;
v18 = v16 + v73;
if ( v16 + v73 <= v74 )
goto LABEL_20;
goto LABEL_49;
}
GameManager::dpadConfigToString((__int64)this + 1316, &v58);
if ( (v58 & 1) != 0 )
{
v5 = v59;
v6 = v60;
if ( v59 )
{
v8 = v73;
v9 = v73 + v59;
if ( v73 + v59 <= v74 )
{
v73 += v59;
v49 = &v75[v8];
goto LABEL_60;
}
goto LABEL_58;
}
if ( !v60 )
{
v8 = v73;
if ( v73 <= v74 )
goto LABEL_61;
v9 = v73;
goto LABEL_58;
}
LABEL_5:
v7 = strlen(v6);
v8 = v73;
v5 = v7;
v9 = v7 + v73;
if ( v7 + v73 <= v74 )
goto LABEL_6;
LABEL_58:
fmt::internal::Array::grow(&v73, v9);
v73 = v9;
v10 = v75;
if ( !v5 )
{
LABEL_7:
if ( (v58 & 1) == 0 )
goto LABEL_8;
LABEL_61:
operator delete(v60);
v11 = v73;
v12 = v73 + 1;
if ( v73 + 1 <= v74 )
goto LABEL_9;
goto LABEL_62;
}
goto LABEL_59;
}
v50 = (int)(unsigned __int8)v58 >> 1;
v6 = (char *)&v58 + 1;
v5 = v50;
if ( !v50 )
goto LABEL_5;
v8 = v73;
v9 = v50 + v73;
if ( v9 > v74 )
goto LABEL_58;
LABEL_6:
v73 = v9;
v10 = v75;
if ( !v5 )
goto LABEL_7;
LABEL_59:
v49 = &v10[v8];
LABEL_60:
memmove(v49, v6, v5);
if ( (v58 & 1) != 0 )
goto LABEL_61;
LABEL_8:
v11 = v73;
v12 = v73 + 1;
if ( v73 + 1 <= v74 )
goto LABEL_9;
LABEL_62:
fmt::internal::Array::grow(&v73, v12);
LABEL_9:
v73 = v12;
v75[v11] = aLjavaLangClass[24];
GameVariable = (unsigned __int8)GameManager::getGameVariable(this, "0113");
fmt::BasicWriter::FormatInt,char>>(&v73, GameVariable);
switch ( a2 )
{
case 2:
v44 = v73;
v45 = (__int64 *)((char *)this + 1544);
v46 = v73 + 1;
if ( v73 + 1 <= v74 )
goto LABEL_96;
goto LABEL_95;
case 3:
v44 = v73;
v45 = (__int64 *)((char *)this + 1568);
v46 = v73 + 1;
if ( v73 + 1 <= v74 )
goto LABEL_96;
goto LABEL_95;
case 1:
v44 = v73;
v45 = (__int64 *)((char *)this + 1520);
v46 = v73 + 1;
if ( v73 + 1 > v74 )
goto LABEL_95;
goto LABEL_96;
}
LABEL_12:
if ( v75 != v76 && v75 )
operator delete[](v75);
return _stack_chk_guard;
}