//
// cocos2d::CCTextureCache::reloadTexture from 0x1800a96e0 to 0x1800a9824 (324 bytes)
//
// 2 xrefs:
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b7ec0
//
// 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
//
// Hidden C++ exception states: #wind=2
__int64 __fastcall cocos2d::CCTextureCache::reloadTexture(cocos2d::CCTextureCache *this, const char *a2)
{
struct cocos2d::CCFileUtils *v4; // rax
unsigned __int8 v5; // di
cocos2d::CCTexture2D *v6; // rsi
char *v7; // rdx
cocos2d::CCImage *v8; // rax
struct cocos2d::CCImage *v9; // rbx
void **v10; // rdx
void *v11; // rcx
void *Block[3]; // [rsp+28h] [rbp-40h] BYREF
unsigned __int64 v14; // [rsp+40h] [rbp-28h]
v4 = cocos2d::CCFileUtils::sharedFileUtils();
((void (__fastcall *)(struct cocos2d::CCFileUtils *, void **, const char *, _QWORD))v4->createCCArrayWithContentsOfFile)(
v4,
Block,
a2,
0);
if ( Block[2] )
{
v6 = (cocos2d::CCTexture2D *)cocos2d::CCDictionary::objectForKey(
(__int64)this->m_pTextures,
(unsigned __int8 *)Block);
v5 = 0;
if ( v6 )
{
v8 = (cocos2d::CCImage *)operator new(0x50u);
if ( v8 )
v9 = cocos2d::CCImage::CCImage(v8);
else
v9 = nullptr;
if ( v9 )
{
v10 = Block;
if ( v14 > 0xF )
v10 = (void **)Block[0];
if ( (unsigned __int8)cocos2d::CCImage::initWithImageFile(v9, (const char *)v10, kFmtPng) )
v5 = cocos2d::CCTexture2D::initWithImage(v6, v9);
}
}
else
{
v7 = (char *)Block;
if ( v14 > 0xF )
v7 = (char *)Block[0];
v5 = cocos2d::CCTextureCache::addImage(this, v7, 0) != nullptr;
}
}
else
{
v5 = 0;
}
if ( v14 > 0xF )
{
v11 = Block[0];
if ( v14 + 1 >= 0x1000 )
{
v11 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v11 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v11);
}
return v5;
}