-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
56 lines (47 loc) · 1.12 KB
/
Copy pathmain.cpp
File metadata and controls
56 lines (47 loc) · 1.12 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
#include <SDL2/SDL.h>
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include "cpu.h"
#include "gpu.h"
#include "dis.h"
#include "apu.h"
char* readFileBytes(const char *name, uint32_t* length)
{
std::ifstream fl(name);
if (!fl) return nullptr;
fl.seekg(0, std::ios::end);
size_t len = fl.tellg();
if (length) *length = len;
char *ret = new char[len];
fl.seekg(0, std::ios::beg);
fl.read(ret, len);
fl.close();
return ret;
}
int main(int argc, char* argv[])
{
/*if (argc <= 2) {
std::cout << "Please supply the paths to (1) the gameboy boot ROM and (2) a game to play." << std::endl;
return 1;
}*/
const char * bootRom = "";
const char * game = "";
SDL_Init(SDL_INIT_EVERYTHING);
Disassembler::init();
CPU::debugger.init();
GPU::init();
CPU::initBootROM(bootRom);
if(!CPU::init(game))
{
APU::init();
CPU::run();
} else {
SDL_CloseAudio();
SDL_Quit();
return 1;
}
SDL_CloseAudio();
SDL_Quit();
return 0;
}