diff --git a/Utilities/config_context.h b/Utilities/config_context.h index 169568038f..31f7f665ca 100644 --- a/Utilities/config_context.h +++ b/Utilities/config_context.h @@ -105,6 +105,13 @@ public: return *this; } + template + entry& operator = (const T2& new_value) + { + value(static_cast(new_value)); + return *this; + } + explicit operator const T&() const { return m_value; diff --git a/rpcs3/Emu/ARMv7/ARMv7Thread.cpp b/rpcs3/Emu/ARMv7/ARMv7Thread.cpp index c104182a52..d25063e688 100644 --- a/rpcs3/Emu/ARMv7/ARMv7Thread.cpp +++ b/rpcs3/Emu/ARMv7/ARMv7Thread.cpp @@ -3,6 +3,7 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" +#include "Emu/state.h" #include "Emu/IdManager.h" #include "Emu/ARMv7/PSVFuncList.h" @@ -179,14 +180,14 @@ void ARMv7Thread::do_run() { m_dec.reset(); - switch(Ini.CPUDecoderMode.GetValue()) + switch((int)rpcs3::state.config.core.ppu_decoder.value()) { case 0: case 1: m_dec.reset(new ARMv7Decoder(*this)); break; default: - LOG_ERROR(ARMv7, "Invalid CPU decoder mode: %d", Ini.CPUDecoderMode.GetValue()); + LOG_ERROR(ARMv7, "Invalid CPU decoder mode: %d", (int)rpcs3::state.config.core.ppu_decoder.value()); Emu.Pause(); } } diff --git a/rpcs3/Emu/Audio/AudioManager.cpp b/rpcs3/Emu/Audio/AudioManager.cpp index 8d28c476a6..3fd250f751 100644 --- a/rpcs3/Emu/Audio/AudioManager.cpp +++ b/rpcs3/Emu/Audio/AudioManager.cpp @@ -1,6 +1,7 @@ #include "stdafx.h" #include "rpcs3/Ini.h" #include "AudioManager.h" +#include "Emu/state.h" #include "AL/OpenALThread.h" #include "Null/NullAudioThread.h" #include "XAudio2/XAudio2Thread.h" @@ -20,13 +21,13 @@ void AudioManager::Init() m_audio_info.Init(); - switch (Ini.AudioOutMode.GetValue()) + switch (rpcs3::state.config.audio.out.value()) { default: - case 0: m_audio_out = new NullAudioThread(); break; - case 1: m_audio_out = new OpenALThread(); break; + case audio_output_type::Null: m_audio_out = new NullAudioThread(); break; + case audio_output_type::OpenAL: m_audio_out = new OpenALThread(); break; #if defined (_WIN32) - case 2: m_audio_out = new XAudio2Thread(); break; + case audio_output_type::XAudio2: m_audio_out = new XAudio2Thread(); break; #endif } } diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index fa9bd6e032..b84437359f 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -3,6 +3,7 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" +#include "Emu/state.h" #include "Emu/IdManager.h" #include "Emu/Cell/PPUThread.h" #include "Emu/Cell/PPUDecoder.h" @@ -143,20 +144,20 @@ void PPUThread::do_run() { m_dec.reset(); - switch (auto mode = Ini.CPUDecoderMode.GetValue()) + switch (auto mode = rpcs3::state.config.core.ppu_decoder.value()) { - case 0: // original interpreter + case ppu_decoder_type::interpreter: // original interpreter { m_dec.reset(new PPUDecoder(new PPUInterpreter(*this))); break; } - case 1: // alternative interpreter + case ppu_decoder_type::interpreter2: // alternative interpreter { break; } - case 2: + case ppu_decoder_type::recompiler_llvm: { #ifdef PPU_LLVM_RECOMPILER m_dec.reset(new ppu_recompiler_llvm::CPUHybridDecoderRecompiler(*this)); diff --git a/rpcs3/Emu/Cell/SPUThread.cpp b/rpcs3/Emu/Cell/SPUThread.cpp index 39799ea018..d57782a88b 100644 --- a/rpcs3/Emu/Cell/SPUThread.cpp +++ b/rpcs3/Emu/Cell/SPUThread.cpp @@ -3,6 +3,7 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" +#include "Emu/state.h" #include "Emu/IdManager.h" #include "Emu/Cell/PPUThread.h" @@ -111,7 +112,7 @@ void SPUThread::task() if (!custom_task && !m_dec) { // Select opcode table (TODO) - const auto& table = Ini.SPUDecoderMode.GetValue() == 0 ? spu_interpreter::precise::g_spu_opcode_table : spu_interpreter::fast::g_spu_opcode_table; + const auto& table = rpcs3::state.config.core.spu_decoder.value() == spu_decoder_type::interpreter_precise ? spu_interpreter::precise::g_spu_opcode_table : spu_interpreter::fast::g_spu_opcode_table; // LS base address const auto base = vm::_ptr(offset); @@ -208,15 +209,15 @@ void SPUThread::do_run() { m_dec.reset(); - switch (auto mode = Ini.SPUDecoderMode.GetValue()) + switch (auto mode = rpcs3::state.config.core.spu_decoder.value()) { - case 0: // Interpreter 1 (Precise) - case 1: // Interpreter 2 (Fast) + case spu_decoder_type::interpreter_precise: // Interpreter 1 (Precise) + case spu_decoder_type::interpreter_fast: // Interpreter 2 (Fast) { break; } - case 2: + case spu_decoder_type::recompiler_asmjit: { m_dec.reset(new SPURecompilerDecoder(*this)); break; @@ -224,7 +225,7 @@ void SPUThread::do_run() default: { - LOG_ERROR(SPU, "Invalid SPU decoder mode: %d", mode); + LOG_ERROR(SPU, "Invalid SPU decoder mode: %d", (u8)mode); Emu.Pause(); } } diff --git a/rpcs3/Emu/RSX/GSManager.cpp b/rpcs3/Emu/RSX/GSManager.cpp index 9a3f0894dd..7dbae299b0 100644 --- a/rpcs3/Emu/RSX/GSManager.cpp +++ b/rpcs3/Emu/RSX/GSManager.cpp @@ -3,6 +3,7 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/SysCalls/Modules/cellVideoOut.h" +#include "Emu/state.h" #include "GSManager.h" #include "Null/NullGSRender.h" @@ -32,13 +33,13 @@ void GSManager::Init() m_info.Init(); - switch (Ini.GSRenderMode.GetValue()) + switch (rpcs3::state.config.rsx.renderer.value()) { default: - case 0: m_render = new NullGSRender(); break; - case 1: m_render = new GLGSRender(); break; + case rsx_renderer_type::Null : m_render = new NullGSRender(); break; + case rsx_renderer_type::OpenGL: m_render = new GLGSRender(); break; #ifdef _WIN32 - case 2: m_render = new D3D12GSRender(); break; + case rsx_renderer_type::DX12: m_render = new D3D12GSRender(); break; #endif } diff --git a/rpcs3/Emu/SysCalls/LogBase.cpp b/rpcs3/Emu/SysCalls/LogBase.cpp index 617206a810..e7b9347ad0 100644 --- a/rpcs3/Emu/SysCalls/LogBase.cpp +++ b/rpcs3/Emu/SysCalls/LogBase.cpp @@ -2,6 +2,7 @@ #include "rpcs3/Ini.h" #include "Utilities/Log.h" #include "Emu/System.h" +#include "Emu/state.h" #include "LogBase.h" bool LogBase::CheckLogging() const diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index f0550c2e49..9734a2c864 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -86,6 +86,21 @@ void Emulator::SetTitle(const std::string& title) m_title = title; } +void Emulator::CreateConfig(const std::string& name) +{ + const std::string& path = "data/" + name; + const std::string& ini_file = path + "/settings.ini"; + + if (!fs::is_dir("data")) + fs::create_dir("data"); + + if (!fs::is_dir(path)) + fs::create_dir(path); + + if (!fs::is_file(ini_file)) + rpcs3::config_t{ ini_file }.save(); +} + bool Emulator::BootGame(const std::string& path, bool direct) { static const char* elf_path[6] = @@ -173,13 +188,11 @@ void Emulator::Load() } } - //TODO: load custom config if exists - rpcs3::state.config = rpcs3::config; - - LOG_NOTICE(LOADER, "Loading '%s'...", m_path.c_str()); ResetInfo(); GetVFS().Init(elf_dir); + LOG_NOTICE(LOADER, "Loading '%s'...", m_path.c_str()); + // /dev_bdvd/ mounting vfsFile f("/app_home/../dev_bdvd.path"); if (f.IsOpened()) @@ -213,8 +226,8 @@ void Emulator::Load() LOG_NOTICE(LOADER, ""); LOG_NOTICE(LOADER, "Settings:"); - LOG_NOTICE(LOADER, "CPU: %s", Ini.CPUIdToString(Ini.CPUDecoderMode.GetValue())); - LOG_NOTICE(LOADER, "SPU: %s", Ini.SPUIdToString(Ini.SPUDecoderMode.GetValue())); + //LOG_NOTICE(LOADER, "CPU: %s", Ini.CPUIdToString(Ini.CPUDecoderMode.GetValue())); + //LOG_NOTICE(LOADER, "SPU: %s", Ini.SPUIdToString(Ini.SPUDecoderMode.GetValue())); LOG_NOTICE(LOADER, "Renderer: %s", Ini.RendererIdToString(Ini.GSRenderMode.GetValue())); if (Ini.GSRenderMode.GetValue() == 2) @@ -231,10 +244,6 @@ void Emulator::Load() LOG_NOTICE(LOADER, "Log Everything: %s", Ini.HLELogging.GetValue() ? "Yes" : "No"); LOG_NOTICE(LOADER, "RSX Logging: %s", Ini.RSXLogging.GetValue() ? "Yes" : "No"); - LOG_NOTICE(LOADER, ""); - - LOG_NOTICE(LOADER, rpcs3::config.to_string().c_str()); - LOG_NOTICE(LOADER, ""); f.Open("/app_home/../PARAM.SFO"); const PSFLoader psf(f); @@ -246,6 +255,26 @@ void Emulator::Load() title.length() ? SetTitle(title) : SetTitle(m_path); SetTitleID(title_id); + rpcs3::state.config = rpcs3::config; + + // load custom config + if (!Ini.UseDefaultIni.GetValue()) + { + std::string& name = title_id; + if (name.size()) + { + name = name.substr(0, 4) + "-" + name.substr(4, 5); + CreateConfig(name); + rpcs3::config_t custom_config { "data/" + name + "/settings.ini" }; + custom_config.load(); + rpcs3::state.config = custom_config; + } + } + + LOG_NOTICE(LOADER, "Used configuration: '%s'", rpcs3::state.config.path().c_str()); + LOG_NOTICE(LOADER, ""); + LOG_NOTICE(LOADER, rpcs3::state.config.to_string().c_str()); + if (m_elf_path.empty()) { GetVFS().GetDeviceLocal(m_path, m_elf_path); diff --git a/rpcs3/Emu/System.h b/rpcs3/Emu/System.h index 81e2799a4d..3fb8991dc5 100644 --- a/rpcs3/Emu/System.h +++ b/rpcs3/Emu/System.h @@ -147,6 +147,7 @@ public: void SetPath(const std::string& path, const std::string& elf_path = ""); void SetTitleID(const std::string& id); void SetTitle(const std::string& title); + void CreateConfig(const std::string& name); const std::string& GetPath() const { diff --git a/rpcs3/Gui/GameViewer.cpp b/rpcs3/Gui/GameViewer.cpp index f0bca30f3d..988ad0a6b3 100644 --- a/rpcs3/Gui/GameViewer.cpp +++ b/rpcs3/Gui/GameViewer.cpp @@ -7,8 +7,10 @@ #include "Emu/FS/VFS.h" #include "Emu/FS/vfsDir.h" #include "Emu/FS/vfsFile.h" +#include "Emu/state.h" #include "GameViewer.h" #include "Loader/PSF.h" +#include "SettingsDialog.h" #include static const std::string m_class_name = "GameViewer"; @@ -251,13 +253,46 @@ void GameViewer::DClick(wxListEvent& event) void GameViewer::RightClick(wxListEvent& event) { - m_popup->Destroy(m_popup->FindItemByPosition(0)); + m_popup->Destroy(0); + m_popup->Destroy(1); + m_popup->Destroy(2); - wxMenuItem *pMenuItemA = m_popup->Append(event.GetIndex(), _T("Remove Game")); - Bind(wxEVT_MENU, &GameViewer::RemoveGame, this, event.GetIndex()); + wxMenuItem* boot_item = new wxMenuItem(m_popup, 0, _T("Boot")); +#if defined (_WIN32) + // wxMenuItem::Set(Get)Font only available for the wxMSW port + wxFont font = GetFont(); + font.SetWeight(wxFONTWEIGHT_BOLD); + boot_item->SetFont(font); +#endif + m_popup->Append(boot_item); + m_popup->Append(1, _T("Configure")); + m_popup->Append(2, _T("Remove Game")); + + Bind(wxEVT_MENU, &GameViewer::BootGame, this, 0); + Bind(wxEVT_MENU, &GameViewer::ConfigureGame, this, 1); + Bind(wxEVT_MENU, &GameViewer::RemoveGame, this, 2); + PopupMenu(m_popup, event.GetPoint()); } +void GameViewer::BootGame(wxCommandEvent& WXUNUSED(event)) +{ + wxListEvent unused_event; + DClick(unused_event); +} + +void GameViewer::ConfigureGame(wxCommandEvent& WXUNUSED(event)) +{ + long i = GetFirstSelected(); + if (i < 0) return; + + Emu.CreateConfig(m_game_data[i].serial); + rpcs3::config_t custom_config { "data/" + m_game_data[i].serial + "/settings.ini" }; + custom_config.load(); + LOG_NOTICE(LOADER, "Configure: '%s'", custom_config.path().c_str()); + SettingsDialog(this, &custom_config); +} + void GameViewer::RemoveGame(wxCommandEvent& event) { Emu.GetVFS().Init("/"); diff --git a/rpcs3/Gui/GameViewer.h b/rpcs3/Gui/GameViewer.h index 71df489898..078dc00032 100644 --- a/rpcs3/Gui/GameViewer.h +++ b/rpcs3/Gui/GameViewer.h @@ -279,8 +279,9 @@ public: void LoadSettings(); void Refresh(); + void BootGame(wxCommandEvent& event); + void ConfigureGame(wxCommandEvent& event); void RemoveGame(wxCommandEvent& event); - bool RemoveFolder(std::string localPath); private: virtual void DClick(wxListEvent& event); diff --git a/rpcs3/Gui/SettingsDialog.cpp b/rpcs3/Gui/SettingsDialog.cpp index 1591c28f3c..f41f49b57e 100644 --- a/rpcs3/Gui/SettingsDialog.cpp +++ b/rpcs3/Gui/SettingsDialog.cpp @@ -2,6 +2,7 @@ #include "Ini.h" #include "Emu/System.h" +#include "Emu/state.h" #include "Emu/SysCalls/Modules/cellVideoOut.h" #include "SettingsDialog.h" #include "Utilities/Log.h" @@ -89,6 +90,7 @@ SettingsDialog::SettingsDialog(wxWindow *parent, rpcs3::config_t* cfg) : wxDialog(parent, wxID_ANY, "Settings", wxDefaultPosition) { const bool was_running = Emu.Pause(); + if (was_running || Emu.IsReady()) cfg = &rpcs3::state.config; static const u32 width = 458; static const u32 height = 400; @@ -196,6 +198,7 @@ SettingsDialog::SettingsDialog(wxWindow *parent, rpcs3::config_t* cfg) wxCheckBox* chbox_hle_savetty = new wxCheckBox(p_misc, wxID_ANY, "Save TTY output to file"); wxCheckBox* chbox_hle_exitonstop = new wxCheckBox(p_misc, wxID_ANY, "Exit RPCS3 when process finishes"); wxCheckBox* chbox_hle_always_start = new wxCheckBox(p_misc, wxID_ANY, "Always start after boot"); + wxCheckBox* chbox_hle_use_default_ini = new wxCheckBox(p_misc, wxID_ANY, "Use default configuration"); wxTextCtrl* txt_dbg_range_min = new wxTextCtrl(p_core, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(55, 20)); wxTextCtrl* txt_dbg_range_max = new wxTextCtrl(p_core, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(55, 20)); @@ -335,6 +338,7 @@ SettingsDialog::SettingsDialog(wxWindow *parent, rpcs3::config_t* cfg) chbox_hle_savetty->SetValue(Ini.HLESaveTTY.GetValue()); chbox_hle_exitonstop->SetValue(Ini.HLEExitOnStop.GetValue()); chbox_hle_always_start->SetValue(Ini.HLEAlwaysStart.GetValue()); + chbox_hle_use_default_ini->SetValue(Ini.UseDefaultIni.GetValue()); chbox_core_hook_stfunc->SetValue(Ini.HookStFunc.GetValue()); chbox_core_load_liblv2->SetValue(Ini.LoadLibLv2.GetValue()); @@ -346,20 +350,20 @@ SettingsDialog::SettingsDialog(wxWindow *parent, rpcs3::config_t* cfg) chbox_emulationdir_enable->SetValue(Ini.SysEmulationDirPathEnable.GetValue()); txt_emulationdir_path->SetValue(Ini.SysEmulationDirPath.GetValue()); - rbox_ppu_decoder->SetSelection(Ini.CPUDecoderMode.GetValue() ? Ini.CPUDecoderMode.GetValue() : 0); + rbox_ppu_decoder->SetSelection((int)cfg->core.ppu_decoder.value()); txt_dbg_range_min->SetValue(std::to_string(Ini.LLVMMinId.GetValue())); txt_dbg_range_max->SetValue(std::to_string(Ini.LLVMMaxId.GetValue())); txt_llvm_threshold->SetValue(std::to_string(Ini.LLVMThreshold.GetValue())); - rbox_spu_decoder->SetSelection(Ini.SPUDecoderMode.GetValue() ? Ini.SPUDecoderMode.GetValue() : 0); - cbox_gs_render->SetSelection(Ini.GSRenderMode.GetValue()); + rbox_spu_decoder->SetSelection((int)cfg->core.spu_decoder.value()); + cbox_gs_render->SetSelection((int)cfg->rsx.renderer.value()); cbox_gs_d3d_adaptater->SetSelection(Ini.GSD3DAdaptater.GetValue()); cbox_gs_resolution->SetSelection(ResolutionIdToNum(Ini.GSResolution.GetValue()) - 1); cbox_gs_aspect->SetSelection(Ini.GSAspectRatio.GetValue() - 1); cbox_gs_frame_limit->SetSelection(Ini.GSFrameLimit.GetValue()); - cbox_pad_handler->SetSelection(Ini.PadHandlerMode.GetValue()); - cbox_keyboard_handler->SetSelection(Ini.KeyboardHandlerMode.GetValue()); - cbox_mouse_handler->SetSelection(Ini.MouseHandlerMode.GetValue()); - cbox_audio_out->SetSelection(Ini.AudioOutMode.GetValue()); + cbox_pad_handler->SetSelection((int)cfg->io.pad_handler_mode.value()); + cbox_keyboard_handler->SetSelection((int)cfg->io.keyboard_handler_mode.value()); + cbox_mouse_handler->SetSelection((int)cfg->io.mouse_handler_mode.value()); + cbox_audio_out->SetSelection((int)cfg->audio.out.value()); cbox_camera->SetSelection(Ini.Camera.GetValue()); cbox_camera_type->SetSelection(Ini.CameraType.GetValue()); cbox_hle_loglvl->SetSelection(Ini.HLELogLvl.GetValue()); @@ -367,6 +371,57 @@ SettingsDialog::SettingsDialog(wxWindow *parent, rpcs3::config_t* cfg) cbox_net_interface->SetSelection(Ini.NETInterface.GetValue()); cbox_sys_lang->SetSelection(Ini.SysLanguage.GetValue()); + // TODO: use later + /*chbox_core_llvm_exclud->SetValue(cfg->core.llvm.exclusion_range.value()); + chbox_gs_log_prog->SetValue(rpcs3::config.rsx.log_programs.value()); + chbox_gs_dump_depth->SetValue(cfg->rsx.opengl.write_depth_buffer.value()); + chbox_gs_dump_color->SetValue(cfg->rsx.opengl.write_color_buffers.value()); + chbox_gs_read_color->SetValue(cfg->rsx.opengl.read_color_buffers.value()); + chbox_gs_read_depth->SetValue(cfg->rsx.opengl.read_depth_buffer.value()); + chbox_gs_vsync->SetValue(rpcs3::config.rsx.vsync.value()); + chbox_gs_debug_output->SetValue(cfg->rsx.d3d12.debug_output.value()); + chbox_gs_3dmonitor->SetValue(rpcs3::config.rsx._3dtv.value()); + chbox_gs_overlay->SetValue(cfg->rsx.d3d12.overlay.value()); + chbox_audio_dump->SetValue(rpcs3::config.audio.dump_to_file.value()); + chbox_audio_conv->SetValue(rpcs3::config.audio.convert_to_u16.value()); + chbox_hle_logging->SetValue(rpcs3::config.misc.log.hle_logging.value()); + chbox_rsx_logging->SetValue(rpcs3::config.misc.log.rsx_logging.value()); + chbox_hle_savetty->SetValue(rpcs3::config.misc.log.save_tty.value()); + chbox_hle_exitonstop->SetValue(rpcs3::config.misc.exit_on_stop.value()); + chbox_hle_always_start->SetValue(rpcs3::config.misc.always_start.value()); + chbox_hle_use_default_ini->SetValue(rpcs3::config.misc.use_default_ini.value()); + chbox_core_hook_stfunc->SetValue(cfg->core.hook_st_func.value()); + chbox_core_load_liblv2->SetValue(cfg->core.load_liblv2.value()); + + //Auto Pause related + chbox_dbg_ap_systemcall->SetValue(rpcs3::config.misc.debug.auto_pause_syscall.value()); + chbox_dbg_ap_functioncall->SetValue(rpcs3::config.misc.debug.auto_pause_func_call.value()); + + //Custom EmulationDir + chbox_emulationdir_enable->SetValue(rpcs3::config.system.emulation_dir_path_enable.value()); + txt_emulationdir_path->SetValue(rpcs3::config.system.emulation_dir_path.value()); + + rbox_ppu_decoder->SetSelection((int)cfg->core.ppu_decoder.value()); + txt_dbg_range_min->SetValue(cfg->core.llvm.min_id.string_value()); + txt_dbg_range_max->SetValue(cfg->core.llvm.max_id.string_value()); + txt_llvm_threshold->SetValue(cfg->core.llvm.threshold.string_value()); + rbox_spu_decoder->SetSelection((int)cfg->core.spu_decoder.value()); + cbox_gs_render->SetSelection((int)cfg->rsx.renderer.value()); + cbox_gs_d3d_adaptater->SetSelection(cfg->rsx.d3d12.adaptater.value()); + cbox_gs_resolution->SetSelection(ResolutionIdToNum((int)cfg->rsx.resolution.value() - 1)); + cbox_gs_aspect->SetSelection((int)cfg->rsx.aspect_ratio.value()); + cbox_gs_frame_limit->SetSelection((int)cfg->rsx.frame_limit.value()); + cbox_pad_handler->SetSelection((int)cfg->io.pad_handler_mode.value()); + cbox_keyboard_handler->SetSelection((int)cfg->io.keyboard_handler_mode.value()); + cbox_mouse_handler->SetSelection((int)cfg->io.mouse_handler_mode.value()); + cbox_audio_out->SetSelection((int)cfg->audio.out.value()); + cbox_camera->SetSelection((int)cfg->io.camera.value()); + cbox_camera_type->SetSelection((int)cfg->io.camera_type.value()); + cbox_hle_loglvl->SetSelection((int)rpcs3::config.misc.log.level.value()); + cbox_net_status->SetSelection((int)rpcs3::config.misc.net.status.value()); + cbox_net_interface->SetSelection((int)rpcs3::config.misc.net._interface.value()); + cbox_sys_lang->SetSelection((int)rpcs3::config.system.language.value());*/ + // Core s_round_llvm->Add(chbox_core_llvm_exclud, wxSizerFlags().Border(wxALL, 5).Expand()); s_round_llvm_range->Add(txt_dbg_range_min, wxSizerFlags().Border(wxALL, 5).Expand()); @@ -449,6 +504,7 @@ SettingsDialog::SettingsDialog(wxWindow *parent, rpcs3::config_t* cfg) s_subpanel_misc->Add(chbox_hle_savetty, wxSizerFlags().Border(wxALL, 5).Expand()); s_subpanel_misc->Add(chbox_hle_exitonstop, wxSizerFlags().Border(wxALL, 5).Expand()); s_subpanel_misc->Add(chbox_hle_always_start, wxSizerFlags().Border(wxALL, 5).Expand()); + s_subpanel_misc->Add(chbox_hle_use_default_ini, wxSizerFlags().Border(wxALL, 5).Expand()); // Auto Pause s_subpanel_misc->Add(chbox_dbg_ap_systemcall, wxSizerFlags().Border(wxALL, 5).Expand()); @@ -484,20 +540,20 @@ SettingsDialog::SettingsDialog(wxWindow *parent, rpcs3::config_t* cfg) if (ShowModal() == wxID_OK) { - Ini.CPUDecoderMode.SetValue(rbox_ppu_decoder->GetSelection()); + long llvmthreshold; long minllvmid, maxllvmid; txt_dbg_range_min->GetValue().ToLong(&minllvmid); txt_dbg_range_max->GetValue().ToLong(&maxllvmid); + txt_llvm_threshold->GetValue().ToLong(&llvmthreshold); + Ini.LLVMExclusionRange.SetValue(chbox_core_llvm_exclud->GetValue()); Ini.LLVMMinId.SetValue((u32)minllvmid); Ini.LLVMMaxId.SetValue((u32)maxllvmid); - long llvmthreshold; - txt_llvm_threshold->GetValue().ToLong(&llvmthreshold); Ini.LLVMThreshold.SetValue((u32)llvmthreshold); - Ini.SPUDecoderMode.SetValue(rbox_spu_decoder->GetSelection()); + cfg->core.spu_decoder = (spu_decoder_type)rbox_spu_decoder->GetSelection(); Ini.HookStFunc.SetValue(chbox_core_hook_stfunc->GetValue()); Ini.LoadLibLv2.SetValue(chbox_core_load_liblv2->GetValue()); - Ini.GSRenderMode.SetValue(cbox_gs_render->GetSelection()); + cfg->rsx.renderer = cbox_gs_render->GetSelection(); Ini.GSD3DAdaptater.SetValue(cbox_gs_d3d_adaptater->GetSelection()); Ini.GSResolution.SetValue(ResolutionNumToId(cbox_gs_resolution->GetSelection() + 1)); Ini.GSAspectRatio.SetValue(cbox_gs_aspect->GetSelection() + 1); @@ -511,10 +567,10 @@ SettingsDialog::SettingsDialog(wxWindow *parent, rpcs3::config_t* cfg) Ini.GSDebugOutputEnable.SetValue(chbox_gs_debug_output->GetValue()); Ini.GS3DTV.SetValue(chbox_gs_3dmonitor->GetValue()); Ini.GSOverlay.SetValue(chbox_gs_overlay->GetValue()); - Ini.PadHandlerMode.SetValue(cbox_pad_handler->GetSelection()); - Ini.KeyboardHandlerMode.SetValue(cbox_keyboard_handler->GetSelection()); - Ini.MouseHandlerMode.SetValue(cbox_mouse_handler->GetSelection()); - Ini.AudioOutMode.SetValue(cbox_audio_out->GetSelection()); + cfg->io.pad_handler_mode = cbox_pad_handler->GetSelection(); + cfg->io.keyboard_handler_mode = cbox_keyboard_handler->GetSelection(); + cfg->io.mouse_handler_mode = cbox_mouse_handler->GetSelection(); + cfg->audio.out = cbox_audio_out->GetSelection(); Ini.AudioDumpToFile.SetValue(chbox_audio_dump->GetValue()); Ini.AudioConvertToU16.SetValue(chbox_audio_conv->GetValue()); Ini.Camera.SetValue(cbox_camera->GetSelection()); @@ -528,6 +584,7 @@ SettingsDialog::SettingsDialog(wxWindow *parent, rpcs3::config_t* cfg) Ini.NETInterface.SetValue(cbox_net_interface->GetSelection()); Ini.SysLanguage.SetValue(cbox_sys_lang->GetSelection()); Ini.HLEAlwaysStart.SetValue(chbox_hle_always_start->GetValue()); + Ini.UseDefaultIni.SetValue(chbox_hle_use_default_ini->GetValue()); //Auto Pause Ini.DBGAutoPauseFunctionCall.SetValue(chbox_dbg_ap_functioncall->GetValue()); @@ -536,6 +593,61 @@ SettingsDialog::SettingsDialog(wxWindow *parent, rpcs3::config_t* cfg) //Custom EmulationDir Ini.SysEmulationDirPathEnable.SetValue(chbox_emulationdir_enable->GetValue()); Ini.SysEmulationDirPath.SetValue(txt_emulationdir_path->GetValue().ToStdString()); + + + // TODO: use later + // individual settings + /*cfg->core.ppu_decoder = rbox_ppu_decoder->GetSelection(); + cfg->core.llvm.exclusion_range = chbox_core_llvm_exclud->GetValue(); + cfg->core.llvm.min_id = minllvmid; + cfg->core.llvm.max_id = maxllvmid; + cfg->core.llvm.threshold = llvmthreshold; + cfg->core.spu_decoder = rbox_spu_decoder->GetSelection(); + cfg->core.hook_st_func = chbox_core_hook_stfunc->GetValue(); + cfg->core.load_liblv2 = chbox_core_load_liblv2->GetValue(); + + cfg->rsx.renderer = cbox_gs_render->GetSelection(); + cfg->rsx.d3d12.adaptater = cbox_gs_d3d_adaptater->GetSelection(); + cfg->rsx.resolution = ResolutionNumToId(cbox_gs_resolution->GetSelection() + 1); + cfg->rsx.aspect_ratio = cbox_gs_aspect->GetSelection() + 1; + cfg->rsx.frame_limit = cbox_gs_frame_limit->GetSelection(); + cfg->rsx.opengl.write_depth_buffer = chbox_gs_dump_depth->GetValue(); + cfg->rsx.opengl.write_color_buffers = chbox_gs_dump_color->GetValue(); + cfg->rsx.opengl.read_color_buffers = chbox_gs_read_color->GetValue(); + cfg->rsx.opengl.read_depth_buffer = chbox_gs_read_depth->GetValue(); + cfg->rsx.d3d12.debug_output = chbox_gs_debug_output->GetValue(); + cfg->rsx.d3d12.overlay = chbox_gs_overlay->GetValue(); + + cfg->audio.out = cbox_audio_out->GetSelection(); + + cfg->io.pad_handler_mode = cbox_pad_handler->GetSelection(); + cfg->io.keyboard_handler_mode = cbox_keyboard_handler->GetSelection(); + cfg->io.mouse_handler_mode = cbox_mouse_handler->GetSelection(); + cfg->io.camera = cbox_camera->GetSelection(); + cfg->io.camera_type = cbox_camera_type->GetSelection(); + + + // global settings + rpcs3::config.rsx.log_programs = chbox_gs_log_prog->GetValue(); + rpcs3::config.rsx.vsync = chbox_gs_vsync->GetValue(); + rpcs3::config.rsx._3dtv = chbox_gs_3dmonitor->GetValue(); + rpcs3::config.audio.dump_to_file = chbox_audio_dump->GetValue(); + rpcs3::config.audio.convert_to_u16 = chbox_audio_conv->GetValue(); + rpcs3::config.misc.log.level = cbox_hle_loglvl->GetSelection(); + rpcs3::config.misc.log.hle_logging = chbox_hle_logging->GetValue(); + rpcs3::config.misc.log.rsx_logging = chbox_rsx_logging->GetValue(); + rpcs3::config.misc.log.save_tty = chbox_hle_savetty->GetValue(); + rpcs3::config.misc.net.status = cbox_net_status->GetSelection(); + rpcs3::config.misc.net._interface = cbox_net_interface->GetSelection(); + rpcs3::config.misc.debug.auto_pause_syscall = chbox_dbg_ap_systemcall->GetValue(); + rpcs3::config.misc.debug.auto_pause_func_call = chbox_dbg_ap_functioncall->GetValue(); + rpcs3::config.misc.always_start = chbox_hle_always_start->GetValue(); + rpcs3::config.misc.exit_on_stop = chbox_hle_exitonstop->GetValue(); + rpcs3::config.misc.use_default_ini = chbox_hle_use_default_ini->GetValue(); + rpcs3::config.system.language = cbox_sys_lang->GetSelection(); + rpcs3::config.system.emulation_dir_path_enable = chbox_emulationdir_enable->GetValue(); + rpcs3::config.system.emulation_dir_path = txt_emulationdir_path->GetValue().ToStdString();*/ + //rpcs3::config.save(); cfg->save(); Ini.Save(); diff --git a/rpcs3/Ini.h b/rpcs3/Ini.h index 139df08436..fbee6f27f0 100644 --- a/rpcs3/Ini.h +++ b/rpcs3/Ini.h @@ -161,6 +161,7 @@ public: IniEntry HLESaveTTY; IniEntry HLEExitOnStop; IniEntry HLEAlwaysStart; + IniEntry UseDefaultIni; // Auto Pause IniEntry DBGAutoPauseSystemCall; @@ -249,6 +250,7 @@ public: HLEExitOnStop.Init("HLE_HLEExitOnStop", path); HLELogLvl.Init("HLE_HLELogLvl", path); HLEAlwaysStart.Init("HLE_HLEAlwaysStart", path); + UseDefaultIni.Init("HLE_UseDefaultIni", path); // Auto Pause DBGAutoPauseFunctionCall.Init("DBG_AutoPauseFunctionCall", path); @@ -333,6 +335,7 @@ public: HLEExitOnStop.Load(false); HLELogLvl.Load(3); HLEAlwaysStart.Load(true); + UseDefaultIni.Load(false); //Auto Pause DBGAutoPauseFunctionCall.Load(false); @@ -417,6 +420,7 @@ public: HLEExitOnStop.Save(); HLELogLvl.Save(); HLEAlwaysStart.Save(); + UseDefaultIni.Save(); //Auto Pause DBGAutoPauseFunctionCall.Save(); diff --git a/rpcs3/config.cpp b/rpcs3/config.cpp index cd38ad0e60..3544217485 100644 --- a/rpcs3/config.cpp +++ b/rpcs3/config.cpp @@ -16,6 +16,7 @@ namespace rpcs3 config_t& config_t::operator =(const config_t& rhs) { assign(rhs); + path(rhs.path()); return *this; } diff --git a/rpcs3/config.h b/rpcs3/config.h index 9f14b95ac7..89a29db63e 100644 --- a/rpcs3/config.h +++ b/rpcs3/config.h @@ -53,6 +53,34 @@ enum class rsx_renderer_type DX12 }; +enum class rsx_aspect_ratio +{ + _16x9 = 1, + _4x3 +}; + +enum class rsx_frame_limit +{ + Off, + _50, + _59_94, + _30, + _60, + Auto +}; + +enum class rsx_resolution +{ + _1920x1080, + _1280x720, + _720x480, + _720x576, + _1600x1080, + _1440x1080, + _1280x1080, + _960x1080 +}; + namespace convert { template<> @@ -88,6 +116,136 @@ namespace convert return rsx_renderer_type::Null; } }; + + template<> + struct to_impl_t + { + static std::string func(rsx_aspect_ratio value) + { + switch (value) + { + case rsx_aspect_ratio::_16x9: return "16x9"; + case rsx_aspect_ratio::_4x3: return "4x3"; + } + + return "Unknown"; + } + }; + + template<> + struct to_impl_t + { + static rsx_aspect_ratio func(const std::string &value) + { + if (value == "16x9") + return rsx_aspect_ratio::_16x9; + + if (value == "4x3") + return rsx_aspect_ratio::_4x3; + + return rsx_aspect_ratio::_16x9; + } + }; + + template<> + struct to_impl_t + { + static std::string func(rsx_frame_limit value) + { + switch (value) + { + case rsx_frame_limit::Off: return "Off"; + case rsx_frame_limit::_50: return "50"; + case rsx_frame_limit::_59_94: return "59.94"; + case rsx_frame_limit::_30: return "30"; + case rsx_frame_limit::_60: return "60"; + case rsx_frame_limit::Auto: return "Auto"; + } + + return "Unknown"; + } + }; + + template<> + struct to_impl_t + { + static rsx_frame_limit func(const std::string &value) + { + if (value == "Off") + return rsx_frame_limit::Off; + + if (value == "50") + return rsx_frame_limit::_50; + + if (value == "59.94") + return rsx_frame_limit::_59_94; + + if (value == "30") + return rsx_frame_limit::_30; + + if (value == "60") + return rsx_frame_limit::_60; + + if (value == "Auto") + return rsx_frame_limit::Auto; + + return rsx_frame_limit::Off; + } + }; + + template<> + struct to_impl_t + { + static std::string func(rsx_resolution value) + { + switch (value) + { + case rsx_resolution::_1920x1080: return "1920x1080"; + case rsx_resolution::_1280x720: return "1280x720"; + case rsx_resolution::_720x480: return "720x480"; + case rsx_resolution::_720x576: return "720x576"; + case rsx_resolution::_1600x1080: return "1600x1080"; + case rsx_resolution::_1440x1080: return "1440x1080"; + case rsx_resolution::_1280x1080: return "1280x1080"; + case rsx_resolution::_960x1080: return "960x1080"; + } + + return "Unknown"; + } + }; + + template<> + struct to_impl_t + { + static rsx_resolution func(const std::string &value) + { + if (value == "1920x1080") + return rsx_resolution::_1920x1080; + + if (value == "1280x720") + return rsx_resolution::_1280x720; + + if (value == "720x480") + return rsx_resolution::_720x480; + + if (value == "720x576") + return rsx_resolution::_720x576; + + if (value == "1600x1080") + return rsx_resolution::_1600x1080; + + if (value == "1440x1080") + return rsx_resolution::_1440x1080; + + if (value == "1280x1080") + return rsx_resolution::_1280x1080; + + if (value == "960x1080") + return rsx_resolution::_960x1080; + + return rsx_resolution::_720x480; + } + }; } enum class ppu_decoder_type @@ -134,7 +292,6 @@ namespace convert }; } - enum class spu_decoder_type { interpreter_precise, @@ -179,6 +336,233 @@ namespace convert }; } +enum class io_camera_state +{ + null, + connected +}; + +enum class io_camera_type +{ + unknown, + eye_toy, + play_station_eye, + usb_video_class_1_1 +}; + +enum class io_handler_mode +{ + null, + windows, + xinput +}; + +namespace convert +{ + template<> + struct to_impl_t + { + static std::string func(io_camera_state value) + { + switch (value) + { + case io_camera_state::null: return "null"; + case io_camera_state::connected: return "connected"; + } + + return "Unknown"; + } + }; + + template<> + struct to_impl_t + { + static io_camera_state func(const std::string &value) + { + if (value == "null") + return io_camera_state::null; + + if (value == "connected") + return io_camera_state::connected; + + return io_camera_state::null; + } + }; + + template<> + struct to_impl_t + { + static std::string func(io_camera_type value) + { + switch (value) + { + case io_camera_type::unknown: return "Unknown"; + case io_camera_type::eye_toy: return "EyeToy"; + case io_camera_type::play_station_eye: return "PlayStationEye"; + case io_camera_type::usb_video_class_1_1: return "UsbVideoClass1.1"; + } + return "Unknown"; + } + }; + + template<> + struct to_impl_t + { + static io_camera_type func(const std::string &value) + { + if (value == "Unknown") + return io_camera_type::unknown; + + if (value == "EyeToy") + return io_camera_type::eye_toy; + + if (value == "PlayStationEye") + return io_camera_type::play_station_eye; + + if (value == "UsbVideoClass1.1") + return io_camera_type::usb_video_class_1_1; + + return io_camera_type::unknown; + } + }; + + template<> + struct to_impl_t + { + static std::string func(io_handler_mode value) + { + switch (value) + { + case io_handler_mode::null: return "null"; + case io_handler_mode::windows: return "windows"; + case io_handler_mode::xinput: return "xinput"; + } + return "Unknown"; + } + }; + + template<> + struct to_impl_t + { + static io_handler_mode func(const std::string &value) + { + if (value == "null") + return io_handler_mode::null; + + if (value == "windows") + return io_handler_mode::windows; + + if (value == "xinput") + return io_handler_mode::xinput; + + return io_handler_mode::null; + } + }; +} + +enum class misc_log_level +{ + all, + warnings, + success, + errors, + nothing +}; + +enum class misc_net_status +{ + ip_obtained, + obtaining_ip, + connecting, + disconnected +}; + +namespace convert +{ + template<> + struct to_impl_t + { + static std::string func(misc_log_level value) + { + switch (value) + { + case misc_log_level::all: return "All"; + case misc_log_level::warnings: return "Warnings"; + case misc_log_level::success: return "Success"; + case misc_log_level::errors: return "Errors"; + case misc_log_level::nothing: return "Nothing"; + } + + return "Unknown"; + } + }; + + template<> + struct to_impl_t + { + static misc_log_level func(const std::string &value) + { + if (value == "All") + return misc_log_level::all; + + if (value == "Warnings") + return misc_log_level::warnings; + + if (value == "Success") + return misc_log_level::success; + + if (value == "Errors") + return misc_log_level::errors; + + if (value == "Nothing") + return misc_log_level::nothing; + + return misc_log_level::errors; + } + }; + + template<> + struct to_impl_t + { + static std::string func(misc_net_status value) + { + switch (value) + { + case misc_net_status::ip_obtained: return "IPObtained"; + case misc_net_status::obtaining_ip: return "ObtainingIP"; + case misc_net_status::connecting: return "Connecting"; + case misc_net_status::disconnected: return "Disconnected"; + } + + return "Unknown"; + } + }; + + template<> + struct to_impl_t + { + static misc_net_status func(const std::string &value) + { + if (value == "IPObtained") + return misc_net_status::ip_obtained; + + if (value == "ObtainingIP") + return misc_net_status::obtaining_ip; + + if (value == "Connecting") + return misc_net_status::connecting; + + if (value == "Disconnected") + return misc_net_status::disconnected; + + return misc_net_status::connecting; + } + }; +} + + + + namespace rpcs3 { class config_t : public config_context_t @@ -190,9 +574,21 @@ namespace rpcs3 { core_group(config_context_t *cfg) : group{ cfg, "core" } {} - entry ppu_decoder{ this, "PPU Decoder", ppu_decoder_type::interpreter }; - entry spu_decoder{ this, "SPU Decoder", spu_decoder_type::interpreter_precise }; - entry load_liblv2{ this, "Load liblv2.sprx", false }; + struct llvm_group : protected group + { + llvm_group(group *grp) : group{ grp, "llvm" } {} + + entry exclusion_range { this, "Compiled blocks exclusion", false }; + entry min_id { this, "Excluded block range min", 200 }; + entry max_id { this, "Excluded block range max", 250 }; + entry threshold { this, "Compilation threshold", 1000 }; + } llvm{ this }; + + entry ppu_decoder { this, "PPU Decoder", ppu_decoder_type::interpreter }; + entry spu_decoder { this, "SPU Decoder", spu_decoder_type::interpreter_precise }; + entry hook_st_func { this, "Hook static functions", false }; + entry load_liblv2 { this, "Load liblv2.sprx", false }; + } core{ this }; struct rsx_group : protected group @@ -201,37 +597,126 @@ namespace rpcs3 { opengl_group(group *grp) : group{ grp, "opengl" } {} - entry write_color_buffers{ this, "Write Color Buffers", true }; - entry write_depth_buffer{ this, "Write Depth Buffer", true }; - entry read_color_buffers{ this, "Read Color Buffers", true }; - entry read_depth_buffer{ this, "Read Depth Buffer", true }; + entry write_color_buffers { this, "Write Color Buffers", true }; + entry write_depth_buffer { this, "Write Depth Buffer", true }; + entry read_color_buffers { this, "Read Color Buffers", true }; + entry read_depth_buffer { this, "Read Depth Buffer", true }; } opengl{ this }; + struct d3d12_group : protected group + { + d3d12_group(group *grp) : group{ grp, "d3d12" } {} + + entry adaptater { this, "D3D Adaptater", 1 }; + entry debug_output { this, "Debug Output", true }; + entry overlay { this, "Debug overlay", true }; + } d3d12{ this }; + rsx_group(config_context_t *cfg) : group{ cfg, "rsx" } {} - entry renderer{ this, "Renderer", rsx_renderer_type::OpenGL }; + entry renderer { this, "Renderer", rsx_renderer_type::OpenGL }; + entry resolution { this, "Resolution", rsx_resolution::_720x480 }; + entry aspect_ratio{ this, "Aspect ratio", rsx_aspect_ratio::_16x9 }; + entry frame_limit { this, "Frame limit", rsx_frame_limit::Off }; + entry log_programs { this, "Log shader programs", false }; + entry vsync { this, "VSync", false }; + entry _3dtv { this, "3D Monitor", false }; + } rsx{ this }; struct audio_group : protected group { audio_group(config_context_t *cfg) : group{ cfg, "audio" } {} - entry test{ this, "Audio Out", audio_output_type::OpenAL }; + entry out{ this, "Audio Out", audio_output_type::OpenAL }; + entry dump_to_file { this, "Dump to file", false }; + entry convert_to_u16 { this, "Convert to 16 bit", false }; } audio{ this }; struct io_group : protected group { io_group(config_context_t *cfg) : group{ cfg, "io" } {} + + entry camera { this, "Camera", io_camera_state::connected }; + entry camera_type { this, "Camera type", io_camera_type::play_station_eye }; + entry pad_handler_mode { this, "Pad Handler", io_handler_mode::windows }; + entry keyboard_handler_mode{ this, "Keyboard Handler", io_handler_mode::null }; + entry mouse_handler_mode { this, "Mouse Handler", io_handler_mode::null }; + + struct pad_group : protected group + { + pad_group(group *grp) : group{ grp, "pad" } {} + + entry left_stick_left { this, "Left Analog Stick Left", 314 }; + entry left_stick_down { this, "Left Analog Stick Down", 317 }; + entry left_stick_right { this, "Left Analog Stick Right", 316 }; + entry left_stick_up { this, "Left Analog Stick Up", 315 }; + entry right_stick_left { this, "Right Analog Stick Left", 313 }; + entry right_stick_down { this, "Right Analog Stick Down", 367 }; + entry right_stick_right{ this, "Right Analog Stick Right", 312 }; + entry right_stick_up { this, "Right Analog Stick Up", 366 }; + entry start { this, "Start", 13 }; + entry select { this, "Select", 32 }; + entry square { this, "Square", static_cast('J') }; + entry cross { this, "Cross", static_cast('K') }; + entry circle { this, "Circle", static_cast('L') }; + entry triangle { this, "Triangle", static_cast('I') }; + entry left { this, "Left", static_cast('A') }; + entry down { this, "Down", static_cast('S') }; + entry right { this, "Right", static_cast('D') }; + entry up { this, "Up", static_cast('W') }; + entry r1 { this, "R1", static_cast('3') }; + entry r2 { this, "R2", static_cast('E') }; + entry r3 { this, "R3", static_cast('C') }; + entry l1 { this, "L1", static_cast('1') }; + entry l2 { this, "L2", static_cast('Q') }; + entry l3 { this, "L3", static_cast('Z') }; + } pad{ this }; + } io{ this }; struct misc_group : protected group { misc_group(config_context_t *cfg) : group{ cfg, "misc" } {} + + struct log_group : protected group + { + log_group(group *grp) : group{ grp, "log" } {} + + entry level { this, "Log Level", misc_log_level::errors }; + entry hle_logging { this, "Log everything", false }; + entry rsx_logging { this, "RSX Logging", false }; + entry save_tty { this, "Save TTY output to file", false }; + } log{ this }; + + struct net_group : protected group + { + net_group(group *grp) : group{ grp, "net" } {} + + entry status{ this, "Connection status", misc_net_status::connecting }; + entry _interface { this, "Network adapter", 0 }; + } net{ this }; + + struct debug_group : protected group + { + debug_group(group *grp) : group{ grp, "debug" } {} + + entry auto_pause_syscall { this, "Auto Pause at System Call", false }; + entry auto_pause_func_call { this, "Auto Pause at Function Call", false }; + } debug{ this }; + + entry exit_on_stop { this, "Exit RPCS3 when process finishes", false }; + entry always_start { this, "Always start after boot", true }; + entry use_default_ini { this, "Use default configuration", false }; } misc{ this }; struct system_group : protected group { system_group(config_context_t *cfg) : group{ cfg, "system" } {} + + entry language { this, "Language", 1 }; + entry emulation_dir_path{ this, "Emulation dir path", "" }; + entry emulation_dir_path_enable{ this, "Use path below as EmulationDir", false }; } system{ this }; config_t() = default; @@ -250,4 +735,4 @@ namespace rpcs3 }; extern config_t config; -} \ No newline at end of file +} diff --git a/rpcs3/rpcs3.cpp b/rpcs3/rpcs3.cpp index eb597efb9f..3120f8cd2c 100644 --- a/rpcs3/rpcs3.cpp +++ b/rpcs3/rpcs3.cpp @@ -1,6 +1,7 @@ #include "stdafx_gui.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" +#include "Emu/state.h" #include "rpcs3.h" #include "Ini.h" #include "Utilities/Log.h" @@ -83,34 +84,34 @@ bool Rpcs3App::OnInit() callbacks.get_kb_handler = []() -> std::unique_ptr { - switch (auto mode = Ini.KeyboardHandlerMode.GetValue()) + switch (auto mode = rpcs3::config.io.pad_handler_mode.value()) { - case 0: return std::make_unique(); - case 1: return std::make_unique(); - default: throw EXCEPTION("Invalid Keyboard Handler Mode %d", +mode); + case io_handler_mode::null: return std::make_unique(); + case io_handler_mode::windows: return std::make_unique(); + default: throw EXCEPTION("Invalid Keyboard Handler Mode %d", +(u32)mode); } }; callbacks.get_mouse_handler = []() -> std::unique_ptr { - switch (auto mode = Ini.MouseHandlerMode.GetValue()) + switch (auto mode = rpcs3::config.io.mouse_handler_mode.value()) { - case 0: return std::make_unique(); - case 1: return std::make_unique(); - default: throw EXCEPTION("Invalid Mouse Handler Mode %d", +mode); + case io_handler_mode::null: return std::make_unique(); + case io_handler_mode::windows: return std::make_unique(); + default: throw EXCEPTION("Invalid Mouse Handler Mode %d", +(u32)mode); } }; callbacks.get_pad_handler = []() -> std::unique_ptr { - switch (auto mode = Ini.PadHandlerMode.GetValue()) + switch (auto mode = rpcs3::config.io.pad_handler_mode.value()) { - case 0: return std::make_unique(); - case 1: return std::make_unique(); + case io_handler_mode::null: return std::make_unique(); + case io_handler_mode::windows: return std::make_unique(); #if defined(_WIN32) - case 2: return std::make_unique(); + case io_handler_mode::xinput: return std::make_unique(); #endif - default: throw EXCEPTION("Invalid Pad Handler Mode %d", +mode); + default: throw EXCEPTION("Invalid Pad Handler Mode %d", +(u32)mode); } }; @@ -173,8 +174,8 @@ void Rpcs3App::OnArguments(const wxCmdLineParser& parser) if (parser.FoundSwitch("t")) { - HLEExitOnStop = Ini.HLEExitOnStop.GetValue(); - Ini.HLEExitOnStop.SetValue(true); + HLEExitOnStop = rpcs3::config.misc.exit_on_stop.value(); + rpcs3::config.misc.exit_on_stop = true; if (parser.GetParamCount() != 1) { wxLogDebug(wxT("A (S)ELF file needs to be given in test mode, exiting.")); @@ -194,7 +195,7 @@ void Rpcs3App::Exit() { if (parser.FoundSwitch("t")) { - Ini.HLEExitOnStop.SetValue(HLEExitOnStop); + rpcs3::config.misc.exit_on_stop = HLEExitOnStop; } Emu.Stop();