diff --git a/Source/Core/DolphinWX/GameListCtrl.cpp b/Source/Core/DolphinWX/GameListCtrl.cpp index 58005099be..a0fe527d4b 100644 --- a/Source/Core/DolphinWX/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/GameListCtrl.cpp @@ -1343,7 +1343,7 @@ void GameListCtrl::OnNetPlayHost(wxCommandEvent& WXUNUSED(event)) config.FromIniConfig(netplay_section); config.game_name = iso->GetUniqueIdentifier(); config.game_list_ctrl = this; - config.SetDialogInfo(netplay_section, m_parent); + config.SetDialogInfo(m_parent); netplay_section.Set("SelectedHostGame", config.game_name); ini_file.Save(dolphin_ini); diff --git a/Source/Core/DolphinWX/NetPlay/NetPlayLauncher.cpp b/Source/Core/DolphinWX/NetPlay/NetPlayLauncher.cpp index eb6bade7a2..ed99715d86 100644 --- a/Source/Core/DolphinWX/NetPlay/NetPlayLauncher.cpp +++ b/Source/Core/DolphinWX/NetPlay/NetPlayLauncher.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include #include #include "Common/CommonTypes.h" @@ -121,14 +122,14 @@ u16 NetPlayLaunchConfig::GetTraversalPortFromIniConfig(const IniFile::Section& n return static_cast(port); } -void NetPlayLaunchConfig::SetDialogInfo(const IniFile::Section& section, wxWindow* parent) +void NetPlayLaunchConfig::SetDialogInfo(wxWindow* parent) { parent_window = parent; - section.Get("NetWindowPosX", &window_pos.x, window_defaults.GetX()); - section.Get("NetWindowPosY", &window_pos.y, window_defaults.GetY()); - section.Get("NetWindowWidth", &window_pos.width, window_defaults.GetWidth()); - section.Get("NetWindowHeight", &window_pos.height, window_defaults.GetHeight()); + wxConfig::Get()->Read("NetWindowPosX", &window_pos.x, window_defaults.GetX()); + wxConfig::Get()->Read("NetWindowPosY", &window_pos.y, window_defaults.GetY()); + wxConfig::Get()->Read("NetWindowWidth", &window_pos.width, window_defaults.GetWidth()); + wxConfig::Get()->Read("NetWindowHeight", &window_pos.height, window_defaults.GetHeight()); if (window_pos.GetX() == window_defaults.GetX() || window_pos.GetY() == window_defaults.GetY()) { diff --git a/Source/Core/DolphinWX/NetPlay/NetPlayLauncher.h b/Source/Core/DolphinWX/NetPlay/NetPlayLauncher.h index fa245dadc7..2d7d4b8f26 100644 --- a/Source/Core/DolphinWX/NetPlay/NetPlayLauncher.h +++ b/Source/Core/DolphinWX/NetPlay/NetPlayLauncher.h @@ -17,7 +17,7 @@ class NetPlayLaunchConfig public: static std::string GetTraversalHostFromIniConfig(const IniFile::Section& netplay_section); static u16 GetTraversalPortFromIniConfig(const IniFile::Section& netplay_section); - void SetDialogInfo(const IniFile::Section& section, wxWindow* parent); + void SetDialogInfo(wxWindow* parent); static const std::string DEFAULT_TRAVERSAL_HOST; static constexpr u16 DEFAULT_TRAVERSAL_PORT = 6262; diff --git a/Source/Core/DolphinWX/NetPlay/NetPlaySetupFrame.cpp b/Source/Core/DolphinWX/NetPlay/NetPlaySetupFrame.cpp index 1fd401ea37..f285abe487 100644 --- a/Source/Core/DolphinWX/NetPlay/NetPlaySetupFrame.cpp +++ b/Source/Core/DolphinWX/NetPlay/NetPlaySetupFrame.cpp @@ -338,7 +338,7 @@ void NetPlaySetupFrame::DoHost() host_config.use_traversal = m_direct_traversal->GetCurrentSelection() == TRAVERSAL_CHOICE; host_config.player_name = WxStrToStr(m_nickname_text->GetValue()); host_config.game_list_ctrl = m_game_list; - host_config.SetDialogInfo(netplay_section, m_parent); + host_config.SetDialogInfo(m_parent); #ifdef USE_UPNP host_config.forward_port = m_upnp_chk->GetValue(); #endif @@ -382,7 +382,7 @@ void NetPlaySetupFrame::DoJoin() join_config.use_traversal = m_direct_traversal->GetCurrentSelection() == TRAVERSAL_CHOICE; join_config.player_name = WxStrToStr(m_nickname_text->GetValue()); join_config.game_list_ctrl = m_game_list; - join_config.SetDialogInfo(netplay_section, m_parent); + join_config.SetDialogInfo(m_parent); unsigned long port = 0; m_connect_port_text->GetValue().ToULong(&port); diff --git a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp index 98aefef953..870851dee1 100644 --- a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp +++ b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -33,7 +34,6 @@ #include "Common/CommonTypes.h" #include "Common/FifoQueue.h" #include "Common/FileUtil.h" -#include "Common/IniFile.h" #include "Common/MsgHandler.h" #include "Common/StringUtil.h" @@ -77,15 +77,11 @@ NetPlayDialog::NetPlayDialog(wxWindow* const parent, const GameListCtrl* const g // Remember the window size and position for NetWindow { - IniFile inifile; - inifile.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); - IniFile::Section& netplay_section = *inifile.GetOrCreateSection("NetPlay"); - int winPosX, winPosY, winWidth, winHeight; - netplay_section.Get("NetWindowPosX", &winPosX, std::numeric_limits::min()); - netplay_section.Get("NetWindowPosY", &winPosY, std::numeric_limits::min()); - netplay_section.Get("NetWindowWidth", &winWidth, -1); - netplay_section.Get("NetWindowHeight", &winHeight, -1); + wxConfig::Get()->Read("NetWindowPosX", &winPosX, std::numeric_limits::min()); + wxConfig::Get()->Read("NetWindowPosY", &winPosY, std::numeric_limits::min()); + wxConfig::Get()->Read("NetWindowWidth", &winWidth, -1); + wxConfig::Get()->Read("NetWindowHeight", &winHeight, -1); WxUtils::SetWindowSizeAndFitToScreen(this, wxPoint(winPosX, winPosY), wxSize(winWidth, winHeight), GetSize()); @@ -282,17 +278,10 @@ wxSizer* NetPlayDialog::CreateBottomGUI(wxWindow* parent) NetPlayDialog::~NetPlayDialog() { - IniFile inifile; - const std::string dolphin_ini = File::GetUserPath(F_DOLPHINCONFIG_IDX); - inifile.Load(dolphin_ini); - IniFile::Section& netplay_config = *inifile.GetOrCreateSection("NetPlay"); - - netplay_config.Set("NetWindowPosX", GetPosition().x); - netplay_config.Set("NetWindowPosY", GetPosition().y); - netplay_config.Set("NetWindowWidth", GetSize().GetWidth()); - netplay_config.Set("NetWindowHeight", GetSize().GetHeight()); - - inifile.Save(dolphin_ini); + wxConfig::Get()->Write("NetWindowPosX", GetPosition().x); + wxConfig::Get()->Write("NetWindowPosY", GetPosition().y); + wxConfig::Get()->Write("NetWindowWidth", GetSize().GetWidth()); + wxConfig::Get()->Write("NetWindowHeight", GetSize().GetHeight()); if (netplay_client) {