#pragma once

#include <common.h>

typedef struct {
    u8 entry[4];
    u8 logo[0x30];

    char title[16];
    u16 new_lic_code;
    u8 sgb_flag;
    u8 type;
    u8 rom_size;
    u8 ram_size;
    u8 dest_code;
    u8 lic_code;
    u8 version;
    u8 checksum;
    u16 global_checksum;
} rom_header;

bool cart_load(char *cart);

rom_header *get_rom_header();

u8 cart_read(u16 address);
void cart_write(u16 address, u8 value);

bool cart_need_save();
bool cart_battery_load();
bool cart_battery_save();