diff options
| author | 2023-10-31 15:45:11 +0300 | |
|---|---|---|
| committer | 2023-10-31 21:14:37 +0300 | |
| commit | 361dbdddcc001937d4ece558ce3aa8701180d11f (patch) | |
| tree | 31356278ff78aeea10604bb888703703c823cfdf | |
| parent | Merge pull request #11922 from t895/simplify-card-layout (diff) | |
| download | yuzu-361dbdddcc001937d4ece558ce3aa8701180d11f.tar.gz yuzu-361dbdddcc001937d4ece558ce3aa8701180d11f.tar.xz yuzu-361dbdddcc001937d4ece558ce3aa8701180d11f.zip | |
service: am: Add support for LLE Software Keyboard Applet
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 79 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.h | 3 |
2 files changed, 80 insertions, 2 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index ff067c8d9..c80b29928 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include "core/hle/service/am/applets/applet_cabinet.h" | 23 | #include "core/hle/service/am/applets/applet_cabinet.h" |
| 24 | #include "core/hle/service/am/applets/applet_mii_edit_types.h" | 24 | #include "core/hle/service/am/applets/applet_mii_edit_types.h" |
| 25 | #include "core/hle/service/am/applets/applet_profile_select.h" | 25 | #include "core/hle/service/am/applets/applet_profile_select.h" |
| 26 | #include "core/hle/service/am/applets/applet_software_keyboard_types.h" | ||
| 26 | #include "core/hle/service/am/applets/applet_web_browser.h" | 27 | #include "core/hle/service/am/applets/applet_web_browser.h" |
| 27 | #include "core/hle/service/am/applets/applets.h" | 28 | #include "core/hle/service/am/applets/applets.h" |
| 28 | #include "core/hle/service/am/idle.h" | 29 | #include "core/hle/service/am/idle.h" |
| @@ -1562,7 +1563,7 @@ ILibraryAppletSelfAccessor::ILibraryAppletSelfAccessor(Core::System& system_) | |||
| 1562 | {16, nullptr, "GetMainAppletStorageId"}, | 1563 | {16, nullptr, "GetMainAppletStorageId"}, |
| 1563 | {17, nullptr, "GetCallerAppletIdentityInfoStack"}, | 1564 | {17, nullptr, "GetCallerAppletIdentityInfoStack"}, |
| 1564 | {18, nullptr, "GetNextReturnDestinationAppletIdentityInfo"}, | 1565 | {18, nullptr, "GetNextReturnDestinationAppletIdentityInfo"}, |
| 1565 | {19, nullptr, "GetDesirableKeyboardLayout"}, | 1566 | {19, &ILibraryAppletSelfAccessor::GetDesirableKeyboardLayout, "GetDesirableKeyboardLayout"}, |
| 1566 | {20, nullptr, "PopExtraStorage"}, | 1567 | {20, nullptr, "PopExtraStorage"}, |
| 1567 | {25, nullptr, "GetPopExtraStorageEvent"}, | 1568 | {25, nullptr, "GetPopExtraStorageEvent"}, |
| 1568 | {30, nullptr, "UnpopInData"}, | 1569 | {30, nullptr, "UnpopInData"}, |
| @@ -1581,7 +1582,7 @@ ILibraryAppletSelfAccessor::ILibraryAppletSelfAccessor(Core::System& system_) | |||
| 1581 | {120, nullptr, "GetLaunchStorageInfoForDebug"}, | 1582 | {120, nullptr, "GetLaunchStorageInfoForDebug"}, |
| 1582 | {130, nullptr, "GetGpuErrorDetectedSystemEvent"}, | 1583 | {130, nullptr, "GetGpuErrorDetectedSystemEvent"}, |
| 1583 | {140, nullptr, "SetApplicationMemoryReservation"}, | 1584 | {140, nullptr, "SetApplicationMemoryReservation"}, |
| 1584 | {150, nullptr, "ShouldSetGpuTimeSliceManually"}, | 1585 | {150, &ILibraryAppletSelfAccessor::ShouldSetGpuTimeSliceManually, "ShouldSetGpuTimeSliceManually"}, |
| 1585 | }; | 1586 | }; |
| 1586 | // clang-format on | 1587 | // clang-format on |
| 1587 | RegisterHandlers(functions); | 1588 | RegisterHandlers(functions); |
| @@ -1596,6 +1597,9 @@ ILibraryAppletSelfAccessor::ILibraryAppletSelfAccessor(Core::System& system_) | |||
| 1596 | case Applets::AppletId::PhotoViewer: | 1597 | case Applets::AppletId::PhotoViewer: |
| 1597 | PushInShowAlbum(); | 1598 | PushInShowAlbum(); |
| 1598 | break; | 1599 | break; |
| 1600 | case Applets::AppletId::SoftwareKeyboard: | ||
| 1601 | PushInShowSoftwareKeyboard(); | ||
| 1602 | break; | ||
| 1599 | default: | 1603 | default: |
| 1600 | break; | 1604 | break; |
| 1601 | } | 1605 | } |
| @@ -1672,6 +1676,14 @@ void ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfo(HLERequestContext& | |||
| 1672 | rb.PushRaw(applet_info); | 1676 | rb.PushRaw(applet_info); |
| 1673 | } | 1677 | } |
| 1674 | 1678 | ||
| 1679 | void ILibraryAppletSelfAccessor::GetDesirableKeyboardLayout(HLERequestContext& ctx) { | ||
| 1680 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 1681 | |||
| 1682 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 1683 | rb.Push(ResultSuccess); | ||
| 1684 | rb.Push<u32>(0); | ||
| 1685 | } | ||
| 1686 | |||
| 1675 | void ILibraryAppletSelfAccessor::GetMainAppletAvailableUsers(HLERequestContext& ctx) { | 1687 | void ILibraryAppletSelfAccessor::GetMainAppletAvailableUsers(HLERequestContext& ctx) { |
| 1676 | const Service::Account::ProfileManager manager{}; | 1688 | const Service::Account::ProfileManager manager{}; |
| 1677 | bool is_empty{true}; | 1689 | bool is_empty{true}; |
| @@ -1691,6 +1703,14 @@ void ILibraryAppletSelfAccessor::GetMainAppletAvailableUsers(HLERequestContext& | |||
| 1691 | rb.Push(user_count); | 1703 | rb.Push(user_count); |
| 1692 | } | 1704 | } |
| 1693 | 1705 | ||
| 1706 | void ILibraryAppletSelfAccessor::ShouldSetGpuTimeSliceManually(HLERequestContext& ctx) { | ||
| 1707 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 1708 | |||
| 1709 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1710 | rb.Push(ResultSuccess); | ||
| 1711 | rb.Push<u8>(0); | ||
| 1712 | } | ||
| 1713 | |||
| 1694 | void ILibraryAppletSelfAccessor::PushInShowAlbum() { | 1714 | void ILibraryAppletSelfAccessor::PushInShowAlbum() { |
| 1695 | const Applets::CommonArguments arguments{ | 1715 | const Applets::CommonArguments arguments{ |
| 1696 | .arguments_version = Applets::CommonArgumentVersion::Version3, | 1716 | .arguments_version = Applets::CommonArgumentVersion::Version3, |
| @@ -1759,6 +1779,61 @@ void ILibraryAppletSelfAccessor::PushInShowMiiEditData() { | |||
| 1759 | queue_data.emplace_back(std::move(argument_data)); | 1779 | queue_data.emplace_back(std::move(argument_data)); |
| 1760 | } | 1780 | } |
| 1761 | 1781 | ||
| 1782 | void ILibraryAppletSelfAccessor::PushInShowSoftwareKeyboard() { | ||
| 1783 | const Applets::CommonArguments arguments{ | ||
| 1784 | .arguments_version = Applets::CommonArgumentVersion::Version3, | ||
| 1785 | .size = Applets::CommonArgumentSize::Version3, | ||
| 1786 | .library_version = static_cast<u32>(Applets::SwkbdAppletVersion::Version524301), | ||
| 1787 | .theme_color = Applets::ThemeColor::BasicBlack, | ||
| 1788 | .play_startup_sound = true, | ||
| 1789 | .system_tick = system.CoreTiming().GetClockTicks(), | ||
| 1790 | }; | ||
| 1791 | |||
| 1792 | std::vector<char16_t> initial_string(0); | ||
| 1793 | |||
| 1794 | const Applets::SwkbdConfigCommon swkbd_config{ | ||
| 1795 | .type = Applets::SwkbdType::Qwerty, | ||
| 1796 | .ok_text{}, | ||
| 1797 | .left_optional_symbol_key{}, | ||
| 1798 | .right_optional_symbol_key{}, | ||
| 1799 | .use_prediction = false, | ||
| 1800 | .key_disable_flags{}, | ||
| 1801 | .initial_cursor_position = Applets::SwkbdInitialCursorPosition::Start, | ||
| 1802 | .header_text{}, | ||
| 1803 | .sub_text{}, | ||
| 1804 | .guide_text{}, | ||
| 1805 | .max_text_length = 500, | ||
| 1806 | .min_text_length = 0, | ||
| 1807 | .password_mode = Applets::SwkbdPasswordMode::Disabled, | ||
| 1808 | .text_draw_type = Applets::SwkbdTextDrawType::Box, | ||
| 1809 | .enable_return_button = true, | ||
| 1810 | .use_utf8 = false, | ||
| 1811 | .use_blur_background = true, | ||
| 1812 | .initial_string_offset{}, | ||
| 1813 | .initial_string_length = static_cast<u32>(initial_string.size()), | ||
| 1814 | .user_dictionary_offset{}, | ||
| 1815 | .user_dictionary_entries{}, | ||
| 1816 | .use_text_check = false, | ||
| 1817 | }; | ||
| 1818 | |||
| 1819 | Applets::SwkbdConfigNew swkbd_config_new{}; | ||
| 1820 | |||
| 1821 | std::vector<u8> argument_data(sizeof(arguments)); | ||
| 1822 | std::vector<u8> swkbd_data(sizeof(swkbd_config) + sizeof(swkbd_config_new)); | ||
| 1823 | std::vector<u8> work_buffer(swkbd_config.initial_string_length * sizeof(char16_t)); | ||
| 1824 | |||
| 1825 | std::memcpy(argument_data.data(), &arguments, sizeof(arguments)); | ||
| 1826 | std::memcpy(swkbd_data.data(), &swkbd_config, sizeof(swkbd_config)); | ||
| 1827 | std::memcpy(swkbd_data.data() + sizeof(swkbd_config), &swkbd_config_new, | ||
| 1828 | sizeof(Applets::SwkbdConfigNew)); | ||
| 1829 | std::memcpy(work_buffer.data(), initial_string.data(), | ||
| 1830 | swkbd_config.initial_string_length * sizeof(char16_t)); | ||
| 1831 | |||
| 1832 | queue_data.emplace_back(std::move(argument_data)); | ||
| 1833 | queue_data.emplace_back(std::move(swkbd_data)); | ||
| 1834 | queue_data.emplace_back(std::move(work_buffer)); | ||
| 1835 | } | ||
| 1836 | |||
| 1762 | IAppletCommonFunctions::IAppletCommonFunctions(Core::System& system_) | 1837 | IAppletCommonFunctions::IAppletCommonFunctions(Core::System& system_) |
| 1763 | : ServiceFramework{system_, "IAppletCommonFunctions"} { | 1838 | : ServiceFramework{system_, "IAppletCommonFunctions"} { |
| 1764 | // clang-format off | 1839 | // clang-format off |
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index 64b3f3fe2..8f8cb8a9e 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h | |||
| @@ -347,11 +347,14 @@ private: | |||
| 347 | void GetLibraryAppletInfo(HLERequestContext& ctx); | 347 | void GetLibraryAppletInfo(HLERequestContext& ctx); |
| 348 | void ExitProcessAndReturn(HLERequestContext& ctx); | 348 | void ExitProcessAndReturn(HLERequestContext& ctx); |
| 349 | void GetCallerAppletIdentityInfo(HLERequestContext& ctx); | 349 | void GetCallerAppletIdentityInfo(HLERequestContext& ctx); |
| 350 | void GetDesirableKeyboardLayout(HLERequestContext& ctx); | ||
| 350 | void GetMainAppletAvailableUsers(HLERequestContext& ctx); | 351 | void GetMainAppletAvailableUsers(HLERequestContext& ctx); |
| 352 | void ShouldSetGpuTimeSliceManually(HLERequestContext& ctx); | ||
| 351 | 353 | ||
| 352 | void PushInShowAlbum(); | 354 | void PushInShowAlbum(); |
| 353 | void PushInShowCabinetData(); | 355 | void PushInShowCabinetData(); |
| 354 | void PushInShowMiiEditData(); | 356 | void PushInShowMiiEditData(); |
| 357 | void PushInShowSoftwareKeyboard(); | ||
| 355 | 358 | ||
| 356 | std::deque<std::vector<u8>> queue_data; | 359 | std::deque<std::vector<u8>> queue_data; |
| 357 | }; | 360 | }; |