//
// GameManager::loadDPadLayout from 0x324914 to 0x324a80 (364 bytes)
//
// 1 xrefs:
// > UISaveLoadLayer::onLoad @ 0x4b30a4
//
// 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
//
void GameManager::loadDPadLayout(GameManager *a1, int a2, bool a3)
{
std::string *p_m_dpadLayout1; // r0
GameManager *v5; // r7
int v6; // r0
bool v7; // r2
std::string *p_m_dpadLayoutDual1; // r0
int v9; // [sp+0h] [bp-20h] BYREF
int v10; // [sp+4h] [bp-1Ch] BYREF
int v11; // [sp+8h] [bp-18h] BYREF
int v12; // [sp+Ch] [bp-14h] BYREF
char *v13; // [sp+10h] [bp-10h] BYREF
int v14; // [sp+14h] [bp-Ch]
int v15; // [sp+18h] [bp-8h]
if ( a3 )
{
if ( a2 == 1 )
{
p_m_dpadLayoutDual1 = &a1->m_dpadLayoutDual1;
}
else if ( a2 == 2 )
{
p_m_dpadLayoutDual1 = &a1->m_dpadLayoutDual2;
}
else
{
p_m_dpadLayoutDual1 = &a1->m_dpadLayoutDual3;
}
v13 = nullptr;
v14 = 0;
v15 = 0;
sub_323710(p_m_dpadLayoutDual1, ";", (int)&v13);
if ( (unsigned int)(v14 - (_DWORD)v13) >> 2 )
{
sub_775C20(&v9, v13);
GameManager::loadDpadFromString((int)a1, (int)&a1->m_dpad2, &v9);
sub_774008(&v9);
sub_775C20(&v10, v13 + 4);
GameManager::loadDpadFromString((int)a1, (int)&a1->m_dpad3, &v10);
sub_774008(&v10);
sub_775C20(&v11, v13 + 8);
GameManager::loadDpadFromString((int)a1, (int)&a1->m_dpad4, &v11);
sub_774008(&v11);
sub_775C20(&v12, v13 + 12);
GameManager::loadDpadFromString((int)a1, (int)&a1->m_dpad5, &v12);
sub_774008(&v12);
}
}
else
{
if ( a2 == 1 )
{
p_m_dpadLayout1 = &a1->m_dpadLayout1;
}
else if ( a2 == 2 )
{
p_m_dpadLayout1 = &a1->m_dpadLayout2;
}
else
{
p_m_dpadLayout1 = &a1->m_dpadLayout3;
}
v13 = nullptr;
v14 = 0;
v15 = 0;
sub_323710(p_m_dpadLayout1, ";", (int)&v13);
if ( (unsigned int)(v14 - (_DWORD)v13) > 7 )
{
sub_775C20(&v12, v13);
GameManager::loadDpadFromString((int)a1, (int)&a1->m_dpad1, &v12);
sub_774008(&v12);
v5 = GameManager::sharedState();
v6 = atoi(*(const char **)&byte_4[(_DWORD)v13]);
v7 = v6;
if ( v6 )
v7 = 1;
GameManager::setGameVariable(v5, "0113", v7);
}
}
std::vector::~vector((void **)&v13);
GameManager::prepareDPadSettings(a1);
}