//
// ProfilePage::onFriend from 0x5f7ba0 to 0x5f7d74 (468 bytes)
//
// 0 xrefs:
//
// 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:32 +0000
//
GameLevelManager *__fastcall ProfilePage::onFriend(ProfilePage *this, cocos2d::CCObject *a2)
{
GJAccountManager *v3; // r0
GJAccountManager *v4; // r0
GameLevelManager *result; // r0
int v6; // r1
int v7; // r4
int v8; // r9
int *v9; // r4
cocos2d::CCDictionary **v10; // r0
FriendRequestPopup *v11; // r0
bool v12; // r2
GJFriendRequest *v13; // r1
cocos2d::CCDictionary **v14; // r0
FLAlertLayer *v15; // r0
int *UnfriendAlert; // r5
int v17[3]; // [sp+1Ch] [bp-20h] BYREF
int v18; // [sp+28h] [bp-14h] BYREF
int v19; // [sp+2Ch] [bp-10h]
int v20; // [sp+30h] [bp-Ch]
v3 = (GJAccountManager *)GJAccountManager::sharedState(this);
if ( *((_DWORD *)v3 + 70) - *((_DWORD *)v3 + 71) <= 0 )
{
v4 = (GJAccountManager *)GJAccountManager::sharedState(v3);
return (GameLevelManager *)GJAccountManager::showAccountNeededAlert(v4, "add friends");
}
result = (GameLevelManager *)GameLevelManager::sharedState(v3);
*((_DWORD *)result + 221) = (char *)this + 532;
v6 = *((_DWORD *)this + 138);
v7 = *(_DWORD *)(v6 + 520);
switch ( v7 )
{
case 0:
memset(v17, 0, sizeof(v17));
std::string::__init(v17, "Friend Request", 0xEu);
v8 = *((_DWORD *)this + 139);
v18 = 0;
v19 = 0;
v20 = 0;
std::string::__init(&v18, &unk_B6B226, 0);
v9 = (int *)ShareCommentLayer::create((int)v17, 140, 2u, v8, (int)&v18);
std::string::~string((int)&v18);
std::string::~string((int)v17);
if ( *(_DWORD *)(*((_DWORD *)this + 138) + 360) != 2 )
{
v18 = 0;
v19 = 0;
v20 = 0;
std::string::__init(&v18, "This user does not accept messages in friend requests.", 0x3Eu);
ShareCommentLayer::lockInput((int)v9, (int)&v18);
std::string::~string((int)&v18);
}
return (GameLevelManager *)(*(int (__fastcall **)(int *))(*v9 + 656))(v9);
case 4:
v10 = (cocos2d::CCDictionary **)GameLevelManager::sharedState(result);
v11 = (FriendRequestPopup *)GameLevelManager::friendRequestFromAccountID(
v10,
*(_DWORD *)(*((_DWORD *)this + 138) + 296));
if ( !v11 )
{
v18 = 0;
v19 = 0;
v20 = 0;
std::string::__init(&v18, "Are you sure you want to remove this friend request?", 0x34u);
v9 = FLAlertLayer::create(
(int)this + 520,
(cocos2d::CCLabelBMFont *)"Cancel friend request",
(int)&v18,
(ButtonSprite *)"Back",
(ButtonSprite *)"Remove",
380.0,
0,
0,
1.0);
std::string::~string((int)&v18);
(*(void (__fastcall **)(int *, int))(*v9 + 36))(v9, 1);
ButtonSprite::updateBGImage((char *)v9[121], "GJ_button_06.png");
return (GameLevelManager *)(*(int (__fastcall **)(int *))(*v9 + 656))(v9);
}
v13 = (GJFriendRequest *)(&dword_0 + 1);
goto LABEL_13;
case 3:
v14 = (cocos2d::CCDictionary **)GameLevelManager::sharedState(result);
v11 = (FriendRequestPopup *)GameLevelManager::friendRequestFromAccountID(
v14,
*(_DWORD *)(*((_DWORD *)this + 138) + 296));
v13 = nullptr;
*(_BYTE *)(*((_DWORD *)this + 138) + 556) = 0;
LABEL_13:
v15 = FriendRequestPopup::create(v11, v13, v12);
return (GameLevelManager *)(*(int (__fastcall **)(FLAlertLayer *))(*(_DWORD *)v15 + 656))(v15);
case 1:
std::string::basic_string(&v18, v6 + 264);
UnfriendAlert = ProfilePage::createUnfriendAlert((int)this + 520, (int)&v18);
std::string::~string((int)&v18);
(*(void (__fastcall **)(int *, int))(*UnfriendAlert + 36))(UnfriendAlert, 2);
return (GameLevelManager *)(*(int (__fastcall **)(int *))(*UnfriendAlert + 656))(UnfriendAlert);
}
return result;
}