mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-07-03 08:26:01 +00:00
fix game path accidentally linked to profile and cache path
This commit is contained in:
parent
b9a2572b72
commit
ee99246428
@ -86,6 +86,8 @@ class MySettingsFrame : public wxFrame {
|
|||||||
MySettingsFrame();
|
MySettingsFrame();
|
||||||
void UpdateInfo();
|
void UpdateInfo();
|
||||||
void UpdateGameDirectory(const std::string& path);
|
void UpdateGameDirectory(const std::string& path);
|
||||||
|
void UpdateProfileDirectory(const std::string& path);
|
||||||
|
void UpdateCacheDirectory(const std::string& path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxDirPickerCtrl* ctrlGameDirectory, *ctrlProfileDirectory, *ctrlCacheDirectory;
|
wxDirPickerCtrl* ctrlGameDirectory, *ctrlProfileDirectory, *ctrlCacheDirectory;
|
||||||
@ -96,6 +98,8 @@ class MySettingsFrame : public wxFrame {
|
|||||||
|
|
||||||
void OnClickConsole(wxCommandEvent& event);
|
void OnClickConsole(wxCommandEvent& event);
|
||||||
void OnChangedGameDir (wxFileDirPickerEvent& event);
|
void OnChangedGameDir (wxFileDirPickerEvent& event);
|
||||||
|
void OnChangedProfileDir (wxFileDirPickerEvent& event);
|
||||||
|
void OnChangedCacheDir (wxFileDirPickerEvent& event);
|
||||||
void OnChangedBuild (wxCommandEvent& event);
|
void OnChangedBuild (wxCommandEvent& event);
|
||||||
void OnAutoDetectGame(wxCommandEvent& event);
|
void OnAutoDetectGame(wxCommandEvent& event);
|
||||||
void OnAutoDetectProfile(wxCommandEvent& event);
|
void OnAutoDetectProfile(wxCommandEvent& event);
|
||||||
@ -122,11 +126,13 @@ wxEND_EVENT_TABLE()
|
|||||||
//SettingsFrame (ID range 200 to 299):
|
//SettingsFrame (ID range 200 to 299):
|
||||||
wxBEGIN_EVENT_TABLE(MySettingsFrame, wxFrame)
|
wxBEGIN_EVENT_TABLE(MySettingsFrame, wxFrame)
|
||||||
EVT_DIRPICKER_CHANGED(200, MySettingsFrame::OnChangedGameDir)
|
EVT_DIRPICKER_CHANGED(200, MySettingsFrame::OnChangedGameDir)
|
||||||
EVT_BUTTON(201, MySettingsFrame::OnAutoDetectGame)
|
EVT_DIRPICKER_CHANGED(201, MySettingsFrame::OnChangedProfileDir)
|
||||||
EVT_BUTTON(202, MySettingsFrame::OnAutoDetectProfile)
|
EVT_DIRPICKER_CHANGED(202, MySettingsFrame::OnChangedCacheDir)
|
||||||
EVT_BUTTON(203, MySettingsFrame::OnResetCache)
|
EVT_BUTTON(203, MySettingsFrame::OnAutoDetectGame)
|
||||||
EVT_CHOICE(204, MySettingsFrame::OnChangedBuild)
|
EVT_BUTTON(204, MySettingsFrame::OnAutoDetectProfile)
|
||||||
EVT_CHECKBOX(205, MySettingsFrame::OnClickConsole)
|
EVT_BUTTON(205, MySettingsFrame::OnResetCache)
|
||||||
|
EVT_CHOICE(206, MySettingsFrame::OnChangedBuild)
|
||||||
|
EVT_CHECKBOX(207, MySettingsFrame::OnClickConsole)
|
||||||
wxEND_EVENT_TABLE()
|
wxEND_EVENT_TABLE()
|
||||||
|
|
||||||
/////////// Get Stats Function ///////////
|
/////////// Get Stats Function ///////////
|
||||||
@ -170,6 +176,18 @@ void MySettingsFrame::UpdateGameDirectory(const std::string& path) {
|
|||||||
MyMainFrame::GameVersionLabel();
|
MyMainFrame::GameVersionLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////// Update Profile Directory Function ///////////
|
||||||
|
void MySettingsFrame::UpdateProfileDirectory(const std::string& path) {
|
||||||
|
ctrlProfileDirectory->SetPath(path);
|
||||||
|
UIData::ProfilePath = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////// Update Cache Directory Function ///////////
|
||||||
|
void MySettingsFrame::UpdateCacheDirectory(const std::string& path) {
|
||||||
|
ctrlCacheDirectory->SetPath(path);
|
||||||
|
UIData::CachePath = path;
|
||||||
|
}
|
||||||
|
|
||||||
/////////// Load Config Function ///////////
|
/////////// Load Config Function ///////////
|
||||||
void LoadConfig() {
|
void LoadConfig() {
|
||||||
if (fs::exists("Launcher.toml")) {
|
if (fs::exists("Launcher.toml")) {
|
||||||
@ -559,17 +577,17 @@ MySettingsFrame::MySettingsFrame() :
|
|||||||
ctrlGameDirectory = new wxDirPickerCtrl (panel, 200, wxEmptyString, wxT("Game Directory"), wxPoint(130, 100), wxSize(300,-1));
|
ctrlGameDirectory = new wxDirPickerCtrl (panel, 200, wxEmptyString, wxT("Game Directory"), wxPoint(130, 100), wxSize(300,-1));
|
||||||
ctrlGameDirectory->SetLabel("GamePath");
|
ctrlGameDirectory->SetLabel("GamePath");
|
||||||
MySettingsFrame::SetFocus();
|
MySettingsFrame::SetFocus();
|
||||||
auto btnDetectGameDirectory = new wxButton(panel, 201, wxT("Detect"), wxPoint(185,140), wxSize(90, 25));
|
auto btnDetectGameDirectory = new wxButton(panel, 203, wxT("Detect"), wxPoint(185,140), wxSize(90, 25));
|
||||||
|
|
||||||
auto* txtProfileDirectory = new wxStaticText(panel, wxID_ANY, wxT("Profile Directory: "), wxPoint(30, 200));
|
auto* txtProfileDirectory = new wxStaticText(panel, wxID_ANY, wxT("Profile Directory: "), wxPoint(30, 200));
|
||||||
ctrlProfileDirectory = new wxDirPickerCtrl (panel, 200, wxEmptyString, wxT("Profile Directory"), wxPoint(130, 200), wxSize(300,-1));
|
ctrlProfileDirectory = new wxDirPickerCtrl (panel, 201, wxEmptyString, wxT("Profile Directory"), wxPoint(130, 200), wxSize(300,-1));
|
||||||
ctrlProfileDirectory->SetLabel("ProfilePath");
|
ctrlProfileDirectory->SetLabel("ProfilePath");
|
||||||
auto btnDetectProfileDirectory = new wxButton(panel, 202, wxT("Detect"), wxPoint(185,240), wxSize(90, 25));
|
auto btnDetectProfileDirectory = new wxButton(panel, 204, wxT("Detect"), wxPoint(185,240), wxSize(90, 25));
|
||||||
|
|
||||||
auto* txtCacheDirectory = new wxStaticText(panel, wxID_ANY, wxT("Cache Directory: "), wxPoint(30, 300));
|
auto* txtCacheDirectory = new wxStaticText(panel, wxID_ANY, wxT("Cache Directory: "), wxPoint(30, 300));
|
||||||
ctrlCacheDirectory = new wxDirPickerCtrl (panel, 200, wxEmptyString, wxT("Cache Directory"), wxPoint(130, 300), wxSize(300,-1));
|
ctrlCacheDirectory = new wxDirPickerCtrl (panel, 202, wxEmptyString, wxT("Cache Directory"), wxPoint(130, 300), wxSize(300,-1));
|
||||||
ctrlCacheDirectory->SetLabel("CachePath");
|
ctrlCacheDirectory->SetLabel("CachePath");
|
||||||
auto btnCacheDirectory = new wxButton(panel, 203, wxT("Reset"), wxPoint(185,340), wxSize(90, 25));
|
auto btnCacheDirectory = new wxButton(panel, 205, wxT("Reset"), wxPoint(185,340), wxSize(90, 25));
|
||||||
|
|
||||||
auto* txtBuild = new wxStaticText(panel, wxID_ANY, wxT("Build: "), wxPoint(30, 400));
|
auto* txtBuild = new wxStaticText(panel, wxID_ANY, wxT("Build: "), wxPoint(30, 400));
|
||||||
wxArrayString BuildChoices;
|
wxArrayString BuildChoices;
|
||||||
@ -577,10 +595,10 @@ MySettingsFrame::MySettingsFrame() :
|
|||||||
BuildChoices.Add("Release");
|
BuildChoices.Add("Release");
|
||||||
BuildChoices.Add("EA");
|
BuildChoices.Add("EA");
|
||||||
BuildChoices.Add("Dev");
|
BuildChoices.Add("Dev");
|
||||||
choiceController = new wxChoice (panel, 204, wxPoint(85, 400), wxSize(120, 20), BuildChoices);
|
choiceController = new wxChoice (panel, 206, wxPoint(85, 400), wxSize(120, 20), BuildChoices);
|
||||||
choiceController->Select(0);
|
choiceController->Select(0);
|
||||||
|
|
||||||
checkConsole = new wxCheckBox (panel, 205, " Show Console", wxPoint(30, 450));
|
checkConsole = new wxCheckBox (panel, 207, " Show Console", wxPoint(30, 450));
|
||||||
|
|
||||||
//UI Colors:
|
//UI Colors:
|
||||||
if (DarkMode) {
|
if (DarkMode) {
|
||||||
@ -740,6 +758,22 @@ void MySettingsFrame::OnChangedGameDir(wxFileDirPickerEvent& event) {
|
|||||||
UpdateGameDirectory(NewPath);
|
UpdateGameDirectory(NewPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////// OnChanged Profile Path Event ///////////
|
||||||
|
void MySettingsFrame::OnChangedProfileDir(wxFileDirPickerEvent& event) {
|
||||||
|
std::string NewPath = event.GetPath().utf8_string();
|
||||||
|
std::string key = reinterpret_cast<wxDirPickerCtrl*> (event.GetEventObject())->GetLabel();
|
||||||
|
UpdateConfig(key, NewPath);
|
||||||
|
UpdateProfileDirectory(NewPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////// OnChanged Cache Path Event ///////////
|
||||||
|
void MySettingsFrame::OnChangedCacheDir(wxFileDirPickerEvent& event) {
|
||||||
|
std::string NewPath = event.GetPath().utf8_string();
|
||||||
|
std::string key = reinterpret_cast<wxDirPickerCtrl*> (event.GetEventObject())->GetLabel();
|
||||||
|
UpdateConfig(key, NewPath);
|
||||||
|
UpdateCacheDirectory(NewPath);
|
||||||
|
}
|
||||||
|
|
||||||
/////////// OnChanged Build Event ///////////
|
/////////// OnChanged Build Event ///////////
|
||||||
void MySettingsFrame::OnChangedBuild(wxCommandEvent& event) {
|
void MySettingsFrame::OnChangedBuild(wxCommandEvent& event) {
|
||||||
std::string key = reinterpret_cast<wxChoice*> (event.GetEventObject())->GetString(event.GetSelection());
|
std::string key = reinterpret_cast<wxChoice*> (event.GetEventObject())->GetString(event.GetSelection());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user