mirror of
https://github.com/libretro/Mesen.git
synced 2024-12-04 15:36:35 +00:00
49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
#pragma once
|
|
#include "stdafx.h"
|
|
#include "MMC2.h"
|
|
|
|
class MMC4 : public MMC2
|
|
{
|
|
protected:
|
|
virtual uint16_t GetPRGPageSize() { return 0x4000; }
|
|
virtual uint16_t GetCHRPageSize() { return 0x1000; }
|
|
|
|
virtual void InitMapper()
|
|
{
|
|
_leftLatch = 1;
|
|
_rightLatch = 1;
|
|
_leftChrPage[0] = 0;
|
|
_leftChrPage[1] = 0;
|
|
_rightChrPage[0] = 0;
|
|
_rightChrPage[1] = 0;
|
|
|
|
SelectPRGPage(0, 0);
|
|
SelectPRGPage(1, -1);
|
|
SelectCHRPage(0, 0);
|
|
SelectCHRPage(0, 1);
|
|
}
|
|
|
|
public:
|
|
virtual void NotifyVRAMAddressChange(uint16_t addr)
|
|
{
|
|
if(_needChrUpdate) {
|
|
SelectCHRPage(0, _leftChrPage[_leftLatch]);
|
|
SelectCHRPage(1, _rightChrPage[_rightLatch]);
|
|
_needChrUpdate = false;
|
|
}
|
|
|
|
if(addr >= 0x0FD8 && addr <= 0x0FDF) {
|
|
_leftLatch = 0;
|
|
_needChrUpdate = true;
|
|
} else if(addr >= 0x0FE8 && addr <= 0x0FEF) {
|
|
_leftLatch = 1;
|
|
_needChrUpdate = true;
|
|
} else if(addr >= 0x1FD8 && addr <= 0x1FDF) {
|
|
_rightLatch = 0;
|
|
_needChrUpdate = true;
|
|
} else if(addr >= 0x1FE8 && addr <= 0x1FEF) {
|
|
_rightLatch = 1;
|
|
_needChrUpdate = true;
|
|
}
|
|
}
|
|
}; |