//
// cocos2d::_base64Decode from 0xd90f60 to 0xd91120 (448 bytes)
//
// 2 xrefs:
// > base64Decode @ 0xd91344
// > ??> @ 0xf5db8
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:08:19 +0000
//
__int64 __fastcall cocos2d::_base64Decode(
cocos2d *this,
const unsigned __int8 *a2,
__int64 a3,
unsigned __int8 *a4,
unsigned int *a5)
{
int v6; // w3
char *v7; // x5
int v8; // t1
int v9; // w5
unsigned int v10; // w21
cocos2d *v11; // x3
int v12; // w20
int v13; // w7
int v14; // t1
int v15; // w1
__int64 result; // x0
char *v17; // x5
int v18; // t1
unsigned int v19; // w1
v6 = 64;
if ( (_BYTE)a5 )
{
v17 = &cocos2d::urlAlphabet[64];
do
{
v18 = (unsigned __int8)*v17--;
byte_1560E60[v18 + 256] = v6--;
byte_1560E60[v18] = 1;
}
while ( v6 != -1 );
}
else
{
v7 = &cocos2d::alphabet[64];
do
{
v8 = (unsigned __int8)*v7--;
byte_1560E60[v8 + 256] = v6--;
byte_1560E60[v8] = 1;
}
while ( v6 != -1 );
}
if ( !(_DWORD)a2 )
{
v10 = 0;
result = 0;
goto LABEL_14;
}
v9 = *(unsigned __int8 *)this;
if ( v9 == 61 )
{
v10 = 0;
goto LABEL_13;
}
v10 = 0;
v11 = (cocos2d *)((char *)this + (unsigned int)((_DWORD)a2 - 1));
v12 = 0;
v13 = 0;
while ( 1 )
{
if ( byte_1560E60[v9] )
{
++v12;
v15 = (unsigned __int8)byte_1560E60[v9 + 256] + v13;
v13 = v15 << 6;
if ( v12 == 4 )
break;
}
if ( this == v11 )
goto LABEL_12;
LABEL_8:
v14 = *((unsigned __int8 *)this + 1);
this = (cocos2d *)((char *)this + 1);
v9 = v14;
if ( v14 == 61 )
goto LABEL_18;
}
*(_BYTE *)(a3 + v10) = BYTE2(v15);
*(_BYTE *)(a3 + v10 + 1) = BYTE1(v15);
v12 = 0;
*(_BYTE *)(a3 + v10 + 2) = v15;
v10 += 3;
v13 = 0;
if ( this != v11 )
goto LABEL_8;
LABEL_12:
if ( v9 != 61 )
goto LABEL_13;
LABEL_18:
switch ( v12 )
{
case 2:
result = 0;
*(_BYTE *)(a3 + v10++) = v13 >> 10;
goto LABEL_14;
case 3:
v19 = v10 + 1;
*(_BYTE *)(a3 + v10) = BYTE2(v13);
result = 0;
v10 += 2;
*(_BYTE *)(a3 + v19) = BYTE1(v13);
goto LABEL_14;
case 1:
fwrite("base64Decode: encoding incomplete: at least 2 bits missing", 1u, 0x3Au, (FILE *)((char *)&_sF + 304));
result = 1;
goto LABEL_14;
}
LABEL_13:
result = 0;
LABEL_14:
*(_DWORD *)a4 = v10;
return result;
}