diff --git a/Core/BaseMapper.h b/Core/BaseMapper.h index d524743f..50a3b8f3 100644 --- a/Core/BaseMapper.h +++ b/Core/BaseMapper.h @@ -413,6 +413,10 @@ class BaseMapper : public IMemoryHandler, public Snapshotable, public INotificat } } + virtual void Reset(bool softReset) + { + } + void ApplyCheats() { RestoreOriginalPrgRam(); diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 94b698ff..61090883 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -198,6 +198,7 @@ + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index 36025be9..82fd3d12 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -359,6 +359,9 @@ Nes\Mappers + + Nes\Mappers + diff --git a/Core/Mapper242.h b/Core/Mapper242.h new file mode 100644 index 00000000..a30d4126 --- /dev/null +++ b/Core/Mapper242.h @@ -0,0 +1,28 @@ +#pragma once +#include "stdafx.h" +#include "BaseMapper.h" + +class Mapper242 : public BaseMapper +{ +protected: + virtual uint16_t GetPRGPageSize() { return 0x8000; } + virtual uint16_t GetCHRPageSize() { return 0x2000; } + + void InitMapper() + { + Reset(false); + SelectCHRPage(0, 0); + } + + virtual void Reset(bool softReset) + { + SelectPRGPage(0, 0); + SetMirroringType(MirroringType::Vertical); + } + + void WriteRegister(uint16_t addr, uint8_t value) + { + SetMirroringType(addr & 0x02 ? MirroringType::Horizontal : MirroringType::Vertical); + SelectPRGPage(0, (addr >> 3) & 0x0F); + } +}; \ No newline at end of file diff --git a/Core/MapperFactory.cpp b/Core/MapperFactory.cpp index 170887b2..79c7bb55 100644 --- a/Core/MapperFactory.cpp +++ b/Core/MapperFactory.cpp @@ -15,6 +15,7 @@ #include "IremTamS1.h" #include "JalecoJfxx.h" #include "JalecoSs88006.h" +#include "Mapper242.h" #include "MMC1.h" #include "MMC2.h" #include "MMC3.h" @@ -109,6 +110,7 @@ BaseMapper* MapperFactory::GetMapperFromID(ROMLoader &romLoader) case 189: return new MMC3_189(); case 206: return new Namco108(); case 232: return new BF9096(); + case 242: return new Mapper242(); } MessageManager::DisplayMessage("Error", "Unsupported mapper, cannot load game."); diff --git a/Core/MemoryManager.cpp b/Core/MemoryManager.cpp index 1059339d..829565c1 100644 --- a/Core/MemoryManager.cpp +++ b/Core/MemoryManager.cpp @@ -40,6 +40,8 @@ void MemoryManager::Reset(bool softReset) if(!softReset) { memset(_internalRAM, 0, InternalRAMSize); } + + _mapper->Reset(softReset); } uint8_t MemoryManager::ReadRegister(uint16_t addr)