diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 100be793..2f340363 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -443,6 +443,7 @@ + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index 31043956..e32d187a 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -1135,6 +1135,9 @@ Nes\Mappers\Unif + + Nes\Mappers + diff --git a/Core/GoldenFive.h b/Core/GoldenFive.h new file mode 100644 index 00000000..e72fa669 --- /dev/null +++ b/Core/GoldenFive.h @@ -0,0 +1,39 @@ +#pragma once +#include "stdafx.h" +#include "BaseMapper.h" + +class GoldenFive : public BaseMapper +{ +private: + uint8_t _prgReg; + +protected: + uint16_t GetPRGPageSize() override { return 0x4000; } + uint16_t GetCHRPageSize() override { return 0x2000; } + + void InitMapper() override + { + _prgReg = 0; + SelectPRGPage(1, 0x0F); + } + + void StreamState(bool saving) override + { + BaseMapper::StreamState(saving); + Stream(_prgReg); + } + + void WriteRegister(uint16_t addr, uint8_t value) override + { + if(addr >= 0xC000) { + _prgReg = (_prgReg & 0xF0) | (value & 0x0F); + SelectPRGPage(0, _prgReg); + } else if(addr <= 0x9FFF) { + if(value & 0x08) { + _prgReg = (_prgReg & 0x0F) | ((value << 4) & 0x70); + SelectPRGPage(0, _prgReg); + SelectPRGPage(1, ((value << 4) & 0x70) | 0x0F); + } + } + } +}; \ No newline at end of file diff --git a/Core/MapperFactory.cpp b/Core/MapperFactory.cpp index 76dc3716..99b4ab73 100644 --- a/Core/MapperFactory.cpp +++ b/Core/MapperFactory.cpp @@ -43,6 +43,7 @@ #include "FDS.h" #include "FrontFareast.h" #include "Ghostbusters63in1.h" +#include "GoldenFive.h" #include "Gs2004.h" #include "Gs2013.h" #include "GxRom.h" @@ -250,7 +251,7 @@ Supported mappers: | 48| 49| 50| 51| 52| 53| 54|???| 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| 83|===| 85| 86| 87| 88| 89| 90| 91| 92| 93| 94| 95| -| 96| 97|===| 99|...|101|===|103|???|105|106|107|108|===|===|===| +| 96| 97|===| 99|...|101|===|103|104|105|106|107|108|===|===|===| |112|113|114|115| |117|118|119|120|121|===|123|===|125|126|===| |===|===|===|===|132|133|134|===|136|137|138|139|140|141|142|143| |144|145|146|147|148|149|150|151|152|153|154|155|156|157|???|159| @@ -368,6 +369,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData) case 99: return new VsSystem(); case 101: return new JalecoJfxx(true); case 103: return new Mapper103(); + case 104: return new GoldenFive(); case 105: return new MMC1_105(); break; case 106: return new Mapper106(); case 107: return new Mapper107();