//
// FriendRequestPopup::loadFromGJFriendRequest from 0x100291a80 to 0x10029222b (1963 bytes)
//
// 1 xrefs:
// > FriendRequestPopup::init @ 0x100291944
//
// 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:27:49 +0000
//
void __fastcall FriendRequestPopup::loadFromGJFriendRequest(__int64 a1, __int64 a2, double a3)
{
const char *v3; // rsi
__int64 v4; // rax
unsigned int v5; // eax
unsigned __int64 v6; // rsi
int v7; // ecx
int v8; // eax
float v9; // xmm0_4
const char *data; // r14
size_t v11; // rax
size_t v12; // r15
char *v13; // r12
size_t v14; // r13
unsigned int v15; // eax
__int64 v16; // r14
__int64 v17; // rax
__int128 *v18; // rax
__int64 v19; // r14
__int64 v20; // rax
__int128 *v21; // rax
__int64 v22; // rax
__int64 CString; // rax
__int64 v24; // r14
char *v25; // rax
void *v26; // r14
char v27; // r12
__int128 v28; // xmm0
char *v29; // rax
void *v30; // r14
__int64 v31; // r15
char *v32; // rax
void *v33; // r14
char *v34; // rax
void *v35; // r14
__int64 v36; // rbx
unsigned __int64 v37; // [rsp+0h] [rbp-B0h] BYREF
_QWORD __dst[2]; // [rsp+8h] [rbp-A8h] BYREF
void *__p; // [rsp+18h] [rbp-98h]
double v40; // [rsp+20h] [rbp-90h] BYREF
unsigned __int64 v41; // [rsp+28h] [rbp-88h] BYREF
__int128 v42; // [rsp+30h] [rbp-80h]
std::string __str; // [rsp+40h] [rbp-70h] BYREF
float v44; // [rsp+58h] [rbp-58h] BYREF
float v45; // [rsp+5Ch] [rbp-54h]
__int128 v46; // [rsp+60h] [rbp-50h] BYREF
void *v47; // [rsp+70h] [rbp-40h]
unsigned __int64 v48[6]; // [rsp+80h] [rbp-30h] BYREF
if ( !a2 || *(_QWORD *)(a1 + 696) )
return;
*(_QWORD *)(a1 + 696) = a2;
cocos2d::CCObject::retain(a2);
*(_QWORD *)(GameLevelManager::sharedState(a3) + 1360) = a1 + 664;
v3 = (const char *)cocos2d::CCDirector::sharedDirector(a2, a2);
cocos2d::CCDirector::getWinSize(&v44, v3);
v4 = *(_QWORD *)(a1 + 696);
if ( (*(_BYTE *)(v4 + 328) & 1) != 0 )
{
v3 = *(const char **)(v4 + 344);
sub_10001AD30(&__str, v3, *(_QWORD *)(v4 + 336));
v5 = (unsigned int)__str.__r_.__value_.__l.0;
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_5:
if ( v5 >> 1 )
goto LABEL_12;
goto LABEL_9;
}
}
else
{
__str = *(std::string *)(v4 + 328);
v5 = (unsigned int)__str.__r_.__value_.__l.0;
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_5;
}
if ( __str.__r_.__value_.__l.__size_ )
goto LABEL_12;
LABEL_9:
v3 = "Sent you a friend request";
if ( *(_BYTE *)(a1 + 689) )
v3 = "Friend request sent";
std::string::assign(&__str, v3);
LABEL_12:
sub_1004EE050(&__str);
v6 = (unsigned int)EmoteSprite::maxEmotesComment(&__str, v3);
v7 = EmoteSprite::effectiveLength(&__str, v6);
v8 = 180;
if ( v7 <= 180
&& (v6 = (unsigned int)EmoteSprite::maxEmotesComment(&__str, v6),
v8 = EmoteSprite::effectiveLength(&__str, v6),
v8 < 71) )
{
v9 = 1.0;
}
else
{
v9 = (float)((float)((float)(180 - v8) / 180.0) * 0.30000001) + 0.69999999;
}
*(float *)&v42 = v9;
sub_100278250((float *)&v37, v44 * 0.5, (float)(0.5 * v45) + -4.0);
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
data = __str.__r_.__value_.__l.__data_;
else
data = __str.__r_.__value_.__s.__data_;
v11 = strlen(data);
if ( v11 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v12 = v11;
if ( v11 >= 0x17 )
{
v14 = 26;
if ( (v11 | 7) != 0x17 )
v14 = (v11 | 7) + 1;
v13 = (char *)operator new(v14);
__p = v13;
__dst[0] = v14 | 1;
__dst[1] = v12;
goto LABEL_26;
}
LOBYTE(__dst[0]) = 2 * v11;
v13 = (char *)__dst + 1;
if ( v11 )
{
LABEL_26:
v6 = (unsigned __int64)data;
memmove(v13, data, v12);
}
v13[v12] = 0;
sub_100278250((float *)&v46, 0.5, 0.5);
v15 = EmoteSprite::maxEmotesComment(&v46, v6);
v16 = TextArea::create(__dst, "chatFont.fnt", &v46, 1, v15, 1.0, 231.0 / *(float *)&v42, 20.0);
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v16);
sub_100278250((float *)v48, 0.0, 1.0);
sub_100278350((double *)&v46, &v37, v48);
(*(void (__fastcall **)(__int64, __int128 *))(*(_QWORD *)v16 + 184LL))(v16, &v46);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v16 + 160LL))(v16, *(float *)&v42);
v17 = *(_QWORD *)(a1 + 696);
if ( (*(_BYTE *)(v17 + 352) & 1) != 0 )
{
sub_10001AD30(&v46, *(const void **)(v17 + 368), *(_QWORD *)(v17 + 360));
}
else
{
v18 = (__int128 *)(v17 + 352);
v47 = *((void **)v18 + 2);
v46 = *v18;
}
if ( (v46 & 1) == 0 )
{
if ( !(_BYTE)v46 )
goto LABEL_42;
LABEL_36:
v20 = *(_QWORD *)(a1 + 696);
if ( (*(_BYTE *)(v20 + 352) & 1) != 0 )
{
sub_10001AD30(&v46, *(const void **)(v20 + 368), *(_QWORD *)(v20 + 360));
}
else
{
v21 = (__int128 *)(v20 + 352);
v47 = *((void **)v21 + 2);
v46 = *v21;
}
v22 = sub_10088E820("%s ago", v37);
CString = cocos2d::CCString::getCString(v22);
v24 = cocos2d::CCLabelBMFont::create_3(CString, "chatFont.fnt");
if ( (v46 & 1) != 0 )
operator delete(v47);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v24, 1);
sub_100278250((float *)&v46, 1.0, 0.5);
(*(void (__fastcall **)(__int64, __int128 *))(*(_QWORD *)v24 + 296LL))(v24, &v46);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v24 + 160LL))(v24, 0.60000002);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v24 + 1072LL))(v24, &unk_100A073CC);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v24 + 1024LL))(v24, 225);
sub_100278250((float *)&v46, (float)((float)(v44 * 0.5) + 170.0) + -8.0, (float)((float)(0.5 * v45) + 95.0) + -12.0);
(*(void (__fastcall **)(__int64, __int128 *))(*(_QWORD *)v24 + 184LL))(v24, &v46);
goto LABEL_42;
}
v19 = *((_QWORD *)&v46 + 1);
operator delete(v47);
if ( v19 )
goto LABEL_36;
LABEL_42:
sub_100278250((float *)&v46, v44 * 0.5, (float)((float)(0.5 * v45) + -95.0) + 22.0);
if ( *(_BYTE *)(a1 + 689) == 1 )
{
v25 = ButtonSprite::create_1(
(__int64)"Cancel",
0x41u,
0,
1u,
(__int64)"bigFont.fnt",
(__int64)"GJ_button_06.png",
0.55000001,
26.0);
v26 = CCMenuItemSpriteExtra::create((__int64)v25, 0, a1, (__int64)FriendRequestPopup::onRemove, 0);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v26);
cocos2d::CCNode::convertToNodeSpace((double *)v48, *(_QWORD *)(a1 + 552), (unsigned int *)&v46);
(*(void (__fastcall **)(void *, unsigned __int64 *))(*(_QWORD *)v26 + 184LL))(v26, v48);
}
else
{
v27 = *(_BYTE *)(*(_QWORD *)(a1 + 696) + 377LL);
if ( v27 )
v28 = 0x42480000u;
else
v28 = 0x42BE0000u;
v42 = v28;
v29 = ButtonSprite::create_1(
(__int64)"Accept",
0x41u,
0,
1u,
(__int64)"bigFont.fnt",
(__int64)"GJ_button_01.png",
0.55000001,
26.0);
v30 = CCMenuItemSpriteExtra::create((__int64)v29, 0, a1, (__int64)FriendRequestPopup::onAccept, 0);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v30);
v31 = *(_QWORD *)(a1 + 552);
sub_100278250((float *)&v41, -*(float *)&v42, 0.0);
sub_100278350(&v40, (unsigned __int64 *)&v46, &v41);
cocos2d::CCNode::convertToNodeSpace((double *)v48, v31, (unsigned int *)&v40);
(*(void (__fastcall **)(void *, unsigned __int64 *))(*(_QWORD *)v30 + 184LL))(v30, v48);
if ( !v27 )
{
v32 = ButtonSprite::create_1(
(__int64)"Ignore",
0x41u,
0,
1u,
(__int64)"bigFont.fnt",
(__int64)"GJ_button_04.png",
0.55000001,
26.0);
v33 = CCMenuItemSpriteExtra::create((__int64)v32, 0, a1, (__int64)sub_1002924C0, 0);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v33);
cocos2d::CCNode::convertToNodeSpace((double *)v48, *(_QWORD *)(a1 + 552), (unsigned int *)&v46);
(*(void (__fastcall **)(void *, unsigned __int64 *))(*(_QWORD *)v33 + 184LL))(v33, v48);
}
v34 = ButtonSprite::create_1(
(__int64)"Block",
0x41u,
0,
1u,
(__int64)"bigFont.fnt",
(__int64)"GJ_button_06.png",
0.55000001,
26.0);
v35 = CCMenuItemSpriteExtra::create((__int64)v34, 0, a1, (__int64)FriendRequestPopup::onBlock, 0);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v35);
v36 = *(_QWORD *)(a1 + 552);
sub_100278250((float *)&v41, *(float *)&v42, 0.0);
sub_100278350(&v40, (unsigned __int64 *)&v46, &v41);
cocos2d::CCNode::convertToNodeSpace((double *)v48, v36, (unsigned int *)&v40);
(*(void (__fastcall **)(void *, unsigned __int64 *))(*(_QWORD *)v35 + 184LL))(v35, v48);
}
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__str.__r_.__value_.__l.__data_);
}