Mapper 71 (BF909x) support - Fixes firehawk

This commit is contained in:
Souryo 2015-07-25 17:39:19 -04:00
parent b9f0bc069e
commit fb49fbb6c9
4 changed files with 42 additions and 1 deletions

36
Core/BF909x.h Normal file
View File

@ -0,0 +1,36 @@
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"
class BF909x : public BaseMapper
{
private:
bool _bf9097Mode = false; //Auto-detect for firehawk
protected:
virtual uint32_t GetPRGPageSize() { return 0x4000; }
virtual uint32_t GetCHRPageSize() { return 0x2000; }
void InitMapper()
{
//First and last PRG page
SelectPRGPage(0, 0);
SelectPRGPage(1, -1);
SelectCHRPage(0, 0);
}
void WriteRegister(uint16_t addr, uint8_t value)
{
if(addr == 0x9000) {
//Firehawk uses $9000 to change mirroring
_bf9097Mode = true;
}
if(addr >= 0xC000 || !_bf9097Mode) {
SelectPRGPage(0, value);
} else if(addr < 0xC000) {
_mirroringType = (value & 0x10) ? MirroringType::ScreenAOnly : MirroringType::ScreenBOnly;
}
}
};

View File

@ -266,6 +266,7 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="APU.h" />
<ClInclude Include="BF909x.h" />
<ClInclude Include="DeltaModulationChannel.h" />
<ClInclude Include="ApuEnvelope.h" />
<ClInclude Include="ApuFrameCounter.h" />

View File

@ -224,6 +224,9 @@
<ClInclude Include="VideoDecoder.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BF909x.h">
<Filter>Header Files\Mappers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="CPU.cpp">

View File

@ -14,6 +14,7 @@
#include "NROM.h"
#include "UNROM.h"
#include "VRC2_4.h"
#include "BF909x.h"
BaseMapper* MapperFactory::GetMapperFromID(uint8_t mapperID)
{
@ -34,7 +35,7 @@ BaseMapper* MapperFactory::GetMapperFromID(uint8_t mapperID)
case 23: return new VRC2_4(VRCVariant::VRC2b); //Conflicts: VRC4e
case 25: return new VRC2_4(VRCVariant::VRC4b); //Conflicts: VRC2c, VRC4d
case 27: return new VRC2_4(VRCVariant::VRC4_27); //Untested
case 71: return new UNROM(); //TODO: "It's largely a clone of UNROM, and Camerica games were initially emulated under iNES Mapper 002 before 071 was assigned."
case 71: return new BF909x();
case 163: return new Nanjing();
case 189: return new MMC3_189();
default: MessageManager::DisplayMessage("Error", "Unsupported mapper, cannot load game.");