mirror of
https://github.com/libretro/Mesen.git
synced 2024-11-23 09:09:45 +00:00
Mapper 252 support
This commit is contained in:
parent
3773ccecaf
commit
696c344bdc
@ -608,6 +608,7 @@
|
||||
<ClInclude Include="VsZapper.h" />
|
||||
<ClInclude Include="Waixing164.h" />
|
||||
<ClInclude Include="Waixing176.h" />
|
||||
<ClInclude Include="Waixing252.h" />
|
||||
<ClInclude Include="WaveRecorder.h" />
|
||||
<ClInclude Include="Zapper.h" />
|
||||
</ItemGroup>
|
||||
|
@ -74,6 +74,9 @@
|
||||
<Filter Include="Nes\Mappers\Bandai">
|
||||
<UniqueIdentifier>{2d5cebc1-c803-457f-bdeb-3c9dfba704ea}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Nes\Mappers\Waixing">
|
||||
<UniqueIdentifier>{a47ffe4e-02b9-43a0-a3d6-b4943c9aade4}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="IAudioDevice.h">
|
||||
@ -658,15 +661,9 @@
|
||||
<ClInclude Include="Sachen74LS374NB.h">
|
||||
<Filter>Nes\Mappers\Sachen</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Waixing176.h">
|
||||
<Filter>Nes\Mappers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Mapper227.h">
|
||||
<Filter>Nes\Mappers\Unnamed</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Waixing164.h">
|
||||
<Filter>Nes\Mappers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VsZapper.h">
|
||||
<Filter>Nes\Controllers</Filter>
|
||||
</ClInclude>
|
||||
@ -712,6 +709,15 @@
|
||||
<ClInclude Include="TaitoTc0690.h">
|
||||
<Filter>Nes\Mappers\Taito</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Waixing252.h">
|
||||
<Filter>Nes\Mappers\Waixing</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Waixing176.h">
|
||||
<Filter>Nes\Mappers\Waixing</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Waixing164.h">
|
||||
<Filter>Nes\Mappers\Waixing</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
@ -115,6 +115,7 @@
|
||||
#include "VsSystem.h"
|
||||
#include "Waixing164.h"
|
||||
#include "Waixing176.h"
|
||||
#include "Waixing252.h"
|
||||
|
||||
/*
|
||||
Supported mappers: (... denotes bad mappers)
|
||||
@ -125,7 +126,7 @@ Supported mappers: (... denotes bad mappers)
|
||||
| 48| 49| 50| | 52| | | | | 57| 58| | 60| 61| 62| |
|
||||
| 64| 65| 66| 67| 68| 69| 70| 71| 72| 73| 74| 75| 76| 77| 78| 79|
|
||||
| 80| | 82| | | 85| 86| 87| 88| 89| | 91| 92| 93| 94| 95|
|
||||
| | 97| | 99| |101| | | | | |107| | | | |
|
||||
| | 97| | 99|...|101| | | | | |107| | | | |
|
||||
|112|113| |115| | |118|119| | | | | | | | |
|
||||
| | | | | | | | | |137|138|139|140|141| |143|
|
||||
|144|145|146|147|148|149|150|151|152|153|154|155|156|157| |159|
|
||||
@ -134,7 +135,7 @@ Supported mappers: (... denotes bad mappers)
|
||||
|192|193|194|195| | | | |200|201|202|203| |205|206|207|
|
||||
| | |210| | | | | | | |218| | | | | |
|
||||
| |225|226|227|228| |230|231|232| | | | | | | |
|
||||
|240|241|242|243| | |246| | | | | | | | | |
|
||||
|240|241|242|243| | |246| | | | | |252| | | |
|
||||
-----------------------------------------------------------------
|
||||
*/
|
||||
|
||||
@ -293,6 +294,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
|
||||
case 242: return new Mapper242();
|
||||
case 243: return new Sachen74LS374N();
|
||||
case 246: return new Mapper246();
|
||||
case 252: return new Waixing252();
|
||||
|
||||
case MapperFactory::NsfMapperID: return new NsfMapper();
|
||||
case MapperFactory::FdsMapperID: return new FDS();
|
||||
|
68
Core/Waixing252.h
Normal file
68
Core/Waixing252.h
Normal file
@ -0,0 +1,68 @@
|
||||
#pragma once
|
||||
#include "BaseMapper.h"
|
||||
#include "VrcIrq.h"
|
||||
|
||||
class Waixing252 : public BaseMapper
|
||||
{
|
||||
private:
|
||||
uint8_t _chrRegs[8];
|
||||
VrcIrq _irq;
|
||||
|
||||
protected:
|
||||
uint16_t GetPRGPageSize() { return 0x2000; }
|
||||
uint16_t GetCHRPageSize() { return 0x400; }
|
||||
|
||||
void InitMapper()
|
||||
{
|
||||
memset(_chrRegs, 0, sizeof(_chrRegs));
|
||||
|
||||
SelectPRGPage(2, -2);
|
||||
SelectPRGPage(3, -1);
|
||||
}
|
||||
|
||||
void StreamState(bool saving)
|
||||
{
|
||||
BaseMapper::StreamState(saving);
|
||||
SnapshotInfo irq{ &_irq };
|
||||
ArrayInfo<uint8_t> chrRegs{ _chrRegs,8 };
|
||||
Stream(chrRegs, irq);
|
||||
|
||||
if(!saving) {
|
||||
UpdateState();
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessCpuClock()
|
||||
{
|
||||
_irq.ProcessCpuClock();
|
||||
}
|
||||
|
||||
void UpdateState()
|
||||
{
|
||||
for(int i = 0; i < 8; i++) {
|
||||
//CHR needs to be writeable (according to Nestopia's source, and this does remove visual glitches from the game)
|
||||
SetPpuMemoryMapping(0x400 * i, 0x400 * i + 0x3FF, _chrRegs[i], ChrMemoryType::Default, MemoryAccessType::ReadWrite);
|
||||
}
|
||||
}
|
||||
|
||||
void WriteRegister(uint16_t addr, uint8_t value)
|
||||
{
|
||||
if(addr <= 0x8FFF) {
|
||||
SelectPRGPage(0, value);
|
||||
} else if(addr >= 0xA000 && addr <= 0xAFFF) {
|
||||
SelectPRGPage(1, value);
|
||||
} else if(addr >= 0xB000 && addr <= 0xEFFF) {
|
||||
uint8_t shift = addr & 0x4;
|
||||
uint8_t bank = (((addr - 0xB000) >> 1 & 0x1800) | (addr << 7 & 0x0400)) / 0x400;
|
||||
_chrRegs[bank] = ((_chrRegs[bank] & (0xF0 >> shift)) | ((value & 0x0F) << shift));
|
||||
UpdateState();
|
||||
} else {
|
||||
switch(addr & 0xF00C) {
|
||||
case 0xF000: _irq.SetReloadValueNibble(value, false); break;
|
||||
case 0xF004: _irq.SetReloadValueNibble(value, true); break;
|
||||
case 0xF008: _irq.SetControlValue(value); break;
|
||||
case 0xF00C: _irq.AcknowledgeIrq(); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user