Added account.dat UtcOffset and TimeZoneId reading, and GetTitleMetaXml

This commit is contained in:
Jonathan Barrow 2023-07-31 00:22:30 -04:00 committed by Arian Kordi
parent 0ddcba4ff1
commit f75d734fb8
4 changed files with 22 additions and 0 deletions

View File

@ -524,6 +524,10 @@ void Account::ParseFile(class FileStream* file)
m_country = ConvertString<uint32>(value, 16);
else if (key == "SimpleAddressId")
m_simple_address_id = ConvertString<uint32>(value, 16);
else if (key == "TimeZoneId")
m_timezone_id = value;
else if (key == "UtcOffset")
m_utc_offset = ConvertString<uint64>(value, 16);
else if (key == "PrincipalId")
m_principal_id = ConvertString<uint32>(value, 16);
else if (key == "IsPasswordCacheEnabled")

View File

@ -77,6 +77,8 @@ public:
[[nodiscard]] std::string_view GetEmail() const { return m_email; }
[[nodiscard]] uint32 GetCountry() const { return m_country; }
[[nodiscard]] uint32 GetSimpleAddressId() const { return m_simple_address_id; }
[[nodiscard]] std::string_view GetTimeZoneId() const { return m_timezone_id; }
[[nodiscard]] sint64 GetUtcOffset() const { return m_utc_offset; }
[[nodiscard]] uint32 GetPrincipalId() const { return m_principal_id; }
[[nodiscard]] bool IsPasswordCacheEnabled() const { return m_password_cache_enabled != 0; }
[[nodiscard]] const std::array<uint8, 32>& GetAccountPasswordCache() const { return m_account_password_cache; }
@ -90,6 +92,8 @@ public:
void SetGender(uint8 gender) { m_gender = gender; }
void SetEmail(std::string_view email) { m_email = email; }
void SetCountry(uint32 country) { m_country = country; }
void SetTimeZoneId(std::string_view timezone_id) { m_timezone_id = timezone_id; }
void SetUtcOffset(sint64 utc_offset) { m_utc_offset = utc_offset; }
// this will always return at least one account (default one)
static const std::vector<Account>& RefreshAccounts();
@ -123,6 +127,8 @@ private:
std::string m_email;
uint32 m_country = 0;
uint32 m_simple_address_id = 0;
std::string m_timezone_id;
sint64 m_utc_offset;
uint32 m_principal_id = 0;
uint8 m_password_cache_enabled = 0;
std::array<uint8, 32> m_account_password_cache{};

View File

@ -49,6 +49,8 @@ struct actAccountData_t
// country & language
uint32 countryIndex;
char country[8];
char timeZoneId[16];
sint64 utcOffset;
// Mii
FFLData_t miiData;
uint16le miiNickname[ACT_NICKNAME_LENGTH];
@ -84,6 +86,8 @@ void FillAccountData(const Account& account, const bool online_enabled, int inde
// country & language
data.countryIndex = account.GetCountry();
strcpy(data.country, NCrypto::GetCountryAsString(data.countryIndex));
std::copy(account.GetTimeZoneId().cbegin(), account.GetTimeZoneId().cend(), data.timeZoneId);
data.utcOffset = account.GetUtcOffset() / 1'000'000;
// Mii
std::copy(account.GetMiiData().begin(), account.GetMiiData().end(), (uint8*)&data.miiData);
std::copy(account.GetMiiName().begin(), account.GetMiiName().end(), data.miiNickname);
@ -808,6 +812,13 @@ int iosuAct_thread()
strcpy(actCemuRequest->resultString.strBuffer, _actAccountData[accountIndex].country);
actCemuRequest->setACTReturnCode(0);
}
else if (actCemuRequest->requestCode == IOSU_ARC_TIMEZONEID)
{
accountIndex = iosuAct_getAccountIndexBySlot(actCemuRequest->accountSlot);
_cancelIfAccountDoesNotExist();
strcpy(actCemuRequest->resultString.strBuffer, _actAccountData[accountIndex].timeZoneId);
actCemuRequest->setACTReturnCode(0);
}
else if (actCemuRequest->requestCode == IOSU_ARC_ISNETWORKACCOUNT)
{
accountIndex = iosuAct_getAccountIndexBySlot(actCemuRequest->accountSlot);

View File

@ -117,6 +117,7 @@ struct iosuActCemuRequest_t
#define IOSU_ARC_MIIDATA 0x0A
#define IOSU_ARC_ACQUIREINDEPENDENTTOKEN 0x0B
#define IOSU_ARC_ACQUIREPIDBYNNID 0x0C
#define IOSU_ARC_TIMEZONEID 0x0D
uint32 iosuAct_getAccountIdOfCurrentAccount();