//
// cocos2d::CCFileUtils::getFileData from 0x100150b24 to 0x100150c54 (304 bytes)
//
// 2 xrefs:
// > ??> @ 0x10079a3f8
// > ??> @ 0x1007c7cc8
//
// 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)
{
std::string *p_p; // x0
FILE *v8; // x0
FILE *v9; // x22
size_t v10; // x23
void *v11; // x20
std::string *v12; // x0
std::string __p; // [xsp+8h] [xbp-48h] BYREF
*a4 = 0;
((void (__fastcall *)(std::string *__return_ptr))a1->createCCArrayWithContentsOfFile)(&__p);
if ( (__p.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
p_p = &__p;
else
p_p = (std::string *)__p.__r_.__value_.__r.__words[0];
v8 = fopen((const char *)p_p, a3);
v9 = v8;
if ( v8 )
{
fseek(v8, 0, 2);
*a4 = ftell(v9);
fseek(v9, 0, 0);
v10 = *a4;
v11 = operator new[](*a4);
*a4 = fread(v11, 1u, v10, v9);
fclose(v9);
}
else
{
v11 = nullptr;
}
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
{
operator delete(__p.__r_.__value_.__l.__data_);
if ( v11 )
return (unsigned __int8 *)v11;
}
else if ( v11 )
{
return (unsigned __int8 *)v11;
}
sub_100009900(&__p, "Get data from file(");
v12 = std::string::append(&__p, a2);
std::string::append(v12, ") failed!");
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
return (unsigned __int8 *)v11;
}