//
// GJBigSprite::updateSpriteVisibility from 0xac33a4 to 0xac3830 (1164 bytes)
//
// 5 xrefs:
// > MapSelectLayer::update @ 0xac38f4
// > MapSelectLayer::update @ 0xac39dc
// > MapSelectLayer::ccTouchMoved @ 0xac3b00
// > MapSelectLayer::init @ 0xac4150
// > ??> @ 0xc1b28
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:01:06 +0000
//
__int64 __fastcall GJBigSprite::updateSpriteVisibility(GJBigSprite *this)
{
cocos2d::CCTexture2D *v2; // x0
unsigned int v4; // w28
float v5; // s9
float v6; // s0
float v7; // s10
cocos2d::CCDirector *v8; // x0
unsigned __int64 v9; // x21
int v10; // w24
__int64 v11; // x0
float v12; // s0
float v13; // s9
float v14; // s0
float v15; // s10
float v16; // s0
float v17; // s11
float v18; // s0
float v19; // s13
__int64 v20; // x19
float v21; // s0
__int64 v22; // x0
__int64 v23; // x1
float v24; // s0
float v25; // s0
float v26; // s0
__int64 v27; // x0
__int64 v28; // x1
const cocos2d::CCRect *v29; // x2
__int64 v30; // x24
void (__fastcall *v31)(__int64, __int64); // x27
__int64 v32; // x0
cocos2d::CCSprite *v33; // x0
const char *v34; // x1
void (__fastcall *v35)(__int64, __int64); // x27
__int64 v36; // x0
float v37; // [xsp+90h] [xbp+90h]
__int64 v38; // [xsp+A8h] [xbp+A8h] BYREF
_BYTE v39[16]; // [xsp+B0h] [xbp+B0h] BYREF
float v40[4]; // [xsp+C0h] [xbp+C0h] BYREF
__int64 v41; // [xsp+D0h] [xbp+D0h] BYREF
__int64 v42; // [xsp+D8h] [xbp+D8h]
void *v43; // [xsp+E0h] [xbp+E0h]
v2 = (cocos2d::CCTexture2D *)*((unsigned __int8 *)this + 361);
if ( !(_DWORD)v2 )
{
v4 = cocos2d::CCTexture2D::defaultAlphaPixelFormat(v2);
v5 = 0.0;
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(1);
v6 = (*(float (__fastcall **)(GJBigSprite *))(*(_QWORD *)this + 168LL))(this);
v7 = v6;
if ( *((_BYTE *)this + 360) )
v5 = 10.0 / v6;
v8 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)*((unsigned __int8 *)this
+ 360));
v9 = 0;
cocos2d::CCDirector::getWinSize(&v38, v8);
v10 = 0;
v37 = (float)((float)-*(float *)(*(__int64 (__fastcall **)(GJBigSprite *))(*(_QWORD *)this + 192LL))(this) / v7)
- v5;
v11 = (*(__int64 (__fastcall **)(GJBigSprite *))(*(_QWORD *)this + 192LL))(this);
cocos2d::CCRect::CCRect(
(cocos2d::CCRect *)v39,
v37,
(float)((float)-*(float *)(v11 + 4) / v7) - v5,
(float)(*(float *)&v38 / v7) + (float)(v5 * 2.0),
(float)(*((float *)&v38 + 1) / v7) + (float)(v5 * 2.0));
cocos2d::CCRect::getMaxX((cocos2d::CCRect *)v39);
v13 = v12;
cocos2d::CCRect::getMinX((cocos2d::CCRect *)v39);
v15 = v14;
cocos2d::CCRect::getMaxY((cocos2d::CCRect *)v39);
v17 = v16;
cocos2d::CCRect::getMinY((cocos2d::CCRect *)v39);
v19 = v18;
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v40, 0.0, 0.0, 120.0, 50.0);
if ( !(unsigned int)cocos2d::CCArray::count(*((cocos2d::CCArray **)this + 43)) )
{
LABEL_13:
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(v4);
return _stack_chk_guard;
}
while ( 1 )
{
v20 = cocos2d::CCArray::objectAtIndex(*((cocos2d::CCArray **)this + 43), v9);
v40[0] = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v20 + 192LL))(v20) - (float)(v40[2] * 0.5);
v40[1] = *(float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v20 + 192LL))(v20) + 4)
- (float)(v40[3] * 0.5);
cocos2d::CCRect::getMinX((cocos2d::CCRect *)v40);
if ( v13 < v21
|| (cocos2d::CCRect::getMaxX((cocos2d::CCRect *)v40), v15 > v24)
|| (cocos2d::CCRect::getMinY((cocos2d::CCRect *)v40), v17 < v25)
|| (cocos2d::CCRect::getMaxY((cocos2d::CCRect *)v40), v19 > v26) )
{
v22 = *(_QWORD *)(v20 + 344);
*(_BYTE *)(v20 + 368) = 0;
if ( v22 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v22 + 536LL))(v22);
*(_QWORD *)(v20 + 344) = 0;
v41 = 0;
v42 = 0;
v43 = nullptr;
if ( (*(_BYTE *)(v20 + 320) & 1) != 0 )
{
std::string::__init(&v41, *(void **)(v20 + 336), *(_QWORD *)(v20 + 328));
}
else
{
v23 = *(_QWORD *)(v20 + 328);
v41 = *(_QWORD *)(v20 + 320);
v42 = v23;
v43 = *(void **)(v20 + 336);
}
GJBigSprite::unloadSprite(this, (__int64)&v41, v10);
if ( (v41 & 1) != 0 )
{
++v9;
operator delete(v43);
goto LABEL_12;
}
}
}
else
{
v27 = *(_QWORD *)(v20 + 344);
*(_BYTE *)(v20 + 368) = 1;
if ( !v27 )
{
if ( !*((_BYTE *)this + 360) )
{
v33 = (cocos2d::CCSprite *)(v20 + 321);
*(_QWORD *)(*((_QWORD *)this + 40) + 8 * (v9 >> 6)) |= 1LL << (v10 & 0x3F);
v34 = (const char *)*(unsigned __int8 *)(v20 + 320);
if ( ((unsigned __int8)v34 & 1) != 0 )
v33 = *(cocos2d::CCSprite **)(v20 + 336);
v30 = cocos2d::CCSprite::create(v33, v34);
v35 = *(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v30 + 184LL);
v36 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v20 + 192LL))(v20);
v35(v30, v36);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v30 + 160LL))(v30, 1.002);
goto LABEL_30;
}
v41 = 0;
v42 = 0;
v43 = nullptr;
if ( (*(_BYTE *)(v20 + 320) & 1) != 0 )
{
std::string::__init(&v41, *(void **)(v20 + 336), *(_QWORD *)(v20 + 328));
}
else
{
v28 = *(_QWORD *)(v20 + 328);
v41 = *(_QWORD *)(v20 + 320);
v42 = v28;
v43 = *(void **)(v20 + 336);
}
GJBigSprite::loadSpriteAsync(this, (__int64)&v41, v10);
if ( (v41 & 1) != 0 )
operator delete(v43);
if ( !*(_QWORD *)(v20 + 344) )
{
v30 = cocos2d::CCSprite::create(
(cocos2d::CCSprite *)"mapimages/image_small.png",
(const char *)(v20 + 352),
v29);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v30 + 128LL))(v30, *((float *)this + 88));
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v30 + 144LL))(v30, *((float *)this + 89));
v31 = *(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v30 + 184LL);
v32 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v20 + 192LL))(v20);
v31(v30, v32);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v30 + 72LL))(v30, 0xFFFFFFFFLL);
LABEL_30:
++v9;
(*(void (__fastcall **)(GJBigSprite *, __int64))(*(_QWORD *)this + 456LL))(this, v30);
*(_QWORD *)(v20 + 344) = v30;
goto LABEL_12;
}
}
}
++v9;
LABEL_12:
v10 = v9;
if ( (unsigned int)cocos2d::CCArray::count(*((cocos2d::CCArray **)this + 43)) <= (unsigned int)v9 )
goto LABEL_13;
}
}
return _stack_chk_guard;
}