diff --git a/src/Cafe/IOSU/legacy/iosu_fpd.cpp b/src/Cafe/IOSU/legacy/iosu_fpd.cpp index 180f2ca01..28d248ae1 100644 --- a/src/Cafe/IOSU/legacy/iosu_fpd.cpp +++ b/src/Cafe/IOSU/legacy/iosu_fpd.cpp @@ -723,7 +723,6 @@ namespace iosu { if(numVecIn != 0 || numVecOut != 1) return FPResult_InvalidIPCParam; - static constexpr uint32 MY_COMMENT_LENGTH = 0x12; std::basic_string myComment; if(g_fpd.nexFriendSession) { diff --git a/src/Cafe/IOSU/legacy/iosu_fpd.h b/src/Cafe/IOSU/legacy/iosu_fpd.h index 64c3903c6..b1c307656 100644 --- a/src/Cafe/IOSU/legacy/iosu_fpd.h +++ b/src/Cafe/IOSU/legacy/iosu_fpd.h @@ -212,6 +212,7 @@ namespace iosu static const int RELATIONSHIP_FRIEND = 3; static const int GAMEMODE_MAX_MESSAGE_LENGTH = 0x80; // limit includes null-terminator character, so only 0x7F actual characters can be used + static const int MY_COMMENT_LENGTH = 0x12; enum class FPD_REQUEST_ID { diff --git a/src/Cafe/OS/libs/nn_fp/nn_fp.cpp b/src/Cafe/OS/libs/nn_fp/nn_fp.cpp index a3afdb36c..86ca47080 100644 --- a/src/Cafe/OS/libs/nn_fp/nn_fp.cpp +++ b/src/Cafe/OS/libs/nn_fp/nn_fp.cpp @@ -480,11 +480,11 @@ namespace nn return ipcCtx->Submit(std::move(ipcCtx)); } - nnResult GetMyComment(iosu::fpd::FPDPreference* myPreference) + nnResult GetMyComment(uint16be* myComment) { FP_API_BASE(); auto ipcCtx = std::make_unique(iosu::fpd::FPD_REQUEST_ID::GetMyComment); - ipcCtx->AddOutput(myPreference, sizeof(uint16be)*0x12); + ipcCtx->AddOutput(myComment, iosu::fpd::MY_COMMENT_LENGTH * sizeof(uint16be)); return ipcCtx->Submit(std::move(ipcCtx)); } @@ -627,8 +627,8 @@ namespace nn { FP_API_BASE(); auto ipcCtx = std::make_unique(iosu::fpd::FPD_REQUEST_ID::UpdateCommentAsync); - uint32 commentLen = CafeStringHelpers::Length(newComment, 17); - if (commentLen >= 17) + uint32 commentLen = CafeStringHelpers::Length(newComment, iosu::fpd::MY_COMMENT_LENGTH-1); + if (commentLen >= iosu::fpd::MY_COMMENT_LENGTH-1) { cemuLog_log(LogType::Force, "UpdateCommentAsync: message too long"); return FPResult_InvalidIPCParam;