Set checksum for NWC24Config during creation
This commit is contained in:
parent
fb8aa9744e
commit
c01ec96c92
|
@ -15,6 +15,7 @@
|
|||
namespace IOS::HLE::NWC24
|
||||
{
|
||||
constexpr const char CONFIG_PATH[] = "/" WII_WC24CONF_DIR "/nwc24msg.cfg";
|
||||
constexpr const char CBK_PATH[] = "/" WII_WC24CONF_DIR "/nwc24msg.cbk";
|
||||
|
||||
NWC24Config::NWC24Config(std::shared_ptr<FS::FileSystem> fs) : m_fs{std::move(fs)}
|
||||
{
|
||||
|
@ -37,6 +38,15 @@ void NWC24Config::ReadConfig()
|
|||
ResetConfig();
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
void NWC24Config::WriteConfig() const
|
||||
{
|
||||
constexpr FS::Modes public_modes{FS::Mode::ReadWrite, FS::Mode::ReadWrite, FS::Mode::ReadWrite};
|
||||
|
|
|
@ -46,6 +46,7 @@ public:
|
|||
explicit NWC24Config(std::shared_ptr<FS::FileSystem> fs);
|
||||
|
||||
void ReadConfig();
|
||||
void WriteCBK() const;
|
||||
void WriteConfig() const;
|
||||
void ResetConfig();
|
||||
|
||||
|
|
|
@ -397,7 +397,9 @@ std::optional<IPCReply> NetKDRequestDevice::IOCtl(const IOCtlRequest& request)
|
|||
config.SetId(user_id);
|
||||
config.IncrementIdGen();
|
||||
config.SetCreationStage(NWC24::NWC24CreationStage::Generated);
|
||||
config.SetChecksum(config.CalculateNwc24ConfigChecksum());
|
||||
config.WriteConfig();
|
||||
config.WriteCBK();
|
||||
|
||||
WriteReturnValue(ret, request.buffer_out);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue