//
// ProfilePage::onFriend from 0x1403c3ee0 to 0x1403c42cc (1004 bytes)
//
// 2 xrefs:
// > ProfilePage::loadPageFromUserInfo @ 0x1403c23b8
// > ??> @ 0x1406d77b4
//
// 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=4
void ProfilePage::onFriend(ProfilePage *a1, cocos2d::CCObject *a2)
{
GJAccountManager *v3; // rax
ProfilePage *v4; // rcx
int m_friendReqStatus; // ecx
__int64 v6; // rax
FLAlertLayerProtocol *v7; // rdi
FLAlertLayer *v8; // rbx
__int64 v9; // rax
__int64 v10; // rdx
__int64 v11; // rcx
GJFriendRequest *v12; // rax
FriendRequestPopup *v13; // rax
FLAlertLayerProtocol *v14; // rdi
__int64 v15; // rax
__int128 v16; // [rsp+50h] [rbp+17h] BYREF
__int64 v17; // [rsp+60h] [rbp+27h]
__int64 v18; // [rsp+68h] [rbp+2Fh]
__int128 v19; // [rsp+70h] [rbp+37h] BYREF
__int64 v20; // [rsp+80h] [rbp+47h]
__int64 v21; // [rsp+88h] [rbp+4Fh]
void *v22; // [rsp+B0h] [rbp+77h]
FLAlertLayer *v23; // [rsp+B8h] [rbp+7Fh]
FLAlertLayer *v24; // [rsp+B8h] [rbp+7Fh]
v3 = GJAccountManager::sharedState();
if ( v3->m_accountID - v3->m_unkInt1 <= 0 )
{
ProfilePage::showNoAccountError(v4);
return;
}
m_friendReqStatus = a1->m_score->m_friendReqStatus;
if ( !m_friendReqStatus )
{
v19 = 0;
v20 = 0;
v21 = 15;
LOBYTE(v19) = 0;
v17 = 14;
v18 = 15;
strcpy((char *)&v16, "Friend request");
HIBYTE(v16) = 0;
v6 = ShareCommentLayer::create((unsigned int)&v16, 140, 2, a1->m_accountID, (__int64)&v19);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v6 + 1040LL))(v6);
return;
}
if ( m_friendReqStatus == 4 )
{
v7 = &a1->FLAlertLayerProtocol;
v16 = 0;
*(_QWORD *)&v16 = sub_14003AA10(0x40u);
v17 = 52;
v18 = 63;
strcpy((char *)v16, "Are you sure you want to remove this friend request?");
v23 = (FLAlertLayer *)operator new(0x278u);
v8 = FLAlertLayer::FLAlertLayer(v23);
if ( v8 )
{
v9 = sub_14003BDB0((__int64)&v19, (__int64)&v16);
if ( FLAlertLayer::init((__int64)v8, (__int64)v7, "Cancel friend request", v9, "Back", "Remove", 380.0, 0, 0, 1.0) )
{
cocos2d::CCObject::autorelease(v8);
}
else
{
((void (__fastcall *)(FLAlertLayer *, __int64))v8->~FLAlertLayer)(v8, 1);
v8 = nullptr;
}
}
sub_14003A830((__int64)&v16);
v10 = 1;
LABEL_21:
v8->setTag(v8, v10);
ButtonSprite::updateBGImage(v8->m_button2, "GJ_button_06.png");
v8->show(v8);
return;
}
if ( m_friendReqStatus != 3 )
{
if ( m_friendReqStatus != 1 )
return;
v14 = &a1->FLAlertLayerProtocol;
v16 = 0;
*(_QWORD *)&v16 = sub_14003AA10(0x30u);
v17 = 44;
v18 = 47;
strcpy((char *)v16, "Are you sure you want to remove this friend?");
v24 = (FLAlertLayer *)operator new(0x278u);
v8 = FLAlertLayer::FLAlertLayer(v24);
if ( v8 )
{
v15 = sub_14003BDB0((__int64)&v19, (__int64)&v16);
if ( FLAlertLayer::init((__int64)v8, (__int64)v14, "Unfriend", v15, "Back", "Unfriend", 380.0, 0, 0, 1.0) )
{
cocos2d::CCObject::autorelease(v8);
}
else
{
((void (__fastcall *)(FLAlertLayer *, __int64))v8->~FLAlertLayer)(v8, 1);
v8 = nullptr;
}
}
sub_14003A830((__int64)&v16);
v10 = 2;
goto LABEL_21;
}
v11 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v22 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v22);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v11 = qword_1406C2EC0;
}
v12 = (GJFriendRequest *)cocos2d::CCDictionary::objectForKey(
*(cocos2d::CCDictionary **)(v11 + 608),
a1->m_score->m_accountID);
a1->m_score->m_newFriendRequest = 0;
v13 = FriendRequestPopup::create(v12);
v13->show(v13);
}