Mapper 44 support

This commit is contained in:
Souryo 2016-01-21 01:01:25 -05:00
parent e356d68a82
commit b3c10edf67
4 changed files with 55 additions and 0 deletions

View file

@ -384,6 +384,7 @@
<ClInclude Include="Mapper58.h" />
<ClInclude Include="MMC3_115.h" />
<ClInclude Include="MMC3_37.h" />
<ClInclude Include="MMC3_44.h" />
<ClInclude Include="MMC3_47.h" />
<ClInclude Include="MMC3_ChrRam.h" />
<ClInclude Include="NtdecTc112.h" />

View file

@ -416,6 +416,9 @@
<ClInclude Include="MMC3_47.h">
<Filter>Nes\Mappers</Filter>
</ClInclude>
<ClInclude Include="MMC3_44.h">
<Filter>Nes\Mappers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">

49
Core/MMC3_44.h Normal file
View file

@ -0,0 +1,49 @@
#pragma once
#include "stdafx.h"
#include "MMC3.h"
class MMC3_44 : public MMC3
{
private:
uint8_t _selectedBlock = 0;
protected:
virtual void StreamState(bool saving)
{
Stream<uint8_t>(_selectedBlock);
MMC3::StreamState(saving);
}
virtual void Reset(bool softReset)
{
_selectedBlock = 0;
UpdateState();
}
virtual void SelectCHRPage(uint16_t slot, uint16_t page, ChrMemoryType memoryType = ChrMemoryType::Default)
{
page &= _selectedBlock <= 5 ? 0x7F : 0xFF;
page |= _selectedBlock * 0x80;
MMC3::SelectCHRPage(slot, page, memoryType);
}
virtual void SelectPRGPage(uint16_t slot, uint16_t page, PrgMemoryType memoryType = PrgMemoryType::PrgRom)
{
page &= _selectedBlock <= 5 ? 0x0F : 0x1F;
page |= _selectedBlock * 0x10;
MMC3::SelectPRGPage(slot, page, memoryType);
}
virtual void WriteRegister(uint16_t addr, uint8_t value)
{
if((addr & 0xE001) == 0xA001) {
_selectedBlock = value & 0x07;
if(_selectedBlock == 7) {
_selectedBlock = 6;
}
}
MMC3::WriteRegister(addr, value);
}
};

View file

@ -33,6 +33,7 @@
#include "MMC3.h"
#include "MMC3_12.h"
#include "MMC3_37.h"
#include "MMC3_44.h"
#include "MMC3_47.h"
#include "MMC3_115.h"
#include "MMC3_189.h"
@ -98,6 +99,7 @@ BaseMapper* MapperFactory::GetMapperFromID(ROMLoader &romLoader)
case 34: return (romLoader.GetChrSize() > 0) ? (BaseMapper*)new Nina01() : (BaseMapper*)new BnRom(); //BnROM uses CHR RAM (so no CHR rom in the .NES file)
case 37: return new MMC3_37();
case 38: return new UnlPci556();
case 44: return new MMC3_44();
case 47: return new MMC3_47();
case 58: return new Mapper58();
case 66: return new GxRom();