Duckstation/src/pse/system.h

69 lines
1.3 KiB
C
Raw Normal View History

2019-09-09 07:01:26 +00:00
#pragma once
#include "types.h"
#include <memory>
2019-09-09 07:01:26 +00:00
2019-09-14 10:28:47 +00:00
class ByteStream;
class StateWrapper;
2019-09-12 14:18:13 +00:00
class HostInterface;
2019-09-12 02:53:04 +00:00
namespace CPU
{
class Core;
}
class Bus;
class DMA;
2019-09-17 06:26:00 +00:00
class InterruptController;
2019-09-12 02:53:04 +00:00
class GPU;
2019-09-17 09:22:39 +00:00
class CDROM;
class Pad;
class PadDevice;
2019-09-20 13:40:19 +00:00
class Timers;
2019-09-12 02:53:04 +00:00
2019-09-09 07:01:26 +00:00
class System
{
public:
2019-09-12 14:18:13 +00:00
System(HostInterface* host_interface);
2019-09-09 07:01:26 +00:00
~System();
2019-09-12 14:18:13 +00:00
HostInterface* GetHostInterface() const { return m_host_interface; }
u32 GetFrameNumber() const { return m_frame_number; }
void IncrementFrameNumber() { m_frame_number++; }
2019-09-09 07:01:26 +00:00
bool Initialize();
void Reset();
2019-09-14 10:28:47 +00:00
bool LoadState(ByteStream* state);
bool SaveState(ByteStream* state);
2019-09-09 07:01:26 +00:00
void RunFrame();
bool LoadEXE(const char* filename);
2019-09-22 15:28:00 +00:00
bool SetExpansionROM(const char* filename);
void SetDowncount(TickCount downcount);
void Synchronize();
2019-09-17 04:25:25 +00:00
void SetPadDevice(u32 slot, std::shared_ptr<PadDevice> dev);
2019-09-20 10:14:00 +00:00
bool HasMedia() const;
bool InsertMedia(const char* path);
void RemoveMedia();
2019-09-09 07:01:26 +00:00
private:
2019-09-14 10:28:47 +00:00
bool DoState(StateWrapper& sw);
2019-09-12 14:18:13 +00:00
HostInterface* m_host_interface;
2019-09-12 02:53:04 +00:00
std::unique_ptr<CPU::Core> m_cpu;
std::unique_ptr<Bus> m_bus;
std::unique_ptr<DMA> m_dma;
2019-09-17 06:26:00 +00:00
std::unique_ptr<InterruptController> m_interrupt_controller;
2019-09-12 02:53:04 +00:00
std::unique_ptr<GPU> m_gpu;
2019-09-17 09:22:39 +00:00
std::unique_ptr<CDROM> m_cdrom;
std::unique_ptr<Pad> m_pad;
2019-09-20 13:40:19 +00:00
std::unique_ptr<Timers> m_timers;
u32 m_frame_number = 1;
2019-09-09 07:01:26 +00:00
};