diff options
| author | 2016-09-18 09:38:01 +0900 | |
|---|---|---|
| committer | 2016-09-18 09:38:01 +0900 | |
| commit | dc8479928c5aee4c6ad6fe4f59006fb604cee701 (patch) | |
| tree | 569a7f13128450bbab973236615587ff00bced5f /src/core/hle/applets | |
| parent | Travis: Import Dolphin’s clang-format hook. (diff) | |
| download | yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.gz yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.xz yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.zip | |
Sources: Run clang-format on everything.
Diffstat (limited to 'src/core/hle/applets')
| -rw-r--r-- | src/core/hle/applets/applet.cpp | 32 | ||||
| -rw-r--r-- | src/core/hle/applets/applet.h | 9 | ||||
| -rw-r--r-- | src/core/hle/applets/erreula.cpp | 12 | ||||
| -rw-r--r-- | src/core/hle/applets/erreula.h | 11 | ||||
| -rw-r--r-- | src/core/hle/applets/mii_selector.cpp | 16 | ||||
| -rw-r--r-- | src/core/hle/applets/mii_selector.h | 39 | ||||
| -rw-r--r-- | src/core/hle/applets/swkbd.cpp | 20 | ||||
| -rw-r--r-- | src/core/hle/applets/swkbd.h | 13 |
8 files changed, 88 insertions, 64 deletions
diff --git a/src/core/hle/applets/applet.cpp b/src/core/hle/applets/applet.cpp index ccf35fa07..2b4bd939d 100644 --- a/src/core/hle/applets/applet.cpp +++ b/src/core/hle/applets/applet.cpp | |||
| @@ -23,23 +23,24 @@ | |||
| 23 | // Specializes std::hash for AppletId, so that we can use it in std::unordered_map. | 23 | // Specializes std::hash for AppletId, so that we can use it in std::unordered_map. |
| 24 | // Workaround for libstdc++ bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60970 | 24 | // Workaround for libstdc++ bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60970 |
| 25 | namespace std { | 25 | namespace std { |
| 26 | template <> | 26 | template <> |
| 27 | struct hash<Service::APT::AppletId> { | 27 | struct hash<Service::APT::AppletId> { |
| 28 | typedef Service::APT::AppletId argument_type; | 28 | typedef Service::APT::AppletId argument_type; |
| 29 | typedef std::size_t result_type; | 29 | typedef std::size_t result_type; |
| 30 | 30 | ||
| 31 | result_type operator()(const argument_type& id_code) const { | 31 | result_type operator()(const argument_type& id_code) const { |
| 32 | typedef std::underlying_type<argument_type>::type Type; | 32 | typedef std::underlying_type<argument_type>::type Type; |
| 33 | return std::hash<Type>()(static_cast<Type>(id_code)); | 33 | return std::hash<Type>()(static_cast<Type>(id_code)); |
| 34 | } | 34 | } |
| 35 | }; | 35 | }; |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | namespace HLE { | 38 | namespace HLE { |
| 39 | namespace Applets { | 39 | namespace Applets { |
| 40 | 40 | ||
| 41 | static std::unordered_map<Service::APT::AppletId, std::shared_ptr<Applet>> applets; | 41 | static std::unordered_map<Service::APT::AppletId, std::shared_ptr<Applet>> applets; |
| 42 | static u32 applet_update_event = -1; ///< The CoreTiming event identifier for the Applet update callback. | 42 | static u32 applet_update_event = |
| 43 | -1; ///< The CoreTiming event identifier for the Applet update callback. | ||
| 43 | /// The interval at which the Applet update callback will be called, 16.6ms | 44 | /// The interval at which the Applet update callback will be called, 16.6ms |
| 44 | static const u64 applet_update_interval_us = 16666; | 45 | static const u64 applet_update_interval_us = 16666; |
| 45 | 46 | ||
| @@ -60,7 +61,8 @@ ResultCode Applet::Create(Service::APT::AppletId id) { | |||
| 60 | default: | 61 | default: |
| 61 | LOG_ERROR(Service_APT, "Could not create applet %u", id); | 62 | LOG_ERROR(Service_APT, "Could not create applet %u", id); |
| 62 | // TODO(Subv): Find the right error code | 63 | // TODO(Subv): Find the right error code |
| 63 | return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotSupported, ErrorLevel::Permanent); | 64 | return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, |
| 65 | ErrorSummary::NotSupported, ErrorLevel::Permanent); | ||
| 64 | } | 66 | } |
| 65 | 67 | ||
| 66 | return RESULT_SUCCESS; | 68 | return RESULT_SUCCESS; |
| @@ -84,7 +86,7 @@ static void AppletUpdateEvent(u64 applet_id, int cycles_late) { | |||
| 84 | // If the applet is still running after the last update, reschedule the event | 86 | // If the applet is still running after the last update, reschedule the event |
| 85 | if (applet->IsRunning()) { | 87 | if (applet->IsRunning()) { |
| 86 | CoreTiming::ScheduleEvent(usToCycles(applet_update_interval_us) - cycles_late, | 88 | CoreTiming::ScheduleEvent(usToCycles(applet_update_interval_us) - cycles_late, |
| 87 | applet_update_event, applet_id); | 89 | applet_update_event, applet_id); |
| 88 | } else { | 90 | } else { |
| 89 | // Otherwise the applet has terminated, in which case we should clean it up | 91 | // Otherwise the applet has terminated, in which case we should clean it up |
| 90 | applets[id] = nullptr; | 92 | applets[id] = nullptr; |
| @@ -96,7 +98,8 @@ ResultCode Applet::Start(const Service::APT::AppletStartupParameter& parameter) | |||
| 96 | if (result.IsError()) | 98 | if (result.IsError()) |
| 97 | return result; | 99 | return result; |
| 98 | // Schedule the update event | 100 | // Schedule the update event |
| 99 | CoreTiming::ScheduleEvent(usToCycles(applet_update_interval_us), applet_update_event, static_cast<u64>(id)); | 101 | CoreTiming::ScheduleEvent(usToCycles(applet_update_interval_us), applet_update_event, |
| 102 | static_cast<u64>(id)); | ||
| 100 | return result; | 103 | return result; |
| 101 | } | 104 | } |
| 102 | 105 | ||
| @@ -116,6 +119,5 @@ void Init() { | |||
| 116 | void Shutdown() { | 119 | void Shutdown() { |
| 117 | CoreTiming::RemoveEvent(applet_update_event); | 120 | CoreTiming::RemoveEvent(applet_update_event); |
| 118 | } | 121 | } |
| 119 | |||
| 120 | } | 122 | } |
| 121 | } // namespace | 123 | } // namespace |
diff --git a/src/core/hle/applets/applet.h b/src/core/hle/applets/applet.h index 754c6f7db..350a58594 100644 --- a/src/core/hle/applets/applet.h +++ b/src/core/hle/applets/applet.h | |||
| @@ -14,8 +14,10 @@ namespace Applets { | |||
| 14 | 14 | ||
| 15 | class Applet { | 15 | class Applet { |
| 16 | public: | 16 | public: |
| 17 | virtual ~Applet() { } | 17 | virtual ~Applet() { |
| 18 | Applet(Service::APT::AppletId id) : id(id) { } | 18 | } |
| 19 | Applet(Service::APT::AppletId id) : id(id) { | ||
| 20 | } | ||
| 19 | 21 | ||
| 20 | /** | 22 | /** |
| 21 | * Creates an instance of the Applet subclass identified by the parameter. | 23 | * Creates an instance of the Applet subclass identified by the parameter. |
| @@ -64,7 +66,7 @@ protected: | |||
| 64 | */ | 66 | */ |
| 65 | virtual ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) = 0; | 67 | virtual ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) = 0; |
| 66 | 68 | ||
| 67 | Service::APT::AppletId id; ///< Id of this Applet | 69 | Service::APT::AppletId id; ///< Id of this Applet |
| 68 | std::shared_ptr<std::vector<u8>> heap_memory; ///< Heap memory for this Applet | 70 | std::shared_ptr<std::vector<u8>> heap_memory; ///< Heap memory for this Applet |
| 69 | }; | 71 | }; |
| 70 | 72 | ||
| @@ -76,6 +78,5 @@ void Init(); | |||
| 76 | 78 | ||
| 77 | /// Shuts down the HLE applets | 79 | /// Shuts down the HLE applets |
| 78 | void Shutdown(); | 80 | void Shutdown(); |
| 79 | |||
| 80 | } | 81 | } |
| 81 | } // namespace | 82 | } // namespace |
diff --git a/src/core/hle/applets/erreula.cpp b/src/core/hle/applets/erreula.cpp index 92a4b2323..144d6a152 100644 --- a/src/core/hle/applets/erreula.cpp +++ b/src/core/hle/applets/erreula.cpp | |||
| @@ -18,7 +18,8 @@ ResultCode ErrEula::ReceiveParameter(const Service::APT::MessageParameter& param | |||
| 18 | return ResultCode(-1); | 18 | return ResultCode(-1); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | // The LibAppJustStarted message contains a buffer with the size of the framebuffer shared memory. | 21 | // The LibAppJustStarted message contains a buffer with the size of the framebuffer shared |
| 22 | // memory. | ||
| 22 | // Create the SharedMemory that will hold the framebuffer data | 23 | // Create the SharedMemory that will hold the framebuffer data |
| 23 | Service::APT::CaptureBufferInfo capture_info; | 24 | Service::APT::CaptureBufferInfo capture_info; |
| 24 | ASSERT(sizeof(capture_info) == parameter.buffer.size()); | 25 | ASSERT(sizeof(capture_info) == parameter.buffer.size()); |
| @@ -30,9 +31,9 @@ ResultCode ErrEula::ReceiveParameter(const Service::APT::MessageParameter& param | |||
| 30 | // Allocate a heap block of the required size for this applet. | 31 | // Allocate a heap block of the required size for this applet. |
| 31 | heap_memory = std::make_shared<std::vector<u8>>(capture_info.size); | 32 | heap_memory = std::make_shared<std::vector<u8>>(capture_info.size); |
| 32 | // Create a SharedMemory that directly points to this heap block. | 33 | // Create a SharedMemory that directly points to this heap block. |
| 33 | framebuffer_memory = Kernel::SharedMemory::CreateForApplet(heap_memory, 0, heap_memory->size(), | 34 | framebuffer_memory = Kernel::SharedMemory::CreateForApplet( |
| 34 | MemoryPermission::ReadWrite, MemoryPermission::ReadWrite, | 35 | heap_memory, 0, heap_memory->size(), MemoryPermission::ReadWrite, |
| 35 | "ErrEula Memory"); | 36 | MemoryPermission::ReadWrite, "ErrEula Memory"); |
| 36 | 37 | ||
| 37 | // Send the response message with the newly created SharedMemory | 38 | // Send the response message with the newly created SharedMemory |
| 38 | Service::APT::MessageParameter result; | 39 | Service::APT::MessageParameter result; |
| @@ -49,7 +50,8 @@ ResultCode ErrEula::ReceiveParameter(const Service::APT::MessageParameter& param | |||
| 49 | ResultCode ErrEula::StartImpl(const Service::APT::AppletStartupParameter& parameter) { | 50 | ResultCode ErrEula::StartImpl(const Service::APT::AppletStartupParameter& parameter) { |
| 50 | started = true; | 51 | started = true; |
| 51 | 52 | ||
| 52 | // TODO(Subv): Set the expected fields in the response buffer before resending it to the application. | 53 | // TODO(Subv): Set the expected fields in the response buffer before resending it to the |
| 54 | // application. | ||
| 53 | // TODO(Subv): Reverse the parameter format for the ErrEula applet | 55 | // TODO(Subv): Reverse the parameter format for the ErrEula applet |
| 54 | 56 | ||
| 55 | // Let the application know that we're closing | 57 | // Let the application know that we're closing |
diff --git a/src/core/hle/applets/erreula.h b/src/core/hle/applets/erreula.h index 9fe72ae07..dd1d1aee4 100644 --- a/src/core/hle/applets/erreula.h +++ b/src/core/hle/applets/erreula.h | |||
| @@ -12,16 +12,21 @@ namespace Applets { | |||
| 12 | 12 | ||
| 13 | class ErrEula final : public Applet { | 13 | class ErrEula final : public Applet { |
| 14 | public: | 14 | public: |
| 15 | explicit ErrEula(Service::APT::AppletId id): Applet(id) { } | 15 | explicit ErrEula(Service::APT::AppletId id) : Applet(id) { |
| 16 | } | ||
| 16 | 17 | ||
| 17 | ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) override; | 18 | ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) override; |
| 18 | ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) override; | 19 | ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) override; |
| 19 | void Update() override; | 20 | void Update() override; |
| 20 | bool IsRunning() const override { return started; } | 21 | bool IsRunning() const override { |
| 22 | return started; | ||
| 23 | } | ||
| 21 | 24 | ||
| 22 | /// This SharedMemory will be created when we receive the LibAppJustStarted message. | 25 | /// This SharedMemory will be created when we receive the LibAppJustStarted message. |
| 23 | /// It holds the framebuffer info retrieved by the application with GSPGPU::ImportDisplayCaptureInfo | 26 | /// It holds the framebuffer info retrieved by the application with |
| 27 | /// GSPGPU::ImportDisplayCaptureInfo | ||
| 24 | Kernel::SharedPtr<Kernel::SharedMemory> framebuffer_memory; | 28 | Kernel::SharedPtr<Kernel::SharedMemory> framebuffer_memory; |
| 29 | |||
| 25 | private: | 30 | private: |
| 26 | /// Whether this applet is currently running instead of the host application or not. | 31 | /// Whether this applet is currently running instead of the host application or not. |
| 27 | bool started = false; | 32 | bool started = false; |
diff --git a/src/core/hle/applets/mii_selector.cpp b/src/core/hle/applets/mii_selector.cpp index 77f01d208..19e603eda 100644 --- a/src/core/hle/applets/mii_selector.cpp +++ b/src/core/hle/applets/mii_selector.cpp | |||
| @@ -29,7 +29,8 @@ ResultCode MiiSelector::ReceiveParameter(const Service::APT::MessageParameter& p | |||
| 29 | return ResultCode(-1); | 29 | return ResultCode(-1); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | // The LibAppJustStarted message contains a buffer with the size of the framebuffer shared memory. | 32 | // The LibAppJustStarted message contains a buffer with the size of the framebuffer shared |
| 33 | // memory. | ||
| 33 | // Create the SharedMemory that will hold the framebuffer data | 34 | // Create the SharedMemory that will hold the framebuffer data |
| 34 | Service::APT::CaptureBufferInfo capture_info; | 35 | Service::APT::CaptureBufferInfo capture_info; |
| 35 | ASSERT(sizeof(capture_info) == parameter.buffer.size()); | 36 | ASSERT(sizeof(capture_info) == parameter.buffer.size()); |
| @@ -40,9 +41,9 @@ ResultCode MiiSelector::ReceiveParameter(const Service::APT::MessageParameter& p | |||
| 40 | // Allocate a heap block of the required size for this applet. | 41 | // Allocate a heap block of the required size for this applet. |
| 41 | heap_memory = std::make_shared<std::vector<u8>>(capture_info.size); | 42 | heap_memory = std::make_shared<std::vector<u8>>(capture_info.size); |
| 42 | // Create a SharedMemory that directly points to this heap block. | 43 | // Create a SharedMemory that directly points to this heap block. |
| 43 | framebuffer_memory = Kernel::SharedMemory::CreateForApplet(heap_memory, 0, heap_memory->size(), | 44 | framebuffer_memory = Kernel::SharedMemory::CreateForApplet( |
| 44 | MemoryPermission::ReadWrite, MemoryPermission::ReadWrite, | 45 | heap_memory, 0, heap_memory->size(), MemoryPermission::ReadWrite, |
| 45 | "MiiSelector Memory"); | 46 | MemoryPermission::ReadWrite, "MiiSelector Memory"); |
| 46 | 47 | ||
| 47 | // Send the response message with the newly created SharedMemory | 48 | // Send the response message with the newly created SharedMemory |
| 48 | Service::APT::MessageParameter result; | 49 | Service::APT::MessageParameter result; |
| @@ -59,12 +60,14 @@ ResultCode MiiSelector::ReceiveParameter(const Service::APT::MessageParameter& p | |||
| 59 | ResultCode MiiSelector::StartImpl(const Service::APT::AppletStartupParameter& parameter) { | 60 | ResultCode MiiSelector::StartImpl(const Service::APT::AppletStartupParameter& parameter) { |
| 60 | started = true; | 61 | started = true; |
| 61 | 62 | ||
| 62 | // TODO(Subv): Set the expected fields in the response buffer before resending it to the application. | 63 | // TODO(Subv): Set the expected fields in the response buffer before resending it to the |
| 64 | // application. | ||
| 63 | // TODO(Subv): Reverse the parameter format for the Mii Selector | 65 | // TODO(Subv): Reverse the parameter format for the Mii Selector |
| 64 | 66 | ||
| 65 | memcpy(&config, parameter.buffer.data(), parameter.buffer.size()); | 67 | memcpy(&config, parameter.buffer.data(), parameter.buffer.size()); |
| 66 | 68 | ||
| 67 | // TODO(Subv): Find more about this structure, result code 0 is enough to let most games continue. | 69 | // TODO(Subv): Find more about this structure, result code 0 is enough to let most games |
| 70 | // continue. | ||
| 68 | MiiResult result; | 71 | MiiResult result; |
| 69 | memset(&result, 0, sizeof(result)); | 72 | memset(&result, 0, sizeof(result)); |
| 70 | result.result_code = 0; | 73 | result.result_code = 0; |
| @@ -84,6 +87,5 @@ ResultCode MiiSelector::StartImpl(const Service::APT::AppletStartupParameter& pa | |||
| 84 | 87 | ||
| 85 | void MiiSelector::Update() { | 88 | void MiiSelector::Update() { |
| 86 | } | 89 | } |
| 87 | |||
| 88 | } | 90 | } |
| 89 | } // namespace | 91 | } // namespace |
diff --git a/src/core/hle/applets/mii_selector.h b/src/core/hle/applets/mii_selector.h index 24e8e721d..dba4abc8d 100644 --- a/src/core/hle/applets/mii_selector.h +++ b/src/core/hle/applets/mii_selector.h | |||
| @@ -4,8 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "common/common_types.h" | ||
| 8 | #include "common/common_funcs.h" | 7 | #include "common/common_funcs.h" |
| 8 | #include "common/common_types.h" | ||
| 9 | 9 | ||
| 10 | #include "core/hle/applets/applet.h" | 10 | #include "core/hle/applets/applet.h" |
| 11 | #include "core/hle/kernel/kernel.h" | 11 | #include "core/hle/kernel/kernel.h" |
| @@ -17,28 +17,30 @@ namespace HLE { | |||
| 17 | namespace Applets { | 17 | namespace Applets { |
| 18 | 18 | ||
| 19 | struct MiiConfig { | 19 | struct MiiConfig { |
| 20 | u8 unk_000; | 20 | u8 unk_000; |
| 21 | u8 unk_001; | 21 | u8 unk_001; |
| 22 | u8 unk_002; | 22 | u8 unk_002; |
| 23 | u8 unk_003; | 23 | u8 unk_003; |
| 24 | u8 unk_004; | 24 | u8 unk_004; |
| 25 | INSERT_PADDING_BYTES(3); | 25 | INSERT_PADDING_BYTES(3); |
| 26 | u16 unk_008; | 26 | u16 unk_008; |
| 27 | INSERT_PADDING_BYTES(0x82); | 27 | INSERT_PADDING_BYTES(0x82); |
| 28 | u8 unk_08C; | 28 | u8 unk_08C; |
| 29 | INSERT_PADDING_BYTES(3); | 29 | INSERT_PADDING_BYTES(3); |
| 30 | u16 unk_090; | 30 | u16 unk_090; |
| 31 | INSERT_PADDING_BYTES(2); | 31 | INSERT_PADDING_BYTES(2); |
| 32 | u32 unk_094; | 32 | u32 unk_094; |
| 33 | u16 unk_098; | 33 | u16 unk_098; |
| 34 | u8 unk_09A[0x64]; | 34 | u8 unk_09A[0x64]; |
| 35 | u8 unk_0FE; | 35 | u8 unk_0FE; |
| 36 | u8 unk_0FF; | 36 | u8 unk_0FF; |
| 37 | u32 unk_100; | 37 | u32 unk_100; |
| 38 | }; | 38 | }; |
| 39 | 39 | ||
| 40 | static_assert(sizeof(MiiConfig) == 0x104, "MiiConfig structure has incorrect size"); | 40 | static_assert(sizeof(MiiConfig) == 0x104, "MiiConfig structure has incorrect size"); |
| 41 | #define ASSERT_REG_POSITION(field_name, position) static_assert(offsetof(MiiConfig, field_name) == position, "Field "#field_name" has invalid position") | 41 | #define ASSERT_REG_POSITION(field_name, position) \ |
| 42 | static_assert(offsetof(MiiConfig, field_name) == position, \ | ||
| 43 | "Field " #field_name " has invalid position") | ||
| 42 | ASSERT_REG_POSITION(unk_008, 0x08); | 44 | ASSERT_REG_POSITION(unk_008, 0x08); |
| 43 | ASSERT_REG_POSITION(unk_08C, 0x8C); | 45 | ASSERT_REG_POSITION(unk_08C, 0x8C); |
| 44 | ASSERT_REG_POSITION(unk_090, 0x90); | 46 | ASSERT_REG_POSITION(unk_090, 0x90); |
| @@ -55,22 +57,28 @@ struct MiiResult { | |||
| 55 | INSERT_PADDING_BYTES(2); | 57 | INSERT_PADDING_BYTES(2); |
| 56 | }; | 58 | }; |
| 57 | static_assert(sizeof(MiiResult) == 0x84, "MiiResult structure has incorrect size"); | 59 | static_assert(sizeof(MiiResult) == 0x84, "MiiResult structure has incorrect size"); |
| 58 | #define ASSERT_REG_POSITION(field_name, position) static_assert(offsetof(MiiResult, field_name) == position, "Field "#field_name" has invalid position") | 60 | #define ASSERT_REG_POSITION(field_name, position) \ |
| 61 | static_assert(offsetof(MiiResult, field_name) == position, \ | ||
| 62 | "Field " #field_name " has invalid position") | ||
| 59 | ASSERT_REG_POSITION(unk_0C, 0x0C); | 63 | ASSERT_REG_POSITION(unk_0C, 0x0C); |
| 60 | ASSERT_REG_POSITION(unk_6C, 0x6C); | 64 | ASSERT_REG_POSITION(unk_6C, 0x6C); |
| 61 | #undef ASSERT_REG_POSITION | 65 | #undef ASSERT_REG_POSITION |
| 62 | 66 | ||
| 63 | class MiiSelector final : public Applet { | 67 | class MiiSelector final : public Applet { |
| 64 | public: | 68 | public: |
| 65 | MiiSelector(Service::APT::AppletId id) : Applet(id), started(false) { } | 69 | MiiSelector(Service::APT::AppletId id) : Applet(id), started(false) { |
| 70 | } | ||
| 66 | 71 | ||
| 67 | ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) override; | 72 | ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) override; |
| 68 | ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) override; | 73 | ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) override; |
| 69 | void Update() override; | 74 | void Update() override; |
| 70 | bool IsRunning() const override { return started; } | 75 | bool IsRunning() const override { |
| 76 | return started; | ||
| 77 | } | ||
| 71 | 78 | ||
| 72 | /// This SharedMemory will be created when we receive the LibAppJustStarted message. | 79 | /// This SharedMemory will be created when we receive the LibAppJustStarted message. |
| 73 | /// It holds the framebuffer info retrieved by the application with GSPGPU::ImportDisplayCaptureInfo | 80 | /// It holds the framebuffer info retrieved by the application with |
| 81 | /// GSPGPU::ImportDisplayCaptureInfo | ||
| 74 | Kernel::SharedPtr<Kernel::SharedMemory> framebuffer_memory; | 82 | Kernel::SharedPtr<Kernel::SharedMemory> framebuffer_memory; |
| 75 | 83 | ||
| 76 | /// Whether this applet is currently running instead of the host application or not. | 84 | /// Whether this applet is currently running instead of the host application or not. |
| @@ -78,6 +86,5 @@ public: | |||
| 78 | 86 | ||
| 79 | MiiConfig config; | 87 | MiiConfig config; |
| 80 | }; | 88 | }; |
| 81 | |||
| 82 | } | 89 | } |
| 83 | } // namespace | 90 | } // namespace |
diff --git a/src/core/hle/applets/swkbd.cpp b/src/core/hle/applets/swkbd.cpp index d87bf3d57..cf2775968 100644 --- a/src/core/hle/applets/swkbd.cpp +++ b/src/core/hle/applets/swkbd.cpp | |||
| @@ -12,9 +12,9 @@ | |||
| 12 | #include "core/hle/applets/swkbd.h" | 12 | #include "core/hle/applets/swkbd.h" |
| 13 | #include "core/hle/kernel/kernel.h" | 13 | #include "core/hle/kernel/kernel.h" |
| 14 | #include "core/hle/kernel/shared_memory.h" | 14 | #include "core/hle/kernel/shared_memory.h" |
| 15 | #include "core/hle/service/hid/hid.h" | ||
| 16 | #include "core/hle/service/gsp_gpu.h" | ||
| 17 | #include "core/hle/result.h" | 15 | #include "core/hle/result.h" |
| 16 | #include "core/hle/service/gsp_gpu.h" | ||
| 17 | #include "core/hle/service/hid/hid.h" | ||
| 18 | #include "core/memory.h" | 18 | #include "core/memory.h" |
| 19 | 19 | ||
| 20 | #include "video_core/video_core.h" | 20 | #include "video_core/video_core.h" |
| @@ -32,7 +32,8 @@ ResultCode SoftwareKeyboard::ReceiveParameter(Service::APT::MessageParameter con | |||
| 32 | return ResultCode(-1); | 32 | return ResultCode(-1); |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | // The LibAppJustStarted message contains a buffer with the size of the framebuffer shared memory. | 35 | // The LibAppJustStarted message contains a buffer with the size of the framebuffer shared |
| 36 | // memory. | ||
| 36 | // Create the SharedMemory that will hold the framebuffer data | 37 | // Create the SharedMemory that will hold the framebuffer data |
| 37 | Service::APT::CaptureBufferInfo capture_info; | 38 | Service::APT::CaptureBufferInfo capture_info; |
| 38 | ASSERT(sizeof(capture_info) == parameter.buffer.size()); | 39 | ASSERT(sizeof(capture_info) == parameter.buffer.size()); |
| @@ -43,9 +44,9 @@ ResultCode SoftwareKeyboard::ReceiveParameter(Service::APT::MessageParameter con | |||
| 43 | // Allocate a heap block of the required size for this applet. | 44 | // Allocate a heap block of the required size for this applet. |
| 44 | heap_memory = std::make_shared<std::vector<u8>>(capture_info.size); | 45 | heap_memory = std::make_shared<std::vector<u8>>(capture_info.size); |
| 45 | // Create a SharedMemory that directly points to this heap block. | 46 | // Create a SharedMemory that directly points to this heap block. |
| 46 | framebuffer_memory = Kernel::SharedMemory::CreateForApplet(heap_memory, 0, heap_memory->size(), | 47 | framebuffer_memory = Kernel::SharedMemory::CreateForApplet( |
| 47 | MemoryPermission::ReadWrite, MemoryPermission::ReadWrite, | 48 | heap_memory, 0, heap_memory->size(), MemoryPermission::ReadWrite, |
| 48 | "SoftwareKeyboard Memory"); | 49 | MemoryPermission::ReadWrite, "SoftwareKeyboard Memory"); |
| 49 | 50 | ||
| 50 | // Send the response message with the newly created SharedMemory | 51 | // Send the response message with the newly created SharedMemory |
| 51 | Service::APT::MessageParameter result; | 52 | Service::APT::MessageParameter result; |
| @@ -60,10 +61,12 @@ ResultCode SoftwareKeyboard::ReceiveParameter(Service::APT::MessageParameter con | |||
| 60 | } | 61 | } |
| 61 | 62 | ||
| 62 | ResultCode SoftwareKeyboard::StartImpl(Service::APT::AppletStartupParameter const& parameter) { | 63 | ResultCode SoftwareKeyboard::StartImpl(Service::APT::AppletStartupParameter const& parameter) { |
| 63 | ASSERT_MSG(parameter.buffer.size() == sizeof(config), "The size of the parameter (SoftwareKeyboardConfig) is wrong"); | 64 | ASSERT_MSG(parameter.buffer.size() == sizeof(config), |
| 65 | "The size of the parameter (SoftwareKeyboardConfig) is wrong"); | ||
| 64 | 66 | ||
| 65 | memcpy(&config, parameter.buffer.data(), parameter.buffer.size()); | 67 | memcpy(&config, parameter.buffer.data(), parameter.buffer.size()); |
| 66 | text_memory = boost::static_pointer_cast<Kernel::SharedMemory, Kernel::Object>(parameter.object); | 68 | text_memory = |
| 69 | boost::static_pointer_cast<Kernel::SharedMemory, Kernel::Object>(parameter.object); | ||
| 67 | 70 | ||
| 68 | // TODO(Subv): Verify if this is the correct behavior | 71 | // TODO(Subv): Verify if this is the correct behavior |
| 69 | memset(text_memory->GetPointer(), 0, text_memory->size); | 72 | memset(text_memory->GetPointer(), 0, text_memory->size); |
| @@ -115,6 +118,5 @@ void SoftwareKeyboard::Finalize() { | |||
| 115 | 118 | ||
| 116 | started = false; | 119 | started = false; |
| 117 | } | 120 | } |
| 118 | |||
| 119 | } | 121 | } |
| 120 | } // namespace | 122 | } // namespace |
diff --git a/src/core/hle/applets/swkbd.h b/src/core/hle/applets/swkbd.h index cf26a8fb7..f50673912 100644 --- a/src/core/hle/applets/swkbd.h +++ b/src/core/hle/applets/swkbd.h | |||
| @@ -4,8 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "common/common_types.h" | ||
| 8 | #include "common/common_funcs.h" | 7 | #include "common/common_funcs.h" |
| 8 | #include "common/common_types.h" | ||
| 9 | 9 | ||
| 10 | #include "core/hle/applets/applet.h" | 10 | #include "core/hle/applets/applet.h" |
| 11 | #include "core/hle/kernel/kernel.h" | 11 | #include "core/hle/kernel/kernel.h" |
| @@ -53,12 +53,15 @@ static_assert(sizeof(SoftwareKeyboardConfig) == 0x400, "Software Keyboard Config | |||
| 53 | 53 | ||
| 54 | class SoftwareKeyboard final : public Applet { | 54 | class SoftwareKeyboard final : public Applet { |
| 55 | public: | 55 | public: |
| 56 | SoftwareKeyboard(Service::APT::AppletId id) : Applet(id), started(false) { } | 56 | SoftwareKeyboard(Service::APT::AppletId id) : Applet(id), started(false) { |
| 57 | } | ||
| 57 | 58 | ||
| 58 | ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) override; | 59 | ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) override; |
| 59 | ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) override; | 60 | ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) override; |
| 60 | void Update() override; | 61 | void Update() override; |
| 61 | bool IsRunning() const override { return started; } | 62 | bool IsRunning() const override { |
| 63 | return started; | ||
| 64 | } | ||
| 62 | 65 | ||
| 63 | /** | 66 | /** |
| 64 | * Draws a keyboard to the current bottom screen framebuffer. | 67 | * Draws a keyboard to the current bottom screen framebuffer. |
| @@ -72,7 +75,8 @@ public: | |||
| 72 | void Finalize(); | 75 | void Finalize(); |
| 73 | 76 | ||
| 74 | /// This SharedMemory will be created when we receive the LibAppJustStarted message. | 77 | /// This SharedMemory will be created when we receive the LibAppJustStarted message. |
| 75 | /// It holds the framebuffer info retrieved by the application with GSPGPU::ImportDisplayCaptureInfo | 78 | /// It holds the framebuffer info retrieved by the application with |
| 79 | /// GSPGPU::ImportDisplayCaptureInfo | ||
| 76 | Kernel::SharedPtr<Kernel::SharedMemory> framebuffer_memory; | 80 | Kernel::SharedPtr<Kernel::SharedMemory> framebuffer_memory; |
| 77 | 81 | ||
| 78 | /// SharedMemory where the output text will be stored | 82 | /// SharedMemory where the output text will be stored |
| @@ -84,6 +88,5 @@ public: | |||
| 84 | /// Whether this applet is currently running instead of the host application or not. | 88 | /// Whether this applet is currently running instead of the host application or not. |
| 85 | bool started; | 89 | bool started; |
| 86 | }; | 90 | }; |
| 87 | |||
| 88 | } | 91 | } |
| 89 | } // namespace | 92 | } // namespace |