nesemu/include/rom.h

39 lines
708 B
C
Raw Normal View History

2023-12-03 00:27:07 -05:00
//
// Created by william on 12/2/23.
//
2024-01-06 14:27:09 -05:00
#include <stdbool.h>
#include "types.h"
#include "system.h"
2023-12-03 00:27:07 -05:00
#ifndef NESEMULATOR_ROM_H
#define NESEMULATOR_ROM_H
2023-12-23 16:35:23 -05:00
// The size of the header in a ROM file, in bytes
#define ROM_HEADER_SIZE 16
// The size of the trainer in a ROM file, in bytes
#define ROM_TRAINER_SIZE 512
2023-12-03 00:27:07 -05:00
typedef struct {
2024-05-23 22:44:52 -04:00
byte header[ROM_HEADER_SIZE];
bool nametable_mirrored;
2023-12-23 16:35:23 -05:00
byte *prg_rom;
2024-05-23 23:52:04 -04:00
unsigned int prg_rom_size;
2024-05-23 22:44:52 -04:00
2023-12-23 16:35:23 -05:00
byte *chr_rom;
2023-12-03 00:27:07 -05:00
} Rom;
2024-05-23 22:44:52 -04:00
Rom *rom_get();
2024-01-06 14:27:09 -05:00
/**
* Loads a ROM from a specified file path.
*
* @param path The file path
* @return A boolean indicating a success (true) or an error.
*/
2024-05-06 20:23:44 -04:00
bool rom_load(char *path);
2023-12-03 00:27:07 -05:00
2024-05-23 22:44:52 -04:00
void rom_unload();
2023-12-03 00:27:07 -05:00
#endif //NESEMULATOR_ROM_H