#pragma once #include "Cartridge.hpp" #include "CPU/CPU.hpp" #include "Input.hpp" #include "Platform.hpp" #include "PPU/PPU.hpp" #include struct Color { Color() : r(0), g(0), b(0), a(0) { } Color(uint8_t r, uint8_t g, uint8_t b) : r(r), g(g), b(b), a(255) {} uint8_t r, g, b, a; uint32_t GetValue() { return (r << 24u) | (g << 16u) | (b << 8u) | a; } }; enum class BusSource { CPU, PPU }; class NES { public: NES(); void InsertCartridge(char const* filename); void Run(); void Write(BusSource source, uint16_t address, uint8_t value); uint8_t Read(BusSource source, uint16_t address); std::unique_ptr cpu; std::unique_ptr ppu; std::unique_ptr cartridge; std::unique_ptr platform; std::unique_ptr input; bool nmi{}; Color palette[64]; };