From 3131283734132c3ec394dc7bb728ab477ac5c4ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Mon, 23 Dec 2024 13:38:20 +0100 Subject: [PATCH] Fix tuning velramp graphs not being updated when tuning changed --- src/engine/client/graph.cpp | 3 +++ src/engine/shared/ringbuffer.cpp | 12 +++++++++--- src/engine/shared/ringbuffer.h | 4 ++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/engine/client/graph.cpp b/src/engine/client/graph.cpp index 59ab25e6849..9b98f7c7077 100644 --- a/src/engine/client/graph.cpp +++ b/src/engine/client/graph.cpp @@ -13,6 +13,9 @@ CGraph::CGraph(int MaxEntries) : void CGraph::Init(float Min, float Max) { + m_Entries.Clear(); + m_pFirstScaled = nullptr; + m_RenderedTotalTime = 0; SetMin(Min); SetMax(Max); } diff --git a/src/engine/shared/ringbuffer.cpp b/src/engine/shared/ringbuffer.cpp index c8697942e44..03fb1b0d4e6 100644 --- a/src/engine/shared/ringbuffer.cpp +++ b/src/engine/shared/ringbuffer.cpp @@ -44,8 +44,15 @@ CRingBufferBase::CItem *CRingBufferBase::MergeBack(CItem *pItem) void CRingBufferBase::Init(void *pMemory, int Size, int Flags) { - m_Size = (Size) / sizeof(CItem) * sizeof(CItem); - m_pFirst = (CItem *)pMemory; + m_Size = Size / sizeof(CItem) * sizeof(CItem); + m_pBuffer = static_cast(pMemory); + m_Flags = Flags; + Clear(); +} + +void CRingBufferBase::Clear() +{ + m_pFirst = m_pBuffer; m_pFirst->m_pPrev = nullptr; m_pFirst->m_pNext = nullptr; m_pFirst->m_Free = 1; @@ -53,7 +60,6 @@ void CRingBufferBase::Init(void *pMemory, int Size, int Flags) m_pLast = m_pFirst; m_pProduce = m_pFirst; m_pConsume = m_pFirst; - m_Flags = Flags; } void *CRingBufferBase::Allocate(int Size) diff --git a/src/engine/shared/ringbuffer.h b/src/engine/shared/ringbuffer.h index 11af0fa3205..676e2852af5 100644 --- a/src/engine/shared/ringbuffer.h +++ b/src/engine/shared/ringbuffer.h @@ -18,6 +18,8 @@ class CRingBufferBase int m_Size; }; + CItem *m_pBuffer; + CItem *m_pProduce; CItem *m_pConsume; @@ -52,6 +54,8 @@ class CRingBufferBase FLAG_RECYCLE = 1 }; static constexpr int ITEM_SIZE = sizeof(CItem); + + void Clear(); }; template