Mapper 162 support

This commit is contained in:
Souryo 2016-08-26 18:13:35 -04:00
parent a056e7e839
commit fe53dbd35c
4 changed files with 55 additions and 1 deletions

View File

@ -668,6 +668,7 @@
<ClInclude Include="VsSystem.h" />
<ClInclude Include="ScaleFilter.h" />
<ClInclude Include="VsZapper.h" />
<ClInclude Include="Waixing162.h" />
<ClInclude Include="Waixing164.h" />
<ClInclude Include="Waixing176.h" />
<ClInclude Include="Waixing178.h" />

View File

@ -916,6 +916,9 @@
<ClInclude Include="MMC1_105.h">
<Filter>Nes\Mappers\MMC</Filter>
</ClInclude>
<ClInclude Include="Waixing162.h">
<Filter>Nes\Mappers\Waixing</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">

View File

@ -170,6 +170,7 @@
#include "VRC6.h"
#include "VRC7.h"
#include "VsSystem.h"
#include "Waixing162.h"
#include "Waixing164.h"
#include "Waixing176.h"
#include "Waixing178.h"
@ -191,7 +192,7 @@ Supported mappers:
|112|113|114|115| |117|118|119|120|121|===| |===| | |===|
|===|===|===|===|132|133| |===|136|137|138|139|140|141|142|143|
|144|145|146|147|148|149|150|151|152|153|154|155|156|157| |159|
|---|===| |163|164|165|166|167|168|===|170|171|172|173|===|175|
|---|===|162|163|164|165|166|167|168|===|170|171|172|173|===|175|
|176|177|178|179|180|---|182|183|184|185|186|187|188|189|===|191|
|192|193|194|195| |197| | |200|201|202|203|204|205|206|207|
| |209|210|211|212|213|214| | | |218| | |221|222| |
@ -345,6 +346,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
case 156: return new DaouInfosys();
case 157: return new BandaiFcg();
case 159: return new BandaiFcg();
case 162: return new Waixing162();
case 163: return new Nanjing();
case 164: return new Waixing164();
case 165: return new MMC3_165();

48
Core/Waixing162.h Normal file
View File

@ -0,0 +1,48 @@
#pragma once
#include "BaseMapper.h"
class Waixing162 : public BaseMapper
{
private:
uint8_t _regs[4];
protected:
uint16_t GetPRGPageSize() { return 0x8000; }
uint16_t GetCHRPageSize() { return 0x2000; }
uint16_t RegisterStartAddress() { return 0x5000; }
uint16_t RegisterEndAddress() { return 0x5FFF; }
void InitMapper()
{
_regs[0] = 3;
_regs[1] = 0;
_regs[2] = 0;
_regs[3] = 7;
SelectCHRPage(0, 0);
UpdateState();
}
void StreamState(bool saving)
{
BaseMapper::StreamState(saving);
ArrayInfo<uint8_t> regs{ _regs, 4 };
Stream(regs);
}
void UpdateState()
{
switch(_regs[3] & 0x5) {
case 0: SelectPRGPage(0, (_regs[0] & 0x0C) | (_regs[1] & 0x02) | ((_regs[2] & 0x0F) << 4)); break;
case 1: SelectPRGPage(0, (_regs[0] & 0x0C) | (_regs[2] & 0x0F) << 4); break;
case 4: SelectPRGPage(0, (_regs[0] & 0x0E) | ((_regs[1] >> 1) & 0x01) | ((_regs[2] & 0x0F) << 4)); break;
case 5: SelectPRGPage(0, (_regs[0] & 0x0F) | ((_regs[2] & 0x0F) << 4)); break;
}
}
void WriteRegister(uint16_t addr, uint8_t value)
{
_regs[(addr >> 8) & 0x03] = value;
UpdateState();
}
};