//
// ProfilePage::onFriend from 0x4c6d78 to 0x4c6efc (388 bytes)
//
// 0 xrefs:
//
// 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
//
void ProfilePage::onFriend(ProfilePage *a1, cocos2d::CCObject *a2)
{
GJAccountManager *v3; // r0
int m_friendReqStatus; // r3
int m_accountID; // r7
unsigned int v6; // r7
FLAlertLayer *v7; // r4
ButtonSprite *m_button2; // r0
GameLevelManager *v9; // r0
GJFriendRequest *v10; // r0
FriendRequestPopup *v11; // r0
char v12; // [sp+24h] [bp-10h] BYREF
_BYTE v13[4]; // [sp+28h] [bp-Ch] BYREF
v3 = GJAccountManager::sharedState();
if ( v3->m_accountID - v3->m_unkInt1 <= 0 )
{
ProfilePage::showNoAccountError(a1);
return;
}
m_friendReqStatus = a1->m_score->m_friendReqStatus;
switch ( m_friendReqStatus )
{
case 0:
sub_776584((int)&v12, "Friend request");
m_accountID = a1->m_accountID;
sub_776584((int)v13, (char *)&unk_939830);
v6 = ShareCommentLayer::create((ShareCommentLayer *)&v12, (std::string)140, 2, m_accountID, (int)v13);
sub_774008(v13);
sub_774008(&v12);
(*(void (__fastcall **)(unsigned int))(*(_DWORD *)v6 + 644))(v6);
return;
case 4:
sub_776584((int)v13, "Are you sure you want to remove this friend request?");
v7 = FLAlertLayer::create(
(int)&a1->FLAlertLayerProtocol,
(int)"Cancel friend request",
(int)v13,
(int)"Back",
(int)"Remove",
380.0,
0,
0,
1.0);
sub_774008(v13);
v7->setTag(v7, 1);
m_button2 = v7->m_button2;
LABEL_11:
ButtonSprite::updateBGImage(m_button2, "GJ_button_06.png");
v7->show(v7);
return;
case 3:
v9 = GameLevelManager::sharedState();
v10 = GameLevelManager::friendRequestFromAccountID(v9, a1->m_score->m_accountID);
a1->m_score->m_newFriendRequest = 0;
v11 = FriendRequestPopup::create(v10);
v11->show(v11);
return;
case 1:
sub_776584((int)v13, "Are you sure you want to remove this friend?");
v7 = FLAlertLayer::create(
(int)&a1->FLAlertLayerProtocol,
(int)"Unfriend",
(int)v13,
(int)"Back",
(int)"Unfriend",
380.0,
0,
0,
1.0);
sub_774008(v13);
v7->setTag(v7, 2);
m_button2 = v7->m_button2;
goto LABEL_11;
}
}