-
Notifications
You must be signed in to change notification settings - Fork 0
/
GB.h
66 lines (50 loc) · 1.22 KB
/
GB.h
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
#pragma once
#include "CPU.h"
#include "Memory.h"
#include "Timers.h"
#include "Graphics.h"
#include "Controller.h"
#include "Serializer.h"
#include "Disassembler.h"
#include "Debugger.h"
#define CYCLES_PER_FRAME 70224
#define TIME_PER_FRAME 1.0 / 60.0
class GB {
private:
const char * rom_fpath;
std::string ROMName;
std::function<void(std::string)> debugLogCallback;
bool CGBMode;
bool doubleSpeed;
int currentCycles;
Controller controller;
Memory MMU;
CPU Cpu;
Timers timers;
Graphics graphics;
Serializer serializer;
Disassembler disassembler;
Debugger debugger;
public:
GB(const char* rom_fpath = nullptr);
void AdvanceFrame();
void SetCGBMode(bool val);
bool CGBModeEnabled();
void SetDoubleSpeed(bool val);
bool IsDoubleSpeed();
std::string GetROMName();
const char * GetROMPath();
void Reset();
void LoadROM(const char * rom_fpath);
void Serialize(Serializer & s);
void Deserialize(Serializer & s);
byte * SaveState(bool save_to_disk = true);
void LoadState(const byte * data = nullptr);
void DebugLog(std::string s);
Graphics* GetGraphics();
CPU* GetCPU();
Memory* GetMMU();
Controller* GetInput();
Debugger* GetDebugger();
Serializer* GetSerializer();
};