Compare commits
46 Commits
__refs_pul
...
__refs_pul
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae75fbd14c | ||
|
|
26c1edf2f0 | ||
|
|
c50a930bbb | ||
|
|
60688bf0d5 | ||
|
|
833afb7ce3 | ||
|
|
290ec3eb2f | ||
|
|
d5bfc36e90 | ||
|
|
5eeadde3c8 | ||
|
|
cfd69e2e58 | ||
|
|
5e4ea04a64 | ||
|
|
39ca7b2928 | ||
|
|
ca8a804a3c | ||
|
|
b5bcd8c71b | ||
|
|
090bc588e5 | ||
|
|
739a81055f | ||
|
|
673accd630 | ||
|
|
db2785082b | ||
|
|
9477181d09 | ||
|
|
8f3e2a1b48 | ||
|
|
d482ec32a4 | ||
|
|
11f6bb1532 | ||
|
|
ba05301e1b | ||
|
|
5a657488e1 | ||
|
|
c9678bda24 | ||
|
|
83afc12475 | ||
|
|
d746cfc018 | ||
|
|
89221ca7d5 | ||
|
|
165ebbb63c | ||
|
|
898c5d35a5 | ||
|
|
a4d0663158 | ||
|
|
e531d1fae9 | ||
|
|
41183b622f | ||
|
|
e91ff9b7bd | ||
|
|
1773a1039f | ||
|
|
61b1772e51 | ||
|
|
889bfce447 | ||
|
|
744434de38 | ||
|
|
17207939e5 | ||
|
|
57aaf00a0c | ||
|
|
3b50906f00 | ||
|
|
139b645aa2 | ||
|
|
2e02ed8bb5 | ||
|
|
19e1ea6a02 | ||
|
|
5e746da981 | ||
|
|
505923f0f3 | ||
|
|
57a4388e2d |
@@ -241,7 +241,7 @@ endif()
|
||||
|
||||
if (ENABLE_WEB_SERVICE)
|
||||
find_package(cpp-jwt 1.4 CONFIG)
|
||||
find_package(httplib 0.11 MODULE)
|
||||
find_package(httplib 0.12 MODULE)
|
||||
endif()
|
||||
|
||||
if (YUZU_TESTS)
|
||||
|
||||
2
externals/cpp-httplib
vendored
2
externals/cpp-httplib
vendored
Submodule externals/cpp-httplib updated: 305a7abcb9...6d963fbe8d
@@ -46,7 +46,7 @@ void CommandGenerator::GenerateDataSourceCommand(VoiceInfo& voice_info,
|
||||
while (destination != nullptr) {
|
||||
if (destination->IsConfigured()) {
|
||||
auto mix_id{destination->GetMixId()};
|
||||
if (mix_id < mix_context.GetCount()) {
|
||||
if (mix_id < mix_context.GetCount() && mix_id != UnusedSplitterId) {
|
||||
auto mix_info{mix_context.GetInfo(mix_id)};
|
||||
command_buffer.GenerateDepopPrepareCommand(
|
||||
voice_info.node_id, voice_state, render_context.depop_buffer,
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "audio_core/renderer/adsp/command_list_processor.h"
|
||||
#include "audio_core/renderer/command/effect/aux_.h"
|
||||
#include "audio_core/renderer/effect/aux_.h"
|
||||
#include "core/core.h"
|
||||
#include "core/memory.h"
|
||||
|
||||
namespace AudioCore::AudioRenderer {
|
||||
@@ -19,10 +20,24 @@ static void ResetAuxBufferDsp(Core::Memory::Memory& memory, const CpuAddr aux_in
|
||||
return;
|
||||
}
|
||||
|
||||
auto info{reinterpret_cast<AuxInfo::AuxInfoDsp*>(memory.GetPointer(aux_info))};
|
||||
info->read_offset = 0;
|
||||
info->write_offset = 0;
|
||||
info->total_sample_count = 0;
|
||||
AuxInfo::AuxInfoDsp info{};
|
||||
auto info_ptr{&info};
|
||||
bool host_safe{(aux_info & Core::Memory::YUZU_PAGEMASK) <=
|
||||
(Core::Memory::YUZU_PAGESIZE - sizeof(AuxInfo::AuxInfoDsp))};
|
||||
|
||||
if (host_safe) [[likely]] {
|
||||
info_ptr = memory.GetPointer<AuxInfo::AuxInfoDsp>(aux_info);
|
||||
} else {
|
||||
memory.ReadBlockUnsafe(aux_info, info_ptr, sizeof(AuxInfo::AuxInfoDsp));
|
||||
}
|
||||
|
||||
info_ptr->read_offset = 0;
|
||||
info_ptr->write_offset = 0;
|
||||
info_ptr->total_sample_count = 0;
|
||||
|
||||
if (!host_safe) [[unlikely]] {
|
||||
memory.WriteBlockUnsafe(aux_info, info_ptr, sizeof(AuxInfo::AuxInfoDsp));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,11 +55,10 @@ static void ResetAuxBufferDsp(Core::Memory::Memory& memory, const CpuAddr aux_in
|
||||
* @param update_count - If non-zero, send_info_ will be updated.
|
||||
* @return Number of samples written.
|
||||
*/
|
||||
static u32 WriteAuxBufferDsp(Core::Memory::Memory& memory, const CpuAddr send_info_,
|
||||
[[maybe_unused]] u32 sample_count, const CpuAddr send_buffer,
|
||||
const u32 count_max, std::span<const s32> input,
|
||||
const u32 write_count_, const u32 write_offset,
|
||||
const u32 update_count) {
|
||||
static u32 WriteAuxBufferDsp(Core::Memory::Memory& memory, CpuAddr send_info_,
|
||||
[[maybe_unused]] u32 sample_count, CpuAddr send_buffer, u32 count_max,
|
||||
std::span<const s32> input, u32 write_count_, u32 write_offset,
|
||||
u32 update_count) {
|
||||
if (write_count_ > count_max) {
|
||||
LOG_ERROR(Service_Audio,
|
||||
"write_count must be smaller than count_max! write_count {}, count_max {}",
|
||||
@@ -52,6 +66,11 @@ static u32 WriteAuxBufferDsp(Core::Memory::Memory& memory, const CpuAddr send_in
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (send_info_ == 0) {
|
||||
LOG_ERROR(Service_Audio, "send_info_ is 0!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (input.empty()) {
|
||||
LOG_ERROR(Service_Audio, "input buffer is empty!");
|
||||
return 0;
|
||||
@@ -67,33 +86,47 @@ static u32 WriteAuxBufferDsp(Core::Memory::Memory& memory, const CpuAddr send_in
|
||||
}
|
||||
|
||||
AuxInfo::AuxInfoDsp send_info{};
|
||||
memory.ReadBlockUnsafe(send_info_, &send_info, sizeof(AuxInfo::AuxInfoDsp));
|
||||
auto send_ptr = &send_info;
|
||||
bool host_safe = (send_info_ & Core::Memory::YUZU_PAGEMASK) <=
|
||||
(Core::Memory::YUZU_PAGESIZE - sizeof(AuxInfo::AuxInfoDsp));
|
||||
|
||||
u32 target_write_offset{send_info.write_offset + write_offset};
|
||||
if (target_write_offset > count_max || write_count_ == 0) {
|
||||
if (host_safe) [[likely]] {
|
||||
send_ptr = memory.GetPointer<AuxInfo::AuxInfoDsp>(send_info_);
|
||||
} else {
|
||||
memory.ReadBlockUnsafe(send_info_, send_ptr, sizeof(AuxInfo::AuxInfoDsp));
|
||||
}
|
||||
|
||||
u32 target_write_offset{send_ptr->write_offset + write_offset};
|
||||
if (target_write_offset > count_max) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 write_count{write_count_};
|
||||
u32 write_pos{0};
|
||||
u32 read_pos{0};
|
||||
while (write_count > 0) {
|
||||
u32 to_write{std::min(count_max - target_write_offset, write_count)};
|
||||
|
||||
if (to_write > 0) {
|
||||
const auto write_addr = send_buffer + target_write_offset * sizeof(s32);
|
||||
bool write_safe{(write_addr & Core::Memory::YUZU_PAGEMASK) <=
|
||||
(Core::Memory::YUZU_PAGESIZE - (write_addr + to_write * sizeof(s32)))};
|
||||
if (write_safe) [[likely]] {
|
||||
auto ptr = memory.GetPointer(write_addr);
|
||||
std::memcpy(ptr, &input[read_pos], to_write * sizeof(s32));
|
||||
} else {
|
||||
memory.WriteBlockUnsafe(send_buffer + target_write_offset * sizeof(s32),
|
||||
&input[write_pos], to_write * sizeof(s32));
|
||||
&input[read_pos], to_write * sizeof(s32));
|
||||
}
|
||||
|
||||
target_write_offset = (target_write_offset + to_write) % count_max;
|
||||
write_count -= to_write;
|
||||
write_pos += to_write;
|
||||
read_pos += to_write;
|
||||
}
|
||||
|
||||
if (update_count) {
|
||||
send_info.write_offset = (send_info.write_offset + update_count) % count_max;
|
||||
send_ptr->write_offset = (send_ptr->write_offset + update_count) % count_max;
|
||||
}
|
||||
|
||||
memory.WriteBlockUnsafe(send_info_, &send_info, sizeof(AuxInfo::AuxInfoDsp));
|
||||
if (!host_safe) [[unlikely]] {
|
||||
memory.WriteBlockUnsafe(send_info_, send_ptr, sizeof(AuxInfo::AuxInfoDsp));
|
||||
}
|
||||
|
||||
return write_count_;
|
||||
}
|
||||
@@ -102,7 +135,7 @@ static u32 WriteAuxBufferDsp(Core::Memory::Memory& memory, const CpuAddr send_in
|
||||
* Read the given memory at return_buffer into the output mix buffer, and update return_info_ if
|
||||
* update_count is set, to notify the game that an update happened.
|
||||
*
|
||||
* @param memory - Core memory for writing.
|
||||
* @param memory - Core memory for reading.
|
||||
* @param return_info_ - Meta information for where to read the mix buffer.
|
||||
* @param return_buffer - Memory address to read the samples from.
|
||||
* @param count_max - Maximum number of samples in the receiving buffer.
|
||||
@@ -112,16 +145,21 @@ static u32 WriteAuxBufferDsp(Core::Memory::Memory& memory, const CpuAddr send_in
|
||||
* @param update_count - If non-zero, send_info_ will be updated.
|
||||
* @return Number of samples read.
|
||||
*/
|
||||
static u32 ReadAuxBufferDsp(Core::Memory::Memory& memory, const CpuAddr return_info_,
|
||||
const CpuAddr return_buffer, const u32 count_max, std::span<s32> output,
|
||||
const u32 count_, const u32 read_offset, const u32 update_count) {
|
||||
static u32 ReadAuxBufferDsp(Core::Memory::Memory& memory, CpuAddr return_info_,
|
||||
CpuAddr return_buffer, u32 count_max, std::span<s32> output,
|
||||
u32 read_count_, u32 read_offset, u32 update_count) {
|
||||
if (count_max == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (count_ > count_max) {
|
||||
if (read_count_ > count_max) {
|
||||
LOG_ERROR(Service_Audio, "count must be smaller than count_max! count {}, count_max {}",
|
||||
count_, count_max);
|
||||
read_count_, count_max);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (return_info_ == 0) {
|
||||
LOG_ERROR(Service_Audio, "return_info_ is 0!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -136,35 +174,49 @@ static u32 ReadAuxBufferDsp(Core::Memory::Memory& memory, const CpuAddr return_i
|
||||
}
|
||||
|
||||
AuxInfo::AuxInfoDsp return_info{};
|
||||
memory.ReadBlockUnsafe(return_info_, &return_info, sizeof(AuxInfo::AuxInfoDsp));
|
||||
auto return_ptr = &return_info;
|
||||
bool host_safe = (return_info_ & Core::Memory::YUZU_PAGEMASK) <=
|
||||
(Core::Memory::YUZU_PAGESIZE - sizeof(AuxInfo::AuxInfoDsp));
|
||||
|
||||
u32 target_read_offset{return_info.read_offset + read_offset};
|
||||
if (host_safe) [[likely]] {
|
||||
return_ptr = memory.GetPointer<AuxInfo::AuxInfoDsp>(return_info_);
|
||||
} else {
|
||||
memory.ReadBlockUnsafe(return_info_, return_ptr, sizeof(AuxInfo::AuxInfoDsp));
|
||||
}
|
||||
|
||||
u32 target_read_offset{return_ptr->read_offset + read_offset};
|
||||
if (target_read_offset > count_max) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 read_count{count_};
|
||||
u32 read_pos{0};
|
||||
u32 read_count{read_count_};
|
||||
u32 write_pos{0};
|
||||
while (read_count > 0) {
|
||||
u32 to_read{std::min(count_max - target_read_offset, read_count)};
|
||||
|
||||
if (to_read > 0) {
|
||||
const auto read_addr = return_buffer + target_read_offset * sizeof(s32);
|
||||
bool read_safe{(read_addr & Core::Memory::YUZU_PAGEMASK) <=
|
||||
(Core::Memory::YUZU_PAGESIZE - (read_addr + to_read * sizeof(s32)))};
|
||||
if (read_safe) [[likely]] {
|
||||
auto ptr = memory.GetPointer(read_addr);
|
||||
std::memcpy(&output[write_pos], ptr, to_read * sizeof(s32));
|
||||
} else {
|
||||
memory.ReadBlockUnsafe(return_buffer + target_read_offset * sizeof(s32),
|
||||
&output[read_pos], to_read * sizeof(s32));
|
||||
&output[write_pos], to_read * sizeof(s32));
|
||||
}
|
||||
|
||||
target_read_offset = (target_read_offset + to_read) % count_max;
|
||||
read_count -= to_read;
|
||||
read_pos += to_read;
|
||||
write_pos += to_read;
|
||||
}
|
||||
|
||||
if (update_count) {
|
||||
return_info.read_offset = (return_info.read_offset + update_count) % count_max;
|
||||
return_ptr->read_offset = (return_ptr->read_offset + update_count) % count_max;
|
||||
}
|
||||
|
||||
memory.WriteBlockUnsafe(return_info_, &return_info, sizeof(AuxInfo::AuxInfoDsp));
|
||||
if (!host_safe) [[unlikely]] {
|
||||
memory.WriteBlockUnsafe(return_info_, return_ptr, sizeof(AuxInfo::AuxInfoDsp));
|
||||
}
|
||||
|
||||
return count_;
|
||||
return read_count_;
|
||||
}
|
||||
|
||||
void AuxCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor,
|
||||
@@ -189,7 +241,7 @@ void AuxCommand::Process(const ADSP::CommandListProcessor& processor) {
|
||||
update_count)};
|
||||
|
||||
if (read != processor.sample_count) {
|
||||
std::memset(&output_buffer[read], 0, processor.sample_count - read);
|
||||
std::memset(&output_buffer[read], 0, (processor.sample_count - read) * sizeof(s32));
|
||||
}
|
||||
} else {
|
||||
ResetAuxBufferDsp(*processor.memory, send_buffer_info);
|
||||
|
||||
@@ -23,6 +23,7 @@ public:
|
||||
buffer{Common::make_unique_for_overwrite<T[]>(initial_capacity)} {}
|
||||
|
||||
~ScratchBuffer() = default;
|
||||
ScratchBuffer(ScratchBuffer&&) = default;
|
||||
|
||||
/// This will only grow the buffer's capacity if size is greater than the current capacity.
|
||||
/// The previously held data will remain intact.
|
||||
|
||||
@@ -59,6 +59,7 @@ void LogSettings() {
|
||||
values.use_asynchronous_gpu_emulation.GetValue());
|
||||
log_setting("Renderer_NvdecEmulation", values.nvdec_emulation.GetValue());
|
||||
log_setting("Renderer_AccelerateASTC", values.accelerate_astc.GetValue());
|
||||
log_setting("Renderer_AsyncASTC", values.async_astc.GetValue());
|
||||
log_setting("Renderer_UseVsync", values.use_vsync.GetValue());
|
||||
log_setting("Renderer_ShaderBackend", values.shader_backend.GetValue());
|
||||
log_setting("Renderer_UseAsynchronousShaders", values.use_asynchronous_shaders.GetValue());
|
||||
@@ -76,6 +77,13 @@ void LogSettings() {
|
||||
log_setting("Debugging_GDBStub", values.use_gdbstub.GetValue());
|
||||
log_setting("Input_EnableMotion", values.motion_enabled.GetValue());
|
||||
log_setting("Input_EnableVibration", values.vibration_enabled.GetValue());
|
||||
log_setting("Input_EnableTouch", values.touchscreen.enabled);
|
||||
log_setting("Input_EnableMouse", values.mouse_enabled.GetValue());
|
||||
log_setting("Input_EnableKeyboard", values.keyboard_enabled.GetValue());
|
||||
log_setting("Input_EnableRingController", values.enable_ring_controller.GetValue());
|
||||
log_setting("Input_EnableIrSensor", values.enable_ir_sensor.GetValue());
|
||||
log_setting("Input_EnableCustomJoycon", values.enable_joycon_driver.GetValue());
|
||||
log_setting("Input_EnableCustomProController", values.enable_procon_driver.GetValue());
|
||||
log_setting("Input_EnableRawInput", values.enable_raw_input.GetValue());
|
||||
}
|
||||
|
||||
@@ -212,6 +220,7 @@ void RestoreGlobalState(bool is_powered_on) {
|
||||
values.use_asynchronous_gpu_emulation.SetGlobal(true);
|
||||
values.nvdec_emulation.SetGlobal(true);
|
||||
values.accelerate_astc.SetGlobal(true);
|
||||
values.async_astc.SetGlobal(true);
|
||||
values.use_vsync.SetGlobal(true);
|
||||
values.shader_backend.SetGlobal(true);
|
||||
values.use_asynchronous_shaders.SetGlobal(true);
|
||||
|
||||
@@ -453,6 +453,7 @@ struct Values {
|
||||
SwitchableSetting<bool> use_asynchronous_gpu_emulation{true, "use_asynchronous_gpu_emulation"};
|
||||
SwitchableSetting<NvdecEmulation> nvdec_emulation{NvdecEmulation::GPU, "nvdec_emulation"};
|
||||
SwitchableSetting<bool> accelerate_astc{true, "accelerate_astc"};
|
||||
SwitchableSetting<bool> async_astc{false, "async_astc"};
|
||||
SwitchableSetting<bool> use_vsync{true, "use_vsync"};
|
||||
SwitchableSetting<ShaderBackend, true> shader_backend{ShaderBackend::GLSL, ShaderBackend::GLSL,
|
||||
ShaderBackend::SPIRV, "shader_backend"};
|
||||
@@ -481,7 +482,7 @@ struct Values {
|
||||
SwitchableSetting<s32, true> sound_index{1, 0, 2, "sound_index"};
|
||||
|
||||
// Controls
|
||||
InputSetting<std::array<PlayerInput, 10>> players;
|
||||
InputSetting<std::array<PlayerInput, 8>> players;
|
||||
|
||||
SwitchableSetting<bool> use_docked_mode{true, "use_docked_mode"};
|
||||
|
||||
|
||||
@@ -225,6 +225,8 @@ add_library(core STATIC
|
||||
hle/kernel/k_memory_manager.h
|
||||
hle/kernel/k_memory_region.h
|
||||
hle/kernel/k_memory_region_type.h
|
||||
hle/kernel/k_object_name.cpp
|
||||
hle/kernel/k_object_name.h
|
||||
hle/kernel/k_page_bitmap.h
|
||||
hle/kernel/k_page_buffer.cpp
|
||||
hle/kernel/k_page_buffer.h
|
||||
|
||||
@@ -23,7 +23,8 @@ void EmulatedConsole::SetTouchParams() {
|
||||
|
||||
// We can't use mouse as touch if native mouse is enabled
|
||||
if (!Settings::values.mouse_enabled) {
|
||||
touch_params[index++] = Common::ParamPackage{"engine:mouse,axis_x:10,axis_y:11,button:0"};
|
||||
touch_params[index++] =
|
||||
Common::ParamPackage{"engine:mouse,axis_x:0,axis_y:1,button:0,port:2"};
|
||||
}
|
||||
|
||||
touch_params[index++] =
|
||||
|
||||
@@ -82,7 +82,12 @@ Settings::ControllerType EmulatedController::MapNPadToSettingsType(NpadStyleInde
|
||||
}
|
||||
|
||||
void EmulatedController::ReloadFromSettings() {
|
||||
const auto player_index = NpadIdTypeToIndex(npad_id_type);
|
||||
if (npad_id_type == NpadIdType::Other) {
|
||||
ReloadDebugPadFromSettings();
|
||||
return;
|
||||
}
|
||||
|
||||
const auto player_index = NpadIdTypeToConfigIndex(npad_id_type);
|
||||
const auto& player = Settings::values.players.GetValue()[player_index];
|
||||
|
||||
for (std::size_t index = 0; index < player.buttons.size(); ++index) {
|
||||
@@ -111,16 +116,25 @@ void EmulatedController::ReloadFromSettings() {
|
||||
|
||||
ring_params[0] = Common::ParamPackage(Settings::values.ringcon_analogs);
|
||||
|
||||
// Other or debug controller should always be a pro controller
|
||||
if (npad_id_type != NpadIdType::Other) {
|
||||
SetNpadStyleIndex(MapSettingsTypeToNPad(player.controller_type));
|
||||
original_npad_type = npad_type;
|
||||
} else {
|
||||
SetNpadStyleIndex(NpadStyleIndex::ProController);
|
||||
original_npad_type = npad_type;
|
||||
// Player 1 shares config with handheld. Disable controller when handheld is selected
|
||||
// if (npad_id_type == NpadIdType::Player1 && npad_type == NpadStyleIndex::Handheld) {
|
||||
// Disconnect();
|
||||
// ReloadInput();
|
||||
// return;
|
||||
//}
|
||||
|
||||
// Handheld shares config with player 1. Disable controller when handheld isn't selected
|
||||
if (npad_id_type == NpadIdType::Handheld && npad_type != NpadStyleIndex::Handheld) {
|
||||
Disconnect();
|
||||
ReloadInput();
|
||||
return;
|
||||
}
|
||||
|
||||
Disconnect();
|
||||
|
||||
SetNpadStyleIndex(MapSettingsTypeToNPad(player.controller_type));
|
||||
original_npad_type = npad_type;
|
||||
|
||||
if (player.connected) {
|
||||
Connect();
|
||||
}
|
||||
@@ -128,6 +142,33 @@ void EmulatedController::ReloadFromSettings() {
|
||||
ReloadInput();
|
||||
}
|
||||
|
||||
void EmulatedController::ReloadDebugPadFromSettings() {
|
||||
for (std::size_t index = 0; index < Settings::values.debug_pad_buttons.size(); ++index) {
|
||||
button_params[index] = Common::ParamPackage(Settings::values.debug_pad_buttons[index]);
|
||||
}
|
||||
for (std::size_t index = 0; index < Settings::values.debug_pad_analogs.size(); ++index) {
|
||||
stick_params[index] = Common::ParamPackage(Settings::values.debug_pad_analogs[index]);
|
||||
}
|
||||
for (std::size_t index = 0; index < motion_params.size(); ++index) {
|
||||
motion_params[index] = {};
|
||||
}
|
||||
|
||||
controller.color_values = {};
|
||||
controller.colors_state.fullkey = {};
|
||||
controller.colors_state.left = {};
|
||||
controller.colors_state.right = {};
|
||||
ring_params[0] = {};
|
||||
SetNpadStyleIndex(NpadStyleIndex::ProController);
|
||||
original_npad_type = npad_type;
|
||||
|
||||
Disconnect();
|
||||
if (Settings::values.debug_pad_enabled) {
|
||||
Connect();
|
||||
}
|
||||
|
||||
ReloadInput();
|
||||
}
|
||||
|
||||
void EmulatedController::LoadDevices() {
|
||||
// TODO(german77): Use more buttons to detect the correct device
|
||||
const auto left_joycon = button_params[Settings::NativeButton::DRight];
|
||||
@@ -363,7 +404,17 @@ void EmulatedController::ReloadInput() {
|
||||
SetMotion(callback, index);
|
||||
},
|
||||
});
|
||||
motion_devices[index]->ForceUpdate();
|
||||
|
||||
// Restore motion state
|
||||
auto& emulated_motion = controller.motion_values[index].emulated;
|
||||
auto& motion = controller.motion_state[index];
|
||||
emulated_motion.ResetRotations();
|
||||
emulated_motion.ResetQuaternion();
|
||||
motion.accel = emulated_motion.GetAcceleration();
|
||||
motion.gyro = emulated_motion.GetGyroscope();
|
||||
motion.rotation = emulated_motion.GetRotations();
|
||||
motion.orientation = emulated_motion.GetOrientation();
|
||||
motion.is_at_rest = !emulated_motion.IsMoving(motion_sensitivity);
|
||||
}
|
||||
|
||||
for (std::size_t index = 0; index < camera_devices.size(); ++index) {
|
||||
@@ -550,8 +601,14 @@ bool EmulatedController::IsConfiguring() const {
|
||||
}
|
||||
|
||||
void EmulatedController::SaveCurrentConfig() {
|
||||
const auto player_index = NpadIdTypeToIndex(npad_id_type);
|
||||
// Other and Handheld can't alter the config from here
|
||||
if (npad_id_type == NpadIdType::Other || npad_id_type == NpadIdType::Handheld) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto player_index = NpadIdTypeToConfigIndex(npad_id_type);
|
||||
auto& player = Settings::values.players.GetValue()[player_index];
|
||||
|
||||
player.connected = is_connected;
|
||||
player.controller_type = MapNPadToSettingsType(npad_type);
|
||||
for (std::size_t index = 0; index < player.buttons.size(); ++index) {
|
||||
@@ -1142,7 +1199,7 @@ bool EmulatedController::SetVibration(std::size_t device_index, VibrationValue v
|
||||
if (!output_devices[device_index]) {
|
||||
return false;
|
||||
}
|
||||
const auto player_index = NpadIdTypeToIndex(npad_id_type);
|
||||
const auto player_index = NpadIdTypeToConfigIndex(npad_id_type);
|
||||
const auto& player = Settings::values.players.GetValue()[player_index];
|
||||
const f32 strength = static_cast<f32>(player.vibration_strength) / 100.0f;
|
||||
|
||||
@@ -1168,7 +1225,7 @@ bool EmulatedController::SetVibration(std::size_t device_index, VibrationValue v
|
||||
}
|
||||
|
||||
bool EmulatedController::IsVibrationEnabled(std::size_t device_index) {
|
||||
const auto player_index = NpadIdTypeToIndex(npad_id_type);
|
||||
const auto player_index = NpadIdTypeToConfigIndex(npad_id_type);
|
||||
const auto& player = Settings::values.players.GetValue()[player_index];
|
||||
|
||||
if (!player.vibration_enabled) {
|
||||
|
||||
@@ -250,9 +250,14 @@ public:
|
||||
/// Reload all input devices
|
||||
void ReloadInput();
|
||||
|
||||
/// Overrides current mapped devices with the stored configuration and reloads all input devices
|
||||
/// Overrides current mapped devices with the stored configuration and reloads all input
|
||||
/// callbacks
|
||||
void ReloadFromSettings();
|
||||
|
||||
/// Overrides current mapped debug pad with the stored configuration and reloads all input
|
||||
/// callbacks
|
||||
void ReloadDebugPadFromSettings();
|
||||
|
||||
/// Saves the current mapped configuration
|
||||
void SaveCurrentConfig();
|
||||
|
||||
|
||||
@@ -19,49 +19,53 @@ void EmulatedDevices::ReloadFromSettings() {
|
||||
|
||||
void EmulatedDevices::ReloadInput() {
|
||||
// If you load any device here add the equivalent to the UnloadInput() function
|
||||
|
||||
// Native Mouse is mapped on port 1, pad 0
|
||||
const Common::ParamPackage mouse_params{"engine:mouse,port:1,pad:0"};
|
||||
|
||||
// Keyboard keys is mapped on port 1, pad 0 for normal keys, pad 1 for moddifier keys
|
||||
const Common::ParamPackage keyboard_params{"engine:keyboard,port:1"};
|
||||
|
||||
std::size_t key_index = 0;
|
||||
for (auto& mouse_device : mouse_button_devices) {
|
||||
Common::ParamPackage mouse_params;
|
||||
mouse_params.Set("engine", "mouse");
|
||||
mouse_params.Set("button", static_cast<int>(key_index));
|
||||
mouse_device = Common::Input::CreateInputDevice(mouse_params);
|
||||
Common::ParamPackage mouse_button_params = mouse_params;
|
||||
mouse_button_params.Set("button", static_cast<int>(key_index));
|
||||
mouse_device = Common::Input::CreateInputDevice(mouse_button_params);
|
||||
key_index++;
|
||||
}
|
||||
|
||||
mouse_stick_device =
|
||||
Common::Input::CreateInputDeviceFromString("engine:mouse,axis_x:0,axis_y:1");
|
||||
Common::ParamPackage mouse_position_params = mouse_params;
|
||||
mouse_position_params.Set("axis_x", 0);
|
||||
mouse_position_params.Set("axis_y", 1);
|
||||
mouse_position_params.Set("deadzone", 0.0f);
|
||||
mouse_position_params.Set("range", 1.0f);
|
||||
mouse_position_params.Set("threshold", 0.0f);
|
||||
mouse_stick_device = Common::Input::CreateInputDevice(mouse_position_params);
|
||||
|
||||
// First two axis are reserved for mouse position
|
||||
key_index = 2;
|
||||
for (auto& mouse_device : mouse_analog_devices) {
|
||||
Common::ParamPackage mouse_params;
|
||||
mouse_params.Set("engine", "mouse");
|
||||
mouse_params.Set("axis", static_cast<int>(key_index));
|
||||
mouse_device = Common::Input::CreateInputDevice(mouse_params);
|
||||
for (auto& mouse_device : mouse_wheel_devices) {
|
||||
Common::ParamPackage mouse_wheel_params = mouse_params;
|
||||
mouse_wheel_params.Set("axis", static_cast<int>(key_index));
|
||||
mouse_device = Common::Input::CreateInputDevice(mouse_wheel_params);
|
||||
key_index++;
|
||||
}
|
||||
|
||||
key_index = 0;
|
||||
for (auto& keyboard_device : keyboard_devices) {
|
||||
// Keyboard keys are only mapped on port 1, pad 0
|
||||
Common::ParamPackage keyboard_params;
|
||||
keyboard_params.Set("engine", "keyboard");
|
||||
keyboard_params.Set("button", static_cast<int>(key_index));
|
||||
keyboard_params.Set("port", 1);
|
||||
keyboard_params.Set("pad", 0);
|
||||
keyboard_device = Common::Input::CreateInputDevice(keyboard_params);
|
||||
Common::ParamPackage keyboard_key_params = keyboard_params;
|
||||
keyboard_key_params.Set("button", static_cast<int>(key_index));
|
||||
keyboard_key_params.Set("pad", 0);
|
||||
keyboard_device = Common::Input::CreateInputDevice(keyboard_key_params);
|
||||
key_index++;
|
||||
}
|
||||
|
||||
key_index = 0;
|
||||
for (auto& keyboard_device : keyboard_modifier_devices) {
|
||||
// Keyboard moddifiers are only mapped on port 1, pad 1
|
||||
Common::ParamPackage keyboard_params;
|
||||
keyboard_params.Set("engine", "keyboard");
|
||||
keyboard_params.Set("button", static_cast<int>(key_index));
|
||||
keyboard_params.Set("port", 1);
|
||||
keyboard_params.Set("pad", 1);
|
||||
keyboard_device = Common::Input::CreateInputDevice(keyboard_params);
|
||||
Common::ParamPackage keyboard_moddifier_params = keyboard_params;
|
||||
keyboard_moddifier_params.Set("button", static_cast<int>(key_index));
|
||||
keyboard_moddifier_params.Set("pad", 1);
|
||||
keyboard_device = Common::Input::CreateInputDevice(keyboard_moddifier_params);
|
||||
key_index++;
|
||||
}
|
||||
|
||||
@@ -77,14 +81,14 @@ void EmulatedDevices::ReloadInput() {
|
||||
});
|
||||
}
|
||||
|
||||
for (std::size_t index = 0; index < mouse_analog_devices.size(); ++index) {
|
||||
if (!mouse_analog_devices[index]) {
|
||||
for (std::size_t index = 0; index < mouse_wheel_devices.size(); ++index) {
|
||||
if (!mouse_wheel_devices[index]) {
|
||||
continue;
|
||||
}
|
||||
mouse_analog_devices[index]->SetCallback({
|
||||
mouse_wheel_devices[index]->SetCallback({
|
||||
.on_change =
|
||||
[this, index](const Common::Input::CallbackStatus& callback) {
|
||||
SetMouseAnalog(callback, index);
|
||||
SetMouseWheel(callback, index);
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -92,7 +96,9 @@ void EmulatedDevices::ReloadInput() {
|
||||
if (mouse_stick_device) {
|
||||
mouse_stick_device->SetCallback({
|
||||
.on_change =
|
||||
[this](const Common::Input::CallbackStatus& callback) { SetMouseStick(callback); },
|
||||
[this](const Common::Input::CallbackStatus& callback) {
|
||||
SetMousePosition(callback);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -125,7 +131,7 @@ void EmulatedDevices::UnloadInput() {
|
||||
for (auto& button : mouse_button_devices) {
|
||||
button.reset();
|
||||
}
|
||||
for (auto& analog : mouse_analog_devices) {
|
||||
for (auto& analog : mouse_wheel_devices) {
|
||||
analog.reset();
|
||||
}
|
||||
mouse_stick_device.reset();
|
||||
@@ -359,18 +365,18 @@ void EmulatedDevices::SetMouseButton(const Common::Input::CallbackStatus& callba
|
||||
TriggerOnChange(DeviceTriggerType::Mouse);
|
||||
}
|
||||
|
||||
void EmulatedDevices::SetMouseAnalog(const Common::Input::CallbackStatus& callback,
|
||||
std::size_t index) {
|
||||
if (index >= device_status.mouse_analog_values.size()) {
|
||||
void EmulatedDevices::SetMouseWheel(const Common::Input::CallbackStatus& callback,
|
||||
std::size_t index) {
|
||||
if (index >= device_status.mouse_wheel_values.size()) {
|
||||
return;
|
||||
}
|
||||
std::unique_lock lock{mutex};
|
||||
const auto analog_value = TransformToAnalog(callback);
|
||||
|
||||
device_status.mouse_analog_values[index] = analog_value;
|
||||
device_status.mouse_wheel_values[index] = analog_value;
|
||||
|
||||
if (is_configuring) {
|
||||
device_status.mouse_position_state = {};
|
||||
device_status.mouse_wheel_state = {};
|
||||
lock.unlock();
|
||||
TriggerOnChange(DeviceTriggerType::Mouse);
|
||||
return;
|
||||
@@ -389,7 +395,7 @@ void EmulatedDevices::SetMouseAnalog(const Common::Input::CallbackStatus& callba
|
||||
TriggerOnChange(DeviceTriggerType::Mouse);
|
||||
}
|
||||
|
||||
void EmulatedDevices::SetMouseStick(const Common::Input::CallbackStatus& callback) {
|
||||
void EmulatedDevices::SetMousePosition(const Common::Input::CallbackStatus& callback) {
|
||||
std::unique_lock lock{mutex};
|
||||
const auto touch_value = TransformToTouch(callback);
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ using KeyboardModifierDevices = std::array<std::unique_ptr<Common::Input::InputD
|
||||
Settings::NativeKeyboard::NumKeyboardMods>;
|
||||
using MouseButtonDevices = std::array<std::unique_ptr<Common::Input::InputDevice>,
|
||||
Settings::NativeMouseButton::NumMouseButtons>;
|
||||
using MouseAnalogDevices = std::array<std::unique_ptr<Common::Input::InputDevice>,
|
||||
Settings::NativeMouseWheel::NumMouseWheels>;
|
||||
using MouseWheelDevices = std::array<std::unique_ptr<Common::Input::InputDevice>,
|
||||
Settings::NativeMouseWheel::NumMouseWheels>;
|
||||
using MouseStickDevice = std::unique_ptr<Common::Input::InputDevice>;
|
||||
|
||||
using MouseButtonParams =
|
||||
@@ -36,7 +36,7 @@ using KeyboardModifierValues =
|
||||
std::array<Common::Input::ButtonStatus, Settings::NativeKeyboard::NumKeyboardMods>;
|
||||
using MouseButtonValues =
|
||||
std::array<Common::Input::ButtonStatus, Settings::NativeMouseButton::NumMouseButtons>;
|
||||
using MouseAnalogValues =
|
||||
using MouseWheelValues =
|
||||
std::array<Common::Input::AnalogStatus, Settings::NativeMouseWheel::NumMouseWheels>;
|
||||
using MouseStickValue = Common::Input::TouchStatus;
|
||||
|
||||
@@ -50,7 +50,7 @@ struct DeviceStatus {
|
||||
KeyboardValues keyboard_values{};
|
||||
KeyboardModifierValues keyboard_moddifier_values{};
|
||||
MouseButtonValues mouse_button_values{};
|
||||
MouseAnalogValues mouse_analog_values{};
|
||||
MouseWheelValues mouse_wheel_values{};
|
||||
MouseStickValue mouse_stick_value{};
|
||||
|
||||
// Data for HID serices
|
||||
@@ -111,15 +111,6 @@ public:
|
||||
/// Reverts any mapped changes made that weren't saved
|
||||
void RestoreConfig();
|
||||
|
||||
// Returns the current mapped ring device
|
||||
Common::ParamPackage GetRingParam() const;
|
||||
|
||||
/**
|
||||
* Updates the current mapped ring device
|
||||
* @param param ParamPackage with ring sensor data to be mapped
|
||||
*/
|
||||
void SetRingParam(Common::ParamPackage param);
|
||||
|
||||
/// Returns the latest status of button input from the keyboard with parameters
|
||||
KeyboardValues GetKeyboardValues() const;
|
||||
|
||||
@@ -187,19 +178,13 @@ private:
|
||||
* @param callback A CallbackStatus containing the wheel status
|
||||
* @param index wheel ID to be updated
|
||||
*/
|
||||
void SetMouseAnalog(const Common::Input::CallbackStatus& callback, std::size_t index);
|
||||
void SetMouseWheel(const Common::Input::CallbackStatus& callback, std::size_t index);
|
||||
|
||||
/**
|
||||
* Updates the mouse position status of the mouse device
|
||||
* @param callback A CallbackStatus containing the position status
|
||||
*/
|
||||
void SetMouseStick(const Common::Input::CallbackStatus& callback);
|
||||
|
||||
/**
|
||||
* Updates the ring analog sensor status of the ring controller
|
||||
* @param callback A CallbackStatus containing the force status
|
||||
*/
|
||||
void SetRingAnalog(const Common::Input::CallbackStatus& callback);
|
||||
void SetMousePosition(const Common::Input::CallbackStatus& callback);
|
||||
|
||||
/**
|
||||
* Triggers a callback that something has changed on the device status
|
||||
@@ -212,7 +197,7 @@ private:
|
||||
KeyboardDevices keyboard_devices;
|
||||
KeyboardModifierDevices keyboard_modifier_devices;
|
||||
MouseButtonDevices mouse_button_devices;
|
||||
MouseAnalogDevices mouse_analog_devices;
|
||||
MouseWheelDevices mouse_wheel_devices;
|
||||
MouseStickDevice mouse_stick_device;
|
||||
|
||||
mutable std::mutex mutex;
|
||||
|
||||
@@ -690,6 +690,32 @@ constexpr size_t NpadIdTypeToIndex(NpadIdType npad_id_type) {
|
||||
}
|
||||
}
|
||||
|
||||
/// Converts a NpadIdType to a config array index.
|
||||
constexpr size_t NpadIdTypeToConfigIndex(NpadIdType npad_id_type) {
|
||||
switch (npad_id_type) {
|
||||
case NpadIdType::Player1:
|
||||
return 0;
|
||||
case NpadIdType::Player2:
|
||||
return 1;
|
||||
case NpadIdType::Player3:
|
||||
return 2;
|
||||
case NpadIdType::Player4:
|
||||
return 3;
|
||||
case NpadIdType::Player5:
|
||||
return 4;
|
||||
case NpadIdType::Player6:
|
||||
return 5;
|
||||
case NpadIdType::Player7:
|
||||
return 6;
|
||||
case NpadIdType::Player8:
|
||||
return 7;
|
||||
case NpadIdType::Other:
|
||||
case NpadIdType::Handheld:
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// Converts an array index to a NpadIdType
|
||||
constexpr NpadIdType IndexToNpadIdType(size_t index) {
|
||||
switch (index) {
|
||||
|
||||
@@ -10,6 +10,8 @@ MotionInput::MotionInput() {
|
||||
// Initialize PID constants with default values
|
||||
SetPID(0.3f, 0.005f, 0.0f);
|
||||
SetGyroThreshold(ThresholdStandard);
|
||||
ResetQuaternion();
|
||||
ResetRotations();
|
||||
}
|
||||
|
||||
void MotionInput::SetPID(f32 new_kp, f32 new_ki, f32 new_kd) {
|
||||
@@ -20,11 +22,19 @@ void MotionInput::SetPID(f32 new_kp, f32 new_ki, f32 new_kd) {
|
||||
|
||||
void MotionInput::SetAcceleration(const Common::Vec3f& acceleration) {
|
||||
accel = acceleration;
|
||||
|
||||
accel.x = std::clamp(accel.x, -AccelMaxValue, AccelMaxValue);
|
||||
accel.y = std::clamp(accel.y, -AccelMaxValue, AccelMaxValue);
|
||||
accel.z = std::clamp(accel.z, -AccelMaxValue, AccelMaxValue);
|
||||
}
|
||||
|
||||
void MotionInput::SetGyroscope(const Common::Vec3f& gyroscope) {
|
||||
gyro = gyroscope - gyro_bias;
|
||||
|
||||
gyro.x = std::clamp(gyro.x, -GyroMaxValue, GyroMaxValue);
|
||||
gyro.y = std::clamp(gyro.y, -GyroMaxValue, GyroMaxValue);
|
||||
gyro.z = std::clamp(gyro.z, -GyroMaxValue, GyroMaxValue);
|
||||
|
||||
// Auto adjust drift to minimize drift
|
||||
if (!IsMoving(IsAtRestRelaxed)) {
|
||||
gyro_bias = (gyro_bias * 0.9999f) + (gyroscope * 0.0001f);
|
||||
@@ -61,6 +71,10 @@ void MotionInput::ResetRotations() {
|
||||
rotations = {};
|
||||
}
|
||||
|
||||
void MotionInput::ResetQuaternion() {
|
||||
quat = {{0.0f, 0.0f, -1.0f}, 0.0f};
|
||||
}
|
||||
|
||||
bool MotionInput::IsMoving(f32 sensitivity) const {
|
||||
return gyro.Length() >= sensitivity || accel.Length() <= 0.9f || accel.Length() >= 1.1f;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,9 @@ public:
|
||||
static constexpr float IsAtRestStandard = 0.01f;
|
||||
static constexpr float IsAtRestThight = 0.005f;
|
||||
|
||||
static constexpr float GyroMaxValue = 5.0f;
|
||||
static constexpr float AccelMaxValue = 7.0f;
|
||||
|
||||
explicit MotionInput();
|
||||
|
||||
MotionInput(const MotionInput&) = default;
|
||||
@@ -40,6 +43,7 @@ public:
|
||||
|
||||
void EnableReset(bool reset);
|
||||
void ResetRotations();
|
||||
void ResetQuaternion();
|
||||
|
||||
void UpdateRotation(u64 elapsed_time);
|
||||
void UpdateOrientation(u64 elapsed_time);
|
||||
@@ -69,7 +73,7 @@ private:
|
||||
Common::Vec3f derivative_error;
|
||||
|
||||
// Quaternion containing the device orientation
|
||||
Common::Quaternion<f32> quat{{0.0f, 0.0f, -1.0f}, 0.0f};
|
||||
Common::Quaternion<f32> quat;
|
||||
|
||||
// Number of full rotations in each axis
|
||||
Common::Vec3f rotations;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "core/hle/kernel/k_event_info.h"
|
||||
#include "core/hle/kernel/k_memory_layout.h"
|
||||
#include "core/hle/kernel/k_memory_manager.h"
|
||||
#include "core/hle/kernel/k_object_name.h"
|
||||
#include "core/hle/kernel/k_page_buffer.h"
|
||||
#include "core/hle/kernel/k_port.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
@@ -49,6 +50,7 @@ namespace Kernel::Init {
|
||||
HANDLER(KThreadLocalPage, \
|
||||
(SLAB_COUNT(KProcess) + (SLAB_COUNT(KProcess) + SLAB_COUNT(KThread)) / 8), \
|
||||
##__VA_ARGS__) \
|
||||
HANDLER(KObjectName, (SLAB_COUNT(KObjectName)), ##__VA_ARGS__) \
|
||||
HANDLER(KResourceLimit, (SLAB_COUNT(KResourceLimit)), ##__VA_ARGS__) \
|
||||
HANDLER(KEventInfo, (SLAB_COUNT(KThread) + SLAB_COUNT(KDebug)), ##__VA_ARGS__) \
|
||||
HANDLER(KDebug, (SLAB_COUNT(KDebug)), ##__VA_ARGS__) \
|
||||
|
||||
102
src/core/hle/kernel/k_object_name.cpp
Normal file
102
src/core/hle/kernel/k_object_name.cpp
Normal file
@@ -0,0 +1,102 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "core/hle/kernel/k_object_name.h"
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
KObjectNameGlobalData::KObjectNameGlobalData(KernelCore& kernel) : m_object_list_lock{kernel} {}
|
||||
KObjectNameGlobalData::~KObjectNameGlobalData() = default;
|
||||
|
||||
void KObjectName::Initialize(KAutoObject* obj, const char* name) {
|
||||
// Set member variables.
|
||||
m_object = obj;
|
||||
std::strncpy(m_name.data(), name, sizeof(m_name) - 1);
|
||||
m_name[sizeof(m_name) - 1] = '\x00';
|
||||
|
||||
// Open a reference to the object we hold.
|
||||
m_object->Open();
|
||||
}
|
||||
|
||||
bool KObjectName::MatchesName(const char* name) const {
|
||||
return std::strncmp(m_name.data(), name, sizeof(m_name)) == 0;
|
||||
}
|
||||
|
||||
Result KObjectName::NewFromName(KernelCore& kernel, KAutoObject* obj, const char* name) {
|
||||
// Create a new object name.
|
||||
KObjectName* new_name = KObjectName::Allocate(kernel);
|
||||
R_UNLESS(new_name != nullptr, ResultOutOfResource);
|
||||
|
||||
// Initialize the new name.
|
||||
new_name->Initialize(obj, name);
|
||||
|
||||
// Check if there's an existing name.
|
||||
{
|
||||
// Get the global data.
|
||||
KObjectNameGlobalData& gd{kernel.ObjectNameGlobalData()};
|
||||
|
||||
// Ensure we have exclusive access to the global list.
|
||||
KScopedLightLock lk{gd.GetObjectListLock()};
|
||||
|
||||
// If the object doesn't exist, put it into the list.
|
||||
KScopedAutoObject existing_object = FindImpl(kernel, name);
|
||||
if (existing_object.IsNull()) {
|
||||
gd.GetObjectList().push_back(*new_name);
|
||||
R_SUCCEED();
|
||||
}
|
||||
}
|
||||
|
||||
// The object already exists, which is an error condition. Perform cleanup.
|
||||
obj->Close();
|
||||
KObjectName::Free(kernel, new_name);
|
||||
R_THROW(ResultInvalidState);
|
||||
}
|
||||
|
||||
Result KObjectName::Delete(KernelCore& kernel, KAutoObject* obj, const char* compare_name) {
|
||||
// Get the global data.
|
||||
KObjectNameGlobalData& gd{kernel.ObjectNameGlobalData()};
|
||||
|
||||
// Ensure we have exclusive access to the global list.
|
||||
KScopedLightLock lk{gd.GetObjectListLock()};
|
||||
|
||||
// Find a matching entry in the list, and delete it.
|
||||
for (auto& name : gd.GetObjectList()) {
|
||||
if (name.MatchesName(compare_name) && obj == name.GetObject()) {
|
||||
// We found a match, clean up its resources.
|
||||
obj->Close();
|
||||
gd.GetObjectList().erase(gd.GetObjectList().iterator_to(name));
|
||||
KObjectName::Free(kernel, std::addressof(name));
|
||||
R_SUCCEED();
|
||||
}
|
||||
}
|
||||
|
||||
// We didn't find the object in the list.
|
||||
R_THROW(ResultNotFound);
|
||||
}
|
||||
|
||||
KScopedAutoObject<KAutoObject> KObjectName::Find(KernelCore& kernel, const char* name) {
|
||||
// Get the global data.
|
||||
KObjectNameGlobalData& gd{kernel.ObjectNameGlobalData()};
|
||||
|
||||
// Ensure we have exclusive access to the global list.
|
||||
KScopedLightLock lk{gd.GetObjectListLock()};
|
||||
|
||||
return FindImpl(kernel, name);
|
||||
}
|
||||
|
||||
KScopedAutoObject<KAutoObject> KObjectName::FindImpl(KernelCore& kernel, const char* compare_name) {
|
||||
// Get the global data.
|
||||
KObjectNameGlobalData& gd{kernel.ObjectNameGlobalData()};
|
||||
|
||||
// Try to find a matching object in the global list.
|
||||
for (const auto& name : gd.GetObjectList()) {
|
||||
if (name.MatchesName(compare_name)) {
|
||||
return name.GetObject();
|
||||
}
|
||||
}
|
||||
|
||||
// There's no matching entry in the list.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace Kernel
|
||||
86
src/core/hle/kernel/k_object_name.h
Normal file
86
src/core/hle/kernel/k_object_name.h
Normal file
@@ -0,0 +1,86 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <boost/intrusive/list.hpp>
|
||||
|
||||
#include "core/hle/kernel/k_light_lock.h"
|
||||
#include "core/hle/kernel/slab_helpers.h"
|
||||
#include "core/hle/kernel/svc_results.h"
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
class KObjectNameGlobalData;
|
||||
|
||||
class KObjectName : public KSlabAllocated<KObjectName>, public boost::intrusive::list_base_hook<> {
|
||||
public:
|
||||
explicit KObjectName(KernelCore&) {}
|
||||
virtual ~KObjectName() = default;
|
||||
|
||||
static constexpr size_t NameLengthMax = 12;
|
||||
using List = boost::intrusive::list<KObjectName>;
|
||||
|
||||
static Result NewFromName(KernelCore& kernel, KAutoObject* obj, const char* name);
|
||||
static Result Delete(KernelCore& kernel, KAutoObject* obj, const char* name);
|
||||
|
||||
static KScopedAutoObject<KAutoObject> Find(KernelCore& kernel, const char* name);
|
||||
|
||||
template <typename Derived>
|
||||
static Result Delete(KernelCore& kernel, const char* name) {
|
||||
// Find the object.
|
||||
KScopedAutoObject obj = Find(kernel, name);
|
||||
R_UNLESS(obj.IsNotNull(), ResultNotFound);
|
||||
|
||||
// Cast the object to the desired type.
|
||||
Derived* derived = obj->DynamicCast<Derived*>();
|
||||
R_UNLESS(derived != nullptr, ResultNotFound);
|
||||
|
||||
// Check that the object is closed.
|
||||
R_UNLESS(derived->IsServerClosed(), ResultInvalidState);
|
||||
|
||||
return Delete(kernel, obj.GetPointerUnsafe(), name);
|
||||
}
|
||||
|
||||
template <typename Derived>
|
||||
requires(std::derived_from<Derived, KAutoObject>)
|
||||
static KScopedAutoObject<Derived> Find(KernelCore& kernel, const char* name) {
|
||||
return Find(kernel, name);
|
||||
}
|
||||
|
||||
private:
|
||||
static KScopedAutoObject<KAutoObject> FindImpl(KernelCore& kernel, const char* name);
|
||||
|
||||
void Initialize(KAutoObject* obj, const char* name);
|
||||
|
||||
bool MatchesName(const char* name) const;
|
||||
KAutoObject* GetObject() const {
|
||||
return m_object;
|
||||
}
|
||||
|
||||
private:
|
||||
std::array<char, NameLengthMax> m_name{};
|
||||
KAutoObject* m_object{};
|
||||
};
|
||||
|
||||
class KObjectNameGlobalData {
|
||||
public:
|
||||
explicit KObjectNameGlobalData(KernelCore& kernel);
|
||||
~KObjectNameGlobalData();
|
||||
|
||||
KLightLock& GetObjectListLock() {
|
||||
return m_object_list_lock;
|
||||
}
|
||||
|
||||
KObjectName::List& GetObjectList() {
|
||||
return m_object_list;
|
||||
}
|
||||
|
||||
private:
|
||||
KLightLock m_object_list_lock;
|
||||
KObjectName::List m_object_list;
|
||||
};
|
||||
|
||||
} // namespace Kernel
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "core/hle/kernel/k_hardware_timer.h"
|
||||
#include "core/hle/kernel/k_memory_layout.h"
|
||||
#include "core/hle/kernel/k_memory_manager.h"
|
||||
#include "core/hle/kernel/k_object_name.h"
|
||||
#include "core/hle/kernel/k_page_buffer.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_resource_limit.h"
|
||||
@@ -84,6 +85,7 @@ struct KernelCore::Impl {
|
||||
InitializeShutdownThreads();
|
||||
InitializePhysicalCores();
|
||||
InitializePreemption(kernel);
|
||||
InitializeGlobalData(kernel);
|
||||
|
||||
// Initialize the Dynamic Slab Heaps.
|
||||
{
|
||||
@@ -194,6 +196,8 @@ struct KernelCore::Impl {
|
||||
}
|
||||
}
|
||||
|
||||
object_name_global_data.reset();
|
||||
|
||||
// Ensure that the object list container is finalized and properly shutdown.
|
||||
global_object_list_container->Finalize();
|
||||
global_object_list_container.reset();
|
||||
@@ -363,27 +367,29 @@ struct KernelCore::Impl {
|
||||
}
|
||||
}
|
||||
|
||||
void InitializeGlobalData(KernelCore& kernel) {
|
||||
object_name_global_data = std::make_unique<KObjectNameGlobalData>(kernel);
|
||||
}
|
||||
|
||||
void MakeApplicationProcess(KProcess* process) {
|
||||
application_process = process;
|
||||
}
|
||||
|
||||
static inline thread_local u32 host_thread_id = UINT32_MAX;
|
||||
static inline thread_local u8 host_thread_id = UINT8_MAX;
|
||||
|
||||
/// Gets the host thread ID for the caller, allocating a new one if this is the first time
|
||||
u32 GetHostThreadId(std::size_t core_id) {
|
||||
if (host_thread_id == UINT32_MAX) {
|
||||
// The first four slots are reserved for CPU core threads
|
||||
ASSERT(core_id < Core::Hardware::NUM_CPU_CORES);
|
||||
host_thread_id = static_cast<u32>(core_id);
|
||||
}
|
||||
/// Sets the host thread ID for the caller.
|
||||
u32 SetHostThreadId(std::size_t core_id) {
|
||||
// This should only be called during core init.
|
||||
ASSERT(host_thread_id == UINT8_MAX);
|
||||
|
||||
// The first four slots are reserved for CPU core threads
|
||||
ASSERT(core_id < Core::Hardware::NUM_CPU_CORES);
|
||||
host_thread_id = static_cast<u8>(core_id);
|
||||
return host_thread_id;
|
||||
}
|
||||
|
||||
/// Gets the host thread ID for the caller, allocating a new one if this is the first time
|
||||
u32 GetHostThreadId() {
|
||||
if (host_thread_id == UINT32_MAX) {
|
||||
host_thread_id = next_host_thread_id++;
|
||||
}
|
||||
/// Gets the host thread ID for the caller
|
||||
u32 GetHostThreadId() const {
|
||||
return host_thread_id;
|
||||
}
|
||||
|
||||
@@ -391,23 +397,19 @@ struct KernelCore::Impl {
|
||||
KThread* GetHostDummyThread(KThread* existing_thread) {
|
||||
auto initialize = [this](KThread* thread) {
|
||||
ASSERT(KThread::InitializeDummyThread(thread, nullptr).IsSuccess());
|
||||
thread->SetName(fmt::format("DummyThread:{}", GetHostThreadId()));
|
||||
thread->SetName(fmt::format("DummyThread:{}", next_host_thread_id++));
|
||||
return thread;
|
||||
};
|
||||
|
||||
thread_local KThread raw_thread{system.Kernel()};
|
||||
thread_local KThread* thread = nullptr;
|
||||
if (thread == nullptr) {
|
||||
thread = (existing_thread == nullptr) ? initialize(&raw_thread) : existing_thread;
|
||||
}
|
||||
|
||||
thread_local KThread* thread = existing_thread ? existing_thread : initialize(&raw_thread);
|
||||
return thread;
|
||||
}
|
||||
|
||||
/// Registers a CPU core thread by allocating a host thread ID for it
|
||||
void RegisterCoreThread(std::size_t core_id) {
|
||||
ASSERT(core_id < Core::Hardware::NUM_CPU_CORES);
|
||||
const auto this_id = GetHostThreadId(core_id);
|
||||
const auto this_id = SetHostThreadId(core_id);
|
||||
if (!is_multicore) {
|
||||
single_core_thread_id = this_id;
|
||||
}
|
||||
@@ -415,7 +417,6 @@ struct KernelCore::Impl {
|
||||
|
||||
/// Registers a new host thread by allocating a host thread ID for it
|
||||
void RegisterHostThread(KThread* existing_thread) {
|
||||
[[maybe_unused]] const auto this_id = GetHostThreadId();
|
||||
[[maybe_unused]] const auto dummy_thread = GetHostDummyThread(existing_thread);
|
||||
}
|
||||
|
||||
@@ -445,11 +446,9 @@ struct KernelCore::Impl {
|
||||
static inline thread_local KThread* current_thread{nullptr};
|
||||
|
||||
KThread* GetCurrentEmuThread() {
|
||||
const auto thread_id = GetCurrentHostThreadID();
|
||||
if (thread_id >= Core::Hardware::NUM_CPU_CORES) {
|
||||
return GetHostDummyThread(nullptr);
|
||||
if (!current_thread) {
|
||||
current_thread = GetHostDummyThread(nullptr);
|
||||
}
|
||||
|
||||
return current_thread;
|
||||
}
|
||||
|
||||
@@ -838,6 +837,8 @@ struct KernelCore::Impl {
|
||||
|
||||
std::unique_ptr<KAutoObjectWithListContainer> global_object_list_container;
|
||||
|
||||
std::unique_ptr<KObjectNameGlobalData> object_name_global_data;
|
||||
|
||||
/// Map of named ports managed by the kernel, which can be retrieved using
|
||||
/// the ConnectToPort SVC.
|
||||
std::unordered_map<std::string, ServiceInterfaceFactory> service_interface_factory;
|
||||
@@ -1002,7 +1003,7 @@ const Kernel::PhysicalCore& KernelCore::CurrentPhysicalCore() const {
|
||||
}
|
||||
|
||||
Kernel::KScheduler* KernelCore::CurrentScheduler() {
|
||||
u32 core_id = impl->GetCurrentHostThreadID();
|
||||
const u32 core_id = impl->GetCurrentHostThreadID();
|
||||
if (core_id >= Core::Hardware::NUM_CPU_CORES) {
|
||||
// This is expected when called from not a guest thread
|
||||
return {};
|
||||
@@ -1138,6 +1139,10 @@ void KernelCore::SetCurrentEmuThread(KThread* thread) {
|
||||
impl->SetCurrentEmuThread(thread);
|
||||
}
|
||||
|
||||
KObjectNameGlobalData& KernelCore::ObjectNameGlobalData() {
|
||||
return *impl->object_name_global_data;
|
||||
}
|
||||
|
||||
KMemoryManager& KernelCore::MemoryManager() {
|
||||
return *impl->memory_manager;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,8 @@ class KHardwareTimer;
|
||||
class KLinkedListNode;
|
||||
class KMemoryLayout;
|
||||
class KMemoryManager;
|
||||
class KObjectName;
|
||||
class KObjectNameGlobalData;
|
||||
class KPageBuffer;
|
||||
class KPageBufferSlabHeap;
|
||||
class KPort;
|
||||
@@ -240,6 +242,9 @@ public:
|
||||
/// Register the current thread as a non CPU core thread.
|
||||
void RegisterHostThread(KThread* existing_thread = nullptr);
|
||||
|
||||
/// Gets global data for KObjectName.
|
||||
KObjectNameGlobalData& ObjectNameGlobalData();
|
||||
|
||||
/// Gets the virtual memory manager for the kernel.
|
||||
KMemoryManager& MemoryManager();
|
||||
|
||||
@@ -372,6 +377,8 @@ public:
|
||||
return slab_heap_container->page_buffer;
|
||||
} else if constexpr (std::is_same_v<T, KThreadLocalPage>) {
|
||||
return slab_heap_container->thread_local_page;
|
||||
} else if constexpr (std::is_same_v<T, KObjectName>) {
|
||||
return slab_heap_container->object_name;
|
||||
} else if constexpr (std::is_same_v<T, KSessionRequest>) {
|
||||
return slab_heap_container->session_request;
|
||||
} else if constexpr (std::is_same_v<T, KSecureSystemResource>) {
|
||||
@@ -443,6 +450,7 @@ private:
|
||||
KSlabHeap<KDeviceAddressSpace> device_address_space;
|
||||
KSlabHeap<KPageBuffer> page_buffer;
|
||||
KSlabHeap<KThreadLocalPage> thread_local_page;
|
||||
KSlabHeap<KObjectName> object_name;
|
||||
KSlabHeap<KSessionRequest> session_request;
|
||||
KSlabHeap<KSecureSystemResource> secure_system_resource;
|
||||
KSlabHeap<KEventInfo> event_info;
|
||||
|
||||
@@ -82,7 +82,7 @@ static_assert(sizeof(uint64_t) == 8);
|
||||
static void SvcWrap_SetHeapSize64From32(Core::System& system) {
|
||||
Result ret{};
|
||||
|
||||
uintptr_t out_address{};
|
||||
uint64_t out_address{};
|
||||
uint32_t size{};
|
||||
|
||||
size = Convert<uint32_t>(GetReg32(system, 1));
|
||||
@@ -729,7 +729,7 @@ static void SvcWrap_GetLastThreadInfo64From32(Core::System& system) {
|
||||
Result ret{};
|
||||
|
||||
ilp32::LastThreadContext out_context{};
|
||||
uintptr_t out_tls_address{};
|
||||
uint64_t out_tls_address{};
|
||||
uint32_t out_flags{};
|
||||
|
||||
ret = GetLastThreadInfo64From32(system, &out_context, &out_tls_address, &out_flags);
|
||||
@@ -1278,8 +1278,8 @@ static void SvcWrap_QueryPhysicalAddress64From32(Core::System& system) {
|
||||
static void SvcWrap_QueryIoMapping64From32(Core::System& system) {
|
||||
Result ret{};
|
||||
|
||||
uintptr_t out_address{};
|
||||
uintptr_t out_size{};
|
||||
uint64_t out_address{};
|
||||
uint64_t out_size{};
|
||||
uint64_t physical_address{};
|
||||
uint32_t size{};
|
||||
|
||||
@@ -2088,7 +2088,7 @@ static void SvcWrap_UnmapInsecureMemory64From32(Core::System& system) {
|
||||
static void SvcWrap_SetHeapSize64(Core::System& system) {
|
||||
Result ret{};
|
||||
|
||||
uintptr_t out_address{};
|
||||
uint64_t out_address{};
|
||||
uint64_t size{};
|
||||
|
||||
size = Convert<uint64_t>(GetReg64(system, 1));
|
||||
@@ -2705,7 +2705,7 @@ static void SvcWrap_GetLastThreadInfo64(Core::System& system) {
|
||||
Result ret{};
|
||||
|
||||
lp64::LastThreadContext out_context{};
|
||||
uintptr_t out_tls_address{};
|
||||
uint64_t out_tls_address{};
|
||||
uint32_t out_flags{};
|
||||
|
||||
ret = GetLastThreadInfo64(system, &out_context, &out_tls_address, &out_flags);
|
||||
@@ -3217,8 +3217,8 @@ static void SvcWrap_QueryPhysicalAddress64(Core::System& system) {
|
||||
static void SvcWrap_QueryIoMapping64(Core::System& system) {
|
||||
Result ret{};
|
||||
|
||||
uintptr_t out_address{};
|
||||
uintptr_t out_size{};
|
||||
uint64_t out_address{};
|
||||
uint64_t out_size{};
|
||||
uint64_t physical_address{};
|
||||
uint64_t size{};
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class System;
|
||||
namespace Kernel::Svc {
|
||||
|
||||
// clang-format off
|
||||
Result SetHeapSize(Core::System& system, uintptr_t* out_address, uint64_t size);
|
||||
Result SetHeapSize(Core::System& system, uint64_t* out_address, uint64_t size);
|
||||
Result SetMemoryPermission(Core::System& system, uint64_t address, uint64_t size, MemoryPermission perm);
|
||||
Result SetMemoryAttribute(Core::System& system, uint64_t address, uint64_t size, uint32_t mask, uint32_t attr);
|
||||
Result MapMemory(Core::System& system, uint64_t dst_address, uint64_t src_address, uint64_t size);
|
||||
@@ -61,7 +61,7 @@ Result FlushDataCache(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result MapPhysicalMemory(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result UnmapPhysicalMemory(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result GetDebugFutureThreadInfo(Core::System& system, lp64::LastThreadContext* out_context, uint64_t* out_thread_id, Handle debug_handle, int64_t ns);
|
||||
Result GetLastThreadInfo(Core::System& system, lp64::LastThreadContext* out_context, uintptr_t* out_tls_address, uint32_t* out_flags);
|
||||
Result GetLastThreadInfo(Core::System& system, lp64::LastThreadContext* out_context, uint64_t* out_tls_address, uint32_t* out_flags);
|
||||
Result GetResourceLimitLimitValue(Core::System& system, int64_t* out_limit_value, Handle resource_limit_handle, LimitableResource which);
|
||||
Result GetResourceLimitCurrentValue(Core::System& system, int64_t* out_current_value, Handle resource_limit_handle, LimitableResource which);
|
||||
Result SetThreadActivity(Core::System& system, Handle thread_handle, ThreadActivity thread_activity);
|
||||
@@ -94,7 +94,7 @@ Result MapTransferMemory(Core::System& system, Handle trmem_handle, uint64_t add
|
||||
Result UnmapTransferMemory(Core::System& system, Handle trmem_handle, uint64_t address, uint64_t size);
|
||||
Result CreateInterruptEvent(Core::System& system, Handle* out_read_handle, int32_t interrupt_id, InterruptType interrupt_type);
|
||||
Result QueryPhysicalAddress(Core::System& system, lp64::PhysicalMemoryInfo* out_info, uint64_t address);
|
||||
Result QueryIoMapping(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, uint64_t physical_address, uint64_t size);
|
||||
Result QueryIoMapping(Core::System& system, uint64_t* out_address, uint64_t* out_size, uint64_t physical_address, uint64_t size);
|
||||
Result CreateDeviceAddressSpace(Core::System& system, Handle* out_handle, uint64_t das_address, uint64_t das_size);
|
||||
Result AttachDeviceAddressSpace(Core::System& system, DeviceName device_name, Handle das_handle);
|
||||
Result DetachDeviceAddressSpace(Core::System& system, DeviceName device_name, Handle das_handle);
|
||||
@@ -137,7 +137,7 @@ Result SetResourceLimitLimitValue(Core::System& system, Handle resource_limit_ha
|
||||
Result MapInsecureMemory(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result UnmapInsecureMemory(Core::System& system, uint64_t address, uint64_t size);
|
||||
|
||||
Result SetHeapSize64From32(Core::System& system, uintptr_t* out_address, uint32_t size);
|
||||
Result SetHeapSize64From32(Core::System& system, uint64_t* out_address, uint32_t size);
|
||||
Result SetMemoryPermission64From32(Core::System& system, uint32_t address, uint32_t size, MemoryPermission perm);
|
||||
Result SetMemoryAttribute64From32(Core::System& system, uint32_t address, uint32_t size, uint32_t mask, uint32_t attr);
|
||||
Result MapMemory64From32(Core::System& system, uint32_t dst_address, uint32_t src_address, uint32_t size);
|
||||
@@ -182,7 +182,7 @@ Result FlushDataCache64From32(Core::System& system, uint32_t address, uint32_t s
|
||||
Result MapPhysicalMemory64From32(Core::System& system, uint32_t address, uint32_t size);
|
||||
Result UnmapPhysicalMemory64From32(Core::System& system, uint32_t address, uint32_t size);
|
||||
Result GetDebugFutureThreadInfo64From32(Core::System& system, ilp32::LastThreadContext* out_context, uint64_t* out_thread_id, Handle debug_handle, int64_t ns);
|
||||
Result GetLastThreadInfo64From32(Core::System& system, ilp32::LastThreadContext* out_context, uintptr_t* out_tls_address, uint32_t* out_flags);
|
||||
Result GetLastThreadInfo64From32(Core::System& system, ilp32::LastThreadContext* out_context, uint64_t* out_tls_address, uint32_t* out_flags);
|
||||
Result GetResourceLimitLimitValue64From32(Core::System& system, int64_t* out_limit_value, Handle resource_limit_handle, LimitableResource which);
|
||||
Result GetResourceLimitCurrentValue64From32(Core::System& system, int64_t* out_current_value, Handle resource_limit_handle, LimitableResource which);
|
||||
Result SetThreadActivity64From32(Core::System& system, Handle thread_handle, ThreadActivity thread_activity);
|
||||
@@ -215,7 +215,7 @@ Result MapTransferMemory64From32(Core::System& system, Handle trmem_handle, uint
|
||||
Result UnmapTransferMemory64From32(Core::System& system, Handle trmem_handle, uint32_t address, uint32_t size);
|
||||
Result CreateInterruptEvent64From32(Core::System& system, Handle* out_read_handle, int32_t interrupt_id, InterruptType interrupt_type);
|
||||
Result QueryPhysicalAddress64From32(Core::System& system, ilp32::PhysicalMemoryInfo* out_info, uint32_t address);
|
||||
Result QueryIoMapping64From32(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, uint64_t physical_address, uint32_t size);
|
||||
Result QueryIoMapping64From32(Core::System& system, uint64_t* out_address, uint64_t* out_size, uint64_t physical_address, uint32_t size);
|
||||
Result CreateDeviceAddressSpace64From32(Core::System& system, Handle* out_handle, uint64_t das_address, uint64_t das_size);
|
||||
Result AttachDeviceAddressSpace64From32(Core::System& system, DeviceName device_name, Handle das_handle);
|
||||
Result DetachDeviceAddressSpace64From32(Core::System& system, DeviceName device_name, Handle das_handle);
|
||||
@@ -258,7 +258,7 @@ Result SetResourceLimitLimitValue64From32(Core::System& system, Handle resource_
|
||||
Result MapInsecureMemory64From32(Core::System& system, uint32_t address, uint32_t size);
|
||||
Result UnmapInsecureMemory64From32(Core::System& system, uint32_t address, uint32_t size);
|
||||
|
||||
Result SetHeapSize64(Core::System& system, uintptr_t* out_address, uint64_t size);
|
||||
Result SetHeapSize64(Core::System& system, uint64_t* out_address, uint64_t size);
|
||||
Result SetMemoryPermission64(Core::System& system, uint64_t address, uint64_t size, MemoryPermission perm);
|
||||
Result SetMemoryAttribute64(Core::System& system, uint64_t address, uint64_t size, uint32_t mask, uint32_t attr);
|
||||
Result MapMemory64(Core::System& system, uint64_t dst_address, uint64_t src_address, uint64_t size);
|
||||
@@ -303,7 +303,7 @@ Result FlushDataCache64(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result MapPhysicalMemory64(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result UnmapPhysicalMemory64(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result GetDebugFutureThreadInfo64(Core::System& system, lp64::LastThreadContext* out_context, uint64_t* out_thread_id, Handle debug_handle, int64_t ns);
|
||||
Result GetLastThreadInfo64(Core::System& system, lp64::LastThreadContext* out_context, uintptr_t* out_tls_address, uint32_t* out_flags);
|
||||
Result GetLastThreadInfo64(Core::System& system, lp64::LastThreadContext* out_context, uint64_t* out_tls_address, uint32_t* out_flags);
|
||||
Result GetResourceLimitLimitValue64(Core::System& system, int64_t* out_limit_value, Handle resource_limit_handle, LimitableResource which);
|
||||
Result GetResourceLimitCurrentValue64(Core::System& system, int64_t* out_current_value, Handle resource_limit_handle, LimitableResource which);
|
||||
Result SetThreadActivity64(Core::System& system, Handle thread_handle, ThreadActivity thread_activity);
|
||||
@@ -336,7 +336,7 @@ Result MapTransferMemory64(Core::System& system, Handle trmem_handle, uint64_t a
|
||||
Result UnmapTransferMemory64(Core::System& system, Handle trmem_handle, uint64_t address, uint64_t size);
|
||||
Result CreateInterruptEvent64(Core::System& system, Handle* out_read_handle, int32_t interrupt_id, InterruptType interrupt_type);
|
||||
Result QueryPhysicalAddress64(Core::System& system, lp64::PhysicalMemoryInfo* out_info, uint64_t address);
|
||||
Result QueryIoMapping64(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, uint64_t physical_address, uint64_t size);
|
||||
Result QueryIoMapping64(Core::System& system, uint64_t* out_address, uint64_t* out_size, uint64_t physical_address, uint64_t size);
|
||||
Result CreateDeviceAddressSpace64(Core::System& system, Handle* out_handle, uint64_t das_address, uint64_t das_size);
|
||||
Result AttachDeviceAddressSpace64(Core::System& system, DeviceName device_name, Handle das_handle);
|
||||
Result DetachDeviceAddressSpace64(Core::System& system, DeviceName device_name, Handle das_handle);
|
||||
|
||||
@@ -12,7 +12,7 @@ Result QueryPhysicalAddress(Core::System& system, lp64::PhysicalMemoryInfo* out_
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
|
||||
Result QueryIoMapping(Core::System& system, uintptr_t* out_address, uintptr_t* out_size,
|
||||
Result QueryIoMapping(Core::System& system, uint64_t* out_address, uint64_t* out_size,
|
||||
uint64_t physical_address, uint64_t size) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
@@ -23,7 +23,7 @@ Result QueryPhysicalAddress64(Core::System& system, lp64::PhysicalMemoryInfo* ou
|
||||
R_RETURN(QueryPhysicalAddress(system, out_info, address));
|
||||
}
|
||||
|
||||
Result QueryIoMapping64(Core::System& system, uintptr_t* out_address, uintptr_t* out_size,
|
||||
Result QueryIoMapping64(Core::System& system, uint64_t* out_address, uint64_t* out_size,
|
||||
uint64_t physical_address, uint64_t size) {
|
||||
R_RETURN(QueryIoMapping(system, out_address, out_size, physical_address, size));
|
||||
}
|
||||
@@ -41,10 +41,10 @@ Result QueryPhysicalAddress64From32(Core::System& system, ilp32::PhysicalMemoryI
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result QueryIoMapping64From32(Core::System& system, uintptr_t* out_address, uintptr_t* out_size,
|
||||
Result QueryIoMapping64From32(Core::System& system, uint64_t* out_address, uint64_t* out_size,
|
||||
uint64_t physical_address, uint32_t size) {
|
||||
R_RETURN(QueryIoMapping(system, reinterpret_cast<uintptr_t*>(out_address),
|
||||
reinterpret_cast<uintptr_t*>(out_size), physical_address, size));
|
||||
R_RETURN(QueryIoMapping(system, reinterpret_cast<uint64_t*>(out_address),
|
||||
reinterpret_cast<uint64_t*>(out_size), physical_address, size));
|
||||
}
|
||||
|
||||
} // namespace Kernel::Svc
|
||||
|
||||
@@ -13,7 +13,7 @@ void FlushEntireDataCache(Core::System& system) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
Result FlushDataCache(Core::System& system, VAddr address, size_t size) {
|
||||
Result FlushDataCache(Core::System& system, uint64_t address, uint64_t size) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
@@ -33,8 +33,8 @@ Result StoreProcessDataCache(Core::System& system, Handle process_handle, uint64
|
||||
Result FlushProcessDataCache(Core::System& system, Handle process_handle, u64 address, u64 size) {
|
||||
// Validate address/size.
|
||||
R_UNLESS(size > 0, ResultInvalidSize);
|
||||
R_UNLESS(address == static_cast<uintptr_t>(address), ResultInvalidCurrentMemory);
|
||||
R_UNLESS(size == static_cast<size_t>(size), ResultInvalidCurrentMemory);
|
||||
R_UNLESS(address == static_cast<uint64_t>(address), ResultInvalidCurrentMemory);
|
||||
R_UNLESS(size == static_cast<uint64_t>(size), ResultInvalidCurrentMemory);
|
||||
|
||||
// Get the process from its handle.
|
||||
KScopedAutoObject process =
|
||||
@@ -53,7 +53,7 @@ void FlushEntireDataCache64(Core::System& system) {
|
||||
FlushEntireDataCache(system);
|
||||
}
|
||||
|
||||
Result FlushDataCache64(Core::System& system, VAddr address, size_t size) {
|
||||
Result FlushDataCache64(Core::System& system, uint64_t address, uint64_t size) {
|
||||
R_RETURN(FlushDataCache(system, address, size));
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ constexpr bool IsValidUnmapFromOwnerCodeMemoryPermission(MemoryPermission perm)
|
||||
|
||||
} // namespace
|
||||
|
||||
Result CreateCodeMemory(Core::System& system, Handle* out, VAddr address, size_t size) {
|
||||
Result CreateCodeMemory(Core::System& system, Handle* out, VAddr address, uint64_t size) {
|
||||
LOG_TRACE(Kernel_SVC, "called, address=0x{:X}, size=0x{:X}", address, size);
|
||||
|
||||
// Get kernel instance.
|
||||
@@ -64,7 +64,7 @@ Result CreateCodeMemory(Core::System& system, Handle* out, VAddr address, size_t
|
||||
}
|
||||
|
||||
Result ControlCodeMemory(Core::System& system, Handle code_memory_handle,
|
||||
CodeMemoryOperation operation, VAddr address, size_t size,
|
||||
CodeMemoryOperation operation, VAddr address, uint64_t size,
|
||||
MemoryPermission perm) {
|
||||
|
||||
LOG_TRACE(Kernel_SVC,
|
||||
|
||||
@@ -45,19 +45,19 @@ Result SetDebugThreadContext(Core::System& system, Handle debug_handle, uint64_t
|
||||
}
|
||||
|
||||
Result QueryDebugProcessMemory(Core::System& system, uint64_t out_memory_info,
|
||||
PageInfo* out_page_info, Handle debug_handle, uintptr_t address) {
|
||||
PageInfo* out_page_info, Handle process_handle, uint64_t address) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
|
||||
Result ReadDebugProcessMemory(Core::System& system, uintptr_t buffer, Handle debug_handle,
|
||||
uintptr_t address, size_t size) {
|
||||
Result ReadDebugProcessMemory(Core::System& system, uint64_t buffer, Handle debug_handle,
|
||||
uint64_t address, uint64_t size) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
|
||||
Result WriteDebugProcessMemory(Core::System& system, Handle debug_handle, uintptr_t buffer,
|
||||
uintptr_t address, size_t size) {
|
||||
Result WriteDebugProcessMemory(Core::System& system, Handle debug_handle, uint64_t buffer,
|
||||
uint64_t address, uint64_t size) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
|
||||
@@ -76,8 +76,8 @@ constexpr bool IsValidDeviceMemoryPermission(MemoryPermission device_perm) {
|
||||
}
|
||||
|
||||
Result MapDeviceAddressSpaceByForce(Core::System& system, Handle das_handle, Handle process_handle,
|
||||
uint64_t process_address, size_t size, uint64_t device_address,
|
||||
u32 option) {
|
||||
uint64_t process_address, uint64_t size,
|
||||
uint64_t device_address, u32 option) {
|
||||
// Decode the option.
|
||||
const MapDeviceAddressSpaceOption option_pack{option};
|
||||
const auto device_perm = option_pack.permission;
|
||||
@@ -90,7 +90,7 @@ Result MapDeviceAddressSpaceByForce(Core::System& system, Handle das_handle, Han
|
||||
R_UNLESS(size > 0, ResultInvalidSize);
|
||||
R_UNLESS((process_address < process_address + size), ResultInvalidCurrentMemory);
|
||||
R_UNLESS((device_address < device_address + size), ResultInvalidMemoryRegion);
|
||||
R_UNLESS((process_address == static_cast<uintptr_t>(process_address)),
|
||||
R_UNLESS((process_address == static_cast<uint64_t>(process_address)),
|
||||
ResultInvalidCurrentMemory);
|
||||
R_UNLESS(IsValidDeviceMemoryPermission(device_perm), ResultInvalidNewMemoryPermission);
|
||||
R_UNLESS(reserved == 0, ResultInvalidEnumValue);
|
||||
@@ -116,8 +116,8 @@ Result MapDeviceAddressSpaceByForce(Core::System& system, Handle das_handle, Han
|
||||
}
|
||||
|
||||
Result MapDeviceAddressSpaceAligned(Core::System& system, Handle das_handle, Handle process_handle,
|
||||
uint64_t process_address, size_t size, uint64_t device_address,
|
||||
u32 option) {
|
||||
uint64_t process_address, uint64_t size,
|
||||
uint64_t device_address, u32 option) {
|
||||
// Decode the option.
|
||||
const MapDeviceAddressSpaceOption option_pack{option};
|
||||
const auto device_perm = option_pack.permission;
|
||||
@@ -131,7 +131,7 @@ Result MapDeviceAddressSpaceAligned(Core::System& system, Handle das_handle, Han
|
||||
R_UNLESS(size > 0, ResultInvalidSize);
|
||||
R_UNLESS((process_address < process_address + size), ResultInvalidCurrentMemory);
|
||||
R_UNLESS((device_address < device_address + size), ResultInvalidMemoryRegion);
|
||||
R_UNLESS((process_address == static_cast<uintptr_t>(process_address)),
|
||||
R_UNLESS((process_address == static_cast<uint64_t>(process_address)),
|
||||
ResultInvalidCurrentMemory);
|
||||
R_UNLESS(IsValidDeviceMemoryPermission(device_perm), ResultInvalidNewMemoryPermission);
|
||||
R_UNLESS(reserved == 0, ResultInvalidEnumValue);
|
||||
@@ -157,7 +157,7 @@ Result MapDeviceAddressSpaceAligned(Core::System& system, Handle das_handle, Han
|
||||
}
|
||||
|
||||
Result UnmapDeviceAddressSpace(Core::System& system, Handle das_handle, Handle process_handle,
|
||||
uint64_t process_address, size_t size, uint64_t device_address) {
|
||||
uint64_t process_address, uint64_t size, uint64_t device_address) {
|
||||
// Validate input.
|
||||
R_UNLESS(Common::IsAligned(process_address, PageSize), ResultInvalidAddress);
|
||||
R_UNLESS(Common::IsAligned(device_address, PageSize), ResultInvalidAddress);
|
||||
@@ -165,7 +165,7 @@ Result UnmapDeviceAddressSpace(Core::System& system, Handle das_handle, Handle p
|
||||
R_UNLESS(size > 0, ResultInvalidSize);
|
||||
R_UNLESS((process_address < process_address + size), ResultInvalidCurrentMemory);
|
||||
R_UNLESS((device_address < device_address + size), ResultInvalidMemoryRegion);
|
||||
R_UNLESS((process_address == static_cast<uintptr_t>(process_address)),
|
||||
R_UNLESS((process_address == static_cast<uint64_t>(process_address)),
|
||||
ResultInvalidCurrentMemory);
|
||||
|
||||
// Get the device address space.
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
|
||||
namespace Kernel::Svc {
|
||||
|
||||
Result MapInsecureMemory(Core::System& system, uintptr_t address, size_t size) {
|
||||
Result MapInsecureMemory(Core::System& system, uint64_t address, uint64_t size) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
|
||||
Result UnmapInsecureMemory(Core::System& system, uintptr_t address, size_t size) {
|
||||
Result UnmapInsecureMemory(Core::System& system, uint64_t address, uint64_t size) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
|
||||
@@ -12,19 +12,19 @@ Result CreateIoPool(Core::System& system, Handle* out, IoPoolType pool_type) {
|
||||
}
|
||||
|
||||
Result CreateIoRegion(Core::System& system, Handle* out, Handle io_pool_handle, uint64_t phys_addr,
|
||||
size_t size, MemoryMapping mapping, MemoryPermission perm) {
|
||||
uint64_t size, MemoryMapping mapping, MemoryPermission perm) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
|
||||
Result MapIoRegion(Core::System& system, Handle io_region_handle, uintptr_t address, size_t size,
|
||||
Result MapIoRegion(Core::System& system, Handle io_region_handle, uint64_t address, uint64_t size,
|
||||
MemoryPermission map_perm) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
|
||||
Result UnmapIoRegion(Core::System& system, Handle io_region_handle, uintptr_t address,
|
||||
size_t size) {
|
||||
Result UnmapIoRegion(Core::System& system, Handle io_region_handle, uint64_t address,
|
||||
uint64_t size) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ Result SetUnsafeLimit64(Core::System& system, uint64_t limit) {
|
||||
R_RETURN(SetUnsafeLimit(system, limit));
|
||||
}
|
||||
|
||||
Result SetHeapSize64From32(Core::System& system, uintptr_t* out_address, uint32_t size) {
|
||||
Result SetHeapSize64From32(Core::System& system, uint64_t* out_address, uint32_t size) {
|
||||
R_RETURN(SetHeapSize(system, out_address, size));
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "core/core.h"
|
||||
#include "core/hle/kernel/k_client_port.h"
|
||||
#include "core/hle/kernel/k_client_session.h"
|
||||
#include "core/hle/kernel/k_object_name.h"
|
||||
#include "core/hle/kernel/k_port.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/svc.h"
|
||||
@@ -64,7 +65,7 @@ Result ConnectToNamedPort(Core::System& system, Handle* out, VAddr port_name_add
|
||||
}
|
||||
|
||||
Result CreatePort(Core::System& system, Handle* out_server, Handle* out_client,
|
||||
int32_t max_sessions, bool is_light, uintptr_t name) {
|
||||
int32_t max_sessions, bool is_light, uint64_t name) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
@@ -74,10 +75,57 @@ Result ConnectToPort(Core::System& system, Handle* out_handle, Handle port) {
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
|
||||
Result ManageNamedPort(Core::System& system, Handle* out_server_handle, uint64_t name,
|
||||
Result ManageNamedPort(Core::System& system, Handle* out_server_handle, uint64_t user_name,
|
||||
int32_t max_sessions) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
// Copy the provided name from user memory to kernel memory.
|
||||
std::array<char, KObjectName::NameLengthMax> name{};
|
||||
system.Memory().ReadBlock(user_name, name.data(), sizeof(name));
|
||||
|
||||
// Validate that sessions and name are valid.
|
||||
R_UNLESS(max_sessions >= 0, ResultOutOfRange);
|
||||
R_UNLESS(name[sizeof(name) - 1] == '\x00', ResultOutOfRange);
|
||||
|
||||
if (max_sessions > 0) {
|
||||
// Get the current handle table.
|
||||
auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable();
|
||||
|
||||
// Create a new port.
|
||||
KPort* port = KPort::Create(system.Kernel());
|
||||
R_UNLESS(port != nullptr, ResultOutOfResource);
|
||||
|
||||
// Initialize the new port.
|
||||
port->Initialize(max_sessions, false, "");
|
||||
|
||||
// Register the port.
|
||||
KPort::Register(system.Kernel(), port);
|
||||
|
||||
// Ensure that our only reference to the port is in the handle table when we're done.
|
||||
SCOPE_EXIT({
|
||||
port->GetClientPort().Close();
|
||||
port->GetServerPort().Close();
|
||||
});
|
||||
|
||||
// Register the handle in the table.
|
||||
R_TRY(handle_table.Add(out_server_handle, std::addressof(port->GetServerPort())));
|
||||
ON_RESULT_FAILURE {
|
||||
handle_table.Remove(*out_server_handle);
|
||||
};
|
||||
|
||||
// Create a new object name.
|
||||
R_TRY(KObjectName::NewFromName(system.Kernel(), std::addressof(port->GetClientPort()),
|
||||
name.data()));
|
||||
} else /* if (max_sessions == 0) */ {
|
||||
// Ensure that this else case is correct.
|
||||
ASSERT(max_sessions == 0);
|
||||
|
||||
// If we're closing, there's no server handle.
|
||||
*out_server_handle = InvalidHandle;
|
||||
|
||||
// Delete the object.
|
||||
R_TRY(KObjectName::Delete<KClientPort>(system.Kernel(), name.data()));
|
||||
}
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ConnectToNamedPort64(Core::System& system, Handle* out_handle, uint64_t name) {
|
||||
|
||||
@@ -37,8 +37,8 @@ Result SetProcessMemoryPermission(Core::System& system, Handle process_handle, V
|
||||
R_UNLESS(Common::IsAligned(size, PageSize), ResultInvalidSize);
|
||||
R_UNLESS(size > 0, ResultInvalidSize);
|
||||
R_UNLESS((address < address + size), ResultInvalidCurrentMemory);
|
||||
R_UNLESS(address == static_cast<uintptr_t>(address), ResultInvalidCurrentMemory);
|
||||
R_UNLESS(size == static_cast<size_t>(size), ResultInvalidCurrentMemory);
|
||||
R_UNLESS(address == static_cast<uint64_t>(address), ResultInvalidCurrentMemory);
|
||||
R_UNLESS(size == static_cast<uint64_t>(size), ResultInvalidCurrentMemory);
|
||||
|
||||
// Validate the memory permission.
|
||||
R_UNLESS(IsValidProcessMemoryPermission(perm), ResultInvalidNewMemoryPermission);
|
||||
|
||||
@@ -443,7 +443,7 @@ def emit_wrapper(wrapped_fn, suffix, register_info, arguments, byte_size):
|
||||
lines.append("")
|
||||
|
||||
for output_type, var_name, _, is_address in output_writes:
|
||||
output_type = "uintptr_t" if is_address else output_type
|
||||
output_type = "uint64_t" if is_address else output_type
|
||||
lines.append(f"{output_type} {var_name}{{}};")
|
||||
for input_type, var_name, _ in input_reads:
|
||||
lines.append(f"{input_type} {var_name}{{}};")
|
||||
@@ -630,7 +630,7 @@ def emit_call(bitness, names, suffix):
|
||||
def build_fn_declaration(return_type, name, arguments):
|
||||
arg_list = ["Core::System& system"]
|
||||
for arg in arguments:
|
||||
type_name = "uintptr_t" if arg.is_address else arg.type_name
|
||||
type_name = "uint64_t" if arg.is_address else arg.type_name
|
||||
pointer = "*" if arg.is_output and not arg.is_outptr else ""
|
||||
arg_list.append(f"{type_name}{pointer} {arg.var_name}")
|
||||
|
||||
|
||||
@@ -76,6 +76,8 @@ public:
|
||||
{141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+
|
||||
{142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+
|
||||
{150, nullptr, "CreateAuthorizationRequest"},
|
||||
{160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"},
|
||||
{161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -136,7 +138,10 @@ public:
|
||||
{140, nullptr, "GetNetworkServiceLicenseCache"}, // 5.0.0+
|
||||
{141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+
|
||||
{142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+
|
||||
{143, nullptr, "GetNetworkServiceLicenseCacheEx"},
|
||||
{150, nullptr, "CreateAuthorizationRequest"},
|
||||
{160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"},
|
||||
{161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"},
|
||||
{200, nullptr, "IsRegistered"},
|
||||
{201, nullptr, "RegisterAsync"},
|
||||
{202, nullptr, "UnregisterAsync"},
|
||||
@@ -242,6 +247,7 @@ public:
|
||||
{100, nullptr, "GetRequestWithTheme"},
|
||||
{101, nullptr, "IsNetworkServiceAccountReplaced"},
|
||||
{199, nullptr, "GetUrlForIntroductionOfExtraMembership"}, // 2.0.0 - 5.1.0
|
||||
{200, nullptr, "ApplyAsyncWithAuthorizedToken"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -647,9 +653,11 @@ public:
|
||||
{0, nullptr, "EnsureAuthenticationTokenCacheAsync"},
|
||||
{1, nullptr, "LoadAuthenticationTokenCache"},
|
||||
{2, nullptr, "InvalidateAuthenticationTokenCache"},
|
||||
{3, nullptr, "IsDeviceAuthenticationTokenCacheAvailable"},
|
||||
{10, nullptr, "EnsureEdgeTokenCacheAsync"},
|
||||
{11, nullptr, "LoadEdgeTokenCache"},
|
||||
{12, nullptr, "InvalidateEdgeTokenCache"},
|
||||
{13, nullptr, "IsEdgeTokenCacheAvailable"},
|
||||
{20, nullptr, "EnsureApplicationAuthenticationCacheAsync"},
|
||||
{21, nullptr, "LoadApplicationAuthenticationTokenCache"},
|
||||
{22, nullptr, "LoadApplicationNetworkServiceClientConfigCache"},
|
||||
|
||||
@@ -55,6 +55,10 @@ ACC_SU::ACC_SU(std::shared_ptr<Module> module_, std::shared_ptr<ProfileManager>
|
||||
{290, nullptr, "ProxyProcedureForGuestLoginWithNintendoAccount"},
|
||||
{291, nullptr, "ProxyProcedureForFloatingRegistrationWithNintendoAccount"},
|
||||
{299, nullptr, "SuspendBackgroundDaemon"},
|
||||
{900, nullptr, "SetUserUnqualifiedForDebug"},
|
||||
{901, nullptr, "UnsetUserUnqualifiedForDebug"},
|
||||
{902, nullptr, "ListUsersUnqualifiedForDebug"},
|
||||
{910, nullptr, "RefreshFirmwareSettingsForDebug"},
|
||||
{997, nullptr, "DebugInvalidateTokenCacheForUser"},
|
||||
{998, nullptr, "DebugSetUserStateClose"},
|
||||
{999, nullptr, "DebugSetUserStateOpen"},
|
||||
|
||||
@@ -226,6 +226,8 @@ IDebugFunctions::IDebugFunctions(Core::System& system_)
|
||||
{30, nullptr, "RequestLaunchApplicationWithUserAndArgumentForDebug"},
|
||||
{31, nullptr, "RequestLaunchApplicationByApplicationLaunchInfoForDebug"},
|
||||
{40, nullptr, "GetAppletResourceUsageInfo"},
|
||||
{50, nullptr, "AddSystemProgramIdAndAppletIdForDebug"},
|
||||
{51, nullptr, "AddOperationConfirmedLibraryAppletIdForDebug"},
|
||||
{100, nullptr, "SetCpuBoostModeForApplet"},
|
||||
{101, nullptr, "CancelCpuBoostModeForApplet"},
|
||||
{110, nullptr, "PushToAppletBoundChannelForDebug"},
|
||||
@@ -237,6 +239,8 @@ IDebugFunctions::IDebugFunctions(Core::System& system_)
|
||||
{131, nullptr, "FriendInvitationClearApplicationParameter"},
|
||||
{132, nullptr, "FriendInvitationPushApplicationParameter"},
|
||||
{140, nullptr, "RestrictPowerOperationForSecureLaunchModeForDebug"},
|
||||
{200, nullptr, "CreateFloatingLibraryAppletAccepterForDebug"},
|
||||
{300, nullptr, "TerminateAllRunningApplicationsForDebug"},
|
||||
{900, nullptr, "GetGrcProcessLaunchedSystemEvent"},
|
||||
};
|
||||
// clang-format on
|
||||
@@ -1855,6 +1859,8 @@ IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_)
|
||||
{31, nullptr, "GetWriterLockAccessorEx"},
|
||||
{40, nullptr, "IsSleepEnabled"},
|
||||
{41, nullptr, "IsRebootEnabled"},
|
||||
{50, nullptr, "LaunchSystemApplet"},
|
||||
{51, nullptr, "LaunchStarter"},
|
||||
{100, nullptr, "PopRequestLaunchApplicationForDebug"},
|
||||
{110, nullptr, "IsForceTerminateApplicationDisabledForDebug"},
|
||||
{200, nullptr, "LaunchDevMenu"},
|
||||
|
||||
@@ -129,6 +129,9 @@ AOC_U::AOC_U(Core::System& system_)
|
||||
{101, &AOC_U::CreatePermanentEcPurchasedEventManager, "CreatePermanentEcPurchasedEventManager"},
|
||||
{110, nullptr, "CreateContentsServiceManager"},
|
||||
{200, nullptr, "SetRequiredAddOnContentsOnContentsAvailabilityTransition"},
|
||||
{300, nullptr, "SetupHostAddOnContent"},
|
||||
{301, nullptr, "GetRegisteredAddOnContentPath"},
|
||||
{302, nullptr, "UpdateCachedList"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
||||
@@ -362,6 +362,8 @@ HwOpus::HwOpus(Core::System& system_) : ServiceFramework{system_, "hwopus"} {
|
||||
{5, &HwOpus::GetWorkBufferSizeEx, "GetWorkBufferSizeEx"},
|
||||
{6, nullptr, "OpenHardwareOpusDecoderForMultiStreamEx"},
|
||||
{7, &HwOpus::GetWorkBufferSizeForMultiStreamEx, "GetWorkBufferSizeForMultiStreamEx"},
|
||||
{8, nullptr, "GetWorkBufferSizeExEx"},
|
||||
{9, nullptr, "GetWorkBufferSizeForMultiStreamExEx"},
|
||||
};
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
@@ -65,6 +65,11 @@ void Controller_Gesture::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
||||
}
|
||||
|
||||
void Controller_Gesture::ReadTouchInput() {
|
||||
if (!Settings::values.touchscreen.enabled) {
|
||||
fingers = {};
|
||||
return;
|
||||
}
|
||||
|
||||
const auto touch_status = console->GetTouch();
|
||||
for (std::size_t id = 0; id < fingers.size(); ++id) {
|
||||
fingers[id] = touch_status[id];
|
||||
|
||||
@@ -33,10 +33,11 @@ void Controller_Mouse::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
||||
return;
|
||||
}
|
||||
|
||||
next_state = {};
|
||||
|
||||
const auto& last_entry = shared_memory->mouse_lifo.ReadCurrentEntry().state;
|
||||
next_state.sampling_number = last_entry.sampling_number + 1;
|
||||
|
||||
next_state.attribute.raw = 0;
|
||||
if (Settings::values.mouse_enabled) {
|
||||
const auto& mouse_button_state = emulated_devices->GetMouseButtons();
|
||||
const auto& mouse_position_state = emulated_devices->GetMousePosition();
|
||||
|
||||
@@ -58,6 +58,11 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin
|
||||
}
|
||||
|
||||
if (!finger.pressed && current_touch.pressed) {
|
||||
// Ignore all touch fingers if disabled
|
||||
if (!Settings::values.touchscreen.enabled) {
|
||||
continue;
|
||||
}
|
||||
|
||||
finger.attribute.start_touch.Assign(1);
|
||||
finger.pressed = true;
|
||||
finger.position = current_touch.position;
|
||||
|
||||
@@ -63,6 +63,7 @@ IAppletResource::IAppletResource(Core::System& system_,
|
||||
MakeControllerWithServiceContext<Controller_NPad>(HidController::NPad, shared_memory);
|
||||
MakeController<Controller_Gesture>(HidController::Gesture, shared_memory);
|
||||
MakeController<Controller_ConsoleSixAxis>(HidController::ConsoleSixAxisSensor, shared_memory);
|
||||
MakeController<Controller_Stubbed>(HidController::DebugMouse, shared_memory);
|
||||
MakeControllerWithServiceContext<Controller_Palma>(HidController::Palma, shared_memory);
|
||||
|
||||
// Homebrew doesn't try to activate some controllers, so we activate them by default
|
||||
@@ -74,6 +75,7 @@ IAppletResource::IAppletResource(Core::System& system_,
|
||||
GetController<Controller_Stubbed>(HidController::CaptureButton).SetCommonHeaderOffset(0x5000);
|
||||
GetController<Controller_Stubbed>(HidController::InputDetector).SetCommonHeaderOffset(0x5200);
|
||||
GetController<Controller_Stubbed>(HidController::UniquePad).SetCommonHeaderOffset(0x5A00);
|
||||
GetController<Controller_Stubbed>(HidController::DebugMouse).SetCommonHeaderOffset(0x3DC00);
|
||||
|
||||
// Register update callbacks
|
||||
npad_update_event = Core::Timing::CreateEvent(
|
||||
@@ -236,6 +238,7 @@ Hid::Hid(Core::System& system_)
|
||||
{1, &Hid::ActivateDebugPad, "ActivateDebugPad"},
|
||||
{11, &Hid::ActivateTouchScreen, "ActivateTouchScreen"},
|
||||
{21, &Hid::ActivateMouse, "ActivateMouse"},
|
||||
{26, nullptr, "ActivateDebugMouse"},
|
||||
{31, &Hid::ActivateKeyboard, "ActivateKeyboard"},
|
||||
{32, &Hid::SendKeyboardLockKeyEvent, "SendKeyboardLockKeyEvent"},
|
||||
{40, nullptr, "AcquireXpadIdEventHandle"},
|
||||
@@ -2380,6 +2383,8 @@ public:
|
||||
{20, nullptr, "DeactivateMouse"},
|
||||
{21, nullptr, "SetMouseAutoPilotState"},
|
||||
{22, nullptr, "UnsetMouseAutoPilotState"},
|
||||
{25, nullptr, "SetDebugMouseAutoPilotState"},
|
||||
{26, nullptr, "UnsetDebugMouseAutoPilotState"},
|
||||
{30, nullptr, "DeactivateKeyboard"},
|
||||
{31, nullptr, "SetKeyboardAutoPilotState"},
|
||||
{32, nullptr, "UnsetKeyboardAutoPilotState"},
|
||||
@@ -2495,6 +2500,7 @@ public:
|
||||
{2000, nullptr, "DeactivateDigitizer"},
|
||||
{2001, nullptr, "SetDigitizerAutoPilotState"},
|
||||
{2002, nullptr, "UnsetDigitizerAutoPilotState"},
|
||||
{2002, nullptr, "ReloadFirmwareDebugSettings"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ enum class HidController : std::size_t {
|
||||
NPad,
|
||||
Gesture,
|
||||
ConsoleSixAxisSensor,
|
||||
DebugMouse,
|
||||
Palma,
|
||||
|
||||
MaxControllers,
|
||||
|
||||
@@ -91,7 +91,7 @@ std::optional<std::size_t> HidBus::GetDeviceIndexFromHandle(BusHandle handle) co
|
||||
if (handle.abstracted_pad_id == device_handle.abstracted_pad_id &&
|
||||
handle.internal_index == device_handle.internal_index &&
|
||||
handle.player_number == device_handle.player_number &&
|
||||
handle.bus_type == device_handle.bus_type &&
|
||||
handle.bus_type_id == device_handle.bus_type_id &&
|
||||
handle.is_valid == device_handle.is_valid) {
|
||||
return i;
|
||||
}
|
||||
@@ -123,7 +123,7 @@ void HidBus::GetBusHandle(Kernel::HLERequestContext& ctx) {
|
||||
continue;
|
||||
}
|
||||
if (static_cast<Core::HID::NpadIdType>(handle.player_number) == parameters.npad_id &&
|
||||
handle.bus_type == parameters.bus_type) {
|
||||
handle.bus_type_id == static_cast<u8>(parameters.bus_type)) {
|
||||
is_handle_found = true;
|
||||
handle_index = i;
|
||||
break;
|
||||
@@ -140,7 +140,7 @@ void HidBus::GetBusHandle(Kernel::HLERequestContext& ctx) {
|
||||
.abstracted_pad_id = static_cast<u8>(i),
|
||||
.internal_index = static_cast<u8>(i),
|
||||
.player_number = static_cast<u8>(parameters.npad_id),
|
||||
.bus_type = parameters.bus_type,
|
||||
.bus_type_id = static_cast<u8>(parameters.bus_type),
|
||||
.is_valid = true,
|
||||
};
|
||||
handle_index = i;
|
||||
@@ -172,7 +172,7 @@ void HidBus::IsExternalDeviceConnected(Kernel::HLERequestContext& ctx) {
|
||||
LOG_INFO(Service_HID,
|
||||
"Called, abstracted_pad_id={}, bus_type={}, internal_index={}, "
|
||||
"player_number={}, is_valid={}",
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index,
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index,
|
||||
bus_handle_.player_number, bus_handle_.is_valid);
|
||||
|
||||
const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
|
||||
@@ -201,7 +201,7 @@ void HidBus::Initialize(Kernel::HLERequestContext& ctx) {
|
||||
LOG_INFO(Service_HID,
|
||||
"called, abstracted_pad_id={} bus_type={} internal_index={} "
|
||||
"player_number={} is_valid={}, applet_resource_user_id={}",
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index,
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index,
|
||||
bus_handle_.player_number, bus_handle_.is_valid, applet_resource_user_id);
|
||||
|
||||
is_hidbus_enabled = true;
|
||||
@@ -253,7 +253,7 @@ void HidBus::Finalize(Kernel::HLERequestContext& ctx) {
|
||||
LOG_INFO(Service_HID,
|
||||
"called, abstracted_pad_id={}, bus_type={}, internal_index={}, "
|
||||
"player_number={}, is_valid={}, applet_resource_user_id={}",
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index,
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index,
|
||||
bus_handle_.player_number, bus_handle_.is_valid, applet_resource_user_id);
|
||||
|
||||
const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
|
||||
@@ -301,7 +301,7 @@ void HidBus::EnableExternalDevice(Kernel::HLERequestContext& ctx) {
|
||||
"called, enable={}, abstracted_pad_id={}, bus_type={}, internal_index={}, "
|
||||
"player_number={}, is_valid={}, inval={}, applet_resource_user_id{}",
|
||||
parameters.enable, parameters.bus_handle.abstracted_pad_id,
|
||||
parameters.bus_handle.bus_type, parameters.bus_handle.internal_index,
|
||||
parameters.bus_handle.bus_type_id, parameters.bus_handle.internal_index,
|
||||
parameters.bus_handle.player_number, parameters.bus_handle.is_valid, parameters.inval,
|
||||
parameters.applet_resource_user_id);
|
||||
|
||||
@@ -329,7 +329,7 @@ void HidBus::GetExternalDeviceId(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_HID,
|
||||
"called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, "
|
||||
"is_valid={}",
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index,
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index,
|
||||
bus_handle_.player_number, bus_handle_.is_valid);
|
||||
|
||||
const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
|
||||
@@ -357,7 +357,7 @@ void HidBus::SendCommandAsync(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_HID,
|
||||
"called, data_size={}, abstracted_pad_id={}, bus_type={}, internal_index={}, "
|
||||
"player_number={}, is_valid={}",
|
||||
data.size(), bus_handle_.abstracted_pad_id, bus_handle_.bus_type,
|
||||
data.size(), bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id,
|
||||
bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid);
|
||||
|
||||
const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
|
||||
@@ -384,7 +384,7 @@ void HidBus::GetSendCommandAsynceResult(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_HID,
|
||||
"called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, "
|
||||
"is_valid={}",
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index,
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index,
|
||||
bus_handle_.player_number, bus_handle_.is_valid);
|
||||
|
||||
const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
|
||||
@@ -413,7 +413,7 @@ void HidBus::SetEventForSendCommandAsycResult(Kernel::HLERequestContext& ctx) {
|
||||
LOG_INFO(Service_HID,
|
||||
"called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, "
|
||||
"is_valid={}",
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index,
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index,
|
||||
bus_handle_.player_number, bus_handle_.is_valid);
|
||||
|
||||
const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
|
||||
@@ -464,7 +464,7 @@ void HidBus::EnableJoyPollingReceiveMode(Kernel::HLERequestContext& ctx) {
|
||||
LOG_INFO(Service_HID,
|
||||
"called, t_mem_handle=0x{:08X}, polling_mode={}, abstracted_pad_id={}, bus_type={}, "
|
||||
"internal_index={}, player_number={}, is_valid={}",
|
||||
t_mem_handle, polling_mode_, bus_handle_.abstracted_pad_id, bus_handle_.bus_type,
|
||||
t_mem_handle, polling_mode_, bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id,
|
||||
bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid);
|
||||
|
||||
const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
|
||||
@@ -492,7 +492,7 @@ void HidBus::DisableJoyPollingReceiveMode(Kernel::HLERequestContext& ctx) {
|
||||
LOG_INFO(Service_HID,
|
||||
"called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, "
|
||||
"is_valid={}",
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index,
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index,
|
||||
bus_handle_.player_number, bus_handle_.is_valid);
|
||||
|
||||
const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
|
||||
|
||||
@@ -41,7 +41,7 @@ private:
|
||||
};
|
||||
|
||||
// This is nn::hidbus::BusType
|
||||
enum class BusType : u8 {
|
||||
enum class BusType : u32 {
|
||||
LeftJoyRail,
|
||||
RightJoyRail,
|
||||
InternalBus, // Lark microphone
|
||||
@@ -54,7 +54,7 @@ private:
|
||||
u32 abstracted_pad_id;
|
||||
u8 internal_index;
|
||||
u8 player_number;
|
||||
BusType bus_type;
|
||||
u8 bus_type_id;
|
||||
bool is_valid;
|
||||
};
|
||||
static_assert(sizeof(BusHandle) == 0x8, "BusHandle is an invalid size");
|
||||
|
||||
@@ -124,6 +124,7 @@ public:
|
||||
{12, nullptr, "InactivateContentMetaDatabase"},
|
||||
{13, nullptr, "InvalidateRightsIdCache"},
|
||||
{14, nullptr, "GetMemoryReport"},
|
||||
{15, nullptr, "ActivateFsContentStorage"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
||||
@@ -159,6 +159,8 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
|
||||
{606, nullptr, "GetContentMetaStorage"},
|
||||
{607, nullptr, "ListAvailableAddOnContent"},
|
||||
{609, nullptr, "ListAvailabilityAssuredAddOnContent"},
|
||||
{610, nullptr, "GetInstalledContentMetaStorage"},
|
||||
{611, nullptr, "PrepareAddOnContent"},
|
||||
{700, nullptr, "PushDownloadTaskList"},
|
||||
{701, nullptr, "ClearTaskStatusList"},
|
||||
{702, nullptr, "RequestDownloadTaskList"},
|
||||
@@ -228,6 +230,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
|
||||
{1900, nullptr, "IsActiveAccount"},
|
||||
{1901, nullptr, "RequestDownloadApplicationPrepurchasedRights"},
|
||||
{1902, nullptr, "GetApplicationTicketInfo"},
|
||||
{1903, nullptr, "RequestDownloadApplicationPrepurchasedRightsForAccount"},
|
||||
{2000, nullptr, "GetSystemDeliveryInfo"},
|
||||
{2001, nullptr, "SelectLatestSystemDeliveryInfo"},
|
||||
{2002, nullptr, "VerifyDeliveryProtocolVersion"},
|
||||
@@ -276,8 +279,11 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
|
||||
{2352, nullptr, "RequestResolveNoDownloadRightsError"},
|
||||
{2353, nullptr, "GetApplicationDownloadTaskInfo"},
|
||||
{2354, nullptr, "PrioritizeApplicationBackgroundTask"},
|
||||
{2355, nullptr, "Unknown2355"},
|
||||
{2356, nullptr, "Unknown2356"},
|
||||
{2355, nullptr, "PreferStorageEfficientUpdate"},
|
||||
{2356, nullptr, "RequestStorageEfficientUpdatePreferable"},
|
||||
{2357, nullptr, "EnableMultiCoreDownload"},
|
||||
{2358, nullptr, "DisableMultiCoreDownload"},
|
||||
{2359, nullptr, "IsMultiCoreDownloadEnabled"},
|
||||
{2400, nullptr, "GetPromotionInfo"},
|
||||
{2401, nullptr, "CountPromotionInfo"},
|
||||
{2402, nullptr, "ListPromotionInfo"},
|
||||
@@ -295,6 +301,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
|
||||
{2519, nullptr, "IsQualificationTransitionSupported"},
|
||||
{2520, nullptr, "IsQualificationTransitionSupportedByProcessId"},
|
||||
{2521, nullptr, "GetRightsUserChangedEvent"},
|
||||
{2522, nullptr, "IsRomRedirectionAvailable"},
|
||||
{2800, nullptr, "GetApplicationIdOfPreomia"},
|
||||
{3000, nullptr, "RegisterDeviceLockKey"},
|
||||
{3001, nullptr, "UnregisterDeviceLockKey"},
|
||||
@@ -311,6 +318,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
|
||||
{3012, nullptr, "IsApplicationTitleHidden"},
|
||||
{3013, nullptr, "IsGameCardEnabled"},
|
||||
{3014, nullptr, "IsLocalContentShareEnabled"},
|
||||
{3050, nullptr, "ListAssignELicenseTaskResult"},
|
||||
{9999, nullptr, "GetApplicationCertificate"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -954,6 +954,9 @@ BSDCFG::BSDCFG(Core::System& system_) : ServiceFramework{system_, "bsdcfg"} {
|
||||
{10, nullptr, "ClearArpEntries"},
|
||||
{11, nullptr, "ClearArpEntries2"},
|
||||
{12, nullptr, "PrintArpEntries"},
|
||||
{13, nullptr, "Unknown13"},
|
||||
{14, nullptr, "Unknown14"},
|
||||
{15, nullptr, "Unknown15"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ enum class Errno : u32 {
|
||||
INVAL = 22,
|
||||
MFILE = 24,
|
||||
MSGSIZE = 90,
|
||||
CONNRESET = 104,
|
||||
NOTCONN = 107,
|
||||
TIMEDOUT = 110,
|
||||
};
|
||||
|
||||
@@ -27,6 +27,8 @@ Errno Translate(Network::Errno value) {
|
||||
return Errno::NOTCONN;
|
||||
case Network::Errno::TIMEDOUT:
|
||||
return Errno::TIMEDOUT;
|
||||
case Network::Errno::CONNRESET:
|
||||
return Errno::CONNRESET;
|
||||
default:
|
||||
UNIMPLEMENTED_MSG("Unimplemented errno={}", value);
|
||||
return Errno::SUCCESS;
|
||||
|
||||
@@ -46,6 +46,14 @@ public:
|
||||
{25, nullptr, "GetCipherInfo"},
|
||||
{26, nullptr, "SetNextAlpnProto"},
|
||||
{27, nullptr, "GetNextAlpnProto"},
|
||||
{28, nullptr, "SetDtlsSocketDescriptor"},
|
||||
{29, nullptr, "GetDtlsHandshakeTimeout"},
|
||||
{30, nullptr, "SetPrivateOption"},
|
||||
{31, nullptr, "SetSrtpCiphers"},
|
||||
{32, nullptr, "GetSrtpCipher"},
|
||||
{33, nullptr, "ExportKeyingMaterial"},
|
||||
{34, nullptr, "SetIoTimeout"},
|
||||
{35, nullptr, "GetIoTimeout"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -69,6 +77,8 @@ public:
|
||||
{9, nullptr, "AddPolicyOid"},
|
||||
{10, nullptr, "ImportCrl"},
|
||||
{11, nullptr, "RemoveCrl"},
|
||||
{12, nullptr, "ImportClientCertKeyPki"},
|
||||
{13, nullptr, "GeneratePrivateKeyAndCert"},
|
||||
};
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
@@ -249,6 +249,9 @@ public:
|
||||
{2053, nullptr, "DestroyIndirectProducerEndPoint"},
|
||||
{2054, nullptr, "CreateIndirectConsumerEndPoint"},
|
||||
{2055, nullptr, "DestroyIndirectConsumerEndPoint"},
|
||||
{2060, nullptr, "CreateWatermarkCompositor"},
|
||||
{2062, nullptr, "SetWatermarkText"},
|
||||
{2063, nullptr, "SetWatermarkLayerStacks"},
|
||||
{2300, nullptr, "AcquireLayerTexturePresentingEvent"},
|
||||
{2301, nullptr, "ReleaseLayerTexturePresentingEvent"},
|
||||
{2302, nullptr, "GetDisplayHotplugEvent"},
|
||||
@@ -279,6 +282,8 @@ public:
|
||||
{6011, nullptr, "EnableLayerAutoClearTransitionBuffer"},
|
||||
{6012, nullptr, "DisableLayerAutoClearTransitionBuffer"},
|
||||
{6013, nullptr, "SetLayerOpacity"},
|
||||
{6014, nullptr, "AttachLayerWatermarkCompositor"},
|
||||
{6015, nullptr, "DetachLayerWatermarkCompositor"},
|
||||
{7000, nullptr, "SetContentVisibility"},
|
||||
{8000, nullptr, "SetConductorLayer"},
|
||||
{8001, nullptr, "SetTimestampTracking"},
|
||||
|
||||
@@ -14,6 +14,10 @@ VI_M::VI_M(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_,
|
||||
static const FunctionInfo functions[] = {
|
||||
{2, &VI_M::GetDisplayService, "GetDisplayService"},
|
||||
{3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
||||
{100, nullptr, "PrepareFatal"},
|
||||
{101, nullptr, "ShowFatal"},
|
||||
{102, nullptr, "DrawFatalRectangle"},
|
||||
{103, nullptr, "DrawFatalText32"},
|
||||
};
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
@@ -109,6 +109,8 @@ Errno TranslateNativeError(int e) {
|
||||
return Errno::AGAIN;
|
||||
case WSAECONNREFUSED:
|
||||
return Errno::CONNREFUSED;
|
||||
case WSAECONNRESET:
|
||||
return Errno::CONNRESET;
|
||||
case WSAEHOSTUNREACH:
|
||||
return Errno::HOSTUNREACH;
|
||||
case WSAENETDOWN:
|
||||
@@ -205,6 +207,8 @@ Errno TranslateNativeError(int e) {
|
||||
return Errno::AGAIN;
|
||||
case ECONNREFUSED:
|
||||
return Errno::CONNREFUSED;
|
||||
case ECONNRESET:
|
||||
return Errno::CONNRESET;
|
||||
case EHOSTUNREACH:
|
||||
return Errno::HOSTUNREACH;
|
||||
case ENETDOWN:
|
||||
|
||||
@@ -30,6 +30,7 @@ enum class Errno {
|
||||
NOTCONN,
|
||||
AGAIN,
|
||||
CONNREFUSED,
|
||||
CONNRESET,
|
||||
HOSTUNREACH,
|
||||
NETDOWN,
|
||||
NETUNREACH,
|
||||
|
||||
@@ -10,68 +10,122 @@
|
||||
#include "input_common/drivers/mouse.h"
|
||||
|
||||
namespace InputCommon {
|
||||
constexpr int update_time = 10;
|
||||
constexpr float default_stick_sensitivity = 0.022f;
|
||||
constexpr float default_motion_sensitivity = 0.008f;
|
||||
constexpr int mouse_axis_x = 0;
|
||||
constexpr int mouse_axis_y = 1;
|
||||
constexpr int wheel_axis_x = 2;
|
||||
constexpr int wheel_axis_y = 3;
|
||||
constexpr int motion_wheel_y = 4;
|
||||
constexpr int touch_axis_x = 10;
|
||||
constexpr int touch_axis_y = 11;
|
||||
constexpr PadIdentifier identifier = {
|
||||
.guid = Common::UUID{},
|
||||
.port = 0,
|
||||
.pad = 0,
|
||||
};
|
||||
|
||||
constexpr PadIdentifier motion_identifier = {
|
||||
.guid = Common::UUID{},
|
||||
.port = 0,
|
||||
.pad = 1,
|
||||
};
|
||||
|
||||
constexpr PadIdentifier real_mouse_identifier = {
|
||||
.guid = Common::UUID{},
|
||||
.port = 1,
|
||||
.pad = 0,
|
||||
};
|
||||
|
||||
constexpr PadIdentifier touch_identifier = {
|
||||
.guid = Common::UUID{},
|
||||
.port = 2,
|
||||
.pad = 0,
|
||||
};
|
||||
|
||||
Mouse::Mouse(std::string input_engine_) : InputEngine(std::move(input_engine_)) {
|
||||
PreSetController(identifier);
|
||||
PreSetController(real_mouse_identifier);
|
||||
PreSetController(touch_identifier);
|
||||
PreSetController(motion_identifier);
|
||||
|
||||
// Initialize all mouse axis
|
||||
PreSetAxis(identifier, mouse_axis_x);
|
||||
PreSetAxis(identifier, mouse_axis_y);
|
||||
PreSetAxis(identifier, wheel_axis_x);
|
||||
PreSetAxis(identifier, wheel_axis_y);
|
||||
PreSetAxis(identifier, motion_wheel_y);
|
||||
PreSetAxis(identifier, touch_axis_x);
|
||||
PreSetAxis(identifier, touch_axis_y);
|
||||
PreSetAxis(real_mouse_identifier, mouse_axis_x);
|
||||
PreSetAxis(real_mouse_identifier, mouse_axis_y);
|
||||
PreSetAxis(touch_identifier, mouse_axis_x);
|
||||
PreSetAxis(touch_identifier, mouse_axis_y);
|
||||
|
||||
// Initialize variables
|
||||
mouse_origin = {};
|
||||
last_mouse_position = {};
|
||||
wheel_position = {};
|
||||
last_mouse_change = {};
|
||||
last_motion_change = {};
|
||||
|
||||
update_thread = std::jthread([this](std::stop_token stop_token) { UpdateThread(stop_token); });
|
||||
}
|
||||
|
||||
void Mouse::UpdateThread(std::stop_token stop_token) {
|
||||
Common::SetCurrentThreadName("Mouse");
|
||||
constexpr int update_time = 10;
|
||||
|
||||
while (!stop_token.stop_requested()) {
|
||||
if (Settings::values.mouse_panning && !Settings::values.mouse_enabled) {
|
||||
// Slow movement by 4%
|
||||
last_mouse_change *= 0.96f;
|
||||
const float sensitivity =
|
||||
Settings::values.mouse_panning_sensitivity.GetValue() * 0.022f;
|
||||
SetAxis(identifier, mouse_axis_x, last_mouse_change.x * sensitivity);
|
||||
SetAxis(identifier, mouse_axis_y, -last_mouse_change.y * sensitivity);
|
||||
}
|
||||
UpdateStickInput();
|
||||
UpdateMotionInput();
|
||||
|
||||
SetAxis(identifier, motion_wheel_y, 0.0f);
|
||||
|
||||
if (mouse_panning_timout++ > 20) {
|
||||
if (mouse_panning_timeout++ > 20) {
|
||||
StopPanning();
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(update_time));
|
||||
}
|
||||
}
|
||||
|
||||
void Mouse::MouseMove(int x, int y, f32 touch_x, f32 touch_y, int center_x, int center_y) {
|
||||
// If native mouse is enabled just set the screen coordinates
|
||||
if (Settings::values.mouse_enabled) {
|
||||
SetAxis(identifier, mouse_axis_x, touch_x);
|
||||
SetAxis(identifier, mouse_axis_y, touch_y);
|
||||
void Mouse::UpdateStickInput() {
|
||||
if (!Settings::values.mouse_panning) {
|
||||
return;
|
||||
}
|
||||
|
||||
SetAxis(identifier, touch_axis_x, touch_x);
|
||||
SetAxis(identifier, touch_axis_y, touch_y);
|
||||
const float sensitivity =
|
||||
Settings::values.mouse_panning_sensitivity.GetValue() * default_stick_sensitivity;
|
||||
|
||||
// Slow movement by 4%
|
||||
last_mouse_change *= 0.96f;
|
||||
SetAxis(identifier, mouse_axis_x, last_mouse_change.x * sensitivity);
|
||||
SetAxis(identifier, mouse_axis_y, -last_mouse_change.y * sensitivity);
|
||||
}
|
||||
|
||||
void Mouse::UpdateMotionInput() {
|
||||
const float sensitivity =
|
||||
Settings::values.mouse_panning_sensitivity.GetValue() * default_motion_sensitivity;
|
||||
|
||||
// Slow movement by 7%
|
||||
if (Settings::values.mouse_panning) {
|
||||
last_motion_change *= 0.93f;
|
||||
} else {
|
||||
last_motion_change.z *= 0.93f;
|
||||
}
|
||||
|
||||
const BasicMotion motion_data{
|
||||
.gyro_x = last_motion_change.x * sensitivity,
|
||||
.gyro_y = last_motion_change.y * sensitivity,
|
||||
.gyro_z = last_motion_change.z * sensitivity,
|
||||
.accel_x = 0,
|
||||
.accel_y = 0,
|
||||
.accel_z = 0,
|
||||
.delta_timestamp = update_time * 1000,
|
||||
};
|
||||
|
||||
SetMotion(motion_identifier, 0, motion_data);
|
||||
}
|
||||
|
||||
void Mouse::Move(int x, int y, int center_x, int center_y) {
|
||||
if (Settings::values.mouse_panning) {
|
||||
mouse_panning_timeout = 0;
|
||||
|
||||
auto mouse_change =
|
||||
(Common::MakeVec(x, y) - Common::MakeVec(center_x, center_y)).Cast<float>();
|
||||
mouse_panning_timout = 0;
|
||||
Common::Vec3<float> motion_change{-mouse_change.y, -mouse_change.x, last_motion_change.z};
|
||||
|
||||
const auto move_distance = mouse_change.Length();
|
||||
if (move_distance == 0) {
|
||||
@@ -87,6 +141,7 @@ void Mouse::MouseMove(int x, int y, f32 touch_x, f32 touch_y, int center_x, int
|
||||
|
||||
// Average mouse movements
|
||||
last_mouse_change = (last_mouse_change * 0.91f) + (mouse_change * 0.09f);
|
||||
last_motion_change = (last_motion_change * 0.69f) + (motion_change * 0.31f);
|
||||
|
||||
const auto last_move_distance = last_mouse_change.Length();
|
||||
|
||||
@@ -110,35 +165,66 @@ void Mouse::MouseMove(int x, int y, f32 touch_x, f32 touch_y, int center_x, int
|
||||
const float sensitivity = Settings::values.mouse_panning_sensitivity.GetValue() * 0.0012f;
|
||||
SetAxis(identifier, mouse_axis_x, static_cast<float>(mouse_move.x) * sensitivity);
|
||||
SetAxis(identifier, mouse_axis_y, static_cast<float>(-mouse_move.y) * sensitivity);
|
||||
|
||||
last_motion_change = {
|
||||
static_cast<float>(-mouse_move.y) / 50.0f,
|
||||
static_cast<float>(-mouse_move.x) / 50.0f,
|
||||
last_motion_change.z,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
void Mouse::PressButton(int x, int y, f32 touch_x, f32 touch_y, MouseButton button) {
|
||||
SetAxis(identifier, touch_axis_x, touch_x);
|
||||
SetAxis(identifier, touch_axis_y, touch_y);
|
||||
void Mouse::MouseMove(f32 touch_x, f32 touch_y) {
|
||||
SetAxis(real_mouse_identifier, mouse_axis_x, touch_x);
|
||||
SetAxis(real_mouse_identifier, mouse_axis_y, touch_y);
|
||||
}
|
||||
|
||||
void Mouse::TouchMove(f32 touch_x, f32 touch_y) {
|
||||
SetAxis(touch_identifier, mouse_axis_x, touch_x);
|
||||
SetAxis(touch_identifier, mouse_axis_y, touch_y);
|
||||
}
|
||||
|
||||
void Mouse::PressButton(int x, int y, MouseButton button) {
|
||||
SetButton(identifier, static_cast<int>(button), true);
|
||||
|
||||
// Set initial analog parameters
|
||||
mouse_origin = {x, y};
|
||||
last_mouse_position = {x, y};
|
||||
button_pressed = true;
|
||||
}
|
||||
|
||||
void Mouse::PressMouseButton(MouseButton button) {
|
||||
SetButton(real_mouse_identifier, static_cast<int>(button), true);
|
||||
}
|
||||
|
||||
void Mouse::PressTouchButton(f32 touch_x, f32 touch_y, MouseButton button) {
|
||||
SetAxis(touch_identifier, mouse_axis_x, touch_x);
|
||||
SetAxis(touch_identifier, mouse_axis_y, touch_y);
|
||||
SetButton(touch_identifier, static_cast<int>(button), true);
|
||||
}
|
||||
|
||||
void Mouse::ReleaseButton(MouseButton button) {
|
||||
SetButton(identifier, static_cast<int>(button), false);
|
||||
SetButton(real_mouse_identifier, static_cast<int>(button), false);
|
||||
SetButton(touch_identifier, static_cast<int>(button), false);
|
||||
|
||||
if (!Settings::values.mouse_panning && !Settings::values.mouse_enabled) {
|
||||
if (!Settings::values.mouse_panning) {
|
||||
SetAxis(identifier, mouse_axis_x, 0);
|
||||
SetAxis(identifier, mouse_axis_y, 0);
|
||||
}
|
||||
|
||||
last_motion_change.x = 0;
|
||||
last_motion_change.y = 0;
|
||||
|
||||
button_pressed = false;
|
||||
}
|
||||
|
||||
void Mouse::MouseWheelChange(int x, int y) {
|
||||
wheel_position.x += x;
|
||||
wheel_position.y += y;
|
||||
last_motion_change.z += static_cast<f32>(y) / 100.0f;
|
||||
SetAxis(identifier, wheel_axis_x, static_cast<f32>(wheel_position.x));
|
||||
SetAxis(identifier, wheel_axis_y, static_cast<f32>(wheel_position.y));
|
||||
SetAxis(identifier, motion_wheel_y, static_cast<f32>(y) / 100.0f);
|
||||
}
|
||||
|
||||
void Mouse::ReleaseAllButtons() {
|
||||
@@ -207,6 +293,9 @@ Common::Input::ButtonNames Mouse::GetUIName(const Common::ParamPackage& params)
|
||||
if (params.Has("axis_x") && params.Has("axis_y") && params.Has("axis_z")) {
|
||||
return Common::Input::ButtonNames::Engine;
|
||||
}
|
||||
if (params.Has("motion")) {
|
||||
return Common::Input::ButtonNames::Engine;
|
||||
}
|
||||
|
||||
return Common::Input::ButtonNames::Invalid;
|
||||
}
|
||||
|
||||
@@ -37,13 +37,43 @@ public:
|
||||
* @param center_x the x-coordinate of the middle of the screen
|
||||
* @param center_y the y-coordinate of the middle of the screen
|
||||
*/
|
||||
void MouseMove(int x, int y, f32 touch_x, f32 touch_y, int center_x, int center_y);
|
||||
void Move(int x, int y, int center_x, int center_y);
|
||||
|
||||
/**
|
||||
* Sets the status of all buttons bound with the key to pressed
|
||||
* @param key_code the code of the key to press
|
||||
* Signals that real mouse has moved.
|
||||
* @param x the absolute position on the touchscreen of the cursor
|
||||
* @param y the absolute position on the touchscreen of the cursor
|
||||
*/
|
||||
void PressButton(int x, int y, f32 touch_x, f32 touch_y, MouseButton button);
|
||||
void MouseMove(f32 touch_x, f32 touch_y);
|
||||
|
||||
/**
|
||||
* Signals that touch finger has moved.
|
||||
* @param x the absolute position on the touchscreen of the cursor
|
||||
* @param y the absolute position on the touchscreen of the cursor
|
||||
*/
|
||||
void TouchMove(f32 touch_x, f32 touch_y);
|
||||
|
||||
/**
|
||||
* Sets the status of a button to pressed
|
||||
* @param x the x-coordinate of the cursor
|
||||
* @param y the y-coordinate of the cursor
|
||||
* @param button the id of the button to press
|
||||
*/
|
||||
void PressButton(int x, int y, MouseButton button);
|
||||
|
||||
/**
|
||||
* Sets the status of a mouse button to pressed
|
||||
* @param button the id of the button to press
|
||||
*/
|
||||
void PressMouseButton(MouseButton button);
|
||||
|
||||
/**
|
||||
* Sets the status of touch finger to pressed
|
||||
* @param x the absolute position on the touchscreen of the cursor
|
||||
* @param y the absolute position on the touchscreen of the cursor
|
||||
* @param button the id of the button to press
|
||||
*/
|
||||
void PressTouchButton(f32 touch_x, f32 touch_y, MouseButton button);
|
||||
|
||||
/**
|
||||
* Sets the status of all buttons bound with the key to released
|
||||
@@ -66,6 +96,8 @@ public:
|
||||
|
||||
private:
|
||||
void UpdateThread(std::stop_token stop_token);
|
||||
void UpdateStickInput();
|
||||
void UpdateMotionInput();
|
||||
void StopPanning();
|
||||
|
||||
Common::Input::ButtonNames GetUIButtonName(const Common::ParamPackage& params) const;
|
||||
@@ -73,9 +105,10 @@ private:
|
||||
Common::Vec2<int> mouse_origin;
|
||||
Common::Vec2<int> last_mouse_position;
|
||||
Common::Vec2<float> last_mouse_change;
|
||||
Common::Vec3<float> last_motion_change;
|
||||
Common::Vec2<int> wheel_position;
|
||||
bool button_pressed;
|
||||
int mouse_panning_timout{};
|
||||
int mouse_panning_timeout{};
|
||||
std::jthread update_thread;
|
||||
};
|
||||
|
||||
|
||||
@@ -142,14 +142,10 @@ void MappingFactory::RegisterMotion(const MappingData& data) {
|
||||
new_input.Set("port", static_cast<int>(data.pad.port));
|
||||
new_input.Set("pad", static_cast<int>(data.pad.pad));
|
||||
|
||||
// If engine is mouse map the mouse position as 3 axis motion
|
||||
// If engine is mouse map it automatically to mouse motion
|
||||
if (data.engine == "mouse") {
|
||||
new_input.Set("axis_x", 1);
|
||||
new_input.Set("invert_x", "-");
|
||||
new_input.Set("axis_y", 0);
|
||||
new_input.Set("axis_z", 4);
|
||||
new_input.Set("range", 1.0f);
|
||||
new_input.Set("deadzone", 0.0f);
|
||||
new_input.Set("motion", 0);
|
||||
new_input.Set("pad", 1);
|
||||
input_queue.Push(new_input);
|
||||
return;
|
||||
}
|
||||
@@ -194,6 +190,10 @@ bool MappingFactory::IsDriverValid(const MappingData& data) const {
|
||||
if (data.engine == "keyboard" && data.pad.port != 0) {
|
||||
return false;
|
||||
}
|
||||
// Only port 0 can be mapped on the mouse
|
||||
if (data.engine == "mouse" && data.pad.port != 0) {
|
||||
return false;
|
||||
}
|
||||
// To prevent mapping with two devices we disable any UDP except motion
|
||||
if (!Settings::values.enable_udp_controller && data.engine == "cemuhookudp" &&
|
||||
data.type != EngineInputType::Motion) {
|
||||
|
||||
@@ -292,7 +292,7 @@ IR::Program TranslateProgram(ObjectPool<IR::Inst>& inst_pool, ObjectPool<IR::Blo
|
||||
|
||||
Optimization::PositionPass(env, program);
|
||||
|
||||
Optimization::GlobalMemoryToStorageBufferPass(program, host_info);
|
||||
Optimization::GlobalMemoryToStorageBufferPass(program);
|
||||
Optimization::TexturePass(env, program, host_info);
|
||||
|
||||
if (Settings::values.resolution_info.active) {
|
||||
|
||||
@@ -15,7 +15,6 @@ struct HostTranslateInfo {
|
||||
bool needs_demote_reorder{}; ///< True when the device needs DemoteToHelperInvocation reordered
|
||||
bool support_snorm_render_buffer{}; ///< True when the device supports SNORM render buffers
|
||||
bool support_viewport_index_layer{}; ///< True when the device supports gl_Layer in VS
|
||||
u32 min_ssbo_alignment{}; ///< Minimum alignment supported by the device for SSBOs
|
||||
bool support_geometry_shader_passthrough{}; ///< True when the device supports geometry
|
||||
///< passthrough shaders
|
||||
};
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "shader_recompiler/frontend/ir/breadth_first_search.h"
|
||||
#include "shader_recompiler/frontend/ir/ir_emitter.h"
|
||||
#include "shader_recompiler/frontend/ir/value.h"
|
||||
#include "shader_recompiler/host_translate_info.h"
|
||||
#include "shader_recompiler/ir_opt/passes.h"
|
||||
|
||||
namespace Shader::Optimization {
|
||||
@@ -403,7 +402,7 @@ void CollectStorageBuffers(IR::Block& block, IR::Inst& inst, StorageInfo& info)
|
||||
}
|
||||
|
||||
/// Returns the offset in indices (not bytes) for an equivalent storage instruction
|
||||
IR::U32 StorageOffset(IR::Block& block, IR::Inst& inst, StorageBufferAddr buffer, u32 alignment) {
|
||||
IR::U32 StorageOffset(IR::Block& block, IR::Inst& inst, StorageBufferAddr buffer) {
|
||||
IR::IREmitter ir{block, IR::Block::InstructionList::s_iterator_to(inst)};
|
||||
IR::U32 offset;
|
||||
if (const std::optional<LowAddrInfo> low_addr{TrackLowAddress(&inst)}) {
|
||||
@@ -416,10 +415,7 @@ IR::U32 StorageOffset(IR::Block& block, IR::Inst& inst, StorageBufferAddr buffer
|
||||
}
|
||||
// Subtract the least significant 32 bits from the guest offset. The result is the storage
|
||||
// buffer offset in bytes.
|
||||
IR::U32 low_cbuf{ir.GetCbuf(ir.Imm32(buffer.index), ir.Imm32(buffer.offset))};
|
||||
|
||||
// Align the offset base to match the host alignment requirements
|
||||
low_cbuf = ir.BitwiseAnd(low_cbuf, ir.Imm32(~(alignment - 1U)));
|
||||
const IR::U32 low_cbuf{ir.GetCbuf(ir.Imm32(buffer.index), ir.Imm32(buffer.offset))};
|
||||
return ir.ISub(offset, low_cbuf);
|
||||
}
|
||||
|
||||
@@ -514,7 +510,7 @@ void Replace(IR::Block& block, IR::Inst& inst, const IR::U32& storage_index,
|
||||
}
|
||||
} // Anonymous namespace
|
||||
|
||||
void GlobalMemoryToStorageBufferPass(IR::Program& program, const HostTranslateInfo& host_info) {
|
||||
void GlobalMemoryToStorageBufferPass(IR::Program& program) {
|
||||
StorageInfo info;
|
||||
for (IR::Block* const block : program.post_order_blocks) {
|
||||
for (IR::Inst& inst : block->Instructions()) {
|
||||
@@ -538,8 +534,7 @@ void GlobalMemoryToStorageBufferPass(IR::Program& program, const HostTranslateIn
|
||||
const IR::U32 index{IR::Value{static_cast<u32>(info.set.index_of(it))}};
|
||||
IR::Block* const block{storage_inst.block};
|
||||
IR::Inst* const inst{storage_inst.inst};
|
||||
const IR::U32 offset{
|
||||
StorageOffset(*block, *inst, storage_buffer, host_info.min_ssbo_alignment)};
|
||||
const IR::U32 offset{StorageOffset(*block, *inst, storage_buffer)};
|
||||
Replace(*block, *inst, index, offset);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Shader::Optimization {
|
||||
void CollectShaderInfoPass(Environment& env, IR::Program& program);
|
||||
void ConstantPropagationPass(Environment& env, IR::Program& program);
|
||||
void DeadCodeEliminationPass(IR::Program& program);
|
||||
void GlobalMemoryToStorageBufferPass(IR::Program& program, const HostTranslateInfo& host_info);
|
||||
void GlobalMemoryToStorageBufferPass(IR::Program& program);
|
||||
void IdentityRemovalPass(IR::Program& program);
|
||||
void LowerFp16ToFp32(IR::Program& program);
|
||||
void LowerInt64ToInt32(IR::Program& program);
|
||||
|
||||
@@ -568,7 +568,7 @@ private:
|
||||
const u64* const state_words = Array<type>();
|
||||
const u64 num_query_words = size / BYTES_PER_WORD + 1;
|
||||
const u64 word_begin = offset / BYTES_PER_WORD;
|
||||
const u64 word_end = std::min(word_begin + num_query_words, NumWords());
|
||||
const u64 word_end = std::min<u64>(word_begin + num_query_words, NumWords());
|
||||
const u64 page_base = offset / BYTES_PER_PAGE;
|
||||
const u64 page_limit = Common::DivCeil(offset + size, BYTES_PER_PAGE);
|
||||
u64 begin = std::numeric_limits<u64>::max();
|
||||
|
||||
@@ -1938,21 +1938,14 @@ typename BufferCache<P>::Binding BufferCache<P>::StorageBufferBinding(GPUVAddr s
|
||||
bool is_written) const {
|
||||
const GPUVAddr gpu_addr = gpu_memory->Read<u64>(ssbo_addr);
|
||||
const u32 size = gpu_memory->Read<u32>(ssbo_addr + 8);
|
||||
const u32 alignment = runtime.GetStorageBufferAlignment();
|
||||
|
||||
const GPUVAddr aligned_gpu_addr = Common::AlignDown(gpu_addr, alignment);
|
||||
const u32 aligned_size =
|
||||
Common::AlignUp(static_cast<u32>(gpu_addr - aligned_gpu_addr) + size, alignment);
|
||||
|
||||
const std::optional<VAddr> cpu_addr = gpu_memory->GpuToCpuAddress(aligned_gpu_addr);
|
||||
const std::optional<VAddr> cpu_addr = gpu_memory->GpuToCpuAddress(gpu_addr);
|
||||
if (!cpu_addr || size == 0) {
|
||||
return NULL_BINDING;
|
||||
}
|
||||
|
||||
const VAddr cpu_end = Common::AlignUp(*cpu_addr + aligned_size, Core::Memory::YUZU_PAGESIZE);
|
||||
const VAddr cpu_end = Common::AlignUp(*cpu_addr + size, Core::Memory::YUZU_PAGESIZE);
|
||||
const Binding binding{
|
||||
.cpu_addr = *cpu_addr,
|
||||
.size = is_written ? aligned_size : static_cast<u32>(cpu_end - *cpu_addr),
|
||||
.size = is_written ? size : static_cast<u32>(cpu_end - *cpu_addr),
|
||||
.buffer_id = BufferId{},
|
||||
};
|
||||
return binding;
|
||||
|
||||
@@ -186,6 +186,7 @@ bool Maxwell3D::IsMethodExecutable(u32 method) {
|
||||
case MAXWELL3D_REG_INDEX(launch_dma):
|
||||
case MAXWELL3D_REG_INDEX(inline_data):
|
||||
case MAXWELL3D_REG_INDEX(fragment_barrier):
|
||||
case MAXWELL3D_REG_INDEX(invalidate_texture_data_cache):
|
||||
case MAXWELL3D_REG_INDEX(tiled_cache_barrier):
|
||||
return true;
|
||||
default:
|
||||
@@ -375,6 +376,9 @@ void Maxwell3D::ProcessMethodCall(u32 method, u32 argument, u32 nonshadow_argume
|
||||
return;
|
||||
case MAXWELL3D_REG_INDEX(fragment_barrier):
|
||||
return rasterizer->FragmentBarrier();
|
||||
case MAXWELL3D_REG_INDEX(invalidate_texture_data_cache):
|
||||
rasterizer->InvalidateGPUCache();
|
||||
return rasterizer->WaitForIdle();
|
||||
case MAXWELL3D_REG_INDEX(tiled_cache_barrier):
|
||||
return rasterizer->TiledCacheBarrier();
|
||||
default:
|
||||
|
||||
@@ -152,6 +152,8 @@ bool Codec::CreateGpuAvDevice() {
|
||||
void Codec::InitializeAvCodecContext() {
|
||||
av_codec_ctx = avcodec_alloc_context3(av_codec);
|
||||
av_opt_set(av_codec_ctx->priv_data, "tune", "zerolatency", 0);
|
||||
av_codec_ctx->thread_count = 0;
|
||||
av_codec_ctx->thread_type &= ~FF_THREAD_FRAME;
|
||||
}
|
||||
|
||||
void Codec::InitializeGpuDecoder() {
|
||||
|
||||
@@ -160,10 +160,6 @@ public:
|
||||
return device.CanReportMemoryUsage();
|
||||
}
|
||||
|
||||
u32 GetStorageBufferAlignment() const {
|
||||
return static_cast<u32>(device.GetShaderStorageBufferAlignment());
|
||||
}
|
||||
|
||||
private:
|
||||
static constexpr std::array PABO_LUT{
|
||||
GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV, GL_TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV,
|
||||
|
||||
@@ -236,7 +236,6 @@ ShaderCache::ShaderCache(RasterizerOpenGL& rasterizer_, Core::Frontend::EmuWindo
|
||||
.needs_demote_reorder = device.IsAmd(),
|
||||
.support_snorm_render_buffer = false,
|
||||
.support_viewport_index_layer = device.HasVertexViewportLayer(),
|
||||
.min_ssbo_alignment = static_cast<u32>(device.GetShaderStorageBufferAlignment()),
|
||||
.support_geometry_shader_passthrough = device.HasGeometryShaderPassthrough(),
|
||||
} {
|
||||
if (use_asynchronous_shaders) {
|
||||
|
||||
@@ -228,8 +228,9 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::array<SwizzleSource, 4
|
||||
|
||||
[[nodiscard]] bool CanBeAccelerated(const TextureCacheRuntime& runtime,
|
||||
const VideoCommon::ImageInfo& info) {
|
||||
if (IsPixelFormatASTC(info.format)) {
|
||||
return !runtime.HasNativeASTC() && Settings::values.accelerate_astc.GetValue();
|
||||
if (IsPixelFormatASTC(info.format) && !runtime.HasNativeASTC()) {
|
||||
return Settings::values.accelerate_astc.GetValue() &&
|
||||
!Settings::values.async_astc.GetValue();
|
||||
}
|
||||
// Disable other accelerated uploads for now as they don't implement swizzled uploads
|
||||
return false;
|
||||
@@ -258,6 +259,14 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::array<SwizzleSource, 4
|
||||
return format_info.compatibility_class == store_class;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool CanBeDecodedAsync(const TextureCacheRuntime& runtime,
|
||||
const VideoCommon::ImageInfo& info) {
|
||||
if (IsPixelFormatASTC(info.format) && !runtime.HasNativeASTC()) {
|
||||
return Settings::values.async_astc.GetValue();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
[[nodiscard]] CopyOrigin MakeCopyOrigin(VideoCommon::Offset3D offset,
|
||||
VideoCommon::SubresourceLayers subresource, GLenum target) {
|
||||
switch (target) {
|
||||
@@ -721,7 +730,9 @@ std::optional<size_t> TextureCacheRuntime::StagingBuffers::FindBuffer(size_t req
|
||||
Image::Image(TextureCacheRuntime& runtime_, const VideoCommon::ImageInfo& info_, GPUVAddr gpu_addr_,
|
||||
VAddr cpu_addr_)
|
||||
: VideoCommon::ImageBase(info_, gpu_addr_, cpu_addr_), runtime{&runtime_} {
|
||||
if (CanBeAccelerated(*runtime, info)) {
|
||||
if (CanBeDecodedAsync(*runtime, info)) {
|
||||
flags |= ImageFlagBits::AsynchronousDecode;
|
||||
} else if (CanBeAccelerated(*runtime, info)) {
|
||||
flags |= ImageFlagBits::AcceleratedUpload;
|
||||
}
|
||||
if (IsConverted(runtime->device, info.format, info.type)) {
|
||||
|
||||
@@ -330,10 +330,6 @@ bool BufferCacheRuntime::CanReportMemoryUsage() const {
|
||||
return device.CanReportMemoryUsage();
|
||||
}
|
||||
|
||||
u32 BufferCacheRuntime::GetStorageBufferAlignment() const {
|
||||
return static_cast<u32>(device.GetStorageBufferAlignment());
|
||||
}
|
||||
|
||||
void BufferCacheRuntime::Finish() {
|
||||
scheduler.Finish();
|
||||
}
|
||||
|
||||
@@ -73,8 +73,6 @@ public:
|
||||
|
||||
bool CanReportMemoryUsage() const;
|
||||
|
||||
u32 GetStorageBufferAlignment() const;
|
||||
|
||||
[[nodiscard]] StagingBufferRef UploadStagingBuffer(size_t size);
|
||||
|
||||
[[nodiscard]] StagingBufferRef DownloadStagingBuffer(size_t size);
|
||||
|
||||
@@ -344,7 +344,6 @@ PipelineCache::PipelineCache(RasterizerVulkan& rasterizer_, const Device& device
|
||||
driver_id == VK_DRIVER_ID_AMD_PROPRIETARY || driver_id == VK_DRIVER_ID_AMD_OPEN_SOURCE,
|
||||
.support_snorm_render_buffer = true,
|
||||
.support_viewport_index_layer = device.IsExtShaderViewportIndexLayerSupported(),
|
||||
.min_ssbo_alignment = static_cast<u32>(device.GetStorageBufferAlignment()),
|
||||
.support_geometry_shader_passthrough = device.IsNvGeometryShaderPassthroughSupported(),
|
||||
};
|
||||
|
||||
|
||||
@@ -1256,11 +1256,12 @@ Image::Image(TextureCacheRuntime& runtime_, const ImageInfo& info_, GPUVAddr gpu
|
||||
commit(runtime_.memory_allocator.Commit(original_image, MemoryUsage::DeviceLocal)),
|
||||
aspect_mask(ImageAspectMask(info.format)) {
|
||||
if (IsPixelFormatASTC(info.format) && !runtime->device.IsOptimalAstcSupported()) {
|
||||
if (Settings::values.accelerate_astc.GetValue()) {
|
||||
if (Settings::values.async_astc.GetValue()) {
|
||||
flags |= VideoCommon::ImageFlagBits::AsynchronousDecode;
|
||||
} else if (Settings::values.accelerate_astc.GetValue()) {
|
||||
flags |= VideoCommon::ImageFlagBits::AcceleratedUpload;
|
||||
} else {
|
||||
flags |= VideoCommon::ImageFlagBits::Converted;
|
||||
}
|
||||
flags |= VideoCommon::ImageFlagBits::Converted;
|
||||
flags |= VideoCommon::ImageFlagBits::CostlyLoad;
|
||||
}
|
||||
if (runtime->device.HasDebuggingToolAttached()) {
|
||||
|
||||
@@ -38,6 +38,9 @@ enum class ImageFlagBits : u32 {
|
||||
Rescaled = 1 << 13,
|
||||
CheckingRescalable = 1 << 14,
|
||||
IsRescalable = 1 << 15,
|
||||
|
||||
AsynchronousDecode = 1 << 16,
|
||||
IsDecoding = 1 << 17, ///< Is currently being decoded asynchornously.
|
||||
};
|
||||
DECLARE_ENUM_FLAG_OPERATORS(ImageFlagBits)
|
||||
|
||||
|
||||
@@ -85,6 +85,11 @@ void TextureCache<P>::RunGarbageCollector() {
|
||||
}
|
||||
--num_iterations;
|
||||
auto& image = slot_images[image_id];
|
||||
if (True(image.flags & ImageFlagBits::IsDecoding)) {
|
||||
// This image is still being decoded, deleting it will invalidate the slot
|
||||
// used by the async decoder thread.
|
||||
return false;
|
||||
}
|
||||
const bool must_download =
|
||||
image.IsSafeDownload() && False(image.flags & ImageFlagBits::BadOverlap);
|
||||
if (!high_priority_mode &&
|
||||
@@ -133,6 +138,8 @@ void TextureCache<P>::TickFrame() {
|
||||
sentenced_images.Tick();
|
||||
sentenced_framebuffers.Tick();
|
||||
sentenced_image_view.Tick();
|
||||
TickAsyncDecode();
|
||||
|
||||
runtime.TickFrame();
|
||||
critical_gc = 0;
|
||||
++frame_tick;
|
||||
@@ -777,6 +784,10 @@ void TextureCache<P>::RefreshContents(Image& image, ImageId image_id) {
|
||||
LOG_WARNING(HW_GPU, "MSAA image uploads are not implemented");
|
||||
return;
|
||||
}
|
||||
if (True(image.flags & ImageFlagBits::AsynchronousDecode)) {
|
||||
QueueAsyncDecode(image, image_id);
|
||||
return;
|
||||
}
|
||||
auto staging = runtime.UploadStagingBuffer(MapSizeBytes(image));
|
||||
UploadImageContents(image, staging);
|
||||
runtime.InsertUploadMemoryBarrier();
|
||||
@@ -989,6 +1000,65 @@ u64 TextureCache<P>::GetScaledImageSizeBytes(const ImageBase& image) {
|
||||
return fitted_size;
|
||||
}
|
||||
|
||||
template <class P>
|
||||
void TextureCache<P>::QueueAsyncDecode(Image& image, ImageId image_id) {
|
||||
UNIMPLEMENTED_IF(False(image.flags & ImageFlagBits::Converted));
|
||||
LOG_INFO(HW_GPU, "Queuing async texture decode");
|
||||
|
||||
image.flags |= ImageFlagBits::IsDecoding;
|
||||
auto decode = std::make_unique<AsyncDecodeContext>();
|
||||
auto* decode_ptr = decode.get();
|
||||
decode->image_id = image_id;
|
||||
async_decodes.push_back(std::move(decode));
|
||||
|
||||
Common::ScratchBuffer<u8> local_unswizzle_data_buffer(image.unswizzled_size_bytes);
|
||||
const size_t guest_size_bytes = image.guest_size_bytes;
|
||||
swizzle_data_buffer.resize_destructive(guest_size_bytes);
|
||||
gpu_memory->ReadBlockUnsafe(image.gpu_addr, swizzle_data_buffer.data(), guest_size_bytes);
|
||||
auto copies = UnswizzleImage(*gpu_memory, image.gpu_addr, image.info, swizzle_data_buffer,
|
||||
local_unswizzle_data_buffer);
|
||||
const size_t out_size = MapSizeBytes(image);
|
||||
|
||||
auto func = [out_size, copies, info = image.info,
|
||||
input = std::move(local_unswizzle_data_buffer),
|
||||
async_decode = decode_ptr]() mutable {
|
||||
async_decode->decoded_data.resize_destructive(out_size);
|
||||
std::span copies_span{copies.data(), copies.size()};
|
||||
ConvertImage(input, info, async_decode->decoded_data, copies_span);
|
||||
|
||||
// TODO: Do we need this lock?
|
||||
std::unique_lock lock{async_decode->mutex};
|
||||
async_decode->copies = std::move(copies);
|
||||
async_decode->complete = true;
|
||||
};
|
||||
texture_decode_worker.QueueWork(std::move(func));
|
||||
}
|
||||
|
||||
template <class P>
|
||||
void TextureCache<P>::TickAsyncDecode() {
|
||||
bool has_uploads{};
|
||||
auto i = async_decodes.begin();
|
||||
while (i != async_decodes.end()) {
|
||||
auto* async_decode = i->get();
|
||||
std::unique_lock lock{async_decode->mutex};
|
||||
if (!async_decode->complete) {
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
Image& image = slot_images[async_decode->image_id];
|
||||
auto staging = runtime.UploadStagingBuffer(MapSizeBytes(image));
|
||||
std::memcpy(staging.mapped_span.data(), async_decode->decoded_data.data(),
|
||||
async_decode->decoded_data.size());
|
||||
image.UploadMemory(staging, async_decode->copies);
|
||||
image.flags &= ~ImageFlagBits::IsDecoding;
|
||||
has_uploads = true;
|
||||
i = async_decodes.erase(i);
|
||||
}
|
||||
if (has_uploads) {
|
||||
runtime.InsertUploadMemoryBarrier();
|
||||
}
|
||||
}
|
||||
|
||||
template <class P>
|
||||
bool TextureCache<P>::ScaleUp(Image& image) {
|
||||
const bool has_copy = image.HasScaled();
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
#include <deque>
|
||||
#include <limits>
|
||||
#include <mutex>
|
||||
@@ -18,6 +19,7 @@
|
||||
#include "common/lru_cache.h"
|
||||
#include "common/polyfill_ranges.h"
|
||||
#include "common/scratch_buffer.h"
|
||||
#include "common/thread_worker.h"
|
||||
#include "video_core/compatible_formats.h"
|
||||
#include "video_core/control/channel_state_cache.h"
|
||||
#include "video_core/delayed_destruction_ring.h"
|
||||
@@ -54,6 +56,14 @@ struct ImageViewInOut {
|
||||
ImageViewId id{};
|
||||
};
|
||||
|
||||
struct AsyncDecodeContext {
|
||||
ImageId image_id;
|
||||
Common::ScratchBuffer<u8> decoded_data;
|
||||
std::vector<BufferImageCopy> copies;
|
||||
std::mutex mutex;
|
||||
std::atomic_bool complete;
|
||||
};
|
||||
|
||||
using TextureCacheGPUMap = std::unordered_map<u64, std::vector<ImageId>, Common::IdentityHash<u64>>;
|
||||
|
||||
class TextureCacheChannelInfo : public ChannelInfo {
|
||||
@@ -377,6 +387,9 @@ private:
|
||||
bool ScaleDown(Image& image);
|
||||
u64 GetScaledImageSizeBytes(const ImageBase& image);
|
||||
|
||||
void QueueAsyncDecode(Image& image, ImageId image_id);
|
||||
void TickAsyncDecode();
|
||||
|
||||
Runtime& runtime;
|
||||
|
||||
VideoCore::RasterizerInterface& rasterizer;
|
||||
@@ -430,6 +443,9 @@ private:
|
||||
|
||||
u64 modification_tick = 0;
|
||||
u64 frame_tick = 0;
|
||||
|
||||
Common::ThreadWorker texture_decode_worker{1, "TextureDecoder"};
|
||||
std::vector<std::unique_ptr<AsyncDecodeContext>> async_decodes;
|
||||
};
|
||||
|
||||
} // namespace VideoCommon
|
||||
|
||||
@@ -1656,8 +1656,8 @@ void Decompress(std::span<const uint8_t> data, uint32_t width, uint32_t height,
|
||||
const u32 rows = Common::DivideUp(height, block_height);
|
||||
const u32 cols = Common::DivideUp(width, block_width);
|
||||
|
||||
Common::ThreadWorker workers{std::max(std::thread::hardware_concurrency(), 2U) / 2,
|
||||
"ASTCDecompress"};
|
||||
static Common::ThreadWorker workers{std::max(std::thread::hardware_concurrency(), 2U) / 2,
|
||||
"ASTCDecompress"};
|
||||
|
||||
for (u32 z = 0; z < depth; ++z) {
|
||||
const u32 depth_offset = z * height * width * 4;
|
||||
|
||||
@@ -71,7 +71,7 @@ struct Client::Impl {
|
||||
const std::string& jwt_ = "", const std::string& username_ = "",
|
||||
const std::string& token_ = "") {
|
||||
if (cli == nullptr) {
|
||||
cli = std::make_unique<httplib::Client>(host.c_str());
|
||||
cli = std::make_unique<httplib::Client>(host);
|
||||
}
|
||||
|
||||
if (!cli->is_valid()) {
|
||||
|
||||
@@ -542,19 +542,14 @@ void QtControllerSelectorDialog::UpdateControllerState(std::size_t player_index)
|
||||
const auto player_connected = player_groupboxes[player_index]->isChecked() &&
|
||||
controller_type != Core::HID::NpadStyleIndex::Handheld;
|
||||
|
||||
if (controller->GetNpadStyleIndex(true) == controller_type &&
|
||||
controller->IsConnected(true) == player_connected) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Disconnect the controller first.
|
||||
UpdateController(controller, controller_type, false);
|
||||
|
||||
// Handheld
|
||||
if (player_index == 0) {
|
||||
auto* handheld = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
|
||||
UpdateController(handheld, controller_type, false);
|
||||
if (controller_type == Core::HID::NpadStyleIndex::Handheld) {
|
||||
auto* handheld =
|
||||
system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
|
||||
UpdateController(handheld, Core::HID::NpadStyleIndex::Handheld,
|
||||
player_groupboxes[player_index]->isChecked());
|
||||
}
|
||||
|
||||
@@ -652,7 +652,10 @@ void GRenderWindow::mousePressEvent(QMouseEvent* event) {
|
||||
const auto [x, y] = ScaleTouch(pos);
|
||||
const auto [touch_x, touch_y] = MapToTouchScreen(x, y);
|
||||
const auto button = QtButtonToMouseButton(event->button());
|
||||
input_subsystem->GetMouse()->PressButton(x, y, touch_x, touch_y, button);
|
||||
|
||||
input_subsystem->GetMouse()->PressMouseButton(button);
|
||||
input_subsystem->GetMouse()->PressButton(pos.x(), pos.y(), button);
|
||||
input_subsystem->GetMouse()->PressTouchButton(touch_x, touch_y, button);
|
||||
|
||||
emit MouseActivity();
|
||||
}
|
||||
@@ -669,7 +672,10 @@ void GRenderWindow::mouseMoveEvent(QMouseEvent* event) {
|
||||
const auto [touch_x, touch_y] = MapToTouchScreen(x, y);
|
||||
const int center_x = width() / 2;
|
||||
const int center_y = height() / 2;
|
||||
input_subsystem->GetMouse()->MouseMove(x, y, touch_x, touch_y, center_x, center_y);
|
||||
|
||||
input_subsystem->GetMouse()->MouseMove(touch_x, touch_y);
|
||||
input_subsystem->GetMouse()->TouchMove(touch_x, touch_y);
|
||||
input_subsystem->GetMouse()->Move(pos.x(), pos.y(), center_x, center_y);
|
||||
|
||||
if (Settings::values.mouse_panning && !Settings::values.mouse_enabled) {
|
||||
QCursor::setPos(mapToGlobal(QPoint{center_x, center_y}));
|
||||
|
||||
@@ -147,6 +147,8 @@ public:
|
||||
|
||||
qreal windowPixelRatio() const;
|
||||
|
||||
std::pair<u32, u32> ScaleTouch(const QPointF& pos) const;
|
||||
|
||||
void closeEvent(QCloseEvent* event) override;
|
||||
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
@@ -184,8 +186,6 @@ public:
|
||||
|
||||
void CaptureScreenshot(const QString& screenshot_path);
|
||||
|
||||
std::pair<u32, u32> ScaleTouch(const QPointF& pos) const;
|
||||
|
||||
/**
|
||||
* Instructs the window to re-launch the application using the specified program_index.
|
||||
* @param program_index Specifies the index within the application of the program to launch.
|
||||
|
||||
@@ -212,16 +212,11 @@ void Config::ReadPlayerValue(std::size_t player_index) {
|
||||
}
|
||||
|
||||
if (player_prefix.isEmpty() && Settings::IsConfiguringGlobal()) {
|
||||
const auto controller = static_cast<Settings::ControllerType>(
|
||||
player.controller_type = static_cast<Settings::ControllerType>(
|
||||
qt_config
|
||||
->value(QStringLiteral("%1type").arg(player_prefix),
|
||||
static_cast<u8>(Settings::ControllerType::ProController))
|
||||
.toUInt());
|
||||
|
||||
if (controller == Settings::ControllerType::LeftJoycon ||
|
||||
controller == Settings::ControllerType::RightJoycon) {
|
||||
player.controller_type = controller;
|
||||
}
|
||||
} else {
|
||||
player.connected =
|
||||
ReadSetting(QStringLiteral("%1connected").arg(player_prefix), player_index == 0)
|
||||
@@ -707,6 +702,7 @@ void Config::ReadRendererValues() {
|
||||
ReadGlobalSetting(Settings::values.use_asynchronous_gpu_emulation);
|
||||
ReadGlobalSetting(Settings::values.nvdec_emulation);
|
||||
ReadGlobalSetting(Settings::values.accelerate_astc);
|
||||
ReadGlobalSetting(Settings::values.async_astc);
|
||||
ReadGlobalSetting(Settings::values.use_vsync);
|
||||
ReadGlobalSetting(Settings::values.shader_backend);
|
||||
ReadGlobalSetting(Settings::values.use_asynchronous_shaders);
|
||||
@@ -1312,9 +1308,7 @@ void Config::SaveRendererValues() {
|
||||
static_cast<u32>(Settings::values.renderer_backend.GetValue(global)),
|
||||
static_cast<u32>(Settings::values.renderer_backend.GetDefault()),
|
||||
Settings::values.renderer_backend.UsingGlobal());
|
||||
WriteSetting(QString::fromStdString(Settings::values.renderer_force_max_clock.GetLabel()),
|
||||
static_cast<u32>(Settings::values.renderer_force_max_clock.GetValue(global)),
|
||||
static_cast<u32>(Settings::values.renderer_force_max_clock.GetDefault()));
|
||||
WriteGlobalSetting(Settings::values.renderer_force_max_clock);
|
||||
WriteGlobalSetting(Settings::values.vulkan_device);
|
||||
WriteSetting(QString::fromStdString(Settings::values.fullscreen_mode.GetLabel()),
|
||||
static_cast<u32>(Settings::values.fullscreen_mode.GetValue(global)),
|
||||
@@ -1350,6 +1344,7 @@ void Config::SaveRendererValues() {
|
||||
static_cast<u32>(Settings::values.nvdec_emulation.GetDefault()),
|
||||
Settings::values.nvdec_emulation.UsingGlobal());
|
||||
WriteGlobalSetting(Settings::values.accelerate_astc);
|
||||
WriteGlobalSetting(Settings::values.async_astc);
|
||||
WriteGlobalSetting(Settings::values.use_vsync);
|
||||
WriteSetting(QString::fromStdString(Settings::values.shader_backend.GetLabel()),
|
||||
static_cast<u32>(Settings::values.shader_backend.GetValue(global)),
|
||||
|
||||
@@ -23,11 +23,13 @@ void ConfigureGraphicsAdvanced::SetConfiguration() {
|
||||
const bool runtime_lock = !system.IsPoweredOn();
|
||||
ui->use_vsync->setEnabled(runtime_lock);
|
||||
ui->renderer_force_max_clock->setEnabled(runtime_lock);
|
||||
ui->async_astc->setEnabled(runtime_lock);
|
||||
ui->use_asynchronous_shaders->setEnabled(runtime_lock);
|
||||
ui->anisotropic_filtering_combobox->setEnabled(runtime_lock);
|
||||
|
||||
ui->renderer_force_max_clock->setChecked(Settings::values.renderer_force_max_clock.GetValue());
|
||||
ui->use_vsync->setChecked(Settings::values.use_vsync.GetValue());
|
||||
ui->async_astc->setChecked(Settings::values.async_astc.GetValue());
|
||||
ui->use_asynchronous_shaders->setChecked(Settings::values.use_asynchronous_shaders.GetValue());
|
||||
ui->use_fast_gpu_time->setChecked(Settings::values.use_fast_gpu_time.GetValue());
|
||||
ui->use_pessimistic_flushes->setChecked(Settings::values.use_pessimistic_flushes.GetValue());
|
||||
@@ -45,8 +47,6 @@ void ConfigureGraphicsAdvanced::SetConfiguration() {
|
||||
&Settings::values.max_anisotropy);
|
||||
ConfigurationShared::SetHighlight(ui->label_gpu_accuracy,
|
||||
!Settings::values.gpu_accuracy.UsingGlobal());
|
||||
ConfigurationShared::SetHighlight(ui->renderer_force_max_clock,
|
||||
!Settings::values.renderer_force_max_clock.UsingGlobal());
|
||||
ConfigurationShared::SetHighlight(ui->af_label,
|
||||
!Settings::values.max_anisotropy.UsingGlobal());
|
||||
}
|
||||
@@ -60,6 +60,8 @@ void ConfigureGraphicsAdvanced::ApplyConfiguration() {
|
||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy,
|
||||
ui->anisotropic_filtering_combobox);
|
||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync, use_vsync);
|
||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.async_astc, ui->async_astc,
|
||||
async_astc);
|
||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_shaders,
|
||||
ui->use_asynchronous_shaders,
|
||||
use_asynchronous_shaders);
|
||||
@@ -91,6 +93,7 @@ void ConfigureGraphicsAdvanced::SetupPerGameUI() {
|
||||
ui->renderer_force_max_clock->setEnabled(
|
||||
Settings::values.renderer_force_max_clock.UsingGlobal());
|
||||
ui->use_vsync->setEnabled(Settings::values.use_vsync.UsingGlobal());
|
||||
ui->async_astc->setEnabled(Settings::values.async_astc.UsingGlobal());
|
||||
ui->use_asynchronous_shaders->setEnabled(
|
||||
Settings::values.use_asynchronous_shaders.UsingGlobal());
|
||||
ui->use_fast_gpu_time->setEnabled(Settings::values.use_fast_gpu_time.UsingGlobal());
|
||||
@@ -108,6 +111,8 @@ void ConfigureGraphicsAdvanced::SetupPerGameUI() {
|
||||
Settings::values.renderer_force_max_clock,
|
||||
renderer_force_max_clock);
|
||||
ConfigurationShared::SetColoredTristate(ui->use_vsync, Settings::values.use_vsync, use_vsync);
|
||||
ConfigurationShared::SetColoredTristate(ui->async_astc, Settings::values.async_astc,
|
||||
async_astc);
|
||||
ConfigurationShared::SetColoredTristate(ui->use_asynchronous_shaders,
|
||||
Settings::values.use_asynchronous_shaders,
|
||||
use_asynchronous_shaders);
|
||||
|
||||
@@ -38,6 +38,7 @@ private:
|
||||
|
||||
ConfigurationShared::CheckState renderer_force_max_clock;
|
||||
ConfigurationShared::CheckState use_vsync;
|
||||
ConfigurationShared::CheckState async_astc;
|
||||
ConfigurationShared::CheckState use_asynchronous_shaders;
|
||||
ConfigurationShared::CheckState use_fast_gpu_time;
|
||||
ConfigurationShared::CheckState use_pessimistic_flushes;
|
||||
|
||||
@@ -89,6 +89,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="async_astc">
|
||||
<property name="toolTip">
|
||||
<string>Enables asynchronous ASTC texture decoding, which may reduce load time stutter. This feature is experimental.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Decode ASTC textures asynchronously (Hack)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="use_asynchronous_shaders">
|
||||
<property name="toolTip">
|
||||
|
||||
@@ -194,6 +194,7 @@ void ConfigureInput::ApplyConfiguration() {
|
||||
}
|
||||
|
||||
advanced->ApplyConfiguration();
|
||||
system.HIDCore().ReloadInputDevices();
|
||||
|
||||
const bool pre_docked_mode = Settings::values.use_docked_mode.GetValue();
|
||||
Settings::values.use_docked_mode.SetValue(ui->radioDocked->isChecked());
|
||||
|
||||
@@ -57,7 +57,7 @@ void ConfigureInputPerGame::ApplyConfiguration() {
|
||||
}
|
||||
|
||||
void ConfigureInputPerGame::LoadConfiguration() {
|
||||
static constexpr size_t HANDHELD_INDEX = 8;
|
||||
static constexpr size_t HANDHELD_INDEX = 0;
|
||||
|
||||
auto& hid_core = system.HIDCore();
|
||||
for (size_t player_index = 0; player_index < profile_comboboxes.size(); ++player_index) {
|
||||
@@ -69,9 +69,6 @@ void ConfigureInputPerGame::LoadConfiguration() {
|
||||
const auto selection_index = player_combobox->currentIndex();
|
||||
if (selection_index == 0) {
|
||||
Settings::values.players.GetValue()[player_index].profile_name = "";
|
||||
if (player_index == 0) {
|
||||
Settings::values.players.GetValue()[HANDHELD_INDEX] = {};
|
||||
}
|
||||
Settings::values.players.SetGlobal(true);
|
||||
emulated_controller->ReloadFromSettings();
|
||||
continue;
|
||||
@@ -89,17 +86,12 @@ void ConfigureInputPerGame::LoadConfiguration() {
|
||||
|
||||
emulated_controller->ReloadFromSettings();
|
||||
|
||||
if (player_index > 0) {
|
||||
if (player_index != HANDHELD_INDEX) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Handle Handheld cases
|
||||
auto& handheld_player = Settings::values.players.GetValue()[HANDHELD_INDEX];
|
||||
auto* handheld_controller = hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld);
|
||||
if (player.controller_type == Settings::ControllerType::Handheld) {
|
||||
handheld_player = player;
|
||||
} else {
|
||||
handheld_player = {};
|
||||
}
|
||||
auto handheld_controller = hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld);
|
||||
handheld_controller->ReloadFromSettings();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,26 +295,11 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
||||
is_powered_on{is_powered_on_}, input_subsystem{input_subsystem_}, profiles(profiles_),
|
||||
timeout_timer(std::make_unique<QTimer>()),
|
||||
poll_timer(std::make_unique<QTimer>()), bottom_row{bottom_row_}, hid_core{hid_core_} {
|
||||
if (player_index == 0) {
|
||||
auto* emulated_controller_p1 =
|
||||
hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1);
|
||||
auto* emulated_controller_handheld =
|
||||
hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld);
|
||||
emulated_controller_p1->SaveCurrentConfig();
|
||||
emulated_controller_p1->EnableConfiguration();
|
||||
emulated_controller_handheld->SaveCurrentConfig();
|
||||
emulated_controller_handheld->EnableConfiguration();
|
||||
if (emulated_controller_handheld->IsConnected(true)) {
|
||||
emulated_controller_p1->Disconnect();
|
||||
emulated_controller = emulated_controller_handheld;
|
||||
} else {
|
||||
emulated_controller = emulated_controller_p1;
|
||||
}
|
||||
} else {
|
||||
emulated_controller = hid_core.GetEmulatedControllerByIndex(player_index);
|
||||
emulated_controller->SaveCurrentConfig();
|
||||
emulated_controller->EnableConfiguration();
|
||||
}
|
||||
|
||||
emulated_controller = hid_core.GetEmulatedControllerByIndex(player_index);
|
||||
emulated_controller->SaveCurrentConfig();
|
||||
emulated_controller->EnableConfiguration();
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
setFocusPolicy(Qt::ClickFocus);
|
||||
@@ -737,29 +722,6 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
||||
UpdateMotionButtons();
|
||||
const Core::HID::NpadStyleIndex type =
|
||||
GetControllerTypeFromIndex(ui->comboControllerType->currentIndex());
|
||||
|
||||
if (player_index == 0) {
|
||||
auto* emulated_controller_p1 =
|
||||
hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1);
|
||||
auto* emulated_controller_handheld =
|
||||
hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld);
|
||||
bool is_connected = emulated_controller->IsConnected(true);
|
||||
|
||||
emulated_controller_p1->SetNpadStyleIndex(type);
|
||||
emulated_controller_handheld->SetNpadStyleIndex(type);
|
||||
if (is_connected) {
|
||||
if (type == Core::HID::NpadStyleIndex::Handheld) {
|
||||
emulated_controller_p1->Disconnect();
|
||||
emulated_controller_handheld->Connect(true);
|
||||
emulated_controller = emulated_controller_handheld;
|
||||
} else {
|
||||
emulated_controller_handheld->Disconnect();
|
||||
emulated_controller_p1->Connect(true);
|
||||
emulated_controller = emulated_controller_p1;
|
||||
}
|
||||
}
|
||||
ui->controllerFrame->SetController(emulated_controller);
|
||||
}
|
||||
emulated_controller->SetNpadStyleIndex(type);
|
||||
});
|
||||
|
||||
@@ -795,32 +757,10 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
||||
}
|
||||
|
||||
ConfigureInputPlayer::~ConfigureInputPlayer() {
|
||||
if (player_index == 0) {
|
||||
auto* emulated_controller_p1 =
|
||||
hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1);
|
||||
auto* emulated_controller_handheld =
|
||||
hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld);
|
||||
emulated_controller_p1->DisableConfiguration();
|
||||
emulated_controller_handheld->DisableConfiguration();
|
||||
} else {
|
||||
emulated_controller->DisableConfiguration();
|
||||
}
|
||||
emulated_controller->DisableConfiguration();
|
||||
}
|
||||
|
||||
void ConfigureInputPlayer::ApplyConfiguration() {
|
||||
if (player_index == 0) {
|
||||
auto* emulated_controller_p1 =
|
||||
hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1);
|
||||
auto* emulated_controller_handheld =
|
||||
hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld);
|
||||
emulated_controller_p1->DisableConfiguration();
|
||||
emulated_controller_p1->SaveCurrentConfig();
|
||||
emulated_controller_p1->EnableConfiguration();
|
||||
emulated_controller_handheld->DisableConfiguration();
|
||||
emulated_controller_handheld->SaveCurrentConfig();
|
||||
emulated_controller_handheld->EnableConfiguration();
|
||||
return;
|
||||
}
|
||||
emulated_controller->DisableConfiguration();
|
||||
emulated_controller->SaveCurrentConfig();
|
||||
emulated_controller->EnableConfiguration();
|
||||
@@ -1490,7 +1430,7 @@ void ConfigureInputPlayer::mousePressEvent(QMouseEvent* event) {
|
||||
}
|
||||
|
||||
const auto button = GRenderWindow::QtButtonToMouseButton(event->button());
|
||||
input_subsystem->GetMouse()->PressButton(0, 0, 0, 0, button);
|
||||
input_subsystem->GetMouse()->PressButton(0, 0, button);
|
||||
}
|
||||
|
||||
void ConfigureInputPlayer::wheelEvent(QWheelEvent* event) {
|
||||
@@ -1589,7 +1529,6 @@ void ConfigureInputPlayer::LoadProfile() {
|
||||
}
|
||||
|
||||
void ConfigureInputPlayer::SaveProfile() {
|
||||
static constexpr size_t HANDHELD_INDEX = 8;
|
||||
const QString profile_name = ui->comboProfiles->itemText(ui->comboProfiles->currentIndex());
|
||||
|
||||
if (profile_name.isEmpty()) {
|
||||
@@ -1598,12 +1537,7 @@ void ConfigureInputPlayer::SaveProfile() {
|
||||
|
||||
ApplyConfiguration();
|
||||
|
||||
// When we're in handheld mode, only the handheld emulated controller bindings are updated
|
||||
const bool is_handheld = player_index == 0 && emulated_controller->GetNpadIdType() ==
|
||||
Core::HID::NpadIdType::Handheld;
|
||||
const auto profile_player_index = is_handheld ? HANDHELD_INDEX : player_index;
|
||||
|
||||
if (!profiles->SaveProfile(profile_name.toStdString(), profile_player_index)) {
|
||||
if (!profiles->SaveProfile(profile_name.toStdString(), player_index)) {
|
||||
QMessageBox::critical(this, tr("Save Input Profile"),
|
||||
tr("Failed to save the input profile \"%1\"").arg(profile_name));
|
||||
UpdateInputProfiles();
|
||||
|
||||
@@ -371,7 +371,7 @@ void ConfigureRingController::mousePressEvent(QMouseEvent* event) {
|
||||
}
|
||||
|
||||
const auto button = GRenderWindow::QtButtonToMouseButton(event->button());
|
||||
input_subsystem->GetMouse()->PressButton(0, 0, 0, 0, button);
|
||||
input_subsystem->GetMouse()->PressButton(0, 0, button);
|
||||
}
|
||||
|
||||
void ConfigureRingController::keyPressEvent(QKeyEvent* event) {
|
||||
|
||||
@@ -75,8 +75,10 @@ void DiscordImpl::Update() {
|
||||
|
||||
// New Check for game cover
|
||||
httplib::Client cli(game_cover_url);
|
||||
cli.set_connection_timeout(std::chrono::seconds(3));
|
||||
cli.set_read_timeout(std::chrono::seconds(3));
|
||||
|
||||
if (auto res = cli.Head(fmt::format("/images/game/boxart/{}.png", icon_name).c_str())) {
|
||||
if (auto res = cli.Head(fmt::format("/images/game/boxart/{}.png", icon_name))) {
|
||||
if (res->status == 200) {
|
||||
game_cover_url += fmt::format("/images/game/boxart/{}.png", icon_name);
|
||||
} else {
|
||||
|
||||
@@ -1165,6 +1165,14 @@ void GMainWindow::InitializeHotkeys() {
|
||||
Settings::values.use_speed_limit.SetValue(!Settings::values.use_speed_limit.GetValue());
|
||||
});
|
||||
connect_shortcut(QStringLiteral("Toggle Mouse Panning"), [&] {
|
||||
if (Settings::values.mouse_enabled) {
|
||||
Settings::values.mouse_panning = false;
|
||||
QMessageBox::warning(
|
||||
this, tr("Emulated mouse is enabled"),
|
||||
tr("Real mouse input and mouse panning are incompatible. Please disable the "
|
||||
"emulated mouse in input advanced settings to allow mouse panning."));
|
||||
return;
|
||||
}
|
||||
Settings::values.mouse_panning = !Settings::values.mouse_panning;
|
||||
if (Settings::values.mouse_panning) {
|
||||
render_window->installEventFilter(render_window);
|
||||
|
||||
@@ -324,6 +324,7 @@ void Config::ReadValues() {
|
||||
ReadSetting("Renderer", Settings::values.use_asynchronous_shaders);
|
||||
ReadSetting("Renderer", Settings::values.nvdec_emulation);
|
||||
ReadSetting("Renderer", Settings::values.accelerate_astc);
|
||||
ReadSetting("Renderer", Settings::values.async_astc);
|
||||
ReadSetting("Renderer", Settings::values.use_fast_gpu_time);
|
||||
ReadSetting("Renderer", Settings::values.use_pessimistic_flushes);
|
||||
ReadSetting("Renderer", Settings::values.use_vulkan_driver_pipeline_cache);
|
||||
|
||||
@@ -342,6 +342,10 @@ nvdec_emulation =
|
||||
# 0: Off, 1 (default): On
|
||||
accelerate_astc =
|
||||
|
||||
# Decode ASTC textures asynchronously.
|
||||
# 0 (default): Off, 1: On
|
||||
async_astc =
|
||||
|
||||
# Turns on the speed limiter, which will limit the emulation speed to the desired speed limit value
|
||||
# 0: Off, 1: On (default)
|
||||
use_speed_limit =
|
||||
|
||||
@@ -62,7 +62,9 @@ void EmuWindow_SDL2::OnMouseButton(u32 button, u8 state, s32 x, s32 y) {
|
||||
const auto mouse_button = SDLButtonToMouseButton(button);
|
||||
if (state == SDL_PRESSED) {
|
||||
const auto [touch_x, touch_y] = MouseToTouchPos(x, y);
|
||||
input_subsystem->GetMouse()->PressButton(x, y, touch_x, touch_y, mouse_button);
|
||||
input_subsystem->GetMouse()->PressButton(x, y, mouse_button);
|
||||
input_subsystem->GetMouse()->PressMouseButton(mouse_button);
|
||||
input_subsystem->GetMouse()->PressTouchButton(touch_x, touch_y, mouse_button);
|
||||
} else {
|
||||
input_subsystem->GetMouse()->ReleaseButton(mouse_button);
|
||||
}
|
||||
@@ -70,7 +72,9 @@ void EmuWindow_SDL2::OnMouseButton(u32 button, u8 state, s32 x, s32 y) {
|
||||
|
||||
void EmuWindow_SDL2::OnMouseMotion(s32 x, s32 y) {
|
||||
const auto [touch_x, touch_y] = MouseToTouchPos(x, y);
|
||||
input_subsystem->GetMouse()->MouseMove(x, y, touch_x, touch_y, 0, 0);
|
||||
input_subsystem->GetMouse()->Move(x, y, 0, 0);
|
||||
input_subsystem->GetMouse()->MouseMove(touch_x, touch_y);
|
||||
input_subsystem->GetMouse()->TouchMove(touch_x, touch_y);
|
||||
}
|
||||
|
||||
void EmuWindow_SDL2::OnFingerDown(float x, float y, std::size_t id) {
|
||||
|
||||
Reference in New Issue
Block a user