//
// LeaderboardsLayer::loadLeaderboardFailed from 0x81fc14 to 0x81fe80 (620 bytes)
//
// 3 xrefs:
// > `non-virtual thunk to'LeaderboardsLayer::loadLeaderboardFailed @ 0x81fe84
// > ??> @ 0xc2670
// > ??> @ 0x1186b30
//
// 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 LeaderboardsLayer::loadLeaderboardFailed(LeaderboardsLayer *a1, const char *a2)
{
_BOOL4 isCorrect; // w24
char *v4; // x0
TextArea *m_noInternet; // x24
_DWORD *v6; // x20
char *v7; // x0
unsigned int *v8; // x1
int v9; // w2
TextArea *v10; // x24
unsigned int *v11; // x20
int v12; // w1
unsigned int *v13; // x20
_DWORD *v14; // [xsp+50h] [xbp+50h] BYREF
sub_D153B8((int)&v14, (char *)a2);
isCorrect = LeaderboardsLayer::isCorrect((__int64)a1, (const void **)&v14);
v4 = (char *)(v14 - 6);
if ( v14 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v8 = v14 - 2;
do
v9 = __ldaxr(v8);
while ( __stlxr(v9 - 1, v8) );
}
else
{
v9 = *(v14 - 2);
*(v14 - 2) = v9 - 1;
}
if ( v9 <= 0 )
operator delete(v4);
}
if ( isCorrect )
{
a1->m_circle->setVisible(a1->m_circle, 0);
if ( PlatformToolbox::isNetworkAvailable() )
{
if ( a1->m_type != Friends )
return;
m_noInternet = a1->m_noInternet;
sub_D153B8((int)&v14, "Create an account to\ncompare scores\nwith friends!");
TextArea::setString((__int64)m_noInternet, (const void **)&v14);
v6 = v14;
v7 = (char *)(v14 - 6);
if ( v14 - 6 == (_DWORD *)&qword_124B6B0 )
{
LABEL_7:
a1->m_noInternet->setVisible(a1->m_noInternet, 1);
return;
}
if ( &pthread_create )
{
v13 = v14 - 2;
do
v12 = __ldaxr(v13);
while ( __stlxr(v12 - 1, v13) );
goto LABEL_17;
}
}
else
{
v10 = a1->m_noInternet;
sub_D153B8((int)&v14, "No Internet connection!");
TextArea::setString((__int64)v10, (const void **)&v14);
v6 = v14;
v7 = (char *)(v14 - 6);
if ( v14 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_7;
if ( &pthread_create )
{
v11 = v14 - 2;
do
v12 = __ldaxr(v11);
while ( __stlxr(v12 - 1, v11) );
goto LABEL_17;
}
}
v12 = *(v6 - 2);
*(v6 - 2) = v12 - 1;
LABEL_17:
if ( v12 <= 0 )
operator delete(v7);
goto LABEL_7;
}
}