diff options
| author | 2023-11-20 16:53:33 -0600 | |
|---|---|---|
| committer | 2023-11-20 16:53:33 -0600 | |
| commit | 8da5bd27e9d4fe5e850700039d79f77e52ba6aea (patch) | |
| tree | f7092ca45b92aa83ef636cc13f970cd3561ba93e | |
| parent | Merge pull request #12093 from t895/zip-intent (diff) | |
| parent | Implemented qlaunch version of the controller applet (diff) | |
| download | yuzu-8da5bd27e9d4fe5e850700039d79f77e52ba6aea.tar.gz yuzu-8da5bd27e9d4fe5e850700039d79f77e52ba6aea.tar.xz yuzu-8da5bd27e9d4fe5e850700039d79f77e52ba6aea.zip | |
Merge pull request #12011 from Macj0rdan/controller-applet
Implemented qlaunch version of the controller applet
| -rw-r--r-- | src/core/hid/hid_types.h | 7 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 91 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.h | 3 | ||||
| -rw-r--r-- | src/core/hle/service/am/applets/applet_controller.h | 2 | ||||
| -rw-r--r-- | src/core/hle/service/btm/btm.cpp | 56 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 16 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.h | 72 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid_server.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid_system_server.cpp | 293 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid_system_server.h | 23 | ||||
| -rw-r--r-- | src/core/hle/service/ldn/ldn.cpp | 10 | ||||
| -rw-r--r-- | src/core/hle/service/set/set_sys.cpp | 30 | ||||
| -rw-r--r-- | src/core/hle/service/set/set_sys.h | 12 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 41 | ||||
| -rw-r--r-- | src/yuzu/main.h | 1 | ||||
| -rw-r--r-- | src/yuzu/main.ui | 22 |
16 files changed, 594 insertions, 89 deletions
diff --git a/src/core/hid/hid_types.h b/src/core/hid/hid_types.h index 9d48cd90e..70fcc6b69 100644 --- a/src/core/hid/hid_types.h +++ b/src/core/hid/hid_types.h | |||
| @@ -218,6 +218,13 @@ enum class NpadIdType : u32 { | |||
| 218 | Invalid = 0xFFFFFFFF, | 218 | Invalid = 0xFFFFFFFF, |
| 219 | }; | 219 | }; |
| 220 | 220 | ||
| 221 | enum class NpadInterfaceType : u8 { | ||
| 222 | Bluetooth = 1, | ||
| 223 | Rail = 2, | ||
| 224 | Usb = 3, | ||
| 225 | Embedded = 4, | ||
| 226 | }; | ||
| 227 | |||
| 221 | // This is nn::hid::NpadStyleIndex | 228 | // This is nn::hid::NpadStyleIndex |
| 222 | enum class NpadStyleIndex : u8 { | 229 | enum class NpadStyleIndex : u8 { |
| 223 | None = 0, | 230 | None = 0, |
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index cc643ea09..a266d7c21 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include "core/file_sys/patch_manager.h" | 13 | #include "core/file_sys/patch_manager.h" |
| 14 | #include "core/file_sys/registered_cache.h" | 14 | #include "core/file_sys/registered_cache.h" |
| 15 | #include "core/file_sys/savedata_factory.h" | 15 | #include "core/file_sys/savedata_factory.h" |
| 16 | #include "core/hid/hid_types.h" | ||
| 16 | #include "core/hle/kernel/k_event.h" | 17 | #include "core/hle/kernel/k_event.h" |
| 17 | #include "core/hle/kernel/k_transfer_memory.h" | 18 | #include "core/hle/kernel/k_transfer_memory.h" |
| 18 | #include "core/hle/result.h" | 19 | #include "core/hle/result.h" |
| @@ -21,6 +22,7 @@ | |||
| 21 | #include "core/hle/service/am/applet_ae.h" | 22 | #include "core/hle/service/am/applet_ae.h" |
| 22 | #include "core/hle/service/am/applet_oe.h" | 23 | #include "core/hle/service/am/applet_oe.h" |
| 23 | #include "core/hle/service/am/applets/applet_cabinet.h" | 24 | #include "core/hle/service/am/applets/applet_cabinet.h" |
| 25 | #include "core/hle/service/am/applets/applet_controller.h" | ||
| 24 | #include "core/hle/service/am/applets/applet_mii_edit_types.h" | 26 | #include "core/hle/service/am/applets/applet_mii_edit_types.h" |
| 25 | #include "core/hle/service/am/applets/applet_profile_select.h" | 27 | #include "core/hle/service/am/applets/applet_profile_select.h" |
| 26 | #include "core/hle/service/am/applets/applet_software_keyboard_types.h" | 28 | #include "core/hle/service/am/applets/applet_software_keyboard_types.h" |
| @@ -35,6 +37,7 @@ | |||
| 35 | #include "core/hle/service/caps/caps_su.h" | 37 | #include "core/hle/service/caps/caps_su.h" |
| 36 | #include "core/hle/service/caps/caps_types.h" | 38 | #include "core/hle/service/caps/caps_types.h" |
| 37 | #include "core/hle/service/filesystem/filesystem.h" | 39 | #include "core/hle/service/filesystem/filesystem.h" |
| 40 | #include "core/hle/service/hid/controllers/npad.h" | ||
| 38 | #include "core/hle/service/ipc_helpers.h" | 41 | #include "core/hle/service/ipc_helpers.h" |
| 39 | #include "core/hle/service/ns/ns.h" | 42 | #include "core/hle/service/ns/ns.h" |
| 40 | #include "core/hle/service/nvnflinger/fb_share_buffer_manager.h" | 43 | #include "core/hle/service/nvnflinger/fb_share_buffer_manager.h" |
| @@ -73,7 +76,7 @@ IWindowController::IWindowController(Core::System& system_) | |||
| 73 | static const FunctionInfo functions[] = { | 76 | static const FunctionInfo functions[] = { |
| 74 | {0, nullptr, "CreateWindow"}, | 77 | {0, nullptr, "CreateWindow"}, |
| 75 | {1, &IWindowController::GetAppletResourceUserId, "GetAppletResourceUserId"}, | 78 | {1, &IWindowController::GetAppletResourceUserId, "GetAppletResourceUserId"}, |
| 76 | {2, nullptr, "GetAppletResourceUserIdOfCallerApplet"}, | 79 | {2, &IWindowController::GetAppletResourceUserIdOfCallerApplet, "GetAppletResourceUserIdOfCallerApplet"}, |
| 77 | {10, &IWindowController::AcquireForegroundRights, "AcquireForegroundRights"}, | 80 | {10, &IWindowController::AcquireForegroundRights, "AcquireForegroundRights"}, |
| 78 | {11, nullptr, "ReleaseForegroundRights"}, | 81 | {11, nullptr, "ReleaseForegroundRights"}, |
| 79 | {12, nullptr, "RejectToChangeIntoBackground"}, | 82 | {12, nullptr, "RejectToChangeIntoBackground"}, |
| @@ -97,6 +100,16 @@ void IWindowController::GetAppletResourceUserId(HLERequestContext& ctx) { | |||
| 97 | rb.Push<u64>(process_id); | 100 | rb.Push<u64>(process_id); |
| 98 | } | 101 | } |
| 99 | 102 | ||
| 103 | void IWindowController::GetAppletResourceUserIdOfCallerApplet(HLERequestContext& ctx) { | ||
| 104 | const u64 process_id = 0; | ||
| 105 | |||
| 106 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 107 | |||
| 108 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 109 | rb.Push(ResultSuccess); | ||
| 110 | rb.Push<u64>(process_id); | ||
| 111 | } | ||
| 112 | |||
| 100 | void IWindowController::AcquireForegroundRights(HLERequestContext& ctx) { | 113 | void IWindowController::AcquireForegroundRights(HLERequestContext& ctx) { |
| 101 | LOG_WARNING(Service_AM, "(STUBBED) called"); | 114 | LOG_WARNING(Service_AM, "(STUBBED) called"); |
| 102 | IPC::ResponseBuilder rb{ctx, 2}; | 115 | IPC::ResponseBuilder rb{ctx, 2}; |
| @@ -1565,7 +1578,7 @@ ILibraryAppletSelfAccessor::ILibraryAppletSelfAccessor(Core::System& system_) | |||
| 1565 | {6, nullptr, "GetPopInteractiveInDataEvent"}, | 1578 | {6, nullptr, "GetPopInteractiveInDataEvent"}, |
| 1566 | {10, &ILibraryAppletSelfAccessor::ExitProcessAndReturn, "ExitProcessAndReturn"}, | 1579 | {10, &ILibraryAppletSelfAccessor::ExitProcessAndReturn, "ExitProcessAndReturn"}, |
| 1567 | {11, &ILibraryAppletSelfAccessor::GetLibraryAppletInfo, "GetLibraryAppletInfo"}, | 1580 | {11, &ILibraryAppletSelfAccessor::GetLibraryAppletInfo, "GetLibraryAppletInfo"}, |
| 1568 | {12, nullptr, "GetMainAppletIdentityInfo"}, | 1581 | {12, &ILibraryAppletSelfAccessor::GetMainAppletIdentityInfo, "GetMainAppletIdentityInfo"}, |
| 1569 | {13, nullptr, "CanUseApplicationCore"}, | 1582 | {13, nullptr, "CanUseApplicationCore"}, |
| 1570 | {14, &ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfo, "GetCallerAppletIdentityInfo"}, | 1583 | {14, &ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfo, "GetCallerAppletIdentityInfo"}, |
| 1571 | {15, nullptr, "GetMainAppletApplicationControlProperty"}, | 1584 | {15, nullptr, "GetMainAppletApplicationControlProperty"}, |
| @@ -1609,6 +1622,9 @@ ILibraryAppletSelfAccessor::ILibraryAppletSelfAccessor(Core::System& system_) | |||
| 1609 | case Applets::AppletId::SoftwareKeyboard: | 1622 | case Applets::AppletId::SoftwareKeyboard: |
| 1610 | PushInShowSoftwareKeyboard(); | 1623 | PushInShowSoftwareKeyboard(); |
| 1611 | break; | 1624 | break; |
| 1625 | case Applets::AppletId::Controller: | ||
| 1626 | PushInShowController(); | ||
| 1627 | break; | ||
| 1612 | default: | 1628 | default: |
| 1613 | break; | 1629 | break; |
| 1614 | } | 1630 | } |
| @@ -1666,13 +1682,33 @@ void ILibraryAppletSelfAccessor::GetLibraryAppletInfo(HLERequestContext& ctx) { | |||
| 1666 | rb.PushRaw(applet_info); | 1682 | rb.PushRaw(applet_info); |
| 1667 | } | 1683 | } |
| 1668 | 1684 | ||
| 1669 | void ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfo(HLERequestContext& ctx) { | 1685 | void ILibraryAppletSelfAccessor::GetMainAppletIdentityInfo(HLERequestContext& ctx) { |
| 1670 | struct AppletIdentityInfo { | 1686 | struct AppletIdentityInfo { |
| 1671 | Applets::AppletId applet_id; | 1687 | Applets::AppletId applet_id; |
| 1672 | INSERT_PADDING_BYTES(0x4); | 1688 | INSERT_PADDING_BYTES(0x4); |
| 1673 | u64 application_id; | 1689 | u64 application_id; |
| 1674 | }; | 1690 | }; |
| 1691 | static_assert(sizeof(AppletIdentityInfo) == 0x10, "AppletIdentityInfo has incorrect size."); | ||
| 1692 | |||
| 1693 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 1694 | |||
| 1695 | const AppletIdentityInfo applet_info{ | ||
| 1696 | .applet_id = Applets::AppletId::QLaunch, | ||
| 1697 | .application_id = 0x0100000000001000ull, | ||
| 1698 | }; | ||
| 1699 | |||
| 1700 | IPC::ResponseBuilder rb{ctx, 6}; | ||
| 1701 | rb.Push(ResultSuccess); | ||
| 1702 | rb.PushRaw(applet_info); | ||
| 1703 | } | ||
| 1675 | 1704 | ||
| 1705 | void ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfo(HLERequestContext& ctx) { | ||
| 1706 | struct AppletIdentityInfo { | ||
| 1707 | Applets::AppletId applet_id; | ||
| 1708 | INSERT_PADDING_BYTES(0x4); | ||
| 1709 | u64 application_id; | ||
| 1710 | }; | ||
| 1711 | static_assert(sizeof(AppletIdentityInfo) == 0x10, "AppletIdentityInfo has incorrect size."); | ||
| 1676 | LOG_WARNING(Service_AM, "(STUBBED) called"); | 1712 | LOG_WARNING(Service_AM, "(STUBBED) called"); |
| 1677 | 1713 | ||
| 1678 | const AppletIdentityInfo applet_info{ | 1714 | const AppletIdentityInfo applet_info{ |
| @@ -1737,6 +1773,55 @@ void ILibraryAppletSelfAccessor::PushInShowAlbum() { | |||
| 1737 | queue_data.emplace_back(std::move(settings_data)); | 1773 | queue_data.emplace_back(std::move(settings_data)); |
| 1738 | } | 1774 | } |
| 1739 | 1775 | ||
| 1776 | void ILibraryAppletSelfAccessor::PushInShowController() { | ||
| 1777 | const Applets::CommonArguments common_args = { | ||
| 1778 | .arguments_version = Applets::CommonArgumentVersion::Version3, | ||
| 1779 | .size = Applets::CommonArgumentSize::Version3, | ||
| 1780 | .library_version = static_cast<u32>(Applets::ControllerAppletVersion::Version8), | ||
| 1781 | .theme_color = Applets::ThemeColor::BasicBlack, | ||
| 1782 | .play_startup_sound = true, | ||
| 1783 | .system_tick = system.CoreTiming().GetClockTicks(), | ||
| 1784 | }; | ||
| 1785 | |||
| 1786 | Applets::ControllerSupportArgNew user_args = { | ||
| 1787 | .header = {.player_count_min = 1, | ||
| 1788 | .player_count_max = 4, | ||
| 1789 | .enable_take_over_connection = true, | ||
| 1790 | .enable_left_justify = false, | ||
| 1791 | .enable_permit_joy_dual = true, | ||
| 1792 | .enable_single_mode = false, | ||
| 1793 | .enable_identification_color = false}, | ||
| 1794 | .identification_colors = {}, | ||
| 1795 | .enable_explain_text = false, | ||
| 1796 | .explain_text = {}, | ||
| 1797 | }; | ||
| 1798 | |||
| 1799 | Applets::ControllerSupportArgPrivate private_args = { | ||
| 1800 | .arg_private_size = sizeof(Applets::ControllerSupportArgPrivate), | ||
| 1801 | .arg_size = sizeof(Applets::ControllerSupportArgNew), | ||
| 1802 | .is_home_menu = true, | ||
| 1803 | .flag_1 = true, | ||
| 1804 | .mode = Applets::ControllerSupportMode::ShowControllerSupport, | ||
| 1805 | .caller = Applets::ControllerSupportCaller:: | ||
| 1806 | Application, // switchbrew: Always zero except with | ||
| 1807 | // ShowControllerFirmwareUpdateForSystem/ShowControllerKeyRemappingForSystem, | ||
| 1808 | // which sets this to the input param | ||
| 1809 | .style_set = Core::HID::NpadStyleSet::None, | ||
| 1810 | .joy_hold_type = 0, | ||
| 1811 | }; | ||
| 1812 | std::vector<u8> common_args_data(sizeof(common_args)); | ||
| 1813 | std::vector<u8> private_args_data(sizeof(private_args)); | ||
| 1814 | std::vector<u8> user_args_data(sizeof(user_args)); | ||
| 1815 | |||
| 1816 | std::memcpy(common_args_data.data(), &common_args, sizeof(common_args)); | ||
| 1817 | std::memcpy(private_args_data.data(), &private_args, sizeof(private_args)); | ||
| 1818 | std::memcpy(user_args_data.data(), &user_args, sizeof(user_args)); | ||
| 1819 | |||
| 1820 | queue_data.emplace_back(std::move(common_args_data)); | ||
| 1821 | queue_data.emplace_back(std::move(private_args_data)); | ||
| 1822 | queue_data.emplace_back(std::move(user_args_data)); | ||
| 1823 | } | ||
| 1824 | |||
| 1740 | void ILibraryAppletSelfAccessor::PushInShowCabinetData() { | 1825 | void ILibraryAppletSelfAccessor::PushInShowCabinetData() { |
| 1741 | const Applets::CommonArguments arguments{ | 1826 | const Applets::CommonArguments arguments{ |
| 1742 | .arguments_version = Applets::CommonArgumentVersion::Version3, | 1827 | .arguments_version = Applets::CommonArgumentVersion::Version3, |
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index 8f8cb8a9e..905a71b9f 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h | |||
| @@ -87,6 +87,7 @@ public: | |||
| 87 | 87 | ||
| 88 | private: | 88 | private: |
| 89 | void GetAppletResourceUserId(HLERequestContext& ctx); | 89 | void GetAppletResourceUserId(HLERequestContext& ctx); |
| 90 | void GetAppletResourceUserIdOfCallerApplet(HLERequestContext& ctx); | ||
| 90 | void AcquireForegroundRights(HLERequestContext& ctx); | 91 | void AcquireForegroundRights(HLERequestContext& ctx); |
| 91 | }; | 92 | }; |
| 92 | 93 | ||
| @@ -345,6 +346,7 @@ private: | |||
| 345 | void PopInData(HLERequestContext& ctx); | 346 | void PopInData(HLERequestContext& ctx); |
| 346 | void PushOutData(HLERequestContext& ctx); | 347 | void PushOutData(HLERequestContext& ctx); |
| 347 | void GetLibraryAppletInfo(HLERequestContext& ctx); | 348 | void GetLibraryAppletInfo(HLERequestContext& ctx); |
| 349 | void GetMainAppletIdentityInfo(HLERequestContext& ctx); | ||
| 348 | void ExitProcessAndReturn(HLERequestContext& ctx); | 350 | void ExitProcessAndReturn(HLERequestContext& ctx); |
| 349 | void GetCallerAppletIdentityInfo(HLERequestContext& ctx); | 351 | void GetCallerAppletIdentityInfo(HLERequestContext& ctx); |
| 350 | void GetDesirableKeyboardLayout(HLERequestContext& ctx); | 352 | void GetDesirableKeyboardLayout(HLERequestContext& ctx); |
| @@ -355,6 +357,7 @@ private: | |||
| 355 | void PushInShowCabinetData(); | 357 | void PushInShowCabinetData(); |
| 356 | void PushInShowMiiEditData(); | 358 | void PushInShowMiiEditData(); |
| 357 | void PushInShowSoftwareKeyboard(); | 359 | void PushInShowSoftwareKeyboard(); |
| 360 | void PushInShowController(); | ||
| 358 | 361 | ||
| 359 | std::deque<std::vector<u8>> queue_data; | 362 | std::deque<std::vector<u8>> queue_data; |
| 360 | }; | 363 | }; |
diff --git a/src/core/hle/service/am/applets/applet_controller.h b/src/core/hle/service/am/applets/applet_controller.h index f6c64f633..9f839f3d7 100644 --- a/src/core/hle/service/am/applets/applet_controller.h +++ b/src/core/hle/service/am/applets/applet_controller.h | |||
| @@ -56,7 +56,7 @@ enum class ControllerSupportResult : u32 { | |||
| 56 | struct ControllerSupportArgPrivate { | 56 | struct ControllerSupportArgPrivate { |
| 57 | u32 arg_private_size{}; | 57 | u32 arg_private_size{}; |
| 58 | u32 arg_size{}; | 58 | u32 arg_size{}; |
| 59 | bool flag_0{}; | 59 | bool is_home_menu{}; |
| 60 | bool flag_1{}; | 60 | bool flag_1{}; |
| 61 | ControllerSupportMode mode{}; | 61 | ControllerSupportMode mode{}; |
| 62 | ControllerSupportCaller caller{}; | 62 | ControllerSupportCaller caller{}; |
diff --git a/src/core/hle/service/btm/btm.cpp b/src/core/hle/service/btm/btm.cpp index 8069f75b7..c65e32489 100644 --- a/src/core/hle/service/btm/btm.cpp +++ b/src/core/hle/service/btm/btm.cpp | |||
| @@ -127,7 +127,7 @@ public: | |||
| 127 | 127 | ||
| 128 | private: | 128 | private: |
| 129 | void GetCore(HLERequestContext& ctx) { | 129 | void GetCore(HLERequestContext& ctx) { |
| 130 | LOG_DEBUG(Service_BTM, "called"); | 130 | LOG_WARNING(Service_BTM, "called"); |
| 131 | 131 | ||
| 132 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 132 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 133 | rb.Push(ResultSuccess); | 133 | rb.Push(ResultSuccess); |
| @@ -263,13 +263,13 @@ public: | |||
| 263 | explicit IBtmSystemCore(Core::System& system_) : ServiceFramework{system_, "IBtmSystemCore"} { | 263 | explicit IBtmSystemCore(Core::System& system_) : ServiceFramework{system_, "IBtmSystemCore"} { |
| 264 | // clang-format off | 264 | // clang-format off |
| 265 | static const FunctionInfo functions[] = { | 265 | static const FunctionInfo functions[] = { |
| 266 | {0, nullptr, "StartGamepadPairing"}, | 266 | {0, &IBtmSystemCore::StartGamepadPairing, "StartGamepadPairing"}, |
| 267 | {1, nullptr, "CancelGamepadPairing"}, | 267 | {1, &IBtmSystemCore::CancelGamepadPairing, "CancelGamepadPairing"}, |
| 268 | {2, nullptr, "ClearGamepadPairingDatabase"}, | 268 | {2, nullptr, "ClearGamepadPairingDatabase"}, |
| 269 | {3, nullptr, "GetPairedGamepadCount"}, | 269 | {3, nullptr, "GetPairedGamepadCount"}, |
| 270 | {4, nullptr, "EnableRadio"}, | 270 | {4, nullptr, "EnableRadio"}, |
| 271 | {5, nullptr, "DisableRadio"}, | 271 | {5, nullptr, "DisableRadio"}, |
| 272 | {6, nullptr, "GetRadioOnOff"}, | 272 | {6, &IBtmSystemCore::IsRadioEnabled, "IsRadioEnabled"}, |
| 273 | {7, nullptr, "AcquireRadioEvent"}, | 273 | {7, nullptr, "AcquireRadioEvent"}, |
| 274 | {8, nullptr, "AcquireGamepadPairingEvent"}, | 274 | {8, nullptr, "AcquireGamepadPairingEvent"}, |
| 275 | {9, nullptr, "IsGamepadPairingStarted"}, | 275 | {9, nullptr, "IsGamepadPairingStarted"}, |
| @@ -280,18 +280,58 @@ public: | |||
| 280 | {14, nullptr, "AcquireAudioDeviceConnectionEvent"}, | 280 | {14, nullptr, "AcquireAudioDeviceConnectionEvent"}, |
| 281 | {15, nullptr, "ConnectAudioDevice"}, | 281 | {15, nullptr, "ConnectAudioDevice"}, |
| 282 | {16, nullptr, "IsConnectingAudioDevice"}, | 282 | {16, nullptr, "IsConnectingAudioDevice"}, |
| 283 | {17, nullptr, "GetConnectedAudioDevices"}, | 283 | {17, &IBtmSystemCore::GetConnectedAudioDevices, "GetConnectedAudioDevices"}, |
| 284 | {18, nullptr, "DisconnectAudioDevice"}, | 284 | {18, nullptr, "DisconnectAudioDevice"}, |
| 285 | {19, nullptr, "AcquirePairedAudioDeviceInfoChangedEvent"}, | 285 | {19, nullptr, "AcquirePairedAudioDeviceInfoChangedEvent"}, |
| 286 | {20, nullptr, "GetPairedAudioDevices"}, | 286 | {20, nullptr, "GetPairedAudioDevices"}, |
| 287 | {21, nullptr, "RemoveAudioDevicePairing"}, | 287 | {21, nullptr, "RemoveAudioDevicePairing"}, |
| 288 | {22, nullptr, "RequestAudioDeviceConnectionRejection"}, | 288 | {22, &IBtmSystemCore::RequestAudioDeviceConnectionRejection, "RequestAudioDeviceConnectionRejection"}, |
| 289 | {23, nullptr, "CancelAudioDeviceConnectionRejection"} | 289 | {23, &IBtmSystemCore::CancelAudioDeviceConnectionRejection, "CancelAudioDeviceConnectionRejection"} |
| 290 | }; | 290 | }; |
| 291 | // clang-format on | 291 | // clang-format on |
| 292 | 292 | ||
| 293 | RegisterHandlers(functions); | 293 | RegisterHandlers(functions); |
| 294 | } | 294 | } |
| 295 | |||
| 296 | private: | ||
| 297 | void IsRadioEnabled(HLERequestContext& ctx) { | ||
| 298 | LOG_DEBUG(Service_BTM, "(STUBBED) called"); // Spams a lot when controller applet is running | ||
| 299 | |||
| 300 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 301 | rb.Push(ResultSuccess); | ||
| 302 | rb.Push(true); | ||
| 303 | } | ||
| 304 | |||
| 305 | void StartGamepadPairing(HLERequestContext& ctx) { | ||
| 306 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 307 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 308 | rb.Push(ResultSuccess); | ||
| 309 | } | ||
| 310 | |||
| 311 | void CancelGamepadPairing(HLERequestContext& ctx) { | ||
| 312 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 313 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 314 | rb.Push(ResultSuccess); | ||
| 315 | } | ||
| 316 | |||
| 317 | void CancelAudioDeviceConnectionRejection(HLERequestContext& ctx) { | ||
| 318 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 319 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 320 | rb.Push(ResultSuccess); | ||
| 321 | } | ||
| 322 | |||
| 323 | void GetConnectedAudioDevices(HLERequestContext& ctx) { | ||
| 324 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 325 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 326 | rb.Push(ResultSuccess); | ||
| 327 | rb.Push<u32>(0); | ||
| 328 | } | ||
| 329 | |||
| 330 | void RequestAudioDeviceConnectionRejection(HLERequestContext& ctx) { | ||
| 331 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 332 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 333 | rb.Push(ResultSuccess); | ||
| 334 | } | ||
| 295 | }; | 335 | }; |
| 296 | 336 | ||
| 297 | class BTM_SYS final : public ServiceFramework<BTM_SYS> { | 337 | class BTM_SYS final : public ServiceFramework<BTM_SYS> { |
| @@ -308,7 +348,7 @@ public: | |||
| 308 | 348 | ||
| 309 | private: | 349 | private: |
| 310 | void GetCore(HLERequestContext& ctx) { | 350 | void GetCore(HLERequestContext& ctx) { |
| 311 | LOG_DEBUG(Service_BTM, "called"); | 351 | LOG_WARNING(Service_BTM, "called"); |
| 312 | 352 | ||
| 313 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 353 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 314 | rb.Push(ResultSuccess); | 354 | rb.Push(ResultSuccess); |
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index d46bf917e..127af2b82 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -344,6 +344,7 @@ void Controller_NPad::InitNewlyAddedController(Core::HID::NpadIdType npad_id) { | |||
| 344 | controller.device->SetPollingMode(Core::HID::EmulatedDeviceIndex::AllDevices, | 344 | controller.device->SetPollingMode(Core::HID::EmulatedDeviceIndex::AllDevices, |
| 345 | Common::Input::PollingMode::Active); | 345 | Common::Input::PollingMode::Active); |
| 346 | } | 346 | } |
| 347 | |||
| 347 | SignalStyleSetChangedEvent(npad_id); | 348 | SignalStyleSetChangedEvent(npad_id); |
| 348 | WriteEmptyEntry(controller.shared_memory); | 349 | WriteEmptyEntry(controller.shared_memory); |
| 349 | hid_core.SetLastActiveController(npad_id); | 350 | hid_core.SetLastActiveController(npad_id); |
| @@ -1726,4 +1727,19 @@ const Controller_NPad::SixaxisParameters& Controller_NPad::GetSixaxisState( | |||
| 1726 | } | 1727 | } |
| 1727 | } | 1728 | } |
| 1728 | 1729 | ||
| 1730 | Controller_NPad::AppletDetailedUiType Controller_NPad::GetAppletDetailedUiType( | ||
| 1731 | Core::HID::NpadIdType npad_id) { | ||
| 1732 | |||
| 1733 | auto controller = GetControllerFromNpadIdType(npad_id); | ||
| 1734 | auto shared_memory = controller.shared_memory; | ||
| 1735 | Service::HID::Controller_NPad::AppletFooterUiType applet_footer_type = | ||
| 1736 | shared_memory->applet_footer_type; | ||
| 1737 | |||
| 1738 | Controller_NPad::AppletDetailedUiType detailed_ui_type{ | ||
| 1739 | .ui_variant = 0, | ||
| 1740 | .footer = applet_footer_type, | ||
| 1741 | }; | ||
| 1742 | return detailed_ui_type; | ||
| 1743 | } | ||
| 1744 | |||
| 1729 | } // namespace Service::HID | 1745 | } // namespace Service::HID |
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index e23b4986c..cd93abdd1 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h | |||
| @@ -78,6 +78,46 @@ public: | |||
| 78 | MaxActivationMode = 3, | 78 | MaxActivationMode = 3, |
| 79 | }; | 79 | }; |
| 80 | 80 | ||
| 81 | // This is nn::hid::system::AppletFooterUiAttributesSet | ||
| 82 | struct AppletFooterUiAttributes { | ||
| 83 | INSERT_PADDING_BYTES(0x4); | ||
| 84 | }; | ||
| 85 | |||
| 86 | // This is nn::hid::system::AppletFooterUiType | ||
| 87 | enum class AppletFooterUiType : u8 { | ||
| 88 | None = 0, | ||
| 89 | HandheldNone = 1, | ||
| 90 | HandheldJoyConLeftOnly = 2, | ||
| 91 | HandheldJoyConRightOnly = 3, | ||
| 92 | HandheldJoyConLeftJoyConRight = 4, | ||
| 93 | JoyDual = 5, | ||
| 94 | JoyDualLeftOnly = 6, | ||
| 95 | JoyDualRightOnly = 7, | ||
| 96 | JoyLeftHorizontal = 8, | ||
| 97 | JoyLeftVertical = 9, | ||
| 98 | JoyRightHorizontal = 10, | ||
| 99 | JoyRightVertical = 11, | ||
| 100 | SwitchProController = 12, | ||
| 101 | CompatibleProController = 13, | ||
| 102 | CompatibleJoyCon = 14, | ||
| 103 | LarkHvc1 = 15, | ||
| 104 | LarkHvc2 = 16, | ||
| 105 | LarkNesLeft = 17, | ||
| 106 | LarkNesRight = 18, | ||
| 107 | Lucia = 19, | ||
| 108 | Verification = 20, | ||
| 109 | Lagon = 21, | ||
| 110 | }; | ||
| 111 | |||
| 112 | using AppletFooterUiVariant = u8; | ||
| 113 | |||
| 114 | // This is "nn::hid::system::AppletDetailedUiType". | ||
| 115 | struct AppletDetailedUiType { | ||
| 116 | AppletFooterUiVariant ui_variant; | ||
| 117 | INSERT_PADDING_BYTES(0x2); | ||
| 118 | AppletFooterUiType footer; | ||
| 119 | }; | ||
| 120 | static_assert(sizeof(AppletDetailedUiType) == 0x4, "AppletDetailedUiType is an invalid size"); | ||
| 81 | // This is nn::hid::NpadCommunicationMode | 121 | // This is nn::hid::NpadCommunicationMode |
| 82 | enum class NpadCommunicationMode : u64 { | 122 | enum class NpadCommunicationMode : u64 { |
| 83 | Mode_5ms = 0, | 123 | Mode_5ms = 0, |
| @@ -203,6 +243,7 @@ public: | |||
| 203 | static Result IsDeviceHandleValid(const Core::HID::VibrationDeviceHandle& device_handle); | 243 | static Result IsDeviceHandleValid(const Core::HID::VibrationDeviceHandle& device_handle); |
| 204 | static Result VerifyValidSixAxisSensorHandle( | 244 | static Result VerifyValidSixAxisSensorHandle( |
| 205 | const Core::HID::SixAxisSensorHandle& device_handle); | 245 | const Core::HID::SixAxisSensorHandle& device_handle); |
| 246 | AppletDetailedUiType GetAppletDetailedUiType(Core::HID::NpadIdType npad_id); | ||
| 206 | 247 | ||
| 207 | private: | 248 | private: |
| 208 | static constexpr std::size_t NPAD_COUNT = 10; | 249 | static constexpr std::size_t NPAD_COUNT = 10; |
| @@ -360,37 +401,6 @@ private: | |||
| 360 | static_assert(sizeof(NfcXcdDeviceHandleStateImpl) == 0x18, | 401 | static_assert(sizeof(NfcXcdDeviceHandleStateImpl) == 0x18, |
| 361 | "NfcXcdDeviceHandleStateImpl is an invalid size"); | 402 | "NfcXcdDeviceHandleStateImpl is an invalid size"); |
| 362 | 403 | ||
| 363 | // This is nn::hid::system::AppletFooterUiAttributesSet | ||
| 364 | struct AppletFooterUiAttributes { | ||
| 365 | INSERT_PADDING_BYTES(0x4); | ||
| 366 | }; | ||
| 367 | |||
| 368 | // This is nn::hid::system::AppletFooterUiType | ||
| 369 | enum class AppletFooterUiType : u8 { | ||
| 370 | None = 0, | ||
| 371 | HandheldNone = 1, | ||
| 372 | HandheldJoyConLeftOnly = 2, | ||
| 373 | HandheldJoyConRightOnly = 3, | ||
| 374 | HandheldJoyConLeftJoyConRight = 4, | ||
| 375 | JoyDual = 5, | ||
| 376 | JoyDualLeftOnly = 6, | ||
| 377 | JoyDualRightOnly = 7, | ||
| 378 | JoyLeftHorizontal = 8, | ||
| 379 | JoyLeftVertical = 9, | ||
| 380 | JoyRightHorizontal = 10, | ||
| 381 | JoyRightVertical = 11, | ||
| 382 | SwitchProController = 12, | ||
| 383 | CompatibleProController = 13, | ||
| 384 | CompatibleJoyCon = 14, | ||
| 385 | LarkHvc1 = 15, | ||
| 386 | LarkHvc2 = 16, | ||
| 387 | LarkNesLeft = 17, | ||
| 388 | LarkNesRight = 18, | ||
| 389 | Lucia = 19, | ||
| 390 | Verification = 20, | ||
| 391 | Lagon = 21, | ||
| 392 | }; | ||
| 393 | |||
| 394 | // This is nn::hid::NpadLarkType | 404 | // This is nn::hid::NpadLarkType |
| 395 | enum class NpadLarkType : u32 { | 405 | enum class NpadLarkType : u32 { |
| 396 | Invalid, | 406 | Invalid, |
diff --git a/src/core/hle/service/hid/hid_server.cpp b/src/core/hle/service/hid/hid_server.cpp index 9094fdcc7..9caed6541 100644 --- a/src/core/hle/service/hid/hid_server.cpp +++ b/src/core/hle/service/hid/hid_server.cpp | |||
| @@ -1222,8 +1222,8 @@ void IHidServer::SetNpadJoyAssignmentModeDual(HLERequestContext& ctx) { | |||
| 1222 | controller.SetNpadMode(new_npad_id, parameters.npad_id, {}, | 1222 | controller.SetNpadMode(new_npad_id, parameters.npad_id, {}, |
| 1223 | Controller_NPad::NpadJoyAssignmentMode::Dual); | 1223 | Controller_NPad::NpadJoyAssignmentMode::Dual); |
| 1224 | 1224 | ||
| 1225 | LOG_INFO(Service_HID, "called, npad_id={}, applet_resource_user_id={}", parameters.npad_id, | 1225 | LOG_DEBUG(Service_HID, "called, npad_id={}, applet_resource_user_id={}", parameters.npad_id, |
| 1226 | parameters.applet_resource_user_id); | 1226 | parameters.applet_resource_user_id); // Spams a lot when controller applet is open |
| 1227 | 1227 | ||
| 1228 | IPC::ResponseBuilder rb{ctx, 2}; | 1228 | IPC::ResponseBuilder rb{ctx, 2}; |
| 1229 | rb.Push(ResultSuccess); | 1229 | rb.Push(ResultSuccess); |
diff --git a/src/core/hle/service/hid/hid_system_server.cpp b/src/core/hle/service/hid/hid_system_server.cpp index 83cfadada..6f1902ee5 100644 --- a/src/core/hle/service/hid/hid_system_server.cpp +++ b/src/core/hle/service/hid/hid_system_server.cpp | |||
| @@ -36,24 +36,24 @@ IHidSystemServer::IHidSystemServer(Core::System& system_, std::shared_ptr<Resour | |||
| 36 | {233, nullptr, "GetXcdHandleForNpadWithIrSensor"}, | 36 | {233, nullptr, "GetXcdHandleForNpadWithIrSensor"}, |
| 37 | {301, nullptr, "ActivateNpadSystem"}, | 37 | {301, nullptr, "ActivateNpadSystem"}, |
| 38 | {303, &IHidSystemServer::ApplyNpadSystemCommonPolicy, "ApplyNpadSystemCommonPolicy"}, | 38 | {303, &IHidSystemServer::ApplyNpadSystemCommonPolicy, "ApplyNpadSystemCommonPolicy"}, |
| 39 | {304, nullptr, "EnableAssigningSingleOnSlSrPress"}, | 39 | {304, &IHidSystemServer::EnableAssigningSingleOnSlSrPress, "EnableAssigningSingleOnSlSrPress"}, |
| 40 | {305, nullptr, "DisableAssigningSingleOnSlSrPress"}, | 40 | {305, &IHidSystemServer::DisableAssigningSingleOnSlSrPress, "DisableAssigningSingleOnSlSrPress"}, |
| 41 | {306, &IHidSystemServer::GetLastActiveNpad, "GetLastActiveNpad"}, | 41 | {306, &IHidSystemServer::GetLastActiveNpad, "GetLastActiveNpad"}, |
| 42 | {307, nullptr, "GetNpadSystemExtStyle"}, | 42 | {307, nullptr, "GetNpadSystemExtStyle"}, |
| 43 | {308, nullptr, "ApplyNpadSystemCommonPolicyFull"}, | 43 | {308, &IHidSystemServer::ApplyNpadSystemCommonPolicyFull, "ApplyNpadSystemCommonPolicyFull"}, |
| 44 | {309, nullptr, "GetNpadFullKeyGripColor"}, | 44 | {309, &IHidSystemServer::GetNpadFullKeyGripColor, "GetNpadFullKeyGripColor"}, |
| 45 | {310, nullptr, "GetMaskedSupportedNpadStyleSet"}, | 45 | {310, &IHidSystemServer::GetMaskedSupportedNpadStyleSet, "GetMaskedSupportedNpadStyleSet"}, |
| 46 | {311, nullptr, "SetNpadPlayerLedBlinkingDevice"}, | 46 | {311, nullptr, "SetNpadPlayerLedBlinkingDevice"}, |
| 47 | {312, nullptr, "SetSupportedNpadStyleSetAll"}, | 47 | {312, &IHidSystemServer::SetSupportedNpadStyleSetAll, "SetSupportedNpadStyleSetAll"}, |
| 48 | {313, nullptr, "GetNpadCaptureButtonAssignment"}, | 48 | {313, nullptr, "GetNpadCaptureButtonAssignment"}, |
| 49 | {314, nullptr, "GetAppletFooterUiType"}, | 49 | {314, nullptr, "GetAppletFooterUiType"}, |
| 50 | {315, nullptr, "GetAppletDetailedUiType"}, | 50 | {315, &IHidSystemServer::GetAppletDetailedUiType, "GetAppletDetailedUiType"}, |
| 51 | {316, nullptr, "GetNpadInterfaceType"}, | 51 | {316, &IHidSystemServer::GetNpadInterfaceType, "GetNpadInterfaceType"}, |
| 52 | {317, nullptr, "GetNpadLeftRightInterfaceType"}, | 52 | {317, &IHidSystemServer::GetNpadLeftRightInterfaceType, "GetNpadLeftRightInterfaceType"}, |
| 53 | {318, nullptr, "HasBattery"}, | 53 | {318, &IHidSystemServer::HasBattery, "HasBattery"}, |
| 54 | {319, nullptr, "HasLeftRightBattery"}, | 54 | {319, &IHidSystemServer::HasLeftRightBattery, "HasLeftRightBattery"}, |
| 55 | {321, &IHidSystemServer::GetUniquePadsFromNpad, "GetUniquePadsFromNpad"}, | 55 | {321, &IHidSystemServer::GetUniquePadsFromNpad, "GetUniquePadsFromNpad"}, |
| 56 | {322, nullptr, "GetIrSensorState"}, | 56 | {322, &IHidSystemServer::GetIrSensorState, "GetIrSensorState"}, |
| 57 | {323, nullptr, "GetXcdHandleForNpadWithIrSensor"}, | 57 | {323, nullptr, "GetXcdHandleForNpadWithIrSensor"}, |
| 58 | {324, nullptr, "GetUniquePadButtonSet"}, | 58 | {324, nullptr, "GetUniquePadButtonSet"}, |
| 59 | {325, nullptr, "GetUniquePadColor"}, | 59 | {325, nullptr, "GetUniquePadColor"}, |
| @@ -85,15 +85,15 @@ IHidSystemServer::IHidSystemServer(Core::System& system_, std::shared_ptr<Resour | |||
| 85 | {541, nullptr, "GetPlayReportControllerUsages"}, | 85 | {541, nullptr, "GetPlayReportControllerUsages"}, |
| 86 | {542, nullptr, "AcquirePlayReportRegisteredDeviceUpdateEvent"}, | 86 | {542, nullptr, "AcquirePlayReportRegisteredDeviceUpdateEvent"}, |
| 87 | {543, nullptr, "GetRegisteredDevicesOld"}, | 87 | {543, nullptr, "GetRegisteredDevicesOld"}, |
| 88 | {544, nullptr, "AcquireConnectionTriggerTimeoutEvent"}, | 88 | {544, &IHidSystemServer::AcquireConnectionTriggerTimeoutEvent, "AcquireConnectionTriggerTimeoutEvent"}, |
| 89 | {545, nullptr, "SendConnectionTrigger"}, | 89 | {545, nullptr, "SendConnectionTrigger"}, |
| 90 | {546, nullptr, "AcquireDeviceRegisteredEventForControllerSupport"}, | 90 | {546, &IHidSystemServer::AcquireDeviceRegisteredEventForControllerSupport, "AcquireDeviceRegisteredEventForControllerSupport"}, |
| 91 | {547, nullptr, "GetAllowedBluetoothLinksCount"}, | 91 | {547, nullptr, "GetAllowedBluetoothLinksCount"}, |
| 92 | {548, nullptr, "GetRegisteredDevices"}, | 92 | {548, &IHidSystemServer::GetRegisteredDevices, "GetRegisteredDevices"}, |
| 93 | {549, nullptr, "GetConnectableRegisteredDevices"}, | 93 | {549, nullptr, "GetConnectableRegisteredDevices"}, |
| 94 | {700, nullptr, "ActivateUniquePad"}, | 94 | {700, nullptr, "ActivateUniquePad"}, |
| 95 | {702, nullptr, "AcquireUniquePadConnectionEventHandle"}, | 95 | {702, &IHidSystemServer::AcquireUniquePadConnectionEventHandle, "AcquireUniquePadConnectionEventHandle"}, |
| 96 | {703, nullptr, "GetUniquePadIds"}, | 96 | {703, &IHidSystemServer::GetUniquePadIds, "GetUniquePadIds"}, |
| 97 | {751, &IHidSystemServer::AcquireJoyDetachOnBluetoothOffEventHandle, "AcquireJoyDetachOnBluetoothOffEventHandle"}, | 97 | {751, &IHidSystemServer::AcquireJoyDetachOnBluetoothOffEventHandle, "AcquireJoyDetachOnBluetoothOffEventHandle"}, |
| 98 | {800, nullptr, "ListSixAxisSensorHandles"}, | 98 | {800, nullptr, "ListSixAxisSensorHandles"}, |
| 99 | {801, nullptr, "IsSixAxisSensorUserCalibrationSupported"}, | 99 | {801, nullptr, "IsSixAxisSensorUserCalibrationSupported"}, |
| @@ -123,10 +123,10 @@ IHidSystemServer::IHidSystemServer(Core::System& system_, std::shared_ptr<Resour | |||
| 123 | {850, &IHidSystemServer::IsUsbFullKeyControllerEnabled, "IsUsbFullKeyControllerEnabled"}, | 123 | {850, &IHidSystemServer::IsUsbFullKeyControllerEnabled, "IsUsbFullKeyControllerEnabled"}, |
| 124 | {851, nullptr, "EnableUsbFullKeyController"}, | 124 | {851, nullptr, "EnableUsbFullKeyController"}, |
| 125 | {852, nullptr, "IsUsbConnected"}, | 125 | {852, nullptr, "IsUsbConnected"}, |
| 126 | {870, nullptr, "IsHandheldButtonPressedOnConsoleMode"}, | 126 | {870, &IHidSystemServer::IsHandheldButtonPressedOnConsoleMode, "IsHandheldButtonPressedOnConsoleMode"}, |
| 127 | {900, nullptr, "ActivateInputDetector"}, | 127 | {900, nullptr, "ActivateInputDetector"}, |
| 128 | {901, nullptr, "NotifyInputDetector"}, | 128 | {901, nullptr, "NotifyInputDetector"}, |
| 129 | {1000, nullptr, "InitializeFirmwareUpdate"}, | 129 | {1000, &IHidSystemServer::InitializeFirmwareUpdate, "InitializeFirmwareUpdate"}, |
| 130 | {1001, nullptr, "GetFirmwareVersion"}, | 130 | {1001, nullptr, "GetFirmwareVersion"}, |
| 131 | {1002, nullptr, "GetAvailableFirmwareVersion"}, | 131 | {1002, nullptr, "GetAvailableFirmwareVersion"}, |
| 132 | {1003, nullptr, "IsFirmwareUpdateAvailable"}, | 132 | {1003, nullptr, "IsFirmwareUpdateAvailable"}, |
| @@ -149,6 +149,7 @@ IHidSystemServer::IHidSystemServer(Core::System& system_, std::shared_ptr<Resour | |||
| 149 | {1132, nullptr, "CheckUsbFirmwareUpdateRequired"}, | 149 | {1132, nullptr, "CheckUsbFirmwareUpdateRequired"}, |
| 150 | {1133, nullptr, "StartUsbFirmwareUpdate"}, | 150 | {1133, nullptr, "StartUsbFirmwareUpdate"}, |
| 151 | {1134, nullptr, "GetUsbFirmwareUpdateState"}, | 151 | {1134, nullptr, "GetUsbFirmwareUpdateState"}, |
| 152 | {1135, &IHidSystemServer::InitializeUsbFirmwareUpdateWithoutMemory, "InitializeUsbFirmwareUpdateWithoutMemory"}, | ||
| 152 | {1150, nullptr, "SetTouchScreenMagnification"}, | 153 | {1150, nullptr, "SetTouchScreenMagnification"}, |
| 153 | {1151, nullptr, "GetTouchScreenFirmwareVersion"}, | 154 | {1151, nullptr, "GetTouchScreenFirmwareVersion"}, |
| 154 | {1152, nullptr, "SetTouchScreenDefaultConfiguration"}, | 155 | {1152, nullptr, "SetTouchScreenDefaultConfiguration"}, |
| @@ -220,11 +221,20 @@ IHidSystemServer::IHidSystemServer(Core::System& system_, std::shared_ptr<Resour | |||
| 220 | 221 | ||
| 221 | RegisterHandlers(functions); | 222 | RegisterHandlers(functions); |
| 222 | 223 | ||
| 223 | joy_detach_event = service_context.CreateEvent("HidSys::JoyDetachEvent"); | 224 | joy_detach_event = service_context.CreateEvent("IHidSystemServer::JoyDetachEvent"); |
| 225 | acquire_device_registered_event = | ||
| 226 | service_context.CreateEvent("IHidSystemServer::AcquireDeviceRegisteredEvent"); | ||
| 227 | acquire_connection_trigger_timeout_event = | ||
| 228 | service_context.CreateEvent("IHidSystemServer::AcquireConnectionTriggerTimeoutEvent"); | ||
| 229 | unique_pad_connection_event = | ||
| 230 | service_context.CreateEvent("IHidSystemServer::AcquireUniquePadConnectionEventHandle"); | ||
| 224 | } | 231 | } |
| 225 | 232 | ||
| 226 | IHidSystemServer::~IHidSystemServer() { | 233 | IHidSystemServer::~IHidSystemServer() { |
| 227 | service_context.CloseEvent(joy_detach_event); | 234 | service_context.CloseEvent(joy_detach_event); |
| 235 | service_context.CloseEvent(acquire_device_registered_event); | ||
| 236 | service_context.CloseEvent(acquire_connection_trigger_timeout_event); | ||
| 237 | service_context.CloseEvent(unique_pad_connection_event); | ||
| 228 | }; | 238 | }; |
| 229 | 239 | ||
| 230 | void IHidSystemServer::ApplyNpadSystemCommonPolicy(HLERequestContext& ctx) { | 240 | void IHidSystemServer::ApplyNpadSystemCommonPolicy(HLERequestContext& ctx) { |
| @@ -238,29 +248,241 @@ void IHidSystemServer::ApplyNpadSystemCommonPolicy(HLERequestContext& ctx) { | |||
| 238 | rb.Push(ResultSuccess); | 248 | rb.Push(ResultSuccess); |
| 239 | } | 249 | } |
| 240 | 250 | ||
| 251 | void IHidSystemServer::EnableAssigningSingleOnSlSrPress(HLERequestContext& ctx) { | ||
| 252 | LOG_WARNING(Service_HID, "(STUBBED) called"); | ||
| 253 | |||
| 254 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 255 | rb.Push(ResultSuccess); | ||
| 256 | } | ||
| 257 | |||
| 258 | void IHidSystemServer::DisableAssigningSingleOnSlSrPress(HLERequestContext& ctx) { | ||
| 259 | LOG_WARNING(Service_HID, "(STUBBED) called"); | ||
| 260 | |||
| 261 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 262 | rb.Push(ResultSuccess); | ||
| 263 | } | ||
| 264 | |||
| 241 | void IHidSystemServer::GetLastActiveNpad(HLERequestContext& ctx) { | 265 | void IHidSystemServer::GetLastActiveNpad(HLERequestContext& ctx) { |
| 242 | LOG_DEBUG(Service_HID, "(STUBBED) called"); | 266 | LOG_DEBUG(Service_HID, "(STUBBED) called"); // Spams a lot when controller applet is running |
| 243 | 267 | ||
| 244 | IPC::ResponseBuilder rb{ctx, 3}; | 268 | IPC::ResponseBuilder rb{ctx, 3}; |
| 245 | rb.Push(ResultSuccess); | 269 | rb.Push(ResultSuccess); |
| 246 | rb.PushEnum(system.HIDCore().GetLastActiveController()); | 270 | rb.PushEnum(system.HIDCore().GetLastActiveController()); |
| 247 | } | 271 | } |
| 248 | 272 | ||
| 273 | void IHidSystemServer::ApplyNpadSystemCommonPolicyFull(HLERequestContext& ctx) { | ||
| 274 | LOG_WARNING(Service_HID, "called"); | ||
| 275 | |||
| 276 | GetResourceManager() | ||
| 277 | ->GetController<Controller_NPad>(HidController::NPad) | ||
| 278 | .ApplyNpadSystemCommonPolicy(); | ||
| 279 | |||
| 280 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 281 | rb.Push(ResultSuccess); | ||
| 282 | } | ||
| 283 | |||
| 284 | void IHidSystemServer::GetNpadFullKeyGripColor(HLERequestContext& ctx) { | ||
| 285 | IPC::RequestParser rp{ctx}; | ||
| 286 | const auto npad_id_type{rp.PopEnum<Core::HID::NpadIdType>()}; | ||
| 287 | |||
| 288 | LOG_DEBUG(Service_HID, "(STUBBED) called, npad_id_type={}", | ||
| 289 | npad_id_type); // Spams a lot when controller applet is running | ||
| 290 | |||
| 291 | Core::HID::NpadColor left_color{}; | ||
| 292 | Core::HID::NpadColor right_color{}; | ||
| 293 | // TODO: Get colors from Npad | ||
| 294 | |||
| 295 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 296 | rb.Push(ResultSuccess); | ||
| 297 | rb.PushRaw(left_color); | ||
| 298 | rb.PushRaw(right_color); | ||
| 299 | } | ||
| 300 | |||
| 301 | void IHidSystemServer::GetMaskedSupportedNpadStyleSet(HLERequestContext& ctx) { | ||
| 302 | IPC::RequestParser rp{ctx}; | ||
| 303 | |||
| 304 | LOG_INFO(Service_HID, "(STUBBED) called"); | ||
| 305 | |||
| 306 | Core::HID::NpadStyleSet supported_styleset = | ||
| 307 | GetResourceManager() | ||
| 308 | ->GetController<Controller_NPad>(HidController::NPad) | ||
| 309 | .GetSupportedStyleSet() | ||
| 310 | .raw; | ||
| 311 | |||
| 312 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 313 | rb.Push(ResultSuccess); | ||
| 314 | rb.PushEnum(supported_styleset); | ||
| 315 | } | ||
| 316 | |||
| 317 | void IHidSystemServer::SetSupportedNpadStyleSetAll(HLERequestContext& ctx) { | ||
| 318 | IPC::RequestParser rp{ctx}; | ||
| 319 | |||
| 320 | LOG_INFO(Service_HID, "(STUBBED) called"); | ||
| 321 | |||
| 322 | Core::HID::NpadStyleSet supported_styleset = | ||
| 323 | GetResourceManager() | ||
| 324 | ->GetController<Controller_NPad>(HidController::NPad) | ||
| 325 | .GetSupportedStyleSet() | ||
| 326 | .raw; | ||
| 327 | |||
| 328 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 329 | rb.Push(ResultSuccess); | ||
| 330 | rb.PushEnum(supported_styleset); | ||
| 331 | } | ||
| 332 | |||
| 333 | void IHidSystemServer::GetAppletDetailedUiType(HLERequestContext& ctx) { | ||
| 334 | IPC::RequestParser rp{ctx}; | ||
| 335 | const auto npad_id_type{rp.PopEnum<Core::HID::NpadIdType>()}; | ||
| 336 | |||
| 337 | LOG_DEBUG(Service_HID, "called, npad_id_type={}", | ||
| 338 | npad_id_type); // Spams a lot when controller applet is running | ||
| 339 | |||
| 340 | const Service::HID::Controller_NPad::AppletDetailedUiType detailed_ui_type = | ||
| 341 | GetResourceManager() | ||
| 342 | ->GetController<Controller_NPad>(HidController::NPad) | ||
| 343 | .GetAppletDetailedUiType(npad_id_type); | ||
| 344 | |||
| 345 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 346 | rb.Push(ResultSuccess); | ||
| 347 | rb.PushRaw(detailed_ui_type); | ||
| 348 | } | ||
| 349 | |||
| 350 | void IHidSystemServer::GetNpadInterfaceType(HLERequestContext& ctx) { | ||
| 351 | IPC::RequestParser rp{ctx}; | ||
| 352 | const auto npad_id_type{rp.PopEnum<Core::HID::NpadIdType>()}; | ||
| 353 | |||
| 354 | LOG_DEBUG(Service_HID, "(STUBBED) called, npad_id_type={}", | ||
| 355 | npad_id_type); // Spams a lot when controller applet is running | ||
| 356 | |||
| 357 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 358 | rb.Push(ResultSuccess); | ||
| 359 | rb.PushEnum(Core::HID::NpadInterfaceType::Bluetooth); | ||
| 360 | } | ||
| 361 | |||
| 362 | void IHidSystemServer::GetNpadLeftRightInterfaceType(HLERequestContext& ctx) { | ||
| 363 | IPC::RequestParser rp{ctx}; | ||
| 364 | const auto npad_id_type{rp.PopEnum<Core::HID::NpadIdType>()}; | ||
| 365 | |||
| 366 | LOG_DEBUG(Service_HID, "(STUBBED) called, npad_id_type={}", | ||
| 367 | npad_id_type); // Spams a lot when controller applet is running | ||
| 368 | |||
| 369 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 370 | rb.Push(ResultSuccess); | ||
| 371 | rb.PushEnum(Core::HID::NpadInterfaceType::Bluetooth); | ||
| 372 | rb.PushEnum(Core::HID::NpadInterfaceType::Bluetooth); | ||
| 373 | } | ||
| 374 | |||
| 375 | void IHidSystemServer::HasBattery(HLERequestContext& ctx) { | ||
| 376 | IPC::RequestParser rp{ctx}; | ||
| 377 | const auto npad_id_type{rp.PopEnum<Core::HID::NpadIdType>()}; | ||
| 378 | |||
| 379 | LOG_DEBUG(Service_HID, "(STUBBED) called, npad_id_type={}", | ||
| 380 | npad_id_type); // Spams a lot when controller applet is running | ||
| 381 | |||
| 382 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 383 | rb.Push(ResultSuccess); | ||
| 384 | rb.Push(false); | ||
| 385 | } | ||
| 386 | |||
| 387 | void IHidSystemServer::HasLeftRightBattery(HLERequestContext& ctx) { | ||
| 388 | IPC::RequestParser rp{ctx}; | ||
| 389 | const auto npad_id_type{rp.PopEnum<Core::HID::NpadIdType>()}; | ||
| 390 | |||
| 391 | LOG_DEBUG(Service_HID, "(STUBBED) called, npad_id_type={}", | ||
| 392 | npad_id_type); // Spams a lot when controller applet is running | ||
| 393 | |||
| 394 | struct LeftRightBattery { | ||
| 395 | bool left; | ||
| 396 | bool right; | ||
| 397 | }; | ||
| 398 | |||
| 399 | LeftRightBattery left_right_battery{ | ||
| 400 | .left = false, | ||
| 401 | .right = false, | ||
| 402 | }; | ||
| 403 | |||
| 404 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 405 | rb.Push(ResultSuccess); | ||
| 406 | rb.PushRaw(left_right_battery); | ||
| 407 | } | ||
| 408 | |||
| 249 | void IHidSystemServer::GetUniquePadsFromNpad(HLERequestContext& ctx) { | 409 | void IHidSystemServer::GetUniquePadsFromNpad(HLERequestContext& ctx) { |
| 250 | IPC::RequestParser rp{ctx}; | 410 | IPC::RequestParser rp{ctx}; |
| 251 | const auto npad_id_type{rp.PopEnum<Core::HID::NpadIdType>()}; | 411 | const auto npad_id_type{rp.PopEnum<Core::HID::NpadIdType>()}; |
| 252 | 412 | ||
| 253 | LOG_WARNING(Service_HID, "(STUBBED) called, npad_id_type={}", npad_id_type); | 413 | LOG_DEBUG(Service_HID, "(STUBBED) called, npad_id_type={}", |
| 414 | npad_id_type); // Spams a lot when controller applet is running | ||
| 254 | 415 | ||
| 255 | const std::vector<Core::HID::UniquePadId> unique_pads{}; | 416 | const std::vector<Core::HID::UniquePadId> unique_pads{}; |
| 256 | 417 | ||
| 257 | ctx.WriteBuffer(unique_pads); | 418 | if (!unique_pads.empty()) { |
| 419 | ctx.WriteBuffer(unique_pads); | ||
| 420 | } | ||
| 258 | 421 | ||
| 259 | IPC::ResponseBuilder rb{ctx, 3}; | 422 | IPC::ResponseBuilder rb{ctx, 3}; |
| 260 | rb.Push(ResultSuccess); | 423 | rb.Push(ResultSuccess); |
| 261 | rb.Push(static_cast<u32>(unique_pads.size())); | 424 | rb.Push(static_cast<u32>(unique_pads.size())); |
| 262 | } | 425 | } |
| 263 | 426 | ||
| 427 | void IHidSystemServer::GetIrSensorState(HLERequestContext& ctx) { | ||
| 428 | IPC::RequestParser rp{ctx}; | ||
| 429 | |||
| 430 | LOG_WARNING(Service_HID, "(STUBBED) called"); | ||
| 431 | |||
| 432 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 433 | rb.Push(ResultSuccess); | ||
| 434 | } | ||
| 435 | |||
| 436 | void IHidSystemServer::AcquireConnectionTriggerTimeoutEvent(HLERequestContext& ctx) { | ||
| 437 | LOG_INFO(Service_AM, "(STUBBED) called"); | ||
| 438 | |||
| 439 | IPC::ResponseBuilder rb{ctx, 2, 1}; | ||
| 440 | rb.Push(ResultSuccess); | ||
| 441 | rb.PushCopyObjects(acquire_device_registered_event->GetReadableEvent()); | ||
| 442 | } | ||
| 443 | |||
| 444 | void IHidSystemServer::AcquireDeviceRegisteredEventForControllerSupport(HLERequestContext& ctx) { | ||
| 445 | LOG_INFO(Service_HID, "(STUBBED) called"); | ||
| 446 | |||
| 447 | IPC::ResponseBuilder rb{ctx, 2, 1}; | ||
| 448 | rb.Push(ResultSuccess); | ||
| 449 | rb.PushCopyObjects(acquire_device_registered_event->GetReadableEvent()); | ||
| 450 | } | ||
| 451 | |||
| 452 | void IHidSystemServer::GetRegisteredDevices(HLERequestContext& ctx) { | ||
| 453 | LOG_WARNING(Service_HID, "(STUBBED) called"); | ||
| 454 | |||
| 455 | struct RegisterData { | ||
| 456 | std::array<u8, 0x68> data; | ||
| 457 | }; | ||
| 458 | static_assert(sizeof(RegisterData) == 0x68, "RegisterData is an invalid size"); | ||
| 459 | std::vector<RegisterData> registered_devices{}; | ||
| 460 | |||
| 461 | if (!registered_devices.empty()) { | ||
| 462 | ctx.WriteBuffer(registered_devices); | ||
| 463 | } | ||
| 464 | |||
| 465 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 466 | rb.Push(ResultSuccess); | ||
| 467 | rb.Push<u64>(registered_devices.size()); | ||
| 468 | } | ||
| 469 | |||
| 470 | void IHidSystemServer::AcquireUniquePadConnectionEventHandle(HLERequestContext& ctx) { | ||
| 471 | LOG_WARNING(Service_HID, "(STUBBED) called"); | ||
| 472 | |||
| 473 | IPC::ResponseBuilder rb{ctx, 2, 1}; | ||
| 474 | rb.PushCopyObjects(unique_pad_connection_event->GetReadableEvent()); | ||
| 475 | rb.Push(ResultSuccess); | ||
| 476 | } | ||
| 477 | |||
| 478 | void IHidSystemServer::GetUniquePadIds(HLERequestContext& ctx) { | ||
| 479 | LOG_WARNING(Service_HID, "(STUBBED) called"); | ||
| 480 | |||
| 481 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 482 | rb.Push(ResultSuccess); | ||
| 483 | rb.Push<u64>(0); | ||
| 484 | } | ||
| 485 | |||
| 264 | void IHidSystemServer::AcquireJoyDetachOnBluetoothOffEventHandle(HLERequestContext& ctx) { | 486 | void IHidSystemServer::AcquireJoyDetachOnBluetoothOffEventHandle(HLERequestContext& ctx) { |
| 265 | LOG_INFO(Service_AM, "called"); | 487 | LOG_INFO(Service_AM, "called"); |
| 266 | 488 | ||
| @@ -279,6 +501,31 @@ void IHidSystemServer::IsUsbFullKeyControllerEnabled(HLERequestContext& ctx) { | |||
| 279 | rb.Push(is_enabled); | 501 | rb.Push(is_enabled); |
| 280 | } | 502 | } |
| 281 | 503 | ||
| 504 | void IHidSystemServer::IsHandheldButtonPressedOnConsoleMode(HLERequestContext& ctx) { | ||
| 505 | const bool button_pressed = false; | ||
| 506 | |||
| 507 | LOG_DEBUG(Service_HID, "(STUBBED) called, is_enabled={}", | ||
| 508 | button_pressed); // Spams a lot when controller applet is open | ||
| 509 | |||
| 510 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 511 | rb.Push(ResultSuccess); | ||
| 512 | rb.Push(button_pressed); | ||
| 513 | } | ||
| 514 | |||
| 515 | void IHidSystemServer::InitializeFirmwareUpdate(HLERequestContext& ctx) { | ||
| 516 | LOG_WARNING(Service_HID, "(STUBBED) called"); | ||
| 517 | |||
| 518 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 519 | rb.Push(ResultSuccess); | ||
| 520 | } | ||
| 521 | |||
| 522 | void IHidSystemServer::InitializeUsbFirmwareUpdateWithoutMemory(HLERequestContext& ctx) { | ||
| 523 | LOG_WARNING(Service_HID, "(STUBBED) called"); | ||
| 524 | |||
| 525 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 526 | rb.Push(ResultSuccess); | ||
| 527 | } | ||
| 528 | |||
| 282 | void IHidSystemServer::GetTouchScreenDefaultConfiguration(HLERequestContext& ctx) { | 529 | void IHidSystemServer::GetTouchScreenDefaultConfiguration(HLERequestContext& ctx) { |
| 283 | LOG_WARNING(Service_HID, "(STUBBED) called"); | 530 | LOG_WARNING(Service_HID, "(STUBBED) called"); |
| 284 | 531 | ||
diff --git a/src/core/hle/service/hid/hid_system_server.h b/src/core/hle/service/hid/hid_system_server.h index d4b3910fa..822d5e5b9 100644 --- a/src/core/hle/service/hid/hid_system_server.h +++ b/src/core/hle/service/hid/hid_system_server.h | |||
| @@ -24,15 +24,38 @@ public: | |||
| 24 | 24 | ||
| 25 | private: | 25 | private: |
| 26 | void ApplyNpadSystemCommonPolicy(HLERequestContext& ctx); | 26 | void ApplyNpadSystemCommonPolicy(HLERequestContext& ctx); |
| 27 | void EnableAssigningSingleOnSlSrPress(HLERequestContext& ctx); | ||
| 28 | void DisableAssigningSingleOnSlSrPress(HLERequestContext& ctx); | ||
| 27 | void GetLastActiveNpad(HLERequestContext& ctx); | 29 | void GetLastActiveNpad(HLERequestContext& ctx); |
| 30 | void ApplyNpadSystemCommonPolicyFull(HLERequestContext& ctx); | ||
| 31 | void GetNpadFullKeyGripColor(HLERequestContext& ctx); | ||
| 32 | void GetMaskedSupportedNpadStyleSet(HLERequestContext& ctx); | ||
| 33 | void SetSupportedNpadStyleSetAll(HLERequestContext& ctx); | ||
| 34 | void GetAppletDetailedUiType(HLERequestContext& ctx); | ||
| 35 | void GetNpadInterfaceType(HLERequestContext& ctx); | ||
| 36 | void GetNpadLeftRightInterfaceType(HLERequestContext& ctx); | ||
| 37 | void HasBattery(HLERequestContext& ctx); | ||
| 38 | void HasLeftRightBattery(HLERequestContext& ctx); | ||
| 28 | void GetUniquePadsFromNpad(HLERequestContext& ctx); | 39 | void GetUniquePadsFromNpad(HLERequestContext& ctx); |
| 40 | void GetIrSensorState(HLERequestContext& ctx); | ||
| 41 | void AcquireConnectionTriggerTimeoutEvent(HLERequestContext& ctx); | ||
| 42 | void AcquireDeviceRegisteredEventForControllerSupport(HLERequestContext& ctx); | ||
| 43 | void GetRegisteredDevices(HLERequestContext& ctx); | ||
| 44 | void AcquireUniquePadConnectionEventHandle(HLERequestContext& ctx); | ||
| 45 | void GetUniquePadIds(HLERequestContext& ctx); | ||
| 29 | void AcquireJoyDetachOnBluetoothOffEventHandle(HLERequestContext& ctx); | 46 | void AcquireJoyDetachOnBluetoothOffEventHandle(HLERequestContext& ctx); |
| 30 | void IsUsbFullKeyControllerEnabled(HLERequestContext& ctx); | 47 | void IsUsbFullKeyControllerEnabled(HLERequestContext& ctx); |
| 48 | void IsHandheldButtonPressedOnConsoleMode(HLERequestContext& ctx); | ||
| 49 | void InitializeFirmwareUpdate(HLERequestContext& ctx); | ||
| 50 | void InitializeUsbFirmwareUpdateWithoutMemory(HLERequestContext& ctx); | ||
| 31 | void GetTouchScreenDefaultConfiguration(HLERequestContext& ctx); | 51 | void GetTouchScreenDefaultConfiguration(HLERequestContext& ctx); |
| 32 | 52 | ||
| 33 | std::shared_ptr<ResourceManager> GetResourceManager(); | 53 | std::shared_ptr<ResourceManager> GetResourceManager(); |
| 34 | 54 | ||
| 55 | Kernel::KEvent* acquire_connection_trigger_timeout_event; | ||
| 56 | Kernel::KEvent* acquire_device_registered_event; | ||
| 35 | Kernel::KEvent* joy_detach_event; | 57 | Kernel::KEvent* joy_detach_event; |
| 58 | Kernel::KEvent* unique_pad_connection_event; | ||
| 36 | KernelHelpers::ServiceContext service_context; | 59 | KernelHelpers::ServiceContext service_context; |
| 37 | std::shared_ptr<ResourceManager> resource_manager; | 60 | std::shared_ptr<ResourceManager> resource_manager; |
| 38 | }; | 61 | }; |
diff --git a/src/core/hle/service/ldn/ldn.cpp b/src/core/hle/service/ldn/ldn.cpp index 7927f8264..961f89a14 100644 --- a/src/core/hle/service/ldn/ldn.cpp +++ b/src/core/hle/service/ldn/ldn.cpp | |||
| @@ -115,12 +115,20 @@ public: | |||
| 115 | {400, nullptr, "InitializeSystem"}, | 115 | {400, nullptr, "InitializeSystem"}, |
| 116 | {401, nullptr, "FinalizeSystem"}, | 116 | {401, nullptr, "FinalizeSystem"}, |
| 117 | {402, nullptr, "SetOperationMode"}, | 117 | {402, nullptr, "SetOperationMode"}, |
| 118 | {403, nullptr, "InitializeSystem2"}, | 118 | {403, &ISystemLocalCommunicationService::InitializeSystem2, "InitializeSystem2"}, |
| 119 | }; | 119 | }; |
| 120 | // clang-format on | 120 | // clang-format on |
| 121 | 121 | ||
| 122 | RegisterHandlers(functions); | 122 | RegisterHandlers(functions); |
| 123 | } | 123 | } |
| 124 | |||
| 125 | private: | ||
| 126 | void InitializeSystem2(HLERequestContext& ctx) { | ||
| 127 | LOG_WARNING(Service_LDN, "(STUBBED) called"); | ||
| 128 | |||
| 129 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 130 | rb.Push(ResultSuccess); | ||
| 131 | } | ||
| 124 | }; | 132 | }; |
| 125 | 133 | ||
| 126 | class IUserLocalCommunicationService final | 134 | class IUserLocalCommunicationService final |
diff --git a/src/core/hle/service/set/set_sys.cpp b/src/core/hle/service/set/set_sys.cpp index ec3af80af..19c667b42 100644 --- a/src/core/hle/service/set/set_sys.cpp +++ b/src/core/hle/service/set/set_sys.cpp | |||
| @@ -431,8 +431,7 @@ void SET_SYS::GetAutoUpdateEnableFlag(HLERequestContext& ctx) { | |||
| 431 | void SET_SYS::GetBatteryPercentageFlag(HLERequestContext& ctx) { | 431 | void SET_SYS::GetBatteryPercentageFlag(HLERequestContext& ctx) { |
| 432 | u8 battery_percentage_flag{1}; | 432 | u8 battery_percentage_flag{1}; |
| 433 | 433 | ||
| 434 | LOG_WARNING(Service_SET, "(STUBBED) called, battery_percentage_flag={}", | 434 | LOG_DEBUG(Service_SET, "(STUBBED) called, battery_percentage_flag={}", battery_percentage_flag); |
| 435 | battery_percentage_flag); | ||
| 436 | 435 | ||
| 437 | IPC::ResponseBuilder rb{ctx, 3}; | 436 | IPC::ResponseBuilder rb{ctx, 3}; |
| 438 | rb.Push(ResultSuccess); | 437 | rb.Push(ResultSuccess); |
| @@ -492,6 +491,29 @@ void SET_SYS::GetChineseTraditionalInputMethod(HLERequestContext& ctx) { | |||
| 492 | rb.PushEnum(ChineseTraditionalInputMethod::Unknown0); | 491 | rb.PushEnum(ChineseTraditionalInputMethod::Unknown0); |
| 493 | } | 492 | } |
| 494 | 493 | ||
| 494 | void SET_SYS::GetHomeMenuScheme(HLERequestContext& ctx) { | ||
| 495 | LOG_DEBUG(Service_SET, "(STUBBED) called"); | ||
| 496 | |||
| 497 | const HomeMenuScheme default_color = { | ||
| 498 | .main = 0xFF323232, | ||
| 499 | .back = 0xFF323232, | ||
| 500 | .sub = 0xFFFFFFFF, | ||
| 501 | .bezel = 0xFFFFFFFF, | ||
| 502 | .extra = 0xFF000000, | ||
| 503 | }; | ||
| 504 | |||
| 505 | IPC::ResponseBuilder rb{ctx, 7}; | ||
| 506 | rb.Push(ResultSuccess); | ||
| 507 | rb.PushRaw(default_color); | ||
| 508 | } | ||
| 509 | |||
| 510 | void SET_SYS::GetHomeMenuSchemeModel(HLERequestContext& ctx) { | ||
| 511 | LOG_WARNING(Service_SET, "(STUBBED) called"); | ||
| 512 | |||
| 513 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 514 | rb.Push(ResultSuccess); | ||
| 515 | rb.Push(0); | ||
| 516 | } | ||
| 495 | void SET_SYS::GetFieldTestingFlag(HLERequestContext& ctx) { | 517 | void SET_SYS::GetFieldTestingFlag(HLERequestContext& ctx) { |
| 496 | LOG_WARNING(Service_SET, "(STUBBED) called"); | 518 | LOG_WARNING(Service_SET, "(STUBBED) called"); |
| 497 | 519 | ||
| @@ -674,7 +696,7 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { | |||
| 674 | {171, nullptr, "SetChineseTraditionalInputMethod"}, | 696 | {171, nullptr, "SetChineseTraditionalInputMethod"}, |
| 675 | {172, nullptr, "GetPtmCycleCountReliability"}, | 697 | {172, nullptr, "GetPtmCycleCountReliability"}, |
| 676 | {173, nullptr, "SetPtmCycleCountReliability"}, | 698 | {173, nullptr, "SetPtmCycleCountReliability"}, |
| 677 | {174, nullptr, "GetHomeMenuScheme"}, | 699 | {174, &SET_SYS::GetHomeMenuScheme, "GetHomeMenuScheme"}, |
| 678 | {175, nullptr, "GetThemeSettings"}, | 700 | {175, nullptr, "GetThemeSettings"}, |
| 679 | {176, nullptr, "SetThemeSettings"}, | 701 | {176, nullptr, "SetThemeSettings"}, |
| 680 | {177, nullptr, "GetThemeKey"}, | 702 | {177, nullptr, "GetThemeKey"}, |
| @@ -685,7 +707,7 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { | |||
| 685 | {182, nullptr, "SetT"}, | 707 | {182, nullptr, "SetT"}, |
| 686 | {183, nullptr, "GetPlatformRegion"}, | 708 | {183, nullptr, "GetPlatformRegion"}, |
| 687 | {184, nullptr, "SetPlatformRegion"}, | 709 | {184, nullptr, "SetPlatformRegion"}, |
| 688 | {185, nullptr, "GetHomeMenuSchemeModel"}, | 710 | {185, &SET_SYS::GetHomeMenuSchemeModel, "GetHomeMenuSchemeModel"}, |
| 689 | {186, nullptr, "GetMemoryUsageRateFlag"}, | 711 | {186, nullptr, "GetMemoryUsageRateFlag"}, |
| 690 | {187, nullptr, "GetTouchScreenMode"}, | 712 | {187, nullptr, "GetTouchScreenMode"}, |
| 691 | {188, nullptr, "SetTouchScreenMode"}, | 713 | {188, nullptr, "SetTouchScreenMode"}, |
diff --git a/src/core/hle/service/set/set_sys.h b/src/core/hle/service/set/set_sys.h index c7dba2a9e..93023c6dd 100644 --- a/src/core/hle/service/set/set_sys.h +++ b/src/core/hle/service/set/set_sys.h | |||
| @@ -269,6 +269,16 @@ private: | |||
| 269 | }; | 269 | }; |
| 270 | static_assert(sizeof(EulaVersion) == 0x30, "EulaVersion is incorrect size"); | 270 | static_assert(sizeof(EulaVersion) == 0x30, "EulaVersion is incorrect size"); |
| 271 | 271 | ||
| 272 | /// This is nn::settings::system::HomeMenuScheme | ||
| 273 | struct HomeMenuScheme { | ||
| 274 | u32 main; | ||
| 275 | u32 back; | ||
| 276 | u32 sub; | ||
| 277 | u32 bezel; | ||
| 278 | u32 extra; | ||
| 279 | }; | ||
| 280 | static_assert(sizeof(HomeMenuScheme) == 0x14, "HomeMenuScheme is incorrect size"); | ||
| 281 | |||
| 272 | void SetLanguageCode(HLERequestContext& ctx); | 282 | void SetLanguageCode(HLERequestContext& ctx); |
| 273 | void GetFirmwareVersion(HLERequestContext& ctx); | 283 | void GetFirmwareVersion(HLERequestContext& ctx); |
| 274 | void GetFirmwareVersion2(HLERequestContext& ctx); | 284 | void GetFirmwareVersion2(HLERequestContext& ctx); |
| @@ -305,6 +315,8 @@ private: | |||
| 305 | void GetKeyboardLayout(HLERequestContext& ctx); | 315 | void GetKeyboardLayout(HLERequestContext& ctx); |
| 306 | void GetChineseTraditionalInputMethod(HLERequestContext& ctx); | 316 | void GetChineseTraditionalInputMethod(HLERequestContext& ctx); |
| 307 | void GetFieldTestingFlag(HLERequestContext& ctx); | 317 | void GetFieldTestingFlag(HLERequestContext& ctx); |
| 318 | void GetHomeMenuScheme(HLERequestContext& ctx); | ||
| 319 | void GetHomeMenuSchemeModel(HLERequestContext& ctx); | ||
| 308 | 320 | ||
| 309 | AccountSettings account_settings{ | 321 | AccountSettings account_settings{ |
| 310 | .flags = {}, | 322 | .flags = {}, |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index f6b548fd3..f22db233b 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -1575,6 +1575,7 @@ void GMainWindow::ConnectMenuEvents() { | |||
| 1575 | connect_menu(ui->action_Load_Cabinet_Formatter, | 1575 | connect_menu(ui->action_Load_Cabinet_Formatter, |
| 1576 | [this]() { OnCabinet(Service::NFP::CabinetMode::StartFormatter); }); | 1576 | [this]() { OnCabinet(Service::NFP::CabinetMode::StartFormatter); }); |
| 1577 | connect_menu(ui->action_Load_Mii_Edit, &GMainWindow::OnMiiEdit); | 1577 | connect_menu(ui->action_Load_Mii_Edit, &GMainWindow::OnMiiEdit); |
| 1578 | connect_menu(ui->action_Open_Controller_Menu, &GMainWindow::OnOpenControllerMenu); | ||
| 1578 | connect_menu(ui->action_Capture_Screenshot, &GMainWindow::OnCaptureScreenshot); | 1579 | connect_menu(ui->action_Capture_Screenshot, &GMainWindow::OnCaptureScreenshot); |
| 1579 | 1580 | ||
| 1580 | // TAS | 1581 | // TAS |
| @@ -1602,14 +1603,13 @@ void GMainWindow::UpdateMenuState() { | |||
| 1602 | ui->action_Pause, | 1603 | ui->action_Pause, |
| 1603 | }; | 1604 | }; |
| 1604 | 1605 | ||
| 1605 | const std::array applet_actions{ | 1606 | const std::array applet_actions{ui->action_Load_Album, |
| 1606 | ui->action_Load_Album, | 1607 | ui->action_Load_Cabinet_Nickname_Owner, |
| 1607 | ui->action_Load_Cabinet_Nickname_Owner, | 1608 | ui->action_Load_Cabinet_Eraser, |
| 1608 | ui->action_Load_Cabinet_Eraser, | 1609 | ui->action_Load_Cabinet_Restorer, |
| 1609 | ui->action_Load_Cabinet_Restorer, | 1610 | ui->action_Load_Cabinet_Formatter, |
| 1610 | ui->action_Load_Cabinet_Formatter, | 1611 | ui->action_Load_Mii_Edit, |
| 1611 | ui->action_Load_Mii_Edit, | 1612 | ui->action_Open_Controller_Menu}; |
| 1612 | }; | ||
| 1613 | 1613 | ||
| 1614 | for (QAction* action : running_actions) { | 1614 | for (QAction* action : running_actions) { |
| 1615 | action->setEnabled(emulation_running); | 1615 | action->setEnabled(emulation_running); |
| @@ -4375,6 +4375,31 @@ void GMainWindow::OnMiiEdit() { | |||
| 4375 | BootGame(filename, MiiEditId); | 4375 | BootGame(filename, MiiEditId); |
| 4376 | } | 4376 | } |
| 4377 | 4377 | ||
| 4378 | void GMainWindow::OnOpenControllerMenu() { | ||
| 4379 | constexpr u64 ControllerAppletId = | ||
| 4380 | static_cast<u64>(Service::AM::Applets::AppletProgramId::Controller); | ||
| 4381 | auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); | ||
| 4382 | if (!bis_system) { | ||
| 4383 | QMessageBox::warning(this, tr("No firmware available"), | ||
| 4384 | tr("Please install the firmware to use the Controller Menu.")); | ||
| 4385 | return; | ||
| 4386 | } | ||
| 4387 | |||
| 4388 | auto controller_applet_nca = | ||
| 4389 | bis_system->GetEntry(ControllerAppletId, FileSys::ContentRecordType::Program); | ||
| 4390 | if (!controller_applet_nca) { | ||
| 4391 | QMessageBox::warning(this, tr("Controller Applet"), | ||
| 4392 | tr("Controller Menu is not available. Please reinstall firmware.")); | ||
| 4393 | return; | ||
| 4394 | } | ||
| 4395 | |||
| 4396 | system->GetAppletManager().SetCurrentAppletId(Service::AM::Applets::AppletId::Controller); | ||
| 4397 | |||
| 4398 | const auto filename = QString::fromStdString((controller_applet_nca->GetFullPath())); | ||
| 4399 | UISettings::values.roms_path = QFileInfo(filename).path(); | ||
| 4400 | BootGame(filename, ControllerAppletId); | ||
| 4401 | } | ||
| 4402 | |||
| 4378 | void GMainWindow::OnCaptureScreenshot() { | 4403 | void GMainWindow::OnCaptureScreenshot() { |
| 4379 | if (emu_thread == nullptr || !emu_thread->IsRunning()) { | 4404 | if (emu_thread == nullptr || !emu_thread->IsRunning()) { |
| 4380 | return; | 4405 | return; |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index f67c4cfda..49ee1e1d2 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -410,6 +410,7 @@ private slots: | |||
| 410 | void OnAlbum(); | 410 | void OnAlbum(); |
| 411 | void OnCabinet(Service::NFP::CabinetMode mode); | 411 | void OnCabinet(Service::NFP::CabinetMode mode); |
| 412 | void OnMiiEdit(); | 412 | void OnMiiEdit(); |
| 413 | void OnOpenControllerMenu(); | ||
| 413 | void OnCaptureScreenshot(); | 414 | void OnCaptureScreenshot(); |
| 414 | void OnReinitializeKeys(ReinitializeKeyBehavior behavior); | 415 | void OnReinitializeKeys(ReinitializeKeyBehavior behavior); |
| 415 | void OnLanguageChanged(const QString& locale); | 416 | void OnLanguageChanged(const QString& locale); |
diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui index 88684ffb5..e53f9951e 100644 --- a/src/yuzu/main.ui +++ b/src/yuzu/main.ui | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | </property> | 25 | </property> |
| 26 | <widget class="QWidget" name="centralwidget"> | 26 | <widget class="QWidget" name="centralwidget"> |
| 27 | <layout class="QHBoxLayout" name="horizontalLayout"> | 27 | <layout class="QHBoxLayout" name="horizontalLayout"> |
| 28 | <property name="margin"> | 28 | <property name="margin" stdset="0"> |
| 29 | <number>0</number> | 29 | <number>0</number> |
| 30 | </property> | 30 | </property> |
| 31 | </layout> | 31 | </layout> |
| @@ -36,7 +36,7 @@ | |||
| 36 | <x>0</x> | 36 | <x>0</x> |
| 37 | <y>0</y> | 37 | <y>0</y> |
| 38 | <width>1280</width> | 38 | <width>1280</width> |
| 39 | <height>26</height> | 39 | <height>21</height> |
| 40 | </rect> | 40 | </rect> |
| 41 | </property> | 41 | </property> |
| 42 | <widget class="QMenu" name="menu_File"> | 42 | <widget class="QMenu" name="menu_File"> |
| @@ -162,6 +162,7 @@ | |||
| 162 | <addaction name="menu_cabinet_applet"/> | 162 | <addaction name="menu_cabinet_applet"/> |
| 163 | <addaction name="action_Load_Album"/> | 163 | <addaction name="action_Load_Album"/> |
| 164 | <addaction name="action_Load_Mii_Edit"/> | 164 | <addaction name="action_Load_Mii_Edit"/> |
| 165 | <addaction name="action_Open_Controller_Menu"/> | ||
| 165 | <addaction name="separator"/> | 166 | <addaction name="separator"/> |
| 166 | <addaction name="action_Capture_Screenshot"/> | 167 | <addaction name="action_Capture_Screenshot"/> |
| 167 | <addaction name="menuTAS"/> | 168 | <addaction name="menuTAS"/> |
| @@ -382,9 +383,9 @@ | |||
| 382 | </property> | 383 | </property> |
| 383 | </action> | 384 | </action> |
| 384 | <action name="action_Load_Album"> | 385 | <action name="action_Load_Album"> |
| 385 | <property name="text"> | 386 | <property name="text"> |
| 386 | <string>Open &Album</string> | 387 | <string>Open &Album</string> |
| 387 | </property> | 388 | </property> |
| 388 | </action> | 389 | </action> |
| 389 | <action name="action_Load_Cabinet_Nickname_Owner"> | 390 | <action name="action_Load_Cabinet_Nickname_Owner"> |
| 390 | <property name="text"> | 391 | <property name="text"> |
| @@ -407,9 +408,9 @@ | |||
| 407 | </property> | 408 | </property> |
| 408 | </action> | 409 | </action> |
| 409 | <action name="action_Load_Mii_Edit"> | 410 | <action name="action_Load_Mii_Edit"> |
| 410 | <property name="text"> | 411 | <property name="text"> |
| 411 | <string>Open &Mii Editor</string> | 412 | <string>Open &Mii Editor</string> |
| 412 | </property> | 413 | </property> |
| 413 | </action> | 414 | </action> |
| 414 | <action name="action_Configure_Tas"> | 415 | <action name="action_Configure_Tas"> |
| 415 | <property name="text"> | 416 | <property name="text"> |
| @@ -454,6 +455,11 @@ | |||
| 454 | <string>R&ecord</string> | 455 | <string>R&ecord</string> |
| 455 | </property> | 456 | </property> |
| 456 | </action> | 457 | </action> |
| 458 | <action name="action_Open_Controller_Menu"> | ||
| 459 | <property name="text"> | ||
| 460 | <string>Open &Controller Menu</string> | ||
| 461 | </property> | ||
| 462 | </action> | ||
| 457 | </widget> | 463 | </widget> |
| 458 | <resources> | 464 | <resources> |
| 459 | <include location="yuzu.qrc"/> | 465 | <include location="yuzu.qrc"/> |