diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/applets/mii_selector.cpp | 19 | ||||
| -rw-r--r-- | src/core/hle/applets/mii_selector.h | 6 | ||||
| -rw-r--r-- | src/core/hle/applets/swkbd.cpp | 20 | ||||
| -rw-r--r-- | src/core/hle/applets/swkbd.h | 7 | ||||
| -rw-r--r-- | src/core/hle/service/apt/apt.h | 15 |
5 files changed, 44 insertions, 23 deletions
diff --git a/src/core/hle/applets/mii_selector.cpp b/src/core/hle/applets/mii_selector.cpp index 708d2f630..1dd6757f7 100644 --- a/src/core/hle/applets/mii_selector.cpp +++ b/src/core/hle/applets/mii_selector.cpp | |||
| @@ -21,13 +21,6 @@ | |||
| 21 | namespace HLE { | 21 | namespace HLE { |
| 22 | namespace Applets { | 22 | namespace Applets { |
| 23 | 23 | ||
| 24 | MiiSelector::MiiSelector(Service::APT::AppletId id) : Applet(id), started(false) { | ||
| 25 | // Create the SharedMemory that will hold the framebuffer data | ||
| 26 | // TODO(Subv): What size should we use here? | ||
| 27 | using Kernel::MemoryPermission; | ||
| 28 | framebuffer_memory = Kernel::SharedMemory::Create(0x1000, MemoryPermission::ReadWrite, MemoryPermission::ReadWrite, "MiiSelector Memory"); | ||
| 29 | } | ||
| 30 | |||
| 31 | ResultCode MiiSelector::ReceiveParameter(const Service::APT::MessageParameter& parameter) { | 24 | ResultCode MiiSelector::ReceiveParameter(const Service::APT::MessageParameter& parameter) { |
| 32 | if (parameter.signal != static_cast<u32>(Service::APT::SignalType::LibAppJustStarted)) { | 25 | if (parameter.signal != static_cast<u32>(Service::APT::SignalType::LibAppJustStarted)) { |
| 33 | LOG_ERROR(Service_APT, "unsupported signal %u", parameter.signal); | 26 | LOG_ERROR(Service_APT, "unsupported signal %u", parameter.signal); |
| @@ -36,8 +29,18 @@ ResultCode MiiSelector::ReceiveParameter(const Service::APT::MessageParameter& p | |||
| 36 | return ResultCode(-1); | 29 | return ResultCode(-1); |
| 37 | } | 30 | } |
| 38 | 31 | ||
| 32 | // The LibAppJustStarted message contains a buffer with the size of the framebuffer shared memory. | ||
| 33 | // Create the SharedMemory that will hold the framebuffer data | ||
| 34 | Service::APT::CaptureBufferInfo capture_info; | ||
| 35 | ASSERT(sizeof(capture_info) == parameter.buffer_size); | ||
| 36 | |||
| 37 | memcpy(&capture_info, parameter.data, sizeof(capture_info)); | ||
| 38 | using Kernel::MemoryPermission; | ||
| 39 | framebuffer_memory = Kernel::SharedMemory::Create(capture_info.size, MemoryPermission::ReadWrite, | ||
| 40 | MemoryPermission::ReadWrite, "MiiSelector Memory"); | ||
| 41 | |||
| 42 | // Send the response message with the newly created SharedMemory | ||
| 39 | Service::APT::MessageParameter result; | 43 | Service::APT::MessageParameter result; |
| 40 | // The buffer passed in parameter contains the data returned by GSPGPU::ImportDisplayCaptureInfo | ||
| 41 | result.signal = static_cast<u32>(Service::APT::SignalType::LibAppFinished); | 44 | result.signal = static_cast<u32>(Service::APT::SignalType::LibAppFinished); |
| 42 | result.data = nullptr; | 45 | result.data = nullptr; |
| 43 | result.buffer_size = 0; | 46 | result.buffer_size = 0; |
diff --git a/src/core/hle/applets/mii_selector.h b/src/core/hle/applets/mii_selector.h index 6a3e7c8eb..5619f8399 100644 --- a/src/core/hle/applets/mii_selector.h +++ b/src/core/hle/applets/mii_selector.h | |||
| @@ -18,15 +18,15 @@ namespace Applets { | |||
| 18 | 18 | ||
| 19 | class MiiSelector final : public Applet { | 19 | class MiiSelector final : public Applet { |
| 20 | public: | 20 | public: |
| 21 | MiiSelector(Service::APT::AppletId id); | 21 | MiiSelector(Service::APT::AppletId id) : Applet(id), started(false) { } |
| 22 | 22 | ||
| 23 | ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) override; | 23 | ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) override; |
| 24 | ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) override; | 24 | ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) override; |
| 25 | void Update() override; | 25 | void Update() override; |
| 26 | bool IsRunning() const override { return started; } | 26 | bool IsRunning() const override { return started; } |
| 27 | 27 | ||
| 28 | /// TODO(Subv): Find out what this is actually used for. | 28 | /// This SharedMemory will be created when we receive the LibAppJustStarted message. |
| 29 | /// It is believed that the application stores the current screen image here. | 29 | /// It holds the framebuffer info retrieved by the application with GSPGPU::ImportDisplayCaptureInfo |
| 30 | Kernel::SharedPtr<Kernel::SharedMemory> framebuffer_memory; | 30 | Kernel::SharedPtr<Kernel::SharedMemory> framebuffer_memory; |
| 31 | 31 | ||
| 32 | /// Whether this applet is currently running instead of the host application or not. | 32 | /// Whether this applet is currently running instead of the host application or not. |
diff --git a/src/core/hle/applets/swkbd.cpp b/src/core/hle/applets/swkbd.cpp index 1db6b5a17..87238aa1c 100644 --- a/src/core/hle/applets/swkbd.cpp +++ b/src/core/hle/applets/swkbd.cpp | |||
| @@ -24,13 +24,6 @@ | |||
| 24 | namespace HLE { | 24 | namespace HLE { |
| 25 | namespace Applets { | 25 | namespace Applets { |
| 26 | 26 | ||
| 27 | SoftwareKeyboard::SoftwareKeyboard(Service::APT::AppletId id) : Applet(id), started(false) { | ||
| 28 | // Create the SharedMemory that will hold the framebuffer data | ||
| 29 | // TODO(Subv): What size should we use here? | ||
| 30 | using Kernel::MemoryPermission; | ||
| 31 | framebuffer_memory = Kernel::SharedMemory::Create(0x1000, MemoryPermission::ReadWrite, MemoryPermission::ReadWrite, "SoftwareKeyboard Memory"); | ||
| 32 | } | ||
| 33 | |||
| 34 | ResultCode SoftwareKeyboard::ReceiveParameter(Service::APT::MessageParameter const& parameter) { | 27 | ResultCode SoftwareKeyboard::ReceiveParameter(Service::APT::MessageParameter const& parameter) { |
| 35 | if (parameter.signal != static_cast<u32>(Service::APT::SignalType::LibAppJustStarted)) { | 28 | if (parameter.signal != static_cast<u32>(Service::APT::SignalType::LibAppJustStarted)) { |
| 36 | LOG_ERROR(Service_APT, "unsupported signal %u", parameter.signal); | 29 | LOG_ERROR(Service_APT, "unsupported signal %u", parameter.signal); |
| @@ -39,8 +32,19 @@ ResultCode SoftwareKeyboard::ReceiveParameter(Service::APT::MessageParameter con | |||
| 39 | return ResultCode(-1); | 32 | return ResultCode(-1); |
| 40 | } | 33 | } |
| 41 | 34 | ||
| 35 | // The LibAppJustStarted message contains a buffer with the size of the framebuffer shared memory. | ||
| 36 | // Create the SharedMemory that will hold the framebuffer data | ||
| 37 | Service::APT::CaptureBufferInfo capture_info; | ||
| 38 | ASSERT(sizeof(capture_info) == parameter.buffer_size); | ||
| 39 | |||
| 40 | memcpy(&capture_info, parameter.data, sizeof(capture_info)); | ||
| 41 | |||
| 42 | using Kernel::MemoryPermission; | ||
| 43 | framebuffer_memory = Kernel::SharedMemory::Create(capture_info.size, MemoryPermission::ReadWrite, | ||
| 44 | MemoryPermission::ReadWrite, "SoftwareKeyboard Memory"); | ||
| 45 | |||
| 46 | // Send the response message with the newly created SharedMemory | ||
| 42 | Service::APT::MessageParameter result; | 47 | Service::APT::MessageParameter result; |
| 43 | // The buffer passed in parameter contains the data returned by GSPGPU::ImportDisplayCaptureInfo | ||
| 44 | result.signal = static_cast<u32>(Service::APT::SignalType::LibAppFinished); | 48 | result.signal = static_cast<u32>(Service::APT::SignalType::LibAppFinished); |
| 45 | result.data = nullptr; | 49 | result.data = nullptr; |
| 46 | result.buffer_size = 0; | 50 | result.buffer_size = 0; |
diff --git a/src/core/hle/applets/swkbd.h b/src/core/hle/applets/swkbd.h index cb95b8d90..cf26a8fb7 100644 --- a/src/core/hle/applets/swkbd.h +++ b/src/core/hle/applets/swkbd.h | |||
| @@ -53,8 +53,7 @@ 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); | 56 | SoftwareKeyboard(Service::APT::AppletId id) : Applet(id), started(false) { } |
| 57 | ~SoftwareKeyboard() {} | ||
| 58 | 57 | ||
| 59 | ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) override; | 58 | ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) override; |
| 60 | ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) override; | 59 | ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) override; |
| @@ -72,8 +71,8 @@ public: | |||
| 72 | */ | 71 | */ |
| 73 | void Finalize(); | 72 | void Finalize(); |
| 74 | 73 | ||
| 75 | /// TODO(Subv): Find out what this is actually used for. | 74 | /// This SharedMemory will be created when we receive the LibAppJustStarted message. |
| 76 | /// It is believed that the application stores the current screen image here. | 75 | /// It holds the framebuffer info retrieved by the application with GSPGPU::ImportDisplayCaptureInfo |
| 77 | Kernel::SharedPtr<Kernel::SharedMemory> framebuffer_memory; | 76 | Kernel::SharedPtr<Kernel::SharedMemory> framebuffer_memory; |
| 78 | 77 | ||
| 79 | /// SharedMemory where the output text will be stored | 78 | /// SharedMemory where the output text will be stored |
diff --git a/src/core/hle/service/apt/apt.h b/src/core/hle/service/apt/apt.h index 668b4a66f..1a1034fcc 100644 --- a/src/core/hle/service/apt/apt.h +++ b/src/core/hle/service/apt/apt.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | #include "common/swap.h" | ||
| 8 | 9 | ||
| 9 | #include "core/hle/kernel/kernel.h" | 10 | #include "core/hle/kernel/kernel.h" |
| 10 | 11 | ||
| @@ -31,6 +32,20 @@ struct AppletStartupParameter { | |||
| 31 | u8* data = nullptr; | 32 | u8* data = nullptr; |
| 32 | }; | 33 | }; |
| 33 | 34 | ||
| 35 | /// Used by the application to pass information about the current framebuffer to applets. | ||
| 36 | struct CaptureBufferInfo { | ||
| 37 | u32_le size; | ||
| 38 | u8 is_3d; | ||
| 39 | INSERT_PADDING_BYTES(0x3); // Padding for alignment | ||
| 40 | u32_le top_screen_left_offset; | ||
| 41 | u32_le top_screen_right_offset; | ||
| 42 | u32_le top_screen_format; | ||
| 43 | u32_le bottom_screen_left_offset; | ||
| 44 | u32_le bottom_screen_right_offset; | ||
| 45 | u32_le bottom_screen_format; | ||
| 46 | }; | ||
| 47 | static_assert(sizeof(CaptureBufferInfo) == 0x20, "CaptureBufferInfo struct has incorrect size"); | ||
| 48 | |||
| 34 | /// Signals used by APT functions | 49 | /// Signals used by APT functions |
| 35 | enum class SignalType : u32 { | 50 | enum class SignalType : u32 { |
| 36 | None = 0x0, | 51 | None = 0x0, |