summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/string_util.cpp12
-rw-r--r--src/common/string_util.h2
-rw-r--r--src/core/core.cpp95
-rw-r--r--src/core/core.h61
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp14
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.h2
-rw-r--r--src/core/hle/service/vi/vi.cpp12
-rw-r--r--src/input_common/sdl/sdl_impl.cpp7
-rw-r--r--src/shader_recompiler/ir_opt/texture_pass.cpp3
-rw-r--r--src/video_core/command_classes/vic.cpp31
-rw-r--r--src/video_core/query_cache.h8
-rw-r--r--src/video_core/rasterizer_accelerated.h2
-rw-r--r--src/video_core/renderer_vulkan/vk_master_semaphore.h17
-rw-r--r--src/video_core/renderer_vulkan/vk_query_cache.cpp3
-rw-r--r--src/yuzu/about_dialog.cpp3
-rw-r--r--src/yuzu/applets/qt_controller.cpp26
-rw-r--r--src/yuzu/applets/qt_controller.h6
-rw-r--r--src/yuzu/applets/qt_web_browser.cpp1
-rw-r--r--src/yuzu/bootmanager.cpp18
-rw-r--r--src/yuzu/bootmanager.h19
-rw-r--r--src/yuzu/compatdb.cpp14
-rw-r--r--src/yuzu/compatdb.h5
-rw-r--r--src/yuzu/configuration/config.cpp5
-rw-r--r--src/yuzu/configuration/config.h8
-rw-r--r--src/yuzu/configuration/configure.ui200
-rw-r--r--src/yuzu/configuration/configure_audio.cpp6
-rw-r--r--src/yuzu/configuration/configure_audio.h10
-rw-r--r--src/yuzu/configuration/configure_audio.ui3
-rw-r--r--src/yuzu/configuration/configure_cpu.cpp5
-rw-r--r--src/yuzu/configuration/configure_cpu.h11
-rw-r--r--src/yuzu/configuration/configure_cpu.ui5
-rw-r--r--src/yuzu/configuration/configure_cpu_debug.cpp6
-rw-r--r--src/yuzu/configuration/configure_cpu_debug.h8
-rw-r--r--src/yuzu/configuration/configure_cpu_debug.ui3
-rw-r--r--src/yuzu/configuration/configure_debug.cpp5
-rw-r--r--src/yuzu/configuration/configure_debug.h8
-rw-r--r--src/yuzu/configuration/configure_debug_controller.cpp5
-rw-r--r--src/yuzu/configuration/configure_debug_controller.h6
-rw-r--r--src/yuzu/configuration/configure_debug_tab.cpp16
-rw-r--r--src/yuzu/configuration/configure_debug_tab.h12
-rw-r--r--src/yuzu/configuration/configure_debug_tab.ui29
-rw-r--r--src/yuzu/configuration/configure_dialog.cpp109
-rw-r--r--src/yuzu/configuration/configure_dialog.h38
-rw-r--r--src/yuzu/configuration/configure_filesystem.ui3
-rw-r--r--src/yuzu/configuration/configure_general.cpp6
-rw-r--r--src/yuzu/configuration/configure_general.h11
-rw-r--r--src/yuzu/configuration/configure_general.ui3
-rw-r--r--src/yuzu/configuration/configure_graphics.cpp6
-rw-r--r--src/yuzu/configuration/configure_graphics.h11
-rw-r--r--src/yuzu/configuration/configure_graphics.ui11
-rw-r--r--src/yuzu/configuration/configure_graphics_advanced.cpp6
-rw-r--r--src/yuzu/configuration/configure_graphics_advanced.h11
-rw-r--r--src/yuzu/configuration/configure_graphics_advanced.ui3
-rw-r--r--src/yuzu/configuration/configure_hotkeys.ui3
-rw-r--r--src/yuzu/configuration/configure_input.cpp44
-rw-r--r--src/yuzu/configuration/configure_input.h10
-rw-r--r--src/yuzu/configuration/configure_input_player.cpp18
-rw-r--r--src/yuzu/configuration/configure_input_player.h9
-rw-r--r--src/yuzu/configuration/configure_input_profile_dialog.cpp7
-rw-r--r--src/yuzu/configuration/configure_input_profile_dialog.h6
-rw-r--r--src/yuzu/configuration/configure_network.cpp6
-rw-r--r--src/yuzu/configuration/configure_network.h4
-rw-r--r--src/yuzu/configuration/configure_network.ui3
-rw-r--r--src/yuzu/configuration/configure_per_game.cpp66
-rw-r--r--src/yuzu/configuration/configure_per_game.h25
-rw-r--r--src/yuzu/configuration/configure_per_game.ui104
-rw-r--r--src/yuzu/configuration/configure_per_game_addons.cpp7
-rw-r--r--src/yuzu/configuration/configure_per_game_addons.h8
-rw-r--r--src/yuzu/configuration/configure_per_game_addons.ui3
-rw-r--r--src/yuzu/configuration/configure_profile_manager.cpp10
-rw-r--r--src/yuzu/configuration/configure_profile_manager.h8
-rw-r--r--src/yuzu/configuration/configure_profile_manager.ui5
-rw-r--r--src/yuzu/configuration/configure_system.cpp9
-rw-r--r--src/yuzu/configuration/configure_system.h11
-rw-r--r--src/yuzu/configuration/configure_system.ui3
-rw-r--r--src/yuzu/configuration/configure_ui.cpp5
-rw-r--r--src/yuzu/configuration/configure_ui.h8
-rw-r--r--src/yuzu/configuration/configure_ui.ui5
-rw-r--r--src/yuzu/configuration/configure_web.ui36
-rw-r--r--src/yuzu/configuration/input_profiles.cpp9
-rw-r--r--src/yuzu/configuration/input_profiles.h8
-rw-r--r--src/yuzu/debugger/wait_tree.cpp79
-rw-r--r--src/yuzu/debugger/wait_tree.h47
-rw-r--r--src/yuzu/discord_impl.cpp9
-rw-r--r--src/yuzu/discord_impl.h8
-rw-r--r--src/yuzu/game_list.cpp7
-rw-r--r--src/yuzu/game_list.h5
-rw-r--r--src/yuzu/game_list_worker.cpp10
-rw-r--r--src/yuzu/game_list_worker.h8
-rw-r--r--src/yuzu/main.cpp516
-rw-r--r--src/yuzu/main.h20
-rw-r--r--src/yuzu/main.ui48
-rw-r--r--src/yuzu/uisettings.h2
-rw-r--r--src/yuzu_cmd/config.cpp3
-rw-r--r--src/yuzu_cmd/default_ini.h6
-rw-r--r--src/yuzu_cmd/yuzu.cpp21
96 files changed, 1154 insertions, 1005 deletions
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index e6344fd41..662171138 100644
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -180,20 +180,20 @@ std::wstring UTF8ToUTF16W(const std::string& input) {
#endif
-std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, std::size_t max_len) {
+std::string StringFromFixedZeroTerminatedBuffer(std::string_view buffer, std::size_t max_len) {
std::size_t len = 0;
- while (len < max_len && buffer[len] != '\0')
+ while (len < buffer.length() && len < max_len && buffer[len] != '\0') {
++len;
-
- return std::string(buffer, len);
+ }
+ return std::string(buffer.begin(), buffer.begin() + len);
}
std::u16string UTF16StringFromFixedZeroTerminatedBuffer(std::u16string_view buffer,
std::size_t max_len) {
std::size_t len = 0;
- while (len < max_len && buffer[len] != '\0')
+ while (len < buffer.length() && len < max_len && buffer[len] != '\0') {
++len;
-
+ }
return std::u16string(buffer.begin(), buffer.begin() + len);
}
diff --git a/src/common/string_util.h b/src/common/string_util.h
index 7e90a9ca5..f0dd632ee 100644
--- a/src/common/string_util.h
+++ b/src/common/string_util.h
@@ -63,7 +63,7 @@ template <typename InIt>
* Creates a std::string from a fixed-size NUL-terminated char buffer. If the buffer isn't
* NUL-terminated then the string ends at max_len characters.
*/
-[[nodiscard]] std::string StringFromFixedZeroTerminatedBuffer(const char* buffer,
+[[nodiscard]] std::string StringFromFixedZeroTerminatedBuffer(std::string_view buffer,
std::size_t max_len);
/**
diff --git a/src/core/core.cpp b/src/core/core.cpp
index bb268a319..3042d611b 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -139,27 +139,47 @@ struct System::Impl {
: kernel{system}, fs_controller{system}, memory{system},
cpu_manager{system}, reporter{system}, applet_manager{system}, time_manager{system} {}
- ResultStatus Run() {
- status = ResultStatus::Success;
+ SystemResultStatus Run() {
+ std::unique_lock<std::mutex> lk(suspend_guard);
+ status = SystemResultStatus::Success;
kernel.Suspend(false);
core_timing.SyncPause(false);
cpu_manager.Pause(false);
+ is_paused = false;
return status;
}
- ResultStatus Pause() {
- status = ResultStatus::Success;
+ SystemResultStatus Pause() {
+ std::unique_lock<std::mutex> lk(suspend_guard);
+ status = SystemResultStatus::Success;
core_timing.SyncPause(true);
kernel.Suspend(true);
cpu_manager.Pause(true);
+ is_paused = true;
return status;
}
- ResultStatus Init(System& system, Frontend::EmuWindow& emu_window) {
+ std::unique_lock<std::mutex> StallCPU() {
+ std::unique_lock<std::mutex> lk(suspend_guard);
+ kernel.Suspend(true);
+ core_timing.SyncPause(true);
+ cpu_manager.Pause(true);
+ return lk;
+ }
+
+ void UnstallCPU() {
+ if (!is_paused) {
+ core_timing.SyncPause(false);
+ kernel.Suspend(false);
+ cpu_manager.Pause(false);
+ }
+ }
+
+ SystemResultStatus Init(System& system, Frontend::EmuWindow& emu_window) {
LOG_DEBUG(Core, "initialized OK");
device_memory = std::make_unique<Core::DeviceMemory>();
@@ -197,7 +217,7 @@ struct System::Impl {
gpu_core = VideoCore::CreateGPU(emu_window, system);
if (!gpu_core) {
- return ResultStatus::ErrorVideoCore;
+ return SystemResultStatus::ErrorVideoCore;
}
service_manager = std::make_shared<Service::SM::ServiceManager>(kernel);
@@ -217,21 +237,22 @@ struct System::Impl {
LOG_DEBUG(Core, "Initialized OK");
- return ResultStatus::Success;
+ return SystemResultStatus::Success;
}
- ResultStatus Load(System& system, Frontend::EmuWindow& emu_window, const std::string& filepath,
- u64 program_id, std::size_t program_index) {
+ SystemResultStatus Load(System& system, Frontend::EmuWindow& emu_window,
+ const std::string& filepath, u64 program_id,
+ std::size_t program_index) {
app_loader = Loader::GetLoader(system, GetGameFileFromPath(virtual_filesystem, filepath),
program_id, program_index);
if (!app_loader) {
LOG_CRITICAL(Core, "Failed to obtain loader for {}!", filepath);
- return ResultStatus::ErrorGetLoader;
+ return SystemResultStatus::ErrorGetLoader;
}
- ResultStatus init_result{Init(system, emu_window)};
- if (init_result != ResultStatus::Success) {
+ SystemResultStatus init_result{Init(system, emu_window)};
+ if (init_result != SystemResultStatus::Success) {
LOG_CRITICAL(Core, "Failed to initialize system (Error {})!",
static_cast<int>(init_result));
Shutdown();
@@ -249,8 +270,8 @@ struct System::Impl {
LOG_CRITICAL(Core, "Failed to load ROM (Error {})!", load_result);
Shutdown();
- return static_cast<ResultStatus>(static_cast<u32>(ResultStatus::ErrorLoader) +
- static_cast<u32>(load_result));
+ return static_cast<SystemResultStatus>(
+ static_cast<u32>(SystemResultStatus::ErrorLoader) + static_cast<u32>(load_result));
}
AddGlueRegistrationForProcess(*app_loader, *main_process);
kernel.MakeCurrentProcess(main_process.get());
@@ -282,7 +303,7 @@ struct System::Impl {
GetAndResetPerfStats();
perf_stats->BeginSystemFrame();
- status = ResultStatus::Success;
+ status = SystemResultStatus::Success;
return status;
}
@@ -355,7 +376,7 @@ struct System::Impl {
arp_manager.Register(launch.title_id, launch, std::move(nacp_data));
}
- void SetStatus(ResultStatus new_status, const char* details = nullptr) {
+ void SetStatus(SystemResultStatus new_status, const char* details = nullptr) {
status = new_status;
if (details) {
status_details = details;
@@ -366,6 +387,9 @@ struct System::Impl {
return perf_stats->GetAndResetStats(core_timing.GetGlobalTimeUs());
}
+ std::mutex suspend_guard;
+ bool is_paused{};
+
Timing::CoreTiming core_timing;
Kernel::KernelCore kernel;
/// RealVfsFilesystem instance
@@ -411,7 +435,7 @@ struct System::Impl {
/// Network instance
Network::NetworkInstance network_instance;
- ResultStatus status = ResultStatus::Success;
+ SystemResultStatus status = SystemResultStatus::Success;
std::string status_details = "";
std::unique_ptr<Core::PerfStats> perf_stats;
@@ -428,21 +452,8 @@ struct System::Impl {
};
System::System() : impl{std::make_unique<Impl>(*this)} {}
-System::~System() = default;
-System& System::GetInstance() {
- if (!s_instance) {
- throw std::runtime_error("Using System instance before its initialization");
- }
- return *s_instance;
-}
-
-void System::InitializeGlobalInstance() {
- if (s_instance) {
- throw std::runtime_error("Reinitializing Global System instance.");
- }
- s_instance = std::unique_ptr<System>(new System);
-}
+System::~System() = default;
CpuManager& System::GetCpuManager() {
return impl->cpu_manager;
@@ -452,16 +463,16 @@ const CpuManager& System::GetCpuManager() const {
return impl->cpu_manager;
}
-System::ResultStatus System::Run() {
+SystemResultStatus System::Run() {
return impl->Run();
}
-System::ResultStatus System::Pause() {
+SystemResultStatus System::Pause() {
return impl->Pause();
}
-System::ResultStatus System::SingleStep() {
- return ResultStatus::Success;
+SystemResultStatus System::SingleStep() {
+ return SystemResultStatus::Success;
}
void System::InvalidateCpuInstructionCaches() {
@@ -476,8 +487,16 @@ void System::Shutdown() {
impl->Shutdown();
}
-System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath,
- u64 program_id, std::size_t program_index) {
+std::unique_lock<std::mutex> System::StallCPU() {
+ return impl->StallCPU();
+}
+
+void System::UnstallCPU() {
+ impl->UnstallCPU();
+}
+
+SystemResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath,
+ u64 program_id, std::size_t program_index) {
return impl->Load(*this, emu_window, filepath, program_id, program_index);
}
@@ -637,7 +656,7 @@ Loader::ResultStatus System::GetGameName(std::string& out) const {
return impl->GetGameName(out);
}
-void System::SetStatus(ResultStatus new_status, const char* details) {
+void System::SetStatus(SystemResultStatus new_status, const char* details) {
impl->SetStatus(new_status, details);
}
diff --git a/src/core/core.h b/src/core/core.h
index a796472b2..1cfe1bba6 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -7,6 +7,7 @@
#include <cstddef>
#include <functional>
#include <memory>
+#include <mutex>
#include <string>
#include <vector>
@@ -104,55 +105,49 @@ struct PerfStatsResults;
FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs,
const std::string& path);
+/// Enumeration representing the return values of the System Initialize and Load process.
+enum class SystemResultStatus : u32 {
+ Success, ///< Succeeded
+ ErrorNotInitialized, ///< Error trying to use core prior to initialization
+ ErrorGetLoader, ///< Error finding the correct application loader
+ ErrorSystemFiles, ///< Error in finding system files
+ ErrorSharedFont, ///< Error in finding shared font
+ ErrorVideoCore, ///< Error in the video core
+ ErrorUnknown, ///< Any other error
+ ErrorLoader, ///< The base for loader errors (too many to repeat)
+};
+
class System {
public:
using CurrentBuildProcessID = std::array<u8, 0x20>;
+ explicit System();
+
+ ~System();
+
System(const System&) = delete;
System& operator=(const System&) = delete;
System(System&&) = delete;
System& operator=(System&&) = delete;
- ~System();
-
- /**
- * Gets the instance of the System singleton class.
- * @returns Reference to the instance of the System singleton class.
- */
- [[deprecated("Use of the global system instance is deprecated")]] static System& GetInstance();
-
- static void InitializeGlobalInstance();
-
- /// Enumeration representing the return values of the System Initialize and Load process.
- enum class ResultStatus : u32 {
- Success, ///< Succeeded
- ErrorNotInitialized, ///< Error trying to use core prior to initialization
- ErrorGetLoader, ///< Error finding the correct application loader
- ErrorSystemFiles, ///< Error in finding system files
- ErrorSharedFont, ///< Error in finding shared font
- ErrorVideoCore, ///< Error in the video core
- ErrorUnknown, ///< Any other error
- ErrorLoader, ///< The base for loader errors (too many to repeat)
- };
-
/**
* Run the OS and Application
* This function will start emulation and run the relevant devices
*/
- [[nodiscard]] ResultStatus Run();
+ [[nodiscard]] SystemResultStatus Run();
/**
* Pause the OS and Application
* This function will pause emulation and stop the relevant devices
*/
- [[nodiscard]] ResultStatus Pause();
+ [[nodiscard]] SystemResultStatus Pause();
/**
* Step the CPU one instruction
* @return Result status, indicating whether or not the operation succeeded.
*/
- [[nodiscard]] ResultStatus SingleStep();
+ [[nodiscard]] SystemResultStatus SingleStep();
/**
* Invalidate the CPU instruction caches
@@ -166,16 +161,20 @@ public:
/// Shutdown the emulated system.
void Shutdown();
+ std::unique_lock<std::mutex> StallCPU();
+ void UnstallCPU();
+
/**
* Load an executable application.
* @param emu_window Reference to the host-system window used for video output and keyboard
* input.
* @param filepath String path to the executable application to load on the host file system.
* @param program_index Specifies the index within the container of the program to launch.
- * @returns ResultStatus code, indicating if the operation succeeded.
+ * @returns SystemResultStatus code, indicating if the operation succeeded.
*/
- [[nodiscard]] ResultStatus Load(Frontend::EmuWindow& emu_window, const std::string& filepath,
- u64 program_id = 0, std::size_t program_index = 0);
+ [[nodiscard]] SystemResultStatus Load(Frontend::EmuWindow& emu_window,
+ const std::string& filepath, u64 program_id = 0,
+ std::size_t program_index = 0);
/**
* Indicates if the emulated system is powered on (all subsystems initialized and able to run an
@@ -301,7 +300,7 @@ public:
/// Gets the name of the current game
[[nodiscard]] Loader::ResultStatus GetGameName(std::string& out) const;
- void SetStatus(ResultStatus new_status, const char* details);
+ void SetStatus(SystemResultStatus new_status, const char* details);
[[nodiscard]] const std::string& GetStatusDetails() const;
@@ -403,12 +402,8 @@ public:
void ApplySettings();
private:
- System();
-
struct Impl;
std::unique_ptr<Impl> impl;
-
- inline static std::unique_ptr<System> s_instance{};
};
} // namespace Core
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
index 8b4867ca7..f9b82b504 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
@@ -92,6 +92,7 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector
if (syncpoint_manager.IsSyncpointExpired(params.syncpt_id, params.threshold)) {
params.value = syncpoint_manager.GetSyncpointMin(params.syncpt_id);
std::memcpy(output.data(), &params, sizeof(params));
+ events_interface.failed[event_id] = false;
return NvResult::Success;
}
@@ -99,6 +100,7 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector
syncpoint_manager.IsSyncpointExpired(params.syncpt_id, params.threshold)) {
params.value = new_value;
std::memcpy(output.data(), &params, sizeof(params));
+ events_interface.failed[event_id] = false;
return NvResult::Success;
}
@@ -117,6 +119,7 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector
event.event->GetWritableEvent().Signal();
params.value = current_syncpoint_value;
std::memcpy(output.data(), &params, sizeof(params));
+ events_interface.failed[event_id] = false;
return NvResult::Success;
}
const u32 target_value = current_syncpoint_value - diff;
@@ -146,6 +149,16 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector
}
params.value |= event_id;
event.event->GetWritableEvent().Clear();
+ if (events_interface.failed[event_id]) {
+ {
+ auto lk = system.StallCPU();
+ gpu.WaitFence(params.syncpt_id, target_value);
+ system.UnstallCPU();
+ }
+ std::memcpy(output.data(), &params, sizeof(params));
+ events_interface.failed[event_id] = false;
+ return NvResult::Success;
+ }
gpu.RegisterSyncptInterrupt(params.syncpt_id, target_value);
std::memcpy(output.data(), &params, sizeof(params));
return NvResult::Timeout;
@@ -201,6 +214,7 @@ NvResult nvhost_ctrl::IocCtrlClearEventWait(const std::vector<u8>& input, std::v
if (events_interface.status[event_id] == EventState::Waiting) {
events_interface.LiberateEvent(event_id);
}
+ events_interface.failed[event_id] = true;
syncpoint_manager.RefreshSyncpoint(events_interface.events[event_id].fence.id);
diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h
index e2a1dde5b..a5af5b785 100644
--- a/src/core/hle/service/nvdrv/nvdrv.h
+++ b/src/core/hle/service/nvdrv/nvdrv.h
@@ -49,6 +49,8 @@ struct EventInterface {
std::array<EventState, MaxNvEvents> status{};
// Tells if an NVEvent is registered or not
std::array<bool, MaxNvEvents> registered{};
+ // Tells the NVEvent that it has failed.
+ std::array<bool, MaxNvEvents> failed{};
// When an NVEvent is waiting on GPU interrupt, this is the sync_point
// associated with it.
std::array<u32, MaxNvEvents> assigned_syncpt{};
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index be3d52d54..439e7e472 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -524,7 +524,9 @@ private:
Disconnect = 11,
AllocateBuffers = 13,
- SetPreallocatedBuffer = 14
+ SetPreallocatedBuffer = 14,
+
+ GetBufferHistory = 17
};
void TransactParcel(Kernel::HLERequestContext& ctx) {
@@ -641,6 +643,14 @@ private:
ctx.WriteBuffer(response.Serialize());
break;
}
+ case TransactionId::GetBufferHistory: {
+ LOG_WARNING(Service_VI, "(STUBBED) called, transaction=GetBufferHistory");
+ [[maybe_unused]] const auto buffer = ctx.ReadBuffer();
+
+ IGBPEmptyResponseParcel response{};
+ ctx.WriteBuffer(response.Serialize());
+ break;
+ }
default:
ASSERT_MSG(false, "Unimplemented");
}
diff --git a/src/input_common/sdl/sdl_impl.cpp b/src/input_common/sdl/sdl_impl.cpp
index ab6211b29..ecb00d428 100644
--- a/src/input_common/sdl/sdl_impl.cpp
+++ b/src/input_common/sdl/sdl_impl.cpp
@@ -170,7 +170,8 @@ public:
float GetAxis(int axis, float range, float offset) const {
std::lock_guard lock{mutex};
const float value = static_cast<float>(state.axes.at(axis)) / 32767.0f;
- return (value + offset) / range;
+ const float offset_scale = (value + offset) > 0.0f ? 1.0f + offset : 1.0f - offset;
+ return (value + offset) / range / offset_scale;
}
bool RumblePlay(u16 amp_low, u16 amp_high) {
@@ -789,8 +790,8 @@ public:
const std::string invert_y_value = params.Get("invert_y", "+");
const bool invert_x = invert_x_value == "-";
const bool invert_y = invert_y_value == "-";
- const float offset_x = params.Get("offset_x", 0.0f);
- const float offset_y = params.Get("offset_y", 0.0f);
+ const float offset_x = std::clamp(params.Get("offset_x", 0.0f), -0.99f, 0.99f);
+ const float offset_y = std::clamp(params.Get("offset_y", 0.0f), -0.99f, 0.99f);
auto joystick = state.GetSDLJoystickByGUID(guid, port);
// This is necessary so accessing GetAxis with axis_x and axis_y won't crash
diff --git a/src/shader_recompiler/ir_opt/texture_pass.cpp b/src/shader_recompiler/ir_opt/texture_pass.cpp
index 44ad10d43..225c238fb 100644
--- a/src/shader_recompiler/ir_opt/texture_pass.cpp
+++ b/src/shader_recompiler/ir_opt/texture_pass.cpp
@@ -492,7 +492,8 @@ void TexturePass(Environment& env, IR::Program& program) {
const auto insert_point{IR::Block::InstructionList::s_iterator_to(*inst)};
IR::IREmitter ir{*texture_inst.block, insert_point};
const IR::U32 shift{ir.Imm32(std::countr_zero(DESCRIPTOR_SIZE))};
- inst->SetArg(0, ir.ShiftRightArithmetic(cbuf.dynamic_offset, shift));
+ inst->SetArg(0, ir.SMin(ir.ShiftRightArithmetic(cbuf.dynamic_offset, shift),
+ ir.Imm32(DESCRIPTOR_SIZE - 1)));
} else {
inst->SetArg(0, IR::Value{});
}
diff --git a/src/video_core/command_classes/vic.cpp b/src/video_core/command_classes/vic.cpp
index dc768b952..051616124 100644
--- a/src/video_core/command_classes/vic.cpp
+++ b/src/video_core/command_classes/vic.cpp
@@ -32,7 +32,7 @@ enum class VideoPixelFormat : u64_le {
RGBA8 = 0x1f,
BGRA8 = 0x20,
RGBX8 = 0x23,
- Yuv420 = 0x44,
+ YUV420 = 0x44,
};
} // Anonymous namespace
@@ -88,12 +88,10 @@ void Vic::Execute() {
const u64 surface_width = config.surface_width_minus1 + 1;
const u64 surface_height = config.surface_height_minus1 + 1;
if (static_cast<u64>(frame->width) != surface_width ||
- static_cast<u64>(frame->height) > surface_height) {
+ static_cast<u64>(frame->height) != surface_height) {
// TODO: Properly support multiple video streams with differing frame dimensions
- LOG_WARNING(Debug,
- "Frame dimensions {}x{} can't be safely decoded into surface dimensions {}x{}",
+ LOG_WARNING(Service_NVDRV, "Frame dimensions {}x{} don't match surface dimensions {}x{}",
frame->width, frame->height, surface_width, surface_height);
- return;
}
switch (config.pixel_format) {
case VideoPixelFormat::RGBA8:
@@ -101,7 +99,7 @@ void Vic::Execute() {
case VideoPixelFormat::RGBX8:
WriteRGBFrame(frame, config);
break;
- case VideoPixelFormat::Yuv420:
+ case VideoPixelFormat::YUV420:
WriteYUVFrame(frame, config);
break;
default:
@@ -136,21 +134,20 @@ void Vic::WriteRGBFrame(const AVFrame* frame, const VicConfig& config) {
scaler_height = frame->height;
converted_frame_buffer.reset();
}
- // Get Converted frame
- const u32 width = static_cast<u32>(frame->width);
- const u32 height = static_cast<u32>(frame->height);
- const std::size_t linear_size = width * height * 4;
-
- // Only allocate frame_buffer once per stream, as the size is not expected to change
if (!converted_frame_buffer) {
- converted_frame_buffer = AVMallocPtr{static_cast<u8*>(av_malloc(linear_size)), av_free};
+ const size_t frame_size = frame->width * frame->height * 4;
+ converted_frame_buffer = AVMallocPtr{static_cast<u8*>(av_malloc(frame_size)), av_free};
}
const std::array<int, 4> converted_stride{frame->width * 4, frame->height * 4, 0, 0};
u8* const converted_frame_buf_addr{converted_frame_buffer.get()};
-
sws_scale(scaler_ctx, frame->data, frame->linesize, 0, frame->height, &converted_frame_buf_addr,
converted_stride.data());
+ // Use the minimum of surface/frame dimensions to avoid buffer overflow.
+ const u32 surface_width = static_cast<u32>(config.surface_width_minus1) + 1;
+ const u32 surface_height = static_cast<u32>(config.surface_height_minus1) + 1;
+ const u32 width = std::min(surface_width, static_cast<u32>(frame->width));
+ const u32 height = std::min(surface_height, static_cast<u32>(frame->height));
const u32 blk_kind = static_cast<u32>(config.block_linear_kind);
if (blk_kind != 0) {
// swizzle pitch linear to block linear
@@ -158,11 +155,12 @@ void Vic::WriteRGBFrame(const AVFrame* frame, const VicConfig& config) {
const auto size = Texture::CalculateSize(true, 4, width, height, 1, block_height, 0);
luma_buffer.resize(size);
Texture::SwizzleSubrect(width, height, width * 4, width, 4, luma_buffer.data(),
- converted_frame_buffer.get(), block_height, 0, 0);
+ converted_frame_buf_addr, block_height, 0, 0);
gpu.MemoryManager().WriteBlock(output_surface_luma_address, luma_buffer.data(), size);
} else {
// send pitch linear frame
+ const size_t linear_size = width * height * 4;
gpu.MemoryManager().WriteBlock(output_surface_luma_address, converted_frame_buf_addr,
linear_size);
}
@@ -173,9 +171,10 @@ void Vic::WriteYUVFrame(const AVFrame* frame, const VicConfig& config) {
const std::size_t surface_width = config.surface_width_minus1 + 1;
const std::size_t surface_height = config.surface_height_minus1 + 1;
+ const std::size_t aligned_width = (surface_width + 0xff) & ~0xffUL;
+ // Use the minimum of surface/frame dimensions to avoid buffer overflow.
const auto frame_width = std::min(surface_width, static_cast<size_t>(frame->width));
const auto frame_height = std::min(surface_height, static_cast<size_t>(frame->height));
- const std::size_t aligned_width = (surface_width + 0xff) & ~0xffUL;
const auto stride = static_cast<size_t>(frame->linesize[0]);
diff --git a/src/video_core/query_cache.h b/src/video_core/query_cache.h
index 73231061a..392f82eb7 100644
--- a/src/video_core/query_cache.h
+++ b/src/video_core/query_cache.h
@@ -258,9 +258,9 @@ private:
void AsyncFlushQuery(VAddr addr) {
if (!uncommitted_flushes) {
- uncommitted_flushes = std::make_shared<std::unordered_set<VAddr>>();
+ uncommitted_flushes = std::make_shared<std::vector<VAddr>>();
}
- uncommitted_flushes->insert(addr);
+ uncommitted_flushes->push_back(addr);
}
static constexpr std::uintptr_t PAGE_SIZE = 4096;
@@ -276,8 +276,8 @@ private:
std::array<CounterStream, VideoCore::NumQueryTypes> streams;
- std::shared_ptr<std::unordered_set<VAddr>> uncommitted_flushes{};
- std::list<std::shared_ptr<std::unordered_set<VAddr>>> committed_flushes;
+ std::shared_ptr<std::vector<VAddr>> uncommitted_flushes{};
+ std::list<std::shared_ptr<std::vector<VAddr>>> committed_flushes;
};
template <class QueryCache, class HostCounter>
diff --git a/src/video_core/rasterizer_accelerated.h b/src/video_core/rasterizer_accelerated.h
index ea879bfdd..249644e50 100644
--- a/src/video_core/rasterizer_accelerated.h
+++ b/src/video_core/rasterizer_accelerated.h
@@ -42,7 +42,7 @@ private:
};
static_assert(sizeof(CacheEntry) == 8, "CacheEntry should be 8 bytes!");
- std::array<CacheEntry, 0x1000000> cached_pages;
+ std::array<CacheEntry, 0x2000000> cached_pages;
Core::Memory::Memory& cpu_memory;
};
diff --git a/src/video_core/renderer_vulkan/vk_master_semaphore.h b/src/video_core/renderer_vulkan/vk_master_semaphore.h
index 4f8688118..0886b7da8 100644
--- a/src/video_core/renderer_vulkan/vk_master_semaphore.h
+++ b/src/video_core/renderer_vulkan/vk_master_semaphore.h
@@ -21,12 +21,12 @@ public:
/// Returns the current logical tick.
[[nodiscard]] u64 CurrentTick() const noexcept {
- return current_tick.load(std::memory_order_relaxed);
+ return current_tick.load(std::memory_order_acquire);
}
/// Returns the last known GPU tick.
[[nodiscard]] u64 KnownGpuTick() const noexcept {
- return gpu_tick.load(std::memory_order_relaxed);
+ return gpu_tick.load(std::memory_order_acquire);
}
/// Returns the timeline semaphore handle.
@@ -41,12 +41,21 @@ public:
/// Advance to the logical tick and return the old one
[[nodiscard]] u64 NextTick() noexcept {
- return current_tick.fetch_add(1, std::memory_order::relaxed);
+ return current_tick.fetch_add(1, std::memory_order_release);
}
/// Refresh the known GPU tick
void Refresh() {
- gpu_tick.store(semaphore.GetCounter(), std::memory_order_relaxed);
+ u64 this_tick{};
+ u64 counter{};
+ do {
+ this_tick = gpu_tick.load(std::memory_order_acquire);
+ counter = semaphore.GetCounter();
+ if (counter < this_tick) {
+ return;
+ }
+ } while (!gpu_tick.compare_exchange_weak(this_tick, counter, std::memory_order_release,
+ std::memory_order_relaxed));
}
/// Waits for a tick to be hit on the GPU
diff --git a/src/video_core/renderer_vulkan/vk_query_cache.cpp b/src/video_core/renderer_vulkan/vk_query_cache.cpp
index c9cb32d71..259cba156 100644
--- a/src/video_core/renderer_vulkan/vk_query_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_query_cache.cpp
@@ -117,7 +117,8 @@ u64 HostCounter::BlockingQuery() const {
cache.GetScheduler().Wait(tick);
u64 data;
const VkResult query_result = cache.GetDevice().GetLogical().GetQueryResults(
- query.first, query.second, 1, sizeof(data), &data, sizeof(data), VK_QUERY_RESULT_64_BIT);
+ query.first, query.second, 1, sizeof(data), &data, sizeof(data),
+ VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT);
switch (query_result) {
case VK_SUCCESS:
diff --git a/src/yuzu/about_dialog.cpp b/src/yuzu/about_dialog.cpp
index 6b0155a78..04ab4ae21 100644
--- a/src/yuzu/about_dialog.cpp
+++ b/src/yuzu/about_dialog.cpp
@@ -8,7 +8,8 @@
#include "ui_aboutdialog.h"
#include "yuzu/about_dialog.h"
-AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AboutDialog) {
+AboutDialog::AboutDialog(QWidget* parent)
+ : QDialog(parent), ui{std::make_unique<Ui::AboutDialog>()} {
const auto branch_name = std::string(Common::g_scm_branch);
const auto description = std::string(Common::g_scm_desc);
const auto build_id = std::string(Common::g_build_id);
diff --git a/src/yuzu/applets/qt_controller.cpp b/src/yuzu/applets/qt_controller.cpp
index 97106d2cc..bf8445a89 100644
--- a/src/yuzu/applets/qt_controller.cpp
+++ b/src/yuzu/applets/qt_controller.cpp
@@ -37,17 +37,14 @@ constexpr std::array<std::array<bool, 4>, 8> led_patterns{{
}};
void UpdateController(Settings::ControllerType controller_type, std::size_t npad_index,
- bool connected) {
- Core::System& system{Core::System::GetInstance()};
-
+ bool connected, Core::System& system) {
if (!system.IsPoweredOn()) {
return;
}
- Service::SM::ServiceManager& sm = system.ServiceManager();
-
auto& npad =
- sm.GetService<Service::HID::Hid>("hid")
+ system.ServiceManager()
+ .GetService<Service::HID::Hid>("hid")
->GetAppletResource()
->GetController<Service::HID::Controller_NPad>(Service::HID::HidController::NPad);
@@ -79,10 +76,10 @@ bool IsControllerCompatible(Settings::ControllerType controller_type,
QtControllerSelectorDialog::QtControllerSelectorDialog(
QWidget* parent, Core::Frontend::ControllerParameters parameters_,
- InputCommon::InputSubsystem* input_subsystem_)
+ InputCommon::InputSubsystem* input_subsystem_, Core::System& system_)
: QDialog(parent), ui(std::make_unique<Ui::QtControllerSelectorDialog>()),
parameters(std::move(parameters_)), input_subsystem{input_subsystem_},
- input_profiles(std::make_unique<InputProfiles>()) {
+ input_profiles(std::make_unique<InputProfiles>(system_)), system{system_} {
ui->setupUi(this);
player_widgets = {
@@ -245,7 +242,7 @@ int QtControllerSelectorDialog::exec() {
void QtControllerSelectorDialog::ApplyConfiguration() {
const bool pre_docked_mode = Settings::values.use_docked_mode.GetValue();
Settings::values.use_docked_mode.SetValue(ui->radioDocked->isChecked());
- OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode.GetValue());
+ OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode.GetValue(), system);
Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked());
Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked());
@@ -293,7 +290,7 @@ void QtControllerSelectorDialog::CallConfigureMotionTouchDialog() {
}
void QtControllerSelectorDialog::CallConfigureInputProfileDialog() {
- ConfigureInputProfileDialog dialog(this, input_subsystem, input_profiles.get());
+ ConfigureInputProfileDialog dialog(this, input_subsystem, input_profiles.get(), system);
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
Qt::WindowSystemMenuHint);
@@ -533,7 +530,7 @@ void QtControllerSelectorDialog::UpdateControllerState(std::size_t player_index)
}
// Disconnect the controller first.
- UpdateController(controller_type, player_index, false);
+ UpdateController(controller_type, player_index, false, system);
player.controller_type = controller_type;
player.connected = player_connected;
@@ -548,7 +545,7 @@ void QtControllerSelectorDialog::UpdateControllerState(std::size_t player_index)
}
handheld.connected = player_groupboxes[player_index]->isChecked() &&
controller_type == Settings::ControllerType::Handheld;
- UpdateController(Settings::ControllerType::Handheld, 8, handheld.connected);
+ UpdateController(Settings::ControllerType::Handheld, 8, handheld.connected, system);
}
if (!player.connected) {
@@ -560,7 +557,7 @@ void QtControllerSelectorDialog::UpdateControllerState(std::size_t player_index)
using namespace std::chrono_literals;
std::this_thread::sleep_for(60ms);
- UpdateController(controller_type, player_index, player_connected);
+ UpdateController(controller_type, player_index, player_connected, system);
}
void QtControllerSelectorDialog::UpdateLEDPattern(std::size_t player_index) {
@@ -659,7 +656,8 @@ void QtControllerSelectorDialog::DisableUnsupportedPlayers() {
for (std::size_t index = max_supported_players; index < NUM_PLAYERS; ++index) {
// Disconnect any unsupported players here and disable or hide them if applicable.
Settings::values.players.GetValue()[index].connected = false;
- UpdateController(Settings::values.players.GetValue()[index].controller_type, index, false);
+ UpdateController(Settings::values.players.GetValue()[index].controller_type, index, false,
+ system);
// Hide the player widgets when max_supported_controllers is less than or equal to 4.
if (max_supported_players <= 4) {
player_widgets[index]->hide();
diff --git a/src/yuzu/applets/qt_controller.h b/src/yuzu/applets/qt_controller.h
index 9b57aea1a..037325f50 100644
--- a/src/yuzu/applets/qt_controller.h
+++ b/src/yuzu/applets/qt_controller.h
@@ -7,6 +7,7 @@
#include <array>
#include <memory>
#include <QDialog>
+#include "core/core.h"
#include "core/frontend/applets/controller.h"
class GMainWindow;
@@ -36,7 +37,8 @@ class QtControllerSelectorDialog final : public QDialog {
public:
explicit QtControllerSelectorDialog(QWidget* parent,
Core::Frontend::ControllerParameters parameters_,
- InputCommon::InputSubsystem* input_subsystem_);
+ InputCommon::InputSubsystem* input_subsystem_,
+ Core::System& system_);
~QtControllerSelectorDialog() override;
int exec() override;
@@ -103,6 +105,8 @@ private:
std::unique_ptr<InputProfiles> input_profiles;
+ Core::System& system;
+
// This is true if and only if all parameters are met. Otherwise, this is false.
// This determines whether the "OK" button can be clicked to exit the applet.
bool parameters_met{false};
diff --git a/src/yuzu/applets/qt_web_browser.cpp b/src/yuzu/applets/qt_web_browser.cpp
index 7d433ca50..da8c6882a 100644
--- a/src/yuzu/applets/qt_web_browser.cpp
+++ b/src/yuzu/applets/qt_web_browser.cpp
@@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#ifdef YUZU_USE_QT_WEB_ENGINE
+#include <QApplication>
#include <QKeyEvent>
#include <QWebEngineProfile>
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index 8b9e186b0..40fd47406 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -42,7 +42,7 @@
#include "yuzu/bootmanager.h"
#include "yuzu/main.h"
-EmuThread::EmuThread() = default;
+EmuThread::EmuThread(Core::System& system_) : system{system_} {}
EmuThread::~EmuThread() = default;
@@ -51,7 +51,6 @@ void EmuThread::run() {
MicroProfileOnThreadCreate(name.c_str());
Common::SetCurrentThreadName(name.c_str());
- auto& system = Core::System::GetInstance();
auto& gpu = system.GPU();
auto stop_token = stop_source.get_token();
@@ -87,15 +86,15 @@ void EmuThread::run() {
}
running_guard = true;
- Core::System::ResultStatus result = system.Run();
- if (result != Core::System::ResultStatus::Success) {
+ Core::SystemResultStatus result = system.Run();
+ if (result != Core::SystemResultStatus::Success) {
running_guard = false;
this->SetRunning(false);
emit ErrorThrown(result, system.GetStatusDetails());
}
running_wait.Wait();
result = system.Pause();
- if (result != Core::System::ResultStatus::Success) {
+ if (result != Core::SystemResultStatus::Success) {
running_guard = false;
this->SetRunning(false);
emit ErrorThrown(result, system.GetStatusDetails());
@@ -285,8 +284,10 @@ static Core::Frontend::EmuWindow::WindowSystemInfo GetWindowSystemInfo(QWindow*
}
GRenderWindow::GRenderWindow(GMainWindow* parent, EmuThread* emu_thread_,
- std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_)
- : QWidget(parent), emu_thread(emu_thread_), input_subsystem{std::move(input_subsystem_)} {
+ std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_,
+ Core::System& system_)
+ : QWidget(parent),
+ emu_thread(emu_thread_), input_subsystem{std::move(input_subsystem_)}, system{system_} {
setWindowTitle(QStringLiteral("yuzu %1 | %2-%3")
.arg(QString::fromUtf8(Common::g_build_name),
QString::fromUtf8(Common::g_scm_branch),
@@ -629,8 +630,7 @@ void GRenderWindow::ReleaseRenderTarget() {
}
void GRenderWindow::CaptureScreenshot(u32 res_scale, const QString& screenshot_path) {
- auto& renderer = Core::System::GetInstance().Renderer();
-
+ VideoCore::RendererBase& renderer = system.Renderer();
if (res_scale == 0) {
res_scale = VideoCore::GetResolutionScaleFactor(renderer);
}
diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h
index 54c4e2142..e6a0666e9 100644
--- a/src/yuzu/bootmanager.h
+++ b/src/yuzu/bootmanager.h
@@ -16,7 +16,6 @@
#include <QWindow>
#include "common/thread.h"
-#include "core/core.h"
#include "core/frontend/emu_window.h"
class GRenderWindow;
@@ -24,6 +23,11 @@ class GMainWindow;
class QKeyEvent;
class QStringList;
+namespace Core {
+enum class SystemResultStatus : u32;
+class System;
+} // namespace Core
+
namespace InputCommon {
class InputSubsystem;
}
@@ -34,13 +38,14 @@ enum class MouseButton;
namespace VideoCore {
enum class LoadCallbackStage;
-}
+class RendererBase;
+} // namespace VideoCore
class EmuThread final : public QThread {
Q_OBJECT
public:
- explicit EmuThread();
+ explicit EmuThread(Core::System& system_);
~EmuThread() override;
/**
@@ -101,6 +106,7 @@ private:
std::condition_variable_any running_cv;
Common::Event running_wait{};
std::atomic_bool running_guard{false};
+ Core::System& system;
signals:
/**
@@ -121,7 +127,7 @@ signals:
*/
void DebugModeLeft();
- void ErrorThrown(Core::System::ResultStatus, std::string);
+ void ErrorThrown(Core::SystemResultStatus, std::string);
void LoadProgress(VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total);
};
@@ -131,7 +137,8 @@ class GRenderWindow : public QWidget, public Core::Frontend::EmuWindow {
public:
explicit GRenderWindow(GMainWindow* parent, EmuThread* emu_thread_,
- std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_);
+ std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_,
+ Core::System& system_);
~GRenderWindow() override;
// EmuWindow implementation.
@@ -232,6 +239,8 @@ private:
std::array<std::size_t, 16> touch_ids{};
+ Core::System& system;
+
protected:
void showEvent(QShowEvent* event) override;
bool eventFilter(QObject* object, QEvent* event) override;
diff --git a/src/yuzu/compatdb.cpp b/src/yuzu/compatdb.cpp
index a470056ef..2442bb3c3 100644
--- a/src/yuzu/compatdb.cpp
+++ b/src/yuzu/compatdb.cpp
@@ -8,14 +8,13 @@
#include <QtConcurrent/qtconcurrentrun.h>
#include "common/logging/log.h"
#include "common/telemetry.h"
-#include "core/core.h"
#include "core/telemetry_session.h"
#include "ui_compatdb.h"
#include "yuzu/compatdb.h"
-CompatDB::CompatDB(QWidget* parent)
+CompatDB::CompatDB(Core::TelemetrySession& telemetry_session_, QWidget* parent)
: QWizard(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint),
- ui{std::make_unique<Ui::CompatDB>()} {
+ ui{std::make_unique<Ui::CompatDB>()}, telemetry_session{telemetry_session_} {
ui->setupUi(this);
connect(ui->radioButton_Perfect, &QRadioButton::clicked, this, &CompatDB::EnableNext);
connect(ui->radioButton_Great, &QRadioButton::clicked, this, &CompatDB::EnableNext);
@@ -53,16 +52,15 @@ void CompatDB::Submit() {
case CompatDBPage::Final:
back();
LOG_DEBUG(Frontend, "Compatibility Rating: {}", compatibility->checkedId());
- Core::System::GetInstance().TelemetrySession().AddField(
- Common::Telemetry::FieldType::UserFeedback, "Compatibility",
- compatibility->checkedId());
+ telemetry_session.AddField(Common::Telemetry::FieldType::UserFeedback, "Compatibility",
+ compatibility->checkedId());
button(NextButton)->setEnabled(false);
button(NextButton)->setText(tr("Submitting"));
button(CancelButton)->setVisible(false);
- testcase_watcher.setFuture(QtConcurrent::run(
- [] { return Core::System::GetInstance().TelemetrySession().SubmitTestcase(); }));
+ testcase_watcher.setFuture(
+ QtConcurrent::run([this] { return telemetry_session.SubmitTestcase(); }));
break;
default:
LOG_ERROR(Frontend, "Unexpected page: {}", currentId());
diff --git a/src/yuzu/compatdb.h b/src/yuzu/compatdb.h
index 5381f67f7..e2b2522bd 100644
--- a/src/yuzu/compatdb.h
+++ b/src/yuzu/compatdb.h
@@ -7,6 +7,7 @@
#include <memory>
#include <QFutureWatcher>
#include <QWizard>
+#include "core/telemetry_session.h"
namespace Ui {
class CompatDB;
@@ -16,7 +17,7 @@ class CompatDB : public QWizard {
Q_OBJECT
public:
- explicit CompatDB(QWidget* parent = nullptr);
+ explicit CompatDB(Core::TelemetrySession& telemetry_session_, QWidget* parent = nullptr);
~CompatDB();
private:
@@ -27,4 +28,6 @@ private:
void Submit();
void OnTestcaseSubmitted();
void EnableNext();
+
+ Core::TelemetrySession& telemetry_session;
};
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index eb941ce02..30a864135 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -16,7 +16,8 @@
namespace FS = Common::FS;
-Config::Config(const std::string& config_name, ConfigType config_type) : type(config_type) {
+Config::Config(Core::System& system_, const std::string& config_name, ConfigType config_type)
+ : type(config_type), system{system_} {
global = config_type == ConfigType::GlobalConfig;
Initialize(config_name);
@@ -1593,7 +1594,7 @@ void Config::Reload() {
ReadValues();
// To apply default value changes
SaveValues();
- Core::System::GetInstance().ApplySettings();
+ system.ApplySettings();
}
void Config::Save() {
diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h
index 3ee694e7c..a7f4a6720 100644
--- a/src/yuzu/configuration/config.h
+++ b/src/yuzu/configuration/config.h
@@ -14,6 +14,10 @@
class QSettings;
+namespace Core {
+class System;
+}
+
class Config {
public:
enum class ConfigType {
@@ -22,7 +26,7 @@ public:
InputProfile,
};
- explicit Config(const std::string& config_name = "qt-config",
+ explicit Config(Core::System& system_, const std::string& config_name = "qt-config",
ConfigType config_type = ConfigType::GlobalConfig);
~Config();
@@ -176,6 +180,8 @@ private:
std::unique_ptr<QSettings> qt_config;
std::string qt_config_loc;
bool global;
+
+ Core::System& system;
};
// These metatype declarations cannot be in common/settings.h because core is devoid of QT
diff --git a/src/yuzu/configuration/configure.ui b/src/yuzu/configuration/configure.ui
index 6258dcf20..eb8078467 100644
--- a/src/yuzu/configuration/configure.ui
+++ b/src/yuzu/configuration/configure.ui
@@ -41,120 +41,8 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
- <number>11</number>
+ <number>-1</number>
</property>
- <widget class="ConfigureGeneral" name="generalTab">
- <property name="accessibleName">
- <string>General</string>
- </property>
- <attribute name="title">
- <string>General</string>
- </attribute>
- </widget>
- <widget class="ConfigureUi" name="uiTab">
- <property name="accessibleName">
- <string>UI</string>
- </property>
- <attribute name="title">
- <string>Game List</string>
- </attribute>
- </widget>
- <widget class="ConfigureSystem" name="systemTab">
- <property name="accessibleName">
- <string>System</string>
- </property>
- <attribute name="title">
- <string>System</string>
- </attribute>
- </widget>
- <widget class="ConfigureProfileManager" name="profileManagerTab">
- <property name="accessibleName">
- <string>Profiles</string>
- </property>
- <attribute name="title">
- <string>Profiles</string>
- </attribute>
- </widget>
- <widget class="ConfigureFilesystem" name="filesystemTab">
- <property name="accessibleName">
- <string>Filesystem</string>
- </property>
- <attribute name="title">
- <string>Filesystem</string>
- </attribute>
- </widget>
- <widget class="ConfigureInput" name="inputTab">
- <property name="accessibleName">
- <string>Controls</string>
- </property>
- <attribute name="title">
- <string>Controls</string>
- </attribute>
- </widget>
- <widget class="ConfigureHotkeys" name="hotkeysTab">
- <property name="accessibleName">
- <string>Hotkeys</string>
- </property>
- <attribute name="title">
- <string>Hotkeys</string>
- </attribute>
- </widget>
- <widget class="ConfigureCpu" name="cpuTab">
- <property name="accessibleName">
- <string>CPU</string>
- </property>
- <attribute name="title">
- <string>CPU</string>
- </attribute>
- </widget>
- <widget class="ConfigureGraphics" name="graphicsTab">
- <property name="accessibleName">
- <string>Graphics</string>
- </property>
- <attribute name="title">
- <string>Graphics</string>
- </attribute>
- </widget>
- <widget class="ConfigureGraphicsAdvanced" name="graphicsAdvancedTab">
- <property name="accessibleName">
- <string>Advanced</string>
- </property>
- <attribute name="title">
- <string>GraphicsAdvanced</string>
- </attribute>
- </widget>
- <widget class="ConfigureAudio" name="audioTab">
- <property name="accessibleName">
- <string>Audio</string>
- </property>
- <attribute name="title">
- <string>Audio</string>
- </attribute>
- </widget>
- <widget class="ConfigureDebugTab" name="debugTab">
- <property name="accessibleName">
- <string>Debug</string>
- </property>
- <attribute name="title">
- <string>Debug</string>
- </attribute>
- </widget>
- <widget class="ConfigureWeb" name="webTab">
- <property name="accessibleName">
- <string>Web</string>
- </property>
- <attribute name="title">
- <string>Web</string>
- </attribute>
- </widget>
- <widget class="ConfigureNetwork" name="networkTab">
- <property name="accessibleName">
- <string>Network</string>
- </property>
- <attribute name="title">
- <string>Network</string>
- </attribute>
- </widget>
</widget>
</item>
</layout>
@@ -168,92 +56,6 @@
</item>
</layout>
</widget>
- <customwidgets>
- <customwidget>
- <class>ConfigureGeneral</class>
- <extends>QWidget</extends>
- <header>configuration/configure_general.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureSystem</class>
- <extends>QWidget</extends>
- <header>configuration/configure_system.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureProfileManager</class>
- <extends>QWidget</extends>
- <header>configuration/configure_profile_manager.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureFilesystem</class>
- <extends>QWidget</extends>
- <header>configuration/configure_filesystem.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureAudio</class>
- <extends>QWidget</extends>
- <header>configuration/configure_audio.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureCpu</class>
- <extends>QWidget</extends>
- <header>configuration/configure_cpu.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureGraphics</class>
- <extends>QWidget</extends>
- <header>configuration/configure_graphics.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureGraphicsAdvanced</class>
- <extends>QWidget</extends>
- <header>configuration/configure_graphics_advanced.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureWeb</class>
- <extends>QWidget</extends>
- <header>configuration/configure_web.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureUi</class>
- <extends>QWidget</extends>
- <header>configuration/configure_ui.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureInput</class>
- <extends>QWidget</extends>
- <header>configuration/configure_input.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureHotkeys</class>
- <extends>QWidget</extends>
- <header>configuration/configure_hotkeys.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureNetwork</class>
- <extends>QWidget</extends>
- <header>configuration/configure_network.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureDebugTab</class>
- <extends>QWidget</extends>
- <header>configuration/configure_debug_tab.h</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
<resources/>
<connections>
<connection>
diff --git a/src/yuzu/configuration/configure_audio.cpp b/src/yuzu/configuration/configure_audio.cpp
index f437cb53d..c33488718 100644
--- a/src/yuzu/configuration/configure_audio.cpp
+++ b/src/yuzu/configuration/configure_audio.cpp
@@ -14,8 +14,8 @@
#include "yuzu/configuration/configuration_shared.h"
#include "yuzu/configuration/configure_audio.h"
-ConfigureAudio::ConfigureAudio(QWidget* parent)
- : QWidget(parent), ui(std::make_unique<Ui::ConfigureAudio>()) {
+ConfigureAudio::ConfigureAudio(const Core::System& system_, QWidget* parent)
+ : QWidget(parent), ui(std::make_unique<Ui::ConfigureAudio>()), system{system_} {
ui->setupUi(this);
InitializeAudioOutputSinkComboBox();
@@ -32,7 +32,7 @@ ConfigureAudio::ConfigureAudio(QWidget* parent)
SetConfiguration();
- const bool is_powered_on = Core::System::GetInstance().IsPoweredOn();
+ const bool is_powered_on = system_.IsPoweredOn();
ui->output_sink_combo_box->setEnabled(!is_powered_on);
ui->audio_device_combo_box->setEnabled(!is_powered_on);
}
diff --git a/src/yuzu/configuration/configure_audio.h b/src/yuzu/configuration/configure_audio.h
index 5a01c8de7..5d2d05e47 100644
--- a/src/yuzu/configuration/configure_audio.h
+++ b/src/yuzu/configuration/configure_audio.h
@@ -7,6 +7,10 @@
#include <memory>
#include <QWidget>
+namespace Core {
+class System;
+}
+
namespace ConfigurationShared {
enum class CheckState;
}
@@ -19,10 +23,11 @@ class ConfigureAudio : public QWidget {
Q_OBJECT
public:
- explicit ConfigureAudio(QWidget* parent = nullptr);
+ explicit ConfigureAudio(const Core::System& system_, QWidget* parent = nullptr);
~ConfigureAudio() override;
void ApplyConfiguration();
+ void SetConfiguration();
private:
void changeEvent(QEvent* event) override;
@@ -33,7 +38,6 @@ private:
void UpdateAudioDevices(int sink_index);
- void SetConfiguration();
void SetOutputSinkFromSinkID();
void SetAudioDeviceFromDeviceID();
void SetVolumeIndicatorText(int percentage);
@@ -41,4 +45,6 @@ private:
void SetupPerGameUI();
std::unique_ptr<Ui::ConfigureAudio> ui;
+
+ const Core::System& system;
};
diff --git a/src/yuzu/configuration/configure_audio.ui b/src/yuzu/configuration/configure_audio.ui
index bf736fc2c..d1ac8ad02 100644
--- a/src/yuzu/configuration/configure_audio.ui
+++ b/src/yuzu/configuration/configure_audio.ui
@@ -10,6 +10,9 @@
<height>368</height>
</rect>
</property>
+ <property name="accessibleName">
+ <string>Audio</string>
+ </property>
<layout class="QVBoxLayout">
<item>
<widget class="QGroupBox" name="groupBox">
diff --git a/src/yuzu/configuration/configure_cpu.cpp b/src/yuzu/configuration/configure_cpu.cpp
index 784b6484e..f66cab5d4 100644
--- a/src/yuzu/configuration/configure_cpu.cpp
+++ b/src/yuzu/configuration/configure_cpu.cpp
@@ -13,7 +13,8 @@
#include "yuzu/configuration/configuration_shared.h"
#include "yuzu/configuration/configure_cpu.h"
-ConfigureCpu::ConfigureCpu(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureCpu) {
+ConfigureCpu::ConfigureCpu(const Core::System& system_, QWidget* parent)
+ : QWidget(parent), ui{std::make_unique<Ui::ConfigureCpu>()}, system{system_} {
ui->setupUi(this);
SetupPerGameUI();
@@ -27,7 +28,7 @@ ConfigureCpu::ConfigureCpu(QWidget* parent) : QWidget(parent), ui(new Ui::Config
ConfigureCpu::~ConfigureCpu() = default;
void ConfigureCpu::SetConfiguration() {
- const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn();
+ const bool runtime_lock = !system.IsPoweredOn();
ui->accuracy->setEnabled(runtime_lock);
ui->cpuopt_unsafe_unfuse_fma->setEnabled(runtime_lock);
diff --git a/src/yuzu/configuration/configure_cpu.h b/src/yuzu/configuration/configure_cpu.h
index 154931482..ed9af0e9f 100644
--- a/src/yuzu/configuration/configure_cpu.h
+++ b/src/yuzu/configuration/configure_cpu.h
@@ -8,6 +8,10 @@
#include <QWidget>
#include "common/settings.h"
+namespace Core {
+class System;
+}
+
namespace ConfigurationShared {
enum class CheckState;
}
@@ -20,10 +24,11 @@ class ConfigureCpu : public QWidget {
Q_OBJECT
public:
- explicit ConfigureCpu(QWidget* parent = nullptr);
+ explicit ConfigureCpu(const Core::System& system_, QWidget* parent = nullptr);
~ConfigureCpu() override;
void ApplyConfiguration();
+ void SetConfiguration();
private:
void changeEvent(QEvent* event) override;
@@ -31,8 +36,6 @@ private:
void UpdateGroup(int index);
- void SetConfiguration();
-
void SetupPerGameUI();
std::unique_ptr<Ui::ConfigureCpu> ui;
@@ -42,4 +45,6 @@ private:
ConfigurationShared::CheckState cpuopt_unsafe_ignore_standard_fpcr;
ConfigurationShared::CheckState cpuopt_unsafe_inaccurate_nan;
ConfigurationShared::CheckState cpuopt_unsafe_fastmem_check;
+
+ const Core::System& system;
};
diff --git a/src/yuzu/configuration/configure_cpu.ui b/src/yuzu/configuration/configure_cpu.ui
index 5b9457faf..d8064db24 100644
--- a/src/yuzu/configuration/configure_cpu.ui
+++ b/src/yuzu/configuration/configure_cpu.ui
@@ -7,12 +7,15 @@
<x>0</x>
<y>0</y>
<width>448</width>
- <height>433</height>
+ <height>439</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
+ <property name="accessibleName">
+ <string>CPU</string>
+ </property>
<layout class="QVBoxLayout">
<item>
<layout class="QVBoxLayout">
diff --git a/src/yuzu/configuration/configure_cpu_debug.cpp b/src/yuzu/configuration/configure_cpu_debug.cpp
index 98e2d2be5..05a90963d 100644
--- a/src/yuzu/configuration/configure_cpu_debug.cpp
+++ b/src/yuzu/configuration/configure_cpu_debug.cpp
@@ -11,8 +11,8 @@
#include "ui_configure_cpu_debug.h"
#include "yuzu/configuration/configure_cpu_debug.h"
-ConfigureCpuDebug::ConfigureCpuDebug(QWidget* parent)
- : QWidget(parent), ui(new Ui::ConfigureCpuDebug) {
+ConfigureCpuDebug::ConfigureCpuDebug(const Core::System& system_, QWidget* parent)
+ : QWidget(parent), ui{std::make_unique<Ui::ConfigureCpuDebug>()}, system{system_} {
ui->setupUi(this);
SetConfiguration();
@@ -21,7 +21,7 @@ ConfigureCpuDebug::ConfigureCpuDebug(QWidget* parent)
ConfigureCpuDebug::~ConfigureCpuDebug() = default;
void ConfigureCpuDebug::SetConfiguration() {
- const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn();
+ const bool runtime_lock = !system.IsPoweredOn();
ui->cpuopt_page_tables->setEnabled(runtime_lock);
ui->cpuopt_page_tables->setChecked(Settings::values.cpuopt_page_tables.GetValue());
diff --git a/src/yuzu/configuration/configure_cpu_debug.h b/src/yuzu/configuration/configure_cpu_debug.h
index 1b0d8050c..d06c4c63f 100644
--- a/src/yuzu/configuration/configure_cpu_debug.h
+++ b/src/yuzu/configuration/configure_cpu_debug.h
@@ -7,6 +7,10 @@
#include <memory>
#include <QWidget>
+namespace Core {
+class System;
+}
+
namespace Ui {
class ConfigureCpuDebug;
}
@@ -15,7 +19,7 @@ class ConfigureCpuDebug : public QWidget {
Q_OBJECT
public:
- explicit ConfigureCpuDebug(QWidget* parent = nullptr);
+ explicit ConfigureCpuDebug(const Core::System& system_, QWidget* parent = nullptr);
~ConfigureCpuDebug() override;
void ApplyConfiguration();
@@ -27,4 +31,6 @@ private:
void SetConfiguration();
std::unique_ptr<Ui::ConfigureCpuDebug> ui;
+
+ const Core::System& system;
};
diff --git a/src/yuzu/configuration/configure_cpu_debug.ui b/src/yuzu/configuration/configure_cpu_debug.ui
index abf469b55..6e635bb2f 100644
--- a/src/yuzu/configuration/configure_cpu_debug.ui
+++ b/src/yuzu/configuration/configure_cpu_debug.ui
@@ -13,6 +13,9 @@
<property name="windowTitle">
<string>Form</string>
</property>
+ <property name="accessibleName">
+ <string>CPU</string>
+ </property>
<layout class="QVBoxLayout">
<item>
<layout class="QVBoxLayout">
diff --git a/src/yuzu/configuration/configure_debug.cpp b/src/yuzu/configuration/configure_debug.cpp
index c0b240c1e..07bfa0360 100644
--- a/src/yuzu/configuration/configure_debug.cpp
+++ b/src/yuzu/configuration/configure_debug.cpp
@@ -14,7 +14,8 @@
#include "yuzu/debugger/console.h"
#include "yuzu/uisettings.h"
-ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureDebug) {
+ConfigureDebug::ConfigureDebug(const Core::System& system_, QWidget* parent)
+ : QWidget(parent), ui{std::make_unique<Ui::ConfigureDebug>()}, system{system_} {
ui->setupUi(this);
SetConfiguration();
@@ -28,7 +29,7 @@ ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::Co
ConfigureDebug::~ConfigureDebug() = default;
void ConfigureDebug::SetConfiguration() {
- const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn();
+ const bool runtime_lock = !system.IsPoweredOn();
ui->toggle_console->setEnabled(runtime_lock);
ui->toggle_console->setChecked(UISettings::values.show_console.GetValue());
diff --git a/src/yuzu/configuration/configure_debug.h b/src/yuzu/configuration/configure_debug.h
index f4805a1d8..73f71c9e3 100644
--- a/src/yuzu/configuration/configure_debug.h
+++ b/src/yuzu/configuration/configure_debug.h
@@ -7,6 +7,10 @@
#include <memory>
#include <QWidget>
+namespace Core {
+class System;
+}
+
namespace Ui {
class ConfigureDebug;
}
@@ -15,7 +19,7 @@ class ConfigureDebug : public QWidget {
Q_OBJECT
public:
- explicit ConfigureDebug(QWidget* parent = nullptr);
+ explicit ConfigureDebug(const Core::System& system_, QWidget* parent = nullptr);
~ConfigureDebug() override;
void ApplyConfiguration();
@@ -27,4 +31,6 @@ private:
void SetConfiguration();
std::unique_ptr<Ui::ConfigureDebug> ui;
+
+ const Core::System& system;
};
diff --git a/src/yuzu/configuration/configure_debug_controller.cpp b/src/yuzu/configuration/configure_debug_controller.cpp
index a878ef9c6..31ec48384 100644
--- a/src/yuzu/configuration/configure_debug_controller.cpp
+++ b/src/yuzu/configuration/configure_debug_controller.cpp
@@ -2,16 +2,17 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include "core/core.h"
#include "ui_configure_debug_controller.h"
#include "yuzu/configuration/configure_debug_controller.h"
#include "yuzu/configuration/configure_input_player.h"
ConfigureDebugController::ConfigureDebugController(QWidget* parent,
InputCommon::InputSubsystem* input_subsystem,
- InputProfiles* profiles)
+ InputProfiles* profiles, Core::System& system)
: QDialog(parent), ui(std::make_unique<Ui::ConfigureDebugController>()),
debug_controller(
- new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles, true)) {
+ new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles, system, true)) {
ui->setupUi(this);
ui->controllerLayout->addWidget(debug_controller);
diff --git a/src/yuzu/configuration/configure_debug_controller.h b/src/yuzu/configuration/configure_debug_controller.h
index b4f53fad5..6e17c5aa0 100644
--- a/src/yuzu/configuration/configure_debug_controller.h
+++ b/src/yuzu/configuration/configure_debug_controller.h
@@ -13,6 +13,10 @@ class ConfigureInputPlayer;
class InputProfiles;
+namespace Core {
+class System;
+}
+
namespace InputCommon {
class InputSubsystem;
}
@@ -26,7 +30,7 @@ class ConfigureDebugController : public QDialog {
public:
explicit ConfigureDebugController(QWidget* parent, InputCommon::InputSubsystem* input_subsystem,
- InputProfiles* profiles);
+ InputProfiles* profiles, Core::System& system);
~ConfigureDebugController() override;
void ApplyConfiguration();
diff --git a/src/yuzu/configuration/configure_debug_tab.cpp b/src/yuzu/configuration/configure_debug_tab.cpp
index 67d369249..e69cca1ef 100644
--- a/src/yuzu/configuration/configure_debug_tab.cpp
+++ b/src/yuzu/configuration/configure_debug_tab.cpp
@@ -2,21 +2,29 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include <memory>
#include "ui_configure_debug_tab.h"
+#include "yuzu/configuration/configure_cpu_debug.h"
+#include "yuzu/configuration/configure_debug.h"
#include "yuzu/configuration/configure_debug_tab.h"
-ConfigureDebugTab::ConfigureDebugTab(QWidget* parent)
- : QWidget(parent), ui(new Ui::ConfigureDebugTab) {
+ConfigureDebugTab::ConfigureDebugTab(const Core::System& system_, QWidget* parent)
+ : QWidget(parent), ui{std::make_unique<Ui::ConfigureDebugTab>()},
+ debug_tab{std::make_unique<ConfigureDebug>(system_, this)},
+ cpu_debug_tab{std::make_unique<ConfigureCpuDebug>(system_, this)} {
ui->setupUi(this);
+ ui->tabWidget->addTab(debug_tab.get(), tr("Debug"));
+ ui->tabWidget->addTab(cpu_debug_tab.get(), tr("CPU"));
+
SetConfiguration();
}
ConfigureDebugTab::~ConfigureDebugTab() = default;
void ConfigureDebugTab::ApplyConfiguration() {
- ui->debugTab->ApplyConfiguration();
- ui->cpuDebugTab->ApplyConfiguration();
+ debug_tab->ApplyConfiguration();
+ cpu_debug_tab->ApplyConfiguration();
}
void ConfigureDebugTab::SetCurrentIndex(int index) {
diff --git a/src/yuzu/configuration/configure_debug_tab.h b/src/yuzu/configuration/configure_debug_tab.h
index 0a96d43d0..4f68260aa 100644
--- a/src/yuzu/configuration/configure_debug_tab.h
+++ b/src/yuzu/configuration/configure_debug_tab.h
@@ -7,6 +7,13 @@
#include <memory>
#include <QWidget>
+class ConfigureDebug;
+class ConfigureCpuDebug;
+
+namespace Core {
+class System;
+}
+
namespace Ui {
class ConfigureDebugTab;
}
@@ -15,7 +22,7 @@ class ConfigureDebugTab : public QWidget {
Q_OBJECT
public:
- explicit ConfigureDebugTab(QWidget* parent = nullptr);
+ explicit ConfigureDebugTab(const Core::System& system_, QWidget* parent = nullptr);
~ConfigureDebugTab() override;
void ApplyConfiguration();
@@ -29,4 +36,7 @@ private:
void SetConfiguration();
std::unique_ptr<Ui::ConfigureDebugTab> ui;
+
+ std::unique_ptr<ConfigureDebug> debug_tab;
+ std::unique_ptr<ConfigureCpuDebug> cpu_debug_tab;
};
diff --git a/src/yuzu/configuration/configure_debug_tab.ui b/src/yuzu/configuration/configure_debug_tab.ui
index 7dc6dd704..15ec74727 100644
--- a/src/yuzu/configuration/configure_debug_tab.ui
+++ b/src/yuzu/configuration/configure_debug_tab.ui
@@ -13,40 +13,19 @@
<property name="windowTitle">
<string>Form</string>
</property>
+ <property name="accessibleName">
+ <string>Debug</string>
+ </property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
- <number>1</number>
+ <number>-1</number>
</property>
- <widget class="ConfigureDebug" name="debugTab">
- <attribute name="title">
- <string>General</string>
- </attribute>
- </widget>
- <widget class="ConfigureCpuDebug" name="cpuDebugTab">
- <attribute name="title">
- <string>CPU</string>
- </attribute>
- </widget>
</widget>
</item>
</layout>
</widget>
- <customwidgets>
- <customwidget>
- <class>ConfigureDebug</class>
- <extends>QWidget</extends>
- <header>configuration/configure_debug.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureCpuDebug</class>
- <extends>QWidget</extends>
- <header>configuration/configure_cpu_debug.h</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
<resources/>
<connections/>
</ui>
diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp
index fe4186157..4fa0c4a43 100644
--- a/src/yuzu/configuration/configure_dialog.cpp
+++ b/src/yuzu/configuration/configure_dialog.cpp
@@ -2,6 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include <memory>
#include <QAbstractButton>
#include <QDialogButtonBox>
#include <QHash>
@@ -9,37 +10,84 @@
#include <QPushButton>
#include <QSignalBlocker>
#include <QTabWidget>
+#include "common/logging/log.h"
#include "common/settings.h"
#include "core/core.h"
#include "ui_configure.h"
#include "yuzu/configuration/config.h"
+#include "yuzu/configuration/configure_audio.h"
+#include "yuzu/configuration/configure_cpu.h"
+#include "yuzu/configuration/configure_debug_tab.h"
#include "yuzu/configuration/configure_dialog.h"
+#include "yuzu/configuration/configure_filesystem.h"
+#include "yuzu/configuration/configure_general.h"
+#include "yuzu/configuration/configure_graphics.h"
+#include "yuzu/configuration/configure_graphics_advanced.h"
+#include "yuzu/configuration/configure_hotkeys.h"
+#include "yuzu/configuration/configure_input.h"
#include "yuzu/configuration/configure_input_player.h"
+#include "yuzu/configuration/configure_network.h"
+#include "yuzu/configuration/configure_profile_manager.h"
+#include "yuzu/configuration/configure_system.h"
+#include "yuzu/configuration/configure_ui.h"
+#include "yuzu/configuration/configure_web.h"
#include "yuzu/hotkeys.h"
ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry,
- InputCommon::InputSubsystem* input_subsystem)
- : QDialog(parent), ui(new Ui::ConfigureDialog), registry(registry) {
+ InputCommon::InputSubsystem* input_subsystem,
+ Core::System& system_)
+ : QDialog(parent), ui{std::make_unique<Ui::ConfigureDialog>()},
+ registry(registry), system{system_}, audio_tab{std::make_unique<ConfigureAudio>(system_,
+ this)},
+ cpu_tab{std::make_unique<ConfigureCpu>(system_, this)},
+ debug_tab_tab{std::make_unique<ConfigureDebugTab>(system_, this)},
+ filesystem_tab{std::make_unique<ConfigureFilesystem>(this)},
+ general_tab{std::make_unique<ConfigureGeneral>(system_, this)},
+ graphics_tab{std::make_unique<ConfigureGraphics>(system_, this)},
+ graphics_advanced_tab{std::make_unique<ConfigureGraphicsAdvanced>(system_, this)},
+ hotkeys_tab{std::make_unique<ConfigureHotkeys>(this)},
+ input_tab{std::make_unique<ConfigureInput>(system_, this)},
+ network_tab{std::make_unique<ConfigureNetwork>(system_, this)},
+ profile_tab{std::make_unique<ConfigureProfileManager>(system_, this)},
+ system_tab{std::make_unique<ConfigureSystem>(system_, this)},
+ ui_tab{std::make_unique<ConfigureUi>(system_, this)}, web_tab{std::make_unique<ConfigureWeb>(
+ this)} {
Settings::SetConfiguringGlobal(true);
ui->setupUi(this);
- ui->hotkeysTab->Populate(registry);
+
+ ui->tabWidget->addTab(audio_tab.get(), tr("Audio"));
+ ui->tabWidget->addTab(cpu_tab.get(), tr("CPU"));
+ ui->tabWidget->addTab(debug_tab_tab.get(), tr("Debug"));
+ ui->tabWidget->addTab(filesystem_tab.get(), tr("Filesystem"));
+ ui->tabWidget->addTab(general_tab.get(), tr("General"));
+ ui->tabWidget->addTab(graphics_tab.get(), tr("Graphics"));
+ ui->tabWidget->addTab(graphics_advanced_tab.get(), tr("GraphicsAdvanced"));
+ ui->tabWidget->addTab(hotkeys_tab.get(), tr("Hotkeys"));
+ ui->tabWidget->addTab(input_tab.get(), tr("Controls"));
+ ui->tabWidget->addTab(profile_tab.get(), tr("Profiles"));
+ ui->tabWidget->addTab(network_tab.get(), tr("Network"));
+ ui->tabWidget->addTab(system_tab.get(), tr("System"));
+ ui->tabWidget->addTab(ui_tab.get(), tr("Game List"));
+ ui->tabWidget->addTab(web_tab.get(), tr("Web"));
+
+ hotkeys_tab->Populate(registry);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
- ui->inputTab->Initialize(input_subsystem);
+ input_tab->Initialize(input_subsystem);
- ui->generalTab->SetResetCallback([&] { this->close(); });
+ general_tab->SetResetCallback([&] { this->close(); });
SetConfiguration();
PopulateSelectionList();
connect(ui->tabWidget, &QTabWidget::currentChanged, this,
- [this]() { ui->debugTab->SetCurrentIndex(0); });
- connect(ui->uiTab, &ConfigureUi::LanguageChanged, this, &ConfigureDialog::OnLanguageChanged);
+ [this]() { debug_tab_tab->SetCurrentIndex(0); });
+ connect(ui_tab.get(), &ConfigureUi::LanguageChanged, this, &ConfigureDialog::OnLanguageChanged);
connect(ui->selectorList, &QListWidget::itemSelectionChanged, this,
&ConfigureDialog::UpdateVisibleTabs);
- if (Core::System::GetInstance().IsPoweredOn()) {
+ if (system.IsPoweredOn()) {
QPushButton* apply_button = ui->buttonBox->addButton(QDialogButtonBox::Apply);
connect(apply_button, &QAbstractButton::clicked, this,
&ConfigureDialog::HandleApplyButtonClicked);
@@ -54,21 +102,21 @@ ConfigureDialog::~ConfigureDialog() = default;
void ConfigureDialog::SetConfiguration() {}
void ConfigureDialog::ApplyConfiguration() {
- ui->generalTab->ApplyConfiguration();
- ui->uiTab->ApplyConfiguration();
- ui->systemTab->ApplyConfiguration();
- ui->profileManagerTab->ApplyConfiguration();
- ui->filesystemTab->applyConfiguration();
- ui->inputTab->ApplyConfiguration();
- ui->hotkeysTab->ApplyConfiguration(registry);
- ui->cpuTab->ApplyConfiguration();
- ui->graphicsTab->ApplyConfiguration();
- ui->graphicsAdvancedTab->ApplyConfiguration();
- ui->audioTab->ApplyConfiguration();
- ui->debugTab->ApplyConfiguration();
- ui->webTab->ApplyConfiguration();
- ui->networkTab->ApplyConfiguration();
- Core::System::GetInstance().ApplySettings();
+ general_tab->ApplyConfiguration();
+ ui_tab->ApplyConfiguration();
+ system_tab->ApplyConfiguration();
+ profile_tab->ApplyConfiguration();
+ filesystem_tab->applyConfiguration();
+ input_tab->ApplyConfiguration();
+ hotkeys_tab->ApplyConfiguration(registry);
+ cpu_tab->ApplyConfiguration();
+ graphics_tab->ApplyConfiguration();
+ graphics_advanced_tab->ApplyConfiguration();
+ audio_tab->ApplyConfiguration();
+ debug_tab_tab->ApplyConfiguration();
+ web_tab->ApplyConfiguration();
+ network_tab->ApplyConfiguration();
+ system.ApplySettings();
Settings::LogSettings();
}
@@ -102,12 +150,14 @@ Q_DECLARE_METATYPE(QList<QWidget*>);
void ConfigureDialog::PopulateSelectionList() {
const std::array<std::pair<QString, QList<QWidget*>>, 6> items{
- {{tr("General"), {ui->generalTab, ui->hotkeysTab, ui->uiTab, ui->webTab, ui->debugTab}},
- {tr("System"), {ui->systemTab, ui->profileManagerTab, ui->networkTab, ui->filesystemTab}},
- {tr("CPU"), {ui->cpuTab}},
- {tr("Graphics"), {ui->graphicsTab, ui->graphicsAdvancedTab}},
- {tr("Audio"), {ui->audioTab}},
- {tr("Controls"), ui->inputTab->GetSubTabs()}},
+ {{tr("General"),
+ {general_tab.get(), hotkeys_tab.get(), ui_tab.get(), web_tab.get(), debug_tab_tab.get()}},
+ {tr("System"),
+ {system_tab.get(), profile_tab.get(), network_tab.get(), filesystem_tab.get()}},
+ {tr("CPU"), {cpu_tab.get()}},
+ {tr("Graphics"), {graphics_tab.get(), graphics_advanced_tab.get()}},
+ {tr("Audio"), {audio_tab.get()}},
+ {tr("Controls"), input_tab->GetSubTabs()}},
};
[[maybe_unused]] const QSignalBlocker blocker(ui->selectorList);
@@ -142,6 +192,7 @@ void ConfigureDialog::UpdateVisibleTabs() {
const auto tabs = qvariant_cast<QList<QWidget*>>(items[0]->data(Qt::UserRole));
for (auto* const tab : tabs) {
+ LOG_DEBUG(Frontend, "{}", tab->accessibleName().toStdString());
ui->tabWidget->addTab(tab, tab->accessibleName());
}
}
diff --git a/src/yuzu/configuration/configure_dialog.h b/src/yuzu/configuration/configure_dialog.h
index abe019635..32ddfd4e0 100644
--- a/src/yuzu/configuration/configure_dialog.h
+++ b/src/yuzu/configuration/configure_dialog.h
@@ -7,6 +7,25 @@
#include <memory>
#include <QDialog>
+namespace Core {
+class System;
+}
+
+class ConfigureAudio;
+class ConfigureCpu;
+class ConfigureDebugTab;
+class ConfigureFilesystem;
+class ConfigureGeneral;
+class ConfigureGraphics;
+class ConfigureGraphicsAdvanced;
+class ConfigureHotkeys;
+class ConfigureInput;
+class ConfigureProfileManager;
+class ConfigureSystem;
+class ConfigureNetwork;
+class ConfigureUi;
+class ConfigureWeb;
+
class HotkeyRegistry;
namespace InputCommon {
@@ -22,7 +41,7 @@ class ConfigureDialog : public QDialog {
public:
explicit ConfigureDialog(QWidget* parent, HotkeyRegistry& registry,
- InputCommon::InputSubsystem* input_subsystem);
+ InputCommon::InputSubsystem* input_subsystem, Core::System& system_);
~ConfigureDialog() override;
void ApplyConfiguration();
@@ -45,4 +64,21 @@ private:
std::unique_ptr<Ui::ConfigureDialog> ui;
HotkeyRegistry& registry;
+
+ Core::System& system;
+
+ std::unique_ptr<ConfigureAudio> audio_tab;
+ std::unique_ptr<ConfigureCpu> cpu_tab;
+ std::unique_ptr<ConfigureDebugTab> debug_tab_tab;
+ std::unique_ptr<ConfigureFilesystem> filesystem_tab;
+ std::unique_ptr<ConfigureGeneral> general_tab;
+ std::unique_ptr<ConfigureGraphics> graphics_tab;
+ std::unique_ptr<ConfigureGraphicsAdvanced> graphics_advanced_tab;
+ std::unique_ptr<ConfigureHotkeys> hotkeys_tab;
+ std::unique_ptr<ConfigureInput> input_tab;
+ std::unique_ptr<ConfigureNetwork> network_tab;
+ std::unique_ptr<ConfigureProfileManager> profile_tab;
+ std::unique_ptr<ConfigureSystem> system_tab;
+ std::unique_ptr<ConfigureUi> ui_tab;
+ std::unique_ptr<ConfigureWeb> web_tab;
};
diff --git a/src/yuzu/configuration/configure_filesystem.ui b/src/yuzu/configuration/configure_filesystem.ui
index 62b9abc7a..2f6030b5c 100644
--- a/src/yuzu/configuration/configure_filesystem.ui
+++ b/src/yuzu/configuration/configure_filesystem.ui
@@ -13,6 +13,9 @@
<property name="windowTitle">
<string>Form</string>
</property>
+ <property name="accessibleName">
+ <string>Filesystem</string>
+ </property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp
index 1f647a0d1..7af3ea97e 100644
--- a/src/yuzu/configuration/configure_general.cpp
+++ b/src/yuzu/configuration/configure_general.cpp
@@ -15,8 +15,8 @@
#include "yuzu/configuration/configure_general.h"
#include "yuzu/uisettings.h"
-ConfigureGeneral::ConfigureGeneral(QWidget* parent)
- : QWidget(parent), ui(new Ui::ConfigureGeneral) {
+ConfigureGeneral::ConfigureGeneral(const Core::System& system_, QWidget* parent)
+ : QWidget(parent), ui{std::make_unique<Ui::ConfigureGeneral>()}, system{system_} {
ui->setupUi(this);
SetupPerGameUI();
@@ -35,7 +35,7 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
ConfigureGeneral::~ConfigureGeneral() = default;
void ConfigureGeneral::SetConfiguration() {
- const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn();
+ const bool runtime_lock = !system.IsPoweredOn();
ui->use_multi_core->setEnabled(runtime_lock);
ui->use_multi_core->setChecked(Settings::values.use_multi_core.GetValue());
diff --git a/src/yuzu/configuration/configure_general.h b/src/yuzu/configuration/configure_general.h
index c9df37d73..85c1dd4a8 100644
--- a/src/yuzu/configuration/configure_general.h
+++ b/src/yuzu/configuration/configure_general.h
@@ -8,6 +8,10 @@
#include <memory>
#include <QWidget>
+namespace Core {
+class System;
+}
+
class ConfigureDialog;
namespace ConfigurationShared {
@@ -24,19 +28,18 @@ class ConfigureGeneral : public QWidget {
Q_OBJECT
public:
- explicit ConfigureGeneral(QWidget* parent = nullptr);
+ explicit ConfigureGeneral(const Core::System& system_, QWidget* parent = nullptr);
~ConfigureGeneral() override;
void SetResetCallback(std::function<void()> callback);
void ResetDefaults();
void ApplyConfiguration();
+ void SetConfiguration();
private:
void changeEvent(QEvent* event) override;
void RetranslateUI();
- void SetConfiguration();
-
void SetupPerGameUI();
std::function<void()> reset_callback;
@@ -45,4 +48,6 @@ private:
ConfigurationShared::CheckState use_speed_limit;
ConfigurationShared::CheckState use_multi_core;
+
+ const Core::System& system;
};
diff --git a/src/yuzu/configuration/configure_general.ui b/src/yuzu/configuration/configure_general.ui
index 69b6c2d66..f9f0e3ebf 100644
--- a/src/yuzu/configuration/configure_general.ui
+++ b/src/yuzu/configuration/configure_general.ui
@@ -13,6 +13,9 @@
<property name="windowTitle">
<string>Form</string>
</property>
+ <property name="accessibleName">
+ <string>General</string>
+ </property>
<layout class="QHBoxLayout" name="HorizontalLayout">
<item>
<layout class="QVBoxLayout" name="VerticalLayout">
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp
index c594164be..8e20cc6f3 100644
--- a/src/yuzu/configuration/configure_graphics.cpp
+++ b/src/yuzu/configuration/configure_graphics.cpp
@@ -19,8 +19,8 @@
#include "yuzu/configuration/configuration_shared.h"
#include "yuzu/configuration/configure_graphics.h"
-ConfigureGraphics::ConfigureGraphics(QWidget* parent)
- : QWidget(parent), ui(new Ui::ConfigureGraphics) {
+ConfigureGraphics::ConfigureGraphics(const Core::System& system_, QWidget* parent)
+ : QWidget(parent), ui{std::make_unique<Ui::ConfigureGraphics>()}, system{system_} {
vulkan_device = Settings::values.vulkan_device.GetValue();
RetrieveVulkanDevices();
@@ -83,7 +83,7 @@ void ConfigureGraphics::UpdateShaderBackendSelection(int backend) {
ConfigureGraphics::~ConfigureGraphics() = default;
void ConfigureGraphics::SetConfiguration() {
- const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn();
+ const bool runtime_lock = !system.IsPoweredOn();
ui->api_widget->setEnabled(runtime_lock);
ui->use_asynchronous_gpu_emulation->setEnabled(runtime_lock);
diff --git a/src/yuzu/configuration/configure_graphics.h b/src/yuzu/configuration/configure_graphics.h
index 7d7ac329d..1b101c940 100644
--- a/src/yuzu/configuration/configure_graphics.h
+++ b/src/yuzu/configuration/configure_graphics.h
@@ -10,6 +10,10 @@
#include <QWidget>
#include "common/settings.h"
+namespace Core {
+class System;
+}
+
namespace ConfigurationShared {
enum class CheckState;
}
@@ -22,17 +26,16 @@ class ConfigureGraphics : public QWidget {
Q_OBJECT
public:
- explicit ConfigureGraphics(QWidget* parent = nullptr);
+ explicit ConfigureGraphics(const Core::System& system_, QWidget* parent = nullptr);
~ConfigureGraphics() override;
void ApplyConfiguration();
+ void SetConfiguration();
private:
void changeEvent(QEvent* event) override;
void RetranslateUI();
- void SetConfiguration();
-
void UpdateBackgroundColorButton(QColor color);
void UpdateAPILayout();
void UpdateDeviceSelection(int device);
@@ -56,4 +59,6 @@ private:
std::vector<QString> vulkan_devices;
u32 vulkan_device{};
Settings::ShaderBackend shader_backend{};
+
+ const Core::System& system;
};
diff --git a/src/yuzu/configuration/configure_graphics.ui b/src/yuzu/configuration/configure_graphics.ui
index 1a12cfa4d..beae74344 100644
--- a/src/yuzu/configuration/configure_graphics.ui
+++ b/src/yuzu/configuration/configure_graphics.ui
@@ -7,12 +7,15 @@
<x>0</x>
<y>0</y>
<width>437</width>
- <height>321</height>
+ <height>482</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
+ <property name="accessibleName">
+ <string>Graphics</string>
+ </property>
<layout class="QVBoxLayout" name="verticalLayout_1">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
@@ -200,17 +203,17 @@
<widget class="QComboBox" name="nvdec_emulation">
<item>
<property name="text">
- <string>Disabled</string>
+ <string>No Video Output</string>
</property>
</item>
<item>
<property name="text">
- <string>CPU Decoding</string>
+ <string>CPU Video Decoding</string>
</property>
</item>
<item>
<property name="text">
- <string>GPU Decoding</string>
+ <string>GPU Video Decoding (Default)</string>
</property>
</item>
</widget>
diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp
index bfd464061..30c5a3595 100644
--- a/src/yuzu/configuration/configure_graphics_advanced.cpp
+++ b/src/yuzu/configuration/configure_graphics_advanced.cpp
@@ -8,8 +8,8 @@
#include "yuzu/configuration/configuration_shared.h"
#include "yuzu/configuration/configure_graphics_advanced.h"
-ConfigureGraphicsAdvanced::ConfigureGraphicsAdvanced(QWidget* parent)
- : QWidget(parent), ui(new Ui::ConfigureGraphicsAdvanced) {
+ConfigureGraphicsAdvanced::ConfigureGraphicsAdvanced(const Core::System& system_, QWidget* parent)
+ : QWidget(parent), ui{std::make_unique<Ui::ConfigureGraphicsAdvanced>()}, system{system_} {
ui->setupUi(this);
@@ -21,7 +21,7 @@ ConfigureGraphicsAdvanced::ConfigureGraphicsAdvanced(QWidget* parent)
ConfigureGraphicsAdvanced::~ConfigureGraphicsAdvanced() = default;
void ConfigureGraphicsAdvanced::SetConfiguration() {
- const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn();
+ const bool runtime_lock = !system.IsPoweredOn();
ui->use_vsync->setEnabled(runtime_lock);
ui->use_asynchronous_shaders->setEnabled(runtime_lock);
ui->anisotropic_filtering_combobox->setEnabled(runtime_lock);
diff --git a/src/yuzu/configuration/configure_graphics_advanced.h b/src/yuzu/configuration/configure_graphics_advanced.h
index 13ba4ff6b..0a1724ce4 100644
--- a/src/yuzu/configuration/configure_graphics_advanced.h
+++ b/src/yuzu/configuration/configure_graphics_advanced.h
@@ -7,6 +7,10 @@
#include <memory>
#include <QWidget>
+namespace Core {
+class System;
+}
+
namespace ConfigurationShared {
enum class CheckState;
}
@@ -19,17 +23,16 @@ class ConfigureGraphicsAdvanced : public QWidget {
Q_OBJECT
public:
- explicit ConfigureGraphicsAdvanced(QWidget* parent = nullptr);
+ explicit ConfigureGraphicsAdvanced(const Core::System& system_, QWidget* parent = nullptr);
~ConfigureGraphicsAdvanced() override;
void ApplyConfiguration();
+ void SetConfiguration();
private:
void changeEvent(QEvent* event) override;
void RetranslateUI();
- void SetConfiguration();
-
void SetupPerGameUI();
std::unique_ptr<Ui::ConfigureGraphicsAdvanced> ui;
@@ -37,4 +40,6 @@ private:
ConfigurationShared::CheckState use_vsync;
ConfigurationShared::CheckState use_asynchronous_shaders;
ConfigurationShared::CheckState use_fast_gpu_time;
+
+ const Core::System& system;
};
diff --git a/src/yuzu/configuration/configure_graphics_advanced.ui b/src/yuzu/configuration/configure_graphics_advanced.ui
index b91abc2f0..d06b45f17 100644
--- a/src/yuzu/configuration/configure_graphics_advanced.ui
+++ b/src/yuzu/configuration/configure_graphics_advanced.ui
@@ -13,6 +13,9 @@
<property name="windowTitle">
<string>Form</string>
</property>
+ <property name="accessibleName">
+ <string>Advanced</string>
+ </property>
<layout class="QVBoxLayout" name="verticalLayout_1">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
diff --git a/src/yuzu/configuration/configure_hotkeys.ui b/src/yuzu/configuration/configure_hotkeys.ui
index 6d9f861e3..a6902a5d8 100644
--- a/src/yuzu/configuration/configure_hotkeys.ui
+++ b/src/yuzu/configuration/configure_hotkeys.ui
@@ -13,6 +13,9 @@
<property name="windowTitle">
<string>Hotkey Settings</string>
</property>
+ <property name="accessibleName">
+ <string>Hotkeys</string>
+ </property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
diff --git a/src/yuzu/configuration/configure_input.cpp b/src/yuzu/configuration/configure_input.cpp
index 422022d02..1599299db 100644
--- a/src/yuzu/configuration/configure_input.cpp
+++ b/src/yuzu/configuration/configure_input.cpp
@@ -39,12 +39,11 @@ void CallConfigureDialog(ConfigureInput& parent, Args&&... args) {
}
} // Anonymous namespace
-void OnDockedModeChanged(bool last_state, bool new_state) {
+void OnDockedModeChanged(bool last_state, bool new_state, Core::System& system) {
if (last_state == new_state) {
return;
}
- Core::System& system{Core::System::GetInstance()};
if (!system.IsPoweredOn()) {
return;
}
@@ -66,9 +65,9 @@ void OnDockedModeChanged(bool last_state, bool new_state) {
}
}
-ConfigureInput::ConfigureInput(QWidget* parent)
+ConfigureInput::ConfigureInput(Core::System& system_, QWidget* parent)
: QWidget(parent), ui(std::make_unique<Ui::ConfigureInput>()),
- profiles(std::make_unique<InputProfiles>()) {
+ profiles(std::make_unique<InputProfiles>(system_)), system{system_} {
ui->setupUi(this);
}
@@ -77,22 +76,22 @@ ConfigureInput::~ConfigureInput() = default;
void ConfigureInput::Initialize(InputCommon::InputSubsystem* input_subsystem,
std::size_t max_players) {
player_controllers = {
- new ConfigureInputPlayer(this, 0, ui->consoleInputSettings, input_subsystem,
- profiles.get()),
- new ConfigureInputPlayer(this, 1, ui->consoleInputSettings, input_subsystem,
- profiles.get()),
- new ConfigureInputPlayer(this, 2, ui->consoleInputSettings, input_subsystem,
- profiles.get()),
- new ConfigureInputPlayer(this, 3, ui->consoleInputSettings, input_subsystem,
- profiles.get()),
- new ConfigureInputPlayer(this, 4, ui->consoleInputSettings, input_subsystem,
- profiles.get()),
- new ConfigureInputPlayer(this, 5, ui->consoleInputSettings, input_subsystem,
- profiles.get()),
- new ConfigureInputPlayer(this, 6, ui->consoleInputSettings, input_subsystem,
- profiles.get()),
- new ConfigureInputPlayer(this, 7, ui->consoleInputSettings, input_subsystem,
- profiles.get()),
+ new ConfigureInputPlayer(this, 0, ui->consoleInputSettings, input_subsystem, profiles.get(),
+ system),
+ new ConfigureInputPlayer(this, 1, ui->consoleInputSettings, input_subsystem, profiles.get(),
+ system),
+ new ConfigureInputPlayer(this, 2, ui->consoleInputSettings, input_subsystem, profiles.get(),
+ system),
+ new ConfigureInputPlayer(this, 3, ui->consoleInputSettings, input_subsystem, profiles.get(),
+ system),
+ new ConfigureInputPlayer(this, 4, ui->consoleInputSettings, input_subsystem, profiles.get(),
+ system),
+ new ConfigureInputPlayer(this, 5, ui->consoleInputSettings, input_subsystem, profiles.get(),
+ system),
+ new ConfigureInputPlayer(this, 6, ui->consoleInputSettings, input_subsystem, profiles.get(),
+ system),
+ new ConfigureInputPlayer(this, 7, ui->consoleInputSettings, input_subsystem, profiles.get(),
+ system),
};
player_tabs = {
@@ -148,7 +147,8 @@ void ConfigureInput::Initialize(InputCommon::InputSubsystem* input_subsystem,
ui->tabAdvanced->setLayout(new QHBoxLayout(ui->tabAdvanced));
ui->tabAdvanced->layout()->addWidget(advanced);
connect(advanced, &ConfigureInputAdvanced::CallDebugControllerDialog, [this, input_subsystem] {
- CallConfigureDialog<ConfigureDebugController>(*this, input_subsystem, profiles.get());
+ CallConfigureDialog<ConfigureDebugController>(*this, input_subsystem, profiles.get(),
+ system);
});
connect(advanced, &ConfigureInputAdvanced::CallMouseConfigDialog, [this, input_subsystem] {
CallConfigureDialog<ConfigureMouseAdvanced>(*this, input_subsystem);
@@ -204,7 +204,7 @@ void ConfigureInput::ApplyConfiguration() {
const bool pre_docked_mode = Settings::values.use_docked_mode.GetValue();
Settings::values.use_docked_mode.SetValue(ui->radioDocked->isChecked());
- OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode.GetValue());
+ OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode.GetValue(), system);
Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked());
Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked());
diff --git a/src/yuzu/configuration/configure_input.h b/src/yuzu/configuration/configure_input.h
index f4eb0d78b..4cafa3dab 100644
--- a/src/yuzu/configuration/configure_input.h
+++ b/src/yuzu/configuration/configure_input.h
@@ -11,6 +11,10 @@
#include <QList>
#include <QWidget>
+namespace Core {
+class System;
+}
+
class QCheckBox;
class QString;
class QTimer;
@@ -28,13 +32,13 @@ namespace Ui {
class ConfigureInput;
}
-void OnDockedModeChanged(bool last_state, bool new_state);
+void OnDockedModeChanged(bool last_state, bool new_state, Core::System& system);
class ConfigureInput : public QWidget {
Q_OBJECT
public:
- explicit ConfigureInput(QWidget* parent = nullptr);
+ explicit ConfigureInput(Core::System& system_, QWidget* parent = nullptr);
~ConfigureInput() override;
/// Initializes the input dialog with the given input subsystem.
@@ -69,4 +73,6 @@ private:
std::array<QWidget*, 8> player_tabs;
std::array<QCheckBox*, 8> player_connected;
ConfigureInputAdvanced* advanced;
+
+ Core::System& system;
};
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp
index 88f4bf388..3aab5d5f8 100644
--- a/src/yuzu/configuration/configure_input_player.cpp
+++ b/src/yuzu/configuration/configure_input_player.cpp
@@ -44,8 +44,7 @@ namespace {
constexpr std::size_t HANDHELD_INDEX = 8;
void UpdateController(Settings::ControllerType controller_type, std::size_t npad_index,
- bool connected) {
- Core::System& system{Core::System::GetInstance()};
+ bool connected, Core::System& system) {
if (!system.IsPoweredOn()) {
return;
}
@@ -232,11 +231,12 @@ QString AnalogToText(const Common::ParamPackage& param, const std::string& dir)
ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_index,
QWidget* bottom_row,
InputCommon::InputSubsystem* input_subsystem_,
- InputProfiles* profiles_, bool debug)
+ InputProfiles* profiles_, Core::System& system_,
+ bool debug)
: QWidget(parent), ui(std::make_unique<Ui::ConfigureInputPlayer>()), player_index(player_index),
debug(debug), input_subsystem{input_subsystem_}, profiles(profiles_),
timeout_timer(std::make_unique<QTimer>()), poll_timer(std::make_unique<QTimer>()),
- bottom_row(bottom_row) {
+ bottom_row(bottom_row), system{system_} {
ui->setupUi(this);
setFocusPolicy(Qt::ClickFocus);
@@ -683,7 +683,7 @@ void ConfigureInputPlayer::TryConnectSelectedController() {
controller_type == Settings::ControllerType::Handheld;
// Connect only if handheld is going from disconnected to connected
if (!handheld.connected && handheld_connected) {
- UpdateController(controller_type, HANDHELD_INDEX, true);
+ UpdateController(controller_type, HANDHELD_INDEX, true, system);
}
handheld.connected = handheld_connected;
}
@@ -703,7 +703,7 @@ void ConfigureInputPlayer::TryConnectSelectedController() {
return;
}
- UpdateController(controller_type, player_index, true);
+ UpdateController(controller_type, player_index, true, system);
}
void ConfigureInputPlayer::TryDisconnectSelectedController() {
@@ -721,7 +721,7 @@ void ConfigureInputPlayer::TryDisconnectSelectedController() {
controller_type == Settings::ControllerType::Handheld;
// Disconnect only if handheld is going from connected to disconnected
if (handheld.connected && !handheld_connected) {
- UpdateController(controller_type, HANDHELD_INDEX, false);
+ UpdateController(controller_type, HANDHELD_INDEX, false, system);
}
return;
}
@@ -737,7 +737,7 @@ void ConfigureInputPlayer::TryDisconnectSelectedController() {
}
// Disconnect the controller first.
- UpdateController(controller_type, player_index, false);
+ UpdateController(controller_type, player_index, false, system);
}
void ConfigureInputPlayer::showEvent(QShowEvent* event) {
@@ -1017,8 +1017,6 @@ void ConfigureInputPlayer::SetConnectableControllers() {
}
};
- Core::System& system{Core::System::GetInstance()};
-
if (!system.IsPoweredOn()) {
add_controllers(true);
return;
diff --git a/src/yuzu/configuration/configure_input_player.h b/src/yuzu/configuration/configure_input_player.h
index c7d101682..39b44b8a5 100644
--- a/src/yuzu/configuration/configure_input_player.h
+++ b/src/yuzu/configuration/configure_input_player.h
@@ -29,6 +29,10 @@ class QWidget;
class InputProfiles;
+namespace Core {
+class System;
+}
+
namespace InputCommon {
class InputSubsystem;
}
@@ -48,7 +52,8 @@ class ConfigureInputPlayer : public QWidget {
public:
explicit ConfigureInputPlayer(QWidget* parent, std::size_t player_index, QWidget* bottom_row,
InputCommon::InputSubsystem* input_subsystem_,
- InputProfiles* profiles_, bool debug = false);
+ InputProfiles* profiles_, Core::System& system_,
+ bool debug = false);
~ConfigureInputPlayer() override;
/// Save all button configurations to settings file.
@@ -233,4 +238,6 @@ private:
/// ConfigureInput widget. On show, add this widget to the main layout. This will change the
/// parent of the widget to this widget (but thats fine).
QWidget* bottom_row;
+
+ Core::System& system;
};
diff --git a/src/yuzu/configuration/configure_input_profile_dialog.cpp b/src/yuzu/configuration/configure_input_profile_dialog.cpp
index 1f5cfa75b..cd5a88cea 100644
--- a/src/yuzu/configuration/configure_input_profile_dialog.cpp
+++ b/src/yuzu/configuration/configure_input_profile_dialog.cpp
@@ -2,14 +2,17 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include "core/core.h"
#include "ui_configure_input_profile_dialog.h"
#include "yuzu/configuration/configure_input_player.h"
#include "yuzu/configuration/configure_input_profile_dialog.h"
ConfigureInputProfileDialog::ConfigureInputProfileDialog(
- QWidget* parent, InputCommon::InputSubsystem* input_subsystem, InputProfiles* profiles)
+ QWidget* parent, InputCommon::InputSubsystem* input_subsystem, InputProfiles* profiles,
+ Core::System& system)
: QDialog(parent), ui(std::make_unique<Ui::ConfigureInputProfileDialog>()),
- profile_widget(new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles, false)) {
+ profile_widget(
+ new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles, system, false)) {
ui->setupUi(this);
ui->controllerLayout->addWidget(profile_widget);
diff --git a/src/yuzu/configuration/configure_input_profile_dialog.h b/src/yuzu/configuration/configure_input_profile_dialog.h
index e6386bdbb..84b1f6d1a 100644
--- a/src/yuzu/configuration/configure_input_profile_dialog.h
+++ b/src/yuzu/configuration/configure_input_profile_dialog.h
@@ -13,6 +13,10 @@ class ConfigureInputPlayer;
class InputProfiles;
+namespace Core {
+class System;
+}
+
namespace InputCommon {
class InputSubsystem;
}
@@ -27,7 +31,7 @@ class ConfigureInputProfileDialog : public QDialog {
public:
explicit ConfigureInputProfileDialog(QWidget* parent,
InputCommon::InputSubsystem* input_subsystem,
- InputProfiles* profiles);
+ InputProfiles* profiles, Core::System& system);
~ConfigureInputProfileDialog() override;
private:
diff --git a/src/yuzu/configuration/configure_network.cpp b/src/yuzu/configuration/configure_network.cpp
index cc15d36c2..7020d2964 100644
--- a/src/yuzu/configuration/configure_network.cpp
+++ b/src/yuzu/configuration/configure_network.cpp
@@ -10,8 +10,8 @@
#include "ui_configure_network.h"
#include "yuzu/configuration/configure_network.h"
-ConfigureNetwork::ConfigureNetwork(QWidget* parent)
- : QWidget(parent), ui(std::make_unique<Ui::ConfigureNetwork>()) {
+ConfigureNetwork::ConfigureNetwork(const Core::System& system_, QWidget* parent)
+ : QWidget(parent), ui(std::make_unique<Ui::ConfigureNetwork>()), system{system_} {
ui->setupUi(this);
ui->network_interface->addItem(tr("None"));
@@ -33,7 +33,7 @@ void ConfigureNetwork::RetranslateUi() {
}
void ConfigureNetwork::SetConfiguration() {
- const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn();
+ const bool runtime_lock = !system.IsPoweredOn();
const std::string& network_interface = Settings::values.network_interface.GetValue();
diff --git a/src/yuzu/configuration/configure_network.h b/src/yuzu/configuration/configure_network.h
index 028fd4acc..8507c62eb 100644
--- a/src/yuzu/configuration/configure_network.h
+++ b/src/yuzu/configuration/configure_network.h
@@ -16,7 +16,7 @@ class ConfigureNetwork : public QWidget {
Q_OBJECT
public:
- explicit ConfigureNetwork(QWidget* parent = nullptr);
+ explicit ConfigureNetwork(const Core::System& system_, QWidget* parent = nullptr);
~ConfigureNetwork() override;
void ApplyConfiguration();
@@ -26,4 +26,6 @@ private:
void SetConfiguration();
std::unique_ptr<Ui::ConfigureNetwork> ui;
+
+ const Core::System& system;
};
diff --git a/src/yuzu/configuration/configure_network.ui b/src/yuzu/configuration/configure_network.ui
index 9a79262f0..f10e973b1 100644
--- a/src/yuzu/configuration/configure_network.ui
+++ b/src/yuzu/configuration/configure_network.ui
@@ -13,6 +13,9 @@
<property name="windowTitle">
<string>Form</string>
</property>
+ <property name="accessibleName">
+ <string>Network</string>
+ </property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
diff --git a/src/yuzu/configuration/configure_per_game.cpp b/src/yuzu/configuration/configure_per_game.cpp
index 8c00eec59..1031399e1 100644
--- a/src/yuzu/configuration/configure_per_game.cpp
+++ b/src/yuzu/configuration/configure_per_game.cpp
@@ -30,32 +30,56 @@
#include "core/loader/loader.h"
#include "ui_configure_per_game.h"
#include "yuzu/configuration/config.h"
+#include "yuzu/configuration/configure_audio.h"
+#include "yuzu/configuration/configure_cpu.h"
+#include "yuzu/configuration/configure_general.h"
+#include "yuzu/configuration/configure_graphics.h"
+#include "yuzu/configuration/configure_graphics_advanced.h"
#include "yuzu/configuration/configure_input.h"
#include "yuzu/configuration/configure_per_game.h"
+#include "yuzu/configuration/configure_per_game_addons.h"
+#include "yuzu/configuration/configure_system.h"
#include "yuzu/uisettings.h"
#include "yuzu/util/util.h"
-ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id, const std::string& file_name)
- : QDialog(parent), ui(std::make_unique<Ui::ConfigurePerGame>()), title_id(title_id) {
+ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id, const std::string& file_name,
+ Core::System& system_)
+ : QDialog(parent), ui(std::make_unique<Ui::ConfigurePerGame>()),
+ title_id(title_id), system{system_}, addons_tab{std::make_unique<ConfigurePerGameAddons>(
+ system_, this)},
+ audio_tab{std::make_unique<ConfigureAudio>(system_, this)},
+ cpu_tab{std::make_unique<ConfigureCpu>(system_, this)},
+ general_tab{std::make_unique<ConfigureGeneral>(system_, this)},
+ graphics_tab{std::make_unique<ConfigureGraphics>(system_, this)},
+ graphics_advanced_tab{std::make_unique<ConfigureGraphicsAdvanced>(system_, this)},
+ system_tab{std::make_unique<ConfigureSystem>(system_, this)} {
const auto file_path = std::filesystem::path(Common::FS::ToU8String(file_name));
const auto config_file_name = title_id == 0 ? Common::FS::PathToUTF8String(file_path.filename())
: fmt::format("{:016X}", title_id);
- game_config = std::make_unique<Config>(config_file_name, Config::ConfigType::PerGameConfig);
-
- Settings::SetConfiguringGlobal(false);
+ game_config =
+ std::make_unique<Config>(system, config_file_name, Config::ConfigType::PerGameConfig);
ui->setupUi(this);
+
+ ui->tabWidget->addTab(addons_tab.get(), tr("Add-Ons"));
+ ui->tabWidget->addTab(general_tab.get(), tr("General"));
+ ui->tabWidget->addTab(system_tab.get(), tr("System"));
+ ui->tabWidget->addTab(cpu_tab.get(), tr("CPU"));
+ ui->tabWidget->addTab(graphics_tab.get(), tr("Graphics"));
+ ui->tabWidget->addTab(graphics_advanced_tab.get(), tr("GraphicsAdvanced"));
+ ui->tabWidget->addTab(audio_tab.get(), tr("Audio"));
+
setFocusPolicy(Qt::ClickFocus);
setWindowTitle(tr("Properties"));
// remove Help question mark button from the title bar
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
- ui->addonsTab->SetTitleId(title_id);
+ addons_tab->SetTitleId(title_id);
scene = new QGraphicsScene;
ui->icon_view->setScene(scene);
- if (Core::System::GetInstance().IsPoweredOn()) {
+ if (system.IsPoweredOn()) {
QPushButton* apply_button = ui->buttonBox->addButton(QDialogButtonBox::Apply);
connect(apply_button, &QAbstractButton::clicked, this,
&ConfigurePerGame::HandleApplyButtonClicked);
@@ -67,15 +91,15 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id, const std::str
ConfigurePerGame::~ConfigurePerGame() = default;
void ConfigurePerGame::ApplyConfiguration() {
- ui->addonsTab->ApplyConfiguration();
- ui->generalTab->ApplyConfiguration();
- ui->cpuTab->ApplyConfiguration();
- ui->systemTab->ApplyConfiguration();
- ui->graphicsTab->ApplyConfiguration();
- ui->graphicsAdvancedTab->ApplyConfiguration();
- ui->audioTab->ApplyConfiguration();
-
- Core::System::GetInstance().ApplySettings();
+ addons_tab->ApplyConfiguration();
+ general_tab->ApplyConfiguration();
+ cpu_tab->ApplyConfiguration();
+ system_tab->ApplyConfiguration();
+ graphics_tab->ApplyConfiguration();
+ graphics_advanced_tab->ApplyConfiguration();
+ audio_tab->ApplyConfiguration();
+
+ system.ApplySettings();
Settings::LogSettings();
game_config->Save();
@@ -108,12 +132,11 @@ void ConfigurePerGame::LoadConfiguration() {
return;
}
- ui->addonsTab->LoadFromFile(file);
+ addons_tab->LoadFromFile(file);
ui->display_title_id->setText(
QStringLiteral("%1").arg(title_id, 16, 16, QLatin1Char{'0'}).toUpper());
- auto& system = Core::System::GetInstance();
const FileSys::PatchManager pm{title_id, system.GetFileSystemController(),
system.GetContentProvider()};
const auto control = pm.GetControlMetadata();
@@ -164,4 +187,11 @@ void ConfigurePerGame::LoadConfiguration() {
const auto valueText = ReadableByteSize(file->GetSize());
ui->display_size->setText(valueText);
+
+ general_tab->SetConfiguration();
+ cpu_tab->SetConfiguration();
+ system_tab->SetConfiguration();
+ graphics_tab->SetConfiguration();
+ graphics_advanced_tab->SetConfiguration();
+ audio_tab->SetConfiguration();
}
diff --git a/src/yuzu/configuration/configure_per_game.h b/src/yuzu/configuration/configure_per_game.h
index a2d0211a3..c1a57d87b 100644
--- a/src/yuzu/configuration/configure_per_game.h
+++ b/src/yuzu/configuration/configure_per_game.h
@@ -14,6 +14,18 @@
#include "core/file_sys/vfs_types.h"
#include "yuzu/configuration/config.h"
+namespace Core {
+class System;
+}
+
+class ConfigurePerGameAddons;
+class ConfigureAudio;
+class ConfigureCpu;
+class ConfigureGeneral;
+class ConfigureGraphics;
+class ConfigureGraphicsAdvanced;
+class ConfigureSystem;
+
class QGraphicsScene;
class QStandardItem;
class QStandardItemModel;
@@ -29,7 +41,8 @@ class ConfigurePerGame : public QDialog {
public:
// Cannot use std::filesystem::path due to https://bugreports.qt.io/browse/QTBUG-73263
- explicit ConfigurePerGame(QWidget* parent, u64 title_id, const std::string& file_name);
+ explicit ConfigurePerGame(QWidget* parent, u64 title_id, const std::string& file_name,
+ Core::System& system_);
~ConfigurePerGame() override;
/// Save all button configurations to settings file
@@ -52,4 +65,14 @@ private:
QGraphicsScene* scene;
std::unique_ptr<Config> game_config;
+
+ Core::System& system;
+
+ std::unique_ptr<ConfigurePerGameAddons> addons_tab;
+ std::unique_ptr<ConfigureAudio> audio_tab;
+ std::unique_ptr<ConfigureCpu> cpu_tab;
+ std::unique_ptr<ConfigureGeneral> general_tab;
+ std::unique_ptr<ConfigureGraphics> graphics_tab;
+ std::unique_ptr<ConfigureGraphicsAdvanced> graphics_advanced_tab;
+ std::unique_ptr<ConfigureSystem> system_tab;
};
diff --git a/src/yuzu/configuration/configure_per_game.ui b/src/yuzu/configuration/configure_per_game.ui
index 7da14146b..60efdbf21 100644
--- a/src/yuzu/configuration/configure_per_game.ui
+++ b/src/yuzu/configuration/configure_per_game.ui
@@ -7,12 +7,13 @@
<x>0</x>
<y>0</y>
<width>900</width>
- <height>600</height>
+ <height>630</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>900</width>
+ <height>0</height>
</size>
</property>
<property name="windowTitle">
@@ -214,7 +215,7 @@
<bool>true</bool>
</property>
<property name="currentIndex">
- <number>0</number>
+ <number>-1</number>
</property>
<property name="usesScrollButtons">
<bool>true</bool>
@@ -225,41 +226,6 @@
<property name="tabsClosable">
<bool>false</bool>
</property>
- <widget class="ConfigurePerGameAddons" name="addonsTab">
- <attribute name="title">
- <string>Add-Ons</string>
- </attribute>
- </widget>
- <widget class="ConfigureGeneral" name="generalTab">
- <attribute name="title">
- <string>General</string>
- </attribute>
- </widget>
- <widget class="ConfigureSystem" name="systemTab">
- <attribute name="title">
- <string>System</string>
- </attribute>
- </widget>
- <widget class="ConfigureCpu" name="cpuTab">
- <attribute name="title">
- <string>CPU</string>
- </attribute>
- </widget>
- <widget class="ConfigureGraphics" name="graphicsTab">
- <attribute name="title">
- <string>Graphics</string>
- </attribute>
- </widget>
- <widget class="ConfigureGraphicsAdvanced" name="graphicsAdvancedTab">
- <attribute name="title">
- <string>Adv. Graphics</string>
- </attribute>
- </widget>
- <widget class="ConfigureAudio" name="audioTab">
- <attribute name="title">
- <string>Audio</string>
- </attribute>
- </widget>
</widget>
</item>
</layout>
@@ -284,50 +250,6 @@
</item>
</layout>
</widget>
- <customwidgets>
- <customwidget>
- <class>ConfigureGeneral</class>
- <extends>QWidget</extends>
- <header>configuration/configure_general.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureSystem</class>
- <extends>QWidget</extends>
- <header>configuration/configure_system.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureAudio</class>
- <extends>QWidget</extends>
- <header>configuration/configure_audio.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureGraphics</class>
- <extends>QWidget</extends>
- <header>configuration/configure_graphics.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureGraphicsAdvanced</class>
- <extends>QWidget</extends>
- <header>configuration/configure_graphics_advanced.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigurePerGameAddons</class>
- <extends>QWidget</extends>
- <header>configuration/configure_per_game_addons.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureCpu</class>
- <extends>QWidget</extends>
- <header>configuration/configure_cpu.h</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
<resources/>
<connections>
<connection>
@@ -335,12 +257,32 @@
<signal>accepted()</signal>
<receiver>ConfigurePerGame</receiver>
<slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ </hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>ConfigurePerGame</receiver>
<slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ </hints>
</connection>
</connections>
</ui>
diff --git a/src/yuzu/configuration/configure_per_game_addons.cpp b/src/yuzu/configuration/configure_per_game_addons.cpp
index ebb0f411c..65e615963 100644
--- a/src/yuzu/configuration/configure_per_game_addons.cpp
+++ b/src/yuzu/configuration/configure_per_game_addons.cpp
@@ -26,8 +26,8 @@
#include "yuzu/uisettings.h"
#include "yuzu/util/util.h"
-ConfigurePerGameAddons::ConfigurePerGameAddons(QWidget* parent)
- : QWidget(parent), ui(new Ui::ConfigurePerGameAddons) {
+ConfigurePerGameAddons::ConfigurePerGameAddons(Core::System& system_, QWidget* parent)
+ : QWidget(parent), ui{std::make_unique<Ui::ConfigurePerGameAddons>()}, system{system_} {
ui->setupUi(this);
layout = new QVBoxLayout;
@@ -58,7 +58,7 @@ ConfigurePerGameAddons::ConfigurePerGameAddons(QWidget* parent)
ui->scrollArea->setLayout(layout);
- ui->scrollArea->setEnabled(!Core::System::GetInstance().IsPoweredOn());
+ ui->scrollArea->setEnabled(!system.IsPoweredOn());
connect(item_model, &QStandardItemModel::itemChanged,
[] { UISettings::values.is_game_list_reload_pending.exchange(true); });
@@ -112,7 +112,6 @@ void ConfigurePerGameAddons::LoadConfiguration() {
return;
}
- auto& system = Core::System::GetInstance();
const FileSys::PatchManager pm{title_id, system.GetFileSystemController(),
system.GetContentProvider()};
const auto loader = Loader::GetLoader(system, file);
diff --git a/src/yuzu/configuration/configure_per_game_addons.h b/src/yuzu/configuration/configure_per_game_addons.h
index a00ec3539..24b017494 100644
--- a/src/yuzu/configuration/configure_per_game_addons.h
+++ b/src/yuzu/configuration/configure_per_game_addons.h
@@ -11,6 +11,10 @@
#include "core/file_sys/vfs_types.h"
+namespace Core {
+class System;
+}
+
class QGraphicsScene;
class QStandardItem;
class QStandardItemModel;
@@ -25,7 +29,7 @@ class ConfigurePerGameAddons : public QWidget {
Q_OBJECT
public:
- explicit ConfigurePerGameAddons(QWidget* parent = nullptr);
+ explicit ConfigurePerGameAddons(Core::System& system_, QWidget* parent = nullptr);
~ConfigurePerGameAddons() override;
/// Save all button configurations to settings file
@@ -50,4 +54,6 @@ private:
QStandardItemModel* item_model;
std::vector<QList<QStandardItem*>> list_items;
+
+ Core::System& system;
};
diff --git a/src/yuzu/configuration/configure_per_game_addons.ui b/src/yuzu/configuration/configure_per_game_addons.ui
index aefdebfcd..f9cf6f2c3 100644
--- a/src/yuzu/configuration/configure_per_game_addons.ui
+++ b/src/yuzu/configuration/configure_per_game_addons.ui
@@ -13,6 +13,9 @@
<property name="windowTitle">
<string>Form</string>
</property>
+ <property name="accessibleDescription">
+ <string>Add-Ons</string>
+ </property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QScrollArea" name="scrollArea">
diff --git a/src/yuzu/configuration/configure_profile_manager.cpp b/src/yuzu/configuration/configure_profile_manager.cpp
index 136614bf8..99d5f4686 100644
--- a/src/yuzu/configuration/configure_profile_manager.cpp
+++ b/src/yuzu/configuration/configure_profile_manager.cpp
@@ -76,9 +76,9 @@ QString GetProfileUsernameFromUser(QWidget* parent, const QString& description_t
}
} // Anonymous namespace
-ConfigureProfileManager::ConfigureProfileManager(QWidget* parent)
- : QWidget(parent), ui(new Ui::ConfigureProfileManager),
- profile_manager(std::make_unique<Service::Account::ProfileManager>()) {
+ConfigureProfileManager::ConfigureProfileManager(const Core::System& system_, QWidget* parent)
+ : QWidget(parent), ui{std::make_unique<Ui::ConfigureProfileManager>()},
+ profile_manager(std::make_unique<Service::Account::ProfileManager>()), system{system_} {
ui->setupUi(this);
tree_view = new QTreeView;
@@ -137,7 +137,7 @@ void ConfigureProfileManager::RetranslateUI() {
}
void ConfigureProfileManager::SetConfiguration() {
- enabled = !Core::System::GetInstance().IsPoweredOn();
+ enabled = !system.IsPoweredOn();
item_model->removeRows(0, item_model->rowCount());
list_items.clear();
@@ -180,8 +180,6 @@ void ConfigureProfileManager::ApplyConfiguration() {
if (!enabled) {
return;
}
-
- Core::System::GetInstance().ApplySettings();
}
void ConfigureProfileManager::SelectUser(const QModelIndex& index) {
diff --git a/src/yuzu/configuration/configure_profile_manager.h b/src/yuzu/configuration/configure_profile_manager.h
index 0a9bca2a6..575cb89d5 100644
--- a/src/yuzu/configuration/configure_profile_manager.h
+++ b/src/yuzu/configuration/configure_profile_manager.h
@@ -9,6 +9,10 @@
#include <QList>
#include <QWidget>
+namespace Core {
+class System;
+}
+
class QGraphicsScene;
class QStandardItem;
class QStandardItemModel;
@@ -27,7 +31,7 @@ class ConfigureProfileManager : public QWidget {
Q_OBJECT
public:
- explicit ConfigureProfileManager(QWidget* parent = nullptr);
+ explicit ConfigureProfileManager(const Core::System& system_, QWidget* parent = nullptr);
~ConfigureProfileManager() override;
void ApplyConfiguration();
@@ -58,4 +62,6 @@ private:
bool enabled = false;
std::unique_ptr<Service::Account::ProfileManager> profile_manager;
+
+ const Core::System& system;
};
diff --git a/src/yuzu/configuration/configure_profile_manager.ui b/src/yuzu/configuration/configure_profile_manager.ui
index dedba4998..cfe7478c8 100644
--- a/src/yuzu/configuration/configure_profile_manager.ui
+++ b/src/yuzu/configuration/configure_profile_manager.ui
@@ -6,13 +6,16 @@
<rect>
<x>0</x>
<y>0</y>
- <width>366</width>
+ <width>390</width>
<height>483</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
+ <property name="accessibleName">
+ <string>Profiles</string>
+ </property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp
index 24a67ad46..eea45f8ea 100644
--- a/src/yuzu/configuration/configure_system.cpp
+++ b/src/yuzu/configuration/configure_system.cpp
@@ -17,7 +17,8 @@
#include "yuzu/configuration/configuration_shared.h"
#include "yuzu/configuration/configure_system.h"
-ConfigureSystem::ConfigureSystem(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureSystem) {
+ConfigureSystem::ConfigureSystem(Core::System& system_, QWidget* parent)
+ : QWidget(parent), ui{std::make_unique<Ui::ConfigureSystem>()}, system{system_} {
ui->setupUi(this);
connect(ui->button_regenerate_console_id, &QPushButton::clicked, this,
&ConfigureSystem::RefreshConsoleID);
@@ -59,7 +60,7 @@ void ConfigureSystem::RetranslateUI() {
}
void ConfigureSystem::SetConfiguration() {
- enabled = !Core::System::GetInstance().IsPoweredOn();
+ enabled = !system.IsPoweredOn();
const auto rng_seed =
QStringLiteral("%1")
.arg(Settings::values.rng_seed.GetValue().value_or(0), 8, 16, QLatin1Char{'0'})
@@ -103,8 +104,6 @@ void ConfigureSystem::SetConfiguration() {
void ConfigureSystem::ReadSystemSettings() {}
void ConfigureSystem::ApplyConfiguration() {
- auto& system = Core::System::GetInstance();
-
// Allow setting custom RTC even if system is powered on,
// to allow in-game time to be fast forwarded
if (Settings::IsConfiguringGlobal()) {
@@ -162,8 +161,6 @@ void ConfigureSystem::ApplyConfiguration() {
break;
}
}
-
- system.ApplySettings();
}
void ConfigureSystem::RefreshConsoleID() {
diff --git a/src/yuzu/configuration/configure_system.h b/src/yuzu/configuration/configure_system.h
index fc5cd2945..bb24c9ae7 100644
--- a/src/yuzu/configuration/configure_system.h
+++ b/src/yuzu/configuration/configure_system.h
@@ -9,6 +9,10 @@
#include <QList>
#include <QWidget>
+namespace Core {
+class System;
+}
+
namespace ConfigurationShared {
enum class CheckState;
}
@@ -21,17 +25,16 @@ class ConfigureSystem : public QWidget {
Q_OBJECT
public:
- explicit ConfigureSystem(QWidget* parent = nullptr);
+ explicit ConfigureSystem(Core::System& system_, QWidget* parent = nullptr);
~ConfigureSystem() override;
void ApplyConfiguration();
+ void SetConfiguration();
private:
void changeEvent(QEvent* event) override;
void RetranslateUI();
- void SetConfiguration();
-
void ReadSystemSettings();
void RefreshConsoleID();
@@ -48,4 +51,6 @@ private:
ConfigurationShared::CheckState use_rng_seed;
ConfigurationShared::CheckState use_custom_rtc;
+
+ Core::System& system;
};
diff --git a/src/yuzu/configuration/configure_system.ui b/src/yuzu/configuration/configure_system.ui
index 27f552f59..5b68dcb29 100644
--- a/src/yuzu/configuration/configure_system.ui
+++ b/src/yuzu/configuration/configure_system.ui
@@ -13,6 +13,9 @@
<property name="windowTitle">
<string>Form</string>
</property>
+ <property name="accessibleName">
+ <string>System</string>
+ </property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
diff --git a/src/yuzu/configuration/configure_ui.cpp b/src/yuzu/configuration/configure_ui.cpp
index 9d7d51126..46e5409db 100644
--- a/src/yuzu/configuration/configure_ui.cpp
+++ b/src/yuzu/configuration/configure_ui.cpp
@@ -54,7 +54,8 @@ QString GetTranslatedRowTextName(size_t index) {
}
} // Anonymous namespace
-ConfigureUi::ConfigureUi(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureUi) {
+ConfigureUi::ConfigureUi(Core::System& system_, QWidget* parent)
+ : QWidget(parent), ui{std::make_unique<Ui::ConfigureUi>()}, system{system_} {
ui->setupUi(this);
InitializeLanguageComboBox();
@@ -116,7 +117,7 @@ void ConfigureUi::ApplyConfiguration() {
UISettings::values.enable_screenshot_save_as = ui->enable_screenshot_save_as->isChecked();
Common::FS::SetYuzuPath(Common::FS::YuzuPath::ScreenshotsDir,
ui->screenshot_path_edit->text().toStdString());
- Core::System::GetInstance().ApplySettings();
+ system.ApplySettings();
}
void ConfigureUi::RequestGameListUpdate() {
diff --git a/src/yuzu/configuration/configure_ui.h b/src/yuzu/configuration/configure_ui.h
index c30bcf6ff..48b6e6d82 100644
--- a/src/yuzu/configuration/configure_ui.h
+++ b/src/yuzu/configuration/configure_ui.h
@@ -7,6 +7,10 @@
#include <memory>
#include <QWidget>
+namespace Core {
+class System;
+}
+
namespace Ui {
class ConfigureUi;
}
@@ -15,7 +19,7 @@ class ConfigureUi : public QWidget {
Q_OBJECT
public:
- explicit ConfigureUi(QWidget* parent = nullptr);
+ explicit ConfigureUi(Core::System& system_, QWidget* parent = nullptr);
~ConfigureUi() override;
void ApplyConfiguration();
@@ -42,4 +46,6 @@ private:
void UpdateSecondRowComboBox(bool init = false);
std::unique_ptr<Ui::ConfigureUi> ui;
+
+ Core::System& system;
};
diff --git a/src/yuzu/configuration/configure_ui.ui b/src/yuzu/configuration/configure_ui.ui
index 394f9fe04..a50df7f6f 100644
--- a/src/yuzu/configuration/configure_ui.ui
+++ b/src/yuzu/configuration/configure_ui.ui
@@ -7,12 +7,15 @@
<x>0</x>
<y>0</y>
<width>363</width>
- <height>391</height>
+ <height>507</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
+ <property name="accessibleName">
+ <string>UI</string>
+ </property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="general_groupBox">
diff --git a/src/yuzu/configuration/configure_web.ui b/src/yuzu/configuration/configure_web.ui
index 8c07d1165..35b4274b0 100644
--- a/src/yuzu/configuration/configure_web.ui
+++ b/src/yuzu/configuration/configure_web.ui
@@ -13,6 +13,9 @@
<property name="windowTitle">
<string>Form</string>
</property>
+ <property name="accessibleName">
+ <string>Web</string>
+ </property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
@@ -55,7 +58,7 @@
</widget>
</item>
<item row="0" column="1" colspan="3">
- <widget class="QLabel" name="username" />
+ <widget class="QLabel" name="username"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_token">
@@ -65,8 +68,7 @@
</widget>
</item>
<item row="1" column="4">
- <widget class="QLabel" name="label_token_verified">
- </widget>
+ <widget class="QLabel" name="label_token_verified"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_username">
@@ -163,20 +165,20 @@
</layout>
</item>
<item>
- <widget class="QGroupBox" name="discord_group">
- <property name="title">
- <string>Discord Presence</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_21">
- <item>
- <widget class="QCheckBox" name="toggle_discordrpc">
- <property name="text">
- <string>Show Current Game in your Discord Status</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
+ <widget class="QGroupBox" name="discord_group">
+ <property name="title">
+ <string>Discord Presence</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_21">
+ <item>
+ <widget class="QCheckBox" name="toggle_discordrpc">
+ <property name="text">
+ <string>Show Current Game in your Discord Status</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
</item>
<item>
<spacer name="verticalSpacer">
diff --git a/src/yuzu/configuration/input_profiles.cpp b/src/yuzu/configuration/input_profiles.cpp
index 333eeb84e..38ea6c772 100644
--- a/src/yuzu/configuration/input_profiles.cpp
+++ b/src/yuzu/configuration/input_profiles.cpp
@@ -28,7 +28,7 @@ std::filesystem::path GetNameWithoutExtension(std::filesystem::path filename) {
} // namespace
-InputProfiles::InputProfiles() {
+InputProfiles::InputProfiles(Core::System& system_) : system{system_} {
const auto input_profile_loc = FS::GetYuzuPath(FS::YuzuPath::ConfigDir) / "input";
if (!FS::IsDir(input_profile_loc)) {
@@ -44,8 +44,8 @@ InputProfiles::InputProfiles() {
if (IsINI(filename) && IsProfileNameValid(name_without_ext)) {
map_profiles.insert_or_assign(
- name_without_ext,
- std::make_unique<Config>(name_without_ext, Config::ConfigType::InputProfile));
+ name_without_ext, std::make_unique<Config>(system, name_without_ext,
+ Config::ConfigType::InputProfile));
}
return true;
@@ -81,7 +81,8 @@ bool InputProfiles::CreateProfile(const std::string& profile_name, std::size_t p
}
map_profiles.insert_or_assign(
- profile_name, std::make_unique<Config>(profile_name, Config::ConfigType::InputProfile));
+ profile_name,
+ std::make_unique<Config>(system, profile_name, Config::ConfigType::InputProfile));
return SaveProfile(profile_name, player_index);
}
diff --git a/src/yuzu/configuration/input_profiles.h b/src/yuzu/configuration/input_profiles.h
index cb41fd9be..a567bd5a9 100644
--- a/src/yuzu/configuration/input_profiles.h
+++ b/src/yuzu/configuration/input_profiles.h
@@ -8,12 +8,16 @@
#include <string_view>
#include <unordered_map>
+namespace Core {
+class System;
+}
+
class Config;
class InputProfiles {
public:
- explicit InputProfiles();
+ explicit InputProfiles(Core::System& system_);
virtual ~InputProfiles();
std::vector<std::string> GetInputProfileNames();
@@ -29,4 +33,6 @@ private:
bool ProfileExistsInMap(const std::string& profile_name) const;
std::unordered_map<std::string, std::unique_ptr<Config>> map_profiles;
+
+ Core::System& system;
};
diff --git a/src/yuzu/debugger/wait_tree.cpp b/src/yuzu/debugger/wait_tree.cpp
index bdfda6c54..1f41c46c4 100644
--- a/src/yuzu/debugger/wait_tree.cpp
+++ b/src/yuzu/debugger/wait_tree.cpp
@@ -89,20 +89,20 @@ std::size_t WaitTreeItem::Row() const {
return row;
}
-std::vector<std::unique_ptr<WaitTreeThread>> WaitTreeItem::MakeThreadItemList() {
+std::vector<std::unique_ptr<WaitTreeThread>> WaitTreeItem::MakeThreadItemList(
+ Core::System& system) {
std::vector<std::unique_ptr<WaitTreeThread>> item_list;
std::size_t row = 0;
auto add_threads = [&](const std::vector<Kernel::KThread*>& threads) {
for (std::size_t i = 0; i < threads.size(); ++i) {
if (threads[i]->GetThreadTypeForDebugging() == Kernel::ThreadType::User) {
- item_list.push_back(std::make_unique<WaitTreeThread>(*threads[i]));
+ item_list.push_back(std::make_unique<WaitTreeThread>(*threads[i], system));
item_list.back()->row = row;
}
++row;
}
};
- const auto& system = Core::System::GetInstance();
add_threads(system.GlobalSchedulerContext().GetThreadList());
return item_list;
@@ -115,9 +115,10 @@ QString WaitTreeText::GetText() const {
return text;
}
-WaitTreeMutexInfo::WaitTreeMutexInfo(VAddr mutex_address, const Kernel::KHandleTable& handle_table)
- : mutex_address(mutex_address) {
- mutex_value = Core::System::GetInstance().Memory().Read32(mutex_address);
+WaitTreeMutexInfo::WaitTreeMutexInfo(VAddr mutex_address, const Kernel::KHandleTable& handle_table,
+ Core::System& system_)
+ : mutex_address(mutex_address), system{system_} {
+ mutex_value = system.Memory().Read32(mutex_address);
owner_handle = static_cast<Kernel::Handle>(mutex_value & Kernel::Svc::HandleWaitMask);
owner = handle_table.GetObject<Kernel::KThread>(owner_handle).GetPointerUnsafe();
}
@@ -136,12 +137,13 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeMutexInfo::GetChildren() cons
list.push_back(std::make_unique<WaitTreeText>(
tr("owner handle: 0x%1").arg(owner_handle, 8, 16, QLatin1Char{'0'})));
if (owner != nullptr) {
- list.push_back(std::make_unique<WaitTreeThread>(*owner));
+ list.push_back(std::make_unique<WaitTreeThread>(*owner, system));
}
return list;
}
-WaitTreeCallstack::WaitTreeCallstack(const Kernel::KThread& thread) : thread(thread) {}
+WaitTreeCallstack::WaitTreeCallstack(const Kernel::KThread& thread, Core::System& system_)
+ : thread(thread), system{system_} {}
WaitTreeCallstack::~WaitTreeCallstack() = default;
QString WaitTreeCallstack::GetText() const {
@@ -159,8 +161,7 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeCallstack::GetChildren() cons
return list;
}
- auto backtrace = Core::ARM_Interface::GetBacktraceFromContext(Core::System::GetInstance(),
- thread.GetContext64());
+ auto backtrace = Core::ARM_Interface::GetBacktraceFromContext(system, thread.GetContext64());
for (auto& entry : backtrace) {
std::string s = fmt::format("{:20}{:016X} {:016X} {:016X} {}", entry.module, entry.address,
@@ -172,8 +173,8 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeCallstack::GetChildren() cons
}
WaitTreeSynchronizationObject::WaitTreeSynchronizationObject(
- const Kernel::KSynchronizationObject& o)
- : object(o) {}
+ const Kernel::KSynchronizationObject& o, Core::System& system_)
+ : object(o), system{system_} {}
WaitTreeSynchronizationObject::~WaitTreeSynchronizationObject() = default;
WaitTreeExpandableItem::WaitTreeExpandableItem() = default;
@@ -191,16 +192,18 @@ QString WaitTreeSynchronizationObject::GetText() const {
}
std::unique_ptr<WaitTreeSynchronizationObject> WaitTreeSynchronizationObject::make(
- const Kernel::KSynchronizationObject& object) {
+ const Kernel::KSynchronizationObject& object, Core::System& system) {
const auto type =
static_cast<Kernel::KClassTokenGenerator::ObjectType>(object.GetTypeObj().GetClassToken());
switch (type) {
case Kernel::KClassTokenGenerator::ObjectType::KReadableEvent:
- return std::make_unique<WaitTreeEvent>(static_cast<const Kernel::KReadableEvent&>(object));
+ return std::make_unique<WaitTreeEvent>(static_cast<const Kernel::KReadableEvent&>(object),
+ system);
case Kernel::KClassTokenGenerator::ObjectType::KThread:
- return std::make_unique<WaitTreeThread>(static_cast<const Kernel::KThread&>(object));
+ return std::make_unique<WaitTreeThread>(static_cast<const Kernel::KThread&>(object),
+ system);
default:
- return std::make_unique<WaitTreeSynchronizationObject>(object);
+ return std::make_unique<WaitTreeSynchronizationObject>(object, system);
}
}
@@ -211,15 +214,15 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeSynchronizationObject::GetChi
if (threads.empty()) {
list.push_back(std::make_unique<WaitTreeText>(tr("waited by no thread")));
} else {
- list.push_back(std::make_unique<WaitTreeThreadList>(std::move(threads)));
+ list.push_back(std::make_unique<WaitTreeThreadList>(std::move(threads), system));
}
return list;
}
WaitTreeObjectList::WaitTreeObjectList(const std::vector<Kernel::KSynchronizationObject*>& list,
- bool w_all)
- : object_list(list), wait_all(w_all) {}
+ bool w_all, Core::System& system_)
+ : object_list(list), wait_all(w_all), system{system_} {}
WaitTreeObjectList::~WaitTreeObjectList() = default;
@@ -231,13 +234,14 @@ QString WaitTreeObjectList::GetText() const {
std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeObjectList::GetChildren() const {
std::vector<std::unique_ptr<WaitTreeItem>> list(object_list.size());
- std::transform(object_list.begin(), object_list.end(), list.begin(),
- [](const auto& t) { return WaitTreeSynchronizationObject::make(*t); });
+ std::transform(object_list.begin(), object_list.end(), list.begin(), [this](const auto& t) {
+ return WaitTreeSynchronizationObject::make(*t, system);
+ });
return list;
}
-WaitTreeThread::WaitTreeThread(const Kernel::KThread& thread)
- : WaitTreeSynchronizationObject(thread) {}
+WaitTreeThread::WaitTreeThread(const Kernel::KThread& thread, Core::System& system_)
+ : WaitTreeSynchronizationObject(thread, system_), system{system_} {}
WaitTreeThread::~WaitTreeThread() = default;
QString WaitTreeThread::GetText() const {
@@ -360,7 +364,8 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThread::GetChildren() const {
const VAddr mutex_wait_address = thread.GetMutexWaitAddressForDebugging();
if (mutex_wait_address != 0) {
const auto& handle_table = thread.GetOwnerProcess()->GetHandleTable();
- list.push_back(std::make_unique<WaitTreeMutexInfo>(mutex_wait_address, handle_table));
+ list.push_back(
+ std::make_unique<WaitTreeMutexInfo>(mutex_wait_address, handle_table, system));
} else {
list.push_back(std::make_unique<WaitTreeText>(tr("not waiting for mutex")));
}
@@ -369,20 +374,20 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThread::GetChildren() const {
thread.GetWaitReasonForDebugging() ==
Kernel::ThreadWaitReasonForDebugging::Synchronization) {
list.push_back(std::make_unique<WaitTreeObjectList>(thread.GetWaitObjectsForDebugging(),
- thread.IsCancellable()));
+ thread.IsCancellable(), system));
}
- list.push_back(std::make_unique<WaitTreeCallstack>(thread));
+ list.push_back(std::make_unique<WaitTreeCallstack>(thread, system));
return list;
}
-WaitTreeEvent::WaitTreeEvent(const Kernel::KReadableEvent& object)
- : WaitTreeSynchronizationObject(object) {}
+WaitTreeEvent::WaitTreeEvent(const Kernel::KReadableEvent& object, Core::System& system_)
+ : WaitTreeSynchronizationObject(object, system_) {}
WaitTreeEvent::~WaitTreeEvent() = default;
-WaitTreeThreadList::WaitTreeThreadList(std::vector<Kernel::KThread*>&& list)
- : thread_list(std::move(list)) {}
+WaitTreeThreadList::WaitTreeThreadList(std::vector<Kernel::KThread*>&& list, Core::System& system_)
+ : thread_list(std::move(list)), system{system_} {}
WaitTreeThreadList::~WaitTreeThreadList() = default;
QString WaitTreeThreadList::GetText() const {
@@ -392,11 +397,12 @@ QString WaitTreeThreadList::GetText() const {
std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThreadList::GetChildren() const {
std::vector<std::unique_ptr<WaitTreeItem>> list(thread_list.size());
std::transform(thread_list.begin(), thread_list.end(), list.begin(),
- [](const auto& t) { return std::make_unique<WaitTreeThread>(*t); });
+ [this](const auto& t) { return std::make_unique<WaitTreeThread>(*t, system); });
return list;
}
-WaitTreeModel::WaitTreeModel(QObject* parent) : QAbstractItemModel(parent) {}
+WaitTreeModel::WaitTreeModel(Core::System& system_, QObject* parent)
+ : QAbstractItemModel(parent), system{system_} {}
WaitTreeModel::~WaitTreeModel() = default;
QModelIndex WaitTreeModel::index(int row, int column, const QModelIndex& parent) const {
@@ -455,10 +461,11 @@ void WaitTreeModel::ClearItems() {
}
void WaitTreeModel::InitItems() {
- thread_items = WaitTreeItem::MakeThreadItemList();
+ thread_items = WaitTreeItem::MakeThreadItemList(system);
}
-WaitTreeWidget::WaitTreeWidget(QWidget* parent) : QDockWidget(tr("&Wait Tree"), parent) {
+WaitTreeWidget::WaitTreeWidget(Core::System& system_, QWidget* parent)
+ : QDockWidget(tr("&Wait Tree"), parent), system{system_} {
setObjectName(QStringLiteral("WaitTreeWidget"));
view = new QTreeView(this);
view->setHeaderHidden(true);
@@ -469,7 +476,7 @@ WaitTreeWidget::WaitTreeWidget(QWidget* parent) : QDockWidget(tr("&Wait Tree"),
WaitTreeWidget::~WaitTreeWidget() = default;
void WaitTreeWidget::OnDebugModeEntered() {
- if (!Core::System::GetInstance().IsPoweredOn())
+ if (!system.IsPoweredOn())
return;
model->InitItems();
view->setModel(model);
@@ -483,7 +490,7 @@ void WaitTreeWidget::OnDebugModeLeft() {
}
void WaitTreeWidget::OnEmulationStarting(EmuThread* emu_thread) {
- model = new WaitTreeModel(this);
+ model = new WaitTreeModel(system, this);
view->setModel(model);
setEnabled(false);
}
diff --git a/src/yuzu/debugger/wait_tree.h b/src/yuzu/debugger/wait_tree.h
index d450345df..ea4d2e299 100644
--- a/src/yuzu/debugger/wait_tree.h
+++ b/src/yuzu/debugger/wait_tree.h
@@ -18,6 +18,10 @@
class EmuThread;
+namespace Core {
+class System;
+}
+
namespace Kernel {
class KHandleTable;
class KReadableEvent;
@@ -42,7 +46,7 @@ public:
WaitTreeItem* Parent() const;
const std::vector<std::unique_ptr<WaitTreeItem>>& Children() const;
std::size_t Row() const;
- static std::vector<std::unique_ptr<WaitTreeThread>> MakeThreadItemList();
+ static std::vector<std::unique_ptr<WaitTreeThread>> MakeThreadItemList(Core::System& system);
private:
std::size_t row;
@@ -75,7 +79,8 @@ public:
class WaitTreeMutexInfo : public WaitTreeExpandableItem {
Q_OBJECT
public:
- explicit WaitTreeMutexInfo(VAddr mutex_address, const Kernel::KHandleTable& handle_table);
+ explicit WaitTreeMutexInfo(VAddr mutex_address, const Kernel::KHandleTable& handle_table,
+ Core::System& system_);
~WaitTreeMutexInfo() override;
QString GetText() const override;
@@ -86,12 +91,14 @@ private:
u32 mutex_value{};
Kernel::Handle owner_handle{};
Kernel::KThread* owner{};
+
+ Core::System& system;
};
class WaitTreeCallstack : public WaitTreeExpandableItem {
Q_OBJECT
public:
- explicit WaitTreeCallstack(const Kernel::KThread& thread);
+ explicit WaitTreeCallstack(const Kernel::KThread& thread, Core::System& system_);
~WaitTreeCallstack() override;
QString GetText() const override;
@@ -99,27 +106,34 @@ public:
private:
const Kernel::KThread& thread;
+
+ Core::System& system;
};
class WaitTreeSynchronizationObject : public WaitTreeExpandableItem {
Q_OBJECT
public:
- explicit WaitTreeSynchronizationObject(const Kernel::KSynchronizationObject& object);
+ explicit WaitTreeSynchronizationObject(const Kernel::KSynchronizationObject& object,
+ Core::System& system_);
~WaitTreeSynchronizationObject() override;
static std::unique_ptr<WaitTreeSynchronizationObject> make(
- const Kernel::KSynchronizationObject& object);
+ const Kernel::KSynchronizationObject& object, Core::System& system);
QString GetText() const override;
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
protected:
const Kernel::KSynchronizationObject& object;
+
+private:
+ Core::System& system;
};
class WaitTreeObjectList : public WaitTreeExpandableItem {
Q_OBJECT
public:
- WaitTreeObjectList(const std::vector<Kernel::KSynchronizationObject*>& list, bool wait_all);
+ WaitTreeObjectList(const std::vector<Kernel::KSynchronizationObject*>& list, bool wait_all,
+ Core::System& system_);
~WaitTreeObjectList() override;
QString GetText() const override;
@@ -128,30 +142,35 @@ public:
private:
const std::vector<Kernel::KSynchronizationObject*>& object_list;
bool wait_all;
+
+ Core::System& system;
};
class WaitTreeThread : public WaitTreeSynchronizationObject {
Q_OBJECT
public:
- explicit WaitTreeThread(const Kernel::KThread& thread);
+ explicit WaitTreeThread(const Kernel::KThread& thread, Core::System& system_);
~WaitTreeThread() override;
QString GetText() const override;
QColor GetColor() const override;
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
+
+private:
+ Core::System& system;
};
class WaitTreeEvent : public WaitTreeSynchronizationObject {
Q_OBJECT
public:
- explicit WaitTreeEvent(const Kernel::KReadableEvent& object);
+ explicit WaitTreeEvent(const Kernel::KReadableEvent& object, Core::System& system_);
~WaitTreeEvent() override;
};
class WaitTreeThreadList : public WaitTreeExpandableItem {
Q_OBJECT
public:
- explicit WaitTreeThreadList(std::vector<Kernel::KThread*>&& list);
+ explicit WaitTreeThreadList(std::vector<Kernel::KThread*>&& list, Core::System& system_);
~WaitTreeThreadList() override;
QString GetText() const override;
@@ -159,13 +178,15 @@ public:
private:
std::vector<Kernel::KThread*> thread_list;
+
+ Core::System& system;
};
class WaitTreeModel : public QAbstractItemModel {
Q_OBJECT
public:
- explicit WaitTreeModel(QObject* parent = nullptr);
+ explicit WaitTreeModel(Core::System& system_, QObject* parent = nullptr);
~WaitTreeModel() override;
QVariant data(const QModelIndex& index, int role) const override;
@@ -179,13 +200,15 @@ public:
private:
std::vector<std::unique_ptr<WaitTreeThread>> thread_items;
+
+ Core::System& system;
};
class WaitTreeWidget : public QDockWidget {
Q_OBJECT
public:
- explicit WaitTreeWidget(QWidget* parent = nullptr);
+ explicit WaitTreeWidget(Core::System& system_, QWidget* parent = nullptr);
~WaitTreeWidget() override;
public slots:
@@ -198,4 +221,6 @@ public slots:
private:
QTreeView* view;
WaitTreeModel* model;
+
+ Core::System& system;
};
diff --git a/src/yuzu/discord_impl.cpp b/src/yuzu/discord_impl.cpp
index a93733b26..66f928af6 100644
--- a/src/yuzu/discord_impl.cpp
+++ b/src/yuzu/discord_impl.cpp
@@ -13,7 +13,7 @@
namespace DiscordRPC {
-DiscordImpl::DiscordImpl() {
+DiscordImpl::DiscordImpl(Core::System& system_) : system{system_} {
DiscordEventHandlers handlers{};
// The number is the client ID for yuzu, it's used for images and the
@@ -35,12 +35,13 @@ void DiscordImpl::Update() {
std::chrono::system_clock::now().time_since_epoch())
.count();
std::string title;
- if (Core::System::GetInstance().IsPoweredOn())
- Core::System::GetInstance().GetAppLoader().ReadTitle(title);
+ if (system.IsPoweredOn()) {
+ system.GetAppLoader().ReadTitle(title);
+ }
DiscordRichPresence presence{};
presence.largeImageKey = "yuzu_logo";
presence.largeImageText = "yuzu is an emulator for the Nintendo Switch";
- if (Core::System::GetInstance().IsPoweredOn()) {
+ if (system.IsPoweredOn()) {
presence.state = title.c_str();
presence.details = "Currently in game";
} else {
diff --git a/src/yuzu/discord_impl.h b/src/yuzu/discord_impl.h
index 4bfda8cdf..03ad42681 100644
--- a/src/yuzu/discord_impl.h
+++ b/src/yuzu/discord_impl.h
@@ -6,15 +6,21 @@
#include "yuzu/discord.h"
+namespace Core {
+class System;
+}
+
namespace DiscordRPC {
class DiscordImpl : public DiscordInterface {
public:
- DiscordImpl();
+ DiscordImpl(Core::System& system_);
~DiscordImpl() override;
void Pause() override;
void Update() override;
+
+ Core::System& system;
};
} // namespace DiscordRPC
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index ba54423ff..6bd0f9ee9 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -304,8 +304,8 @@ void GameList::OnFilterCloseClicked() {
}
GameList::GameList(FileSys::VirtualFilesystem vfs, FileSys::ManualContentProvider* provider,
- GMainWindow* parent)
- : QWidget{parent}, vfs(std::move(vfs)), provider(provider) {
+ Core::System& system_, GMainWindow* parent)
+ : QWidget{parent}, vfs(std::move(vfs)), provider(provider), system{system_} {
watcher = new QFileSystemWatcher(this);
connect(watcher, &QFileSystemWatcher::directoryChanged, this, &GameList::RefreshGameDirectory);
@@ -737,7 +737,8 @@ void GameList::PopulateAsync(QVector<UISettings::GameDir>& game_dirs) {
emit ShouldCancelWorker();
- GameListWorker* worker = new GameListWorker(vfs, provider, game_dirs, compatibility_list);
+ GameListWorker* worker =
+ new GameListWorker(vfs, provider, game_dirs, compatibility_list, system);
connect(worker, &GameListWorker::EntryReady, this, &GameList::AddEntry, Qt::QueuedConnection);
connect(worker, &GameListWorker::DirEntryReady, this, &GameList::AddDirEntry,
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h
index 10339dcca..675469e66 100644
--- a/src/yuzu/game_list.h
+++ b/src/yuzu/game_list.h
@@ -72,7 +72,8 @@ public:
};
explicit GameList(std::shared_ptr<FileSys::VfsFilesystem> vfs,
- FileSys::ManualContentProvider* provider, GMainWindow* parent = nullptr);
+ FileSys::ManualContentProvider* provider, Core::System& system_,
+ GMainWindow* parent = nullptr);
~GameList() override;
QString GetLastFilterResultItem() const;
@@ -145,6 +146,8 @@ private:
CompatibilityList compatibility_list;
friend class GameListSearchField;
+
+ Core::System& system;
};
class GameListPlaceholder : public QWidget {
diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp
index 2d5492157..fd92b36df 100644
--- a/src/yuzu/game_list_worker.cpp
+++ b/src/yuzu/game_list_worker.cpp
@@ -228,16 +228,15 @@ QList<QStandardItem*> MakeGameListEntry(const std::string& path, const std::stri
GameListWorker::GameListWorker(FileSys::VirtualFilesystem vfs,
FileSys::ManualContentProvider* provider,
QVector<UISettings::GameDir>& game_dirs,
- const CompatibilityList& compatibility_list)
+ const CompatibilityList& compatibility_list, Core::System& system_)
: vfs(std::move(vfs)), provider(provider), game_dirs(game_dirs),
- compatibility_list(compatibility_list) {}
+ compatibility_list(compatibility_list), system{system_} {}
GameListWorker::~GameListWorker() = default;
void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) {
using namespace FileSys;
- auto& system = Core::System::GetInstance();
const auto& cache = dynamic_cast<ContentProviderUnion&>(system.GetContentProvider());
auto installed_games = cache.ListEntriesFilterOrigin(std::nullopt, TitleType::Application,
@@ -285,10 +284,7 @@ void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) {
void GameListWorker::ScanFileSystem(ScanTarget target, const std::string& dir_path, bool deep_scan,
GameListDir* parent_dir) {
- auto& system = Core::System::GetInstance();
-
- const auto callback = [this, target, parent_dir,
- &system](const std::filesystem::path& path) -> bool {
+ const auto callback = [this, target, parent_dir](const std::filesystem::path& path) -> bool {
if (stop_processing) {
// Breaks the callback loop.
return false;
diff --git a/src/yuzu/game_list_worker.h b/src/yuzu/game_list_worker.h
index 396bb2623..1383e9fbc 100644
--- a/src/yuzu/game_list_worker.h
+++ b/src/yuzu/game_list_worker.h
@@ -19,6 +19,10 @@
#include "common/common_types.h"
#include "yuzu/compatibility_list.h"
+namespace Core {
+class System;
+}
+
class QStandardItem;
namespace FileSys {
@@ -37,7 +41,7 @@ public:
explicit GameListWorker(std::shared_ptr<FileSys::VfsFilesystem> vfs,
FileSys::ManualContentProvider* provider,
QVector<UISettings::GameDir>& game_dirs,
- const CompatibilityList& compatibility_list);
+ const CompatibilityList& compatibility_list, Core::System& system_);
~GameListWorker() override;
/// Starts the processing of directory tree information.
@@ -80,4 +84,6 @@ private:
QStringList watch_list;
std::atomic_bool stop_processing;
+
+ Core::System& system;
};
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 552c2cc63..2af582fe5 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -104,6 +104,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
#include "core/telemetry_session.h"
#include "input_common/main.h"
#include "input_common/tas/tas_input.h"
+#include "ui_main.h"
#include "util/overlay_dialog.h"
#include "video_core/gpu.h"
#include "video_core/renderer_base.h"
@@ -171,7 +172,7 @@ void GMainWindow::ShowTelemetryCallout() {
"<br/><br/>Would you like to share your usage data with us?");
if (QMessageBox::question(this, tr("Telemetry"), telemetry_message) != QMessageBox::Yes) {
Settings::values.enable_telemetry = false;
- Core::System::GetInstance().ApplySettings();
+ system->ApplySettings();
}
}
@@ -191,14 +192,16 @@ static void RemoveCachedContents() {
}
GMainWindow::GMainWindow()
- : input_subsystem{std::make_shared<InputCommon::InputSubsystem>()},
- config{std::make_unique<Config>()}, vfs{std::make_shared<FileSys::RealVfsFilesystem>()},
+ : ui{std::make_unique<Ui::MainWindow>()}, system{std::make_unique<Core::System>()},
+ input_subsystem{std::make_shared<InputCommon::InputSubsystem>()},
+ config{std::make_unique<Config>(*system)},
+ vfs{std::make_shared<FileSys::RealVfsFilesystem>()},
provider{std::make_unique<FileSys::ManualContentProvider>()} {
Common::Log::Initialize();
LoadTranslation();
setAcceptDrops(true);
- ui.setupUi(this);
+ ui->setupUi(this);
statusBar()->hide();
default_theme_paths = QIcon::themeSearchPaths();
@@ -255,11 +258,10 @@ GMainWindow::GMainWindow()
show();
- Core::System::GetInstance().SetContentProvider(
- std::make_unique<FileSys::ContentProviderUnion>());
- Core::System::GetInstance().RegisterContentProvider(
- FileSys::ContentProviderUnionSlot::FrontendManual, provider.get());
- Core::System::GetInstance().GetFileSystemController().CreateFactories(*vfs);
+ system->SetContentProvider(std::make_unique<FileSys::ContentProviderUnion>());
+ system->RegisterContentProvider(FileSys::ContentProviderUnionSlot::FrontendManual,
+ provider.get());
+ system->GetFileSystemController().CreateFactories(*vfs);
// Remove cached contents generated during the previous session
RemoveCachedContents();
@@ -274,16 +276,16 @@ GMainWindow::GMainWindow()
ShowTelemetryCallout();
// make sure menubar has the arrow cursor instead of inheriting from this
- ui.menubar->setCursor(QCursor());
+ ui->menubar->setCursor(QCursor());
statusBar()->setCursor(QCursor());
mouse_hide_timer.setInterval(default_mouse_timeout);
connect(&mouse_hide_timer, &QTimer::timeout, this, &GMainWindow::HideMouseCursor);
- connect(ui.menubar, &QMenuBar::hovered, this, &GMainWindow::ShowMouseCursor);
+ connect(ui->menubar, &QMenuBar::hovered, this, &GMainWindow::ShowMouseCursor);
MigrateConfigFiles();
- ui.action_Fullscreen->setChecked(false);
+ ui->action_Fullscreen->setChecked(false);
QStringList args = QApplication::arguments();
@@ -302,7 +304,7 @@ GMainWindow::GMainWindow()
// Launch game in fullscreen mode
if (args[i] == QStringLiteral("-f")) {
- ui.action_Fullscreen->setChecked(true);
+ ui->action_Fullscreen->setChecked(true);
continue;
}
@@ -405,12 +407,12 @@ void GMainWindow::RegisterMetaTypes() {
qRegisterMetaType<Service::AM::Applets::WebExitReason>("Service::AM::Applets::WebExitReason");
// Register loader types
- qRegisterMetaType<Core::System::ResultStatus>("Core::System::ResultStatus");
+ qRegisterMetaType<Core::SystemResultStatus>("Core::SystemResultStatus");
}
void GMainWindow::ControllerSelectorReconfigureControllers(
const Core::Frontend::ControllerParameters& parameters) {
- QtControllerSelectorDialog dialog(this, parameters, input_subsystem.get());
+ QtControllerSelectorDialog dialog(this, parameters, input_subsystem.get(), *system);
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint |
Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
@@ -420,7 +422,7 @@ void GMainWindow::ControllerSelectorReconfigureControllers(
emit ControllerSelectorReconfigureFinished();
// Don't forget to apply settings.
- Core::System::GetInstance().ApplySettings();
+ system->ApplySettings();
config->Save();
UpdateStatusButtons();
@@ -454,8 +456,8 @@ void GMainWindow::SoftwareKeyboardInitialize(
return;
}
- software_keyboard = new QtSoftwareKeyboardDialog(render_window, Core::System::GetInstance(),
- is_inline, std::move(initialize_parameters));
+ software_keyboard = new QtSoftwareKeyboardDialog(render_window, *system, is_inline,
+ std::move(initialize_parameters));
if (is_inline) {
connect(
@@ -566,11 +568,11 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
return;
}
- QtNXWebEngineView web_browser_view(this, Core::System::GetInstance(), input_subsystem.get());
+ QtNXWebEngineView web_browser_view(this, *system, input_subsystem.get());
- ui.action_Pause->setEnabled(false);
- ui.action_Restart->setEnabled(false);
- ui.action_Stop->setEnabled(false);
+ ui->action_Pause->setEnabled(false);
+ ui->action_Restart->setEnabled(false);
+ ui->action_Stop->setEnabled(false);
{
QProgressDialog loading_progress(this);
@@ -634,7 +636,7 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
web_browser_view.SetFinished(true);
}
});
- ui.menubar->addAction(exit_action);
+ ui->menubar->addAction(exit_action);
while (!web_browser_view.IsFinished()) {
QCoreApplication::processEvents();
@@ -676,11 +678,11 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
render_window->show();
}
- ui.action_Pause->setEnabled(true);
- ui.action_Restart->setEnabled(true);
- ui.action_Stop->setEnabled(true);
+ ui->action_Pause->setEnabled(true);
+ ui->action_Restart->setEnabled(true);
+ ui->action_Stop->setEnabled(true);
- ui.menubar->removeAction(exit_action);
+ ui->menubar->removeAction(exit_action);
QCoreApplication::processEvents();
@@ -696,21 +698,21 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
void GMainWindow::InitializeWidgets() {
#ifdef YUZU_ENABLE_COMPATIBILITY_REPORTING
- ui.action_Report_Compatibility->setVisible(true);
+ ui->action_Report_Compatibility->setVisible(true);
#endif
- render_window = new GRenderWindow(this, emu_thread.get(), input_subsystem);
+ render_window = new GRenderWindow(this, emu_thread.get(), input_subsystem, *system);
render_window->hide();
- game_list = new GameList(vfs, provider.get(), this);
- ui.horizontalLayout->addWidget(game_list);
+ game_list = new GameList(vfs, provider.get(), *system, this);
+ ui->horizontalLayout->addWidget(game_list);
game_list_placeholder = new GameListPlaceholder(this);
- ui.horizontalLayout->addWidget(game_list_placeholder);
+ ui->horizontalLayout->addWidget(game_list_placeholder);
game_list_placeholder->setVisible(false);
loading_screen = new LoadingScreen(this);
loading_screen->hide();
- ui.horizontalLayout->addWidget(loading_screen);
+ ui->horizontalLayout->addWidget(loading_screen);
connect(loading_screen, &LoadingScreen::Hidden, [&] {
loading_screen->Clear();
if (emulation_running) {
@@ -767,14 +769,14 @@ void GMainWindow::InitializeWidgets() {
tr("Handheld controller can't be used on docked mode. Pro "
"controller will be selected."));
controller_type = Settings::ControllerType::ProController;
- ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get());
+ ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get(), *system);
configure_dialog.ApplyConfiguration();
controller_dialog->refreshConfiguration();
}
Settings::values.use_docked_mode.SetValue(!is_docked);
dock_status_button->setChecked(!is_docked);
- OnDockedModeChanged(is_docked, !is_docked);
+ OnDockedModeChanged(is_docked, !is_docked, *system);
});
dock_status_button->setText(tr("DOCK"));
dock_status_button->setCheckable(true);
@@ -798,7 +800,7 @@ void GMainWindow::InitializeWidgets() {
}
}
- Core::System::GetInstance().ApplySettings();
+ system->ApplySettings();
UpdateGPUAccuracyButton();
});
UpdateGPUAccuracyButton();
@@ -826,7 +828,7 @@ void GMainWindow::InitializeWidgets() {
Settings::values.renderer_backend.SetValue(Settings::RendererBackend::OpenGL);
}
- Core::System::GetInstance().ApplySettings();
+ system->ApplySettings();
});
statusBar()->insertPermanentWidget(0, renderer_status_button);
@@ -835,7 +837,7 @@ void GMainWindow::InitializeWidgets() {
}
void GMainWindow::InitializeDebugWidgets() {
- QMenu* debug_menu = ui.menu_View_Debugging;
+ QMenu* debug_menu = ui->menu_View_Debugging;
#if MICROPROFILE_ENABLED
microProfileDialog = new MicroProfileDialog(this);
@@ -843,7 +845,7 @@ void GMainWindow::InitializeDebugWidgets() {
debug_menu->addAction(microProfileDialog->toggleViewAction());
#endif
- waitTreeWidget = new WaitTreeWidget(this);
+ waitTreeWidget = new WaitTreeWidget(*system, this);
addDockWidget(Qt::LeftDockWidgetArea, waitTreeWidget);
waitTreeWidget->hide();
debug_menu->addAction(waitTreeWidget->toggleViewAction());
@@ -864,16 +866,16 @@ void GMainWindow::InitializeRecentFileMenuActions() {
actions_recent_files[i]->setVisible(false);
connect(actions_recent_files[i], &QAction::triggered, this, &GMainWindow::OnMenuRecentFile);
- ui.menu_recent_files->addAction(actions_recent_files[i]);
+ ui->menu_recent_files->addAction(actions_recent_files[i]);
}
- ui.menu_recent_files->addSeparator();
+ ui->menu_recent_files->addSeparator();
QAction* action_clear_recent_files = new QAction(this);
action_clear_recent_files->setText(tr("&Clear Recent Files"));
connect(action_clear_recent_files, &QAction::triggered, this, [this] {
UISettings::values.recent_files.clear();
UpdateRecentFiles();
});
- ui.menu_recent_files->addAction(action_clear_recent_files);
+ ui->menu_recent_files->addAction(action_clear_recent_files);
UpdateRecentFiles();
}
@@ -892,43 +894,43 @@ void GMainWindow::InitializeHotkeys() {
const QString fullscreen = QStringLiteral("Fullscreen");
const QString capture_screenshot = QStringLiteral("Capture Screenshot");
- ui.action_Load_File->setShortcut(hotkey_registry.GetKeySequence(main_window, load_file));
- ui.action_Load_File->setShortcutContext(
+ ui->action_Load_File->setShortcut(hotkey_registry.GetKeySequence(main_window, load_file));
+ ui->action_Load_File->setShortcutContext(
hotkey_registry.GetShortcutContext(main_window, load_file));
- ui.action_Load_Amiibo->setShortcut(hotkey_registry.GetKeySequence(main_window, load_amiibo));
- ui.action_Load_Amiibo->setShortcutContext(
+ ui->action_Load_Amiibo->setShortcut(hotkey_registry.GetKeySequence(main_window, load_amiibo));
+ ui->action_Load_Amiibo->setShortcutContext(
hotkey_registry.GetShortcutContext(main_window, load_amiibo));
- ui.action_Exit->setShortcut(hotkey_registry.GetKeySequence(main_window, exit_yuzu));
- ui.action_Exit->setShortcutContext(hotkey_registry.GetShortcutContext(main_window, exit_yuzu));
+ ui->action_Exit->setShortcut(hotkey_registry.GetKeySequence(main_window, exit_yuzu));
+ ui->action_Exit->setShortcutContext(hotkey_registry.GetShortcutContext(main_window, exit_yuzu));
- ui.action_Restart->setShortcut(hotkey_registry.GetKeySequence(main_window, restart_emulation));
- ui.action_Restart->setShortcutContext(
+ ui->action_Restart->setShortcut(hotkey_registry.GetKeySequence(main_window, restart_emulation));
+ ui->action_Restart->setShortcutContext(
hotkey_registry.GetShortcutContext(main_window, restart_emulation));
- ui.action_Stop->setShortcut(hotkey_registry.GetKeySequence(main_window, stop_emulation));
- ui.action_Stop->setShortcutContext(
+ ui->action_Stop->setShortcut(hotkey_registry.GetKeySequence(main_window, stop_emulation));
+ ui->action_Stop->setShortcutContext(
hotkey_registry.GetShortcutContext(main_window, stop_emulation));
- ui.action_Show_Filter_Bar->setShortcut(
+ ui->action_Show_Filter_Bar->setShortcut(
hotkey_registry.GetKeySequence(main_window, toggle_filter_bar));
- ui.action_Show_Filter_Bar->setShortcutContext(
+ ui->action_Show_Filter_Bar->setShortcutContext(
hotkey_registry.GetShortcutContext(main_window, toggle_filter_bar));
- ui.action_Show_Status_Bar->setShortcut(
+ ui->action_Show_Status_Bar->setShortcut(
hotkey_registry.GetKeySequence(main_window, toggle_status_bar));
- ui.action_Show_Status_Bar->setShortcutContext(
+ ui->action_Show_Status_Bar->setShortcutContext(
hotkey_registry.GetShortcutContext(main_window, toggle_status_bar));
- ui.action_Capture_Screenshot->setShortcut(
+ ui->action_Capture_Screenshot->setShortcut(
hotkey_registry.GetKeySequence(main_window, capture_screenshot));
- ui.action_Capture_Screenshot->setShortcutContext(
+ ui->action_Capture_Screenshot->setShortcutContext(
hotkey_registry.GetShortcutContext(main_window, capture_screenshot));
- ui.action_Fullscreen->setShortcut(
+ ui->action_Fullscreen->setShortcut(
hotkey_registry.GetHotkey(main_window, fullscreen, this)->key());
- ui.action_Fullscreen->setShortcutContext(
+ ui->action_Fullscreen->setShortcutContext(
hotkey_registry.GetShortcutContext(main_window, fullscreen));
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Load File"), this),
@@ -946,19 +948,19 @@ void GMainWindow::InitializeHotkeys() {
});
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Restart Emulation"), this),
&QShortcut::activated, this, [this] {
- if (!Core::System::GetInstance().IsPoweredOn()) {
+ if (!system->IsPoweredOn()) {
return;
}
BootGame(game_path);
});
connect(hotkey_registry.GetHotkey(main_window, fullscreen, render_window),
- &QShortcut::activated, ui.action_Fullscreen, &QAction::trigger);
+ &QShortcut::activated, ui->action_Fullscreen, &QAction::trigger);
connect(hotkey_registry.GetHotkey(main_window, fullscreen, render_window),
- &QShortcut::activatedAmbiguously, ui.action_Fullscreen, &QAction::trigger);
+ &QShortcut::activatedAmbiguously, ui->action_Fullscreen, &QAction::trigger);
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Exit Fullscreen"), this),
&QShortcut::activated, this, [&] {
if (emulation_running) {
- ui.action_Fullscreen->setChecked(false);
+ ui->action_Fullscreen->setChecked(false);
ToggleFullscreen();
}
});
@@ -987,7 +989,7 @@ void GMainWindow::InitializeHotkeys() {
});
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Load Amiibo"), this),
&QShortcut::activated, this, [&] {
- if (ui.action_Load_Amiibo->isEnabled()) {
+ if (ui->action_Load_Amiibo->isEnabled()) {
OnLoadAmiibo();
}
});
@@ -1002,7 +1004,7 @@ void GMainWindow::InitializeHotkeys() {
Settings::values.use_docked_mode.SetValue(
!Settings::values.use_docked_mode.GetValue());
OnDockedModeChanged(!Settings::values.use_docked_mode.GetValue(),
- Settings::values.use_docked_mode.GetValue());
+ Settings::values.use_docked_mode.GetValue(), *system);
dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue());
});
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Mute Audio"), this),
@@ -1068,20 +1070,20 @@ void GMainWindow::RestoreUIState() {
game_list->LoadInterfaceLayout();
- ui.action_Single_Window_Mode->setChecked(UISettings::values.single_window_mode.GetValue());
+ ui->action_Single_Window_Mode->setChecked(UISettings::values.single_window_mode.GetValue());
ToggleWindowMode();
- ui.action_Fullscreen->setChecked(UISettings::values.fullscreen.GetValue());
+ ui->action_Fullscreen->setChecked(UISettings::values.fullscreen.GetValue());
- ui.action_Display_Dock_Widget_Headers->setChecked(
+ ui->action_Display_Dock_Widget_Headers->setChecked(
UISettings::values.display_titlebar.GetValue());
- OnDisplayTitleBars(ui.action_Display_Dock_Widget_Headers->isChecked());
+ OnDisplayTitleBars(ui->action_Display_Dock_Widget_Headers->isChecked());
- ui.action_Show_Filter_Bar->setChecked(UISettings::values.show_filter_bar.GetValue());
- game_list->SetFilterVisible(ui.action_Show_Filter_Bar->isChecked());
+ ui->action_Show_Filter_Bar->setChecked(UISettings::values.show_filter_bar.GetValue());
+ game_list->SetFilterVisible(ui->action_Show_Filter_Bar->isChecked());
- ui.action_Show_Status_Bar->setChecked(UISettings::values.show_status_bar.GetValue());
- statusBar()->setVisible(ui.action_Show_Status_Bar->isChecked());
+ ui->action_Show_Status_Bar->setChecked(UISettings::values.show_status_bar.GetValue());
+ statusBar()->setVisible(ui->action_Show_Status_Bar->isChecked());
Debugger::ToggleConsole();
}
@@ -1093,11 +1095,11 @@ void GMainWindow::OnAppFocusStateChanged(Qt::ApplicationState state) {
state != Qt::ApplicationActive) {
LOG_DEBUG(Frontend, "ApplicationState unusual flag: {} ", state);
}
- if (ui.action_Pause->isEnabled() &&
+ if (ui->action_Pause->isEnabled() &&
(state & (Qt::ApplicationHidden | Qt::ApplicationInactive))) {
auto_paused = true;
OnPauseGame();
- } else if (ui.action_Start->isEnabled() && auto_paused && state == Qt::ApplicationActive) {
+ } else if (ui->action_Start->isEnabled() && auto_paused && state == Qt::ApplicationActive) {
auto_paused = false;
OnStartGame();
}
@@ -1142,53 +1144,60 @@ void GMainWindow::ConnectWidgetEvents() {
void GMainWindow::ConnectMenuEvents() {
// File
- connect(ui.action_Load_File, &QAction::triggered, this, &GMainWindow::OnMenuLoadFile);
- connect(ui.action_Load_Folder, &QAction::triggered, this, &GMainWindow::OnMenuLoadFolder);
- connect(ui.action_Install_File_NAND, &QAction::triggered, this,
+ connect(ui->action_Load_File, &QAction::triggered, this, &GMainWindow::OnMenuLoadFile);
+ connect(ui->action_Load_Folder, &QAction::triggered, this, &GMainWindow::OnMenuLoadFolder);
+ connect(ui->action_Install_File_NAND, &QAction::triggered, this,
&GMainWindow::OnMenuInstallToNAND);
- connect(ui.action_Exit, &QAction::triggered, this, &QMainWindow::close);
- connect(ui.action_Load_Amiibo, &QAction::triggered, this, &GMainWindow::OnLoadAmiibo);
+ connect(ui->action_Exit, &QAction::triggered, this, &QMainWindow::close);
+ connect(ui->action_Load_Amiibo, &QAction::triggered, this, &GMainWindow::OnLoadAmiibo);
// Emulation
- connect(ui.action_Start, &QAction::triggered, this, &GMainWindow::OnStartGame);
- connect(ui.action_Pause, &QAction::triggered, this, &GMainWindow::OnPauseGame);
- connect(ui.action_Stop, &QAction::triggered, this, &GMainWindow::OnStopGame);
- connect(ui.action_Report_Compatibility, &QAction::triggered, this,
+ connect(ui->action_Start, &QAction::triggered, this, &GMainWindow::OnStartGame);
+ connect(ui->action_Pause, &QAction::triggered, this, &GMainWindow::OnPauseGame);
+ connect(ui->action_Stop, &QAction::triggered, this, &GMainWindow::OnStopGame);
+ connect(ui->action_Report_Compatibility, &QAction::triggered, this,
&GMainWindow::OnMenuReportCompatibility);
- connect(ui.action_Open_Mods_Page, &QAction::triggered, this, &GMainWindow::OnOpenModsPage);
- connect(ui.action_Open_Quickstart_Guide, &QAction::triggered, this,
+ connect(ui->action_Open_Mods_Page, &QAction::triggered, this, &GMainWindow::OnOpenModsPage);
+ connect(ui->action_Open_Quickstart_Guide, &QAction::triggered, this,
&GMainWindow::OnOpenQuickstartGuide);
- connect(ui.action_Open_FAQ, &QAction::triggered, this, &GMainWindow::OnOpenFAQ);
- connect(ui.action_Restart, &QAction::triggered, this, [this] { BootGame(QString(game_path)); });
- connect(ui.action_Configure, &QAction::triggered, this, &GMainWindow::OnConfigure);
- connect(ui.action_Configure_Tas, &QAction::triggered, this, &GMainWindow::OnConfigureTas);
- connect(ui.action_Configure_Current_Game, &QAction::triggered, this,
+ connect(ui->action_Open_FAQ, &QAction::triggered, this, &GMainWindow::OnOpenFAQ);
+ connect(ui->action_Restart, &QAction::triggered, this,
+ [this] { BootGame(QString(game_path)); });
+ connect(ui->action_Configure, &QAction::triggered, this, &GMainWindow::OnConfigure);
+ connect(ui->action_Configure_Tas, &QAction::triggered, this, &GMainWindow::OnConfigureTas);
+ connect(ui->action_Configure_Current_Game, &QAction::triggered, this,
&GMainWindow::OnConfigurePerGame);
// View
- connect(ui.action_Single_Window_Mode, &QAction::triggered, this,
+ connect(ui->action_Single_Window_Mode, &QAction::triggered, this,
&GMainWindow::ToggleWindowMode);
- connect(ui.action_Display_Dock_Widget_Headers, &QAction::triggered, this,
+ connect(ui->action_Display_Dock_Widget_Headers, &QAction::triggered, this,
&GMainWindow::OnDisplayTitleBars);
- connect(ui.action_Show_Filter_Bar, &QAction::triggered, this, &GMainWindow::OnToggleFilterBar);
- connect(ui.action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible);
- connect(ui.action_Reset_Window_Size_720, &QAction::triggered, this,
+ connect(ui->action_Show_Filter_Bar, &QAction::triggered, this, &GMainWindow::OnToggleFilterBar);
+ connect(ui->action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible);
+
+ connect(ui->action_Reset_Window_Size_720, &QAction::triggered, this,
&GMainWindow::ResetWindowSize720);
- connect(ui.action_Reset_Window_Size_1080, &QAction::triggered, this,
+ connect(ui->action_Reset_Window_Size_900, &QAction::triggered, this,
+ &GMainWindow::ResetWindowSize900);
+ connect(ui->action_Reset_Window_Size_1080, &QAction::triggered, this,
&GMainWindow::ResetWindowSize1080);
+ ui->menu_Reset_Window_Size->addAction(ui->action_Reset_Window_Size_720);
+ ui->menu_Reset_Window_Size->addAction(ui->action_Reset_Window_Size_900);
+ ui->menu_Reset_Window_Size->addAction(ui->action_Reset_Window_Size_1080);
// Fullscreen
- connect(ui.action_Fullscreen, &QAction::triggered, this, &GMainWindow::ToggleFullscreen);
+ connect(ui->action_Fullscreen, &QAction::triggered, this, &GMainWindow::ToggleFullscreen);
// Movie
- connect(ui.action_Capture_Screenshot, &QAction::triggered, this,
+ connect(ui->action_Capture_Screenshot, &QAction::triggered, this,
&GMainWindow::OnCaptureScreenshot);
// Help
- connect(ui.action_Open_yuzu_Folder, &QAction::triggered, this, &GMainWindow::OnOpenYuzuFolder);
- connect(ui.action_Rederive, &QAction::triggered, this,
+ connect(ui->action_Open_yuzu_Folder, &QAction::triggered, this, &GMainWindow::OnOpenYuzuFolder);
+ connect(ui->action_Rederive, &QAction::triggered, this,
std::bind(&GMainWindow::OnReinitializeKeys, this, ReinitializeKeyBehavior::Warning));
- connect(ui.action_About, &QAction::triggered, this, &GMainWindow::OnAbout);
+ connect(ui->action_About, &QAction::triggered, this, &GMainWindow::OnAbout);
}
void GMainWindow::OnDisplayTitleBars(bool show) {
@@ -1232,10 +1241,9 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
return false;
}
- Core::System& system{Core::System::GetInstance()};
- system.SetFilesystem(vfs);
+ system->SetFilesystem(vfs);
- system.SetAppletFrontendSet({
+ system->SetAppletFrontendSet({
std::make_unique<QtControllerSelector>(*this), // Controller Selector
std::make_unique<QtErrorDisplay>(*this), // Error Display
nullptr, // Parental Controls
@@ -1245,14 +1253,14 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
std::make_unique<QtWebBrowser>(*this), // Web Browser
});
- const Core::System::ResultStatus result{
- system.Load(*render_window, filename.toStdString(), program_id, program_index)};
+ const Core::SystemResultStatus result{
+ system->Load(*render_window, filename.toStdString(), program_id, program_index)};
const auto drd_callout = (UISettings::values.callout_flags.GetValue() &
static_cast<u32>(CalloutFlag::DRDDeprecation)) == 0;
- if (result == Core::System::ResultStatus::Success &&
- system.GetAppLoader().GetFileType() == Loader::FileType::DeconstructedRomDirectory &&
+ if (result == Core::SystemResultStatus::Success &&
+ system->GetAppLoader().GetFileType() == Loader::FileType::DeconstructedRomDirectory &&
drd_callout) {
UISettings::values.callout_flags = UISettings::values.callout_flags.GetValue() |
static_cast<u32>(CalloutFlag::DRDDeprecation);
@@ -1266,14 +1274,14 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
"wiki</a>. This message will not be shown again."));
}
- if (result != Core::System::ResultStatus::Success) {
+ if (result != Core::SystemResultStatus::Success) {
switch (result) {
- case Core::System::ResultStatus::ErrorGetLoader:
+ case Core::SystemResultStatus::ErrorGetLoader:
LOG_CRITICAL(Frontend, "Failed to obtain loader for {}!", filename.toStdString());
QMessageBox::critical(this, tr("Error while loading ROM!"),
tr("The ROM format is not supported."));
break;
- case Core::System::ResultStatus::ErrorVideoCore:
+ case Core::SystemResultStatus::ErrorVideoCore:
QMessageBox::critical(
this, tr("An error occurred initializing the video core."),
tr("yuzu has encountered an error while running the video core, please see the "
@@ -1287,8 +1295,8 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
break;
default:
- if (result > Core::System::ResultStatus::ErrorLoader) {
- const u16 loader_id = static_cast<u16>(Core::System::ResultStatus::ErrorLoader);
+ if (result > Core::SystemResultStatus::ErrorLoader) {
+ const u16 loader_id = static_cast<u16>(Core::SystemResultStatus::ErrorLoader);
const u16 error_id = static_cast<u16>(result) - loader_id;
const std::string error_code = fmt::format("({:04X}-{:04X})", loader_id, error_id);
LOG_CRITICAL(Frontend, "Failed to load ROM! {}", error_code);
@@ -1316,7 +1324,7 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
}
game_path = filename;
- system.TelemetrySession().AddField(Common::Telemetry::FieldType::App, "Frontend", "Qt");
+ system->TelemetrySession().AddField(Common::Telemetry::FieldType::App, "Frontend", "Qt");
return true;
}
@@ -1342,9 +1350,8 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
last_filename_booted = filename;
- auto& system = Core::System::GetInstance();
const auto v_file = Core::GetGameFileFromPath(vfs, filename.toUtf8().constData());
- const auto loader = Loader::GetLoader(system, v_file, program_id, program_index);
+ const auto loader = Loader::GetLoader(*system, v_file, program_id, program_index);
if (loader != nullptr && loader->ReadProgramId(title_id) == Loader::ResultStatus::Success &&
type == StartGameType::Normal) {
@@ -1353,7 +1360,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
const auto config_file_name = title_id == 0
? Common::FS::PathToUTF8String(file_path.filename())
: fmt::format("{:016X}", title_id);
- Config per_game_config(config_file_name, Config::ConfigType::PerGameConfig);
+ Config per_game_config(*system, config_file_name, Config::ConfigType::PerGameConfig);
}
ConfigureVibration::SetAllVibrationDevices();
@@ -1376,16 +1383,16 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
return;
// Create and start the emulation thread
- emu_thread = std::make_unique<EmuThread>();
+ emu_thread = std::make_unique<EmuThread>(*system);
emit EmulationStarting(emu_thread.get());
emu_thread->start();
// Register an ExecuteProgram callback such that Core can execute a sub-program
- system.RegisterExecuteProgramCallback(
+ system->RegisterExecuteProgramCallback(
[this](std::size_t program_index) { render_window->ExecuteProgram(program_index); });
// Register an Exit callback such that Core can exit the currently running application.
- system.RegisterExitCallback([this]() { render_window->Exit(); });
+ system->RegisterExitCallback([this]() { render_window->Exit(); });
connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame);
connect(render_window, &GRenderWindow::MouseActivity, this, &GMainWindow::OnMouseActivity);
@@ -1401,7 +1408,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
// Update the GUI
UpdateStatusButtons();
- if (ui.action_Single_Window_Mode->isChecked()) {
+ if (ui->action_Single_Window_Mode->isChecked()) {
game_list->hide();
game_list_placeholder->hide();
}
@@ -1419,11 +1426,11 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
std::string title_name;
std::string title_version;
- const auto res = system.GetGameName(title_name);
+ const auto res = system->GetGameName(title_name);
- const auto metadata = [&system, title_id] {
- const FileSys::PatchManager pm(title_id, system.GetFileSystemController(),
- system.GetContentProvider());
+ const auto metadata = [this, title_id] {
+ const FileSys::PatchManager pm(title_id, system->GetFileSystemController(),
+ system->GetContentProvider());
return pm.GetControlMetadata();
}();
if (metadata.first != nullptr) {
@@ -1434,20 +1441,20 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
title_name = Common::FS::PathToUTF8String(
std::filesystem::path{filename.toStdU16String()}.filename());
}
- const bool is_64bit = system.Kernel().CurrentProcess()->Is64BitProcess();
+ const bool is_64bit = system->Kernel().CurrentProcess()->Is64BitProcess();
const auto instruction_set_suffix = is_64bit ? tr("(64-bit)") : tr("(32-bit)");
title_name = tr("%1 %2", "%1 is the title name. %2 indicates if the title is 64-bit or 32-bit")
.arg(QString::fromStdString(title_name), instruction_set_suffix)
.toStdString();
LOG_INFO(Frontend, "Booting game: {:016X} | {} | {}", title_id, title_name, title_version);
- const auto gpu_vendor = system.GPU().Renderer().GetDeviceVendor();
+ const auto gpu_vendor = system->GPU().Renderer().GetDeviceVendor();
UpdateWindowTitle(title_name, title_version, gpu_vendor);
- loading_screen->Prepare(system.GetAppLoader());
+ loading_screen->Prepare(system->GetAppLoader());
loading_screen->show();
emulation_running = true;
- if (ui.action_Fullscreen->isChecked()) {
+ if (ui->action_Fullscreen->isChecked()) {
ShowFullscreen();
}
OnStartGame();
@@ -1458,7 +1465,7 @@ void GMainWindow::ShutdownGame() {
return;
}
- if (ui.action_Fullscreen->isChecked()) {
+ if (ui->action_Fullscreen->isChecked()) {
HideFullscreen();
}
@@ -1479,15 +1486,15 @@ void GMainWindow::ShutdownGame() {
disconnect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame);
// Update the GUI
- ui.action_Start->setEnabled(false);
- ui.action_Start->setText(tr("Start"));
- ui.action_Pause->setEnabled(false);
- ui.action_Stop->setEnabled(false);
- ui.action_Restart->setEnabled(false);
- ui.action_Configure_Current_Game->setEnabled(false);
- ui.action_Report_Compatibility->setEnabled(false);
- ui.action_Load_Amiibo->setEnabled(false);
- ui.action_Capture_Screenshot->setEnabled(false);
+ ui->action_Start->setEnabled(false);
+ ui->action_Start->setText(tr("Start"));
+ ui->action_Pause->setEnabled(false);
+ ui->action_Stop->setEnabled(false);
+ ui->action_Restart->setEnabled(false);
+ ui->action_Configure_Current_Game->setEnabled(false);
+ ui->action_Report_Compatibility->setEnabled(false);
+ ui->action_Load_Amiibo->setEnabled(false);
+ ui->action_Capture_Screenshot->setEnabled(false);
render_window->hide();
loading_screen->hide();
loading_screen->Clear();
@@ -1549,7 +1556,7 @@ void GMainWindow::UpdateRecentFiles() {
}
// Enable the recent files menu if the list isn't empty
- ui.menu_recent_files->setEnabled(num_recent_files != 0);
+ ui->menu_recent_files->setEnabled(num_recent_files != 0);
}
void GMainWindow::OnGameListLoadFile(QString game_path, u64 program_id) {
@@ -1560,18 +1567,17 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
const std::string& game_path) {
std::filesystem::path path;
QString open_target;
- auto& system = Core::System::GetInstance();
- const auto [user_save_size, device_save_size] = [this, &game_path, &program_id, &system] {
- const FileSys::PatchManager pm{program_id, system.GetFileSystemController(),
- system.GetContentProvider()};
+ const auto [user_save_size, device_save_size] = [this, &game_path, &program_id] {
+ const FileSys::PatchManager pm{program_id, system->GetFileSystemController(),
+ system->GetContentProvider()};
const auto control = pm.GetControlMetadata().first;
if (control != nullptr) {
return std::make_pair(control->GetDefaultNormalSaveSize(),
control->GetDeviceSaveDataSize());
} else {
const auto file = Core::GetGameFileFromPath(vfs, game_path);
- const auto loader = Loader::GetLoader(system, file);
+ const auto loader = Loader::GetLoader(*system, file);
FileSys::NACP nacp{};
loader->ReadControlData(nacp);
@@ -1614,14 +1620,14 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
ASSERT(user_id);
const auto user_save_data_path = FileSys::SaveDataFactory::GetFullPath(
- system, FileSys::SaveDataSpaceId::NandUser, FileSys::SaveDataType::SaveData,
+ *system, FileSys::SaveDataSpaceId::NandUser, FileSys::SaveDataType::SaveData,
program_id, user_id->uuid, 0);
path = Common::FS::ConcatPathSafe(nand_dir, user_save_data_path);
} else {
// Device save data
const auto device_save_data_path = FileSys::SaveDataFactory::GetFullPath(
- system, FileSys::SaveDataSpaceId::NandUser, FileSys::SaveDataType::SaveData,
+ *system, FileSys::SaveDataSpaceId::NandUser, FileSys::SaveDataType::SaveData,
program_id, {}, 0);
path = Common::FS::ConcatPathSafe(nand_dir, device_save_data_path);
@@ -1660,7 +1666,7 @@ void GMainWindow::OnTransferableShaderCacheOpenFile(u64 program_id) {
const auto shader_cache_folder_path{shader_cache_dir / fmt::format("{:016x}", program_id)};
if (!Common::FS::CreateDirs(shader_cache_folder_path)) {
QMessageBox::warning(this, tr("Error Opening Transferable Shader Cache"),
- tr("Filed to create the shader cache directory for this title."));
+ tr("Failed to create the shader cache directory for this title."));
return;
}
const auto shader_path_string{Common::FS::PathToUTF8String(shader_cache_folder_path)};
@@ -1748,7 +1754,7 @@ void GMainWindow::OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryT
}
void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) {
- const auto& fs_controller = Core::System::GetInstance().GetFileSystemController();
+ const auto& fs_controller = system->GetFileSystemController();
const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(program_id) ||
fs_controller.GetSDMCContents()->RemoveExistingEntry(program_id);
@@ -1764,7 +1770,7 @@ void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) {
void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type) {
const auto update_id = program_id | 0x800;
- const auto& fs_controller = Core::System::GetInstance().GetFileSystemController();
+ const auto& fs_controller = system->GetFileSystemController();
const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(update_id) ||
fs_controller.GetSDMCContents()->RemoveExistingEntry(update_id);
@@ -1779,8 +1785,8 @@ void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type)
void GMainWindow::RemoveAddOnContent(u64 program_id, const QString& entry_type) {
u32 count{};
- const auto& fs_controller = Core::System::GetInstance().GetFileSystemController();
- const auto dlc_entries = Core::System::GetInstance().GetContentProvider().ListEntriesFilter(
+ const auto& fs_controller = system->GetFileSystemController();
+ const auto dlc_entries = system->GetContentProvider().ListEntriesFilter(
FileSys::TitleType::AOC, FileSys::ContentRecordType::Data);
for (const auto& entry : dlc_entries) {
@@ -1918,8 +1924,7 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa
"cancelled the operation."));
};
- auto& system = Core::System::GetInstance();
- const auto loader = Loader::GetLoader(system, vfs->OpenFile(game_path, FileSys::Mode::Read));
+ const auto loader = Loader::GetLoader(*system, vfs->OpenFile(game_path, FileSys::Mode::Read));
if (loader == nullptr) {
failed();
return;
@@ -1931,7 +1936,7 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa
return;
}
- const auto& installed = system.GetContentProvider();
+ const auto& installed = system->GetContentProvider();
const auto romfs_title_id = SelectRomFSDumpTarget(installed, program_id);
if (!romfs_title_id) {
@@ -1951,7 +1956,7 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa
if (*romfs_title_id == program_id) {
const u64 ivfc_offset = loader->ReadRomFSIVFCOffset();
- const FileSys::PatchManager pm{program_id, system.GetFileSystemController(), installed};
+ const FileSys::PatchManager pm{program_id, system->GetFileSystemController(), installed};
romfs =
pm.PatchRomFS(file, ivfc_offset, FileSys::ContentRecordType::Program, nullptr, false);
} else {
@@ -2077,7 +2082,7 @@ void GMainWindow::OnGameListAddDirectory() {
}
void GMainWindow::OnGameListShowList(bool show) {
- if (emulation_running && ui.action_Single_Window_Mode->isChecked())
+ if (emulation_running && ui->action_Single_Window_Mode->isChecked())
return;
game_list->setVisible(show);
game_list_placeholder->setVisible(!show);
@@ -2086,7 +2091,7 @@ void GMainWindow::OnGameListShowList(bool show) {
void GMainWindow::OnGameListOpenPerGameProperties(const std::string& file) {
u64 title_id{};
const auto v_file = Core::GetGameFileFromPath(vfs, file);
- const auto loader = Loader::GetLoader(Core::System::GetInstance(), v_file);
+ const auto loader = Loader::GetLoader(*system, v_file);
if (loader == nullptr || loader->ReadProgramId(title_id) != Loader::ResultStatus::Success) {
QMessageBox::information(this, tr("Properties"),
@@ -2179,7 +2184,7 @@ void GMainWindow::OnMenuInstallToNAND() {
QStringList failed_files{}; // Files that failed to install due to errors
bool detected_base_install{}; // Whether a base game was attempted to be installed
- ui.action_Install_File_NAND->setEnabled(false);
+ ui->action_Install_File_NAND->setEnabled(false);
install_progress = new QProgressDialog(QString{}, tr("Cancel"), 0, total_size, this);
install_progress->setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint &
@@ -2255,7 +2260,7 @@ void GMainWindow::OnMenuInstallToNAND() {
Common::FS::RemoveDirRecursively(Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir) /
"game_list");
game_list->PopulateAsync(UISettings::values.game_dirs);
- ui.action_Install_File_NAND->setEnabled(true);
+ ui->action_Install_File_NAND->setEnabled(true);
}
InstallResult GMainWindow::InstallNSPXCI(const QString& filename) {
@@ -2300,9 +2305,8 @@ InstallResult GMainWindow::InstallNSPXCI(const QString& filename) {
if (nsp->GetStatus() != Loader::ResultStatus::Success) {
return InstallResult::Failure;
}
- const auto res =
- Core::System::GetInstance().GetFileSystemController().GetUserNANDContents()->InstallEntry(
- *nsp, true, qt_raw_copy);
+ const auto res = system->GetFileSystemController().GetUserNANDContents()->InstallEntry(
+ *nsp, true, qt_raw_copy);
switch (res) {
case FileSys::InstallResult::Success:
return InstallResult::Success;
@@ -2380,19 +2384,13 @@ InstallResult GMainWindow::InstallNCA(const QString& filename) {
static_cast<size_t>(FileSys::TitleType::FirmwarePackageB);
}
- FileSys::InstallResult res;
- if (index >= static_cast<s32>(FileSys::TitleType::Application)) {
- res = Core::System::GetInstance()
- .GetFileSystemController()
- .GetUserNANDContents()
- ->InstallEntry(*nca, static_cast<FileSys::TitleType>(index), true, qt_raw_copy);
- } else {
- res = Core::System::GetInstance()
- .GetFileSystemController()
- .GetSystemNANDContents()
- ->InstallEntry(*nca, static_cast<FileSys::TitleType>(index), true, qt_raw_copy);
- }
+ const bool is_application = index >= static_cast<s32>(FileSys::TitleType::Application);
+ const auto& fs_controller = system->GetFileSystemController();
+ auto* registered_cache = is_application ? fs_controller.GetUserNANDContents()
+ : fs_controller.GetSystemNANDContents();
+ const auto res = registered_cache->InstallEntry(*nca, static_cast<FileSys::TitleType>(index),
+ true, qt_raw_copy);
if (res == FileSys::InstallResult::Success) {
return InstallResult::Success;
} else if (res == FileSys::InstallResult::OverwriteExisting) {
@@ -2426,40 +2424,39 @@ void GMainWindow::OnStartGame() {
connect(emu_thread.get(), &EmuThread::ErrorThrown, this, &GMainWindow::OnCoreError);
- ui.action_Start->setEnabled(false);
- ui.action_Start->setText(tr("&Continue"));
+ ui->action_Start->setEnabled(false);
+ ui->action_Start->setText(tr("&Continue"));
- ui.action_Pause->setEnabled(true);
- ui.action_Stop->setEnabled(true);
- ui.action_Restart->setEnabled(true);
- ui.action_Configure_Current_Game->setEnabled(true);
- ui.action_Report_Compatibility->setEnabled(true);
+ ui->action_Pause->setEnabled(true);
+ ui->action_Stop->setEnabled(true);
+ ui->action_Restart->setEnabled(true);
+ ui->action_Configure_Current_Game->setEnabled(true);
+ ui->action_Report_Compatibility->setEnabled(true);
discord_rpc->Update();
- ui.action_Load_Amiibo->setEnabled(true);
- ui.action_Capture_Screenshot->setEnabled(true);
+ ui->action_Load_Amiibo->setEnabled(true);
+ ui->action_Capture_Screenshot->setEnabled(true);
}
void GMainWindow::OnPauseGame() {
emu_thread->SetRunning(false);
- ui.action_Start->setEnabled(true);
- ui.action_Pause->setEnabled(false);
- ui.action_Stop->setEnabled(true);
- ui.action_Capture_Screenshot->setEnabled(false);
+ ui->action_Start->setEnabled(true);
+ ui->action_Pause->setEnabled(false);
+ ui->action_Stop->setEnabled(true);
+ ui->action_Capture_Screenshot->setEnabled(false);
AllowOSSleep();
}
void GMainWindow::OnStopGame() {
- auto& system{Core::System::GetInstance()};
- if (system.GetExitLock() && !ConfirmForceLockedExit()) {
+ if (system->GetExitLock() && !ConfirmForceLockedExit()) {
return;
}
ShutdownGame();
- Settings::RestoreGlobalState(system.IsPoweredOn());
+ Settings::RestoreGlobalState(system->IsPoweredOn());
UpdateStatusButtons();
}
@@ -2477,8 +2474,8 @@ void GMainWindow::OnExit() {
}
void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_text) {
- OverlayDialog dialog(render_window, Core::System::GetInstance(), error_code, error_text,
- QString{}, tr("OK"), Qt::AlignLeft | Qt::AlignVCenter);
+ OverlayDialog dialog(render_window, *system, error_code, error_text, QString{}, tr("OK"),
+ Qt::AlignLeft | Qt::AlignVCenter);
dialog.exec();
emit ErrorDisplayFinished();
@@ -2487,7 +2484,7 @@ void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_tex
void GMainWindow::OnMenuReportCompatibility() {
if (!Settings::values.yuzu_token.GetValue().empty() &&
!Settings::values.yuzu_username.GetValue().empty()) {
- CompatDB compatdb{this};
+ CompatDB compatdb{system->TelemetrySession(), this};
compatdb.exec();
} else {
QMessageBox::critical(
@@ -2523,7 +2520,7 @@ void GMainWindow::ToggleFullscreen() {
if (!emulation_running) {
return;
}
- if (ui.action_Fullscreen->isChecked()) {
+ if (ui->action_Fullscreen->isChecked()) {
ShowFullscreen();
} else {
HideFullscreen();
@@ -2531,10 +2528,10 @@ void GMainWindow::ToggleFullscreen() {
}
void GMainWindow::ShowFullscreen() {
- if (ui.action_Single_Window_Mode->isChecked()) {
+ if (ui->action_Single_Window_Mode->isChecked()) {
UISettings::values.geometry = saveGeometry();
- ui.menubar->hide();
+ ui->menubar->hide();
statusBar()->hide();
if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) {
@@ -2568,7 +2565,7 @@ void GMainWindow::ShowFullscreen() {
}
void GMainWindow::HideFullscreen() {
- if (ui.action_Single_Window_Mode->isChecked()) {
+ if (ui->action_Single_Window_Mode->isChecked()) {
if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) {
showNormal();
restoreGeometry(UISettings::values.geometry);
@@ -2580,8 +2577,8 @@ void GMainWindow::HideFullscreen() {
show();
}
- statusBar()->setVisible(ui.action_Show_Status_Bar->isChecked());
- ui.menubar->show();
+ statusBar()->setVisible(ui->action_Show_Status_Bar->isChecked());
+ ui->menubar->show();
} else {
if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) {
render_window->showNormal();
@@ -2597,10 +2594,10 @@ void GMainWindow::HideFullscreen() {
}
void GMainWindow::ToggleWindowMode() {
- if (ui.action_Single_Window_Mode->isChecked()) {
+ if (ui->action_Single_Window_Mode->isChecked()) {
// Render in the main window...
render_window->BackupGeometry();
- ui.horizontalLayout->addWidget(render_window);
+ ui->horizontalLayout->addWidget(render_window);
render_window->setFocusPolicy(Qt::StrongFocus);
if (emulation_running) {
render_window->setVisible(true);
@@ -2610,7 +2607,7 @@ void GMainWindow::ToggleWindowMode() {
} else {
// Render in a separate window...
- ui.horizontalLayout->removeWidget(render_window);
+ ui->horizontalLayout->removeWidget(render_window);
render_window->setParent(nullptr);
render_window->setFocusPolicy(Qt::NoFocus);
if (emulation_running) {
@@ -2621,39 +2618,37 @@ void GMainWindow::ToggleWindowMode() {
}
}
-void GMainWindow::ResetWindowSize720() {
+void GMainWindow::ResetWindowSize(u32 width, u32 height) {
const auto aspect_ratio = Layout::EmulationAspectRatio(
static_cast<Layout::AspectRatio>(Settings::values.aspect_ratio.GetValue()),
- static_cast<float>(Layout::ScreenUndocked::Height) / Layout::ScreenUndocked::Width);
- if (!ui.action_Single_Window_Mode->isChecked()) {
- render_window->resize(Layout::ScreenUndocked::Height / aspect_ratio,
- Layout::ScreenUndocked::Height);
+ static_cast<float>(height) / width);
+ if (!ui->action_Single_Window_Mode->isChecked()) {
+ render_window->resize(height / aspect_ratio, height);
} else {
- resize(Layout::ScreenUndocked::Height / aspect_ratio,
- Layout::ScreenUndocked::Height + menuBar()->height() +
- (ui.action_Show_Status_Bar->isChecked() ? statusBar()->height() : 0));
+ const bool show_status_bar = ui->action_Show_Status_Bar->isChecked();
+ const auto status_bar_height = show_status_bar ? statusBar()->height() : 0;
+ resize(height / aspect_ratio, height + menuBar()->height() + status_bar_height);
}
}
+void GMainWindow::ResetWindowSize720() {
+ ResetWindowSize(Layout::ScreenUndocked::Width, Layout::ScreenUndocked::Height);
+}
+
+void GMainWindow::ResetWindowSize900() {
+ ResetWindowSize(1600U, 900U);
+}
+
void GMainWindow::ResetWindowSize1080() {
- const auto aspect_ratio = Layout::EmulationAspectRatio(
- static_cast<Layout::AspectRatio>(Settings::values.aspect_ratio.GetValue()),
- static_cast<float>(Layout::ScreenDocked::Height) / Layout::ScreenDocked::Width);
- if (!ui.action_Single_Window_Mode->isChecked()) {
- render_window->resize(Layout::ScreenDocked::Height / aspect_ratio,
- Layout::ScreenDocked::Height);
- } else {
- resize(Layout::ScreenDocked::Height / aspect_ratio,
- Layout::ScreenDocked::Height + menuBar()->height() +
- (ui.action_Show_Status_Bar->isChecked() ? statusBar()->height() : 0));
- }
+ ResetWindowSize(Layout::ScreenDocked::Width, Layout::ScreenDocked::Height);
}
void GMainWindow::OnConfigure() {
const auto old_theme = UISettings::values.theme;
const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue();
- ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get());
+ Settings::SetConfiguringGlobal(true);
+ ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get(), *system);
connect(&configure_dialog, &ConfigureDialog::LanguageChanged, this,
&GMainWindow::OnLanguageChanged);
@@ -2689,7 +2684,7 @@ void GMainWindow::OnConfigure() {
Settings::values.disabled_addons.clear();
- config = std::make_unique<Config>();
+ config = std::make_unique<Config>(*system);
UISettings::values.reset_to_defaults = false;
UISettings::values.game_dirs = std::move(old_game_dirs);
@@ -2738,12 +2733,11 @@ void GMainWindow::OnConfigure() {
}
void GMainWindow::OnConfigureTas() {
- const auto& system = Core::System::GetInstance();
ConfigureTasDialog dialog(this);
const auto result = dialog.exec();
if (result != QDialog::Accepted && !UISettings::values.configuration_applied) {
- Settings::RestoreGlobalState(system.IsPoweredOn());
+ Settings::RestoreGlobalState(system->IsPoweredOn());
return;
} else if (result == QDialog::Accepted) {
dialog.ApplyConfiguration();
@@ -2751,20 +2745,20 @@ void GMainWindow::OnConfigureTas() {
}
void GMainWindow::OnConfigurePerGame() {
- const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID();
+ const u64 title_id = system->CurrentProcess()->GetTitleID();
OpenPerGameConfiguration(title_id, game_path.toStdString());
}
void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file_name) {
const auto v_file = Core::GetGameFileFromPath(vfs, file_name);
- const auto& system = Core::System::GetInstance();
- ConfigurePerGame dialog(this, title_id, file_name);
+ Settings::SetConfiguringGlobal(false);
+ ConfigurePerGame dialog(this, title_id, file_name, *system);
dialog.LoadFromFile(v_file);
const auto result = dialog.exec();
if (result != QDialog::Accepted && !UISettings::values.configuration_applied) {
- Settings::RestoreGlobalState(system.IsPoweredOn());
+ Settings::RestoreGlobalState(system->IsPoweredOn());
return;
} else if (result == QDialog::Accepted) {
dialog.ApplyConfiguration();
@@ -2776,7 +2770,7 @@ void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file
}
// Do not cause the global config to write local settings into the config file
- const bool is_powered_on = system.IsPoweredOn();
+ const bool is_powered_on = system->IsPoweredOn();
Settings::RestoreGlobalState(is_powered_on);
UISettings::values.configuration_applied = false;
@@ -2799,8 +2793,7 @@ void GMainWindow::OnLoadAmiibo() {
}
void GMainWindow::LoadAmiibo(const QString& filename) {
- Core::System& system{Core::System::GetInstance()};
- Service::SM::ServiceManager& sm = system.ServiceManager();
+ Service::SM::ServiceManager& sm = system->ServiceManager();
auto nfc = sm.GetService<Service::NFP::Module::Interface>("nfp:user");
if (nfc == nullptr) {
return;
@@ -2842,8 +2835,8 @@ void GMainWindow::OnAbout() {
}
void GMainWindow::OnToggleFilterBar() {
- game_list->SetFilterVisible(ui.action_Show_Filter_Bar->isChecked());
- if (ui.action_Show_Filter_Bar->isChecked()) {
+ game_list->SetFilterVisible(ui->action_Show_Filter_Bar->isChecked());
+ if (ui->action_Show_Filter_Bar->isChecked()) {
game_list->SetFilterFocus();
} else {
game_list->ClearFilter();
@@ -2851,7 +2844,7 @@ void GMainWindow::OnToggleFilterBar() {
}
void GMainWindow::OnCaptureScreenshot() {
- const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID();
+ const u64 title_id = system->CurrentProcess()->GetTitleID();
const auto screenshot_path =
QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir));
const auto date =
@@ -2957,9 +2950,8 @@ void GMainWindow::UpdateStatusBar() {
tas_label->clear();
}
- auto& system = Core::System::GetInstance();
- auto results = system.GetAndResetPerfStats();
- auto& shader_notify = system.GPU().ShaderNotify();
+ auto results = system->GetAndResetPerfStats();
+ auto& shader_notify = system->GPU().ShaderNotify();
const int shaders_building = shader_notify.ShadersBuilding();
if (shaders_building > 0) {
@@ -3021,7 +3013,7 @@ void GMainWindow::UpdateStatusButtons() {
}
void GMainWindow::UpdateUISettings() {
- if (!ui.action_Fullscreen->isChecked()) {
+ if (!ui->action_Fullscreen->isChecked()) {
UISettings::values.geometry = saveGeometry();
UISettings::values.renderwindow_geometry = render_window->saveGeometry();
}
@@ -3030,11 +3022,11 @@ void GMainWindow::UpdateUISettings() {
UISettings::values.microprofile_geometry = microProfileDialog->saveGeometry();
UISettings::values.microprofile_visible = microProfileDialog->isVisible();
#endif
- UISettings::values.single_window_mode = ui.action_Single_Window_Mode->isChecked();
- UISettings::values.fullscreen = ui.action_Fullscreen->isChecked();
- UISettings::values.display_titlebar = ui.action_Display_Dock_Widget_Headers->isChecked();
- UISettings::values.show_filter_bar = ui.action_Show_Filter_Bar->isChecked();
- UISettings::values.show_status_bar = ui.action_Show_Status_Bar->isChecked();
+ UISettings::values.single_window_mode = ui->action_Single_Window_Mode->isChecked();
+ UISettings::values.fullscreen = ui->action_Fullscreen->isChecked();
+ UISettings::values.display_titlebar = ui->action_Display_Dock_Widget_Headers->isChecked();
+ UISettings::values.show_filter_bar = ui->action_Show_Filter_Bar->isChecked();
+ UISettings::values.show_status_bar = ui->action_Show_Status_Bar->isChecked();
UISettings::values.first_start = false;
}
@@ -3060,7 +3052,7 @@ void GMainWindow::OnMouseActivity() {
}
}
-void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string details) {
+void GMainWindow::OnCoreError(Core::SystemResultStatus result, std::string details) {
QMessageBox::StandardButton answer;
QString status_message;
const QString common_message =
@@ -3075,7 +3067,7 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
"back to the game list? Continuing emulation may result in crashes, corrupted save "
"data, or other bugs.");
switch (result) {
- case Core::System::ResultStatus::ErrorSystemFiles: {
+ case Core::SystemResultStatus::ErrorSystemFiles: {
QString message;
if (details.empty()) {
message =
@@ -3091,7 +3083,7 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
break;
}
- case Core::System::ResultStatus::ErrorSharedFont: {
+ case Core::SystemResultStatus::ErrorSharedFont: {
const QString message =
tr("yuzu was unable to locate the Switch shared fonts. %1").arg(common_message);
answer = QMessageBox::question(this, tr("Shared Fonts Not Found"), message,
@@ -3120,7 +3112,7 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
if (emu_thread) {
ShutdownGame();
- Settings::RestoreGlobalState(Core::System::GetInstance().IsPoweredOn());
+ Settings::RestoreGlobalState(system->IsPoweredOn());
UpdateStatusButtons();
}
} else {
@@ -3162,9 +3154,8 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) {
const auto function = [this, &keys, &pdm] {
keys.PopulateFromPartitionData(pdm);
- auto& system = Core::System::GetInstance();
- system.GetFileSystemController().CreateFactories(*vfs);
- keys.DeriveETicket(pdm, system.GetContentProvider());
+ system->GetFileSystemController().CreateFactories(*vfs);
+ keys.DeriveETicket(pdm, system->GetContentProvider());
};
QString errors;
@@ -3206,7 +3197,7 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) {
prog.close();
}
- Core::System::GetInstance().GetFileSystemController().CreateFactories(*vfs);
+ system->GetFileSystemController().CreateFactories(*vfs);
if (behavior == ReinitializeKeyBehavior::Warning) {
game_list->PopulateAsync(UISettings::values.game_dirs);
@@ -3274,7 +3265,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) {
if (emu_thread != nullptr) {
ShutdownGame();
- Settings::RestoreGlobalState(Core::System::GetInstance().IsPoweredOn());
+ Settings::RestoreGlobalState(system->IsPoweredOn());
UpdateStatusButtons();
}
@@ -3349,7 +3340,7 @@ bool GMainWindow::ConfirmForceLockedExit() {
}
void GMainWindow::RequestGameExit() {
- auto& sm{Core::System::GetInstance().ServiceManager()};
+ auto& sm{system->ServiceManager()};
auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE");
auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE");
bool has_signalled = false;
@@ -3365,7 +3356,7 @@ void GMainWindow::RequestGameExit() {
}
void GMainWindow::filterBarSetChecked(bool state) {
- ui.action_Show_Filter_Bar->setChecked(state);
+ ui->action_Show_Filter_Bar->setChecked(state);
emit(OnToggleFilterBar());
}
@@ -3433,17 +3424,17 @@ void GMainWindow::OnLanguageChanged(const QString& locale) {
UISettings::values.language = locale;
LoadTranslation();
- ui.retranslateUi(this);
+ ui->retranslateUi(this);
UpdateWindowTitle();
if (emulation_running)
- ui.action_Start->setText(tr("&Continue"));
+ ui->action_Start->setText(tr("&Continue"));
}
void GMainWindow::SetDiscordEnabled([[maybe_unused]] bool state) {
#ifdef USE_DISCORD_PRESENCE
if (state) {
- discord_rpc = std::make_unique<DiscordRPC::DiscordImpl>();
+ discord_rpc = std::make_unique<DiscordRPC::DiscordImpl>(*system);
} else {
discord_rpc = std::make_unique<DiscordRPC::NullImpl>();
}
@@ -3497,8 +3488,7 @@ int main(int argc, char* argv[]) {
// generating shaders
setlocale(LC_ALL, "C");
- Core::System::InitializeGlobalInstance();
- GMainWindow main_window;
+ GMainWindow main_window{};
// After settings have been loaded by GMainWindow, apply the filter
main_window.show();
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index 60ce01471..aed15a0a0 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -13,9 +13,7 @@
#include <QTranslator>
#include "common/common_types.h"
-#include "core/core.h"
#include "core/hle/service/acc/profile_manager.h"
-#include "ui_main.h"
#include "yuzu/compatibility_list.h"
#include "yuzu/hotkeys.h"
@@ -45,6 +43,11 @@ enum class StartGameType {
Global, // Only uses global configuration
};
+namespace Core {
+enum class SystemResultStatus : u32;
+class System;
+} // namespace Core
+
namespace Core::Frontend {
struct ControllerParameters;
struct InlineAppearParameters;
@@ -73,6 +76,10 @@ enum class SwkbdReplyType : u32;
enum class WebExitReason : u32;
} // namespace Service::AM::Applets
+namespace Ui {
+class MainWindow;
+}
+
enum class EmulatedDirectoryTarget {
NAND,
SDMC,
@@ -107,7 +114,7 @@ class GMainWindow : public QMainWindow {
public:
void filterBarSetChecked(bool state);
void UpdateUITheme();
- GMainWindow();
+ explicit GMainWindow();
~GMainWindow() override;
bool DropAction(QDropEvent* event);
@@ -272,10 +279,12 @@ private slots:
void ShowFullscreen();
void HideFullscreen();
void ToggleWindowMode();
+ void ResetWindowSize(u32 width, u32 height);
void ResetWindowSize720();
+ void ResetWindowSize900();
void ResetWindowSize1080();
void OnCaptureScreenshot();
- void OnCoreError(Core::System::ResultStatus, std::string);
+ void OnCoreError(Core::SystemResultStatus, std::string);
void OnReinitializeKeys(ReinitializeKeyBehavior behavior);
void OnLanguageChanged(const QString& locale);
void OnMouseActivity();
@@ -304,8 +313,9 @@ private:
void OpenPerGameConfiguration(u64 title_id, const std::string& file_name);
QString GetTasStateDescription() const;
- Ui::MainWindow ui;
+ std::unique_ptr<Ui::MainWindow> ui;
+ std::unique_ptr<Core::System> system;
std::unique_ptr<DiscordRPC::DiscordInterface> discord_rpc;
std::shared_ptr<InputCommon::InputSubsystem> input_subsystem;
diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui
index 653c010d8..a62e39a06 100644
--- a/src/yuzu/main.ui
+++ b/src/yuzu/main.ui
@@ -78,6 +78,35 @@
<property name="title">
<string>&amp;View</string>
</property>
+ <widget class="QMenu" name="menu_Reset_Window_Size">
+ <property name="title">
+ <string>&amp;Reset Window Size</string>
+ </property>
+ </widget>
+ <action name="action_Reset_Window_Size_720">
+ <property name="text">
+ <string>Reset Window Size to &amp;720p</string>
+ </property>
+ <property name="iconText">
+ <string>Reset Window Size to 720p</string>
+ </property>
+ </action>
+ <action name="action_Reset_Window_Size_900">
+ <property name="text">
+ <string>Reset Window Size to &amp;900p</string>
+ </property>
+ <property name="iconText">
+ <string>Reset Window Size to 900p</string>
+ </property>
+ </action>
+ <action name="action_Reset_Window_Size_1080">
+ <property name="text">
+ <string>Reset Window Size to &amp;1080p</string>
+ </property>
+ <property name="iconText">
+ <string>Reset Window Size to 1080p</string>
+ </property>
+ </action>
<widget class="QMenu" name="menu_View_Debugging">
<property name="title">
<string>&amp;Debugging</string>
@@ -88,9 +117,8 @@
<addaction name="action_Display_Dock_Widget_Headers"/>
<addaction name="action_Show_Filter_Bar"/>
<addaction name="action_Show_Status_Bar"/>
- <addaction name="action_Reset_Window_Size_720"/>
- <addaction name="action_Reset_Window_Size_1080"/>
<addaction name="separator"/>
+ <addaction name="menu_Reset_Window_Size"/>
<addaction name="menu_View_Debugging"/>
</widget>
<widget class="QMenu" name="menu_Tools">
@@ -216,22 +244,6 @@
<string>Show Status Bar</string>
</property>
</action>
- <action name="action_Reset_Window_Size_720">
- <property name="text">
- <string>Reset Window Size to &amp;720p</string>
- </property>
- <property name="iconText">
- <string>Reset Window Size to 720p</string>
- </property>
- </action>
- <action name="action_Reset_Window_Size_1080">
- <property name="text">
- <string>Reset Window Size to &amp;1080p</string>
- </property>
- <property name="iconText">
- <string>Reset Window Size to 1080p</string>
- </property>
- </action>
<action name="action_Fullscreen">
<property name="checkable">
<bool>true</bool>
diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h
index 81f741f20..cac19452f 100644
--- a/src/yuzu/uisettings.h
+++ b/src/yuzu/uisettings.h
@@ -60,7 +60,7 @@ struct Values {
Settings::BasicSetting<bool> confirm_before_closing{true, "confirmClose"};
Settings::BasicSetting<bool> first_start{true, "firstStart"};
Settings::BasicSetting<bool> pause_when_in_background{false, "pauseWhenInBackground"};
- Settings::BasicSetting<bool> hide_mouse{false, "hideInactiveMouse"};
+ Settings::BasicSetting<bool> hide_mouse{true, "hideInactiveMouse"};
Settings::BasicSetting<bool> select_user_on_boot{false, "select_user_on_boot"};
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp
index 434518d53..8ca20679a 100644
--- a/src/yuzu_cmd/config.cpp
+++ b/src/yuzu_cmd/config.cpp
@@ -518,6 +518,9 @@ void Config::ReadValues() {
ReadSetting("WebService", Settings::values.web_api_url);
ReadSetting("WebService", Settings::values.yuzu_username);
ReadSetting("WebService", Settings::values.yuzu_token);
+
+ // Network
+ ReadSetting("Network", Settings::values.network_interface);
}
void Config::Reload() {
diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h
index 8119a50d8..339dca766 100644
--- a/src/yuzu_cmd/default_ini.h
+++ b/src/yuzu_cmd/default_ini.h
@@ -428,6 +428,12 @@ web_api_url = https://api.yuzu-emu.org
yuzu_username =
yuzu_token =
+[Network]
+# Name of the network interface device to use with yuzu LAN play.
+# e.g. On *nix: 'enp7s0', 'wlp6s0u1u3u3', 'lo'
+# e.g. On Windows: 'Ethernet', 'Wi-Fi'
+network_interface =
+
[AddOns]
# Used to disable add-ons
# List of title IDs of games that will have add-ons disabled (separated by '|'):
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp
index ba2c993ba..67587cc54 100644
--- a/src/yuzu_cmd/yuzu.cpp
+++ b/src/yuzu_cmd/yuzu.cpp
@@ -146,9 +146,8 @@ int main(int argc, char** argv) {
return -1;
}
- Core::System::InitializeGlobalInstance();
- auto& system{Core::System::GetInstance()};
- InputCommon::InputSubsystem input_subsystem;
+ Core::System system{};
+ InputCommon::InputSubsystem input_subsystem{};
// Apply the command line arguments
system.ApplySettings();
@@ -167,27 +166,27 @@ int main(int argc, char** argv) {
system.SetFilesystem(std::make_shared<FileSys::RealVfsFilesystem>());
system.GetFileSystemController().CreateFactories(*system.GetFilesystem());
- const Core::System::ResultStatus load_result{system.Load(*emu_window, filepath)};
+ const Core::SystemResultStatus load_result{system.Load(*emu_window, filepath)};
switch (load_result) {
- case Core::System::ResultStatus::ErrorGetLoader:
+ case Core::SystemResultStatus::ErrorGetLoader:
LOG_CRITICAL(Frontend, "Failed to obtain loader for {}!", filepath);
return -1;
- case Core::System::ResultStatus::ErrorLoader:
+ case Core::SystemResultStatus::ErrorLoader:
LOG_CRITICAL(Frontend, "Failed to load ROM!");
return -1;
- case Core::System::ResultStatus::ErrorNotInitialized:
+ case Core::SystemResultStatus::ErrorNotInitialized:
LOG_CRITICAL(Frontend, "CPUCore not initialized");
return -1;
- case Core::System::ResultStatus::ErrorVideoCore:
+ case Core::SystemResultStatus::ErrorVideoCore:
LOG_CRITICAL(Frontend, "Failed to initialize VideoCore!");
return -1;
- case Core::System::ResultStatus::Success:
+ case Core::SystemResultStatus::Success:
break; // Expected case
default:
if (static_cast<u32>(load_result) >
- static_cast<u32>(Core::System::ResultStatus::ErrorLoader)) {
- const u16 loader_id = static_cast<u16>(Core::System::ResultStatus::ErrorLoader);
+ static_cast<u32>(Core::SystemResultStatus::ErrorLoader)) {
+ const u16 loader_id = static_cast<u16>(Core::SystemResultStatus::ErrorLoader);
const u16 error_id = static_cast<u16>(load_result) - loader_id;
LOG_CRITICAL(Frontend,
"While attempting to load the ROM requested, an error occurred. Please "