Mapper 71 fix hardwired mirroring restore after power/savestate, fix uninitialized preg. See issue #389

This commit is contained in:
bbbradsmith 2021-11-24 01:08:38 -05:00
parent d319b5574f
commit 73e0aacb8c
1 changed files with 5 additions and 0 deletions

View File

@ -21,6 +21,7 @@
#include "mapinc.h" #include "mapinc.h"
static uint8 preg, mirr; static uint8 preg, mirr;
static int hardmirr;
static SFORMAT StateRegs[] = static SFORMAT StateRegs[] =
{ {
@ -35,6 +36,8 @@ static void Sync(void) {
setchr8(0); setchr8(0);
if(mirr) if(mirr)
setmirror(mirr); setmirror(mirr);
else
setmirror(hardmirr); // restore hardwired mirroring
} }
static DECLFW(M71Write) { static DECLFW(M71Write) {
@ -46,6 +49,7 @@ static DECLFW(M71Write) {
} }
static void M71Power(void) { static void M71Power(void) {
preg = 0;
mirr = 0; mirr = 0;
Sync(); Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR); SetReadHandler(0x8000, 0xFFFF, CartBR);
@ -57,6 +61,7 @@ static void StateRestore(int version) {
} }
void Mapper71_Init(CartInfo *info) { void Mapper71_Init(CartInfo *info) {
hardmirr = info->mirror;
info->Power = M71Power; info->Power = M71Power;
GameStateRestore = StateRestore; GameStateRestore = StateRestore;