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/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/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 a372e1c2f7..9734a2c864 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -89,7 +89,7 @@ void Emulator::SetTitle(const std::string& title) void Emulator::CreateConfig(const std::string& name) { const std::string& path = "data/" + name; - const std::string& ini_file = path + "/" + name + ".ini"; + const std::string& ini_file = path + "/settings.ini"; if (!fs::is_dir("data")) fs::create_dir("data"); @@ -265,7 +265,7 @@ void Emulator::Load() { name = name.substr(0, 4) + "-" + name.substr(4, 5); CreateConfig(name); - rpcs3::config_t custom_config { "data/" + name + "/" + name + ".ini" }; + rpcs3::config_t custom_config { "data/" + name + "/settings.ini" }; custom_config.load(); rpcs3::state.config = custom_config; } @@ -476,7 +476,6 @@ void Emulator::Stop() RSXIOMem.Clear(); vm::close(); - rpcs3::state.config = rpcs3::config; // fallback to default .ini SendDbgCommand(DID_STOPPED_EMU); } diff --git a/rpcs3/Gui/GameViewer.cpp b/rpcs3/Gui/GameViewer.cpp index 1d069bd3b0..988ad0a6b3 100644 --- a/rpcs3/Gui/GameViewer.cpp +++ b/rpcs3/Gui/GameViewer.cpp @@ -287,7 +287,7 @@ void GameViewer::ConfigureGame(wxCommandEvent& WXUNUSED(event)) if (i < 0) return; Emu.CreateConfig(m_game_data[i].serial); - rpcs3::config_t custom_config { "data/" + m_game_data[i].serial + "/" + m_game_data[i].serial + ".ini" }; + 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); diff --git a/rpcs3/Gui/SettingsDialog.cpp b/rpcs3/Gui/SettingsDialog.cpp index 9d34537edc..f41f49b57e 100644 --- a/rpcs3/Gui/SettingsDialog.cpp +++ b/rpcs3/Gui/SettingsDialog.cpp @@ -355,15 +355,15 @@ SettingsDialog::SettingsDialog(wxWindow *parent, rpcs3::config_t* cfg) 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((int)cfg->core.spu_decoder.value()); - cbox_gs_render->SetSelection(Ini.GSRenderMode.GetValue()); + 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()); @@ -371,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()); @@ -489,20 +540,20 @@ SettingsDialog::SettingsDialog(wxWindow *parent, rpcs3::config_t* cfg) if (ShowModal() == wxID_OK) { - cfg->core.ppu_decoder = (ppu_decoder_type)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); 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); @@ -516,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()); @@ -542,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/config.h b/rpcs3/config.h index 9f14b95ac7..a54b159c52 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();