//
// GJMultiplayerManager::handleIt from 0x982780 to 0x982b04 (900 bytes)
//
// 3 xrefs:
// > GJMultiplayerManager::onProcessHttpRequestCompleted @ 0x982b84
// > GJMultiplayerManager::handleItND @ 0x982da0
// > ??> @ 0xbba28
//
// 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
//
__int64 __fastcall GJMultiplayerManager::handleIt(GJMultiplayerManager *a1, char a2, __int64 a3, __int64 a4, int a5)
{
char *v7; // x0
char *v8; // x1
char *v9; // x0
unsigned int *v10; // x1
int v11; // w2
char *v12; // x0
unsigned int *v13; // x1
char *v14; // x0
unsigned int *v15; // x1
unsigned int *v16; // x1
int v17; // w2
unsigned int *v18; // x1
int v19; // w2
unsigned int *v20; // x1
int v21; // w2
int v22; // [xsp+30h] [xbp+30h]
char *v23; // [xsp+48h] [xbp+48h] BYREF
const char *v24; // [xsp+50h] [xbp+50h] BYREF
if ( a2 )
{
if ( a5 != 57 )
goto LABEL_3;
LABEL_13:
sub_D18D28(&v23);
sub_D18D28(&v24);
GJMultiplayerManager::onJoinLobbyCompleted(a1, (const void **)&v23, &v24);
v12 = (char *)(v24 - 24);
if ( v24 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(v24 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *((_DWORD *)v24 - 2);
*((_DWORD *)v24 - 2) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v12);
}
v8 = v23;
v9 = v23 - 24;
if ( v23 - 24 == (char *)&qword_124B6B0 )
return _stack_chk_guard;
if ( !&pthread_create )
goto LABEL_41;
v13 = (unsigned int *)(v23 - 8);
do
v11 = __ldaxr(v13);
while ( __stlxr(v11 - 1, v13) );
LABEL_18:
if ( v11 <= 0 )
operator delete(v9);
return _stack_chk_guard;
}
v22 = a5;
sub_D1798C(a3, "-1", 2);
a5 = v22;
if ( v22 == 57 )
goto LABEL_13;
LABEL_3:
if ( a5 == 58 )
{
sub_D18D28(&v23);
sub_D18D28(&v24);
GJMultiplayerManager::onExitLobbyCompleted(a1, (const void **)&v23, &v24);
v14 = (char *)(v24 - 24);
if ( v24 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = (unsigned int *)(v24 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *((_DWORD *)v24 - 2);
*((_DWORD *)v24 - 2) = v17 - 1;
}
if ( v17 <= 0 )
operator delete(v14);
}
v8 = v23;
v9 = v23 - 24;
if ( v23 - 24 == (char *)&qword_124B6B0 )
return _stack_chk_guard;
if ( !&pthread_create )
goto LABEL_41;
v15 = (unsigned int *)(v23 - 8);
do
v11 = __ldaxr(v15);
while ( __stlxr(v11 - 1, v15) );
goto LABEL_18;
}
if ( a5 == 13 )
{
sub_D18D28(&v23);
sub_D18D28(&v24);
GJMultiplayerManager::onUploadCommentCompleted(a1, (const void **)&v23, &v24);
v7 = (char *)(v24 - 24);
if ( v24 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v24 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *((_DWORD *)v24 - 2);
*((_DWORD *)v24 - 2) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v7);
}
v8 = v23;
v9 = v23 - 24;
if ( v23 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v10 = (unsigned int *)(v23 - 8);
do
v11 = __ldaxr(v10);
while ( __stlxr(v11 - 1, v10) );
goto LABEL_18;
}
LABEL_41:
v11 = *((_DWORD *)v8 - 2);
*((_DWORD *)v8 - 2) = v11 - 1;
goto LABEL_18;
}
}
return _stack_chk_guard;
}