#pragma once #include "Utilities/convert.h" #include "Utilities/config_context.h" enum class audio_output_type { Null, OpenAL, XAudio2 }; namespace convert { template<> struct to_impl_t { static std::string func(audio_output_type value) { switch (value) { case audio_output_type::Null: return "Null"; case audio_output_type::OpenAL: return "OpenAL"; case audio_output_type::XAudio2: return "XAudio2"; } return "Unknown"; } }; template<> struct to_impl_t { static audio_output_type func(const std::string &value) { if (value == "Null") return audio_output_type::Null; if (value == "OpenAL") return audio_output_type::OpenAL; if (value == "XAudio2") return audio_output_type::XAudio2; return audio_output_type::Null; } }; } enum class rsx_renderer_type { Null, OpenGL, 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<> struct to_impl_t { static std::string func(rsx_renderer_type value) { switch (value) { case rsx_renderer_type::Null: return "Null"; case rsx_renderer_type::OpenGL: return "OpenGL"; case rsx_renderer_type::DX12: return "DX12"; } return "Unknown"; } }; template<> struct to_impl_t { static rsx_renderer_type func(const std::string &value) { if (value == "Null") return rsx_renderer_type::Null; if (value == "OpenGL") return rsx_renderer_type::OpenGL; if (value == "DX12") return rsx_renderer_type::DX12; 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 { interpreter, interpreter2, recompiler_llvm }; namespace convert { template<> struct to_impl_t { static std::string func(ppu_decoder_type value) { switch (value) { case ppu_decoder_type::interpreter: return "interpreter"; case ppu_decoder_type::interpreter2: return "interpreter2"; case ppu_decoder_type::recompiler_llvm: return "recompiler_llvm"; } return "Unknown"; } }; template<> struct to_impl_t { static ppu_decoder_type func(const std::string &value) { if (value == "interpreter") return ppu_decoder_type::interpreter; if (value == "interpreter2") return ppu_decoder_type::interpreter2; if (value == "DX12") return ppu_decoder_type::recompiler_llvm; return ppu_decoder_type::interpreter; } }; } enum class spu_decoder_type { interpreter_precise, interpreter_fast, recompiler_asmjit }; namespace convert { template<> struct to_impl_t { static std::string func(spu_decoder_type value) { switch (value) { case spu_decoder_type::interpreter_precise: return "interpreter_precise"; case spu_decoder_type::interpreter_fast: return "interpreter_fast"; case spu_decoder_type::recompiler_asmjit: return "recompiler_asmjit"; } return "Unknown"; } }; template<> struct to_impl_t { static spu_decoder_type func(const std::string &value) { if (value == "interpreter_precise") return spu_decoder_type::interpreter_precise; if (value == "interpreter_fast") return spu_decoder_type::interpreter_fast; if (value == "recompiler_asmjit") return spu_decoder_type::recompiler_asmjit; return spu_decoder_type::interpreter_precise; } }; } 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 { std::string m_path; public: struct core_group : protected group { core_group(config_context_t *cfg) : group{ cfg, "core" } {} 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 { struct opengl_group : protected group { 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 }; } 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 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 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; config_t(const std::string &path); config_t(const config_t& rhs); config_t(config_t&& rhs) = delete; config_t& operator =(const config_t& rhs); config_t& operator =(config_t&& rhs) = delete; void path(const std::string &new_path); std::string path() const; void load(); void save() const; }; extern config_t config; }