From eeb20a9ba89d7a555e38e76445ac3089a7ea6476 Mon Sep 17 00:00:00 2001 From: izzy2lost Date: Mon, 28 Jul 2025 00:08:57 +0000 Subject: [PATCH] Add debug files --- .../src/graphic/Fast3D/debug/GfxDebugger.cpp | 54 +++++++++++++++++++ .../src/graphic/Fast3D/debug/GfxDebugger.h | 33 ++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 libultraship/src/graphic/Fast3D/debug/GfxDebugger.cpp create mode 100644 libultraship/src/graphic/Fast3D/debug/GfxDebugger.h diff --git a/libultraship/src/graphic/Fast3D/debug/GfxDebugger.cpp b/libultraship/src/graphic/Fast3D/debug/GfxDebugger.cpp new file mode 100644 index 00000000..65f966bd --- /dev/null +++ b/libultraship/src/graphic/Fast3D/debug/GfxDebugger.cpp @@ -0,0 +1,54 @@ +#include "GfxDebugger.h" +#include + +namespace Fast { + +void GfxDebugger::ResumeGame() { + mIsDebugging = false; + mIsDebuggingRequested = false; + mDlist = nullptr; +} + +const F3DGfx* GfxDebugger::GetDisplayList() const { + return mDlist; +} + +const std::vector& GfxDebugger::GetBreakPoint() const { + return mBreakPoint; +} + +void GfxDebugger::SetBreakPoint(const std::vector& bp) { + mBreakPoint = bp; +} + +void GfxDebugger::RequestDebugging() { + mIsDebuggingRequested = true; +} +bool GfxDebugger::IsDebugging() const { + return mIsDebugging; +} +bool GfxDebugger::IsDebuggingRequested() const { + return mIsDebuggingRequested; +} + +void GfxDebugger::DebugDisplayList(F3DGfx* cmds) { + mDlist = cmds; + mIsDebuggingRequested = false; + mIsDebugging = true; + mBreakPoint = { cmds }; +} + +bool GfxDebugger::HasBreakPoint(const std::vector& path) const { + if (path.size() != mBreakPoint.size()) + return false; + + for (size_t i = 0; i < path.size(); i++) { + if (path[i] != mBreakPoint[i]) { + return false; + } + } + + return true; +} + +} // namespace Fast diff --git a/libultraship/src/graphic/Fast3D/debug/GfxDebugger.h b/libultraship/src/graphic/Fast3D/debug/GfxDebugger.h new file mode 100644 index 00000000..8be65c16 --- /dev/null +++ b/libultraship/src/graphic/Fast3D/debug/GfxDebugger.h @@ -0,0 +1,33 @@ +#pragma once + +#include + +namespace Fast { +union F3DGfx; + +class GfxDebugger { + public: + void RequestDebugging(); + bool IsDebugging() const; + bool IsDebuggingRequested() const; + + void DebugDisplayList(F3DGfx* cmds); + + void ResumeGame(); + + const F3DGfx* GetDisplayList() const; + + const std::vector& GetBreakPoint() const; + + bool HasBreakPoint(const std::vector& path) const; + + void SetBreakPoint(const std::vector& bp); + + private: + bool mIsDebugging = false; + bool mIsDebuggingRequested = false; + F3DGfx* mDlist = nullptr; + std::vector mBreakPoint = {}; +}; + +} // namespace Fast