early-access version 3190

This commit is contained in:
pineappleEA 2022-12-06 15:54:52 +01:00
parent d58b981076
commit dd16f58704
36 changed files with 156 additions and 170 deletions

View file

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 3189. This is the source code for early-access 3190.
## Legal Notice ## Legal Notice

View file

@ -16,7 +16,7 @@ DefaultControllerApplet::DefaultControllerApplet(HID::HIDCore& hid_core_) : hid_
DefaultControllerApplet::~DefaultControllerApplet() = default; DefaultControllerApplet::~DefaultControllerApplet() = default;
void DefaultControllerApplet::ReconfigureControllers(std::function<void()> callback, void DefaultControllerApplet::ReconfigureControllers(ReconfigureCallback callback,
const ControllerParameters& parameters) const { const ControllerParameters& parameters) const {
LOG_INFO(Service_HID, "called, deducing the best configuration based on the given parameters!"); LOG_INFO(Service_HID, "called, deducing the best configuration based on the given parameters!");

View file

@ -36,9 +36,11 @@ struct ControllerParameters {
class ControllerApplet { class ControllerApplet {
public: public:
using ReconfigureCallback = std::function<void()>;
virtual ~ControllerApplet(); virtual ~ControllerApplet();
virtual void ReconfigureControllers(std::function<void()> callback, virtual void ReconfigureControllers(ReconfigureCallback callback,
const ControllerParameters& parameters) const = 0; const ControllerParameters& parameters) const = 0;
}; };
@ -47,7 +49,7 @@ public:
explicit DefaultControllerApplet(HID::HIDCore& hid_core_); explicit DefaultControllerApplet(HID::HIDCore& hid_core_);
~DefaultControllerApplet() override; ~DefaultControllerApplet() override;
void ReconfigureControllers(std::function<void()> callback, void ReconfigureControllers(ReconfigureCallback callback,
const ControllerParameters& parameters) const override; const ControllerParameters& parameters) const override;
private: private:

View file

@ -8,13 +8,13 @@ namespace Core::Frontend {
ErrorApplet::~ErrorApplet() = default; ErrorApplet::~ErrorApplet() = default;
void DefaultErrorApplet::ShowError(Result error, std::function<void()> finished) const { void DefaultErrorApplet::ShowError(Result error, FinishedCallback finished) const {
LOG_CRITICAL(Service_Fatal, "Application requested error display: {:04}-{:04} (raw={:08X})", LOG_CRITICAL(Service_Fatal, "Application requested error display: {:04}-{:04} (raw={:08X})",
error.module.Value(), error.description.Value(), error.raw); error.module.Value(), error.description.Value(), error.raw);
} }
void DefaultErrorApplet::ShowErrorWithTimestamp(Result error, std::chrono::seconds time, void DefaultErrorApplet::ShowErrorWithTimestamp(Result error, std::chrono::seconds time,
std::function<void()> finished) const { FinishedCallback finished) const {
LOG_CRITICAL( LOG_CRITICAL(
Service_Fatal, Service_Fatal,
"Application requested error display: {:04X}-{:04X} (raw={:08X}) with timestamp={:016X}", "Application requested error display: {:04X}-{:04X} (raw={:08X}) with timestamp={:016X}",
@ -23,7 +23,7 @@ void DefaultErrorApplet::ShowErrorWithTimestamp(Result error, std::chrono::secon
void DefaultErrorApplet::ShowCustomErrorText(Result error, std::string main_text, void DefaultErrorApplet::ShowCustomErrorText(Result error, std::string main_text,
std::string detail_text, std::string detail_text,
std::function<void()> finished) const { FinishedCallback finished) const {
LOG_CRITICAL(Service_Fatal, LOG_CRITICAL(Service_Fatal,
"Application requested custom error with error_code={:04X}-{:04X} (raw={:08X})", "Application requested custom error with error_code={:04X}-{:04X} (raw={:08X})",
error.module.Value(), error.description.Value(), error.raw); error.module.Value(), error.description.Value(), error.raw);

View file

@ -12,25 +12,27 @@ namespace Core::Frontend {
class ErrorApplet { class ErrorApplet {
public: public:
using FinishedCallback = std::function<void()>;
virtual ~ErrorApplet(); virtual ~ErrorApplet();
virtual void ShowError(Result error, std::function<void()> finished) const = 0; virtual void ShowError(Result error, FinishedCallback finished) const = 0;
virtual void ShowErrorWithTimestamp(Result error, std::chrono::seconds time, virtual void ShowErrorWithTimestamp(Result error, std::chrono::seconds time,
std::function<void()> finished) const = 0; FinishedCallback finished) const = 0;
virtual void ShowCustomErrorText(Result error, std::string dialog_text, virtual void ShowCustomErrorText(Result error, std::string dialog_text,
std::string fullscreen_text, std::string fullscreen_text,
std::function<void()> finished) const = 0; FinishedCallback finished) const = 0;
}; };
class DefaultErrorApplet final : public ErrorApplet { class DefaultErrorApplet final : public ErrorApplet {
public: public:
void ShowError(Result error, std::function<void()> finished) const override; void ShowError(Result error, FinishedCallback finished) const override;
void ShowErrorWithTimestamp(Result error, std::chrono::seconds time, void ShowErrorWithTimestamp(Result error, std::chrono::seconds time,
std::function<void()> finished) const override; FinishedCallback finished) const override;
void ShowCustomErrorText(Result error, std::string main_text, std::string detail_text, void ShowCustomErrorText(Result error, std::string main_text, std::string detail_text,
std::function<void()> finished) const override; FinishedCallback finished) const override;
}; };
} // namespace Core::Frontend } // namespace Core::Frontend

View file

@ -8,7 +8,7 @@ namespace Core::Frontend {
MiiEditApplet::~MiiEditApplet() = default; MiiEditApplet::~MiiEditApplet() = default;
void DefaultMiiEditApplet::ShowMiiEdit(const std::function<void()>& callback) const { void DefaultMiiEditApplet::ShowMiiEdit(const MiiEditCallback& callback) const {
LOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
callback(); callback();

View file

@ -9,14 +9,16 @@ namespace Core::Frontend {
class MiiEditApplet { class MiiEditApplet {
public: public:
using MiiEditCallback = std::function<void()>;
virtual ~MiiEditApplet(); virtual ~MiiEditApplet();
virtual void ShowMiiEdit(const std::function<void()>& callback) const = 0; virtual void ShowMiiEdit(const MiiEditCallback& callback) const = 0;
}; };
class DefaultMiiEditApplet final : public MiiEditApplet { class DefaultMiiEditApplet final : public MiiEditApplet {
public: public:
void ShowMiiEdit(const std::function<void()>& callback) const override; void ShowMiiEdit(const MiiEditCallback& callback) const override;
}; };
} // namespace Core::Frontend } // namespace Core::Frontend

View file

@ -9,8 +9,7 @@ namespace Core::Frontend {
ProfileSelectApplet::~ProfileSelectApplet() = default; ProfileSelectApplet::~ProfileSelectApplet() = default;
void DefaultProfileSelectApplet::SelectProfile( void DefaultProfileSelectApplet::SelectProfile(SelectProfileCallback callback) const {
std::function<void(std::optional<Common::UUID>)> callback) const {
Service::Account::ProfileManager manager; Service::Account::ProfileManager manager;
callback(manager.GetUser(Settings::values.current_user.GetValue()).value_or(Common::UUID{})); callback(manager.GetUser(Settings::values.current_user.GetValue()).value_or(Common::UUID{}));
LOG_INFO(Service_ACC, "called, selecting current user instead of prompting..."); LOG_INFO(Service_ACC, "called, selecting current user instead of prompting...");

View file

@ -11,14 +11,16 @@ namespace Core::Frontend {
class ProfileSelectApplet { class ProfileSelectApplet {
public: public:
using SelectProfileCallback = std::function<void(std::optional<Common::UUID>)>;
virtual ~ProfileSelectApplet(); virtual ~ProfileSelectApplet();
virtual void SelectProfile(std::function<void(std::optional<Common::UUID>)> callback) const = 0; virtual void SelectProfile(SelectProfileCallback callback) const = 0;
}; };
class DefaultProfileSelectApplet final : public ProfileSelectApplet { class DefaultProfileSelectApplet final : public ProfileSelectApplet {
public: public:
void SelectProfile(std::function<void(std::optional<Common::UUID>)> callback) const override; void SelectProfile(SelectProfileCallback callback) const override;
}; };
} // namespace Core::Frontend } // namespace Core::Frontend

View file

@ -15,10 +15,7 @@ DefaultSoftwareKeyboardApplet::~DefaultSoftwareKeyboardApplet() = default;
void DefaultSoftwareKeyboardApplet::InitializeKeyboard( void DefaultSoftwareKeyboardApplet::InitializeKeyboard(
bool is_inline, KeyboardInitializeParameters initialize_parameters, bool is_inline, KeyboardInitializeParameters initialize_parameters,
std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)> SubmitNormalCallback submit_normal_callback_, SubmitInlineCallback submit_inline_callback_) {
submit_normal_callback_,
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
submit_inline_callback_) {
if (is_inline) { if (is_inline) {
LOG_WARNING( LOG_WARNING(
Service_AM, Service_AM,

View file

@ -54,14 +54,17 @@ struct InlineTextParameters {
class SoftwareKeyboardApplet { class SoftwareKeyboardApplet {
public: public:
using SubmitInlineCallback =
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>;
using SubmitNormalCallback =
std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>;
virtual ~SoftwareKeyboardApplet(); virtual ~SoftwareKeyboardApplet();
virtual void InitializeKeyboard( virtual void InitializeKeyboard(bool is_inline,
bool is_inline, KeyboardInitializeParameters initialize_parameters, KeyboardInitializeParameters initialize_parameters,
std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)> SubmitNormalCallback submit_normal_callback_,
submit_normal_callback_, SubmitInlineCallback submit_inline_callback_) = 0;
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
submit_inline_callback_) = 0;
virtual void ShowNormalKeyboard() const = 0; virtual void ShowNormalKeyboard() const = 0;
@ -81,12 +84,9 @@ class DefaultSoftwareKeyboardApplet final : public SoftwareKeyboardApplet {
public: public:
~DefaultSoftwareKeyboardApplet() override; ~DefaultSoftwareKeyboardApplet() override;
void InitializeKeyboard( void InitializeKeyboard(bool is_inline, KeyboardInitializeParameters initialize_parameters,
bool is_inline, KeyboardInitializeParameters initialize_parameters, SubmitNormalCallback submit_normal_callback_,
std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)> SubmitInlineCallback submit_inline_callback_) override;
submit_normal_callback_,
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
submit_inline_callback_) override;
void ShowNormalKeyboard() const override; void ShowNormalKeyboard() const override;
@ -105,12 +105,10 @@ private:
void SubmitNormalText(std::u16string text) const; void SubmitNormalText(std::u16string text) const;
void SubmitInlineText(std::u16string_view text) const; void SubmitInlineText(std::u16string_view text) const;
KeyboardInitializeParameters parameters; KeyboardInitializeParameters parameters{};
mutable std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)> mutable SubmitNormalCallback submit_normal_callback;
submit_normal_callback; mutable SubmitInlineCallback submit_inline_callback;
mutable std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
submit_inline_callback;
}; };
} // namespace Core::Frontend } // namespace Core::Frontend

View file

@ -10,18 +10,17 @@ WebBrowserApplet::~WebBrowserApplet() = default;
DefaultWebBrowserApplet::~DefaultWebBrowserApplet() = default; DefaultWebBrowserApplet::~DefaultWebBrowserApplet() = default;
void DefaultWebBrowserApplet::OpenLocalWebPage( void DefaultWebBrowserApplet::OpenLocalWebPage(const std::string& local_url,
const std::string& local_url, std::function<void()> extract_romfs_callback, ExtractROMFSCallback extract_romfs_callback,
std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const { OpenWebPageCallback callback) const {
LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open local web page at {}", LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open local web page at {}",
local_url); local_url);
callback(Service::AM::Applets::WebExitReason::WindowClosed, "http://localhost/"); callback(Service::AM::Applets::WebExitReason::WindowClosed, "http://localhost/");
} }
void DefaultWebBrowserApplet::OpenExternalWebPage( void DefaultWebBrowserApplet::OpenExternalWebPage(const std::string& external_url,
const std::string& external_url, OpenWebPageCallback callback) const {
std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const {
LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open external web page at {}", LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open external web page at {}",
external_url); external_url);

View file

@ -11,29 +11,29 @@ namespace Core::Frontend {
class WebBrowserApplet { class WebBrowserApplet {
public: public:
using ExtractROMFSCallback = std::function<void()>;
using OpenWebPageCallback =
std::function<void(Service::AM::Applets::WebExitReason, std::string)>;
virtual ~WebBrowserApplet(); virtual ~WebBrowserApplet();
virtual void OpenLocalWebPage( virtual void OpenLocalWebPage(const std::string& local_url,
const std::string& local_url, std::function<void()> extract_romfs_callback, ExtractROMFSCallback extract_romfs_callback,
std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0; OpenWebPageCallback callback) const = 0;
virtual void OpenExternalWebPage( virtual void OpenExternalWebPage(const std::string& external_url,
const std::string& external_url, OpenWebPageCallback callback) const = 0;
std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0;
}; };
class DefaultWebBrowserApplet final : public WebBrowserApplet { class DefaultWebBrowserApplet final : public WebBrowserApplet {
public: public:
~DefaultWebBrowserApplet() override; ~DefaultWebBrowserApplet() override;
void OpenLocalWebPage(const std::string& local_url, void OpenLocalWebPage(const std::string& local_url, ExtractROMFSCallback extract_romfs_callback,
std::function<void()> extract_romfs_callback, OpenWebPageCallback callback) const override;
std::function<void(Service::AM::Applets::WebExitReason, std::string)>
callback) const override;
void OpenExternalWebPage(const std::string& external_url, void OpenExternalWebPage(const std::string& external_url,
std::function<void(Service::AM::Applets::WebExitReason, std::string)> OpenWebPageCallback callback) const override;
callback) const override;
}; };
} // namespace Core::Frontend } // namespace Core::Frontend

View file

@ -37,7 +37,7 @@ void EmulatedConsole::SetTouchParams() {
touchscreen_param.Set("axis_x", i * 2); touchscreen_param.Set("axis_x", i * 2);
touchscreen_param.Set("axis_y", (i * 2) + 1); touchscreen_param.Set("axis_y", (i * 2) + 1);
touchscreen_param.Set("button", i); touchscreen_param.Set("button", i);
touch_params[index++] = touchscreen_param; touch_params[index++] = std::move(touchscreen_param);
} }
const auto button_index = const auto button_index =
@ -59,7 +59,7 @@ void EmulatedConsole::SetTouchParams() {
touch_button_params.Set("button", params.Serialize()); touch_button_params.Set("button", params.Serialize());
touch_button_params.Set("x", x); touch_button_params.Set("x", x);
touch_button_params.Set("y", y); touch_button_params.Set("y", y);
touch_params[index] = touch_button_params; touch_params[index] = std::move(touch_button_params);
index++; index++;
} }
} }
@ -131,7 +131,7 @@ Common::ParamPackage EmulatedConsole::GetMotionParam() const {
} }
void EmulatedConsole::SetMotionParam(Common::ParamPackage param) { void EmulatedConsole::SetMotionParam(Common::ParamPackage param) {
motion_params = param; motion_params = std::move(param);
ReloadInput(); ReloadInput();
} }
@ -199,7 +199,7 @@ void EmulatedConsole::SetTouch(const Common::Input::CallbackStatus& callback, st
if (is_new_input) { if (is_new_input) {
touch_value.pressed.value = true; touch_value.pressed.value = true;
touch_value.id = static_cast<u32>(index); touch_value.id = static_cast<int>(index);
} }
touch_value.x = touch_input.x; touch_value.x = touch_input.x;
@ -284,7 +284,7 @@ void EmulatedConsole::TriggerOnChange(ConsoleTriggerType type) {
int EmulatedConsole::SetCallback(ConsoleUpdateCallback update_callback) { int EmulatedConsole::SetCallback(ConsoleUpdateCallback update_callback) {
std::scoped_lock lock{callback_mutex}; std::scoped_lock lock{callback_mutex};
callback_list.insert_or_assign(last_callback_key, update_callback); callback_list.insert_or_assign(last_callback_key, std::move(update_callback));
return last_callback_key++; return last_callback_key++;
} }

View file

@ -424,15 +424,14 @@ void EmulatedController::RestoreConfig() {
ReloadFromSettings(); ReloadFromSettings();
} }
std::vector<Common::ParamPackage> EmulatedController::GetMappedDevices( std::vector<Common::ParamPackage> EmulatedController::GetMappedDevices() const {
EmulatedDeviceIndex device_index) const {
std::vector<Common::ParamPackage> devices; std::vector<Common::ParamPackage> devices;
for (const auto& param : button_params) { for (const auto& param : button_params) {
if (!param.Has("engine")) { if (!param.Has("engine")) {
continue; continue;
} }
const auto devices_it = std::find_if( const auto devices_it = std::find_if(
devices.begin(), devices.end(), [param](const Common::ParamPackage param_) { devices.begin(), devices.end(), [&param](const Common::ParamPackage& param_) {
return param.Get("engine", "") == param_.Get("engine", "") && return param.Get("engine", "") == param_.Get("engine", "") &&
param.Get("guid", "") == param_.Get("guid", "") && param.Get("guid", "") == param_.Get("guid", "") &&
param.Get("port", 0) == param_.Get("port", 0) && param.Get("port", 0) == param_.Get("port", 0) &&
@ -441,12 +440,12 @@ std::vector<Common::ParamPackage> EmulatedController::GetMappedDevices(
if (devices_it != devices.end()) { if (devices_it != devices.end()) {
continue; continue;
} }
Common::ParamPackage device{};
auto& device = devices.emplace_back();
device.Set("engine", param.Get("engine", "")); device.Set("engine", param.Get("engine", ""));
device.Set("guid", param.Get("guid", "")); device.Set("guid", param.Get("guid", ""));
device.Set("port", param.Get("port", 0)); device.Set("port", param.Get("port", 0));
device.Set("pad", param.Get("pad", 0)); device.Set("pad", param.Get("pad", 0));
devices.push_back(device);
} }
for (const auto& param : stick_params) { for (const auto& param : stick_params) {
@ -457,7 +456,7 @@ std::vector<Common::ParamPackage> EmulatedController::GetMappedDevices(
continue; continue;
} }
const auto devices_it = std::find_if( const auto devices_it = std::find_if(
devices.begin(), devices.end(), [param](const Common::ParamPackage param_) { devices.begin(), devices.end(), [&param](const Common::ParamPackage& param_) {
return param.Get("engine", "") == param_.Get("engine", "") && return param.Get("engine", "") == param_.Get("engine", "") &&
param.Get("guid", "") == param_.Get("guid", "") && param.Get("guid", "") == param_.Get("guid", "") &&
param.Get("port", 0) == param_.Get("port", 0) && param.Get("port", 0) == param_.Get("port", 0) &&
@ -466,12 +465,12 @@ std::vector<Common::ParamPackage> EmulatedController::GetMappedDevices(
if (devices_it != devices.end()) { if (devices_it != devices.end()) {
continue; continue;
} }
Common::ParamPackage device{};
auto& device = devices.emplace_back();
device.Set("engine", param.Get("engine", "")); device.Set("engine", param.Get("engine", ""));
device.Set("guid", param.Get("guid", "")); device.Set("guid", param.Get("guid", ""));
device.Set("port", param.Get("port", 0)); device.Set("port", param.Get("port", 0));
device.Set("pad", param.Get("pad", 0)); device.Set("pad", param.Get("pad", 0));
devices.push_back(device);
} }
return devices; return devices;
} }

View file

@ -244,7 +244,7 @@ public:
void RestoreConfig(); void RestoreConfig();
/// Returns a vector of mapped devices from the mapped button and stick parameters /// Returns a vector of mapped devices from the mapped button and stick parameters
std::vector<Common::ParamPackage> GetMappedDevices(EmulatedDeviceIndex device_index) const; std::vector<Common::ParamPackage> GetMappedDevices() const;
// Returns the current mapped button device // Returns the current mapped button device
Common::ParamPackage GetButtonParam(std::size_t index) const; Common::ParamPackage GetButtonParam(std::size_t index) const;

View file

@ -280,18 +280,19 @@ struct KMemoryInfo {
class KMemoryBlock : public Common::IntrusiveRedBlackTreeBaseNode<KMemoryBlock> { class KMemoryBlock : public Common::IntrusiveRedBlackTreeBaseNode<KMemoryBlock> {
private: private:
u16 m_device_disable_merge_left_count; u16 m_device_disable_merge_left_count{};
u16 m_device_disable_merge_right_count; u16 m_device_disable_merge_right_count{};
VAddr m_address; VAddr m_address{};
size_t m_num_pages; size_t m_num_pages{};
KMemoryState m_memory_state; KMemoryState m_memory_state{KMemoryState::None};
u16 m_ipc_lock_count; u16 m_ipc_lock_count{};
u16 m_device_use_count; u16 m_device_use_count{};
u16 m_ipc_disable_merge_count; u16 m_ipc_disable_merge_count{};
KMemoryPermission m_permission; KMemoryPermission m_permission{KMemoryPermission::None};
KMemoryPermission m_original_permission; KMemoryPermission m_original_permission{KMemoryPermission::None};
KMemoryAttribute m_attribute; KMemoryAttribute m_attribute{KMemoryAttribute::None};
KMemoryBlockDisableMergeAttribute m_disable_merge_attribute; KMemoryBlockDisableMergeAttribute m_disable_merge_attribute{
KMemoryBlockDisableMergeAttribute::None};
public: public:
static constexpr int Compare(const KMemoryBlock& lhs, const KMemoryBlock& rhs) { static constexpr int Compare(const KMemoryBlock& lhs, const KMemoryBlock& rhs) {
@ -367,12 +368,8 @@ public:
constexpr KMemoryBlock(VAddr addr, size_t np, KMemoryState ms, KMemoryPermission p, constexpr KMemoryBlock(VAddr addr, size_t np, KMemoryState ms, KMemoryPermission p,
KMemoryAttribute attr) KMemoryAttribute attr)
: Common::IntrusiveRedBlackTreeBaseNode<KMemoryBlock>(), : Common::IntrusiveRedBlackTreeBaseNode<KMemoryBlock>(), m_address(addr), m_num_pages(np),
m_device_disable_merge_left_count(), m_device_disable_merge_right_count(), m_memory_state(ms), m_permission(p), m_attribute(attr) {}
m_address(addr), m_num_pages(np), m_memory_state(ms), m_ipc_lock_count(0),
m_device_use_count(0), m_ipc_disable_merge_count(), m_permission(p),
m_original_permission(KMemoryPermission::None), m_attribute(attr),
m_disable_merge_attribute() {}
constexpr void Initialize(VAddr addr, size_t np, KMemoryState ms, KMemoryPermission p, constexpr void Initialize(VAddr addr, size_t np, KMemoryState ms, KMemoryPermission p,
KMemoryAttribute attr) { KMemoryAttribute attr) {

View file

@ -3,6 +3,7 @@
#pragma once #pragma once
#include <array>
#include <functional> #include <functional>
#include "common/common_funcs.h" #include "common/common_funcs.h"
@ -17,9 +18,9 @@ public:
static constexpr size_t MaxBlocks = 2; static constexpr size_t MaxBlocks = 2;
private: private:
KMemoryBlock* m_blocks[MaxBlocks]; std::array<KMemoryBlock*, MaxBlocks> m_blocks{};
size_t m_index; size_t m_index{MaxBlocks};
KMemoryBlockSlabManager* m_slab_manager; KMemoryBlockSlabManager* m_slab_manager{};
private: private:
Result Initialize(size_t num_blocks) { Result Initialize(size_t num_blocks) {
@ -41,7 +42,7 @@ private:
public: public:
KMemoryBlockManagerUpdateAllocator(Result* out_result, KMemoryBlockSlabManager* sm, KMemoryBlockManagerUpdateAllocator(Result* out_result, KMemoryBlockSlabManager* sm,
size_t num_blocks = MaxBlocks) size_t num_blocks = MaxBlocks)
: m_blocks(), m_index(MaxBlocks), m_slab_manager(sm) { : m_slab_manager(sm) {
*out_result = this->Initialize(num_blocks); *out_result = this->Initialize(num_blocks);
} }

View file

@ -74,7 +74,7 @@ public:
static void PostDestroy([[maybe_unused]] uintptr_t arg) {} static void PostDestroy([[maybe_unused]] uintptr_t arg) {}
private: private:
Core::DeviceMemory* device_memory; Core::DeviceMemory* device_memory{};
KProcess* owner_process{}; KProcess* owner_process{};
KPageGroup page_list; KPageGroup page_list;
Svc::MemoryPermission owner_permission{}; Svc::MemoryPermission owner_permission{};

View file

@ -784,8 +784,8 @@ private:
std::vector<KSynchronizationObject*> wait_objects_for_debugging; std::vector<KSynchronizationObject*> wait_objects_for_debugging;
VAddr mutex_wait_address_for_debugging{}; VAddr mutex_wait_address_for_debugging{};
ThreadWaitReasonForDebugging wait_reason_for_debugging{}; ThreadWaitReasonForDebugging wait_reason_for_debugging{};
uintptr_t argument; uintptr_t argument{};
VAddr stack_top; VAddr stack_top{};
public: public:
using ConditionVariableThreadTreeType = ConditionVariableThreadTree; using ConditionVariableThreadTreeType = ConditionVariableThreadTree;

View file

@ -891,7 +891,7 @@ struct KernelCore::Impl {
Common::ThreadWorker service_threads_manager; Common::ThreadWorker service_threads_manager;
Common::Barrier service_thread_barrier; Common::Barrier service_thread_barrier;
std::array<KThread*, Core::Hardware::NUM_CPU_CORES> shutdown_threads; std::array<KThread*, Core::Hardware::NUM_CPU_CORES> shutdown_threads{};
std::array<std::unique_ptr<Kernel::KScheduler>, Core::Hardware::NUM_CPU_CORES> schedulers{}; std::array<std::unique_ptr<Kernel::KScheduler>, Core::Hardware::NUM_CPU_CORES> schedulers{};
bool is_multicore{}; bool is_multicore{};

View file

@ -85,7 +85,7 @@ private:
std::mutex guard; std::mutex guard;
std::condition_variable on_interrupt; std::condition_variable on_interrupt;
std::unique_ptr<Core::ARM_Interface> arm_interface; std::unique_ptr<Core::ARM_Interface> arm_interface;
bool is_interrupted; bool is_interrupted{};
}; };
} // namespace Kernel } // namespace Kernel

View file

@ -38,7 +38,7 @@ std::string GetTimestamp() {
using namespace nlohmann; using namespace nlohmann;
void SaveToFile(json json, const std::filesystem::path& filename) { void SaveToFile(const json& json, const std::filesystem::path& filename) {
if (!Common::FS::CreateParentDirs(filename)) { if (!Common::FS::CreateParentDirs(filename)) {
LOG_ERROR(Core, "Failed to create path for '{}' to save report!", LOG_ERROR(Core, "Failed to create path for '{}' to save report!",
Common::FS::PathToUTF8String(filename)); Common::FS::PathToUTF8String(filename));
@ -81,8 +81,8 @@ json GetReportCommonData(u64 title_id, Result result, const std::string& timesta
} }
json GetProcessorStateData(const std::string& architecture, u64 entry_point, u64 sp, u64 pc, json GetProcessorStateData(const std::string& architecture, u64 entry_point, u64 sp, u64 pc,
u64 pstate, std::array<u64, 31> registers, u64 pstate, const std::array<u64, 31>& registers,
std::optional<std::array<u64, 32>> backtrace = {}) { const std::optional<std::array<u64, 32>>& backtrace = {}) {
auto out = json{ auto out = json{
{"entry_point", fmt::format("{:016X}", entry_point)}, {"entry_point", fmt::format("{:016X}", entry_point)},
{"sp", fmt::format("{:016X}", sp)}, {"sp", fmt::format("{:016X}", sp)},
@ -224,11 +224,11 @@ void Reporter::SaveCrashReport(u64 title_id, Result result, u64 set_flags, u64 e
out["processor_state"] = std::move(proc_out); out["processor_state"] = std::move(proc_out);
SaveToFile(std::move(out), GetPath("crash_report", title_id, timestamp)); SaveToFile(out, GetPath("crash_report", title_id, timestamp));
} }
void Reporter::SaveSvcBreakReport(u32 type, bool signal_debugger, u64 info1, u64 info2, void Reporter::SaveSvcBreakReport(u32 type, bool signal_debugger, u64 info1, u64 info2,
std::optional<std::vector<u8>> resolved_buffer) const { const std::optional<std::vector<u8>>& resolved_buffer) const {
if (!IsReportingEnabled()) { if (!IsReportingEnabled()) {
return; return;
} }
@ -250,7 +250,7 @@ void Reporter::SaveSvcBreakReport(u32 type, bool signal_debugger, u64 info1, u64
out["svc_break"] = std::move(break_out); out["svc_break"] = std::move(break_out);
SaveToFile(std::move(out), GetPath("svc_break_report", title_id, timestamp)); SaveToFile(out, GetPath("svc_break_report", title_id, timestamp));
} }
void Reporter::SaveUnimplementedFunctionReport(Kernel::HLERequestContext& ctx, u32 command_id, void Reporter::SaveUnimplementedFunctionReport(Kernel::HLERequestContext& ctx, u32 command_id,
@ -271,13 +271,13 @@ void Reporter::SaveUnimplementedFunctionReport(Kernel::HLERequestContext& ctx, u
out["function"] = std::move(function_out); out["function"] = std::move(function_out);
SaveToFile(std::move(out), GetPath("unimpl_func_report", title_id, timestamp)); SaveToFile(out, GetPath("unimpl_func_report", title_id, timestamp));
} }
void Reporter::SaveUnimplementedAppletReport( void Reporter::SaveUnimplementedAppletReport(
u32 applet_id, u32 common_args_version, u32 library_version, u32 theme_color, u32 applet_id, u32 common_args_version, u32 library_version, u32 theme_color,
bool startup_sound, u64 system_tick, std::vector<std::vector<u8>> normal_channel, bool startup_sound, u64 system_tick, const std::vector<std::vector<u8>>& normal_channel,
std::vector<std::vector<u8>> interactive_channel) const { const std::vector<std::vector<u8>>& interactive_channel) const {
if (!IsReportingEnabled()) { if (!IsReportingEnabled()) {
return; return;
} }
@ -308,10 +308,11 @@ void Reporter::SaveUnimplementedAppletReport(
out["applet_normal_data"] = std::move(normal_out); out["applet_normal_data"] = std::move(normal_out);
out["applet_interactive_data"] = std::move(interactive_out); out["applet_interactive_data"] = std::move(interactive_out);
SaveToFile(std::move(out), GetPath("unimpl_applet_report", title_id, timestamp)); SaveToFile(out, GetPath("unimpl_applet_report", title_id, timestamp));
} }
void Reporter::SavePlayReport(PlayReportType type, u64 title_id, std::vector<std::vector<u8>> data, void Reporter::SavePlayReport(PlayReportType type, u64 title_id,
const std::vector<std::vector<u8>>& data,
std::optional<u64> process_id, std::optional<u128> user_id) const { std::optional<u64> process_id, std::optional<u128> user_id) const {
if (!IsReportingEnabled()) { if (!IsReportingEnabled()) {
return; return;
@ -335,12 +336,12 @@ void Reporter::SavePlayReport(PlayReportType type, u64 title_id, std::vector<std
out["play_report_type"] = fmt::format("{:02}", static_cast<u8>(type)); out["play_report_type"] = fmt::format("{:02}", static_cast<u8>(type));
out["play_report_data"] = std::move(data_out); out["play_report_data"] = std::move(data_out);
SaveToFile(std::move(out), GetPath("play_report", title_id, timestamp)); SaveToFile(out, GetPath("play_report", title_id, timestamp));
} }
void Reporter::SaveErrorReport(u64 title_id, Result result, void Reporter::SaveErrorReport(u64 title_id, Result result,
std::optional<std::string> custom_text_main, const std::optional<std::string>& custom_text_main,
std::optional<std::string> custom_text_detail) const { const std::optional<std::string>& custom_text_detail) const {
if (!IsReportingEnabled()) { if (!IsReportingEnabled()) {
return; return;
} }
@ -354,11 +355,11 @@ void Reporter::SaveErrorReport(u64 title_id, Result result,
out["backtrace"] = GetBacktraceData(system); out["backtrace"] = GetBacktraceData(system);
out["error_custom_text"] = { out["error_custom_text"] = {
{"main", *custom_text_main}, {"main", custom_text_main.value_or("")},
{"detail", *custom_text_detail}, {"detail", custom_text_detail.value_or("")},
}; };
SaveToFile(std::move(out), GetPath("error_report", title_id, timestamp)); SaveToFile(out, GetPath("error_report", title_id, timestamp));
} }
void Reporter::SaveFSAccessLog(std::string_view log_message) const { void Reporter::SaveFSAccessLog(std::string_view log_message) const {

View file

@ -36,7 +36,7 @@ public:
// Used by syscall svcBreak // Used by syscall svcBreak
void SaveSvcBreakReport(u32 type, bool signal_debugger, u64 info1, u64 info2, void SaveSvcBreakReport(u32 type, bool signal_debugger, u64 info1, u64 info2,
std::optional<std::vector<u8>> resolved_buffer = {}) const; const std::optional<std::vector<u8>>& resolved_buffer = {}) const;
// Used by HLE service handler // Used by HLE service handler
void SaveUnimplementedFunctionReport(Kernel::HLERequestContext& ctx, u32 command_id, void SaveUnimplementedFunctionReport(Kernel::HLERequestContext& ctx, u32 command_id,
@ -44,10 +44,10 @@ public:
const std::string& service_name) const; const std::string& service_name) const;
// Used by stub applet implementation // Used by stub applet implementation
void SaveUnimplementedAppletReport(u32 applet_id, u32 common_args_version, u32 library_version, void SaveUnimplementedAppletReport(
u32 theme_color, bool startup_sound, u64 system_tick, u32 applet_id, u32 common_args_version, u32 library_version, u32 theme_color,
std::vector<std::vector<u8>> normal_channel, bool startup_sound, u64 system_tick, const std::vector<std::vector<u8>>& normal_channel,
std::vector<std::vector<u8>> interactive_channel) const; const std::vector<std::vector<u8>>& interactive_channel) const;
enum class PlayReportType { enum class PlayReportType {
Old, Old,
@ -56,13 +56,13 @@ public:
System, System,
}; };
void SavePlayReport(PlayReportType type, u64 title_id, std::vector<std::vector<u8>> data, void SavePlayReport(PlayReportType type, u64 title_id, const std::vector<std::vector<u8>>& data,
std::optional<u64> process_id = {}, std::optional<u128> user_id = {}) const; std::optional<u64> process_id = {}, std::optional<u128> user_id = {}) const;
// Used by error applet // Used by error applet
void SaveErrorReport(u64 title_id, Result result, void SaveErrorReport(u64 title_id, Result result,
std::optional<std::string> custom_text_main = {}, const std::optional<std::string>& custom_text_main = {},
std::optional<std::string> custom_text_detail = {}) const; const std::optional<std::string>& custom_text_detail = {}) const;
void SaveFSAccessLog(std::string_view log_message) const; void SaveFSAccessLog(std::string_view log_message) const;

View file

@ -685,7 +685,7 @@ QtControllerSelector::QtControllerSelector(GMainWindow& parent) {
QtControllerSelector::~QtControllerSelector() = default; QtControllerSelector::~QtControllerSelector() = default;
void QtControllerSelector::ReconfigureControllers( void QtControllerSelector::ReconfigureControllers(
std::function<void()> callback_, const Core::Frontend::ControllerParameters& parameters) const { ReconfigureCallback callback_, const Core::Frontend::ControllerParameters& parameters) const {
callback = std::move(callback_); callback = std::move(callback_);
emit MainWindowReconfigureControllers(parameters); emit MainWindowReconfigureControllers(parameters);
} }

View file

@ -157,7 +157,7 @@ public:
~QtControllerSelector() override; ~QtControllerSelector() override;
void ReconfigureControllers( void ReconfigureControllers(
std::function<void()> callback_, ReconfigureCallback callback_,
const Core::Frontend::ControllerParameters& parameters) const override; const Core::Frontend::ControllerParameters& parameters) const override;
signals: signals:
@ -167,5 +167,5 @@ signals:
private: private:
void MainWindowReconfigureFinished(); void MainWindowReconfigureFinished();
mutable std::function<void()> callback; mutable ReconfigureCallback callback;
}; };

View file

@ -14,7 +14,7 @@ QtErrorDisplay::QtErrorDisplay(GMainWindow& parent) {
QtErrorDisplay::~QtErrorDisplay() = default; QtErrorDisplay::~QtErrorDisplay() = default;
void QtErrorDisplay::ShowError(Result error, std::function<void()> finished) const { void QtErrorDisplay::ShowError(Result error, FinishedCallback finished) const {
callback = std::move(finished); callback = std::move(finished);
emit MainWindowDisplayError( emit MainWindowDisplayError(
tr("Error Code: %1-%2 (0x%3)") tr("Error Code: %1-%2 (0x%3)")
@ -25,7 +25,7 @@ void QtErrorDisplay::ShowError(Result error, std::function<void()> finished) con
} }
void QtErrorDisplay::ShowErrorWithTimestamp(Result error, std::chrono::seconds time, void QtErrorDisplay::ShowErrorWithTimestamp(Result error, std::chrono::seconds time,
std::function<void()> finished) const { FinishedCallback finished) const {
callback = std::move(finished); callback = std::move(finished);
const QDateTime date_time = QDateTime::fromSecsSinceEpoch(time.count()); const QDateTime date_time = QDateTime::fromSecsSinceEpoch(time.count());
@ -42,7 +42,7 @@ void QtErrorDisplay::ShowErrorWithTimestamp(Result error, std::chrono::seconds t
void QtErrorDisplay::ShowCustomErrorText(Result error, std::string dialog_text, void QtErrorDisplay::ShowCustomErrorText(Result error, std::string dialog_text,
std::string fullscreen_text, std::string fullscreen_text,
std::function<void()> finished) const { FinishedCallback finished) const {
callback = std::move(finished); callback = std::move(finished);
emit MainWindowDisplayError( emit MainWindowDisplayError(
tr("Error Code: %1-%2 (0x%3)") tr("Error Code: %1-%2 (0x%3)")

View file

@ -16,11 +16,11 @@ public:
explicit QtErrorDisplay(GMainWindow& parent); explicit QtErrorDisplay(GMainWindow& parent);
~QtErrorDisplay() override; ~QtErrorDisplay() override;
void ShowError(Result error, std::function<void()> finished) const override; void ShowError(Result error, FinishedCallback finished) const override;
void ShowErrorWithTimestamp(Result error, std::chrono::seconds time, void ShowErrorWithTimestamp(Result error, std::chrono::seconds time,
std::function<void()> finished) const override; FinishedCallback finished) const override;
void ShowCustomErrorText(Result error, std::string dialog_text, std::string fullscreen_text, void ShowCustomErrorText(Result error, std::string dialog_text, std::string fullscreen_text,
std::function<void()> finished) const override; FinishedCallback finished) const override;
signals: signals:
void MainWindowDisplayError(QString error_code, QString error_text) const; void MainWindowDisplayError(QString error_code, QString error_text) const;
@ -28,5 +28,5 @@ signals:
private: private:
void MainWindowFinishedError(); void MainWindowFinishedError();
mutable std::function<void()> callback; mutable FinishedCallback callback;
}; };

View file

@ -163,8 +163,7 @@ QtProfileSelector::QtProfileSelector(GMainWindow& parent) {
QtProfileSelector::~QtProfileSelector() = default; QtProfileSelector::~QtProfileSelector() = default;
void QtProfileSelector::SelectProfile( void QtProfileSelector::SelectProfile(SelectProfileCallback callback_) const {
std::function<void(std::optional<Common::UUID>)> callback_) const {
callback = std::move(callback_); callback = std::move(callback_);
emit MainWindowSelectProfile(); emit MainWindowSelectProfile();
} }

View file

@ -65,7 +65,7 @@ public:
explicit QtProfileSelector(GMainWindow& parent); explicit QtProfileSelector(GMainWindow& parent);
~QtProfileSelector() override; ~QtProfileSelector() override;
void SelectProfile(std::function<void(std::optional<Common::UUID>)> callback_) const override; void SelectProfile(SelectProfileCallback callback_) const override;
signals: signals:
void MainWindowSelectProfile() const; void MainWindowSelectProfile() const;
@ -73,5 +73,5 @@ signals:
private: private:
void MainWindowFinishedSelection(std::optional<Common::UUID> uuid); void MainWindowFinishedSelection(std::optional<Common::UUID> uuid);
mutable std::function<void(std::optional<Common::UUID>)> callback; mutable SelectProfileCallback callback;
}; };

View file

@ -1566,10 +1566,7 @@ QtSoftwareKeyboard::~QtSoftwareKeyboard() = default;
void QtSoftwareKeyboard::InitializeKeyboard( void QtSoftwareKeyboard::InitializeKeyboard(
bool is_inline, Core::Frontend::KeyboardInitializeParameters initialize_parameters, bool is_inline, Core::Frontend::KeyboardInitializeParameters initialize_parameters,
std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)> SubmitNormalCallback submit_normal_callback_, SubmitInlineCallback submit_inline_callback_) {
submit_normal_callback_,
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
submit_inline_callback_) {
if (is_inline) { if (is_inline) {
submit_inline_callback = std::move(submit_inline_callback_); submit_inline_callback = std::move(submit_inline_callback_);
} else { } else {

View file

@ -233,12 +233,10 @@ public:
explicit QtSoftwareKeyboard(GMainWindow& parent); explicit QtSoftwareKeyboard(GMainWindow& parent);
~QtSoftwareKeyboard() override; ~QtSoftwareKeyboard() override;
void InitializeKeyboard( void InitializeKeyboard(bool is_inline,
bool is_inline, Core::Frontend::KeyboardInitializeParameters initialize_parameters, Core::Frontend::KeyboardInitializeParameters initialize_parameters,
std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)> SubmitNormalCallback submit_normal_callback_,
submit_normal_callback_, SubmitInlineCallback submit_inline_callback_) override;
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
submit_inline_callback_) override;
void ShowNormalKeyboard() const override; void ShowNormalKeyboard() const override;
@ -279,8 +277,6 @@ private:
void SubmitInlineText(Service::AM::Applets::SwkbdReplyType reply_type, void SubmitInlineText(Service::AM::Applets::SwkbdReplyType reply_type,
std::u16string submitted_text, s32 cursor_position) const; std::u16string submitted_text, s32 cursor_position) const;
mutable std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)> mutable SubmitNormalCallback submit_normal_callback;
submit_normal_callback; mutable SubmitInlineCallback submit_inline_callback;
mutable std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
submit_inline_callback;
}; };

View file

@ -401,9 +401,9 @@ QtWebBrowser::QtWebBrowser(GMainWindow& main_window) {
QtWebBrowser::~QtWebBrowser() = default; QtWebBrowser::~QtWebBrowser() = default;
void QtWebBrowser::OpenLocalWebPage( void QtWebBrowser::OpenLocalWebPage(const std::string& local_url,
const std::string& local_url, std::function<void()> extract_romfs_callback_, ExtractROMFSCallback extract_romfs_callback_,
std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback_) const { OpenWebPageCallback callback_) const {
extract_romfs_callback = std::move(extract_romfs_callback_); extract_romfs_callback = std::move(extract_romfs_callback_);
callback = std::move(callback_); callback = std::move(callback_);
@ -416,9 +416,8 @@ void QtWebBrowser::OpenLocalWebPage(
} }
} }
void QtWebBrowser::OpenExternalWebPage( void QtWebBrowser::OpenExternalWebPage(const std::string& external_url,
const std::string& external_url, OpenWebPageCallback callback_) const {
std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback_) const {
callback = std::move(callback_); callback = std::move(callback_);
const auto index = external_url.find('?'); const auto index = external_url.find('?');

View file

@ -197,13 +197,11 @@ public:
~QtWebBrowser() override; ~QtWebBrowser() override;
void OpenLocalWebPage(const std::string& local_url, void OpenLocalWebPage(const std::string& local_url,
std::function<void()> extract_romfs_callback_, ExtractROMFSCallback extract_romfs_callback_,
std::function<void(Service::AM::Applets::WebExitReason, std::string)> OpenWebPageCallback callback_) const override;
callback_) const override;
void OpenExternalWebPage(const std::string& external_url, void OpenExternalWebPage(const std::string& external_url,
std::function<void(Service::AM::Applets::WebExitReason, std::string)> OpenWebPageCallback callback_) const override;
callback_) const override;
signals: signals:
void MainWindowOpenWebPage(const std::string& main_url, const std::string& additional_args, void MainWindowOpenWebPage(const std::string& main_url, const std::string& additional_args,
@ -215,7 +213,6 @@ private:
void MainWindowWebBrowserClosed(Service::AM::Applets::WebExitReason exit_reason, void MainWindowWebBrowserClosed(Service::AM::Applets::WebExitReason exit_reason,
std::string last_url); std::string last_url);
mutable std::function<void()> extract_romfs_callback; mutable ExtractROMFSCallback extract_romfs_callback;
mutable OpenWebPageCallback callback;
mutable std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback;
}; };

View file

@ -31,7 +31,7 @@ ConfigureGraphics::ConfigureGraphics(const Core::System& system_, QWidget* paren
ui->backend->addItem(QStringLiteral("GLSL")); ui->backend->addItem(QStringLiteral("GLSL"));
ui->backend->addItem(tr("GLASM (Assembly Shaders, NVIDIA Only)")); ui->backend->addItem(tr("GLASM (Assembly Shaders, NVIDIA Only)"));
ui->backend->addItem(QStringLiteral("SPIR-V (Experimental, Mesa Only)")); ui->backend->addItem(tr("SPIR-V (Experimental, Mesa Only)"));
SetupPerGameUI(); SetupPerGameUI();

View file

@ -855,8 +855,7 @@ void ConfigureInputPlayer::UpdateInputDeviceCombobox() {
return; return;
} }
const auto devices = const auto devices = emulated_controller->GetMappedDevices();
emulated_controller->GetMappedDevices(Core::HID::EmulatedDeviceIndex::AllDevices);
UpdateInputDevices(); UpdateInputDevices();
if (devices.empty()) { if (devices.empty()) {