blob: afc78b10028474d8a4d5324d40dc7735164ea398 (
plain) (
blame)
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
|
#include <emulator.h>
int emulator_load_rom(Emulator* emulator, char* rom_name)
{
printf("load rom!: %s\n", rom_name);
FILE* rom = fopen(rom_name, "r");
if(rom == NULL)
{
perror("no rom file!\n");
return 1;
}
struct stat st;
fstat(fileno(rom), &st);
int bytes_read = fread(emulator->memory, 1, st.st_size, rom);
if(bytes_read != st.st_size)
{
perror("doesnt cuadrar\n");
return 2;
}
return 0;
}
int emulator_tick(Emulator* emulator)
{
return 0;
}
|