mirror of
https://github.com/libretro/Mesen.git
synced 2025-02-24 18:41:48 +00:00
Mapper 165 support
This commit is contained in:
parent
80bc11099e
commit
d8fd734fe2
@ -278,7 +278,8 @@ void BaseMapper::RestoreOriginalPrgRam()
|
||||
|
||||
void BaseMapper::InitializeChrRam(int32_t chrRamSize)
|
||||
{
|
||||
_chrRamSize = chrRamSize >= 0 ? chrRamSize : GetChrRamSize();
|
||||
uint32_t defaultRamSize = GetChrRamSize() ? GetChrRamSize() : 0x2000;
|
||||
_chrRamSize = chrRamSize >= 0 ? chrRamSize : defaultRamSize;
|
||||
if(_chrRamSize > 0) {
|
||||
_chrRam = new uint8_t[_chrRamSize];
|
||||
memset(_chrRam, 0, _chrRamSize);
|
||||
@ -418,6 +419,8 @@ void BaseMapper::Initialize(RomData &romData)
|
||||
_chrRomSize = _chrRamSize;
|
||||
} else if(romData.ChrRamSize >= 0) {
|
||||
InitializeChrRam(romData.ChrRamSize);
|
||||
} else if(GetChrRamSize()) {
|
||||
InitializeChrRam();
|
||||
}
|
||||
|
||||
//Setup a default work/save ram in 0x6000-0x7FFF space
|
||||
|
@ -105,7 +105,7 @@ protected:
|
||||
virtual uint32_t GetSaveRamPageSize() { return 0x2000; }
|
||||
virtual bool ForceBattery() { return false; }
|
||||
|
||||
virtual uint32_t GetChrRamSize() { return 0x2000; }
|
||||
virtual uint32_t GetChrRamSize() { return 0x0000; }
|
||||
|
||||
//Work ram is NOT saved - aka Expansion ram, etc.
|
||||
virtual uint32_t GetWorkRamPageSize() { return 0x2000; }
|
||||
|
@ -463,6 +463,7 @@
|
||||
<ClInclude Include="Mapper50.h" />
|
||||
<ClInclude Include="Mapper60.h" />
|
||||
<ClInclude Include="MMC1_155.h" />
|
||||
<ClInclude Include="MMC3_165.h" />
|
||||
<ClInclude Include="MMC3_182.h" />
|
||||
<ClInclude Include="MMC3_245.h" />
|
||||
<ClInclude Include="MMC3_45.h" />
|
||||
|
@ -790,6 +790,9 @@
|
||||
<ClInclude Include="Mapper35.h">
|
||||
<Filter>Nes\Mappers\Unnamed</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MMC3_165.h">
|
||||
<Filter>Nes\Mappers\MMC</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
@ -13,8 +13,6 @@ protected:
|
||||
|
||||
void InitMapper()
|
||||
{
|
||||
InitializeChrRam();
|
||||
|
||||
SelectPRGPage(0, 0);
|
||||
SelectCHRPage(0, 0);
|
||||
SetMirroringType(MirroringType::FourScreens);
|
||||
|
52
Core/MMC3_165.h
Normal file
52
Core/MMC3_165.h
Normal file
@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
#include "stdafx.h"
|
||||
#include "MMC3.h"
|
||||
|
||||
class MMC3_165 : public MMC3
|
||||
{
|
||||
private:
|
||||
bool _chrLatch[2] = { false, false };
|
||||
bool _needUpdate = false;
|
||||
|
||||
protected:
|
||||
virtual uint16_t GetCHRPageSize() { return 0x1000; }
|
||||
virtual uint32_t GetChrRamSize() { return 0x1000; }
|
||||
virtual uint16_t GetChrRamPageSize() { return 0x1000; }
|
||||
|
||||
virtual void StreamState(bool saving)
|
||||
{
|
||||
MMC3::StreamState(saving);
|
||||
Stream(_chrLatch[0], _chrLatch[1], _needUpdate);
|
||||
}
|
||||
|
||||
virtual void UpdateChrMapping()
|
||||
{
|
||||
uint16_t page;
|
||||
|
||||
for(int i = 0; i < 2; i++) {
|
||||
page = _registers[i == 0 ? (_chrLatch[0] ? 1 : 0) : (_chrLatch[1] ? 4 : 2)];
|
||||
if(page == 0) {
|
||||
SelectCHRPage(i, 0, ChrMemoryType::ChrRam);
|
||||
} else {
|
||||
SelectCHRPage(i, page >> 2, ChrMemoryType::ChrRom);
|
||||
}
|
||||
}
|
||||
|
||||
_needUpdate = false;
|
||||
}
|
||||
|
||||
virtual void NotifyVRAMAddressChange(uint16_t addr)
|
||||
{
|
||||
if(_needUpdate) {
|
||||
UpdateChrMapping();
|
||||
}
|
||||
|
||||
//MMC2 style latch
|
||||
switch(addr & 0x2FF8) {
|
||||
case 0xFD0: case 0xFE8:
|
||||
_chrLatch[(addr >> 12) & 0x01] = ((addr & 0x08) == 0x08);
|
||||
_needUpdate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
@ -32,6 +32,5 @@ protected:
|
||||
public:
|
||||
MMC3_ChrRam(uint16_t firstRamBank, uint16_t lastRamBank, uint16_t chrRamSize) : _firstRamBank(firstRamBank), _lastRamBank(lastRamBank), _chrRamSize(chrRamSize)
|
||||
{
|
||||
InitializeChrRam();
|
||||
}
|
||||
};
|
||||
|
@ -78,6 +78,7 @@
|
||||
#include "MMC3_49.h"
|
||||
#include "MMC3_52.h"
|
||||
#include "MMC3_115.h"
|
||||
#include "MMC3_165.h"
|
||||
#include "MMC3_182.h"
|
||||
#include "MMC3_189.h"
|
||||
#include "MMC3_205.h"
|
||||
@ -154,7 +155,7 @@ Supported mappers:
|
||||
|112|113| |115| | |118|119| | | | | | | | |
|
||||
| | | | |132|133| | | |137|138|139|140|141|142|143|
|
||||
|144|145|146|147|148|149|150|151|152|153|154|155|156|157| |159|
|
||||
| | | |163|164| | | | | |170|171|172|173| |175|
|
||||
| | | |163|164|165| | | | |170|171|172|173| |175|
|
||||
|176|177|178|179|180| |182| |184|185| | | |189| |191|
|
||||
|192|193|194|195| | | | |200|201|202|203| |205|206|207|
|
||||
| |209|210|211| | | | | | |218| | | | | |
|
||||
@ -298,6 +299,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
|
||||
case 159: return new BandaiFcg();
|
||||
case 163: return new Nanjing();
|
||||
case 164: return new Waixing164();
|
||||
case 165: return new MMC3_165();
|
||||
case 170: return new Mapper170();
|
||||
case 171: return new Kaiser7058();
|
||||
case 172: return new Txc22211B();
|
||||
|
Loading…
x
Reference in New Issue
Block a user