//
// sub_100882580 from 0x100882580 to 0x100882abe (1342 bytes)
//
// 2 xrefs:
// > MoreVideoOptionsLayer::init @ 0x100882333
// > MoreVideoOptionsLayer::init @ 0x100882350
//
// 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:36:57 +0000
//
__int64 __fastcall sub_100882580(__int64 a1, char *a2, const char *a3, char *a4)
{
__int64 v5; // rbx
int v6; // eax
unsigned int v7; // r13d
signed int v8; // eax
__int64 v9; // rax
unsigned __int8 GameVariable; // r12
size_t v11; // rax
size_t v12; // r15
char *v13; // r12
size_t v14; // rbx
__int64 v15; // rax
__int64 v16; // r14
size_t v17; // rax
size_t v18; // r15
char *v19; // r12
size_t v20; // rbx
__int64 v21; // r15
char *v22; // r12
__int64 v23; // r15
__int64 result; // rax
char *v25; // r13
size_t v26; // rax
size_t v27; // r14
char *v28; // r15
size_t v29; // rbx
__int64 v30; // rbx
__int64 v31; // rax
size_t v32; // rax
size_t v33; // r13
char *v34; // r15
char *v35; // rsi
size_t v36; // r14
char *v37; // rax
char *v38; // rbx
__int64 v39; // rdi
__int64 v40; // rbx
void *v41; // r14
unsigned __int64 *v42; // rbx
char v43; // [rsp+0h] [rbp-E0h]
__int64 v44; // [rsp+40h] [rbp-A0h] BYREF
_QWORD v45[2]; // [rsp+48h] [rbp-98h] BYREF
void *v46; // [rsp+58h] [rbp-88h]
unsigned __int64 v47[2]; // [rsp+60h] [rbp-80h] BYREF
void *v48; // [rsp+70h] [rbp-70h]
__int64 v49; // [rsp+78h] [rbp-68h]
__int64 v50; // [rsp+80h] [rbp-60h]
char *__s; // [rsp+88h] [rbp-58h]
char *CString; // [rsp+90h] [rbp-50h]
size_t __dst; // [rsp+98h] [rbp-48h] BYREF
size_t v54; // [rsp+A0h] [rbp-40h]
void *__p; // [rsp+A8h] [rbp-38h]
unsigned int v56; // [rsp+B0h] [rbp-30h]
unsigned __int8 v57; // [rsp+B7h] [rbp-29h]
CString = a4;
__s = a2;
v5 = a1;
v6 = *(_DWORD *)(a1 + 664);
*(_DWORD *)(a1 + 664) = v6 + 1;
v7 = 0;
if ( v6 >= 10 )
v7 = (int)(float)(v6 / 0xAu);
v8 = *(_DWORD *)(a1 + 668);
if ( v8 <= (int)v7 )
v8 = v7;
*(_DWORD *)(a1 + 668) = v8;
v56 = atoi(a3);
v9 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v9, a3);
v50 = *(_QWORD *)(a1 + 680);
v11 = strlen(a3);
if ( v11 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_48;
v12 = v11;
v57 = GameVariable;
v49 = a1;
if ( v11 >= 0x17 )
{
v14 = 26;
if ( (v11 | 7) != 0x17 )
v14 = (v11 | 7) + 1;
v13 = (char *)operator new(v14);
__p = v13;
__dst = v14 + 1;
v5 = v49;
v54 = v12;
goto LABEL_12;
}
LOBYTE(__dst) = 2 * v11;
v13 = (char *)&__dst + 1;
if ( v11 )
LABEL_12:
memcpy(v13, a3, v12);
v13[v12] = 0;
v15 = sub_10088E600(&__dst);
cocos2d::CCDictionary::setObject_1(v50, v15, (int)v56);
if ( (__dst & 1) != 0 )
operator delete(__p);
sub_100883010(&v44, v5, v7);
v16 = sub_100883110(v5, v7);
v17 = strlen(__s);
if ( v17 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_48;
v18 = v17;
if ( v17 >= 0x17 )
{
v20 = 26;
if ( (v17 | 7) != 0x17 )
v20 = (v17 | 7) + 1;
v19 = (char *)operator new(v20);
v46 = v19;
v45[0] = v20 + 1;
v5 = v49;
v45[1] = v18;
goto LABEL_22;
}
LOBYTE(v45[0]) = 2 * v17;
v19 = (char *)v45 + 1;
if ( v17 )
LABEL_22:
memcpy(v19, __s, v18);
v19[v18] = 0;
v21 = *(_QWORD *)(v5 + 552);
sub_1002782D0(&__dst, &v44);
sub_100278250((float *)v47, 8.0, 0.0);
v22 = GameToolbox::createToggleButton(
(__int64)v45,
(__int64)MoreVideoOptionsLayer::onToggle,
0,
v57,
v21,
&__dst,
COERCE_DOUBLE(1061997773),
0.5,
110.0,
v5,
v16,
(float *)v47,
(__int64)"bigFont.fnt",
0,
0,
0);
if ( (v45[0] & 1) != 0 )
operator delete(v46);
(*(void (__fastcall **)(char *, _QWORD))(*(_QWORD *)v22 + 72LL))(v22, v56);
CCMenuItemToggler::setSizeMult((__int64)v22, 1.0);
sub_1008839B0(v5, v7);
v23 = sub_100883AD0(v5, v7);
sub_1007FEBF0(v23, (__int64)v22);
(*(void (__fastcall **)(char *, _QWORD))(*(_QWORD *)v22 + 344LL))(v22, 0);
result = (*(__int64 (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v16 + 344LL))(v16, 0);
v25 = CString;
if ( CString )
{
__s = *(char **)(v5 + 672);
v26 = strlen(CString);
if ( v26 < 0xFFFFFFFFFFFFFFF8LL )
{
v27 = v26;
v50 = v23;
if ( v26 >= 0x17 )
{
v29 = 26;
if ( (v26 | 7) != 0x17 )
v29 = (v26 | 7) + 1;
v28 = (char *)operator new(v29);
__p = v28;
__dst = v29 + 1;
v54 = v27;
}
else
{
LOBYTE(__dst) = 2 * v26;
v28 = (char *)&__dst + 1;
if ( !v26 )
{
LABEL_34:
v28[v27] = 0;
v30 = sub_10088E600(&__dst);
v31 = sub_10088E820("info_%i", v43);
CString = (char *)cocos2d::CCString::getCString(v31);
v32 = strlen(CString);
if ( v32 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v33 = v32;
if ( v32 >= 0x17 )
{
v36 = 26;
if ( (v32 | 7) != 0x17 )
v36 = (v32 | 7) + 1;
v37 = (char *)operator new(v36);
v35 = CString;
v34 = v37;
v48 = v37;
v47[0] = v36 | 1;
v47[1] = v33;
}
else
{
LOBYTE(v47[0]) = 2 * v32;
v34 = (char *)v47 + 1;
v35 = CString;
if ( !v32 )
goto LABEL_42;
}
memmove(v34, v35, v33);
LABEL_42:
v34[v33] = 0;
cocos2d::CCDictionary::setObject((__int64)__s, v30, (char *)v47);
if ( (v47[0] & 1) != 0 )
operator delete(v48);
if ( (__dst & 1) != 0 )
operator delete(__p);
v38 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"GJ_infoIcon_001.png", COERCE_DOUBLE(1065353216));
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v38 + 160LL))(v38, 0.5);
v39 = (__int64)v38;
v40 = v49;
v41 = CCMenuItemSpriteExtra::create(v39, 0, v49, (__int64)sub_100883CD0, 0);
CCMenuItemSpriteExtra::setSizeMult((__int64)v41, 2.0);
(*(void (__fastcall **)(void *, _QWORD))(*(_QWORD *)v41 + 72LL))(v41, v56);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(v40 + 552) + 456LL))(*(_QWORD *)(v40 + 552), v41);
v42 = (unsigned __int64 *)(*(__int64 (__fastcall **)(char *))(*(_QWORD *)v22 + 192LL))(v22);
sub_100278250((float *)v47, -18.0, 16.0);
sub_100278350((double *)&__dst, v42, v47);
(*(void (__fastcall **)(void *, size_t *))(*(_QWORD *)v41 + 184LL))(v41, &__dst);
sub_1007FEBF0(v50, (__int64)v41);
return (*(__int64 (__fastcall **)(void *, _QWORD))(*(_QWORD *)v41 + 344LL))(v41, 0);
}
}
memcpy(v28, v25, v27);
goto LABEL_34;
}
LABEL_48:
sub_100003630();
}
return result;
}