From a28ef8554946bffe21d5d70075456043496f8045 Mon Sep 17 00:00:00 2001 From: Souryo Date: Sun, 19 Jun 2016 08:28:13 -0400 Subject: [PATCH] Mapper 228 support (Action 52, Cheetahmen 2) --- Core/ActionEnterprises.h | 43 +++++++++++++++++++++++++++++++++++++++ Core/Core.vcxproj | 1 + Core/Core.vcxproj.filters | 3 +++ Core/MapperFactory.cpp | 2 ++ 4 files changed, 49 insertions(+) create mode 100644 Core/ActionEnterprises.h diff --git a/Core/ActionEnterprises.h b/Core/ActionEnterprises.h new file mode 100644 index 00000000..d5f78699 --- /dev/null +++ b/Core/ActionEnterprises.h @@ -0,0 +1,43 @@ +#pragma once +#include "stdafx.h" +#include "BaseMapper.h" + +class ActionEnterprises : public BaseMapper +{ +protected: + virtual uint16_t GetPRGPageSize() { return 0x4000; } + virtual uint16_t GetCHRPageSize() { return 0x2000; } + + void InitMapper() + { + WriteRegister(0x8000, 0); + } + + virtual void Reset(bool softReset) + { + WriteRegister(0x8000, 0); + } + + + void WriteRegister(uint16_t addr, uint8_t value) + { + uint8_t chipSelect = (addr >> 11) & 0x03; + + if(chipSelect == 3) { + chipSelect = 2; + } + + uint8_t prgPage = ((addr >> 6) & 0x1F) | (chipSelect << 5); + if(addr & 0x20) { + SelectPRGPage(0, prgPage); + SelectPRGPage(1, prgPage); + } else { + SelectPRGPage(0, prgPage & 0xFE); + SelectPRGPage(1, (prgPage & 0xFE) + 1); + } + + SelectCHRPage(0, ((addr & 0x0F) << 2) | (value & 0x03)); + + SetMirroringType(addr & 0x2000 ? MirroringType::Horizontal : MirroringType::Vertical); + } +}; diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 1a98e7db..bd055e8e 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -382,6 +382,7 @@ + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index 378810a0..45f3dfb7 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -649,6 +649,9 @@ Nes\Mappers\Sachen + + Nes\Mappers + diff --git a/Core/MapperFactory.cpp b/Core/MapperFactory.cpp index 820ad62e..74e234fc 100644 --- a/Core/MapperFactory.cpp +++ b/Core/MapperFactory.cpp @@ -2,6 +2,7 @@ #include "MessageManager.h" #include "MapperFactory.h" #include "RomLoader.h" +#include "ActionEnterprises.h" #include "AXROM.h" #include "Bandai74161_7432.h" #include "BandaiFcg.h" @@ -236,6 +237,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData) case 218: return new Mapper218(); case 225: return new Mapper225(); case 226: return new Mapper226(); + case 228: return new ActionEnterprises(); case 230: return new Mapper230(); case 231: return new Mapper231(); case 232: return new BF9096();