From 3da14c08ba5563799be1a3173f03690f04dff92c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 31 Mar 2022 20:07:00 +0200 Subject: [PATCH] Remove DebugHud --- Core/Console.cpp | 11 ------ Core/Console.h | 1 - Core/DebugHud.cpp | 74 ------------------------------------- Core/DebugHud.h | 27 -------------- Core/Debugger.cpp | 2 - Core/DefaultVideoFilter.cpp | 1 - Core/VideoDecoder.cpp | 2 - Libretro/Makefile.common | 1 - 8 files changed, 119 deletions(-) delete mode 100644 Core/DebugHud.cpp delete mode 100644 Core/DebugHud.h diff --git a/Core/Console.cpp b/Core/Console.cpp index 7f842448..b5619037 100644 --- a/Core/Console.cpp +++ b/Core/Console.cpp @@ -37,12 +37,10 @@ #include "IBattery.h" #include "KeyManager.h" #include "BatteryManager.h" -#include "DebugHud.h" #include "RomLoader.h" #include "CheatManager.h" #include "VideoDecoder.h" #include "VideoRenderer.h" -#include "DebugHud.h" #include "NotificationManager.h" #include "HistoryViewer.h" #include "ConsolePauseHelper.h" @@ -83,7 +81,6 @@ void Console::Init() _saveStateManager.reset(new SaveStateManager(shared_from_this())); _cheatManager.reset(new CheatManager(shared_from_this())); - _debugHud.reset(new DebugHud()); _soundMixer.reset(new SoundMixer(shared_from_this())); _soundMixer->SetNesModel(_model); @@ -107,7 +104,6 @@ void Console::Release(bool forShutdown) _videoDecoder.reset(); _videoRenderer.reset(); - _debugHud.reset(); _saveStateManager.reset(); _cheatManager.reset(); @@ -157,11 +153,6 @@ shared_ptr Console::GetVideoRenderer() return _videoRenderer; } -shared_ptr Console::GetDebugHud() -{ - return _debugHud; -} - void Console::SaveBatteries() { shared_ptr mapper = _mapper; @@ -606,7 +597,6 @@ void Console::ResetComponents(bool softReset) } _soundMixer->StopAudio(true); - _debugHud->ClearScreen(); _memoryManager->Reset(softReset); if(!_settings->CheckFlag(EmulationFlags::DisablePpuReset) || !softReset || IsNsf()) { @@ -1099,7 +1089,6 @@ void Console::LoadState(istream &loadStream, uint32_t stateVersion) debugger->ResetCounters(); } - _debugHud->ClearScreen(); _notificationManager->SendNotification(ConsoleNotificationType::StateLoaded); UpdateNesModel(false); } diff --git a/Core/Console.h b/Core/Console.h index d336396d..7be78977 100644 --- a/Core/Console.h +++ b/Core/Console.h @@ -71,7 +71,6 @@ private: shared_ptr _videoRenderer; shared_ptr _saveStateManager; shared_ptr _cheatManager; - shared_ptr _debugHud; shared_ptr _soundMixer; shared_ptr _notificationManager; shared_ptr _settings; diff --git a/Core/DebugHud.cpp b/Core/DebugHud.cpp deleted file mode 100644 index 14d1d60b..00000000 --- a/Core/DebugHud.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include "stdafx.h" -#include -#include "DebugHud.h" -#include "DrawCommand.h" -#include "DrawLineCommand.h" -#include "DrawPixelCommand.h" -#include "DrawRectangleCommand.h" -#include "DrawStringCommand.h" -#include "DrawScreenBufferCommand.h" - -DebugHud::DebugHud() -{ -} - -DebugHud::~DebugHud() -{ - _commandLock.Acquire(); - _commandLock.Release(); -} - -void DebugHud::ClearScreen() -{ - auto lock = _commandLock.AcquireSafe(); - _commands.clear(); -} - -void DebugHud::Draw(uint32_t* argbBuffer, OverscanDimensions overscan, uint32_t lineWidth, uint32_t frameNumber) -{ - auto lock = _commandLock.AcquireSafe(); - for(unique_ptr &command : _commands) { - command->Draw(argbBuffer, overscan, lineWidth, frameNumber); - } - _commands.erase(std::remove_if(_commands.begin(), _commands.end(), [](const unique_ptr& c) { return c->Expired(); }), _commands.end()); -} - -void DebugHud::DrawPixel(int x, int y, int color, int frameCount, int startFrame) -{ - auto lock = _commandLock.AcquireSafe(); - if(_commands.size() < DebugHud::MaxCommandCount) { - _commands.push_back(unique_ptr(new DrawPixelCommand(x, y, color, frameCount, startFrame))); - } -} - -void DebugHud::DrawLine(int x, int y, int x2, int y2, int color, int frameCount, int startFrame) -{ - auto lock = _commandLock.AcquireSafe(); - if(_commands.size() < DebugHud::MaxCommandCount) { - _commands.push_back(unique_ptr(new DrawLineCommand(x, y, x2, y2, color, frameCount, startFrame))); - } -} - -void DebugHud::DrawRectangle(int x, int y, int width, int height, int color, bool fill, int frameCount, int startFrame) -{ - auto lock = _commandLock.AcquireSafe(); - if(_commands.size() < DebugHud::MaxCommandCount) { - _commands.push_back(unique_ptr(new DrawRectangleCommand(x, y, width, height, color, fill, frameCount, startFrame))); - } -} - -void DebugHud::DrawScreenBuffer(uint32_t* screenBuffer, int startFrame) -{ - auto lock = _commandLock.AcquireSafe(); - if(_commands.size() < DebugHud::MaxCommandCount) { - _commands.push_back(unique_ptr(new DrawScreenBufferCommand(screenBuffer, startFrame))); - } -} - -void DebugHud::DrawString(int x, int y, string text, int color, int backColor, int frameCount, int startFrame) -{ - auto lock = _commandLock.AcquireSafe(); - if(_commands.size() < DebugHud::MaxCommandCount) { - _commands.push_back(unique_ptr(new DrawStringCommand(x, y, text, color, backColor, frameCount, startFrame))); - } -} diff --git a/Core/DebugHud.h b/Core/DebugHud.h deleted file mode 100644 index 1a66815f..00000000 --- a/Core/DebugHud.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once -#include "stdafx.h" -#include "../Utilities/SimpleLock.h" -#include "EmulationSettings.h" - -class DrawCommand; - -class DebugHud -{ -private: - static constexpr size_t MaxCommandCount = 500000; - vector> _commands; - SimpleLock _commandLock; - -public: - DebugHud(); - ~DebugHud(); - - void Draw(uint32_t* argbBuffer, OverscanDimensions overscan, uint32_t width, uint32_t frameNumber); - void ClearScreen(); - - void DrawPixel(int x, int y, int color, int frameCount, int startFrame); - void DrawLine(int x, int y, int x2, int y2, int color, int frameCount, int startFrame); - void DrawRectangle(int x, int y, int width, int height, int color, bool fill, int frameCount, int startFrame); - void DrawScreenBuffer(uint32_t* screenBuffer, int startFrame); - void DrawString(int x, int y, string text, int color, int backColor, int frameCount, int startFrame); -}; diff --git a/Core/Debugger.cpp b/Core/Debugger.cpp index f332718d..b1e873d0 100644 --- a/Core/Debugger.cpp +++ b/Core/Debugger.cpp @@ -26,7 +26,6 @@ #include "Breakpoint.h" #include "CodeDataLogger.h" #include "NotificationManager.h" -#include "DebugHud.h" #include "DummyCpu.h" #include "EventManager.h" @@ -1500,7 +1499,6 @@ void Debugger::RemoveScript(int32_t scriptId) if(script->GetScriptId() == scriptId) { //Send a ScriptEnded event before unloading the script script->ProcessEvent(EventType::ScriptEnded); - _console->GetDebugHud()->ClearScreen(); return true; } return false; diff --git a/Core/DefaultVideoFilter.cpp b/Core/DefaultVideoFilter.cpp index f5e73f03..5e86a341 100644 --- a/Core/DefaultVideoFilter.cpp +++ b/Core/DefaultVideoFilter.cpp @@ -4,7 +4,6 @@ #include #include #include "PPU.h" -#include "DebugHud.h" #include "Console.h" diff --git a/Core/VideoDecoder.cpp b/Core/VideoDecoder.cpp index 0531ba77..0b29291b 100644 --- a/Core/VideoDecoder.cpp +++ b/Core/VideoDecoder.cpp @@ -15,7 +15,6 @@ #include "HdData.h" #include "HdNesPack.h" #include "RotateFilter.h" -#include "DebugHud.h" #include "NotificationManager.h" VideoDecoder::VideoDecoder(shared_ptr console) @@ -104,7 +103,6 @@ void VideoDecoder::DecodeFrame(bool synchronous) uint32_t* outputBuffer = _videoFilter->GetOutputBuffer(); FrameInfo frameInfo = _videoFilter->GetFrameInfo(); - _console->GetDebugHud()->Draw(outputBuffer, _videoFilter->GetOverscan(), frameInfo.Width, _frameNumber); if(_rotateFilter) { outputBuffer = _rotateFilter->ApplyFilter(outputBuffer, frameInfo.Width, frameInfo.Height); diff --git a/Libretro/Makefile.common b/Libretro/Makefile.common index ff61ab8d..3da4d5a9 100644 --- a/Libretro/Makefile.common +++ b/Libretro/Makefile.common @@ -38,7 +38,6 @@ SOURCES_CXX := $(LIBRETRO_DIR)/libretro.cpp \ $(CORE_DIR)/CPU.cpp \ $(CORE_DIR)/CrossFeedFilter.cpp \ $(CORE_DIR)/Debugger.cpp \ - $(CORE_DIR)/DebugHud.cpp \ $(CORE_DIR)/DefaultVideoFilter.cpp \ $(CORE_DIR)/RawVideoFilter.cpp \ $(CORE_DIR)/DeltaModulationChannel.cpp \