diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2023-12-21 00:04:03 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2024-01-19 03:12:30 +0100 |
commit | 2f0418c10134b4c8e5ae47ace623b5db57c0435c (patch) | |
tree | 775c82e0b3b07090b1a3c83859bebe2c0f0e1369 /src/core/device_memory.h | |
parent | Merge pull request #12702 from german77/android-input (diff) | |
download | yuzu-2f0418c10134b4c8e5ae47ace623b5db57c0435c.tar yuzu-2f0418c10134b4c8e5ae47ace623b5db57c0435c.tar.gz yuzu-2f0418c10134b4c8e5ae47ace623b5db57c0435c.tar.bz2 yuzu-2f0418c10134b4c8e5ae47ace623b5db57c0435c.tar.lz yuzu-2f0418c10134b4c8e5ae47ace623b5db57c0435c.tar.xz yuzu-2f0418c10134b4c8e5ae47ace623b5db57c0435c.tar.zst yuzu-2f0418c10134b4c8e5ae47ace623b5db57c0435c.zip |
Diffstat (limited to '')
-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; }; |