From 38c053e2d8b8141ffdfbb1becf99671cbcd9cb3c Mon Sep 17 00:00:00 2001 From: Riyyi Date: Wed, 17 Aug 2022 22:51:03 +0200 Subject: [PATCH] Emu: Convert Emu class to singleton --- src/emu.h | 34 +++++++++++-------- ...processingunit.cpp => processing-unit.cpp} | 0 src/{processingunit.h => processing-unit.h} | 0 3 files changed, 19 insertions(+), 15 deletions(-) rename src/{processingunit.cpp => processing-unit.cpp} (100%) rename src/{processingunit.h => processing-unit.h} (100%) diff --git a/src/emu.h b/src/emu.h index 5034195..bff6129 100644 --- a/src/emu.h +++ b/src/emu.h @@ -2,25 +2,29 @@ #include #include -#include "processing_unit.h" -class Emu { +#include "processing-unit.h" +#include "ruc/singleton.h" + +class Emu : ruc::Singleton { public: -void WriteRAM(int location, int length); -void WriteVRAM(int location, int length); -void WriteROM(int location, int length); + Emu(s) {} + + void WriteRAM(int location, int length); + void WriteVRAM(int location, int length); + void WriteROM(int location, int length); -void ReadRAM(int location, int length); -void ReadVRAM(int location, int length); -void ReadROM(int location, int length); + void ReadRAM(int location, int length); + void ReadVRAM(int location, int length); + void ReadROM(int location, int length); private: -float m_frequency; -int m_cycle = 0; + float m_frequency; + int m_cycle = 0; -uint8_t m_ram[1024]; -uint8_t m_vram[1024]; -uint8_t m_rom[1024]; + uint8_t m_ram[1024]; + uint8_t m_vram[1024]; + uint8_t m_rom[1024]; -std::vector m_processing_units; -}; \ No newline at end of file + std::vector m_processing_units; +}; diff --git a/src/processingunit.cpp b/src/processing-unit.cpp similarity index 100% rename from src/processingunit.cpp rename to src/processing-unit.cpp diff --git a/src/processingunit.h b/src/processing-unit.h similarity index 100% rename from src/processingunit.h rename to src/processing-unit.h