IOS/NWC24Config: Combine WriteConfig() and WriteCBK().

This commit is contained in:
Admiral H. Curtiss 2022-12-27 21:19:33 +01:00
parent c01ec96c92
commit c8202043b6
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
2 changed files with 10 additions and 8 deletions

View File

@ -40,20 +40,21 @@ void NWC24Config::ReadConfig()
void NWC24Config::WriteCBK() const
{
constexpr FS::Modes public_modes{FS::Mode::ReadWrite, FS::Mode::ReadWrite, FS::Mode::ReadWrite};
m_fs->CreateFullPath(PID_KD, PID_KD, CBK_PATH, 0, public_modes);
const auto file = m_fs->CreateAndOpenFile(PID_KD, PID_KD, CBK_PATH, public_modes);
if (!file || !file->Write(&m_data, 1))
ERROR_LOG_FMT(IOS_WC24, "Failed to open or write WC24 config file");
WriteConfigToPath(CBK_PATH);
}
void NWC24Config::WriteConfig() const
{
WriteConfigToPath(CONFIG_PATH);
}
void NWC24Config::WriteConfigToPath(const std::string& path) const
{
constexpr FS::Modes public_modes{FS::Mode::ReadWrite, FS::Mode::ReadWrite, FS::Mode::ReadWrite};
m_fs->CreateFullPath(PID_KD, PID_KD, CONFIG_PATH, 0, public_modes);
const auto file = m_fs->CreateAndOpenFile(PID_KD, PID_KD, CONFIG_PATH, public_modes);
m_fs->CreateFullPath(PID_KD, PID_KD, path, 0, public_modes);
const auto file = m_fs->CreateAndOpenFile(PID_KD, PID_KD, path, public_modes);
if (!file || !file->Write(&m_data, 1))
ERROR_LOG_FMT(IOS_WC24, "Failed to open or write WC24 config file");
ERROR_LOG_FMT(IOS_WC24, "Failed to open or write WC24 config file at {}", path);
}
void NWC24Config::ResetConfig()

View File

@ -48,6 +48,7 @@ public:
void ReadConfig();
void WriteCBK() const;
void WriteConfig() const;
void WriteConfigToPath(const std::string& path) const;
void ResetConfig();
u32 CalculateNwc24ConfigChecksum() const;