libgambatte: make mbc3 behave more like mbc1.

map rom bank 0 to bank 1.

fixes pokemon red/blue name entry glitch that has gone unnoticed for
years.

found by anthonyjbentley.
This commit is contained in:
sinamas 2014-07-24 14:00:56 +02:00
parent 4d0479539b
commit 7c92c6dcde

View File

@ -278,7 +278,7 @@ public:
break;
case 1:
rombank_ = data & 0x7F;
memptrs_.setRombank(rombank_ & (rombanks(memptrs_) - 1));
setRombank();
break;
case 2:
rambank_ = data;
@ -303,7 +303,7 @@ public:
rambank_ = ss.rambank;
enableRam_ = ss.enableRam;
setRambank();
memptrs_.setRombank(rombank_ & (rombanks(memptrs_) - 1));
setRombank();
}
private:
@ -325,6 +325,10 @@ private:
memptrs_.setRambank(flags, rambank_ & (rambanks(memptrs_) - 1));
}
void setRombank() const {
memptrs_.setRombank(std::max(rombank_ & (rombanks(memptrs_) - 1), 1u));
}
};
class HuC1 : public DefaultMbc {