//
// GJBigSprite::updateSpriteVisibility from 0x640198 to 0x64047c (740 bytes)
//
// 4 xrefs:
// > MapSelectLayer::update @ 0x6404fa
// > MapSelectLayer::update @ 0x640550
// > MapSelectLayer::ccTouchMoved @ 0x640656
// > MapSelectLayer::init @ 0x640bce
//
// 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 11:55:28 +0000
//
cocos2d::CCTexture2D *__fastcall GJBigSprite::updateSpriteVisibility(cocos2d::CCTexture2D *this)
{
int v1; // r5
int v2; // r10
float v3; // r0
float v4; // s18
float v5; // s16
unsigned int v6; // r7
float v7; // s17
int v8; // r0
float v9; // s17
float v10; // s18
float v11; // s19
float v12; // s20
int v13; // r4
float *v14; // r0
int v15; // r0
int v16; // r0
int v17; // r2
const cocos2d::CCRect *v18; // r2
int v19; // r6
int v20; // r0
cocos2d::CCSprite *v21; // r0
int v22; // r0
void (__fastcall *v23)(int, int); // [sp+Ch] [bp-40h]
void (__fastcall *v24)(int, int); // [sp+Ch] [bp-40h]
float v25[2]; // [sp+10h] [bp-3Ch] BYREF
int v26[3]; // [sp+18h] [bp-34h] BYREF
_BYTE v27[16]; // [sp+24h] [bp-28h] BYREF
float v28[4]; // [sp+34h] [bp-18h] BYREF
v1 = (int)this;
if ( !*((_BYTE *)this + 289) )
{
v2 = cocos2d::CCTexture2D::defaultAlphaPixelFormat(this);
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(1);
v3 = COERCE_FLOAT((*(int (__fastcall **)(int))(*(_DWORD *)v1 + 84))(v1));
v4 = v3;
if ( *(_BYTE *)(v1 + 288) )
v5 = 10.0 / v3;
else
v5 = 0.0;
cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)LODWORD(v3));
v6 = 0;
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v25);
v7 = *(float *)(*(int (__fastcall **)(int))(*(_DWORD *)v1 + 96))(v1);
v8 = (*(int (__fastcall **)(int))(*(_DWORD *)v1 + 96))(v1);
cocos2d::CCRect::CCRect(
(cocos2d::CCRect *)v27,
(float)((float)-v7 / v4) - v5,
(float)((float)-*(float *)(v8 + 4) / v4) - v5,
(float)(v25[0] / v4) + (float)(v5 + v5),
(float)(v25[1] / v4) + (float)(v5 + v5));
v9 = COERCE_FLOAT(cocos2d::CCRect::getMaxX((cocos2d::CCRect *)v27));
v10 = COERCE_FLOAT(cocos2d::CCRect::getMinX((cocos2d::CCRect *)v27));
v11 = COERCE_FLOAT(cocos2d::CCRect::getMaxY((cocos2d::CCRect *)v27));
v12 = COERCE_FLOAT(cocos2d::CCRect::getMinY((cocos2d::CCRect *)v27));
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v28, 0.0, 0.0, 120.0, 50.0);
while ( 1 )
{
if ( v6 >= cocos2d::CCArray::count(*(cocos2d::CCArray **)(v1 + 276)) )
return (cocos2d::CCTexture2D *)cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(v2);
v13 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v1 + 276), v6);
v14 = (float *)(*(int (__fastcall **)(int))(*(_DWORD *)v13 + 96))(v13);
v28[0] = *v14 - (float)(v28[2] * 0.5);
v15 = (*(int (__fastcall **)(int))(*(_DWORD *)v13 + 96))(v13);
v28[1] = *(float *)(v15 + 4) - (float)(v28[3] * 0.5);
if ( v9 < COERCE_FLOAT(cocos2d::CCRect::getMinX((cocos2d::CCRect *)v28))
|| COERCE_FLOAT(cocos2d::CCRect::getMaxX((cocos2d::CCRect *)v28)) < v10
|| v11 < COERCE_FLOAT(cocos2d::CCRect::getMinY((cocos2d::CCRect *)v28))
|| COERCE_FLOAT(cocos2d::CCRect::getMaxY((cocos2d::CCRect *)v28)) < v12 )
{
v16 = *(_DWORD *)(v13 + 276);
*(_BYTE *)(v13 + 296) = 0;
if ( v16 )
{
(*(void (__fastcall **)(int))(*(_DWORD *)v16 + 268))(v16);
*(_DWORD *)(v13 + 276) = 0;
std::string::basic_string(v26, v13 + 264);
GJBigSprite::unloadSprite((cocos2d::CCTextureCache *)v1, (int)v26, v6);
std::string::~string((int)v26);
}
}
else
{
v17 = *(_DWORD *)(v13 + 276);
*(_BYTE *)(v13 + 296) = 1;
if ( v17 )
goto LABEL_15;
if ( *(_BYTE *)(v1 + 288) )
{
std::string::basic_string(v26, v13 + 264);
GJBigSprite::loadSpriteAsync(v1, (int)v26, v6);
std::string::~string((int)v26);
if ( *(_DWORD *)(v13 + 276) )
goto LABEL_15;
v19 = cocos2d::CCSprite::create(
(cocos2d::CCSprite *)"mapimages/image_small.png",
(const char *)(v13 + 280),
v18);
(*(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v19 + 64))(v19, *(_DWORD *)(v1 + 280));
(*(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v19 + 72))(v19, *(_DWORD *)(v1 + 284));
v23 = *(void (__fastcall **)(int, int))(*(_DWORD *)v19 + 92);
v20 = (*(int (__fastcall **)(int))(*(_DWORD *)v13 + 96))(v13);
v23(v19, v20);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v19 + 36))(v19, -1);
}
else
{
*(_DWORD *)(*(_DWORD *)(v1 + 264) + 4 * (v6 >> 5)) |= 1 << (v6 & 0x1F);
if ( (*(_BYTE *)(v13 + 264) & 1) != 0 )
v21 = *(cocos2d::CCSprite **)(v13 + 272);
else
v21 = (cocos2d::CCSprite *)(v13 + 265);
v19 = cocos2d::CCSprite::create(v21, (const char *)(v6 >> 5));
v24 = *(void (__fastcall **)(int, int))(*(_DWORD *)v19 + 92);
v22 = (*(int (__fastcall **)(int))(*(_DWORD *)v13 + 96))(v13);
v24(v19, v22);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v19 + 80))(v19, 1065369993);
}
(*(void (__fastcall **)(int, int))(*(_DWORD *)v1 + 228))(v1, v19);
*(_DWORD *)(v13 + 276) = v19;
}
LABEL_15:
++v6;
}
}
return this;
}