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