From 07ce5b0aa6dfbda81b1661ba42eb5a9e8ee43c6d Mon Sep 17 00:00:00 2001 From: IntriguingTiles Date: Sun, 28 Aug 2022 03:32:10 -0600 Subject: [PATCH] nn_act: Fix errors in Mii name (#95) nn_act: Don't swap the Mii name again Account: Zero out miiName before copying in data --- src/Cafe/Account/Account.cpp | 1 + src/Cafe/OS/libs/nn_act/nn_act.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Cafe/Account/Account.cpp b/src/Cafe/Account/Account.cpp index 159e6466..2bbd35a2 100644 --- a/src/Cafe/Account/Account.cpp +++ b/src/Cafe/Account/Account.cpp @@ -101,6 +101,7 @@ Account::Account(uint32 persistent_id, std::wstring_view mii_name) // set default name FFLData_t* fflData = (FFLData_t*)m_mii_data.data(); const auto tmp_name = GetMiiName(); + memset(fflData->miiName, 0, sizeof(fflData->miiName)); std::copy(tmp_name.cbegin(), tmp_name.cend(), fflData->miiName); // calculate checksum diff --git a/src/Cafe/OS/libs/nn_act/nn_act.cpp b/src/Cafe/OS/libs/nn_act/nn_act.cpp index 7da1601d..a349da5c 100644 --- a/src/Cafe/OS/libs/nn_act/nn_act.cpp +++ b/src/Cafe/OS/libs/nn_act/nn_act.cpp @@ -369,7 +369,7 @@ void nnActExport_GetMiiName(PPCInterpreter_t* hCPU) sint32 miiNameLength = 0; for (sint32 i = 0; i < MII_FFL_NAME_LENGTH; i++) { - miiName[i] = _swapEndianU16(miiData->miiName[i]); + miiName[i] = miiData->miiName[i]; if (miiData->miiName[i] == (const uint16be)'\0') break; miiNameLength = i+1; @@ -392,7 +392,7 @@ void nnActExport_GetMiiNameEx(PPCInterpreter_t* hCPU) sint32 miiNameLength = 0; for (sint32 i = 0; i < MII_FFL_NAME_LENGTH; i++) { - miiName[i] = _swapEndianU16(miiData->miiName[i]); + miiName[i] = miiData->miiName[i]; if (miiData->miiName[i] == (const uint16be)'\0') break; miiNameLength = i + 1;