diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2024-01-22 16:55:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-22 16:55:39 +0100 |
commit | 8bd10473d60503c7acddc399604a51b9c9947541 (patch) | |
tree | f713f84942681321fca27ba028e31d6c74a09013 /src/core/device_memory.h | |
parent | Merge pull request #12747 from t895/homescreen-widget (diff) | |
parent | device_memory_manager: use unique_lock for update (diff) | |
download | yuzu-8bd10473d60503c7acddc399604a51b9c9947541.tar yuzu-8bd10473d60503c7acddc399604a51b9c9947541.tar.gz yuzu-8bd10473d60503c7acddc399604a51b9c9947541.tar.bz2 yuzu-8bd10473d60503c7acddc399604a51b9c9947541.tar.lz yuzu-8bd10473d60503c7acddc399604a51b9c9947541.tar.xz yuzu-8bd10473d60503c7acddc399604a51b9c9947541.tar.zst yuzu-8bd10473d60503c7acddc399604a51b9c9947541.zip |
Diffstat (limited to 'src/core/device_memory.h')
-rw-r--r-- | src/core/device_memory.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/core/device_memory.h b/src/core/device_memory.h index 13388b73e..11bf0e326 100644 --- a/src/core/device_memory.h +++ b/src/core/device_memory.h @@ -32,6 +32,12 @@ public: } template <typename T> + PAddr GetRawPhysicalAddr(const T* ptr) const { + return static_cast<PAddr>(reinterpret_cast<uintptr_t>(ptr) - + reinterpret_cast<uintptr_t>(buffer.BackingBasePointer())); + } + + template <typename T> T* GetPointer(Common::PhysicalAddress addr) { return reinterpret_cast<T*>(buffer.BackingBasePointer() + (GetInteger(addr) - DramMemoryMap::Base)); @@ -43,6 +49,16 @@ public: (GetInteger(addr) - DramMemoryMap::Base)); } + template <typename T> + T* GetPointerFromRaw(PAddr addr) { + return reinterpret_cast<T*>(buffer.BackingBasePointer() + addr); + } + + template <typename T> + const T* GetPointerFromRaw(PAddr addr) const { + return reinterpret_cast<T*>(buffer.BackingBasePointer() + addr); + } + Common::HostMemory buffer; }; |