//
// cocos2d::CCRectFromString from 0x1005668a0 to 0x100566e94 (1524 bytes)
//
// 2 xrefs:
// > cocos2d::CCSpriteFrameCache::addSpriteFramesWithDictionary @ 0x10031c501
// > cocos2d::CCSpriteFrameCache::addSpriteFramesWithDictionary @ 0x10031c9ee
//
// 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
//
cocos2d::CCRect __fastcall cocos2d::CCRectFromString(const char *a1)
{
const char *v1; // rsi
__m128 v2; // xmm3
size_t v4; // rax
std::string::size_type v5; // r15
char *data; // r12
size_t v7; // r13
std::string::size_type v8; // r13
int v9; // eax
std::string::size_type v10; // rax
bool v11; // cl
std::string::size_type v12; // r14
std::string::size_type size; // r15
std::string::pointer v14; // r12
size_t v15; // rax
size_t v16; // r15
char *v17; // rbx
size_t v18; // r13
int v19; // eax
std::string::size_type v20; // r14
std::string::pointer v21; // rbx
char *v22; // rsi
size_t v23; // r12
char *v24; // r13
size_t v25; // r15
std::string::size_type v26; // r14
std::string::size_type v27; // r12
size_t v28; // rax
size_t v29; // r12
char *v30; // r13
size_t v31; // r15
char *v32; // rdi
__m128 *v33; // rbx
char *v34; // rdi
const char *v35; // rdi
const char *v36; // r14
double v37; // xmm0_8
const char *v38; // rdi
float v39; // xmm1_4
float v40; // xmm0_4
float v41; // xmm0_4
const char *v42; // r14
void **v44; // rbx
void **v45; // r14
void *v46; // rdi
void **v47; // rbx
void **v48; // r14
void *v49; // rdi
unsigned __int64 v50[2]; // [rsp+0h] [rbp-E0h] BYREF
void *v51[2]; // [rsp+10h] [rbp-D0h]
__int64 v52; // [rsp+20h] [rbp-C0h]
void *v53[2]; // [rsp+30h] [rbp-B0h]
__int64 v54; // [rsp+40h] [rbp-A0h]
float v55; // [rsp+54h] [rbp-8Ch]
_QWORD v56[2]; // [rsp+58h] [rbp-88h] BYREF
void *v57; // [rsp+68h] [rbp-78h]
const char *v58; // [rsp+70h] [rbp-70h]
void *__src; // [rsp+78h] [rbp-68h]
double v60; // [rsp+80h] [rbp-60h]
__int128 v61; // [rsp+88h] [rbp-58h] BYREF
void *v62; // [rsp+98h] [rbp-48h]
std::string __dst[2]; // [rsp+A0h] [rbp-40h] BYREF
cocos2d::CCRect result; // 0:xmm0_8.8,8:xmm1_8.8
*(double *)&result.origin = sub_10028D180((__m128 *)a1, (unsigned __int64 *)&unk_1009A2938);
if ( v1 )
{
v4 = strlen(v1);
if ( v4 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)&result.origin);
v5 = v4;
if ( v4 >= 0x17 )
{
v7 = 26;
if ( (v4 | 7) != 0x17 )
v7 = (v4 | 7) + 1;
data = (char *)operator new(v7);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst[0].__r_.__value_.__r.__words[0] = v7 + 1;
__dst[0].__r_.__value_.__l.__size_ = v5;
}
else
{
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v4);
data = __dst[0].__r_.__value_.__s.__data_;
if ( !v4 )
goto LABEL_10;
}
memcpy(data, v1, v5);
LABEL_10:
data[v5] = 0;
v8 = std::string::find(__dst, 123, 0);
v9 = std::string::find(__dst, 125, 0);
if ( v9 == -1 )
goto LABEL_11;
v10 = std::string::find(__dst, 125, v9 + 1);
v11 = (_DWORD)v10 == -1;
if ( (_DWORD)v10 != -1 )
{
LODWORD(v10) = std::string::find(__dst, 125, (__int64)((__int64)&_mh_execute_header + (v10 << 32)) >> 32);
v11 = (_DWORD)v10 == -1;
}
if ( (_DWORD)v8 == -1 || v11 )
goto LABEL_11;
v12 = (__int64)((__int64)&_mh_execute_header + (v8 << 32)) >> 32;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
{
size = __dst[0].__r_.__value_.__l.__size_;
if ( __dst[0].__r_.__value_.__l.__size_ >= v12 )
{
v14 = __dst[0].__r_.__value_.__l.__data_;
LABEL_23:
v15 = ~(_DWORD)v8 + (int)v10;
v16 = size - v12;
if ( v16 >= v15 )
v16 = v15;
if ( v16 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)&result.origin);
v58 = a1;
if ( v16 >= 0x17 )
{
v18 = 26;
if ( (v16 | 7) != 0x17 )
v18 = (v16 | 7) + 1;
v17 = (char *)operator new(v18);
v62 = v17;
*(_QWORD *)&v61 = v18 | 1;
*((_QWORD *)&v61 + 1) = v16;
}
else
{
LOBYTE(v61) = 2 * v16;
v17 = (char *)&v61 + 1;
if ( !v16 )
{
LABEL_33:
v17[v16] = 0;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)v62;
result.origin = (cocos2d::CCPoint)v61;
*(_OWORD *)&__dst[0].__r_.__value_.__l.0 = v61;
v19 = std::string::find(__dst, 125, 0);
if ( v19 == -1 )
goto LABEL_11;
v20 = std::string::find(__dst, 44, v19);
if ( (_DWORD)v20 == -1 )
goto LABEL_11;
v21 = __dst[0].__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
{
v22 = __dst[0].__r_.__value_.__l.__data_;
v23 = __dst[0].__r_.__value_.__l.__size_;
}
else
{
v23 = *(_BYTE *)&__dst[0].__r_.__value_.__l.0 >> 1;
v22 = __dst[0].__r_.__value_.__s.__data_;
}
if ( v23 >= (int)v20 )
v23 = (int)v20;
if ( v23 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)&result.origin);
*(_QWORD *)&v60 = (int)v20;
if ( v23 >= 0x17 )
{
__src = v22;
v25 = 26;
if ( (v23 | 7) != 0x17 )
v25 = (v23 | 7) + 1;
v24 = (char *)operator new(v25);
v62 = v24;
*(_QWORD *)&v61 = v25 | 1;
*((_QWORD *)&v61 + 1) = v23;
v22 = (char *)__src;
}
else
{
LOBYTE(v61) = 2 * v23;
v24 = (char *)&v61 + 1;
if ( !v23 )
{
LABEL_50:
v24[v23] = 0;
v26 = (__int64)((__int64)&_mh_execute_header + (v20 << 32)) >> 32;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
{
v27 = __dst[0].__r_.__value_.__l.__size_;
if ( __dst[0].__r_.__value_.__l.__size_ < v26 )
goto LABEL_110;
v21 = __dst[0].__r_.__value_.__l.__data_;
}
else
{
v27 = *(_BYTE *)&__dst[0].__r_.__value_.__l.0 >> 1;
if ( v26 > v27 )
LABEL_110:
sub_1000547C0();
}
v28 = v27 - *(_QWORD *)&v60;
v29 = v27 - v26;
if ( v29 >= v28 )
v29 = v28;
if ( v29 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)&result.origin);
if ( v29 >= 0x17 )
{
v31 = 26;
if ( (v29 | 7) != 0x17 )
v31 = (v29 | 7) + 1;
v30 = (char *)operator new(v31);
v57 = v30;
v56[0] = v31 | 1;
v56[1] = v29;
}
else
{
LOBYTE(v56[0]) = 2 * v29;
v30 = (char *)v56 + 1;
if ( !v29 )
goto LABEL_65;
}
memmove(v30, &v21[v26], v29);
LABEL_65:
v30[v29] = 0;
result.origin = 0;
*(_OWORD *)v51 = 0;
v52 = 0;
if ( (v61 & 1) != 0 )
v32 = (char *)v62;
else
v32 = (char *)&v61 + 1;
if ( (unsigned __int8)sub_100566F30(v32) )
{
result.origin = 0;
*(_OWORD *)v53 = 0;
v54 = 0;
v33 = (__m128 *)v58;
if ( (v56[0] & 1) != 0 )
v34 = (char *)v57;
else
v34 = (char *)v56 + 1;
if ( (unsigned __int8)sub_100566F30(v34) )
{
if ( (*(_BYTE *)v51[0] & 1) != 0 )
v35 = *((const char **)v51[0] + 2);
else
v35 = (char *)v51[0] + 1;
v60 = atof(v35);
if ( (*((_BYTE *)v51[0] + 24) & 1) != 0 )
v36 = *((const char **)v51[0] + 5);
else
v36 = (char *)v51[0] + 25;
v37 = atof(v36);
if ( (*(_BYTE *)v53[0] & 1) != 0 )
v38 = *((const char **)v53[0] + 2);
else
v38 = (char *)v53[0] + 1;
v39 = v60;
*(float *)&v60 = v39;
v40 = v37;
*(float *)&__src = v40;
v41 = atof(v38);
v55 = v41;
if ( (*((_BYTE *)v53[0] + 24) & 1) != 0 )
v42 = *((const char **)v53[0] + 5);
else
v42 = (char *)v53[0] + 25;
v2.f32[0] = atof(v42);
result.origin = (cocos2d::CCPoint)LODWORD(v60);
result.size = (cocos2d::CCSize)(unsigned int)__src;
sub_10028CC00((__int64)v50, *(float *)&v60, *(float *)&__src, (__m128)LODWORD(v55), v2);
sub_10028D1A0(v33, v50);
}
v44 = (void **)v53[0];
if ( v53[0] )
{
v45 = (void **)v53[1];
v46 = v53[0];
if ( v53[1] != v53[0] )
{
do
{
if ( (*(_BYTE *)(v45 - 3) & 1) != 0 )
operator delete(*(v45 - 1));
v45 -= 3;
}
while ( v45 != v44 );
v46 = v53[0];
}
v53[1] = v44;
operator delete(v46);
}
}
v47 = (void **)v51[0];
if ( v51[0] )
{
v48 = (void **)v51[1];
v49 = v51[0];
if ( v51[1] != v51[0] )
{
do
{
if ( (*(_BYTE *)(v48 - 3) & 1) != 0 )
operator delete(*(v48 - 1));
v48 -= 3;
}
while ( v48 != v47 );
v49 = v51[0];
}
v51[1] = v47;
operator delete(v49);
}
if ( (v56[0] & 1) != 0 )
operator delete(v57);
if ( (v61 & 1) != 0 )
operator delete(v62);
LABEL_11:
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
return result;
}
}
memmove(v24, v22, v23);
goto LABEL_50;
}
}
memmove(v17, &v14[v12], v16);
goto LABEL_33;
}
}
else
{
size = *(_BYTE *)&__dst[0].__r_.__value_.__l.0 >> 1;
if ( v12 <= size )
{
v14 = __dst[0].__r_.__value_.__s.__data_;
goto LABEL_23;
}
}
sub_1000547C0();
}
return result;
}