mapper-related updates and fixes (#491)

* m116: Fix support for Huang-2 chip

* Provide 8K CHR ram if no CHR rom/ram is provided due to bad headers

* m15: Implement CHR write-protect

* Update Namco 106

- Cleanup save state struct
- Implement nametable mirroring
- fix sound issue (fceux)

Co-authored-by: negativeExponent <negativeExponent@users.noreply.github.com>
This commit is contained in:
negativeExponent
2022-02-01 15:14:16 +08:00
committed by GitHub
parent e0200b03c8
commit 85ace685b9
6 changed files with 76 additions and 45 deletions

View File

@@ -1116,6 +1116,7 @@ static int iNES_Init(int num) {
if (!VROM_size) {
if (iNESCart.iNES2) {
CHRRAMSize = iNESCart.CHRRamSize + iNESCart.CHRRamSaveSize;
if (CHRRAMSize == 0) CHRRAMSize = iNESCart.CHRRamSize = 8 * 8192;
} else {
switch (num) { /* FIXME, mapper or game data base with the board parameters and ROM/RAM sizes */
case 13: CHRRAMSize = 16 * 1024; break;
@@ -1132,7 +1133,7 @@ static int iNES_Init(int num) {
}
iNESCart.CHRRamSize = CHRRAMSize;
}
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 */
if (CHRRAMSize > 0) { /* TODO: CHR-RAM are sometimes handled in mappers e.g. MMC1 using submapper 1/2/4 and CHR-RAM can be zero here */
if ((VROM = (uint8*)malloc(CHRRAMSize)) == NULL) return 0;
FCEU_MemoryRand(VROM, CHRRAMSize);
UNIFchrrama = VROM;