//
// GJBaseGameLayer::queueButton from 0x4756fc to 0x4757f6 (250 bytes)
//
// 13 xrefs:
// > UILayer::handleKeypress @ 0x30d4e6
// > UILayer::processUINodeTouch @ 0x30d868
// > UILayer::processUINodeTouch @ 0x30d88e
// > UILayer::processUINodeTouch @ 0x30d90c
// > UILayer::processUINodeTouch @ 0x30d922
// > UILayer::processUINodeTouch @ 0x30d946
// > UILayer::processUINodeTouch @ 0x30d980
// > UILayer::processUINodeTouch @ 0x30d994
// > UILayer::ccTouchBegan @ 0x30db4c
// > UILayer::ccTouchEnded @ 0x30dbd4
// > PlayLayer::resetLevel @ 0x31fe0c
// > EditorUI::playerTouchBegan @ 0x381fdc
// > EditorUI::playerTouchEnded @ 0x38204a
//
// 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 GJBaseGameLayer::queueButton(GJBaseGameLayer *a1, int a2, bool a3, bool a4, double a5)
{
std::vector
*p_m_queuedButtons; // r6
PlayerButtonCommand *m_finish; // r5
int v10; // r1
__int64 v11; // r2
int v12; // r5
int v13; // r2
bool v14; // cf
unsigned int v15; // r2
int v16; // r5
PlayerButtonCommand *v17; // r11
PlayerButtonCommand *m_start; // r12
signed int v19; // r10
char *v20; // r7
int v21; // r1
__int64 v22; // r2
int v23; // r10
_QWORD v24[3]; // [sp+8h] [bp-1Ch] BYREF
if ( a2 )
{
p_m_queuedButtons = &a1->m_queuedButtons;
memset(v24, 0, sizeof(v24));
m_finish = p_m_queuedButtons->m_finish;
if ( m_finish == p_m_queuedButtons->m_reserveEnd )
{
v12 = -1431655765 * (((char *)m_finish - (char *)p_m_queuedButtons->m_start) >> 3);
if ( v12 )
v13 = v12;
else
v13 = 1;
v14 = __CFADD__(v13, v12);
v15 = v13 + v12;
v16 = 178956970;
if ( v14 || v15 > 0xAAAAAAA || (v16 = v15) != 0 )
v17 = (PlayerButtonCommand *)operator new(24 * v16);
else
v17 = nullptr;
m_start = p_m_queuedButtons->m_start;
v19 = (char *)p_m_queuedButtons->m_finish - (char *)p_m_queuedButtons->m_start;
if ( (char *)v17 + v19 )
{
*(double *)&v24[2] = a5;
BYTE4(v24[0]) = a3;
v20 = (char *)v17 + v19;
LODWORD(v24[0]) = a2;
BYTE5(v24[0]) = a4;
v21 = HIDWORD(v24[0]);
v22 = v24[1];
*(_DWORD *)v20 = a2;
*((_DWORD *)v20 + 1) = v21;
*((_QWORD *)v20 + 1) = v22;
*(_QWORD *)((char *)&v17->m_timestamp + v19) = v24[2];
}
if ( -1431655765 * (v19 >> 3) )
memmove(v17, m_start, v19);
v23 = v19 + 24;
if ( p_m_queuedButtons->m_start )
operator delete(p_m_queuedButtons->m_start);
p_m_queuedButtons->m_start = v17;
p_m_queuedButtons->m_finish = (PlayerButtonCommand *)((char *)v17 + v23);
p_m_queuedButtons->m_reserveEnd = &v17[v16];
}
else
{
if ( m_finish )
{
*(double *)&v24[2] = a5;
BYTE4(v24[0]) = a3;
LODWORD(v24[0]) = a2;
BYTE5(v24[0]) = a4;
v10 = HIDWORD(v24[0]);
v11 = v24[1];
m_finish->m_button = a2;
*(_DWORD *)&m_finish->m_isPush = v10;
*(_QWORD *)&m_finish->m_step = v11;
*(_QWORD *)&m_finish->m_timestamp = v24[2];
}
p_m_queuedButtons->m_finish = m_finish + 1;
}
}
}