summaryrefslogtreecommitdiff
path: root/src/yuzu_tester
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu_tester')
-rw-r--r--src/yuzu_tester/CMakeLists.txt2
-rw-r--r--src/yuzu_tester/config.cpp95
-rw-r--r--src/yuzu_tester/default_ini.h38
-rw-r--r--src/yuzu_tester/emu_window/emu_window_sdl2_hide.cpp5
-rw-r--r--src/yuzu_tester/emu_window/emu_window_sdl2_hide.h6
-rw-r--r--src/yuzu_tester/service/yuzutest.cpp2
-rw-r--r--src/yuzu_tester/yuzu.cpp13
-rw-r--r--src/yuzu_tester/yuzu.rc2
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()
28 28
29if (MSVC) 29if (MSVC)
30 include(CopyYuzuSDLDeps) 30 include(CopyYuzuSDLDeps)
31 include(CopyYuzuUnicornDeps)
32 copy_yuzu_SDL_deps(yuzu-tester) 31 copy_yuzu_SDL_deps(yuzu-tester)
33 copy_yuzu_unicorn_deps(yuzu-tester)
34endif() 32endif()
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 @@
15#include "yuzu_tester/config.h" 15#include "yuzu_tester/config.h"
16#include "yuzu_tester/default_ini.h" 16#include "yuzu_tester/default_ini.h"
17 17
18namespace FS = Common::FS;
19
18Config::Config() { 20Config::Config() {
19 // TODO: Don't hardcode the path; let the frontend decide where to put the config files. 21 // TODO: Don't hardcode the path; let the frontend decide where to put the config files.
20 sdl2_config_loc = 22 sdl2_config_loc = FS::GetUserPath(FS::UserPath::ConfigDir) + "sdl2-tester-config.ini";
21 FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + "sdl2-tester-config.ini";
22 sdl2_config = std::make_unique<INIReader>(sdl2_config_loc); 23 sdl2_config = std::make_unique<INIReader>(sdl2_config_loc);
23 24
24 Reload(); 25 Reload();
@@ -31,8 +32,8 @@ bool Config::LoadINI(const std::string& default_contents, bool retry) {
31 if (sdl2_config->ParseError() < 0) { 32 if (sdl2_config->ParseError() < 0) {
32 if (retry) { 33 if (retry) {
33 LOG_WARNING(Config, "Failed to load {}. Creating file from defaults...", location); 34 LOG_WARNING(Config, "Failed to load {}. Creating file from defaults...", location);
34 FileUtil::CreateFullPath(location); 35 FS::CreateFullPath(location);
35 FileUtil::WriteStringToFile(true, default_contents, location); 36 FS::WriteStringToFile(true, default_contents, location);
36 sdl2_config = std::make_unique<INIReader>(location); // Reopen file 37 sdl2_config = std::make_unique<INIReader>(location); // Reopen file
37 38
38 return LoadINI(default_contents, false); 39 return LoadINI(default_contents, false);
@@ -46,13 +47,13 @@ bool Config::LoadINI(const std::string& default_contents, bool retry) {
46 47
47void Config::ReadValues() { 48void Config::ReadValues() {
48 // Controls 49 // Controls
49 for (std::size_t p = 0; p < Settings::values.players.size(); ++p) { 50 for (std::size_t p = 0; p < Settings::values.players.GetValue().size(); ++p) {
50 for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) { 51 for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) {
51 Settings::values.players[p].buttons[i] = ""; 52 Settings::values.players.GetValue()[p].buttons[i] = "";
52 } 53 }
53 54
54 for (int i = 0; i < Settings::NativeAnalog::NumAnalogs; ++i) { 55 for (int i = 0; i < Settings::NativeAnalog::NumAnalogs; ++i) {
55 Settings::values.players[p].analogs[i] = ""; 56 Settings::values.players.GetValue()[p].analogs[i] = "";
56 } 57 }
57 } 58 }
58 59
@@ -74,6 +75,9 @@ void Config::ReadValues() {
74 Settings::values.debug_pad_analogs[i] = ""; 75 Settings::values.debug_pad_analogs[i] = "";
75 } 76 }
76 77
78 Settings::values.vibration_enabled.SetValue(true);
79 Settings::values.enable_accurate_vibrations.SetValue(false);
80 Settings::values.motion_enabled.SetValue(true);
77 Settings::values.touchscreen.enabled = ""; 81 Settings::values.touchscreen.enabled = "";
78 Settings::values.touchscreen.device = ""; 82 Settings::values.touchscreen.device = "";
79 Settings::values.touchscreen.finger = 0; 83 Settings::values.touchscreen.finger = 0;
@@ -81,68 +85,73 @@ void Config::ReadValues() {
81 Settings::values.touchscreen.diameter_x = 15; 85 Settings::values.touchscreen.diameter_x = 15;
82 Settings::values.touchscreen.diameter_y = 15; 86 Settings::values.touchscreen.diameter_y = 15;
83 87
88 Settings::values.use_docked_mode.SetValue(
89 sdl2_config->GetBoolean("Controls", "use_docked_mode", false));
90
84 // Data Storage 91 // Data Storage
85 Settings::values.use_virtual_sd = 92 Settings::values.use_virtual_sd =
86 sdl2_config->GetBoolean("Data Storage", "use_virtual_sd", true); 93 sdl2_config->GetBoolean("Data Storage", "use_virtual_sd", true);
87 FileUtil::GetUserPath(FileUtil::UserPath::NANDDir, 94 FS::GetUserPath(Common::FS::UserPath::NANDDir,
88 sdl2_config->Get("Data Storage", "nand_directory", 95 sdl2_config->Get("Data Storage", "nand_directory",
89 FileUtil::GetUserPath(FileUtil::UserPath::NANDDir))); 96 Common::FS::GetUserPath(Common::FS::UserPath::NANDDir)));
90 FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir, 97 FS::GetUserPath(Common::FS::UserPath::SDMCDir,
91 sdl2_config->Get("Data Storage", "sdmc_directory", 98 sdl2_config->Get("Data Storage", "sdmc_directory",
92 FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir))); 99 Common::FS::GetUserPath(Common::FS::UserPath::SDMCDir)));
93 100
94 // System 101 // System
95 Settings::values.use_docked_mode = sdl2_config->GetBoolean("System", "use_docked_mode", false);
96
97 Settings::values.current_user = std::clamp<int>( 102 Settings::values.current_user = std::clamp<int>(
98 sdl2_config->GetInteger("System", "current_user", 0), 0, Service::Account::MAX_USERS - 1); 103 sdl2_config->GetInteger("System", "current_user", 0), 0, Service::Account::MAX_USERS - 1);
99 104
100 const auto rng_seed_enabled = sdl2_config->GetBoolean("System", "rng_seed_enabled", false); 105 const auto rng_seed_enabled = sdl2_config->GetBoolean("System", "rng_seed_enabled", false);
101 if (rng_seed_enabled) { 106 if (rng_seed_enabled) {
102 Settings::values.rng_seed = sdl2_config->GetInteger("System", "rng_seed", 0); 107 Settings::values.rng_seed.SetValue(sdl2_config->GetInteger("System", "rng_seed", 0));
103 } else { 108 } else {
104 Settings::values.rng_seed = std::nullopt; 109 Settings::values.rng_seed.SetValue(std::nullopt);
105 } 110 }
106 111
107 const auto custom_rtc_enabled = sdl2_config->GetBoolean("System", "custom_rtc_enabled", false); 112 const auto custom_rtc_enabled = sdl2_config->GetBoolean("System", "custom_rtc_enabled", false);
108 if (custom_rtc_enabled) { 113 if (custom_rtc_enabled) {
109 Settings::values.custom_rtc = 114 Settings::values.custom_rtc.SetValue(
110 std::chrono::seconds(sdl2_config->GetInteger("System", "custom_rtc", 0)); 115 std::chrono::seconds(sdl2_config->GetInteger("System", "custom_rtc", 0)));
111 } else { 116 } else {
112 Settings::values.custom_rtc = std::nullopt; 117 Settings::values.custom_rtc.SetValue(std::nullopt);
113 } 118 }
114 119
115 // Core 120 // Core
116 Settings::values.use_multi_core = sdl2_config->GetBoolean("Core", "use_multi_core", false); 121 Settings::values.use_multi_core.SetValue(
122 sdl2_config->GetBoolean("Core", "use_multi_core", false));
117 123
118 // Renderer 124 // Renderer
119 Settings::values.resolution_factor = 125 Settings::values.aspect_ratio.SetValue(
120 static_cast<float>(sdl2_config->GetReal("Renderer", "resolution_factor", 1.0)); 126 static_cast<int>(sdl2_config->GetInteger("Renderer", "aspect_ratio", 0)));
121 Settings::values.aspect_ratio = 127 Settings::values.max_anisotropy.SetValue(
122 static_cast<int>(sdl2_config->GetInteger("Renderer", "aspect_ratio", 0)); 128 static_cast<int>(sdl2_config->GetInteger("Renderer", "max_anisotropy", 0)));
123 Settings::values.max_anisotropy = 129 Settings::values.use_frame_limit.SetValue(false);
124 static_cast<int>(sdl2_config->GetInteger("Renderer", "max_anisotropy", 0)); 130 Settings::values.frame_limit.SetValue(100);
125 Settings::values.use_frame_limit = false; 131 Settings::values.use_disk_shader_cache.SetValue(
126 Settings::values.frame_limit = 100; 132 sdl2_config->GetBoolean("Renderer", "use_disk_shader_cache", false));
127 Settings::values.use_disk_shader_cache = 133 const int gpu_accuracy_level = sdl2_config->GetInteger("Renderer", "gpu_accuracy", 0);
128 sdl2_config->GetBoolean("Renderer", "use_disk_shader_cache", false); 134 Settings::values.gpu_accuracy.SetValue(static_cast<Settings::GPUAccuracy>(gpu_accuracy_level));
129 Settings::values.use_accurate_gpu_emulation = 135 Settings::values.use_asynchronous_gpu_emulation.SetValue(
130 sdl2_config->GetBoolean("Renderer", "use_accurate_gpu_emulation", false); 136 sdl2_config->GetBoolean("Renderer", "use_asynchronous_gpu_emulation", false));
131 Settings::values.use_asynchronous_gpu_emulation = 137 Settings::values.use_fast_gpu_time.SetValue(
132 sdl2_config->GetBoolean("Renderer", "use_asynchronous_gpu_emulation", false); 138 sdl2_config->GetBoolean("Renderer", "use_fast_gpu_time", true));
133 139
134 Settings::values.bg_red = static_cast<float>(sdl2_config->GetReal("Renderer", "bg_red", 0.0)); 140 Settings::values.bg_red.SetValue(
135 Settings::values.bg_green = 141 static_cast<float>(sdl2_config->GetReal("Renderer", "bg_red", 0.0)));
136 static_cast<float>(sdl2_config->GetReal("Renderer", "bg_green", 0.0)); 142 Settings::values.bg_green.SetValue(
137 Settings::values.bg_blue = static_cast<float>(sdl2_config->GetReal("Renderer", "bg_blue", 0.0)); 143 static_cast<float>(sdl2_config->GetReal("Renderer", "bg_green", 0.0)));
144 Settings::values.bg_blue.SetValue(
145 static_cast<float>(sdl2_config->GetReal("Renderer", "bg_blue", 0.0)));
138 146
139 // Audio 147 // Audio
140 Settings::values.sink_id = "null"; 148 Settings::values.sink_id = "null";
141 Settings::values.enable_audio_stretching = false; 149 Settings::values.enable_audio_stretching.SetValue(false);
142 Settings::values.audio_device_id = "auto"; 150 Settings::values.audio_device_id = "auto";
143 Settings::values.volume = 0; 151 Settings::values.volume.SetValue(0);
144 152
145 Settings::values.language_index = sdl2_config->GetInteger("System", "language_index", 1); 153 Settings::values.language_index.SetValue(
154 sdl2_config->GetInteger("System", "language_index", 1));
146 155
147 // Miscellaneous 156 // Miscellaneous
148 Settings::values.log_filter = sdl2_config->Get("Miscellaneous", "log_filter", "*:Trace"); 157 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"(
12# 0 (default): Disabled, 1: Enabled 12# 0 (default): Disabled, 1: Enabled
13use_multi_core= 13use_multi_core=
14 14
15[Cpu]
16# Enable inline page tables optimization (faster guest memory access)
17# 0: Disabled, 1 (default): Enabled
18cpuopt_page_tables =
19
20# Enable block linking CPU optimization (reduce block dispatcher use during predictable jumps)
21# 0: Disabled, 1 (default): Enabled
22cpuopt_block_linking =
23
24# Enable return stack buffer CPU optimization (reduce block dispatcher use during predictable returns)
25# 0: Disabled, 1 (default): Enabled
26cpuopt_return_stack_buffer =
27
28# Enable fast dispatcher CPU optimization (use a two-tiered dispatcher architecture)
29# 0: Disabled, 1 (default): Enabled
30cpuopt_fast_dispatcher =
31
32# Enable context elimination CPU Optimization (reduce host memory use for guest context)
33# 0: Disabled, 1 (default): Enabled
34cpuopt_context_elimination =
35
36# Enable constant propagation CPU optimization (basic IR optimization)
37# 0: Disabled, 1 (default): Enabled
38cpuopt_const_prop =
39
40# Enable miscellaneous CPU optimizations (basic IR optimization)
41# 0: Disabled, 1 (default): Enabled
42cpuopt_misc_ir =
43
44# Enable reduction of memory misalignment checks (reduce memory fallbacks for misaligned access)
45# 0: Disabled, 1 (default): Enabled
46cpuopt_reduce_misalign_checks =
47
15[Renderer] 48[Renderer]
16# Whether to use software or hardware rendering. 49# Whether to use software or hardware rendering.
17# 0: Software, 1 (default): Hardware 50# 0: Software, 1 (default): Hardware
@@ -21,11 +54,6 @@ use_hw_renderer =
21# 0: Interpreter (slow), 1 (default): JIT (fast) 54# 0: Interpreter (slow), 1 (default): JIT (fast)
22use_shader_jit = 55use_shader_jit =
23 56
24# Resolution scale factor
25# 0: Auto (scales resolution to window size), 1: Native Switch screen resolution, Otherwise a scale
26# factor for the Switch resolution
27resolution_factor =
28
29# Aspect ratio 57# Aspect ratio
30# 0: Default (16:9), 1: Force 4:3, 2: Force 21:9, 3: Stretch to Window 58# 0: Default (16:9), 1: Force 4:3, 2: Force 21:9, 3: Stretch to Window
31aspect_ratio = 59aspect_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 @@
13 13
14#include <glad/glad.h> 14#include <glad/glad.h>
15 15
16#include "common/assert.h"
17#include "common/logging/log.h" 16#include "common/logging/log.h"
18#include "common/scm_rev.h" 17#include "common/scm_rev.h"
19#include "core/settings.h" 18#include "core/settings.h"
@@ -53,7 +52,7 @@ EmuWindow_SDL2_Hide::EmuWindow_SDL2_Hide() {
53 exit(1); 52 exit(1);
54 } 53 }
55 54
56 InputCommon::Init(); 55 input_subsystem->Initialize();
57 56
58 SDL_SetMainReady(); 57 SDL_SetMainReady();
59 58
@@ -105,7 +104,7 @@ EmuWindow_SDL2_Hide::EmuWindow_SDL2_Hide() {
105} 104}
106 105
107EmuWindow_SDL2_Hide::~EmuWindow_SDL2_Hide() { 106EmuWindow_SDL2_Hide::~EmuWindow_SDL2_Hide() {
108 InputCommon::Shutdown(); 107 input_subsystem->Shutdown();
109 SDL_GL_DeleteContext(gl_context); 108 SDL_GL_DeleteContext(gl_context);
110 SDL_Quit(); 109 SDL_Quit();
111} 110}
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 @@
8 8
9struct SDL_Window; 9struct SDL_Window;
10 10
11namespace InputCommon {
12class InputSubsystem;
13}
14
11class EmuWindow_SDL2_Hide : public Core::Frontend::EmuWindow { 15class EmuWindow_SDL2_Hide : public Core::Frontend::EmuWindow {
12public: 16public:
13 explicit EmuWindow_SDL2_Hide(); 17 explicit EmuWindow_SDL2_Hide();
@@ -25,6 +29,8 @@ private:
25 /// Whether the GPU and driver supports the OpenGL extension required 29 /// Whether the GPU and driver supports the OpenGL extension required
26 bool SupportsRequiredGLExtensions(); 30 bool SupportsRequiredGLExtensions();
27 31
32 std::unique_ptr<InputCommon::InputSubsystem> input_subsystem;
33
28 /// Internal SDL2 render window 34 /// Internal SDL2 render window
29 SDL_Window* render_window; 35 SDL_Window* render_window;
30 36
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:
53 53
54 IPC::ResponseBuilder rb{ctx, 3}; 54 IPC::ResponseBuilder rb{ctx, 3};
55 rb.Push(RESULT_SUCCESS); 55 rb.Push(RESULT_SUCCESS);
56 rb.Push<u32>(write_size); 56 rb.Push<u32>(static_cast<u32>(write_size));
57 } 57 }
58 58
59 void StartIndividual(Kernel::HLERequestContext& ctx) { 59 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 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <chrono>
5#include <iostream> 6#include <iostream>
6#include <memory> 7#include <memory>
7#include <string> 8#include <string>
@@ -78,8 +79,8 @@ static void InitializeLogging(bool console) {
78 if (console) 79 if (console)
79 Log::AddBackend(std::make_unique<Log::ColorConsoleBackend>()); 80 Log::AddBackend(std::make_unique<Log::ColorConsoleBackend>());
80 81
81 const std::string& log_dir = FileUtil::GetUserPath(FileUtil::UserPath::LogDir); 82 const std::string& log_dir = Common::FS::GetUserPath(Common::FS::UserPath::LogDir);
82 FileUtil::CreateFullPath(log_dir); 83 Common::FS::CreateFullPath(log_dir);
83 Log::AddBackend(std::make_unique<Log::FileBackend>(log_dir + LOG_FILE)); 84 Log::AddBackend(std::make_unique<Log::FileBackend>(log_dir + LOG_FILE));
84#ifdef _WIN32 85#ifdef _WIN32
85 Log::AddBackend(std::make_unique<Log::DebuggerBackend>()); 86 Log::AddBackend(std::make_unique<Log::DebuggerBackend>());
@@ -250,14 +251,16 @@ int main(int argc, char** argv) {
250 251
251 Service::Yuzu::InstallInterfaces(system.ServiceManager(), datastring, callback); 252 Service::Yuzu::InstallInterfaces(system.ServiceManager(), datastring, callback);
252 253
253 system.TelemetrySession().AddField(Telemetry::FieldType::App, "Frontend", "SDLHideTester"); 254 system.TelemetrySession().AddField(Common::Telemetry::FieldType::App, "Frontend",
255 "SDLHideTester");
254 256
255 system.GPU().Start(); 257 system.GPU().Start();
256 system.Renderer().Rasterizer().LoadDiskResources();
257 258
259 void(system.Run());
258 while (!finished) { 260 while (!finished) {
259 system.RunLoop(); 261 std::this_thread::sleep_for(std::chrono::milliseconds(1));
260 } 262 }
263 void(system.Pause());
261 264
262 detached_tasks.WaitForAllTasks(); 265 detached_tasks.WaitForAllTasks();
263 return return_value; 266 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"
14// RT_MANIFEST 14// RT_MANIFEST
15// 15//
16 16
171 RT_MANIFEST "../../dist/yuzu.manifest" 170 RT_MANIFEST "../../dist/yuzu.manifest"