//
// GJShopLayer::onExit from 0x100324ca0 to 0x100324ec1 (545 bytes)
//
// 1 xrefs:
// > ??> @ 0x1009139b8
//
// 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
//
void __fastcall GJShopLayer::onExit(GJShopLayer *a1)
{
double v1; // xmm0_8
cocos2d::CCSpriteFrameCache *v2; // rax
unsigned int sizex2; // r14d
size_t size; // r15
unsigned __int64 v5; // rbx
char *v6; // r13
const char *v7; // r12
GJShopLayer *v8; // rbx
std::array *p_shortStorage; // rsi
size_t v10; // r12
cocos2d::CCTextureCache *v11; // rax
unsigned int v12; // r14d
size_t v13; // r15
unsigned __int64 v14; // rbx
char *v15; // r13
const char *v16; // r12
std::array *longStorage; // rsi
size_t v18; // r12
cocos2d::CCSpriteFrameCache *v19; // [rsp+0h] [rbp-50h]
cocos2d::CCTextureCache *v20; // [rsp+0h] [rbp-50h]
__int128 __dst; // [rsp+10h] [rbp-40h] BYREF
void *__p; // [rsp+20h] [rbp-30h]
cocos2d::CCLayer::onExit(a1);
v2 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
sizex2 = a1->m_sheetName.m_data.m_short.sizex2;
if ( (sizex2 & 1) != 0 )
size = a1->m_sheetName.m_data.m_long.size;
else
size = sizex2 >> 1;
v5 = size + 6;
if ( size + 6 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_36;
v19 = v2;
if ( v5 < 0x17 )
{
v1 = 0.0;
__dst = 0;
__p = nullptr;
LOBYTE(__dst) = 2 * v5;
v6 = (char *)&__dst + 1;
v7 = (char *)&__dst + 1;
v8 = a1;
if ( !size )
goto LABEL_14;
if ( (sizex2 & 1) != 0 )
goto LABEL_8;
LABEL_12:
p_shortStorage = &v8->m_sheetName.m_data.m_short.shortStorage;
goto LABEL_13;
}
v10 = 26;
if ( (v5 | 7) != 0x17 )
v10 = (v5 | 7) + 1;
v6 = (char *)operator new(v10);
*(_QWORD *)&__dst = v10 + 1;
__p = v6;
*((_QWORD *)&__dst + 1) = size + 6;
v7 = (char *)&__dst + 1;
v8 = a1;
if ( (sizex2 & 1) == 0 )
goto LABEL_12;
LABEL_8:
p_shortStorage = (std::array *)v8->m_sheetName.m_data.m_long.longStorage;
LABEL_13:
memmove(v6, p_shortStorage, size);
LABEL_14:
strcpy(&v6[size], ".plist");
if ( (__dst & 1) != 0 )
v7 = (const char *)__p;
cocos2d::CCSpriteFrameCache::removeSpriteFramesFromFile(v19, v7);
if ( (__dst & 1) != 0 )
operator delete(__p);
v11 = cocos2d::CCTextureCache::sharedTextureCache();
v12 = v8->m_sheetName.m_data.m_short.sizex2;
if ( (v12 & 1) != 0 )
v13 = v8->m_sheetName.m_data.m_long.size;
else
v13 = v12 >> 1;
v14 = v13 + 4;
if ( v13 + 4 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_36:
sub_100006BF0(v1);
v20 = v11;
if ( v14 < 0x17 )
{
__dst = 0;
__p = nullptr;
LOBYTE(__dst) = 2 * v14;
v15 = (char *)&__dst + 1;
v16 = (char *)&__dst + 1;
if ( !v13 )
goto LABEL_31;
if ( (v12 & 1) != 0 )
goto LABEL_25;
LABEL_29:
longStorage = &a1->m_sheetName.m_data.m_short.shortStorage;
goto LABEL_30;
}
v18 = 26;
if ( (v14 | 7) != 0x17 )
v18 = (v14 | 7) + 1;
v15 = (char *)operator new(v18);
*(_QWORD *)&__dst = v18 + 1;
__p = v15;
*((_QWORD *)&__dst + 1) = v13 + 4;
v16 = (char *)&__dst + 1;
if ( (v12 & 1) == 0 )
goto LABEL_29;
LABEL_25:
longStorage = (std::array *)a1->m_sheetName.m_data.m_long.longStorage;
LABEL_30:
memmove(v15, longStorage, v13);
LABEL_31:
strcpy(&v15[v13], ".png");
if ( (__dst & 1) != 0 )
v16 = (const char *)__p;
cocos2d::CCTextureCache::removeTextureForKey(v20, v16);
if ( (__dst & 1) != 0 )
operator delete(__p);
}