project64/Source/Project64-core/N64System/Mips/GBCart.h

41 lines
964 B
C
Raw Normal View History

#pragma once
#include <stddef.h>
2021-04-12 06:34:26 +00:00
#include <stdint.h>
struct gb_cart
{
2022-10-10 00:22:17 +00:00
uint8_t * rom;
uint8_t * ram;
2022-10-10 00:22:17 +00:00
size_t rom_size;
size_t ram_size;
2022-10-10 00:22:17 +00:00
unsigned int rom_bank;
unsigned int ram_bank;
2022-10-10 00:22:17 +00:00
bool has_rtc;
bool ram_bank_mode;
bool ram_enabled;
uint32_t rtc_latch;
int rtc_data[5];
int rtc_latch_data[5];
2022-10-10 00:22:17 +00:00
time_t rtc_last_time;
2022-10-10 00:22:17 +00:00
void (*read_gb_cart)(struct gb_cart * gb_cart, uint16_t address, uint8_t * data);
void (*write_gb_cart)(struct gb_cart * gb_cart, uint16_t address, const uint8_t * data);
};
class GBCart
{
public:
2022-10-10 00:22:17 +00:00
static bool init_gb_cart(struct gb_cart * gb_cart, const char * gb_file);
static void release_gb_cart(struct gb_cart * gb_cart);
static void save_gb_cart(struct gb_cart * gb_cart);
2022-10-10 00:22:17 +00:00
static void read_gb_cart(struct gb_cart * gb_cart, uint16_t address, uint8_t * data);
static void write_gb_cart(struct gb_cart * gb_cart, uint16_t address, const uint8_t * data);
};