Rename some cart info variables that indicates size (readability)
This commit is contained in:
@@ -88,7 +88,7 @@ static void M226Reset(void) {
|
||||
void Mapper226_Init(CartInfo *info) {
|
||||
isresetbased = 0;
|
||||
/* 1536KiB PRG roms have different bank order */
|
||||
reorder_banks = ((info->prgRom * 16) == 1536) ? 1 : 0;
|
||||
reorder_banks = ((info->PRGRomSize * 16) == 1536) ? 1 : 0;
|
||||
info->Power = M226Power;
|
||||
info->Reset = M226Reset;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
|
||||
@@ -217,9 +217,9 @@ void UNROM512_Init(CartInfo *info) {
|
||||
flash_bank = 0;
|
||||
flash_save = info->battery;
|
||||
|
||||
if (info->chrRam == 8192)
|
||||
if (info->CHRRamSize == 8192)
|
||||
chrram_mask = 0;
|
||||
else if (info->chrRam == 16384)
|
||||
else if (info->CHRRamSize == 16384)
|
||||
chrram_mask = 0x20;
|
||||
else
|
||||
chrram_mask = 0x60;
|
||||
@@ -236,7 +236,7 @@ void UNROM512_Init(CartInfo *info) {
|
||||
SetupCartMirroring(MI_0, 0, NULL);
|
||||
break;
|
||||
case 3: /* hard four screen, last 8k of 32k RAM (flags: 4-screen + vertical) */
|
||||
SetupCartMirroring(4, 1, VROM + (info->chrRam - 8192));
|
||||
SetupCartMirroring(4, 1, VROM + (info->CHRRamSize - 8192));
|
||||
break;
|
||||
}
|
||||
bus_conflict = !info->battery;
|
||||
|
||||
12
src/cart.h
12
src/cart.h
@@ -20,12 +20,12 @@ typedef struct {
|
||||
* set to mapper 4.
|
||||
*/
|
||||
int battery; /* Presence of an actual battery. */
|
||||
int prgRom; /* total prg rom size in 16 K chunks */
|
||||
int chrRom; /* total chr rom size in 8 K chunks */
|
||||
int prgRam; /* prg ram size (volatile) */
|
||||
int chrRam; /* chr ram size (volatile) */
|
||||
int prgRam_battery; /* prg ram size (non-volatile or battery backed) */
|
||||
int chrRam_battery; /* chr ram size (non-volatile or battery backed) */
|
||||
int PRGRomSize; /* total prg rom size in 16 K chunks */
|
||||
int CHRRomSize; /* total chr rom size in 8 K chunks */
|
||||
int PRGRamSize; /* prg ram size (volatile) */
|
||||
int CHRRamSize; /* chr ram size (volatile) */
|
||||
int PRGRamSaveSize; /* prg ram size (non-volatile or battery backed) */
|
||||
int CHRRamSaveSize; /* chr ram size (non-volatile or battery backed) */
|
||||
int region; /* video system timing (ntsc, pal, dendy */
|
||||
|
||||
uint8 MD5[16];
|
||||
|
||||
24
src/ines.c
24
src/ines.c
@@ -808,10 +808,10 @@ int iNESLoad(const char *name, FCEUFILE *fp) {
|
||||
chrRom |= ((uint32)head.upper_PRG_CHR_size << 4) & 0xF00;
|
||||
|
||||
subMapper = (head.ROM_type3 >> 4) & 0x0F;
|
||||
iNESCart.prgRam = (head.PRGRAM_size & 0x0F) ? (64 << (head.PRGRAM_size & 0x0F)) : 0;
|
||||
iNESCart.chrRam = (head.CHRRAM_size & 0x0F) ? (64 << (head.CHRRAM_size & 0x0F)) : 0;
|
||||
iNESCart.prgRam_battery = (head.PRGRAM_size & 0xF0) ? (64 << ((head.PRGRAM_size & 0xF0) >> 4)) : 0;
|
||||
iNESCart.chrRam_battery = (head.CHRRAM_size & 0xF0) ? (64 << ((head.CHRRAM_size & 0xF0) >> 4)) : 0;
|
||||
iNESCart.PRGRamSize = (head.PRGRAM_size & 0x0F) ? (64 << (head.PRGRAM_size & 0x0F)) : 0;
|
||||
iNESCart.CHRRamSize = (head.CHRRAM_size & 0x0F) ? (64 << (head.CHRRAM_size & 0x0F)) : 0;
|
||||
iNESCart.PRGRamSaveSize = (head.PRGRAM_size & 0xF0) ? (64 << ((head.PRGRAM_size & 0xF0) >> 4)) : 0;
|
||||
iNESCart.CHRRamSaveSize = (head.CHRRAM_size & 0xF0) ? (64 << ((head.CHRRAM_size & 0xF0) >> 4)) : 0;
|
||||
region = (head.Region & 3);
|
||||
} else {
|
||||
if (!prgRom)
|
||||
@@ -832,8 +832,8 @@ int iNESLoad(const char *name, FCEUFILE *fp) {
|
||||
} else if (romSize < filesize)
|
||||
FCEU_PrintError(" File contains %llu bytes of unused data\n", filesize - romSize);
|
||||
|
||||
iNESCart.prgRom = prgRom;
|
||||
iNESCart.chrRom = chrRom;
|
||||
iNESCart.PRGRomSize = prgRom;
|
||||
iNESCart.CHRRomSize = chrRom;
|
||||
|
||||
ROM_size = uppow2(prgRom);
|
||||
|
||||
@@ -891,8 +891,8 @@ int iNESLoad(const char *name, FCEUFILE *fp) {
|
||||
|
||||
if (iNES2) {
|
||||
const char *tv_region[] = { "NTSC", "PAL", "Multi-region", "Dendy" };
|
||||
unsigned PRGRAM = iNESCart.prgRam + iNESCart.prgRam_battery;
|
||||
unsigned CHRRAM = iNESCart.chrRam + iNESCart.chrRam_battery;
|
||||
unsigned PRGRAM = iNESCart.PRGRamSize + iNESCart.PRGRamSaveSize;
|
||||
unsigned CHRRAM = iNESCart.CHRRamSize + iNESCart.CHRRamSaveSize;
|
||||
|
||||
FCEU_printf(" NES 2.0 extended iNES.\n");
|
||||
FCEU_printf(" Mapper #: %3d\n", MapperNo);
|
||||
@@ -902,8 +902,8 @@ int iNESLoad(const char *name, FCEUFILE *fp) {
|
||||
FCEU_printf(" PRG RAM: %d KB\n", PRGRAM / 1024);
|
||||
FCEU_printf(" CHR RAM: %d KB\n", CHRRAM / 1024);
|
||||
if (head.ROM_type & 0x02) {
|
||||
FCEU_printf(" PRG RAM backed by battery: %d KiB\n", iNESCart.prgRam_battery / 1024);
|
||||
FCEU_printf(" CHR RAM backed by battery: %d KiB\n", iNESCart.chrRam_battery / 1024);
|
||||
FCEU_printf(" PRG RAM backed by battery: %d KiB\n", iNESCart.PRGRamSaveSize / 1024);
|
||||
FCEU_printf(" CHR RAM backed by battery: %d KiB\n", iNESCart.CHRRamSaveSize / 1024);
|
||||
}
|
||||
}
|
||||
FCEU_printf(" Mirroring: %s\n", Mirroring == 2 ? "None (Four-screen)" : Mirroring ? "Vertical" : "Horizontal");
|
||||
@@ -1011,7 +1011,7 @@ static int iNES_Init(int num) {
|
||||
UNIFchrrama = 0; /* need here for compatibility with UNIF mapper code */
|
||||
if (!VROM_size) {
|
||||
if (iNESCart.iNES2) {
|
||||
CHRRAMSize = iNESCart.chrRam + iNESCart.chrRam_battery;
|
||||
CHRRAMSize = iNESCart.CHRRamSize + iNESCart.CHRRamSaveSize;
|
||||
} else {
|
||||
switch (num) { /* FIXME, mapper or game data base with the board parameters and ROM/RAM sizes */
|
||||
case 13: CHRRAMSize = 16 * 1024; break;
|
||||
@@ -1026,7 +1026,7 @@ static int iNES_Init(int num) {
|
||||
case 268: CHRRAMSize = 256 * 1024; break;
|
||||
default: CHRRAMSize = 8 * 1024; break;
|
||||
}
|
||||
iNESCart.chrRam = CHRRAMSize;
|
||||
iNESCart.CHRRamSize = CHRRAMSize;
|
||||
FCEU_printf(" CHR-RAM: %3d KiB\n", CHRRAMSize / 1024);
|
||||
}
|
||||
if (CHRRAMSize) { /* TODO: CHR-RAM are sometimes handled in mappers e.g. MMC1 using submapper 1/2/4 and CHR-RAM can be zero here */
|
||||
|
||||
@@ -740,10 +740,10 @@ int UNIFLoad(const char *name, FCEUFILE *fp) {
|
||||
if (!LoadUNIFChunks(fp))
|
||||
goto aborto;
|
||||
|
||||
UNIFCart.prgRom = (UNIF_PRGROMSize / 0x1000) + ((UNIF_PRGROMSize % 0x1000) ? 1 : 0);
|
||||
UNIFCart.prgRom = (UNIFCart.prgRom >> 2) + ((UNIFCart.prgRom & 3) ? 1: 0);
|
||||
UNIFCart.chrRom = (UNIF_CHRROMSize / 0x400) + ((UNIF_CHRROMSize % 0x400) ? 1 : 0);
|
||||
UNIFCart.chrRom = (UNIFCart.chrRom >> 3) + ((UNIFCart.chrRom & 7) ? 1: 0);
|
||||
UNIFCart.PRGRomSize = (UNIF_PRGROMSize / 0x1000) + ((UNIF_PRGROMSize % 0x1000) ? 1 : 0);
|
||||
UNIFCart.PRGRomSize = (UNIFCart.PRGRomSize >> 2) + ((UNIFCart.PRGRomSize & 3) ? 1: 0);
|
||||
UNIFCart.CHRRomSize = (UNIF_CHRROMSize / 0x400) + ((UNIF_CHRROMSize % 0x400) ? 1 : 0);
|
||||
UNIFCart.CHRRomSize = (UNIFCart.CHRRomSize >> 3) + ((UNIFCart.CHRRomSize & 7) ? 1: 0);
|
||||
|
||||
ROM_size = FixRomSize(UNIF_PRGROMSize, 2048);
|
||||
if (UNIF_CHRROMSize)
|
||||
|
||||
Reference in New Issue
Block a user