//
// GameManager::saveDPadLayout from 0x1402817b0 to 0x140281b4d (925 bytes)
//
// 2 xrefs:
// > ControlSlotsPopup::onSave @ 0x140456ed4
// > ??> @ 0x14091d084
//
// This function is hookable on this platform (idp: pc, 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 11:29:00 +0000
//
// Hidden C++ exception states: #wind=2
__int64 __fastcall GameManager::saveDPadLayout(__int64 a1, int a2, char a3)
{
__int64 v6; // rcx
__int64 v7; // rax
bool GameVariable; // al
int v9; // edi
int v10; // edi
_BYTE *v11; // rax
size_t v12; // r8
void **v13; // rcx
__int64 v14; // rax
__int64 v15; // rcx
__int64 v16; // rax
__int64 v17; // rcx
__int64 v18; // rax
__int64 v19; // rcx
__int64 v20; // rax
int v21; // edi
int v22; // edi
__int128 v24; // [rsp+20h] [rbp-E0h] BYREF
_BYTE v25[16]; // [rsp+30h] [rbp-D0h] BYREF
_BYTE v26[32]; // [rsp+40h] [rbp-C0h] BYREF
_BYTE v27[528]; // [rsp+60h] [rbp-A0h] BYREF
fmt::BasicWriter::BasicWriter(v27);
if ( a3 )
{
v14 = GameManager::dpadConfigToString(v6, v26, a1 + 1348);
v24 = *(_OWORD *)fmt::BasicStringRef::BasicStringRef(v25, v14);
fmt::BasicWriter::operator<<(v27, &v24);
sub_14003D310((__int64)v26);
*(_QWORD *)&v24 = &unk_140752308;
*((_QWORD *)&v24 + 1) = 0;
fmt::BasicWriter::operator<<(v27, &v24);
v16 = GameManager::dpadConfigToString(v15, v26, a1 + 1388);
v24 = *(_OWORD *)fmt::BasicStringRef::BasicStringRef(v25, v16);
fmt::BasicWriter::operator<<(v27, &v24);
sub_14003D310((__int64)v26);
v24 = (unsigned __int64)&unk_140752308;
fmt::BasicWriter::operator<<(v27, &v24);
v18 = GameManager::dpadConfigToString(v17, v26, a1 + 1428);
v24 = *(_OWORD *)fmt::BasicStringRef::BasicStringRef(v25, v18);
fmt::BasicWriter::operator<<(v27, &v24);
sub_14003D310((__int64)v26);
v24 = (unsigned __int64)&unk_140752308;
fmt::BasicWriter::operator<<(v27, &v24);
v20 = GameManager::dpadConfigToString(v19, v26, a1 + 1468);
v24 = *(_OWORD *)fmt::BasicStringRef::BasicStringRef(v25, v20);
fmt::BasicWriter::operator<<(v27, &v24);
sub_14003D310((__int64)v26);
v21 = a2 - 1;
if ( !v21 )
{
v11 = (_BYTE *)fmt::BasicWriter::c_str(v27);
v12 = -1;
do
++v12;
while ( v11[v12] );
v13 = (void **)(a1 + 1608);
goto LABEL_26;
}
v22 = v21 - 1;
if ( !v22 )
{
v11 = (_BYTE *)fmt::BasicWriter::c_str(v27);
v12 = -1;
do
++v12;
while ( v11[v12] );
v13 = (void **)(a1 + 1640);
goto LABEL_26;
}
if ( v22 == 1 )
{
v11 = (_BYTE *)fmt::BasicWriter::c_str(v27);
v12 = -1;
do
++v12;
while ( v11[v12] );
v13 = (void **)(a1 + 1672);
goto LABEL_26;
}
}
else
{
v7 = GameManager::dpadConfigToString(v6, v26, a1 + 1308);
v24 = *(_OWORD *)fmt::BasicStringRef::BasicStringRef(v25, v7);
fmt::BasicWriter::operator<<(v27, &v24);
sub_14003D310((__int64)v26);
*(_QWORD *)&v24 = &unk_140752308;
*((_QWORD *)&v24 + 1) = 0;
fmt::BasicWriter::operator<<(v27, &v24);
GameVariable = GameManager::getGameVariable(a1, "0113");
fmt::BasicWriter::operator<<(v27, GameVariable);
v9 = a2 - 1;
if ( !v9 )
{
v11 = (_BYTE *)fmt::BasicWriter::c_str(v27);
v12 = -1;
do
++v12;
while ( v11[v12] );
v13 = (void **)(a1 + 1512);
goto LABEL_26;
}
v10 = v9 - 1;
if ( !v10 )
{
v11 = (_BYTE *)fmt::BasicWriter::c_str(v27);
v12 = -1;
do
++v12;
while ( v11[v12] );
v13 = (void **)(a1 + 1544);
goto LABEL_26;
}
if ( v10 == 1 )
{
v11 = (_BYTE *)fmt::BasicWriter::c_str(v27);
v12 = -1;
do
++v12;
while ( v11[v12] );
v13 = (void **)(a1 + 1576);
LABEL_26:
sub_1400405A0(v13, v11, v12);
}
}
return fmt::BasicWriter::~BasicWriter(v27);
}