diff options
Diffstat (limited to 'src/yuzu_tester')
-rw-r--r-- | src/yuzu_tester/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/yuzu_tester/config.cpp | 95 | ||||
-rw-r--r-- | src/yuzu_tester/default_ini.h | 38 | ||||
-rw-r--r-- | src/yuzu_tester/emu_window/emu_window_sdl2_hide.cpp | 5 | ||||
-rw-r--r-- | src/yuzu_tester/emu_window/emu_window_sdl2_hide.h | 6 | ||||
-rw-r--r-- | src/yuzu_tester/service/yuzutest.cpp | 2 | ||||
-rw-r--r-- | src/yuzu_tester/yuzu.cpp | 13 | ||||
-rw-r--r-- | src/yuzu_tester/yuzu.rc | 2 |
8 files changed, 103 insertions, 60 deletions
diff --git a/src/yuzu_tester/CMakeLists.txt b/src/yuzu_tester/CMakeLists.txt index 06c2ee011..d8a2a1511 100644 --- a/src/yuzu_tester/CMakeLists.txt +++ b/src/yuzu_tester/CMakeLists.txt @@ -28,7 +28,5 @@ endif() if (MSVC) include(CopyYuzuSDLDeps) - include(CopyYuzuUnicornDeps) copy_yuzu_SDL_deps(yuzu-tester) - copy_yuzu_unicorn_deps(yuzu-tester) endif() diff --git a/src/yuzu_tester/config.cpp b/src/yuzu_tester/config.cpp index ee2591c8f..b6cdc7c1c 100644 --- a/src/yuzu_tester/config.cpp +++ b/src/yuzu_tester/config.cpp @@ -15,10 +15,11 @@ #include "yuzu_tester/config.h" #include "yuzu_tester/default_ini.h" +namespace FS = Common::FS; + Config::Config() { // TODO: Don't hardcode the path; let the frontend decide where to put the config files. - sdl2_config_loc = - FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + "sdl2-tester-config.ini"; + sdl2_config_loc = FS::GetUserPath(FS::UserPath::ConfigDir) + "sdl2-tester-config.ini"; sdl2_config = std::make_unique<INIReader>(sdl2_config_loc); Reload(); @@ -31,8 +32,8 @@ bool Config::LoadINI(const std::string& default_contents, bool retry) { if (sdl2_config->ParseError() < 0) { if (retry) { LOG_WARNING(Config, "Failed to load {}. Creating file from defaults...", location); - FileUtil::CreateFullPath(location); - FileUtil::WriteStringToFile(true, default_contents, location); + FS::CreateFullPath(location); + FS::WriteStringToFile(true, default_contents, location); sdl2_config = std::make_unique<INIReader>(location); // Reopen file return LoadINI(default_contents, false); @@ -46,13 +47,13 @@ bool Config::LoadINI(const std::string& default_contents, bool retry) { void Config::ReadValues() { // Controls - for (std::size_t p = 0; p < Settings::values.players.size(); ++p) { + for (std::size_t p = 0; p < Settings::values.players.GetValue().size(); ++p) { for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) { - Settings::values.players[p].buttons[i] = ""; + Settings::values.players.GetValue()[p].buttons[i] = ""; } for (int i = 0; i < Settings::NativeAnalog::NumAnalogs; ++i) { - Settings::values.players[p].analogs[i] = ""; + Settings::values.players.GetValue()[p].analogs[i] = ""; } } @@ -74,6 +75,9 @@ void Config::ReadValues() { Settings::values.debug_pad_analogs[i] = ""; } + Settings::values.vibration_enabled.SetValue(true); + Settings::values.enable_accurate_vibrations.SetValue(false); + Settings::values.motion_enabled.SetValue(true); Settings::values.touchscreen.enabled = ""; Settings::values.touchscreen.device = ""; Settings::values.touchscreen.finger = 0; @@ -81,68 +85,73 @@ void Config::ReadValues() { Settings::values.touchscreen.diameter_x = 15; Settings::values.touchscreen.diameter_y = 15; + Settings::values.use_docked_mode.SetValue( + sdl2_config->GetBoolean("Controls", "use_docked_mode", false)); + // Data Storage Settings::values.use_virtual_sd = sdl2_config->GetBoolean("Data Storage", "use_virtual_sd", true); - FileUtil::GetUserPath(FileUtil::UserPath::NANDDir, - sdl2_config->Get("Data Storage", "nand_directory", - FileUtil::GetUserPath(FileUtil::UserPath::NANDDir))); - FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir, - sdl2_config->Get("Data Storage", "sdmc_directory", - FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir))); + FS::GetUserPath(Common::FS::UserPath::NANDDir, + sdl2_config->Get("Data Storage", "nand_directory", + Common::FS::GetUserPath(Common::FS::UserPath::NANDDir))); + FS::GetUserPath(Common::FS::UserPath::SDMCDir, + sdl2_config->Get("Data Storage", "sdmc_directory", + Common::FS::GetUserPath(Common::FS::UserPath::SDMCDir))); // System - Settings::values.use_docked_mode = sdl2_config->GetBoolean("System", "use_docked_mode", false); - Settings::values.current_user = std::clamp<int>( sdl2_config->GetInteger("System", "current_user", 0), 0, Service::Account::MAX_USERS - 1); const auto rng_seed_enabled = sdl2_config->GetBoolean("System", "rng_seed_enabled", false); if (rng_seed_enabled) { - Settings::values.rng_seed = sdl2_config->GetInteger("System", "rng_seed", 0); + Settings::values.rng_seed.SetValue(sdl2_config->GetInteger("System", "rng_seed", 0)); } else { - Settings::values.rng_seed = std::nullopt; + Settings::values.rng_seed.SetValue(std::nullopt); } const auto custom_rtc_enabled = sdl2_config->GetBoolean("System", "custom_rtc_enabled", false); if (custom_rtc_enabled) { - Settings::values.custom_rtc = - std::chrono::seconds(sdl2_config->GetInteger("System", "custom_rtc", 0)); + Settings::values.custom_rtc.SetValue( + std::chrono::seconds(sdl2_config->GetInteger("System", "custom_rtc", 0))); } else { - Settings::values.custom_rtc = std::nullopt; + Settings::values.custom_rtc.SetValue(std::nullopt); } // Core - Settings::values.use_multi_core = sdl2_config->GetBoolean("Core", "use_multi_core", false); + Settings::values.use_multi_core.SetValue( + sdl2_config->GetBoolean("Core", "use_multi_core", false)); // Renderer - Settings::values.resolution_factor = - static_cast<float>(sdl2_config->GetReal("Renderer", "resolution_factor", 1.0)); - Settings::values.aspect_ratio = - static_cast<int>(sdl2_config->GetInteger("Renderer", "aspect_ratio", 0)); - Settings::values.max_anisotropy = - static_cast<int>(sdl2_config->GetInteger("Renderer", "max_anisotropy", 0)); - Settings::values.use_frame_limit = false; - Settings::values.frame_limit = 100; - Settings::values.use_disk_shader_cache = - sdl2_config->GetBoolean("Renderer", "use_disk_shader_cache", false); - Settings::values.use_accurate_gpu_emulation = - sdl2_config->GetBoolean("Renderer", "use_accurate_gpu_emulation", false); - Settings::values.use_asynchronous_gpu_emulation = - sdl2_config->GetBoolean("Renderer", "use_asynchronous_gpu_emulation", false); - - Settings::values.bg_red = static_cast<float>(sdl2_config->GetReal("Renderer", "bg_red", 0.0)); - Settings::values.bg_green = - static_cast<float>(sdl2_config->GetReal("Renderer", "bg_green", 0.0)); - Settings::values.bg_blue = static_cast<float>(sdl2_config->GetReal("Renderer", "bg_blue", 0.0)); + Settings::values.aspect_ratio.SetValue( + static_cast<int>(sdl2_config->GetInteger("Renderer", "aspect_ratio", 0))); + Settings::values.max_anisotropy.SetValue( + static_cast<int>(sdl2_config->GetInteger("Renderer", "max_anisotropy", 0))); + Settings::values.use_frame_limit.SetValue(false); + Settings::values.frame_limit.SetValue(100); + Settings::values.use_disk_shader_cache.SetValue( + sdl2_config->GetBoolean("Renderer", "use_disk_shader_cache", false)); + const int gpu_accuracy_level = sdl2_config->GetInteger("Renderer", "gpu_accuracy", 0); + Settings::values.gpu_accuracy.SetValue(static_cast<Settings::GPUAccuracy>(gpu_accuracy_level)); + Settings::values.use_asynchronous_gpu_emulation.SetValue( + sdl2_config->GetBoolean("Renderer", "use_asynchronous_gpu_emulation", false)); + Settings::values.use_fast_gpu_time.SetValue( + sdl2_config->GetBoolean("Renderer", "use_fast_gpu_time", true)); + + Settings::values.bg_red.SetValue( + static_cast<float>(sdl2_config->GetReal("Renderer", "bg_red", 0.0))); + Settings::values.bg_green.SetValue( + static_cast<float>(sdl2_config->GetReal("Renderer", "bg_green", 0.0))); + Settings::values.bg_blue.SetValue( + static_cast<float>(sdl2_config->GetReal("Renderer", "bg_blue", 0.0))); // Audio Settings::values.sink_id = "null"; - Settings::values.enable_audio_stretching = false; + Settings::values.enable_audio_stretching.SetValue(false); Settings::values.audio_device_id = "auto"; - Settings::values.volume = 0; + Settings::values.volume.SetValue(0); - Settings::values.language_index = sdl2_config->GetInteger("System", "language_index", 1); + Settings::values.language_index.SetValue( + sdl2_config->GetInteger("System", "language_index", 1)); // Miscellaneous Settings::values.log_filter = sdl2_config->Get("Miscellaneous", "log_filter", "*:Trace"); diff --git a/src/yuzu_tester/default_ini.h b/src/yuzu_tester/default_ini.h index ca203b64d..3eb64e9d7 100644 --- a/src/yuzu_tester/default_ini.h +++ b/src/yuzu_tester/default_ini.h @@ -12,6 +12,39 @@ const char* sdl2_config_file = R"( # 0 (default): Disabled, 1: Enabled use_multi_core= +[Cpu] +# Enable inline page tables optimization (faster guest memory access) +# 0: Disabled, 1 (default): Enabled +cpuopt_page_tables = + +# Enable block linking CPU optimization (reduce block dispatcher use during predictable jumps) +# 0: Disabled, 1 (default): Enabled +cpuopt_block_linking = + +# Enable return stack buffer CPU optimization (reduce block dispatcher use during predictable returns) +# 0: Disabled, 1 (default): Enabled +cpuopt_return_stack_buffer = + +# Enable fast dispatcher CPU optimization (use a two-tiered dispatcher architecture) +# 0: Disabled, 1 (default): Enabled +cpuopt_fast_dispatcher = + +# Enable context elimination CPU Optimization (reduce host memory use for guest context) +# 0: Disabled, 1 (default): Enabled +cpuopt_context_elimination = + +# Enable constant propagation CPU optimization (basic IR optimization) +# 0: Disabled, 1 (default): Enabled +cpuopt_const_prop = + +# Enable miscellaneous CPU optimizations (basic IR optimization) +# 0: Disabled, 1 (default): Enabled +cpuopt_misc_ir = + +# Enable reduction of memory misalignment checks (reduce memory fallbacks for misaligned access) +# 0: Disabled, 1 (default): Enabled +cpuopt_reduce_misalign_checks = + [Renderer] # Whether to use software or hardware rendering. # 0: Software, 1 (default): Hardware @@ -21,11 +54,6 @@ use_hw_renderer = # 0: Interpreter (slow), 1 (default): JIT (fast) use_shader_jit = -# Resolution scale factor -# 0: Auto (scales resolution to window size), 1: Native Switch screen resolution, Otherwise a scale -# factor for the Switch resolution -resolution_factor = - # Aspect ratio # 0: Default (16:9), 1: Force 4:3, 2: Force 21:9, 3: Stretch to Window aspect_ratio = diff --git a/src/yuzu_tester/emu_window/emu_window_sdl2_hide.cpp b/src/yuzu_tester/emu_window/emu_window_sdl2_hide.cpp index 8584f6671..78f75fb38 100644 --- a/src/yuzu_tester/emu_window/emu_window_sdl2_hide.cpp +++ b/src/yuzu_tester/emu_window/emu_window_sdl2_hide.cpp @@ -13,7 +13,6 @@ #include <glad/glad.h> -#include "common/assert.h" #include "common/logging/log.h" #include "common/scm_rev.h" #include "core/settings.h" @@ -53,7 +52,7 @@ EmuWindow_SDL2_Hide::EmuWindow_SDL2_Hide() { exit(1); } - InputCommon::Init(); + input_subsystem->Initialize(); SDL_SetMainReady(); @@ -105,7 +104,7 @@ EmuWindow_SDL2_Hide::EmuWindow_SDL2_Hide() { } EmuWindow_SDL2_Hide::~EmuWindow_SDL2_Hide() { - InputCommon::Shutdown(); + input_subsystem->Shutdown(); SDL_GL_DeleteContext(gl_context); SDL_Quit(); } diff --git a/src/yuzu_tester/emu_window/emu_window_sdl2_hide.h b/src/yuzu_tester/emu_window/emu_window_sdl2_hide.h index c13a82df2..a553b4b95 100644 --- a/src/yuzu_tester/emu_window/emu_window_sdl2_hide.h +++ b/src/yuzu_tester/emu_window/emu_window_sdl2_hide.h @@ -8,6 +8,10 @@ struct SDL_Window; +namespace InputCommon { +class InputSubsystem; +} + class EmuWindow_SDL2_Hide : public Core::Frontend::EmuWindow { public: explicit EmuWindow_SDL2_Hide(); @@ -25,6 +29,8 @@ private: /// Whether the GPU and driver supports the OpenGL extension required bool SupportsRequiredGLExtensions(); + std::unique_ptr<InputCommon::InputSubsystem> input_subsystem; + /// Internal SDL2 render window SDL_Window* render_window; diff --git a/src/yuzu_tester/service/yuzutest.cpp b/src/yuzu_tester/service/yuzutest.cpp index 85d3f436b..2d3f6e3a7 100644 --- a/src/yuzu_tester/service/yuzutest.cpp +++ b/src/yuzu_tester/service/yuzutest.cpp @@ -53,7 +53,7 @@ private: IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); - rb.Push<u32>(write_size); + rb.Push<u32>(static_cast<u32>(write_size)); } void StartIndividual(Kernel::HLERequestContext& ctx) { diff --git a/src/yuzu_tester/yuzu.cpp b/src/yuzu_tester/yuzu.cpp index 676e70ebd..88e4bd1f7 100644 --- a/src/yuzu_tester/yuzu.cpp +++ b/src/yuzu_tester/yuzu.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include <chrono> #include <iostream> #include <memory> #include <string> @@ -78,8 +79,8 @@ static void InitializeLogging(bool console) { if (console) Log::AddBackend(std::make_unique<Log::ColorConsoleBackend>()); - const std::string& log_dir = FileUtil::GetUserPath(FileUtil::UserPath::LogDir); - FileUtil::CreateFullPath(log_dir); + const std::string& log_dir = Common::FS::GetUserPath(Common::FS::UserPath::LogDir); + Common::FS::CreateFullPath(log_dir); Log::AddBackend(std::make_unique<Log::FileBackend>(log_dir + LOG_FILE)); #ifdef _WIN32 Log::AddBackend(std::make_unique<Log::DebuggerBackend>()); @@ -250,14 +251,16 @@ int main(int argc, char** argv) { Service::Yuzu::InstallInterfaces(system.ServiceManager(), datastring, callback); - system.TelemetrySession().AddField(Telemetry::FieldType::App, "Frontend", "SDLHideTester"); + system.TelemetrySession().AddField(Common::Telemetry::FieldType::App, "Frontend", + "SDLHideTester"); system.GPU().Start(); - system.Renderer().Rasterizer().LoadDiskResources(); + void(system.Run()); while (!finished) { - system.RunLoop(); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } + void(system.Pause()); detached_tasks.WaitForAllTasks(); return return_value; diff --git a/src/yuzu_tester/yuzu.rc b/src/yuzu_tester/yuzu.rc index 7de8ef3d9..0cde75e2f 100644 --- a/src/yuzu_tester/yuzu.rc +++ b/src/yuzu_tester/yuzu.rc @@ -14,4 +14,4 @@ YUZU_ICON ICON "../../dist/yuzu.ico" // RT_MANIFEST // -1 RT_MANIFEST "../../dist/yuzu.manifest" +0 RT_MANIFEST "../../dist/yuzu.manifest" |