summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Lioncash2018-11-19 09:00:32 -0500
committerGravatar Lioncash2018-11-19 09:20:29 -0500
commitfb5d4b17de035e3682e64513ae7612f40afd01bd (patch)
treeba3ea9eaad87f32b3844f4de0638df426000fdb9
parentkernel/shared_memory: Use 64-bit types for offset and size in CreateForApplet (diff)
downloadyuzu-fb5d4b17de035e3682e64513ae7612f40afd01bd.tar.gz
yuzu-fb5d4b17de035e3682e64513ae7612f40afd01bd.tar.xz
yuzu-fb5d4b17de035e3682e64513ae7612f40afd01bd.zip
kernel/shared_memory: Add a const qualified member function overload for GetPointer()
Given this doesn't mutate instance state, we can provide a const-qualified variant as well.
-rw-r--r--src/core/hle/kernel/shared_memory.cpp4
-rw-r--r--src/core/hle/kernel/shared_memory.h9
2 files changed, 12 insertions, 1 deletions
diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp
index 68ad39fa1..b8bcc16ee 100644
--- a/src/core/hle/kernel/shared_memory.cpp
+++ b/src/core/hle/kernel/shared_memory.cpp
@@ -136,4 +136,8 @@ u8* SharedMemory::GetPointer(std::size_t offset) {
136 return backing_block->data() + backing_block_offset + offset; 136 return backing_block->data() + backing_block_offset + offset;
137} 137}
138 138
139const u8* SharedMemory::GetPointer(std::size_t offset) const {
140 return backing_block->data() + backing_block_offset + offset;
141}
142
139} // namespace Kernel 143} // namespace Kernel
diff --git a/src/core/hle/kernel/shared_memory.h b/src/core/hle/kernel/shared_memory.h
index 60433f09b..f3b05e48b 100644
--- a/src/core/hle/kernel/shared_memory.h
+++ b/src/core/hle/kernel/shared_memory.h
@@ -113,10 +113,17 @@ public:
113 /** 113 /**
114 * Gets a pointer to the shared memory block 114 * Gets a pointer to the shared memory block
115 * @param offset Offset from the start of the shared memory block to get pointer 115 * @param offset Offset from the start of the shared memory block to get pointer
116 * @return Pointer to the shared memory block from the specified offset 116 * @return A pointer to the shared memory block from the specified offset
117 */ 117 */
118 u8* GetPointer(std::size_t offset = 0); 118 u8* GetPointer(std::size_t offset = 0);
119 119
120 /**
121 * Gets a constant pointer to the shared memory block
122 * @param offset Offset from the start of the shared memory block to get pointer
123 * @return A constant pointer to the shared memory block from the specified offset
124 */
125 const u8* GetPointer(std::size_t offset = 0) const;
126
120private: 127private:
121 explicit SharedMemory(KernelCore& kernel); 128 explicit SharedMemory(KernelCore& kernel);
122 ~SharedMemory() override; 129 ~SharedMemory() override;