//
// GJRateLevelLayer::setupRateInfo from 0x1402f5980 to 0x1402f6538 (3000 bytes)
//
// 2 xrefs:
// > GJRateLevelLayer::rateInfoFinished @ 0x1402f6c81
// > ??> @ 0x1406d4010
//
// 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
//
// Hidden C++ exception states: #wind=6
void __fastcall GJRateLevelLayer::setupRateInfo(__int64 a1, __int64 *a2)
{
__int64 v2; // r13
cocos2d::CCString *v3; // rax
const char *CString; // rax
size_t v5; // r14
size_t v6; // r8
cocos2d::CCArray *v7; // rsi
void *v8; // rcx
float v9; // xmm7_4
int v10; // ebx
unsigned int i; // edi
cocos2d::CCString *v12; // rax
const char *v13; // rax
int v14; // eax
double v15; // xmm0_8
unsigned int v16; // ebx
__int64 v17; // r15
cocos2d::CCString *v18; // rax
const char *v19; // rax
int v20; // edi
float v21; // xmm6_4
_BYTE *v22; // rax
size_t v23; // r8
__int64 v24; // rdx
__int64 v25; // rcx
__int64 v26; // r8
__int64 v27; // r9
char v28; // r15
void **v29; // rax
void **v30; // r12
unsigned __int64 v31; // r13
char *v32; // rsi
unsigned __int64 v33; // rdi
unsigned __int64 v34; // rbx
__int64 v35; // rax
char *v36; // rax
struct cocos2d::CCSprite *v37; // rdi
cocos2d::CCSprite_vtbl *v38; // rbx
__int64 v39; // rdx
float v40; // xmm0_4
cocos2d::CCString *v41; // rax
const char *v42; // rax
size_t v43; // r8
cocos2d::CCArray *v44; // r12
float v45; // xmm7_4
int v46; // ebx
unsigned int k; // edi
cocos2d::CCString *v48; // rax
const char *v49; // rax
int v50; // eax
double v51; // xmm0_8
unsigned int v52; // r15d
cocos2d::CCArray *v53; // rbx
cocos2d::CCString *v54; // rax
const char *v55; // rax
int v56; // r13d
float v57; // xmm6_4
__int64 v58; // rbx
char v59; // si
int v60; // r9d
__int64 v61; // rax
unsigned int v62; // eax
double v63; // xmm0_8
_DWORD *v64; // rax
float v65; // xmm8_4
float v66; // xmm5_4
float v67; // xmm6_4
float v68; // xmm7_4
float v69; // xmm3_4
cocos2d::CCString *v70; // rax
char *v71; // rax
cocos2d::CCString *v72; // rax
const char *v73; // rcx
struct cocos2d::CCLabelBMFont *v74; // rdi
cocos2d::CCLabelBMFont_vtbl *v75; // rbx
const cocos2d::CCPoint *v76; // rax
__int64 v77; // rdx
float v78; // xmm0_4
__int16 v79; // [rsp+58h] [rbp-B0h]
__int16 v80; // [rsp+58h] [rbp-B0h]
char v81; // [rsp+5Ch] [rbp-ACh]
char v82; // [rsp+5Ch] [rbp-ACh]
__int16 v83; // [rsp+60h] [rbp-A8h] BYREF
char v84; // [rsp+62h] [rbp-A6h]
bool v85; // [rsp+64h] [rbp-A4h]
__int16 v86; // [rsp+68h] [rbp-A0h] BYREF
char v87; // [rsp+6Ah] [rbp-9Eh]
__int16 v88; // [rsp+78h] [rbp-90h] BYREF
char v89; // [rsp+7Ah] [rbp-8Eh]
_BYTE v90[4]; // [rsp+88h] [rbp-80h] BYREF
float v91; // [rsp+8Ch] [rbp-7Ch]
int v92; // [rsp+90h] [rbp-78h]
unsigned int v93; // [rsp+94h] [rbp-74h]
cocos2d::CCArray *v94; // [rsp+98h] [rbp-70h] BYREF
__int128 v95; // [rsp+A0h] [rbp-68h] BYREF
unsigned __int64 v96; // [rsp+B0h] [rbp-58h]
__int64 v97; // [rsp+B8h] [rbp-50h]
cocos2d::CCPoint v98; // [rsp+C0h] [rbp-48h] BYREF
__int64 v99; // [rsp+C8h] [rbp-40h]
__int64 j; // [rsp+D0h] [rbp-38h] BYREF
cocos2d::CCArray *v101; // [rsp+D8h] [rbp-30h]
__int64 *v102; // [rsp+E0h] [rbp-28h]
cocos2d::CCPoint v103; // [rsp+E8h] [rbp-20h] BYREF
__int128 *v104; // [rsp+F0h] [rbp-18h]
__int64 *v105; // [rsp+F8h] [rbp-10h]
void *Src[2]; // [rsp+100h] [rbp-8h] BYREF
unsigned __int64 v107; // [rsp+110h] [rbp+8h]
unsigned __int64 v108; // [rsp+118h] [rbp+10h]
void *Block[2]; // [rsp+120h] [rbp+18h] BYREF
__m128i si128; // [rsp+130h] [rbp+28h]
__int128 v111; // [rsp+140h] [rbp+38h] BYREF
__m128i v112; // [rsp+150h] [rbp+48h]
_BYTE v113[528]; // [rsp+168h] [rbp+60h] BYREF
v102 = a2;
v2 = a1;
v99 = a1;
v105 = a2;
v94 = sub_140140F70(a2, ":");
v3 = cocos2d::CCArray::stringAtIndex(v94, 0);
CString = cocos2d::CCString::getCString(v3);
*(_OWORD *)Block = 0;
si128 = 0;
v5 = -1;
v6 = -1;
do
++v6;
while ( CString[v6] );
sub_14003A930(Block, CString, v6);
v7 = sub_140140F70((__int64 *)Block, ",");
v101 = v7;
if ( si128.m128i_i64[1] > 0xFuLL )
{
v8 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v8 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v8 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v8);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_140623F30);
LOBYTE(Block[0]) = 0;
v9 = 10.0;
v10 = 0;
for ( i = 0; i < cocos2d::CCArray::count(v7); ++i )
{
v12 = cocos2d::CCArray::stringAtIndex(v7, i);
v13 = cocos2d::CCString::getCString(v12);
v14 = atoi(v13);
if ( v14 > v10 )
v10 = v14;
}
*(float *)&v15 = (float)v10 * 10.0;
if ( *(float *)&v15 > 100.0 )
v9 = 100.0 / (float)v10;
v16 = 0;
if ( cocos2d::CCArray::count(v7) )
{
v17 = v2 + 1048;
for ( j = v2 + 1048; ; v17 = j )
{
v18 = cocos2d::CCArray::stringAtIndex(v7, v16);
v19 = cocos2d::CCString::getCString(v18);
v20 = atoi(v19);
v92 = v20;
cocos2d::CCPoint::CCPoint(*(float *)&v15, (float)(int)(15 * (v16 - 8)));
cocos2d::CCPoint::operator+(v17, v90);
v21 = v9;
v83 = 0;
v81 = 0;
fmt::BasicWriter::BasicWriter(v113);
v93 = v16 + 1;
fmt::BasicWriter::operator<<(v113, v16 + 1);
v22 = (_BYTE *)fmt::BasicWriter::c_str(v113);
*(_OWORD *)Src = 0;
v107 = 0;
v108 = 0;
v23 = -1;
do
++v23;
while ( v22[v23] );
sub_14003A930(Src, v22, v23);
fmt::BasicWriter::~BasicWriter(v113);
if ( v20 <= 0 )
{
v92 = 1;
v79 = 12371;
v28 = 23;
v83 = 8247;
v81 = 16;
v29 = Src;
if ( v108 > 0xF )
v29 = (void **)Src[0];
v107 = 0;
*(_BYTE *)v29 = 0;
if ( v9 >= 10.0 )
{
v21 = v9 * 0.5;
v91 = v91 - (float)((float)(v9 * 0.5) * 0.5);
}
}
else
{
switch ( v16 )
{
case 0u:
v79 = -11517;
v28 = -1;
break;
case 1u:
v79 = -27904;
v28 = -1;
break;
case 2u:
v79 = -1536;
v28 = 60;
break;
case 3u:
v79 = -10146;
v28 = 0;
break;
case 4u:
v79 = -4610;
v28 = 20;
break;
case 5u:
v79 = -18433;
v28 = 0;
break;
case 6u:
v79 = 30975;
v28 = 0;
break;
case 7u:
v79 = 30207;
v28 = -21;
break;
case 8u:
v79 = 11775;
v28 = -20;
break;
case 9u:
v79 = 11775;
v28 = 0;
break;
default:
v79 = -26986;
v28 = -106;
break;
}
}
v104 = &v95;
v95 = 0;
v96 = 0;
v97 = 0;
v30 = Src;
v31 = v108;
v85 = v108 > 0xF;
v32 = (char *)Src[0];
if ( v108 > 0xF )
v30 = (void **)Src[0];
v33 = v107;
if ( v107 > 0x7FFFFFFFFFFFFFFFLL )
sub_140007B50(v25, v24, v26, v27);
v97 = 15;
if ( v107 > 0xF )
{
v34 = v107 | 0xF;
if ( (v107 | 0xF) <= 0x7FFFFFFFFFFFFFFFLL )
{
if ( v34 < 0x16 )
v34 = 22;
}
else
{
v34 = 0x7FFFFFFFFFFFFFFFLL;
}
*(_QWORD *)&v95 = sub_14003AA10(v34 + 1);
v96 = v33;
v97 = v34;
memcpy((void *)v95, v30, v33 + 1);
}
else
{
v96 = v107;
v95 = *(_OWORD *)v30;
}
v86 = v83;
v87 = v81;
v88 = v79;
v89 = v28;
v15 = cocos2d::CCPoint::CCPoint(&v98);
GJRateLevelLayer::createStatPillar(v99, 10, (int)v21, v92, (__int64)&v88, (__int64)&v86, v35, (__int64)&v95);
if ( v85 )
{
v36 = v32;
if ( v31 + 1 >= 0x1000 )
{
v32 = *((char **)v32 - 1);
if ( (unsigned __int64)(v36 - v32 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v32);
}
v16 = v93;
v7 = v101;
if ( v16 >= cocos2d::CCArray::count(v101) )
break;
}
v2 = v99;
}
v37 = cocos2d::CCSprite::createWithSpriteFrameName("whiteSquare60_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v37->setScaleX)(v37);
v38 = v37->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v37->getContentSize(v37);
((void (__fastcall *)(struct cocos2d::CCSprite *))v38->setScaleY)(v37);
v83 = 11086;
v84 = 24;
v37->setColor(&v37->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v83);
LOBYTE(v39) = -56;
v37->setOpacity(&v37->cocos2d::CCRGBAProtocol, v39);
v40 = (*(float (__fastcall **)(_QWORD, struct cocos2d::CCSprite *, __int64))(**(_QWORD **)(v2 + 576) + 440LL))(
*(_QWORD *)(v2 + 576),
v37,
3);
cocos2d::CCPoint::CCPoint(v40, 38.0);
cocos2d::CCPoint::operator+(v2 + 1048, &j);
v37->setPosition_0(v37, (const cocos2d::CCPoint *)&j);
v41 = cocos2d::CCArray::stringAtIndex(v94, 1u);
v42 = cocos2d::CCString::getCString(v41);
*(_OWORD *)Block = 0;
si128 = 0;
v43 = -1;
do
++v43;
while ( v42[v43] );
sub_14003A930(Block, v42, v43);
v44 = sub_140140F70((__int64 *)Block, ",");
sub_14003A830((__int64)Block);
v45 = 10.0;
v46 = 0;
for ( k = 0; k < cocos2d::CCArray::count(v44); ++k )
{
v48 = cocos2d::CCArray::stringAtIndex(v44, k);
v49 = cocos2d::CCString::getCString(v48);
v50 = atoi(v49);
if ( v50 > v46 )
v46 = v50;
}
*(float *)&v51 = (float)v46 * 10.0;
if ( *(float *)&v51 > 100.0 )
v45 = 100.0 / (float)v46;
v52 = 0;
if ( cocos2d::CCArray::count(v44) )
{
v53 = (cocos2d::CCArray *)(v2 + 1048);
v94 = (cocos2d::CCArray *)(v2 + 1048);
do
{
v54 = cocos2d::CCArray::stringAtIndex(v44, v52);
v55 = cocos2d::CCString::getCString(v54);
v56 = atoi(v55);
cocos2d::CCPoint::CCPoint(*(float *)&v51, (float)(int)(15 * (v52 + 4)));
cocos2d::CCPoint::operator+(v53, v90);
v57 = v45;
v83 = 0;
v82 = 0;
*(_OWORD *)Src = 0;
v108 = 15;
if ( v56 <= 0 )
{
v56 = 1;
v80 = 12371;
v59 = 23;
v83 = 8247;
v82 = 16;
v58 = 0;
v107 = 0;
LOBYTE(Src[0]) = 0;
if ( v45 >= 10.0 )
{
v57 = v45 * 0.5;
v91 = v91 - (float)((float)(v45 * 0.5) * 0.5);
}
}
else
{
v58 = 1;
v107 = 1;
switch ( v52 )
{
case 1u:
v80 = -1;
v59 = 0;
LOWORD(Src[0]) = 70;
break;
case 2u:
v80 = 32255;
v59 = 0;
LOWORD(Src[0]) = 69;
break;
case 3u:
v80 = 255;
v59 = -1;
LOWORD(Src[0]) = 76;
break;
case 4u:
v80 = -256;
v59 = -1;
LOWORD(Src[0]) = 77;
break;
default:
v80 = -26986;
v59 = -106;
LOWORD(Src[0]) = 82;
break;
}
}
v104 = &v95;
v97 = 15;
v96 = v58;
v95 = *(_OWORD *)Src;
v88 = v83;
v89 = v82;
v86 = v80;
v87 = v59;
v51 = cocos2d::CCPoint::CCPoint(&v103);
v60 = v56;
v2 = v99;
GJRateLevelLayer::createStatPillar(v99, 10, (int)v57, v60, (__int64)&v86, (__int64)&v88, v61, (__int64)&v95);
++v52;
v62 = cocos2d::CCArray::count(v44);
v53 = v94;
}
while ( v52 < v62 );
}
LODWORD(v63) = 0;
v111 = 0;
v112 = _mm_load_si128((const __m128i *)&xmmword_140623F30);
LOBYTE(v111) = 0;
v64 = *(_DWORD **)(v2 + 968);
v65 = (float)(int)v64[252];
if ( v65 <= 0.0 )
{
v72 = cocos2d::CCString::createWithFormat("Req: %i", v64[250]);
v71 = (char *)cocos2d::CCString::getCString(v72);
do
++v5;
while ( v71[v5] );
}
else
{
v66 = (float)(int)v64[253];
v67 = (float)(int)v64[254];
v68 = (float)(int)v64[255];
v69 = v66 - (float)(v67 * 10.0);
v63 = (float)((float)(v69 - v68) / (float)((float)(v65 - v67) - v68));
v70 = cocos2d::CCString::createWithFormat(
"R: %i (%i- / %i+)\n%.1f | +%.1f | -%.1f | +-%.1f\nReq: %i",
(int)v65,
(int)v68,
(int)v67,
(float)(v66 / v65),
(float)((float)(v66 - v68) / (float)(v65 - v68)),
(float)(v69 / (float)(v65 - v67)),
v63,
v64[250]);
v71 = (char *)cocos2d::CCString::getCString(v70);
do
++v5;
while ( v71[v5] );
}
sub_14003CCE0((void **)&v111, v71, v5);
v73 = (const char *)&v111;
if ( v112.m128i_i64[1] > 0xFuLL )
v73 = (const char *)v111;
v74 = cocos2d::CCLabelBMFont::create(v73, "chatFont.fnt");
v75 = v74->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(*(float *)&v63, 0.0);
v75->setAnchorPoint(v74, v76);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v74->setScale_0)(v74);
v74->setColor(&v74->cocos2d::CCRGBAProtocol, &stru_140529B30);
LOBYTE(v77) = -31;
v74->setOpacity(&v74->cocos2d::CCRGBAProtocol, v77);
v78 = (*(float (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *, __int64))(**(_QWORD **)(v2 + 576) + 440LL))(
*(_QWORD *)(v2 + 576),
v74,
2);
cocos2d::CCPoint::CCPoint(v78, -130.0);
cocos2d::CCPoint::operator+(v2 + 1048, &v94);
v74->setPosition_0(v74, (const cocos2d::CCPoint *)&v94);
sub_14003A830((__int64)&v111);
sub_14003A830((__int64)v102);
}