From b34d3d27603b249e41ba9e63a82dba9f5ea2b9d3 Mon Sep 17 00:00:00 2001 From: Souryo Date: Wed, 12 Apr 2017 20:23:32 -0400 Subject: [PATCH] Support for 255-in-1 rom --- Core/Core.vcxproj | 1 + Core/Core.vcxproj.filters | 3 +++ Core/MapperFactory.cpp | 2 ++ Core/UnifBoards.h | 1 + Core/UnifLoader.cpp | 1 + Core/Unl255in1.h | 21 +++++++++++++++++++++ GUI.NET/Dependencies/MesenDB.txt | 2 +- 7 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 Core/Unl255in1.h diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index a6178fb8..e0db74c9 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -716,6 +716,7 @@ + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index 85254acd..825981db 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -1129,6 +1129,9 @@ Nes\Mappers\Unif + + Nes\Mappers\Unif + diff --git a/Core/MapperFactory.cpp b/Core/MapperFactory.cpp index 670f2887..4475c697 100644 --- a/Core/MapperFactory.cpp +++ b/Core/MapperFactory.cpp @@ -217,6 +217,7 @@ #include "Txc22211B.h" #include "Txc22211C.h" #include "TxSRom.h" +#include "Unl255in1.h" #include "Unl43272.h" #include "UnlPci556.h" #include "UnlPuzzle.h" @@ -535,6 +536,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData) case UnifBoards::Super40in1Ws: return new Super40in1Ws(); case UnifBoards::T262: return new T262(); case UnifBoards::Tf1201: return new Tf1201(); + case UnifBoards::Unl255in1: return new Unl255in1(); case UnifBoards::Unl43272: return new Unl43272(); case UnifBoards::UnlPuzzle: return new UnlPuzzle(); diff --git a/Core/UnifBoards.h b/Core/UnifBoards.h index be50eede..d280d759 100644 --- a/Core/UnifBoards.h +++ b/Core/UnifBoards.h @@ -51,5 +51,6 @@ namespace UnifBoards { UnlPuzzle, Fk23C, Fk23Ca, + Unl255in1, }; } \ No newline at end of file diff --git a/Core/UnifLoader.cpp b/Core/UnifLoader.cpp index 6bc7b7f2..5349d5b3 100644 --- a/Core/UnifLoader.cpp +++ b/Core/UnifLoader.cpp @@ -7,6 +7,7 @@ std::unordered_map UnifLoader::_boardMappings = std::unordered_map< { "13in1JY110", UnifBoards::UnknownBoard }, { "190in1", UnifBoards::Bmc190in1 }, { "22211", 132 }, + { "255in1", UnifBoards::Unl255in1 }, //Doesn't actually exist as a UNIF file (used to assign a mapper to the 255-in-1 rom) { "3D-BLOCK", UnifBoards::UnknownBoard }, { "411120-C", UnifBoards::Bmc411120C }, { "42in1ResetSwitch", 226 }, diff --git a/Core/Unl255in1.h b/Core/Unl255in1.h new file mode 100644 index 00000000..b55ba2fc --- /dev/null +++ b/Core/Unl255in1.h @@ -0,0 +1,21 @@ +#pragma once +#include "stdafx.h" +#include "BaseMapper.h" + +class Unl255in1 : public BaseMapper +{ +protected: + virtual uint16_t GetPRGPageSize() override { return 0x8000; } + virtual uint16_t GetCHRPageSize() override { return 0x2000; } + + void InitMapper() override + { + WriteRegister(0x8000, 0); + } + + void WriteRegister(uint16_t addr, uint8_t value) override + { + SelectCHRPage(0, addr & 0x07); + SelectPRGPage(0, (addr >> 2) & 0x03); + } +}; \ No newline at end of file diff --git a/GUI.NET/Dependencies/MesenDB.txt b/GUI.NET/Dependencies/MesenDB.txt index 7d9ce9d7..60792702 100644 --- a/GUI.NET/Dependencies/MesenDB.txt +++ b/GUI.NET/Dependencies/MesenDB.txt @@ -368,7 +368,7 @@ 1E66861F,Playchoice,,,,1,128,128,,0,0,0,,, 1EB4A920,NesNtsc,AVE-NINA-06,NINA-06,,79,32,32,,0,0,0,v,, 1EBB5B42,NesNtsc,NES-SNROM,NES-SNROM-06,MMC1B2,1,128,,8,8,0,0,,FourPlayer, -1EC1DFEB,NesNtsc,,,,217,64,32,,0,0,0,v,, +1EC1DFEB,NesNtsc,UNL-255in1,,,65000,64,32,,0,0,0,v,, 1ED48C5C,Famicom,HVC-UNROM,HVC-UNROM-09,,2,128,,8,0,0,0,v,, 1ED5C801,NesPal,NES-TSROM,NES-TSROM-08,MMC3B,4,256,128,,8,0,0,,, 1ED7D6BE,Famicom,HVC-TLROM,HVC-TLROM-02,MMC3A,4,128,128,,0,0,0,,,