diff options
Diffstat (limited to 'src')
84 files changed, 583 insertions, 259 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 9884a4a0b..56b247ac4 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt | |||
| @@ -176,7 +176,7 @@ endif() | |||
| 176 | 176 | ||
| 177 | create_target_directory_groups(common) | 177 | create_target_directory_groups(common) |
| 178 | 178 | ||
| 179 | target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile Threads::Threads) | 179 | target_link_libraries(common PUBLIC Boost::context Boost::headers fmt::fmt microprofile Threads::Threads) |
| 180 | target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd LLVM::Demangle) | 180 | target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd LLVM::Demangle) |
| 181 | 181 | ||
| 182 | if (YUZU_USE_PRECOMPILED_HEADERS) | 182 | if (YUZU_USE_PRECOMPILED_HEADERS) |
diff --git a/src/common/scratch_buffer.h b/src/common/scratch_buffer.h index 1245a5086..26d4e76dc 100644 --- a/src/common/scratch_buffer.h +++ b/src/common/scratch_buffer.h | |||
| @@ -23,6 +23,7 @@ public: | |||
| 23 | buffer{Common::make_unique_for_overwrite<T[]>(initial_capacity)} {} | 23 | buffer{Common::make_unique_for_overwrite<T[]>(initial_capacity)} {} |
| 24 | 24 | ||
| 25 | ~ScratchBuffer() = default; | 25 | ~ScratchBuffer() = default; |
| 26 | ScratchBuffer(ScratchBuffer&&) = default; | ||
| 26 | 27 | ||
| 27 | /// This will only grow the buffer's capacity if size is greater than the current capacity. | 28 | /// This will only grow the buffer's capacity if size is greater than the current capacity. |
| 28 | /// The previously held data will remain intact. | 29 | /// The previously held data will remain intact. |
diff --git a/src/common/settings.cpp b/src/common/settings.cpp index 49b41c158..84955030b 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp | |||
| @@ -59,6 +59,7 @@ void LogSettings() { | |||
| 59 | values.use_asynchronous_gpu_emulation.GetValue()); | 59 | values.use_asynchronous_gpu_emulation.GetValue()); |
| 60 | log_setting("Renderer_NvdecEmulation", values.nvdec_emulation.GetValue()); | 60 | log_setting("Renderer_NvdecEmulation", values.nvdec_emulation.GetValue()); |
| 61 | log_setting("Renderer_AccelerateASTC", values.accelerate_astc.GetValue()); | 61 | log_setting("Renderer_AccelerateASTC", values.accelerate_astc.GetValue()); |
| 62 | log_setting("Renderer_AsyncASTC", values.async_astc.GetValue()); | ||
| 62 | log_setting("Renderer_UseVsync", values.use_vsync.GetValue()); | 63 | log_setting("Renderer_UseVsync", values.use_vsync.GetValue()); |
| 63 | log_setting("Renderer_ShaderBackend", values.shader_backend.GetValue()); | 64 | log_setting("Renderer_ShaderBackend", values.shader_backend.GetValue()); |
| 64 | log_setting("Renderer_UseAsynchronousShaders", values.use_asynchronous_shaders.GetValue()); | 65 | log_setting("Renderer_UseAsynchronousShaders", values.use_asynchronous_shaders.GetValue()); |
| @@ -76,6 +77,13 @@ void LogSettings() { | |||
| 76 | log_setting("Debugging_GDBStub", values.use_gdbstub.GetValue()); | 77 | log_setting("Debugging_GDBStub", values.use_gdbstub.GetValue()); |
| 77 | log_setting("Input_EnableMotion", values.motion_enabled.GetValue()); | 78 | log_setting("Input_EnableMotion", values.motion_enabled.GetValue()); |
| 78 | log_setting("Input_EnableVibration", values.vibration_enabled.GetValue()); | 79 | log_setting("Input_EnableVibration", values.vibration_enabled.GetValue()); |
| 80 | log_setting("Input_EnableTouch", values.touchscreen.enabled); | ||
| 81 | log_setting("Input_EnableMouse", values.mouse_enabled.GetValue()); | ||
| 82 | log_setting("Input_EnableKeyboard", values.keyboard_enabled.GetValue()); | ||
| 83 | log_setting("Input_EnableRingController", values.enable_ring_controller.GetValue()); | ||
| 84 | log_setting("Input_EnableIrSensor", values.enable_ir_sensor.GetValue()); | ||
| 85 | log_setting("Input_EnableCustomJoycon", values.enable_joycon_driver.GetValue()); | ||
| 86 | log_setting("Input_EnableCustomProController", values.enable_procon_driver.GetValue()); | ||
| 79 | log_setting("Input_EnableRawInput", values.enable_raw_input.GetValue()); | 87 | log_setting("Input_EnableRawInput", values.enable_raw_input.GetValue()); |
| 80 | } | 88 | } |
| 81 | 89 | ||
| @@ -212,6 +220,7 @@ void RestoreGlobalState(bool is_powered_on) { | |||
| 212 | values.use_asynchronous_gpu_emulation.SetGlobal(true); | 220 | values.use_asynchronous_gpu_emulation.SetGlobal(true); |
| 213 | values.nvdec_emulation.SetGlobal(true); | 221 | values.nvdec_emulation.SetGlobal(true); |
| 214 | values.accelerate_astc.SetGlobal(true); | 222 | values.accelerate_astc.SetGlobal(true); |
| 223 | values.async_astc.SetGlobal(true); | ||
| 215 | values.use_vsync.SetGlobal(true); | 224 | values.use_vsync.SetGlobal(true); |
| 216 | values.shader_backend.SetGlobal(true); | 225 | values.shader_backend.SetGlobal(true); |
| 217 | values.use_asynchronous_shaders.SetGlobal(true); | 226 | values.use_asynchronous_shaders.SetGlobal(true); |
diff --git a/src/common/settings.h b/src/common/settings.h index 6d27dd5ee..512ecff69 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -453,6 +453,7 @@ struct Values { | |||
| 453 | SwitchableSetting<bool> use_asynchronous_gpu_emulation{true, "use_asynchronous_gpu_emulation"}; | 453 | SwitchableSetting<bool> use_asynchronous_gpu_emulation{true, "use_asynchronous_gpu_emulation"}; |
| 454 | SwitchableSetting<NvdecEmulation> nvdec_emulation{NvdecEmulation::GPU, "nvdec_emulation"}; | 454 | SwitchableSetting<NvdecEmulation> nvdec_emulation{NvdecEmulation::GPU, "nvdec_emulation"}; |
| 455 | SwitchableSetting<bool> accelerate_astc{true, "accelerate_astc"}; | 455 | SwitchableSetting<bool> accelerate_astc{true, "accelerate_astc"}; |
| 456 | SwitchableSetting<bool> async_astc{false, "async_astc"}; | ||
| 456 | SwitchableSetting<bool> use_vsync{true, "use_vsync"}; | 457 | SwitchableSetting<bool> use_vsync{true, "use_vsync"}; |
| 457 | SwitchableSetting<ShaderBackend, true> shader_backend{ShaderBackend::GLSL, ShaderBackend::GLSL, | 458 | SwitchableSetting<ShaderBackend, true> shader_backend{ShaderBackend::GLSL, ShaderBackend::GLSL, |
| 458 | ShaderBackend::SPIRV, "shader_backend"}; | 459 | ShaderBackend::SPIRV, "shader_backend"}; |
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index dcdfcbac5..cdebb0bd8 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -834,7 +834,7 @@ endif() | |||
| 834 | create_target_directory_groups(core) | 834 | create_target_directory_groups(core) |
| 835 | 835 | ||
| 836 | target_link_libraries(core PUBLIC common PRIVATE audio_core network video_core) | 836 | target_link_libraries(core PUBLIC common PRIVATE audio_core network video_core) |
| 837 | target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls Opus::opus) | 837 | target_link_libraries(core PUBLIC Boost::headers PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls Opus::opus) |
| 838 | if (MINGW) | 838 | if (MINGW) |
| 839 | target_link_libraries(core PRIVATE ${MSWSOCK_LIBRARY}) | 839 | target_link_libraries(core PRIVATE ${MSWSOCK_LIBRARY}) |
| 840 | endif() | 840 | endif() |
| @@ -863,3 +863,7 @@ endif() | |||
| 863 | if (YUZU_USE_PRECOMPILED_HEADERS) | 863 | if (YUZU_USE_PRECOMPILED_HEADERS) |
| 864 | target_precompile_headers(core PRIVATE precompiled_headers.h) | 864 | target_precompile_headers(core PRIVATE precompiled_headers.h) |
| 865 | endif() | 865 | endif() |
| 866 | |||
| 867 | if (YUZU_ENABLE_LTO) | ||
| 868 | set_property(TARGET core PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) | ||
| 869 | endif() | ||
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index 6d5a3dead..a29c9a6f8 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp | |||
| @@ -363,7 +363,17 @@ void EmulatedController::ReloadInput() { | |||
| 363 | SetMotion(callback, index); | 363 | SetMotion(callback, index); |
| 364 | }, | 364 | }, |
| 365 | }); | 365 | }); |
| 366 | motion_devices[index]->ForceUpdate(); | 366 | |
| 367 | // Restore motion state | ||
| 368 | auto& emulated_motion = controller.motion_values[index].emulated; | ||
| 369 | auto& motion = controller.motion_state[index]; | ||
| 370 | emulated_motion.ResetRotations(); | ||
| 371 | emulated_motion.ResetQuaternion(); | ||
| 372 | motion.accel = emulated_motion.GetAcceleration(); | ||
| 373 | motion.gyro = emulated_motion.GetGyroscope(); | ||
| 374 | motion.rotation = emulated_motion.GetRotations(); | ||
| 375 | motion.orientation = emulated_motion.GetOrientation(); | ||
| 376 | motion.is_at_rest = !emulated_motion.IsMoving(motion_sensitivity); | ||
| 367 | } | 377 | } |
| 368 | 378 | ||
| 369 | for (std::size_t index = 0; index < camera_devices.size(); ++index) { | 379 | for (std::size_t index = 0; index < camera_devices.size(); ++index) { |
diff --git a/src/core/hid/emulated_devices.cpp b/src/core/hid/emulated_devices.cpp index 578a6ff61..8e165dded 100644 --- a/src/core/hid/emulated_devices.cpp +++ b/src/core/hid/emulated_devices.cpp | |||
| @@ -19,52 +19,53 @@ void EmulatedDevices::ReloadFromSettings() { | |||
| 19 | 19 | ||
| 20 | void EmulatedDevices::ReloadInput() { | 20 | void EmulatedDevices::ReloadInput() { |
| 21 | // If you load any device here add the equivalent to the UnloadInput() function | 21 | // If you load any device here add the equivalent to the UnloadInput() function |
| 22 | |||
| 23 | // Native Mouse is mapped on port 1, pad 0 | ||
| 24 | const Common::ParamPackage mouse_params{"engine:mouse,port:1,pad:0"}; | ||
| 25 | |||
| 26 | // Keyboard keys is mapped on port 1, pad 0 for normal keys, pad 1 for moddifier keys | ||
| 27 | const Common::ParamPackage keyboard_params{"engine:keyboard,port:1"}; | ||
| 28 | |||
| 22 | std::size_t key_index = 0; | 29 | std::size_t key_index = 0; |
| 23 | for (auto& mouse_device : mouse_button_devices) { | 30 | for (auto& mouse_device : mouse_button_devices) { |
| 24 | Common::ParamPackage mouse_params; | 31 | Common::ParamPackage mouse_button_params = mouse_params; |
| 25 | mouse_params.Set("engine", "mouse"); | 32 | mouse_button_params.Set("button", static_cast<int>(key_index)); |
| 26 | mouse_params.Set("button", static_cast<int>(key_index)); | 33 | mouse_device = Common::Input::CreateInputDevice(mouse_button_params); |
| 27 | mouse_device = Common::Input::CreateInputDevice(mouse_params); | ||
| 28 | key_index++; | 34 | key_index++; |
| 29 | } | 35 | } |
| 30 | 36 | ||
| 31 | mouse_stick_device = | 37 | Common::ParamPackage mouse_position_params = mouse_params; |
| 32 | Common::Input::CreateInputDeviceFromString("engine:mouse,axis_x:0,axis_y:1"); | 38 | mouse_position_params.Set("axis_x", 0); |
| 39 | mouse_position_params.Set("axis_y", 1); | ||
| 40 | mouse_position_params.Set("deadzone", 0.0f); | ||
| 41 | mouse_position_params.Set("range", 1.0f); | ||
| 42 | mouse_position_params.Set("threshold", 0.0f); | ||
| 43 | mouse_stick_device = Common::Input::CreateInputDevice(mouse_position_params); | ||
| 33 | 44 | ||
| 34 | // First two axis are reserved for mouse position | 45 | // First two axis are reserved for mouse position |
| 35 | key_index = 2; | 46 | key_index = 2; |
| 36 | for (auto& mouse_device : mouse_analog_devices) { | 47 | for (auto& mouse_device : mouse_wheel_devices) { |
| 37 | // Mouse axis are only mapped on port 1, pad 0 | 48 | Common::ParamPackage mouse_wheel_params = mouse_params; |
| 38 | Common::ParamPackage mouse_params; | 49 | mouse_wheel_params.Set("axis", static_cast<int>(key_index)); |
| 39 | mouse_params.Set("engine", "mouse"); | 50 | mouse_device = Common::Input::CreateInputDevice(mouse_wheel_params); |
| 40 | mouse_params.Set("axis", static_cast<int>(key_index)); | ||
| 41 | mouse_params.Set("port", 1); | ||
| 42 | mouse_params.Set("pad", 0); | ||
| 43 | mouse_device = Common::Input::CreateInputDevice(mouse_params); | ||
| 44 | key_index++; | 51 | key_index++; |
| 45 | } | 52 | } |
| 46 | 53 | ||
| 47 | key_index = 0; | 54 | key_index = 0; |
| 48 | for (auto& keyboard_device : keyboard_devices) { | 55 | for (auto& keyboard_device : keyboard_devices) { |
| 49 | // Keyboard keys are only mapped on port 1, pad 0 | 56 | Common::ParamPackage keyboard_key_params = keyboard_params; |
| 50 | Common::ParamPackage keyboard_params; | 57 | keyboard_key_params.Set("button", static_cast<int>(key_index)); |
| 51 | keyboard_params.Set("engine", "keyboard"); | 58 | keyboard_key_params.Set("pad", 0); |
| 52 | keyboard_params.Set("button", static_cast<int>(key_index)); | 59 | keyboard_device = Common::Input::CreateInputDevice(keyboard_key_params); |
| 53 | keyboard_params.Set("port", 1); | ||
| 54 | keyboard_params.Set("pad", 0); | ||
| 55 | keyboard_device = Common::Input::CreateInputDevice(keyboard_params); | ||
| 56 | key_index++; | 60 | key_index++; |
| 57 | } | 61 | } |
| 58 | 62 | ||
| 59 | key_index = 0; | 63 | key_index = 0; |
| 60 | for (auto& keyboard_device : keyboard_modifier_devices) { | 64 | for (auto& keyboard_device : keyboard_modifier_devices) { |
| 61 | // Keyboard moddifiers are only mapped on port 1, pad 1 | 65 | Common::ParamPackage keyboard_moddifier_params = keyboard_params; |
| 62 | Common::ParamPackage keyboard_params; | 66 | keyboard_moddifier_params.Set("button", static_cast<int>(key_index)); |
| 63 | keyboard_params.Set("engine", "keyboard"); | 67 | keyboard_moddifier_params.Set("pad", 1); |
| 64 | keyboard_params.Set("button", static_cast<int>(key_index)); | 68 | keyboard_device = Common::Input::CreateInputDevice(keyboard_moddifier_params); |
| 65 | keyboard_params.Set("port", 1); | ||
| 66 | keyboard_params.Set("pad", 1); | ||
| 67 | keyboard_device = Common::Input::CreateInputDevice(keyboard_params); | ||
| 68 | key_index++; | 69 | key_index++; |
| 69 | } | 70 | } |
| 70 | 71 | ||
| @@ -80,14 +81,14 @@ void EmulatedDevices::ReloadInput() { | |||
| 80 | }); | 81 | }); |
| 81 | } | 82 | } |
| 82 | 83 | ||
| 83 | for (std::size_t index = 0; index < mouse_analog_devices.size(); ++index) { | 84 | for (std::size_t index = 0; index < mouse_wheel_devices.size(); ++index) { |
| 84 | if (!mouse_analog_devices[index]) { | 85 | if (!mouse_wheel_devices[index]) { |
| 85 | continue; | 86 | continue; |
| 86 | } | 87 | } |
| 87 | mouse_analog_devices[index]->SetCallback({ | 88 | mouse_wheel_devices[index]->SetCallback({ |
| 88 | .on_change = | 89 | .on_change = |
| 89 | [this, index](const Common::Input::CallbackStatus& callback) { | 90 | [this, index](const Common::Input::CallbackStatus& callback) { |
| 90 | SetMouseAnalog(callback, index); | 91 | SetMouseWheel(callback, index); |
| 91 | }, | 92 | }, |
| 92 | }); | 93 | }); |
| 93 | } | 94 | } |
| @@ -95,7 +96,9 @@ void EmulatedDevices::ReloadInput() { | |||
| 95 | if (mouse_stick_device) { | 96 | if (mouse_stick_device) { |
| 96 | mouse_stick_device->SetCallback({ | 97 | mouse_stick_device->SetCallback({ |
| 97 | .on_change = | 98 | .on_change = |
| 98 | [this](const Common::Input::CallbackStatus& callback) { SetMouseStick(callback); }, | 99 | [this](const Common::Input::CallbackStatus& callback) { |
| 100 | SetMousePosition(callback); | ||
| 101 | }, | ||
| 99 | }); | 102 | }); |
| 100 | } | 103 | } |
| 101 | 104 | ||
| @@ -128,7 +131,7 @@ void EmulatedDevices::UnloadInput() { | |||
| 128 | for (auto& button : mouse_button_devices) { | 131 | for (auto& button : mouse_button_devices) { |
| 129 | button.reset(); | 132 | button.reset(); |
| 130 | } | 133 | } |
| 131 | for (auto& analog : mouse_analog_devices) { | 134 | for (auto& analog : mouse_wheel_devices) { |
| 132 | analog.reset(); | 135 | analog.reset(); |
| 133 | } | 136 | } |
| 134 | mouse_stick_device.reset(); | 137 | mouse_stick_device.reset(); |
| @@ -362,18 +365,18 @@ void EmulatedDevices::SetMouseButton(const Common::Input::CallbackStatus& callba | |||
| 362 | TriggerOnChange(DeviceTriggerType::Mouse); | 365 | TriggerOnChange(DeviceTriggerType::Mouse); |
| 363 | } | 366 | } |
| 364 | 367 | ||
| 365 | void EmulatedDevices::SetMouseAnalog(const Common::Input::CallbackStatus& callback, | 368 | void EmulatedDevices::SetMouseWheel(const Common::Input::CallbackStatus& callback, |
| 366 | std::size_t index) { | 369 | std::size_t index) { |
| 367 | if (index >= device_status.mouse_analog_values.size()) { | 370 | if (index >= device_status.mouse_wheel_values.size()) { |
| 368 | return; | 371 | return; |
| 369 | } | 372 | } |
| 370 | std::unique_lock lock{mutex}; | 373 | std::unique_lock lock{mutex}; |
| 371 | const auto analog_value = TransformToAnalog(callback); | 374 | const auto analog_value = TransformToAnalog(callback); |
| 372 | 375 | ||
| 373 | device_status.mouse_analog_values[index] = analog_value; | 376 | device_status.mouse_wheel_values[index] = analog_value; |
| 374 | 377 | ||
| 375 | if (is_configuring) { | 378 | if (is_configuring) { |
| 376 | device_status.mouse_position_state = {}; | 379 | device_status.mouse_wheel_state = {}; |
| 377 | lock.unlock(); | 380 | lock.unlock(); |
| 378 | TriggerOnChange(DeviceTriggerType::Mouse); | 381 | TriggerOnChange(DeviceTriggerType::Mouse); |
| 379 | return; | 382 | return; |
| @@ -392,7 +395,7 @@ void EmulatedDevices::SetMouseAnalog(const Common::Input::CallbackStatus& callba | |||
| 392 | TriggerOnChange(DeviceTriggerType::Mouse); | 395 | TriggerOnChange(DeviceTriggerType::Mouse); |
| 393 | } | 396 | } |
| 394 | 397 | ||
| 395 | void EmulatedDevices::SetMouseStick(const Common::Input::CallbackStatus& callback) { | 398 | void EmulatedDevices::SetMousePosition(const Common::Input::CallbackStatus& callback) { |
| 396 | std::unique_lock lock{mutex}; | 399 | std::unique_lock lock{mutex}; |
| 397 | const auto touch_value = TransformToTouch(callback); | 400 | const auto touch_value = TransformToTouch(callback); |
| 398 | 401 | ||
diff --git a/src/core/hid/emulated_devices.h b/src/core/hid/emulated_devices.h index 76f9150df..caf2ca659 100644 --- a/src/core/hid/emulated_devices.h +++ b/src/core/hid/emulated_devices.h | |||
| @@ -23,8 +23,8 @@ using KeyboardModifierDevices = std::array<std::unique_ptr<Common::Input::InputD | |||
| 23 | Settings::NativeKeyboard::NumKeyboardMods>; | 23 | Settings::NativeKeyboard::NumKeyboardMods>; |
| 24 | using MouseButtonDevices = std::array<std::unique_ptr<Common::Input::InputDevice>, | 24 | using MouseButtonDevices = std::array<std::unique_ptr<Common::Input::InputDevice>, |
| 25 | Settings::NativeMouseButton::NumMouseButtons>; | 25 | Settings::NativeMouseButton::NumMouseButtons>; |
| 26 | using MouseAnalogDevices = std::array<std::unique_ptr<Common::Input::InputDevice>, | 26 | using MouseWheelDevices = std::array<std::unique_ptr<Common::Input::InputDevice>, |
| 27 | Settings::NativeMouseWheel::NumMouseWheels>; | 27 | Settings::NativeMouseWheel::NumMouseWheels>; |
| 28 | using MouseStickDevice = std::unique_ptr<Common::Input::InputDevice>; | 28 | using MouseStickDevice = std::unique_ptr<Common::Input::InputDevice>; |
| 29 | 29 | ||
| 30 | using MouseButtonParams = | 30 | using MouseButtonParams = |
| @@ -36,7 +36,7 @@ using KeyboardModifierValues = | |||
| 36 | std::array<Common::Input::ButtonStatus, Settings::NativeKeyboard::NumKeyboardMods>; | 36 | std::array<Common::Input::ButtonStatus, Settings::NativeKeyboard::NumKeyboardMods>; |
| 37 | using MouseButtonValues = | 37 | using MouseButtonValues = |
| 38 | std::array<Common::Input::ButtonStatus, Settings::NativeMouseButton::NumMouseButtons>; | 38 | std::array<Common::Input::ButtonStatus, Settings::NativeMouseButton::NumMouseButtons>; |
| 39 | using MouseAnalogValues = | 39 | using MouseWheelValues = |
| 40 | std::array<Common::Input::AnalogStatus, Settings::NativeMouseWheel::NumMouseWheels>; | 40 | std::array<Common::Input::AnalogStatus, Settings::NativeMouseWheel::NumMouseWheels>; |
| 41 | using MouseStickValue = Common::Input::TouchStatus; | 41 | using MouseStickValue = Common::Input::TouchStatus; |
| 42 | 42 | ||
| @@ -50,7 +50,7 @@ struct DeviceStatus { | |||
| 50 | KeyboardValues keyboard_values{}; | 50 | KeyboardValues keyboard_values{}; |
| 51 | KeyboardModifierValues keyboard_moddifier_values{}; | 51 | KeyboardModifierValues keyboard_moddifier_values{}; |
| 52 | MouseButtonValues mouse_button_values{}; | 52 | MouseButtonValues mouse_button_values{}; |
| 53 | MouseAnalogValues mouse_analog_values{}; | 53 | MouseWheelValues mouse_wheel_values{}; |
| 54 | MouseStickValue mouse_stick_value{}; | 54 | MouseStickValue mouse_stick_value{}; |
| 55 | 55 | ||
| 56 | // Data for HID serices | 56 | // Data for HID serices |
| @@ -111,15 +111,6 @@ public: | |||
| 111 | /// Reverts any mapped changes made that weren't saved | 111 | /// Reverts any mapped changes made that weren't saved |
| 112 | void RestoreConfig(); | 112 | void RestoreConfig(); |
| 113 | 113 | ||
| 114 | // Returns the current mapped ring device | ||
| 115 | Common::ParamPackage GetRingParam() const; | ||
| 116 | |||
| 117 | /** | ||
| 118 | * Updates the current mapped ring device | ||
| 119 | * @param param ParamPackage with ring sensor data to be mapped | ||
| 120 | */ | ||
| 121 | void SetRingParam(Common::ParamPackage param); | ||
| 122 | |||
| 123 | /// Returns the latest status of button input from the keyboard with parameters | 114 | /// Returns the latest status of button input from the keyboard with parameters |
| 124 | KeyboardValues GetKeyboardValues() const; | 115 | KeyboardValues GetKeyboardValues() const; |
| 125 | 116 | ||
| @@ -187,19 +178,13 @@ private: | |||
| 187 | * @param callback A CallbackStatus containing the wheel status | 178 | * @param callback A CallbackStatus containing the wheel status |
| 188 | * @param index wheel ID to be updated | 179 | * @param index wheel ID to be updated |
| 189 | */ | 180 | */ |
| 190 | void SetMouseAnalog(const Common::Input::CallbackStatus& callback, std::size_t index); | 181 | void SetMouseWheel(const Common::Input::CallbackStatus& callback, std::size_t index); |
| 191 | 182 | ||
| 192 | /** | 183 | /** |
| 193 | * Updates the mouse position status of the mouse device | 184 | * Updates the mouse position status of the mouse device |
| 194 | * @param callback A CallbackStatus containing the position status | 185 | * @param callback A CallbackStatus containing the position status |
| 195 | */ | 186 | */ |
| 196 | void SetMouseStick(const Common::Input::CallbackStatus& callback); | 187 | void SetMousePosition(const Common::Input::CallbackStatus& callback); |
| 197 | |||
| 198 | /** | ||
| 199 | * Updates the ring analog sensor status of the ring controller | ||
| 200 | * @param callback A CallbackStatus containing the force status | ||
| 201 | */ | ||
| 202 | void SetRingAnalog(const Common::Input::CallbackStatus& callback); | ||
| 203 | 188 | ||
| 204 | /** | 189 | /** |
| 205 | * Triggers a callback that something has changed on the device status | 190 | * Triggers a callback that something has changed on the device status |
| @@ -212,7 +197,7 @@ private: | |||
| 212 | KeyboardDevices keyboard_devices; | 197 | KeyboardDevices keyboard_devices; |
| 213 | KeyboardModifierDevices keyboard_modifier_devices; | 198 | KeyboardModifierDevices keyboard_modifier_devices; |
| 214 | MouseButtonDevices mouse_button_devices; | 199 | MouseButtonDevices mouse_button_devices; |
| 215 | MouseAnalogDevices mouse_analog_devices; | 200 | MouseWheelDevices mouse_wheel_devices; |
| 216 | MouseStickDevice mouse_stick_device; | 201 | MouseStickDevice mouse_stick_device; |
| 217 | 202 | ||
| 218 | mutable std::mutex mutex; | 203 | mutable std::mutex mutex; |
diff --git a/src/core/hid/motion_input.cpp b/src/core/hid/motion_input.cpp index eef6edf4b..0dd66c1cc 100644 --- a/src/core/hid/motion_input.cpp +++ b/src/core/hid/motion_input.cpp | |||
| @@ -10,6 +10,8 @@ MotionInput::MotionInput() { | |||
| 10 | // Initialize PID constants with default values | 10 | // Initialize PID constants with default values |
| 11 | SetPID(0.3f, 0.005f, 0.0f); | 11 | SetPID(0.3f, 0.005f, 0.0f); |
| 12 | SetGyroThreshold(ThresholdStandard); | 12 | SetGyroThreshold(ThresholdStandard); |
| 13 | ResetQuaternion(); | ||
| 14 | ResetRotations(); | ||
| 13 | } | 15 | } |
| 14 | 16 | ||
| 15 | void MotionInput::SetPID(f32 new_kp, f32 new_ki, f32 new_kd) { | 17 | 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) { | |||
| 20 | 22 | ||
| 21 | void MotionInput::SetAcceleration(const Common::Vec3f& acceleration) { | 23 | void MotionInput::SetAcceleration(const Common::Vec3f& acceleration) { |
| 22 | accel = acceleration; | 24 | accel = acceleration; |
| 25 | |||
| 26 | accel.x = std::clamp(accel.x, -AccelMaxValue, AccelMaxValue); | ||
| 27 | accel.y = std::clamp(accel.y, -AccelMaxValue, AccelMaxValue); | ||
| 28 | accel.z = std::clamp(accel.z, -AccelMaxValue, AccelMaxValue); | ||
| 23 | } | 29 | } |
| 24 | 30 | ||
| 25 | void MotionInput::SetGyroscope(const Common::Vec3f& gyroscope) { | 31 | void MotionInput::SetGyroscope(const Common::Vec3f& gyroscope) { |
| 26 | gyro = gyroscope - gyro_bias; | 32 | gyro = gyroscope - gyro_bias; |
| 27 | 33 | ||
| 34 | gyro.x = std::clamp(gyro.x, -GyroMaxValue, GyroMaxValue); | ||
| 35 | gyro.y = std::clamp(gyro.y, -GyroMaxValue, GyroMaxValue); | ||
| 36 | gyro.z = std::clamp(gyro.z, -GyroMaxValue, GyroMaxValue); | ||
| 37 | |||
| 28 | // Auto adjust drift to minimize drift | 38 | // Auto adjust drift to minimize drift |
| 29 | if (!IsMoving(IsAtRestRelaxed)) { | 39 | if (!IsMoving(IsAtRestRelaxed)) { |
| 30 | gyro_bias = (gyro_bias * 0.9999f) + (gyroscope * 0.0001f); | 40 | gyro_bias = (gyro_bias * 0.9999f) + (gyroscope * 0.0001f); |
| @@ -61,6 +71,10 @@ void MotionInput::ResetRotations() { | |||
| 61 | rotations = {}; | 71 | rotations = {}; |
| 62 | } | 72 | } |
| 63 | 73 | ||
| 74 | void MotionInput::ResetQuaternion() { | ||
| 75 | quat = {{0.0f, 0.0f, -1.0f}, 0.0f}; | ||
| 76 | } | ||
| 77 | |||
| 64 | bool MotionInput::IsMoving(f32 sensitivity) const { | 78 | bool MotionInput::IsMoving(f32 sensitivity) const { |
| 65 | return gyro.Length() >= sensitivity || accel.Length() <= 0.9f || accel.Length() >= 1.1f; | 79 | return gyro.Length() >= sensitivity || accel.Length() <= 0.9f || accel.Length() >= 1.1f; |
| 66 | } | 80 | } |
diff --git a/src/core/hid/motion_input.h b/src/core/hid/motion_input.h index 9180bb9aa..e2c1bbf95 100644 --- a/src/core/hid/motion_input.h +++ b/src/core/hid/motion_input.h | |||
| @@ -20,6 +20,9 @@ public: | |||
| 20 | static constexpr float IsAtRestStandard = 0.01f; | 20 | static constexpr float IsAtRestStandard = 0.01f; |
| 21 | static constexpr float IsAtRestThight = 0.005f; | 21 | static constexpr float IsAtRestThight = 0.005f; |
| 22 | 22 | ||
| 23 | static constexpr float GyroMaxValue = 5.0f; | ||
| 24 | static constexpr float AccelMaxValue = 7.0f; | ||
| 25 | |||
| 23 | explicit MotionInput(); | 26 | explicit MotionInput(); |
| 24 | 27 | ||
| 25 | MotionInput(const MotionInput&) = default; | 28 | MotionInput(const MotionInput&) = default; |
| @@ -40,6 +43,7 @@ public: | |||
| 40 | 43 | ||
| 41 | void EnableReset(bool reset); | 44 | void EnableReset(bool reset); |
| 42 | void ResetRotations(); | 45 | void ResetRotations(); |
| 46 | void ResetQuaternion(); | ||
| 43 | 47 | ||
| 44 | void UpdateRotation(u64 elapsed_time); | 48 | void UpdateRotation(u64 elapsed_time); |
| 45 | void UpdateOrientation(u64 elapsed_time); | 49 | void UpdateOrientation(u64 elapsed_time); |
| @@ -69,7 +73,7 @@ private: | |||
| 69 | Common::Vec3f derivative_error; | 73 | Common::Vec3f derivative_error; |
| 70 | 74 | ||
| 71 | // Quaternion containing the device orientation | 75 | // Quaternion containing the device orientation |
| 72 | Common::Quaternion<f32> quat{{0.0f, 0.0f, -1.0f}, 0.0f}; | 76 | Common::Quaternion<f32> quat; |
| 73 | 77 | ||
| 74 | // Number of full rotations in each axis | 78 | // Number of full rotations in each axis |
| 75 | Common::Vec3f rotations; | 79 | Common::Vec3f rotations; |
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 1072da8cc..a0bfd6bbc 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -82,7 +82,7 @@ static_assert(sizeof(uint64_t) == 8); | |||
| 82 | static void SvcWrap_SetHeapSize64From32(Core::System& system) { | 82 | static void SvcWrap_SetHeapSize64From32(Core::System& system) { |
| 83 | Result ret{}; | 83 | Result ret{}; |
| 84 | 84 | ||
| 85 | uintptr_t out_address{}; | 85 | uint64_t out_address{}; |
| 86 | uint32_t size{}; | 86 | uint32_t size{}; |
| 87 | 87 | ||
| 88 | size = Convert<uint32_t>(GetReg32(system, 1)); | 88 | size = Convert<uint32_t>(GetReg32(system, 1)); |
| @@ -729,7 +729,7 @@ static void SvcWrap_GetLastThreadInfo64From32(Core::System& system) { | |||
| 729 | Result ret{}; | 729 | Result ret{}; |
| 730 | 730 | ||
| 731 | ilp32::LastThreadContext out_context{}; | 731 | ilp32::LastThreadContext out_context{}; |
| 732 | uintptr_t out_tls_address{}; | 732 | uint64_t out_tls_address{}; |
| 733 | uint32_t out_flags{}; | 733 | uint32_t out_flags{}; |
| 734 | 734 | ||
| 735 | ret = GetLastThreadInfo64From32(system, &out_context, &out_tls_address, &out_flags); | 735 | ret = GetLastThreadInfo64From32(system, &out_context, &out_tls_address, &out_flags); |
| @@ -1278,8 +1278,8 @@ static void SvcWrap_QueryPhysicalAddress64From32(Core::System& system) { | |||
| 1278 | static void SvcWrap_QueryIoMapping64From32(Core::System& system) { | 1278 | static void SvcWrap_QueryIoMapping64From32(Core::System& system) { |
| 1279 | Result ret{}; | 1279 | Result ret{}; |
| 1280 | 1280 | ||
| 1281 | uintptr_t out_address{}; | 1281 | uint64_t out_address{}; |
| 1282 | uintptr_t out_size{}; | 1282 | uint64_t out_size{}; |
| 1283 | uint64_t physical_address{}; | 1283 | uint64_t physical_address{}; |
| 1284 | uint32_t size{}; | 1284 | uint32_t size{}; |
| 1285 | 1285 | ||
| @@ -2088,7 +2088,7 @@ static void SvcWrap_UnmapInsecureMemory64From32(Core::System& system) { | |||
| 2088 | static void SvcWrap_SetHeapSize64(Core::System& system) { | 2088 | static void SvcWrap_SetHeapSize64(Core::System& system) { |
| 2089 | Result ret{}; | 2089 | Result ret{}; |
| 2090 | 2090 | ||
| 2091 | uintptr_t out_address{}; | 2091 | uint64_t out_address{}; |
| 2092 | uint64_t size{}; | 2092 | uint64_t size{}; |
| 2093 | 2093 | ||
| 2094 | size = Convert<uint64_t>(GetReg64(system, 1)); | 2094 | size = Convert<uint64_t>(GetReg64(system, 1)); |
| @@ -2705,7 +2705,7 @@ static void SvcWrap_GetLastThreadInfo64(Core::System& system) { | |||
| 2705 | Result ret{}; | 2705 | Result ret{}; |
| 2706 | 2706 | ||
| 2707 | lp64::LastThreadContext out_context{}; | 2707 | lp64::LastThreadContext out_context{}; |
| 2708 | uintptr_t out_tls_address{}; | 2708 | uint64_t out_tls_address{}; |
| 2709 | uint32_t out_flags{}; | 2709 | uint32_t out_flags{}; |
| 2710 | 2710 | ||
| 2711 | ret = GetLastThreadInfo64(system, &out_context, &out_tls_address, &out_flags); | 2711 | ret = GetLastThreadInfo64(system, &out_context, &out_tls_address, &out_flags); |
| @@ -3217,8 +3217,8 @@ static void SvcWrap_QueryPhysicalAddress64(Core::System& system) { | |||
| 3217 | static void SvcWrap_QueryIoMapping64(Core::System& system) { | 3217 | static void SvcWrap_QueryIoMapping64(Core::System& system) { |
| 3218 | Result ret{}; | 3218 | Result ret{}; |
| 3219 | 3219 | ||
| 3220 | uintptr_t out_address{}; | 3220 | uint64_t out_address{}; |
| 3221 | uintptr_t out_size{}; | 3221 | uint64_t out_size{}; |
| 3222 | uint64_t physical_address{}; | 3222 | uint64_t physical_address{}; |
| 3223 | uint64_t size{}; | 3223 | uint64_t size{}; |
| 3224 | 3224 | ||
diff --git a/src/core/hle/kernel/svc.h b/src/core/hle/kernel/svc.h index 36e619959..ac4696008 100644 --- a/src/core/hle/kernel/svc.h +++ b/src/core/hle/kernel/svc.h | |||
| @@ -16,7 +16,7 @@ class System; | |||
| 16 | namespace Kernel::Svc { | 16 | namespace Kernel::Svc { |
| 17 | 17 | ||
| 18 | // clang-format off | 18 | // clang-format off |
| 19 | Result SetHeapSize(Core::System& system, uintptr_t* out_address, uint64_t size); | 19 | Result SetHeapSize(Core::System& system, uint64_t* out_address, uint64_t size); |
| 20 | Result SetMemoryPermission(Core::System& system, uint64_t address, uint64_t size, MemoryPermission perm); | 20 | Result SetMemoryPermission(Core::System& system, uint64_t address, uint64_t size, MemoryPermission perm); |
| 21 | Result SetMemoryAttribute(Core::System& system, uint64_t address, uint64_t size, uint32_t mask, uint32_t attr); | 21 | Result SetMemoryAttribute(Core::System& system, uint64_t address, uint64_t size, uint32_t mask, uint32_t attr); |
| 22 | Result MapMemory(Core::System& system, uint64_t dst_address, uint64_t src_address, uint64_t size); | 22 | 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); | |||
| 61 | Result MapPhysicalMemory(Core::System& system, uint64_t address, uint64_t size); | 61 | Result MapPhysicalMemory(Core::System& system, uint64_t address, uint64_t size); |
| 62 | Result UnmapPhysicalMemory(Core::System& system, uint64_t address, uint64_t size); | 62 | Result UnmapPhysicalMemory(Core::System& system, uint64_t address, uint64_t size); |
| 63 | Result GetDebugFutureThreadInfo(Core::System& system, lp64::LastThreadContext* out_context, uint64_t* out_thread_id, Handle debug_handle, int64_t ns); | 63 | Result GetDebugFutureThreadInfo(Core::System& system, lp64::LastThreadContext* out_context, uint64_t* out_thread_id, Handle debug_handle, int64_t ns); |
| 64 | Result GetLastThreadInfo(Core::System& system, lp64::LastThreadContext* out_context, uintptr_t* out_tls_address, uint32_t* out_flags); | 64 | Result GetLastThreadInfo(Core::System& system, lp64::LastThreadContext* out_context, uint64_t* out_tls_address, uint32_t* out_flags); |
| 65 | Result GetResourceLimitLimitValue(Core::System& system, int64_t* out_limit_value, Handle resource_limit_handle, LimitableResource which); | 65 | Result GetResourceLimitLimitValue(Core::System& system, int64_t* out_limit_value, Handle resource_limit_handle, LimitableResource which); |
| 66 | Result GetResourceLimitCurrentValue(Core::System& system, int64_t* out_current_value, Handle resource_limit_handle, LimitableResource which); | 66 | Result GetResourceLimitCurrentValue(Core::System& system, int64_t* out_current_value, Handle resource_limit_handle, LimitableResource which); |
| 67 | Result SetThreadActivity(Core::System& system, Handle thread_handle, ThreadActivity thread_activity); | 67 | 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 | |||
| 94 | Result UnmapTransferMemory(Core::System& system, Handle trmem_handle, uint64_t address, uint64_t size); | 94 | Result UnmapTransferMemory(Core::System& system, Handle trmem_handle, uint64_t address, uint64_t size); |
| 95 | Result CreateInterruptEvent(Core::System& system, Handle* out_read_handle, int32_t interrupt_id, InterruptType interrupt_type); | 95 | Result CreateInterruptEvent(Core::System& system, Handle* out_read_handle, int32_t interrupt_id, InterruptType interrupt_type); |
| 96 | Result QueryPhysicalAddress(Core::System& system, lp64::PhysicalMemoryInfo* out_info, uint64_t address); | 96 | Result QueryPhysicalAddress(Core::System& system, lp64::PhysicalMemoryInfo* out_info, uint64_t address); |
| 97 | Result QueryIoMapping(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, uint64_t physical_address, uint64_t size); | 97 | Result QueryIoMapping(Core::System& system, uint64_t* out_address, uint64_t* out_size, uint64_t physical_address, uint64_t size); |
| 98 | Result CreateDeviceAddressSpace(Core::System& system, Handle* out_handle, uint64_t das_address, uint64_t das_size); | 98 | Result CreateDeviceAddressSpace(Core::System& system, Handle* out_handle, uint64_t das_address, uint64_t das_size); |
| 99 | Result AttachDeviceAddressSpace(Core::System& system, DeviceName device_name, Handle das_handle); | 99 | Result AttachDeviceAddressSpace(Core::System& system, DeviceName device_name, Handle das_handle); |
| 100 | Result DetachDeviceAddressSpace(Core::System& system, DeviceName device_name, Handle das_handle); | 100 | Result DetachDeviceAddressSpace(Core::System& system, DeviceName device_name, Handle das_handle); |
| @@ -137,7 +137,7 @@ Result SetResourceLimitLimitValue(Core::System& system, Handle resource_limit_ha | |||
| 137 | Result MapInsecureMemory(Core::System& system, uint64_t address, uint64_t size); | 137 | Result MapInsecureMemory(Core::System& system, uint64_t address, uint64_t size); |
| 138 | Result UnmapInsecureMemory(Core::System& system, uint64_t address, uint64_t size); | 138 | Result UnmapInsecureMemory(Core::System& system, uint64_t address, uint64_t size); |
| 139 | 139 | ||
| 140 | Result SetHeapSize64From32(Core::System& system, uintptr_t* out_address, uint32_t size); | 140 | Result SetHeapSize64From32(Core::System& system, uint64_t* out_address, uint32_t size); |
| 141 | Result SetMemoryPermission64From32(Core::System& system, uint32_t address, uint32_t size, MemoryPermission perm); | 141 | Result SetMemoryPermission64From32(Core::System& system, uint32_t address, uint32_t size, MemoryPermission perm); |
| 142 | Result SetMemoryAttribute64From32(Core::System& system, uint32_t address, uint32_t size, uint32_t mask, uint32_t attr); | 142 | Result SetMemoryAttribute64From32(Core::System& system, uint32_t address, uint32_t size, uint32_t mask, uint32_t attr); |
| 143 | Result MapMemory64From32(Core::System& system, uint32_t dst_address, uint32_t src_address, uint32_t size); | 143 | 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 | |||
| 182 | Result MapPhysicalMemory64From32(Core::System& system, uint32_t address, uint32_t size); | 182 | Result MapPhysicalMemory64From32(Core::System& system, uint32_t address, uint32_t size); |
| 183 | Result UnmapPhysicalMemory64From32(Core::System& system, uint32_t address, uint32_t size); | 183 | Result UnmapPhysicalMemory64From32(Core::System& system, uint32_t address, uint32_t size); |
| 184 | Result GetDebugFutureThreadInfo64From32(Core::System& system, ilp32::LastThreadContext* out_context, uint64_t* out_thread_id, Handle debug_handle, int64_t ns); | 184 | Result GetDebugFutureThreadInfo64From32(Core::System& system, ilp32::LastThreadContext* out_context, uint64_t* out_thread_id, Handle debug_handle, int64_t ns); |
| 185 | Result GetLastThreadInfo64From32(Core::System& system, ilp32::LastThreadContext* out_context, uintptr_t* out_tls_address, uint32_t* out_flags); | 185 | Result GetLastThreadInfo64From32(Core::System& system, ilp32::LastThreadContext* out_context, uint64_t* out_tls_address, uint32_t* out_flags); |
| 186 | Result GetResourceLimitLimitValue64From32(Core::System& system, int64_t* out_limit_value, Handle resource_limit_handle, LimitableResource which); | 186 | Result GetResourceLimitLimitValue64From32(Core::System& system, int64_t* out_limit_value, Handle resource_limit_handle, LimitableResource which); |
| 187 | Result GetResourceLimitCurrentValue64From32(Core::System& system, int64_t* out_current_value, Handle resource_limit_handle, LimitableResource which); | 187 | Result GetResourceLimitCurrentValue64From32(Core::System& system, int64_t* out_current_value, Handle resource_limit_handle, LimitableResource which); |
| 188 | Result SetThreadActivity64From32(Core::System& system, Handle thread_handle, ThreadActivity thread_activity); | 188 | Result SetThreadActivity64From32(Core::System& system, Handle thread_handle, ThreadActivity thread_activity); |
| @@ -215,7 +215,7 @@ Result MapTransferMemory64From32(Core::System& system, Handle trmem_handle, uint | |||
| 215 | Result UnmapTransferMemory64From32(Core::System& system, Handle trmem_handle, uint32_t address, uint32_t size); | 215 | Result UnmapTransferMemory64From32(Core::System& system, Handle trmem_handle, uint32_t address, uint32_t size); |
| 216 | Result CreateInterruptEvent64From32(Core::System& system, Handle* out_read_handle, int32_t interrupt_id, InterruptType interrupt_type); | 216 | Result CreateInterruptEvent64From32(Core::System& system, Handle* out_read_handle, int32_t interrupt_id, InterruptType interrupt_type); |
| 217 | Result QueryPhysicalAddress64From32(Core::System& system, ilp32::PhysicalMemoryInfo* out_info, uint32_t address); | 217 | Result QueryPhysicalAddress64From32(Core::System& system, ilp32::PhysicalMemoryInfo* out_info, uint32_t address); |
| 218 | Result QueryIoMapping64From32(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, uint64_t physical_address, uint32_t size); | 218 | Result QueryIoMapping64From32(Core::System& system, uint64_t* out_address, uint64_t* out_size, uint64_t physical_address, uint32_t size); |
| 219 | Result CreateDeviceAddressSpace64From32(Core::System& system, Handle* out_handle, uint64_t das_address, uint64_t das_size); | 219 | Result CreateDeviceAddressSpace64From32(Core::System& system, Handle* out_handle, uint64_t das_address, uint64_t das_size); |
| 220 | Result AttachDeviceAddressSpace64From32(Core::System& system, DeviceName device_name, Handle das_handle); | 220 | Result AttachDeviceAddressSpace64From32(Core::System& system, DeviceName device_name, Handle das_handle); |
| 221 | Result DetachDeviceAddressSpace64From32(Core::System& system, DeviceName device_name, Handle das_handle); | 221 | Result DetachDeviceAddressSpace64From32(Core::System& system, DeviceName device_name, Handle das_handle); |
| @@ -258,7 +258,7 @@ Result SetResourceLimitLimitValue64From32(Core::System& system, Handle resource_ | |||
| 258 | Result MapInsecureMemory64From32(Core::System& system, uint32_t address, uint32_t size); | 258 | Result MapInsecureMemory64From32(Core::System& system, uint32_t address, uint32_t size); |
| 259 | Result UnmapInsecureMemory64From32(Core::System& system, uint32_t address, uint32_t size); | 259 | Result UnmapInsecureMemory64From32(Core::System& system, uint32_t address, uint32_t size); |
| 260 | 260 | ||
| 261 | Result SetHeapSize64(Core::System& system, uintptr_t* out_address, uint64_t size); | 261 | Result SetHeapSize64(Core::System& system, uint64_t* out_address, uint64_t size); |
| 262 | Result SetMemoryPermission64(Core::System& system, uint64_t address, uint64_t size, MemoryPermission perm); | 262 | Result SetMemoryPermission64(Core::System& system, uint64_t address, uint64_t size, MemoryPermission perm); |
| 263 | Result SetMemoryAttribute64(Core::System& system, uint64_t address, uint64_t size, uint32_t mask, uint32_t attr); | 263 | Result SetMemoryAttribute64(Core::System& system, uint64_t address, uint64_t size, uint32_t mask, uint32_t attr); |
| 264 | Result MapMemory64(Core::System& system, uint64_t dst_address, uint64_t src_address, uint64_t size); | 264 | 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); | |||
| 303 | Result MapPhysicalMemory64(Core::System& system, uint64_t address, uint64_t size); | 303 | Result MapPhysicalMemory64(Core::System& system, uint64_t address, uint64_t size); |
| 304 | Result UnmapPhysicalMemory64(Core::System& system, uint64_t address, uint64_t size); | 304 | Result UnmapPhysicalMemory64(Core::System& system, uint64_t address, uint64_t size); |
| 305 | Result GetDebugFutureThreadInfo64(Core::System& system, lp64::LastThreadContext* out_context, uint64_t* out_thread_id, Handle debug_handle, int64_t ns); | 305 | Result GetDebugFutureThreadInfo64(Core::System& system, lp64::LastThreadContext* out_context, uint64_t* out_thread_id, Handle debug_handle, int64_t ns); |
| 306 | Result GetLastThreadInfo64(Core::System& system, lp64::LastThreadContext* out_context, uintptr_t* out_tls_address, uint32_t* out_flags); | 306 | Result GetLastThreadInfo64(Core::System& system, lp64::LastThreadContext* out_context, uint64_t* out_tls_address, uint32_t* out_flags); |
| 307 | Result GetResourceLimitLimitValue64(Core::System& system, int64_t* out_limit_value, Handle resource_limit_handle, LimitableResource which); | 307 | Result GetResourceLimitLimitValue64(Core::System& system, int64_t* out_limit_value, Handle resource_limit_handle, LimitableResource which); |
| 308 | Result GetResourceLimitCurrentValue64(Core::System& system, int64_t* out_current_value, Handle resource_limit_handle, LimitableResource which); | 308 | Result GetResourceLimitCurrentValue64(Core::System& system, int64_t* out_current_value, Handle resource_limit_handle, LimitableResource which); |
| 309 | Result SetThreadActivity64(Core::System& system, Handle thread_handle, ThreadActivity thread_activity); | 309 | 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 | |||
| 336 | Result UnmapTransferMemory64(Core::System& system, Handle trmem_handle, uint64_t address, uint64_t size); | 336 | Result UnmapTransferMemory64(Core::System& system, Handle trmem_handle, uint64_t address, uint64_t size); |
| 337 | Result CreateInterruptEvent64(Core::System& system, Handle* out_read_handle, int32_t interrupt_id, InterruptType interrupt_type); | 337 | Result CreateInterruptEvent64(Core::System& system, Handle* out_read_handle, int32_t interrupt_id, InterruptType interrupt_type); |
| 338 | Result QueryPhysicalAddress64(Core::System& system, lp64::PhysicalMemoryInfo* out_info, uint64_t address); | 338 | Result QueryPhysicalAddress64(Core::System& system, lp64::PhysicalMemoryInfo* out_info, uint64_t address); |
| 339 | Result QueryIoMapping64(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, uint64_t physical_address, uint64_t size); | 339 | Result QueryIoMapping64(Core::System& system, uint64_t* out_address, uint64_t* out_size, uint64_t physical_address, uint64_t size); |
| 340 | Result CreateDeviceAddressSpace64(Core::System& system, Handle* out_handle, uint64_t das_address, uint64_t das_size); | 340 | Result CreateDeviceAddressSpace64(Core::System& system, Handle* out_handle, uint64_t das_address, uint64_t das_size); |
| 341 | Result AttachDeviceAddressSpace64(Core::System& system, DeviceName device_name, Handle das_handle); | 341 | Result AttachDeviceAddressSpace64(Core::System& system, DeviceName device_name, Handle das_handle); |
| 342 | Result DetachDeviceAddressSpace64(Core::System& system, DeviceName device_name, Handle das_handle); | 342 | Result DetachDeviceAddressSpace64(Core::System& system, DeviceName device_name, Handle das_handle); |
diff --git a/src/core/hle/kernel/svc/svc_address_translation.cpp b/src/core/hle/kernel/svc/svc_address_translation.cpp index c25e144cd..e65a11cda 100644 --- a/src/core/hle/kernel/svc/svc_address_translation.cpp +++ b/src/core/hle/kernel/svc/svc_address_translation.cpp | |||
| @@ -12,7 +12,7 @@ Result QueryPhysicalAddress(Core::System& system, lp64::PhysicalMemoryInfo* out_ | |||
| 12 | R_THROW(ResultNotImplemented); | 12 | R_THROW(ResultNotImplemented); |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | Result QueryIoMapping(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, | 15 | Result QueryIoMapping(Core::System& system, uint64_t* out_address, uint64_t* out_size, |
| 16 | uint64_t physical_address, uint64_t size) { | 16 | uint64_t physical_address, uint64_t size) { |
| 17 | UNIMPLEMENTED(); | 17 | UNIMPLEMENTED(); |
| 18 | R_THROW(ResultNotImplemented); | 18 | R_THROW(ResultNotImplemented); |
| @@ -23,7 +23,7 @@ Result QueryPhysicalAddress64(Core::System& system, lp64::PhysicalMemoryInfo* ou | |||
| 23 | R_RETURN(QueryPhysicalAddress(system, out_info, address)); | 23 | R_RETURN(QueryPhysicalAddress(system, out_info, address)); |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | Result QueryIoMapping64(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, | 26 | Result QueryIoMapping64(Core::System& system, uint64_t* out_address, uint64_t* out_size, |
| 27 | uint64_t physical_address, uint64_t size) { | 27 | uint64_t physical_address, uint64_t size) { |
| 28 | R_RETURN(QueryIoMapping(system, out_address, out_size, physical_address, size)); | 28 | R_RETURN(QueryIoMapping(system, out_address, out_size, physical_address, size)); |
| 29 | } | 29 | } |
| @@ -41,10 +41,10 @@ Result QueryPhysicalAddress64From32(Core::System& system, ilp32::PhysicalMemoryI | |||
| 41 | R_SUCCEED(); | 41 | R_SUCCEED(); |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | Result QueryIoMapping64From32(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, | 44 | Result QueryIoMapping64From32(Core::System& system, uint64_t* out_address, uint64_t* out_size, |
| 45 | uint64_t physical_address, uint32_t size) { | 45 | uint64_t physical_address, uint32_t size) { |
| 46 | R_RETURN(QueryIoMapping(system, reinterpret_cast<uintptr_t*>(out_address), | 46 | R_RETURN(QueryIoMapping(system, reinterpret_cast<uint64_t*>(out_address), |
| 47 | reinterpret_cast<uintptr_t*>(out_size), physical_address, size)); | 47 | reinterpret_cast<uint64_t*>(out_size), physical_address, size)); |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | } // namespace Kernel::Svc | 50 | } // namespace Kernel::Svc |
diff --git a/src/core/hle/kernel/svc/svc_cache.cpp b/src/core/hle/kernel/svc/svc_cache.cpp index 598b71da5..1779832d3 100644 --- a/src/core/hle/kernel/svc/svc_cache.cpp +++ b/src/core/hle/kernel/svc/svc_cache.cpp | |||
| @@ -13,7 +13,7 @@ void FlushEntireDataCache(Core::System& system) { | |||
| 13 | UNIMPLEMENTED(); | 13 | UNIMPLEMENTED(); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | Result FlushDataCache(Core::System& system, VAddr address, size_t size) { | 16 | Result FlushDataCache(Core::System& system, uint64_t address, uint64_t size) { |
| 17 | UNIMPLEMENTED(); | 17 | UNIMPLEMENTED(); |
| 18 | R_THROW(ResultNotImplemented); | 18 | R_THROW(ResultNotImplemented); |
| 19 | } | 19 | } |
| @@ -33,8 +33,8 @@ Result StoreProcessDataCache(Core::System& system, Handle process_handle, uint64 | |||
| 33 | Result FlushProcessDataCache(Core::System& system, Handle process_handle, u64 address, u64 size) { | 33 | Result FlushProcessDataCache(Core::System& system, Handle process_handle, u64 address, u64 size) { |
| 34 | // Validate address/size. | 34 | // Validate address/size. |
| 35 | R_UNLESS(size > 0, ResultInvalidSize); | 35 | R_UNLESS(size > 0, ResultInvalidSize); |
| 36 | R_UNLESS(address == static_cast<uintptr_t>(address), ResultInvalidCurrentMemory); | 36 | R_UNLESS(address == static_cast<uint64_t>(address), ResultInvalidCurrentMemory); |
| 37 | R_UNLESS(size == static_cast<size_t>(size), ResultInvalidCurrentMemory); | 37 | R_UNLESS(size == static_cast<uint64_t>(size), ResultInvalidCurrentMemory); |
| 38 | 38 | ||
| 39 | // Get the process from its handle. | 39 | // Get the process from its handle. |
| 40 | KScopedAutoObject process = | 40 | KScopedAutoObject process = |
| @@ -53,7 +53,7 @@ void FlushEntireDataCache64(Core::System& system) { | |||
| 53 | FlushEntireDataCache(system); | 53 | FlushEntireDataCache(system); |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | Result FlushDataCache64(Core::System& system, VAddr address, size_t size) { | 56 | Result FlushDataCache64(Core::System& system, uint64_t address, uint64_t size) { |
| 57 | R_RETURN(FlushDataCache(system, address, size)); | 57 | R_RETURN(FlushDataCache(system, address, size)); |
| 58 | } | 58 | } |
| 59 | 59 | ||
diff --git a/src/core/hle/kernel/svc/svc_code_memory.cpp b/src/core/hle/kernel/svc/svc_code_memory.cpp index 538ff1c71..8bed747af 100644 --- a/src/core/hle/kernel/svc/svc_code_memory.cpp +++ b/src/core/hle/kernel/svc/svc_code_memory.cpp | |||
| @@ -28,7 +28,7 @@ constexpr bool IsValidUnmapFromOwnerCodeMemoryPermission(MemoryPermission perm) | |||
| 28 | 28 | ||
| 29 | } // namespace | 29 | } // namespace |
| 30 | 30 | ||
| 31 | Result CreateCodeMemory(Core::System& system, Handle* out, VAddr address, size_t size) { | 31 | Result CreateCodeMemory(Core::System& system, Handle* out, VAddr address, uint64_t size) { |
| 32 | LOG_TRACE(Kernel_SVC, "called, address=0x{:X}, size=0x{:X}", address, size); | 32 | LOG_TRACE(Kernel_SVC, "called, address=0x{:X}, size=0x{:X}", address, size); |
| 33 | 33 | ||
| 34 | // Get kernel instance. | 34 | // Get kernel instance. |
| @@ -64,7 +64,7 @@ Result CreateCodeMemory(Core::System& system, Handle* out, VAddr address, size_t | |||
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | Result ControlCodeMemory(Core::System& system, Handle code_memory_handle, | 66 | Result ControlCodeMemory(Core::System& system, Handle code_memory_handle, |
| 67 | CodeMemoryOperation operation, VAddr address, size_t size, | 67 | CodeMemoryOperation operation, VAddr address, uint64_t size, |
| 68 | MemoryPermission perm) { | 68 | MemoryPermission perm) { |
| 69 | 69 | ||
| 70 | LOG_TRACE(Kernel_SVC, | 70 | LOG_TRACE(Kernel_SVC, |
diff --git a/src/core/hle/kernel/svc/svc_debug.cpp b/src/core/hle/kernel/svc/svc_debug.cpp index a14050fa7..a4d1f700e 100644 --- a/src/core/hle/kernel/svc/svc_debug.cpp +++ b/src/core/hle/kernel/svc/svc_debug.cpp | |||
| @@ -45,19 +45,19 @@ Result SetDebugThreadContext(Core::System& system, Handle debug_handle, uint64_t | |||
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | Result QueryDebugProcessMemory(Core::System& system, uint64_t out_memory_info, | 47 | Result QueryDebugProcessMemory(Core::System& system, uint64_t out_memory_info, |
| 48 | PageInfo* out_page_info, Handle debug_handle, uintptr_t address) { | 48 | PageInfo* out_page_info, Handle process_handle, uint64_t address) { |
| 49 | UNIMPLEMENTED(); | 49 | UNIMPLEMENTED(); |
| 50 | R_THROW(ResultNotImplemented); | 50 | R_THROW(ResultNotImplemented); |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | Result ReadDebugProcessMemory(Core::System& system, uintptr_t buffer, Handle debug_handle, | 53 | Result ReadDebugProcessMemory(Core::System& system, uint64_t buffer, Handle debug_handle, |
| 54 | uintptr_t address, size_t size) { | 54 | uint64_t address, uint64_t size) { |
| 55 | UNIMPLEMENTED(); | 55 | UNIMPLEMENTED(); |
| 56 | R_THROW(ResultNotImplemented); | 56 | R_THROW(ResultNotImplemented); |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | Result WriteDebugProcessMemory(Core::System& system, Handle debug_handle, uintptr_t buffer, | 59 | Result WriteDebugProcessMemory(Core::System& system, Handle debug_handle, uint64_t buffer, |
| 60 | uintptr_t address, size_t size) { | 60 | uint64_t address, uint64_t size) { |
| 61 | UNIMPLEMENTED(); | 61 | UNIMPLEMENTED(); |
| 62 | R_THROW(ResultNotImplemented); | 62 | R_THROW(ResultNotImplemented); |
| 63 | } | 63 | } |
diff --git a/src/core/hle/kernel/svc/svc_device_address_space.cpp b/src/core/hle/kernel/svc/svc_device_address_space.cpp index f68c0e6a9..ec3143e67 100644 --- a/src/core/hle/kernel/svc/svc_device_address_space.cpp +++ b/src/core/hle/kernel/svc/svc_device_address_space.cpp | |||
| @@ -76,8 +76,8 @@ constexpr bool IsValidDeviceMemoryPermission(MemoryPermission device_perm) { | |||
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | Result MapDeviceAddressSpaceByForce(Core::System& system, Handle das_handle, Handle process_handle, | 78 | Result MapDeviceAddressSpaceByForce(Core::System& system, Handle das_handle, Handle process_handle, |
| 79 | uint64_t process_address, size_t size, uint64_t device_address, | 79 | uint64_t process_address, uint64_t size, |
| 80 | u32 option) { | 80 | uint64_t device_address, u32 option) { |
| 81 | // Decode the option. | 81 | // Decode the option. |
| 82 | const MapDeviceAddressSpaceOption option_pack{option}; | 82 | const MapDeviceAddressSpaceOption option_pack{option}; |
| 83 | const auto device_perm = option_pack.permission; | 83 | const auto device_perm = option_pack.permission; |
| @@ -90,7 +90,7 @@ Result MapDeviceAddressSpaceByForce(Core::System& system, Handle das_handle, Han | |||
| 90 | R_UNLESS(size > 0, ResultInvalidSize); | 90 | R_UNLESS(size > 0, ResultInvalidSize); |
| 91 | R_UNLESS((process_address < process_address + size), ResultInvalidCurrentMemory); | 91 | R_UNLESS((process_address < process_address + size), ResultInvalidCurrentMemory); |
| 92 | R_UNLESS((device_address < device_address + size), ResultInvalidMemoryRegion); | 92 | R_UNLESS((device_address < device_address + size), ResultInvalidMemoryRegion); |
| 93 | R_UNLESS((process_address == static_cast<uintptr_t>(process_address)), | 93 | R_UNLESS((process_address == static_cast<uint64_t>(process_address)), |
| 94 | ResultInvalidCurrentMemory); | 94 | ResultInvalidCurrentMemory); |
| 95 | R_UNLESS(IsValidDeviceMemoryPermission(device_perm), ResultInvalidNewMemoryPermission); | 95 | R_UNLESS(IsValidDeviceMemoryPermission(device_perm), ResultInvalidNewMemoryPermission); |
| 96 | R_UNLESS(reserved == 0, ResultInvalidEnumValue); | 96 | R_UNLESS(reserved == 0, ResultInvalidEnumValue); |
| @@ -116,8 +116,8 @@ Result MapDeviceAddressSpaceByForce(Core::System& system, Handle das_handle, Han | |||
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | Result MapDeviceAddressSpaceAligned(Core::System& system, Handle das_handle, Handle process_handle, | 118 | Result MapDeviceAddressSpaceAligned(Core::System& system, Handle das_handle, Handle process_handle, |
| 119 | uint64_t process_address, size_t size, uint64_t device_address, | 119 | uint64_t process_address, uint64_t size, |
| 120 | u32 option) { | 120 | uint64_t device_address, u32 option) { |
| 121 | // Decode the option. | 121 | // Decode the option. |
| 122 | const MapDeviceAddressSpaceOption option_pack{option}; | 122 | const MapDeviceAddressSpaceOption option_pack{option}; |
| 123 | const auto device_perm = option_pack.permission; | 123 | const auto device_perm = option_pack.permission; |
| @@ -131,7 +131,7 @@ Result MapDeviceAddressSpaceAligned(Core::System& system, Handle das_handle, Han | |||
| 131 | R_UNLESS(size > 0, ResultInvalidSize); | 131 | R_UNLESS(size > 0, ResultInvalidSize); |
| 132 | R_UNLESS((process_address < process_address + size), ResultInvalidCurrentMemory); | 132 | R_UNLESS((process_address < process_address + size), ResultInvalidCurrentMemory); |
| 133 | R_UNLESS((device_address < device_address + size), ResultInvalidMemoryRegion); | 133 | R_UNLESS((device_address < device_address + size), ResultInvalidMemoryRegion); |
| 134 | R_UNLESS((process_address == static_cast<uintptr_t>(process_address)), | 134 | R_UNLESS((process_address == static_cast<uint64_t>(process_address)), |
| 135 | ResultInvalidCurrentMemory); | 135 | ResultInvalidCurrentMemory); |
| 136 | R_UNLESS(IsValidDeviceMemoryPermission(device_perm), ResultInvalidNewMemoryPermission); | 136 | R_UNLESS(IsValidDeviceMemoryPermission(device_perm), ResultInvalidNewMemoryPermission); |
| 137 | R_UNLESS(reserved == 0, ResultInvalidEnumValue); | 137 | R_UNLESS(reserved == 0, ResultInvalidEnumValue); |
| @@ -157,7 +157,7 @@ Result MapDeviceAddressSpaceAligned(Core::System& system, Handle das_handle, Han | |||
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | Result UnmapDeviceAddressSpace(Core::System& system, Handle das_handle, Handle process_handle, | 159 | Result UnmapDeviceAddressSpace(Core::System& system, Handle das_handle, Handle process_handle, |
| 160 | uint64_t process_address, size_t size, uint64_t device_address) { | 160 | uint64_t process_address, uint64_t size, uint64_t device_address) { |
| 161 | // Validate input. | 161 | // Validate input. |
| 162 | R_UNLESS(Common::IsAligned(process_address, PageSize), ResultInvalidAddress); | 162 | R_UNLESS(Common::IsAligned(process_address, PageSize), ResultInvalidAddress); |
| 163 | R_UNLESS(Common::IsAligned(device_address, PageSize), ResultInvalidAddress); | 163 | R_UNLESS(Common::IsAligned(device_address, PageSize), ResultInvalidAddress); |
| @@ -165,7 +165,7 @@ Result UnmapDeviceAddressSpace(Core::System& system, Handle das_handle, Handle p | |||
| 165 | R_UNLESS(size > 0, ResultInvalidSize); | 165 | R_UNLESS(size > 0, ResultInvalidSize); |
| 166 | R_UNLESS((process_address < process_address + size), ResultInvalidCurrentMemory); | 166 | R_UNLESS((process_address < process_address + size), ResultInvalidCurrentMemory); |
| 167 | R_UNLESS((device_address < device_address + size), ResultInvalidMemoryRegion); | 167 | R_UNLESS((device_address < device_address + size), ResultInvalidMemoryRegion); |
| 168 | R_UNLESS((process_address == static_cast<uintptr_t>(process_address)), | 168 | R_UNLESS((process_address == static_cast<uint64_t>(process_address)), |
| 169 | ResultInvalidCurrentMemory); | 169 | ResultInvalidCurrentMemory); |
| 170 | 170 | ||
| 171 | // Get the device address space. | 171 | // Get the device address space. |
diff --git a/src/core/hle/kernel/svc/svc_insecure_memory.cpp b/src/core/hle/kernel/svc/svc_insecure_memory.cpp index 79882685d..00457c6bf 100644 --- a/src/core/hle/kernel/svc/svc_insecure_memory.cpp +++ b/src/core/hle/kernel/svc/svc_insecure_memory.cpp | |||
| @@ -6,12 +6,12 @@ | |||
| 6 | 6 | ||
| 7 | namespace Kernel::Svc { | 7 | namespace Kernel::Svc { |
| 8 | 8 | ||
| 9 | Result MapInsecureMemory(Core::System& system, uintptr_t address, size_t size) { | 9 | Result MapInsecureMemory(Core::System& system, uint64_t address, uint64_t size) { |
| 10 | UNIMPLEMENTED(); | 10 | UNIMPLEMENTED(); |
| 11 | R_THROW(ResultNotImplemented); | 11 | R_THROW(ResultNotImplemented); |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | Result UnmapInsecureMemory(Core::System& system, uintptr_t address, size_t size) { | 14 | Result UnmapInsecureMemory(Core::System& system, uint64_t address, uint64_t size) { |
| 15 | UNIMPLEMENTED(); | 15 | UNIMPLEMENTED(); |
| 16 | R_THROW(ResultNotImplemented); | 16 | R_THROW(ResultNotImplemented); |
| 17 | } | 17 | } |
diff --git a/src/core/hle/kernel/svc/svc_io_pool.cpp b/src/core/hle/kernel/svc/svc_io_pool.cpp index 33f3d69bf..f01817e24 100644 --- a/src/core/hle/kernel/svc/svc_io_pool.cpp +++ b/src/core/hle/kernel/svc/svc_io_pool.cpp | |||
| @@ -12,19 +12,19 @@ Result CreateIoPool(Core::System& system, Handle* out, IoPoolType pool_type) { | |||
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | Result CreateIoRegion(Core::System& system, Handle* out, Handle io_pool_handle, uint64_t phys_addr, | 14 | Result CreateIoRegion(Core::System& system, Handle* out, Handle io_pool_handle, uint64_t phys_addr, |
| 15 | size_t size, MemoryMapping mapping, MemoryPermission perm) { | 15 | uint64_t size, MemoryMapping mapping, MemoryPermission perm) { |
| 16 | UNIMPLEMENTED(); | 16 | UNIMPLEMENTED(); |
| 17 | R_THROW(ResultNotImplemented); | 17 | R_THROW(ResultNotImplemented); |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | Result MapIoRegion(Core::System& system, Handle io_region_handle, uintptr_t address, size_t size, | 20 | Result MapIoRegion(Core::System& system, Handle io_region_handle, uint64_t address, uint64_t size, |
| 21 | MemoryPermission map_perm) { | 21 | MemoryPermission map_perm) { |
| 22 | UNIMPLEMENTED(); | 22 | UNIMPLEMENTED(); |
| 23 | R_THROW(ResultNotImplemented); | 23 | R_THROW(ResultNotImplemented); |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | Result UnmapIoRegion(Core::System& system, Handle io_region_handle, uintptr_t address, | 26 | Result UnmapIoRegion(Core::System& system, Handle io_region_handle, uint64_t address, |
| 27 | size_t size) { | 27 | uint64_t size) { |
| 28 | UNIMPLEMENTED(); | 28 | UNIMPLEMENTED(); |
| 29 | R_THROW(ResultNotImplemented); | 29 | R_THROW(ResultNotImplemented); |
| 30 | } | 30 | } |
diff --git a/src/core/hle/kernel/svc/svc_physical_memory.cpp b/src/core/hle/kernel/svc/svc_physical_memory.cpp index a1f534454..ed6a624ac 100644 --- a/src/core/hle/kernel/svc/svc_physical_memory.cpp +++ b/src/core/hle/kernel/svc/svc_physical_memory.cpp | |||
| @@ -158,7 +158,7 @@ Result SetUnsafeLimit64(Core::System& system, uint64_t limit) { | |||
| 158 | R_RETURN(SetUnsafeLimit(system, limit)); | 158 | R_RETURN(SetUnsafeLimit(system, limit)); |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | Result SetHeapSize64From32(Core::System& system, uintptr_t* out_address, uint32_t size) { | 161 | Result SetHeapSize64From32(Core::System& system, uint64_t* out_address, uint32_t size) { |
| 162 | R_RETURN(SetHeapSize(system, out_address, size)); | 162 | R_RETURN(SetHeapSize(system, out_address, size)); |
| 163 | } | 163 | } |
| 164 | 164 | ||
diff --git a/src/core/hle/kernel/svc/svc_port.cpp b/src/core/hle/kernel/svc/svc_port.cpp index ac095b338..78c2a8d17 100644 --- a/src/core/hle/kernel/svc/svc_port.cpp +++ b/src/core/hle/kernel/svc/svc_port.cpp | |||
| @@ -49,7 +49,7 @@ Result ConnectToNamedPort(Core::System& system, Handle* out, VAddr user_name) { | |||
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | Result CreatePort(Core::System& system, Handle* out_server, Handle* out_client, | 51 | Result CreatePort(Core::System& system, Handle* out_server, Handle* out_client, |
| 52 | int32_t max_sessions, bool is_light, uintptr_t name) { | 52 | int32_t max_sessions, bool is_light, uint64_t name) { |
| 53 | UNIMPLEMENTED(); | 53 | UNIMPLEMENTED(); |
| 54 | R_THROW(ResultNotImplemented); | 54 | R_THROW(ResultNotImplemented); |
| 55 | } | 55 | } |
diff --git a/src/core/hle/kernel/svc/svc_process_memory.cpp b/src/core/hle/kernel/svc/svc_process_memory.cpp index 4dfd9e5bb..8e2fb4092 100644 --- a/src/core/hle/kernel/svc/svc_process_memory.cpp +++ b/src/core/hle/kernel/svc/svc_process_memory.cpp | |||
| @@ -37,8 +37,8 @@ Result SetProcessMemoryPermission(Core::System& system, Handle process_handle, V | |||
| 37 | R_UNLESS(Common::IsAligned(size, PageSize), ResultInvalidSize); | 37 | R_UNLESS(Common::IsAligned(size, PageSize), ResultInvalidSize); |
| 38 | R_UNLESS(size > 0, ResultInvalidSize); | 38 | R_UNLESS(size > 0, ResultInvalidSize); |
| 39 | R_UNLESS((address < address + size), ResultInvalidCurrentMemory); | 39 | R_UNLESS((address < address + size), ResultInvalidCurrentMemory); |
| 40 | R_UNLESS(address == static_cast<uintptr_t>(address), ResultInvalidCurrentMemory); | 40 | R_UNLESS(address == static_cast<uint64_t>(address), ResultInvalidCurrentMemory); |
| 41 | R_UNLESS(size == static_cast<size_t>(size), ResultInvalidCurrentMemory); | 41 | R_UNLESS(size == static_cast<uint64_t>(size), ResultInvalidCurrentMemory); |
| 42 | 42 | ||
| 43 | // Validate the memory permission. | 43 | // Validate the memory permission. |
| 44 | R_UNLESS(IsValidProcessMemoryPermission(perm), ResultInvalidNewMemoryPermission); | 44 | R_UNLESS(IsValidProcessMemoryPermission(perm), ResultInvalidNewMemoryPermission); |
diff --git a/src/core/hle/kernel/svc_generator.py b/src/core/hle/kernel/svc_generator.py index 34d2ac659..0cce69e85 100644 --- a/src/core/hle/kernel/svc_generator.py +++ b/src/core/hle/kernel/svc_generator.py | |||
| @@ -443,7 +443,7 @@ def emit_wrapper(wrapped_fn, suffix, register_info, arguments, byte_size): | |||
| 443 | lines.append("") | 443 | lines.append("") |
| 444 | 444 | ||
| 445 | for output_type, var_name, _, is_address in output_writes: | 445 | for output_type, var_name, _, is_address in output_writes: |
| 446 | output_type = "uintptr_t" if is_address else output_type | 446 | output_type = "uint64_t" if is_address else output_type |
| 447 | lines.append(f"{output_type} {var_name}{{}};") | 447 | lines.append(f"{output_type} {var_name}{{}};") |
| 448 | for input_type, var_name, _ in input_reads: | 448 | for input_type, var_name, _ in input_reads: |
| 449 | lines.append(f"{input_type} {var_name}{{}};") | 449 | lines.append(f"{input_type} {var_name}{{}};") |
| @@ -630,7 +630,7 @@ def emit_call(bitness, names, suffix): | |||
| 630 | def build_fn_declaration(return_type, name, arguments): | 630 | def build_fn_declaration(return_type, name, arguments): |
| 631 | arg_list = ["Core::System& system"] | 631 | arg_list = ["Core::System& system"] |
| 632 | for arg in arguments: | 632 | for arg in arguments: |
| 633 | type_name = "uintptr_t" if arg.is_address else arg.type_name | 633 | type_name = "uint64_t" if arg.is_address else arg.type_name |
| 634 | pointer = "*" if arg.is_output and not arg.is_outptr else "" | 634 | pointer = "*" if arg.is_output and not arg.is_outptr else "" |
| 635 | arg_list.append(f"{type_name}{pointer} {arg.var_name}") | 635 | arg_list.append(f"{type_name}{pointer} {arg.var_name}") |
| 636 | 636 | ||
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 5eefa2e82..c3e5c4462 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp | |||
| @@ -77,6 +77,8 @@ public: | |||
| 77 | {141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+ | 77 | {141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+ |
| 78 | {142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+ | 78 | {142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+ |
| 79 | {150, nullptr, "CreateAuthorizationRequest"}, | 79 | {150, nullptr, "CreateAuthorizationRequest"}, |
| 80 | {160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"}, | ||
| 81 | {161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"}, | ||
| 80 | }; | 82 | }; |
| 81 | // clang-format on | 83 | // clang-format on |
| 82 | 84 | ||
| @@ -137,7 +139,10 @@ public: | |||
| 137 | {140, nullptr, "GetNetworkServiceLicenseCache"}, // 5.0.0+ | 139 | {140, nullptr, "GetNetworkServiceLicenseCache"}, // 5.0.0+ |
| 138 | {141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+ | 140 | {141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+ |
| 139 | {142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+ | 141 | {142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+ |
| 142 | {143, nullptr, "GetNetworkServiceLicenseCacheEx"}, | ||
| 140 | {150, nullptr, "CreateAuthorizationRequest"}, | 143 | {150, nullptr, "CreateAuthorizationRequest"}, |
| 144 | {160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"}, | ||
| 145 | {161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"}, | ||
| 141 | {200, nullptr, "IsRegistered"}, | 146 | {200, nullptr, "IsRegistered"}, |
| 142 | {201, nullptr, "RegisterAsync"}, | 147 | {201, nullptr, "RegisterAsync"}, |
| 143 | {202, nullptr, "UnregisterAsync"}, | 148 | {202, nullptr, "UnregisterAsync"}, |
| @@ -243,6 +248,7 @@ public: | |||
| 243 | {100, nullptr, "GetRequestWithTheme"}, | 248 | {100, nullptr, "GetRequestWithTheme"}, |
| 244 | {101, nullptr, "IsNetworkServiceAccountReplaced"}, | 249 | {101, nullptr, "IsNetworkServiceAccountReplaced"}, |
| 245 | {199, nullptr, "GetUrlForIntroductionOfExtraMembership"}, // 2.0.0 - 5.1.0 | 250 | {199, nullptr, "GetUrlForIntroductionOfExtraMembership"}, // 2.0.0 - 5.1.0 |
| 251 | {200, nullptr, "ApplyAsyncWithAuthorizedToken"}, | ||
| 246 | }; | 252 | }; |
| 247 | // clang-format on | 253 | // clang-format on |
| 248 | 254 | ||
| @@ -648,9 +654,11 @@ public: | |||
| 648 | {0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, | 654 | {0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, |
| 649 | {1, nullptr, "LoadAuthenticationTokenCache"}, | 655 | {1, nullptr, "LoadAuthenticationTokenCache"}, |
| 650 | {2, nullptr, "InvalidateAuthenticationTokenCache"}, | 656 | {2, nullptr, "InvalidateAuthenticationTokenCache"}, |
| 657 | {3, nullptr, "IsDeviceAuthenticationTokenCacheAvailable"}, | ||
| 651 | {10, nullptr, "EnsureEdgeTokenCacheAsync"}, | 658 | {10, nullptr, "EnsureEdgeTokenCacheAsync"}, |
| 652 | {11, nullptr, "LoadEdgeTokenCache"}, | 659 | {11, nullptr, "LoadEdgeTokenCache"}, |
| 653 | {12, nullptr, "InvalidateEdgeTokenCache"}, | 660 | {12, nullptr, "InvalidateEdgeTokenCache"}, |
| 661 | {13, nullptr, "IsEdgeTokenCacheAvailable"}, | ||
| 654 | {20, nullptr, "EnsureApplicationAuthenticationCacheAsync"}, | 662 | {20, nullptr, "EnsureApplicationAuthenticationCacheAsync"}, |
| 655 | {21, nullptr, "LoadApplicationAuthenticationTokenCache"}, | 663 | {21, nullptr, "LoadApplicationAuthenticationTokenCache"}, |
| 656 | {22, nullptr, "LoadApplicationNetworkServiceClientConfigCache"}, | 664 | {22, nullptr, "LoadApplicationNetworkServiceClientConfigCache"}, |
diff --git a/src/core/hle/service/acc/acc_su.cpp b/src/core/hle/service/acc/acc_su.cpp index b6bfd6155..d9882ecd3 100644 --- a/src/core/hle/service/acc/acc_su.cpp +++ b/src/core/hle/service/acc/acc_su.cpp | |||
| @@ -55,6 +55,10 @@ ACC_SU::ACC_SU(std::shared_ptr<Module> module_, std::shared_ptr<ProfileManager> | |||
| 55 | {290, nullptr, "ProxyProcedureForGuestLoginWithNintendoAccount"}, | 55 | {290, nullptr, "ProxyProcedureForGuestLoginWithNintendoAccount"}, |
| 56 | {291, nullptr, "ProxyProcedureForFloatingRegistrationWithNintendoAccount"}, | 56 | {291, nullptr, "ProxyProcedureForFloatingRegistrationWithNintendoAccount"}, |
| 57 | {299, nullptr, "SuspendBackgroundDaemon"}, | 57 | {299, nullptr, "SuspendBackgroundDaemon"}, |
| 58 | {900, nullptr, "SetUserUnqualifiedForDebug"}, | ||
| 59 | {901, nullptr, "UnsetUserUnqualifiedForDebug"}, | ||
| 60 | {902, nullptr, "ListUsersUnqualifiedForDebug"}, | ||
| 61 | {910, nullptr, "RefreshFirmwareSettingsForDebug"}, | ||
| 58 | {997, nullptr, "DebugInvalidateTokenCacheForUser"}, | 62 | {997, nullptr, "DebugInvalidateTokenCacheForUser"}, |
| 59 | {998, nullptr, "DebugSetUserStateClose"}, | 63 | {998, nullptr, "DebugSetUserStateClose"}, |
| 60 | {999, nullptr, "DebugSetUserStateOpen"}, | 64 | {999, nullptr, "DebugSetUserStateOpen"}, |
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 979881512..3cd772b83 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -227,6 +227,8 @@ IDebugFunctions::IDebugFunctions(Core::System& system_) | |||
| 227 | {30, nullptr, "RequestLaunchApplicationWithUserAndArgumentForDebug"}, | 227 | {30, nullptr, "RequestLaunchApplicationWithUserAndArgumentForDebug"}, |
| 228 | {31, nullptr, "RequestLaunchApplicationByApplicationLaunchInfoForDebug"}, | 228 | {31, nullptr, "RequestLaunchApplicationByApplicationLaunchInfoForDebug"}, |
| 229 | {40, nullptr, "GetAppletResourceUsageInfo"}, | 229 | {40, nullptr, "GetAppletResourceUsageInfo"}, |
| 230 | {50, nullptr, "AddSystemProgramIdAndAppletIdForDebug"}, | ||
| 231 | {51, nullptr, "AddOperationConfirmedLibraryAppletIdForDebug"}, | ||
| 230 | {100, nullptr, "SetCpuBoostModeForApplet"}, | 232 | {100, nullptr, "SetCpuBoostModeForApplet"}, |
| 231 | {101, nullptr, "CancelCpuBoostModeForApplet"}, | 233 | {101, nullptr, "CancelCpuBoostModeForApplet"}, |
| 232 | {110, nullptr, "PushToAppletBoundChannelForDebug"}, | 234 | {110, nullptr, "PushToAppletBoundChannelForDebug"}, |
| @@ -238,6 +240,8 @@ IDebugFunctions::IDebugFunctions(Core::System& system_) | |||
| 238 | {131, nullptr, "FriendInvitationClearApplicationParameter"}, | 240 | {131, nullptr, "FriendInvitationClearApplicationParameter"}, |
| 239 | {132, nullptr, "FriendInvitationPushApplicationParameter"}, | 241 | {132, nullptr, "FriendInvitationPushApplicationParameter"}, |
| 240 | {140, nullptr, "RestrictPowerOperationForSecureLaunchModeForDebug"}, | 242 | {140, nullptr, "RestrictPowerOperationForSecureLaunchModeForDebug"}, |
| 243 | {200, nullptr, "CreateFloatingLibraryAppletAccepterForDebug"}, | ||
| 244 | {300, nullptr, "TerminateAllRunningApplicationsForDebug"}, | ||
| 241 | {900, nullptr, "GetGrcProcessLaunchedSystemEvent"}, | 245 | {900, nullptr, "GetGrcProcessLaunchedSystemEvent"}, |
| 242 | }; | 246 | }; |
| 243 | // clang-format on | 247 | // clang-format on |
| @@ -1261,9 +1265,8 @@ void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContex | |||
| 1261 | return; | 1265 | return; |
| 1262 | } | 1266 | } |
| 1263 | 1267 | ||
| 1264 | const u8* const mem_begin = system.Memory().GetPointer(transfer_mem->GetSourceAddress()); | 1268 | std::vector<u8> memory(transfer_mem->GetSize()); |
| 1265 | const u8* const mem_end = mem_begin + transfer_mem->GetSize(); | 1269 | system.Memory().ReadBlock(transfer_mem->GetSourceAddress(), memory.data(), memory.size()); |
| 1266 | std::vector<u8> memory{mem_begin, mem_end}; | ||
| 1267 | 1270 | ||
| 1268 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 1271 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 1269 | rb.Push(ResultSuccess); | 1272 | rb.Push(ResultSuccess); |
| @@ -1295,9 +1298,8 @@ void ILibraryAppletCreator::CreateHandleStorage(Kernel::HLERequestContext& ctx) | |||
| 1295 | return; | 1298 | return; |
| 1296 | } | 1299 | } |
| 1297 | 1300 | ||
| 1298 | const u8* const mem_begin = system.Memory().GetPointer(transfer_mem->GetSourceAddress()); | 1301 | std::vector<u8> memory(transfer_mem->GetSize()); |
| 1299 | const u8* const mem_end = mem_begin + transfer_mem->GetSize(); | 1302 | system.Memory().ReadBlock(transfer_mem->GetSourceAddress(), memory.data(), memory.size()); |
| 1300 | std::vector<u8> memory{mem_begin, mem_end}; | ||
| 1301 | 1303 | ||
| 1302 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 1304 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 1303 | rb.Push(ResultSuccess); | 1305 | rb.Push(ResultSuccess); |
| @@ -1860,6 +1862,8 @@ IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_) | |||
| 1860 | {31, nullptr, "GetWriterLockAccessorEx"}, | 1862 | {31, nullptr, "GetWriterLockAccessorEx"}, |
| 1861 | {40, nullptr, "IsSleepEnabled"}, | 1863 | {40, nullptr, "IsSleepEnabled"}, |
| 1862 | {41, nullptr, "IsRebootEnabled"}, | 1864 | {41, nullptr, "IsRebootEnabled"}, |
| 1865 | {50, nullptr, "LaunchSystemApplet"}, | ||
| 1866 | {51, nullptr, "LaunchStarter"}, | ||
| 1863 | {100, nullptr, "PopRequestLaunchApplicationForDebug"}, | 1867 | {100, nullptr, "PopRequestLaunchApplicationForDebug"}, |
| 1864 | {110, nullptr, "IsForceTerminateApplicationDisabledForDebug"}, | 1868 | {110, nullptr, "IsForceTerminateApplicationDisabledForDebug"}, |
| 1865 | {200, nullptr, "LaunchDevMenu"}, | 1869 | {200, nullptr, "LaunchDevMenu"}, |
diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp index c4cd1d0d5..fed51cfd6 100644 --- a/src/core/hle/service/aoc/aoc_u.cpp +++ b/src/core/hle/service/aoc/aoc_u.cpp | |||
| @@ -130,6 +130,9 @@ AOC_U::AOC_U(Core::System& system_) | |||
| 130 | {101, &AOC_U::CreatePermanentEcPurchasedEventManager, "CreatePermanentEcPurchasedEventManager"}, | 130 | {101, &AOC_U::CreatePermanentEcPurchasedEventManager, "CreatePermanentEcPurchasedEventManager"}, |
| 131 | {110, nullptr, "CreateContentsServiceManager"}, | 131 | {110, nullptr, "CreateContentsServiceManager"}, |
| 132 | {200, nullptr, "SetRequiredAddOnContentsOnContentsAvailabilityTransition"}, | 132 | {200, nullptr, "SetRequiredAddOnContentsOnContentsAvailabilityTransition"}, |
| 133 | {300, nullptr, "SetupHostAddOnContent"}, | ||
| 134 | {301, nullptr, "GetRegisteredAddOnContentPath"}, | ||
| 135 | {302, nullptr, "UpdateCachedList"}, | ||
| 133 | }; | 136 | }; |
| 134 | // clang-format on | 137 | // clang-format on |
| 135 | 138 | ||
diff --git a/src/core/hle/service/audio/hwopus.cpp b/src/core/hle/service/audio/hwopus.cpp index e01f87356..3db3fe188 100644 --- a/src/core/hle/service/audio/hwopus.cpp +++ b/src/core/hle/service/audio/hwopus.cpp | |||
| @@ -362,6 +362,8 @@ HwOpus::HwOpus(Core::System& system_) : ServiceFramework{system_, "hwopus"} { | |||
| 362 | {5, &HwOpus::GetWorkBufferSizeEx, "GetWorkBufferSizeEx"}, | 362 | {5, &HwOpus::GetWorkBufferSizeEx, "GetWorkBufferSizeEx"}, |
| 363 | {6, nullptr, "OpenHardwareOpusDecoderForMultiStreamEx"}, | 363 | {6, nullptr, "OpenHardwareOpusDecoderForMultiStreamEx"}, |
| 364 | {7, &HwOpus::GetWorkBufferSizeForMultiStreamEx, "GetWorkBufferSizeForMultiStreamEx"}, | 364 | {7, &HwOpus::GetWorkBufferSizeForMultiStreamEx, "GetWorkBufferSizeForMultiStreamEx"}, |
| 365 | {8, nullptr, "GetWorkBufferSizeExEx"}, | ||
| 366 | {9, nullptr, "GetWorkBufferSizeForMultiStreamExEx"}, | ||
| 365 | }; | 367 | }; |
| 366 | RegisterHandlers(functions); | 368 | RegisterHandlers(functions); |
| 367 | } | 369 | } |
diff --git a/src/core/hle/service/btm/btm.cpp b/src/core/hle/service/btm/btm.cpp index e068ea87f..dbd9d6a88 100644 --- a/src/core/hle/service/btm/btm.cpp +++ b/src/core/hle/service/btm/btm.cpp | |||
| @@ -73,32 +73,36 @@ private: | |||
| 73 | void AcquireBleScanEvent(Kernel::HLERequestContext& ctx) { | 73 | void AcquireBleScanEvent(Kernel::HLERequestContext& ctx) { |
| 74 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | 74 | LOG_WARNING(Service_BTM, "(STUBBED) called"); |
| 75 | 75 | ||
| 76 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 76 | IPC::ResponseBuilder rb{ctx, 3, 1}; |
| 77 | rb.Push(ResultSuccess); | 77 | rb.Push(ResultSuccess); |
| 78 | rb.Push(true); | ||
| 78 | rb.PushCopyObjects(scan_event->GetReadableEvent()); | 79 | rb.PushCopyObjects(scan_event->GetReadableEvent()); |
| 79 | } | 80 | } |
| 80 | 81 | ||
| 81 | void AcquireBleConnectionEvent(Kernel::HLERequestContext& ctx) { | 82 | void AcquireBleConnectionEvent(Kernel::HLERequestContext& ctx) { |
| 82 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | 83 | LOG_WARNING(Service_BTM, "(STUBBED) called"); |
| 83 | 84 | ||
| 84 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 85 | IPC::ResponseBuilder rb{ctx, 3, 1}; |
| 85 | rb.Push(ResultSuccess); | 86 | rb.Push(ResultSuccess); |
| 87 | rb.Push(true); | ||
| 86 | rb.PushCopyObjects(connection_event->GetReadableEvent()); | 88 | rb.PushCopyObjects(connection_event->GetReadableEvent()); |
| 87 | } | 89 | } |
| 88 | 90 | ||
| 89 | void AcquireBleServiceDiscoveryEvent(Kernel::HLERequestContext& ctx) { | 91 | void AcquireBleServiceDiscoveryEvent(Kernel::HLERequestContext& ctx) { |
| 90 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | 92 | LOG_WARNING(Service_BTM, "(STUBBED) called"); |
| 91 | 93 | ||
| 92 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 94 | IPC::ResponseBuilder rb{ctx, 3, 1}; |
| 93 | rb.Push(ResultSuccess); | 95 | rb.Push(ResultSuccess); |
| 96 | rb.Push(true); | ||
| 94 | rb.PushCopyObjects(service_discovery_event->GetReadableEvent()); | 97 | rb.PushCopyObjects(service_discovery_event->GetReadableEvent()); |
| 95 | } | 98 | } |
| 96 | 99 | ||
| 97 | void AcquireBleMtuConfigEvent(Kernel::HLERequestContext& ctx) { | 100 | void AcquireBleMtuConfigEvent(Kernel::HLERequestContext& ctx) { |
| 98 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | 101 | LOG_WARNING(Service_BTM, "(STUBBED) called"); |
| 99 | 102 | ||
| 100 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 103 | IPC::ResponseBuilder rb{ctx, 3, 1}; |
| 101 | rb.Push(ResultSuccess); | 104 | rb.Push(ResultSuccess); |
| 105 | rb.Push(true); | ||
| 102 | rb.PushCopyObjects(config_event->GetReadableEvent()); | 106 | rb.PushCopyObjects(config_event->GetReadableEvent()); |
| 103 | } | 107 | } |
| 104 | 108 | ||
diff --git a/src/core/hle/service/hid/controllers/console_sixaxis.cpp b/src/core/hle/service/hid/controllers/console_sixaxis.cpp index bb3cba910..478d38590 100644 --- a/src/core/hle/service/hid/controllers/console_sixaxis.cpp +++ b/src/core/hle/service/hid/controllers/console_sixaxis.cpp | |||
| @@ -1,17 +1,18 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "core/core.h" | ||
| 4 | #include "core/core_timing.h" | 5 | #include "core/core_timing.h" |
| 5 | #include "core/hid/emulated_console.h" | 6 | #include "core/hid/emulated_console.h" |
| 6 | #include "core/hid/hid_core.h" | 7 | #include "core/hid/hid_core.h" |
| 7 | #include "core/hle/service/hid/controllers/console_sixaxis.h" | 8 | #include "core/hle/service/hid/controllers/console_sixaxis.h" |
| 9 | #include "core/memory.h" | ||
| 8 | 10 | ||
| 9 | namespace Service::HID { | 11 | namespace Service::HID { |
| 10 | constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3C200; | 12 | constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3C200; |
| 11 | 13 | ||
| 12 | Controller_ConsoleSixAxis::Controller_ConsoleSixAxis(Core::HID::HIDCore& hid_core_, | 14 | Controller_ConsoleSixAxis::Controller_ConsoleSixAxis(Core::System& system_, u8* raw_shared_memory_) |
| 13 | u8* raw_shared_memory_) | 15 | : ControllerBase{system_.HIDCore()}, system{system_} { |
| 14 | : ControllerBase{hid_core_} { | ||
| 15 | console = hid_core.GetEmulatedConsole(); | 16 | console = hid_core.GetEmulatedConsole(); |
| 16 | static_assert(SHARED_MEMORY_OFFSET + sizeof(ConsoleSharedMemory) < shared_memory_size, | 17 | static_assert(SHARED_MEMORY_OFFSET + sizeof(ConsoleSharedMemory) < shared_memory_size, |
| 17 | "ConsoleSharedMemory is bigger than the shared memory"); | 18 | "ConsoleSharedMemory is bigger than the shared memory"); |
| @@ -26,7 +27,7 @@ void Controller_ConsoleSixAxis::OnInit() {} | |||
| 26 | void Controller_ConsoleSixAxis::OnRelease() {} | 27 | void Controller_ConsoleSixAxis::OnRelease() {} |
| 27 | 28 | ||
| 28 | void Controller_ConsoleSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing) { | 29 | void Controller_ConsoleSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing) { |
| 29 | if (!IsControllerActivated() || !is_transfer_memory_set) { | 30 | if (!IsControllerActivated() || transfer_memory == 0) { |
| 30 | seven_sixaxis_lifo.buffer_count = 0; | 31 | seven_sixaxis_lifo.buffer_count = 0; |
| 31 | seven_sixaxis_lifo.buffer_tail = 0; | 32 | seven_sixaxis_lifo.buffer_tail = 0; |
| 32 | return; | 33 | return; |
| @@ -59,11 +60,10 @@ void Controller_ConsoleSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_ti | |||
| 59 | 60 | ||
| 60 | // Update seven six axis transfer memory | 61 | // Update seven six axis transfer memory |
| 61 | seven_sixaxis_lifo.WriteNextEntry(next_seven_sixaxis_state); | 62 | seven_sixaxis_lifo.WriteNextEntry(next_seven_sixaxis_state); |
| 62 | std::memcpy(transfer_memory, &seven_sixaxis_lifo, sizeof(seven_sixaxis_lifo)); | 63 | system.Memory().WriteBlock(transfer_memory, &seven_sixaxis_lifo, sizeof(seven_sixaxis_lifo)); |
| 63 | } | 64 | } |
| 64 | 65 | ||
| 65 | void Controller_ConsoleSixAxis::SetTransferMemoryPointer(u8* t_mem) { | 66 | void Controller_ConsoleSixAxis::SetTransferMemoryAddress(VAddr t_mem) { |
| 66 | is_transfer_memory_set = true; | ||
| 67 | transfer_memory = t_mem; | 67 | transfer_memory = t_mem; |
| 68 | } | 68 | } |
| 69 | 69 | ||
diff --git a/src/core/hle/service/hid/controllers/console_sixaxis.h b/src/core/hle/service/hid/controllers/console_sixaxis.h index 2fd11538f..8d3e4081b 100644 --- a/src/core/hle/service/hid/controllers/console_sixaxis.h +++ b/src/core/hle/service/hid/controllers/console_sixaxis.h | |||
| @@ -10,6 +10,10 @@ | |||
| 10 | #include "core/hle/service/hid/controllers/controller_base.h" | 10 | #include "core/hle/service/hid/controllers/controller_base.h" |
| 11 | #include "core/hle/service/hid/ring_lifo.h" | 11 | #include "core/hle/service/hid/ring_lifo.h" |
| 12 | 12 | ||
| 13 | namespace Core { | ||
| 14 | class System; | ||
| 15 | } // namespace Core | ||
| 16 | |||
| 13 | namespace Core::HID { | 17 | namespace Core::HID { |
| 14 | class EmulatedConsole; | 18 | class EmulatedConsole; |
| 15 | } // namespace Core::HID | 19 | } // namespace Core::HID |
| @@ -17,7 +21,7 @@ class EmulatedConsole; | |||
| 17 | namespace Service::HID { | 21 | namespace Service::HID { |
| 18 | class Controller_ConsoleSixAxis final : public ControllerBase { | 22 | class Controller_ConsoleSixAxis final : public ControllerBase { |
| 19 | public: | 23 | public: |
| 20 | explicit Controller_ConsoleSixAxis(Core::HID::HIDCore& hid_core_, u8* raw_shared_memory_); | 24 | explicit Controller_ConsoleSixAxis(Core::System& system_, u8* raw_shared_memory_); |
| 21 | ~Controller_ConsoleSixAxis() override; | 25 | ~Controller_ConsoleSixAxis() override; |
| 22 | 26 | ||
| 23 | // Called when the controller is initialized | 27 | // Called when the controller is initialized |
| @@ -30,7 +34,7 @@ public: | |||
| 30 | void OnUpdate(const Core::Timing::CoreTiming& core_timing) override; | 34 | void OnUpdate(const Core::Timing::CoreTiming& core_timing) override; |
| 31 | 35 | ||
| 32 | // Called on InitializeSevenSixAxisSensor | 36 | // Called on InitializeSevenSixAxisSensor |
| 33 | void SetTransferMemoryPointer(u8* t_mem); | 37 | void SetTransferMemoryAddress(VAddr t_mem); |
| 34 | 38 | ||
| 35 | // Called on ResetSevenSixAxisSensorTimestamp | 39 | // Called on ResetSevenSixAxisSensorTimestamp |
| 36 | void ResetTimestamp(); | 40 | void ResetTimestamp(); |
| @@ -62,12 +66,13 @@ private: | |||
| 62 | static_assert(sizeof(seven_sixaxis_lifo) == 0xA70, "SevenSixAxisState is an invalid size"); | 66 | static_assert(sizeof(seven_sixaxis_lifo) == 0xA70, "SevenSixAxisState is an invalid size"); |
| 63 | 67 | ||
| 64 | SevenSixAxisState next_seven_sixaxis_state{}; | 68 | SevenSixAxisState next_seven_sixaxis_state{}; |
| 65 | u8* transfer_memory = nullptr; | 69 | VAddr transfer_memory{}; |
| 66 | ConsoleSharedMemory* shared_memory = nullptr; | 70 | ConsoleSharedMemory* shared_memory = nullptr; |
| 67 | Core::HID::EmulatedConsole* console = nullptr; | 71 | Core::HID::EmulatedConsole* console = nullptr; |
| 68 | 72 | ||
| 69 | bool is_transfer_memory_set = false; | ||
| 70 | u64 last_saved_timestamp{}; | 73 | u64 last_saved_timestamp{}; |
| 71 | u64 last_global_timestamp{}; | 74 | u64 last_global_timestamp{}; |
| 75 | |||
| 76 | Core::System& system; | ||
| 72 | }; | 77 | }; |
| 73 | } // namespace Service::HID | 78 | } // namespace Service::HID |
diff --git a/src/core/hle/service/hid/controllers/gesture.cpp b/src/core/hle/service/hid/controllers/gesture.cpp index 32e0708ba..de0090cc5 100644 --- a/src/core/hle/service/hid/controllers/gesture.cpp +++ b/src/core/hle/service/hid/controllers/gesture.cpp | |||
| @@ -65,6 +65,11 @@ void Controller_Gesture::OnUpdate(const Core::Timing::CoreTiming& core_timing) { | |||
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | void Controller_Gesture::ReadTouchInput() { | 67 | void Controller_Gesture::ReadTouchInput() { |
| 68 | if (!Settings::values.touchscreen.enabled) { | ||
| 69 | fingers = {}; | ||
| 70 | return; | ||
| 71 | } | ||
| 72 | |||
| 68 | const auto touch_status = console->GetTouch(); | 73 | const auto touch_status = console->GetTouch(); |
| 69 | for (std::size_t id = 0; id < fingers.size(); ++id) { | 74 | for (std::size_t id = 0; id < fingers.size(); ++id) { |
| 70 | fingers[id] = touch_status[id]; | 75 | fingers[id] = touch_status[id]; |
diff --git a/src/core/hle/service/hid/controllers/mouse.cpp b/src/core/hle/service/hid/controllers/mouse.cpp index b11cb438d..0afc66681 100644 --- a/src/core/hle/service/hid/controllers/mouse.cpp +++ b/src/core/hle/service/hid/controllers/mouse.cpp | |||
| @@ -33,10 +33,11 @@ void Controller_Mouse::OnUpdate(const Core::Timing::CoreTiming& core_timing) { | |||
| 33 | return; | 33 | return; |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | next_state = {}; | ||
| 37 | |||
| 36 | const auto& last_entry = shared_memory->mouse_lifo.ReadCurrentEntry().state; | 38 | const auto& last_entry = shared_memory->mouse_lifo.ReadCurrentEntry().state; |
| 37 | next_state.sampling_number = last_entry.sampling_number + 1; | 39 | next_state.sampling_number = last_entry.sampling_number + 1; |
| 38 | 40 | ||
| 39 | next_state.attribute.raw = 0; | ||
| 40 | if (Settings::values.mouse_enabled) { | 41 | if (Settings::values.mouse_enabled) { |
| 41 | const auto& mouse_button_state = emulated_devices->GetMouseButtons(); | 42 | const auto& mouse_button_state = emulated_devices->GetMouseButtons(); |
| 42 | const auto& mouse_position_state = emulated_devices->GetMousePosition(); | 43 | const auto& mouse_position_state = emulated_devices->GetMousePosition(); |
diff --git a/src/core/hle/service/hid/controllers/palma.cpp b/src/core/hle/service/hid/controllers/palma.cpp index 4564ea1e2..bce51285c 100644 --- a/src/core/hle/service/hid/controllers/palma.cpp +++ b/src/core/hle/service/hid/controllers/palma.cpp | |||
| @@ -152,7 +152,7 @@ Result Controller_Palma::WritePalmaRgbLedPatternEntry(const PalmaConnectionHandl | |||
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | Result Controller_Palma::WritePalmaWaveEntry(const PalmaConnectionHandle& handle, PalmaWaveSet wave, | 154 | Result Controller_Palma::WritePalmaWaveEntry(const PalmaConnectionHandle& handle, PalmaWaveSet wave, |
| 155 | u8* t_mem, u64 size) { | 155 | VAddr t_mem, u64 size) { |
| 156 | if (handle.npad_id != active_handle.npad_id) { | 156 | if (handle.npad_id != active_handle.npad_id) { |
| 157 | return InvalidPalmaHandle; | 157 | return InvalidPalmaHandle; |
| 158 | } | 158 | } |
diff --git a/src/core/hle/service/hid/controllers/palma.h b/src/core/hle/service/hid/controllers/palma.h index 1d7fc94e1..cf62f0dbc 100644 --- a/src/core/hle/service/hid/controllers/palma.h +++ b/src/core/hle/service/hid/controllers/palma.h | |||
| @@ -125,7 +125,7 @@ public: | |||
| 125 | Result ReadPalmaUniqueCode(const PalmaConnectionHandle& handle); | 125 | Result ReadPalmaUniqueCode(const PalmaConnectionHandle& handle); |
| 126 | Result SetPalmaUniqueCodeInvalid(const PalmaConnectionHandle& handle); | 126 | Result SetPalmaUniqueCodeInvalid(const PalmaConnectionHandle& handle); |
| 127 | Result WritePalmaRgbLedPatternEntry(const PalmaConnectionHandle& handle, u64 unknown); | 127 | Result WritePalmaRgbLedPatternEntry(const PalmaConnectionHandle& handle, u64 unknown); |
| 128 | Result WritePalmaWaveEntry(const PalmaConnectionHandle& handle, PalmaWaveSet wave, u8* t_mem, | 128 | Result WritePalmaWaveEntry(const PalmaConnectionHandle& handle, PalmaWaveSet wave, VAddr t_mem, |
| 129 | u64 size); | 129 | u64 size); |
| 130 | Result SetPalmaDataBaseIdentificationVersion(const PalmaConnectionHandle& handle, | 130 | Result SetPalmaDataBaseIdentificationVersion(const PalmaConnectionHandle& handle, |
| 131 | s32 database_id_version_); | 131 | s32 database_id_version_); |
diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp index 1da8d3eb0..d90a4e732 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.cpp +++ b/src/core/hle/service/hid/controllers/touchscreen.cpp | |||
| @@ -58,6 +58,11 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin | |||
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | if (!finger.pressed && current_touch.pressed) { | 60 | if (!finger.pressed && current_touch.pressed) { |
| 61 | // Ignore all touch fingers if disabled | ||
| 62 | if (!Settings::values.touchscreen.enabled) { | ||
| 63 | continue; | ||
| 64 | } | ||
| 65 | |||
| 61 | finger.attribute.start_touch.Assign(1); | 66 | finger.attribute.start_touch.Assign(1); |
| 62 | finger.pressed = true; | 67 | finger.pressed = true; |
| 63 | finger.position = current_touch.position; | 68 | finger.position = current_touch.position; |
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 5ec31950a..4b5130469 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -64,6 +64,7 @@ IAppletResource::IAppletResource(Core::System& system_, | |||
| 64 | MakeControllerWithServiceContext<Controller_NPad>(HidController::NPad, shared_memory); | 64 | MakeControllerWithServiceContext<Controller_NPad>(HidController::NPad, shared_memory); |
| 65 | MakeController<Controller_Gesture>(HidController::Gesture, shared_memory); | 65 | MakeController<Controller_Gesture>(HidController::Gesture, shared_memory); |
| 66 | MakeController<Controller_ConsoleSixAxis>(HidController::ConsoleSixAxisSensor, shared_memory); | 66 | MakeController<Controller_ConsoleSixAxis>(HidController::ConsoleSixAxisSensor, shared_memory); |
| 67 | MakeController<Controller_Stubbed>(HidController::DebugMouse, shared_memory); | ||
| 67 | MakeControllerWithServiceContext<Controller_Palma>(HidController::Palma, shared_memory); | 68 | MakeControllerWithServiceContext<Controller_Palma>(HidController::Palma, shared_memory); |
| 68 | 69 | ||
| 69 | // Homebrew doesn't try to activate some controllers, so we activate them by default | 70 | // Homebrew doesn't try to activate some controllers, so we activate them by default |
| @@ -75,6 +76,7 @@ IAppletResource::IAppletResource(Core::System& system_, | |||
| 75 | GetController<Controller_Stubbed>(HidController::CaptureButton).SetCommonHeaderOffset(0x5000); | 76 | GetController<Controller_Stubbed>(HidController::CaptureButton).SetCommonHeaderOffset(0x5000); |
| 76 | GetController<Controller_Stubbed>(HidController::InputDetector).SetCommonHeaderOffset(0x5200); | 77 | GetController<Controller_Stubbed>(HidController::InputDetector).SetCommonHeaderOffset(0x5200); |
| 77 | GetController<Controller_Stubbed>(HidController::UniquePad).SetCommonHeaderOffset(0x5A00); | 78 | GetController<Controller_Stubbed>(HidController::UniquePad).SetCommonHeaderOffset(0x5A00); |
| 79 | GetController<Controller_Stubbed>(HidController::DebugMouse).SetCommonHeaderOffset(0x3DC00); | ||
| 78 | 80 | ||
| 79 | // Register update callbacks | 81 | // Register update callbacks |
| 80 | npad_update_event = Core::Timing::CreateEvent( | 82 | npad_update_event = Core::Timing::CreateEvent( |
| @@ -237,6 +239,7 @@ Hid::Hid(Core::System& system_) | |||
| 237 | {1, &Hid::ActivateDebugPad, "ActivateDebugPad"}, | 239 | {1, &Hid::ActivateDebugPad, "ActivateDebugPad"}, |
| 238 | {11, &Hid::ActivateTouchScreen, "ActivateTouchScreen"}, | 240 | {11, &Hid::ActivateTouchScreen, "ActivateTouchScreen"}, |
| 239 | {21, &Hid::ActivateMouse, "ActivateMouse"}, | 241 | {21, &Hid::ActivateMouse, "ActivateMouse"}, |
| 242 | {26, nullptr, "ActivateDebugMouse"}, | ||
| 240 | {31, &Hid::ActivateKeyboard, "ActivateKeyboard"}, | 243 | {31, &Hid::ActivateKeyboard, "ActivateKeyboard"}, |
| 241 | {32, &Hid::SendKeyboardLockKeyEvent, "SendKeyboardLockKeyEvent"}, | 244 | {32, &Hid::SendKeyboardLockKeyEvent, "SendKeyboardLockKeyEvent"}, |
| 242 | {40, nullptr, "AcquireXpadIdEventHandle"}, | 245 | {40, nullptr, "AcquireXpadIdEventHandle"}, |
| @@ -1859,7 +1862,7 @@ void Hid::InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { | |||
| 1859 | .ActivateController(); | 1862 | .ActivateController(); |
| 1860 | 1863 | ||
| 1861 | applet_resource->GetController<Controller_ConsoleSixAxis>(HidController::ConsoleSixAxisSensor) | 1864 | applet_resource->GetController<Controller_ConsoleSixAxis>(HidController::ConsoleSixAxisSensor) |
| 1862 | .SetTransferMemoryPointer(system.Memory().GetPointer(t_mem_1->GetSourceAddress())); | 1865 | .SetTransferMemoryAddress(t_mem_1->GetSourceAddress()); |
| 1863 | 1866 | ||
| 1864 | LOG_WARNING(Service_HID, | 1867 | LOG_WARNING(Service_HID, |
| 1865 | "called, t_mem_1_handle=0x{:08X}, t_mem_2_handle=0x{:08X}, " | 1868 | "called, t_mem_1_handle=0x{:08X}, t_mem_2_handle=0x{:08X}, " |
| @@ -2146,8 +2149,7 @@ void Hid::WritePalmaWaveEntry(Kernel::HLERequestContext& ctx) { | |||
| 2146 | connection_handle.npad_id, wave_set, unknown, t_mem_handle, t_mem_size, size); | 2149 | connection_handle.npad_id, wave_set, unknown, t_mem_handle, t_mem_size, size); |
| 2147 | 2150 | ||
| 2148 | applet_resource->GetController<Controller_Palma>(HidController::Palma) | 2151 | applet_resource->GetController<Controller_Palma>(HidController::Palma) |
| 2149 | .WritePalmaWaveEntry(connection_handle, wave_set, | 2152 | .WritePalmaWaveEntry(connection_handle, wave_set, t_mem->GetSourceAddress(), t_mem_size); |
| 2150 | system.Memory().GetPointer(t_mem->GetSourceAddress()), t_mem_size); | ||
| 2151 | 2153 | ||
| 2152 | IPC::ResponseBuilder rb{ctx, 2}; | 2154 | IPC::ResponseBuilder rb{ctx, 2}; |
| 2153 | rb.Push(ResultSuccess); | 2155 | rb.Push(ResultSuccess); |
| @@ -2381,6 +2383,8 @@ public: | |||
| 2381 | {20, nullptr, "DeactivateMouse"}, | 2383 | {20, nullptr, "DeactivateMouse"}, |
| 2382 | {21, nullptr, "SetMouseAutoPilotState"}, | 2384 | {21, nullptr, "SetMouseAutoPilotState"}, |
| 2383 | {22, nullptr, "UnsetMouseAutoPilotState"}, | 2385 | {22, nullptr, "UnsetMouseAutoPilotState"}, |
| 2386 | {25, nullptr, "SetDebugMouseAutoPilotState"}, | ||
| 2387 | {26, nullptr, "UnsetDebugMouseAutoPilotState"}, | ||
| 2384 | {30, nullptr, "DeactivateKeyboard"}, | 2388 | {30, nullptr, "DeactivateKeyboard"}, |
| 2385 | {31, nullptr, "SetKeyboardAutoPilotState"}, | 2389 | {31, nullptr, "SetKeyboardAutoPilotState"}, |
| 2386 | {32, nullptr, "UnsetKeyboardAutoPilotState"}, | 2390 | {32, nullptr, "UnsetKeyboardAutoPilotState"}, |
| @@ -2496,6 +2500,7 @@ public: | |||
| 2496 | {2000, nullptr, "DeactivateDigitizer"}, | 2500 | {2000, nullptr, "DeactivateDigitizer"}, |
| 2497 | {2001, nullptr, "SetDigitizerAutoPilotState"}, | 2501 | {2001, nullptr, "SetDigitizerAutoPilotState"}, |
| 2498 | {2002, nullptr, "UnsetDigitizerAutoPilotState"}, | 2502 | {2002, nullptr, "UnsetDigitizerAutoPilotState"}, |
| 2503 | {2002, nullptr, "ReloadFirmwareDebugSettings"}, | ||
| 2499 | }; | 2504 | }; |
| 2500 | // clang-format on | 2505 | // clang-format on |
| 2501 | 2506 | ||
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index dc3c45aba..9563654b6 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h | |||
| @@ -33,6 +33,7 @@ enum class HidController : std::size_t { | |||
| 33 | NPad, | 33 | NPad, |
| 34 | Gesture, | 34 | Gesture, |
| 35 | ConsoleSixAxisSensor, | 35 | ConsoleSixAxisSensor, |
| 36 | DebugMouse, | ||
| 36 | Palma, | 37 | Palma, |
| 37 | 38 | ||
| 38 | MaxControllers, | 39 | MaxControllers, |
| @@ -60,9 +61,15 @@ public: | |||
| 60 | private: | 61 | private: |
| 61 | template <typename T> | 62 | template <typename T> |
| 62 | void MakeController(HidController controller, u8* shared_memory) { | 63 | void MakeController(HidController controller, u8* shared_memory) { |
| 63 | controllers[static_cast<std::size_t>(controller)] = | 64 | if constexpr (std::is_constructible_v<T, Core::System&, u8*>) { |
| 64 | std::make_unique<T>(system.HIDCore(), shared_memory); | 65 | controllers[static_cast<std::size_t>(controller)] = |
| 66 | std::make_unique<T>(system, shared_memory); | ||
| 67 | } else { | ||
| 68 | controllers[static_cast<std::size_t>(controller)] = | ||
| 69 | std::make_unique<T>(system.HIDCore(), shared_memory); | ||
| 70 | } | ||
| 65 | } | 71 | } |
| 72 | |||
| 66 | template <typename T> | 73 | template <typename T> |
| 67 | void MakeControllerWithServiceContext(HidController controller, u8* shared_memory) { | 74 | void MakeControllerWithServiceContext(HidController controller, u8* shared_memory) { |
| 68 | controllers[static_cast<std::size_t>(controller)] = | 75 | controllers[static_cast<std::size_t>(controller)] = |
diff --git a/src/core/hle/service/hid/hidbus.cpp b/src/core/hle/service/hid/hidbus.cpp index bd94e8f3d..07199d5d5 100644 --- a/src/core/hle/service/hid/hidbus.cpp +++ b/src/core/hle/service/hid/hidbus.cpp | |||
| @@ -91,7 +91,7 @@ std::optional<std::size_t> HidBus::GetDeviceIndexFromHandle(BusHandle handle) co | |||
| 91 | if (handle.abstracted_pad_id == device_handle.abstracted_pad_id && | 91 | if (handle.abstracted_pad_id == device_handle.abstracted_pad_id && |
| 92 | handle.internal_index == device_handle.internal_index && | 92 | handle.internal_index == device_handle.internal_index && |
| 93 | handle.player_number == device_handle.player_number && | 93 | handle.player_number == device_handle.player_number && |
| 94 | handle.bus_type == device_handle.bus_type && | 94 | handle.bus_type_id == device_handle.bus_type_id && |
| 95 | handle.is_valid == device_handle.is_valid) { | 95 | handle.is_valid == device_handle.is_valid) { |
| 96 | return i; | 96 | return i; |
| 97 | } | 97 | } |
| @@ -123,7 +123,7 @@ void HidBus::GetBusHandle(Kernel::HLERequestContext& ctx) { | |||
| 123 | continue; | 123 | continue; |
| 124 | } | 124 | } |
| 125 | if (static_cast<Core::HID::NpadIdType>(handle.player_number) == parameters.npad_id && | 125 | if (static_cast<Core::HID::NpadIdType>(handle.player_number) == parameters.npad_id && |
| 126 | handle.bus_type == parameters.bus_type) { | 126 | handle.bus_type_id == static_cast<u8>(parameters.bus_type)) { |
| 127 | is_handle_found = true; | 127 | is_handle_found = true; |
| 128 | handle_index = i; | 128 | handle_index = i; |
| 129 | break; | 129 | break; |
| @@ -140,7 +140,7 @@ void HidBus::GetBusHandle(Kernel::HLERequestContext& ctx) { | |||
| 140 | .abstracted_pad_id = static_cast<u8>(i), | 140 | .abstracted_pad_id = static_cast<u8>(i), |
| 141 | .internal_index = static_cast<u8>(i), | 141 | .internal_index = static_cast<u8>(i), |
| 142 | .player_number = static_cast<u8>(parameters.npad_id), | 142 | .player_number = static_cast<u8>(parameters.npad_id), |
| 143 | .bus_type = parameters.bus_type, | 143 | .bus_type_id = static_cast<u8>(parameters.bus_type), |
| 144 | .is_valid = true, | 144 | .is_valid = true, |
| 145 | }; | 145 | }; |
| 146 | handle_index = i; | 146 | handle_index = i; |
| @@ -172,7 +172,7 @@ void HidBus::IsExternalDeviceConnected(Kernel::HLERequestContext& ctx) { | |||
| 172 | LOG_INFO(Service_HID, | 172 | LOG_INFO(Service_HID, |
| 173 | "Called, abstracted_pad_id={}, bus_type={}, internal_index={}, " | 173 | "Called, abstracted_pad_id={}, bus_type={}, internal_index={}, " |
| 174 | "player_number={}, is_valid={}", | 174 | "player_number={}, is_valid={}", |
| 175 | bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, | 175 | bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, |
| 176 | bus_handle_.player_number, bus_handle_.is_valid); | 176 | bus_handle_.player_number, bus_handle_.is_valid); |
| 177 | 177 | ||
| 178 | const auto device_index = GetDeviceIndexFromHandle(bus_handle_); | 178 | const auto device_index = GetDeviceIndexFromHandle(bus_handle_); |
| @@ -201,7 +201,7 @@ void HidBus::Initialize(Kernel::HLERequestContext& ctx) { | |||
| 201 | LOG_INFO(Service_HID, | 201 | LOG_INFO(Service_HID, |
| 202 | "called, abstracted_pad_id={} bus_type={} internal_index={} " | 202 | "called, abstracted_pad_id={} bus_type={} internal_index={} " |
| 203 | "player_number={} is_valid={}, applet_resource_user_id={}", | 203 | "player_number={} is_valid={}, applet_resource_user_id={}", |
| 204 | bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, | 204 | bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, |
| 205 | bus_handle_.player_number, bus_handle_.is_valid, applet_resource_user_id); | 205 | bus_handle_.player_number, bus_handle_.is_valid, applet_resource_user_id); |
| 206 | 206 | ||
| 207 | is_hidbus_enabled = true; | 207 | is_hidbus_enabled = true; |
| @@ -253,7 +253,7 @@ void HidBus::Finalize(Kernel::HLERequestContext& ctx) { | |||
| 253 | LOG_INFO(Service_HID, | 253 | LOG_INFO(Service_HID, |
| 254 | "called, abstracted_pad_id={}, bus_type={}, internal_index={}, " | 254 | "called, abstracted_pad_id={}, bus_type={}, internal_index={}, " |
| 255 | "player_number={}, is_valid={}, applet_resource_user_id={}", | 255 | "player_number={}, is_valid={}, applet_resource_user_id={}", |
| 256 | bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, | 256 | bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, |
| 257 | bus_handle_.player_number, bus_handle_.is_valid, applet_resource_user_id); | 257 | bus_handle_.player_number, bus_handle_.is_valid, applet_resource_user_id); |
| 258 | 258 | ||
| 259 | const auto device_index = GetDeviceIndexFromHandle(bus_handle_); | 259 | const auto device_index = GetDeviceIndexFromHandle(bus_handle_); |
| @@ -301,7 +301,7 @@ void HidBus::EnableExternalDevice(Kernel::HLERequestContext& ctx) { | |||
| 301 | "called, enable={}, abstracted_pad_id={}, bus_type={}, internal_index={}, " | 301 | "called, enable={}, abstracted_pad_id={}, bus_type={}, internal_index={}, " |
| 302 | "player_number={}, is_valid={}, inval={}, applet_resource_user_id{}", | 302 | "player_number={}, is_valid={}, inval={}, applet_resource_user_id{}", |
| 303 | parameters.enable, parameters.bus_handle.abstracted_pad_id, | 303 | parameters.enable, parameters.bus_handle.abstracted_pad_id, |
| 304 | parameters.bus_handle.bus_type, parameters.bus_handle.internal_index, | 304 | parameters.bus_handle.bus_type_id, parameters.bus_handle.internal_index, |
| 305 | parameters.bus_handle.player_number, parameters.bus_handle.is_valid, parameters.inval, | 305 | parameters.bus_handle.player_number, parameters.bus_handle.is_valid, parameters.inval, |
| 306 | parameters.applet_resource_user_id); | 306 | parameters.applet_resource_user_id); |
| 307 | 307 | ||
| @@ -329,7 +329,7 @@ void HidBus::GetExternalDeviceId(Kernel::HLERequestContext& ctx) { | |||
| 329 | LOG_DEBUG(Service_HID, | 329 | LOG_DEBUG(Service_HID, |
| 330 | "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, " | 330 | "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, " |
| 331 | "is_valid={}", | 331 | "is_valid={}", |
| 332 | bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, | 332 | bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, |
| 333 | bus_handle_.player_number, bus_handle_.is_valid); | 333 | bus_handle_.player_number, bus_handle_.is_valid); |
| 334 | 334 | ||
| 335 | const auto device_index = GetDeviceIndexFromHandle(bus_handle_); | 335 | const auto device_index = GetDeviceIndexFromHandle(bus_handle_); |
| @@ -357,7 +357,7 @@ void HidBus::SendCommandAsync(Kernel::HLERequestContext& ctx) { | |||
| 357 | LOG_DEBUG(Service_HID, | 357 | LOG_DEBUG(Service_HID, |
| 358 | "called, data_size={}, abstracted_pad_id={}, bus_type={}, internal_index={}, " | 358 | "called, data_size={}, abstracted_pad_id={}, bus_type={}, internal_index={}, " |
| 359 | "player_number={}, is_valid={}", | 359 | "player_number={}, is_valid={}", |
| 360 | data.size(), bus_handle_.abstracted_pad_id, bus_handle_.bus_type, | 360 | data.size(), bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, |
| 361 | bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid); | 361 | bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid); |
| 362 | 362 | ||
| 363 | const auto device_index = GetDeviceIndexFromHandle(bus_handle_); | 363 | const auto device_index = GetDeviceIndexFromHandle(bus_handle_); |
| @@ -384,7 +384,7 @@ void HidBus::GetSendCommandAsynceResult(Kernel::HLERequestContext& ctx) { | |||
| 384 | LOG_DEBUG(Service_HID, | 384 | LOG_DEBUG(Service_HID, |
| 385 | "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, " | 385 | "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, " |
| 386 | "is_valid={}", | 386 | "is_valid={}", |
| 387 | bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, | 387 | bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, |
| 388 | bus_handle_.player_number, bus_handle_.is_valid); | 388 | bus_handle_.player_number, bus_handle_.is_valid); |
| 389 | 389 | ||
| 390 | const auto device_index = GetDeviceIndexFromHandle(bus_handle_); | 390 | const auto device_index = GetDeviceIndexFromHandle(bus_handle_); |
| @@ -413,7 +413,7 @@ void HidBus::SetEventForSendCommandAsycResult(Kernel::HLERequestContext& ctx) { | |||
| 413 | LOG_INFO(Service_HID, | 413 | LOG_INFO(Service_HID, |
| 414 | "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, " | 414 | "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, " |
| 415 | "is_valid={}", | 415 | "is_valid={}", |
| 416 | bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, | 416 | bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, |
| 417 | bus_handle_.player_number, bus_handle_.is_valid); | 417 | bus_handle_.player_number, bus_handle_.is_valid); |
| 418 | 418 | ||
| 419 | const auto device_index = GetDeviceIndexFromHandle(bus_handle_); | 419 | const auto device_index = GetDeviceIndexFromHandle(bus_handle_); |
| @@ -464,7 +464,7 @@ void HidBus::EnableJoyPollingReceiveMode(Kernel::HLERequestContext& ctx) { | |||
| 464 | LOG_INFO(Service_HID, | 464 | LOG_INFO(Service_HID, |
| 465 | "called, t_mem_handle=0x{:08X}, polling_mode={}, abstracted_pad_id={}, bus_type={}, " | 465 | "called, t_mem_handle=0x{:08X}, polling_mode={}, abstracted_pad_id={}, bus_type={}, " |
| 466 | "internal_index={}, player_number={}, is_valid={}", | 466 | "internal_index={}, player_number={}, is_valid={}", |
| 467 | t_mem_handle, polling_mode_, bus_handle_.abstracted_pad_id, bus_handle_.bus_type, | 467 | t_mem_handle, polling_mode_, bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, |
| 468 | bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid); | 468 | bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid); |
| 469 | 469 | ||
| 470 | const auto device_index = GetDeviceIndexFromHandle(bus_handle_); | 470 | const auto device_index = GetDeviceIndexFromHandle(bus_handle_); |
| @@ -472,7 +472,7 @@ void HidBus::EnableJoyPollingReceiveMode(Kernel::HLERequestContext& ctx) { | |||
| 472 | if (device_index) { | 472 | if (device_index) { |
| 473 | auto& device = devices[device_index.value()].device; | 473 | auto& device = devices[device_index.value()].device; |
| 474 | device->SetPollingMode(polling_mode_); | 474 | device->SetPollingMode(polling_mode_); |
| 475 | device->SetTransferMemoryPointer(system.Memory().GetPointer(t_mem->GetSourceAddress())); | 475 | device->SetTransferMemoryAddress(t_mem->GetSourceAddress()); |
| 476 | 476 | ||
| 477 | IPC::ResponseBuilder rb{ctx, 2}; | 477 | IPC::ResponseBuilder rb{ctx, 2}; |
| 478 | rb.Push(ResultSuccess); | 478 | rb.Push(ResultSuccess); |
| @@ -492,7 +492,7 @@ void HidBus::DisableJoyPollingReceiveMode(Kernel::HLERequestContext& ctx) { | |||
| 492 | LOG_INFO(Service_HID, | 492 | LOG_INFO(Service_HID, |
| 493 | "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, " | 493 | "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, " |
| 494 | "is_valid={}", | 494 | "is_valid={}", |
| 495 | bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, | 495 | bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, |
| 496 | bus_handle_.player_number, bus_handle_.is_valid); | 496 | bus_handle_.player_number, bus_handle_.is_valid); |
| 497 | 497 | ||
| 498 | const auto device_index = GetDeviceIndexFromHandle(bus_handle_); | 498 | const auto device_index = GetDeviceIndexFromHandle(bus_handle_); |
diff --git a/src/core/hle/service/hid/hidbus.h b/src/core/hle/service/hid/hidbus.h index 8c687f678..85ed96e2e 100644 --- a/src/core/hle/service/hid/hidbus.h +++ b/src/core/hle/service/hid/hidbus.h | |||
| @@ -41,7 +41,7 @@ private: | |||
| 41 | }; | 41 | }; |
| 42 | 42 | ||
| 43 | // This is nn::hidbus::BusType | 43 | // This is nn::hidbus::BusType |
| 44 | enum class BusType : u8 { | 44 | enum class BusType : u32 { |
| 45 | LeftJoyRail, | 45 | LeftJoyRail, |
| 46 | RightJoyRail, | 46 | RightJoyRail, |
| 47 | InternalBus, // Lark microphone | 47 | InternalBus, // Lark microphone |
| @@ -54,7 +54,7 @@ private: | |||
| 54 | u32 abstracted_pad_id; | 54 | u32 abstracted_pad_id; |
| 55 | u8 internal_index; | 55 | u8 internal_index; |
| 56 | u8 player_number; | 56 | u8 player_number; |
| 57 | BusType bus_type; | 57 | u8 bus_type_id; |
| 58 | bool is_valid; | 58 | bool is_valid; |
| 59 | }; | 59 | }; |
| 60 | static_assert(sizeof(BusHandle) == 0x8, "BusHandle is an invalid size"); | 60 | static_assert(sizeof(BusHandle) == 0x8, "BusHandle is an invalid size"); |
| @@ -115,8 +115,7 @@ private: | |||
| 115 | void MakeDevice(BusHandle handle) { | 115 | void MakeDevice(BusHandle handle) { |
| 116 | const auto device_index = GetDeviceIndexFromHandle(handle); | 116 | const auto device_index = GetDeviceIndexFromHandle(handle); |
| 117 | if (device_index) { | 117 | if (device_index) { |
| 118 | devices[device_index.value()].device = | 118 | devices[device_index.value()].device = std::make_unique<T>(system, service_context); |
| 119 | std::make_unique<T>(system.HIDCore(), service_context); | ||
| 120 | } | 119 | } |
| 121 | } | 120 | } |
| 122 | 121 | ||
diff --git a/src/core/hle/service/hid/hidbus/hidbus_base.cpp b/src/core/hle/service/hid/hidbus/hidbus_base.cpp index b569b3c20..dfd23ec04 100644 --- a/src/core/hle/service/hid/hidbus/hidbus_base.cpp +++ b/src/core/hle/service/hid/hidbus/hidbus_base.cpp | |||
| @@ -9,8 +9,8 @@ | |||
| 9 | 9 | ||
| 10 | namespace Service::HID { | 10 | namespace Service::HID { |
| 11 | 11 | ||
| 12 | HidbusBase::HidbusBase(KernelHelpers::ServiceContext& service_context_) | 12 | HidbusBase::HidbusBase(Core::System& system_, KernelHelpers::ServiceContext& service_context_) |
| 13 | : service_context(service_context_) { | 13 | : system(system_), service_context(service_context_) { |
| 14 | send_command_async_event = service_context.CreateEvent("hidbus:SendCommandAsyncEvent"); | 14 | send_command_async_event = service_context.CreateEvent("hidbus:SendCommandAsyncEvent"); |
| 15 | } | 15 | } |
| 16 | HidbusBase::~HidbusBase() = default; | 16 | HidbusBase::~HidbusBase() = default; |
| @@ -59,8 +59,7 @@ void HidbusBase::DisablePollingMode() { | |||
| 59 | polling_mode_enabled = false; | 59 | polling_mode_enabled = false; |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | void HidbusBase::SetTransferMemoryPointer(u8* t_mem) { | 62 | void HidbusBase::SetTransferMemoryAddress(VAddr t_mem) { |
| 63 | is_transfer_memory_set = true; | ||
| 64 | transfer_memory = t_mem; | 63 | transfer_memory = t_mem; |
| 65 | } | 64 | } |
| 66 | 65 | ||
diff --git a/src/core/hle/service/hid/hidbus/hidbus_base.h b/src/core/hle/service/hid/hidbus/hidbus_base.h index 65e301137..26313264d 100644 --- a/src/core/hle/service/hid/hidbus/hidbus_base.h +++ b/src/core/hle/service/hid/hidbus/hidbus_base.h | |||
| @@ -8,6 +8,10 @@ | |||
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "core/hle/result.h" | 9 | #include "core/hle/result.h" |
| 10 | 10 | ||
| 11 | namespace Core { | ||
| 12 | class System; | ||
| 13 | } | ||
| 14 | |||
| 11 | namespace Kernel { | 15 | namespace Kernel { |
| 12 | class KEvent; | 16 | class KEvent; |
| 13 | class KReadableEvent; | 17 | class KReadableEvent; |
| @@ -106,7 +110,7 @@ static_assert(sizeof(ButtonOnlyPollingDataAccessor) == 0x2F0, | |||
| 106 | 110 | ||
| 107 | class HidbusBase { | 111 | class HidbusBase { |
| 108 | public: | 112 | public: |
| 109 | explicit HidbusBase(KernelHelpers::ServiceContext& service_context_); | 113 | explicit HidbusBase(Core::System& system_, KernelHelpers::ServiceContext& service_context_); |
| 110 | virtual ~HidbusBase(); | 114 | virtual ~HidbusBase(); |
| 111 | 115 | ||
| 112 | void ActivateDevice(); | 116 | void ActivateDevice(); |
| @@ -134,7 +138,7 @@ public: | |||
| 134 | void DisablePollingMode(); | 138 | void DisablePollingMode(); |
| 135 | 139 | ||
| 136 | // Called on EnableJoyPollingReceiveMode | 140 | // Called on EnableJoyPollingReceiveMode |
| 137 | void SetTransferMemoryPointer(u8* t_mem); | 141 | void SetTransferMemoryAddress(VAddr t_mem); |
| 138 | 142 | ||
| 139 | Kernel::KReadableEvent& GetSendCommandAsycEvent() const; | 143 | Kernel::KReadableEvent& GetSendCommandAsycEvent() const; |
| 140 | 144 | ||
| @@ -170,9 +174,9 @@ protected: | |||
| 170 | JoyEnableSixAxisDataAccessor enable_sixaxis_data{}; | 174 | JoyEnableSixAxisDataAccessor enable_sixaxis_data{}; |
| 171 | ButtonOnlyPollingDataAccessor button_only_data{}; | 175 | ButtonOnlyPollingDataAccessor button_only_data{}; |
| 172 | 176 | ||
| 173 | u8* transfer_memory{nullptr}; | 177 | VAddr transfer_memory{}; |
| 174 | bool is_transfer_memory_set{}; | ||
| 175 | 178 | ||
| 179 | Core::System& system; | ||
| 176 | Kernel::KEvent* send_command_async_event; | 180 | Kernel::KEvent* send_command_async_event; |
| 177 | KernelHelpers::ServiceContext& service_context; | 181 | KernelHelpers::ServiceContext& service_context; |
| 178 | }; | 182 | }; |
diff --git a/src/core/hle/service/hid/hidbus/ringcon.cpp b/src/core/hle/service/hid/hidbus/ringcon.cpp index 35847cbdd..65a2dd521 100644 --- a/src/core/hle/service/hid/hidbus/ringcon.cpp +++ b/src/core/hle/service/hid/hidbus/ringcon.cpp | |||
| @@ -1,18 +1,20 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "core/core.h" | ||
| 4 | #include "core/hid/emulated_controller.h" | 5 | #include "core/hid/emulated_controller.h" |
| 5 | #include "core/hid/hid_core.h" | 6 | #include "core/hid/hid_core.h" |
| 6 | #include "core/hle/kernel/k_event.h" | 7 | #include "core/hle/kernel/k_event.h" |
| 7 | #include "core/hle/kernel/k_readable_event.h" | 8 | #include "core/hle/kernel/k_readable_event.h" |
| 8 | #include "core/hle/service/hid/hidbus/ringcon.h" | 9 | #include "core/hle/service/hid/hidbus/ringcon.h" |
| 10 | #include "core/memory.h" | ||
| 9 | 11 | ||
| 10 | namespace Service::HID { | 12 | namespace Service::HID { |
| 11 | 13 | ||
| 12 | RingController::RingController(Core::HID::HIDCore& hid_core_, | 14 | RingController::RingController(Core::System& system_, |
| 13 | KernelHelpers::ServiceContext& service_context_) | 15 | KernelHelpers::ServiceContext& service_context_) |
| 14 | : HidbusBase(service_context_) { | 16 | : HidbusBase(system_, service_context_) { |
| 15 | input = hid_core_.GetEmulatedController(Core::HID::NpadIdType::Player1); | 17 | input = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1); |
| 16 | } | 18 | } |
| 17 | 19 | ||
| 18 | RingController::~RingController() = default; | 20 | RingController::~RingController() = default; |
| @@ -38,7 +40,7 @@ void RingController::OnUpdate() { | |||
| 38 | return; | 40 | return; |
| 39 | } | 41 | } |
| 40 | 42 | ||
| 41 | if (!polling_mode_enabled || !is_transfer_memory_set) { | 43 | if (!polling_mode_enabled || transfer_memory == 0) { |
| 42 | return; | 44 | return; |
| 43 | } | 45 | } |
| 44 | 46 | ||
| @@ -62,7 +64,8 @@ void RingController::OnUpdate() { | |||
| 62 | curr_entry.polling_data.out_size = sizeof(ringcon_value); | 64 | curr_entry.polling_data.out_size = sizeof(ringcon_value); |
| 63 | std::memcpy(curr_entry.polling_data.data.data(), &ringcon_value, sizeof(ringcon_value)); | 65 | std::memcpy(curr_entry.polling_data.data.data(), &ringcon_value, sizeof(ringcon_value)); |
| 64 | 66 | ||
| 65 | std::memcpy(transfer_memory, &enable_sixaxis_data, sizeof(enable_sixaxis_data)); | 67 | system.Memory().WriteBlock(transfer_memory, &enable_sixaxis_data, |
| 68 | sizeof(enable_sixaxis_data)); | ||
| 66 | break; | 69 | break; |
| 67 | } | 70 | } |
| 68 | default: | 71 | default: |
diff --git a/src/core/hle/service/hid/hidbus/ringcon.h b/src/core/hle/service/hid/hidbus/ringcon.h index c2fb386b1..f42f3ea41 100644 --- a/src/core/hle/service/hid/hidbus/ringcon.h +++ b/src/core/hle/service/hid/hidbus/ringcon.h | |||
| @@ -17,8 +17,7 @@ namespace Service::HID { | |||
| 17 | 17 | ||
| 18 | class RingController final : public HidbusBase { | 18 | class RingController final : public HidbusBase { |
| 19 | public: | 19 | public: |
| 20 | explicit RingController(Core::HID::HIDCore& hid_core_, | 20 | explicit RingController(Core::System& system_, KernelHelpers::ServiceContext& service_context_); |
| 21 | KernelHelpers::ServiceContext& service_context_); | ||
| 22 | ~RingController() override; | 21 | ~RingController() override; |
| 23 | 22 | ||
| 24 | void OnInit() override; | 23 | void OnInit() override; |
diff --git a/src/core/hle/service/hid/hidbus/starlink.cpp b/src/core/hle/service/hid/hidbus/starlink.cpp index d0e760314..36573274e 100644 --- a/src/core/hle/service/hid/hidbus/starlink.cpp +++ b/src/core/hle/service/hid/hidbus/starlink.cpp | |||
| @@ -8,8 +8,8 @@ | |||
| 8 | namespace Service::HID { | 8 | namespace Service::HID { |
| 9 | constexpr u8 DEVICE_ID = 0x28; | 9 | constexpr u8 DEVICE_ID = 0x28; |
| 10 | 10 | ||
| 11 | Starlink::Starlink(Core::HID::HIDCore& hid_core_, KernelHelpers::ServiceContext& service_context_) | 11 | Starlink::Starlink(Core::System& system_, KernelHelpers::ServiceContext& service_context_) |
| 12 | : HidbusBase(service_context_) {} | 12 | : HidbusBase(system_, service_context_) {} |
| 13 | Starlink::~Starlink() = default; | 13 | Starlink::~Starlink() = default; |
| 14 | 14 | ||
| 15 | void Starlink::OnInit() { | 15 | void Starlink::OnInit() { |
| @@ -27,7 +27,7 @@ void Starlink::OnUpdate() { | |||
| 27 | if (!device_enabled) { | 27 | if (!device_enabled) { |
| 28 | return; | 28 | return; |
| 29 | } | 29 | } |
| 30 | if (!polling_mode_enabled || !is_transfer_memory_set) { | 30 | if (!polling_mode_enabled || transfer_memory == 0) { |
| 31 | return; | 31 | return; |
| 32 | } | 32 | } |
| 33 | 33 | ||
diff --git a/src/core/hle/service/hid/hidbus/starlink.h b/src/core/hle/service/hid/hidbus/starlink.h index 07c800e6e..a276aa88f 100644 --- a/src/core/hle/service/hid/hidbus/starlink.h +++ b/src/core/hle/service/hid/hidbus/starlink.h | |||
| @@ -14,8 +14,7 @@ namespace Service::HID { | |||
| 14 | 14 | ||
| 15 | class Starlink final : public HidbusBase { | 15 | class Starlink final : public HidbusBase { |
| 16 | public: | 16 | public: |
| 17 | explicit Starlink(Core::HID::HIDCore& hid_core_, | 17 | explicit Starlink(Core::System& system_, KernelHelpers::ServiceContext& service_context_); |
| 18 | KernelHelpers::ServiceContext& service_context_); | ||
| 19 | ~Starlink() override; | 18 | ~Starlink() override; |
| 20 | 19 | ||
| 21 | void OnInit() override; | 20 | void OnInit() override; |
diff --git a/src/core/hle/service/hid/hidbus/stubbed.cpp b/src/core/hle/service/hid/hidbus/stubbed.cpp index 07632c872..8160b7218 100644 --- a/src/core/hle/service/hid/hidbus/stubbed.cpp +++ b/src/core/hle/service/hid/hidbus/stubbed.cpp | |||
| @@ -8,9 +8,8 @@ | |||
| 8 | namespace Service::HID { | 8 | namespace Service::HID { |
| 9 | constexpr u8 DEVICE_ID = 0xFF; | 9 | constexpr u8 DEVICE_ID = 0xFF; |
| 10 | 10 | ||
| 11 | HidbusStubbed::HidbusStubbed(Core::HID::HIDCore& hid_core_, | 11 | HidbusStubbed::HidbusStubbed(Core::System& system_, KernelHelpers::ServiceContext& service_context_) |
| 12 | KernelHelpers::ServiceContext& service_context_) | 12 | : HidbusBase(system_, service_context_) {} |
| 13 | : HidbusBase(service_context_) {} | ||
| 14 | HidbusStubbed::~HidbusStubbed() = default; | 13 | HidbusStubbed::~HidbusStubbed() = default; |
| 15 | 14 | ||
| 16 | void HidbusStubbed::OnInit() { | 15 | void HidbusStubbed::OnInit() { |
| @@ -28,7 +27,7 @@ void HidbusStubbed::OnUpdate() { | |||
| 28 | if (!device_enabled) { | 27 | if (!device_enabled) { |
| 29 | return; | 28 | return; |
| 30 | } | 29 | } |
| 31 | if (!polling_mode_enabled || !is_transfer_memory_set) { | 30 | if (!polling_mode_enabled || transfer_memory == 0) { |
| 32 | return; | 31 | return; |
| 33 | } | 32 | } |
| 34 | 33 | ||
diff --git a/src/core/hle/service/hid/hidbus/stubbed.h b/src/core/hle/service/hid/hidbus/stubbed.h index 38eaa0ecc..2e58d42fc 100644 --- a/src/core/hle/service/hid/hidbus/stubbed.h +++ b/src/core/hle/service/hid/hidbus/stubbed.h | |||
| @@ -14,8 +14,7 @@ namespace Service::HID { | |||
| 14 | 14 | ||
| 15 | class HidbusStubbed final : public HidbusBase { | 15 | class HidbusStubbed final : public HidbusBase { |
| 16 | public: | 16 | public: |
| 17 | explicit HidbusStubbed(Core::HID::HIDCore& hid_core_, | 17 | explicit HidbusStubbed(Core::System& system_, KernelHelpers::ServiceContext& service_context_); |
| 18 | KernelHelpers::ServiceContext& service_context_); | ||
| 19 | ~HidbusStubbed() override; | 18 | ~HidbusStubbed() override; |
| 20 | 19 | ||
| 21 | void OnInit() override; | 20 | void OnInit() override; |
diff --git a/src/core/hle/service/hid/irs.cpp b/src/core/hle/service/hid/irs.cpp index 3bd418e92..a40f61fde 100644 --- a/src/core/hle/service/hid/irs.cpp +++ b/src/core/hle/service/hid/irs.cpp | |||
| @@ -208,8 +208,6 @@ void IRS::RunImageTransferProcessor(Kernel::HLERequestContext& ctx) { | |||
| 208 | 208 | ||
| 209 | ASSERT_MSG(t_mem->GetSize() == parameters.transfer_memory_size, "t_mem has incorrect size"); | 209 | ASSERT_MSG(t_mem->GetSize() == parameters.transfer_memory_size, "t_mem has incorrect size"); |
| 210 | 210 | ||
| 211 | u8* transfer_memory = system.Memory().GetPointer(t_mem->GetSourceAddress()); | ||
| 212 | |||
| 213 | LOG_INFO(Service_IRS, | 211 | LOG_INFO(Service_IRS, |
| 214 | "called, npad_type={}, npad_id={}, transfer_memory_size={}, transfer_memory_size={}, " | 212 | "called, npad_type={}, npad_id={}, transfer_memory_size={}, transfer_memory_size={}, " |
| 215 | "applet_resource_user_id={}", | 213 | "applet_resource_user_id={}", |
| @@ -224,7 +222,7 @@ void IRS::RunImageTransferProcessor(Kernel::HLERequestContext& ctx) { | |||
| 224 | auto& image_transfer_processor = | 222 | auto& image_transfer_processor = |
| 225 | GetProcessor<ImageTransferProcessor>(parameters.camera_handle); | 223 | GetProcessor<ImageTransferProcessor>(parameters.camera_handle); |
| 226 | image_transfer_processor.SetConfig(parameters.processor_config); | 224 | image_transfer_processor.SetConfig(parameters.processor_config); |
| 227 | image_transfer_processor.SetTransferMemoryPointer(transfer_memory); | 225 | image_transfer_processor.SetTransferMemoryAddress(t_mem->GetSourceAddress()); |
| 228 | npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex, | 226 | npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex, |
| 229 | Common::Input::PollingMode::IR); | 227 | Common::Input::PollingMode::IR); |
| 230 | } | 228 | } |
| @@ -448,8 +446,6 @@ void IRS::RunImageTransferExProcessor(Kernel::HLERequestContext& ctx) { | |||
| 448 | auto t_mem = system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>( | 446 | auto t_mem = system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>( |
| 449 | t_mem_handle); | 447 | t_mem_handle); |
| 450 | 448 | ||
| 451 | u8* transfer_memory = system.Memory().GetPointer(t_mem->GetSourceAddress()); | ||
| 452 | |||
| 453 | LOG_INFO(Service_IRS, | 449 | LOG_INFO(Service_IRS, |
| 454 | "called, npad_type={}, npad_id={}, transfer_memory_size={}, " | 450 | "called, npad_type={}, npad_id={}, transfer_memory_size={}, " |
| 455 | "applet_resource_user_id={}", | 451 | "applet_resource_user_id={}", |
| @@ -464,7 +460,7 @@ void IRS::RunImageTransferExProcessor(Kernel::HLERequestContext& ctx) { | |||
| 464 | auto& image_transfer_processor = | 460 | auto& image_transfer_processor = |
| 465 | GetProcessor<ImageTransferProcessor>(parameters.camera_handle); | 461 | GetProcessor<ImageTransferProcessor>(parameters.camera_handle); |
| 466 | image_transfer_processor.SetConfig(parameters.processor_config); | 462 | image_transfer_processor.SetConfig(parameters.processor_config); |
| 467 | image_transfer_processor.SetTransferMemoryPointer(transfer_memory); | 463 | image_transfer_processor.SetTransferMemoryAddress(t_mem->GetSourceAddress()); |
| 468 | npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex, | 464 | npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex, |
| 469 | Common::Input::PollingMode::IR); | 465 | Common::Input::PollingMode::IR); |
| 470 | } | 466 | } |
diff --git a/src/core/hle/service/hid/irs.h b/src/core/hle/service/hid/irs.h index 2e6115c73..b76ad7854 100644 --- a/src/core/hle/service/hid/irs.h +++ b/src/core/hle/service/hid/irs.h | |||
| @@ -80,7 +80,13 @@ private: | |||
| 80 | LOG_CRITICAL(Service_IRS, "Invalid index {}", index); | 80 | LOG_CRITICAL(Service_IRS, "Invalid index {}", index); |
| 81 | return; | 81 | return; |
| 82 | } | 82 | } |
| 83 | processors[index] = std::make_unique<T>(system.HIDCore(), device_state, index); | 83 | |
| 84 | if constexpr (std::is_constructible_v<T, Core::System&, Core::IrSensor::DeviceFormat&, | ||
| 85 | std::size_t>) { | ||
| 86 | processors[index] = std::make_unique<T>(system, device_state, index); | ||
| 87 | } else { | ||
| 88 | processors[index] = std::make_unique<T>(system.HIDCore(), device_state, index); | ||
| 89 | } | ||
| 84 | } | 90 | } |
| 85 | 91 | ||
| 86 | template <typename T> | 92 | template <typename T> |
diff --git a/src/core/hle/service/hid/irsensor/image_transfer_processor.cpp b/src/core/hle/service/hid/irsensor/image_transfer_processor.cpp index 98f0c579d..bc896a1e3 100644 --- a/src/core/hle/service/hid/irsensor/image_transfer_processor.cpp +++ b/src/core/hle/service/hid/irsensor/image_transfer_processor.cpp | |||
| @@ -1,16 +1,18 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later | 2 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 3 | 3 | ||
| 4 | #include "core/core.h" | ||
| 4 | #include "core/hid/emulated_controller.h" | 5 | #include "core/hid/emulated_controller.h" |
| 5 | #include "core/hid/hid_core.h" | 6 | #include "core/hid/hid_core.h" |
| 6 | #include "core/hle/service/hid/irsensor/image_transfer_processor.h" | 7 | #include "core/hle/service/hid/irsensor/image_transfer_processor.h" |
| 8 | #include "core/memory.h" | ||
| 7 | 9 | ||
| 8 | namespace Service::IRS { | 10 | namespace Service::IRS { |
| 9 | ImageTransferProcessor::ImageTransferProcessor(Core::HID::HIDCore& hid_core_, | 11 | ImageTransferProcessor::ImageTransferProcessor(Core::System& system_, |
| 10 | Core::IrSensor::DeviceFormat& device_format, | 12 | Core::IrSensor::DeviceFormat& device_format, |
| 11 | std::size_t npad_index) | 13 | std::size_t npad_index) |
| 12 | : device{device_format} { | 14 | : device{device_format}, system{system_} { |
| 13 | npad_device = hid_core_.GetEmulatedControllerByIndex(npad_index); | 15 | npad_device = system.HIDCore().GetEmulatedControllerByIndex(npad_index); |
| 14 | 16 | ||
| 15 | Core::HID::ControllerUpdateCallback engine_callback{ | 17 | Core::HID::ControllerUpdateCallback engine_callback{ |
| 16 | .on_change = [this](Core::HID::ControllerTriggerType type) { OnControllerUpdate(type); }, | 18 | .on_change = [this](Core::HID::ControllerTriggerType type) { OnControllerUpdate(type); }, |
| @@ -43,7 +45,7 @@ void ImageTransferProcessor::OnControllerUpdate(Core::HID::ControllerTriggerType | |||
| 43 | if (type != Core::HID::ControllerTriggerType::IrSensor) { | 45 | if (type != Core::HID::ControllerTriggerType::IrSensor) { |
| 44 | return; | 46 | return; |
| 45 | } | 47 | } |
| 46 | if (!is_transfer_memory_set) { | 48 | if (transfer_memory == 0) { |
| 47 | return; | 49 | return; |
| 48 | } | 50 | } |
| 49 | 51 | ||
| @@ -56,14 +58,16 @@ void ImageTransferProcessor::OnControllerUpdate(Core::HID::ControllerTriggerType | |||
| 56 | if (camera_data.format != current_config.origin_format) { | 58 | if (camera_data.format != current_config.origin_format) { |
| 57 | LOG_WARNING(Service_IRS, "Wrong Input format {} expected {}", camera_data.format, | 59 | LOG_WARNING(Service_IRS, "Wrong Input format {} expected {}", camera_data.format, |
| 58 | current_config.origin_format); | 60 | current_config.origin_format); |
| 59 | memset(transfer_memory, 0, GetDataSize(current_config.trimming_format)); | 61 | system.Memory().ZeroBlock(*system.ApplicationProcess(), transfer_memory, |
| 62 | GetDataSize(current_config.trimming_format)); | ||
| 60 | return; | 63 | return; |
| 61 | } | 64 | } |
| 62 | 65 | ||
| 63 | if (current_config.origin_format > current_config.trimming_format) { | 66 | if (current_config.origin_format > current_config.trimming_format) { |
| 64 | LOG_WARNING(Service_IRS, "Origin format {} is smaller than trimming format {}", | 67 | LOG_WARNING(Service_IRS, "Origin format {} is smaller than trimming format {}", |
| 65 | current_config.origin_format, current_config.trimming_format); | 68 | current_config.origin_format, current_config.trimming_format); |
| 66 | memset(transfer_memory, 0, GetDataSize(current_config.trimming_format)); | 69 | system.Memory().ZeroBlock(*system.ApplicationProcess(), transfer_memory, |
| 70 | GetDataSize(current_config.trimming_format)); | ||
| 67 | return; | 71 | return; |
| 68 | } | 72 | } |
| 69 | 73 | ||
| @@ -80,7 +84,8 @@ void ImageTransferProcessor::OnControllerUpdate(Core::HID::ControllerTriggerType | |||
| 80 | "Trimming area ({}, {}, {}, {}) is outside of origin area ({}, {})", | 84 | "Trimming area ({}, {}, {}, {}) is outside of origin area ({}, {})", |
| 81 | current_config.trimming_start_x, current_config.trimming_start_y, | 85 | current_config.trimming_start_x, current_config.trimming_start_y, |
| 82 | trimming_width, trimming_height, origin_width, origin_height); | 86 | trimming_width, trimming_height, origin_width, origin_height); |
| 83 | memset(transfer_memory, 0, GetDataSize(current_config.trimming_format)); | 87 | system.Memory().ZeroBlock(*system.ApplicationProcess(), transfer_memory, |
| 88 | GetDataSize(current_config.trimming_format)); | ||
| 84 | return; | 89 | return; |
| 85 | } | 90 | } |
| 86 | 91 | ||
| @@ -94,7 +99,8 @@ void ImageTransferProcessor::OnControllerUpdate(Core::HID::ControllerTriggerType | |||
| 94 | } | 99 | } |
| 95 | } | 100 | } |
| 96 | 101 | ||
| 97 | memcpy(transfer_memory, window_data.data(), GetDataSize(current_config.trimming_format)); | 102 | system.Memory().WriteBlock(transfer_memory, window_data.data(), |
| 103 | GetDataSize(current_config.trimming_format)); | ||
| 98 | 104 | ||
| 99 | if (!IsProcessorActive()) { | 105 | if (!IsProcessorActive()) { |
| 100 | StartProcessor(); | 106 | StartProcessor(); |
| @@ -134,8 +140,7 @@ void ImageTransferProcessor::SetConfig( | |||
| 134 | npad_device->SetCameraFormat(current_config.origin_format); | 140 | npad_device->SetCameraFormat(current_config.origin_format); |
| 135 | } | 141 | } |
| 136 | 142 | ||
| 137 | void ImageTransferProcessor::SetTransferMemoryPointer(u8* t_mem) { | 143 | void ImageTransferProcessor::SetTransferMemoryAddress(VAddr t_mem) { |
| 138 | is_transfer_memory_set = true; | ||
| 139 | transfer_memory = t_mem; | 144 | transfer_memory = t_mem; |
| 140 | } | 145 | } |
| 141 | 146 | ||
| @@ -143,7 +148,7 @@ Core::IrSensor::ImageTransferProcessorState ImageTransferProcessor::GetState( | |||
| 143 | std::vector<u8>& data) const { | 148 | std::vector<u8>& data) const { |
| 144 | const auto size = GetDataSize(current_config.trimming_format); | 149 | const auto size = GetDataSize(current_config.trimming_format); |
| 145 | data.resize(size); | 150 | data.resize(size); |
| 146 | memcpy(data.data(), transfer_memory, size); | 151 | system.Memory().ReadBlock(transfer_memory, data.data(), size); |
| 147 | return processor_state; | 152 | return processor_state; |
| 148 | } | 153 | } |
| 149 | 154 | ||
diff --git a/src/core/hle/service/hid/irsensor/image_transfer_processor.h b/src/core/hle/service/hid/irsensor/image_transfer_processor.h index 393df492d..7cfe04c8c 100644 --- a/src/core/hle/service/hid/irsensor/image_transfer_processor.h +++ b/src/core/hle/service/hid/irsensor/image_transfer_processor.h | |||
| @@ -7,6 +7,10 @@ | |||
| 7 | #include "core/hid/irs_types.h" | 7 | #include "core/hid/irs_types.h" |
| 8 | #include "core/hle/service/hid/irsensor/processor_base.h" | 8 | #include "core/hle/service/hid/irsensor/processor_base.h" |
| 9 | 9 | ||
| 10 | namespace Core { | ||
| 11 | class System; | ||
| 12 | } | ||
| 13 | |||
| 10 | namespace Core::HID { | 14 | namespace Core::HID { |
| 11 | class EmulatedController; | 15 | class EmulatedController; |
| 12 | } // namespace Core::HID | 16 | } // namespace Core::HID |
| @@ -14,7 +18,7 @@ class EmulatedController; | |||
| 14 | namespace Service::IRS { | 18 | namespace Service::IRS { |
| 15 | class ImageTransferProcessor final : public ProcessorBase { | 19 | class ImageTransferProcessor final : public ProcessorBase { |
| 16 | public: | 20 | public: |
| 17 | explicit ImageTransferProcessor(Core::HID::HIDCore& hid_core_, | 21 | explicit ImageTransferProcessor(Core::System& system_, |
| 18 | Core::IrSensor::DeviceFormat& device_format, | 22 | Core::IrSensor::DeviceFormat& device_format, |
| 19 | std::size_t npad_index); | 23 | std::size_t npad_index); |
| 20 | ~ImageTransferProcessor() override; | 24 | ~ImageTransferProcessor() override; |
| @@ -33,7 +37,7 @@ public: | |||
| 33 | void SetConfig(Core::IrSensor::PackedImageTransferProcessorExConfig config); | 37 | void SetConfig(Core::IrSensor::PackedImageTransferProcessorExConfig config); |
| 34 | 38 | ||
| 35 | // Transfer memory where the image data will be stored | 39 | // Transfer memory where the image data will be stored |
| 36 | void SetTransferMemoryPointer(u8* t_mem); | 40 | void SetTransferMemoryAddress(VAddr t_mem); |
| 37 | 41 | ||
| 38 | Core::IrSensor::ImageTransferProcessorState GetState(std::vector<u8>& data) const; | 42 | Core::IrSensor::ImageTransferProcessorState GetState(std::vector<u8>& data) const; |
| 39 | 43 | ||
| @@ -67,7 +71,7 @@ private: | |||
| 67 | Core::HID::EmulatedController* npad_device; | 71 | Core::HID::EmulatedController* npad_device; |
| 68 | int callback_key{}; | 72 | int callback_key{}; |
| 69 | 73 | ||
| 70 | u8* transfer_memory = nullptr; | 74 | Core::System& system; |
| 71 | bool is_transfer_memory_set = false; | 75 | VAddr transfer_memory{}; |
| 72 | }; | 76 | }; |
| 73 | } // namespace Service::IRS | 77 | } // namespace Service::IRS |
diff --git a/src/core/hle/service/ncm/ncm.cpp b/src/core/hle/service/ncm/ncm.cpp index e8cd762ad..5ab24dc34 100644 --- a/src/core/hle/service/ncm/ncm.cpp +++ b/src/core/hle/service/ncm/ncm.cpp | |||
| @@ -124,6 +124,7 @@ public: | |||
| 124 | {12, nullptr, "InactivateContentMetaDatabase"}, | 124 | {12, nullptr, "InactivateContentMetaDatabase"}, |
| 125 | {13, nullptr, "InvalidateRightsIdCache"}, | 125 | {13, nullptr, "InvalidateRightsIdCache"}, |
| 126 | {14, nullptr, "GetMemoryReport"}, | 126 | {14, nullptr, "GetMemoryReport"}, |
| 127 | {15, nullptr, "ActivateFsContentStorage"}, | ||
| 127 | }; | 128 | }; |
| 128 | // clang-format on | 129 | // clang-format on |
| 129 | 130 | ||
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index a9291ed5d..062e96ef9 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp | |||
| @@ -160,6 +160,8 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ | |||
| 160 | {606, nullptr, "GetContentMetaStorage"}, | 160 | {606, nullptr, "GetContentMetaStorage"}, |
| 161 | {607, nullptr, "ListAvailableAddOnContent"}, | 161 | {607, nullptr, "ListAvailableAddOnContent"}, |
| 162 | {609, nullptr, "ListAvailabilityAssuredAddOnContent"}, | 162 | {609, nullptr, "ListAvailabilityAssuredAddOnContent"}, |
| 163 | {610, nullptr, "GetInstalledContentMetaStorage"}, | ||
| 164 | {611, nullptr, "PrepareAddOnContent"}, | ||
| 163 | {700, nullptr, "PushDownloadTaskList"}, | 165 | {700, nullptr, "PushDownloadTaskList"}, |
| 164 | {701, nullptr, "ClearTaskStatusList"}, | 166 | {701, nullptr, "ClearTaskStatusList"}, |
| 165 | {702, nullptr, "RequestDownloadTaskList"}, | 167 | {702, nullptr, "RequestDownloadTaskList"}, |
| @@ -229,6 +231,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ | |||
| 229 | {1900, nullptr, "IsActiveAccount"}, | 231 | {1900, nullptr, "IsActiveAccount"}, |
| 230 | {1901, nullptr, "RequestDownloadApplicationPrepurchasedRights"}, | 232 | {1901, nullptr, "RequestDownloadApplicationPrepurchasedRights"}, |
| 231 | {1902, nullptr, "GetApplicationTicketInfo"}, | 233 | {1902, nullptr, "GetApplicationTicketInfo"}, |
| 234 | {1903, nullptr, "RequestDownloadApplicationPrepurchasedRightsForAccount"}, | ||
| 232 | {2000, nullptr, "GetSystemDeliveryInfo"}, | 235 | {2000, nullptr, "GetSystemDeliveryInfo"}, |
| 233 | {2001, nullptr, "SelectLatestSystemDeliveryInfo"}, | 236 | {2001, nullptr, "SelectLatestSystemDeliveryInfo"}, |
| 234 | {2002, nullptr, "VerifyDeliveryProtocolVersion"}, | 237 | {2002, nullptr, "VerifyDeliveryProtocolVersion"}, |
| @@ -277,8 +280,11 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ | |||
| 277 | {2352, nullptr, "RequestResolveNoDownloadRightsError"}, | 280 | {2352, nullptr, "RequestResolveNoDownloadRightsError"}, |
| 278 | {2353, nullptr, "GetApplicationDownloadTaskInfo"}, | 281 | {2353, nullptr, "GetApplicationDownloadTaskInfo"}, |
| 279 | {2354, nullptr, "PrioritizeApplicationBackgroundTask"}, | 282 | {2354, nullptr, "PrioritizeApplicationBackgroundTask"}, |
| 280 | {2355, nullptr, "Unknown2355"}, | 283 | {2355, nullptr, "PreferStorageEfficientUpdate"}, |
| 281 | {2356, nullptr, "Unknown2356"}, | 284 | {2356, nullptr, "RequestStorageEfficientUpdatePreferable"}, |
| 285 | {2357, nullptr, "EnableMultiCoreDownload"}, | ||
| 286 | {2358, nullptr, "DisableMultiCoreDownload"}, | ||
| 287 | {2359, nullptr, "IsMultiCoreDownloadEnabled"}, | ||
| 282 | {2400, nullptr, "GetPromotionInfo"}, | 288 | {2400, nullptr, "GetPromotionInfo"}, |
| 283 | {2401, nullptr, "CountPromotionInfo"}, | 289 | {2401, nullptr, "CountPromotionInfo"}, |
| 284 | {2402, nullptr, "ListPromotionInfo"}, | 290 | {2402, nullptr, "ListPromotionInfo"}, |
| @@ -296,6 +302,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ | |||
| 296 | {2519, nullptr, "IsQualificationTransitionSupported"}, | 302 | {2519, nullptr, "IsQualificationTransitionSupported"}, |
| 297 | {2520, nullptr, "IsQualificationTransitionSupportedByProcessId"}, | 303 | {2520, nullptr, "IsQualificationTransitionSupportedByProcessId"}, |
| 298 | {2521, nullptr, "GetRightsUserChangedEvent"}, | 304 | {2521, nullptr, "GetRightsUserChangedEvent"}, |
| 305 | {2522, nullptr, "IsRomRedirectionAvailable"}, | ||
| 299 | {2800, nullptr, "GetApplicationIdOfPreomia"}, | 306 | {2800, nullptr, "GetApplicationIdOfPreomia"}, |
| 300 | {3000, nullptr, "RegisterDeviceLockKey"}, | 307 | {3000, nullptr, "RegisterDeviceLockKey"}, |
| 301 | {3001, nullptr, "UnregisterDeviceLockKey"}, | 308 | {3001, nullptr, "UnregisterDeviceLockKey"}, |
| @@ -312,6 +319,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ | |||
| 312 | {3012, nullptr, "IsApplicationTitleHidden"}, | 319 | {3012, nullptr, "IsApplicationTitleHidden"}, |
| 313 | {3013, nullptr, "IsGameCardEnabled"}, | 320 | {3013, nullptr, "IsGameCardEnabled"}, |
| 314 | {3014, nullptr, "IsLocalContentShareEnabled"}, | 321 | {3014, nullptr, "IsLocalContentShareEnabled"}, |
| 322 | {3050, nullptr, "ListAssignELicenseTaskResult"}, | ||
| 315 | {9999, nullptr, "GetApplicationCertificate"}, | 323 | {9999, nullptr, "GetApplicationCertificate"}, |
| 316 | }; | 324 | }; |
| 317 | // clang-format on | 325 | // clang-format on |
diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp index 790e28504..2789fa1ed 100644 --- a/src/core/hle/service/sockets/bsd.cpp +++ b/src/core/hle/service/sockets/bsd.cpp | |||
| @@ -953,6 +953,9 @@ BSDCFG::BSDCFG(Core::System& system_) : ServiceFramework{system_, "bsdcfg"} { | |||
| 953 | {10, nullptr, "ClearArpEntries"}, | 953 | {10, nullptr, "ClearArpEntries"}, |
| 954 | {11, nullptr, "ClearArpEntries2"}, | 954 | {11, nullptr, "ClearArpEntries2"}, |
| 955 | {12, nullptr, "PrintArpEntries"}, | 955 | {12, nullptr, "PrintArpEntries"}, |
| 956 | {13, nullptr, "Unknown13"}, | ||
| 957 | {14, nullptr, "Unknown14"}, | ||
| 958 | {15, nullptr, "Unknown15"}, | ||
| 956 | }; | 959 | }; |
| 957 | // clang-format on | 960 | // clang-format on |
| 958 | 961 | ||
diff --git a/src/core/hle/service/sockets/sockets.h b/src/core/hle/service/sockets/sockets.h index c94e80ef6..acd2dae7b 100644 --- a/src/core/hle/service/sockets/sockets.h +++ b/src/core/hle/service/sockets/sockets.h | |||
| @@ -19,6 +19,7 @@ enum class Errno : u32 { | |||
| 19 | INVAL = 22, | 19 | INVAL = 22, |
| 20 | MFILE = 24, | 20 | MFILE = 24, |
| 21 | MSGSIZE = 90, | 21 | MSGSIZE = 90, |
| 22 | CONNRESET = 104, | ||
| 22 | NOTCONN = 107, | 23 | NOTCONN = 107, |
| 23 | TIMEDOUT = 110, | 24 | TIMEDOUT = 110, |
| 24 | }; | 25 | }; |
diff --git a/src/core/hle/service/sockets/sockets_translate.cpp b/src/core/hle/service/sockets/sockets_translate.cpp index 023aa0486..594e58f90 100644 --- a/src/core/hle/service/sockets/sockets_translate.cpp +++ b/src/core/hle/service/sockets/sockets_translate.cpp | |||
| @@ -27,6 +27,8 @@ Errno Translate(Network::Errno value) { | |||
| 27 | return Errno::NOTCONN; | 27 | return Errno::NOTCONN; |
| 28 | case Network::Errno::TIMEDOUT: | 28 | case Network::Errno::TIMEDOUT: |
| 29 | return Errno::TIMEDOUT; | 29 | return Errno::TIMEDOUT; |
| 30 | case Network::Errno::CONNRESET: | ||
| 31 | return Errno::CONNRESET; | ||
| 30 | default: | 32 | default: |
| 31 | UNIMPLEMENTED_MSG("Unimplemented errno={}", value); | 33 | UNIMPLEMENTED_MSG("Unimplemented errno={}", value); |
| 32 | return Errno::SUCCESS; | 34 | return Errno::SUCCESS; |
diff --git a/src/core/hle/service/ssl/ssl.cpp b/src/core/hle/service/ssl/ssl.cpp index 57027bdf5..c1fd1a59b 100644 --- a/src/core/hle/service/ssl/ssl.cpp +++ b/src/core/hle/service/ssl/ssl.cpp | |||
| @@ -46,6 +46,14 @@ public: | |||
| 46 | {25, nullptr, "GetCipherInfo"}, | 46 | {25, nullptr, "GetCipherInfo"}, |
| 47 | {26, nullptr, "SetNextAlpnProto"}, | 47 | {26, nullptr, "SetNextAlpnProto"}, |
| 48 | {27, nullptr, "GetNextAlpnProto"}, | 48 | {27, nullptr, "GetNextAlpnProto"}, |
| 49 | {28, nullptr, "SetDtlsSocketDescriptor"}, | ||
| 50 | {29, nullptr, "GetDtlsHandshakeTimeout"}, | ||
| 51 | {30, nullptr, "SetPrivateOption"}, | ||
| 52 | {31, nullptr, "SetSrtpCiphers"}, | ||
| 53 | {32, nullptr, "GetSrtpCipher"}, | ||
| 54 | {33, nullptr, "ExportKeyingMaterial"}, | ||
| 55 | {34, nullptr, "SetIoTimeout"}, | ||
| 56 | {35, nullptr, "GetIoTimeout"}, | ||
| 49 | }; | 57 | }; |
| 50 | // clang-format on | 58 | // clang-format on |
| 51 | 59 | ||
| @@ -69,6 +77,8 @@ public: | |||
| 69 | {9, nullptr, "AddPolicyOid"}, | 77 | {9, nullptr, "AddPolicyOid"}, |
| 70 | {10, nullptr, "ImportCrl"}, | 78 | {10, nullptr, "ImportCrl"}, |
| 71 | {11, nullptr, "RemoveCrl"}, | 79 | {11, nullptr, "RemoveCrl"}, |
| 80 | {12, nullptr, "ImportClientCertKeyPki"}, | ||
| 81 | {13, nullptr, "GeneratePrivateKeyAndCert"}, | ||
| 72 | }; | 82 | }; |
| 73 | RegisterHandlers(functions); | 83 | RegisterHandlers(functions); |
| 74 | } | 84 | } |
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index 6da8bea9e..d9cfebd70 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp | |||
| @@ -249,6 +249,9 @@ public: | |||
| 249 | {2053, nullptr, "DestroyIndirectProducerEndPoint"}, | 249 | {2053, nullptr, "DestroyIndirectProducerEndPoint"}, |
| 250 | {2054, nullptr, "CreateIndirectConsumerEndPoint"}, | 250 | {2054, nullptr, "CreateIndirectConsumerEndPoint"}, |
| 251 | {2055, nullptr, "DestroyIndirectConsumerEndPoint"}, | 251 | {2055, nullptr, "DestroyIndirectConsumerEndPoint"}, |
| 252 | {2060, nullptr, "CreateWatermarkCompositor"}, | ||
| 253 | {2062, nullptr, "SetWatermarkText"}, | ||
| 254 | {2063, nullptr, "SetWatermarkLayerStacks"}, | ||
| 252 | {2300, nullptr, "AcquireLayerTexturePresentingEvent"}, | 255 | {2300, nullptr, "AcquireLayerTexturePresentingEvent"}, |
| 253 | {2301, nullptr, "ReleaseLayerTexturePresentingEvent"}, | 256 | {2301, nullptr, "ReleaseLayerTexturePresentingEvent"}, |
| 254 | {2302, nullptr, "GetDisplayHotplugEvent"}, | 257 | {2302, nullptr, "GetDisplayHotplugEvent"}, |
| @@ -279,6 +282,8 @@ public: | |||
| 279 | {6011, nullptr, "EnableLayerAutoClearTransitionBuffer"}, | 282 | {6011, nullptr, "EnableLayerAutoClearTransitionBuffer"}, |
| 280 | {6012, nullptr, "DisableLayerAutoClearTransitionBuffer"}, | 283 | {6012, nullptr, "DisableLayerAutoClearTransitionBuffer"}, |
| 281 | {6013, nullptr, "SetLayerOpacity"}, | 284 | {6013, nullptr, "SetLayerOpacity"}, |
| 285 | {6014, nullptr, "AttachLayerWatermarkCompositor"}, | ||
| 286 | {6015, nullptr, "DetachLayerWatermarkCompositor"}, | ||
| 282 | {7000, nullptr, "SetContentVisibility"}, | 287 | {7000, nullptr, "SetContentVisibility"}, |
| 283 | {8000, nullptr, "SetConductorLayer"}, | 288 | {8000, nullptr, "SetConductorLayer"}, |
| 284 | {8001, nullptr, "SetTimestampTracking"}, | 289 | {8001, nullptr, "SetTimestampTracking"}, |
diff --git a/src/core/hle/service/vi/vi_m.cpp b/src/core/hle/service/vi/vi_m.cpp index 1ab7fe4ab..7ca44354b 100644 --- a/src/core/hle/service/vi/vi_m.cpp +++ b/src/core/hle/service/vi/vi_m.cpp | |||
| @@ -14,6 +14,10 @@ VI_M::VI_M(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_, | |||
| 14 | static const FunctionInfo functions[] = { | 14 | static const FunctionInfo functions[] = { |
| 15 | {2, &VI_M::GetDisplayService, "GetDisplayService"}, | 15 | {2, &VI_M::GetDisplayService, "GetDisplayService"}, |
| 16 | {3, nullptr, "GetDisplayServiceWithProxyNameExchange"}, | 16 | {3, nullptr, "GetDisplayServiceWithProxyNameExchange"}, |
| 17 | {100, nullptr, "PrepareFatal"}, | ||
| 18 | {101, nullptr, "ShowFatal"}, | ||
| 19 | {102, nullptr, "DrawFatalRectangle"}, | ||
| 20 | {103, nullptr, "DrawFatalText32"}, | ||
| 17 | }; | 21 | }; |
| 18 | RegisterHandlers(functions); | 22 | RegisterHandlers(functions); |
| 19 | } | 23 | } |
diff --git a/src/core/internal_network/network.cpp b/src/core/internal_network/network.cpp index 7494fb62d..f85c73ca6 100644 --- a/src/core/internal_network/network.cpp +++ b/src/core/internal_network/network.cpp | |||
| @@ -109,6 +109,8 @@ Errno TranslateNativeError(int e) { | |||
| 109 | return Errno::AGAIN; | 109 | return Errno::AGAIN; |
| 110 | case WSAECONNREFUSED: | 110 | case WSAECONNREFUSED: |
| 111 | return Errno::CONNREFUSED; | 111 | return Errno::CONNREFUSED; |
| 112 | case WSAECONNRESET: | ||
| 113 | return Errno::CONNRESET; | ||
| 112 | case WSAEHOSTUNREACH: | 114 | case WSAEHOSTUNREACH: |
| 113 | return Errno::HOSTUNREACH; | 115 | return Errno::HOSTUNREACH; |
| 114 | case WSAENETDOWN: | 116 | case WSAENETDOWN: |
| @@ -205,6 +207,8 @@ Errno TranslateNativeError(int e) { | |||
| 205 | return Errno::AGAIN; | 207 | return Errno::AGAIN; |
| 206 | case ECONNREFUSED: | 208 | case ECONNREFUSED: |
| 207 | return Errno::CONNREFUSED; | 209 | return Errno::CONNREFUSED; |
| 210 | case ECONNRESET: | ||
| 211 | return Errno::CONNRESET; | ||
| 208 | case EHOSTUNREACH: | 212 | case EHOSTUNREACH: |
| 209 | return Errno::HOSTUNREACH; | 213 | return Errno::HOSTUNREACH; |
| 210 | case ENETDOWN: | 214 | case ENETDOWN: |
diff --git a/src/core/internal_network/network.h b/src/core/internal_network/network.h index 36994c22e..1e09a007a 100644 --- a/src/core/internal_network/network.h +++ b/src/core/internal_network/network.h | |||
| @@ -30,6 +30,7 @@ enum class Errno { | |||
| 30 | NOTCONN, | 30 | NOTCONN, |
| 31 | AGAIN, | 31 | AGAIN, |
| 32 | CONNREFUSED, | 32 | CONNREFUSED, |
| 33 | CONNRESET, | ||
| 33 | HOSTUNREACH, | 34 | HOSTUNREACH, |
| 34 | NETDOWN, | 35 | NETDOWN, |
| 35 | NETUNREACH, | 36 | NETUNREACH, |
diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt index e3b627e4f..322c29065 100644 --- a/src/input_common/CMakeLists.txt +++ b/src/input_common/CMakeLists.txt | |||
| @@ -89,7 +89,7 @@ if (ENABLE_LIBUSB) | |||
| 89 | endif() | 89 | endif() |
| 90 | 90 | ||
| 91 | create_target_directory_groups(input_common) | 91 | create_target_directory_groups(input_common) |
| 92 | target_link_libraries(input_common PUBLIC core PRIVATE common Boost::boost) | 92 | target_link_libraries(input_common PUBLIC core PRIVATE common Boost::headers) |
| 93 | 93 | ||
| 94 | if (YUZU_USE_PRECOMPILED_HEADERS) | 94 | if (YUZU_USE_PRECOMPILED_HEADERS) |
| 95 | target_precompile_headers(input_common PRIVATE precompiled_headers.h) | 95 | target_precompile_headers(input_common PRIVATE precompiled_headers.h) |
diff --git a/src/input_common/drivers/mouse.cpp b/src/input_common/drivers/mouse.cpp index da50e0a24..8b7f9aee9 100644 --- a/src/input_common/drivers/mouse.cpp +++ b/src/input_common/drivers/mouse.cpp | |||
| @@ -10,17 +10,25 @@ | |||
| 10 | #include "input_common/drivers/mouse.h" | 10 | #include "input_common/drivers/mouse.h" |
| 11 | 11 | ||
| 12 | namespace InputCommon { | 12 | namespace InputCommon { |
| 13 | constexpr int update_time = 10; | ||
| 14 | constexpr float default_stick_sensitivity = 0.022f; | ||
| 15 | constexpr float default_motion_sensitivity = 0.008f; | ||
| 13 | constexpr int mouse_axis_x = 0; | 16 | constexpr int mouse_axis_x = 0; |
| 14 | constexpr int mouse_axis_y = 1; | 17 | constexpr int mouse_axis_y = 1; |
| 15 | constexpr int wheel_axis_x = 2; | 18 | constexpr int wheel_axis_x = 2; |
| 16 | constexpr int wheel_axis_y = 3; | 19 | constexpr int wheel_axis_y = 3; |
| 17 | constexpr int motion_wheel_y = 4; | ||
| 18 | constexpr PadIdentifier identifier = { | 20 | constexpr PadIdentifier identifier = { |
| 19 | .guid = Common::UUID{}, | 21 | .guid = Common::UUID{}, |
| 20 | .port = 0, | 22 | .port = 0, |
| 21 | .pad = 0, | 23 | .pad = 0, |
| 22 | }; | 24 | }; |
| 23 | 25 | ||
| 26 | constexpr PadIdentifier motion_identifier = { | ||
| 27 | .guid = Common::UUID{}, | ||
| 28 | .port = 0, | ||
| 29 | .pad = 1, | ||
| 30 | }; | ||
| 31 | |||
| 24 | constexpr PadIdentifier real_mouse_identifier = { | 32 | constexpr PadIdentifier real_mouse_identifier = { |
| 25 | .guid = Common::UUID{}, | 33 | .guid = Common::UUID{}, |
| 26 | .port = 1, | 34 | .port = 1, |
| @@ -37,47 +45,87 @@ Mouse::Mouse(std::string input_engine_) : InputEngine(std::move(input_engine_)) | |||
| 37 | PreSetController(identifier); | 45 | PreSetController(identifier); |
| 38 | PreSetController(real_mouse_identifier); | 46 | PreSetController(real_mouse_identifier); |
| 39 | PreSetController(touch_identifier); | 47 | PreSetController(touch_identifier); |
| 48 | PreSetController(motion_identifier); | ||
| 40 | 49 | ||
| 41 | // Initialize all mouse axis | 50 | // Initialize all mouse axis |
| 42 | PreSetAxis(identifier, mouse_axis_x); | 51 | PreSetAxis(identifier, mouse_axis_x); |
| 43 | PreSetAxis(identifier, mouse_axis_y); | 52 | PreSetAxis(identifier, mouse_axis_y); |
| 44 | PreSetAxis(identifier, wheel_axis_x); | 53 | PreSetAxis(identifier, wheel_axis_x); |
| 45 | PreSetAxis(identifier, wheel_axis_y); | 54 | PreSetAxis(identifier, wheel_axis_y); |
| 46 | PreSetAxis(identifier, motion_wheel_y); | ||
| 47 | PreSetAxis(real_mouse_identifier, mouse_axis_x); | 55 | PreSetAxis(real_mouse_identifier, mouse_axis_x); |
| 48 | PreSetAxis(real_mouse_identifier, mouse_axis_y); | 56 | PreSetAxis(real_mouse_identifier, mouse_axis_y); |
| 49 | PreSetAxis(touch_identifier, mouse_axis_x); | 57 | PreSetAxis(touch_identifier, mouse_axis_x); |
| 50 | PreSetAxis(touch_identifier, mouse_axis_y); | 58 | PreSetAxis(touch_identifier, mouse_axis_y); |
| 59 | |||
| 60 | // Initialize variables | ||
| 61 | mouse_origin = {}; | ||
| 62 | last_mouse_position = {}; | ||
| 63 | wheel_position = {}; | ||
| 64 | last_mouse_change = {}; | ||
| 65 | last_motion_change = {}; | ||
| 66 | |||
| 51 | update_thread = std::jthread([this](std::stop_token stop_token) { UpdateThread(stop_token); }); | 67 | update_thread = std::jthread([this](std::stop_token stop_token) { UpdateThread(stop_token); }); |
| 52 | } | 68 | } |
| 53 | 69 | ||
| 54 | void Mouse::UpdateThread(std::stop_token stop_token) { | 70 | void Mouse::UpdateThread(std::stop_token stop_token) { |
| 55 | Common::SetCurrentThreadName("Mouse"); | 71 | Common::SetCurrentThreadName("Mouse"); |
| 56 | constexpr int update_time = 10; | ||
| 57 | while (!stop_token.stop_requested()) { | ||
| 58 | if (Settings::values.mouse_panning) { | ||
| 59 | // Slow movement by 4% | ||
| 60 | last_mouse_change *= 0.96f; | ||
| 61 | const float sensitivity = | ||
| 62 | Settings::values.mouse_panning_sensitivity.GetValue() * 0.022f; | ||
| 63 | SetAxis(identifier, mouse_axis_x, last_mouse_change.x * sensitivity); | ||
| 64 | SetAxis(identifier, mouse_axis_y, -last_mouse_change.y * sensitivity); | ||
| 65 | } | ||
| 66 | 72 | ||
| 67 | SetAxis(identifier, motion_wheel_y, 0.0f); | 73 | while (!stop_token.stop_requested()) { |
| 74 | UpdateStickInput(); | ||
| 75 | UpdateMotionInput(); | ||
| 68 | 76 | ||
| 69 | if (mouse_panning_timout++ > 20) { | 77 | if (mouse_panning_timeout++ > 20) { |
| 70 | StopPanning(); | 78 | StopPanning(); |
| 71 | } | 79 | } |
| 72 | std::this_thread::sleep_for(std::chrono::milliseconds(update_time)); | 80 | std::this_thread::sleep_for(std::chrono::milliseconds(update_time)); |
| 73 | } | 81 | } |
| 74 | } | 82 | } |
| 75 | 83 | ||
| 84 | void Mouse::UpdateStickInput() { | ||
| 85 | if (!Settings::values.mouse_panning) { | ||
| 86 | return; | ||
| 87 | } | ||
| 88 | |||
| 89 | const float sensitivity = | ||
| 90 | Settings::values.mouse_panning_sensitivity.GetValue() * default_stick_sensitivity; | ||
| 91 | |||
| 92 | // Slow movement by 4% | ||
| 93 | last_mouse_change *= 0.96f; | ||
| 94 | SetAxis(identifier, mouse_axis_x, last_mouse_change.x * sensitivity); | ||
| 95 | SetAxis(identifier, mouse_axis_y, -last_mouse_change.y * sensitivity); | ||
| 96 | } | ||
| 97 | |||
| 98 | void Mouse::UpdateMotionInput() { | ||
| 99 | const float sensitivity = | ||
| 100 | Settings::values.mouse_panning_sensitivity.GetValue() * default_motion_sensitivity; | ||
| 101 | |||
| 102 | // Slow movement by 7% | ||
| 103 | if (Settings::values.mouse_panning) { | ||
| 104 | last_motion_change *= 0.93f; | ||
| 105 | } else { | ||
| 106 | last_motion_change.z *= 0.93f; | ||
| 107 | } | ||
| 108 | |||
| 109 | const BasicMotion motion_data{ | ||
| 110 | .gyro_x = last_motion_change.x * sensitivity, | ||
| 111 | .gyro_y = last_motion_change.y * sensitivity, | ||
| 112 | .gyro_z = last_motion_change.z * sensitivity, | ||
| 113 | .accel_x = 0, | ||
| 114 | .accel_y = 0, | ||
| 115 | .accel_z = 0, | ||
| 116 | .delta_timestamp = update_time * 1000, | ||
| 117 | }; | ||
| 118 | |||
| 119 | SetMotion(motion_identifier, 0, motion_data); | ||
| 120 | } | ||
| 121 | |||
| 76 | void Mouse::Move(int x, int y, int center_x, int center_y) { | 122 | void Mouse::Move(int x, int y, int center_x, int center_y) { |
| 77 | if (Settings::values.mouse_panning) { | 123 | if (Settings::values.mouse_panning) { |
| 124 | mouse_panning_timeout = 0; | ||
| 125 | |||
| 78 | auto mouse_change = | 126 | auto mouse_change = |
| 79 | (Common::MakeVec(x, y) - Common::MakeVec(center_x, center_y)).Cast<float>(); | 127 | (Common::MakeVec(x, y) - Common::MakeVec(center_x, center_y)).Cast<float>(); |
| 80 | mouse_panning_timout = 0; | 128 | Common::Vec3<float> motion_change{-mouse_change.y, -mouse_change.x, last_motion_change.z}; |
| 81 | 129 | ||
| 82 | const auto move_distance = mouse_change.Length(); | 130 | const auto move_distance = mouse_change.Length(); |
| 83 | if (move_distance == 0) { | 131 | if (move_distance == 0) { |
| @@ -93,6 +141,7 @@ void Mouse::Move(int x, int y, int center_x, int center_y) { | |||
| 93 | 141 | ||
| 94 | // Average mouse movements | 142 | // Average mouse movements |
| 95 | last_mouse_change = (last_mouse_change * 0.91f) + (mouse_change * 0.09f); | 143 | last_mouse_change = (last_mouse_change * 0.91f) + (mouse_change * 0.09f); |
| 144 | last_motion_change = (last_motion_change * 0.69f) + (motion_change * 0.31f); | ||
| 96 | 145 | ||
| 97 | const auto last_move_distance = last_mouse_change.Length(); | 146 | const auto last_move_distance = last_mouse_change.Length(); |
| 98 | 147 | ||
| @@ -116,6 +165,12 @@ void Mouse::Move(int x, int y, int center_x, int center_y) { | |||
| 116 | const float sensitivity = Settings::values.mouse_panning_sensitivity.GetValue() * 0.0012f; | 165 | const float sensitivity = Settings::values.mouse_panning_sensitivity.GetValue() * 0.0012f; |
| 117 | SetAxis(identifier, mouse_axis_x, static_cast<float>(mouse_move.x) * sensitivity); | 166 | SetAxis(identifier, mouse_axis_x, static_cast<float>(mouse_move.x) * sensitivity); |
| 118 | SetAxis(identifier, mouse_axis_y, static_cast<float>(-mouse_move.y) * sensitivity); | 167 | SetAxis(identifier, mouse_axis_y, static_cast<float>(-mouse_move.y) * sensitivity); |
| 168 | |||
| 169 | last_motion_change = { | ||
| 170 | static_cast<float>(-mouse_move.y) / 50.0f, | ||
| 171 | static_cast<float>(-mouse_move.x) / 50.0f, | ||
| 172 | last_motion_change.z, | ||
| 173 | }; | ||
| 119 | } | 174 | } |
| 120 | } | 175 | } |
| 121 | 176 | ||
| @@ -157,15 +212,19 @@ void Mouse::ReleaseButton(MouseButton button) { | |||
| 157 | SetAxis(identifier, mouse_axis_x, 0); | 212 | SetAxis(identifier, mouse_axis_x, 0); |
| 158 | SetAxis(identifier, mouse_axis_y, 0); | 213 | SetAxis(identifier, mouse_axis_y, 0); |
| 159 | } | 214 | } |
| 215 | |||
| 216 | last_motion_change.x = 0; | ||
| 217 | last_motion_change.y = 0; | ||
| 218 | |||
| 160 | button_pressed = false; | 219 | button_pressed = false; |
| 161 | } | 220 | } |
| 162 | 221 | ||
| 163 | void Mouse::MouseWheelChange(int x, int y) { | 222 | void Mouse::MouseWheelChange(int x, int y) { |
| 164 | wheel_position.x += x; | 223 | wheel_position.x += x; |
| 165 | wheel_position.y += y; | 224 | wheel_position.y += y; |
| 225 | last_motion_change.z += static_cast<f32>(y) / 100.0f; | ||
| 166 | SetAxis(identifier, wheel_axis_x, static_cast<f32>(wheel_position.x)); | 226 | SetAxis(identifier, wheel_axis_x, static_cast<f32>(wheel_position.x)); |
| 167 | SetAxis(identifier, wheel_axis_y, static_cast<f32>(wheel_position.y)); | 227 | SetAxis(identifier, wheel_axis_y, static_cast<f32>(wheel_position.y)); |
| 168 | SetAxis(identifier, motion_wheel_y, static_cast<f32>(y) / 100.0f); | ||
| 169 | } | 228 | } |
| 170 | 229 | ||
| 171 | void Mouse::ReleaseAllButtons() { | 230 | void Mouse::ReleaseAllButtons() { |
| @@ -234,6 +293,9 @@ Common::Input::ButtonNames Mouse::GetUIName(const Common::ParamPackage& params) | |||
| 234 | if (params.Has("axis_x") && params.Has("axis_y") && params.Has("axis_z")) { | 293 | if (params.Has("axis_x") && params.Has("axis_y") && params.Has("axis_z")) { |
| 235 | return Common::Input::ButtonNames::Engine; | 294 | return Common::Input::ButtonNames::Engine; |
| 236 | } | 295 | } |
| 296 | if (params.Has("motion")) { | ||
| 297 | return Common::Input::ButtonNames::Engine; | ||
| 298 | } | ||
| 237 | 299 | ||
| 238 | return Common::Input::ButtonNames::Invalid; | 300 | return Common::Input::ButtonNames::Invalid; |
| 239 | } | 301 | } |
diff --git a/src/input_common/drivers/mouse.h b/src/input_common/drivers/mouse.h index f3b65bdd1..b872c7a0f 100644 --- a/src/input_common/drivers/mouse.h +++ b/src/input_common/drivers/mouse.h | |||
| @@ -96,6 +96,8 @@ public: | |||
| 96 | 96 | ||
| 97 | private: | 97 | private: |
| 98 | void UpdateThread(std::stop_token stop_token); | 98 | void UpdateThread(std::stop_token stop_token); |
| 99 | void UpdateStickInput(); | ||
| 100 | void UpdateMotionInput(); | ||
| 99 | void StopPanning(); | 101 | void StopPanning(); |
| 100 | 102 | ||
| 101 | Common::Input::ButtonNames GetUIButtonName(const Common::ParamPackage& params) const; | 103 | Common::Input::ButtonNames GetUIButtonName(const Common::ParamPackage& params) const; |
| @@ -103,9 +105,10 @@ private: | |||
| 103 | Common::Vec2<int> mouse_origin; | 105 | Common::Vec2<int> mouse_origin; |
| 104 | Common::Vec2<int> last_mouse_position; | 106 | Common::Vec2<int> last_mouse_position; |
| 105 | Common::Vec2<float> last_mouse_change; | 107 | Common::Vec2<float> last_mouse_change; |
| 108 | Common::Vec3<float> last_motion_change; | ||
| 106 | Common::Vec2<int> wheel_position; | 109 | Common::Vec2<int> wheel_position; |
| 107 | bool button_pressed; | 110 | bool button_pressed; |
| 108 | int mouse_panning_timout{}; | 111 | int mouse_panning_timeout{}; |
| 109 | std::jthread update_thread; | 112 | std::jthread update_thread; |
| 110 | }; | 113 | }; |
| 111 | 114 | ||
diff --git a/src/input_common/input_mapping.cpp b/src/input_common/input_mapping.cpp index 6990a86b9..2ff480ff9 100644 --- a/src/input_common/input_mapping.cpp +++ b/src/input_common/input_mapping.cpp | |||
| @@ -142,14 +142,10 @@ void MappingFactory::RegisterMotion(const MappingData& data) { | |||
| 142 | new_input.Set("port", static_cast<int>(data.pad.port)); | 142 | new_input.Set("port", static_cast<int>(data.pad.port)); |
| 143 | new_input.Set("pad", static_cast<int>(data.pad.pad)); | 143 | new_input.Set("pad", static_cast<int>(data.pad.pad)); |
| 144 | 144 | ||
| 145 | // If engine is mouse map the mouse position as 3 axis motion | 145 | // If engine is mouse map it automatically to mouse motion |
| 146 | if (data.engine == "mouse") { | 146 | if (data.engine == "mouse") { |
| 147 | new_input.Set("axis_x", 1); | 147 | new_input.Set("motion", 0); |
| 148 | new_input.Set("invert_x", "-"); | 148 | new_input.Set("pad", 1); |
| 149 | new_input.Set("axis_y", 0); | ||
| 150 | new_input.Set("axis_z", 4); | ||
| 151 | new_input.Set("range", 1.0f); | ||
| 152 | new_input.Set("deadzone", 0.0f); | ||
| 153 | input_queue.Push(new_input); | 149 | input_queue.Push(new_input); |
| 154 | return; | 150 | return; |
| 155 | } | 151 | } |
diff --git a/src/network/CMakeLists.txt b/src/network/CMakeLists.txt index 1ab52da59..8e306219f 100644 --- a/src/network/CMakeLists.txt +++ b/src/network/CMakeLists.txt | |||
| @@ -19,7 +19,7 @@ add_library(network STATIC | |||
| 19 | 19 | ||
| 20 | create_target_directory_groups(network) | 20 | create_target_directory_groups(network) |
| 21 | 21 | ||
| 22 | target_link_libraries(network PRIVATE common enet::enet Boost::boost) | 22 | target_link_libraries(network PRIVATE common enet::enet Boost::headers) |
| 23 | if (ENABLE_WEB_SERVICE) | 23 | if (ENABLE_WEB_SERVICE) |
| 24 | target_compile_definitions(network PRIVATE -DENABLE_WEB_SERVICE) | 24 | target_compile_definitions(network PRIVATE -DENABLE_WEB_SERVICE) |
| 25 | target_link_libraries(network PRIVATE web_service) | 25 | target_link_libraries(network PRIVATE web_service) |
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index 4742bcbe9..e904573d7 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt | |||
| @@ -330,3 +330,7 @@ endif() | |||
| 330 | if (YUZU_USE_PRECOMPILED_HEADERS) | 330 | if (YUZU_USE_PRECOMPILED_HEADERS) |
| 331 | target_precompile_headers(video_core PRIVATE precompiled_headers.h) | 331 | target_precompile_headers(video_core PRIVATE precompiled_headers.h) |
| 332 | endif() | 332 | endif() |
| 333 | |||
| 334 | if (YUZU_ENABLE_LTO) | ||
| 335 | set_property(TARGET video_core PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) | ||
| 336 | endif() | ||
diff --git a/src/video_core/buffer_cache/buffer_base.h b/src/video_core/buffer_cache/buffer_base.h index 92d77eef2..1b4d63616 100644 --- a/src/video_core/buffer_cache/buffer_base.h +++ b/src/video_core/buffer_cache/buffer_base.h | |||
| @@ -568,7 +568,7 @@ private: | |||
| 568 | const u64* const state_words = Array<type>(); | 568 | const u64* const state_words = Array<type>(); |
| 569 | const u64 num_query_words = size / BYTES_PER_WORD + 1; | 569 | const u64 num_query_words = size / BYTES_PER_WORD + 1; |
| 570 | const u64 word_begin = offset / BYTES_PER_WORD; | 570 | const u64 word_begin = offset / BYTES_PER_WORD; |
| 571 | const u64 word_end = std::min(word_begin + num_query_words, NumWords()); | 571 | const u64 word_end = std::min<u64>(word_begin + num_query_words, NumWords()); |
| 572 | const u64 page_base = offset / BYTES_PER_PAGE; | 572 | const u64 page_base = offset / BYTES_PER_PAGE; |
| 573 | const u64 page_limit = Common::DivCeil(offset + size, BYTES_PER_PAGE); | 573 | const u64 page_limit = Common::DivCeil(offset + size, BYTES_PER_PAGE); |
| 574 | u64 begin = std::numeric_limits<u64>::max(); | 574 | u64 begin = std::numeric_limits<u64>::max(); |
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index eb6e43a08..b047e7b3d 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp | |||
| @@ -228,8 +228,9 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::array<SwizzleSource, 4 | |||
| 228 | 228 | ||
| 229 | [[nodiscard]] bool CanBeAccelerated(const TextureCacheRuntime& runtime, | 229 | [[nodiscard]] bool CanBeAccelerated(const TextureCacheRuntime& runtime, |
| 230 | const VideoCommon::ImageInfo& info) { | 230 | const VideoCommon::ImageInfo& info) { |
| 231 | if (IsPixelFormatASTC(info.format)) { | 231 | if (IsPixelFormatASTC(info.format) && !runtime.HasNativeASTC()) { |
| 232 | return !runtime.HasNativeASTC() && Settings::values.accelerate_astc.GetValue(); | 232 | return Settings::values.accelerate_astc.GetValue() && |
| 233 | !Settings::values.async_astc.GetValue(); | ||
| 233 | } | 234 | } |
| 234 | // Disable other accelerated uploads for now as they don't implement swizzled uploads | 235 | // Disable other accelerated uploads for now as they don't implement swizzled uploads |
| 235 | return false; | 236 | return false; |
| @@ -258,6 +259,14 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::array<SwizzleSource, 4 | |||
| 258 | return format_info.compatibility_class == store_class; | 259 | return format_info.compatibility_class == store_class; |
| 259 | } | 260 | } |
| 260 | 261 | ||
| 262 | [[nodiscard]] bool CanBeDecodedAsync(const TextureCacheRuntime& runtime, | ||
| 263 | const VideoCommon::ImageInfo& info) { | ||
| 264 | if (IsPixelFormatASTC(info.format) && !runtime.HasNativeASTC()) { | ||
| 265 | return Settings::values.async_astc.GetValue(); | ||
| 266 | } | ||
| 267 | return false; | ||
| 268 | } | ||
| 269 | |||
| 261 | [[nodiscard]] CopyOrigin MakeCopyOrigin(VideoCommon::Offset3D offset, | 270 | [[nodiscard]] CopyOrigin MakeCopyOrigin(VideoCommon::Offset3D offset, |
| 262 | VideoCommon::SubresourceLayers subresource, GLenum target) { | 271 | VideoCommon::SubresourceLayers subresource, GLenum target) { |
| 263 | switch (target) { | 272 | switch (target) { |
| @@ -721,7 +730,9 @@ std::optional<size_t> TextureCacheRuntime::StagingBuffers::FindBuffer(size_t req | |||
| 721 | Image::Image(TextureCacheRuntime& runtime_, const VideoCommon::ImageInfo& info_, GPUVAddr gpu_addr_, | 730 | Image::Image(TextureCacheRuntime& runtime_, const VideoCommon::ImageInfo& info_, GPUVAddr gpu_addr_, |
| 722 | VAddr cpu_addr_) | 731 | VAddr cpu_addr_) |
| 723 | : VideoCommon::ImageBase(info_, gpu_addr_, cpu_addr_), runtime{&runtime_} { | 732 | : VideoCommon::ImageBase(info_, gpu_addr_, cpu_addr_), runtime{&runtime_} { |
| 724 | if (CanBeAccelerated(*runtime, info)) { | 733 | if (CanBeDecodedAsync(*runtime, info)) { |
| 734 | flags |= ImageFlagBits::AsynchronousDecode; | ||
| 735 | } else if (CanBeAccelerated(*runtime, info)) { | ||
| 725 | flags |= ImageFlagBits::AcceleratedUpload; | 736 | flags |= ImageFlagBits::AcceleratedUpload; |
| 726 | } | 737 | } |
| 727 | if (IsConverted(runtime->device, info.format, info.type)) { | 738 | if (IsConverted(runtime->device, info.format, info.type)) { |
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 9b85dfb5e..80adb70eb 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp | |||
| @@ -1256,11 +1256,12 @@ Image::Image(TextureCacheRuntime& runtime_, const ImageInfo& info_, GPUVAddr gpu | |||
| 1256 | commit(runtime_.memory_allocator.Commit(original_image, MemoryUsage::DeviceLocal)), | 1256 | commit(runtime_.memory_allocator.Commit(original_image, MemoryUsage::DeviceLocal)), |
| 1257 | aspect_mask(ImageAspectMask(info.format)) { | 1257 | aspect_mask(ImageAspectMask(info.format)) { |
| 1258 | if (IsPixelFormatASTC(info.format) && !runtime->device.IsOptimalAstcSupported()) { | 1258 | if (IsPixelFormatASTC(info.format) && !runtime->device.IsOptimalAstcSupported()) { |
| 1259 | if (Settings::values.accelerate_astc.GetValue()) { | 1259 | if (Settings::values.async_astc.GetValue()) { |
| 1260 | flags |= VideoCommon::ImageFlagBits::AsynchronousDecode; | ||
| 1261 | } else if (Settings::values.accelerate_astc.GetValue()) { | ||
| 1260 | flags |= VideoCommon::ImageFlagBits::AcceleratedUpload; | 1262 | flags |= VideoCommon::ImageFlagBits::AcceleratedUpload; |
| 1261 | } else { | ||
| 1262 | flags |= VideoCommon::ImageFlagBits::Converted; | ||
| 1263 | } | 1263 | } |
| 1264 | flags |= VideoCommon::ImageFlagBits::Converted; | ||
| 1264 | flags |= VideoCommon::ImageFlagBits::CostlyLoad; | 1265 | flags |= VideoCommon::ImageFlagBits::CostlyLoad; |
| 1265 | } | 1266 | } |
| 1266 | if (runtime->device.HasDebuggingToolAttached()) { | 1267 | if (runtime->device.HasDebuggingToolAttached()) { |
diff --git a/src/video_core/texture_cache/image_base.h b/src/video_core/texture_cache/image_base.h index 620565684..e8fa592d2 100644 --- a/src/video_core/texture_cache/image_base.h +++ b/src/video_core/texture_cache/image_base.h | |||
| @@ -38,6 +38,9 @@ enum class ImageFlagBits : u32 { | |||
| 38 | Rescaled = 1 << 13, | 38 | Rescaled = 1 << 13, |
| 39 | CheckingRescalable = 1 << 14, | 39 | CheckingRescalable = 1 << 14, |
| 40 | IsRescalable = 1 << 15, | 40 | IsRescalable = 1 << 15, |
| 41 | |||
| 42 | AsynchronousDecode = 1 << 16, | ||
| 43 | IsDecoding = 1 << 17, ///< Is currently being decoded asynchornously. | ||
| 41 | }; | 44 | }; |
| 42 | DECLARE_ENUM_FLAG_OPERATORS(ImageFlagBits) | 45 | DECLARE_ENUM_FLAG_OPERATORS(ImageFlagBits) |
| 43 | 46 | ||
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 3e2cbb0b0..9dd152fbe 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -85,6 +85,11 @@ void TextureCache<P>::RunGarbageCollector() { | |||
| 85 | } | 85 | } |
| 86 | --num_iterations; | 86 | --num_iterations; |
| 87 | auto& image = slot_images[image_id]; | 87 | auto& image = slot_images[image_id]; |
| 88 | if (True(image.flags & ImageFlagBits::IsDecoding)) { | ||
| 89 | // This image is still being decoded, deleting it will invalidate the slot | ||
| 90 | // used by the async decoder thread. | ||
| 91 | return false; | ||
| 92 | } | ||
| 88 | const bool must_download = | 93 | const bool must_download = |
| 89 | image.IsSafeDownload() && False(image.flags & ImageFlagBits::BadOverlap); | 94 | image.IsSafeDownload() && False(image.flags & ImageFlagBits::BadOverlap); |
| 90 | if (!high_priority_mode && | 95 | if (!high_priority_mode && |
| @@ -133,6 +138,8 @@ void TextureCache<P>::TickFrame() { | |||
| 133 | sentenced_images.Tick(); | 138 | sentenced_images.Tick(); |
| 134 | sentenced_framebuffers.Tick(); | 139 | sentenced_framebuffers.Tick(); |
| 135 | sentenced_image_view.Tick(); | 140 | sentenced_image_view.Tick(); |
| 141 | TickAsyncDecode(); | ||
| 142 | |||
| 136 | runtime.TickFrame(); | 143 | runtime.TickFrame(); |
| 137 | critical_gc = 0; | 144 | critical_gc = 0; |
| 138 | ++frame_tick; | 145 | ++frame_tick; |
| @@ -777,6 +784,10 @@ void TextureCache<P>::RefreshContents(Image& image, ImageId image_id) { | |||
| 777 | LOG_WARNING(HW_GPU, "MSAA image uploads are not implemented"); | 784 | LOG_WARNING(HW_GPU, "MSAA image uploads are not implemented"); |
| 778 | return; | 785 | return; |
| 779 | } | 786 | } |
| 787 | if (True(image.flags & ImageFlagBits::AsynchronousDecode)) { | ||
| 788 | QueueAsyncDecode(image, image_id); | ||
| 789 | return; | ||
| 790 | } | ||
| 780 | auto staging = runtime.UploadStagingBuffer(MapSizeBytes(image)); | 791 | auto staging = runtime.UploadStagingBuffer(MapSizeBytes(image)); |
| 781 | UploadImageContents(image, staging); | 792 | UploadImageContents(image, staging); |
| 782 | runtime.InsertUploadMemoryBarrier(); | 793 | runtime.InsertUploadMemoryBarrier(); |
| @@ -990,6 +1001,65 @@ u64 TextureCache<P>::GetScaledImageSizeBytes(const ImageBase& image) { | |||
| 990 | } | 1001 | } |
| 991 | 1002 | ||
| 992 | template <class P> | 1003 | template <class P> |
| 1004 | void TextureCache<P>::QueueAsyncDecode(Image& image, ImageId image_id) { | ||
| 1005 | UNIMPLEMENTED_IF(False(image.flags & ImageFlagBits::Converted)); | ||
| 1006 | LOG_INFO(HW_GPU, "Queuing async texture decode"); | ||
| 1007 | |||
| 1008 | image.flags |= ImageFlagBits::IsDecoding; | ||
| 1009 | auto decode = std::make_unique<AsyncDecodeContext>(); | ||
| 1010 | auto* decode_ptr = decode.get(); | ||
| 1011 | decode->image_id = image_id; | ||
| 1012 | async_decodes.push_back(std::move(decode)); | ||
| 1013 | |||
| 1014 | Common::ScratchBuffer<u8> local_unswizzle_data_buffer(image.unswizzled_size_bytes); | ||
| 1015 | const size_t guest_size_bytes = image.guest_size_bytes; | ||
| 1016 | swizzle_data_buffer.resize_destructive(guest_size_bytes); | ||
| 1017 | gpu_memory->ReadBlockUnsafe(image.gpu_addr, swizzle_data_buffer.data(), guest_size_bytes); | ||
| 1018 | auto copies = UnswizzleImage(*gpu_memory, image.gpu_addr, image.info, swizzle_data_buffer, | ||
| 1019 | local_unswizzle_data_buffer); | ||
| 1020 | const size_t out_size = MapSizeBytes(image); | ||
| 1021 | |||
| 1022 | auto func = [out_size, copies, info = image.info, | ||
| 1023 | input = std::move(local_unswizzle_data_buffer), | ||
| 1024 | async_decode = decode_ptr]() mutable { | ||
| 1025 | async_decode->decoded_data.resize_destructive(out_size); | ||
| 1026 | std::span copies_span{copies.data(), copies.size()}; | ||
| 1027 | ConvertImage(input, info, async_decode->decoded_data, copies_span); | ||
| 1028 | |||
| 1029 | // TODO: Do we need this lock? | ||
| 1030 | std::unique_lock lock{async_decode->mutex}; | ||
| 1031 | async_decode->copies = std::move(copies); | ||
| 1032 | async_decode->complete = true; | ||
| 1033 | }; | ||
| 1034 | texture_decode_worker.QueueWork(std::move(func)); | ||
| 1035 | } | ||
| 1036 | |||
| 1037 | template <class P> | ||
| 1038 | void TextureCache<P>::TickAsyncDecode() { | ||
| 1039 | bool has_uploads{}; | ||
| 1040 | auto i = async_decodes.begin(); | ||
| 1041 | while (i != async_decodes.end()) { | ||
| 1042 | auto* async_decode = i->get(); | ||
| 1043 | std::unique_lock lock{async_decode->mutex}; | ||
| 1044 | if (!async_decode->complete) { | ||
| 1045 | ++i; | ||
| 1046 | continue; | ||
| 1047 | } | ||
| 1048 | Image& image = slot_images[async_decode->image_id]; | ||
| 1049 | auto staging = runtime.UploadStagingBuffer(MapSizeBytes(image)); | ||
| 1050 | std::memcpy(staging.mapped_span.data(), async_decode->decoded_data.data(), | ||
| 1051 | async_decode->decoded_data.size()); | ||
| 1052 | image.UploadMemory(staging, async_decode->copies); | ||
| 1053 | image.flags &= ~ImageFlagBits::IsDecoding; | ||
| 1054 | has_uploads = true; | ||
| 1055 | i = async_decodes.erase(i); | ||
| 1056 | } | ||
| 1057 | if (has_uploads) { | ||
| 1058 | runtime.InsertUploadMemoryBarrier(); | ||
| 1059 | } | ||
| 1060 | } | ||
| 1061 | |||
| 1062 | template <class P> | ||
| 993 | bool TextureCache<P>::ScaleUp(Image& image) { | 1063 | bool TextureCache<P>::ScaleUp(Image& image) { |
| 994 | const bool has_copy = image.HasScaled(); | 1064 | const bool has_copy = image.HasScaled(); |
| 995 | const bool rescaled = image.ScaleUp(); | 1065 | const bool rescaled = image.ScaleUp(); |
diff --git a/src/video_core/texture_cache/texture_cache_base.h b/src/video_core/texture_cache/texture_cache_base.h index 485eaabaa..013836933 100644 --- a/src/video_core/texture_cache/texture_cache_base.h +++ b/src/video_core/texture_cache/texture_cache_base.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <atomic> | ||
| 6 | #include <deque> | 7 | #include <deque> |
| 7 | #include <limits> | 8 | #include <limits> |
| 8 | #include <mutex> | 9 | #include <mutex> |
| @@ -18,6 +19,7 @@ | |||
| 18 | #include "common/lru_cache.h" | 19 | #include "common/lru_cache.h" |
| 19 | #include "common/polyfill_ranges.h" | 20 | #include "common/polyfill_ranges.h" |
| 20 | #include "common/scratch_buffer.h" | 21 | #include "common/scratch_buffer.h" |
| 22 | #include "common/thread_worker.h" | ||
| 21 | #include "video_core/compatible_formats.h" | 23 | #include "video_core/compatible_formats.h" |
| 22 | #include "video_core/control/channel_state_cache.h" | 24 | #include "video_core/control/channel_state_cache.h" |
| 23 | #include "video_core/delayed_destruction_ring.h" | 25 | #include "video_core/delayed_destruction_ring.h" |
| @@ -54,6 +56,14 @@ struct ImageViewInOut { | |||
| 54 | ImageViewId id{}; | 56 | ImageViewId id{}; |
| 55 | }; | 57 | }; |
| 56 | 58 | ||
| 59 | struct AsyncDecodeContext { | ||
| 60 | ImageId image_id; | ||
| 61 | Common::ScratchBuffer<u8> decoded_data; | ||
| 62 | std::vector<BufferImageCopy> copies; | ||
| 63 | std::mutex mutex; | ||
| 64 | std::atomic_bool complete; | ||
| 65 | }; | ||
| 66 | |||
| 57 | using TextureCacheGPUMap = std::unordered_map<u64, std::vector<ImageId>, Common::IdentityHash<u64>>; | 67 | using TextureCacheGPUMap = std::unordered_map<u64, std::vector<ImageId>, Common::IdentityHash<u64>>; |
| 58 | 68 | ||
| 59 | class TextureCacheChannelInfo : public ChannelInfo { | 69 | class TextureCacheChannelInfo : public ChannelInfo { |
| @@ -377,6 +387,9 @@ private: | |||
| 377 | bool ScaleDown(Image& image); | 387 | bool ScaleDown(Image& image); |
| 378 | u64 GetScaledImageSizeBytes(const ImageBase& image); | 388 | u64 GetScaledImageSizeBytes(const ImageBase& image); |
| 379 | 389 | ||
| 390 | void QueueAsyncDecode(Image& image, ImageId image_id); | ||
| 391 | void TickAsyncDecode(); | ||
| 392 | |||
| 380 | Runtime& runtime; | 393 | Runtime& runtime; |
| 381 | 394 | ||
| 382 | VideoCore::RasterizerInterface& rasterizer; | 395 | VideoCore::RasterizerInterface& rasterizer; |
| @@ -430,6 +443,9 @@ private: | |||
| 430 | 443 | ||
| 431 | u64 modification_tick = 0; | 444 | u64 modification_tick = 0; |
| 432 | u64 frame_tick = 0; | 445 | u64 frame_tick = 0; |
| 446 | |||
| 447 | Common::ThreadWorker texture_decode_worker{1, "TextureDecoder"}; | ||
| 448 | std::vector<std::unique_ptr<AsyncDecodeContext>> async_decodes; | ||
| 433 | }; | 449 | }; |
| 434 | 450 | ||
| 435 | } // namespace VideoCommon | 451 | } // namespace VideoCommon |
diff --git a/src/video_core/textures/astc.cpp b/src/video_core/textures/astc.cpp index e8d7c7863..4381eed1d 100644 --- a/src/video_core/textures/astc.cpp +++ b/src/video_core/textures/astc.cpp | |||
| @@ -1656,8 +1656,8 @@ void Decompress(std::span<const uint8_t> data, uint32_t width, uint32_t height, | |||
| 1656 | const u32 rows = Common::DivideUp(height, block_height); | 1656 | const u32 rows = Common::DivideUp(height, block_height); |
| 1657 | const u32 cols = Common::DivideUp(width, block_width); | 1657 | const u32 cols = Common::DivideUp(width, block_width); |
| 1658 | 1658 | ||
| 1659 | Common::ThreadWorker workers{std::max(std::thread::hardware_concurrency(), 2U) / 2, | 1659 | static Common::ThreadWorker workers{std::max(std::thread::hardware_concurrency(), 2U) / 2, |
| 1660 | "ASTCDecompress"}; | 1660 | "ASTCDecompress"}; |
| 1661 | 1661 | ||
| 1662 | for (u32 z = 0; z < depth; ++z) { | 1662 | for (u32 z = 0; z < depth; ++z) { |
| 1663 | const u32 depth_offset = z * height * width * 4; | 1663 | const u32 depth_offset = z * height * width * 4; |
diff --git a/src/web_service/web_backend.cpp b/src/web_service/web_backend.cpp index 12a7e4922..dff380cca 100644 --- a/src/web_service/web_backend.cpp +++ b/src/web_service/web_backend.cpp | |||
| @@ -71,7 +71,7 @@ struct Client::Impl { | |||
| 71 | const std::string& jwt_ = "", const std::string& username_ = "", | 71 | const std::string& jwt_ = "", const std::string& username_ = "", |
| 72 | const std::string& token_ = "") { | 72 | const std::string& token_ = "") { |
| 73 | if (cli == nullptr) { | 73 | if (cli == nullptr) { |
| 74 | cli = std::make_unique<httplib::Client>(host.c_str()); | 74 | cli = std::make_unique<httplib::Client>(host); |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | if (!cli->is_valid()) { | 77 | if (!cli->is_valid()) { |
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index 06d982d9b..0f8c1e6a6 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt | |||
| @@ -314,7 +314,7 @@ endif() | |||
| 314 | create_target_directory_groups(yuzu) | 314 | create_target_directory_groups(yuzu) |
| 315 | 315 | ||
| 316 | target_link_libraries(yuzu PRIVATE common core input_common network video_core) | 316 | target_link_libraries(yuzu PRIVATE common core input_common network video_core) |
| 317 | target_link_libraries(yuzu PRIVATE Boost::boost glad Qt${QT_MAJOR_VERSION}::Widgets) | 317 | target_link_libraries(yuzu PRIVATE Boost::headers glad Qt${QT_MAJOR_VERSION}::Widgets) |
| 318 | target_link_libraries(yuzu PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads) | 318 | target_link_libraries(yuzu PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads) |
| 319 | 319 | ||
| 320 | target_link_libraries(yuzu PRIVATE Vulkan::Headers) | 320 | target_link_libraries(yuzu PRIVATE Vulkan::Headers) |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index db68ed259..bb731276e 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -707,6 +707,7 @@ void Config::ReadRendererValues() { | |||
| 707 | ReadGlobalSetting(Settings::values.use_asynchronous_gpu_emulation); | 707 | ReadGlobalSetting(Settings::values.use_asynchronous_gpu_emulation); |
| 708 | ReadGlobalSetting(Settings::values.nvdec_emulation); | 708 | ReadGlobalSetting(Settings::values.nvdec_emulation); |
| 709 | ReadGlobalSetting(Settings::values.accelerate_astc); | 709 | ReadGlobalSetting(Settings::values.accelerate_astc); |
| 710 | ReadGlobalSetting(Settings::values.async_astc); | ||
| 710 | ReadGlobalSetting(Settings::values.use_vsync); | 711 | ReadGlobalSetting(Settings::values.use_vsync); |
| 711 | ReadGlobalSetting(Settings::values.shader_backend); | 712 | ReadGlobalSetting(Settings::values.shader_backend); |
| 712 | ReadGlobalSetting(Settings::values.use_asynchronous_shaders); | 713 | ReadGlobalSetting(Settings::values.use_asynchronous_shaders); |
| @@ -1312,9 +1313,7 @@ void Config::SaveRendererValues() { | |||
| 1312 | static_cast<u32>(Settings::values.renderer_backend.GetValue(global)), | 1313 | static_cast<u32>(Settings::values.renderer_backend.GetValue(global)), |
| 1313 | static_cast<u32>(Settings::values.renderer_backend.GetDefault()), | 1314 | static_cast<u32>(Settings::values.renderer_backend.GetDefault()), |
| 1314 | Settings::values.renderer_backend.UsingGlobal()); | 1315 | Settings::values.renderer_backend.UsingGlobal()); |
| 1315 | WriteSetting(QString::fromStdString(Settings::values.renderer_force_max_clock.GetLabel()), | 1316 | WriteGlobalSetting(Settings::values.renderer_force_max_clock); |
| 1316 | static_cast<u32>(Settings::values.renderer_force_max_clock.GetValue(global)), | ||
| 1317 | static_cast<u32>(Settings::values.renderer_force_max_clock.GetDefault())); | ||
| 1318 | WriteGlobalSetting(Settings::values.vulkan_device); | 1317 | WriteGlobalSetting(Settings::values.vulkan_device); |
| 1319 | WriteSetting(QString::fromStdString(Settings::values.fullscreen_mode.GetLabel()), | 1318 | WriteSetting(QString::fromStdString(Settings::values.fullscreen_mode.GetLabel()), |
| 1320 | static_cast<u32>(Settings::values.fullscreen_mode.GetValue(global)), | 1319 | static_cast<u32>(Settings::values.fullscreen_mode.GetValue(global)), |
| @@ -1350,6 +1349,7 @@ void Config::SaveRendererValues() { | |||
| 1350 | static_cast<u32>(Settings::values.nvdec_emulation.GetDefault()), | 1349 | static_cast<u32>(Settings::values.nvdec_emulation.GetDefault()), |
| 1351 | Settings::values.nvdec_emulation.UsingGlobal()); | 1350 | Settings::values.nvdec_emulation.UsingGlobal()); |
| 1352 | WriteGlobalSetting(Settings::values.accelerate_astc); | 1351 | WriteGlobalSetting(Settings::values.accelerate_astc); |
| 1352 | WriteGlobalSetting(Settings::values.async_astc); | ||
| 1353 | WriteGlobalSetting(Settings::values.use_vsync); | 1353 | WriteGlobalSetting(Settings::values.use_vsync); |
| 1354 | WriteSetting(QString::fromStdString(Settings::values.shader_backend.GetLabel()), | 1354 | WriteSetting(QString::fromStdString(Settings::values.shader_backend.GetLabel()), |
| 1355 | static_cast<u32>(Settings::values.shader_backend.GetValue(global)), | 1355 | static_cast<u32>(Settings::values.shader_backend.GetValue(global)), |
diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp index cc0155a2c..59fb1b334 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.cpp +++ b/src/yuzu/configuration/configure_graphics_advanced.cpp | |||
| @@ -23,11 +23,13 @@ void ConfigureGraphicsAdvanced::SetConfiguration() { | |||
| 23 | const bool runtime_lock = !system.IsPoweredOn(); | 23 | const bool runtime_lock = !system.IsPoweredOn(); |
| 24 | ui->use_vsync->setEnabled(runtime_lock); | 24 | ui->use_vsync->setEnabled(runtime_lock); |
| 25 | ui->renderer_force_max_clock->setEnabled(runtime_lock); | 25 | ui->renderer_force_max_clock->setEnabled(runtime_lock); |
| 26 | ui->async_astc->setEnabled(runtime_lock); | ||
| 26 | ui->use_asynchronous_shaders->setEnabled(runtime_lock); | 27 | ui->use_asynchronous_shaders->setEnabled(runtime_lock); |
| 27 | ui->anisotropic_filtering_combobox->setEnabled(runtime_lock); | 28 | ui->anisotropic_filtering_combobox->setEnabled(runtime_lock); |
| 28 | 29 | ||
| 29 | ui->renderer_force_max_clock->setChecked(Settings::values.renderer_force_max_clock.GetValue()); | 30 | ui->renderer_force_max_clock->setChecked(Settings::values.renderer_force_max_clock.GetValue()); |
| 30 | ui->use_vsync->setChecked(Settings::values.use_vsync.GetValue()); | 31 | ui->use_vsync->setChecked(Settings::values.use_vsync.GetValue()); |
| 32 | ui->async_astc->setChecked(Settings::values.async_astc.GetValue()); | ||
| 31 | ui->use_asynchronous_shaders->setChecked(Settings::values.use_asynchronous_shaders.GetValue()); | 33 | ui->use_asynchronous_shaders->setChecked(Settings::values.use_asynchronous_shaders.GetValue()); |
| 32 | ui->use_fast_gpu_time->setChecked(Settings::values.use_fast_gpu_time.GetValue()); | 34 | ui->use_fast_gpu_time->setChecked(Settings::values.use_fast_gpu_time.GetValue()); |
| 33 | ui->use_pessimistic_flushes->setChecked(Settings::values.use_pessimistic_flushes.GetValue()); | 35 | ui->use_pessimistic_flushes->setChecked(Settings::values.use_pessimistic_flushes.GetValue()); |
| @@ -45,8 +47,6 @@ void ConfigureGraphicsAdvanced::SetConfiguration() { | |||
| 45 | &Settings::values.max_anisotropy); | 47 | &Settings::values.max_anisotropy); |
| 46 | ConfigurationShared::SetHighlight(ui->label_gpu_accuracy, | 48 | ConfigurationShared::SetHighlight(ui->label_gpu_accuracy, |
| 47 | !Settings::values.gpu_accuracy.UsingGlobal()); | 49 | !Settings::values.gpu_accuracy.UsingGlobal()); |
| 48 | ConfigurationShared::SetHighlight(ui->renderer_force_max_clock, | ||
| 49 | !Settings::values.renderer_force_max_clock.UsingGlobal()); | ||
| 50 | ConfigurationShared::SetHighlight(ui->af_label, | 50 | ConfigurationShared::SetHighlight(ui->af_label, |
| 51 | !Settings::values.max_anisotropy.UsingGlobal()); | 51 | !Settings::values.max_anisotropy.UsingGlobal()); |
| 52 | } | 52 | } |
| @@ -60,6 +60,8 @@ void ConfigureGraphicsAdvanced::ApplyConfiguration() { | |||
| 60 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy, | 60 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy, |
| 61 | ui->anisotropic_filtering_combobox); | 61 | ui->anisotropic_filtering_combobox); |
| 62 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync, use_vsync); | 62 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync, use_vsync); |
| 63 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.async_astc, ui->async_astc, | ||
| 64 | async_astc); | ||
| 63 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_shaders, | 65 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_shaders, |
| 64 | ui->use_asynchronous_shaders, | 66 | ui->use_asynchronous_shaders, |
| 65 | use_asynchronous_shaders); | 67 | use_asynchronous_shaders); |
| @@ -91,6 +93,7 @@ void ConfigureGraphicsAdvanced::SetupPerGameUI() { | |||
| 91 | ui->renderer_force_max_clock->setEnabled( | 93 | ui->renderer_force_max_clock->setEnabled( |
| 92 | Settings::values.renderer_force_max_clock.UsingGlobal()); | 94 | Settings::values.renderer_force_max_clock.UsingGlobal()); |
| 93 | ui->use_vsync->setEnabled(Settings::values.use_vsync.UsingGlobal()); | 95 | ui->use_vsync->setEnabled(Settings::values.use_vsync.UsingGlobal()); |
| 96 | ui->async_astc->setEnabled(Settings::values.async_astc.UsingGlobal()); | ||
| 94 | ui->use_asynchronous_shaders->setEnabled( | 97 | ui->use_asynchronous_shaders->setEnabled( |
| 95 | Settings::values.use_asynchronous_shaders.UsingGlobal()); | 98 | Settings::values.use_asynchronous_shaders.UsingGlobal()); |
| 96 | ui->use_fast_gpu_time->setEnabled(Settings::values.use_fast_gpu_time.UsingGlobal()); | 99 | ui->use_fast_gpu_time->setEnabled(Settings::values.use_fast_gpu_time.UsingGlobal()); |
| @@ -108,6 +111,8 @@ void ConfigureGraphicsAdvanced::SetupPerGameUI() { | |||
| 108 | Settings::values.renderer_force_max_clock, | 111 | Settings::values.renderer_force_max_clock, |
| 109 | renderer_force_max_clock); | 112 | renderer_force_max_clock); |
| 110 | ConfigurationShared::SetColoredTristate(ui->use_vsync, Settings::values.use_vsync, use_vsync); | 113 | ConfigurationShared::SetColoredTristate(ui->use_vsync, Settings::values.use_vsync, use_vsync); |
| 114 | ConfigurationShared::SetColoredTristate(ui->async_astc, Settings::values.async_astc, | ||
| 115 | async_astc); | ||
| 111 | ConfigurationShared::SetColoredTristate(ui->use_asynchronous_shaders, | 116 | ConfigurationShared::SetColoredTristate(ui->use_asynchronous_shaders, |
| 112 | Settings::values.use_asynchronous_shaders, | 117 | Settings::values.use_asynchronous_shaders, |
| 113 | use_asynchronous_shaders); | 118 | use_asynchronous_shaders); |
diff --git a/src/yuzu/configuration/configure_graphics_advanced.h b/src/yuzu/configuration/configure_graphics_advanced.h index df557d585..bf1b04749 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.h +++ b/src/yuzu/configuration/configure_graphics_advanced.h | |||
| @@ -38,6 +38,7 @@ private: | |||
| 38 | 38 | ||
| 39 | ConfigurationShared::CheckState renderer_force_max_clock; | 39 | ConfigurationShared::CheckState renderer_force_max_clock; |
| 40 | ConfigurationShared::CheckState use_vsync; | 40 | ConfigurationShared::CheckState use_vsync; |
| 41 | ConfigurationShared::CheckState async_astc; | ||
| 41 | ConfigurationShared::CheckState use_asynchronous_shaders; | 42 | ConfigurationShared::CheckState use_asynchronous_shaders; |
| 42 | ConfigurationShared::CheckState use_fast_gpu_time; | 43 | ConfigurationShared::CheckState use_fast_gpu_time; |
| 43 | ConfigurationShared::CheckState use_pessimistic_flushes; | 44 | ConfigurationShared::CheckState use_pessimistic_flushes; |
diff --git a/src/yuzu/configuration/configure_graphics_advanced.ui b/src/yuzu/configuration/configure_graphics_advanced.ui index 061885e30..a7dbdc18c 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.ui +++ b/src/yuzu/configuration/configure_graphics_advanced.ui | |||
| @@ -90,6 +90,16 @@ | |||
| 90 | </widget> | 90 | </widget> |
| 91 | </item> | 91 | </item> |
| 92 | <item> | 92 | <item> |
| 93 | <widget class="QCheckBox" name="async_astc"> | ||
| 94 | <property name="toolTip"> | ||
| 95 | <string>Enables asynchronous ASTC texture decoding, which may reduce load time stutter. This feature is experimental.</string> | ||
| 96 | </property> | ||
| 97 | <property name="text"> | ||
| 98 | <string>Decode ASTC textures asynchronously (Hack)</string> | ||
| 99 | </property> | ||
| 100 | </widget> | ||
| 101 | </item> | ||
| 102 | <item> | ||
| 93 | <widget class="QCheckBox" name="use_asynchronous_shaders"> | 103 | <widget class="QCheckBox" name="use_asynchronous_shaders"> |
| 94 | <property name="toolTip"> | 104 | <property name="toolTip"> |
| 95 | <string>Enables asynchronous shader compilation, which may reduce shader stutter. This feature is experimental.</string> | 105 | <string>Enables asynchronous shader compilation, which may reduce shader stutter. This feature is experimental.</string> |
diff --git a/src/yuzu/discord_impl.cpp b/src/yuzu/discord_impl.cpp index de0c307d4..ac2fc1bcb 100644 --- a/src/yuzu/discord_impl.cpp +++ b/src/yuzu/discord_impl.cpp | |||
| @@ -75,8 +75,10 @@ void DiscordImpl::Update() { | |||
| 75 | 75 | ||
| 76 | // New Check for game cover | 76 | // New Check for game cover |
| 77 | httplib::Client cli(game_cover_url); | 77 | httplib::Client cli(game_cover_url); |
| 78 | cli.set_connection_timeout(std::chrono::seconds(3)); | ||
| 79 | cli.set_read_timeout(std::chrono::seconds(3)); | ||
| 78 | 80 | ||
| 79 | if (auto res = cli.Head(fmt::format("/images/game/boxart/{}.png", icon_name).c_str())) { | 81 | if (auto res = cli.Head(fmt::format("/images/game/boxart/{}.png", icon_name))) { |
| 80 | if (res->status == 200) { | 82 | if (res->status == 200) { |
| 81 | game_cover_url += fmt::format("/images/game/boxart/{}.png", icon_name); | 83 | game_cover_url += fmt::format("/images/game/boxart/{}.png", icon_name); |
| 82 | } else { | 84 | } else { |
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index 3b6dce296..464da3231 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp | |||
| @@ -324,6 +324,7 @@ void Config::ReadValues() { | |||
| 324 | ReadSetting("Renderer", Settings::values.use_asynchronous_shaders); | 324 | ReadSetting("Renderer", Settings::values.use_asynchronous_shaders); |
| 325 | ReadSetting("Renderer", Settings::values.nvdec_emulation); | 325 | ReadSetting("Renderer", Settings::values.nvdec_emulation); |
| 326 | ReadSetting("Renderer", Settings::values.accelerate_astc); | 326 | ReadSetting("Renderer", Settings::values.accelerate_astc); |
| 327 | ReadSetting("Renderer", Settings::values.async_astc); | ||
| 327 | ReadSetting("Renderer", Settings::values.use_fast_gpu_time); | 328 | ReadSetting("Renderer", Settings::values.use_fast_gpu_time); |
| 328 | ReadSetting("Renderer", Settings::values.use_pessimistic_flushes); | 329 | ReadSetting("Renderer", Settings::values.use_pessimistic_flushes); |
| 329 | ReadSetting("Renderer", Settings::values.use_vulkan_driver_pipeline_cache); | 330 | ReadSetting("Renderer", Settings::values.use_vulkan_driver_pipeline_cache); |
diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h index cf3cc4c4e..20e403400 100644 --- a/src/yuzu_cmd/default_ini.h +++ b/src/yuzu_cmd/default_ini.h | |||
| @@ -342,6 +342,10 @@ nvdec_emulation = | |||
| 342 | # 0: Off, 1 (default): On | 342 | # 0: Off, 1 (default): On |
| 343 | accelerate_astc = | 343 | accelerate_astc = |
| 344 | 344 | ||
| 345 | # Decode ASTC textures asynchronously. | ||
| 346 | # 0 (default): Off, 1: On | ||
| 347 | async_astc = | ||
| 348 | |||
| 345 | # Turns on the speed limiter, which will limit the emulation speed to the desired speed limit value | 349 | # Turns on the speed limiter, which will limit the emulation speed to the desired speed limit value |
| 346 | # 0: Off, 1: On (default) | 350 | # 0: Off, 1: On (default) |
| 347 | use_speed_limit = | 351 | use_speed_limit = |