//
// GameManager::saveDPadLayout from 0x140185e20 to 0x1401861dd (957 bytes)
//
// 2 xrefs:
// > UISaveLoadLayer::onSave @ 0x1402a45f7
// > ??> @ 0x1406cb634
//
// 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::saveDPadLayout(GameManager *a1, int a2, bool a3)
{
__int64 v6; // rcx
__int64 v7; // rax
bool GameVariable; // al
int v9; // edi
int v10; // edi
_BYTE *v11; // rax
size_t v12; // r8
std::string *p_m_dpadLayoutDual1; // 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 v23; // [rsp+20h] [rbp-E0h] BYREF
_BYTE v24[16]; // [rsp+30h] [rbp-D0h] BYREF
_BYTE v25[32]; // [rsp+40h] [rbp-C0h] BYREF
_BYTE v26[528]; // [rsp+60h] [rbp-A0h] BYREF
fmt::BasicWriter::BasicWriter(v26);
if ( a3 )
{
v14 = GameManager::dpadConfigToString(v6, v25, &a1->m_dpad2);
v23 = *(_OWORD *)fmt::BasicStringRef::BasicStringRef(v24, v14);
fmt::BasicWriter::operator<<(v26, &v23);
sub_14003A830((__int64)v25);
*(_QWORD *)&v23 = ";";
*((_QWORD *)&v23 + 1) = 0;
fmt::BasicWriter::operator<<(v26, &v23);
v16 = GameManager::dpadConfigToString(v15, v25, &a1->m_dpad3);
v23 = *(_OWORD *)fmt::BasicStringRef::BasicStringRef(v24, v16);
fmt::BasicWriter::operator<<(v26, &v23);
sub_14003A830((__int64)v25);
v23 = (unsigned __int64)";";
fmt::BasicWriter::operator<<(v26, &v23);
v18 = GameManager::dpadConfigToString(v17, v25, &a1->m_dpad4);
v23 = *(_OWORD *)fmt::BasicStringRef::BasicStringRef(v24, v18);
fmt::BasicWriter::operator<<(v26, &v23);
sub_14003A830((__int64)v25);
v23 = (unsigned __int64)";";
fmt::BasicWriter::operator<<(v26, &v23);
v20 = GameManager::dpadConfigToString(v19, v25, &a1->m_dpad5);
v23 = *(_OWORD *)fmt::BasicStringRef::BasicStringRef(v24, v20);
fmt::BasicWriter::operator<<(v26, &v23);
sub_14003A830((__int64)v25);
v21 = a2 - 1;
if ( !v21 )
{
v11 = (_BYTE *)fmt::BasicWriter::c_str(v26);
v12 = -1;
do
++v12;
while ( v11[v12] );
p_m_dpadLayoutDual1 = &a1->m_dpadLayoutDual1;
goto LABEL_26;
}
v22 = v21 - 1;
if ( !v22 )
{
v11 = (_BYTE *)fmt::BasicWriter::c_str(v26);
v12 = -1;
do
++v12;
while ( v11[v12] );
p_m_dpadLayoutDual1 = &a1->m_dpadLayoutDual2;
goto LABEL_26;
}
if ( v22 == 1 )
{
v11 = (_BYTE *)fmt::BasicWriter::c_str(v26);
v12 = -1;
do
++v12;
while ( v11[v12] );
p_m_dpadLayoutDual1 = &a1->m_dpadLayoutDual3;
goto LABEL_26;
}
}
else
{
v7 = GameManager::dpadConfigToString(v6, v25, &a1->m_dpad1);
v23 = *(_OWORD *)fmt::BasicStringRef::BasicStringRef(v24, v7);
fmt::BasicWriter::operator<<(v26, &v23);
sub_14003A830((__int64)v25);
*(_QWORD *)&v23 = ";";
*((_QWORD *)&v23 + 1) = 0;
fmt::BasicWriter::operator<<(v26, &v23);
GameVariable = GameManager::getGameVariable(a1, "0113");
fmt::BasicWriter::operator<<(v26, GameVariable);
v9 = a2 - 1;
if ( !v9 )
{
v11 = (_BYTE *)fmt::BasicWriter::c_str(v26);
v12 = -1;
do
++v12;
while ( v11[v12] );
p_m_dpadLayoutDual1 = &a1->m_dpadLayout1;
goto LABEL_26;
}
v10 = v9 - 1;
if ( !v10 )
{
v11 = (_BYTE *)fmt::BasicWriter::c_str(v26);
v12 = -1;
do
++v12;
while ( v11[v12] );
p_m_dpadLayoutDual1 = &a1->m_dpadLayout2;
goto LABEL_26;
}
if ( v10 == 1 )
{
v11 = (_BYTE *)fmt::BasicWriter::c_str(v26);
v12 = -1;
do
++v12;
while ( v11[v12] );
p_m_dpadLayoutDual1 = &a1->m_dpadLayout3;
LABEL_26:
sub_14003CCE0((void **)p_m_dpadLayoutDual1, v11, v12);
}
}
fmt::BasicWriter::~BasicWriter(v26);
}