//
// SocialLinksPopup::init from 0x14039f330 to 0x14039fe6b (2875 bytes)
//
// 2 xrefs:
// > GJAccountSettingsLayer::onSocialLinks @ 0x14039e72d
// > ??> @ 0x140923504
//
// 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 11:31:16 +0000
//
// Hidden C++ exception states: #wind=4
bool __fastcall SocialLinksPopup::init(__int64 a1, __int64 a2)
{
bool result; // al
__int64 v5; // rdx
__int64 v6; // rdx
__int64 v7; // rcx
__int64 v8; // rax
__int64 v9; // rax
__int64 v10; // rax
__int64 v11; // rdi
__int64 v12; // rbx
__int64 v13; // rax
struct cocos2d::CCLabelBMFont *v14; // rdi
__int64 v15; // rbx
__int64 v16; // rax
__int64 v17; // rcx
__int64 v18; // rax
struct cocos2d::CCSprite *v19; // rax
cocos2d::CCObject *v20; // rdi
__int64 v21; // rbx
__int64 v22; // rax
__int64 v23; // rcx
cocos2d::CCObject *v24; // rax
float v25; // xmm8_4
int v26; // eax
char v27; // bl
float v28; // xmm0_4
__int64 v29; // rax
unsigned __int64 v30; // r15
const char *v31; // rdi
struct cocos2d::CCLabelBMFont *v32; // rsi
__int64 v33; // rbx
__int64 v34; // rax
__int64 v35; // rax
_BYTE *v36; // rdx
size_t v37; // r8
size_t v38; // r8
__int64 *v39; // rdi
float v40; // xmm6_4
double v41; // xmm0_8
__int64 v42; // rax
__int64 v43; // rbx
__int64 v44; // rax
__int64 v45; // rbx
__int64 v46; // rax
__int64 v47; // rax
_QWORD *v48; // rdi
__int64 v49; // rbx
__int64 v50; // rax
__int64 v51; // rax
__int64 v52; // rdx
__int64 v53; // rcx
char *v54; // rbx
_QWORD *v55; // rax
cocos2d::CCObject *v56; // rbx
cocos2d::CCObject *v57; // rdi
__int64 v58; // rbx
__int64 v59; // rax
unsigned int v60; // [rsp+58h] [rbp-B0h] BYREF
__int16 v61; // [rsp+5Ch] [rbp-ACh] BYREF
char v62; // [rsp+5Eh] [rbp-AAh]
float v63; // [rsp+60h] [rbp-A8h] BYREF
float v64; // [rsp+64h] [rbp-A4h]
__int16 v65; // [rsp+68h] [rbp-A0h]
_BYTE v66[12]; // [rsp+6Ch] [rbp-9Ch] BYREF
_QWORD v67[3]; // [rsp+78h] [rbp-90h] BYREF
__int64 v68; // [rsp+90h] [rbp-78h]
__int64 v69; // [rsp+98h] [rbp-70h]
float v70[4]; // [rsp+A0h] [rbp-68h] BYREF
__int64 v71[2]; // [rsp+B0h] [rbp-58h] BYREF
char v72[8]; // [rsp+C0h] [rbp-48h] BYREF
char v73[8]; // [rsp+C8h] [rbp-40h] BYREF
__int128 v74; // [rsp+D0h] [rbp-38h] BYREF
__int64 v75; // [rsp+E0h] [rbp-28h]
__int64 v76; // [rsp+E8h] [rbp-20h]
const char *v77; // [rsp+F8h] [rbp-10h]
const char *v78; // [rsp+100h] [rbp-8h]
_DWORD v79[2]; // [rsp+108h] [rbp+0h]
_QWORD v80[3]; // [rsp+110h] [rbp+8h]
int v81; // [rsp+128h] [rbp+20h]
const char *v82; // [rsp+130h] [rbp+28h]
const char *v83; // [rsp+138h] [rbp+30h]
const char *v84; // [rsp+140h] [rbp+38h]
int v85; // [rsp+148h] [rbp+40h]
const char *v86; // [rsp+150h] [rbp+48h]
const char *v87; // [rsp+158h] [rbp+50h]
const char *v88; // [rsp+160h] [rbp+58h]
int v89; // [rsp+168h] [rbp+60h]
const char *v90; // [rsp+170h] [rbp+68h]
const char *v91; // [rsp+178h] [rbp+70h]
const char *v92; // [rsp+180h] [rbp+78h]
int v93; // [rsp+188h] [rbp+80h]
const char *v94; // [rsp+190h] [rbp+88h]
const char *v95; // [rsp+198h] [rbp+90h]
const char *v96; // [rsp+1A0h] [rbp+98h]
int v97; // [rsp+1A8h] [rbp+A0h]
const char *v98; // [rsp+1B0h] [rbp+A8h]
const char *v99; // [rsp+1B8h] [rbp+B0h]
const char *v100; // [rsp+1C0h] [rbp+B8h]
int v101; // [rsp+1C8h] [rbp+C0h]
const char *v102; // [rsp+1D0h] [rbp+C8h]
char v103[8]; // [rsp+1D8h] [rbp+D0h] BYREF
char v104[8]; // [rsp+1E0h] [rbp+D8h] BYREF
_QWORD *v105; // [rsp+1E8h] [rbp+E0h]
char v106[8]; // [rsp+1F0h] [rbp+E8h] BYREF
char v107[8]; // [rsp+1F8h] [rbp+F0h] BYREF
char v108[8]; // [rsp+200h] [rbp+F8h] BYREF
char v109[16]; // [rsp+208h] [rbp+100h] BYREF
_BYTE v110[16]; // [rsp+218h] [rbp+110h] BYREF
__int64 v111; // [rsp+228h] [rbp+120h]
v60 = -1778384896;
result = cocos2d::CCLayerColor::initWithColor((cocos2d::CCLayerColor *)a1, (const struct cocos2d::_ccColor4B *)&v60);
if ( result )
{
*(_QWORD *)(a1 + 664) = a2;
FLAlertLayer::incrementForcePrio((struct cocos2d::CCObject *)a1);
*(_BYTE *)(a1 + 596) = 1;
LOBYTE(v5) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 920LL))(a1, v5);
LOBYTE(v6) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 992LL))(a1, v6);
v8 = cocos2d::CCDirector::sharedDirector(v7);
cocos2d::CCDirector::getWinSize(v8, v70);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v63, v70[0] * 0.5, v70[1] * 0.5);
v9 = cocos2d::CCLayer::create();
*(_QWORD *)(a1 + 584) = v9;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v9);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v71, 0.0, 0.0, 80.0, 80.0);
v11 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v10);
v12 = *(_QWORD *)v11;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v66, 420.0, 280.0);
(*(void (__fastcall **)(__int64, __int64))(v12 + 312))(v11, v13);
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v11 + 184LL))(v11, &v63);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v11,
4294967294LL);
v14 = cocos2d::CCLabelBMFont::create("Social Links", "goldFont.fnt");
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v14 + 160LL))(v14);
v15 = *(_QWORD *)v14;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v66, v63, (float)(v64 + 140.0) - 18.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v15 + 184))(v14, v16);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v14);
v18 = cocos2d::CCMenu::create(v17);
*(_QWORD *)(a1 + 552) = v18;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v18, 10);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 184LL))(*(_QWORD *)(a1 + 552), &unk_14090AC90);
*(_DWORD *)(a1 + 640) = -1;
v19 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
LODWORD(v15) = (_DWORD)v19;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v19 + 160LL))(v19);
v20 = CCMenuItemSpriteExtra::create(v15, 0, a1, (__int64)SocialLinksPopup::onClose);
*((_DWORD *)v20 + 93) = 1069547520;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v20);
v21 = *(_QWORD *)v20;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v66, (float)(v63 - 210.0) + 8.0, (float)(v64 + 140.0) - 8.0);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v21 + 184))(v20, v22);
v24 = (cocos2d::CCObject *)cocos2d::CCArray::create(v23);
*(_QWORD *)(a1 + 672) = v24;
cocos2d::CCObject::retain(v24);
v25 = v64 + 58.0;
v77 = "YouTube:";
v78 = "youtube.com/...";
v79[0] = 30;
v80[0] = "For YouTube, enter your @handle (your unique YouTube username found in your channel URL or account "
"settings).\n"
"Display names do not work.\n"
"You can also use your old channel ID starting with 'UC'.";
v80[1] = "Twitter:";
v80[2] = "twitter.com/...";
v81 = 20;
v82 = "For Twitter (X), input your username handle, seen after '@' on your profile.\n"
"Display names do not work.";
v83 = "Twitch:";
v84 = "twitch.tv/...";
v85 = 30;
v86 = "For Twitch, input your username, seen at the end of your channel's link (after 'twitch.tv/') or within"
" your profile settings.\n"
"Display names do not work.";
v87 = "Instagram:";
v88 = "instagram.com/...";
v89 = 30;
v90 = "For Instagram, input your username, seen on posts or within your settings.\n"
"Display names (at the top of your profile) do not work.";
v91 = "TikTok:";
v92 = "tiktok.com/@...";
v93 = 30;
v94 = "For TikTok, input your unique username handle, seen after '@' on your profile or at the end of your ch"
"annel link (after 'tiktok.com/@').\n"
"Display names do not work.";
v95 = "Discord:";
v96 = "Discord username...";
v97 = 40;
v98 = "For Discord, input your username, seen on your profile info page (button next to your display name). T"
"his is also used to tag users with by writing '@' first.\n"
"Display names do not work.\n"
"Your Discord username is used for account linking and notifications through the Discord bot Rateon.";
v99 = "Custom:";
v100 = "custom...";
v101 = 30;
v102 = "This field can be used for a custom, one-time authentication token generated by a third-party service"
" (such as a mod). Once saved here, the service can link and verify your account.\n"
"Do not share any tokens generated for you with other users.";
v60 = 0;
v65 = 13405;
v61 = -21896;
v26 = 0;
v27 = 0;
do
{
v28 = floorf((float)v26 * 0.5);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v67,
(float)((float)(2 * (v27 & 1) - 1) * 95.0) + v63,
v25 - (float)(v28 * 46.0));
v29 = sub_1402D6130((__int64 *)(*(_QWORD *)(a1 + 664) + 696LL), (int *)&v60);
sub_14003F4F0((__int64)v110, v29);
v30 = 8LL * (int)v60;
v31 = (&v77)[v30 / 2];
v32 = cocos2d::CCLabelBMFont::create(v31, "goldFont.fnt");
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v32);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v32 + 160LL))(v32);
v33 = *(_QWORD *)v32;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v103, 0.5, 0.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v33 + 288))(v32, v34);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v104, 0.0, 12.0);
cocos2d::CCPoint::operator+(v67, v72, v35);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, char *))(*(_QWORD *)v32 + 184LL))(v32, v72);
v105 = &v67[1];
v36 = (_BYTE *)v80[v30 / 2];
*(_OWORD *)&v67[1] = 0;
v68 = 0;
v69 = 0;
v37 = -1;
do
++v37;
while ( v36[v37] );
sub_14003D230(&v67[1], v36, v37);
v74 = 0;
v75 = 0;
v76 = 0;
v38 = -1;
do
++v38;
while ( v31[v38] );
sub_14003D230(&v74, v31, v38);
v39 = (__int64 *)InfoAlertButton::create(&v74, &v67[1]);
(*(void (__fastcall **)(_QWORD, __int64 *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v39);
v40 = *(float *)(*(__int64 (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v32 + 320LL))(v32);
v41 = (*(double (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v32 + 168LL))(v32);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v106, (float)((float)(*(float *)&v41 * v40) * 0.5) + 10.0, 5.0);
v43 = v42;
v44 = (*(__int64 (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v32 + 200LL))(v32);
cocos2d::CCPoint::operator+(v44, v73, v43);
v45 = *v39;
cocos2d::CCNode::convertToNodeSpace(*(_QWORD *)(a1 + 552), v107, v73);
(*(void (__fastcall **)(__int64 *, __int64))(v45 + 184))(v39, v46);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v109, 0.0, 0.0, 40.0, 40.0);
v48 = (_QWORD *)cocos2d::extension::CCScale9Sprite::create("square02b_small.png", v47);
v61 = v65;
v62 = 31;
(*(void (__fastcall **)(_QWORD *, __int16 *))v48[40])(v48 + 40, &v61);
v49 = *v48;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v108, 160.0, 20.0);
(*(void (__fastcall **)(_QWORD *, __int64))(v49 + 312))(v48, v50);
(*(void (__fastcall **)(_QWORD, _QWORD *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v48,
0xFFFFFFFFLL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v71, 0.0, -1.0);
cocos2d::CCPoint::operator+(v67, v66, v51);
(*(void (__fastcall **)(_QWORD *, _BYTE *))(*v48 + 184LL))(v48, v66);
v54 = CCTextInputNode::create(v53, v52, *(_QWORD *)&v79[v30 - 2]);
if ( v111 )
{
v55 = (_QWORD *)sub_14003F4F0((__int64)&v74, (__int64)v110);
CCTextInputNode::setString(v54, v55);
}
(*(void (__fastcall **)(_QWORD, char *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v54,
20);
*((_QWORD *)v54 + 75) = a1 + 544;
(*(void (__fastcall **)(char *, _QWORD *))(*(_QWORD *)v54 + 184LL))(v54, v67);
*((_DWORD *)v54 + 141) = 1056964608;
CCTextInputNode::refreshLabel((__int64)v54);
*((_DWORD *)v54 + 140) = 1124859904;
CCTextInputNode::refreshLabel((__int64)v54);
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)v54 + 74) + 336LL))(*((_QWORD *)v54 + 74), 0);
*((_DWORD *)v54 + 152) = v79[v30];
*(_OWORD *)&v67[1] = 0;
v68 = 0;
v69 = 0;
v67[1] = sub_14003D460(0x50u);
v68 = 67;
v69 = 79;
strcpy((char *)v67[1], " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_'.");
CCTextInputNode::setAllowedChars((__int64)v54, (void **)&v67[1]);
*((_WORD *)v54 + 286) = -21896;
v54[574] = -16;
CCTextInputNode::refreshLabel((__int64)v54);
*((_DWORD *)v54 + 142) = 1055286886;
CCTextInputNode::refreshLabel((__int64)v54);
(*(void (__fastcall **)(char *, _QWORD))(*(_QWORD *)v54 + 64LL))(v54, v60);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 672), (struct cocos2d::CCObject *)v54);
sub_14003D310((__int64)v110);
v26 = v60 + 1;
v60 = v26;
v27 = v26;
}
while ( v26 <= 6 );
v71[0] = (__int64)operator new(0x2C8u);
v56 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite(v71[0]);
if ( v56 )
{
if ( ButtonSprite::init_1(
(__int64)v56,
(__int64)"OK",
50,
0,
1058642330,
1,
&qword_140704F78,
(__int64)"GJ_button_01.png",
1105199104) )
{
cocos2d::CCObject::autorelease(v56);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v56 + 8LL))(v56, 1);
v56 = nullptr;
}
}
v71[0] = (__int64)operator new(0x208u);
v57 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(v71[0]);
if ( v57 )
{
if ( CCMenuItemSpriteExtra::init((__int64 *)v57, (__int64 *)v56, 0, a1, (__int64)SocialLinksPopup::onOK) )
{
cocos2d::CCObject::autorelease(v57);
LABEL_19:
*((_DWORD *)v57 + 93) = 1066192077;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
v57);
v58 = *(_QWORD *)v57;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v71, v63 + 95.0, (float)(v25 - 138.0) - 1.0);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v58 + 184))(v57, v59);
return 1;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v57 + 8LL))(v57, 1);
}
v57 = nullptr;
goto LABEL_19;
}
return result;
}