mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-22 09:09:18 +01:00
nn_nfp: Avoid current app from showing up as "???" for others in Friend List + View friends' status (#1157)
This commit is contained in:
parent
7b635e7eb8
commit
33a74c2035
@ -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<SelfPlayingGame>(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<GameKey>(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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -431,7 +431,7 @@ public:
|
||||
{
|
||||
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 @@ public:
|
||||
public:
|
||||
nexNNAInfo nnaInfo;
|
||||
nexPresenceV2 presence;
|
||||
nexComment gameModeMessage;
|
||||
nexComment comment;
|
||||
uint64 friendsSinceTimestamp;
|
||||
uint64 lastOnlineTimestamp;
|
||||
uint64 ukn6;
|
||||
|
Loading…
Reference in New Issue
Block a user