Compare commits
40 Commits
__refs_pul
...
__refs_pul
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4629edca38 | ||
|
|
a78a475815 | ||
|
|
22432668be | ||
|
|
50575c317e | ||
|
|
5f2cbf53d7 | ||
|
|
c38bb96a2c | ||
|
|
71ca956d5c | ||
|
|
2b4ba90329 | ||
|
|
ff11fdb07e | ||
|
|
26c1edf2f0 | ||
|
|
c50a930bbb | ||
|
|
60688bf0d5 | ||
|
|
833afb7ce3 | ||
|
|
290ec3eb2f | ||
|
|
d5bfc36e90 | ||
|
|
5eeadde3c8 | ||
|
|
cfd69e2e58 | ||
|
|
5e4ea04a64 | ||
|
|
39ca7b2928 | ||
|
|
975186ad4d | ||
|
|
de4e5db330 | ||
|
|
ca8a804a3c | ||
|
|
b5bcd8c71b | ||
|
|
090bc588e5 | ||
|
|
739a81055f | ||
|
|
673accd630 | ||
|
|
db2785082b | ||
|
|
9477181d09 | ||
|
|
8f3e2a1b48 | ||
|
|
d482ec32a4 | ||
|
|
2bf9602e83 | ||
|
|
11f6bb1532 | ||
|
|
ba05301e1b | ||
|
|
5a657488e1 | ||
|
|
c9678bda24 | ||
|
|
83afc12475 | ||
|
|
d746cfc018 | ||
|
|
89221ca7d5 | ||
|
|
70f7ff3db5 | ||
|
|
caa25146f2 |
@@ -9,7 +9,7 @@ parameters:
|
||||
steps:
|
||||
- script: choco install vulkan-sdk
|
||||
displayName: 'Install vulkan-sdk'
|
||||
- script: refreshenv && mkdir build && cd build && cmake -E env CXXFLAGS="/Gw /GA /Gr /Ob2" cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DCMAKE_POLICY_DEFAULT_CMP0069=NEW -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_SDL2=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DYUZU_TESTS=OFF -DUSE_DISCORD_PRESENCE=ON -DENABLE_QT_TRANSLATION=ON -DDISPLAY_VERSION=${{ parameters['version'] }} -DCMAKE_BUILD_TYPE=Release -DYUZU_CRASH_DUMPS=ON .. && cd ..
|
||||
- script: refreshenv && mkdir build && cd build && cmake -E env CXXFLAGS="/Gw /GA /Gr /Ob2" cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_POLICY_DEFAULT_CMP0069=NEW -DENABLE_LTO=ON -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_SDL2=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DYUZU_TESTS=OFF -DUSE_DISCORD_PRESENCE=ON -DENABLE_QT_TRANSLATION=ON -DDISPLAY_VERSION=${{ parameters['version'] }} -DCMAKE_BUILD_TYPE=Release -DYUZU_CRASH_DUMPS=ON .. && cd ..
|
||||
displayName: 'Configure CMake'
|
||||
- task: MSBuild@1
|
||||
displayName: 'Build'
|
||||
|
||||
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -30,7 +30,7 @@
|
||||
url = https://github.com/yuzu-emu/sirit
|
||||
[submodule "mbedtls"]
|
||||
path = externals/mbedtls
|
||||
url = https://github.com/yuzu-emu/mbedtls
|
||||
url = https://github.com/Mbed-TLS/mbedtls
|
||||
[submodule "xbyak"]
|
||||
path = externals/xbyak
|
||||
url = https://github.com/herumi/xbyak.git
|
||||
|
||||
@@ -56,6 +56,8 @@ option(YUZU_USE_BUNDLED_VCPKG "Use vcpkg for yuzu dependencies" "${MSVC}")
|
||||
|
||||
option(YUZU_CHECK_SUBMODULES "Check if submodules are present" ON)
|
||||
|
||||
option(YUZU_ENABLE_LTO "Enable link-time optimization" OFF)
|
||||
|
||||
CMAKE_DEPENDENT_OPTION(YUZU_USE_FASTER_LD "Check if a faster linker is available" ON "NOT WIN32" OFF)
|
||||
|
||||
if (YUZU_USE_BUNDLED_VCPKG)
|
||||
@@ -241,7 +243,10 @@ endif()
|
||||
|
||||
if (ENABLE_WEB_SERVICE)
|
||||
find_package(cpp-jwt 1.4 CONFIG)
|
||||
find_package(httplib 0.11 MODULE)
|
||||
find_package(httplib 0.12 MODULE)
|
||||
if (NOT cpp-jwt_FOUND OR NOT httplib_FOUND)
|
||||
find_package(OpenSSL 1.1 MODULE COMPONENTS Crypto SSL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (YUZU_TESTS)
|
||||
|
||||
43
CMakeModules/FindMbedTLS.cmake
Normal file
43
CMakeModules/FindMbedTLS.cmake
Normal file
@@ -0,0 +1,43 @@
|
||||
# SPDX-FileCopyrightText: 2021 Andrea Pappacoda <andrea@pappacoda.it>
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# MbedTLS 3.0.0 will ship with a CMake package config file,
|
||||
# see ARMmbed/mbedtls@d259e347e6e3a630acfc1a811709ca05e5d3b92e,
|
||||
# so when yuzu will switch to that version this won't be required anymore.
|
||||
#
|
||||
# yuzu only uses mbedcrypto, searching for mbedtls and mbedx509 is not
|
||||
# needed.
|
||||
|
||||
find_path(MbedTLS_INCLUDE_DIR mbedtls/cipher.h)
|
||||
|
||||
find_library(MbedTLS_LIBRARY mbedcrypto)
|
||||
|
||||
if (MbedTLS_INCLUDE_DIR AND MbedTLS_LIBRARY)
|
||||
# Check for CMAC support
|
||||
include(CheckSymbolExists)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${MbedTLS_LIBRARY})
|
||||
check_symbol_exists(mbedtls_cipher_cmac ${MbedTLS_INCLUDE_DIR}/mbedtls/cmac.h mbedcrypto_HAS_CMAC)
|
||||
unset(CMAKE_REQUIRED_LIBRARIES)
|
||||
|
||||
# Check if version 2.x is available
|
||||
file(READ "${MbedTLS_INCLUDE_DIR}/mbedtls/version.h" MbedTLS_VERSION_FILE)
|
||||
string(REGEX MATCH "#define[ ]+MBEDTLS_VERSION_STRING[ ]+\"([0-9.]+)\"" _ ${MbedTLS_VERSION_FILE})
|
||||
set(MbedTLS_VERSION "${CMAKE_MATCH_1}")
|
||||
|
||||
if (NOT TARGET MbedTLS::mbedcrypto)
|
||||
add_library(MbedTLS::mbedcrypto UNKNOWN IMPORTED GLOBAL)
|
||||
set_target_properties(MbedTLS::mbedcrypto PROPERTIES
|
||||
IMPORTED_LOCATION "${MbedTLS_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${MbedTLS_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(MbedTLS
|
||||
REQUIRED_VARS
|
||||
MbedTLS_LIBRARY
|
||||
MbedTLS_INCLUDE_DIR
|
||||
mbedcrypto_HAS_CMAC
|
||||
VERSION_VAR MbedTLS_VERSION
|
||||
)
|
||||
38
externals/CMakeLists.txt
vendored
38
externals/CMakeLists.txt
vendored
@@ -33,9 +33,23 @@ if (NOT TARGET inih::INIReader)
|
||||
add_subdirectory(inih)
|
||||
endif()
|
||||
|
||||
# mbedtls
|
||||
add_subdirectory(mbedtls EXCLUDE_FROM_ALL)
|
||||
target_include_directories(mbedtls PUBLIC ./mbedtls/include)
|
||||
# MbedTLS
|
||||
find_package(MbedTLS 2.16)
|
||||
if(NOT MbedTLS_FOUND)
|
||||
message(STATUS "MbedTLS not found, falling back to externals")
|
||||
|
||||
set(ENABLE_PROGRAMS OFF CACHE BOOL "")
|
||||
set(ENABLE_TESTING OFF CACHE BOOL "")
|
||||
|
||||
# Edit MbedTLS config header to enable CMAC
|
||||
file(READ "./mbedtls/include/mbedtls/config.h" MbedTLS_CONFIG_FILE)
|
||||
string(REPLACE "//#define MBEDTLS_CMAC_C" "#define MBEDTLS_CMAC_C" MbedTLS_CONFIG_FILE_CMAC "${MbedTLS_CONFIG_FILE}")
|
||||
file(WRITE "./mbedtls/include/mbedtls/config.h" "${MbedTLS_CONFIG_FILE_CMAC}")
|
||||
|
||||
add_subdirectory(mbedtls EXCLUDE_FROM_ALL)
|
||||
target_include_directories(mbedcrypto PUBLIC ./mbedtls/include)
|
||||
add_library(MbedTLS::mbedcrypto ALIAS mbedcrypto)
|
||||
endif()
|
||||
|
||||
# MicroProfile
|
||||
add_library(microprofile INTERFACE)
|
||||
@@ -100,17 +114,9 @@ endif()
|
||||
# Sirit
|
||||
add_subdirectory(sirit EXCLUDE_FROM_ALL)
|
||||
|
||||
# httplib
|
||||
if (ENABLE_WEB_SERVICE AND NOT TARGET httplib::httplib)
|
||||
if (NOT WIN32)
|
||||
find_package(OpenSSL 1.1)
|
||||
if (OPENSSL_FOUND)
|
||||
set(OPENSSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# LibreSSL
|
||||
if (ENABLE_WEB_SERVICE AND DEFINED OPENSSL_FOUND)
|
||||
if (WIN32 OR NOT OPENSSL_FOUND)
|
||||
# LibreSSL
|
||||
set(LIBRESSL_SKIP_INSTALL ON)
|
||||
set(OPENSSLDIR "/etc/ssl/")
|
||||
add_subdirectory(libressl EXCLUDE_FROM_ALL)
|
||||
@@ -119,8 +125,13 @@ if (ENABLE_WEB_SERVICE AND NOT TARGET httplib::httplib)
|
||||
get_directory_property(OPENSSL_LIBRARIES
|
||||
DIRECTORY libressl
|
||||
DEFINITION OPENSSL_LIBS)
|
||||
else()
|
||||
set(OPENSSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# httplib
|
||||
if (ENABLE_WEB_SERVICE AND NOT TARGET httplib::httplib)
|
||||
add_library(httplib INTERFACE)
|
||||
target_include_directories(httplib INTERFACE ./cpp-httplib)
|
||||
target_compile_definitions(httplib INTERFACE -DCPPHTTPLIB_OPENSSL_SUPPORT)
|
||||
@@ -136,6 +147,7 @@ if (ENABLE_WEB_SERVICE AND NOT TARGET cpp-jwt::cpp-jwt)
|
||||
add_library(cpp-jwt INTERFACE)
|
||||
target_include_directories(cpp-jwt INTERFACE ./cpp-jwt/include)
|
||||
target_compile_definitions(cpp-jwt INTERFACE CPP_JWT_USE_VENDORED_NLOHMANN_JSON)
|
||||
target_link_libraries(cpp-jwt INTERFACE ${OPENSSL_LIBRARIES})
|
||||
add_library(cpp-jwt::cpp-jwt ALIAS cpp-jwt)
|
||||
endif()
|
||||
|
||||
|
||||
2
externals/cpp-httplib
vendored
2
externals/cpp-httplib
vendored
Submodule externals/cpp-httplib updated: 305a7abcb9...6d963fbe8d
2
externals/mbedtls
vendored
2
externals/mbedtls
vendored
Submodule externals/mbedtls updated: 8c88150ca1...dd79db1001
@@ -23,6 +23,7 @@ public:
|
||||
buffer{Common::make_unique_for_overwrite<T[]>(initial_capacity)} {}
|
||||
|
||||
~ScratchBuffer() = default;
|
||||
ScratchBuffer(ScratchBuffer&&) = default;
|
||||
|
||||
/// This will only grow the buffer's capacity if size is greater than the current capacity.
|
||||
/// The previously held data will remain intact.
|
||||
|
||||
@@ -59,6 +59,7 @@ void LogSettings() {
|
||||
values.use_asynchronous_gpu_emulation.GetValue());
|
||||
log_setting("Renderer_NvdecEmulation", values.nvdec_emulation.GetValue());
|
||||
log_setting("Renderer_AccelerateASTC", values.accelerate_astc.GetValue());
|
||||
log_setting("Renderer_AsyncASTC", values.async_astc.GetValue());
|
||||
log_setting("Renderer_UseVsync", values.use_vsync.GetValue());
|
||||
log_setting("Renderer_ShaderBackend", values.shader_backend.GetValue());
|
||||
log_setting("Renderer_UseAsynchronousShaders", values.use_asynchronous_shaders.GetValue());
|
||||
@@ -76,6 +77,13 @@ void LogSettings() {
|
||||
log_setting("Debugging_GDBStub", values.use_gdbstub.GetValue());
|
||||
log_setting("Input_EnableMotion", values.motion_enabled.GetValue());
|
||||
log_setting("Input_EnableVibration", values.vibration_enabled.GetValue());
|
||||
log_setting("Input_EnableTouch", values.touchscreen.enabled);
|
||||
log_setting("Input_EnableMouse", values.mouse_enabled.GetValue());
|
||||
log_setting("Input_EnableKeyboard", values.keyboard_enabled.GetValue());
|
||||
log_setting("Input_EnableRingController", values.enable_ring_controller.GetValue());
|
||||
log_setting("Input_EnableIrSensor", values.enable_ir_sensor.GetValue());
|
||||
log_setting("Input_EnableCustomJoycon", values.enable_joycon_driver.GetValue());
|
||||
log_setting("Input_EnableCustomProController", values.enable_procon_driver.GetValue());
|
||||
log_setting("Input_EnableRawInput", values.enable_raw_input.GetValue());
|
||||
}
|
||||
|
||||
@@ -212,6 +220,7 @@ void RestoreGlobalState(bool is_powered_on) {
|
||||
values.use_asynchronous_gpu_emulation.SetGlobal(true);
|
||||
values.nvdec_emulation.SetGlobal(true);
|
||||
values.accelerate_astc.SetGlobal(true);
|
||||
values.async_astc.SetGlobal(true);
|
||||
values.use_vsync.SetGlobal(true);
|
||||
values.shader_backend.SetGlobal(true);
|
||||
values.use_asynchronous_shaders.SetGlobal(true);
|
||||
|
||||
@@ -453,6 +453,7 @@ struct Values {
|
||||
SwitchableSetting<bool> use_asynchronous_gpu_emulation{true, "use_asynchronous_gpu_emulation"};
|
||||
SwitchableSetting<NvdecEmulation> nvdec_emulation{NvdecEmulation::GPU, "nvdec_emulation"};
|
||||
SwitchableSetting<bool> accelerate_astc{true, "accelerate_astc"};
|
||||
SwitchableSetting<bool> async_astc{false, "async_astc"};
|
||||
SwitchableSetting<bool> use_vsync{true, "use_vsync"};
|
||||
SwitchableSetting<ShaderBackend, true> shader_backend{ShaderBackend::GLSL, ShaderBackend::GLSL,
|
||||
ShaderBackend::SPIRV, "shader_backend"};
|
||||
|
||||
@@ -832,7 +832,7 @@ endif()
|
||||
create_target_directory_groups(core)
|
||||
|
||||
target_link_libraries(core PUBLIC common PRIVATE audio_core network video_core)
|
||||
target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls Opus::opus)
|
||||
target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt::fmt nlohmann_json::nlohmann_json MbedTLS::mbedcrypto Opus::opus)
|
||||
if (MINGW)
|
||||
target_link_libraries(core PRIVATE ${MSWSOCK_LIBRARY})
|
||||
endif()
|
||||
@@ -861,3 +861,7 @@ endif()
|
||||
if (YUZU_USE_PRECOMPILED_HEADERS)
|
||||
target_precompile_headers(core PRIVATE precompiled_headers.h)
|
||||
endif()
|
||||
|
||||
if (YUZU_ENABLE_LTO)
|
||||
set_property(TARGET core PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
endif()
|
||||
|
||||
@@ -363,7 +363,17 @@ void EmulatedController::ReloadInput() {
|
||||
SetMotion(callback, index);
|
||||
},
|
||||
});
|
||||
motion_devices[index]->ForceUpdate();
|
||||
|
||||
// Restore motion state
|
||||
auto& emulated_motion = controller.motion_values[index].emulated;
|
||||
auto& motion = controller.motion_state[index];
|
||||
emulated_motion.ResetRotations();
|
||||
emulated_motion.ResetQuaternion();
|
||||
motion.accel = emulated_motion.GetAcceleration();
|
||||
motion.gyro = emulated_motion.GetGyroscope();
|
||||
motion.rotation = emulated_motion.GetRotations();
|
||||
motion.orientation = emulated_motion.GetOrientation();
|
||||
motion.is_at_rest = !emulated_motion.IsMoving(motion_sensitivity);
|
||||
}
|
||||
|
||||
for (std::size_t index = 0; index < camera_devices.size(); ++index) {
|
||||
|
||||
@@ -19,52 +19,53 @@ void EmulatedDevices::ReloadFromSettings() {
|
||||
|
||||
void EmulatedDevices::ReloadInput() {
|
||||
// If you load any device here add the equivalent to the UnloadInput() function
|
||||
|
||||
// Native Mouse is mapped on port 1, pad 0
|
||||
const Common::ParamPackage mouse_params{"engine:mouse,port:1,pad:0"};
|
||||
|
||||
// Keyboard keys is mapped on port 1, pad 0 for normal keys, pad 1 for moddifier keys
|
||||
const Common::ParamPackage keyboard_params{"engine:keyboard,port:1"};
|
||||
|
||||
std::size_t key_index = 0;
|
||||
for (auto& mouse_device : mouse_button_devices) {
|
||||
Common::ParamPackage mouse_params;
|
||||
mouse_params.Set("engine", "mouse");
|
||||
mouse_params.Set("button", static_cast<int>(key_index));
|
||||
mouse_device = Common::Input::CreateInputDevice(mouse_params);
|
||||
Common::ParamPackage mouse_button_params = mouse_params;
|
||||
mouse_button_params.Set("button", static_cast<int>(key_index));
|
||||
mouse_device = Common::Input::CreateInputDevice(mouse_button_params);
|
||||
key_index++;
|
||||
}
|
||||
|
||||
mouse_stick_device =
|
||||
Common::Input::CreateInputDeviceFromString("engine:mouse,axis_x:0,axis_y:1");
|
||||
Common::ParamPackage mouse_position_params = mouse_params;
|
||||
mouse_position_params.Set("axis_x", 0);
|
||||
mouse_position_params.Set("axis_y", 1);
|
||||
mouse_position_params.Set("deadzone", 0.0f);
|
||||
mouse_position_params.Set("range", 1.0f);
|
||||
mouse_position_params.Set("threshold", 0.0f);
|
||||
mouse_stick_device = Common::Input::CreateInputDevice(mouse_position_params);
|
||||
|
||||
// First two axis are reserved for mouse position
|
||||
key_index = 2;
|
||||
for (auto& mouse_device : mouse_analog_devices) {
|
||||
// Mouse axis are only mapped on port 1, pad 0
|
||||
Common::ParamPackage mouse_params;
|
||||
mouse_params.Set("engine", "mouse");
|
||||
mouse_params.Set("axis", static_cast<int>(key_index));
|
||||
mouse_params.Set("port", 1);
|
||||
mouse_params.Set("pad", 0);
|
||||
mouse_device = Common::Input::CreateInputDevice(mouse_params);
|
||||
for (auto& mouse_device : mouse_wheel_devices) {
|
||||
Common::ParamPackage mouse_wheel_params = mouse_params;
|
||||
mouse_wheel_params.Set("axis", static_cast<int>(key_index));
|
||||
mouse_device = Common::Input::CreateInputDevice(mouse_wheel_params);
|
||||
key_index++;
|
||||
}
|
||||
|
||||
key_index = 0;
|
||||
for (auto& keyboard_device : keyboard_devices) {
|
||||
// Keyboard keys are only mapped on port 1, pad 0
|
||||
Common::ParamPackage keyboard_params;
|
||||
keyboard_params.Set("engine", "keyboard");
|
||||
keyboard_params.Set("button", static_cast<int>(key_index));
|
||||
keyboard_params.Set("port", 1);
|
||||
keyboard_params.Set("pad", 0);
|
||||
keyboard_device = Common::Input::CreateInputDevice(keyboard_params);
|
||||
Common::ParamPackage keyboard_key_params = keyboard_params;
|
||||
keyboard_key_params.Set("button", static_cast<int>(key_index));
|
||||
keyboard_key_params.Set("pad", 0);
|
||||
keyboard_device = Common::Input::CreateInputDevice(keyboard_key_params);
|
||||
key_index++;
|
||||
}
|
||||
|
||||
key_index = 0;
|
||||
for (auto& keyboard_device : keyboard_modifier_devices) {
|
||||
// Keyboard moddifiers are only mapped on port 1, pad 1
|
||||
Common::ParamPackage keyboard_params;
|
||||
keyboard_params.Set("engine", "keyboard");
|
||||
keyboard_params.Set("button", static_cast<int>(key_index));
|
||||
keyboard_params.Set("port", 1);
|
||||
keyboard_params.Set("pad", 1);
|
||||
keyboard_device = Common::Input::CreateInputDevice(keyboard_params);
|
||||
Common::ParamPackage keyboard_moddifier_params = keyboard_params;
|
||||
keyboard_moddifier_params.Set("button", static_cast<int>(key_index));
|
||||
keyboard_moddifier_params.Set("pad", 1);
|
||||
keyboard_device = Common::Input::CreateInputDevice(keyboard_moddifier_params);
|
||||
key_index++;
|
||||
}
|
||||
|
||||
@@ -80,14 +81,14 @@ void EmulatedDevices::ReloadInput() {
|
||||
});
|
||||
}
|
||||
|
||||
for (std::size_t index = 0; index < mouse_analog_devices.size(); ++index) {
|
||||
if (!mouse_analog_devices[index]) {
|
||||
for (std::size_t index = 0; index < mouse_wheel_devices.size(); ++index) {
|
||||
if (!mouse_wheel_devices[index]) {
|
||||
continue;
|
||||
}
|
||||
mouse_analog_devices[index]->SetCallback({
|
||||
mouse_wheel_devices[index]->SetCallback({
|
||||
.on_change =
|
||||
[this, index](const Common::Input::CallbackStatus& callback) {
|
||||
SetMouseAnalog(callback, index);
|
||||
SetMouseWheel(callback, index);
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -95,7 +96,9 @@ void EmulatedDevices::ReloadInput() {
|
||||
if (mouse_stick_device) {
|
||||
mouse_stick_device->SetCallback({
|
||||
.on_change =
|
||||
[this](const Common::Input::CallbackStatus& callback) { SetMouseStick(callback); },
|
||||
[this](const Common::Input::CallbackStatus& callback) {
|
||||
SetMousePosition(callback);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -128,7 +131,7 @@ void EmulatedDevices::UnloadInput() {
|
||||
for (auto& button : mouse_button_devices) {
|
||||
button.reset();
|
||||
}
|
||||
for (auto& analog : mouse_analog_devices) {
|
||||
for (auto& analog : mouse_wheel_devices) {
|
||||
analog.reset();
|
||||
}
|
||||
mouse_stick_device.reset();
|
||||
@@ -362,18 +365,18 @@ void EmulatedDevices::SetMouseButton(const Common::Input::CallbackStatus& callba
|
||||
TriggerOnChange(DeviceTriggerType::Mouse);
|
||||
}
|
||||
|
||||
void EmulatedDevices::SetMouseAnalog(const Common::Input::CallbackStatus& callback,
|
||||
std::size_t index) {
|
||||
if (index >= device_status.mouse_analog_values.size()) {
|
||||
void EmulatedDevices::SetMouseWheel(const Common::Input::CallbackStatus& callback,
|
||||
std::size_t index) {
|
||||
if (index >= device_status.mouse_wheel_values.size()) {
|
||||
return;
|
||||
}
|
||||
std::unique_lock lock{mutex};
|
||||
const auto analog_value = TransformToAnalog(callback);
|
||||
|
||||
device_status.mouse_analog_values[index] = analog_value;
|
||||
device_status.mouse_wheel_values[index] = analog_value;
|
||||
|
||||
if (is_configuring) {
|
||||
device_status.mouse_position_state = {};
|
||||
device_status.mouse_wheel_state = {};
|
||||
lock.unlock();
|
||||
TriggerOnChange(DeviceTriggerType::Mouse);
|
||||
return;
|
||||
@@ -392,7 +395,7 @@ void EmulatedDevices::SetMouseAnalog(const Common::Input::CallbackStatus& callba
|
||||
TriggerOnChange(DeviceTriggerType::Mouse);
|
||||
}
|
||||
|
||||
void EmulatedDevices::SetMouseStick(const Common::Input::CallbackStatus& callback) {
|
||||
void EmulatedDevices::SetMousePosition(const Common::Input::CallbackStatus& callback) {
|
||||
std::unique_lock lock{mutex};
|
||||
const auto touch_value = TransformToTouch(callback);
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ using KeyboardModifierDevices = std::array<std::unique_ptr<Common::Input::InputD
|
||||
Settings::NativeKeyboard::NumKeyboardMods>;
|
||||
using MouseButtonDevices = std::array<std::unique_ptr<Common::Input::InputDevice>,
|
||||
Settings::NativeMouseButton::NumMouseButtons>;
|
||||
using MouseAnalogDevices = std::array<std::unique_ptr<Common::Input::InputDevice>,
|
||||
Settings::NativeMouseWheel::NumMouseWheels>;
|
||||
using MouseWheelDevices = std::array<std::unique_ptr<Common::Input::InputDevice>,
|
||||
Settings::NativeMouseWheel::NumMouseWheels>;
|
||||
using MouseStickDevice = std::unique_ptr<Common::Input::InputDevice>;
|
||||
|
||||
using MouseButtonParams =
|
||||
@@ -36,7 +36,7 @@ using KeyboardModifierValues =
|
||||
std::array<Common::Input::ButtonStatus, Settings::NativeKeyboard::NumKeyboardMods>;
|
||||
using MouseButtonValues =
|
||||
std::array<Common::Input::ButtonStatus, Settings::NativeMouseButton::NumMouseButtons>;
|
||||
using MouseAnalogValues =
|
||||
using MouseWheelValues =
|
||||
std::array<Common::Input::AnalogStatus, Settings::NativeMouseWheel::NumMouseWheels>;
|
||||
using MouseStickValue = Common::Input::TouchStatus;
|
||||
|
||||
@@ -50,7 +50,7 @@ struct DeviceStatus {
|
||||
KeyboardValues keyboard_values{};
|
||||
KeyboardModifierValues keyboard_moddifier_values{};
|
||||
MouseButtonValues mouse_button_values{};
|
||||
MouseAnalogValues mouse_analog_values{};
|
||||
MouseWheelValues mouse_wheel_values{};
|
||||
MouseStickValue mouse_stick_value{};
|
||||
|
||||
// Data for HID serices
|
||||
@@ -111,15 +111,6 @@ public:
|
||||
/// Reverts any mapped changes made that weren't saved
|
||||
void RestoreConfig();
|
||||
|
||||
// Returns the current mapped ring device
|
||||
Common::ParamPackage GetRingParam() const;
|
||||
|
||||
/**
|
||||
* Updates the current mapped ring device
|
||||
* @param param ParamPackage with ring sensor data to be mapped
|
||||
*/
|
||||
void SetRingParam(Common::ParamPackage param);
|
||||
|
||||
/// Returns the latest status of button input from the keyboard with parameters
|
||||
KeyboardValues GetKeyboardValues() const;
|
||||
|
||||
@@ -187,19 +178,13 @@ private:
|
||||
* @param callback A CallbackStatus containing the wheel status
|
||||
* @param index wheel ID to be updated
|
||||
*/
|
||||
void SetMouseAnalog(const Common::Input::CallbackStatus& callback, std::size_t index);
|
||||
void SetMouseWheel(const Common::Input::CallbackStatus& callback, std::size_t index);
|
||||
|
||||
/**
|
||||
* Updates the mouse position status of the mouse device
|
||||
* @param callback A CallbackStatus containing the position status
|
||||
*/
|
||||
void SetMouseStick(const Common::Input::CallbackStatus& callback);
|
||||
|
||||
/**
|
||||
* Updates the ring analog sensor status of the ring controller
|
||||
* @param callback A CallbackStatus containing the force status
|
||||
*/
|
||||
void SetRingAnalog(const Common::Input::CallbackStatus& callback);
|
||||
void SetMousePosition(const Common::Input::CallbackStatus& callback);
|
||||
|
||||
/**
|
||||
* Triggers a callback that something has changed on the device status
|
||||
@@ -212,7 +197,7 @@ private:
|
||||
KeyboardDevices keyboard_devices;
|
||||
KeyboardModifierDevices keyboard_modifier_devices;
|
||||
MouseButtonDevices mouse_button_devices;
|
||||
MouseAnalogDevices mouse_analog_devices;
|
||||
MouseWheelDevices mouse_wheel_devices;
|
||||
MouseStickDevice mouse_stick_device;
|
||||
|
||||
mutable std::mutex mutex;
|
||||
|
||||
@@ -10,6 +10,8 @@ MotionInput::MotionInput() {
|
||||
// Initialize PID constants with default values
|
||||
SetPID(0.3f, 0.005f, 0.0f);
|
||||
SetGyroThreshold(ThresholdStandard);
|
||||
ResetQuaternion();
|
||||
ResetRotations();
|
||||
}
|
||||
|
||||
void MotionInput::SetPID(f32 new_kp, f32 new_ki, f32 new_kd) {
|
||||
@@ -20,11 +22,19 @@ void MotionInput::SetPID(f32 new_kp, f32 new_ki, f32 new_kd) {
|
||||
|
||||
void MotionInput::SetAcceleration(const Common::Vec3f& acceleration) {
|
||||
accel = acceleration;
|
||||
|
||||
accel.x = std::clamp(accel.x, -AccelMaxValue, AccelMaxValue);
|
||||
accel.y = std::clamp(accel.y, -AccelMaxValue, AccelMaxValue);
|
||||
accel.z = std::clamp(accel.z, -AccelMaxValue, AccelMaxValue);
|
||||
}
|
||||
|
||||
void MotionInput::SetGyroscope(const Common::Vec3f& gyroscope) {
|
||||
gyro = gyroscope - gyro_bias;
|
||||
|
||||
gyro.x = std::clamp(gyro.x, -GyroMaxValue, GyroMaxValue);
|
||||
gyro.y = std::clamp(gyro.y, -GyroMaxValue, GyroMaxValue);
|
||||
gyro.z = std::clamp(gyro.z, -GyroMaxValue, GyroMaxValue);
|
||||
|
||||
// Auto adjust drift to minimize drift
|
||||
if (!IsMoving(IsAtRestRelaxed)) {
|
||||
gyro_bias = (gyro_bias * 0.9999f) + (gyroscope * 0.0001f);
|
||||
@@ -61,6 +71,10 @@ void MotionInput::ResetRotations() {
|
||||
rotations = {};
|
||||
}
|
||||
|
||||
void MotionInput::ResetQuaternion() {
|
||||
quat = {{0.0f, 0.0f, -1.0f}, 0.0f};
|
||||
}
|
||||
|
||||
bool MotionInput::IsMoving(f32 sensitivity) const {
|
||||
return gyro.Length() >= sensitivity || accel.Length() <= 0.9f || accel.Length() >= 1.1f;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,9 @@ public:
|
||||
static constexpr float IsAtRestStandard = 0.01f;
|
||||
static constexpr float IsAtRestThight = 0.005f;
|
||||
|
||||
static constexpr float GyroMaxValue = 5.0f;
|
||||
static constexpr float AccelMaxValue = 7.0f;
|
||||
|
||||
explicit MotionInput();
|
||||
|
||||
MotionInput(const MotionInput&) = default;
|
||||
@@ -40,6 +43,7 @@ public:
|
||||
|
||||
void EnableReset(bool reset);
|
||||
void ResetRotations();
|
||||
void ResetQuaternion();
|
||||
|
||||
void UpdateRotation(u64 elapsed_time);
|
||||
void UpdateOrientation(u64 elapsed_time);
|
||||
@@ -69,7 +73,7 @@ private:
|
||||
Common::Vec3f derivative_error;
|
||||
|
||||
// Quaternion containing the device orientation
|
||||
Common::Quaternion<f32> quat{{0.0f, 0.0f, -1.0f}, 0.0f};
|
||||
Common::Quaternion<f32> quat;
|
||||
|
||||
// Number of full rotations in each axis
|
||||
Common::Vec3f rotations;
|
||||
|
||||
@@ -82,7 +82,7 @@ static_assert(sizeof(uint64_t) == 8);
|
||||
static void SvcWrap_SetHeapSize64From32(Core::System& system) {
|
||||
Result ret{};
|
||||
|
||||
uintptr_t out_address{};
|
||||
uint64_t out_address{};
|
||||
uint32_t size{};
|
||||
|
||||
size = Convert<uint32_t>(GetReg32(system, 1));
|
||||
@@ -729,7 +729,7 @@ static void SvcWrap_GetLastThreadInfo64From32(Core::System& system) {
|
||||
Result ret{};
|
||||
|
||||
ilp32::LastThreadContext out_context{};
|
||||
uintptr_t out_tls_address{};
|
||||
uint64_t out_tls_address{};
|
||||
uint32_t out_flags{};
|
||||
|
||||
ret = GetLastThreadInfo64From32(system, &out_context, &out_tls_address, &out_flags);
|
||||
@@ -1278,8 +1278,8 @@ static void SvcWrap_QueryPhysicalAddress64From32(Core::System& system) {
|
||||
static void SvcWrap_QueryIoMapping64From32(Core::System& system) {
|
||||
Result ret{};
|
||||
|
||||
uintptr_t out_address{};
|
||||
uintptr_t out_size{};
|
||||
uint64_t out_address{};
|
||||
uint64_t out_size{};
|
||||
uint64_t physical_address{};
|
||||
uint32_t size{};
|
||||
|
||||
@@ -2088,7 +2088,7 @@ static void SvcWrap_UnmapInsecureMemory64From32(Core::System& system) {
|
||||
static void SvcWrap_SetHeapSize64(Core::System& system) {
|
||||
Result ret{};
|
||||
|
||||
uintptr_t out_address{};
|
||||
uint64_t out_address{};
|
||||
uint64_t size{};
|
||||
|
||||
size = Convert<uint64_t>(GetReg64(system, 1));
|
||||
@@ -2705,7 +2705,7 @@ static void SvcWrap_GetLastThreadInfo64(Core::System& system) {
|
||||
Result ret{};
|
||||
|
||||
lp64::LastThreadContext out_context{};
|
||||
uintptr_t out_tls_address{};
|
||||
uint64_t out_tls_address{};
|
||||
uint32_t out_flags{};
|
||||
|
||||
ret = GetLastThreadInfo64(system, &out_context, &out_tls_address, &out_flags);
|
||||
@@ -3217,8 +3217,8 @@ static void SvcWrap_QueryPhysicalAddress64(Core::System& system) {
|
||||
static void SvcWrap_QueryIoMapping64(Core::System& system) {
|
||||
Result ret{};
|
||||
|
||||
uintptr_t out_address{};
|
||||
uintptr_t out_size{};
|
||||
uint64_t out_address{};
|
||||
uint64_t out_size{};
|
||||
uint64_t physical_address{};
|
||||
uint64_t size{};
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class System;
|
||||
namespace Kernel::Svc {
|
||||
|
||||
// clang-format off
|
||||
Result SetHeapSize(Core::System& system, uintptr_t* out_address, uint64_t size);
|
||||
Result SetHeapSize(Core::System& system, uint64_t* out_address, uint64_t size);
|
||||
Result SetMemoryPermission(Core::System& system, uint64_t address, uint64_t size, MemoryPermission perm);
|
||||
Result SetMemoryAttribute(Core::System& system, uint64_t address, uint64_t size, uint32_t mask, uint32_t attr);
|
||||
Result MapMemory(Core::System& system, uint64_t dst_address, uint64_t src_address, uint64_t size);
|
||||
@@ -61,7 +61,7 @@ Result FlushDataCache(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result MapPhysicalMemory(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result UnmapPhysicalMemory(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result GetDebugFutureThreadInfo(Core::System& system, lp64::LastThreadContext* out_context, uint64_t* out_thread_id, Handle debug_handle, int64_t ns);
|
||||
Result GetLastThreadInfo(Core::System& system, lp64::LastThreadContext* out_context, uintptr_t* out_tls_address, uint32_t* out_flags);
|
||||
Result GetLastThreadInfo(Core::System& system, lp64::LastThreadContext* out_context, uint64_t* out_tls_address, uint32_t* out_flags);
|
||||
Result GetResourceLimitLimitValue(Core::System& system, int64_t* out_limit_value, Handle resource_limit_handle, LimitableResource which);
|
||||
Result GetResourceLimitCurrentValue(Core::System& system, int64_t* out_current_value, Handle resource_limit_handle, LimitableResource which);
|
||||
Result SetThreadActivity(Core::System& system, Handle thread_handle, ThreadActivity thread_activity);
|
||||
@@ -94,7 +94,7 @@ Result MapTransferMemory(Core::System& system, Handle trmem_handle, uint64_t add
|
||||
Result UnmapTransferMemory(Core::System& system, Handle trmem_handle, uint64_t address, uint64_t size);
|
||||
Result CreateInterruptEvent(Core::System& system, Handle* out_read_handle, int32_t interrupt_id, InterruptType interrupt_type);
|
||||
Result QueryPhysicalAddress(Core::System& system, lp64::PhysicalMemoryInfo* out_info, uint64_t address);
|
||||
Result QueryIoMapping(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, uint64_t physical_address, uint64_t size);
|
||||
Result QueryIoMapping(Core::System& system, uint64_t* out_address, uint64_t* out_size, uint64_t physical_address, uint64_t size);
|
||||
Result CreateDeviceAddressSpace(Core::System& system, Handle* out_handle, uint64_t das_address, uint64_t das_size);
|
||||
Result AttachDeviceAddressSpace(Core::System& system, DeviceName device_name, Handle das_handle);
|
||||
Result DetachDeviceAddressSpace(Core::System& system, DeviceName device_name, Handle das_handle);
|
||||
@@ -137,7 +137,7 @@ Result SetResourceLimitLimitValue(Core::System& system, Handle resource_limit_ha
|
||||
Result MapInsecureMemory(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result UnmapInsecureMemory(Core::System& system, uint64_t address, uint64_t size);
|
||||
|
||||
Result SetHeapSize64From32(Core::System& system, uintptr_t* out_address, uint32_t size);
|
||||
Result SetHeapSize64From32(Core::System& system, uint64_t* out_address, uint32_t size);
|
||||
Result SetMemoryPermission64From32(Core::System& system, uint32_t address, uint32_t size, MemoryPermission perm);
|
||||
Result SetMemoryAttribute64From32(Core::System& system, uint32_t address, uint32_t size, uint32_t mask, uint32_t attr);
|
||||
Result MapMemory64From32(Core::System& system, uint32_t dst_address, uint32_t src_address, uint32_t size);
|
||||
@@ -182,7 +182,7 @@ Result FlushDataCache64From32(Core::System& system, uint32_t address, uint32_t s
|
||||
Result MapPhysicalMemory64From32(Core::System& system, uint32_t address, uint32_t size);
|
||||
Result UnmapPhysicalMemory64From32(Core::System& system, uint32_t address, uint32_t size);
|
||||
Result GetDebugFutureThreadInfo64From32(Core::System& system, ilp32::LastThreadContext* out_context, uint64_t* out_thread_id, Handle debug_handle, int64_t ns);
|
||||
Result GetLastThreadInfo64From32(Core::System& system, ilp32::LastThreadContext* out_context, uintptr_t* out_tls_address, uint32_t* out_flags);
|
||||
Result GetLastThreadInfo64From32(Core::System& system, ilp32::LastThreadContext* out_context, uint64_t* out_tls_address, uint32_t* out_flags);
|
||||
Result GetResourceLimitLimitValue64From32(Core::System& system, int64_t* out_limit_value, Handle resource_limit_handle, LimitableResource which);
|
||||
Result GetResourceLimitCurrentValue64From32(Core::System& system, int64_t* out_current_value, Handle resource_limit_handle, LimitableResource which);
|
||||
Result SetThreadActivity64From32(Core::System& system, Handle thread_handle, ThreadActivity thread_activity);
|
||||
@@ -215,7 +215,7 @@ Result MapTransferMemory64From32(Core::System& system, Handle trmem_handle, uint
|
||||
Result UnmapTransferMemory64From32(Core::System& system, Handle trmem_handle, uint32_t address, uint32_t size);
|
||||
Result CreateInterruptEvent64From32(Core::System& system, Handle* out_read_handle, int32_t interrupt_id, InterruptType interrupt_type);
|
||||
Result QueryPhysicalAddress64From32(Core::System& system, ilp32::PhysicalMemoryInfo* out_info, uint32_t address);
|
||||
Result QueryIoMapping64From32(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, uint64_t physical_address, uint32_t size);
|
||||
Result QueryIoMapping64From32(Core::System& system, uint64_t* out_address, uint64_t* out_size, uint64_t physical_address, uint32_t size);
|
||||
Result CreateDeviceAddressSpace64From32(Core::System& system, Handle* out_handle, uint64_t das_address, uint64_t das_size);
|
||||
Result AttachDeviceAddressSpace64From32(Core::System& system, DeviceName device_name, Handle das_handle);
|
||||
Result DetachDeviceAddressSpace64From32(Core::System& system, DeviceName device_name, Handle das_handle);
|
||||
@@ -258,7 +258,7 @@ Result SetResourceLimitLimitValue64From32(Core::System& system, Handle resource_
|
||||
Result MapInsecureMemory64From32(Core::System& system, uint32_t address, uint32_t size);
|
||||
Result UnmapInsecureMemory64From32(Core::System& system, uint32_t address, uint32_t size);
|
||||
|
||||
Result SetHeapSize64(Core::System& system, uintptr_t* out_address, uint64_t size);
|
||||
Result SetHeapSize64(Core::System& system, uint64_t* out_address, uint64_t size);
|
||||
Result SetMemoryPermission64(Core::System& system, uint64_t address, uint64_t size, MemoryPermission perm);
|
||||
Result SetMemoryAttribute64(Core::System& system, uint64_t address, uint64_t size, uint32_t mask, uint32_t attr);
|
||||
Result MapMemory64(Core::System& system, uint64_t dst_address, uint64_t src_address, uint64_t size);
|
||||
@@ -303,7 +303,7 @@ Result FlushDataCache64(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result MapPhysicalMemory64(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result UnmapPhysicalMemory64(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result GetDebugFutureThreadInfo64(Core::System& system, lp64::LastThreadContext* out_context, uint64_t* out_thread_id, Handle debug_handle, int64_t ns);
|
||||
Result GetLastThreadInfo64(Core::System& system, lp64::LastThreadContext* out_context, uintptr_t* out_tls_address, uint32_t* out_flags);
|
||||
Result GetLastThreadInfo64(Core::System& system, lp64::LastThreadContext* out_context, uint64_t* out_tls_address, uint32_t* out_flags);
|
||||
Result GetResourceLimitLimitValue64(Core::System& system, int64_t* out_limit_value, Handle resource_limit_handle, LimitableResource which);
|
||||
Result GetResourceLimitCurrentValue64(Core::System& system, int64_t* out_current_value, Handle resource_limit_handle, LimitableResource which);
|
||||
Result SetThreadActivity64(Core::System& system, Handle thread_handle, ThreadActivity thread_activity);
|
||||
@@ -336,7 +336,7 @@ Result MapTransferMemory64(Core::System& system, Handle trmem_handle, uint64_t a
|
||||
Result UnmapTransferMemory64(Core::System& system, Handle trmem_handle, uint64_t address, uint64_t size);
|
||||
Result CreateInterruptEvent64(Core::System& system, Handle* out_read_handle, int32_t interrupt_id, InterruptType interrupt_type);
|
||||
Result QueryPhysicalAddress64(Core::System& system, lp64::PhysicalMemoryInfo* out_info, uint64_t address);
|
||||
Result QueryIoMapping64(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, uint64_t physical_address, uint64_t size);
|
||||
Result QueryIoMapping64(Core::System& system, uint64_t* out_address, uint64_t* out_size, uint64_t physical_address, uint64_t size);
|
||||
Result CreateDeviceAddressSpace64(Core::System& system, Handle* out_handle, uint64_t das_address, uint64_t das_size);
|
||||
Result AttachDeviceAddressSpace64(Core::System& system, DeviceName device_name, Handle das_handle);
|
||||
Result DetachDeviceAddressSpace64(Core::System& system, DeviceName device_name, Handle das_handle);
|
||||
|
||||
@@ -12,7 +12,7 @@ Result QueryPhysicalAddress(Core::System& system, lp64::PhysicalMemoryInfo* out_
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
|
||||
Result QueryIoMapping(Core::System& system, uintptr_t* out_address, uintptr_t* out_size,
|
||||
Result QueryIoMapping(Core::System& system, uint64_t* out_address, uint64_t* out_size,
|
||||
uint64_t physical_address, uint64_t size) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
@@ -23,7 +23,7 @@ Result QueryPhysicalAddress64(Core::System& system, lp64::PhysicalMemoryInfo* ou
|
||||
R_RETURN(QueryPhysicalAddress(system, out_info, address));
|
||||
}
|
||||
|
||||
Result QueryIoMapping64(Core::System& system, uintptr_t* out_address, uintptr_t* out_size,
|
||||
Result QueryIoMapping64(Core::System& system, uint64_t* out_address, uint64_t* out_size,
|
||||
uint64_t physical_address, uint64_t size) {
|
||||
R_RETURN(QueryIoMapping(system, out_address, out_size, physical_address, size));
|
||||
}
|
||||
@@ -41,10 +41,10 @@ Result QueryPhysicalAddress64From32(Core::System& system, ilp32::PhysicalMemoryI
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result QueryIoMapping64From32(Core::System& system, uintptr_t* out_address, uintptr_t* out_size,
|
||||
Result QueryIoMapping64From32(Core::System& system, uint64_t* out_address, uint64_t* out_size,
|
||||
uint64_t physical_address, uint32_t size) {
|
||||
R_RETURN(QueryIoMapping(system, reinterpret_cast<uintptr_t*>(out_address),
|
||||
reinterpret_cast<uintptr_t*>(out_size), physical_address, size));
|
||||
R_RETURN(QueryIoMapping(system, reinterpret_cast<uint64_t*>(out_address),
|
||||
reinterpret_cast<uint64_t*>(out_size), physical_address, size));
|
||||
}
|
||||
|
||||
} // namespace Kernel::Svc
|
||||
|
||||
@@ -13,7 +13,7 @@ void FlushEntireDataCache(Core::System& system) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
Result FlushDataCache(Core::System& system, VAddr address, size_t size) {
|
||||
Result FlushDataCache(Core::System& system, uint64_t address, uint64_t size) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
@@ -33,8 +33,8 @@ Result StoreProcessDataCache(Core::System& system, Handle process_handle, uint64
|
||||
Result FlushProcessDataCache(Core::System& system, Handle process_handle, u64 address, u64 size) {
|
||||
// Validate address/size.
|
||||
R_UNLESS(size > 0, ResultInvalidSize);
|
||||
R_UNLESS(address == static_cast<uintptr_t>(address), ResultInvalidCurrentMemory);
|
||||
R_UNLESS(size == static_cast<size_t>(size), ResultInvalidCurrentMemory);
|
||||
R_UNLESS(address == static_cast<uint64_t>(address), ResultInvalidCurrentMemory);
|
||||
R_UNLESS(size == static_cast<uint64_t>(size), ResultInvalidCurrentMemory);
|
||||
|
||||
// Get the process from its handle.
|
||||
KScopedAutoObject process =
|
||||
@@ -53,7 +53,7 @@ void FlushEntireDataCache64(Core::System& system) {
|
||||
FlushEntireDataCache(system);
|
||||
}
|
||||
|
||||
Result FlushDataCache64(Core::System& system, VAddr address, size_t size) {
|
||||
Result FlushDataCache64(Core::System& system, uint64_t address, uint64_t size) {
|
||||
R_RETURN(FlushDataCache(system, address, size));
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ constexpr bool IsValidUnmapFromOwnerCodeMemoryPermission(MemoryPermission perm)
|
||||
|
||||
} // namespace
|
||||
|
||||
Result CreateCodeMemory(Core::System& system, Handle* out, VAddr address, size_t size) {
|
||||
Result CreateCodeMemory(Core::System& system, Handle* out, VAddr address, uint64_t size) {
|
||||
LOG_TRACE(Kernel_SVC, "called, address=0x{:X}, size=0x{:X}", address, size);
|
||||
|
||||
// Get kernel instance.
|
||||
@@ -64,7 +64,7 @@ Result CreateCodeMemory(Core::System& system, Handle* out, VAddr address, size_t
|
||||
}
|
||||
|
||||
Result ControlCodeMemory(Core::System& system, Handle code_memory_handle,
|
||||
CodeMemoryOperation operation, VAddr address, size_t size,
|
||||
CodeMemoryOperation operation, VAddr address, uint64_t size,
|
||||
MemoryPermission perm) {
|
||||
|
||||
LOG_TRACE(Kernel_SVC,
|
||||
|
||||
@@ -45,19 +45,19 @@ Result SetDebugThreadContext(Core::System& system, Handle debug_handle, uint64_t
|
||||
}
|
||||
|
||||
Result QueryDebugProcessMemory(Core::System& system, uint64_t out_memory_info,
|
||||
PageInfo* out_page_info, Handle debug_handle, uintptr_t address) {
|
||||
PageInfo* out_page_info, Handle process_handle, uint64_t address) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
|
||||
Result ReadDebugProcessMemory(Core::System& system, uintptr_t buffer, Handle debug_handle,
|
||||
uintptr_t address, size_t size) {
|
||||
Result ReadDebugProcessMemory(Core::System& system, uint64_t buffer, Handle debug_handle,
|
||||
uint64_t address, uint64_t size) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
|
||||
Result WriteDebugProcessMemory(Core::System& system, Handle debug_handle, uintptr_t buffer,
|
||||
uintptr_t address, size_t size) {
|
||||
Result WriteDebugProcessMemory(Core::System& system, Handle debug_handle, uint64_t buffer,
|
||||
uint64_t address, uint64_t size) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
|
||||
@@ -76,8 +76,8 @@ constexpr bool IsValidDeviceMemoryPermission(MemoryPermission device_perm) {
|
||||
}
|
||||
|
||||
Result MapDeviceAddressSpaceByForce(Core::System& system, Handle das_handle, Handle process_handle,
|
||||
uint64_t process_address, size_t size, uint64_t device_address,
|
||||
u32 option) {
|
||||
uint64_t process_address, uint64_t size,
|
||||
uint64_t device_address, u32 option) {
|
||||
// Decode the option.
|
||||
const MapDeviceAddressSpaceOption option_pack{option};
|
||||
const auto device_perm = option_pack.permission;
|
||||
@@ -90,7 +90,7 @@ Result MapDeviceAddressSpaceByForce(Core::System& system, Handle das_handle, Han
|
||||
R_UNLESS(size > 0, ResultInvalidSize);
|
||||
R_UNLESS((process_address < process_address + size), ResultInvalidCurrentMemory);
|
||||
R_UNLESS((device_address < device_address + size), ResultInvalidMemoryRegion);
|
||||
R_UNLESS((process_address == static_cast<uintptr_t>(process_address)),
|
||||
R_UNLESS((process_address == static_cast<uint64_t>(process_address)),
|
||||
ResultInvalidCurrentMemory);
|
||||
R_UNLESS(IsValidDeviceMemoryPermission(device_perm), ResultInvalidNewMemoryPermission);
|
||||
R_UNLESS(reserved == 0, ResultInvalidEnumValue);
|
||||
@@ -116,8 +116,8 @@ Result MapDeviceAddressSpaceByForce(Core::System& system, Handle das_handle, Han
|
||||
}
|
||||
|
||||
Result MapDeviceAddressSpaceAligned(Core::System& system, Handle das_handle, Handle process_handle,
|
||||
uint64_t process_address, size_t size, uint64_t device_address,
|
||||
u32 option) {
|
||||
uint64_t process_address, uint64_t size,
|
||||
uint64_t device_address, u32 option) {
|
||||
// Decode the option.
|
||||
const MapDeviceAddressSpaceOption option_pack{option};
|
||||
const auto device_perm = option_pack.permission;
|
||||
@@ -131,7 +131,7 @@ Result MapDeviceAddressSpaceAligned(Core::System& system, Handle das_handle, Han
|
||||
R_UNLESS(size > 0, ResultInvalidSize);
|
||||
R_UNLESS((process_address < process_address + size), ResultInvalidCurrentMemory);
|
||||
R_UNLESS((device_address < device_address + size), ResultInvalidMemoryRegion);
|
||||
R_UNLESS((process_address == static_cast<uintptr_t>(process_address)),
|
||||
R_UNLESS((process_address == static_cast<uint64_t>(process_address)),
|
||||
ResultInvalidCurrentMemory);
|
||||
R_UNLESS(IsValidDeviceMemoryPermission(device_perm), ResultInvalidNewMemoryPermission);
|
||||
R_UNLESS(reserved == 0, ResultInvalidEnumValue);
|
||||
@@ -157,7 +157,7 @@ Result MapDeviceAddressSpaceAligned(Core::System& system, Handle das_handle, Han
|
||||
}
|
||||
|
||||
Result UnmapDeviceAddressSpace(Core::System& system, Handle das_handle, Handle process_handle,
|
||||
uint64_t process_address, size_t size, uint64_t device_address) {
|
||||
uint64_t process_address, uint64_t size, uint64_t device_address) {
|
||||
// Validate input.
|
||||
R_UNLESS(Common::IsAligned(process_address, PageSize), ResultInvalidAddress);
|
||||
R_UNLESS(Common::IsAligned(device_address, PageSize), ResultInvalidAddress);
|
||||
@@ -165,7 +165,7 @@ Result UnmapDeviceAddressSpace(Core::System& system, Handle das_handle, Handle p
|
||||
R_UNLESS(size > 0, ResultInvalidSize);
|
||||
R_UNLESS((process_address < process_address + size), ResultInvalidCurrentMemory);
|
||||
R_UNLESS((device_address < device_address + size), ResultInvalidMemoryRegion);
|
||||
R_UNLESS((process_address == static_cast<uintptr_t>(process_address)),
|
||||
R_UNLESS((process_address == static_cast<uint64_t>(process_address)),
|
||||
ResultInvalidCurrentMemory);
|
||||
|
||||
// Get the device address space.
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
|
||||
namespace Kernel::Svc {
|
||||
|
||||
Result MapInsecureMemory(Core::System& system, uintptr_t address, size_t size) {
|
||||
Result MapInsecureMemory(Core::System& system, uint64_t address, uint64_t size) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
|
||||
Result UnmapInsecureMemory(Core::System& system, uintptr_t address, size_t size) {
|
||||
Result UnmapInsecureMemory(Core::System& system, uint64_t address, uint64_t size) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
|
||||
@@ -12,19 +12,19 @@ Result CreateIoPool(Core::System& system, Handle* out, IoPoolType pool_type) {
|
||||
}
|
||||
|
||||
Result CreateIoRegion(Core::System& system, Handle* out, Handle io_pool_handle, uint64_t phys_addr,
|
||||
size_t size, MemoryMapping mapping, MemoryPermission perm) {
|
||||
uint64_t size, MemoryMapping mapping, MemoryPermission perm) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
|
||||
Result MapIoRegion(Core::System& system, Handle io_region_handle, uintptr_t address, size_t size,
|
||||
Result MapIoRegion(Core::System& system, Handle io_region_handle, uint64_t address, uint64_t size,
|
||||
MemoryPermission map_perm) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
|
||||
Result UnmapIoRegion(Core::System& system, Handle io_region_handle, uintptr_t address,
|
||||
size_t size) {
|
||||
Result UnmapIoRegion(Core::System& system, Handle io_region_handle, uint64_t address,
|
||||
uint64_t size) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ Result SetUnsafeLimit64(Core::System& system, uint64_t limit) {
|
||||
R_RETURN(SetUnsafeLimit(system, limit));
|
||||
}
|
||||
|
||||
Result SetHeapSize64From32(Core::System& system, uintptr_t* out_address, uint32_t size) {
|
||||
Result SetHeapSize64From32(Core::System& system, uint64_t* out_address, uint32_t size) {
|
||||
R_RETURN(SetHeapSize(system, out_address, size));
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ Result ConnectToNamedPort(Core::System& system, Handle* out, VAddr port_name_add
|
||||
}
|
||||
|
||||
Result CreatePort(Core::System& system, Handle* out_server, Handle* out_client,
|
||||
int32_t max_sessions, bool is_light, uintptr_t name) {
|
||||
int32_t max_sessions, bool is_light, uint64_t name) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ Result SetProcessMemoryPermission(Core::System& system, Handle process_handle, V
|
||||
R_UNLESS(Common::IsAligned(size, PageSize), ResultInvalidSize);
|
||||
R_UNLESS(size > 0, ResultInvalidSize);
|
||||
R_UNLESS((address < address + size), ResultInvalidCurrentMemory);
|
||||
R_UNLESS(address == static_cast<uintptr_t>(address), ResultInvalidCurrentMemory);
|
||||
R_UNLESS(size == static_cast<size_t>(size), ResultInvalidCurrentMemory);
|
||||
R_UNLESS(address == static_cast<uint64_t>(address), ResultInvalidCurrentMemory);
|
||||
R_UNLESS(size == static_cast<uint64_t>(size), ResultInvalidCurrentMemory);
|
||||
|
||||
// Validate the memory permission.
|
||||
R_UNLESS(IsValidProcessMemoryPermission(perm), ResultInvalidNewMemoryPermission);
|
||||
|
||||
@@ -443,7 +443,7 @@ def emit_wrapper(wrapped_fn, suffix, register_info, arguments, byte_size):
|
||||
lines.append("")
|
||||
|
||||
for output_type, var_name, _, is_address in output_writes:
|
||||
output_type = "uintptr_t" if is_address else output_type
|
||||
output_type = "uint64_t" if is_address else output_type
|
||||
lines.append(f"{output_type} {var_name}{{}};")
|
||||
for input_type, var_name, _ in input_reads:
|
||||
lines.append(f"{input_type} {var_name}{{}};")
|
||||
@@ -630,7 +630,7 @@ def emit_call(bitness, names, suffix):
|
||||
def build_fn_declaration(return_type, name, arguments):
|
||||
arg_list = ["Core::System& system"]
|
||||
for arg in arguments:
|
||||
type_name = "uintptr_t" if arg.is_address else arg.type_name
|
||||
type_name = "uint64_t" if arg.is_address else arg.type_name
|
||||
pointer = "*" if arg.is_output and not arg.is_outptr else ""
|
||||
arg_list.append(f"{type_name}{pointer} {arg.var_name}")
|
||||
|
||||
|
||||
@@ -76,6 +76,8 @@ public:
|
||||
{141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+
|
||||
{142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+
|
||||
{150, nullptr, "CreateAuthorizationRequest"},
|
||||
{160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"},
|
||||
{161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -136,7 +138,10 @@ public:
|
||||
{140, nullptr, "GetNetworkServiceLicenseCache"}, // 5.0.0+
|
||||
{141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+
|
||||
{142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+
|
||||
{143, nullptr, "GetNetworkServiceLicenseCacheEx"},
|
||||
{150, nullptr, "CreateAuthorizationRequest"},
|
||||
{160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"},
|
||||
{161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"},
|
||||
{200, nullptr, "IsRegistered"},
|
||||
{201, nullptr, "RegisterAsync"},
|
||||
{202, nullptr, "UnregisterAsync"},
|
||||
@@ -242,6 +247,7 @@ public:
|
||||
{100, nullptr, "GetRequestWithTheme"},
|
||||
{101, nullptr, "IsNetworkServiceAccountReplaced"},
|
||||
{199, nullptr, "GetUrlForIntroductionOfExtraMembership"}, // 2.0.0 - 5.1.0
|
||||
{200, nullptr, "ApplyAsyncWithAuthorizedToken"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -647,9 +653,11 @@ public:
|
||||
{0, nullptr, "EnsureAuthenticationTokenCacheAsync"},
|
||||
{1, nullptr, "LoadAuthenticationTokenCache"},
|
||||
{2, nullptr, "InvalidateAuthenticationTokenCache"},
|
||||
{3, nullptr, "IsDeviceAuthenticationTokenCacheAvailable"},
|
||||
{10, nullptr, "EnsureEdgeTokenCacheAsync"},
|
||||
{11, nullptr, "LoadEdgeTokenCache"},
|
||||
{12, nullptr, "InvalidateEdgeTokenCache"},
|
||||
{13, nullptr, "IsEdgeTokenCacheAvailable"},
|
||||
{20, nullptr, "EnsureApplicationAuthenticationCacheAsync"},
|
||||
{21, nullptr, "LoadApplicationAuthenticationTokenCache"},
|
||||
{22, nullptr, "LoadApplicationNetworkServiceClientConfigCache"},
|
||||
|
||||
@@ -55,6 +55,10 @@ ACC_SU::ACC_SU(std::shared_ptr<Module> module_, std::shared_ptr<ProfileManager>
|
||||
{290, nullptr, "ProxyProcedureForGuestLoginWithNintendoAccount"},
|
||||
{291, nullptr, "ProxyProcedureForFloatingRegistrationWithNintendoAccount"},
|
||||
{299, nullptr, "SuspendBackgroundDaemon"},
|
||||
{900, nullptr, "SetUserUnqualifiedForDebug"},
|
||||
{901, nullptr, "UnsetUserUnqualifiedForDebug"},
|
||||
{902, nullptr, "ListUsersUnqualifiedForDebug"},
|
||||
{910, nullptr, "RefreshFirmwareSettingsForDebug"},
|
||||
{997, nullptr, "DebugInvalidateTokenCacheForUser"},
|
||||
{998, nullptr, "DebugSetUserStateClose"},
|
||||
{999, nullptr, "DebugSetUserStateOpen"},
|
||||
|
||||
@@ -226,6 +226,8 @@ IDebugFunctions::IDebugFunctions(Core::System& system_)
|
||||
{30, nullptr, "RequestLaunchApplicationWithUserAndArgumentForDebug"},
|
||||
{31, nullptr, "RequestLaunchApplicationByApplicationLaunchInfoForDebug"},
|
||||
{40, nullptr, "GetAppletResourceUsageInfo"},
|
||||
{50, nullptr, "AddSystemProgramIdAndAppletIdForDebug"},
|
||||
{51, nullptr, "AddOperationConfirmedLibraryAppletIdForDebug"},
|
||||
{100, nullptr, "SetCpuBoostModeForApplet"},
|
||||
{101, nullptr, "CancelCpuBoostModeForApplet"},
|
||||
{110, nullptr, "PushToAppletBoundChannelForDebug"},
|
||||
@@ -237,6 +239,8 @@ IDebugFunctions::IDebugFunctions(Core::System& system_)
|
||||
{131, nullptr, "FriendInvitationClearApplicationParameter"},
|
||||
{132, nullptr, "FriendInvitationPushApplicationParameter"},
|
||||
{140, nullptr, "RestrictPowerOperationForSecureLaunchModeForDebug"},
|
||||
{200, nullptr, "CreateFloatingLibraryAppletAccepterForDebug"},
|
||||
{300, nullptr, "TerminateAllRunningApplicationsForDebug"},
|
||||
{900, nullptr, "GetGrcProcessLaunchedSystemEvent"},
|
||||
};
|
||||
// clang-format on
|
||||
@@ -1260,9 +1264,8 @@ void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContex
|
||||
return;
|
||||
}
|
||||
|
||||
const u8* const mem_begin = system.Memory().GetPointer(transfer_mem->GetSourceAddress());
|
||||
const u8* const mem_end = mem_begin + transfer_mem->GetSize();
|
||||
std::vector<u8> memory{mem_begin, mem_end};
|
||||
std::vector<u8> memory(transfer_mem->GetSize());
|
||||
system.Memory().ReadBlock(transfer_mem->GetSourceAddress(), memory.data(), memory.size());
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||
rb.Push(ResultSuccess);
|
||||
@@ -1294,9 +1297,8 @@ void ILibraryAppletCreator::CreateHandleStorage(Kernel::HLERequestContext& ctx)
|
||||
return;
|
||||
}
|
||||
|
||||
const u8* const mem_begin = system.Memory().GetPointer(transfer_mem->GetSourceAddress());
|
||||
const u8* const mem_end = mem_begin + transfer_mem->GetSize();
|
||||
std::vector<u8> memory{mem_begin, mem_end};
|
||||
std::vector<u8> memory(transfer_mem->GetSize());
|
||||
system.Memory().ReadBlock(transfer_mem->GetSourceAddress(), memory.data(), memory.size());
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||
rb.Push(ResultSuccess);
|
||||
@@ -1855,6 +1857,8 @@ IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_)
|
||||
{31, nullptr, "GetWriterLockAccessorEx"},
|
||||
{40, nullptr, "IsSleepEnabled"},
|
||||
{41, nullptr, "IsRebootEnabled"},
|
||||
{50, nullptr, "LaunchSystemApplet"},
|
||||
{51, nullptr, "LaunchStarter"},
|
||||
{100, nullptr, "PopRequestLaunchApplicationForDebug"},
|
||||
{110, nullptr, "IsForceTerminateApplicationDisabledForDebug"},
|
||||
{200, nullptr, "LaunchDevMenu"},
|
||||
|
||||
@@ -129,6 +129,9 @@ AOC_U::AOC_U(Core::System& system_)
|
||||
{101, &AOC_U::CreatePermanentEcPurchasedEventManager, "CreatePermanentEcPurchasedEventManager"},
|
||||
{110, nullptr, "CreateContentsServiceManager"},
|
||||
{200, nullptr, "SetRequiredAddOnContentsOnContentsAvailabilityTransition"},
|
||||
{300, nullptr, "SetupHostAddOnContent"},
|
||||
{301, nullptr, "GetRegisteredAddOnContentPath"},
|
||||
{302, nullptr, "UpdateCachedList"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
||||
@@ -362,6 +362,8 @@ HwOpus::HwOpus(Core::System& system_) : ServiceFramework{system_, "hwopus"} {
|
||||
{5, &HwOpus::GetWorkBufferSizeEx, "GetWorkBufferSizeEx"},
|
||||
{6, nullptr, "OpenHardwareOpusDecoderForMultiStreamEx"},
|
||||
{7, &HwOpus::GetWorkBufferSizeForMultiStreamEx, "GetWorkBufferSizeForMultiStreamEx"},
|
||||
{8, nullptr, "GetWorkBufferSizeExEx"},
|
||||
{9, nullptr, "GetWorkBufferSizeForMultiStreamExEx"},
|
||||
};
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
@@ -72,32 +72,36 @@ private:
|
||||
void AcquireBleScanEvent(Kernel::HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service_BTM, "(STUBBED) called");
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2, 1};
|
||||
IPC::ResponseBuilder rb{ctx, 3, 1};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(true);
|
||||
rb.PushCopyObjects(scan_event->GetReadableEvent());
|
||||
}
|
||||
|
||||
void AcquireBleConnectionEvent(Kernel::HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service_BTM, "(STUBBED) called");
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2, 1};
|
||||
IPC::ResponseBuilder rb{ctx, 3, 1};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(true);
|
||||
rb.PushCopyObjects(connection_event->GetReadableEvent());
|
||||
}
|
||||
|
||||
void AcquireBleServiceDiscoveryEvent(Kernel::HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service_BTM, "(STUBBED) called");
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2, 1};
|
||||
IPC::ResponseBuilder rb{ctx, 3, 1};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(true);
|
||||
rb.PushCopyObjects(service_discovery_event->GetReadableEvent());
|
||||
}
|
||||
|
||||
void AcquireBleMtuConfigEvent(Kernel::HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service_BTM, "(STUBBED) called");
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2, 1};
|
||||
IPC::ResponseBuilder rb{ctx, 3, 1};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(true);
|
||||
rb.PushCopyObjects(config_event->GetReadableEvent());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "core/core.h"
|
||||
#include "core/core_timing.h"
|
||||
#include "core/hid/emulated_console.h"
|
||||
#include "core/hid/hid_core.h"
|
||||
#include "core/hle/service/hid/controllers/console_sixaxis.h"
|
||||
#include "core/memory.h"
|
||||
|
||||
namespace Service::HID {
|
||||
constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3C200;
|
||||
|
||||
Controller_ConsoleSixAxis::Controller_ConsoleSixAxis(Core::HID::HIDCore& hid_core_,
|
||||
u8* raw_shared_memory_)
|
||||
: ControllerBase{hid_core_} {
|
||||
Controller_ConsoleSixAxis::Controller_ConsoleSixAxis(Core::System& system_, u8* raw_shared_memory_)
|
||||
: ControllerBase{system_.HIDCore()}, system{system_} {
|
||||
console = hid_core.GetEmulatedConsole();
|
||||
static_assert(SHARED_MEMORY_OFFSET + sizeof(ConsoleSharedMemory) < shared_memory_size,
|
||||
"ConsoleSharedMemory is bigger than the shared memory");
|
||||
@@ -26,7 +27,7 @@ void Controller_ConsoleSixAxis::OnInit() {}
|
||||
void Controller_ConsoleSixAxis::OnRelease() {}
|
||||
|
||||
void Controller_ConsoleSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
||||
if (!IsControllerActivated() || !is_transfer_memory_set) {
|
||||
if (!IsControllerActivated() || transfer_memory == 0) {
|
||||
seven_sixaxis_lifo.buffer_count = 0;
|
||||
seven_sixaxis_lifo.buffer_tail = 0;
|
||||
return;
|
||||
@@ -59,11 +60,10 @@ void Controller_ConsoleSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_ti
|
||||
|
||||
// Update seven six axis transfer memory
|
||||
seven_sixaxis_lifo.WriteNextEntry(next_seven_sixaxis_state);
|
||||
std::memcpy(transfer_memory, &seven_sixaxis_lifo, sizeof(seven_sixaxis_lifo));
|
||||
system.Memory().WriteBlock(transfer_memory, &seven_sixaxis_lifo, sizeof(seven_sixaxis_lifo));
|
||||
}
|
||||
|
||||
void Controller_ConsoleSixAxis::SetTransferMemoryPointer(u8* t_mem) {
|
||||
is_transfer_memory_set = true;
|
||||
void Controller_ConsoleSixAxis::SetTransferMemoryAddress(VAddr t_mem) {
|
||||
transfer_memory = t_mem;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
#include "core/hle/service/hid/controllers/controller_base.h"
|
||||
#include "core/hle/service/hid/ring_lifo.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
} // namespace Core
|
||||
|
||||
namespace Core::HID {
|
||||
class EmulatedConsole;
|
||||
} // namespace Core::HID
|
||||
@@ -17,7 +21,7 @@ class EmulatedConsole;
|
||||
namespace Service::HID {
|
||||
class Controller_ConsoleSixAxis final : public ControllerBase {
|
||||
public:
|
||||
explicit Controller_ConsoleSixAxis(Core::HID::HIDCore& hid_core_, u8* raw_shared_memory_);
|
||||
explicit Controller_ConsoleSixAxis(Core::System& system_, u8* raw_shared_memory_);
|
||||
~Controller_ConsoleSixAxis() override;
|
||||
|
||||
// Called when the controller is initialized
|
||||
@@ -30,7 +34,7 @@ public:
|
||||
void OnUpdate(const Core::Timing::CoreTiming& core_timing) override;
|
||||
|
||||
// Called on InitializeSevenSixAxisSensor
|
||||
void SetTransferMemoryPointer(u8* t_mem);
|
||||
void SetTransferMemoryAddress(VAddr t_mem);
|
||||
|
||||
// Called on ResetSevenSixAxisSensorTimestamp
|
||||
void ResetTimestamp();
|
||||
@@ -62,12 +66,13 @@ private:
|
||||
static_assert(sizeof(seven_sixaxis_lifo) == 0xA70, "SevenSixAxisState is an invalid size");
|
||||
|
||||
SevenSixAxisState next_seven_sixaxis_state{};
|
||||
u8* transfer_memory = nullptr;
|
||||
VAddr transfer_memory{};
|
||||
ConsoleSharedMemory* shared_memory = nullptr;
|
||||
Core::HID::EmulatedConsole* console = nullptr;
|
||||
|
||||
bool is_transfer_memory_set = false;
|
||||
u64 last_saved_timestamp{};
|
||||
u64 last_global_timestamp{};
|
||||
|
||||
Core::System& system;
|
||||
};
|
||||
} // namespace Service::HID
|
||||
|
||||
@@ -65,6 +65,11 @@ void Controller_Gesture::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
||||
}
|
||||
|
||||
void Controller_Gesture::ReadTouchInput() {
|
||||
if (!Settings::values.touchscreen.enabled) {
|
||||
fingers = {};
|
||||
return;
|
||||
}
|
||||
|
||||
const auto touch_status = console->GetTouch();
|
||||
for (std::size_t id = 0; id < fingers.size(); ++id) {
|
||||
fingers[id] = touch_status[id];
|
||||
|
||||
@@ -33,10 +33,11 @@ void Controller_Mouse::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
||||
return;
|
||||
}
|
||||
|
||||
next_state = {};
|
||||
|
||||
const auto& last_entry = shared_memory->mouse_lifo.ReadCurrentEntry().state;
|
||||
next_state.sampling_number = last_entry.sampling_number + 1;
|
||||
|
||||
next_state.attribute.raw = 0;
|
||||
if (Settings::values.mouse_enabled) {
|
||||
const auto& mouse_button_state = emulated_devices->GetMouseButtons();
|
||||
const auto& mouse_position_state = emulated_devices->GetMousePosition();
|
||||
|
||||
@@ -152,7 +152,7 @@ Result Controller_Palma::WritePalmaRgbLedPatternEntry(const PalmaConnectionHandl
|
||||
}
|
||||
|
||||
Result Controller_Palma::WritePalmaWaveEntry(const PalmaConnectionHandle& handle, PalmaWaveSet wave,
|
||||
u8* t_mem, u64 size) {
|
||||
VAddr t_mem, u64 size) {
|
||||
if (handle.npad_id != active_handle.npad_id) {
|
||||
return InvalidPalmaHandle;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
Result ReadPalmaUniqueCode(const PalmaConnectionHandle& handle);
|
||||
Result SetPalmaUniqueCodeInvalid(const PalmaConnectionHandle& handle);
|
||||
Result WritePalmaRgbLedPatternEntry(const PalmaConnectionHandle& handle, u64 unknown);
|
||||
Result WritePalmaWaveEntry(const PalmaConnectionHandle& handle, PalmaWaveSet wave, u8* t_mem,
|
||||
Result WritePalmaWaveEntry(const PalmaConnectionHandle& handle, PalmaWaveSet wave, VAddr t_mem,
|
||||
u64 size);
|
||||
Result SetPalmaDataBaseIdentificationVersion(const PalmaConnectionHandle& handle,
|
||||
s32 database_id_version_);
|
||||
|
||||
@@ -58,6 +58,11 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin
|
||||
}
|
||||
|
||||
if (!finger.pressed && current_touch.pressed) {
|
||||
// Ignore all touch fingers if disabled
|
||||
if (!Settings::values.touchscreen.enabled) {
|
||||
continue;
|
||||
}
|
||||
|
||||
finger.attribute.start_touch.Assign(1);
|
||||
finger.pressed = true;
|
||||
finger.position = current_touch.position;
|
||||
|
||||
@@ -63,6 +63,7 @@ IAppletResource::IAppletResource(Core::System& system_,
|
||||
MakeControllerWithServiceContext<Controller_NPad>(HidController::NPad, shared_memory);
|
||||
MakeController<Controller_Gesture>(HidController::Gesture, shared_memory);
|
||||
MakeController<Controller_ConsoleSixAxis>(HidController::ConsoleSixAxisSensor, shared_memory);
|
||||
MakeController<Controller_Stubbed>(HidController::DebugMouse, shared_memory);
|
||||
MakeControllerWithServiceContext<Controller_Palma>(HidController::Palma, shared_memory);
|
||||
|
||||
// Homebrew doesn't try to activate some controllers, so we activate them by default
|
||||
@@ -74,6 +75,7 @@ IAppletResource::IAppletResource(Core::System& system_,
|
||||
GetController<Controller_Stubbed>(HidController::CaptureButton).SetCommonHeaderOffset(0x5000);
|
||||
GetController<Controller_Stubbed>(HidController::InputDetector).SetCommonHeaderOffset(0x5200);
|
||||
GetController<Controller_Stubbed>(HidController::UniquePad).SetCommonHeaderOffset(0x5A00);
|
||||
GetController<Controller_Stubbed>(HidController::DebugMouse).SetCommonHeaderOffset(0x3DC00);
|
||||
|
||||
// Register update callbacks
|
||||
npad_update_event = Core::Timing::CreateEvent(
|
||||
@@ -236,6 +238,7 @@ Hid::Hid(Core::System& system_)
|
||||
{1, &Hid::ActivateDebugPad, "ActivateDebugPad"},
|
||||
{11, &Hid::ActivateTouchScreen, "ActivateTouchScreen"},
|
||||
{21, &Hid::ActivateMouse, "ActivateMouse"},
|
||||
{26, nullptr, "ActivateDebugMouse"},
|
||||
{31, &Hid::ActivateKeyboard, "ActivateKeyboard"},
|
||||
{32, &Hid::SendKeyboardLockKeyEvent, "SendKeyboardLockKeyEvent"},
|
||||
{40, nullptr, "AcquireXpadIdEventHandle"},
|
||||
@@ -1858,7 +1861,7 @@ void Hid::InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) {
|
||||
.ActivateController();
|
||||
|
||||
applet_resource->GetController<Controller_ConsoleSixAxis>(HidController::ConsoleSixAxisSensor)
|
||||
.SetTransferMemoryPointer(system.Memory().GetPointer(t_mem_1->GetSourceAddress()));
|
||||
.SetTransferMemoryAddress(t_mem_1->GetSourceAddress());
|
||||
|
||||
LOG_WARNING(Service_HID,
|
||||
"called, t_mem_1_handle=0x{:08X}, t_mem_2_handle=0x{:08X}, "
|
||||
@@ -2145,8 +2148,7 @@ void Hid::WritePalmaWaveEntry(Kernel::HLERequestContext& ctx) {
|
||||
connection_handle.npad_id, wave_set, unknown, t_mem_handle, t_mem_size, size);
|
||||
|
||||
applet_resource->GetController<Controller_Palma>(HidController::Palma)
|
||||
.WritePalmaWaveEntry(connection_handle, wave_set,
|
||||
system.Memory().GetPointer(t_mem->GetSourceAddress()), t_mem_size);
|
||||
.WritePalmaWaveEntry(connection_handle, wave_set, t_mem->GetSourceAddress(), t_mem_size);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(ResultSuccess);
|
||||
@@ -2380,6 +2382,8 @@ public:
|
||||
{20, nullptr, "DeactivateMouse"},
|
||||
{21, nullptr, "SetMouseAutoPilotState"},
|
||||
{22, nullptr, "UnsetMouseAutoPilotState"},
|
||||
{25, nullptr, "SetDebugMouseAutoPilotState"},
|
||||
{26, nullptr, "UnsetDebugMouseAutoPilotState"},
|
||||
{30, nullptr, "DeactivateKeyboard"},
|
||||
{31, nullptr, "SetKeyboardAutoPilotState"},
|
||||
{32, nullptr, "UnsetKeyboardAutoPilotState"},
|
||||
@@ -2495,6 +2499,7 @@ public:
|
||||
{2000, nullptr, "DeactivateDigitizer"},
|
||||
{2001, nullptr, "SetDigitizerAutoPilotState"},
|
||||
{2002, nullptr, "UnsetDigitizerAutoPilotState"},
|
||||
{2002, nullptr, "ReloadFirmwareDebugSettings"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ enum class HidController : std::size_t {
|
||||
NPad,
|
||||
Gesture,
|
||||
ConsoleSixAxisSensor,
|
||||
DebugMouse,
|
||||
Palma,
|
||||
|
||||
MaxControllers,
|
||||
@@ -60,9 +61,15 @@ public:
|
||||
private:
|
||||
template <typename T>
|
||||
void MakeController(HidController controller, u8* shared_memory) {
|
||||
controllers[static_cast<std::size_t>(controller)] =
|
||||
std::make_unique<T>(system.HIDCore(), shared_memory);
|
||||
if constexpr (std::is_constructible_v<T, Core::System&, u8*>) {
|
||||
controllers[static_cast<std::size_t>(controller)] =
|
||||
std::make_unique<T>(system, shared_memory);
|
||||
} else {
|
||||
controllers[static_cast<std::size_t>(controller)] =
|
||||
std::make_unique<T>(system.HIDCore(), shared_memory);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void MakeControllerWithServiceContext(HidController controller, u8* shared_memory) {
|
||||
controllers[static_cast<std::size_t>(controller)] =
|
||||
|
||||
@@ -91,7 +91,7 @@ std::optional<std::size_t> HidBus::GetDeviceIndexFromHandle(BusHandle handle) co
|
||||
if (handle.abstracted_pad_id == device_handle.abstracted_pad_id &&
|
||||
handle.internal_index == device_handle.internal_index &&
|
||||
handle.player_number == device_handle.player_number &&
|
||||
handle.bus_type == device_handle.bus_type &&
|
||||
handle.bus_type_id == device_handle.bus_type_id &&
|
||||
handle.is_valid == device_handle.is_valid) {
|
||||
return i;
|
||||
}
|
||||
@@ -123,7 +123,7 @@ void HidBus::GetBusHandle(Kernel::HLERequestContext& ctx) {
|
||||
continue;
|
||||
}
|
||||
if (static_cast<Core::HID::NpadIdType>(handle.player_number) == parameters.npad_id &&
|
||||
handle.bus_type == parameters.bus_type) {
|
||||
handle.bus_type_id == static_cast<u8>(parameters.bus_type)) {
|
||||
is_handle_found = true;
|
||||
handle_index = i;
|
||||
break;
|
||||
@@ -140,7 +140,7 @@ void HidBus::GetBusHandle(Kernel::HLERequestContext& ctx) {
|
||||
.abstracted_pad_id = static_cast<u8>(i),
|
||||
.internal_index = static_cast<u8>(i),
|
||||
.player_number = static_cast<u8>(parameters.npad_id),
|
||||
.bus_type = parameters.bus_type,
|
||||
.bus_type_id = static_cast<u8>(parameters.bus_type),
|
||||
.is_valid = true,
|
||||
};
|
||||
handle_index = i;
|
||||
@@ -172,7 +172,7 @@ void HidBus::IsExternalDeviceConnected(Kernel::HLERequestContext& ctx) {
|
||||
LOG_INFO(Service_HID,
|
||||
"Called, abstracted_pad_id={}, bus_type={}, internal_index={}, "
|
||||
"player_number={}, is_valid={}",
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index,
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index,
|
||||
bus_handle_.player_number, bus_handle_.is_valid);
|
||||
|
||||
const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
|
||||
@@ -201,7 +201,7 @@ void HidBus::Initialize(Kernel::HLERequestContext& ctx) {
|
||||
LOG_INFO(Service_HID,
|
||||
"called, abstracted_pad_id={} bus_type={} internal_index={} "
|
||||
"player_number={} is_valid={}, applet_resource_user_id={}",
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index,
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index,
|
||||
bus_handle_.player_number, bus_handle_.is_valid, applet_resource_user_id);
|
||||
|
||||
is_hidbus_enabled = true;
|
||||
@@ -253,7 +253,7 @@ void HidBus::Finalize(Kernel::HLERequestContext& ctx) {
|
||||
LOG_INFO(Service_HID,
|
||||
"called, abstracted_pad_id={}, bus_type={}, internal_index={}, "
|
||||
"player_number={}, is_valid={}, applet_resource_user_id={}",
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index,
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index,
|
||||
bus_handle_.player_number, bus_handle_.is_valid, applet_resource_user_id);
|
||||
|
||||
const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
|
||||
@@ -301,7 +301,7 @@ void HidBus::EnableExternalDevice(Kernel::HLERequestContext& ctx) {
|
||||
"called, enable={}, abstracted_pad_id={}, bus_type={}, internal_index={}, "
|
||||
"player_number={}, is_valid={}, inval={}, applet_resource_user_id{}",
|
||||
parameters.enable, parameters.bus_handle.abstracted_pad_id,
|
||||
parameters.bus_handle.bus_type, parameters.bus_handle.internal_index,
|
||||
parameters.bus_handle.bus_type_id, parameters.bus_handle.internal_index,
|
||||
parameters.bus_handle.player_number, parameters.bus_handle.is_valid, parameters.inval,
|
||||
parameters.applet_resource_user_id);
|
||||
|
||||
@@ -329,7 +329,7 @@ void HidBus::GetExternalDeviceId(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_HID,
|
||||
"called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, "
|
||||
"is_valid={}",
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index,
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index,
|
||||
bus_handle_.player_number, bus_handle_.is_valid);
|
||||
|
||||
const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
|
||||
@@ -357,7 +357,7 @@ void HidBus::SendCommandAsync(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_HID,
|
||||
"called, data_size={}, abstracted_pad_id={}, bus_type={}, internal_index={}, "
|
||||
"player_number={}, is_valid={}",
|
||||
data.size(), bus_handle_.abstracted_pad_id, bus_handle_.bus_type,
|
||||
data.size(), bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id,
|
||||
bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid);
|
||||
|
||||
const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
|
||||
@@ -384,7 +384,7 @@ void HidBus::GetSendCommandAsynceResult(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_HID,
|
||||
"called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, "
|
||||
"is_valid={}",
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index,
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index,
|
||||
bus_handle_.player_number, bus_handle_.is_valid);
|
||||
|
||||
const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
|
||||
@@ -413,7 +413,7 @@ void HidBus::SetEventForSendCommandAsycResult(Kernel::HLERequestContext& ctx) {
|
||||
LOG_INFO(Service_HID,
|
||||
"called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, "
|
||||
"is_valid={}",
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index,
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index,
|
||||
bus_handle_.player_number, bus_handle_.is_valid);
|
||||
|
||||
const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
|
||||
@@ -464,7 +464,7 @@ void HidBus::EnableJoyPollingReceiveMode(Kernel::HLERequestContext& ctx) {
|
||||
LOG_INFO(Service_HID,
|
||||
"called, t_mem_handle=0x{:08X}, polling_mode={}, abstracted_pad_id={}, bus_type={}, "
|
||||
"internal_index={}, player_number={}, is_valid={}",
|
||||
t_mem_handle, polling_mode_, bus_handle_.abstracted_pad_id, bus_handle_.bus_type,
|
||||
t_mem_handle, polling_mode_, bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id,
|
||||
bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid);
|
||||
|
||||
const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
|
||||
@@ -472,7 +472,7 @@ void HidBus::EnableJoyPollingReceiveMode(Kernel::HLERequestContext& ctx) {
|
||||
if (device_index) {
|
||||
auto& device = devices[device_index.value()].device;
|
||||
device->SetPollingMode(polling_mode_);
|
||||
device->SetTransferMemoryPointer(system.Memory().GetPointer(t_mem->GetSourceAddress()));
|
||||
device->SetTransferMemoryAddress(t_mem->GetSourceAddress());
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(ResultSuccess);
|
||||
@@ -492,7 +492,7 @@ void HidBus::DisableJoyPollingReceiveMode(Kernel::HLERequestContext& ctx) {
|
||||
LOG_INFO(Service_HID,
|
||||
"called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, "
|
||||
"is_valid={}",
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index,
|
||||
bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index,
|
||||
bus_handle_.player_number, bus_handle_.is_valid);
|
||||
|
||||
const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
|
||||
|
||||
@@ -41,7 +41,7 @@ private:
|
||||
};
|
||||
|
||||
// This is nn::hidbus::BusType
|
||||
enum class BusType : u8 {
|
||||
enum class BusType : u32 {
|
||||
LeftJoyRail,
|
||||
RightJoyRail,
|
||||
InternalBus, // Lark microphone
|
||||
@@ -54,7 +54,7 @@ private:
|
||||
u32 abstracted_pad_id;
|
||||
u8 internal_index;
|
||||
u8 player_number;
|
||||
BusType bus_type;
|
||||
u8 bus_type_id;
|
||||
bool is_valid;
|
||||
};
|
||||
static_assert(sizeof(BusHandle) == 0x8, "BusHandle is an invalid size");
|
||||
@@ -115,8 +115,7 @@ private:
|
||||
void MakeDevice(BusHandle handle) {
|
||||
const auto device_index = GetDeviceIndexFromHandle(handle);
|
||||
if (device_index) {
|
||||
devices[device_index.value()].device =
|
||||
std::make_unique<T>(system.HIDCore(), service_context);
|
||||
devices[device_index.value()].device = std::make_unique<T>(system, service_context);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
namespace Service::HID {
|
||||
|
||||
HidbusBase::HidbusBase(KernelHelpers::ServiceContext& service_context_)
|
||||
: service_context(service_context_) {
|
||||
HidbusBase::HidbusBase(Core::System& system_, KernelHelpers::ServiceContext& service_context_)
|
||||
: system(system_), service_context(service_context_) {
|
||||
send_command_async_event = service_context.CreateEvent("hidbus:SendCommandAsyncEvent");
|
||||
}
|
||||
HidbusBase::~HidbusBase() = default;
|
||||
@@ -59,8 +59,7 @@ void HidbusBase::DisablePollingMode() {
|
||||
polling_mode_enabled = false;
|
||||
}
|
||||
|
||||
void HidbusBase::SetTransferMemoryPointer(u8* t_mem) {
|
||||
is_transfer_memory_set = true;
|
||||
void HidbusBase::SetTransferMemoryAddress(VAddr t_mem) {
|
||||
transfer_memory = t_mem;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
#include "common/common_types.h"
|
||||
#include "core/hle/result.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace Kernel {
|
||||
class KEvent;
|
||||
class KReadableEvent;
|
||||
@@ -106,7 +110,7 @@ static_assert(sizeof(ButtonOnlyPollingDataAccessor) == 0x2F0,
|
||||
|
||||
class HidbusBase {
|
||||
public:
|
||||
explicit HidbusBase(KernelHelpers::ServiceContext& service_context_);
|
||||
explicit HidbusBase(Core::System& system_, KernelHelpers::ServiceContext& service_context_);
|
||||
virtual ~HidbusBase();
|
||||
|
||||
void ActivateDevice();
|
||||
@@ -134,7 +138,7 @@ public:
|
||||
void DisablePollingMode();
|
||||
|
||||
// Called on EnableJoyPollingReceiveMode
|
||||
void SetTransferMemoryPointer(u8* t_mem);
|
||||
void SetTransferMemoryAddress(VAddr t_mem);
|
||||
|
||||
Kernel::KReadableEvent& GetSendCommandAsycEvent() const;
|
||||
|
||||
@@ -170,9 +174,9 @@ protected:
|
||||
JoyEnableSixAxisDataAccessor enable_sixaxis_data{};
|
||||
ButtonOnlyPollingDataAccessor button_only_data{};
|
||||
|
||||
u8* transfer_memory{nullptr};
|
||||
bool is_transfer_memory_set{};
|
||||
VAddr transfer_memory{};
|
||||
|
||||
Core::System& system;
|
||||
Kernel::KEvent* send_command_async_event;
|
||||
KernelHelpers::ServiceContext& service_context;
|
||||
};
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "core/core.h"
|
||||
#include "core/hid/emulated_controller.h"
|
||||
#include "core/hid/hid_core.h"
|
||||
#include "core/hle/kernel/k_event.h"
|
||||
#include "core/hle/kernel/k_readable_event.h"
|
||||
#include "core/hle/service/hid/hidbus/ringcon.h"
|
||||
#include "core/memory.h"
|
||||
|
||||
namespace Service::HID {
|
||||
|
||||
RingController::RingController(Core::HID::HIDCore& hid_core_,
|
||||
RingController::RingController(Core::System& system_,
|
||||
KernelHelpers::ServiceContext& service_context_)
|
||||
: HidbusBase(service_context_) {
|
||||
input = hid_core_.GetEmulatedController(Core::HID::NpadIdType::Player1);
|
||||
: HidbusBase(system_, service_context_) {
|
||||
input = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
|
||||
}
|
||||
|
||||
RingController::~RingController() = default;
|
||||
@@ -38,7 +40,7 @@ void RingController::OnUpdate() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!polling_mode_enabled || !is_transfer_memory_set) {
|
||||
if (!polling_mode_enabled || transfer_memory == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -62,7 +64,8 @@ void RingController::OnUpdate() {
|
||||
curr_entry.polling_data.out_size = sizeof(ringcon_value);
|
||||
std::memcpy(curr_entry.polling_data.data.data(), &ringcon_value, sizeof(ringcon_value));
|
||||
|
||||
std::memcpy(transfer_memory, &enable_sixaxis_data, sizeof(enable_sixaxis_data));
|
||||
system.Memory().WriteBlock(transfer_memory, &enable_sixaxis_data,
|
||||
sizeof(enable_sixaxis_data));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -17,8 +17,7 @@ namespace Service::HID {
|
||||
|
||||
class RingController final : public HidbusBase {
|
||||
public:
|
||||
explicit RingController(Core::HID::HIDCore& hid_core_,
|
||||
KernelHelpers::ServiceContext& service_context_);
|
||||
explicit RingController(Core::System& system_, KernelHelpers::ServiceContext& service_context_);
|
||||
~RingController() override;
|
||||
|
||||
void OnInit() override;
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
namespace Service::HID {
|
||||
constexpr u8 DEVICE_ID = 0x28;
|
||||
|
||||
Starlink::Starlink(Core::HID::HIDCore& hid_core_, KernelHelpers::ServiceContext& service_context_)
|
||||
: HidbusBase(service_context_) {}
|
||||
Starlink::Starlink(Core::System& system_, KernelHelpers::ServiceContext& service_context_)
|
||||
: HidbusBase(system_, service_context_) {}
|
||||
Starlink::~Starlink() = default;
|
||||
|
||||
void Starlink::OnInit() {
|
||||
@@ -27,7 +27,7 @@ void Starlink::OnUpdate() {
|
||||
if (!device_enabled) {
|
||||
return;
|
||||
}
|
||||
if (!polling_mode_enabled || !is_transfer_memory_set) {
|
||||
if (!polling_mode_enabled || transfer_memory == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,7 @@ namespace Service::HID {
|
||||
|
||||
class Starlink final : public HidbusBase {
|
||||
public:
|
||||
explicit Starlink(Core::HID::HIDCore& hid_core_,
|
||||
KernelHelpers::ServiceContext& service_context_);
|
||||
explicit Starlink(Core::System& system_, KernelHelpers::ServiceContext& service_context_);
|
||||
~Starlink() override;
|
||||
|
||||
void OnInit() override;
|
||||
|
||||
@@ -8,9 +8,8 @@
|
||||
namespace Service::HID {
|
||||
constexpr u8 DEVICE_ID = 0xFF;
|
||||
|
||||
HidbusStubbed::HidbusStubbed(Core::HID::HIDCore& hid_core_,
|
||||
KernelHelpers::ServiceContext& service_context_)
|
||||
: HidbusBase(service_context_) {}
|
||||
HidbusStubbed::HidbusStubbed(Core::System& system_, KernelHelpers::ServiceContext& service_context_)
|
||||
: HidbusBase(system_, service_context_) {}
|
||||
HidbusStubbed::~HidbusStubbed() = default;
|
||||
|
||||
void HidbusStubbed::OnInit() {
|
||||
@@ -28,7 +27,7 @@ void HidbusStubbed::OnUpdate() {
|
||||
if (!device_enabled) {
|
||||
return;
|
||||
}
|
||||
if (!polling_mode_enabled || !is_transfer_memory_set) {
|
||||
if (!polling_mode_enabled || transfer_memory == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,7 @@ namespace Service::HID {
|
||||
|
||||
class HidbusStubbed final : public HidbusBase {
|
||||
public:
|
||||
explicit HidbusStubbed(Core::HID::HIDCore& hid_core_,
|
||||
KernelHelpers::ServiceContext& service_context_);
|
||||
explicit HidbusStubbed(Core::System& system_, KernelHelpers::ServiceContext& service_context_);
|
||||
~HidbusStubbed() override;
|
||||
|
||||
void OnInit() override;
|
||||
|
||||
@@ -208,8 +208,6 @@ void IRS::RunImageTransferProcessor(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
ASSERT_MSG(t_mem->GetSize() == parameters.transfer_memory_size, "t_mem has incorrect size");
|
||||
|
||||
u8* transfer_memory = system.Memory().GetPointer(t_mem->GetSourceAddress());
|
||||
|
||||
LOG_INFO(Service_IRS,
|
||||
"called, npad_type={}, npad_id={}, transfer_memory_size={}, transfer_memory_size={}, "
|
||||
"applet_resource_user_id={}",
|
||||
@@ -224,7 +222,7 @@ void IRS::RunImageTransferProcessor(Kernel::HLERequestContext& ctx) {
|
||||
auto& image_transfer_processor =
|
||||
GetProcessor<ImageTransferProcessor>(parameters.camera_handle);
|
||||
image_transfer_processor.SetConfig(parameters.processor_config);
|
||||
image_transfer_processor.SetTransferMemoryPointer(transfer_memory);
|
||||
image_transfer_processor.SetTransferMemoryAddress(t_mem->GetSourceAddress());
|
||||
npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex,
|
||||
Common::Input::PollingMode::IR);
|
||||
}
|
||||
@@ -448,8 +446,6 @@ void IRS::RunImageTransferExProcessor(Kernel::HLERequestContext& ctx) {
|
||||
auto t_mem = system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(
|
||||
t_mem_handle);
|
||||
|
||||
u8* transfer_memory = system.Memory().GetPointer(t_mem->GetSourceAddress());
|
||||
|
||||
LOG_INFO(Service_IRS,
|
||||
"called, npad_type={}, npad_id={}, transfer_memory_size={}, "
|
||||
"applet_resource_user_id={}",
|
||||
@@ -464,7 +460,7 @@ void IRS::RunImageTransferExProcessor(Kernel::HLERequestContext& ctx) {
|
||||
auto& image_transfer_processor =
|
||||
GetProcessor<ImageTransferProcessor>(parameters.camera_handle);
|
||||
image_transfer_processor.SetConfig(parameters.processor_config);
|
||||
image_transfer_processor.SetTransferMemoryPointer(transfer_memory);
|
||||
image_transfer_processor.SetTransferMemoryAddress(t_mem->GetSourceAddress());
|
||||
npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex,
|
||||
Common::Input::PollingMode::IR);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,13 @@ private:
|
||||
LOG_CRITICAL(Service_IRS, "Invalid index {}", index);
|
||||
return;
|
||||
}
|
||||
processors[index] = std::make_unique<T>(system.HIDCore(), device_state, index);
|
||||
|
||||
if constexpr (std::is_constructible_v<T, Core::System&, Core::IrSensor::DeviceFormat&,
|
||||
std::size_t>) {
|
||||
processors[index] = std::make_unique<T>(system, device_state, index);
|
||||
} else {
|
||||
processors[index] = std::make_unique<T>(system.HIDCore(), device_state, index);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "core/core.h"
|
||||
#include "core/hid/emulated_controller.h"
|
||||
#include "core/hid/hid_core.h"
|
||||
#include "core/hle/service/hid/irsensor/image_transfer_processor.h"
|
||||
#include "core/memory.h"
|
||||
|
||||
namespace Service::IRS {
|
||||
ImageTransferProcessor::ImageTransferProcessor(Core::HID::HIDCore& hid_core_,
|
||||
ImageTransferProcessor::ImageTransferProcessor(Core::System& system_,
|
||||
Core::IrSensor::DeviceFormat& device_format,
|
||||
std::size_t npad_index)
|
||||
: device{device_format} {
|
||||
npad_device = hid_core_.GetEmulatedControllerByIndex(npad_index);
|
||||
: device{device_format}, system{system_} {
|
||||
npad_device = system.HIDCore().GetEmulatedControllerByIndex(npad_index);
|
||||
|
||||
Core::HID::ControllerUpdateCallback engine_callback{
|
||||
.on_change = [this](Core::HID::ControllerTriggerType type) { OnControllerUpdate(type); },
|
||||
@@ -43,7 +45,7 @@ void ImageTransferProcessor::OnControllerUpdate(Core::HID::ControllerTriggerType
|
||||
if (type != Core::HID::ControllerTriggerType::IrSensor) {
|
||||
return;
|
||||
}
|
||||
if (!is_transfer_memory_set) {
|
||||
if (transfer_memory == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -56,14 +58,16 @@ void ImageTransferProcessor::OnControllerUpdate(Core::HID::ControllerTriggerType
|
||||
if (camera_data.format != current_config.origin_format) {
|
||||
LOG_WARNING(Service_IRS, "Wrong Input format {} expected {}", camera_data.format,
|
||||
current_config.origin_format);
|
||||
memset(transfer_memory, 0, GetDataSize(current_config.trimming_format));
|
||||
system.Memory().ZeroBlock(*system.ApplicationProcess(), transfer_memory,
|
||||
GetDataSize(current_config.trimming_format));
|
||||
return;
|
||||
}
|
||||
|
||||
if (current_config.origin_format > current_config.trimming_format) {
|
||||
LOG_WARNING(Service_IRS, "Origin format {} is smaller than trimming format {}",
|
||||
current_config.origin_format, current_config.trimming_format);
|
||||
memset(transfer_memory, 0, GetDataSize(current_config.trimming_format));
|
||||
system.Memory().ZeroBlock(*system.ApplicationProcess(), transfer_memory,
|
||||
GetDataSize(current_config.trimming_format));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -80,7 +84,8 @@ void ImageTransferProcessor::OnControllerUpdate(Core::HID::ControllerTriggerType
|
||||
"Trimming area ({}, {}, {}, {}) is outside of origin area ({}, {})",
|
||||
current_config.trimming_start_x, current_config.trimming_start_y,
|
||||
trimming_width, trimming_height, origin_width, origin_height);
|
||||
memset(transfer_memory, 0, GetDataSize(current_config.trimming_format));
|
||||
system.Memory().ZeroBlock(*system.ApplicationProcess(), transfer_memory,
|
||||
GetDataSize(current_config.trimming_format));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -94,7 +99,8 @@ void ImageTransferProcessor::OnControllerUpdate(Core::HID::ControllerTriggerType
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(transfer_memory, window_data.data(), GetDataSize(current_config.trimming_format));
|
||||
system.Memory().WriteBlock(transfer_memory, window_data.data(),
|
||||
GetDataSize(current_config.trimming_format));
|
||||
|
||||
if (!IsProcessorActive()) {
|
||||
StartProcessor();
|
||||
@@ -134,8 +140,7 @@ void ImageTransferProcessor::SetConfig(
|
||||
npad_device->SetCameraFormat(current_config.origin_format);
|
||||
}
|
||||
|
||||
void ImageTransferProcessor::SetTransferMemoryPointer(u8* t_mem) {
|
||||
is_transfer_memory_set = true;
|
||||
void ImageTransferProcessor::SetTransferMemoryAddress(VAddr t_mem) {
|
||||
transfer_memory = t_mem;
|
||||
}
|
||||
|
||||
@@ -143,7 +148,7 @@ Core::IrSensor::ImageTransferProcessorState ImageTransferProcessor::GetState(
|
||||
std::vector<u8>& data) const {
|
||||
const auto size = GetDataSize(current_config.trimming_format);
|
||||
data.resize(size);
|
||||
memcpy(data.data(), transfer_memory, size);
|
||||
system.Memory().ReadBlock(transfer_memory, data.data(), size);
|
||||
return processor_state;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
#include "core/hid/irs_types.h"
|
||||
#include "core/hle/service/hid/irsensor/processor_base.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace Core::HID {
|
||||
class EmulatedController;
|
||||
} // namespace Core::HID
|
||||
@@ -14,7 +18,7 @@ class EmulatedController;
|
||||
namespace Service::IRS {
|
||||
class ImageTransferProcessor final : public ProcessorBase {
|
||||
public:
|
||||
explicit ImageTransferProcessor(Core::HID::HIDCore& hid_core_,
|
||||
explicit ImageTransferProcessor(Core::System& system_,
|
||||
Core::IrSensor::DeviceFormat& device_format,
|
||||
std::size_t npad_index);
|
||||
~ImageTransferProcessor() override;
|
||||
@@ -33,7 +37,7 @@ public:
|
||||
void SetConfig(Core::IrSensor::PackedImageTransferProcessorExConfig config);
|
||||
|
||||
// Transfer memory where the image data will be stored
|
||||
void SetTransferMemoryPointer(u8* t_mem);
|
||||
void SetTransferMemoryAddress(VAddr t_mem);
|
||||
|
||||
Core::IrSensor::ImageTransferProcessorState GetState(std::vector<u8>& data) const;
|
||||
|
||||
@@ -67,7 +71,7 @@ private:
|
||||
Core::HID::EmulatedController* npad_device;
|
||||
int callback_key{};
|
||||
|
||||
u8* transfer_memory = nullptr;
|
||||
bool is_transfer_memory_set = false;
|
||||
Core::System& system;
|
||||
VAddr transfer_memory{};
|
||||
};
|
||||
} // namespace Service::IRS
|
||||
|
||||
@@ -124,6 +124,7 @@ public:
|
||||
{12, nullptr, "InactivateContentMetaDatabase"},
|
||||
{13, nullptr, "InvalidateRightsIdCache"},
|
||||
{14, nullptr, "GetMemoryReport"},
|
||||
{15, nullptr, "ActivateFsContentStorage"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
||||
@@ -159,6 +159,8 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
|
||||
{606, nullptr, "GetContentMetaStorage"},
|
||||
{607, nullptr, "ListAvailableAddOnContent"},
|
||||
{609, nullptr, "ListAvailabilityAssuredAddOnContent"},
|
||||
{610, nullptr, "GetInstalledContentMetaStorage"},
|
||||
{611, nullptr, "PrepareAddOnContent"},
|
||||
{700, nullptr, "PushDownloadTaskList"},
|
||||
{701, nullptr, "ClearTaskStatusList"},
|
||||
{702, nullptr, "RequestDownloadTaskList"},
|
||||
@@ -228,6 +230,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
|
||||
{1900, nullptr, "IsActiveAccount"},
|
||||
{1901, nullptr, "RequestDownloadApplicationPrepurchasedRights"},
|
||||
{1902, nullptr, "GetApplicationTicketInfo"},
|
||||
{1903, nullptr, "RequestDownloadApplicationPrepurchasedRightsForAccount"},
|
||||
{2000, nullptr, "GetSystemDeliveryInfo"},
|
||||
{2001, nullptr, "SelectLatestSystemDeliveryInfo"},
|
||||
{2002, nullptr, "VerifyDeliveryProtocolVersion"},
|
||||
@@ -276,8 +279,11 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
|
||||
{2352, nullptr, "RequestResolveNoDownloadRightsError"},
|
||||
{2353, nullptr, "GetApplicationDownloadTaskInfo"},
|
||||
{2354, nullptr, "PrioritizeApplicationBackgroundTask"},
|
||||
{2355, nullptr, "Unknown2355"},
|
||||
{2356, nullptr, "Unknown2356"},
|
||||
{2355, nullptr, "PreferStorageEfficientUpdate"},
|
||||
{2356, nullptr, "RequestStorageEfficientUpdatePreferable"},
|
||||
{2357, nullptr, "EnableMultiCoreDownload"},
|
||||
{2358, nullptr, "DisableMultiCoreDownload"},
|
||||
{2359, nullptr, "IsMultiCoreDownloadEnabled"},
|
||||
{2400, nullptr, "GetPromotionInfo"},
|
||||
{2401, nullptr, "CountPromotionInfo"},
|
||||
{2402, nullptr, "ListPromotionInfo"},
|
||||
@@ -295,6 +301,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
|
||||
{2519, nullptr, "IsQualificationTransitionSupported"},
|
||||
{2520, nullptr, "IsQualificationTransitionSupportedByProcessId"},
|
||||
{2521, nullptr, "GetRightsUserChangedEvent"},
|
||||
{2522, nullptr, "IsRomRedirectionAvailable"},
|
||||
{2800, nullptr, "GetApplicationIdOfPreomia"},
|
||||
{3000, nullptr, "RegisterDeviceLockKey"},
|
||||
{3001, nullptr, "UnregisterDeviceLockKey"},
|
||||
@@ -311,6 +318,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
|
||||
{3012, nullptr, "IsApplicationTitleHidden"},
|
||||
{3013, nullptr, "IsGameCardEnabled"},
|
||||
{3014, nullptr, "IsLocalContentShareEnabled"},
|
||||
{3050, nullptr, "ListAssignELicenseTaskResult"},
|
||||
{9999, nullptr, "GetApplicationCertificate"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -954,6 +954,9 @@ BSDCFG::BSDCFG(Core::System& system_) : ServiceFramework{system_, "bsdcfg"} {
|
||||
{10, nullptr, "ClearArpEntries"},
|
||||
{11, nullptr, "ClearArpEntries2"},
|
||||
{12, nullptr, "PrintArpEntries"},
|
||||
{13, nullptr, "Unknown13"},
|
||||
{14, nullptr, "Unknown14"},
|
||||
{15, nullptr, "Unknown15"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ enum class Errno : u32 {
|
||||
INVAL = 22,
|
||||
MFILE = 24,
|
||||
MSGSIZE = 90,
|
||||
CONNRESET = 104,
|
||||
NOTCONN = 107,
|
||||
TIMEDOUT = 110,
|
||||
};
|
||||
|
||||
@@ -27,6 +27,8 @@ Errno Translate(Network::Errno value) {
|
||||
return Errno::NOTCONN;
|
||||
case Network::Errno::TIMEDOUT:
|
||||
return Errno::TIMEDOUT;
|
||||
case Network::Errno::CONNRESET:
|
||||
return Errno::CONNRESET;
|
||||
default:
|
||||
UNIMPLEMENTED_MSG("Unimplemented errno={}", value);
|
||||
return Errno::SUCCESS;
|
||||
|
||||
@@ -46,6 +46,14 @@ public:
|
||||
{25, nullptr, "GetCipherInfo"},
|
||||
{26, nullptr, "SetNextAlpnProto"},
|
||||
{27, nullptr, "GetNextAlpnProto"},
|
||||
{28, nullptr, "SetDtlsSocketDescriptor"},
|
||||
{29, nullptr, "GetDtlsHandshakeTimeout"},
|
||||
{30, nullptr, "SetPrivateOption"},
|
||||
{31, nullptr, "SetSrtpCiphers"},
|
||||
{32, nullptr, "GetSrtpCipher"},
|
||||
{33, nullptr, "ExportKeyingMaterial"},
|
||||
{34, nullptr, "SetIoTimeout"},
|
||||
{35, nullptr, "GetIoTimeout"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -69,6 +77,8 @@ public:
|
||||
{9, nullptr, "AddPolicyOid"},
|
||||
{10, nullptr, "ImportCrl"},
|
||||
{11, nullptr, "RemoveCrl"},
|
||||
{12, nullptr, "ImportClientCertKeyPki"},
|
||||
{13, nullptr, "GeneratePrivateKeyAndCert"},
|
||||
};
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
@@ -249,6 +249,9 @@ public:
|
||||
{2053, nullptr, "DestroyIndirectProducerEndPoint"},
|
||||
{2054, nullptr, "CreateIndirectConsumerEndPoint"},
|
||||
{2055, nullptr, "DestroyIndirectConsumerEndPoint"},
|
||||
{2060, nullptr, "CreateWatermarkCompositor"},
|
||||
{2062, nullptr, "SetWatermarkText"},
|
||||
{2063, nullptr, "SetWatermarkLayerStacks"},
|
||||
{2300, nullptr, "AcquireLayerTexturePresentingEvent"},
|
||||
{2301, nullptr, "ReleaseLayerTexturePresentingEvent"},
|
||||
{2302, nullptr, "GetDisplayHotplugEvent"},
|
||||
@@ -279,6 +282,8 @@ public:
|
||||
{6011, nullptr, "EnableLayerAutoClearTransitionBuffer"},
|
||||
{6012, nullptr, "DisableLayerAutoClearTransitionBuffer"},
|
||||
{6013, nullptr, "SetLayerOpacity"},
|
||||
{6014, nullptr, "AttachLayerWatermarkCompositor"},
|
||||
{6015, nullptr, "DetachLayerWatermarkCompositor"},
|
||||
{7000, nullptr, "SetContentVisibility"},
|
||||
{8000, nullptr, "SetConductorLayer"},
|
||||
{8001, nullptr, "SetTimestampTracking"},
|
||||
|
||||
@@ -14,6 +14,10 @@ VI_M::VI_M(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_,
|
||||
static const FunctionInfo functions[] = {
|
||||
{2, &VI_M::GetDisplayService, "GetDisplayService"},
|
||||
{3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
||||
{100, nullptr, "PrepareFatal"},
|
||||
{101, nullptr, "ShowFatal"},
|
||||
{102, nullptr, "DrawFatalRectangle"},
|
||||
{103, nullptr, "DrawFatalText32"},
|
||||
};
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
@@ -109,6 +109,8 @@ Errno TranslateNativeError(int e) {
|
||||
return Errno::AGAIN;
|
||||
case WSAECONNREFUSED:
|
||||
return Errno::CONNREFUSED;
|
||||
case WSAECONNRESET:
|
||||
return Errno::CONNRESET;
|
||||
case WSAEHOSTUNREACH:
|
||||
return Errno::HOSTUNREACH;
|
||||
case WSAENETDOWN:
|
||||
@@ -205,6 +207,8 @@ Errno TranslateNativeError(int e) {
|
||||
return Errno::AGAIN;
|
||||
case ECONNREFUSED:
|
||||
return Errno::CONNREFUSED;
|
||||
case ECONNRESET:
|
||||
return Errno::CONNRESET;
|
||||
case EHOSTUNREACH:
|
||||
return Errno::HOSTUNREACH;
|
||||
case ENETDOWN:
|
||||
|
||||
@@ -30,6 +30,7 @@ enum class Errno {
|
||||
NOTCONN,
|
||||
AGAIN,
|
||||
CONNREFUSED,
|
||||
CONNRESET,
|
||||
HOSTUNREACH,
|
||||
NETDOWN,
|
||||
NETUNREACH,
|
||||
|
||||
@@ -15,7 +15,7 @@ if (ENABLE_WEB_SERVICE)
|
||||
target_link_libraries(yuzu-room PRIVATE web_service)
|
||||
endif()
|
||||
|
||||
target_link_libraries(yuzu-room PRIVATE mbedtls mbedcrypto)
|
||||
target_link_libraries(yuzu-room PRIVATE MbedTLS::mbedcrypto)
|
||||
if (MSVC)
|
||||
target_link_libraries(yuzu-room PRIVATE getopt)
|
||||
endif()
|
||||
|
||||
@@ -10,17 +10,25 @@
|
||||
#include "input_common/drivers/mouse.h"
|
||||
|
||||
namespace InputCommon {
|
||||
constexpr int update_time = 10;
|
||||
constexpr float default_stick_sensitivity = 0.022f;
|
||||
constexpr float default_motion_sensitivity = 0.008f;
|
||||
constexpr int mouse_axis_x = 0;
|
||||
constexpr int mouse_axis_y = 1;
|
||||
constexpr int wheel_axis_x = 2;
|
||||
constexpr int wheel_axis_y = 3;
|
||||
constexpr int motion_wheel_y = 4;
|
||||
constexpr PadIdentifier identifier = {
|
||||
.guid = Common::UUID{},
|
||||
.port = 0,
|
||||
.pad = 0,
|
||||
};
|
||||
|
||||
constexpr PadIdentifier motion_identifier = {
|
||||
.guid = Common::UUID{},
|
||||
.port = 0,
|
||||
.pad = 1,
|
||||
};
|
||||
|
||||
constexpr PadIdentifier real_mouse_identifier = {
|
||||
.guid = Common::UUID{},
|
||||
.port = 1,
|
||||
@@ -37,47 +45,87 @@ Mouse::Mouse(std::string input_engine_) : InputEngine(std::move(input_engine_))
|
||||
PreSetController(identifier);
|
||||
PreSetController(real_mouse_identifier);
|
||||
PreSetController(touch_identifier);
|
||||
PreSetController(motion_identifier);
|
||||
|
||||
// Initialize all mouse axis
|
||||
PreSetAxis(identifier, mouse_axis_x);
|
||||
PreSetAxis(identifier, mouse_axis_y);
|
||||
PreSetAxis(identifier, wheel_axis_x);
|
||||
PreSetAxis(identifier, wheel_axis_y);
|
||||
PreSetAxis(identifier, motion_wheel_y);
|
||||
PreSetAxis(real_mouse_identifier, mouse_axis_x);
|
||||
PreSetAxis(real_mouse_identifier, mouse_axis_y);
|
||||
PreSetAxis(touch_identifier, mouse_axis_x);
|
||||
PreSetAxis(touch_identifier, mouse_axis_y);
|
||||
|
||||
// Initialize variables
|
||||
mouse_origin = {};
|
||||
last_mouse_position = {};
|
||||
wheel_position = {};
|
||||
last_mouse_change = {};
|
||||
last_motion_change = {};
|
||||
|
||||
update_thread = std::jthread([this](std::stop_token stop_token) { UpdateThread(stop_token); });
|
||||
}
|
||||
|
||||
void Mouse::UpdateThread(std::stop_token stop_token) {
|
||||
Common::SetCurrentThreadName("Mouse");
|
||||
constexpr int update_time = 10;
|
||||
|
||||
while (!stop_token.stop_requested()) {
|
||||
if (Settings::values.mouse_panning) {
|
||||
// Slow movement by 4%
|
||||
last_mouse_change *= 0.96f;
|
||||
const float sensitivity =
|
||||
Settings::values.mouse_panning_sensitivity.GetValue() * 0.022f;
|
||||
SetAxis(identifier, mouse_axis_x, last_mouse_change.x * sensitivity);
|
||||
SetAxis(identifier, mouse_axis_y, -last_mouse_change.y * sensitivity);
|
||||
}
|
||||
UpdateStickInput();
|
||||
UpdateMotionInput();
|
||||
|
||||
SetAxis(identifier, motion_wheel_y, 0.0f);
|
||||
|
||||
if (mouse_panning_timout++ > 20) {
|
||||
if (mouse_panning_timeout++ > 20) {
|
||||
StopPanning();
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(update_time));
|
||||
}
|
||||
}
|
||||
|
||||
void Mouse::UpdateStickInput() {
|
||||
if (!Settings::values.mouse_panning) {
|
||||
return;
|
||||
}
|
||||
|
||||
const float sensitivity =
|
||||
Settings::values.mouse_panning_sensitivity.GetValue() * default_stick_sensitivity;
|
||||
|
||||
// Slow movement by 4%
|
||||
last_mouse_change *= 0.96f;
|
||||
SetAxis(identifier, mouse_axis_x, last_mouse_change.x * sensitivity);
|
||||
SetAxis(identifier, mouse_axis_y, -last_mouse_change.y * sensitivity);
|
||||
}
|
||||
|
||||
void Mouse::UpdateMotionInput() {
|
||||
const float sensitivity =
|
||||
Settings::values.mouse_panning_sensitivity.GetValue() * default_motion_sensitivity;
|
||||
|
||||
// Slow movement by 7%
|
||||
if (Settings::values.mouse_panning) {
|
||||
last_motion_change *= 0.93f;
|
||||
} else {
|
||||
last_motion_change.z *= 0.93f;
|
||||
}
|
||||
|
||||
const BasicMotion motion_data{
|
||||
.gyro_x = last_motion_change.x * sensitivity,
|
||||
.gyro_y = last_motion_change.y * sensitivity,
|
||||
.gyro_z = last_motion_change.z * sensitivity,
|
||||
.accel_x = 0,
|
||||
.accel_y = 0,
|
||||
.accel_z = 0,
|
||||
.delta_timestamp = update_time * 1000,
|
||||
};
|
||||
|
||||
SetMotion(motion_identifier, 0, motion_data);
|
||||
}
|
||||
|
||||
void Mouse::Move(int x, int y, int center_x, int center_y) {
|
||||
if (Settings::values.mouse_panning) {
|
||||
mouse_panning_timeout = 0;
|
||||
|
||||
auto mouse_change =
|
||||
(Common::MakeVec(x, y) - Common::MakeVec(center_x, center_y)).Cast<float>();
|
||||
mouse_panning_timout = 0;
|
||||
Common::Vec3<float> motion_change{-mouse_change.y, -mouse_change.x, last_motion_change.z};
|
||||
|
||||
const auto move_distance = mouse_change.Length();
|
||||
if (move_distance == 0) {
|
||||
@@ -93,6 +141,7 @@ void Mouse::Move(int x, int y, int center_x, int center_y) {
|
||||
|
||||
// Average mouse movements
|
||||
last_mouse_change = (last_mouse_change * 0.91f) + (mouse_change * 0.09f);
|
||||
last_motion_change = (last_motion_change * 0.69f) + (motion_change * 0.31f);
|
||||
|
||||
const auto last_move_distance = last_mouse_change.Length();
|
||||
|
||||
@@ -116,6 +165,12 @@ void Mouse::Move(int x, int y, int center_x, int center_y) {
|
||||
const float sensitivity = Settings::values.mouse_panning_sensitivity.GetValue() * 0.0012f;
|
||||
SetAxis(identifier, mouse_axis_x, static_cast<float>(mouse_move.x) * sensitivity);
|
||||
SetAxis(identifier, mouse_axis_y, static_cast<float>(-mouse_move.y) * sensitivity);
|
||||
|
||||
last_motion_change = {
|
||||
static_cast<float>(-mouse_move.y) / 50.0f,
|
||||
static_cast<float>(-mouse_move.x) / 50.0f,
|
||||
last_motion_change.z,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,15 +212,19 @@ void Mouse::ReleaseButton(MouseButton button) {
|
||||
SetAxis(identifier, mouse_axis_x, 0);
|
||||
SetAxis(identifier, mouse_axis_y, 0);
|
||||
}
|
||||
|
||||
last_motion_change.x = 0;
|
||||
last_motion_change.y = 0;
|
||||
|
||||
button_pressed = false;
|
||||
}
|
||||
|
||||
void Mouse::MouseWheelChange(int x, int y) {
|
||||
wheel_position.x += x;
|
||||
wheel_position.y += y;
|
||||
last_motion_change.z += static_cast<f32>(y) / 100.0f;
|
||||
SetAxis(identifier, wheel_axis_x, static_cast<f32>(wheel_position.x));
|
||||
SetAxis(identifier, wheel_axis_y, static_cast<f32>(wheel_position.y));
|
||||
SetAxis(identifier, motion_wheel_y, static_cast<f32>(y) / 100.0f);
|
||||
}
|
||||
|
||||
void Mouse::ReleaseAllButtons() {
|
||||
@@ -234,6 +293,9 @@ Common::Input::ButtonNames Mouse::GetUIName(const Common::ParamPackage& params)
|
||||
if (params.Has("axis_x") && params.Has("axis_y") && params.Has("axis_z")) {
|
||||
return Common::Input::ButtonNames::Engine;
|
||||
}
|
||||
if (params.Has("motion")) {
|
||||
return Common::Input::ButtonNames::Engine;
|
||||
}
|
||||
|
||||
return Common::Input::ButtonNames::Invalid;
|
||||
}
|
||||
|
||||
@@ -96,6 +96,8 @@ public:
|
||||
|
||||
private:
|
||||
void UpdateThread(std::stop_token stop_token);
|
||||
void UpdateStickInput();
|
||||
void UpdateMotionInput();
|
||||
void StopPanning();
|
||||
|
||||
Common::Input::ButtonNames GetUIButtonName(const Common::ParamPackage& params) const;
|
||||
@@ -103,9 +105,10 @@ private:
|
||||
Common::Vec2<int> mouse_origin;
|
||||
Common::Vec2<int> last_mouse_position;
|
||||
Common::Vec2<float> last_mouse_change;
|
||||
Common::Vec3<float> last_motion_change;
|
||||
Common::Vec2<int> wheel_position;
|
||||
bool button_pressed;
|
||||
int mouse_panning_timout{};
|
||||
int mouse_panning_timeout{};
|
||||
std::jthread update_thread;
|
||||
};
|
||||
|
||||
|
||||
@@ -142,14 +142,10 @@ void MappingFactory::RegisterMotion(const MappingData& data) {
|
||||
new_input.Set("port", static_cast<int>(data.pad.port));
|
||||
new_input.Set("pad", static_cast<int>(data.pad.pad));
|
||||
|
||||
// If engine is mouse map the mouse position as 3 axis motion
|
||||
// If engine is mouse map it automatically to mouse motion
|
||||
if (data.engine == "mouse") {
|
||||
new_input.Set("axis_x", 1);
|
||||
new_input.Set("invert_x", "-");
|
||||
new_input.Set("axis_y", 0);
|
||||
new_input.Set("axis_z", 4);
|
||||
new_input.Set("range", 1.0f);
|
||||
new_input.Set("deadzone", 0.0f);
|
||||
new_input.Set("motion", 0);
|
||||
new_input.Set("pad", 1);
|
||||
input_queue.Push(new_input);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -330,3 +330,7 @@ endif()
|
||||
if (YUZU_USE_PRECOMPILED_HEADERS)
|
||||
target_precompile_headers(video_core PRIVATE precompiled_headers.h)
|
||||
endif()
|
||||
|
||||
if (YUZU_ENABLE_LTO)
|
||||
set_property(TARGET video_core PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
endif()
|
||||
|
||||
@@ -568,7 +568,7 @@ private:
|
||||
const u64* const state_words = Array<type>();
|
||||
const u64 num_query_words = size / BYTES_PER_WORD + 1;
|
||||
const u64 word_begin = offset / BYTES_PER_WORD;
|
||||
const u64 word_end = std::min(word_begin + num_query_words, NumWords());
|
||||
const u64 word_end = std::min<u64>(word_begin + num_query_words, NumWords());
|
||||
const u64 page_base = offset / BYTES_PER_PAGE;
|
||||
const u64 page_limit = Common::DivCeil(offset + size, BYTES_PER_PAGE);
|
||||
u64 begin = std::numeric_limits<u64>::max();
|
||||
|
||||
@@ -228,8 +228,9 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::array<SwizzleSource, 4
|
||||
|
||||
[[nodiscard]] bool CanBeAccelerated(const TextureCacheRuntime& runtime,
|
||||
const VideoCommon::ImageInfo& info) {
|
||||
if (IsPixelFormatASTC(info.format)) {
|
||||
return !runtime.HasNativeASTC() && Settings::values.accelerate_astc.GetValue();
|
||||
if (IsPixelFormatASTC(info.format) && !runtime.HasNativeASTC()) {
|
||||
return Settings::values.accelerate_astc.GetValue() &&
|
||||
!Settings::values.async_astc.GetValue();
|
||||
}
|
||||
// Disable other accelerated uploads for now as they don't implement swizzled uploads
|
||||
return false;
|
||||
@@ -258,6 +259,14 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::array<SwizzleSource, 4
|
||||
return format_info.compatibility_class == store_class;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool CanBeDecodedAsync(const TextureCacheRuntime& runtime,
|
||||
const VideoCommon::ImageInfo& info) {
|
||||
if (IsPixelFormatASTC(info.format) && !runtime.HasNativeASTC()) {
|
||||
return Settings::values.async_astc.GetValue();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
[[nodiscard]] CopyOrigin MakeCopyOrigin(VideoCommon::Offset3D offset,
|
||||
VideoCommon::SubresourceLayers subresource, GLenum target) {
|
||||
switch (target) {
|
||||
@@ -721,7 +730,9 @@ std::optional<size_t> TextureCacheRuntime::StagingBuffers::FindBuffer(size_t req
|
||||
Image::Image(TextureCacheRuntime& runtime_, const VideoCommon::ImageInfo& info_, GPUVAddr gpu_addr_,
|
||||
VAddr cpu_addr_)
|
||||
: VideoCommon::ImageBase(info_, gpu_addr_, cpu_addr_), runtime{&runtime_} {
|
||||
if (CanBeAccelerated(*runtime, info)) {
|
||||
if (CanBeDecodedAsync(*runtime, info)) {
|
||||
flags |= ImageFlagBits::AsynchronousDecode;
|
||||
} else if (CanBeAccelerated(*runtime, info)) {
|
||||
flags |= ImageFlagBits::AcceleratedUpload;
|
||||
}
|
||||
if (IsConverted(runtime->device, info.format, info.type)) {
|
||||
|
||||
@@ -1256,11 +1256,12 @@ Image::Image(TextureCacheRuntime& runtime_, const ImageInfo& info_, GPUVAddr gpu
|
||||
commit(runtime_.memory_allocator.Commit(original_image, MemoryUsage::DeviceLocal)),
|
||||
aspect_mask(ImageAspectMask(info.format)) {
|
||||
if (IsPixelFormatASTC(info.format) && !runtime->device.IsOptimalAstcSupported()) {
|
||||
if (Settings::values.accelerate_astc.GetValue()) {
|
||||
if (Settings::values.async_astc.GetValue()) {
|
||||
flags |= VideoCommon::ImageFlagBits::AsynchronousDecode;
|
||||
} else if (Settings::values.accelerate_astc.GetValue()) {
|
||||
flags |= VideoCommon::ImageFlagBits::AcceleratedUpload;
|
||||
} else {
|
||||
flags |= VideoCommon::ImageFlagBits::Converted;
|
||||
}
|
||||
flags |= VideoCommon::ImageFlagBits::Converted;
|
||||
flags |= VideoCommon::ImageFlagBits::CostlyLoad;
|
||||
}
|
||||
if (runtime->device.HasDebuggingToolAttached()) {
|
||||
|
||||
@@ -38,6 +38,9 @@ enum class ImageFlagBits : u32 {
|
||||
Rescaled = 1 << 13,
|
||||
CheckingRescalable = 1 << 14,
|
||||
IsRescalable = 1 << 15,
|
||||
|
||||
AsynchronousDecode = 1 << 16,
|
||||
IsDecoding = 1 << 17, ///< Is currently being decoded asynchornously.
|
||||
};
|
||||
DECLARE_ENUM_FLAG_OPERATORS(ImageFlagBits)
|
||||
|
||||
|
||||
@@ -85,6 +85,11 @@ void TextureCache<P>::RunGarbageCollector() {
|
||||
}
|
||||
--num_iterations;
|
||||
auto& image = slot_images[image_id];
|
||||
if (True(image.flags & ImageFlagBits::IsDecoding)) {
|
||||
// This image is still being decoded, deleting it will invalidate the slot
|
||||
// used by the async decoder thread.
|
||||
return false;
|
||||
}
|
||||
const bool must_download =
|
||||
image.IsSafeDownload() && False(image.flags & ImageFlagBits::BadOverlap);
|
||||
if (!high_priority_mode &&
|
||||
@@ -133,6 +138,8 @@ void TextureCache<P>::TickFrame() {
|
||||
sentenced_images.Tick();
|
||||
sentenced_framebuffers.Tick();
|
||||
sentenced_image_view.Tick();
|
||||
TickAsyncDecode();
|
||||
|
||||
runtime.TickFrame();
|
||||
critical_gc = 0;
|
||||
++frame_tick;
|
||||
@@ -777,6 +784,10 @@ void TextureCache<P>::RefreshContents(Image& image, ImageId image_id) {
|
||||
LOG_WARNING(HW_GPU, "MSAA image uploads are not implemented");
|
||||
return;
|
||||
}
|
||||
if (True(image.flags & ImageFlagBits::AsynchronousDecode)) {
|
||||
QueueAsyncDecode(image, image_id);
|
||||
return;
|
||||
}
|
||||
auto staging = runtime.UploadStagingBuffer(MapSizeBytes(image));
|
||||
UploadImageContents(image, staging);
|
||||
runtime.InsertUploadMemoryBarrier();
|
||||
@@ -989,6 +1000,65 @@ u64 TextureCache<P>::GetScaledImageSizeBytes(const ImageBase& image) {
|
||||
return fitted_size;
|
||||
}
|
||||
|
||||
template <class P>
|
||||
void TextureCache<P>::QueueAsyncDecode(Image& image, ImageId image_id) {
|
||||
UNIMPLEMENTED_IF(False(image.flags & ImageFlagBits::Converted));
|
||||
LOG_INFO(HW_GPU, "Queuing async texture decode");
|
||||
|
||||
image.flags |= ImageFlagBits::IsDecoding;
|
||||
auto decode = std::make_unique<AsyncDecodeContext>();
|
||||
auto* decode_ptr = decode.get();
|
||||
decode->image_id = image_id;
|
||||
async_decodes.push_back(std::move(decode));
|
||||
|
||||
Common::ScratchBuffer<u8> local_unswizzle_data_buffer(image.unswizzled_size_bytes);
|
||||
const size_t guest_size_bytes = image.guest_size_bytes;
|
||||
swizzle_data_buffer.resize_destructive(guest_size_bytes);
|
||||
gpu_memory->ReadBlockUnsafe(image.gpu_addr, swizzle_data_buffer.data(), guest_size_bytes);
|
||||
auto copies = UnswizzleImage(*gpu_memory, image.gpu_addr, image.info, swizzle_data_buffer,
|
||||
local_unswizzle_data_buffer);
|
||||
const size_t out_size = MapSizeBytes(image);
|
||||
|
||||
auto func = [out_size, copies, info = image.info,
|
||||
input = std::move(local_unswizzle_data_buffer),
|
||||
async_decode = decode_ptr]() mutable {
|
||||
async_decode->decoded_data.resize_destructive(out_size);
|
||||
std::span copies_span{copies.data(), copies.size()};
|
||||
ConvertImage(input, info, async_decode->decoded_data, copies_span);
|
||||
|
||||
// TODO: Do we need this lock?
|
||||
std::unique_lock lock{async_decode->mutex};
|
||||
async_decode->copies = std::move(copies);
|
||||
async_decode->complete = true;
|
||||
};
|
||||
texture_decode_worker.QueueWork(std::move(func));
|
||||
}
|
||||
|
||||
template <class P>
|
||||
void TextureCache<P>::TickAsyncDecode() {
|
||||
bool has_uploads{};
|
||||
auto i = async_decodes.begin();
|
||||
while (i != async_decodes.end()) {
|
||||
auto* async_decode = i->get();
|
||||
std::unique_lock lock{async_decode->mutex};
|
||||
if (!async_decode->complete) {
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
Image& image = slot_images[async_decode->image_id];
|
||||
auto staging = runtime.UploadStagingBuffer(MapSizeBytes(image));
|
||||
std::memcpy(staging.mapped_span.data(), async_decode->decoded_data.data(),
|
||||
async_decode->decoded_data.size());
|
||||
image.UploadMemory(staging, async_decode->copies);
|
||||
image.flags &= ~ImageFlagBits::IsDecoding;
|
||||
has_uploads = true;
|
||||
i = async_decodes.erase(i);
|
||||
}
|
||||
if (has_uploads) {
|
||||
runtime.InsertUploadMemoryBarrier();
|
||||
}
|
||||
}
|
||||
|
||||
template <class P>
|
||||
bool TextureCache<P>::ScaleUp(Image& image) {
|
||||
const bool has_copy = image.HasScaled();
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
#include <deque>
|
||||
#include <limits>
|
||||
#include <mutex>
|
||||
@@ -18,6 +19,7 @@
|
||||
#include "common/lru_cache.h"
|
||||
#include "common/polyfill_ranges.h"
|
||||
#include "common/scratch_buffer.h"
|
||||
#include "common/thread_worker.h"
|
||||
#include "video_core/compatible_formats.h"
|
||||
#include "video_core/control/channel_state_cache.h"
|
||||
#include "video_core/delayed_destruction_ring.h"
|
||||
@@ -54,6 +56,14 @@ struct ImageViewInOut {
|
||||
ImageViewId id{};
|
||||
};
|
||||
|
||||
struct AsyncDecodeContext {
|
||||
ImageId image_id;
|
||||
Common::ScratchBuffer<u8> decoded_data;
|
||||
std::vector<BufferImageCopy> copies;
|
||||
std::mutex mutex;
|
||||
std::atomic_bool complete;
|
||||
};
|
||||
|
||||
using TextureCacheGPUMap = std::unordered_map<u64, std::vector<ImageId>, Common::IdentityHash<u64>>;
|
||||
|
||||
class TextureCacheChannelInfo : public ChannelInfo {
|
||||
@@ -377,6 +387,9 @@ private:
|
||||
bool ScaleDown(Image& image);
|
||||
u64 GetScaledImageSizeBytes(const ImageBase& image);
|
||||
|
||||
void QueueAsyncDecode(Image& image, ImageId image_id);
|
||||
void TickAsyncDecode();
|
||||
|
||||
Runtime& runtime;
|
||||
|
||||
VideoCore::RasterizerInterface& rasterizer;
|
||||
@@ -430,6 +443,9 @@ private:
|
||||
|
||||
u64 modification_tick = 0;
|
||||
u64 frame_tick = 0;
|
||||
|
||||
Common::ThreadWorker texture_decode_worker{1, "TextureDecoder"};
|
||||
std::vector<std::unique_ptr<AsyncDecodeContext>> async_decodes;
|
||||
};
|
||||
|
||||
} // namespace VideoCommon
|
||||
|
||||
@@ -1656,8 +1656,8 @@ void Decompress(std::span<const uint8_t> data, uint32_t width, uint32_t height,
|
||||
const u32 rows = Common::DivideUp(height, block_height);
|
||||
const u32 cols = Common::DivideUp(width, block_width);
|
||||
|
||||
Common::ThreadWorker workers{std::max(std::thread::hardware_concurrency(), 2U) / 2,
|
||||
"ASTCDecompress"};
|
||||
static Common::ThreadWorker workers{std::max(std::thread::hardware_concurrency(), 2U) / 2,
|
||||
"ASTCDecompress"};
|
||||
|
||||
for (u32 z = 0; z < depth; ++z) {
|
||||
const u32 depth_offset = z * height * width * 4;
|
||||
|
||||
@@ -71,7 +71,7 @@ struct Client::Impl {
|
||||
const std::string& jwt_ = "", const std::string& username_ = "",
|
||||
const std::string& token_ = "") {
|
||||
if (cli == nullptr) {
|
||||
cli = std::make_unique<httplib::Client>(host.c_str());
|
||||
cli = std::make_unique<httplib::Client>(host);
|
||||
}
|
||||
|
||||
if (!cli->is_valid()) {
|
||||
|
||||
@@ -707,6 +707,7 @@ void Config::ReadRendererValues() {
|
||||
ReadGlobalSetting(Settings::values.use_asynchronous_gpu_emulation);
|
||||
ReadGlobalSetting(Settings::values.nvdec_emulation);
|
||||
ReadGlobalSetting(Settings::values.accelerate_astc);
|
||||
ReadGlobalSetting(Settings::values.async_astc);
|
||||
ReadGlobalSetting(Settings::values.use_vsync);
|
||||
ReadGlobalSetting(Settings::values.shader_backend);
|
||||
ReadGlobalSetting(Settings::values.use_asynchronous_shaders);
|
||||
@@ -1312,9 +1313,7 @@ void Config::SaveRendererValues() {
|
||||
static_cast<u32>(Settings::values.renderer_backend.GetValue(global)),
|
||||
static_cast<u32>(Settings::values.renderer_backend.GetDefault()),
|
||||
Settings::values.renderer_backend.UsingGlobal());
|
||||
WriteSetting(QString::fromStdString(Settings::values.renderer_force_max_clock.GetLabel()),
|
||||
static_cast<u32>(Settings::values.renderer_force_max_clock.GetValue(global)),
|
||||
static_cast<u32>(Settings::values.renderer_force_max_clock.GetDefault()));
|
||||
WriteGlobalSetting(Settings::values.renderer_force_max_clock);
|
||||
WriteGlobalSetting(Settings::values.vulkan_device);
|
||||
WriteSetting(QString::fromStdString(Settings::values.fullscreen_mode.GetLabel()),
|
||||
static_cast<u32>(Settings::values.fullscreen_mode.GetValue(global)),
|
||||
@@ -1350,6 +1349,7 @@ void Config::SaveRendererValues() {
|
||||
static_cast<u32>(Settings::values.nvdec_emulation.GetDefault()),
|
||||
Settings::values.nvdec_emulation.UsingGlobal());
|
||||
WriteGlobalSetting(Settings::values.accelerate_astc);
|
||||
WriteGlobalSetting(Settings::values.async_astc);
|
||||
WriteGlobalSetting(Settings::values.use_vsync);
|
||||
WriteSetting(QString::fromStdString(Settings::values.shader_backend.GetLabel()),
|
||||
static_cast<u32>(Settings::values.shader_backend.GetValue(global)),
|
||||
|
||||
@@ -23,11 +23,13 @@ void ConfigureGraphicsAdvanced::SetConfiguration() {
|
||||
const bool runtime_lock = !system.IsPoweredOn();
|
||||
ui->use_vsync->setEnabled(runtime_lock);
|
||||
ui->renderer_force_max_clock->setEnabled(runtime_lock);
|
||||
ui->async_astc->setEnabled(runtime_lock);
|
||||
ui->use_asynchronous_shaders->setEnabled(runtime_lock);
|
||||
ui->anisotropic_filtering_combobox->setEnabled(runtime_lock);
|
||||
|
||||
ui->renderer_force_max_clock->setChecked(Settings::values.renderer_force_max_clock.GetValue());
|
||||
ui->use_vsync->setChecked(Settings::values.use_vsync.GetValue());
|
||||
ui->async_astc->setChecked(Settings::values.async_astc.GetValue());
|
||||
ui->use_asynchronous_shaders->setChecked(Settings::values.use_asynchronous_shaders.GetValue());
|
||||
ui->use_fast_gpu_time->setChecked(Settings::values.use_fast_gpu_time.GetValue());
|
||||
ui->use_pessimistic_flushes->setChecked(Settings::values.use_pessimistic_flushes.GetValue());
|
||||
@@ -45,8 +47,6 @@ void ConfigureGraphicsAdvanced::SetConfiguration() {
|
||||
&Settings::values.max_anisotropy);
|
||||
ConfigurationShared::SetHighlight(ui->label_gpu_accuracy,
|
||||
!Settings::values.gpu_accuracy.UsingGlobal());
|
||||
ConfigurationShared::SetHighlight(ui->renderer_force_max_clock,
|
||||
!Settings::values.renderer_force_max_clock.UsingGlobal());
|
||||
ConfigurationShared::SetHighlight(ui->af_label,
|
||||
!Settings::values.max_anisotropy.UsingGlobal());
|
||||
}
|
||||
@@ -60,6 +60,8 @@ void ConfigureGraphicsAdvanced::ApplyConfiguration() {
|
||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy,
|
||||
ui->anisotropic_filtering_combobox);
|
||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync, use_vsync);
|
||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.async_astc, ui->async_astc,
|
||||
async_astc);
|
||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_shaders,
|
||||
ui->use_asynchronous_shaders,
|
||||
use_asynchronous_shaders);
|
||||
@@ -91,6 +93,7 @@ void ConfigureGraphicsAdvanced::SetupPerGameUI() {
|
||||
ui->renderer_force_max_clock->setEnabled(
|
||||
Settings::values.renderer_force_max_clock.UsingGlobal());
|
||||
ui->use_vsync->setEnabled(Settings::values.use_vsync.UsingGlobal());
|
||||
ui->async_astc->setEnabled(Settings::values.async_astc.UsingGlobal());
|
||||
ui->use_asynchronous_shaders->setEnabled(
|
||||
Settings::values.use_asynchronous_shaders.UsingGlobal());
|
||||
ui->use_fast_gpu_time->setEnabled(Settings::values.use_fast_gpu_time.UsingGlobal());
|
||||
@@ -108,6 +111,8 @@ void ConfigureGraphicsAdvanced::SetupPerGameUI() {
|
||||
Settings::values.renderer_force_max_clock,
|
||||
renderer_force_max_clock);
|
||||
ConfigurationShared::SetColoredTristate(ui->use_vsync, Settings::values.use_vsync, use_vsync);
|
||||
ConfigurationShared::SetColoredTristate(ui->async_astc, Settings::values.async_astc,
|
||||
async_astc);
|
||||
ConfigurationShared::SetColoredTristate(ui->use_asynchronous_shaders,
|
||||
Settings::values.use_asynchronous_shaders,
|
||||
use_asynchronous_shaders);
|
||||
|
||||
@@ -38,6 +38,7 @@ private:
|
||||
|
||||
ConfigurationShared::CheckState renderer_force_max_clock;
|
||||
ConfigurationShared::CheckState use_vsync;
|
||||
ConfigurationShared::CheckState async_astc;
|
||||
ConfigurationShared::CheckState use_asynchronous_shaders;
|
||||
ConfigurationShared::CheckState use_fast_gpu_time;
|
||||
ConfigurationShared::CheckState use_pessimistic_flushes;
|
||||
|
||||
@@ -89,6 +89,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="async_astc">
|
||||
<property name="toolTip">
|
||||
<string>Enables asynchronous ASTC texture decoding, which may reduce load time stutter. This feature is experimental.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Decode ASTC textures asynchronously (Hack)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="use_asynchronous_shaders">
|
||||
<property name="toolTip">
|
||||
|
||||
@@ -75,8 +75,10 @@ void DiscordImpl::Update() {
|
||||
|
||||
// New Check for game cover
|
||||
httplib::Client cli(game_cover_url);
|
||||
cli.set_connection_timeout(std::chrono::seconds(3));
|
||||
cli.set_read_timeout(std::chrono::seconds(3));
|
||||
|
||||
if (auto res = cli.Head(fmt::format("/images/game/boxart/{}.png", icon_name).c_str())) {
|
||||
if (auto res = cli.Head(fmt::format("/images/game/boxart/{}.png", icon_name))) {
|
||||
if (res->status == 200) {
|
||||
game_cover_url += fmt::format("/images/game/boxart/{}.png", icon_name);
|
||||
} else {
|
||||
|
||||
@@ -324,6 +324,7 @@ void Config::ReadValues() {
|
||||
ReadSetting("Renderer", Settings::values.use_asynchronous_shaders);
|
||||
ReadSetting("Renderer", Settings::values.nvdec_emulation);
|
||||
ReadSetting("Renderer", Settings::values.accelerate_astc);
|
||||
ReadSetting("Renderer", Settings::values.async_astc);
|
||||
ReadSetting("Renderer", Settings::values.use_fast_gpu_time);
|
||||
ReadSetting("Renderer", Settings::values.use_pessimistic_flushes);
|
||||
ReadSetting("Renderer", Settings::values.use_vulkan_driver_pipeline_cache);
|
||||
|
||||
@@ -342,6 +342,10 @@ nvdec_emulation =
|
||||
# 0: Off, 1 (default): On
|
||||
accelerate_astc =
|
||||
|
||||
# Decode ASTC textures asynchronously.
|
||||
# 0 (default): Off, 1: On
|
||||
async_astc =
|
||||
|
||||
# Turns on the speed limiter, which will limit the emulation speed to the desired speed limit value
|
||||
# 0: Off, 1: On (default)
|
||||
use_speed_limit =
|
||||
|
||||
Reference in New Issue
Block a user