2019-02-12 22:13:09 -05:00
|
|
|
#pragma once
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "../Utilities/VirtualFile.h"
|
|
|
|
#include "../Utilities/SimpleLock.h"
|
|
|
|
|
|
|
|
class Cpu;
|
2019-02-13 13:32:21 -05:00
|
|
|
class Ppu;
|
2019-02-16 11:23:01 -05:00
|
|
|
class Spc;
|
2019-02-15 21:33:13 -05:00
|
|
|
class BaseCartridge;
|
2019-02-12 22:13:09 -05:00
|
|
|
class MemoryManager;
|
2019-02-17 15:37:31 -05:00
|
|
|
class InternalRegisters;
|
2019-02-17 19:54:29 -05:00
|
|
|
class ControlManager;
|
2019-02-19 21:09:12 -05:00
|
|
|
class DmaController;
|
2019-02-12 22:13:09 -05:00
|
|
|
class Debugger;
|
2019-02-13 23:02:43 -05:00
|
|
|
class DebugHud;
|
2019-02-16 11:23:01 -05:00
|
|
|
class SoundMixer;
|
2019-02-13 23:02:43 -05:00
|
|
|
class VideoRenderer;
|
|
|
|
class VideoDecoder;
|
2019-02-15 21:33:13 -05:00
|
|
|
class NotificationManager;
|
2019-02-12 22:13:09 -05:00
|
|
|
enum class MemoryOperationType;
|
|
|
|
|
|
|
|
class Console : public std::enable_shared_from_this<Console>
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
shared_ptr<Cpu> _cpu;
|
2019-02-13 13:32:21 -05:00
|
|
|
shared_ptr<Ppu> _ppu;
|
2019-02-16 11:23:01 -05:00
|
|
|
shared_ptr<Spc> _spc;
|
2019-02-12 22:13:09 -05:00
|
|
|
shared_ptr<MemoryManager> _memoryManager;
|
2019-02-15 21:33:13 -05:00
|
|
|
shared_ptr<BaseCartridge> _cart;
|
2019-02-17 15:37:31 -05:00
|
|
|
shared_ptr<InternalRegisters> _internalRegisters;
|
2019-02-17 19:54:29 -05:00
|
|
|
shared_ptr<ControlManager> _controlManager;
|
2019-02-19 21:09:12 -05:00
|
|
|
shared_ptr<DmaController> _dmaController;
|
2019-02-17 15:37:31 -05:00
|
|
|
|
2019-02-12 22:13:09 -05:00
|
|
|
shared_ptr<Debugger> _debugger;
|
2019-02-13 23:02:43 -05:00
|
|
|
|
2019-02-15 21:33:13 -05:00
|
|
|
shared_ptr<NotificationManager> _notificationManager;
|
2019-02-16 11:23:01 -05:00
|
|
|
shared_ptr<SoundMixer> _soundMixer;
|
2019-02-13 23:02:43 -05:00
|
|
|
shared_ptr<VideoRenderer> _videoRenderer;
|
|
|
|
shared_ptr<VideoDecoder> _videoDecoder;
|
|
|
|
shared_ptr<DebugHud> _debugHud;
|
2019-02-12 22:13:09 -05:00
|
|
|
|
|
|
|
SimpleLock _runLock;
|
2019-02-16 00:47:53 -05:00
|
|
|
SimpleLock _debuggerLock;
|
2019-02-12 22:13:09 -05:00
|
|
|
atomic<bool> _stopFlag;
|
|
|
|
|
|
|
|
public:
|
2019-02-13 23:02:43 -05:00
|
|
|
void Initialize();
|
2019-02-16 01:22:31 -05:00
|
|
|
void Release();
|
2019-02-13 23:02:43 -05:00
|
|
|
|
2019-02-12 22:13:09 -05:00
|
|
|
void Run();
|
|
|
|
void Stop();
|
|
|
|
|
|
|
|
void LoadRom(VirtualFile romFile, VirtualFile patchFile);
|
|
|
|
|
2019-02-16 11:23:01 -05:00
|
|
|
shared_ptr<SoundMixer> GetSoundMixer();
|
2019-02-13 23:02:43 -05:00
|
|
|
shared_ptr<VideoRenderer> GetVideoRenderer();
|
|
|
|
shared_ptr<VideoDecoder> GetVideoDecoder();
|
2019-02-15 21:33:13 -05:00
|
|
|
shared_ptr<NotificationManager> GetNotificationManager();
|
|
|
|
|
2019-02-13 23:02:43 -05:00
|
|
|
shared_ptr<DebugHud> GetDebugHud();
|
|
|
|
|
2019-02-13 18:44:39 -05:00
|
|
|
shared_ptr<Cpu> GetCpu();
|
2019-02-13 13:32:21 -05:00
|
|
|
shared_ptr<Ppu> GetPpu();
|
2019-02-16 11:23:01 -05:00
|
|
|
shared_ptr<Spc> GetSpc();
|
2019-02-15 21:33:13 -05:00
|
|
|
shared_ptr<BaseCartridge> GetCartridge();
|
2019-02-13 23:02:43 -05:00
|
|
|
shared_ptr<MemoryManager> GetMemoryManager();
|
2019-02-17 15:37:31 -05:00
|
|
|
shared_ptr<InternalRegisters> GetInternalRegisters();
|
2019-02-17 19:54:29 -05:00
|
|
|
shared_ptr<ControlManager> GetControlManager();
|
2019-02-19 21:09:12 -05:00
|
|
|
shared_ptr<DmaController> GetDmaController();
|
2019-02-16 00:47:53 -05:00
|
|
|
shared_ptr<Debugger> GetDebugger(bool autoStart = true);
|
2019-02-17 15:02:33 -05:00
|
|
|
|
|
|
|
bool IsRunning();
|
2019-02-12 22:13:09 -05:00
|
|
|
|
|
|
|
void ProcessCpuRead(uint32_t addr, uint8_t value, MemoryOperationType type);
|
|
|
|
void ProcessCpuWrite(uint32_t addr, uint8_t value, MemoryOperationType type);
|
|
|
|
};
|