-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmulator.h
More file actions
executable file
·113 lines (88 loc) · 2.56 KB
/
Emulator.h
File metadata and controls
executable file
·113 lines (88 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#ifndef EMULATOR_H
#define EMULATOR_H
#include "Peripheral.h"
#include "core/types.h"
#include "core/rip/Rip.h"
#include "core/cpu/ProcessorBus.h"
#include "core/cpu/Processor.h"
#include "core/audio/AudioMixer.h"
#include "core/audio/AudioProducer.h"
#include "core/input/InputConsumerBus.h"
#include "core/input/InputConsumer.h"
#include "core/video/VideoBus.h"
#include "core/video/VideoProducer.h"
#include "core/memory/MemoryBus.h"
#include "core/memory/Memory.h"
typedef struct _StateHeader
{
UINT32 emu;
UINT32 state;
UINT32 emuID;
UINT32 version;
UINT32 sys;
UINT32 sysID;
UINT32 cart;
UINT32 cartID;
} StateHeader;
typedef struct _StateChunk
{
UINT32 id;
UINT32 size;
} StateChunk;
#if defined(DEBUG)
#define EMU_STATE_VERSION ('dev\0')
#else
#define EMU_STATE_VERSION (0x02010000)
#endif
class Intellivision;
class Atari5200;
#define MAX_PERIPHERALS 16
#define NUM_EMULATORS 2
/**
*
*/
class Emulator : public Peripheral
{
public:
void AddPeripheral(Peripheral* p);
UINT32 GetPeripheralCount();
Peripheral* GetPeripheral(UINT32);
UINT32 GetVideoWidth();
UINT32 GetVideoHeight();
void UsePeripheral(UINT32, BOOL);
void SetRip(Rip* rip);
void InitVideo(VideoBus* video, UINT32 width, UINT32 height);
void ReleaseVideo();
void InitAudio(AudioMixer* audio, UINT32 sampleRate);
void ReleaseAudio();
void Reset();
void Run();
void FlushAudio();
void Render();
virtual BOOL SaveState(const CHAR* filename) = 0;
virtual BOOL LoadState(const CHAR* filename) = 0;
static UINT32 GetEmulatorCount();
static Emulator* GetEmulator(UINT32 i);
static Emulator* GetEmulatorByID(UINT32 targetSystemID);
protected:
Emulator(const char* name);
MemoryBus memoryBus;
Rip* currentRip;
UINT32 videoWidth;
UINT32 videoHeight;
private:
ProcessorBus processorBus;
AudioMixer *audioMixer;
VideoBus *videoBus;
InputConsumerBus inputConsumerBus;
void InsertPeripheral(Peripheral* p);
void RemovePeripheral(Peripheral* p);
Peripheral* peripherals[MAX_PERIPHERALS];
BOOL usePeripheralIndicators[MAX_PERIPHERALS];
INT32 peripheralCount;
static UINT32 systemIDs[NUM_EMULATORS];
static Emulator* emus[NUM_EMULATORS];
static Intellivision inty;
static Atari5200 atari5200;
};
#endif