//
// OptionsCell::loadFromObject from 0x1400b5170 to 0x1400b5501 (913 bytes)
//
// 3 xrefs:
// > CustomListView::loadCell @ 0x1400ab749
// > CustomListView::reloadAll @ 0x1400ac7a2
// > ??> @ 0x1406c7ba8
//
// 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=2
void OptionsCell::loadFromObject(OptionsCell *a1, OptionsObject *a2)
{
OptionsObject *v2; // rbx
signed int m_count; // edi
const char *Elems; // rcx
struct cocos2d::CCLabelBMFont *v6; // r14
cocos2d::CCLabelBMFont_vtbl *v7; // rbx
const cocos2d::CCPoint *v8; // rax
cocos2d::CCLabelBMFont_vtbl *v9; // rbx
const cocos2d::CCPoint *v10; // rax
void **v11; // rax
void *v12; // rdx
void **v13; // rcx
struct cocos2d::CCLabelBMFont *v14; // rdi
cocos2d::CCLabelBMFont_vtbl *v15; // rbx
const cocos2d::CCPoint *v16; // rax
__int64 v17; // rdx
float *v18; // rbx
double v19; // xmm0_8
__int64 v20; // rax
void *v21; // rcx
const char *v22; // rcx
struct cocos2d::CCSprite *v23; // rbx
CCMenuItemSpriteExtra *v24; // rax
struct cocos2d::CCMenu *v25; // rdi
cocos2d::CCMenu_vtbl *v26; // rbx
const cocos2d::CCPoint *v27; // rax
__int16 v28; // [rsp+28h] [rbp-29h] BYREF
char v29; // [rsp+2Ah] [rbp-27h]
cocos2d::CCPoint v30; // [rsp+2Ch] [rbp-25h] BYREF
cocos2d::CCPoint v31; // [rsp+34h] [rbp-1Dh] BYREF
void *Block[2]; // [rsp+40h] [rbp-11h] BYREF
__int64 v33; // [rsp+50h] [rbp-1h]
unsigned __int64 v34; // [rsp+58h] [rbp+7h]
_QWORD v35[4]; // [rsp+60h] [rbp+Fh] BYREF
v2 = a2;
a1->m_optionsObject = a2;
LOBYTE(a2) = 1;
a1->m_mainLayer->removeAllChildrenWithCleanup(a1->m_mainLayer, (bool)a2);
m_count = v2->m_count;
Elems = v2->m_name.m_data.m_smallStorage._Elems;
if ( v2->m_name.m_data.m_capacity > 0xF )
Elems = *(const char **)Elems;
v6 = cocos2d::CCLabelBMFont::create(Elems, (const char *)&qword_14052A4D8);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v6, 2);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v6->setScale_0)(v6);
v7 = v6->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v30, 0.0, 0.5);
v7->setAnchorPoint(v6, v8);
v9 = v6->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v30, 40.0, a1->m_height * 0.5);
v9->setPosition_0(v6, v10);
if ( m_count )
{
if ( m_count > 0 )
{
*(_OWORD *)Block = 0;
v33 = 2;
v34 = 15;
strcpy((char *)Block, "[ ");
v11 = (void **)GameToolbox::intToString(v35, m_count);
v12 = v11;
if ( (unsigned __int64)v11[3] > 0xF )
v12 = *v11;
sub_140041270(Block, v12, (size_t)v11[2]);
sub_14003A830((__int64)v35);
sub_140041270(Block, " ]", 2u);
v13 = Block;
if ( v34 > 0xF )
v13 = (void **)Block[0];
v14 = cocos2d::CCLabelBMFont::create((const char *)v13, "chatFont.fnt");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v14, 2);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v14->setScale_0)(v14);
v15 = v14->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v30, 0.0, 0.5);
v15->setAnchorPoint(v14, v16);
v14->setColor(&v14->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&word_140529A10);
LOBYTE(v17) = -81;
v14->setOpacity(&v14->cocos2d::CCRGBAProtocol, v17);
v18 = (float *)v6->getContentSize(v6);
v19 = ((double (__fastcall *)(struct cocos2d::CCLabelBMFont *))v6->getScale)(v6);
cocos2d::CCPoint::CCPoint(&v31, (float)(*(float *)&v19 * *v18) + 8.0, 0.0);
v20 = (__int64)v6->getPosition_0(v6);
cocos2d::CCPoint::operator+(v20, &v30);
v14->setPosition_0(v14, &v30);
if ( v34 > 0xF )
{
v21 = Block[0];
if ( v34 + 1 >= 0x1000 )
{
v21 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v21 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v21);
}
}
}
else
{
v28 = -26986;
v29 = -106;
v6->setColor(&v6->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v28);
}
v22 = "GJ_checkOff_001.png";
if ( a1->m_optionsObject->m_enabled )
v22 = "GJ_checkOn_001.png";
v23 = cocos2d::CCSprite::createWithSpriteFrameName(v22);
((void (__fastcall *)(struct cocos2d::CCSprite *))v23->setScale_0)(v23);
v24 = CCMenuItemSpriteExtra::create(v23, nullptr, a1, (cocos2d::SEL_MenuHandler *)OptionsCell::onToggleOption);
HIDWORD(v24->m_pfnSelector.adj) = 1069547520;
v25 = cocos2d::CCMenu::create(v24, 0);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v25, 3);
v26 = v25->cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v31, 20.0, a1->m_height * 0.5);
v26->setPosition_0(v25, v27);
}