cfg: Load and save MCU config as binary file. (#7200)

This commit is contained in:
Steveice10 2023-11-21 17:56:08 -08:00 committed by GitHub
parent 5733c8681e
commit 33a1f27a99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -577,7 +577,7 @@ ResultCode Module::LoadConfigNANDSaveFile() {
void Module::LoadMCUConfig() { void Module::LoadMCUConfig() {
FileUtil::IOFile mcu_data_file( FileUtil::IOFile mcu_data_file(
fmt::format("{}/mcu.dat", FileUtil::GetUserPath(FileUtil::UserPath::SysDataDir)), "r"); fmt::format("{}/mcu.dat", FileUtil::GetUserPath(FileUtil::UserPath::SysDataDir)), "rb");
if (mcu_data_file.IsOpen() && mcu_data_file.GetSize() >= sizeof(MCUData) && if (mcu_data_file.IsOpen() && mcu_data_file.GetSize() >= sizeof(MCUData) &&
mcu_data_file.ReadBytes(&mcu_data, sizeof(MCUData)) == sizeof(MCUData)) { mcu_data_file.ReadBytes(&mcu_data, sizeof(MCUData)) == sizeof(MCUData)) {
@ -592,7 +592,7 @@ void Module::LoadMCUConfig() {
void Module::SaveMCUConfig() { void Module::SaveMCUConfig() {
FileUtil::IOFile mcu_data_file( FileUtil::IOFile mcu_data_file(
fmt::format("{}/mcu.dat", FileUtil::GetUserPath(FileUtil::UserPath::SysDataDir)), "w"); fmt::format("{}/mcu.dat", FileUtil::GetUserPath(FileUtil::UserPath::SysDataDir)), "wb");
if (mcu_data_file.IsOpen()) { if (mcu_data_file.IsOpen()) {
mcu_data_file.WriteBytes(&mcu_data, sizeof(MCUData)); mcu_data_file.WriteBytes(&mcu_data, sizeof(MCUData));