SettingsHandler: Add Open and Save member functions
This commit is contained in:
1 parent
f37c5f1f1c
commit
98291cd843
4 files changed
+53
-40
No files matched your search
@@ -196,18 +196,14 @@ bool CBoot::SetupWiiMemory(u64 ios_title_id)
|
||||
|
||||
SettingsHandler gen;
|
||||
std::string serno;
|
||||
std::string settings_Filename(
|
||||
const std::string settings_file_path(
|
||||
Common::GetTitleDataPath(TITLEID_SYSMENU, Common::FROM_SESSION_ROOT) + WII_SETTING);
|
||||
if (File::Exists(settings_Filename))
|
||||
if (File::Exists(settings_file_path) && gen.Open(settings_file_path))
|
||||
{
|
||||
File::IOFile settingsFileHandle(settings_Filename, "rb");
|
||||
if (settingsFileHandle.ReadBytes((void*)gen.GetData(), SettingsHandler::SETTINGS_SIZE))
|
||||
{
|
||||
gen.Decrypt();
|
||||
serno = gen.GetValue("SERNO");
|
||||
gen.Reset();
|
||||
}
|
||||
File::Delete(settings_Filename);
|
||||
serno = gen.GetValue("SERNO");
|
||||
gen.Reset();
|
||||
|
||||
File::Delete(settings_file_path);
|
||||
}
|
||||
|
||||
if (serno.empty() || serno == "000000000")
|
||||
@@ -233,19 +229,15 @@ bool CBoot::SetupWiiMemory(u64 ios_title_id)
|
||||
gen.AddSetting("VIDEO", region_setting.video);
|
||||
gen.AddSetting("GAME", region_setting.game);
|
||||
|
||||
File::CreateFullPath(settings_Filename);
|
||||
if (!gen.Save(settings_file_path))
|
||||
{
|
||||
File::IOFile settingsFileHandle(settings_Filename, "wb");
|
||||
|
||||
if (!settingsFileHandle.WriteBytes(gen.GetData(), SettingsHandler::SETTINGS_SIZE))
|
||||
{
|
||||
PanicAlertT("SetupWiiMemory: Can't create setting.txt file");
|
||||
return false;
|
||||
}
|
||||
// Write the 256 byte setting.txt to memory.
|
||||
Memory::CopyToEmu(0x3800, gen.GetData(), SettingsHandler::SETTINGS_SIZE);
|
||||
PanicAlertT("SetupWiiMemory: Can't create setting.txt file");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Write the 256 byte setting.txt to memory.
|
||||
Memory::CopyToEmu(0x3800, gen.GetData(), SettingsHandler::SETTINGS_SIZE);
|
||||
|
||||
INFO_LOG(BOOT, "Setup Wii Memory...");
|
||||
|
||||
/*
|
||||
|
||||
Reference in new issue
Block a user