mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Merge pull request #11353 from noahpistilli/fix-mail-account-generation
Set checksum for NWC24Config during creation
This commit is contained in:
@ -15,6 +15,7 @@
|
|||||||
namespace IOS::HLE::NWC24
|
namespace IOS::HLE::NWC24
|
||||||
{
|
{
|
||||||
constexpr const char CONFIG_PATH[] = "/" WII_WC24CONF_DIR "/nwc24msg.cfg";
|
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)}
|
NWC24Config::NWC24Config(std::shared_ptr<FS::FileSystem> fs) : m_fs{std::move(fs)}
|
||||||
{
|
{
|
||||||
@ -37,13 +38,23 @@ void NWC24Config::ReadConfig()
|
|||||||
ResetConfig();
|
ResetConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NWC24Config::WriteCBK() const
|
||||||
|
{
|
||||||
|
WriteConfigToPath(CBK_PATH);
|
||||||
|
}
|
||||||
|
|
||||||
void NWC24Config::WriteConfig() const
|
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};
|
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);
|
m_fs->CreateFullPath(PID_KD, PID_KD, path, 0, public_modes);
|
||||||
const auto file = m_fs->CreateAndOpenFile(PID_KD, PID_KD, CONFIG_PATH, public_modes);
|
const auto file = m_fs->CreateAndOpenFile(PID_KD, PID_KD, path, public_modes);
|
||||||
if (!file || !file->Write(&m_data, 1))
|
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()
|
void NWC24Config::ResetConfig()
|
||||||
|
@ -46,7 +46,9 @@ public:
|
|||||||
explicit NWC24Config(std::shared_ptr<FS::FileSystem> fs);
|
explicit NWC24Config(std::shared_ptr<FS::FileSystem> fs);
|
||||||
|
|
||||||
void ReadConfig();
|
void ReadConfig();
|
||||||
|
void WriteCBK() const;
|
||||||
void WriteConfig() const;
|
void WriteConfig() const;
|
||||||
|
void WriteConfigToPath(const std::string& path) const;
|
||||||
void ResetConfig();
|
void ResetConfig();
|
||||||
|
|
||||||
u32 CalculateNwc24ConfigChecksum() const;
|
u32 CalculateNwc24ConfigChecksum() const;
|
||||||
|
@ -397,7 +397,9 @@ std::optional<IPCReply> NetKDRequestDevice::IOCtl(const IOCtlRequest& request)
|
|||||||
config.SetId(user_id);
|
config.SetId(user_id);
|
||||||
config.IncrementIdGen();
|
config.IncrementIdGen();
|
||||||
config.SetCreationStage(NWC24::NWC24CreationStage::Generated);
|
config.SetCreationStage(NWC24::NWC24CreationStage::Generated);
|
||||||
|
config.SetChecksum(config.CalculateNwc24ConfigChecksum());
|
||||||
config.WriteConfig();
|
config.WriteConfig();
|
||||||
|
config.WriteCBK();
|
||||||
|
|
||||||
WriteReturnValue(ret, request.buffer_out);
|
WriteReturnValue(ret, request.buffer_out);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user