//
// cocos2d::CCFileUtils::getFileData from 0x10043ad80 to 0x10043ae9e (286 bytes)
//
// 2 xrefs:
// > ??> @ 0x100937fa8
// > ??> @ 0x100980548
//
// 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
//
unsigned __int8 *__fastcall cocos2d::CCFileUtils::getFileData(
cocos2d::CCFileUtils *a1,
const char *a2,
const char *a3,
unsigned __int64 *a4)
{
const char *data; // rdi
FILE *v7; // rax
FILE *v8; // r12
size_t v9; // r13
void *v10; // r15
std::string *v11; // rax
std::string v13; // [rsp+0h] [rbp-40h] BYREF
*a4 = 0;
((void (__fastcall *)(std::string *, cocos2d::CCFileUtils *, const char *, _QWORD))a1->createCCArrayWithContentsOfFile)(
&v13,
a1,
a2,
0);
if ( (*(_BYTE *)&v13.__r_.__value_.__s.0 & 1) != 0 )
data = v13.__r_.__value_.__l.__data_;
else
data = v13.__r_.__value_.__s.__data_;
v7 = fopen(data, a3);
v8 = v7;
if ( !v7 )
{
v10 = nullptr;
if ( (*(_BYTE *)&v13.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_7;
goto LABEL_6;
}
fseek(v7, 0, 2);
*a4 = ftell(v8);
fseek(v8, 0, 0);
v9 = *a4;
v10 = operator new[](*a4);
*a4 = fread(v10, 1u, v9, v8);
fclose(v8);
if ( (*(_BYTE *)&v13.__r_.__value_.__s.0 & 1) != 0 )
LABEL_6:
operator delete(v13.__r_.__value_.__l.__data_);
LABEL_7:
if ( !v10 )
{
strcpy((char *)&v13, "&Get data from file(");
v11 = std::string::append(&v13, a2);
std::string::append(v11, ") failed!");
if ( (*(_BYTE *)&v13.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v13.__r_.__value_.__l.__data_);
}
return (unsigned __int8 *)v10;
}