Mapper 245 fixes (fixes Dragon Quest VII (Ch))
This commit is contained in:
parent
7f43628693
commit
7cf5696305
2 changed files with 22 additions and 7 deletions
|
@ -22,7 +22,6 @@ class MMC3 : public BaseMapper
|
|||
};
|
||||
|
||||
uint8_t _currentRegister;
|
||||
uint8_t _prgMode;
|
||||
|
||||
bool _wramEnabled;
|
||||
bool _wramWriteProtected;
|
||||
|
@ -69,6 +68,7 @@ class MMC3 : public BaseMapper
|
|||
uint8_t _irqCounter;
|
||||
bool _irqReload;
|
||||
bool _irqEnabled;
|
||||
uint8_t _prgMode;
|
||||
uint8_t _chrMode;
|
||||
uint8_t _registers[8];
|
||||
|
||||
|
|
|
@ -5,13 +5,8 @@
|
|||
class MMC3_245 : public MMC3
|
||||
{
|
||||
protected:
|
||||
virtual void UpdateState()
|
||||
virtual void UpdateState() override
|
||||
{
|
||||
uint8_t orValue = _registers[0] & 0x01 ? 0x40 : 0x00;
|
||||
|
||||
_registers[6] = (_registers[6] & 0x3F) | orValue;
|
||||
_registers[7] = (_registers[7] & 0x3F) | orValue;
|
||||
|
||||
MMC3::UpdateState();
|
||||
|
||||
if(HasChrRam()) {
|
||||
|
@ -24,4 +19,24 @@ protected:
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void UpdatePrgMapping() override
|
||||
{
|
||||
uint8_t orValue = _registers[0] & 0x02 ? 0x40 : 0x00;
|
||||
_registers[6] = (_registers[6] & 0x3F) | orValue;
|
||||
_registers[7] = (_registers[7] & 0x3F) | orValue;
|
||||
|
||||
uint16_t lastPageInBlock = (GetPRGPageCount() >= 0x40 ? (0x3F | orValue) : -1);
|
||||
if(_prgMode == 0) {
|
||||
SelectPRGPage(0, _registers[6]);
|
||||
SelectPRGPage(1, _registers[7]);
|
||||
SelectPRGPage(2, lastPageInBlock - 1);
|
||||
SelectPRGPage(3, lastPageInBlock);
|
||||
} else if(_prgMode == 1) {
|
||||
SelectPRGPage(0, lastPageInBlock - 1);
|
||||
SelectPRGPage(1, _registers[7]);
|
||||
SelectPRGPage(2, _registers[6]);
|
||||
SelectPRGPage(3, lastPageInBlock);
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Add table
Reference in a new issue