summaryrefslogtreecommitdiff
path: root/src/core/hle/applets
diff options
context:
space:
mode:
authorGravatar Subv2016-05-08 17:10:53 -0500
committerGravatar Subv2016-05-12 20:01:59 -0500
commitac2de12ed8a7cc2759e25325f388db92b3f356a6 (patch)
treef679398a60a1d330b6ac38bfffa051631f99d6e7 /src/core/hle/applets
parentKernel: Account for automatically-allocated shared memories in the amount of ... (diff)
downloadyuzu-ac2de12ed8a7cc2759e25325f388db92b3f356a6.tar.gz
yuzu-ac2de12ed8a7cc2759e25325f388db92b3f356a6.tar.xz
yuzu-ac2de12ed8a7cc2759e25325f388db92b3f356a6.zip
HLE/Applets: Give each applet its own block of heap memory, and use that when creating the framebuffer shared memory block.
Diffstat (limited to 'src/core/hle/applets')
-rw-r--r--src/core/hle/applets/applet.h1
-rw-r--r--src/core/hle/applets/mii_selector.cpp9
-rw-r--r--src/core/hle/applets/swkbd.cpp8
3 files changed, 14 insertions, 4 deletions
diff --git a/src/core/hle/applets/applet.h b/src/core/hle/applets/applet.h
index af442f81d..754c6f7db 100644
--- a/src/core/hle/applets/applet.h
+++ b/src/core/hle/applets/applet.h
@@ -65,6 +65,7 @@ protected:
65 virtual ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) = 0; 65 virtual ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) = 0;
66 66
67 Service::APT::AppletId id; ///< Id of this Applet 67 Service::APT::AppletId id; ///< Id of this Applet
68 std::shared_ptr<std::vector<u8>> heap_memory; ///< Heap memory for this Applet
68}; 69};
69 70
70/// Returns whether a library applet is currently running 71/// Returns whether a library applet is currently running
diff --git a/src/core/hle/applets/mii_selector.cpp b/src/core/hle/applets/mii_selector.cpp
index 7f174f3e6..bf39eca22 100644
--- a/src/core/hle/applets/mii_selector.cpp
+++ b/src/core/hle/applets/mii_selector.cpp
@@ -35,9 +35,14 @@ ResultCode MiiSelector::ReceiveParameter(const Service::APT::MessageParameter& p
35 ASSERT(sizeof(capture_info) == parameter.buffer_size); 35 ASSERT(sizeof(capture_info) == parameter.buffer_size);
36 36
37 memcpy(&capture_info, parameter.data, sizeof(capture_info)); 37 memcpy(&capture_info, parameter.data, sizeof(capture_info));
38
38 using Kernel::MemoryPermission; 39 using Kernel::MemoryPermission;
39 framebuffer_memory = Kernel::SharedMemory::Create(nullptr, capture_info.size, MemoryPermission::ReadWrite, 40 // Allocate a heap block of the required size for this applet.
40 MemoryPermission::ReadWrite, 0, Kernel::MemoryRegion::BASE, "MiiSelector Memory"); 41 heap_memory = std::make_shared<std::vector<u8>>(capture_info.size);
42 // Create a SharedMemory that directly points to this heap block.
43 framebuffer_memory = Kernel::SharedMemory::CreateForApplet(heap_memory, 0, heap_memory->size(),
44 MemoryPermission::ReadWrite, MemoryPermission::ReadWrite,
45 "MiiSelector Memory");
41 46
42 // Send the response message with the newly created SharedMemory 47 // Send the response message with the newly created SharedMemory
43 Service::APT::MessageParameter result; 48 Service::APT::MessageParameter result;
diff --git a/src/core/hle/applets/swkbd.cpp b/src/core/hle/applets/swkbd.cpp
index e0c134182..90c6adc65 100644
--- a/src/core/hle/applets/swkbd.cpp
+++ b/src/core/hle/applets/swkbd.cpp
@@ -40,8 +40,12 @@ ResultCode SoftwareKeyboard::ReceiveParameter(Service::APT::MessageParameter con
40 memcpy(&capture_info, parameter.data, sizeof(capture_info)); 40 memcpy(&capture_info, parameter.data, sizeof(capture_info));
41 41
42 using Kernel::MemoryPermission; 42 using Kernel::MemoryPermission;
43 framebuffer_memory = Kernel::SharedMemory::Create(nullptr, capture_info.size, MemoryPermission::ReadWrite, 43 // Allocate a heap block of the required size for this applet.
44 MemoryPermission::ReadWrite, 0, Kernel::MemoryRegion::BASE, "SoftwareKeyboard Memory"); 44 heap_memory = std::make_shared<std::vector<u8>>(capture_info.size);
45 // Create a SharedMemory that directly points to this heap block.
46 framebuffer_memory = Kernel::SharedMemory::CreateForApplet(heap_memory, 0, heap_memory->size(),
47 MemoryPermission::ReadWrite, MemoryPermission::ReadWrite,
48 "SoftwareKeyboard Memory");
45 49
46 // Send the response message with the newly created SharedMemory 50 // Send the response message with the newly created SharedMemory
47 Service::APT::MessageParameter result; 51 Service::APT::MessageParameter result;