diff --git a/src/Cafe/IOSU/legacy/iosu_fpd.cpp b/src/Cafe/IOSU/legacy/iosu_fpd.cpp index 9130b28d2..aca1a332b 100644 --- a/src/Cafe/IOSU/legacy/iosu_fpd.cpp +++ b/src/Cafe/IOSU/legacy/iosu_fpd.cpp @@ -214,6 +214,12 @@ namespace iosu friendData->friendExtraData.gameKey.ukn08 = frd->presence.gameKey.ukn; NexPresenceToGameMode(&frd->presence, &friendData->friendExtraData.gameMode); + auto fixed_presence_msg = '\0' + frd->presence.msg; // avoid first character of comment from being cut off + friendData->friendExtraData.gameModeDescription.assignFromUTF8(fixed_presence_msg); + + auto fixed_comment = '\0' + frd->comment.commentString; // avoid first character of comment from being cut off + friendData->friendExtraData.comment.assignFromUTF8(fixed_comment); + // set valid dates friendData->uknDate.year = 2018; friendData->uknDate.day = 1; @@ -750,9 +756,18 @@ namespace iosu { if(numVecIn != 0 || numVecOut != 1) return FPResult_InvalidIPCParam; - SelfPlayingGame selfPlayingGame{0}; - cemuLog_log(LogType::Force, "GetMyPlayingGame is todo"); - return WriteValueOutput(vecOut, selfPlayingGame); + GameKey selfPlayingGame + { + CafeSystem::GetForegroundTitleId(), + CafeSystem::GetForegroundTitleVersion(), + {0,0,0,0,0,0} + }; + if (GetTitleIdHigh(CafeSystem::GetForegroundTitleId()) != 0x00050000) + { + selfPlayingGame.titleId = 0; + selfPlayingGame.ukn08 = 0; + } + return WriteValueOutput(vecOut, selfPlayingGame); } nnResult CallHandler_GetFriendAccountId(FPDClient* fpdClient, IPCIoctlVector* vecIn, uint32 numVecIn, IPCIoctlVector* vecOut, uint32 numVecOut) @@ -1410,8 +1425,16 @@ namespace iosu act::getCountryIndex(currentSlot, &countryCode); // init presence g_fpd.myPresence.isOnline = 1; - g_fpd.myPresence.gameKey.titleId = CafeSystem::GetForegroundTitleId(); - g_fpd.myPresence.gameKey.ukn = CafeSystem::GetForegroundTitleVersion(); + if (GetTitleIdHigh(CafeSystem::GetForegroundTitleId()) == 0x00050000) + { + g_fpd.myPresence.gameKey.titleId = CafeSystem::GetForegroundTitleId(); + g_fpd.myPresence.gameKey.ukn = CafeSystem::GetForegroundTitleVersion(); + } + else + { + g_fpd.myPresence.gameKey.titleId = 0; // icon will not be ??? or invalid to others + g_fpd.myPresence.gameKey.ukn = 0; + } // resolve potential domain to IP address struct addrinfo hints = {0}, *addrs; hints.ai_family = AF_INET; diff --git a/src/Cafe/IOSU/legacy/iosu_fpd.h b/src/Cafe/IOSU/legacy/iosu_fpd.h index 79f524d65..0a6f08857 100644 --- a/src/Cafe/IOSU/legacy/iosu_fpd.h +++ b/src/Cafe/IOSU/legacy/iosu_fpd.h @@ -94,7 +94,7 @@ namespace iosu /* +0x1EC */ uint8 isOnline; /* +0x1ED */ uint8 _padding1ED[3]; // some other sub struct? - /* +0x1F0 */ char comment[36]; // pops up every few seconds in friend list + /* +0x1F0 */ CafeWideString<0x12> comment; // pops up every few seconds in friend list /* +0x214 */ uint32be _padding214; /* +0x218 */ FPDDate approvalTime; /* +0x220 */ FPDDate lastOnline; @@ -263,4 +263,4 @@ namespace iosu IOSUModule* GetModule(); } -} \ No newline at end of file +} diff --git a/src/Cemu/nex/nexFriends.cpp b/src/Cemu/nex/nexFriends.cpp index 4fae81438..ae87ce44b 100644 --- a/src/Cemu/nex/nexFriends.cpp +++ b/src/Cemu/nex/nexFriends.cpp @@ -1,6 +1,7 @@ #include "prudp.h" #include "nex.h" #include "nexFriends.h" +#include "Cafe/CafeSystem.h" static const int NOTIFICATION_SRV_FRIEND_OFFLINE = 0x0A; // the opposite event (friend online) is notified via _PRESENCE_CHANGE static const int NOTIFICATION_SRV_FRIEND_PRESENCE_CHANGE = 0x18; @@ -912,6 +913,18 @@ void NexFriends::markFriendRequestsAsReceived(uint64* messageIdList, sint32 coun void NexFriends::updateMyPresence(nexPresenceV2& myPresence) { this->myPresence = myPresence; + + if (GetTitleIdHigh(CafeSystem::GetForegroundTitleId()) == 0x00050000) + { + myPresence.gameKey.titleId = CafeSystem::GetForegroundTitleId(); + myPresence.gameKey.ukn = CafeSystem::GetForegroundTitleVersion(); + } + else + { + myPresence.gameKey.titleId = 0; // icon will not be ??? or invalid to others + myPresence.gameKey.ukn = 0; + } + if (nexCon == nullptr || nexCon->getState() != nexService::STATE_CONNECTED) { // not connected diff --git a/src/Cemu/nex/nexFriends.h b/src/Cemu/nex/nexFriends.h index 06c751107..1077b0d5a 100644 --- a/src/Cemu/nex/nexFriends.h +++ b/src/Cemu/nex/nexFriends.h @@ -431,7 +431,7 @@ class nexFriend : public nexType { nnaInfo.readData(pb); presence.readData(pb); - gameModeMessage.readData(pb); + comment.readData(pb); friendsSinceTimestamp = pb->readU64(); lastOnlineTimestamp = pb->readU64(); ukn6 = pb->readU64(); @@ -439,7 +439,7 @@ class nexFriend : public nexType public: nexNNAInfo nnaInfo; nexPresenceV2 presence; - nexComment gameModeMessage; + nexComment comment; uint64 friendsSinceTimestamp; uint64 lastOnlineTimestamp; uint64 ukn6;