//
// cocos2d::VolatileTexture::reloadAllTextures from 0xb35a64 to 0xb35d90 (812 bytes)
//
// 2 xrefs:
// > cocos2d::CCTextureCache::reloadAllTextures @ 0xb35d90
// > ??> @ 0xb0d78
//
// 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
//
char *__fastcall cocos2d::VolatileTexture::reloadAllTextures(cocos2d::VolatileTexture *this)
{
__int64 *v1; // x21
cocos2d::CCTexture2D **v2; // x0
__int64 *v3; // x23
__int64 v4; // x19
__int64 v6; // x21
unsigned int v7; // w22
__int64 v8; // x0
_BYTE *v9; // x24
unsigned __int8 *v10; // x0
cocos2d::CCTexture2DPixelFormat v11; // w21
void *v12; // x0
unsigned int *v13; // x2
int v14; // w1
cocos2d::CCImage *v15; // x21
cocos2d::CCFileUtils *v16; // x0
void *v17; // x22
cocos2d::CCTexture2DPixelFormat v18; // w24
__int64 v19; // [xsp+0h] [xbp+0h] BYREF
void *v20; // [xsp+68h] [xbp+68h]
__int64 v21; // [xsp+78h] [xbp+78h] BYREF
int v22[2]; // [xsp+80h] [xbp+80h] BYREF
v1 = (__int64 *)cocos2d::VolatileTexture::textures;
cocos2d::VolatileTexture::isReloading = 1;
if ( (__int64 *)cocos2d::VolatileTexture::textures != &cocos2d::VolatileTexture::textures )
{
do
{
v2 = (cocos2d::CCTexture2D **)v1[2];
v1 = (__int64 *)*v1;
cocos2d::CCTexture2D::releaseGLTexture(*v2);
}
while ( v1 != &cocos2d::VolatileTexture::textures );
v3 = (__int64 *)*v1;
if ( (__int64 *)*v1 != v1 )
{
v20 = ".pvr";
while ( 1 )
{
v4 = v3[2];
v3 = (__int64 *)*v3;
switch ( *(_DWORD *)(v4 + 16) )
{
case 1:
v6 = 0;
v7 = 0;
sub_D153B8((unsigned int)&v19 + 120, *(char **)(v4 + 48));
v8 = v21;
if ( *(_QWORD *)(v21 - 24) )
{
do
{
if ( (*(_DWORD *)(v8 - 8) & 0x80000000) == 0 )
sub_D176A8(&v21);
v9 = (_BYTE *)(v21 + v6);
v10 = (unsigned __int8 *)(v21 + v6);
if ( (*(_DWORD *)(v21 - 8) & 0x80000000) == 0 )
{
sub_D176A8(&v21);
v10 = (unsigned __int8 *)(v21 + v6);
}
v6 = ++v7;
*v9 = tolower(*v10);
v8 = v21;
}
while ( (unsigned __int64)v7 < *(_QWORD *)(v21 - 24) );
}
if ( sub_D1641C((int)&v21, v20) != -1 )
{
v11 = cocos2d::CCTexture2D::defaultAlphaPixelFormat();
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(*(cocos2d::CCTexture2DPixelFormat *)(v4 + 40));
cocos2d::CCTexture2D::initWithPVRFile(*(cocos2d::CCTexture2D **)v4, *(const char **)(v4 + 48));
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(v11);
goto LABEL_17;
}
v15 = (cocos2d::CCImage *)operator new(0x50u);
cocos2d::CCImage::CCImage(v15);
*(_QWORD *)v22 = 0;
v16 = cocos2d::CCFileUtils::sharedFileUtils();
v17 = (void *)((__int64 (__fastcall *)(cocos2d::CCFileUtils *, _QWORD, char *, int *))v16->addSearchResolutionsOrder)(
v16,
*(_QWORD *)(v4 + 48),
"rb",
v22);
if ( !cocos2d::CCImage::initWithImageData(
v15,
v17,
v22[0],
*(cocos2d::CCImage::EImageFormat *)(v4 + 56),
0,
0,
8,
0) )
{
if ( !v17 )
goto LABEL_28;
LABEL_27:
operator delete[](v17);
goto LABEL_28;
}
v18 = cocos2d::CCTexture2D::defaultAlphaPixelFormat();
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(*(cocos2d::CCTexture2DPixelFormat *)(v4 + 40));
cocos2d::CCTexture2D::initWithImage(*(cocos2d::CCTexture2D **)v4, v15);
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(v18);
if ( v17 )
goto LABEL_27;
LABEL_28:
cocos2d::CCObject::release(v15);
LABEL_17:
v12 = (void *)(v21 - 24);
if ( (__int64 *)(v21 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v13 = (unsigned int *)(v21 - 8);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
}
else
{
v14 = *(_DWORD *)(v21 - 8);
*(_DWORD *)(v21 - 8) = v14 - 1;
}
if ( v14 <= 0 )
operator delete(v12);
}
LABEL_7:
cocos2d::CCTexture2D::setTexParameters(*(cocos2d::CCTexture2D **)v4, (cocos2d::ccTexParams *)(v4 + 60));
if ( v3 == &cocos2d::VolatileTexture::textures )
goto LABEL_8;
break;
case 2:
cocos2d::CCTexture2D::initWithData(
*(cocos2d::CCTexture2D **)v4,
*(const void **)(v4 + 24),
*(cocos2d::CCTexture2DPixelFormat *)(v4 + 40),
(unsigned int)*(float *)(v4 + 32),
(unsigned int)*(float *)(v4 + 36),
(const cocos2d::CCSize *)(v4 + 32));
goto LABEL_7;
case 3:
cocos2d::CCTexture2D::initWithString(
*(cocos2d::VolatileTexture **)v4,
*(cocos2d::CCTexture2D **)(v4 + 104),
*(char **)(v4 + 96),
(float *)(v4 + 76),
*(_DWORD *)(v4 + 84),
*(_DWORD *)(v4 + 88),
*(float *)(v4 + 112));
goto LABEL_7;
case 4:
cocos2d::CCTexture2D::initWithImage(*(cocos2d::CCTexture2D **)v4, *(cocos2d::CCImage **)(v4 + 8));
goto LABEL_7;
default:
goto LABEL_7;
}
}
}
}
LABEL_8:
cocos2d::VolatileTexture::isReloading = 0;
return &cocos2d::VolatileTexture::isReloading;
}