diff options
| author | 2019-11-26 15:48:19 -0500 | |
|---|---|---|
| committer | 2019-11-26 21:55:38 -0500 | |
| commit | b2165c6b353be5e8117d1f9bc677bb198fa9d8cd (patch) | |
| tree | 1b08113cf73a864c7c3e74cd4a3e1cca53879ce2 /src/core/memory.h | |
| parent | core/memory: Migrate over GetPointer() (diff) | |
| download | yuzu-b2165c6b353be5e8117d1f9bc677bb198fa9d8cd.tar.gz yuzu-b2165c6b353be5e8117d1f9bc677bb198fa9d8cd.tar.xz yuzu-b2165c6b353be5e8117d1f9bc677bb198fa9d8cd.zip | |
core/memory: Migrate over ReadCString() to the Memory class
This only had one usage spot, so this is fairly straightforward to
convert over.
Diffstat (limited to 'src/core/memory.h')
| -rw-r--r-- | src/core/memory.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/core/memory.h b/src/core/memory.h index 59b9ce2bb..47765c8a0 100644 --- a/src/core/memory.h +++ b/src/core/memory.h | |||
| @@ -152,6 +152,23 @@ public: | |||
| 152 | */ | 152 | */ |
| 153 | const u8* GetPointer(VAddr vaddr) const; | 153 | const u8* GetPointer(VAddr vaddr) const; |
| 154 | 154 | ||
| 155 | /** | ||
| 156 | * Reads a null-terminated string from the given virtual address. | ||
| 157 | * This function will continually read characters until either: | ||
| 158 | * | ||
| 159 | * - A null character ('\0') is reached. | ||
| 160 | * - max_length characters have been read. | ||
| 161 | * | ||
| 162 | * @note The final null-terminating character (if found) is not included | ||
| 163 | * in the returned string. | ||
| 164 | * | ||
| 165 | * @param vaddr The address to begin reading the string from. | ||
| 166 | * @param max_length The maximum length of the string to read in characters. | ||
| 167 | * | ||
| 168 | * @returns The read string. | ||
| 169 | */ | ||
| 170 | std::string ReadCString(VAddr vaddr, std::size_t max_length); | ||
| 171 | |||
| 155 | private: | 172 | private: |
| 156 | struct Impl; | 173 | struct Impl; |
| 157 | std::unique_ptr<Impl> impl; | 174 | std::unique_ptr<Impl> impl; |
| @@ -182,8 +199,6 @@ void WriteBlock(VAddr dest_addr, const void* src_buffer, std::size_t size); | |||
| 182 | void ZeroBlock(const Kernel::Process& process, VAddr dest_addr, std::size_t size); | 199 | void ZeroBlock(const Kernel::Process& process, VAddr dest_addr, std::size_t size); |
| 183 | void CopyBlock(VAddr dest_addr, VAddr src_addr, std::size_t size); | 200 | void CopyBlock(VAddr dest_addr, VAddr src_addr, std::size_t size); |
| 184 | 201 | ||
| 185 | std::string ReadCString(VAddr vaddr, std::size_t max_length); | ||
| 186 | |||
| 187 | /** | 202 | /** |
| 188 | * Mark each page touching the region as cached. | 203 | * Mark each page touching the region as cached. |
| 189 | */ | 204 | */ |