summaryrefslogtreecommitdiffstats
path: root/src/core/memory.cpp
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2016-08-29 07:21:24 +0200
committerGitHub <noreply@github.com>2016-08-29 07:21:24 +0200
commit474586bc53eb6fda40fb0db23ea1d50d32af28b6 (patch)
tree49df9979f3351f3eac26d8a74e25c5181ba35e6c /src/core/memory.cpp
parentMerge pull request #1987 from Lectem/ipcdescriptors (diff)
parentLDR: Implement CRO (diff)
downloadyuzu-474586bc53eb6fda40fb0db23ea1d50d32af28b6.tar
yuzu-474586bc53eb6fda40fb0db23ea1d50d32af28b6.tar.gz
yuzu-474586bc53eb6fda40fb0db23ea1d50d32af28b6.tar.bz2
yuzu-474586bc53eb6fda40fb0db23ea1d50d32af28b6.tar.lz
yuzu-474586bc53eb6fda40fb0db23ea1d50d32af28b6.tar.xz
yuzu-474586bc53eb6fda40fb0db23ea1d50d32af28b6.tar.zst
yuzu-474586bc53eb6fda40fb0db23ea1d50d32af28b6.zip
Diffstat (limited to 'src/core/memory.cpp')
-rw-r--r--src/core/memory.cpp14
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) {
return nullptr;
}
+std::string ReadCString(VAddr vaddr, std::size_t max_length) {
+ std::string string;
+ string.reserve(max_length);
+ for (std::size_t i = 0; i < max_length; ++i) {
+ char c = Read8(vaddr);
+ if (c == '\0')
+ break;
+ string.push_back(c);
+ ++vaddr;
+ }
+ string.shrink_to_fit();
+ return string;
+}
+
u8* GetPhysicalPointer(PAddr address) {
// TODO(Subv): This call should not go through the application's memory mapping.
return GetPointer(PhysicalToVirtualAddress(address));