diff --git a/Source/Core/VideoCommon/DataReader.h b/Source/Core/VideoCommon/DataReader.h index f7e030739f..b27d513781 100644 --- a/Source/Core/VideoCommon/DataReader.h +++ b/Source/Core/VideoCommon/DataReader.h @@ -15,9 +15,9 @@ public: __forceinline DataReader(u8* src, u8* _end) : buffer(src), end(_end) {} - __forceinline void WritePointer(u8** src) + __forceinline u8* GetPointer() { - *src = buffer; + return buffer; } __forceinline u8* operator=(u8* src) diff --git a/Source/Core/VideoCommon/OpcodeDecoding.cpp b/Source/Core/VideoCommon/OpcodeDecoding.cpp index 34b821605f..0c1083b9c2 100644 --- a/Source/Core/VideoCommon/OpcodeDecoding.cpp +++ b/Source/Core/VideoCommon/OpcodeDecoding.cpp @@ -137,7 +137,7 @@ u8* OpcodeDecoder_Run(DataReader src, u32* cycles, bool in_display_list) u8* opcodeStart; while (true) { - src.WritePointer(&opcodeStart); + opcodeStart = src.GetPointer(); if (!src.size()) goto end; @@ -301,7 +301,7 @@ u8* OpcodeDecoder_Run(DataReader src, u32* cycles, bool in_display_list) if (!is_preprocess && g_bRecordFifoData && cmd_byte != GX_CMD_CALL_DL) { u8* opcodeEnd; - src.WritePointer(&opcodeEnd); + opcodeEnd = src.GetPointer(); FifoRecorder::GetInstance().WriteGPCommand(opcodeStart, u32(opcodeEnd - opcodeStart)); } } diff --git a/Source/Core/VideoCommon/VertexLoader.cpp b/Source/Core/VideoCommon/VertexLoader.cpp index e2a2073ccf..a605c6b2d7 100644 --- a/Source/Core/VideoCommon/VertexLoader.cpp +++ b/Source/Core/VideoCommon/VertexLoader.cpp @@ -453,8 +453,8 @@ void VertexLoader::WriteSetVariable(int bits, void *address, OpArg value) int VertexLoader::RunVertices(int primitive, int count, DataReader src, DataReader dst) { - dst.WritePointer(&g_vertex_manager_write_ptr); - src.WritePointer(&g_video_buffer_read_ptr); + g_vertex_manager_write_ptr = dst.GetPointer(); + g_video_buffer_read_ptr = src.GetPointer(); m_numLoadedVertices += count; m_skippedVertices = 0; diff --git a/Source/Core/VideoCommon/VertexLoaderBase.cpp b/Source/Core/VideoCommon/VertexLoaderBase.cpp index ed56db0655..580fb5bf15 100644 --- a/Source/Core/VideoCommon/VertexLoaderBase.cpp +++ b/Source/Core/VideoCommon/VertexLoaderBase.cpp @@ -159,9 +159,7 @@ public: if (memcmp(buffer_a.data(), buffer_b.data(), std::min(count_a, count_b))) ERROR_LOG(VIDEO, "Both vertexloaders have loaded different data."); - u8* dstptr; - dst.WritePointer(&dstptr); - memcpy(dstptr, buffer_a.data(), count_a); + memcpy(dst.GetPointer(), buffer_a.data(), count_a); return count_a; } std::string GetName() const override { return "CompareLoader"; } diff --git a/Source/Core/VideoCommon/VertexLoader_Normal.cpp b/Source/Core/VideoCommon/VertexLoader_Normal.cpp index 70081ead11..181b61bd6d 100644 --- a/Source/Core/VideoCommon/VertexLoader_Normal.cpp +++ b/Source/Core/VideoCommon/VertexLoader_Normal.cpp @@ -50,7 +50,7 @@ __forceinline void ReadIndirect(const T* data) dst.Write(FracAdjust(Common::FromBigEndian(data[i]))); } - dst.WritePointer(&g_vertex_manager_write_ptr); + g_vertex_manager_write_ptr = dst.GetPointer(); LOG_NORM(); } diff --git a/Source/Core/VideoCommon/VertexLoader_Position.cpp b/Source/Core/VideoCommon/VertexLoader_Position.cpp index 419c041b5b..3313c12b5a 100644 --- a/Source/Core/VideoCommon/VertexLoader_Position.cpp +++ b/Source/Core/VideoCommon/VertexLoader_Position.cpp @@ -81,8 +81,8 @@ void LOADERDECL Pos_ReadDirect(VertexLoader* loader) for (int i = 0; i < 3; ++i) dst.Write(i(), scale) : 0.f); - dst.WritePointer(&g_vertex_manager_write_ptr); - src.WritePointer(&g_video_buffer_read_ptr); + g_vertex_manager_write_ptr = dst.GetPointer(); + g_video_buffer_read_ptr = src.GetPointer(); LOG_VTX(); } @@ -101,7 +101,7 @@ void LOADERDECL Pos_ReadIndex(VertexLoader* loader) for (int i = 0; i < 3; ++i) dst.Write(i(), scale)); - dst.WritePointer(&g_vertex_manager_write_ptr); - src.WritePointer(&g_video_buffer_read_ptr); + g_vertex_manager_write_ptr = dst.GetPointer(); + g_video_buffer_read_ptr = src.GetPointer(); LOG_TEX(); ++loader->m_tcIndex; @@ -77,7 +77,7 @@ void LOADERDECL TexCoord_ReadIndex(VertexLoader* loader) for (int i = 0; i != N; ++i) dst.Write(TCScale(Common::FromBigEndian(data[i]), scale)); - dst.WritePointer(&g_vertex_manager_write_ptr); + g_vertex_manager_write_ptr = dst.GetPointer(); LOG_TEX(); ++loader->m_tcIndex; }