diff options
| author | 2016-08-28 22:21:24 -0700 | |
|---|---|---|
| committer | 2016-08-28 22:21:24 -0700 | |
| commit | 474586bc53eb6fda40fb0db23ea1d50d32af28b6 (patch) | |
| tree | 49df9979f3351f3eac26d8a74e25c5181ba35e6c /src/core/memory.cpp | |
| parent | Merge pull request #1987 from Lectem/ipcdescriptors (diff) | |
| parent | LDR: Implement CRO (diff) | |
| download | yuzu-474586bc53eb6fda40fb0db23ea1d50d32af28b6.tar.gz yuzu-474586bc53eb6fda40fb0db23ea1d50d32af28b6.tar.xz yuzu-474586bc53eb6fda40fb0db23ea1d50d32af28b6.zip | |
Merge pull request #1948 from wwylele/cro++
Implemented CRO
Diffstat (limited to 'src/core/memory.cpp')
| -rw-r--r-- | src/core/memory.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 8c9e5d46d..9aa8c4e5a 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp | |||
| @@ -280,6 +280,20 @@ u8* GetPointer(const VAddr vaddr) { | |||
| 280 | return nullptr; | 280 | return nullptr; |
| 281 | } | 281 | } |
| 282 | 282 | ||
| 283 | std::string ReadCString(VAddr vaddr, std::size_t max_length) { | ||
| 284 | std::string string; | ||
| 285 | string.reserve(max_length); | ||
| 286 | for (std::size_t i = 0; i < max_length; ++i) { | ||
| 287 | char c = Read8(vaddr); | ||
| 288 | if (c == '\0') | ||
| 289 | break; | ||
| 290 | string.push_back(c); | ||
| 291 | ++vaddr; | ||
| 292 | } | ||
| 293 | string.shrink_to_fit(); | ||
| 294 | return string; | ||
| 295 | } | ||
| 296 | |||
| 283 | u8* GetPhysicalPointer(PAddr address) { | 297 | u8* GetPhysicalPointer(PAddr address) { |
| 284 | // TODO(Subv): This call should not go through the application's memory mapping. | 298 | // TODO(Subv): This call should not go through the application's memory mapping. |
| 285 | return GetPointer(PhysicalToVirtualAddress(address)); | 299 | return GetPointer(PhysicalToVirtualAddress(address)); |