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
This commit is contained in:
IntriguingTiles 2022-08-28 03:32:10 -06:00 committed by GitHub
parent ef61361b87
commit 07ce5b0aa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -101,6 +101,7 @@ Account::Account(uint32 persistent_id, std::wstring_view mii_name)
// set default name // set default name
FFLData_t* fflData = (FFLData_t*)m_mii_data.data(); FFLData_t* fflData = (FFLData_t*)m_mii_data.data();
const auto tmp_name = GetMiiName(); const auto tmp_name = GetMiiName();
memset(fflData->miiName, 0, sizeof(fflData->miiName));
std::copy(tmp_name.cbegin(), tmp_name.cend(), fflData->miiName); std::copy(tmp_name.cbegin(), tmp_name.cend(), fflData->miiName);
// calculate checksum // calculate checksum

View File

@ -369,7 +369,7 @@ void nnActExport_GetMiiName(PPCInterpreter_t* hCPU)
sint32 miiNameLength = 0; sint32 miiNameLength = 0;
for (sint32 i = 0; i < MII_FFL_NAME_LENGTH; i++) 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') if (miiData->miiName[i] == (const uint16be)'\0')
break; break;
miiNameLength = i+1; miiNameLength = i+1;
@ -392,7 +392,7 @@ void nnActExport_GetMiiNameEx(PPCInterpreter_t* hCPU)
sint32 miiNameLength = 0; sint32 miiNameLength = 0;
for (sint32 i = 0; i < MII_FFL_NAME_LENGTH; i++) 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') if (miiData->miiName[i] == (const uint16be)'\0')
break; break;
miiNameLength = i + 1; miiNameLength = i + 1;