genesis: only save the actual saveram (instead of an overly large file) in some cases with MD cart. disable automatic saveram (that didn't exist anyway) in most non-saveram carts. for mega CD, reduce size of EBRAM cart to 16KiB. it's still enough for a total of 3 Shining Force CD saves, so no complaining.
This commit is contained in:
parent
339cceaca3
commit
28c1347b75
|
@ -12,6 +12,7 @@
|
|||
#include "genesis.h"
|
||||
#include "md_ntsc.h"
|
||||
#include "sms_ntsc.h"
|
||||
#include "eeprom_i2c.h"
|
||||
|
||||
char GG_ROM[256] = "GG_ROM"; // game genie rom
|
||||
char AR_ROM[256] = "AR_ROM"; // actin replay rom
|
||||
|
@ -196,6 +197,33 @@ GPGX_EX void gpgx_advance(void)
|
|||
nsamples = audio_update(soundbuffer);
|
||||
}
|
||||
|
||||
// internal: computes sram size (no brams)
|
||||
int saveramsize(void)
|
||||
{
|
||||
if (!sram.on)
|
||||
return 0;
|
||||
switch (sram.custom)
|
||||
{
|
||||
case 0: // plain bus access saveram
|
||||
break;
|
||||
case 1: // i2c
|
||||
return eeprom_i2c.config.size_mask + 1;
|
||||
case 2: // spi
|
||||
return 0x10000; // it doesn't appear to mask anything internally
|
||||
case 3: // 93c
|
||||
return 0x10000; // SMS only and i don't have time to look into it
|
||||
default:
|
||||
return 0x10000; // who knows
|
||||
}
|
||||
// figure size for plain bus access saverams
|
||||
{
|
||||
int startaddr = sram.start / 8192;
|
||||
int endaddr = sram.end / 8192 + 1;
|
||||
int size = (endaddr - startaddr) * 8192;
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
GPGX_EX void gpgx_clear_sram(void)
|
||||
{
|
||||
// clear sram
|
||||
|
@ -329,7 +357,7 @@ GPGX_EX const char* gpgx_get_memdom(int which, void **area, int *size)
|
|||
if (sram.on)
|
||||
{
|
||||
*area = sram.sram;
|
||||
*size = 0x10000;
|
||||
*size = saveramsize();
|
||||
return "SRAM";
|
||||
}
|
||||
else return NULL;
|
||||
|
@ -356,7 +384,7 @@ GPGX_EX void gpgx_get_sram(void **area, int *size)
|
|||
if (sram.on)
|
||||
{
|
||||
*area = sram.sram;
|
||||
*size = 0x10000;
|
||||
*size = saveramsize();
|
||||
}
|
||||
else if (scd.cartridge.id)
|
||||
{
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
****************************************************************************************/
|
||||
|
||||
#include "shared.h"
|
||||
#include "eeprom_i2c.h"
|
||||
|
||||
#define GAME_CNT 28
|
||||
|
||||
|
@ -56,45 +57,6 @@
|
|||
* which uses D1-read=SDA, D0-write=SDA, D1-write=SCL. Accolade also has a custom-chip mapper which may even use a third method.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8 address_bits; /* number of bits needed to address memory: 7, 8 or 16 */
|
||||
uint16 size_mask; /* depends on the max size of the memory (in bytes) */
|
||||
uint16 pagewrite_mask; /* depends on the maximal number of bytes that can be written in a single write cycle */
|
||||
uint32 sda_in_adr; /* 68000 memory address mapped to SDA_IN */
|
||||
uint32 sda_out_adr; /* 68000 memory address mapped to SDA_OUT */
|
||||
uint32 scl_adr; /* 68000 memory address mapped to SCL */
|
||||
uint8 sda_in_bit; /* bit offset for SDA_IN */
|
||||
uint8 sda_out_bit; /* bit offset for SDA_OUT */
|
||||
uint8 scl_bit; /* bit offset for SCL */
|
||||
} T_CONFIG_I2C;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
STAND_BY = 0,
|
||||
WAIT_STOP,
|
||||
GET_SLAVE_ADR,
|
||||
GET_WORD_ADR_7BITS,
|
||||
GET_WORD_ADR_HIGH,
|
||||
GET_WORD_ADR_LOW,
|
||||
WRITE_DATA,
|
||||
READ_DATA
|
||||
} T_STATE_I2C;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8 sda; /* current /SDA line state */
|
||||
uint8 scl; /* current /SCL line state */
|
||||
uint8 old_sda; /* previous /SDA line state */
|
||||
uint8 old_scl; /* previous /SCL line state */
|
||||
uint8 cycles; /* current operation cycle number (0-9) */
|
||||
uint8 rw; /* operation type (1:READ, 0:WRITE) */
|
||||
uint16 slave_mask; /* device address (shifted by the memory address width)*/
|
||||
uint16 word_address; /* memory address */
|
||||
T_STATE_I2C state; /* current operation state */
|
||||
T_CONFIG_I2C config; /* EEPROM characteristics for this game */
|
||||
} T_EEPROM_I2C;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char game_id[16];
|
||||
|
|
|
@ -39,6 +39,47 @@
|
|||
#ifndef _EEPROM_I2C_H_
|
||||
#define _EEPROM_I2C_H_
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8 address_bits; /* number of bits needed to address memory: 7, 8 or 16 */
|
||||
uint16 size_mask; /* depends on the max size of the memory (in bytes) */
|
||||
uint16 pagewrite_mask; /* depends on the maximal number of bytes that can be written in a single write cycle */
|
||||
uint32 sda_in_adr; /* 68000 memory address mapped to SDA_IN */
|
||||
uint32 sda_out_adr; /* 68000 memory address mapped to SDA_OUT */
|
||||
uint32 scl_adr; /* 68000 memory address mapped to SCL */
|
||||
uint8 sda_in_bit; /* bit offset for SDA_IN */
|
||||
uint8 sda_out_bit; /* bit offset for SDA_OUT */
|
||||
uint8 scl_bit; /* bit offset for SCL */
|
||||
} T_CONFIG_I2C;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
STAND_BY = 0,
|
||||
WAIT_STOP,
|
||||
GET_SLAVE_ADR,
|
||||
GET_WORD_ADR_7BITS,
|
||||
GET_WORD_ADR_HIGH,
|
||||
GET_WORD_ADR_LOW,
|
||||
WRITE_DATA,
|
||||
READ_DATA
|
||||
} T_STATE_I2C;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8 sda; /* current /SDA line state */
|
||||
uint8 scl; /* current /SCL line state */
|
||||
uint8 old_sda; /* previous /SDA line state */
|
||||
uint8 old_scl; /* previous /SCL line state */
|
||||
uint8 cycles; /* current operation cycle number (0-9) */
|
||||
uint8 rw; /* operation type (1:READ, 0:WRITE) */
|
||||
uint16 slave_mask; /* device address (shifted by the memory address width)*/
|
||||
uint16 word_address; /* memory address */
|
||||
T_STATE_I2C state; /* current operation state */
|
||||
T_CONFIG_I2C config; /* EEPROM characteristics for this game */
|
||||
} T_EEPROM_I2C;
|
||||
|
||||
extern T_EEPROM_I2C eeprom_i2c;
|
||||
|
||||
/* Function prototypes */
|
||||
extern void eeprom_i2c_init();
|
||||
|
||||
|
|
|
@ -186,14 +186,16 @@ void sram_init()
|
|||
sram.on = 0;
|
||||
}
|
||||
|
||||
/* by default, enable backup RAM for ROM smaller than 2MB */
|
||||
// by default, enable backup RAM for ROM smaller than 2MB
|
||||
/*
|
||||
else if (cart.romsize <= 0x200000)
|
||||
{
|
||||
/* 64KB static RAM mapped to $200000-$20ffff */
|
||||
// 64KB static RAM mapped to $200000-$20ffff
|
||||
sram.start = 0x200000;
|
||||
sram.end = 0x20ffff;
|
||||
sram.on = 1;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -191,8 +191,9 @@ void cd_cart_init(void)
|
|||
{
|
||||
/* enable 512K backup RAM cartridge when booting from CD (Mode 2) */
|
||||
//scd.cartridge.id = 6;
|
||||
scd.cartridge.id = 4; // use 128K instead, which is the size of a real ebram cart
|
||||
//scd.cartridge.id = 4; // use 128K instead, which is the size of a real ebram cart
|
||||
// bizhawk doesn't need the extra space because it gives each game its own anyway
|
||||
scd.cartridge.id = 1; // 16K to be size-frugal
|
||||
}
|
||||
|
||||
/* RAM cartridge enabled ? */
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue