forked from eden-emu/eden
Ran clang-format. Fixed Qt6 deprecations.
This commit is contained in:
parent
a538126eb7
commit
8cd0d78269
219 changed files with 2635 additions and 2845 deletions
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
#include <map>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
@ -22,12 +21,7 @@
|
||||||
namespace Dynarmic::IR {
|
namespace Dynarmic::IR {
|
||||||
|
|
||||||
Block::Block(const LocationDescriptor& location)
|
Block::Block(const LocationDescriptor& location)
|
||||||
: location{location},
|
: location{location}, end_location{location}, cond{Cond::AL}, instruction_alloc_pool{std::make_unique<InstPool>()} {
|
||||||
end_location{location},
|
|
||||||
cond{Cond::AL},
|
|
||||||
instruction_alloc_pool{std::make_unique<std::remove_reference_t<decltype(*instruction_alloc_pool)>>()}
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Prepends a new instruction to this basic block before the insertion point,
|
/// Prepends a new instruction to this basic block before the insertion point,
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
#include "dynarmic/ir/microinstruction.h"
|
#include "dynarmic/ir/microinstruction.h"
|
||||||
#include "dynarmic/ir/terminal.h"
|
#include "dynarmic/ir/terminal.h"
|
||||||
#include "dynarmic/ir/value.h"
|
#include "dynarmic/ir/value.h"
|
||||||
#include "dynarmic/ir/dense_list.h"
|
|
||||||
#include "dynarmic/common/memory_pool.h"
|
#include "dynarmic/common/memory_pool.h"
|
||||||
|
|
||||||
namespace Dynarmic::IR {
|
namespace Dynarmic::IR {
|
||||||
|
@ -171,8 +170,9 @@ private:
|
||||||
LocationDescriptor end_location;
|
LocationDescriptor end_location;
|
||||||
/// Conditional to pass in order to execute this block
|
/// Conditional to pass in order to execute this block
|
||||||
Cond cond;
|
Cond cond;
|
||||||
|
using InstPool = Common::Pool<sizeof(Inst), 0x200000UL / sizeof(Inst)>;
|
||||||
/// Memory pool for instruction list
|
/// Memory pool for instruction list
|
||||||
std::unique_ptr<Common::Pool<sizeof(Inst), 2097152UL / sizeof(Inst)>> instruction_alloc_pool;
|
std::unique_ptr<InstPool> instruction_alloc_pool;
|
||||||
/// Terminal instruction of this block.
|
/// Terminal instruction of this block.
|
||||||
Terminal terminal = Term::Invalid{};
|
Terminal terminal = Term::Invalid{};
|
||||||
/// Number of cycles this block takes to execute if the conditional fails.
|
/// Number of cycles this block takes to execute if the conditional fails.
|
||||||
|
|
|
@ -23,7 +23,7 @@ constexpr size_t max_arg_count = 4;
|
||||||
/// A representation of a microinstruction. A single ARM/Thumb instruction may be
|
/// A representation of a microinstruction. A single ARM/Thumb instruction may be
|
||||||
/// converted into zero or more microinstructions.
|
/// converted into zero or more microinstructions.
|
||||||
//class Inst final {
|
//class Inst final {
|
||||||
class Inst final : public mcl::intrusive_list_node<Inst> {
|
class alignas(64) Inst final : public mcl::intrusive_list_node<Inst> {
|
||||||
public:
|
public:
|
||||||
explicit Inst(Opcode op) : op(op) {}
|
explicit Inst(Opcode op) : op(op) {}
|
||||||
|
|
||||||
|
@ -74,12 +74,12 @@ private:
|
||||||
void UndoUse(const Value& value);
|
void UndoUse(const Value& value);
|
||||||
|
|
||||||
// TODO: so much padding wasted with mcl::intrusive_node
|
// TODO: so much padding wasted with mcl::intrusive_node
|
||||||
// 16 + 1, 24
|
// 17
|
||||||
Opcode op; //2 (6)
|
Opcode op; // 20(4)
|
||||||
// Linked list of pseudooperations associated with this instruction.
|
// Linked list of pseudooperations associated with this instruction.
|
||||||
Inst* next_pseudoop = nullptr; //8 (14)
|
Inst* next_pseudoop = nullptr; // 24(8)
|
||||||
unsigned use_count = 0; //4 (0)
|
unsigned use_count = 0; // 32(4)
|
||||||
unsigned name = 0; //4 (4)
|
unsigned name = 0; // 36(4)
|
||||||
alignas(64) std::array<Value, max_arg_count> args; //16 * 4 = 64 (1 cache line)
|
alignas(64) std::array<Value, max_arg_count> args; //16 * 4 = 64 (1 cache line)
|
||||||
};
|
};
|
||||||
static_assert(sizeof(Inst) == 128);
|
static_assert(sizeof(Inst) == 128);
|
||||||
|
|
|
@ -8,172 +8,233 @@
|
||||||
|
|
||||||
#include <common/settings_common.h>
|
#include <common/settings_common.h>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/settings_setting.h"
|
|
||||||
#include "common/settings_enums.h"
|
#include "common/settings_enums.h"
|
||||||
|
#include "common/settings_setting.h"
|
||||||
|
|
||||||
namespace AndroidSettings {
|
namespace AndroidSettings {
|
||||||
|
|
||||||
struct GameDir {
|
struct GameDir {
|
||||||
std::string path;
|
std::string path;
|
||||||
bool deep_scan = false;
|
bool deep_scan = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct OverlayControlData {
|
struct OverlayControlData {
|
||||||
std::string id;
|
std::string id;
|
||||||
bool enabled;
|
bool enabled;
|
||||||
std::pair<double, double> landscape_position;
|
std::pair<double, double> landscape_position;
|
||||||
std::pair<double, double> portrait_position;
|
std::pair<double, double> portrait_position;
|
||||||
std::pair<double, double> foldable_position;
|
std::pair<double, double> foldable_position;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Values {
|
struct Values {
|
||||||
Settings::Linkage linkage;
|
Settings::Linkage linkage;
|
||||||
|
|
||||||
// Path settings
|
// Path settings
|
||||||
std::vector<GameDir> game_dirs;
|
std::vector<GameDir> game_dirs;
|
||||||
|
|
||||||
// Android
|
// Android
|
||||||
Settings::Setting<bool> picture_in_picture{linkage, false, "picture_in_picture",
|
Settings::Setting<bool> picture_in_picture{linkage, false, "picture_in_picture",
|
||||||
Settings::Category::Android};
|
Settings::Category::Android};
|
||||||
Settings::Setting<s32> screen_layout{linkage,
|
Settings::Setting<s32> screen_layout{linkage,
|
||||||
5,
|
5,
|
||||||
"screen_layout",
|
"screen_layout",
|
||||||
Settings::Category::Android,
|
Settings::Category::Android,
|
||||||
Settings::Specialization::Default,
|
Settings::Specialization::Default,
|
||||||
true,
|
true,
|
||||||
true};
|
true};
|
||||||
Settings::Setting<s32> vertical_alignment{linkage,
|
Settings::Setting<s32> vertical_alignment{linkage,
|
||||||
0,
|
0,
|
||||||
"vertical_alignment",
|
"vertical_alignment",
|
||||||
Settings::Category::Android,
|
Settings::Category::Android,
|
||||||
|
Settings::Specialization::Default,
|
||||||
|
true,
|
||||||
|
true};
|
||||||
|
|
||||||
|
Settings::SwitchableSetting<std::string, false> driver_path{linkage, "", "driver_path",
|
||||||
|
Settings::Category::GpuDriver};
|
||||||
|
|
||||||
|
// LRU Cache
|
||||||
|
Settings::SwitchableSetting<bool> use_lru_cache{linkage, true, "use_lru_cache",
|
||||||
|
Settings::Category::System};
|
||||||
|
|
||||||
|
Settings::Setting<s32> theme{linkage, 0, "theme", Settings::Category::Android};
|
||||||
|
Settings::Setting<s32> theme_mode{linkage, -1, "theme_mode", Settings::Category::Android};
|
||||||
|
Settings::Setting<bool> black_backgrounds{linkage, false, "black_backgrounds",
|
||||||
|
Settings::Category::Android};
|
||||||
|
|
||||||
|
// Input/performance overlay settings
|
||||||
|
std::vector<OverlayControlData> overlay_control_data;
|
||||||
|
Settings::Setting<s32> overlay_scale{linkage, 50, "control_scale", Settings::Category::Overlay};
|
||||||
|
Settings::Setting<s32> overlay_opacity{linkage, 100, "control_opacity",
|
||||||
|
Settings::Category::Overlay};
|
||||||
|
|
||||||
|
Settings::Setting<bool> joystick_rel_center{linkage, true, "joystick_rel_center",
|
||||||
|
Settings::Category::Overlay};
|
||||||
|
Settings::Setting<bool> dpad_slide{linkage, true, "dpad_slide", Settings::Category::Overlay};
|
||||||
|
Settings::Setting<bool> haptic_feedback{linkage, true, "haptic_feedback",
|
||||||
|
Settings::Category::Overlay};
|
||||||
|
Settings::Setting<bool> show_performance_overlay{linkage,
|
||||||
|
true,
|
||||||
|
"show_performance_overlay",
|
||||||
|
Settings::Category::Overlay,
|
||||||
|
Settings::Specialization::Paired,
|
||||||
|
true,
|
||||||
|
true};
|
||||||
|
Settings::Setting<bool> perf_overlay_background{linkage,
|
||||||
|
false,
|
||||||
|
"perf_overlay_background",
|
||||||
|
Settings::Category::Overlay,
|
||||||
|
Settings::Specialization::Default,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
&show_performance_overlay};
|
||||||
|
Settings::Setting<s32> perf_overlay_position{linkage,
|
||||||
|
0,
|
||||||
|
"perf_overlay_position",
|
||||||
|
Settings::Category::Overlay,
|
||||||
|
Settings::Specialization::Default,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
&show_performance_overlay};
|
||||||
|
|
||||||
|
Settings::Setting<bool> show_fps{linkage,
|
||||||
|
true,
|
||||||
|
"show_fps",
|
||||||
|
Settings::Category::Overlay,
|
||||||
|
Settings::Specialization::Default,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
&show_performance_overlay};
|
||||||
|
Settings::Setting<bool> show_frame_time{linkage,
|
||||||
|
false,
|
||||||
|
"show_frame_time",
|
||||||
|
Settings::Category::Overlay,
|
||||||
|
Settings::Specialization::Default,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
&show_performance_overlay};
|
||||||
|
Settings::Setting<bool> show_app_ram_usage{linkage,
|
||||||
|
false,
|
||||||
|
"show_app_ram_usage",
|
||||||
|
Settings::Category::Overlay,
|
||||||
|
Settings::Specialization::Default,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
&show_performance_overlay};
|
||||||
|
Settings::Setting<bool> show_system_ram_usage{linkage,
|
||||||
|
false,
|
||||||
|
"show_system_ram_usage",
|
||||||
|
Settings::Category::Overlay,
|
||||||
Settings::Specialization::Default,
|
Settings::Specialization::Default,
|
||||||
true,
|
true,
|
||||||
true};
|
true,
|
||||||
|
&show_performance_overlay};
|
||||||
Settings::SwitchableSetting<std::string, false> driver_path{linkage, "", "driver_path",
|
Settings::Setting<bool> show_bat_temperature{linkage,
|
||||||
Settings::Category::GpuDriver};
|
false,
|
||||||
|
"show_bat_temperature",
|
||||||
// LRU Cache
|
|
||||||
Settings::SwitchableSetting<bool> use_lru_cache{linkage, true, "use_lru_cache",
|
|
||||||
Settings::Category::System};
|
|
||||||
|
|
||||||
Settings::Setting<s32> theme{linkage, 0, "theme", Settings::Category::Android};
|
|
||||||
Settings::Setting<s32> theme_mode{linkage, -1, "theme_mode", Settings::Category::Android};
|
|
||||||
Settings::Setting<bool> black_backgrounds{linkage, false, "black_backgrounds",
|
|
||||||
Settings::Category::Android};
|
|
||||||
|
|
||||||
// Input/performance overlay settings
|
|
||||||
std::vector<OverlayControlData> overlay_control_data;
|
|
||||||
Settings::Setting<s32> overlay_scale{linkage, 50, "control_scale",
|
|
||||||
Settings::Category::Overlay};
|
|
||||||
Settings::Setting<s32> overlay_opacity{linkage, 100, "control_opacity",
|
|
||||||
Settings::Category::Overlay};
|
|
||||||
|
|
||||||
Settings::Setting<bool> joystick_rel_center{linkage, true, "joystick_rel_center",
|
|
||||||
Settings::Category::Overlay};
|
|
||||||
Settings::Setting<bool> dpad_slide{linkage, true, "dpad_slide",
|
|
||||||
Settings::Category::Overlay};
|
|
||||||
Settings::Setting<bool> haptic_feedback{linkage, true, "haptic_feedback",
|
|
||||||
Settings::Category::Overlay};
|
|
||||||
Settings::Setting<bool> show_performance_overlay{linkage, true, "show_performance_overlay",
|
|
||||||
Settings::Category::Overlay,
|
|
||||||
Settings::Specialization::Paired, true,
|
|
||||||
true};
|
|
||||||
Settings::Setting<bool> perf_overlay_background{linkage, false, "perf_overlay_background",
|
|
||||||
Settings::Category::Overlay,
|
|
||||||
Settings::Specialization::Default, true,
|
|
||||||
true,
|
|
||||||
&show_performance_overlay};
|
|
||||||
Settings::Setting<s32> perf_overlay_position{linkage, 0, "perf_overlay_position",
|
|
||||||
Settings::Category::Overlay,
|
|
||||||
Settings::Specialization::Default, true, true,
|
|
||||||
&show_performance_overlay};
|
|
||||||
|
|
||||||
Settings::Setting<bool> show_fps{linkage, true, "show_fps",
|
|
||||||
Settings::Category::Overlay,
|
|
||||||
Settings::Specialization::Default, true, true,
|
|
||||||
&show_performance_overlay};
|
|
||||||
Settings::Setting<bool> show_frame_time{linkage, false, "show_frame_time",
|
|
||||||
Settings::Category::Overlay,
|
|
||||||
Settings::Specialization::Default, true, true,
|
|
||||||
&show_performance_overlay};
|
|
||||||
Settings::Setting<bool> show_app_ram_usage{linkage, false, "show_app_ram_usage",
|
|
||||||
Settings::Category::Overlay,
|
|
||||||
Settings::Specialization::Default, true, true,
|
|
||||||
&show_performance_overlay};
|
|
||||||
Settings::Setting<bool> show_system_ram_usage{linkage, false, "show_system_ram_usage",
|
|
||||||
Settings::Category::Overlay,
|
|
||||||
Settings::Specialization::Default, true, true,
|
|
||||||
&show_performance_overlay};
|
|
||||||
Settings::Setting<bool> show_bat_temperature{linkage, false, "show_bat_temperature",
|
|
||||||
Settings::Category::Overlay,
|
|
||||||
Settings::Specialization::Default, true, true,
|
|
||||||
&show_performance_overlay};
|
|
||||||
Settings::Setting<Settings::TemperatureUnits> bat_temperature_unit{linkage,
|
|
||||||
Settings::TemperatureUnits::Celsius,
|
|
||||||
"bat_temperature_unit",
|
|
||||||
Settings::Category::Overlay,
|
|
||||||
Settings::Specialization::Default,
|
|
||||||
true, true,
|
|
||||||
&show_bat_temperature};
|
|
||||||
Settings::Setting<bool> show_power_info{linkage, false, "show_power_info",
|
|
||||||
Settings::Category::Overlay,
|
|
||||||
Settings::Specialization::Default, true, true,
|
|
||||||
&show_performance_overlay};
|
|
||||||
Settings::Setting<bool> show_shaders_building{linkage, true, "show_shaders_building",
|
|
||||||
Settings::Category::Overlay,
|
|
||||||
Settings::Specialization::Default, true, true,
|
|
||||||
&show_performance_overlay};
|
|
||||||
|
|
||||||
|
|
||||||
Settings::Setting<bool> show_input_overlay{linkage, true, "show_input_overlay",
|
|
||||||
Settings::Category::Overlay};
|
|
||||||
Settings::Setting<bool> touchscreen{linkage, true, "touchscreen",
|
|
||||||
Settings::Category::Overlay};
|
|
||||||
Settings::Setting<s32> lock_drawer{linkage, false, "lock_drawer",
|
|
||||||
Settings::Category::Overlay};
|
|
||||||
|
|
||||||
/// DEVICE/SOC OVERLAY
|
|
||||||
|
|
||||||
Settings::Setting<bool> show_soc_overlay{linkage, true, "show_soc_overlay",
|
|
||||||
Settings::Category::Overlay,
|
Settings::Category::Overlay,
|
||||||
Settings::Specialization::Paired, true, true};
|
Settings::Specialization::Default,
|
||||||
|
true,
|
||||||
Settings::Setting<bool> show_device_model{linkage, true, "show_device_model",
|
true,
|
||||||
|
&show_performance_overlay};
|
||||||
|
Settings::Setting<Settings::TemperatureUnits> bat_temperature_unit{
|
||||||
|
linkage,
|
||||||
|
Settings::TemperatureUnits::Celsius,
|
||||||
|
"bat_temperature_unit",
|
||||||
|
Settings::Category::Overlay,
|
||||||
|
Settings::Specialization::Default,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
&show_bat_temperature};
|
||||||
|
Settings::Setting<bool> show_power_info{linkage,
|
||||||
|
false,
|
||||||
|
"show_power_info",
|
||||||
|
Settings::Category::Overlay,
|
||||||
|
Settings::Specialization::Default,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
&show_performance_overlay};
|
||||||
|
Settings::Setting<bool> show_shaders_building{linkage,
|
||||||
|
true,
|
||||||
|
"show_shaders_building",
|
||||||
Settings::Category::Overlay,
|
Settings::Category::Overlay,
|
||||||
Settings::Specialization::Default, true, true,
|
Settings::Specialization::Default,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
&show_performance_overlay};
|
&show_performance_overlay};
|
||||||
|
|
||||||
Settings::Setting<bool> show_gpu_model{linkage, true, "show_gpu_model",
|
Settings::Setting<bool> show_input_overlay{linkage, true, "show_input_overlay",
|
||||||
Settings::Category::Overlay,
|
Settings::Category::Overlay};
|
||||||
Settings::Specialization::Default, true, true,
|
Settings::Setting<bool> touchscreen{linkage, true, "touchscreen", Settings::Category::Overlay};
|
||||||
&show_performance_overlay};
|
Settings::Setting<s32> lock_drawer{linkage, false, "lock_drawer", Settings::Category::Overlay};
|
||||||
|
|
||||||
Settings::Setting<bool> show_soc_model{linkage, true, "show_soc_model",
|
/// DEVICE/SOC OVERLAY
|
||||||
Settings::Category::Overlay,
|
|
||||||
Settings::Specialization::Default, true, true,
|
|
||||||
&show_soc_overlay};
|
|
||||||
|
|
||||||
Settings::Setting<bool> show_fw_version{linkage, true, "show_firmware_version",
|
Settings::Setting<bool> show_soc_overlay{linkage,
|
||||||
|
true,
|
||||||
|
"show_soc_overlay",
|
||||||
|
Settings::Category::Overlay,
|
||||||
|
Settings::Specialization::Paired,
|
||||||
|
true,
|
||||||
|
true};
|
||||||
|
|
||||||
|
Settings::Setting<bool> show_device_model{linkage,
|
||||||
|
true,
|
||||||
|
"show_device_model",
|
||||||
|
Settings::Category::Overlay,
|
||||||
|
Settings::Specialization::Default,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
&show_performance_overlay};
|
||||||
|
|
||||||
|
Settings::Setting<bool> show_gpu_model{linkage,
|
||||||
|
true,
|
||||||
|
"show_gpu_model",
|
||||||
|
Settings::Category::Overlay,
|
||||||
|
Settings::Specialization::Default,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
&show_performance_overlay};
|
||||||
|
|
||||||
|
Settings::Setting<bool> show_soc_model{linkage,
|
||||||
|
true,
|
||||||
|
"show_soc_model",
|
||||||
|
Settings::Category::Overlay,
|
||||||
|
Settings::Specialization::Default,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
&show_soc_overlay};
|
||||||
|
|
||||||
|
Settings::Setting<bool> show_fw_version{linkage,
|
||||||
|
true,
|
||||||
|
"show_firmware_version",
|
||||||
|
Settings::Category::Overlay,
|
||||||
|
Settings::Specialization::Default,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
&show_performance_overlay};
|
||||||
|
|
||||||
|
Settings::Setting<bool> soc_overlay_background{linkage,
|
||||||
|
false,
|
||||||
|
"soc_overlay_background",
|
||||||
|
Settings::Category::Overlay,
|
||||||
|
Settings::Specialization::Default,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
&show_soc_overlay};
|
||||||
|
Settings::Setting<s32> soc_overlay_position{linkage,
|
||||||
|
2,
|
||||||
|
"soc_overlay_position",
|
||||||
Settings::Category::Overlay,
|
Settings::Category::Overlay,
|
||||||
Settings::Specialization::Default, true, true,
|
Settings::Specialization::Default,
|
||||||
&show_performance_overlay};
|
true,
|
||||||
|
true,
|
||||||
|
&show_soc_overlay};
|
||||||
|
|
||||||
Settings::Setting<bool> soc_overlay_background{linkage, false, "soc_overlay_background",
|
Settings::Setting<bool> dont_show_eden_veil_warning{
|
||||||
Settings::Category::Overlay,
|
linkage, false, "dont_show_eden_veil_warning", Settings::Category::Miscellaneous};
|
||||||
Settings::Specialization::Default, true,
|
};
|
||||||
true,
|
|
||||||
&show_soc_overlay};
|
|
||||||
Settings::Setting<s32> soc_overlay_position{linkage, 2, "soc_overlay_position",
|
|
||||||
Settings::Category::Overlay,
|
|
||||||
Settings::Specialization::Default, true, true,
|
|
||||||
&show_soc_overlay};
|
|
||||||
|
|
||||||
Settings::Setting<bool> dont_show_eden_veil_warning{linkage, false,
|
extern Values values;
|
||||||
"dont_show_eden_veil_warning",
|
|
||||||
Settings::Category::Miscellaneous};
|
|
||||||
};
|
|
||||||
|
|
||||||
extern Values values;
|
|
||||||
|
|
||||||
} // namespace AndroidSettings
|
} // namespace AndroidSettings
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
|
||||||
#include <codecvt>
|
#include <codecvt>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -24,9 +23,9 @@
|
||||||
#include <frontend_common/content_manager.h>
|
#include <frontend_common/content_manager.h>
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
#include "common/android/multiplayer/multiplayer.h"
|
|
||||||
#include "common/android/android_common.h"
|
#include "common/android/android_common.h"
|
||||||
#include "common/android/id_cache.h"
|
#include "common/android/id_cache.h"
|
||||||
|
#include "common/android/multiplayer/multiplayer.h"
|
||||||
#include "common/detached_tasks.h"
|
#include "common/detached_tasks.h"
|
||||||
#include "common/dynamic_library.h"
|
#include "common/dynamic_library.h"
|
||||||
#include "common/fs/path_util.h"
|
#include "common/fs/path_util.h"
|
||||||
|
@ -65,23 +64,23 @@
|
||||||
#include "hid_core/hid_core.h"
|
#include "hid_core/hid_core.h"
|
||||||
#include "hid_core/hid_types.h"
|
#include "hid_core/hid_types.h"
|
||||||
#include "jni/native.h"
|
#include "jni/native.h"
|
||||||
|
#include "network/announce_multiplayer_session.h"
|
||||||
#include "video_core/renderer_base.h"
|
#include "video_core/renderer_base.h"
|
||||||
#include "video_core/renderer_vulkan/renderer_vulkan.h"
|
#include "video_core/renderer_vulkan/renderer_vulkan.h"
|
||||||
|
#include "video_core/shader_notify.h"
|
||||||
#include "video_core/vulkan_common/vulkan_instance.h"
|
#include "video_core/vulkan_common/vulkan_instance.h"
|
||||||
#include "video_core/vulkan_common/vulkan_surface.h"
|
#include "video_core/vulkan_common/vulkan_surface.h"
|
||||||
#include "video_core/shader_notify.h"
|
|
||||||
#include "network/announce_multiplayer_session.h"
|
|
||||||
|
|
||||||
#define jconst [[maybe_unused]] const auto
|
#define jconst [[maybe_unused]] const auto
|
||||||
#define jauto [[maybe_unused]] auto
|
#define jauto [[maybe_unused]] auto
|
||||||
|
|
||||||
static EmulationSession s_instance;
|
static EmulationSession s_instance;
|
||||||
|
|
||||||
//Abdroid Multiplayer which can be initialized with parameters
|
// Abdroid Multiplayer which can be initialized with parameters
|
||||||
std::unique_ptr<AndroidMultiplayer> multiplayer{nullptr};
|
std::unique_ptr<AndroidMultiplayer> multiplayer{nullptr};
|
||||||
std::shared_ptr<Core::AnnounceMultiplayerSession> announce_multiplayer_session;
|
std::shared_ptr<Core::AnnounceMultiplayerSession> announce_multiplayer_session;
|
||||||
|
|
||||||
//Power Status default values
|
// Power Status default values
|
||||||
std::atomic<int> g_battery_percentage = {100};
|
std::atomic<int> g_battery_percentage = {100};
|
||||||
std::atomic<bool> g_is_charging = {false};
|
std::atomic<bool> g_is_charging = {false};
|
||||||
std::atomic<bool> g_has_battery = {true};
|
std::atomic<bool> g_has_battery = {true};
|
||||||
|
@ -581,7 +580,9 @@ jobjectArray Java_org_yuzu_yuzu_1emu_utils_GpuDriverHelper_getSystemDriverInfo(
|
||||||
return j_driver_info;
|
return j_driver_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
jstring Java_org_yuzu_yuzu_1emu_utils_GpuDriverHelper_getGpuModel(JNIEnv *env, jobject j_obj, jobject j_surf, jstring j_hook_lib_dir) {
|
jstring Java_org_yuzu_yuzu_1emu_utils_GpuDriverHelper_getGpuModel(JNIEnv* env, jobject j_obj,
|
||||||
|
jobject j_surf,
|
||||||
|
jstring j_hook_lib_dir) {
|
||||||
const char* file_redirect_dir_{};
|
const char* file_redirect_dir_{};
|
||||||
int featureFlags{};
|
int featureFlags{};
|
||||||
std::string hook_lib_dir = Common::Android::GetJString(env, j_hook_lib_dir);
|
std::string hook_lib_dir = Common::Android::GetJString(env, j_hook_lib_dir);
|
||||||
|
@ -590,11 +591,11 @@ jstring Java_org_yuzu_yuzu_1emu_utils_GpuDriverHelper_getGpuModel(JNIEnv *env, j
|
||||||
auto driver_library = std::make_shared<Common::DynamicLibrary>(handle);
|
auto driver_library = std::make_shared<Common::DynamicLibrary>(handle);
|
||||||
InputCommon::InputSubsystem input_subsystem;
|
InputCommon::InputSubsystem input_subsystem;
|
||||||
auto window =
|
auto window =
|
||||||
std::make_unique<EmuWindow_Android>(ANativeWindow_fromSurface(env, j_surf), driver_library);
|
std::make_unique<EmuWindow_Android>(ANativeWindow_fromSurface(env, j_surf), driver_library);
|
||||||
|
|
||||||
Vulkan::vk::InstanceDispatch dld;
|
Vulkan::vk::InstanceDispatch dld;
|
||||||
Vulkan::vk::Instance vk_instance = Vulkan::CreateInstance(
|
Vulkan::vk::Instance vk_instance = Vulkan::CreateInstance(
|
||||||
*driver_library, dld, VK_API_VERSION_1_1, Core::Frontend::WindowSystemType::Android);
|
*driver_library, dld, VK_API_VERSION_1_1, Core::Frontend::WindowSystemType::Android);
|
||||||
|
|
||||||
auto surface = Vulkan::CreateSurface(vk_instance, window->GetWindowInfo());
|
auto surface = Vulkan::CreateSurface(vk_instance, window->GetWindowInfo());
|
||||||
|
|
||||||
|
@ -791,16 +792,19 @@ jstring Java_org_yuzu_yuzu_1emu_NativeLibrary_firmwareVersion(JNIEnv* env, jclas
|
||||||
}
|
}
|
||||||
|
|
||||||
jint Java_org_yuzu_yuzu_1emu_NativeLibrary_verifyFirmware(JNIEnv* env, jclass clazz) {
|
jint Java_org_yuzu_yuzu_1emu_NativeLibrary_verifyFirmware(JNIEnv* env, jclass clazz) {
|
||||||
return static_cast<int>(FirmwareManager::VerifyFirmware(EmulationSession::GetInstance().System()));
|
return static_cast<int>(
|
||||||
|
FirmwareManager::VerifyFirmware(EmulationSession::GetInstance().System()));
|
||||||
}
|
}
|
||||||
|
|
||||||
jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_gameRequiresFirmware(JNIEnv* env, jclass clazz, jstring jprogramId) {
|
jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_gameRequiresFirmware(JNIEnv* env, jclass clazz,
|
||||||
|
jstring jprogramId) {
|
||||||
auto program_id = EmulationSession::GetProgramId(env, jprogramId);
|
auto program_id = EmulationSession::GetProgramId(env, jprogramId);
|
||||||
|
|
||||||
return FirmwareManager::GameRequiresFirmware(program_id);
|
return FirmwareManager::GameRequiresFirmware(program_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
jint Java_org_yuzu_yuzu_1emu_NativeLibrary_installKeys(JNIEnv* env, jclass clazz, jstring jpath, jstring jext) {
|
jint Java_org_yuzu_yuzu_1emu_NativeLibrary_installKeys(JNIEnv* env, jclass clazz, jstring jpath,
|
||||||
|
jstring jext) {
|
||||||
const auto path = Common::Android::GetJString(env, jpath);
|
const auto path = Common::Android::GetJString(env, jpath);
|
||||||
const auto ext = Common::Android::GetJString(env, jext);
|
const auto ext = Common::Android::GetJString(env, jext);
|
||||||
|
|
||||||
|
@ -957,105 +961,97 @@ jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_areKeysPresent(JNIEnv* env, jobje
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_org_yuzu_yuzu_1emu_NativeLibrary_initMultiplayer(
|
Java_org_yuzu_yuzu_1emu_NativeLibrary_initMultiplayer(JNIEnv* env, [[maybe_unused]] jobject obj) {
|
||||||
JNIEnv* env, [[maybe_unused]] jobject obj) {
|
|
||||||
if (multiplayer) {
|
if (multiplayer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
announce_multiplayer_session = std::make_shared<Core::AnnounceMultiplayerSession>();
|
announce_multiplayer_session = std::make_shared<Core::AnnounceMultiplayerSession>();
|
||||||
|
|
||||||
multiplayer = std::make_unique<AndroidMultiplayer>(s_instance.System(), announce_multiplayer_session);
|
multiplayer =
|
||||||
|
std::make_unique<AndroidMultiplayer>(s_instance.System(), announce_multiplayer_session);
|
||||||
multiplayer->NetworkInit();
|
multiplayer->NetworkInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jobjectArray JNICALL
|
JNIEXPORT jobjectArray JNICALL Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlayGetPublicRooms(
|
||||||
Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlayGetPublicRooms(
|
JNIEnv* env, [[maybe_unused]] jobject obj) {
|
||||||
JNIEnv *env, [[maybe_unused]] jobject obj) {
|
|
||||||
return Common::Android::ToJStringArray(env, multiplayer->NetPlayGetPublicRooms());
|
return Common::Android::ToJStringArray(env, multiplayer->NetPlayGetPublicRooms());
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlayCreateRoom(
|
JNIEXPORT jint JNICALL Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlayCreateRoom(
|
||||||
JNIEnv* env, [[maybe_unused]] jobject obj, jstring ipaddress, jint port,
|
JNIEnv* env, [[maybe_unused]] jobject obj, jstring ipaddress, jint port, jstring username,
|
||||||
jstring username, jstring preferredGameName, jlong preferredGameId, jstring password,
|
jstring preferredGameName, jlong preferredGameId, jstring password, jstring room_name,
|
||||||
jstring room_name, jint max_players, jboolean isPublic) {
|
jint max_players, jboolean isPublic) {
|
||||||
return static_cast<jint>(
|
return static_cast<jint>(multiplayer->NetPlayCreateRoom(
|
||||||
multiplayer->NetPlayCreateRoom(Common::Android::GetJString(env, ipaddress), port,
|
Common::Android::GetJString(env, ipaddress), port,
|
||||||
Common::Android::GetJString(env, username), Common::Android::GetJString(env, preferredGameName),
|
Common::Android::GetJString(env, username),
|
||||||
preferredGameId,Common::Android::GetJString(env, password),
|
Common::Android::GetJString(env, preferredGameName), preferredGameId,
|
||||||
Common::Android::GetJString(env, room_name), max_players, isPublic));
|
Common::Android::GetJString(env, password), Common::Android::GetJString(env, room_name),
|
||||||
|
max_players, isPublic));
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlayJoinRoom(
|
JNIEXPORT jint JNICALL Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlayJoinRoom(
|
||||||
JNIEnv* env, [[maybe_unused]] jobject obj, jstring ipaddress, jint port,
|
JNIEnv* env, [[maybe_unused]] jobject obj, jstring ipaddress, jint port, jstring username,
|
||||||
jstring username, jstring password) {
|
jstring password) {
|
||||||
return static_cast<jint>(
|
return static_cast<jint>(multiplayer->NetPlayJoinRoom(
|
||||||
multiplayer->NetPlayJoinRoom(Common::Android::GetJString(env, ipaddress), port,
|
Common::Android::GetJString(env, ipaddress), port,
|
||||||
Common::Android::GetJString(env, username), Common::Android::GetJString(env, password)));
|
Common::Android::GetJString(env, username), Common::Android::GetJString(env, password)));
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jobjectArray JNICALL
|
JNIEXPORT jobjectArray JNICALL Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlayRoomInfo(
|
||||||
Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlayRoomInfo(
|
JNIEnv* env, [[maybe_unused]] jobject obj) {
|
||||||
JNIEnv* env, [[maybe_unused]] jobject obj) {
|
|
||||||
return Common::Android::ToJStringArray(env, multiplayer->NetPlayRoomInfo());
|
return Common::Android::ToJStringArray(env, multiplayer->NetPlayRoomInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL
|
JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlayIsJoined(
|
||||||
Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlayIsJoined(
|
[[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj) {
|
||||||
[[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj) {
|
|
||||||
return multiplayer->NetPlayIsJoined();
|
return multiplayer->NetPlayIsJoined();
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL
|
JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlayIsHostedRoom(
|
||||||
Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlayIsHostedRoom(
|
[[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj) {
|
||||||
[[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj) {
|
|
||||||
return multiplayer->NetPlayIsHostedRoom();
|
return multiplayer->NetPlayIsHostedRoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlaySendMessage(
|
||||||
Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlaySendMessage(
|
JNIEnv* env, [[maybe_unused]] jobject obj, jstring msg) {
|
||||||
JNIEnv* env, [[maybe_unused]] jobject obj, jstring msg) {
|
|
||||||
multiplayer->NetPlaySendMessage(Common::Android::GetJString(env, msg));
|
multiplayer->NetPlaySendMessage(Common::Android::GetJString(env, msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlayKickUser(
|
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlayKickUser(
|
||||||
JNIEnv* env, [[maybe_unused]] jobject obj, jstring username) {
|
JNIEnv* env, [[maybe_unused]] jobject obj, jstring username) {
|
||||||
multiplayer->NetPlayKickUser(Common::Android::GetJString(env, username));
|
multiplayer->NetPlayKickUser(Common::Android::GetJString(env, username));
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlayLeaveRoom(
|
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlayLeaveRoom(
|
||||||
[[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj) {
|
[[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj) {
|
||||||
multiplayer->NetPlayLeaveRoom();
|
multiplayer->NetPlayLeaveRoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL
|
JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlayIsModerator(
|
||||||
Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlayIsModerator(
|
[[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj) {
|
||||||
[[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj) {
|
|
||||||
return multiplayer->NetPlayIsModerator();
|
return multiplayer->NetPlayIsModerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jobjectArray JNICALL
|
JNIEXPORT jobjectArray JNICALL Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlayGetBanList(
|
||||||
Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlayGetBanList(
|
JNIEnv* env, [[maybe_unused]] jobject obj) {
|
||||||
JNIEnv* env, [[maybe_unused]] jobject obj) {
|
|
||||||
return Common::Android::ToJStringArray(env, multiplayer->NetPlayGetBanList());
|
return Common::Android::ToJStringArray(env, multiplayer->NetPlayGetBanList());
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlayBanUser(
|
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlayBanUser(
|
||||||
JNIEnv* env, [[maybe_unused]] jobject obj, jstring username) {
|
JNIEnv* env, [[maybe_unused]] jobject obj, jstring username) {
|
||||||
multiplayer->NetPlayBanUser(Common::Android::GetJString(env, username));
|
multiplayer->NetPlayBanUser(Common::Android::GetJString(env, username));
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlayUnbanUser(
|
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_network_NetPlayManager_netPlayUnbanUser(
|
||||||
JNIEnv* env, [[maybe_unused]] jobject obj, jstring username) {
|
JNIEnv* env, [[maybe_unused]] jobject obj, jstring username) {
|
||||||
multiplayer->NetPlayUnbanUser(Common::Android::GetJString(env, username));
|
multiplayer->NetPlayUnbanUser(Common::Android::GetJString(env, username));
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_updatePowerState(
|
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_updatePowerState(JNIEnv* env, jobject,
|
||||||
JNIEnv* env,
|
jint percentage,
|
||||||
jobject,
|
jboolean isCharging,
|
||||||
jint percentage,
|
jboolean hasBattery) {
|
||||||
jboolean isCharging,
|
|
||||||
jboolean hasBattery) {
|
|
||||||
|
|
||||||
g_battery_percentage.store(percentage, std::memory_order_relaxed);
|
g_battery_percentage.store(percentage, std::memory_order_relaxed);
|
||||||
g_is_charging.store(isCharging, std::memory_order_relaxed);
|
g_is_charging.store(isCharging, std::memory_order_relaxed);
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
namespace AudioCore::AudioIn {
|
namespace AudioCore::AudioIn {
|
||||||
|
|
||||||
In::In(Core::System& system_, Manager& manager_, Kernel::KEvent* event_, size_t session_id_)
|
In::In(Core::System& system_, Manager& manager_, Kernel::KEvent* event_, size_t session_id_)
|
||||||
: manager{manager_}, parent_mutex{manager.mutex}, event{event_}, system{system_, event,
|
: manager{manager_}, parent_mutex{manager.mutex}, event{event_},
|
||||||
session_id_} {}
|
system{system_, event, session_id_} {}
|
||||||
|
|
||||||
void In::Free() {
|
void In::Free() {
|
||||||
std::scoped_lock l{parent_mutex};
|
std::scoped_lock l{parent_mutex};
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
namespace AudioCore::AudioIn {
|
namespace AudioCore::AudioIn {
|
||||||
|
|
||||||
System::System(Core::System& system_, Kernel::KEvent* event_, const size_t session_id_)
|
System::System(Core::System& system_, Kernel::KEvent* event_, const size_t session_id_)
|
||||||
: system{system_}, buffer_event{event_},
|
: system{system_}, buffer_event{event_}, session_id{session_id_},
|
||||||
session_id{session_id_}, session{std::make_unique<DeviceSession>(system_)} {}
|
session{std::make_unique<DeviceSession>(system_)} {}
|
||||||
|
|
||||||
System::~System() {
|
System::~System() {
|
||||||
Finalize();
|
Finalize();
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
namespace AudioCore::AudioOut {
|
namespace AudioCore::AudioOut {
|
||||||
|
|
||||||
Out::Out(Core::System& system_, Manager& manager_, Kernel::KEvent* event_, size_t session_id_)
|
Out::Out(Core::System& system_, Manager& manager_, Kernel::KEvent* event_, size_t session_id_)
|
||||||
: manager{manager_}, parent_mutex{manager.mutex}, event{event_}, system{system_, event,
|
: manager{manager_}, parent_mutex{manager.mutex}, event{event_},
|
||||||
session_id_} {}
|
system{system_, event, session_id_} {}
|
||||||
|
|
||||||
void Out::Free() {
|
void Out::Free() {
|
||||||
std::scoped_lock l{parent_mutex};
|
std::scoped_lock l{parent_mutex};
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
namespace AudioCore::AudioOut {
|
namespace AudioCore::AudioOut {
|
||||||
|
|
||||||
System::System(Core::System& system_, Kernel::KEvent* event_, size_t session_id_)
|
System::System(Core::System& system_, Kernel::KEvent* event_, size_t session_id_)
|
||||||
: system{system_}, buffer_event{event_},
|
: system{system_}, buffer_event{event_}, session_id{session_id_},
|
||||||
session_id{session_id_}, session{std::make_unique<DeviceSession>(system_)} {}
|
session{std::make_unique<DeviceSession>(system_)} {}
|
||||||
|
|
||||||
System::~System() {
|
System::~System() {
|
||||||
Finalize();
|
Finalize();
|
||||||
|
|
|
@ -19,10 +19,9 @@ namespace AudioCore::Renderer {
|
||||||
|
|
||||||
InfoUpdater::InfoUpdater(std::span<const u8> input_, std::span<u8> output_,
|
InfoUpdater::InfoUpdater(std::span<const u8> input_, std::span<u8> output_,
|
||||||
Kernel::KProcess* process_handle_, BehaviorInfo& behaviour_)
|
Kernel::KProcess* process_handle_, BehaviorInfo& behaviour_)
|
||||||
: input{input_.data() + sizeof(UpdateDataHeader)},
|
: input{input_.data() + sizeof(UpdateDataHeader)}, input_origin{input_},
|
||||||
input_origin{input_}, output{output_.data() + sizeof(UpdateDataHeader)},
|
output{output_.data() + sizeof(UpdateDataHeader)}, output_origin{output_},
|
||||||
output_origin{output_}, in_header{reinterpret_cast<const UpdateDataHeader*>(
|
in_header{reinterpret_cast<const UpdateDataHeader*>(input_origin.data())},
|
||||||
input_origin.data())},
|
|
||||||
out_header{reinterpret_cast<UpdateDataHeader*>(output_origin.data())},
|
out_header{reinterpret_cast<UpdateDataHeader*>(output_origin.data())},
|
||||||
expected_input_size{input_.size()}, expected_output_size{output_.size()},
|
expected_input_size{input_.size()}, expected_output_size{output_.size()},
|
||||||
process_handle{process_handle_}, behaviour{behaviour_} {
|
process_handle{process_handle_}, behaviour{behaviour_} {
|
||||||
|
|
|
@ -13,8 +13,8 @@ PoolMapper::PoolMapper(Kernel::KProcess* process_handle_, bool force_map_)
|
||||||
|
|
||||||
PoolMapper::PoolMapper(Kernel::KProcess* process_handle_, std::span<MemoryPoolInfo> pool_infos_,
|
PoolMapper::PoolMapper(Kernel::KProcess* process_handle_, std::span<MemoryPoolInfo> pool_infos_,
|
||||||
u32 pool_count_, bool force_map_)
|
u32 pool_count_, bool force_map_)
|
||||||
: process_handle{process_handle_}, pool_infos{pool_infos_.data()},
|
: process_handle{process_handle_}, pool_infos{pool_infos_.data()}, pool_count{pool_count_},
|
||||||
pool_count{pool_count_}, force_map{force_map_} {}
|
force_map{force_map_} {}
|
||||||
|
|
||||||
void PoolMapper::ClearUseState(std::span<MemoryPoolInfo> pools, const u32 count) {
|
void PoolMapper::ClearUseState(std::span<MemoryPoolInfo> pools, const u32 count) {
|
||||||
for (u32 i = 0; i < count; i++) {
|
for (u32 i = 0; i < count; i++) {
|
||||||
|
|
|
@ -240,7 +240,9 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz
|
||||||
// Successfully dequeued a new buffer.
|
// Successfully dequeued a new buffer.
|
||||||
queued_buffers--;
|
queued_buffers--;
|
||||||
|
|
||||||
{ std::unique_lock lk{release_mutex}; }
|
{
|
||||||
|
std::unique_lock lk{release_mutex};
|
||||||
|
}
|
||||||
|
|
||||||
release_cv.notify_one();
|
release_cv.notify_one();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,7 @@
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
template <typename VaType, size_t AddressSpaceBits>
|
template <typename VaType, size_t AddressSpaceBits>
|
||||||
concept AddressSpaceValid = std::is_unsigned_v<VaType> && sizeof(VaType) * 8 >=
|
concept AddressSpaceValid = std::is_unsigned_v<VaType> && sizeof(VaType) * 8 >= AddressSpaceBits;
|
||||||
AddressSpaceBits;
|
|
||||||
|
|
||||||
struct EmptyStruct {};
|
struct EmptyStruct {};
|
||||||
|
|
||||||
|
|
|
@ -38,8 +38,8 @@ jstring ToJString(JNIEnv* env, std::string_view str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
jobjectArray ToJStringArray(JNIEnv* env, const std::vector<std::string>& strs) {
|
jobjectArray ToJStringArray(JNIEnv* env, const std::vector<std::string>& strs) {
|
||||||
jobjectArray array =
|
jobjectArray array = env->NewObjectArray(
|
||||||
env->NewObjectArray(static_cast<jsize>(strs.size()), env->FindClass("java/lang/String"), env->NewStringUTF(""));
|
static_cast<jsize>(strs.size()), env->FindClass("java/lang/String"), env->NewStringUTF(""));
|
||||||
for (std::size_t i = 0; i < strs.size(); ++i) {
|
for (std::size_t i = 0; i < strs.size(); ++i) {
|
||||||
env->SetObjectArrayElement(array, static_cast<jsize>(i), ToJString(env, strs[i]));
|
env->SetObjectArrayElement(array, static_cast<jsize>(i), ToJString(env, strs[i]));
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -118,5 +118,4 @@ jmethodID GetYuzuDeviceHasKeys();
|
||||||
jmethodID GetAddNetPlayMessage();
|
jmethodID GetAddNetPlayMessage();
|
||||||
jmethodID ClearChat();
|
jmethodID ClearChat();
|
||||||
|
|
||||||
|
|
||||||
} // namespace Common::Android
|
} // namespace Common::Android
|
||||||
|
|
|
@ -6,23 +6,23 @@
|
||||||
|
|
||||||
#include "common/android/android_common.h"
|
#include "common/android/android_common.h"
|
||||||
|
|
||||||
|
#include "android/log.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "network/network.h"
|
#include "network/network.h"
|
||||||
#include "android/log.h"
|
|
||||||
|
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
#include "web_service/web_backend.h"
|
|
||||||
#include "web_service/verify_user_jwt.h"
|
#include "web_service/verify_user_jwt.h"
|
||||||
|
#include "web_service/web_backend.h"
|
||||||
#include "web_service/web_result.h"
|
#include "web_service/web_result.h"
|
||||||
|
|
||||||
#include <thread>
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
namespace IDCache = Common::Android;
|
namespace IDCache = Common::Android;
|
||||||
|
|
||||||
AndroidMultiplayer::AndroidMultiplayer(Core::System &system_,
|
AndroidMultiplayer::AndroidMultiplayer(Core::System& system_,
|
||||||
std::shared_ptr<Core::AnnounceMultiplayerSession> session)
|
std::shared_ptr<Core::AnnounceMultiplayerSession> session)
|
||||||
: system{system_}, announce_multiplayer_session(session) {}
|
: system{system_}, announce_multiplayer_session(session) {}
|
||||||
|
|
||||||
AndroidMultiplayer::~AndroidMultiplayer() = default;
|
AndroidMultiplayer::~AndroidMultiplayer() = default;
|
||||||
|
|
||||||
|
@ -31,8 +31,8 @@ void AndroidMultiplayer::AddNetPlayMessage(jint type, jstring msg) {
|
||||||
IDCache::GetAddNetPlayMessage(), type, msg);
|
IDCache::GetAddNetPlayMessage(), type, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidMultiplayer::AddNetPlayMessage(int type, const std::string &msg) {
|
void AndroidMultiplayer::AddNetPlayMessage(int type, const std::string& msg) {
|
||||||
JNIEnv *env = IDCache::GetEnvForThread();
|
JNIEnv* env = IDCache::GetEnvForThread();
|
||||||
AddNetPlayMessage(type, Common::Android::ToJString(env, msg));
|
AddNetPlayMessage(type, Common::Android::ToJString(env, msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,91 +50,91 @@ bool AndroidMultiplayer::NetworkInit() {
|
||||||
|
|
||||||
if (auto member = Network::GetRoomMember().lock()) {
|
if (auto member = Network::GetRoomMember().lock()) {
|
||||||
// register the network structs to use in slots and signals
|
// register the network structs to use in slots and signals
|
||||||
member->BindOnStateChanged([this](const Network::RoomMember::State &state) {
|
member->BindOnStateChanged([this](const Network::RoomMember::State& state) {
|
||||||
if (state == Network::RoomMember::State::Joined ||
|
if (state == Network::RoomMember::State::Joined ||
|
||||||
state == Network::RoomMember::State::Moderator) {
|
state == Network::RoomMember::State::Moderator) {
|
||||||
NetPlayStatus status;
|
NetPlayStatus status;
|
||||||
std::string msg;
|
std::string msg;
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case Network::RoomMember::State::Joined:
|
case Network::RoomMember::State::Joined:
|
||||||
status = NetPlayStatus::ROOM_JOINED;
|
status = NetPlayStatus::ROOM_JOINED;
|
||||||
break;
|
break;
|
||||||
case Network::RoomMember::State::Moderator:
|
case Network::RoomMember::State::Moderator:
|
||||||
status = NetPlayStatus::ROOM_MODERATOR;
|
status = NetPlayStatus::ROOM_MODERATOR;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AddNetPlayMessage(static_cast<int>(status), msg);
|
AddNetPlayMessage(static_cast<int>(status), msg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
member->BindOnError([this](const Network::RoomMember::Error &error) {
|
member->BindOnError([this](const Network::RoomMember::Error& error) {
|
||||||
NetPlayStatus status;
|
NetPlayStatus status;
|
||||||
std::string msg;
|
std::string msg;
|
||||||
switch (error) {
|
switch (error) {
|
||||||
case Network::RoomMember::Error::LostConnection:
|
case Network::RoomMember::Error::LostConnection:
|
||||||
status = NetPlayStatus::LOST_CONNECTION;
|
status = NetPlayStatus::LOST_CONNECTION;
|
||||||
break;
|
break;
|
||||||
case Network::RoomMember::Error::HostKicked:
|
case Network::RoomMember::Error::HostKicked:
|
||||||
status = NetPlayStatus::HOST_KICKED;
|
status = NetPlayStatus::HOST_KICKED;
|
||||||
break;
|
break;
|
||||||
case Network::RoomMember::Error::UnknownError:
|
case Network::RoomMember::Error::UnknownError:
|
||||||
status = NetPlayStatus::UNKNOWN_ERROR;
|
status = NetPlayStatus::UNKNOWN_ERROR;
|
||||||
break;
|
break;
|
||||||
case Network::RoomMember::Error::NameCollision:
|
case Network::RoomMember::Error::NameCollision:
|
||||||
status = NetPlayStatus::NAME_COLLISION;
|
status = NetPlayStatus::NAME_COLLISION;
|
||||||
break;
|
break;
|
||||||
case Network::RoomMember::Error::IpCollision:
|
case Network::RoomMember::Error::IpCollision:
|
||||||
status = NetPlayStatus::MAC_COLLISION;
|
status = NetPlayStatus::MAC_COLLISION;
|
||||||
break;
|
break;
|
||||||
case Network::RoomMember::Error::WrongVersion:
|
case Network::RoomMember::Error::WrongVersion:
|
||||||
status = NetPlayStatus::WRONG_VERSION;
|
status = NetPlayStatus::WRONG_VERSION;
|
||||||
break;
|
break;
|
||||||
case Network::RoomMember::Error::WrongPassword:
|
case Network::RoomMember::Error::WrongPassword:
|
||||||
status = NetPlayStatus::WRONG_PASSWORD;
|
status = NetPlayStatus::WRONG_PASSWORD;
|
||||||
break;
|
break;
|
||||||
case Network::RoomMember::Error::CouldNotConnect:
|
case Network::RoomMember::Error::CouldNotConnect:
|
||||||
status = NetPlayStatus::COULD_NOT_CONNECT;
|
status = NetPlayStatus::COULD_NOT_CONNECT;
|
||||||
break;
|
break;
|
||||||
case Network::RoomMember::Error::RoomIsFull:
|
case Network::RoomMember::Error::RoomIsFull:
|
||||||
status = NetPlayStatus::ROOM_IS_FULL;
|
status = NetPlayStatus::ROOM_IS_FULL;
|
||||||
break;
|
break;
|
||||||
case Network::RoomMember::Error::HostBanned:
|
case Network::RoomMember::Error::HostBanned:
|
||||||
status = NetPlayStatus::HOST_BANNED;
|
status = NetPlayStatus::HOST_BANNED;
|
||||||
break;
|
break;
|
||||||
case Network::RoomMember::Error::PermissionDenied:
|
case Network::RoomMember::Error::PermissionDenied:
|
||||||
status = NetPlayStatus::PERMISSION_DENIED;
|
status = NetPlayStatus::PERMISSION_DENIED;
|
||||||
break;
|
break;
|
||||||
case Network::RoomMember::Error::NoSuchUser:
|
case Network::RoomMember::Error::NoSuchUser:
|
||||||
status = NetPlayStatus::NO_SUCH_USER;
|
status = NetPlayStatus::NO_SUCH_USER;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
AddNetPlayMessage(static_cast<int>(status), msg);
|
AddNetPlayMessage(static_cast<int>(status), msg);
|
||||||
});
|
});
|
||||||
member->BindOnStatusMessageReceived(
|
member->BindOnStatusMessageReceived(
|
||||||
[this](const Network::StatusMessageEntry &status_message) {
|
[this](const Network::StatusMessageEntry& status_message) {
|
||||||
NetPlayStatus status = NetPlayStatus::NO_ERROR;
|
NetPlayStatus status = NetPlayStatus::NO_ERROR;
|
||||||
std::string msg(status_message.nickname);
|
std::string msg(status_message.nickname);
|
||||||
switch (status_message.type) {
|
switch (status_message.type) {
|
||||||
case Network::IdMemberJoin:
|
case Network::IdMemberJoin:
|
||||||
status = NetPlayStatus::MEMBER_JOIN;
|
status = NetPlayStatus::MEMBER_JOIN;
|
||||||
break;
|
break;
|
||||||
case Network::IdMemberLeave:
|
case Network::IdMemberLeave:
|
||||||
status = NetPlayStatus::MEMBER_LEAVE;
|
status = NetPlayStatus::MEMBER_LEAVE;
|
||||||
break;
|
break;
|
||||||
case Network::IdMemberKicked:
|
case Network::IdMemberKicked:
|
||||||
status = NetPlayStatus::MEMBER_KICKED;
|
status = NetPlayStatus::MEMBER_KICKED;
|
||||||
break;
|
break;
|
||||||
case Network::IdMemberBanned:
|
case Network::IdMemberBanned:
|
||||||
status = NetPlayStatus::MEMBER_BANNED;
|
status = NetPlayStatus::MEMBER_BANNED;
|
||||||
break;
|
break;
|
||||||
case Network::IdAddressUnbanned:
|
case Network::IdAddressUnbanned:
|
||||||
status = NetPlayStatus::ADDRESS_UNBANNED;
|
status = NetPlayStatus::ADDRESS_UNBANNED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
AddNetPlayMessage(static_cast<int>(status), msg);
|
AddNetPlayMessage(static_cast<int>(status), msg);
|
||||||
});
|
});
|
||||||
member->BindOnChatMessageReceived([this](const Network::ChatEntry &chat) {
|
member->BindOnChatMessageReceived([this](const Network::ChatEntry& chat) {
|
||||||
NetPlayStatus status = NetPlayStatus::CHAT_MESSAGE;
|
NetPlayStatus status = NetPlayStatus::CHAT_MESSAGE;
|
||||||
std::string msg(chat.nickname);
|
std::string msg(chat.nickname);
|
||||||
msg += ": ";
|
msg += ": ";
|
||||||
|
@ -146,13 +146,10 @@ bool AndroidMultiplayer::NetworkInit() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetPlayStatus AndroidMultiplayer::NetPlayCreateRoom(const std::string &ipaddress, int port,
|
NetPlayStatus AndroidMultiplayer::NetPlayCreateRoom(
|
||||||
const std::string &username,
|
const std::string& ipaddress, int port, const std::string& username,
|
||||||
const std::string &preferredGameName,
|
const std::string& preferredGameName, const u64& preferredGameId, const std::string& password,
|
||||||
const u64 &preferredGameId,
|
const std::string& room_name, int max_players, bool isPublic) {
|
||||||
const std::string &password,
|
|
||||||
const std::string &room_name, int max_players,
|
|
||||||
bool isPublic) {
|
|
||||||
auto member = Network::GetRoomMember().lock();
|
auto member = Network::GetRoomMember().lock();
|
||||||
if (!member) {
|
if (!member) {
|
||||||
return NetPlayStatus::NETWORK_ERROR;
|
return NetPlayStatus::NETWORK_ERROR;
|
||||||
|
@ -173,8 +170,8 @@ NetPlayStatus AndroidMultiplayer::NetPlayCreateRoom(const std::string &ipaddress
|
||||||
|
|
||||||
// Placeholder game info
|
// Placeholder game info
|
||||||
const AnnounceMultiplayerRoom::GameInfo game{
|
const AnnounceMultiplayerRoom::GameInfo game{
|
||||||
.name = preferredGameName,
|
.name = preferredGameName,
|
||||||
.id = preferredGameId,
|
.id = preferredGameId,
|
||||||
};
|
};
|
||||||
|
|
||||||
port = (port == 0) ? Network::DefaultRoomPort : static_cast<u16>(port);
|
port = (port == 0) ? Network::DefaultRoomPort : static_cast<u16>(port);
|
||||||
|
@ -205,8 +202,8 @@ NetPlayStatus AndroidMultiplayer::NetPlayCreateRoom(const std::string &ipaddress
|
||||||
|
|
||||||
std::string token;
|
std::string token;
|
||||||
// TODO(alekpop): properly handle the compile definition, it's not working right
|
// TODO(alekpop): properly handle the compile definition, it's not working right
|
||||||
//#ifdef ENABLE_WEB_SERVICE
|
// #ifdef ENABLE_WEB_SERVICE
|
||||||
// LOG_INFO(WebService, "Web Service enabled");
|
// LOG_INFO(WebService, "Web Service enabled");
|
||||||
if (isPublic) {
|
if (isPublic) {
|
||||||
WebService::Client client(Settings::values.web_api_url.GetValue(),
|
WebService::Client client(Settings::values.web_api_url.GetValue(),
|
||||||
Settings::values.eden_username.GetValue(),
|
Settings::values.eden_username.GetValue(),
|
||||||
|
@ -220,9 +217,9 @@ NetPlayStatus AndroidMultiplayer::NetPlayCreateRoom(const std::string &ipaddress
|
||||||
LOG_INFO(WebService, "Successfully requested external JWT: size={}", token.size());
|
LOG_INFO(WebService, "Successfully requested external JWT: size={}", token.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//#else
|
// #else
|
||||||
// LOG_INFO(WebService, "Web Service disabled");
|
// LOG_INFO(WebService, "Web Service disabled");
|
||||||
//#endif
|
// #endif
|
||||||
|
|
||||||
member->Join(username, ipaddress.c_str(), static_cast<u16>(port), 0, Network::NoPreferredIP,
|
member->Join(username, ipaddress.c_str(), static_cast<u16>(port), 0, Network::NoPreferredIP,
|
||||||
password, token);
|
password, token);
|
||||||
|
@ -241,17 +238,15 @@ NetPlayStatus AndroidMultiplayer::NetPlayCreateRoom(const std::string &ipaddress
|
||||||
return NetPlayStatus::CREATE_ROOM_ERROR;
|
return NetPlayStatus::CREATE_ROOM_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetPlayStatus AndroidMultiplayer::NetPlayJoinRoom(const std::string &ipaddress, int port,
|
NetPlayStatus AndroidMultiplayer::NetPlayJoinRoom(const std::string& ipaddress, int port,
|
||||||
const std::string &username,
|
const std::string& username,
|
||||||
const std::string &password) {
|
const std::string& password) {
|
||||||
auto member = Network::GetRoomMember().lock();
|
auto member = Network::GetRoomMember().lock();
|
||||||
if (!member) {
|
if (!member) {
|
||||||
return NetPlayStatus::NETWORK_ERROR;
|
return NetPlayStatus::NETWORK_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
port =
|
port = (port == 0) ? Network::DefaultRoomPort : static_cast<u16>(port);
|
||||||
(port == 0) ? Network::DefaultRoomPort : static_cast<u16>(port);
|
|
||||||
|
|
||||||
|
|
||||||
if (member->GetState() == Network::RoomMember::State::Joining || member->IsConnected()) {
|
if (member->GetState() == Network::RoomMember::State::Joining || member->IsConnected()) {
|
||||||
return NetPlayStatus::ALREADY_IN_ROOM;
|
return NetPlayStatus::ALREADY_IN_ROOM;
|
||||||
|
@ -275,7 +270,7 @@ NetPlayStatus AndroidMultiplayer::NetPlayJoinRoom(const std::string &ipaddress,
|
||||||
return NetPlayStatus::WRONG_PASSWORD;
|
return NetPlayStatus::WRONG_PASSWORD;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidMultiplayer::NetPlaySendMessage(const std::string &msg) {
|
void AndroidMultiplayer::NetPlaySendMessage(const std::string& msg) {
|
||||||
if (auto room = Network::GetRoomMember().lock()) {
|
if (auto room = Network::GetRoomMember().lock()) {
|
||||||
if (room->GetState() != Network::RoomMember::State::Joined &&
|
if (room->GetState() != Network::RoomMember::State::Joined &&
|
||||||
room->GetState() != Network::RoomMember::State::Moderator) {
|
room->GetState() != Network::RoomMember::State::Moderator) {
|
||||||
|
@ -286,11 +281,11 @@ void AndroidMultiplayer::NetPlaySendMessage(const std::string &msg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidMultiplayer::NetPlayKickUser(const std::string &username) {
|
void AndroidMultiplayer::NetPlayKickUser(const std::string& username) {
|
||||||
if (auto room = Network::GetRoomMember().lock()) {
|
if (auto room = Network::GetRoomMember().lock()) {
|
||||||
auto members = room->GetMemberInformation();
|
auto members = room->GetMemberInformation();
|
||||||
auto it = std::find_if(members.begin(), members.end(),
|
auto it = std::find_if(members.begin(), members.end(),
|
||||||
[&username](const Network::RoomMember::MemberInformation &member) {
|
[&username](const Network::RoomMember::MemberInformation& member) {
|
||||||
return member.nickname == username;
|
return member.nickname == username;
|
||||||
});
|
});
|
||||||
if (it != members.end()) {
|
if (it != members.end()) {
|
||||||
|
@ -299,11 +294,11 @@ void AndroidMultiplayer::NetPlayKickUser(const std::string &username) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidMultiplayer::NetPlayBanUser(const std::string &username) {
|
void AndroidMultiplayer::NetPlayBanUser(const std::string& username) {
|
||||||
if (auto room = Network::GetRoomMember().lock()) {
|
if (auto room = Network::GetRoomMember().lock()) {
|
||||||
auto members = room->GetMemberInformation();
|
auto members = room->GetMemberInformation();
|
||||||
auto it = std::find_if(members.begin(), members.end(),
|
auto it = std::find_if(members.begin(), members.end(),
|
||||||
[&username](const Network::RoomMember::MemberInformation &member) {
|
[&username](const Network::RoomMember::MemberInformation& member) {
|
||||||
return member.nickname == username;
|
return member.nickname == username;
|
||||||
});
|
});
|
||||||
if (it != members.end()) {
|
if (it != members.end()) {
|
||||||
|
@ -312,7 +307,7 @@ void AndroidMultiplayer::NetPlayBanUser(const std::string &username) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidMultiplayer::NetPlayUnbanUser(const std::string &username) {
|
void AndroidMultiplayer::NetPlayUnbanUser(const std::string& username) {
|
||||||
if (auto room = Network::GetRoomMember().lock()) {
|
if (auto room = Network::GetRoomMember().lock()) {
|
||||||
room->SendModerationRequest(Network::RoomMessageTypes::IdModUnban, username);
|
room->SendModerationRequest(Network::RoomMessageTypes::IdModUnban, username);
|
||||||
}
|
}
|
||||||
|
@ -327,7 +322,7 @@ std::vector<std::string> AndroidMultiplayer::NetPlayRoomInfo() {
|
||||||
auto room_info = room->GetRoomInformation();
|
auto room_info = room->GetRoomInformation();
|
||||||
info_list.push_back(room_info.name + "|" + std::to_string(room_info.member_slots));
|
info_list.push_back(room_info.name + "|" + std::to_string(room_info.member_slots));
|
||||||
// all members
|
// all members
|
||||||
for (const auto &member: members) {
|
for (const auto& member : members) {
|
||||||
info_list.push_back(member.nickname);
|
info_list.push_back(member.nickname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -385,30 +380,24 @@ std::vector<std::string> AndroidMultiplayer::NetPlayGetPublicRooms() {
|
||||||
|
|
||||||
if (auto session = announce_multiplayer_session.lock()) {
|
if (auto session = announce_multiplayer_session.lock()) {
|
||||||
auto rooms = session->GetRoomList();
|
auto rooms = session->GetRoomList();
|
||||||
for (const auto &room: rooms) {
|
for (const auto& room : rooms) {
|
||||||
room_list.push_back(room.information.name + "|" +
|
room_list.push_back(room.information.name + "|" + (room.has_password ? "1" : "0") +
|
||||||
(room.has_password ? "1" : "0") + "|" +
|
"|" + std::to_string(room.information.member_slots) + "|" +
|
||||||
std::to_string(room.information.member_slots) + "|" +
|
room.ip + "|" + std::to_string(room.information.port) + "|" +
|
||||||
room.ip + "|" +
|
|
||||||
std::to_string(room.information.port) + "|" +
|
|
||||||
room.information.description + "|" +
|
room.information.description + "|" +
|
||||||
room.information.host_username + "|" +
|
room.information.host_username + "|" +
|
||||||
std::to_string(room.information.preferred_game.id) + "|" +
|
std::to_string(room.information.preferred_game.id) + "|" +
|
||||||
room.information.preferred_game.name + "|" +
|
room.information.preferred_game.name + "|" +
|
||||||
room.information.preferred_game.version);
|
room.information.preferred_game.version);
|
||||||
|
|
||||||
for (const auto &member: room.members) {
|
for (const auto& member : room.members) {
|
||||||
room_list.push_back("MEMBER|" + room.information.name + "|" +
|
room_list.push_back("MEMBER|" + room.information.name + "|" + member.username +
|
||||||
member.username + "|" +
|
"|" + member.nickname + "|" + std::to_string(member.game.id) +
|
||||||
member.nickname + "|" +
|
"|" + member.game.name);
|
||||||
std::to_string(member.game.id) + "|" +
|
|
||||||
member.game.name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return room_list;
|
return room_list;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> AndroidMultiplayer::NetPlayGetBanList() {
|
std::vector<std::string> AndroidMultiplayer::NetPlayGetBanList() {
|
||||||
|
@ -417,27 +406,28 @@ std::vector<std::string> AndroidMultiplayer::NetPlayGetBanList() {
|
||||||
auto [username_bans, ip_bans] = room->GetBanList();
|
auto [username_bans, ip_bans] = room->GetBanList();
|
||||||
|
|
||||||
// Add username bans
|
// Add username bans
|
||||||
for (const auto &username: username_bans) {
|
for (const auto& username : username_bans) {
|
||||||
ban_list.push_back(username);
|
ban_list.push_back(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add IP bans
|
// Add IP bans
|
||||||
for (const auto &ip: ip_bans) {
|
for (const auto& ip : ip_bans) {
|
||||||
ban_list.push_back(ip);
|
ban_list.push_back(ip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ban_list;
|
return ban_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Network::VerifyUser::Backend> AndroidMultiplayer::CreateVerifyBackend(bool use_validation) {
|
std::unique_ptr<Network::VerifyUser::Backend> AndroidMultiplayer::CreateVerifyBackend(
|
||||||
|
bool use_validation) {
|
||||||
std::unique_ptr<Network::VerifyUser::Backend> verify_backend;
|
std::unique_ptr<Network::VerifyUser::Backend> verify_backend;
|
||||||
if (use_validation) {
|
if (use_validation) {
|
||||||
//#ifdef ENABLE_WEB_SERVICE
|
// #ifdef ENABLE_WEB_SERVICE
|
||||||
verify_backend =
|
verify_backend =
|
||||||
std::make_unique<WebService::VerifyUserJWT>(Settings::values.web_api_url.GetValue());
|
std::make_unique<WebService::VerifyUserJWT>(Settings::values.web_api_url.GetValue());
|
||||||
//#else
|
// #else
|
||||||
// verify_backend = std::make_unique<Network::VerifyUser::NullBackend>();
|
// verify_backend = std::make_unique<Network::VerifyUser::NullBackend>();
|
||||||
//#endif
|
// #endif
|
||||||
} else {
|
} else {
|
||||||
verify_backend = std::make_unique<Network::VerifyUser::NullBackend>();
|
verify_backend = std::make_unique<Network::VerifyUser::NullBackend>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,13 +7,13 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <common/common_types.h>
|
#include <common/common_types.h>
|
||||||
#include <network/network.h>
|
|
||||||
#include <network/announce_multiplayer_session.h>
|
#include <network/announce_multiplayer_session.h>
|
||||||
|
#include <network/network.h>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class System;
|
class System;
|
||||||
class AnnounceMultiplayerSession;
|
class AnnounceMultiplayerSession;
|
||||||
}
|
} // namespace Core
|
||||||
|
|
||||||
enum class NetPlayStatus : s32 {
|
enum class NetPlayStatus : s32 {
|
||||||
NO_ERROR,
|
NO_ERROR,
|
||||||
|
@ -63,13 +63,14 @@ public:
|
||||||
|
|
||||||
void ClearChat();
|
void ClearChat();
|
||||||
|
|
||||||
NetPlayStatus NetPlayCreateRoom(const std::string &ipaddress, int port,
|
NetPlayStatus NetPlayCreateRoom(const std::string& ipaddress, int port,
|
||||||
const std::string &username, const std::string &preferredGameName,
|
const std::string& username,
|
||||||
const u64 &preferredGameId, const std::string &password,
|
const std::string& preferredGameName,
|
||||||
const std::string &room_name, int max_players, bool isPublic);
|
const u64& preferredGameId, const std::string& password,
|
||||||
|
const std::string& room_name, int max_players, bool isPublic);
|
||||||
|
|
||||||
NetPlayStatus NetPlayJoinRoom(const std::string &ipaddress, int port,
|
NetPlayStatus NetPlayJoinRoom(const std::string& ipaddress, int port,
|
||||||
const std::string &username, const std::string &password);
|
const std::string& username, const std::string& password);
|
||||||
|
|
||||||
std::vector<std::string> NetPlayRoomInfo();
|
std::vector<std::string> NetPlayRoomInfo();
|
||||||
|
|
||||||
|
@ -79,11 +80,11 @@ public:
|
||||||
|
|
||||||
bool NetPlayIsModerator();
|
bool NetPlayIsModerator();
|
||||||
|
|
||||||
void NetPlaySendMessage(const std::string &msg);
|
void NetPlaySendMessage(const std::string& msg);
|
||||||
|
|
||||||
void NetPlayKickUser(const std::string &username);
|
void NetPlayKickUser(const std::string& username);
|
||||||
|
|
||||||
void NetPlayBanUser(const std::string &username);
|
void NetPlayBanUser(const std::string& username);
|
||||||
|
|
||||||
void NetPlayLeaveRoom();
|
void NetPlayLeaveRoom();
|
||||||
|
|
||||||
|
@ -91,12 +92,12 @@ public:
|
||||||
|
|
||||||
std::vector<std::string> NetPlayGetBanList();
|
std::vector<std::string> NetPlayGetBanList();
|
||||||
|
|
||||||
void NetPlayUnbanUser(const std::string &username);
|
void NetPlayUnbanUser(const std::string& username);
|
||||||
|
|
||||||
std::vector<std::string> NetPlayGetPublicRooms();
|
std::vector<std::string> NetPlayGetPublicRooms();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Core::System& system;
|
Core::System& system;
|
||||||
static std::unique_ptr<Network::VerifyUser::Backend> CreateVerifyBackend(bool use_validation) ;
|
static std::unique_ptr<Network::VerifyUser::Backend> CreateVerifyBackend(bool use_validation);
|
||||||
std::weak_ptr<Core::AnnounceMultiplayerSession> announce_multiplayer_session;
|
std::weak_ptr<Core::AnnounceMultiplayerSession> announce_multiplayer_session;
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,9 +16,9 @@ concept IsContiguousContainer = std::contiguous_iterator<typename T::iterator>;
|
||||||
// is available on all supported platforms.
|
// is available on all supported platforms.
|
||||||
template <typename Derived, typename Base>
|
template <typename Derived, typename Base>
|
||||||
concept DerivedFrom = requires {
|
concept DerivedFrom = requires {
|
||||||
std::is_base_of_v<Base, Derived>;
|
std::is_base_of_v<Base, Derived>;
|
||||||
std::is_convertible_v<const volatile Derived*, const volatile Base*>;
|
std::is_convertible_v<const volatile Derived*, const volatile Base*>;
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: Replace with std::convertible_to when libc++ implements it.
|
// TODO: Replace with std::convertible_to when libc++ implements it.
|
||||||
template <typename From, typename To>
|
template <typename From, typename To>
|
||||||
|
|
|
@ -27,76 +27,73 @@ extern std::atomic<bool> g_has_battery;
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
PowerStatus GetPowerStatus()
|
PowerStatus GetPowerStatus() {
|
||||||
{
|
PowerStatus info;
|
||||||
PowerStatus info;
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
SYSTEM_POWER_STATUS status;
|
SYSTEM_POWER_STATUS status;
|
||||||
if (GetSystemPowerStatus(&status)) {
|
if (GetSystemPowerStatus(&status)) {
|
||||||
if (status.BatteryFlag == 128) {
|
if (status.BatteryFlag == 128) {
|
||||||
info.has_battery = false;
|
|
||||||
} else {
|
|
||||||
info.percentage = status.BatteryLifePercent;
|
|
||||||
info.charging = (status.BatteryFlag & 8) != 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
info.has_battery = false;
|
info.has_battery = false;
|
||||||
|
} else {
|
||||||
|
info.percentage = status.BatteryLifePercent;
|
||||||
|
info.charging = (status.BatteryFlag & 8) != 0;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
info.has_battery = false;
|
||||||
|
}
|
||||||
|
|
||||||
#elif defined(__ANDROID__)
|
#elif defined(__ANDROID__)
|
||||||
info.percentage = g_battery_percentage.load(std::memory_order_relaxed);
|
info.percentage = g_battery_percentage.load(std::memory_order_relaxed);
|
||||||
info.charging = g_is_charging.load(std::memory_order_relaxed);
|
info.charging = g_is_charging.load(std::memory_order_relaxed);
|
||||||
info.has_battery = g_has_battery.load(std::memory_order_relaxed);
|
info.has_battery = g_has_battery.load(std::memory_order_relaxed);
|
||||||
|
|
||||||
#elif defined(__APPLE__) && TARGET_OS_MAC
|
#elif defined(__APPLE__) && TARGET_OS_MAC
|
||||||
CFTypeRef info_ref = IOPSCopyPowerSourcesInfo();
|
CFTypeRef info_ref = IOPSCopyPowerSourcesInfo();
|
||||||
CFArrayRef sources = IOPSCopyPowerSourcesList(info_ref);
|
CFArrayRef sources = IOPSCopyPowerSourcesList(info_ref);
|
||||||
if (CFArrayGetCount(sources) > 0) {
|
if (CFArrayGetCount(sources) > 0) {
|
||||||
CFDictionaryRef battery =
|
CFDictionaryRef battery =
|
||||||
IOPSGetPowerSourceDescription(info_ref, CFArrayGetValueAtIndex(sources, 0));
|
IOPSGetPowerSourceDescription(info_ref, CFArrayGetValueAtIndex(sources, 0));
|
||||||
|
|
||||||
CFNumberRef curNum =
|
CFNumberRef curNum =
|
||||||
(CFNumberRef)CFDictionaryGetValue(battery, CFSTR(kIOPSCurrentCapacityKey));
|
(CFNumberRef)CFDictionaryGetValue(battery, CFSTR(kIOPSCurrentCapacityKey));
|
||||||
CFNumberRef maxNum =
|
CFNumberRef maxNum = (CFNumberRef)CFDictionaryGetValue(battery, CFSTR(kIOPSMaxCapacityKey));
|
||||||
(CFNumberRef)CFDictionaryGetValue(battery, CFSTR(kIOPSMaxCapacityKey));
|
int cur = 0, max = 0;
|
||||||
int cur = 0, max = 0;
|
CFNumberGetValue(curNum, kCFNumberIntType, &cur);
|
||||||
CFNumberGetValue(curNum, kCFNumberIntType, &cur);
|
CFNumberGetValue(maxNum, kCFNumberIntType, &max);
|
||||||
CFNumberGetValue(maxNum, kCFNumberIntType, &max);
|
|
||||||
|
|
||||||
if (max > 0)
|
if (max > 0)
|
||||||
info.percentage = (cur * 100) / max;
|
info.percentage = (cur * 100) / max;
|
||||||
|
|
||||||
CFBooleanRef isCharging =
|
CFBooleanRef isCharging =
|
||||||
(CFBooleanRef)CFDictionaryGetValue(battery, CFSTR(kIOPSIsChargingKey));
|
(CFBooleanRef)CFDictionaryGetValue(battery, CFSTR(kIOPSIsChargingKey));
|
||||||
info.charging = CFBooleanGetValue(isCharging);
|
info.charging = CFBooleanGetValue(isCharging);
|
||||||
} else {
|
} else {
|
||||||
info.has_battery = false;
|
info.has_battery = false;
|
||||||
}
|
}
|
||||||
CFRelease(sources);
|
CFRelease(sources);
|
||||||
CFRelease(info_ref);
|
CFRelease(info_ref);
|
||||||
|
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
const char* battery_path = "/sys/class/power_supply/BAT0/";
|
const char* battery_path = "/sys/class/power_supply/BAT0/";
|
||||||
|
|
||||||
std::ifstream capFile(std::string(battery_path) + "capacity");
|
std::ifstream capFile(std::string(battery_path) + "capacity");
|
||||||
if (capFile) {
|
if (capFile) {
|
||||||
capFile >> info.percentage;
|
capFile >> info.percentage;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
info.has_battery = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ifstream statFile(std::string(battery_path) + "status");
|
|
||||||
if (statFile) {
|
|
||||||
std::string status;
|
|
||||||
std::getline(statFile, status);
|
|
||||||
info.charging = (status == "Charging");
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
info.has_battery = false;
|
info.has_battery = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ifstream statFile(std::string(battery_path) + "status");
|
||||||
|
if (statFile) {
|
||||||
|
std::string status;
|
||||||
|
std::getline(statFile, status);
|
||||||
|
info.charging = (status == "Charging");
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
info.has_battery = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} // namespace Common
|
||||||
|
|
|
@ -598,14 +598,14 @@ public:
|
||||||
template <typename G = E, std::enable_if_t<std::is_constructible_v<E, G&&>>* = nullptr,
|
template <typename G = E, std::enable_if_t<std::is_constructible_v<E, G&&>>* = nullptr,
|
||||||
std::enable_if_t<!std::is_convertible_v<G&&, E>>* = nullptr>
|
std::enable_if_t<!std::is_convertible_v<G&&, E>>* = nullptr>
|
||||||
constexpr explicit Expected(Unexpected<G>&& e) noexcept(std::is_nothrow_constructible_v<E, G&&>)
|
constexpr explicit Expected(Unexpected<G>&& e) noexcept(std::is_nothrow_constructible_v<E, G&&>)
|
||||||
: impl_base{unexpect_t{}, std::move(e.value())}, ctor_base{
|
: impl_base{unexpect_t{}, std::move(e.value())},
|
||||||
detail::default_constructor_tag{}} {}
|
ctor_base{detail::default_constructor_tag{}} {}
|
||||||
|
|
||||||
template <typename G = E, std::enable_if_t<std::is_constructible_v<E, G&&>>* = nullptr,
|
template <typename G = E, std::enable_if_t<std::is_constructible_v<E, G&&>>* = nullptr,
|
||||||
std::enable_if_t<std::is_convertible_v<G&&, E>>* = nullptr>
|
std::enable_if_t<std::is_convertible_v<G&&, E>>* = nullptr>
|
||||||
constexpr Expected(Unexpected<G>&& e) noexcept(std::is_nothrow_constructible_v<E, G&&>)
|
constexpr Expected(Unexpected<G>&& e) noexcept(std::is_nothrow_constructible_v<E, G&&>)
|
||||||
: impl_base{unexpect_t{}, std::move(e.value())}, ctor_base{
|
: impl_base{unexpect_t{}, std::move(e.value())},
|
||||||
detail::default_constructor_tag{}} {}
|
ctor_base{detail::default_constructor_tag{}} {}
|
||||||
|
|
||||||
template <typename... Args, std::enable_if_t<std::is_constructible_v<E, Args&&...>>* = nullptr>
|
template <typename... Args, std::enable_if_t<std::is_constructible_v<E, Args&&...>>* = nullptr>
|
||||||
constexpr explicit Expected(unexpect_t, Args&&... args)
|
constexpr explicit Expected(unexpect_t, Args&&... args)
|
||||||
|
|
|
@ -88,9 +88,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateEdenPaths() {
|
void CreateEdenPaths() {
|
||||||
std::for_each(eden_paths.begin(), eden_paths.end(), [](auto &path) {
|
std::for_each(eden_paths.begin(), eden_paths.end(),
|
||||||
void(FS::CreateDir(path.second));
|
[](auto& path) { void(FS::CreateDir(path.second)); });
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetEdenPathImpl(EdenPath eden_path, const fs::path& new_path) {
|
void SetEdenPathImpl(EdenPath eden_path, const fs::path& new_path) {
|
||||||
|
@ -116,9 +115,13 @@ public:
|
||||||
eden_path_cache = eden_path / CACHE_DIR;
|
eden_path_cache = eden_path / CACHE_DIR;
|
||||||
eden_path_config = eden_path / CONFIG_DIR;
|
eden_path_config = eden_path / CONFIG_DIR;
|
||||||
|
|
||||||
#define LEGACY_PATH(titleName, upperName) GenerateLegacyPath(LegacyPath::titleName##Dir, GetAppDataRoamingDirectory() / upperName##_DIR); \
|
#define LEGACY_PATH(titleName, upperName) \
|
||||||
GenerateLegacyPath(LegacyPath::titleName##ConfigDir, GetAppDataRoamingDirectory() / upperName##_DIR / CONFIG_DIR); \
|
GenerateLegacyPath(LegacyPath::titleName##Dir, \
|
||||||
GenerateLegacyPath(LegacyPath::titleName##CacheDir, GetAppDataRoamingDirectory() / upperName##_DIR / CACHE_DIR);
|
GetAppDataRoamingDirectory() / upperName##_DIR); \
|
||||||
|
GenerateLegacyPath(LegacyPath::titleName##ConfigDir, \
|
||||||
|
GetAppDataRoamingDirectory() / upperName##_DIR / CONFIG_DIR); \
|
||||||
|
GenerateLegacyPath(LegacyPath::titleName##CacheDir, \
|
||||||
|
GetAppDataRoamingDirectory() / upperName##_DIR / CACHE_DIR);
|
||||||
|
|
||||||
LEGACY_PATH(Citron, CITRON)
|
LEGACY_PATH(Citron, CITRON)
|
||||||
LEGACY_PATH(Sudachi, SUDACHI)
|
LEGACY_PATH(Sudachi, SUDACHI)
|
||||||
|
@ -143,9 +146,13 @@ public:
|
||||||
eden_path_config = GetDataDirectory("XDG_CONFIG_HOME") / EDEN_DIR;
|
eden_path_config = GetDataDirectory("XDG_CONFIG_HOME") / EDEN_DIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define LEGACY_PATH(titleName, upperName) GenerateLegacyPath(LegacyPath::titleName##Dir, GetDataDirectory("XDG_DATA_HOME") / upperName##_DIR); \
|
#define LEGACY_PATH(titleName, upperName) \
|
||||||
GenerateLegacyPath(LegacyPath::titleName##ConfigDir, GetDataDirectory("XDG_CONFIG_HOME") / upperName##_DIR); \
|
GenerateLegacyPath(LegacyPath::titleName##Dir, \
|
||||||
GenerateLegacyPath(LegacyPath::titleName##CacheDir, GetDataDirectory("XDG_CACHE_HOME") / upperName##_DIR);
|
GetDataDirectory("XDG_DATA_HOME") / upperName##_DIR); \
|
||||||
|
GenerateLegacyPath(LegacyPath::titleName##ConfigDir, \
|
||||||
|
GetDataDirectory("XDG_CONFIG_HOME") / upperName##_DIR); \
|
||||||
|
GenerateLegacyPath(LegacyPath::titleName##CacheDir, \
|
||||||
|
GetDataDirectory("XDG_CACHE_HOME") / upperName##_DIR);
|
||||||
|
|
||||||
LEGACY_PATH(Citron, CITRON)
|
LEGACY_PATH(Citron, CITRON)
|
||||||
LEGACY_PATH(Sudachi, SUDACHI)
|
LEGACY_PATH(Sudachi, SUDACHI)
|
||||||
|
@ -301,8 +308,7 @@ void SetEdenPath(EdenPath eden_path, const fs::path& new_path) {
|
||||||
PathManagerImpl::GetInstance().SetEdenPathImpl(eden_path, new_path);
|
PathManagerImpl::GetInstance().SetEdenPathImpl(eden_path, new_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateEdenPaths()
|
void CreateEdenPaths() {
|
||||||
{
|
|
||||||
PathManagerImpl::GetInstance().CreateEdenPaths();
|
PathManagerImpl::GetInstance().CreateEdenPaths();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -538,7 +538,7 @@ public:
|
||||||
template <auto T, class Derived = Common::impl::GetParentType<T>>
|
template <auto T, class Derived = Common::impl::GetParentType<T>>
|
||||||
class IntrusiveListMemberTraits;
|
class IntrusiveListMemberTraits;
|
||||||
|
|
||||||
template <class Parent, IntrusiveListNode Parent::*Member, class Derived>
|
template <class Parent, IntrusiveListNode Parent::* Member, class Derived>
|
||||||
class IntrusiveListMemberTraits<Member, Derived> {
|
class IntrusiveListMemberTraits<Member, Derived> {
|
||||||
public:
|
public:
|
||||||
using ListType = IntrusiveList<Derived, IntrusiveListMemberTraits>;
|
using ListType = IntrusiveList<Derived, IntrusiveListMemberTraits>;
|
||||||
|
@ -566,7 +566,7 @@ private:
|
||||||
template <auto T, class Derived = Common::impl::GetParentType<T>>
|
template <auto T, class Derived = Common::impl::GetParentType<T>>
|
||||||
class IntrusiveListMemberTraitsByNonConstexprOffsetOf;
|
class IntrusiveListMemberTraitsByNonConstexprOffsetOf;
|
||||||
|
|
||||||
template <class Parent, IntrusiveListNode Parent::*Member, class Derived>
|
template <class Parent, IntrusiveListNode Parent::* Member, class Derived>
|
||||||
class IntrusiveListMemberTraitsByNonConstexprOffsetOf<Member, Derived> {
|
class IntrusiveListMemberTraitsByNonConstexprOffsetOf<Member, Derived> {
|
||||||
public:
|
public:
|
||||||
using ListType = IntrusiveList<Derived, IntrusiveListMemberTraitsByNonConstexprOffsetOf>;
|
using ListType = IntrusiveList<Derived, IntrusiveListMemberTraitsByNonConstexprOffsetOf>;
|
||||||
|
|
|
@ -238,10 +238,8 @@ public:
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
concept HasRedBlackKeyType = requires {
|
concept HasRedBlackKeyType = requires {
|
||||||
{
|
{ std::is_same<typename T::RedBlackKeyType, void>::value } -> std::convertible_to<bool>;
|
||||||
std::is_same<typename T::RedBlackKeyType, void>::value
|
};
|
||||||
} -> std::convertible_to<bool>;
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace impl {
|
namespace impl {
|
||||||
|
|
||||||
|
@ -497,7 +495,7 @@ public:
|
||||||
template <auto T, class Derived = Common::impl::GetParentType<T>>
|
template <auto T, class Derived = Common::impl::GetParentType<T>>
|
||||||
class IntrusiveRedBlackTreeMemberTraits;
|
class IntrusiveRedBlackTreeMemberTraits;
|
||||||
|
|
||||||
template <class Parent, IntrusiveRedBlackTreeNode Parent::*Member, class Derived>
|
template <class Parent, IntrusiveRedBlackTreeNode Parent::* Member, class Derived>
|
||||||
class IntrusiveRedBlackTreeMemberTraits<Member, Derived> {
|
class IntrusiveRedBlackTreeMemberTraits<Member, Derived> {
|
||||||
public:
|
public:
|
||||||
template <class Comparator>
|
template <class Comparator>
|
||||||
|
@ -530,7 +528,7 @@ private:
|
||||||
template <auto T, class Derived = Common::impl::GetParentType<T>>
|
template <auto T, class Derived = Common::impl::GetParentType<T>>
|
||||||
class IntrusiveRedBlackTreeMemberTraitsDeferredAssert;
|
class IntrusiveRedBlackTreeMemberTraitsDeferredAssert;
|
||||||
|
|
||||||
template <class Parent, IntrusiveRedBlackTreeNode Parent::*Member, class Derived>
|
template <class Parent, IntrusiveRedBlackTreeNode Parent::* Member, class Derived>
|
||||||
class IntrusiveRedBlackTreeMemberTraitsDeferredAssert<Member, Derived> {
|
class IntrusiveRedBlackTreeMemberTraitsDeferredAssert<Member, Derived> {
|
||||||
public:
|
public:
|
||||||
template <class Comparator>
|
template <class Comparator>
|
||||||
|
|
|
@ -90,8 +90,8 @@ public:
|
||||||
auto old_filename = filename;
|
auto old_filename = filename;
|
||||||
old_filename += ".old.txt";
|
old_filename += ".old.txt";
|
||||||
|
|
||||||
// Existence checks are done within the functions themselves.
|
// Existence checks are done within the functions themselves.
|
||||||
// We don't particularly care if these succeed or not.
|
// We don't particularly care if these succeed or not.
|
||||||
static_cast<void>(FS::RemoveFile(old_filename));
|
static_cast<void>(FS::RemoveFile(old_filename));
|
||||||
static_cast<void>(FS::RenameFile(filename, old_filename));
|
static_cast<void>(FS::RenameFile(filename, old_filename));
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,12 @@ public:
|
||||||
|
|
||||||
MultiLevelPageTable(MultiLevelPageTable&& other) noexcept
|
MultiLevelPageTable(MultiLevelPageTable&& other) noexcept
|
||||||
: address_space_bits{std::exchange(other.address_space_bits, 0)},
|
: address_space_bits{std::exchange(other.address_space_bits, 0)},
|
||||||
first_level_bits{std::exchange(other.first_level_bits, 0)}, page_bits{std::exchange(
|
first_level_bits{std::exchange(other.first_level_bits, 0)},
|
||||||
other.page_bits, 0)},
|
page_bits{std::exchange(other.page_bits, 0)},
|
||||||
first_level_shift{std::exchange(other.first_level_shift, 0)},
|
first_level_shift{std::exchange(other.first_level_shift, 0)},
|
||||||
first_level_chunk_size{std::exchange(other.first_level_chunk_size, 0)},
|
first_level_chunk_size{std::exchange(other.first_level_chunk_size, 0)},
|
||||||
first_level_map{std::move(other.first_level_map)}, base_ptr{std::exchange(other.base_ptr,
|
first_level_map{std::move(other.first_level_map)},
|
||||||
nullptr)} {}
|
base_ptr{std::exchange(other.base_ptr, nullptr)} {}
|
||||||
|
|
||||||
MultiLevelPageTable& operator=(MultiLevelPageTable&& other) noexcept {
|
MultiLevelPageTable& operator=(MultiLevelPageTable&& other) noexcept {
|
||||||
address_space_bits = std::exchange(other.address_space_bits, 0);
|
address_space_bits = std::exchange(other.address_space_bits, 0);
|
||||||
|
|
|
@ -92,7 +92,7 @@ struct OffsetOfCalculator {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename CurUnion>
|
template <typename CurUnion>
|
||||||
static constexpr std::ptrdiff_t OffsetOfImpl(MemberType ParentType::*member,
|
static constexpr std::ptrdiff_t OffsetOfImpl(MemberType ParentType::* member,
|
||||||
CurUnion& cur_union) {
|
CurUnion& cur_union) {
|
||||||
constexpr size_t Offset = CurUnion::GetOffset();
|
constexpr size_t Offset = CurUnion::GetOffset();
|
||||||
const auto target = std::addressof(GetPointer(U.parent)->*member);
|
const auto target = std::addressof(GetPointer(U.parent)->*member);
|
||||||
|
@ -111,7 +111,7 @@ struct OffsetOfCalculator {
|
||||||
Offset);
|
Offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr std::ptrdiff_t OffsetOf(MemberType ParentType::*member) {
|
static constexpr std::ptrdiff_t OffsetOf(MemberType ParentType::* member) {
|
||||||
return OffsetOfImpl(member, U.first_union);
|
return OffsetOfImpl(member, U.first_union);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,12 +34,12 @@ struct Point {
|
||||||
.y = static_cast<T>(value op rhs.y), \
|
.y = static_cast<T>(value op rhs.y), \
|
||||||
}; \
|
}; \
|
||||||
} \
|
} \
|
||||||
friend constexpr Point& operator compound_op(Point& lhs, const Point& rhs) noexcept { \
|
friend constexpr Point& operator compound_op(Point & lhs, const Point & rhs) noexcept { \
|
||||||
lhs.x = static_cast<T>(lhs.x op rhs.x); \
|
lhs.x = static_cast<T>(lhs.x op rhs.x); \
|
||||||
lhs.y = static_cast<T>(lhs.y op rhs.y); \
|
lhs.y = static_cast<T>(lhs.y op rhs.y); \
|
||||||
return lhs; \
|
return lhs; \
|
||||||
} \
|
} \
|
||||||
friend constexpr Point& operator compound_op(Point& lhs, T value) noexcept { \
|
friend constexpr Point& operator compound_op(Point & lhs, T value) noexcept { \
|
||||||
lhs.x = static_cast<T>(lhs.x op value); \
|
lhs.x = static_cast<T>(lhs.x op value); \
|
||||||
lhs.y = static_cast<T>(lhs.y op value); \
|
lhs.y = static_cast<T>(lhs.y op value); \
|
||||||
return lhs; \
|
return lhs; \
|
||||||
|
|
|
@ -18,9 +18,9 @@ namespace ranges {
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
concept range = requires(T& t) {
|
concept range = requires(T& t) {
|
||||||
begin(t);
|
begin(t);
|
||||||
end(t);
|
end(t);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
concept input_range = range<T>;
|
concept input_range = range<T>;
|
||||||
|
|
|
@ -339,7 +339,9 @@ void CondvarWait(Condvar& cv, std::unique_lock<Lock>& lk, std::stop_token token,
|
||||||
}
|
}
|
||||||
|
|
||||||
std::stop_callback callback(token, [&] {
|
std::stop_callback callback(token, [&] {
|
||||||
{ std::scoped_lock lk2{*lk.mutex()}; }
|
{
|
||||||
|
std::scoped_lock lk2{*lk.mutex()};
|
||||||
|
}
|
||||||
cv.notify_all();
|
cv.notify_all();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ struct Values {
|
||||||
Setting<AppletMode> net_connect_applet_mode{linkage, AppletMode::LLE, "net_connect_applet_mode",
|
Setting<AppletMode> net_connect_applet_mode{linkage, AppletMode::LLE, "net_connect_applet_mode",
|
||||||
Category::LibraryApplet};
|
Category::LibraryApplet};
|
||||||
Setting<AppletMode> player_select_applet_mode{
|
Setting<AppletMode> player_select_applet_mode{
|
||||||
linkage, AppletMode::LLE, "player_select_applet_mode", Category::LibraryApplet};
|
linkage, AppletMode::LLE, "player_select_applet_mode", Category::LibraryApplet};
|
||||||
Setting<AppletMode> swkbd_applet_mode{linkage, AppletMode::HLE, "swkbd_applet_mode",
|
Setting<AppletMode> swkbd_applet_mode{linkage, AppletMode::HLE, "swkbd_applet_mode",
|
||||||
Category::LibraryApplet};
|
Category::LibraryApplet};
|
||||||
Setting<AppletMode> mii_edit_applet_mode{linkage, AppletMode::LLE, "mii_edit_applet_mode",
|
Setting<AppletMode> mii_edit_applet_mode{linkage, AppletMode::LLE, "mii_edit_applet_mode",
|
||||||
|
@ -160,13 +160,13 @@ struct Values {
|
||||||
Setting<AppletMode> shop_applet_mode{linkage, AppletMode::HLE, "shop_applet_mode",
|
Setting<AppletMode> shop_applet_mode{linkage, AppletMode::HLE, "shop_applet_mode",
|
||||||
Category::LibraryApplet};
|
Category::LibraryApplet};
|
||||||
Setting<AppletMode> photo_viewer_applet_mode{
|
Setting<AppletMode> photo_viewer_applet_mode{
|
||||||
linkage, AppletMode::LLE, "photo_viewer_applet_mode", Category::LibraryApplet};
|
linkage, AppletMode::LLE, "photo_viewer_applet_mode", Category::LibraryApplet};
|
||||||
Setting<AppletMode> offline_web_applet_mode{linkage, AppletMode::LLE, "offline_web_applet_mode",
|
Setting<AppletMode> offline_web_applet_mode{linkage, AppletMode::LLE, "offline_web_applet_mode",
|
||||||
Category::LibraryApplet};
|
Category::LibraryApplet};
|
||||||
Setting<AppletMode> login_share_applet_mode{linkage, AppletMode::HLE, "login_share_applet_mode",
|
Setting<AppletMode> login_share_applet_mode{linkage, AppletMode::HLE, "login_share_applet_mode",
|
||||||
Category::LibraryApplet};
|
Category::LibraryApplet};
|
||||||
Setting<AppletMode> wifi_web_auth_applet_mode{
|
Setting<AppletMode> wifi_web_auth_applet_mode{
|
||||||
linkage, AppletMode::HLE, "wifi_web_auth_applet_mode", Category::LibraryApplet};
|
linkage, AppletMode::HLE, "wifi_web_auth_applet_mode", Category::LibraryApplet};
|
||||||
Setting<AppletMode> my_page_applet_mode{linkage, AppletMode::LLE, "my_page_applet_mode",
|
Setting<AppletMode> my_page_applet_mode{linkage, AppletMode::LLE, "my_page_applet_mode",
|
||||||
Category::LibraryApplet};
|
Category::LibraryApplet};
|
||||||
|
|
||||||
|
@ -174,13 +174,13 @@ struct Values {
|
||||||
SwitchableSetting<AudioEngine> sink_id{linkage, AudioEngine::Auto, "output_engine",
|
SwitchableSetting<AudioEngine> sink_id{linkage, AudioEngine::Auto, "output_engine",
|
||||||
Category::Audio, Specialization::RuntimeList};
|
Category::Audio, Specialization::RuntimeList};
|
||||||
SwitchableSetting<std::string> audio_output_device_id{
|
SwitchableSetting<std::string> audio_output_device_id{
|
||||||
linkage, "auto", "output_device", Category::Audio, Specialization::RuntimeList};
|
linkage, "auto", "output_device", Category::Audio, Specialization::RuntimeList};
|
||||||
SwitchableSetting<std::string> audio_input_device_id{
|
SwitchableSetting<std::string> audio_input_device_id{
|
||||||
linkage, "auto", "input_device", Category::Audio, Specialization::RuntimeList};
|
linkage, "auto", "input_device", Category::Audio, Specialization::RuntimeList};
|
||||||
SwitchableSetting<AudioMode, true> sound_index{
|
SwitchableSetting<AudioMode, true> sound_index{
|
||||||
linkage, AudioMode::Stereo, AudioMode::Mono, AudioMode::Surround,
|
linkage, AudioMode::Stereo, AudioMode::Mono, AudioMode::Surround,
|
||||||
"sound_index", Category::SystemAudio, Specialization::Default, true,
|
"sound_index", Category::SystemAudio, Specialization::Default, true,
|
||||||
true};
|
true};
|
||||||
SwitchableSetting<u8, true> volume{linkage,
|
SwitchableSetting<u8, true> volume{linkage,
|
||||||
100,
|
100,
|
||||||
0,
|
0,
|
||||||
|
@ -191,9 +191,9 @@ struct Values {
|
||||||
true,
|
true,
|
||||||
true};
|
true};
|
||||||
Setting<bool, false> audio_muted{
|
Setting<bool, false> audio_muted{
|
||||||
linkage, false, "audio_muted", Category::Audio, Specialization::Default, true, true};
|
linkage, false, "audio_muted", Category::Audio, Specialization::Default, true, true};
|
||||||
Setting<bool, false> dump_audio_commands{
|
Setting<bool, false> dump_audio_commands{
|
||||||
linkage, false, "dump_audio_commands", Category::Audio, Specialization::Default, false};
|
linkage, false, "dump_audio_commands", Category::Audio, Specialization::Default, false};
|
||||||
|
|
||||||
// Core
|
// Core
|
||||||
SwitchableSetting<bool> use_multi_core{linkage, true, "use_multi_core", Category::Core};
|
SwitchableSetting<bool> use_multi_core{linkage, true, "use_multi_core", Category::Core};
|
||||||
|
@ -206,7 +206,7 @@ struct Values {
|
||||||
Specialization::Default,
|
Specialization::Default,
|
||||||
true};
|
true};
|
||||||
SwitchableSetting<bool> use_speed_limit{
|
SwitchableSetting<bool> use_speed_limit{
|
||||||
linkage, true, "use_speed_limit", Category::Core, Specialization::Paired, true, true};
|
linkage, true, "use_speed_limit", Category::Core, Specialization::Paired, true, true};
|
||||||
SwitchableSetting<u16, true> speed_limit{linkage,
|
SwitchableSetting<u16, true> speed_limit{linkage,
|
||||||
100,
|
100,
|
||||||
0,
|
0,
|
||||||
|
@ -217,7 +217,8 @@ struct Values {
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
&use_speed_limit};
|
&use_speed_limit};
|
||||||
SwitchableSetting<bool> sync_core_speed{linkage, false, "sync_core_speed", Category::Core, Specialization::Default};
|
SwitchableSetting<bool> sync_core_speed{linkage, false, "sync_core_speed", Category::Core,
|
||||||
|
Specialization::Default};
|
||||||
|
|
||||||
// Memory
|
// Memory
|
||||||
#ifdef HAS_NCE
|
#ifdef HAS_NCE
|
||||||
|
@ -243,29 +244,14 @@ struct Values {
|
||||||
CpuAccuracy::Auto, CpuAccuracy::Paranoid,
|
CpuAccuracy::Auto, CpuAccuracy::Paranoid,
|
||||||
"cpu_accuracy", Category::Cpu};
|
"cpu_accuracy", Category::Cpu};
|
||||||
|
|
||||||
SwitchableSetting<bool> use_fast_cpu_time{linkage,
|
SwitchableSetting<bool> use_fast_cpu_time{
|
||||||
false,
|
linkage, false, "use_fast_cpu_time", Category::Cpu, Specialization::Paired, true, true};
|
||||||
"use_fast_cpu_time",
|
SwitchableSetting<CpuClock> fast_cpu_time{
|
||||||
Category::Cpu,
|
linkage, CpuClock::Boost, "fast_cpu_time", Category::Cpu, Specialization::Default, true,
|
||||||
Specialization::Paired,
|
true, &use_fast_cpu_time};
|
||||||
true,
|
|
||||||
true};
|
|
||||||
SwitchableSetting<CpuClock> fast_cpu_time{linkage,
|
|
||||||
CpuClock::Boost,
|
|
||||||
"fast_cpu_time",
|
|
||||||
Category::Cpu,
|
|
||||||
Specialization::Default,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
&use_fast_cpu_time};
|
|
||||||
|
|
||||||
SwitchableSetting<bool> use_custom_cpu_ticks{linkage,
|
SwitchableSetting<bool> use_custom_cpu_ticks{
|
||||||
false,
|
linkage, false, "use_custom_cpu_ticks", Category::Cpu, Specialization::Paired, true, true};
|
||||||
"use_custom_cpu_ticks",
|
|
||||||
Category::Cpu,
|
|
||||||
Specialization::Paired,
|
|
||||||
true,
|
|
||||||
true};
|
|
||||||
|
|
||||||
SwitchableSetting<u32, true> cpu_ticks{linkage,
|
SwitchableSetting<u32, true> cpu_ticks{linkage,
|
||||||
16000,
|
16000,
|
||||||
|
@ -302,29 +288,29 @@ struct Values {
|
||||||
SwitchableSetting<bool> cpuopt_unsafe_unfuse_fma{linkage, true, "cpuopt_unsafe_unfuse_fma",
|
SwitchableSetting<bool> cpuopt_unsafe_unfuse_fma{linkage, true, "cpuopt_unsafe_unfuse_fma",
|
||||||
Category::CpuUnsafe};
|
Category::CpuUnsafe};
|
||||||
SwitchableSetting<bool> cpuopt_unsafe_reduce_fp_error{
|
SwitchableSetting<bool> cpuopt_unsafe_reduce_fp_error{
|
||||||
linkage, true, "cpuopt_unsafe_reduce_fp_error", Category::CpuUnsafe};
|
linkage, true, "cpuopt_unsafe_reduce_fp_error", Category::CpuUnsafe};
|
||||||
SwitchableSetting<bool> cpuopt_unsafe_ignore_standard_fpcr{
|
SwitchableSetting<bool> cpuopt_unsafe_ignore_standard_fpcr{
|
||||||
linkage, true, "cpuopt_unsafe_ignore_standard_fpcr", Category::CpuUnsafe};
|
linkage, true, "cpuopt_unsafe_ignore_standard_fpcr", Category::CpuUnsafe};
|
||||||
SwitchableSetting<bool> cpuopt_unsafe_inaccurate_nan{
|
SwitchableSetting<bool> cpuopt_unsafe_inaccurate_nan{
|
||||||
linkage, true, "cpuopt_unsafe_inaccurate_nan", Category::CpuUnsafe};
|
linkage, true, "cpuopt_unsafe_inaccurate_nan", Category::CpuUnsafe};
|
||||||
SwitchableSetting<bool> cpuopt_unsafe_fastmem_check{
|
SwitchableSetting<bool> cpuopt_unsafe_fastmem_check{
|
||||||
linkage, true, "cpuopt_unsafe_fastmem_check", Category::CpuUnsafe};
|
linkage, true, "cpuopt_unsafe_fastmem_check", Category::CpuUnsafe};
|
||||||
SwitchableSetting<bool> cpuopt_unsafe_ignore_global_monitor{
|
SwitchableSetting<bool> cpuopt_unsafe_ignore_global_monitor{
|
||||||
linkage, true, "cpuopt_unsafe_ignore_global_monitor", Category::CpuUnsafe};
|
linkage, true, "cpuopt_unsafe_ignore_global_monitor", Category::CpuUnsafe};
|
||||||
|
|
||||||
// Renderer
|
// Renderer
|
||||||
SwitchableSetting<RendererBackend, true> renderer_backend{
|
SwitchableSetting<RendererBackend, true> renderer_backend{
|
||||||
linkage, RendererBackend::Vulkan, RendererBackend::OpenGL, RendererBackend::Null,
|
linkage, RendererBackend::Vulkan, RendererBackend::OpenGL, RendererBackend::Null,
|
||||||
"backend", Category::Renderer};
|
"backend", Category::Renderer};
|
||||||
SwitchableSetting<ShaderBackend, true> shader_backend{
|
SwitchableSetting<ShaderBackend, true> shader_backend{
|
||||||
linkage, ShaderBackend::SpirV, ShaderBackend::Glsl, ShaderBackend::SpirV,
|
linkage, ShaderBackend::SpirV, ShaderBackend::Glsl, ShaderBackend::SpirV,
|
||||||
"shader_backend", Category::Renderer, Specialization::RuntimeList};
|
"shader_backend", Category::Renderer, Specialization::RuntimeList};
|
||||||
SwitchableSetting<int> vulkan_device{linkage, 0, "vulkan_device", Category::Renderer,
|
SwitchableSetting<int> vulkan_device{linkage, 0, "vulkan_device", Category::Renderer,
|
||||||
Specialization::RuntimeList};
|
Specialization::RuntimeList};
|
||||||
SwitchableSetting<bool> enable_raii{linkage, false, "enable_raii", Category::Renderer};
|
SwitchableSetting<bool> enable_raii{linkage, false, "enable_raii", Category::Renderer};
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
SwitchableSetting<bool> frame_interpolation{linkage, true, "frame_interpolation", Category::Renderer,
|
SwitchableSetting<bool> frame_interpolation{linkage, true, "frame_interpolation",
|
||||||
Specialization::RuntimeList};
|
Category::Renderer, Specialization::RuntimeList};
|
||||||
SwitchableSetting<bool> frame_skipping{linkage, false, "frame_skipping", Category::Renderer,
|
SwitchableSetting<bool> frame_skipping{linkage, false, "frame_skipping", Category::Renderer,
|
||||||
Specialization::RuntimeList};
|
Specialization::RuntimeList};
|
||||||
#endif
|
#endif
|
||||||
|
@ -337,7 +323,7 @@ struct Values {
|
||||||
"optimize_spirv_output",
|
"optimize_spirv_output",
|
||||||
Category::Renderer};
|
Category::Renderer};
|
||||||
SwitchableSetting<bool> use_asynchronous_gpu_emulation{
|
SwitchableSetting<bool> use_asynchronous_gpu_emulation{
|
||||||
linkage, true, "use_asynchronous_gpu_emulation", Category::Renderer};
|
linkage, true, "use_asynchronous_gpu_emulation", Category::Renderer};
|
||||||
SwitchableSetting<AstcDecodeMode, true> accelerate_astc{linkage,
|
SwitchableSetting<AstcDecodeMode, true> accelerate_astc{linkage,
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
AstcDecodeMode::Cpu,
|
AstcDecodeMode::Cpu,
|
||||||
|
@ -349,9 +335,9 @@ struct Values {
|
||||||
"accelerate_astc",
|
"accelerate_astc",
|
||||||
Category::Renderer};
|
Category::Renderer};
|
||||||
SwitchableSetting<VSyncMode, true> vsync_mode{
|
SwitchableSetting<VSyncMode, true> vsync_mode{
|
||||||
linkage, VSyncMode::Fifo, VSyncMode::Immediate, VSyncMode::FifoRelaxed,
|
linkage, VSyncMode::Fifo, VSyncMode::Immediate, VSyncMode::FifoRelaxed,
|
||||||
"use_vsync", Category::Renderer, Specialization::RuntimeList, true,
|
"use_vsync", Category::Renderer, Specialization::RuntimeList, true,
|
||||||
true};
|
true};
|
||||||
SwitchableSetting<NvdecEmulation> nvdec_emulation{linkage, NvdecEmulation::Gpu,
|
SwitchableSetting<NvdecEmulation> nvdec_emulation{linkage, NvdecEmulation::Gpu,
|
||||||
"nvdec_emulation", Category::Renderer};
|
"nvdec_emulation", Category::Renderer};
|
||||||
// *nix platforms may have issues with the borderless windowed fullscreen mode.
|
// *nix platforms may have issues with the borderless windowed fullscreen mode.
|
||||||
|
@ -408,11 +394,11 @@ struct Values {
|
||||||
true};
|
true};
|
||||||
|
|
||||||
SwitchableSetting<u8, false> bg_red{
|
SwitchableSetting<u8, false> bg_red{
|
||||||
linkage, 0, "bg_red", Category::Renderer, Specialization::Default, true, true};
|
linkage, 0, "bg_red", Category::Renderer, Specialization::Default, true, true};
|
||||||
SwitchableSetting<u8, false> bg_green{
|
SwitchableSetting<u8, false> bg_green{
|
||||||
linkage, 0, "bg_green", Category::Renderer, Specialization::Default, true, true};
|
linkage, 0, "bg_green", Category::Renderer, Specialization::Default, true, true};
|
||||||
SwitchableSetting<u8, false> bg_blue{
|
SwitchableSetting<u8, false> bg_blue{
|
||||||
linkage, 0, "bg_blue", Category::Renderer, Specialization::Default, true, true};
|
linkage, 0, "bg_blue", Category::Renderer, Specialization::Default, true, true};
|
||||||
|
|
||||||
SwitchableSetting<GpuAccuracy, true> gpu_accuracy{linkage,
|
SwitchableSetting<GpuAccuracy, true> gpu_accuracy{linkage,
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
|
@ -476,13 +462,9 @@ struct Values {
|
||||||
Category::RendererAdvanced};
|
Category::RendererAdvanced};
|
||||||
SwitchableSetting<bool> use_asynchronous_shaders{linkage, false, "use_asynchronous_shaders",
|
SwitchableSetting<bool> use_asynchronous_shaders{linkage, false, "use_asynchronous_shaders",
|
||||||
Category::RendererAdvanced};
|
Category::RendererAdvanced};
|
||||||
SwitchableSetting<bool> use_fast_gpu_time{linkage,
|
SwitchableSetting<bool> use_fast_gpu_time{
|
||||||
true,
|
linkage, true, "use_fast_gpu_time", Category::RendererAdvanced, Specialization::Paired,
|
||||||
"use_fast_gpu_time",
|
true, true};
|
||||||
Category::RendererAdvanced,
|
|
||||||
Specialization::Paired,
|
|
||||||
true,
|
|
||||||
true};
|
|
||||||
|
|
||||||
SwitchableSetting<GpuOverclock> fast_gpu_time{linkage,
|
SwitchableSetting<GpuOverclock> fast_gpu_time{linkage,
|
||||||
GpuOverclock::Low,
|
GpuOverclock::Low,
|
||||||
|
@ -507,17 +489,15 @@ struct Values {
|
||||||
SwitchableSetting<bool> barrier_feedback_loops{linkage, true, "barrier_feedback_loops",
|
SwitchableSetting<bool> barrier_feedback_loops{linkage, true, "barrier_feedback_loops",
|
||||||
Category::RendererAdvanced};
|
Category::RendererAdvanced};
|
||||||
|
|
||||||
SwitchableSetting<u8, true> dyna_state{linkage,
|
SwitchableSetting<u8, true> dyna_state{
|
||||||
0,
|
linkage, 0, 0, 3, "dyna_state", Category::RendererExtensions, Specialization::Scalar};
|
||||||
0,
|
|
||||||
3,
|
|
||||||
"dyna_state",
|
|
||||||
Category::RendererExtensions,
|
|
||||||
Specialization::Scalar};
|
|
||||||
|
|
||||||
SwitchableSetting<bool> provoking_vertex{linkage, false, "provoking_vertex", Category::RendererExtensions};
|
SwitchableSetting<bool> provoking_vertex{linkage, false, "provoking_vertex",
|
||||||
SwitchableSetting<bool> descriptor_indexing{linkage, false, "descriptor_indexing", Category::RendererExtensions};
|
Category::RendererExtensions};
|
||||||
SwitchableSetting<bool> sample_shading{linkage, false, "sample_shading", Category::RendererExtensions};
|
SwitchableSetting<bool> descriptor_indexing{linkage, false, "descriptor_indexing",
|
||||||
|
Category::RendererExtensions};
|
||||||
|
SwitchableSetting<bool> sample_shading{linkage, false, "sample_shading",
|
||||||
|
Category::RendererExtensions};
|
||||||
|
|
||||||
Setting<bool> renderer_debug{linkage, false, "debug", Category::RendererDebug};
|
Setting<bool> renderer_debug{linkage, false, "debug", Category::RendererDebug};
|
||||||
Setting<bool> renderer_shader_feedback{linkage, false, "shader_feedback",
|
Setting<bool> renderer_shader_feedback{linkage, false, "shader_feedback",
|
||||||
|
@ -525,19 +505,16 @@ struct Values {
|
||||||
Setting<bool> enable_nsight_aftermath{linkage, false, "nsight_aftermath",
|
Setting<bool> enable_nsight_aftermath{linkage, false, "nsight_aftermath",
|
||||||
Category::RendererDebug};
|
Category::RendererDebug};
|
||||||
Setting<bool> disable_shader_loop_safety_checks{
|
Setting<bool> disable_shader_loop_safety_checks{
|
||||||
linkage, false, "disable_shader_loop_safety_checks", Category::RendererDebug};
|
linkage, false, "disable_shader_loop_safety_checks", Category::RendererDebug};
|
||||||
Setting<bool> enable_renderdoc_hotkey{linkage, false, "renderdoc_hotkey",
|
Setting<bool> enable_renderdoc_hotkey{linkage, false, "renderdoc_hotkey",
|
||||||
Category::RendererDebug};
|
Category::RendererDebug};
|
||||||
Setting<bool> disable_buffer_reorder{linkage, false, "disable_buffer_reorder",
|
Setting<bool> disable_buffer_reorder{linkage, false, "disable_buffer_reorder",
|
||||||
Category::RendererDebug};
|
Category::RendererDebug};
|
||||||
|
|
||||||
// System
|
// System
|
||||||
SwitchableSetting<Language, true> language_index{linkage,
|
SwitchableSetting<Language, true> language_index{
|
||||||
Language::EnglishAmerican,
|
linkage, Language::EnglishAmerican, Language::Japanese,
|
||||||
Language::Japanese,
|
Language::Serbian, "language_index", Category::System};
|
||||||
Language::Serbian,
|
|
||||||
"language_index",
|
|
||||||
Category::System};
|
|
||||||
SwitchableSetting<Region, true> region_index{linkage, Region::Usa, Region::Japan,
|
SwitchableSetting<Region, true> region_index{linkage, Region::Usa, Region::Japan,
|
||||||
Region::Taiwan, "region_index", Category::System};
|
Region::Taiwan, "region_index", Category::System};
|
||||||
SwitchableSetting<TimeZone, true> time_zone_index{linkage, TimeZone::Auto,
|
SwitchableSetting<TimeZone, true> time_zone_index{linkage, TimeZone::Auto,
|
||||||
|
@ -545,10 +522,10 @@ struct Values {
|
||||||
"time_zone_index", Category::System};
|
"time_zone_index", Category::System};
|
||||||
// Measured in seconds since epoch
|
// Measured in seconds since epoch
|
||||||
SwitchableSetting<bool> custom_rtc_enabled{
|
SwitchableSetting<bool> custom_rtc_enabled{
|
||||||
linkage, false, "custom_rtc_enabled", Category::System, Specialization::Paired, true, true};
|
linkage, false, "custom_rtc_enabled", Category::System, Specialization::Paired, true, true};
|
||||||
SwitchableSetting<s64> custom_rtc{
|
SwitchableSetting<s64> custom_rtc{
|
||||||
linkage, 0, "custom_rtc", Category::System, Specialization::Time,
|
linkage, 0, "custom_rtc", Category::System, Specialization::Time,
|
||||||
false, true, &custom_rtc_enabled};
|
false, true, &custom_rtc_enabled};
|
||||||
SwitchableSetting<s64, true> custom_rtc_offset{linkage,
|
SwitchableSetting<s64, true> custom_rtc_offset{linkage,
|
||||||
0,
|
0,
|
||||||
std::numeric_limits<int>::min(),
|
std::numeric_limits<int>::min(),
|
||||||
|
@ -559,12 +536,12 @@ struct Values {
|
||||||
true,
|
true,
|
||||||
true};
|
true};
|
||||||
SwitchableSetting<bool> rng_seed_enabled{
|
SwitchableSetting<bool> rng_seed_enabled{
|
||||||
linkage, false, "rng_seed_enabled", Category::System, Specialization::Paired, true, true};
|
linkage, false, "rng_seed_enabled", Category::System, Specialization::Paired, true, true};
|
||||||
SwitchableSetting<u32> rng_seed{
|
SwitchableSetting<u32> rng_seed{
|
||||||
linkage, 0, "rng_seed", Category::System, Specialization::Hex,
|
linkage, 0, "rng_seed", Category::System, Specialization::Hex,
|
||||||
true, true, &rng_seed_enabled};
|
true, true, &rng_seed_enabled};
|
||||||
Setting<std::string> device_name{
|
Setting<std::string> device_name{
|
||||||
linkage, "eden", "device_name", Category::System, Specialization::Default, true, true};
|
linkage, "eden", "device_name", Category::System, Specialization::Default, true, true};
|
||||||
|
|
||||||
Setting<s32> current_user{linkage, 0, "current_user", Category::System};
|
Setting<s32> current_user{linkage, 0, "current_user", Category::System};
|
||||||
|
|
||||||
|
@ -615,21 +592,21 @@ struct Values {
|
||||||
Setting<bool> tas_loop{linkage, false, "tas_loop", Category::Controls};
|
Setting<bool> tas_loop{linkage, false, "tas_loop", Category::Controls};
|
||||||
|
|
||||||
Setting<bool> mouse_panning{
|
Setting<bool> mouse_panning{
|
||||||
linkage, false, "mouse_panning", Category::Controls, Specialization::Default, false};
|
linkage, false, "mouse_panning", Category::Controls, Specialization::Default, false};
|
||||||
Setting<u8, true> mouse_panning_sensitivity{
|
Setting<u8, true> mouse_panning_sensitivity{
|
||||||
linkage, 50, 1, 100, "mouse_panning_sensitivity", Category::Controls};
|
linkage, 50, 1, 100, "mouse_panning_sensitivity", Category::Controls};
|
||||||
Setting<bool> mouse_enabled{linkage, false, "mouse_enabled", Category::Controls};
|
Setting<bool> mouse_enabled{linkage, false, "mouse_enabled", Category::Controls};
|
||||||
|
|
||||||
Setting<u8, true> mouse_panning_x_sensitivity{
|
Setting<u8, true> mouse_panning_x_sensitivity{
|
||||||
linkage, 50, 1, 100, "mouse_panning_x_sensitivity", Category::Controls};
|
linkage, 50, 1, 100, "mouse_panning_x_sensitivity", Category::Controls};
|
||||||
Setting<u8, true> mouse_panning_y_sensitivity{
|
Setting<u8, true> mouse_panning_y_sensitivity{
|
||||||
linkage, 50, 1, 100, "mouse_panning_y_sensitivity", Category::Controls};
|
linkage, 50, 1, 100, "mouse_panning_y_sensitivity", Category::Controls};
|
||||||
Setting<u8, true> mouse_panning_deadzone_counterweight{
|
Setting<u8, true> mouse_panning_deadzone_counterweight{
|
||||||
linkage, 20, 0, 100, "mouse_panning_deadzone_counterweight", Category::Controls};
|
linkage, 20, 0, 100, "mouse_panning_deadzone_counterweight", Category::Controls};
|
||||||
Setting<u8, true> mouse_panning_decay_strength{
|
Setting<u8, true> mouse_panning_decay_strength{
|
||||||
linkage, 18, 0, 100, "mouse_panning_decay_strength", Category::Controls};
|
linkage, 18, 0, 100, "mouse_panning_decay_strength", Category::Controls};
|
||||||
Setting<u8, true> mouse_panning_min_decay{
|
Setting<u8, true> mouse_panning_min_decay{
|
||||||
linkage, 6, 0, 100, "mouse_panning_min_decay", Category::Controls};
|
linkage, 6, 0, 100, "mouse_panning_min_decay", Category::Controls};
|
||||||
|
|
||||||
Setting<bool> emulate_analog_keyboard{linkage, false, "emulate_analog_keyboard",
|
Setting<bool> emulate_analog_keyboard{linkage, false, "emulate_analog_keyboard",
|
||||||
Category::Controls};
|
Category::Controls};
|
||||||
|
@ -672,23 +649,22 @@ struct Values {
|
||||||
Setting<bool> dump_exefs{linkage, false, "dump_exefs", Category::Debugging};
|
Setting<bool> dump_exefs{linkage, false, "dump_exefs", Category::Debugging};
|
||||||
Setting<bool> dump_nso{linkage, false, "dump_nso", Category::Debugging};
|
Setting<bool> dump_nso{linkage, false, "dump_nso", Category::Debugging};
|
||||||
Setting<bool> dump_shaders{
|
Setting<bool> dump_shaders{
|
||||||
linkage, false, "dump_shaders", Category::DebuggingGraphics, Specialization::Default,
|
linkage, false, "dump_shaders", Category::DebuggingGraphics, Specialization::Default,
|
||||||
false};
|
false};
|
||||||
Setting<bool> dump_macros{
|
Setting<bool> dump_macros{
|
||||||
linkage, false, "dump_macros", Category::DebuggingGraphics, Specialization::Default, false};
|
linkage, false, "dump_macros", Category::DebuggingGraphics, Specialization::Default, false};
|
||||||
Setting<bool> enable_fs_access_log{linkage, false, "enable_fs_access_log", Category::Debugging};
|
Setting<bool> enable_fs_access_log{linkage, false, "enable_fs_access_log", Category::Debugging};
|
||||||
Setting<bool> reporting_services{
|
Setting<bool> reporting_services{
|
||||||
linkage, false, "reporting_services", Category::Debugging, Specialization::Default, false};
|
linkage, false, "reporting_services", Category::Debugging, Specialization::Default, false};
|
||||||
Setting<bool> quest_flag{linkage, false, "quest_flag", Category::Debugging};
|
Setting<bool> quest_flag{linkage, false, "quest_flag", Category::Debugging};
|
||||||
Setting<bool> disable_macro_jit{linkage, false, "disable_macro_jit",
|
Setting<bool> disable_macro_jit{linkage, false, "disable_macro_jit",
|
||||||
Category::DebuggingGraphics};
|
Category::DebuggingGraphics};
|
||||||
Setting<bool> disable_macro_hle{linkage, false, "disable_macro_hle",
|
Setting<bool> disable_macro_hle{linkage, false, "disable_macro_hle",
|
||||||
Category::DebuggingGraphics};
|
Category::DebuggingGraphics};
|
||||||
Setting<bool> extended_logging{
|
Setting<bool> extended_logging{
|
||||||
linkage, false, "extended_logging", Category::Debugging, Specialization::Default, false};
|
linkage, false, "extended_logging", Category::Debugging, Specialization::Default, false};
|
||||||
Setting<bool> use_debug_asserts{linkage, false, "use_debug_asserts", Category::Debugging};
|
Setting<bool> use_debug_asserts{linkage, false, "use_debug_asserts", Category::Debugging};
|
||||||
Setting<bool> use_auto_stub{
|
Setting<bool> use_auto_stub{linkage, false, "use_auto_stub", Category::Debugging};
|
||||||
linkage, false, "use_auto_stub", Category::Debugging};
|
|
||||||
Setting<bool> enable_all_controllers{linkage, false, "enable_all_controllers",
|
Setting<bool> enable_all_controllers{linkage, false, "enable_all_controllers",
|
||||||
Category::Debugging};
|
Category::Debugging};
|
||||||
Setting<bool> perform_vulkan_check{linkage, true, "perform_vulkan_check", Category::Debugging};
|
Setting<bool> perform_vulkan_check{linkage, true, "perform_vulkan_check", Category::Debugging};
|
||||||
|
|
|
@ -150,19 +150,8 @@ ENUM(FullscreenMode, Borderless, Exclusive);
|
||||||
|
|
||||||
ENUM(NvdecEmulation, Off, Cpu, Gpu);
|
ENUM(NvdecEmulation, Off, Cpu, Gpu);
|
||||||
|
|
||||||
ENUM(ResolutionSetup,
|
ENUM(ResolutionSetup, Res1_4X, Res1_2X, Res3_4X, Res1X, Res3_2X, Res2X, Res3X, Res4X, Res5X, Res6X,
|
||||||
Res1_4X,
|
Res7X, Res8X);
|
||||||
Res1_2X,
|
|
||||||
Res3_4X,
|
|
||||||
Res1X,
|
|
||||||
Res3_2X,
|
|
||||||
Res2X,
|
|
||||||
Res3X,
|
|
||||||
Res4X,
|
|
||||||
Res5X,
|
|
||||||
Res6X,
|
|
||||||
Res7X,
|
|
||||||
Res8X);
|
|
||||||
|
|
||||||
ENUM(ScalingFilter, NearestNeighbor, Bilinear, Bicubic, Gaussian, ScaleForce, Fsr, Area, MaxEnum);
|
ENUM(ScalingFilter, NearestNeighbor, Bilinear, Bicubic, Gaussian, ScaleForce, Fsr, Area, MaxEnum);
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,8 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <codecvt>
|
|
||||||
#include <locale>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <boost/locale.hpp>
|
||||||
|
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
|
|
||||||
|
@ -142,18 +141,15 @@ std::string ReplaceAll(std::string result, const std::string& src, const std::st
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string UTF16ToUTF8(std::u16string_view input) {
|
std::string UTF16ToUTF8(std::u16string_view input) {
|
||||||
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
|
return boost::locale::conv::utf_to_utf<char>(input.data(), input.data() + input.size());
|
||||||
return convert.to_bytes(input.data(), input.data() + input.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::u16string UTF8ToUTF16(std::string_view input) {
|
std::u16string UTF8ToUTF16(std::string_view input) {
|
||||||
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
|
return boost::locale::conv::utf_to_utf<char16_t>(input.data(), input.data() + input.size());
|
||||||
return convert.from_bytes(input.data(), input.data() + input.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::u32string UTF8ToUTF32(std::string_view input) {
|
std::u32string UTF8ToUTF32(std::string_view input) {
|
||||||
std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> convert;
|
return boost::locale::conv::utf_to_utf<char32_t>(input.data(), input.data() + input.size());
|
||||||
return convert.from_bytes(input.data(), input.data() + input.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
|
@ -103,9 +103,9 @@ concept IsRBEntry = CheckRBEntry<T>::value;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
concept HasRBEntry = requires(T& t, const T& ct) {
|
concept HasRBEntry = requires(T& t, const T& ct) {
|
||||||
{ t.GetRBEntry() } -> std::same_as<RBEntry<T>&>;
|
{ t.GetRBEntry() } -> std::same_as<RBEntry<T>&>;
|
||||||
{ ct.GetRBEntry() } -> std::same_as<const RBEntry<T>&>;
|
{ ct.GetRBEntry() } -> std::same_as<const RBEntry<T>&>;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
requires HasRBEntry<T>
|
requires HasRBEntry<T>
|
||||||
|
|
|
@ -362,7 +362,9 @@ public:
|
||||||
// _DEFINE_SWIZZLER2 defines a single such function, DEFINE_SWIZZLER2 defines all of them for all
|
// _DEFINE_SWIZZLER2 defines a single such function, DEFINE_SWIZZLER2 defines all of them for all
|
||||||
// component names (x<->r) and permutations (xy<->yx)
|
// component names (x<->r) and permutations (xy<->yx)
|
||||||
#define _DEFINE_SWIZZLER2(a, b, name) \
|
#define _DEFINE_SWIZZLER2(a, b, name) \
|
||||||
[[nodiscard]] constexpr Vec2<T> name() const { return Vec2<T>(a, b); }
|
[[nodiscard]] constexpr Vec2<T> name() const { \
|
||||||
|
return Vec2<T>(a, b); \
|
||||||
|
}
|
||||||
#define DEFINE_SWIZZLER2(a, b, a2, b2, a3, b3, a4, b4) \
|
#define DEFINE_SWIZZLER2(a, b, a2, b2, a3, b3, a4, b4) \
|
||||||
_DEFINE_SWIZZLER2(a, b, a##b); \
|
_DEFINE_SWIZZLER2(a, b, a##b); \
|
||||||
_DEFINE_SWIZZLER2(a, b, a2##b2); \
|
_DEFINE_SWIZZLER2(a, b, a2##b2); \
|
||||||
|
@ -555,7 +557,9 @@ public:
|
||||||
// DEFINE_SWIZZLER2_COMP2 defines two component functions for all component names (x<->r) and
|
// DEFINE_SWIZZLER2_COMP2 defines two component functions for all component names (x<->r) and
|
||||||
// permutations (xy<->yx)
|
// permutations (xy<->yx)
|
||||||
#define _DEFINE_SWIZZLER2(a, b, name) \
|
#define _DEFINE_SWIZZLER2(a, b, name) \
|
||||||
[[nodiscard]] constexpr Vec2<T> name() const { return Vec2<T>(a, b); }
|
[[nodiscard]] constexpr Vec2<T> name() const { \
|
||||||
|
return Vec2<T>(a, b); \
|
||||||
|
}
|
||||||
#define DEFINE_SWIZZLER2_COMP1(a, a2) \
|
#define DEFINE_SWIZZLER2_COMP1(a, a2) \
|
||||||
_DEFINE_SWIZZLER2(a, a, a##a); \
|
_DEFINE_SWIZZLER2(a, a, a##a); \
|
||||||
_DEFINE_SWIZZLER2(a, a, a2##a2)
|
_DEFINE_SWIZZLER2(a, a, a2##a2)
|
||||||
|
@ -580,7 +584,9 @@ public:
|
||||||
#undef _DEFINE_SWIZZLER2
|
#undef _DEFINE_SWIZZLER2
|
||||||
|
|
||||||
#define _DEFINE_SWIZZLER3(a, b, c, name) \
|
#define _DEFINE_SWIZZLER3(a, b, c, name) \
|
||||||
[[nodiscard]] constexpr Vec3<T> name() const { return Vec3<T>(a, b, c); }
|
[[nodiscard]] constexpr Vec3<T> name() const { \
|
||||||
|
return Vec3<T>(a, b, c); \
|
||||||
|
}
|
||||||
#define DEFINE_SWIZZLER3_COMP1(a, a2) \
|
#define DEFINE_SWIZZLER3_COMP1(a, a2) \
|
||||||
_DEFINE_SWIZZLER3(a, a, a, a##a##a); \
|
_DEFINE_SWIZZLER3(a, a, a, a##a##a); \
|
||||||
_DEFINE_SWIZZLER3(a, a, a, a2##a2##a2)
|
_DEFINE_SWIZZLER3(a, a, a, a2##a2##a2)
|
||||||
|
|
|
@ -33,8 +33,8 @@ public:
|
||||||
VirtualBuffer& operator=(const VirtualBuffer&) = delete;
|
VirtualBuffer& operator=(const VirtualBuffer&) = delete;
|
||||||
|
|
||||||
VirtualBuffer(VirtualBuffer&& other) noexcept
|
VirtualBuffer(VirtualBuffer&& other) noexcept
|
||||||
: alloc_size{std::exchange(other.alloc_size, 0)}, base_ptr{std::exchange(other.base_ptr),
|
: alloc_size{std::exchange(other.alloc_size, 0)},
|
||||||
nullptr} {}
|
base_ptr{std::exchange(other.base_ptr), nullptr} {}
|
||||||
|
|
||||||
VirtualBuffer& operator=(VirtualBuffer&& other) noexcept {
|
VirtualBuffer& operator=(VirtualBuffer&& other) noexcept {
|
||||||
alloc_size = std::exchange(other.alloc_size, 0);
|
alloc_size = std::exchange(other.alloc_size, 0);
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
namespace Common::X64 {
|
namespace Common::X64 {
|
||||||
|
|
||||||
NativeClock::NativeClock(u64 rdtsc_frequency_)
|
NativeClock::NativeClock(u64 rdtsc_frequency_)
|
||||||
: rdtsc_frequency{rdtsc_frequency_}, ns_rdtsc_factor{GetFixedPoint64Factor(NsRatio::den,
|
: rdtsc_frequency{rdtsc_frequency_},
|
||||||
rdtsc_frequency)},
|
ns_rdtsc_factor{GetFixedPoint64Factor(NsRatio::den, rdtsc_frequency)},
|
||||||
us_rdtsc_factor{GetFixedPoint64Factor(UsRatio::den, rdtsc_frequency)},
|
us_rdtsc_factor{GetFixedPoint64Factor(UsRatio::den, rdtsc_frequency)},
|
||||||
ms_rdtsc_factor{GetFixedPoint64Factor(MsRatio::den, rdtsc_frequency)},
|
ms_rdtsc_factor{GetFixedPoint64Factor(MsRatio::den, rdtsc_frequency)},
|
||||||
cntpct_rdtsc_factor{GetFixedPoint64Factor(CNTFRQ, rdtsc_frequency)},
|
cntpct_rdtsc_factor{GetFixedPoint64Factor(CNTFRQ, rdtsc_frequency)},
|
||||||
|
|
|
@ -14,7 +14,8 @@ void ArmInterface::LogBacktrace(Kernel::KProcess* process) const {
|
||||||
this->GetContext(ctx);
|
this->GetContext(ctx);
|
||||||
|
|
||||||
LOG_ERROR(Core_ARM, "Backtrace, sp={:016X}, pc={:016X}", ctx.sp, ctx.pc);
|
LOG_ERROR(Core_ARM, "Backtrace, sp={:016X}, pc={:016X}", ctx.sp, ctx.pc);
|
||||||
LOG_ERROR(Core_ARM, "{:20}{:20}{:20}{:20}{}", "Module Name", "Address", "Original Address", "Offset", "Symbol");
|
LOG_ERROR(Core_ARM, "{:20}{:20}{:20}{:20}{}", "Module Name", "Address", "Original Address",
|
||||||
|
"Offset", "Symbol");
|
||||||
LOG_ERROR(Core_ARM, "");
|
LOG_ERROR(Core_ARM, "");
|
||||||
|
|
||||||
const auto backtrace = GetBacktraceFromContext(process, ctx);
|
const auto backtrace = GetBacktraceFromContext(process, ctx);
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace {
|
||||||
|
|
||||||
thread_local Core::Memory::Memory* g_current_memory{};
|
thread_local Core::Memory::Memory* g_current_memory{};
|
||||||
std::once_flag g_registered{};
|
std::once_flag g_registered{};
|
||||||
struct sigaction g_old_segv {};
|
struct sigaction g_old_segv{};
|
||||||
|
|
||||||
void HandleSigSegv(int sig, siginfo_t* info, void* ctx) {
|
void HandleSigSegv(int sig, siginfo_t* info, void* ctx) {
|
||||||
if (g_current_memory && g_current_memory->InvalidateSeparateHeap(info->si_addr)) {
|
if (g_current_memory && g_current_memory->InvalidateSeparateHeap(info->si_addr)) {
|
||||||
|
@ -37,7 +37,7 @@ ScopedJitExecution::~ScopedJitExecution() {
|
||||||
|
|
||||||
void ScopedJitExecution::RegisterHandler() {
|
void ScopedJitExecution::RegisterHandler() {
|
||||||
std::call_once(g_registered, [] {
|
std::call_once(g_registered, [] {
|
||||||
struct sigaction sa {};
|
struct sigaction sa{};
|
||||||
sa.sa_sigaction = &HandleSigSegv;
|
sa.sa_sigaction = &HandleSigSegv;
|
||||||
sa.sa_flags = SA_SIGINFO | SA_ONSTACK;
|
sa.sa_flags = SA_SIGINFO | SA_ONSTACK;
|
||||||
Common::SigAction(SIGSEGV, std::addressof(sa), std::addressof(g_old_segv));
|
Common::SigAction(SIGSEGV, std::addressof(sa), std::addressof(g_old_segv));
|
||||||
|
|
|
@ -19,8 +19,8 @@ using namespace Common::Literals;
|
||||||
class DynarmicCallbacks32 : public Dynarmic::A32::UserCallbacks {
|
class DynarmicCallbacks32 : public Dynarmic::A32::UserCallbacks {
|
||||||
public:
|
public:
|
||||||
explicit DynarmicCallbacks32(ArmDynarmic32& parent, Kernel::KProcess* process)
|
explicit DynarmicCallbacks32(ArmDynarmic32& parent, Kernel::KProcess* process)
|
||||||
: m_parent{parent}, m_memory(process->GetMemory()),
|
: m_parent{parent}, m_memory(process->GetMemory()), m_process(process),
|
||||||
m_process(process), m_debugger_enabled{parent.m_system.DebuggerEnabled()},
|
m_debugger_enabled{parent.m_system.DebuggerEnabled()},
|
||||||
m_check_memory_access{m_debugger_enabled ||
|
m_check_memory_access{m_debugger_enabled ||
|
||||||
!Settings::values.cpuopt_ignore_memory_aborts.GetValue()} {}
|
!Settings::values.cpuopt_ignore_memory_aborts.GetValue()} {}
|
||||||
|
|
||||||
|
@ -195,11 +195,12 @@ std::shared_ptr<Dynarmic::A32::Jit> ArmDynarmic32::MakeJit(Common::PageTable* pa
|
||||||
config.detect_misaligned_access_via_page_table = 16 | 32 | 64 | 128;
|
config.detect_misaligned_access_via_page_table = 16 | 32 | 64 | 128;
|
||||||
config.only_detect_misalignment_via_page_table_on_page_boundary = true;
|
config.only_detect_misalignment_via_page_table_on_page_boundary = true;
|
||||||
|
|
||||||
config.fastmem_pointer = page_table->fastmem_arena ?
|
config.fastmem_pointer =
|
||||||
std::optional<uintptr_t>{reinterpret_cast<uintptr_t>(page_table->fastmem_arena)} :
|
page_table->fastmem_arena
|
||||||
std::nullopt;
|
? std::optional<uintptr_t>{reinterpret_cast<uintptr_t>(page_table->fastmem_arena)}
|
||||||
|
: std::nullopt;
|
||||||
|
|
||||||
config.fastmem_exclusive_access = config.fastmem_pointer != std::nullopt;
|
config.fastmem_exclusive_access = config.fastmem_pointer != std::nullopt;
|
||||||
config.recompile_on_exclusive_fastmem_failure = true;
|
config.recompile_on_exclusive_fastmem_failure = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,8 @@ using namespace Common::Literals;
|
||||||
class DynarmicCallbacks64 : public Dynarmic::A64::UserCallbacks {
|
class DynarmicCallbacks64 : public Dynarmic::A64::UserCallbacks {
|
||||||
public:
|
public:
|
||||||
explicit DynarmicCallbacks64(ArmDynarmic64& parent, Kernel::KProcess* process)
|
explicit DynarmicCallbacks64(ArmDynarmic64& parent, Kernel::KProcess* process)
|
||||||
: m_parent{parent}, m_memory(process->GetMemory()),
|
: m_parent{parent}, m_memory(process->GetMemory()), m_process(process),
|
||||||
m_process(process), m_debugger_enabled{parent.m_system.DebuggerEnabled()},
|
m_debugger_enabled{parent.m_system.DebuggerEnabled()},
|
||||||
m_check_memory_access{m_debugger_enabled ||
|
m_check_memory_access{m_debugger_enabled ||
|
||||||
!Settings::values.cpuopt_ignore_memory_aborts.GetValue()} {}
|
!Settings::values.cpuopt_ignore_memory_aborts.GetValue()} {}
|
||||||
|
|
||||||
|
@ -242,9 +242,10 @@ std::shared_ptr<Dynarmic::A64::Jit> ArmDynarmic64::MakeJit(Common::PageTable* pa
|
||||||
config.detect_misaligned_access_via_page_table = 16 | 32 | 64 | 128;
|
config.detect_misaligned_access_via_page_table = 16 | 32 | 64 | 128;
|
||||||
config.only_detect_misalignment_via_page_table_on_page_boundary = true;
|
config.only_detect_misalignment_via_page_table_on_page_boundary = true;
|
||||||
|
|
||||||
config.fastmem_pointer = page_table->fastmem_arena ?
|
config.fastmem_pointer =
|
||||||
std::optional<uintptr_t>{reinterpret_cast<uintptr_t>(page_table->fastmem_arena)} :
|
page_table->fastmem_arena
|
||||||
std::nullopt;
|
? std::optional<uintptr_t>{reinterpret_cast<uintptr_t>(page_table->fastmem_arena)}
|
||||||
|
: std::nullopt;
|
||||||
config.fastmem_address_space_bits = std::uint32_t(address_space_bits);
|
config.fastmem_address_space_bits = std::uint32_t(address_space_bits);
|
||||||
config.silently_mirror_fastmem = false;
|
config.silently_mirror_fastmem = false;
|
||||||
|
|
||||||
|
|
|
@ -302,7 +302,7 @@ void ArmNce::Initialize() {
|
||||||
sigaddset(&signal_mask, GuestAlignmentFaultSignal);
|
sigaddset(&signal_mask, GuestAlignmentFaultSignal);
|
||||||
sigaddset(&signal_mask, GuestAccessFaultSignal);
|
sigaddset(&signal_mask, GuestAccessFaultSignal);
|
||||||
|
|
||||||
struct sigaction return_to_run_code_action {};
|
struct sigaction return_to_run_code_action{};
|
||||||
return_to_run_code_action.sa_flags = SA_SIGINFO | SA_ONSTACK;
|
return_to_run_code_action.sa_flags = SA_SIGINFO | SA_ONSTACK;
|
||||||
return_to_run_code_action.sa_sigaction = reinterpret_cast<HandlerType>(
|
return_to_run_code_action.sa_sigaction = reinterpret_cast<HandlerType>(
|
||||||
&ArmNce::ReturnToRunCodeByExceptionLevelChangeSignalHandler);
|
&ArmNce::ReturnToRunCodeByExceptionLevelChangeSignalHandler);
|
||||||
|
@ -310,21 +310,21 @@ void ArmNce::Initialize() {
|
||||||
Common::SigAction(ReturnToRunCodeByExceptionLevelChangeSignal, &return_to_run_code_action,
|
Common::SigAction(ReturnToRunCodeByExceptionLevelChangeSignal, &return_to_run_code_action,
|
||||||
nullptr);
|
nullptr);
|
||||||
|
|
||||||
struct sigaction break_from_run_code_action {};
|
struct sigaction break_from_run_code_action{};
|
||||||
break_from_run_code_action.sa_flags = SA_SIGINFO | SA_ONSTACK;
|
break_from_run_code_action.sa_flags = SA_SIGINFO | SA_ONSTACK;
|
||||||
break_from_run_code_action.sa_sigaction =
|
break_from_run_code_action.sa_sigaction =
|
||||||
reinterpret_cast<HandlerType>(&ArmNce::BreakFromRunCodeSignalHandler);
|
reinterpret_cast<HandlerType>(&ArmNce::BreakFromRunCodeSignalHandler);
|
||||||
break_from_run_code_action.sa_mask = signal_mask;
|
break_from_run_code_action.sa_mask = signal_mask;
|
||||||
Common::SigAction(BreakFromRunCodeSignal, &break_from_run_code_action, nullptr);
|
Common::SigAction(BreakFromRunCodeSignal, &break_from_run_code_action, nullptr);
|
||||||
|
|
||||||
struct sigaction alignment_fault_action {};
|
struct sigaction alignment_fault_action{};
|
||||||
alignment_fault_action.sa_flags = SA_SIGINFO | SA_ONSTACK;
|
alignment_fault_action.sa_flags = SA_SIGINFO | SA_ONSTACK;
|
||||||
alignment_fault_action.sa_sigaction =
|
alignment_fault_action.sa_sigaction =
|
||||||
reinterpret_cast<HandlerType>(&ArmNce::GuestAlignmentFaultSignalHandler);
|
reinterpret_cast<HandlerType>(&ArmNce::GuestAlignmentFaultSignalHandler);
|
||||||
alignment_fault_action.sa_mask = signal_mask;
|
alignment_fault_action.sa_mask = signal_mask;
|
||||||
Common::SigAction(GuestAlignmentFaultSignal, &alignment_fault_action, nullptr);
|
Common::SigAction(GuestAlignmentFaultSignal, &alignment_fault_action, nullptr);
|
||||||
|
|
||||||
struct sigaction access_fault_action {};
|
struct sigaction access_fault_action{};
|
||||||
access_fault_action.sa_flags = SA_SIGINFO | SA_ONSTACK | SA_RESTART;
|
access_fault_action.sa_flags = SA_SIGINFO | SA_ONSTACK | SA_RESTART;
|
||||||
access_fault_action.sa_sigaction =
|
access_fault_action.sa_sigaction =
|
||||||
reinterpret_cast<HandlerType>(&ArmNce::GuestAccessFaultSignalHandler);
|
reinterpret_cast<HandlerType>(&ArmNce::GuestAccessFaultSignalHandler);
|
||||||
|
@ -405,19 +405,19 @@ void ArmNce::ClearInstructionCache() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArmNce::InvalidateCacheRange(u64 addr, std::size_t size) {
|
void ArmNce::InvalidateCacheRange(u64 addr, std::size_t size) {
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
// Align the start address to cache line boundary for better performance
|
// Align the start address to cache line boundary for better performance
|
||||||
const size_t CACHE_LINE_SIZE = 64;
|
const size_t CACHE_LINE_SIZE = 64;
|
||||||
addr &= ~(CACHE_LINE_SIZE - 1);
|
addr &= ~(CACHE_LINE_SIZE - 1);
|
||||||
|
|
||||||
// Round up size to nearest cache line
|
// Round up size to nearest cache line
|
||||||
size = (size + CACHE_LINE_SIZE - 1) & ~(CACHE_LINE_SIZE - 1);
|
size = (size + CACHE_LINE_SIZE - 1) & ~(CACHE_LINE_SIZE - 1);
|
||||||
|
|
||||||
// Prefetch the range to be invalidated
|
// Prefetch the range to be invalidated
|
||||||
for (size_t offset = 0; offset < size; offset += CACHE_LINE_SIZE) {
|
for (size_t offset = 0; offset < size; offset += CACHE_LINE_SIZE) {
|
||||||
__builtin_prefetch((void*)(addr + offset), 1, 3);
|
__builtin_prefetch((void*)(addr + offset), 1, 3);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
this->ClearInstructionCache();
|
this->ClearInstructionCache();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace Core {
|
||||||
namespace {
|
namespace {
|
||||||
// Prefetch tuning parameters
|
// Prefetch tuning parameters
|
||||||
constexpr size_t CACHE_LINE_SIZE = 64;
|
constexpr size_t CACHE_LINE_SIZE = 64;
|
||||||
constexpr size_t PREFETCH_STRIDE = 128; // 2 cache lines ahead
|
constexpr size_t PREFETCH_STRIDE = 128; // 2 cache lines ahead
|
||||||
constexpr size_t SIMD_PREFETCH_THRESHOLD = 32; // Bytes
|
constexpr size_t SIMD_PREFETCH_THRESHOLD = 32; // Bytes
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
|
@ -13,28 +13,34 @@
|
||||||
template <typename KeyType, typename ValueType>
|
template <typename KeyType, typename ValueType>
|
||||||
class LRUCache {
|
class LRUCache {
|
||||||
public:
|
public:
|
||||||
using key_type = KeyType;
|
using key_type = KeyType;
|
||||||
using value_type = ValueType;
|
using value_type = ValueType;
|
||||||
using size_type = std::size_t;
|
using size_type = std::size_t;
|
||||||
|
|
||||||
struct Statistics {
|
struct Statistics {
|
||||||
size_type hits = 0;
|
size_type hits = 0;
|
||||||
size_type misses = 0;
|
size_type misses = 0;
|
||||||
void reset() noexcept { hits = misses = 0; }
|
void reset() noexcept {
|
||||||
|
hits = misses = 0;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit LRUCache(size_type capacity, bool enabled = true)
|
explicit LRUCache(size_type capacity, bool enabled = true)
|
||||||
: enabled_{enabled}, capacity_{capacity} {
|
: enabled_{enabled}, capacity_{capacity} {
|
||||||
cache_map_.reserve(capacity_);
|
cache_map_.reserve(capacity_);
|
||||||
LOG_WARNING(Core, "LRU Cache initialised (state: {} | capacity: {})", enabled_ ? "enabled" : "disabled", capacity_);
|
LOG_WARNING(Core, "LRU Cache initialised (state: {} | capacity: {})",
|
||||||
|
enabled_ ? "enabled" : "disabled", capacity_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Non-movable copy semantics
|
// Non-movable copy semantics
|
||||||
LRUCache(const LRUCache&) = delete;
|
LRUCache(const LRUCache&) = delete;
|
||||||
LRUCache& operator=(const LRUCache&) = delete;
|
LRUCache& operator=(const LRUCache&) = delete;
|
||||||
LRUCache(LRUCache&& other) noexcept { *this = std::move(other); }
|
LRUCache(LRUCache&& other) noexcept {
|
||||||
|
*this = std::move(other);
|
||||||
|
}
|
||||||
LRUCache& operator=(LRUCache&& other) noexcept {
|
LRUCache& operator=(LRUCache&& other) noexcept {
|
||||||
if (this == &other) return *this;
|
if (this == &other)
|
||||||
|
return *this;
|
||||||
std::unique_lock this_lock(mutex_, std::defer_lock);
|
std::unique_lock this_lock(mutex_, std::defer_lock);
|
||||||
std::unique_lock other_lock(other.mutex_, std::defer_lock);
|
std::unique_lock other_lock(other.mutex_, std::defer_lock);
|
||||||
std::lock(this_lock, other_lock);
|
std::lock(this_lock, other_lock);
|
||||||
|
@ -48,7 +54,8 @@ public:
|
||||||
~LRUCache() = default;
|
~LRUCache() = default;
|
||||||
|
|
||||||
[[nodiscard]] value_type* get(const key_type& key) {
|
[[nodiscard]] value_type* get(const key_type& key) {
|
||||||
if (!enabled_) [[unlikely]] return nullptr;
|
if (!enabled_) [[unlikely]]
|
||||||
|
return nullptr;
|
||||||
std::unique_lock lock(mutex_);
|
std::unique_lock lock(mutex_);
|
||||||
auto it = cache_map_.find(key);
|
auto it = cache_map_.find(key);
|
||||||
if (it == cache_map_.end()) {
|
if (it == cache_map_.end()) {
|
||||||
|
@ -61,7 +68,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] value_type* peek(const key_type& key) const {
|
[[nodiscard]] value_type* peek(const key_type& key) const {
|
||||||
if (!enabled_) [[unlikely]] return nullptr;
|
if (!enabled_) [[unlikely]]
|
||||||
|
return nullptr;
|
||||||
std::shared_lock lock(mutex_);
|
std::shared_lock lock(mutex_);
|
||||||
auto it = cache_map_.find(key);
|
auto it = cache_map_.find(key);
|
||||||
return it == cache_map_.end() ? nullptr : &it->second.second;
|
return it == cache_map_.end() ? nullptr : &it->second.second;
|
||||||
|
@ -69,7 +77,8 @@ public:
|
||||||
|
|
||||||
template <typename V>
|
template <typename V>
|
||||||
void put(const key_type& key, V&& value) {
|
void put(const key_type& key, V&& value) {
|
||||||
if (!enabled_) [[unlikely]] return;
|
if (!enabled_) [[unlikely]]
|
||||||
|
return;
|
||||||
std::unique_lock lock(mutex_);
|
std::unique_lock lock(mutex_);
|
||||||
insert_or_update(key, std::forward<V>(value));
|
insert_or_update(key, std::forward<V>(value));
|
||||||
}
|
}
|
||||||
|
@ -88,16 +97,19 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] bool contains(const key_type& key) const {
|
[[nodiscard]] bool contains(const key_type& key) const {
|
||||||
if (!enabled_) return false;
|
if (!enabled_)
|
||||||
|
return false;
|
||||||
std::shared_lock lock(mutex_);
|
std::shared_lock lock(mutex_);
|
||||||
return cache_map_.find(key) != cache_map_.end();
|
return cache_map_.find(key) != cache_map_.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool erase(const key_type& key) {
|
bool erase(const key_type& key) {
|
||||||
if (!enabled_) return false;
|
if (!enabled_)
|
||||||
|
return false;
|
||||||
std::unique_lock lock(mutex_);
|
std::unique_lock lock(mutex_);
|
||||||
auto it = cache_map_.find(key);
|
auto it = cache_map_.find(key);
|
||||||
if (it == cache_map_.end()) return false;
|
if (it == cache_map_.end())
|
||||||
|
return false;
|
||||||
cache_list_.erase(it->second.first);
|
cache_list_.erase(it->second.first);
|
||||||
cache_map_.erase(it);
|
cache_map_.erase(it);
|
||||||
return true;
|
return true;
|
||||||
|
@ -111,15 +123,19 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] size_type size() const {
|
[[nodiscard]] size_type size() const {
|
||||||
if (!enabled_) return 0;
|
if (!enabled_)
|
||||||
|
return 0;
|
||||||
std::shared_lock lock(mutex_);
|
std::shared_lock lock(mutex_);
|
||||||
return cache_map_.size();
|
return cache_map_.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] size_type get_capacity() const { return capacity_; }
|
[[nodiscard]] size_type get_capacity() const {
|
||||||
|
return capacity_;
|
||||||
|
}
|
||||||
|
|
||||||
void resize(size_type new_capacity) {
|
void resize(size_type new_capacity) {
|
||||||
if (!enabled_) return;
|
if (!enabled_)
|
||||||
|
return;
|
||||||
std::unique_lock lock(mutex_);
|
std::unique_lock lock(mutex_);
|
||||||
capacity_ = new_capacity;
|
capacity_ = new_capacity;
|
||||||
shrink_if_needed();
|
shrink_if_needed();
|
||||||
|
@ -130,10 +146,13 @@ public:
|
||||||
std::unique_lock lock(mutex_);
|
std::unique_lock lock(mutex_);
|
||||||
enabled_ = state;
|
enabled_ = state;
|
||||||
LOG_WARNING(Core, "LRU Cache state changed to: {}", state ? "enabled" : "disabled");
|
LOG_WARNING(Core, "LRU Cache state changed to: {}", state ? "enabled" : "disabled");
|
||||||
if (!enabled_) clear();
|
if (!enabled_)
|
||||||
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] bool isEnabled() const { return enabled_; }
|
[[nodiscard]] bool isEnabled() const {
|
||||||
|
return enabled_;
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] Statistics stats() const {
|
[[nodiscard]] Statistics stats() const {
|
||||||
std::shared_lock lock(mutex_);
|
std::shared_lock lock(mutex_);
|
||||||
|
@ -141,10 +160,10 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using list_type = std::list<key_type>;
|
using list_type = std::list<key_type>;
|
||||||
using list_iterator = typename list_type::iterator;
|
using list_iterator = typename list_type::iterator;
|
||||||
using map_value_type = std::pair<list_iterator, value_type>;
|
using map_value_type = std::pair<list_iterator, value_type>;
|
||||||
using map_type = std::unordered_map<key_type, map_value_type>;
|
using map_type = std::unordered_map<key_type, map_value_type>;
|
||||||
|
|
||||||
template <typename V>
|
template <typename V>
|
||||||
void insert_or_update(const key_type& key, V&& value) {
|
void insert_or_update(const key_type& key, V&& value) {
|
||||||
|
|
|
@ -16,21 +16,16 @@ namespace Core::NCE {
|
||||||
|
|
||||||
Patcher::Patcher(Patcher&& other) noexcept
|
Patcher::Patcher(Patcher&& other) noexcept
|
||||||
: patch_cache(std::move(other.patch_cache)),
|
: patch_cache(std::move(other.patch_cache)),
|
||||||
m_patch_instructions(std::move(other.m_patch_instructions)),
|
m_patch_instructions(std::move(other.m_patch_instructions)), c(m_patch_instructions),
|
||||||
c(m_patch_instructions),
|
m_save_context(other.m_save_context), m_load_context(other.m_load_context), mode(other.mode),
|
||||||
m_save_context(other.m_save_context),
|
|
||||||
m_load_context(other.m_load_context),
|
|
||||||
mode(other.mode),
|
|
||||||
total_program_size(other.total_program_size),
|
total_program_size(other.total_program_size),
|
||||||
m_relocate_module_index(other.m_relocate_module_index),
|
m_relocate_module_index(other.m_relocate_module_index), modules(std::move(other.modules)),
|
||||||
modules(std::move(other.modules)),
|
|
||||||
curr_patch(nullptr) {
|
curr_patch(nullptr) {
|
||||||
if (!modules.empty()) {
|
if (!modules.empty()) {
|
||||||
curr_patch = &modules.back();
|
curr_patch = &modules.back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
using namespace Common::Literals;
|
using namespace Common::Literals;
|
||||||
using namespace oaknut::util;
|
using namespace oaknut::util;
|
||||||
|
|
||||||
|
@ -41,7 +36,7 @@ constexpr u32 ModuleCodeIndex = 0x24 / sizeof(u32);
|
||||||
|
|
||||||
Patcher::Patcher() : c(m_patch_instructions) {
|
Patcher::Patcher() : c(m_patch_instructions) {
|
||||||
LOG_WARNING(Core_ARM, "Patcher initialized with LRU cache {}",
|
LOG_WARNING(Core_ARM, "Patcher initialized with LRU cache {}",
|
||||||
patch_cache.isEnabled() ? "enabled" : "disabled");
|
patch_cache.isEnabled() ? "enabled" : "disabled");
|
||||||
// The first word of the patch section is always a branch to the first instruction of the
|
// The first word of the patch section is always a branch to the first instruction of the
|
||||||
// module.
|
// module.
|
||||||
c.dw(0);
|
c.dw(0);
|
||||||
|
|
|
@ -9,13 +9,13 @@
|
||||||
#include <oaknut/code_block.hpp>
|
#include <oaknut/code_block.hpp>
|
||||||
#include <oaknut/oaknut.hpp>
|
#include <oaknut/oaknut.hpp>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
#include "core/hle/kernel/code_set.h"
|
#include "core/hle/kernel/code_set.h"
|
||||||
#include "core/hle/kernel/k_typed_address.h"
|
#include "core/hle/kernel/k_typed_address.h"
|
||||||
#include "core/hle/kernel/physical_memory.h"
|
#include "core/hle/kernel/physical_memory.h"
|
||||||
#include "lru_cache.h"
|
#include "lru_cache.h"
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
namespace Core::NCE {
|
namespace Core::NCE {
|
||||||
|
|
||||||
|
@ -67,8 +67,9 @@ private:
|
||||||
void WriteCntpctHandler(ModuleDestLabel module_dest, oaknut::XReg dest_reg);
|
void WriteCntpctHandler(ModuleDestLabel module_dest, oaknut::XReg dest_reg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr size_t CACHE_SIZE = 16384; // Cache size for patch entries
|
static constexpr size_t CACHE_SIZE = 16384; // Cache size for patch entries
|
||||||
LRUCache<uintptr_t, PatchTextAddress> patch_cache{CACHE_SIZE, Settings::values.lru_cache_enabled.GetValue()};
|
LRUCache<uintptr_t, PatchTextAddress> patch_cache{
|
||||||
|
CACHE_SIZE, Settings::values.lru_cache_enabled.GetValue()};
|
||||||
|
|
||||||
void BranchToPatch(uintptr_t module_dest) {
|
void BranchToPatch(uintptr_t module_dest) {
|
||||||
if (patch_cache.isEnabled()) {
|
if (patch_cache.isEnabled()) {
|
||||||
|
@ -79,14 +80,16 @@ private:
|
||||||
curr_patch->m_branch_to_patch_relocations.push_back({c.offset(), *cached_patch});
|
curr_patch->m_branch_to_patch_relocations.push_back({c.offset(), *cached_patch});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LOG_DEBUG(Core_ARM, "LRU cache miss for address {:#x}, creating new patch", module_dest);
|
LOG_DEBUG(Core_ARM, "LRU cache miss for address {:#x}, creating new patch",
|
||||||
|
module_dest);
|
||||||
|
|
||||||
// If not in cache, create new entry and cache it
|
// If not in cache, create new entry and cache it
|
||||||
const auto patch_addr = c.offset();
|
const auto patch_addr = c.offset();
|
||||||
curr_patch->m_branch_to_patch_relocations.push_back({patch_addr, module_dest});
|
curr_patch->m_branch_to_patch_relocations.push_back({patch_addr, module_dest});
|
||||||
patch_cache.put(module_dest, patch_addr);
|
patch_cache.put(module_dest, patch_addr);
|
||||||
} else {
|
} else {
|
||||||
LOG_DEBUG(Core_ARM, "LRU cache disabled - creating direct patch for address {:#x}", module_dest);
|
LOG_DEBUG(Core_ARM, "LRU cache disabled - creating direct patch for address {:#x}",
|
||||||
|
module_dest);
|
||||||
// LRU disabled - use pre-LRU approach
|
// LRU disabled - use pre-LRU approach
|
||||||
curr_patch->m_branch_to_patch_relocations.push_back({c.offset(), module_dest});
|
curr_patch->m_branch_to_patch_relocations.push_back({c.offset(), module_dest});
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
#include "common/x64/cpu_wait.h"
|
#include "common/x64/cpu_wait.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "common/settings.h"
|
|
||||||
#include "common/microprofile.h"
|
#include "common/microprofile.h"
|
||||||
|
#include "common/settings.h"
|
||||||
#include "core/core_timing.h"
|
#include "core/core_timing.h"
|
||||||
#include "core/hardware_properties.h"
|
#include "core/hardware_properties.h"
|
||||||
|
|
||||||
|
@ -175,9 +175,9 @@ void CoreTiming::UnscheduleEvent(const std::shared_ptr<EventType>& event_type,
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreTiming::AddTicks(u64 ticks_to_add) {
|
void CoreTiming::AddTicks(u64 ticks_to_add) {
|
||||||
cpu_ticks = Settings::values.use_custom_cpu_ticks.GetValue()
|
cpu_ticks = Settings::values.use_custom_cpu_ticks.GetValue()
|
||||||
? Settings::values.cpu_ticks.GetValue()
|
? Settings::values.cpu_ticks.GetValue()
|
||||||
: cpu_ticks + ticks_to_add;
|
: cpu_ticks + ticks_to_add;
|
||||||
downcount -= static_cast<s64>(cpu_ticks);
|
downcount -= static_cast<s64>(cpu_ticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,22 +193,22 @@ u64 CoreTiming::GetClockTicks() const {
|
||||||
u64 fres;
|
u64 fres;
|
||||||
if (is_multicore) [[likely]] {
|
if (is_multicore) [[likely]] {
|
||||||
fres = clock->GetCNTPCT();
|
fres = clock->GetCNTPCT();
|
||||||
} else {
|
} else {
|
||||||
fres = Common::WallClock::CPUTickToCNTPCT(cpu_ticks);
|
fres = Common::WallClock::CPUTickToCNTPCT(cpu_ticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings::values.use_fast_cpu_time) {
|
if (Settings::values.use_fast_cpu_time) {
|
||||||
fres = (u64) ((double) fres
|
fres = (u64)((double)fres * (1.7 + 0.3 * (u32)Settings::values.fast_cpu_time.GetValue()));
|
||||||
* (1.7 + 0.3 * (u32) Settings::values.fast_cpu_time.GetValue()));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (Settings::values.sync_core_speed.GetValue()) {
|
if (Settings::values.sync_core_speed.GetValue()) {
|
||||||
const double ticks = static_cast<double>(fres);
|
const double ticks = static_cast<double>(fres);
|
||||||
const double speed_limit = static_cast<double>(Settings::values.speed_limit.GetValue())*0.01;
|
const double speed_limit =
|
||||||
return static_cast<u64>(ticks/speed_limit);
|
static_cast<double>(Settings::values.speed_limit.GetValue()) * 0.01;
|
||||||
} else {
|
return static_cast<u64>(ticks / speed_limit);
|
||||||
return fres;
|
} else {
|
||||||
}
|
return fres;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 CoreTiming::GetGPUTicks() const {
|
u64 CoreTiming::GetGPUTicks() const {
|
||||||
|
|
|
@ -29,8 +29,8 @@ constexpr std::array partition_names{
|
||||||
|
|
||||||
XCI::XCI(VirtualFile file_, u64 program_id, size_t program_index)
|
XCI::XCI(VirtualFile file_, u64 program_id, size_t program_index)
|
||||||
: file(std::move(file_)), program_nca_status{Loader::ResultStatus::ErrorXCIMissingProgramNCA},
|
: file(std::move(file_)), program_nca_status{Loader::ResultStatus::ErrorXCIMissingProgramNCA},
|
||||||
partitions(partition_names.size()),
|
partitions(partition_names.size()), partitions_raw(partition_names.size()),
|
||||||
partitions_raw(partition_names.size()), keys{Core::Crypto::KeyManager::Instance()} {
|
keys{Core::Crypto::KeyManager::Instance()} {
|
||||||
const auto header_status = TryReadHeader();
|
const auto header_status = TryReadHeader();
|
||||||
if (header_status != Loader::ResultStatus::Success) {
|
if (header_status != Loader::ResultStatus::Success) {
|
||||||
status = header_status;
|
status = header_status;
|
||||||
|
|
|
@ -87,12 +87,15 @@ private:
|
||||||
u32 m_value;
|
u32 m_value;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
constexpr PathFlags() : m_value(0) { /* ... */
|
constexpr PathFlags() : m_value(0) { /* ... */ }
|
||||||
}
|
|
||||||
|
|
||||||
#define DECLARE_PATH_FLAG_HANDLER(__WHICH__) \
|
#define DECLARE_PATH_FLAG_HANDLER(__WHICH__) \
|
||||||
constexpr bool Is##__WHICH__##Allowed() const { return (m_value & __WHICH__##Flag) != 0; } \
|
constexpr bool Is##__WHICH__##Allowed() const { \
|
||||||
constexpr void Allow##__WHICH__() { m_value |= __WHICH__##Flag; }
|
return (m_value & __WHICH__##Flag) != 0; \
|
||||||
|
} \
|
||||||
|
constexpr void Allow##__WHICH__() { \
|
||||||
|
m_value |= __WHICH__##Flag; \
|
||||||
|
}
|
||||||
|
|
||||||
DECLARE_PATH_FLAG_HANDLER(WindowsPath)
|
DECLARE_PATH_FLAG_HANDLER(WindowsPath)
|
||||||
DECLARE_PATH_FLAG_HANDLER(RelativePath)
|
DECLARE_PATH_FLAG_HANDLER(RelativePath)
|
||||||
|
|
|
@ -4,23 +4,18 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "core/file_sys/fssystem/fssystem_integrity_verification_storage.h"
|
|
||||||
#include "common/alignment.h"
|
#include "common/alignment.h"
|
||||||
|
#include "core/file_sys/fssystem/fssystem_integrity_verification_storage.h"
|
||||||
|
|
||||||
namespace FileSys {
|
namespace FileSys {
|
||||||
|
|
||||||
constexpr inline u32 ILog2(u32 val)
|
constexpr inline u32 ILog2(u32 val) {
|
||||||
{
|
|
||||||
ASSERT(val > 0);
|
ASSERT(val > 0);
|
||||||
return static_cast<u32>((sizeof(u32) * 8) - 1 - std::countl_zero<u32>(val));
|
return static_cast<u32>((sizeof(u32) * 8) - 1 - std::countl_zero<u32>(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntegrityVerificationStorage::Initialize(VirtualFile hs,
|
void IntegrityVerificationStorage::Initialize(VirtualFile hs, VirtualFile ds, s64 verif_block_size,
|
||||||
VirtualFile ds,
|
s64 upper_layer_verif_block_size, bool is_real_data) {
|
||||||
s64 verif_block_size,
|
|
||||||
s64 upper_layer_verif_block_size,
|
|
||||||
bool is_real_data)
|
|
||||||
{
|
|
||||||
// Validate preconditions.
|
// Validate preconditions.
|
||||||
ASSERT(verif_block_size >= HashSize);
|
ASSERT(verif_block_size >= HashSize);
|
||||||
|
|
||||||
|
@ -54,14 +49,12 @@ void IntegrityVerificationStorage::Initialize(VirtualFile hs,
|
||||||
m_is_real_data = is_real_data;
|
m_is_real_data = is_real_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntegrityVerificationStorage::Finalize()
|
void IntegrityVerificationStorage::Finalize() {
|
||||||
{
|
|
||||||
m_hash_storage = VirtualFile();
|
m_hash_storage = VirtualFile();
|
||||||
m_data_storage = VirtualFile();
|
m_data_storage = VirtualFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t IntegrityVerificationStorage::Read(u8* buffer, size_t size, size_t offset) const
|
size_t IntegrityVerificationStorage::Read(u8* buffer, size_t size, size_t offset) const {
|
||||||
{
|
|
||||||
// Succeed if zero size.
|
// Succeed if zero size.
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
return size;
|
return size;
|
||||||
|
@ -104,8 +97,7 @@ size_t IntegrityVerificationStorage::Read(u8* buffer, size_t size, size_t offset
|
||||||
return m_data_storage->Read(buffer, read_size, offset);
|
return m_data_storage->Read(buffer, read_size, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t IntegrityVerificationStorage::GetSize() const
|
size_t IntegrityVerificationStorage::GetSize() const {
|
||||||
{
|
|
||||||
return m_data_storage->GetSize();
|
return m_data_storage->GetSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -790,7 +790,9 @@ InstallResult RegisteredCache::RawInstallNCA(const NCA& nca, const VfsCopyFuncti
|
||||||
if (GetFileAtID(id) != nullptr) {
|
if (GetFileAtID(id) != nullptr) {
|
||||||
LOG_WARNING(Loader, "Overwriting existing NCA...");
|
LOG_WARNING(Loader, "Overwriting existing NCA...");
|
||||||
VirtualDir c_dir;
|
VirtualDir c_dir;
|
||||||
{ c_dir = dir->GetFileRelative(path)->GetContainingDirectory(); }
|
{
|
||||||
|
c_dir = dir->GetFileRelative(path)->GetContainingDirectory();
|
||||||
|
}
|
||||||
c_dir->DeleteFile(Common::FS::GetFilename(path));
|
c_dir->DeleteFile(Common::FS::GetFilename(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,7 @@ SDMCFactory::SDMCFactory(VirtualDir sd_dir_, VirtualDir sd_mod_dir_)
|
||||||
: sd_dir(std::move(sd_dir_)), sd_mod_dir(std::move(sd_mod_dir_)),
|
: sd_dir(std::move(sd_dir_)), sd_mod_dir(std::move(sd_mod_dir_)),
|
||||||
contents(std::make_unique<RegisteredCache>(
|
contents(std::make_unique<RegisteredCache>(
|
||||||
GetOrCreateDirectoryRelative(sd_dir, "/Nintendo/Contents/registered"),
|
GetOrCreateDirectoryRelative(sd_dir, "/Nintendo/Contents/registered"),
|
||||||
[](const VirtualFile& file, const NcaID& id) {
|
[](const VirtualFile& file, const NcaID& id) { return NAX{file, id}.GetDecrypted(); })),
|
||||||
return NAX{file, id}.GetDecrypted();
|
|
||||||
})),
|
|
||||||
placeholder(std::make_unique<PlaceholderCache>(
|
placeholder(std::make_unique<PlaceholderCache>(
|
||||||
GetOrCreateDirectoryRelative(sd_dir, "/Nintendo/Contents/placehld"))) {}
|
GetOrCreateDirectoryRelative(sd_dir, "/Nintendo/Contents/placehld"))) {}
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,9 @@
|
||||||
namespace FileSys {
|
namespace FileSys {
|
||||||
|
|
||||||
NSP::NSP(VirtualFile file_, u64 title_id_, std::size_t program_index_)
|
NSP::NSP(VirtualFile file_, u64 title_id_, std::size_t program_index_)
|
||||||
: file(std::move(file_)), expected_program_id(title_id_),
|
: file(std::move(file_)), expected_program_id(title_id_), program_index(program_index_),
|
||||||
program_index(program_index_), status{Loader::ResultStatus::Success},
|
status{Loader::ResultStatus::Success}, pfs(std::make_shared<PartitionFilesystem>(file)),
|
||||||
pfs(std::make_shared<PartitionFilesystem>(file)), keys{Core::Crypto::KeyManager::Instance()} {
|
keys{Core::Crypto::KeyManager::Instance()} {
|
||||||
if (pfs->GetStatus() != Loader::ResultStatus::Success) {
|
if (pfs->GetStatus() != Loader::ResultStatus::Success) {
|
||||||
status = pfs->GetStatus();
|
status = pfs->GetStatus();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -44,8 +44,8 @@ static bool CalculateHMAC256(Destination* out, const SourceKey* key, std::size_t
|
||||||
}
|
}
|
||||||
|
|
||||||
NAX::NAX(VirtualFile file_)
|
NAX::NAX(VirtualFile file_)
|
||||||
: header(std::make_unique<NAXHeader>()),
|
: header(std::make_unique<NAXHeader>()), file(std::move(file_)),
|
||||||
file(std::move(file_)), keys{Core::Crypto::KeyManager::Instance()} {
|
keys{Core::Crypto::KeyManager::Instance()} {
|
||||||
std::string path = Common::FS::SanitizePath(file->GetFullPath());
|
std::string path = Common::FS::SanitizePath(file->GetFullPath());
|
||||||
static const std::regex nax_path_regex("/registered/(000000[0-9A-F]{2})/([0-9A-F]{32})\\.nca",
|
static const std::regex nax_path_regex("/registered/(000000[0-9A-F]{2})/([0-9A-F]{32})\\.nca",
|
||||||
std::regex_constants::ECMAScript |
|
std::regex_constants::ECMAScript |
|
||||||
|
@ -62,8 +62,8 @@ NAX::NAX(VirtualFile file_)
|
||||||
}
|
}
|
||||||
|
|
||||||
NAX::NAX(VirtualFile file_, std::array<u8, 0x10> nca_id)
|
NAX::NAX(VirtualFile file_, std::array<u8, 0x10> nca_id)
|
||||||
: header(std::make_unique<NAXHeader>()),
|
: header(std::make_unique<NAXHeader>()), file(std::move(file_)),
|
||||||
file(std::move(file_)), keys{Core::Crypto::KeyManager::Instance()} {
|
keys{Core::Crypto::KeyManager::Instance()} {
|
||||||
Core::Crypto::SHA256Hash hash{};
|
Core::Crypto::SHA256Hash hash{};
|
||||||
mbedtls_sha256_ret(nca_id.data(), nca_id.size(), hash.data(), 0);
|
mbedtls_sha256_ret(nca_id.data(), nca_id.size(), hash.data(), 0);
|
||||||
status = Parse(fmt::format("/registered/000000{:02X}/{}.nca", hash[0],
|
status = Parse(fmt::format("/registered/000000{:02X}/{}.nca", hash[0],
|
||||||
|
|
|
@ -24,7 +24,9 @@ private:
|
||||||
friend class ::Kernel::KClassTokenGenerator; \
|
friend class ::Kernel::KClassTokenGenerator; \
|
||||||
static constexpr inline auto ObjectType = ::Kernel::KClassTokenGenerator::ObjectType::CLASS; \
|
static constexpr inline auto ObjectType = ::Kernel::KClassTokenGenerator::ObjectType::CLASS; \
|
||||||
static constexpr inline const char* const TypeName = #CLASS; \
|
static constexpr inline const char* const TypeName = #CLASS; \
|
||||||
static constexpr inline ClassTokenType ClassToken() { return ::Kernel::ClassToken<CLASS>; } \
|
static constexpr inline ClassTokenType ClassToken() { \
|
||||||
|
return ::Kernel::ClassToken<CLASS>; \
|
||||||
|
} \
|
||||||
\
|
\
|
||||||
public: \
|
public: \
|
||||||
YUZU_NON_COPYABLE(CLASS); \
|
YUZU_NON_COPYABLE(CLASS); \
|
||||||
|
@ -35,9 +37,15 @@ public:
|
||||||
constexpr ClassTokenType Token = ClassToken(); \
|
constexpr ClassTokenType Token = ClassToken(); \
|
||||||
return TypeObj(TypeName, Token); \
|
return TypeObj(TypeName, Token); \
|
||||||
} \
|
} \
|
||||||
static constexpr const char* GetStaticTypeName() { return TypeName; } \
|
static constexpr const char* GetStaticTypeName() { \
|
||||||
virtual TypeObj GetTypeObj() ATTRIBUTE { return GetStaticTypeObj(); } \
|
return TypeName; \
|
||||||
virtual const char* GetTypeName() ATTRIBUTE { return GetStaticTypeName(); } \
|
} \
|
||||||
|
virtual TypeObj GetTypeObj() ATTRIBUTE { \
|
||||||
|
return GetStaticTypeObj(); \
|
||||||
|
} \
|
||||||
|
virtual const char* GetTypeName() ATTRIBUTE { \
|
||||||
|
return GetStaticTypeName(); \
|
||||||
|
} \
|
||||||
\
|
\
|
||||||
private: \
|
private: \
|
||||||
constexpr bool operator!=(const TypeObj& rhs)
|
constexpr bool operator!=(const TypeObj& rhs)
|
||||||
|
|
|
@ -128,8 +128,8 @@ KVirtualAddress KMemoryRegionTree::GetRandomAlignedRegion(size_t size, size_t al
|
||||||
|
|
||||||
KMemoryLayout::KMemoryLayout()
|
KMemoryLayout::KMemoryLayout()
|
||||||
: m_virtual_tree{m_memory_region_allocator}, m_physical_tree{m_memory_region_allocator},
|
: m_virtual_tree{m_memory_region_allocator}, m_physical_tree{m_memory_region_allocator},
|
||||||
m_virtual_linear_tree{m_memory_region_allocator}, m_physical_linear_tree{
|
m_virtual_linear_tree{m_memory_region_allocator},
|
||||||
m_memory_region_allocator} {}
|
m_physical_linear_tree{m_memory_region_allocator} {}
|
||||||
|
|
||||||
void KMemoryLayout::InitializeLinearMemoryRegionTrees(KPhysicalAddress aligned_linear_phys_start,
|
void KMemoryLayout::InitializeLinearMemoryRegionTrees(KPhysicalAddress aligned_linear_phys_start,
|
||||||
KVirtualAddress linear_virtual_start) {
|
KVirtualAddress linear_virtual_start) {
|
||||||
|
|
|
@ -17,38 +17,32 @@ namespace Kernel {
|
||||||
class KThread;
|
class KThread;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
concept KPriorityQueueAffinityMask = !
|
concept KPriorityQueueAffinityMask = !std::is_reference_v<T> && requires(T& t) {
|
||||||
std::is_reference_v<T>&& requires(T& t) {
|
{ t.GetAffinityMask() } -> Common::ConvertibleTo<u64>;
|
||||||
{ t.GetAffinityMask() } -> Common::ConvertibleTo<u64>;
|
{ t.SetAffinityMask(0) };
|
||||||
{ t.SetAffinityMask(0) };
|
|
||||||
|
|
||||||
{ t.GetAffinity(0) } -> std::same_as<bool>;
|
{ t.GetAffinity(0) } -> std::same_as<bool>;
|
||||||
{ t.SetAffinity(0, false) };
|
{ t.SetAffinity(0, false) };
|
||||||
{ t.SetAll() };
|
{ t.SetAll() };
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
concept KPriorityQueueMember = !
|
concept KPriorityQueueMember = !std::is_reference_v<T> && requires(T& t) {
|
||||||
std::is_reference_v<T>&& requires(T& t) {
|
{ typename T::QueueEntry() };
|
||||||
{ typename T::QueueEntry() };
|
{ (typename T::QueueEntry()).Initialize() };
|
||||||
{ (typename T::QueueEntry()).Initialize() };
|
{ (typename T::QueueEntry()).SetPrev(std::addressof(t)) };
|
||||||
{ (typename T::QueueEntry()).SetPrev(std::addressof(t)) };
|
{ (typename T::QueueEntry()).SetNext(std::addressof(t)) };
|
||||||
{ (typename T::QueueEntry()).SetNext(std::addressof(t)) };
|
{ (typename T::QueueEntry()).GetNext() } -> std::same_as<T*>;
|
||||||
{ (typename T::QueueEntry()).GetNext() } -> std::same_as<T*>;
|
{ (typename T::QueueEntry()).GetPrev() } -> std::same_as<T*>;
|
||||||
{ (typename T::QueueEntry()).GetPrev() } -> std::same_as<T*>;
|
{ t.GetPriorityQueueEntry(0) } -> std::same_as<typename T::QueueEntry&>;
|
||||||
{
|
|
||||||
t.GetPriorityQueueEntry(0)
|
|
||||||
} -> std::same_as<typename T::QueueEntry&>;
|
|
||||||
|
|
||||||
{ t.GetAffinityMask() };
|
{ t.GetAffinityMask() };
|
||||||
{
|
{ std::remove_cvref_t<decltype(t.GetAffinityMask())>() } -> KPriorityQueueAffinityMask;
|
||||||
std::remove_cvref_t<decltype(t.GetAffinityMask())>()
|
|
||||||
} -> KPriorityQueueAffinityMask;
|
|
||||||
|
|
||||||
{ t.GetActiveCore() } -> Common::ConvertibleTo<s32>;
|
{ t.GetActiveCore() } -> Common::ConvertibleTo<s32>;
|
||||||
{ t.GetPriority() } -> Common::ConvertibleTo<s32>;
|
{ t.GetPriority() } -> Common::ConvertibleTo<s32>;
|
||||||
{ t.IsDummyThread() } -> Common::ConvertibleTo<bool>;
|
{ t.IsDummyThread() } -> Common::ConvertibleTo<bool>;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Member, size_t NumCores_, int LowestPriority, int HighestPriority>
|
template <typename Member, size_t NumCores_, int LowestPriority, int HighestPriority>
|
||||||
requires KPriorityQueueMember<Member>
|
requires KPriorityQueueMember<Member>
|
||||||
|
|
|
@ -84,7 +84,7 @@ private:
|
||||||
std::array<u64, 4> m_entropy{};
|
std::array<u64, 4> m_entropy{};
|
||||||
bool m_is_signaled{};
|
bool m_is_signaled{};
|
||||||
bool m_is_initialized{};
|
bool m_is_initialized{};
|
||||||
u32 m_pointer_buffer_size = 0x8000; // Default pointer buffer size (can be game-specific later)
|
u32 m_pointer_buffer_size = 0x8000; // Default pointer buffer size (can be game-specific later)
|
||||||
bool m_is_application{};
|
bool m_is_application{};
|
||||||
bool m_is_default_application_system_resource{};
|
bool m_is_default_application_system_resource{};
|
||||||
bool m_is_hbl{};
|
bool m_is_hbl{};
|
||||||
|
|
|
@ -10,11 +10,10 @@
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
concept KLockable = !
|
concept KLockable = !std::is_reference_v<T> && requires(T& t) {
|
||||||
std::is_reference_v<T>&& requires(T& t) {
|
{ t.Lock() } -> std::same_as<void>;
|
||||||
{ t.Lock() } -> std::same_as<void>;
|
{ t.Unlock() } -> std::same_as<void>;
|
||||||
{ t.Unlock() } -> std::same_as<void>;
|
};
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
requires KLockable<T>
|
requires KLockable<T>
|
||||||
|
|
|
@ -37,8 +37,8 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle
|
||||||
case InfoType::TotalNonSystemMemorySize:
|
case InfoType::TotalNonSystemMemorySize:
|
||||||
case InfoType::UsedNonSystemMemorySize:
|
case InfoType::UsedNonSystemMemorySize:
|
||||||
case InfoType::IsApplication:
|
case InfoType::IsApplication:
|
||||||
case InfoType::FreeThreadCount:
|
case InfoType::FreeThreadCount:
|
||||||
case InfoType::AliasRegionExtraSize: {
|
case InfoType::AliasRegionExtraSize: {
|
||||||
R_UNLESS(info_sub_id == 0, ResultInvalidEnumValue);
|
R_UNLESS(info_sub_id == 0, ResultInvalidEnumValue);
|
||||||
|
|
||||||
const auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable();
|
const auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable();
|
||||||
|
@ -135,10 +135,10 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle
|
||||||
}
|
}
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
|
|
||||||
case InfoType::AliasRegionExtraSize:
|
case InfoType::AliasRegionExtraSize:
|
||||||
// TODO (jarrodnorwell): do this when KIP's NPDM header is finished
|
// TODO (jarrodnorwell): do this when KIP's NPDM header is finished
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ enum class InfoType : u32 {
|
||||||
ThreadTickCount = 25,
|
ThreadTickCount = 25,
|
||||||
IsSvcPermitted = 26,
|
IsSvcPermitted = 26,
|
||||||
IoRegionHint = 27,
|
IoRegionHint = 27,
|
||||||
AliasRegionExtraSize = 28,
|
AliasRegionExtraSize = 28,
|
||||||
|
|
||||||
MesosphereMeta = 65000,
|
MesosphereMeta = 65000,
|
||||||
MesosphereCurrentProcess = 65001,
|
MesosphereCurrentProcess = 65001,
|
||||||
|
|
|
@ -458,9 +458,13 @@ constexpr inline Result __TmpCurrentResultReference = ResultSuccess;
|
||||||
if (true)
|
if (true)
|
||||||
|
|
||||||
#define R_CONVERT(catch_type, convert_type) \
|
#define R_CONVERT(catch_type, convert_type) \
|
||||||
R_CATCH(catch_type) { R_THROW(static_cast<Result>(convert_type)); }
|
R_CATCH(catch_type) { \
|
||||||
|
R_THROW(static_cast<Result>(convert_type)); \
|
||||||
|
}
|
||||||
|
|
||||||
#define R_CONVERT_ALL(convert_type) \
|
#define R_CONVERT_ALL(convert_type) \
|
||||||
R_CATCH_ALL() { R_THROW(static_cast<Result>(convert_type)); }
|
R_CATCH_ALL() { \
|
||||||
|
R_THROW(static_cast<Result>(convert_type)); \
|
||||||
|
}
|
||||||
|
|
||||||
#define R_ASSERT(res_expr) ASSERT(R_SUCCEEDED(res_expr))
|
#define R_ASSERT(res_expr) ASSERT(R_SUCCEEDED(res_expr))
|
||||||
|
|
|
@ -496,5 +496,4 @@ void ProfileManager::SetUserPosition(u64 position, Common::UUID uuid) {
|
||||||
WriteUserSaveFile();
|
WriteUserSaveFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}; // namespace Service::Account
|
}; // namespace Service::Account
|
||||||
|
|
|
@ -26,7 +26,7 @@ void Applet::UpdateSuspensionStateLocked(bool force_message) {
|
||||||
// Remove any forced resumption.
|
// Remove any forced resumption.
|
||||||
lifecycle_manager.RemoveForceResumeIfPossible();
|
lifecycle_manager.RemoveForceResumeIfPossible();
|
||||||
|
|
||||||
const bool update_requested_focus_state = lifecycle_manager.UpdateRequestedFocusState();
|
const bool update_requested_focus_state = lifecycle_manager.UpdateRequestedFocusState();
|
||||||
const bool curr_activity_runnable = lifecycle_manager.IsRunnable();
|
const bool curr_activity_runnable = lifecycle_manager.IsRunnable();
|
||||||
const bool prev_activity_runnable = is_activity_runnable;
|
const bool prev_activity_runnable = is_activity_runnable;
|
||||||
const bool was_changed = curr_activity_runnable != prev_activity_runnable;
|
const bool was_changed = curr_activity_runnable != prev_activity_runnable;
|
||||||
|
@ -36,7 +36,7 @@ void Applet::UpdateSuspensionStateLocked(bool force_message) {
|
||||||
process->Suspend(false);
|
process->Suspend(false);
|
||||||
} else {
|
} else {
|
||||||
process->Suspend(true);
|
process->Suspend(true);
|
||||||
lifecycle_manager.RequestResumeNotification();
|
lifecycle_manager.RequestResumeNotification();
|
||||||
}
|
}
|
||||||
|
|
||||||
is_activity_runnable = curr_activity_runnable;
|
is_activity_runnable = curr_activity_runnable;
|
||||||
|
|
|
@ -18,9 +18,8 @@ namespace Service::AM::Frontend {
|
||||||
|
|
||||||
Cabinet::Cabinet(Core::System& system_, std::shared_ptr<Applet> applet_,
|
Cabinet::Cabinet(Core::System& system_, std::shared_ptr<Applet> applet_,
|
||||||
LibraryAppletMode applet_mode_, const Core::Frontend::CabinetApplet& frontend_)
|
LibraryAppletMode applet_mode_, const Core::Frontend::CabinetApplet& frontend_)
|
||||||
: FrontendApplet{system_, applet_, applet_mode_}, frontend{frontend_}, service_context{
|
: FrontendApplet{system_, applet_, applet_mode_}, frontend{frontend_},
|
||||||
system_,
|
service_context{system_, "CabinetApplet"} {
|
||||||
"CabinetApplet"} {
|
|
||||||
|
|
||||||
availability_change_event =
|
availability_change_event =
|
||||||
service_context.CreateEvent("CabinetApplet:AvailabilityChangeEvent");
|
service_context.CreateEvent("CabinetApplet:AvailabilityChangeEvent");
|
||||||
|
|
|
@ -15,7 +15,9 @@
|
||||||
|
|
||||||
namespace Service::AM::Frontend {
|
namespace Service::AM::Frontend {
|
||||||
|
|
||||||
NetConnect::NetConnect(Core::System& system_, std::shared_ptr<Applet> applet_, LibraryAppletMode applet_mode_, const Core::Frontend::NetConnectApplet& frontend_)
|
NetConnect::NetConnect(Core::System& system_, std::shared_ptr<Applet> applet_,
|
||||||
|
LibraryAppletMode applet_mode_,
|
||||||
|
const Core::Frontend::NetConnectApplet& frontend_)
|
||||||
: FrontendApplet{system_, applet_, applet_mode_}, frontend{frontend_} {}
|
: FrontendApplet{system_, applet_, applet_mode_}, frontend{frontend_} {}
|
||||||
|
|
||||||
NetConnect::~NetConnect() = default;
|
NetConnect::~NetConnect() = default;
|
||||||
|
|
|
@ -14,8 +14,8 @@ namespace Service::AM::Frontend {
|
||||||
class NetConnect final : public FrontendApplet {
|
class NetConnect final : public FrontendApplet {
|
||||||
public:
|
public:
|
||||||
explicit NetConnect(Core::System& system_, std::shared_ptr<Applet> applet_,
|
explicit NetConnect(Core::System& system_, std::shared_ptr<Applet> applet_,
|
||||||
LibraryAppletMode applet_mode_,
|
LibraryAppletMode applet_mode_,
|
||||||
const Core::Frontend::NetConnectApplet& frontend_);
|
const Core::Frontend::NetConnectApplet& frontend_);
|
||||||
~NetConnect() override;
|
~NetConnect() override;
|
||||||
|
|
||||||
void Initialize() override;
|
void Initialize() override;
|
||||||
|
|
|
@ -85,7 +85,8 @@ FrontendAppletSet::FrontendAppletSet(CabinetApplet cabinet_applet,
|
||||||
MiiEdit mii_edit_,
|
MiiEdit mii_edit_,
|
||||||
ParentalControlsApplet parental_controls_applet,
|
ParentalControlsApplet parental_controls_applet,
|
||||||
PhotoViewer photo_viewer_, ProfileSelect profile_select_,
|
PhotoViewer photo_viewer_, ProfileSelect profile_select_,
|
||||||
SoftwareKeyboard software_keyboard_, WebBrowser web_browser_, NetConnect net_connect_)
|
SoftwareKeyboard software_keyboard_, WebBrowser web_browser_,
|
||||||
|
NetConnect net_connect_)
|
||||||
: cabinet{std::move(cabinet_applet)}, controller{std::move(controller_applet)},
|
: cabinet{std::move(cabinet_applet)}, controller{std::move(controller_applet)},
|
||||||
error{std::move(error_applet)}, mii_edit{std::move(mii_edit_)},
|
error{std::move(error_applet)}, mii_edit{std::move(mii_edit_)},
|
||||||
parental_controls{std::move(parental_controls_applet)},
|
parental_controls{std::move(parental_controls_applet)},
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
#include "common/swap.h"
|
#include "common/swap.h"
|
||||||
#include "core/hle/service/am/applet.h"
|
|
||||||
#include "core/frontend/applets/net_connect.h"
|
#include "core/frontend/applets/net_connect.h"
|
||||||
|
#include "core/hle/service/am/applet.h"
|
||||||
|
|
||||||
union Result;
|
union Result;
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ std::unique_ptr<Process> CreateApplicationProcess(std::vector<u8>& out_control,
|
||||||
out_control = nacp.GetRawBytes();
|
out_control = nacp.GetRawBytes();
|
||||||
} else {
|
} else {
|
||||||
out_control.resize(sizeof(FileSys::RawNACP));
|
out_control.resize(sizeof(FileSys::RawNACP));
|
||||||
std::fill(out_control.begin(), out_control.end(), (u8) 0);
|
std::fill(out_control.begin(), out_control.end(), (u8)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& storage = system.GetContentProviderUnion();
|
auto& storage = system.GetContentProviderUnion();
|
||||||
|
|
|
@ -18,8 +18,8 @@ namespace Service::AM {
|
||||||
|
|
||||||
IApplicationProxy::IApplicationProxy(Core::System& system_, std::shared_ptr<Applet> applet,
|
IApplicationProxy::IApplicationProxy(Core::System& system_, std::shared_ptr<Applet> applet,
|
||||||
Kernel::KProcess* process, WindowSystem& window_system)
|
Kernel::KProcess* process, WindowSystem& window_system)
|
||||||
: ServiceFramework{system_, "IApplicationProxy"},
|
: ServiceFramework{system_, "IApplicationProxy"}, m_window_system{window_system},
|
||||||
m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} {
|
m_process{process}, m_applet{std::move(applet)} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, D<&IApplicationProxy::GetCommonStateGetter>, "GetCommonStateGetter"},
|
{0, D<&IApplicationProxy::GetCommonStateGetter>, "GetCommonStateGetter"},
|
||||||
|
|
|
@ -20,7 +20,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Result GetLastForegroundCaptureImageEx(Out<bool> out_was_written,
|
Result GetLastForegroundCaptureImageEx(Out<bool> out_was_written,
|
||||||
OutBuffer<BufferAttr_HipcMapAlias> out_image_data);
|
OutBuffer<BufferAttr_HipcMapAlias> out_image_data);
|
||||||
Result GetCallerAppletCaptureImageEx(Out<bool> out_was_written,
|
Result GetCallerAppletCaptureImageEx(Out<bool> out_was_written,
|
||||||
OutBuffer<BufferAttr_HipcMapAlias> out_image_data);
|
OutBuffer<BufferAttr_HipcMapAlias> out_image_data);
|
||||||
Result TakeScreenShotOfOwnLayer(bool unknown0, s32 fbshare_layer_index);
|
Result TakeScreenShotOfOwnLayer(bool unknown0, s32 fbshare_layer_index);
|
||||||
|
|
|
@ -101,12 +101,12 @@ Result ILibraryAppletAccessor::PushInData(SharedPointer<IStorage> storage) {
|
||||||
|
|
||||||
Result ILibraryAppletAccessor::PopOutData(Out<SharedPointer<IStorage>> out_storage) {
|
Result ILibraryAppletAccessor::PopOutData(Out<SharedPointer<IStorage>> out_storage) {
|
||||||
LOG_DEBUG(Service_AM, "called");
|
LOG_DEBUG(Service_AM, "called");
|
||||||
if (auto caller_applet = m_applet->caller_applet.lock(); caller_applet) {
|
if (auto caller_applet = m_applet->caller_applet.lock(); caller_applet) {
|
||||||
Event m_system_event = caller_applet->lifecycle_manager.GetSystemEvent();
|
Event m_system_event = caller_applet->lifecycle_manager.GetSystemEvent();
|
||||||
m_system_event.Signal();
|
m_system_event.Signal();
|
||||||
caller_applet->lifecycle_manager.RequestResumeNotification();
|
caller_applet->lifecycle_manager.RequestResumeNotification();
|
||||||
m_system_event.Clear();
|
m_system_event.Clear();
|
||||||
}
|
}
|
||||||
R_RETURN(m_broker->GetOutData().Pop(out_storage.Get()));
|
R_RETURN(m_broker->GetOutData().Pop(out_storage.Get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -167,8 +167,8 @@ std::shared_ptr<ILibraryAppletAccessor> CreateFrontendApplet(Core::System& syste
|
||||||
|
|
||||||
ILibraryAppletCreator::ILibraryAppletCreator(Core::System& system_, std::shared_ptr<Applet> applet,
|
ILibraryAppletCreator::ILibraryAppletCreator(Core::System& system_, std::shared_ptr<Applet> applet,
|
||||||
WindowSystem& window_system)
|
WindowSystem& window_system)
|
||||||
: ServiceFramework{system_, "ILibraryAppletCreator"},
|
: ServiceFramework{system_, "ILibraryAppletCreator"}, m_window_system{window_system},
|
||||||
m_window_system{window_system}, m_applet{std::move(applet)} {
|
m_applet{std::move(applet)} {
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, D<&ILibraryAppletCreator::CreateLibraryApplet>, "CreateLibraryApplet"},
|
{0, D<&ILibraryAppletCreator::CreateLibraryApplet>, "CreateLibraryApplet"},
|
||||||
{1, nullptr, "TerminateAllLibraryApplets"},
|
{1, nullptr, "TerminateAllLibraryApplets"},
|
||||||
|
|
|
@ -20,8 +20,8 @@ namespace Service::AM {
|
||||||
|
|
||||||
ILibraryAppletProxy::ILibraryAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet,
|
ILibraryAppletProxy::ILibraryAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet,
|
||||||
Kernel::KProcess* process, WindowSystem& window_system)
|
Kernel::KProcess* process, WindowSystem& window_system)
|
||||||
: ServiceFramework{system_, "ILibraryAppletProxy"},
|
: ServiceFramework{system_, "ILibraryAppletProxy"}, m_window_system{window_system},
|
||||||
m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} {
|
m_process{process}, m_applet{std::move(applet)} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, D<&ILibraryAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"},
|
{0, D<&ILibraryAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"},
|
||||||
|
|
|
@ -16,8 +16,8 @@ namespace Service::AM {
|
||||||
|
|
||||||
ISelfController::ISelfController(Core::System& system_, std::shared_ptr<Applet> applet,
|
ISelfController::ISelfController(Core::System& system_, std::shared_ptr<Applet> applet,
|
||||||
Kernel::KProcess* process)
|
Kernel::KProcess* process)
|
||||||
: ServiceFramework{system_, "ISelfController"}, m_process{process}, m_applet{
|
: ServiceFramework{system_, "ISelfController"}, m_process{process},
|
||||||
std::move(applet)} {
|
m_applet{std::move(applet)} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, D<&ISelfController::Exit>, "Exit"},
|
{0, D<&ISelfController::Exit>, "Exit"},
|
||||||
|
|
|
@ -20,8 +20,8 @@ namespace Service::AM {
|
||||||
|
|
||||||
ISystemAppletProxy::ISystemAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet,
|
ISystemAppletProxy::ISystemAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet,
|
||||||
Kernel::KProcess* process, WindowSystem& window_system)
|
Kernel::KProcess* process, WindowSystem& window_system)
|
||||||
: ServiceFramework{system_, "ISystemAppletProxy"},
|
: ServiceFramework{system_, "ISystemAppletProxy"}, m_window_system{window_system},
|
||||||
m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} {
|
m_process{process}, m_applet{std::move(applet)} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, D<&ISystemAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"},
|
{0, D<&ISystemAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"},
|
||||||
|
|
|
@ -11,8 +11,8 @@ namespace Service::AM {
|
||||||
|
|
||||||
IWindowController::IWindowController(Core::System& system_, std::shared_ptr<Applet> applet,
|
IWindowController::IWindowController(Core::System& system_, std::shared_ptr<Applet> applet,
|
||||||
WindowSystem& window_system)
|
WindowSystem& window_system)
|
||||||
: ServiceFramework{system_, "IWindowController"},
|
: ServiceFramework{system_, "IWindowController"}, m_window_system{window_system},
|
||||||
m_window_system{window_system}, m_applet{std::move(applet)} {
|
m_applet{std::move(applet)} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, nullptr, "CreateWindow"},
|
{0, nullptr, "CreateWindow"},
|
||||||
|
|
|
@ -9,8 +9,8 @@ namespace Service::AOC {
|
||||||
constexpr Result ResultNoPurchasedProductInfoAvailable{ErrorModule::NIMShop, 400};
|
constexpr Result ResultNoPurchasedProductInfoAvailable{ErrorModule::NIMShop, 400};
|
||||||
|
|
||||||
IPurchaseEventManager::IPurchaseEventManager(Core::System& system_)
|
IPurchaseEventManager::IPurchaseEventManager(Core::System& system_)
|
||||||
: ServiceFramework{system_, "IPurchaseEventManager"}, service_context{system,
|
: ServiceFramework{system_, "IPurchaseEventManager"},
|
||||||
"IPurchaseEventManager"} {
|
service_context{system, "IPurchaseEventManager"} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, D<&IPurchaseEventManager::SetDefaultDeliveryTarget>, "SetDefaultDeliveryTarget"},
|
{0, D<&IPurchaseEventManager::SetDefaultDeliveryTarget>, "SetDefaultDeliveryTarget"},
|
||||||
|
|
|
@ -12,9 +12,8 @@ IAudioIn::IAudioIn(Core::System& system_, Manager& manager, size_t session_id,
|
||||||
const std::string& device_name, const AudioInParameter& in_params,
|
const std::string& device_name, const AudioInParameter& in_params,
|
||||||
Kernel::KProcess* handle, u64 applet_resource_user_id)
|
Kernel::KProcess* handle, u64 applet_resource_user_id)
|
||||||
: ServiceFramework{system_, "IAudioIn"}, process{handle}, service_context{system_, "IAudioIn"},
|
: ServiceFramework{system_, "IAudioIn"}, process{handle}, service_context{system_, "IAudioIn"},
|
||||||
event{service_context.CreateEvent("AudioInEvent")}, impl{std::make_shared<In>(system_,
|
event{service_context.CreateEvent("AudioInEvent")},
|
||||||
manager, event,
|
impl{std::make_shared<In>(system_, manager, event, session_id)} {
|
||||||
session_id)} {
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, D<&IAudioIn::GetAudioInState>, "GetAudioInState"},
|
{0, D<&IAudioIn::GetAudioInState>, "GetAudioInState"},
|
||||||
|
|
|
@ -10,8 +10,8 @@ namespace Service::Audio {
|
||||||
using namespace AudioCore::AudioIn;
|
using namespace AudioCore::AudioIn;
|
||||||
|
|
||||||
IAudioInManager::IAudioInManager(Core::System& system_)
|
IAudioInManager::IAudioInManager(Core::System& system_)
|
||||||
: ServiceFramework{system_, "audin:u"}, impl{std::make_unique<AudioCore::AudioIn::Manager>(
|
: ServiceFramework{system_, "audin:u"},
|
||||||
system_)} {
|
impl{std::make_unique<AudioCore::AudioIn::Manager>(system_)} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, D<&IAudioInManager::ListAudioIns>, "ListAudioIns"},
|
{0, D<&IAudioInManager::ListAudioIns>, "ListAudioIns"},
|
||||||
|
|
|
@ -14,8 +14,8 @@ IAudioRenderer::IAudioRenderer(Core::System& system_, Manager& manager_,
|
||||||
s32 session_id)
|
s32 session_id)
|
||||||
: ServiceFramework{system_, "IAudioRenderer"}, service_context{system_, "IAudioRenderer"},
|
: ServiceFramework{system_, "IAudioRenderer"}, service_context{system_, "IAudioRenderer"},
|
||||||
rendered_event{service_context.CreateEvent("IAudioRendererEvent")}, manager{manager_},
|
rendered_event{service_context.CreateEvent("IAudioRendererEvent")}, manager{manager_},
|
||||||
impl{std::make_unique<Renderer>(system_, manager, rendered_event)}, process_handle{
|
impl{std::make_unique<Renderer>(system_, manager, rendered_event)},
|
||||||
process_handle_} {
|
process_handle{process_handle_} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, D<&IAudioRenderer::GetSampleRate>, "GetSampleRate"},
|
{0, D<&IAudioRenderer::GetSampleRate>, "GetSampleRate"},
|
||||||
|
|
|
@ -7,9 +7,8 @@
|
||||||
namespace Service::News {
|
namespace Service::News {
|
||||||
|
|
||||||
INewlyArrivedEventHolder::INewlyArrivedEventHolder(Core::System& system_)
|
INewlyArrivedEventHolder::INewlyArrivedEventHolder(Core::System& system_)
|
||||||
: ServiceFramework{system_, "INewlyArrivedEventHolder"}, service_context{
|
: ServiceFramework{system_, "INewlyArrivedEventHolder"},
|
||||||
system_,
|
service_context{system_, "INewlyArrivedEventHolder"} {
|
||||||
"INewlyArrivedEventHolder"} {
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, D<&INewlyArrivedEventHolder::Get>, "Get"},
|
{0, D<&INewlyArrivedEventHolder::Get>, "Get"},
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
namespace Service::News {
|
namespace Service::News {
|
||||||
|
|
||||||
IOverwriteEventHolder::IOverwriteEventHolder(Core::System& system_)
|
IOverwriteEventHolder::IOverwriteEventHolder(Core::System& system_)
|
||||||
: ServiceFramework{system_, "IOverwriteEventHolder"}, service_context{system_,
|
: ServiceFramework{system_, "IOverwriteEventHolder"},
|
||||||
"IOverwriteEventHolder"} {
|
service_context{system_, "IOverwriteEventHolder"} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, D<&IOverwriteEventHolder::Get>, "Get"},
|
{0, D<&IOverwriteEventHolder::Get>, "Get"},
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
namespace Service::FileSystem {
|
namespace Service::FileSystem {
|
||||||
|
|
||||||
IFileSystem::IFileSystem(Core::System& system_, FileSys::VirtualDir dir_, SizeGetter size_getter_)
|
IFileSystem::IFileSystem(Core::System& system_, FileSys::VirtualDir dir_, SizeGetter size_getter_)
|
||||||
: ServiceFramework{system_, "IFileSystem"}, backend{std::make_unique<FileSys::Fsa::IFileSystem>(
|
: ServiceFramework{system_, "IFileSystem"},
|
||||||
dir_)},
|
backend{std::make_unique<FileSys::Fsa::IFileSystem>(dir_)},
|
||||||
size_getter{std::move(size_getter_)} {
|
size_getter{std::move(size_getter_)} {
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, D<&IFileSystem::CreateFile>, "CreateFile"},
|
{0, D<&IFileSystem::CreateFile>, "CreateFile"},
|
||||||
|
|
|
@ -12,8 +12,8 @@ namespace Service::FileSystem {
|
||||||
ISaveDataInfoReader::ISaveDataInfoReader(Core::System& system_,
|
ISaveDataInfoReader::ISaveDataInfoReader(Core::System& system_,
|
||||||
std::shared_ptr<SaveDataController> save_data_controller_,
|
std::shared_ptr<SaveDataController> save_data_controller_,
|
||||||
FileSys::SaveDataSpaceId space)
|
FileSys::SaveDataSpaceId space)
|
||||||
: ServiceFramework{system_, "ISaveDataInfoReader"}, save_data_controller{
|
: ServiceFramework{system_, "ISaveDataInfoReader"},
|
||||||
save_data_controller_} {
|
save_data_controller{save_data_controller_} {
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, D<&ISaveDataInfoReader::ReadSaveDataInfo>, "ReadSaveDataInfo"},
|
{0, D<&ISaveDataInfoReader::ReadSaveDataInfo>, "ReadSaveDataInfo"},
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
namespace Service::Glue::Time {
|
namespace Service::Glue::Time {
|
||||||
|
|
||||||
AlarmWorker::AlarmWorker(Core::System& system, StandardSteadyClockResource& steady_clock_resource)
|
AlarmWorker::AlarmWorker(Core::System& system, StandardSteadyClockResource& steady_clock_resource)
|
||||||
: m_system{system}, m_ctx{system, "Glue:AlarmWorker"}, m_steady_clock_resource{
|
: m_system{system}, m_ctx{system, "Glue:AlarmWorker"},
|
||||||
steady_clock_resource} {}
|
m_steady_clock_resource{steady_clock_resource} {}
|
||||||
|
|
||||||
AlarmWorker::~AlarmWorker() {
|
AlarmWorker::~AlarmWorker() {
|
||||||
m_system.CoreTiming().UnscheduleEvent(m_timer_timing_event);
|
m_system.CoreTiming().UnscheduleEvent(m_timer_timing_event);
|
||||||
|
|
|
@ -87,10 +87,8 @@ static Service::PSC::Time::LocationName GetTimeZoneString(
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeManager::TimeManager(Core::System& system)
|
TimeManager::TimeManager(Core::System& system)
|
||||||
: m_steady_clock_resource{system}, m_time_zone_binary{system}, m_worker{
|
: m_steady_clock_resource{system}, m_time_zone_binary{system},
|
||||||
system,
|
m_worker{system, m_steady_clock_resource, m_file_timestamp_worker} {
|
||||||
m_steady_clock_resource,
|
|
||||||
m_file_timestamp_worker} {
|
|
||||||
m_time_m =
|
m_time_m =
|
||||||
system.ServiceManager().GetService<Service::PSC::Time::ServiceManager>("time:m", true);
|
system.ServiceManager().GetService<Service::PSC::Time::ServiceManager>("time:m", true);
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,9 @@ TimeZoneService::TimeZoneService(
|
||||||
std::shared_ptr<Service::PSC::Time::TimeZoneService> time_zone_service)
|
std::shared_ptr<Service::PSC::Time::TimeZoneService> time_zone_service)
|
||||||
: ServiceFramework{system_, "ITimeZoneService"}, m_system{system},
|
: ServiceFramework{system_, "ITimeZoneService"}, m_system{system},
|
||||||
m_can_write_timezone_device_location{can_write_timezone_device_location},
|
m_can_write_timezone_device_location{can_write_timezone_device_location},
|
||||||
m_file_timestamp_worker{file_timestamp_worker}, m_wrapped_service{std::move(
|
m_file_timestamp_worker{file_timestamp_worker},
|
||||||
time_zone_service)},
|
m_wrapped_service{std::move(time_zone_service)}, m_operation_event{m_system},
|
||||||
m_operation_event{m_system}, m_time_zone_binary{time_zone_binary} {
|
m_time_zone_binary{time_zone_binary} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, D<&TimeZoneService::GetDeviceLocationName>, "GetDeviceLocationName"},
|
{0, D<&TimeZoneService::GetDeviceLocationName>, "GetDeviceLocationName"},
|
||||||
|
|
|
@ -19,11 +19,11 @@ namespace Service::Glue::Time {
|
||||||
|
|
||||||
TimeWorker::TimeWorker(Core::System& system, StandardSteadyClockResource& steady_clock_resource,
|
TimeWorker::TimeWorker(Core::System& system, StandardSteadyClockResource& steady_clock_resource,
|
||||||
FileTimestampWorker& file_timestamp_worker)
|
FileTimestampWorker& file_timestamp_worker)
|
||||||
: m_system{system}, m_ctx{m_system, "Glue:TimeWorker"}, m_event{m_ctx.CreateEvent(
|
: m_system{system}, m_ctx{m_system, "Glue:TimeWorker"},
|
||||||
"Glue:TimeWorker:Event")},
|
m_event{m_ctx.CreateEvent("Glue:TimeWorker:Event")},
|
||||||
m_steady_clock_resource{steady_clock_resource},
|
m_steady_clock_resource{steady_clock_resource},
|
||||||
m_file_timestamp_worker{file_timestamp_worker}, m_timer_steady_clock{m_ctx.CreateEvent(
|
m_file_timestamp_worker{file_timestamp_worker},
|
||||||
"Glue:TimeWorker:SteadyClockTimerEvent")},
|
m_timer_steady_clock{m_ctx.CreateEvent("Glue:TimeWorker:SteadyClockTimerEvent")},
|
||||||
m_timer_file_system{m_ctx.CreateEvent("Glue:TimeWorker:FileTimeTimerEvent")},
|
m_timer_file_system{m_ctx.CreateEvent("Glue:TimeWorker:FileTimeTimerEvent")},
|
||||||
m_alarm_worker{m_system, m_steady_clock_resource}, m_pm_state_change_handler{m_alarm_worker} {
|
m_alarm_worker{m_system, m_steady_clock_resource}, m_pm_state_change_handler{m_alarm_worker} {
|
||||||
m_timer_steady_clock_timing_event = Core::Timing::CreateEvent(
|
m_timer_steady_clock_timing_event = Core::Timing::CreateEvent(
|
||||||
|
|
|
@ -17,8 +17,8 @@ namespace Service::HID {
|
||||||
|
|
||||||
IHidDebugServer::IHidDebugServer(Core::System& system_, std::shared_ptr<ResourceManager> resource,
|
IHidDebugServer::IHidDebugServer(Core::System& system_, std::shared_ptr<ResourceManager> resource,
|
||||||
std::shared_ptr<HidFirmwareSettings> settings)
|
std::shared_ptr<HidFirmwareSettings> settings)
|
||||||
: ServiceFramework{system_, "hid:dbg"}, resource_manager{resource}, firmware_settings{
|
: ServiceFramework{system_, "hid:dbg"}, resource_manager{resource},
|
||||||
settings} {
|
firmware_settings{settings} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, nullptr, "DeactivateDebugPad"},
|
{0, nullptr, "DeactivateDebugPad"},
|
||||||
|
|
|
@ -587,10 +587,8 @@ Result IHidServer::ActivateGesture(u32 basic_gesture_id, ClientAppletResourceUse
|
||||||
|
|
||||||
Result IHidServer::SetGestureOutputRanges(u32 param1, u32 param2, u32 param3, u32 param4) {
|
Result IHidServer::SetGestureOutputRanges(u32 param1, u32 param2, u32 param3, u32 param4) {
|
||||||
// https://switchbrew.org/wiki/HID_services , Undocumented. 92 [18.0.0+] SetGestureOutputRanges
|
// https://switchbrew.org/wiki/HID_services , Undocumented. 92 [18.0.0+] SetGestureOutputRanges
|
||||||
LOG_WARNING(
|
LOG_WARNING(Service_HID, "(STUBBED) called, param1={}, param2={}, param3={}, param4={}", param1,
|
||||||
Service_HID,
|
param2, param3, param4);
|
||||||
"(STUBBED) called, param1={}, param2={}, param3={}, param4={}",
|
|
||||||
param1, param2, param3, param4);
|
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,8 +72,8 @@ public:
|
||||||
u32 num_handles_to_copy_ = 0, u32 num_objects_to_move_ = 0,
|
u32 num_handles_to_copy_ = 0, u32 num_objects_to_move_ = 0,
|
||||||
Flags flags = Flags::None)
|
Flags flags = Flags::None)
|
||||||
: RequestHelperBase(ctx), normal_params_size(normal_params_size_),
|
: RequestHelperBase(ctx), normal_params_size(normal_params_size_),
|
||||||
num_handles_to_copy(num_handles_to_copy_),
|
num_handles_to_copy(num_handles_to_copy_), num_objects_to_move(num_objects_to_move_),
|
||||||
num_objects_to_move(num_objects_to_move_), kernel{ctx.kernel} {
|
kernel{ctx.kernel} {
|
||||||
|
|
||||||
memset(cmdbuf, 0, sizeof(u32) * IPC::COMMAND_BUFFER_LENGTH);
|
memset(cmdbuf, 0, sizeof(u32) * IPC::COMMAND_BUFFER_LENGTH);
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,8 @@ class DynarmicCallbacks64 : public Dynarmic::A64::UserCallbacks {
|
||||||
public:
|
public:
|
||||||
explicit DynarmicCallbacks64(Core::Memory::Memory& memory_, std::vector<u8>& local_memory_,
|
explicit DynarmicCallbacks64(Core::Memory::Memory& memory_, std::vector<u8>& local_memory_,
|
||||||
IntervalSet& mapped_ranges_, JITContextImpl& parent_)
|
IntervalSet& mapped_ranges_, JITContextImpl& parent_)
|
||||||
: memory{memory_}, local_memory{local_memory_},
|
: memory{memory_}, local_memory{local_memory_}, mapped_ranges{mapped_ranges_},
|
||||||
mapped_ranges{mapped_ranges_}, parent{parent_} {}
|
parent{parent_} {}
|
||||||
|
|
||||||
u8 MemoryRead8(u64 vaddr) override {
|
u8 MemoryRead8(u64 vaddr) override {
|
||||||
return ReadMemory<u8>(vaddr);
|
return ReadMemory<u8>(vaddr);
|
||||||
|
|
|
@ -37,7 +37,7 @@ void LanStation::OverrideInfo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
LANDiscovery::LANDiscovery()
|
LANDiscovery::LANDiscovery()
|
||||||
: stations({{{1, this}, {2, this}, {3, this}, {4, this}, {5, this}, {6, this}, {7, this}}}){}
|
: stations({{{1, this}, {2, this}, {3, this}, {4, this}, {5, this}, {6, this}, {7, this}}}) {}
|
||||||
|
|
||||||
LANDiscovery::~LANDiscovery() {
|
LANDiscovery::~LANDiscovery() {
|
||||||
if (inited) {
|
if (inited) {
|
||||||
|
|
|
@ -24,8 +24,7 @@ namespace Service::LDN {
|
||||||
|
|
||||||
IUserLocalCommunicationService::IUserLocalCommunicationService(Core::System& system_)
|
IUserLocalCommunicationService::IUserLocalCommunicationService(Core::System& system_)
|
||||||
: ServiceFramework{system_, "IUserLocalCommunicationService"},
|
: ServiceFramework{system_, "IUserLocalCommunicationService"},
|
||||||
service_context{system, "IUserLocalCommunicationService"},
|
service_context{system, "IUserLocalCommunicationService"}, lan_discovery{} {
|
||||||
lan_discovery{} {
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, C<&IUserLocalCommunicationService::GetState>, "GetState"},
|
{0, C<&IUserLocalCommunicationService::GetState>, "GetState"},
|
||||||
|
|
|
@ -23,8 +23,8 @@ class IDatabaseService final : public ServiceFramework<IDatabaseService> {
|
||||||
public:
|
public:
|
||||||
explicit IDatabaseService(Core::System& system_, std::shared_ptr<MiiManager> mii_manager,
|
explicit IDatabaseService(Core::System& system_, std::shared_ptr<MiiManager> mii_manager,
|
||||||
bool is_system_)
|
bool is_system_)
|
||||||
: ServiceFramework{system_, "IDatabaseService"}, manager{mii_manager}, is_system{
|
: ServiceFramework{system_, "IDatabaseService"}, manager{mii_manager},
|
||||||
is_system_} {
|
is_system{is_system_} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, D<&IDatabaseService::IsUpdated>, "IsUpdated"},
|
{0, D<&IDatabaseService::IsUpdated>, "IsUpdated"},
|
||||||
|
|
|
@ -7,43 +7,43 @@
|
||||||
#include "core/hle/service/server_manager.h"
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/sm/sm.h"
|
#include "core/hle/service/sm/sm.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace Service::MM {
|
namespace Service::MM {
|
||||||
enum class Module : u32 {
|
enum class Module : u32 {
|
||||||
CPU = 0,
|
CPU = 0,
|
||||||
GPU = 1,
|
GPU = 1,
|
||||||
EMC = 2,
|
EMC = 2,
|
||||||
SYS_BUS = 3,
|
SYS_BUS = 3,
|
||||||
M_SELECT = 4,
|
M_SELECT = 4,
|
||||||
NVDEC = 5,
|
NVDEC = 5,
|
||||||
NVENC = 6,
|
NVENC = 6,
|
||||||
NVJPG = 7,
|
NVJPG = 7,
|
||||||
TEST = 8
|
TEST = 8
|
||||||
};
|
};
|
||||||
|
|
||||||
class Session {
|
class Session {
|
||||||
public:
|
public:
|
||||||
Session(Module module_, u32 request_id_, bool is_auto_clear_event_) {
|
Session(Module module_, u32 request_id_, bool is_auto_clear_event_) {
|
||||||
this->module = module_;
|
this->module = module_;
|
||||||
this->request_id = request_id_;
|
this->request_id = request_id_;
|
||||||
this->is_auto_clear_event = is_auto_clear_event_;
|
this->is_auto_clear_event = is_auto_clear_event_;
|
||||||
this->min = 0;
|
this->min = 0;
|
||||||
this->max = -1;
|
this->max = -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Module module;
|
Module module;
|
||||||
u32 request_id, min;
|
u32 request_id, min;
|
||||||
s32 max;
|
s32 max;
|
||||||
bool is_auto_clear_event;
|
bool is_auto_clear_event;
|
||||||
|
|
||||||
|
void SetAndWait(u32 min_, s32 max_) {
|
||||||
|
this->min = min_;
|
||||||
|
this->max = max_;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void SetAndWait(u32 min_, s32 max_) {
|
|
||||||
this->min = min_;
|
|
||||||
this->max = max_;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class MM_U final : public ServiceFramework<MM_U> {
|
class MM_U final : public ServiceFramework<MM_U> {
|
||||||
public:
|
public:
|
||||||
explicit MM_U(Core::System& system_) : ServiceFramework{system_, "mm:u"} {
|
explicit MM_U(Core::System& system_) : ServiceFramework{system_, "mm:u"} {
|
||||||
|
@ -65,53 +65,53 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void InitializeOld(HLERequestContext& ctx) {
|
void InitializeOld(HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_MM, "(STUBBED) called");
|
LOG_DEBUG(Service_MM, "(STUBBED) called");
|
||||||
|
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const auto module = rp.PopEnum<Module>();
|
const auto module = rp.PopEnum<Module>();
|
||||||
rp.Pop<u32>();
|
rp.Pop<u32>();
|
||||||
const auto event_clear_mode = rp.Pop<u32>();
|
const auto event_clear_mode = rp.Pop<u32>();
|
||||||
|
|
||||||
|
const bool is_auto_clear_event = event_clear_mode == 1;
|
||||||
|
|
||||||
|
sessions.push_back({module, request_id++, is_auto_clear_event});
|
||||||
|
|
||||||
const bool is_auto_clear_event = event_clear_mode == 1;
|
|
||||||
|
|
||||||
sessions.push_back({module, request_id++, is_auto_clear_event});
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FinalizeOld(HLERequestContext& ctx) {
|
void FinalizeOld(HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_MM, "(STUBBED) called");
|
LOG_DEBUG(Service_MM, "(STUBBED) called");
|
||||||
|
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const auto module = rp.PopEnum<Module>();
|
const auto module = rp.PopEnum<Module>();
|
||||||
|
|
||||||
for (auto it = sessions.begin(); it != sessions.end(); ++it) {
|
for (auto it = sessions.begin(); it != sessions.end(); ++it) {
|
||||||
if (it->module == module) {
|
if (it->module == module) {
|
||||||
sessions.erase(it);
|
sessions.erase(it);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetAndWaitOld(HLERequestContext& ctx) {
|
void SetAndWaitOld(HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_MM, "(STUBBED) called");
|
LOG_DEBUG(Service_MM, "(STUBBED) called");
|
||||||
|
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const auto module = rp.PopEnum<Module>();
|
const auto module = rp.PopEnum<Module>();
|
||||||
const auto min = rp.Pop<u32>();
|
const auto min = rp.Pop<u32>();
|
||||||
const auto max = rp.Pop<s32>();
|
const auto max = rp.Pop<s32>();
|
||||||
|
|
||||||
|
for (auto& session : sessions) {
|
||||||
|
if (session.module == module) {
|
||||||
|
session.SetAndWait(min, max);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (auto& session : sessions) {
|
|
||||||
if (session.module == module) {
|
|
||||||
session.SetAndWait(min, max);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
@ -119,72 +119,72 @@ private:
|
||||||
void GetOld(HLERequestContext& ctx) {
|
void GetOld(HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_MM, "(STUBBED) called");
|
LOG_DEBUG(Service_MM, "(STUBBED) called");
|
||||||
|
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const auto module = rp.PopEnum<Module>();
|
const auto module = rp.PopEnum<Module>();
|
||||||
|
|
||||||
for (const auto& session : sessions) {
|
for (const auto& session : sessions) {
|
||||||
if (session.module == module) {
|
if (session.module == module) {
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.Push(session.min);
|
rb.Push(session.min);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.Push<u32>(0);
|
rb.Push<u32>(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Initialize(HLERequestContext& ctx) {
|
void Initialize(HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_MM, "(STUBBED) called");
|
LOG_DEBUG(Service_MM, "(STUBBED) called");
|
||||||
|
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const auto module = rp.PopEnum<Module>();
|
const auto module = rp.PopEnum<Module>();
|
||||||
rp.Pop<u32>();
|
rp.Pop<u32>();
|
||||||
const auto event_clear_mode = rp.Pop<u32>();
|
const auto event_clear_mode = rp.Pop<u32>();
|
||||||
|
|
||||||
const bool is_auto_clear_event = event_clear_mode == 1;
|
const bool is_auto_clear_event = event_clear_mode == 1;
|
||||||
|
|
||||||
sessions.push_back({module, request_id++, is_auto_clear_event});
|
sessions.push_back({module, request_id++, is_auto_clear_event});
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.Push(request_id - 1);
|
rb.Push(request_id - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Finalize(HLERequestContext& ctx) {
|
void Finalize(HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_MM, "(STUBBED) called");
|
LOG_DEBUG(Service_MM, "(STUBBED) called");
|
||||||
|
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
const auto id = rp.Pop<u32>();
|
||||||
|
|
||||||
|
for (auto it = sessions.begin(); it != sessions.end(); ++it) {
|
||||||
|
if (it->request_id == id) {
|
||||||
|
sessions.erase(it);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
IPC::RequestParser rp{ctx};
|
|
||||||
const auto id = rp.Pop<u32>();
|
|
||||||
|
|
||||||
for (auto it = sessions.begin(); it != sessions.end(); ++it) {
|
|
||||||
if (it->request_id == id) {
|
|
||||||
sessions.erase(it);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetAndWait(HLERequestContext& ctx) {
|
void SetAndWait(HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_MM, "(STUBBED) called");
|
LOG_DEBUG(Service_MM, "(STUBBED) called");
|
||||||
|
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const auto id = rp.Pop<u32>();
|
const auto id = rp.Pop<u32>();
|
||||||
const auto min = rp.Pop<u32>();
|
const auto min = rp.Pop<u32>();
|
||||||
const auto max = rp.Pop<s32>();
|
const auto max = rp.Pop<s32>();
|
||||||
|
|
||||||
|
for (auto& session : sessions) {
|
||||||
|
if (session.request_id == id) {
|
||||||
|
session.SetAndWait(min, max);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (auto& session : sessions) {
|
|
||||||
if (session.request_id == id) {
|
|
||||||
session.SetAndWait(min, max);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
@ -192,25 +192,25 @@ private:
|
||||||
void Get(HLERequestContext& ctx) {
|
void Get(HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_MM, "(STUBBED) called");
|
LOG_DEBUG(Service_MM, "(STUBBED) called");
|
||||||
|
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const auto id = rp.Pop<u32>();
|
const auto id = rp.Pop<u32>();
|
||||||
|
|
||||||
for (const auto& session : sessions) {
|
for (const auto& session : sessions) {
|
||||||
if (session.request_id == id) {
|
if (session.request_id == id) {
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.Push(session.min);
|
rb.Push(session.min);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.Push<u32>(0);
|
rb.Push<u32>(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Session> sessions;
|
std::vector<Session> sessions;
|
||||||
u32 request_id{1};
|
u32 request_id{1};
|
||||||
};
|
};
|
||||||
|
|
||||||
void LoopProcess(Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
|
|
|
@ -67,7 +67,6 @@ static u128 MakeUuidFromName(std::string_view name) {
|
||||||
return {h1, h2};
|
return {h1, h2};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// This is nn::nifm::RequestState
|
// This is nn::nifm::RequestState
|
||||||
enum class RequestState : u32 {
|
enum class RequestState : u32 {
|
||||||
NotSubmitted = 1,
|
NotSubmitted = 1,
|
||||||
|
@ -217,7 +216,6 @@ struct PendingProfile {
|
||||||
std::array<char, 0x41> passphrase{};
|
std::array<char, 0x41> passphrase{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
constexpr Result ResultPendingConnection{ErrorModule::NIFM, 111};
|
constexpr Result ResultPendingConnection{ErrorModule::NIFM, 111};
|
||||||
constexpr Result ResultInvalidInput{ErrorModule::NIFM, 112};
|
constexpr Result ResultInvalidInput{ErrorModule::NIFM, 112};
|
||||||
constexpr Result ResultNetworkCommunicationDisabled{ErrorModule::NIFM, 1111};
|
constexpr Result ResultNetworkCommunicationDisabled{ErrorModule::NIFM, 1111};
|
||||||
|
@ -278,8 +276,7 @@ private:
|
||||||
IPC::ResponseBuilder{ctx, 2}.Push(ResultSuccess);
|
IPC::ResponseBuilder{ctx, 2}.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IsProcessing(HLERequestContext& ctx)
|
void IsProcessing(HLERequestContext& ctx) {
|
||||||
{
|
|
||||||
const bool processing = state.load() == State::Processing;
|
const bool processing = state.load() == State::Processing;
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
|
@ -306,7 +303,7 @@ private:
|
||||||
|
|
||||||
enum class State { Idle, Processing, Finished };
|
enum class State { Idle, Processing, Finished };
|
||||||
|
|
||||||
void WorkerThread() {
|
void WorkerThread() {
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
scan_results = Network::ScanWifiNetworks(3s);
|
scan_results = Network::ScanWifiNetworks(3s);
|
||||||
|
@ -321,7 +318,6 @@ private:
|
||||||
Finish(ok ? ResultSuccess : ResultPendingConnection);
|
Finish(ok ? ResultSuccess : ResultPendingConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Finish(Result rc) {
|
void Finish(Result rc) {
|
||||||
worker_result.store(rc);
|
worker_result.store(rc);
|
||||||
state.store(State::Finished);
|
state.store(State::Finished);
|
||||||
|
@ -665,8 +661,9 @@ void IGeneralService::GetNetworkProfile(HLERequestContext& ctx) {
|
||||||
std::memcpy(net_name.data(), net_state.ssid, ssid_len);
|
std::memcpy(net_name.data(), net_state.ssid, ssid_len);
|
||||||
|
|
||||||
SfWirelessSettingData wifi{};
|
SfWirelessSettingData wifi{};
|
||||||
wifi.ssid_length = static_cast<u8>(std::min<size_t>(std::strlen(net_state.ssid), net_name.size()));
|
wifi.ssid_length =
|
||||||
wifi.is_secured = !net_state.secure; //somehow reversed
|
static_cast<u8>(std::min<size_t>(std::strlen(net_state.ssid), net_name.size()));
|
||||||
|
wifi.is_secured = !net_state.secure; // somehow reversed
|
||||||
wifi.passphrase = {"password"};
|
wifi.passphrase = {"password"};
|
||||||
std::memcpy(wifi.ssid.data(), net_state.ssid, wifi.ssid_length);
|
std::memcpy(wifi.ssid.data(), net_state.ssid, wifi.ssid_length);
|
||||||
|
|
||||||
|
@ -693,11 +690,10 @@ void IGeneralService::GetNetworkProfile(HLERequestContext& ctx) {
|
||||||
.uuid{MakeUuidFromName(net_state.ssid)},
|
.uuid{MakeUuidFromName(net_state.ssid)},
|
||||||
.network_name{net_name},
|
.network_name{net_name},
|
||||||
.profile_type = static_cast<u8>(NetworkProfileType::User),
|
.profile_type = static_cast<u8>(NetworkProfileType::User),
|
||||||
.interface_type =
|
.interface_type = static_cast<u8>(net_iface->kind == Network::HostAdapterKind::Wifi
|
||||||
static_cast<u8>(net_iface->kind ==
|
? NetworkInterfaceType::WiFi_Ieee80211
|
||||||
Network::HostAdapterKind::Wifi ? NetworkInterfaceType::WiFi_Ieee80211 : NetworkInterfaceType::Ethernet),
|
: NetworkInterfaceType::Ethernet),
|
||||||
.wireless_setting_data{wifi}
|
.wireless_setting_data{wifi}};
|
||||||
};
|
|
||||||
}();
|
}();
|
||||||
|
|
||||||
ctx.WriteBuffer(profile);
|
ctx.WriteBuffer(profile);
|
||||||
|
@ -732,7 +728,6 @@ void IGeneralService::SetNetworkProfile(HLERequestContext& ctx) {
|
||||||
IPC::ResponseBuilder{ctx, 2}.Push(ResultSuccess);
|
IPC::ResponseBuilder{ctx, 2}.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IGeneralService::RemoveNetworkProfile(HLERequestContext& ctx) {
|
void IGeneralService::RemoveNetworkProfile(HLERequestContext& ctx) {
|
||||||
LOG_WARNING(Service_NIFM, "(STUBBED) called");
|
LOG_WARNING(Service_NIFM, "(STUBBED) called");
|
||||||
|
|
||||||
|
@ -759,7 +754,6 @@ void IGeneralService::GetScanDataV2(HLERequestContext& ctx) {
|
||||||
const std::size_t max_rows = guest_bytes / sizeof(AccessPointDataV3);
|
const std::size_t max_rows = guest_bytes / sizeof(AccessPointDataV3);
|
||||||
const std::size_t rows_copy = std::min<std::size_t>(scans.size(), max_rows);
|
const std::size_t rows_copy = std::min<std::size_t>(scans.size(), max_rows);
|
||||||
|
|
||||||
|
|
||||||
std::vector<AccessPointDataV3> rows;
|
std::vector<AccessPointDataV3> rows;
|
||||||
rows.resize(rows_copy);
|
rows.resize(rows_copy);
|
||||||
|
|
||||||
|
@ -776,7 +770,7 @@ void IGeneralService::GetScanDataV2(HLERequestContext& ctx) {
|
||||||
ap.strength = to_bars(s.quality);
|
ap.strength = to_bars(s.quality);
|
||||||
|
|
||||||
bool is_connected = std::strncmp(net_state.ssid, ap.ssid, ap.ssid_len) == 0 &&
|
bool is_connected = std::strncmp(net_state.ssid, ap.ssid, ap.ssid_len) == 0 &&
|
||||||
net_state.ssid[ap.ssid_len] == '\0';
|
net_state.ssid[ap.ssid_len] == '\0';
|
||||||
|
|
||||||
ap.visible = (is_connected) ? 0 : 1;
|
ap.visible = (is_connected) ? 0 : 1;
|
||||||
ap.has_password = (s.flags & 2) ? 2 : 1;
|
ap.has_password = (s.flags & 2) ? 2 : 1;
|
||||||
|
|
|
@ -241,7 +241,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CreateServerInterface(HLERequestContext& ctx) {
|
void CreateServerInterface(HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_NIM, "(STUBBED) called");
|
LOG_DEBUG(Service_NIM, "(STUBBED) called");
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.PushIpcInterface<IShopServiceAccessServer>(system);
|
rb.PushIpcInterface<IShopServiceAccessServer>(system);
|
||||||
|
@ -258,14 +258,14 @@ private:
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.Push(false);
|
rb.Push(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateServerInterface2(HLERequestContext& ctx) {
|
void CreateServerInterface2(HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_NIM, "(STUBBED) called.");
|
LOG_DEBUG(Service_NIM, "(STUBBED) called.");
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.PushIpcInterface<IShopServiceAccessServer>(system);
|
rb.PushIpcInterface<IShopServiceAccessServer>(system);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class NIM_SHP final : public ServiceFramework<NIM_SHP> {
|
class NIM_SHP final : public ServiceFramework<NIM_SHP> {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue