diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 04b66116..23629cf2 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -425,6 +425,7 @@ + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index 1e7d3c10..5110bb22 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -637,6 +637,9 @@ Nes\Mappers + + Nes\Mappers\MMC + diff --git a/Core/MMC1.h b/Core/MMC1.h index 900e4245..d10fdc76 100644 --- a/Core/MMC1.h +++ b/Core/MMC1.h @@ -1,3 +1,4 @@ +#pragma once #include "stdafx.h" #include "CPU.h" #include "BaseMapper.h" @@ -44,13 +45,6 @@ class MMC1 : public BaseMapper uint8_t _prgReg; int32_t _lastWriteCycle = -1; - - struct { - uint8_t Reg8000; - uint8_t RegA000; - uint8_t RegC000; - uint8_t RegE000; - } _state; private: bool HasResetFlag(uint8_t value) @@ -85,7 +79,16 @@ class MMC1 : public BaseMapper } } - void UpdateState() + protected: + struct + { + uint8_t Reg8000; + uint8_t RegA000; + uint8_t RegC000; + uint8_t RegE000; + } _state; + + virtual void UpdateState() { switch(_state.Reg8000 & 0x03) { case 0: SetMirroringType(MirroringType::ScreenAOnly); break; @@ -135,7 +138,6 @@ class MMC1 : public BaseMapper } } - protected: void StreamState(bool saving) { BaseMapper::StreamState(saving); diff --git a/Core/MMC1_155.h b/Core/MMC1_155.h new file mode 100644 index 00000000..7adfcbb8 --- /dev/null +++ b/Core/MMC1_155.h @@ -0,0 +1,14 @@ +#pragma once +#include "MMC1.h" + +class MMC1_155 : public MMC1 +{ +protected : + void UpdateState() + { + //WRAM disable bit does not exist in mapper 155 + _state.RegE000 &= 0x0F; + + MMC1::UpdateState(); + } +}; \ No newline at end of file diff --git a/Core/MapperFactory.cpp b/Core/MapperFactory.cpp index 3c124179..ab47164e 100644 --- a/Core/MapperFactory.cpp +++ b/Core/MapperFactory.cpp @@ -47,6 +47,7 @@ #include "Mapper242.h" #include "Mapper246.h" #include "MMC1.h" +#include "MMC1_155.h" #include "MMC2.h" #include "MMC3.h" #include "MMC3_12.h" @@ -202,6 +203,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData) case 152: return new Bandai74161_7432(true); case 153: return new BandaiFcg(); case 154: return new Namco108_154(); + case 155: return new MMC1_155(); case 156: return new DaouInfosys(); case 157: return new BandaiFcg(); case 159: return new BandaiFcg();