//
// FriendRequestPopup::loadFromGJFriendRequest from 0x5db7a8 to 0x5dbd08 (1376 bytes)
//
// 1 xrefs:
// > FriendRequestPopup::init @ 0x5df5a2
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:54:12 +0000
//
int __fastcall FriendRequestPopup::loadFromGJFriendRequest(int this, GJFriendRequest *a2)
{
const char *v2; // r5
int v3; // r4
GameLevelManager *v4; // r0
cocos2d::CCDirector *v5; // r0
int v6; // r3
EmoteSprite *v7; // r0
char *v8; // r1
int v9; // r0
int v10; // r2
int v11; // r3
EmoteSprite *v12; // r0
int v13; // r0
int v14; // r2
int v15; // r3
int v16; // r0
float v17; // s17
size_t v18; // r0
EmoteSprite *v19; // r0
int v20; // r0
int v21; // r9
void (__fastcall *v22)(int, _DWORD *); // r11
int v23; // r9
const char *v24; // r1
cocos2d::CCString *v25; // r0
cocos2d::CCLabelBMFont *CString; // r0
const char *v27; // r2
int v28; // r9
void (__fastcall *v29)(int, _DWORD *); // r10
void (__fastcall *v30)(int, _DWORD *); // r10
ButtonSprite *v31; // r0
int v32; // r7
void (__fastcall *v33)(int, _DWORD *); // r8
float v34; // s15
ButtonSprite *v35; // r0
int v36; // r10
void (__fastcall *v37)(int, _DWORD *); // r11
ButtonSprite *v38; // r0
int v39; // r8
void (__fastcall *v40)(int, _DWORD *); // r10
ButtonSprite *v41; // r0
int v42; // r5
const cocos2d::CCPoint *v43; // r8
void (__fastcall *v44)(int, _DWORD *); // r7
float v45; // [sp+10h] [bp-9Ch]
float v46; // [sp+10h] [bp-9Ch]
int v47; // [sp+14h] [bp-98h]
cocos2d::CCPoint *v48; // [sp+20h] [bp-8Ch]
float v49; // [sp+2Ch] [bp-80h] BYREF
float v50; // [sp+30h] [bp-7Ch]
_BYTE v51[8]; // [sp+34h] [bp-78h] BYREF
_BYTE v52[8]; // [sp+3Ch] [bp-70h] BYREF
_BYTE v53[8]; // [sp+44h] [bp-68h] BYREF
_BYTE v54[8]; // [sp+4Ch] [bp-60h] BYREF
_DWORD v55[4]; // [sp+54h] [bp-58h] BYREF
_DWORD v56[2]; // [sp+64h] [bp-48h] BYREF
_DWORD v57[2]; // [sp+6Ch] [bp-40h] BYREF
int v58[3]; // [sp+74h] [bp-38h] BYREF
int v59[3]; // [sp+80h] [bp-2Ch] BYREF
int v60[3]; // [sp+8Ch] [bp-20h] BYREF
int v61[3]; // [sp+98h] [bp-14h] BYREF
v3 = this;
if ( *(_DWORD *)(this + 536) || !a2 )
return this;
*(_DWORD *)(this + 536) = a2;
v4 = (GameLevelManager *)cocos2d::CCObject::retain(a2);
v5 = (cocos2d::CCDirector *)GameLevelManager::sharedState(v4);
*((_DWORD *)v5 + 222) = v3 + 520;
cocos2d::CCDirector::sharedDirector(v5);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v49);
std::string::basic_string(v58, *(_DWORD *)(v3 + 536) + 276);
if ( (v58[0] & 1) != 0 )
v6 = v58[1];
else
v6 = (int)LOBYTE(v58[0]) >> 1;
if ( !v6 )
{
if ( *(_BYTE *)(v3 + 533) )
v8 = "Friend request sent";
else
v8 = "Sent you a friend request";
std::string::assign(v58, v8);
}
v7 = (EmoteSprite *)GameToolbox::stripNonBreakingSpaces(v58);
v9 = EmoteSprite::maxEmotesComment(v7);
v12 = (EmoteSprite *)EmoteSprite::effectiveLength((unsigned __int8 *)v58, v9, v10, v11);
if ( (int)v12 > 180 )
{
v16 = 180;
}
else
{
v13 = EmoteSprite::maxEmotesComment(v12);
v16 = EmoteSprite::effectiveLength((unsigned __int8 *)v58, v13, v14, v15);
if ( v16 <= 70 )
{
v17 = 1.0;
goto LABEL_18;
}
}
v17 = (float)((float)((float)(180 - v16) / 180.0) * 0.3) + 0.7;
LABEL_18:
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v51, v49 * 0.5, (float)(v50 * 0.5) - 4.0);
if ( (v58[0] & 1) == 0 )
v2 = (char *)v58 + 1;
v59[0] = 0;
if ( (v58[0] & 1) != 0 )
v2 = (const char *)v58[2];
v59[1] = 0;
v59[2] = 0;
v18 = strlen(v2);
std::string::__init(v59, v2, v18);
v19 = (EmoteSprite *)cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v57, 0.5, 0.5);
v20 = EmoteSprite::maxEmotesComment(v19);
v21 = TextArea::create(
(int)v59,
"chatFont.fnt",
1065353216,
COERCE_INT(231.0 / v17),
(const cocos2d::CCPoint *)v57,
1101004800,
1,
v20);
std::string::~string((int)v59);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(v3 + 460) + 228))(*(_DWORD *)(v3 + 460), v21);
v22 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v21 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v56, 0.0, 1.0);
cocos2d::CCPoint::operator+(v57, v51, v56);
v22(v21, v57);
(*(void (__fastcall **)(int, float))(*(_DWORD *)v21 + 80))(v21, COERCE_FLOAT(LODWORD(v17)));
std::string::basic_string(v60, *(_DWORD *)(v3 + 536) + 288);
if ( (v60[0] & 1) != 0 )
v23 = v60[1];
else
v23 = (int)LOBYTE(v60[0]) >> 1;
std::string::~string((int)v60);
if ( v23 )
{
std::string::basic_string(v61, *(_DWORD *)(v3 + 536) + 288);
if ( (v61[0] & 1) != 0 )
v24 = (const char *)v61[2];
else
v24 = (char *)v61 + 1;
v25 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s ago", v24);
CString = (cocos2d::CCLabelBMFont *)cocos2d::CCString::getCString(v25);
v28 = cocos2d::CCLabelBMFont::create(CString, "chatFont.fnt", v27);
std::string::~string((int)v61);
(*(void (__fastcall **)(_DWORD, int, int))(**(_DWORD **)(v3 + 460) + 232))(*(_DWORD *)(v3 + 460), v28, 1);
v29 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v28 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v57, 1.0, 0.5);
v29(v28, v57);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v28 + 80))(v28, 1058642330);
(*(void (__fastcall **)(int, void *))(*(_DWORD *)v28 + 536))(v28, &unk_BEE20E);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v28 + 512))(v28, 225);
v30 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v28 + 92);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v57,
(float)((float)(v49 * 0.5) + 170.0) - 8.0,
(float)((float)(v50 * 0.5) + 95.0) - 12.0);
v30(v28, v57);
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v52, v49 * 0.5, (float)((float)(v50 * 0.5) - 95.0) + 22.0);
if ( *(_BYTE *)(v3 + 533) )
{
v31 = ButtonSprite::create(
(ButtonSprite *)"Cancel",
(const char *)&dword_40 + 1,
0,
0.55,
1,
"bigFont.fnt",
"GJ_button_06.png",
(const char *)0x41D00000,
v45);
v55[1] = 0;
v55[0] = FriendRequestPopup::onRemove;
v32 = CCMenuItemSpriteExtra::create((int)v31, 0, v3, (int)FriendRequestPopup::onRemove, 0);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(v3 + 444) + 228))(*(_DWORD *)(v3 + 444), v32);
v33 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v32 + 92);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v57, *(const cocos2d::CCPoint **)(v3 + 444));
v33(v32, v57);
}
else
{
v34 = 50.0;
v47 = *(unsigned __int8 *)(*(_DWORD *)(v3 + 536) + 301);
if ( !*(_BYTE *)(*(_DWORD *)(v3 + 536) + 301) )
v34 = 95.0;
v35 = ButtonSprite::create(
(ButtonSprite *)"Accept",
(const char *)&dword_40 + 1,
*(unsigned __int8 *)(v3 + 533),
0.55,
1,
"bigFont.fnt",
"GJ_button_01.png",
(const char *)0x41D00000,
v45);
v55[3] = 0;
v55[2] = FriendRequestPopup::onAccept;
v36 = CCMenuItemSpriteExtra::create((int)v35, 0, v3, (int)FriendRequestPopup::onAccept, 0);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(v3 + 444) + 228))(*(_DWORD *)(v3 + 444), v36);
v37 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v36 + 92);
v48 = *(cocos2d::CCPoint **)(v3 + 444);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v55, COERCE_FLOAT(LODWORD(v34) ^ 0x80000000), 0.0);
cocos2d::CCPoint::operator+(v56, v52, v55);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v57, v48);
v37(v36, v57);
if ( !v47 )
{
v38 = ButtonSprite::create(
(ButtonSprite *)"Ignore",
(const char *)&dword_40 + 1,
0,
0.55,
1,
"bigFont.fnt",
"GJ_button_04.png",
(const char *)0x41D00000,
v46);
v56[1] = 0;
v56[0] = FriendRequestPopup::onIgnore;
v39 = CCMenuItemSpriteExtra::create((int)v38, 0, v3, (int)FriendRequestPopup::onIgnore, 0);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(v3 + 444) + 228))(*(_DWORD *)(v3 + 444), v39);
v40 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v39 + 92);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v57, *(const cocos2d::CCPoint **)(v3 + 444));
v40(v39, v57);
}
v41 = ButtonSprite::create(
(ButtonSprite *)"Block",
(const char *)&dword_40 + 1,
0,
0.55,
1,
"bigFont.fnt",
"GJ_button_06.png",
(const char *)0x41D00000,
v46);
v57[1] = 0;
v57[0] = FriendRequestPopup::onBlock;
v42 = CCMenuItemSpriteExtra::create((int)v41, 0, v3, (int)FriendRequestPopup::onBlock, 0);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(v3 + 444) + 228))(*(_DWORD *)(v3 + 444), v42);
v43 = *(const cocos2d::CCPoint **)(v3 + 444);
v44 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v42 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v53, v34, 0.0);
cocos2d::CCPoint::operator+(v54, v52, v53);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v55, v43);
v44(v42, v55);
}
return std::string::~string((int)v58);
}