//
// cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile_2 from 0x1003081c0 to 0x1003084c5 (773 bytes)
//
// 26 xrefs:
// > LevelAreaLayer::init @ 0x100263f92
// > LevelAreaInnerLayer::init @ 0x100266371
// > GJPathsLayer::init @ 0x1002e8f39
// > GJShopLayer::init @ 0x10030ea74
// > GameManager::loadIcon @ 0x10036b4c4
// > GameManager::loadDeathEffect @ 0x10036c61c
// > LoadingLayer::init @ 0x10038bd43
// > LoadingLayer::loadAssets @ 0x10038c553
// > LoadingLayer::loadAssets @ 0x10038c67e
// > LoadingLayer::loadAssets @ 0x10038c6a8
// > LoadingLayer::loadAssets @ 0x10038c6fe
// > LoadingLayer::loadAssets @ 0x10038c890
// > LoadingLayer::loadAssets @ 0x10038c9b6
// > LoadingLayer::loadAssets @ 0x10038c9f2
// > SecretLayer4::init @ 0x10039a0cc
// > WorldSelectLayer::init @ 0x1003ab200
// > cocos2d::CCAnimationCache::addAnimationsWithDictionary @ 0x100462166
// > cocos2d::CCAnimationCache::addAnimationsWithDictionary @ 0x100462196
// > SecretLayer5::init @ 0x10046e9fd
// > SecretLayer5::init @ 0x10046ea27
// > SecretLayer6::init @ 0x100473519
// > SecretLayer2::init @ 0x1004961bc
// > SecretLayer3::init @ 0x10049c62b
// > GauntletSelectLayer::init @ 0x10059e6c9
// > SecretRewardsLayer::init @ 0x10070cd26
// > SelectFontLayer2::loadPreviewSheet @ 0x1009707fc
//
// This function is hookable on this platform (idp: pc, 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 12:28:35 +0000
//
void __fastcall cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile_2(__int64 a1, const char *a2, double a3)
{
const char *v3; // rbx
char *v5; // r15
size_t v6; // rax
std::string::size_type v7; // r12
char *data; // r13
size_t v9; // rbx
std::string::pointer v10; // rdi
__int64 v11; // r15
__int64 v12; // rbx
__int64 v13; // rax
__int64 v14; // r15
std::string *v15; // rdi
__int64 v16; // r12
void *v17; // rax
const std::string::value_type *CString; // rax
std::string::pointer v19; // r12
std::string::size_type size; // rax
std::string::pointer v21; // rcx
std::string::size_type v22; // rsi
std::string *v24; // rax
std::string *v25; // rax
__int64 v26; // rax
__int64 v27; // rax
__int64 v28; // r14
size_t v29; // rax
size_t v30; // r15
_BYTE *v31; // r12
size_t v32; // r13
_BYTE v34[24]; // [rsp+8h] [rbp-58h] BYREF
std::string __dst[2]; // [rsp+20h] [rbp-40h] BYREF
v3 = a2;
v5 = *(char **)(a1 + 72);
v6 = strlen(a2);
if ( v6 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v7 = v6;
if ( v6 >= 0x17 )
{
v9 = 26;
if ( (v6 | 7) != 0x17 )
v9 = (v6 | 7) + 1;
data = (char *)operator new(v9);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst[0].__r_.__value_.__r.__words[0] = v9 + 1;
v3 = a2;
__dst[0].__r_.__value_.__l.__size_ = v7;
goto LABEL_8;
}
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v6);
data = __dst[0].__r_.__value_.__s.__data_;
if ( v6 )
LABEL_8:
memcpy(data, v3, v7);
data[v7] = 0;
v10 = v5;
v11 = sub_100309350(v5, __dst);
v12 = *(_QWORD *)(a1 + 72) + 8LL;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
{
v10 = __dst[0].__r_.__value_.__l.__data_;
operator delete(__dst[0].__r_.__value_.__l.__data_);
}
if ( v11 == v12 )
{
v13 = CCContentManager::sharedManager((__int64)v10, (__int64)__dst);
v14 = CCContentManager::addDict(v13, a2, 0);
*(_WORD *)&__dst[0].__r_.__value_.__l.0 = 0;
v34[0] = 16;
strcpy(&v34[1], "metadata");
v15 = (std::string *)v14;
v16 = cocos2d::CCDictionary::objectForKey(v14, v34);
if ( (v34[0] & 1) != 0 )
{
v15 = *(std::string **)&v34[16];
operator delete(*(void **)&v34[16]);
}
if ( v16 )
{
v34[0] = 30;
strcpy(&v34[1], "textureFileName");
v17 = cocos2d::CCDictionary::valueForKey(v16, (__int64)v34);
CString = (const std::string::value_type *)cocos2d::CCString::getCString(v17);
v15 = __dst;
std::string::assign(__dst, CString);
if ( (v34[0] & 1) != 0 )
{
v15 = *(std::string **)&v34[16];
operator delete(*(void **)&v34[16]);
}
}
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
{
v19 = __dst[0].__r_.__value_.__s.__data_;
if ( __dst[0].__r_.__value_.__l.__size_ )
goto LABEL_29;
}
else
{
v19 = __dst[0].__r_.__value_.__s.__data_;
if ( *(_BYTE *)&__dst[0].__r_.__value_.__l.0 >> 1 )
goto LABEL_29;
}
std::string::assign(__dst, a2);
size = *(_BYTE *)&__dst[0].__r_.__value_.__l.0 >> 1;
v21 = __dst[0].__r_.__value_.__l.__data_;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
size = __dst[0].__r_.__value_.__l.__size_;
else
v21 = __dst[0].__r_.__value_.__s.__data_;
while ( size )
{
v22 = size - 1;
if ( v21[--size] == 46 )
goto LABEL_28;
}
v22 = -1;
LABEL_28:
v24 = std::string::erase(__dst, v22, 0xFFFFFFFFFFFFFFFFLL);
std::string::operator=(__dst, v24);
v25 = std::string::append(__dst, ".png");
v15 = __dst;
std::string::operator=(__dst, v25);
LABEL_29:
v26 = cocos2d::CCTextureCache::sharedTextureCache(v15);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
v19 = __dst[0].__r_.__value_.__l.__data_;
v27 = cocos2d::CCTextureCache::addImage(v26, v19, 0);
if ( !v27 )
goto LABEL_42;
cocos2d::CCSpriteFrameCache::addSpriteFramesWithDictionary(a1, v14, v27, a3);
v28 = *(_QWORD *)(a1 + 72);
v29 = strlen(a2);
if ( v29 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v30 = v29;
if ( v29 >= 0x17 )
{
v32 = 26;
if ( (v29 | 7) != 0x17 )
v32 = (v29 | 7) + 1;
v31 = operator new(v32);
*(_QWORD *)&v34[16] = v31;
*(_QWORD *)v34 = v32 | 1;
*(_QWORD *)&v34[8] = v30;
}
else
{
v34[0] = 2 * v29;
v31 = &v34[1];
if ( !v29 )
{
LABEL_40:
v31[v30] = 0;
sub_100309460(v28, v34);
if ( (v34[0] & 1) != 0 )
operator delete(*(void **)&v34[16]);
LABEL_42:
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
return;
}
}
memcpy(v31, a2, v30);
goto LABEL_40;
}
}