2016-01-29 11:17:59 +00:00
|
|
|
/****************************************************************************
|
|
|
|
* *
|
|
|
|
* Project64 - A Nintendo 64 emulator. *
|
|
|
|
* http://www.pj64-emu.com/ *
|
|
|
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
|
|
|
* *
|
|
|
|
* License: *
|
|
|
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
|
|
|
* *
|
|
|
|
****************************************************************************/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stddef.h>
|
2016-02-04 10:28:07 +00:00
|
|
|
#include <Common/stdtypes.h>
|
2016-01-29 11:17:59 +00:00
|
|
|
|
|
|
|
struct gb_cart
|
|
|
|
{
|
|
|
|
uint8_t* rom;
|
|
|
|
uint8_t* ram;
|
|
|
|
|
|
|
|
size_t rom_size;
|
|
|
|
size_t ram_size;
|
|
|
|
|
|
|
|
unsigned int rom_bank;
|
|
|
|
unsigned int ram_bank;
|
|
|
|
|
|
|
|
bool has_rtc;
|
|
|
|
bool ram_bank_mode;
|
|
|
|
bool ram_enabled;
|
|
|
|
|
2016-01-30 14:52:26 +00:00
|
|
|
uint32_t rtc_latch;
|
|
|
|
|
2016-02-04 01:57:09 +00:00
|
|
|
int rtc_data[5];
|
|
|
|
int rtc_latch_data[5];
|
2016-01-30 14:52:26 +00:00
|
|
|
time_t rtc_last_time;
|
|
|
|
|
2016-01-29 11:17:59 +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:
|
2016-02-01 08:58:37 +00:00
|
|
|
static bool init_gb_cart(struct gb_cart* gb_cart, const char* gb_file);
|
2016-01-29 11:17:59 +00:00
|
|
|
static void release_gb_cart(struct gb_cart* gb_cart);
|
2016-02-01 08:58:37 +00:00
|
|
|
static void save_gb_cart(struct gb_cart* gb_cart);
|
2016-01-29 11:17:59 +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);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|