Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid current app from showing up as "???" for others in Friend List + View friends' status #1157

Merged
merged 10 commits into from Apr 8, 2024

Conversation

rewfs98
Copy link
Contributor

@rewfs98 rewfs98 commented Apr 6, 2024

iosu_fpd.cpp, nexFriends.cpp and nexFriends.h are edited to have these changes:

  • Starting a friend session on a non-game application (system app, etc) will force myPresence.gameKey.titleId and myPresence.gameKey.ukn to be 0 in order to avoid the app from showing up as "???" for other people in Friend List and instead have no icon just like in real hardware
  • Updating the gamemode will force myPresence.gameKey.titleId and myPresence.gameKey.ukn to be the current foreground title id/version (or 0 if not a game app) in order to avoid the app from showing up as "???" for other people in Friend List (the titleid is incorrect when the gamemode is updated, not sure why)
  • Renamed nexFriend->gameModeMessage to nexFriend->comment since it is the status comment of an account, nothing to do with GameMode
  • When calling NexFriendToFPDFriendData, the gamemode description and status comment from NexFriend will be copied over to FriendData, allowing friends comments and gamemode description to be read in Friend List
  • Somewhat implemented GetMyPlayingGame (might be not too accurate)

- Implement GetMyPlayingGame
- In StartFriendSession, the gameKey will be 0 if the current foreground title id does not start with 0x00050000 (game application)
- In NexFriends::updateMyPresence, the gameKey will be 0 if the current foreground title id does not start with 0x00050000 (game application)
@rewfs98
Copy link
Contributor Author

rewfs98 commented Apr 6, 2024

I forgot to change the other instance of gameModeMessage in nexFriend.readData causing the build to fail, sorry about that!


auto comment_utf16 = StringHelpers::FromUtf8(frd->comment.commentString);
comment_utf16.insert(0, 1, '\0'); // avoid first character of comment from being cut off
memcpy(friendData->friendExtraData.comment, comment_utf16.c_str(), 36);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have friendExtraData.comment defined as a char array, but here you are assigning it the bytes from a wide string. If this is working then we should redefine friendExtraData.comment as the proper string type. Consider using the helper class CafeWideString since that avoids having to manually memcpy

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defined friendExtraData.comment as CafeWideString<0x12> and now using assignFromUTF8 instead of memcpy, still works. 👍

@Exzap Exzap merged commit 33a74c2 into cemu-project:main Apr 8, 2024
4 of 5 checks passed
@Exzap
Copy link
Contributor

Exzap commented Apr 8, 2024

thanks!

@rewfs98 rewfs98 deleted the mypresence branch April 9, 2024 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants