diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 0b2bb2ff..eb36cf6b 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -444,6 +444,7 @@ + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index 1e4817b3..5e012fe0 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -805,6 +805,9 @@ Nes\Mappers\MMC + + Nes\Mappers\Unnamed + diff --git a/Core/Mapper108.h b/Core/Mapper108.h new file mode 100644 index 00000000..c60d268a --- /dev/null +++ b/Core/Mapper108.h @@ -0,0 +1,47 @@ +#pragma once +#include "stdafx.h" +#include "BaseMapper.h" + +class Mapper108 : public BaseMapper +{ +private: + uint8_t _reg; + +protected: + virtual uint16_t RegisterStartAddress() { return 0x8000; } + virtual uint16_t RegisterEndAddress() { return 0x8FFF; } + virtual uint16_t GetPRGPageSize() { return 0x2000; } + virtual uint16_t GetCHRPageSize() { return 0x2000; } + + void InitMapper() + { + //Used by Bubble Bobble hack only + AddRegisterRange(0xF000, 0xFFFF, MemoryOperation::Write); + + _reg = 0; + + SelectPrgPage4x(0, -4); + SelectCHRPage(0, 0); + } + + void StreamState(bool saving) + { + BaseMapper::StreamState(saving); + Stream(_reg); + + if(!saving) { + UpdateState(); + } + } + + void UpdateState() + { + SetCpuMemoryMapping(0x6000, 0x7FFF, _reg, PrgMemoryType::PrgRom); + } + + void WriteRegister(uint16_t addr, uint8_t value) + { + _reg = value; + UpdateState(); + } +}; diff --git a/Core/MapperFactory.cpp b/Core/MapperFactory.cpp index c79efea0..7c6398d3 100644 --- a/Core/MapperFactory.cpp +++ b/Core/MapperFactory.cpp @@ -50,6 +50,7 @@ #include "Mapper62.h" #include "Mapper91.h" #include "Mapper107.h" +#include "Mapper108.h" #include "Mapper112.h" #include "Mapper170.h" #include "Mapper200.h" @@ -154,7 +155,7 @@ Supported mappers: | 48| 49| 50| 51| 52| | | | 56| 57| 58|===| 60| 61| 62| 63| | 64| 65| 66| 67| 68| 69| 70| 71| 72| 73| 74| 75| 76| 77| 78| 79| | 80|===| 82| |===| 85| 86| 87| 88| 89| 90| 91| 92| 93| 94| 95| -| | 97| | 99|...|101| | | | | |107| | | | | +| | 97| | 99|...|101| | | | | |107|108| | | | |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| @@ -271,6 +272,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData) case 101: return new JalecoJfxx(true); case 105: break; //NES World Champ - has dip switches case 107: return new Mapper107(); + case 108: return new Mapper108(); case 112: return new Mapper112(); case 113: return new Nina03_06(true); case 115: return new MMC3_115();