From eeffa162e117235c78efc57598e9cba8bf13af3f Mon Sep 17 00:00:00 2001 From: Souryo Date: Wed, 9 Nov 2016 20:14:55 -0500 Subject: [PATCH] UNIF RT-01 board support --- Core/Core.vcxproj | 1 + Core/Core.vcxproj.filters | 3 +++ Core/MapperFactory.cpp | 3 +++ Core/MapperFactory.h | 1 + Core/Rt01.h | 30 ++++++++++++++++++++++++++++++ Core/UnifLoader.h | 2 +- 6 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 Core/Rt01.h diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 44eedd4c..5481c2b1 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -561,6 +561,7 @@ + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index c66cc7f8..8a89c4cc 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -1024,6 +1024,9 @@ Nes\Mappers\Unif + + Nes\Mappers\Unif + diff --git a/Core/MapperFactory.cpp b/Core/MapperFactory.cpp index 3c8bcd86..2962d2e2 100644 --- a/Core/MapperFactory.cpp +++ b/Core/MapperFactory.cpp @@ -161,6 +161,7 @@ #include "OekaKids.h" #include "Racermate.h" #include "Rambo1.h" +#include "Rt01.h" #include "Sachen_133.h" #include "Sachen_136.h" #include "Sachen_143.h" @@ -255,6 +256,7 @@ const uint16_t MapperFactory::UnifKof97; const uint16_t MapperFactory::UnifKs7016; const uint16_t MapperFactory::UnifMalee; const uint16_t MapperFactory::UnifNovelDiamond; +const uint16_t MapperFactory::UnifRt01; const uint16_t MapperFactory::UnifStreetHeroes; const uint16_t MapperFactory::UnifSmb2j; const uint16_t MapperFactory::UnifSuper24in1Sc03; @@ -506,6 +508,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData) case MapperFactory::UnifKs7016: return new Kaiser7016(); case MapperFactory::UnifMalee: return new Malee(); case MapperFactory::UnifNovelDiamond: return new NovelDiamond(); + case MapperFactory::UnifRt01: return new Rt01(); case MapperFactory::UnifSmb2j: return new Smb2j(); case MapperFactory::UnifStreetHeroes: return new MMC3_StreetHeroes(); case MapperFactory::UnifSuper24in1Sc03: return new MMC3_Super24in1Sc03(); diff --git a/Core/MapperFactory.h b/Core/MapperFactory.h index ac4bb880..1b848720 100644 --- a/Core/MapperFactory.h +++ b/Core/MapperFactory.h @@ -35,6 +35,7 @@ class MapperFactory static const uint16_t UnifSuper40in1Ws = 65512; static const uint16_t UnifCc21 = 65511; static const uint16_t UnifKs7016 = 65510; + static const uint16_t UnifRt01 = 65509; static shared_ptr InitializeFromFile(string romFilename, stringstream *filestream, string ipsFilename, int32_t archiveFileIndex); }; diff --git a/Core/Rt01.h b/Core/Rt01.h new file mode 100644 index 00000000..fbc92468 --- /dev/null +++ b/Core/Rt01.h @@ -0,0 +1,30 @@ +#pragma once +#include "stdafx.h" +#include "BaseMapper.h" + +class Rt01 : public BaseMapper +{ +protected: + uint16_t GetPRGPageSize() { return 0x4000; } + uint16_t GetCHRPageSize() { return 0x800; } + bool AllowRegisterRead() override { return true; } + + void InitMapper() override + { + SelectPRGPage(0, 0); + SelectPRGPage(1, 0); + SelectCHRPage(0, 0); + SelectCHRPage(1, 0); + SelectCHRPage(2, 0); + SelectCHRPage(3, 0); + } + + uint8_t ReadRegister(uint16_t addr) override + { + if((addr >= 0xCE80 && addr < 0xCF00) || (addr >= 0xFE80 && addr < 0xFF00)) { + return 0xF2 | (rand() & 0x0D); + } else { + return InternalReadRam(addr); + } + } +}; \ No newline at end of file diff --git a/Core/UnifLoader.h b/Core/UnifLoader.h index 5e89c809..bc1faae2 100644 --- a/Core/UnifLoader.h +++ b/Core/UnifLoader.h @@ -155,7 +155,7 @@ private: { "EH8813A", MapperFactory::UnknownBoard }, { "HP898F", MapperFactory::UnknownBoard }, { "F-15", MapperFactory::UnknownBoard }, - { "RT-01", MapperFactory::UnknownBoard }, + { "RT-01", MapperFactory::UnifRt01 }, { "81-01-31-C", MapperFactory::UnknownBoard }, { "8-IN-1", MapperFactory::UnknownBoard }, { "WS", MapperFactory::UnifSuper40in1Ws }