//
// cocos2d::VolatileTexture::reloadAllTextures from 0x801380 to 0x8015ce (590 bytes)
//
// 1 xrefs:
// > cocos2d::CCTextureCache::reloadAllTextures @ 0x8015e8
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:01:20 +0000
//
void __fastcall cocos2d::VolatileTexture::reloadAllTextures(cocos2d::VolatileTexture *this, unsigned int a2)
{
int v2; // r5
char *v3; // r9
GLuint v4; // r2
int v5; // r4
int *i; // r3
int v7; // r4
char v8; // r3
unsigned int v9; // r5
unsigned __int8 *v10; // r11
size_t v11; // r0
unsigned int v12; // r2
unsigned __int8 *v13; // r1
char *v14; // r9
unsigned __int8 *v15; // r3
int v16; // r0
const char *v17; // r1
const char *v18; // r2
unsigned __int8 *v19; // r5
unsigned __int8 **v20; // r0
int v21; // r5
float v22; // r2
const char *v23; // r1
cocos2d::CCImage *v24; // r5
cocos2d::CCFileUtils *v25; // r0
int v26; // r0
int v27; // r1
cocos2d::CCTexture2D *v28; // r0
int v29; // r11
int *v30; // [sp+10h] [bp-2Ch]
int v31[2]; // [sp+20h] [bp-1Ch] BYREF
int v32; // [sp+28h] [bp-14h] BYREF
unsigned int v33; // [sp+2Ch] [bp-10h]
unsigned __int8 *v34; // [sp+30h] [bp-Ch]
v2 = dword_D311E0;
v3 = &cocos2d::VolatileTexture::isReloading;
v4 = 1;
cocos2d::VolatileTexture::isReloading = 1;
while ( (int *)v2 != &cocos2d::VolatileTexture::textures )
{
v5 = *(_DWORD *)(v2 + 4);
cocos2d::CCTexture2D::releaseGLTexture(**(cocos2d::CCTexture2D ***)(v2 + 8), a2, v4);
v2 = v5;
}
for ( i = (int *)dword_D311E0; i != &cocos2d::VolatileTexture::textures; i = v30 )
{
v7 = i[2];
v30 = (int *)i[1];
switch ( *(_DWORD *)(v7 + 8) )
{
case 1:
v8 = *(_BYTE *)(v7 + 28);
v9 = 0;
v32 = 0;
v33 = 0;
if ( (v8 & 1) == 0 )
v3 = (char *)(v7 + 29);
v34 = nullptr;
if ( (v8 & 1) != 0 )
v3 = *(char **)(v7 + 36);
v10 = (unsigned __int8 *)&v32 + 1;
v11 = strlen(v3);
std::string::__init(&v32, v3, v11);
break;
case 2:
cocos2d::CCTexture2D::initWithData(
*(_DWORD *)v7,
*(const GLvoid **)(v7 + 12),
*(_DWORD *)(v7 + 24),
(unsigned int)*(float *)(v7 + 16),
(unsigned int)*(float *)(v7 + 20),
(float *)(v7 + 16));
goto LABEL_29;
case 3:
if ( (*(_BYTE *)(v7 + 88) & 1) != 0 )
v17 = *(const char **)(v7 + 96);
else
v17 = (const char *)(v7 + 89);
if ( (*(_BYTE *)(v7 + 76) & 1) != 0 )
v18 = *(const char **)(v7 + 84);
else
v18 = (const char *)(v7 + 77);
cocos2d::CCTexture2D::initWithString(
*(cocos2d::CCTexture2D **)v7,
v17,
v18,
*(float *)(v7 + 100),
(float *)(v7 + 60),
*(_DWORD *)(v7 + 68),
*(_DWORD *)(v7 + 72));
goto LABEL_29;
case 4:
cocos2d::CCTexture2D::initWithImage(*(cocos2d::CCTexture2D **)v7, *(cocos2d::CCImage **)(v7 + 4));
goto LABEL_29;
default:
goto LABEL_29;
}
while ( (v32 & 1) == 0 )
{
v12 = (int)(unsigned __int8)v32 >> 1;
if ( v9 >= v12 )
goto LABEL_32;
v13 = (unsigned __int8 *)&v32 + 1;
LABEL_14:
v14 = (char *)&v13[v9];
if ( (v32 & 1) != 0 )
v15 = v34;
else
v15 = (unsigned __int8 *)&v32 + 1;
v16 = v15[v9++];
*v14 = tolower(v16);
}
v12 = v33;
v13 = v34;
if ( v9 < v33 )
goto LABEL_14;
v10 = v34;
LABEL_32:
v3 = (char *)v31;
if ( v12 <= 3
|| (v19 = &v10[v12],
v20 = std::__search(
(unsigned __int8 **)v31,
v10,
&v10[v12],
".pvr",
(unsigned __int8 *)"",
(int (__fastcall *)(int, _DWORD))std::char_traits::eq),
(unsigned __int8 *)v31[0] == v19)
|| v31[0] - (_DWORD)v10 == -1 )
{
v24 = (cocos2d::CCImage *)operator new(0x48u);
v25 = cocos2d::CCImage::CCImage(v24);
v31[0] = 0;
v26 = cocos2d::CCFileUtils::sharedFileUtils(v25);
if ( (*(_BYTE *)(v7 + 28) & 1) != 0 )
v27 = *(_DWORD *)(v7 + 36);
else
v27 = v7 + 29;
v3 = (char *)(*(int (__fastcall **)(int, int, const char *, int *))(*(_DWORD *)v26 + 16))(v26, v27, "rb", v31);
v28 = (cocos2d::CCTexture2D *)cocos2d::CCImage::initWithImageData(
v24,
(int *)v3,
v31[0],
*(_DWORD *)(v7 + 40),
0,
0,
8);
if ( v28 )
{
v29 = cocos2d::CCTexture2D::defaultAlphaPixelFormat(v28);
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(*(_DWORD *)(v7 + 24));
cocos2d::CCTexture2D::initWithImage(*(cocos2d::CCTexture2D **)v7, v24);
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(v29);
}
if ( v3 )
operator delete[](v3);
cocos2d::CCObject::release(v24);
}
else
{
v21 = cocos2d::CCTexture2D::defaultAlphaPixelFormat((cocos2d::CCTexture2D *)v20);
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(*(_DWORD *)(v7 + 24));
if ( (*(_BYTE *)(v7 + 28) & 1) != 0 )
v23 = *(const char **)(v7 + 36);
else
v23 = (const char *)(v7 + 29);
cocos2d::CCTexture2D::initWithPVRFile(
*(cocos2d::CCTexture2D **)v7,
v23,
v22,
COERCE_FLOAT(*(unsigned __int8 *)(v7 + 28) << 31));
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(v21);
}
std::string::~string((int)&v32);
LABEL_29:
cocos2d::CCTexture2D::setTexParameters(*(cocos2d ***)v7, (GLint *)(v7 + 44));
}
cocos2d::VolatileTexture::isReloading = 0;
}