diff options
author | bunnei <bunneidev@gmail.com> | 2014-11-24 21:31:53 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2014-11-24 21:31:53 +0100 |
commit | bb730855e58d18d8964d158a55822c40503d548f (patch) | |
tree | 9c3ff113839583d1deca837e9888d81f25d485a0 /src/core/hle/service/gsp_gpu.cpp | |
parent | Merge pull request #191 from archshift/deletexyz (diff) | |
parent | Use pointers instead of passing handles around in some functions. (diff) | |
download | yuzu-bb730855e58d18d8964d158a55822c40503d548f.tar yuzu-bb730855e58d18d8964d158a55822c40503d548f.tar.gz yuzu-bb730855e58d18d8964d158a55822c40503d548f.tar.bz2 yuzu-bb730855e58d18d8964d158a55822c40503d548f.tar.lz yuzu-bb730855e58d18d8964d158a55822c40503d548f.tar.xz yuzu-bb730855e58d18d8964d158a55822c40503d548f.tar.zst yuzu-bb730855e58d18d8964d158a55822c40503d548f.zip |
Diffstat (limited to 'src/core/hle/service/gsp_gpu.cpp')
-rw-r--r-- | src/core/hle/service/gsp_gpu.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp index 66daded94..de1bd3f61 100644 --- a/src/core/hle/service/gsp_gpu.cpp +++ b/src/core/hle/service/gsp_gpu.cpp @@ -28,28 +28,23 @@ u32 g_thread_id = 1; ///< Thread index into interrupt relay queue, 1 /// Gets a pointer to a thread command buffer in GSP shared memory static inline u8* GetCommandBuffer(u32 thread_id) { - if (0 == g_shared_memory) - return nullptr; - - return Kernel::GetSharedMemoryPointer(g_shared_memory, - 0x800 + (thread_id * sizeof(CommandBuffer))); + ResultVal<u8*> ptr = Kernel::GetSharedMemoryPointer(g_shared_memory, 0x800 + (thread_id * sizeof(CommandBuffer))); + return ptr.ValueOr(nullptr); } static inline FrameBufferUpdate* GetFrameBufferInfo(u32 thread_id, u32 screen_index) { - if (0 == g_shared_memory) - return nullptr; - _dbg_assert_msg_(GSP, screen_index < 2, "Invalid screen index"); // For each thread there are two FrameBufferUpdate fields u32 offset = 0x200 + (2 * thread_id + screen_index) * sizeof(FrameBufferUpdate); - return (FrameBufferUpdate*)Kernel::GetSharedMemoryPointer(g_shared_memory, offset); + ResultVal<u8*> ptr = Kernel::GetSharedMemoryPointer(g_shared_memory, offset); + return reinterpret_cast<FrameBufferUpdate*>(ptr.ValueOr(nullptr)); } /// Gets a pointer to the interrupt relay queue for a given thread index static inline InterruptRelayQueue* GetInterruptRelayQueue(u32 thread_id) { - return (InterruptRelayQueue*)Kernel::GetSharedMemoryPointer(g_shared_memory, - sizeof(InterruptRelayQueue) * thread_id); + ResultVal<u8*> ptr = Kernel::GetSharedMemoryPointer(g_shared_memory, sizeof(InterruptRelayQueue) * thread_id); + return reinterpret_cast<InterruptRelayQueue*>(ptr.ValueOr(nullptr)); } static void WriteHWRegs(u32 base_address, u32 size_in_bytes, const u32* data) { |