//
// cocos2d::CCArray::createWithContentsOfFileThreadSafe from 0x180006d20 to 0x180006ed8 (440 bytes)
//
// 3 xrefs:
// > cocos2d::CCArray::createWithContentsOfFile @ 0x180006cf6
// > ??> @ 0x18014cf68
// > ??> @ 0x1801b7978
//
// This function is hookable on this platform (idp: pc, 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 11:21:18 +0000
//
// Hidden C++ exception states: #wind=1
struct cocos2d::CCArray *__fastcall cocos2d::CCArray::createWithContentsOfFileThreadSafe(const char *Src)
{
size_t v2; // rax
size_t v3; // rbx
__int64 v4; // rsi
unsigned __int64 v5; // rax
size_t v6; // rax
__int64 v7; // rax
_QWORD *v8; // rdi
struct cocos2d::CCFileUtils *v9; // rax
__int64 v10; // rbx
void *v11; // r8
void *Block[2]; // [rsp+30h] [rbp-38h] BYREF
__int128 v14; // [rsp+40h] [rbp-28h]
*(_OWORD *)Block = 0;
v14 = 0;
v2 = strlen(Src);
v3 = v2;
v4 = 0x7FFFFFFFFFFFFFFFLL;
if ( v2 > 0x7FFFFFFFFFFFFFFFLL )
std::vector::_Xlen();
if ( v2 <= 0xF )
{
*(_QWORD *)&v14 = v2;
*((_QWORD *)&v14 + 1) = 15;
memcpy(Block, Src, v2);
*((_BYTE *)Block + v3) = 0;
goto LABEL_15;
}
v5 = v2 | 0xF;
if ( v5 > 0x7FFFFFFFFFFFFFFFLL )
{
v6 = 0x8000000000000027uLL;
LABEL_6:
v7 = sub_1800E4AC0(v6);
if ( !v7 )
goto LABEL_18;
v8 = (_QWORD *)((v7 + 39) & 0xFFFFFFFFFFFFFFE0uLL);
*(v8 - 1) = v7;
goto LABEL_14;
}
v4 = v5;
if ( v5 < 0x16 )
v4 = 22;
if ( (unsigned __int64)(v4 + 1) >= 0x1000 )
{
v6 = v4 + 40;
if ( v4 + 40 < (unsigned __int64)(v4 + 1) )
Concurrency::cancel_current_task();
goto LABEL_6;
}
v8 = (_QWORD *)sub_1800E4AC0(v4 + 1);
LABEL_14:
Block[0] = v8;
*(_QWORD *)&v14 = v3;
*((_QWORD *)&v14 + 1) = v4;
memcpy(v8, Src, v3);
*((_BYTE *)v8 + v3) = 0;
LABEL_15:
v9 = cocos2d::CCFileUtils::sharedFileUtils();
v10 = (*(__int64 (__fastcall **)(struct cocos2d::CCFileUtils *, void **))(*(_QWORD *)v9 + 248LL))(v9, Block);
if ( *((_QWORD *)&v14 + 1) > 0xFu )
{
v11 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v14 + 1) + 1LL) >= 0x1000 )
{
v11 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v11 - 8) > 0x1F )
LABEL_18:
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free_0(v11);
}
return (struct cocos2d::CCArray *)v10;
}