save config properly

This commit is contained in:
Joshua de Reeper 2025-01-22 10:17:21 +01:00
parent c9c7afaa0f
commit 9bb6b32417
2 changed files with 21 additions and 1 deletions

View file

@ -275,9 +275,11 @@ void CemuConfig::Load(XMLConfigParser& parser)
tv_channels = audio.get("TVChannels", kStereo);
pad_channels = audio.get("PadChannels", kStereo);
input_channels = audio.get("InputChannels", kMono);
portal_channels = audio.get("PortalChannels", kMono);
tv_volume = audio.get("TVVolume", 20);
pad_volume = audio.get("PadVolume", 0);
input_volume = audio.get("InputVolume", 20);
portal_volume = audio.get("PortalVolume", 20);
const auto tv = audio.get("TVDevice", "");
try
@ -309,6 +311,16 @@ void CemuConfig::Load(XMLConfigParser& parser)
cemuLog_log(LogType::Force, "config load error: can't load input device: {}", input_device_name);
}
const auto portal_device_name = audio.get("PortalDevice", "");
try
{
portal_device = boost::nowide::widen(portal_device_name);
}
catch (const std::exception&)
{
cemuLog_log(LogType::Force, "config load error: can't load input device: {}", portal_device_name);
}
// account
auto acc = parser.get("Account");
account.m_persistent_id = acc.get("PersistentId", account.m_persistent_id);
@ -508,12 +520,15 @@ void CemuConfig::Save(XMLConfigParser& parser)
audio.set("TVChannels", tv_channels);
audio.set("PadChannels", pad_channels);
audio.set("InputChannels", input_channels);
audio.set("InputChannels", portal_channels);
audio.set("TVVolume", tv_volume);
audio.set("PadVolume", pad_volume);
audio.set("InputVolume", input_volume);
audio.set("PortalVolume", portal_volume);
audio.set("TVDevice", boost::nowide::narrow(tv_device).c_str());
audio.set("PadDevice", boost::nowide::narrow(pad_device).c_str());
audio.set("InputDevice", boost::nowide::narrow(input_device).c_str());
audio.set("PortalDevice", boost::nowide::narrow(portal_device).c_str());
// account
auto acc = config.set("Account");

View file

@ -1183,11 +1183,16 @@ void GeneralSettings2::OnVolumeChanged(wxCommandEvent& event)
g_padVolume = event.GetInt();
}
}
else
else if (event.GetEventObject() == m_tv_volume)
{
if (g_tvAudio)
g_tvAudio->SetVolume(event.GetInt());
}
else
{
if(g_portalAudio)
g_portalAudio->SetVolume(event.GetInt());
}
}