デバイスIDを4文字ごとに空白で区切るように

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@659 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
N2614 2012-03-08 00:46:39 +00:00
parent 9c73351cef
commit 6636bc75ba
3 changed files with 26 additions and 3 deletions

View File

@ -16,6 +16,7 @@
#include "DrawSystemState.h"
#include "ResFont.h"
#include "version.h"
#include "Util.h"
#include <nn/nwm.h>
@ -32,7 +33,7 @@ u8 s_CupMicro;
u8 s_NupMajor;
nn::cfg::CTR::CfgRegionCode s_Region;
u8 s_SerialNo[nn::cfg::CTR::CFG_SECURE_INFO_SERIAL_NO_LEN + 1];
bit64 s_DeviceId;
char s_DeviceIdStr[30];
char8 s_MacAddress[nn::nwm::Mac::MAC_STRING_SIZE];
u64 s_FriendCode;
u8 s_BatteryRemain;
@ -70,7 +71,7 @@ void SetTextWriterCore()
GetTextWriter()->Printf("System Ver. %d.%d.%d-%d\n", s_CupMajor, s_CupMinor, s_CupMicro, s_NupMajor);
GetTextWriter()->Printf("System Region %s\n", nn::cfg::CTR::GetRegionCodeA3(s_Region));
GetTextWriter()->Printf("Serial No. %s\n", s_SerialNo);
GetTextWriter()->Printf("Device ID %llu\n", s_DeviceId);
GetTextWriter()->Printf("Device ID %s\n", s_DeviceIdStr);
GetTextWriter()->Printf("MAC Address %s\n", s_MacAddress);
if (s_ReadFriendCode)
{
@ -126,7 +127,10 @@ void DrawSystemState
s_CupMicro = cupMicroVersion;
s_NupMajor = nupVersion;
s_BatteryRemain = batteryRemain;
s_DeviceId = deviceId;
nn::nstd::TSNPrintf(s_DeviceIdStr, sizeof(s_DeviceIdStr), "%llu", deviceId);
std::string deviceIdString(s_DeviceIdStr);
Util::SplitDeviceidWithSpace(deviceIdString);
std::memcpy(s_DeviceIdStr, deviceIdString.c_str(), deviceIdString.size());
s_FriendCode = friendCode;
s_Progress = progress;
std::memcpy(s_MacAddress, macAddress, sizeof(s_MacAddress));

View File

@ -370,6 +370,22 @@ bool Util::HasReadFriendCode()
return m_HasReadFriendCode;
}
void Util::SplitDeviceidWithSpace(std::string& deviceIdStr)
{
std::string tmp = deviceIdStr;
deviceIdStr.clear();
u32 i = 0;
do
{
deviceIdStr.append(tmp.substr(i, 1));
i++;
if( i % 4 == 0)
{
deviceIdStr.push_back(' ');
}
}while( i < tmp.size());
}
nn::Result PrintNetworkSetting()
{
nn::Result result;

View File

@ -111,6 +111,9 @@ public:
// フレンドコードを取得済みかどうか
bool HasReadFriendCode();
// デバイスIDを4文字ごとに空白で区切る
static void SplitDeviceidWithSpace(std::string& deviceIdStr);
private:
void Initialize();
void Finalize();