//
// sub_10056E740 from 0x10056e740 to 0x10056e899 (345 bytes)
//
// 1 xrefs:
// > ??> @ 0x1009641a8
//
// 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 __fastcall sub_10056E740(unsigned __int8 *a1)
{
unsigned int v1; // eax
unsigned int v2; // edx
char *v3; // r14
__int64 v4; // rdx
char *v5; // r15
void *v6; // rax
char *v7; // rax
cocos2d::CCUserDefault *v8; // rax
pthread_t *v9; // rax
__int128 v10; // [rsp-38h] [rbp-38h] BYREF
__int64 v11; // [rsp-28h] [rbp-28h]
if ( !*((_QWORD *)a1 + 18) )
{
v1 = a1[80];
if ( (v1 & 1) != 0 )
{
if ( !*((_QWORD *)a1 + 11) )
return;
}
else if ( !(v1 >> 1) )
{
return;
}
v2 = a1[56];
if ( (v2 & 1) != 0 )
{
v4 = *((_QWORD *)a1 + 8);
if ( !v4 )
return;
v3 = *((char **)a1 + 9);
if ( v4 < 4 )
return;
}
else
{
if ( !a1[56] )
return;
v3 = (char *)(a1 + 57);
v4 = v2 >> 1;
if ( v4 < 4 )
return;
}
v5 = &v3[v4];
v6 = v3;
do
{
v7 = (char *)memchr(v6, 46, v4 - 3);
if ( !v7 )
break;
if ( *(_DWORD *)v7 == 1885960750 )
{
if ( v7 != v5
&& v7 - v3 != -1
&& (*(unsigned __int8 (__fastcall **)(unsigned __int8 *))(*(_QWORD *)a1 + 16LL))(a1) )
{
v8 = cocos2d::CCUserDefault::sharedUserDefault();
cocos2d::CCUserDefault::getStringForKey_1(&v10, v8, "downloaded-version-code");
if ( (a1[104] & 1) != 0 )
operator delete(*((void **)a1 + 15));
*((_QWORD *)a1 + 15) = v11;
*(_OWORD *)(a1 + 104) = v10;
v9 = (pthread_t *)operator new(8u);
*v9 = nullptr;
*((_QWORD *)a1 + 18) = v9;
pthread_create(v9, nullptr, (void *(__cdecl *)(void *))sub_10056DCE0, a1);
}
return;
}
v6 = v7 + 1;
v4 = v5 - (_BYTE *)v6;
}
while ( v5 - (_BYTE *)v6 >= 4 );
}
}