diff --git a/rpcs3/Emu/FS/VFS.cpp b/rpcs3/Emu/FS/VFS.cpp index c7179fdb2d..ceab7d7b19 100644 --- a/rpcs3/Emu/FS/VFS.cpp +++ b/rpcs3/Emu/FS/VFS.cpp @@ -6,6 +6,7 @@ #include "Ini.h" #include "Emu/System.h" #include "Utilities/Log.h" +#include // To check whether directory exists #undef CreateFile @@ -477,17 +478,34 @@ void VFS::SaveLoadDevices(std::vector& res, bool is_load) entries_count.SaveValue(count); } - //Custom EmulationDir. should check if that is a valid directory. + // Custom EmulationDir. + // TODO:: should have a better log that would show results before loading a game? if (Ini.SysEmulationDirPathEnable.GetValue()) { - if (Ini.SysEmulationDirPath.GetValue().empty()) + std::string EmulationDir = Ini.SysEmulationDirPath.GetValue(); + if (EmulationDir.empty()) Ini.SysEmulationDirPath.SetValue(Emu.GetEmulatorPath()); - LOG_NOTICE(GENERAL, "EmualtionDir: Custom EmulationDir is On, Binded $(EmulatorDir) to %s.", Ini.SysEmulationDirPath.GetValue()); + struct stat fstatinfo; + if ((stat(EmulationDir.c_str(), &fstatinfo))) + { + LOG_NOTICE(GENERAL, "Custom EmualtionDir: Tried %s but it doesn't exists. Maybe you add some not needed chars like '\"'?"); + Ini.SysEmulationDirPathEnable.SetValue(false); + } + else if (fstatinfo.st_mode & S_IFDIR) + LOG_NOTICE(GENERAL, "Custom EmualtionDir: On, Binded $(EmulatorDir) to %s.", EmulationDir); + else + { + // If that is not directory turn back to use original one. + LOG_NOTICE(GENERAL, "Custom EmulationDir: Cause path %s is not a valid directory.", EmulationDir); + Ini.SysEmulationDirPathEnable.SetValue(false); + } } - else + // I left this to check again just to catch those failed in directory checks. + if (!Ini.SysEmulationDirPathEnable.GetValue()) { - LOG_NOTICE(GENERAL, "EmualtionDir: Custom EmulationDir is Off, Binded $(EmulatorDir) to %s.", Emu.GetEmulatorPath()); + LOG_NOTICE(GENERAL, "Custom EmualtionDir: Off, Binded $(EmulatorDir) to %s.", Emu.GetEmulatorPath()); } + for(int i=0; i entry_path; diff --git a/rpcs3/Gui/MainFrame.cpp b/rpcs3/Gui/MainFrame.cpp index c20dbbc466..ae4ae0556a 100644 --- a/rpcs3/Gui/MainFrame.cpp +++ b/rpcs3/Gui/MainFrame.cpp @@ -437,8 +437,8 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) wxCheckBox* chbox_dbg_ap_functioncall = new wxCheckBox(p_hle, wxID_ANY, "Auto Pause at Function Call"); //Custom EmulationDir - wxCheckBox* chbox_emulationdir_enable = new wxCheckBox(p_system, wxID_ANY, "Use Custom EmulationDir Path?"); - wxTextCtrl* txt_emulationdir_path = new wxTextCtrl(p_system, wxID_ANY, "EmulationDir Path, Need Restart"); + wxCheckBox* chbox_emulationdir_enable = new wxCheckBox(p_system, wxID_ANY, "Use Path Below as EmulationDir ? (Need Restart)"); + wxTextCtrl* txt_emulationdir_path = new wxTextCtrl(p_system, wxID_ANY, Emu.GetEmulatorPath()); cbox_cpu_decoder->Append("PPU Interpreter"); cbox_cpu_decoder->Append("PPU Interpreter 2");