UNIF Super24in1Sc03 board support

This commit is contained in:
Souryo 2016-11-08 19:51:53 -05:00
parent c5850f7946
commit f27b8f953d
6 changed files with 64 additions and 1 deletions

View File

@ -658,6 +658,7 @@
<ClInclude Include="Sunsoft89.h" />
<ClInclude Include="Sunsoft93.h" />
<ClInclude Include="SunsoftFme7.h" />
<ClInclude Include="MMC3_Super24in1Sc03.h" />
<ClInclude Include="Supervision.h" />
<ClInclude Include="T262.h" />
<ClInclude Include="TaitoTc0190.h" />

View File

@ -1009,6 +1009,9 @@
<ClInclude Include="Ax5705.h">
<Filter>Nes\Mappers\Unif</Filter>
</ClInclude>
<ClInclude Include="MMC3_Super24in1Sc03.h">
<Filter>Nes\Mappers\Unif</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">

View File

@ -0,0 +1,55 @@
#pragma once
#include "stdafx.h"
#include "MMC3.h"
class MMC3_Super24in1Sc03 : public MMC3
{
private:
const int _prgMask[8] = { 0x3F, 0x1F, 0x0F, 0x01, 0x03, 0, 0, 0 };
uint8_t _exRegs[3];
protected:
uint32_t GetChrRamSize() override { return 0x2000; }
uint16_t GetChrRamPageSize() override { return 0x400; }
void InitMapper() override
{
_exRegs[0] = 0x24;
_exRegs[1] = 0x9F;
_exRegs[2] = 0;
MMC3::InitMapper();
AddRegisterRange(0x5FF0, 0x5FF2, MemoryOperation::Write);
}
void StreamState(bool saving) override
{
MMC3::StreamState(saving);
Stream(_exRegs[0], _exRegs[1], _exRegs[2]);
if(!saving) {
UpdateState();
}
}
void SelectCHRPage(uint16_t slot, uint16_t page, ChrMemoryType memoryType = ChrMemoryType::Default) override
{
MMC3::SelectCHRPage(slot, ((_exRegs[2] << 3) & 0xF00) | page, _exRegs[0] & 0x20 ? ChrMemoryType::ChrRam : ChrMemoryType::ChrRom);
}
void SelectPRGPage(uint16_t slot, uint16_t page, PrgMemoryType memoryType = PrgMemoryType::PrgRom) override
{
MMC3::SelectPRGPage(slot, ((_exRegs[1] << 1) | (page & _prgMask[_exRegs[0] & 0x07])) & 0xFF);
}
void WriteRegister(uint16_t addr, uint8_t value) override
{
if(addr < 0x8000) {
_exRegs[addr & 0x03] = value;
UpdateState();
} else {
MMC3::WriteRegister(addr, value);
}
}
};

View File

@ -138,6 +138,7 @@
#include "MMC3_Coolboy.h"
#include "MMC3_Kof97.h"
#include "MMC3_StreetHeroes.h"
#include "MMC3_Super24in1Sc03.h"
#include "MMC4.h"
#include "MMC5.h"
#include "Namco108.h"
@ -250,6 +251,7 @@ const uint16_t MapperFactory::UnifMalee;
const uint16_t MapperFactory::UnifNovelDiamond;
const uint16_t MapperFactory::UnifStreetHeroes;
const uint16_t MapperFactory::UnifSmb2j;
const uint16_t MapperFactory::UnifSuper24in1Sc03;
const uint16_t MapperFactory::UnifT262;
const uint16_t MapperFactory::UnifTf1201;
@ -496,6 +498,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
case MapperFactory::UnifNovelDiamond: return new NovelDiamond();
case MapperFactory::UnifSmb2j: return new Smb2j();
case MapperFactory::UnifStreetHeroes: return new MMC3_StreetHeroes();
case MapperFactory::UnifSuper24in1Sc03: return new MMC3_Super24in1Sc03();
case MapperFactory::UnifT262: return new T262();
case MapperFactory::UnifTf1201: return new Tf1201();

View File

@ -31,6 +31,7 @@ class MapperFactory
static const uint16_t UnifBmc70in1 = 65516;
static const uint16_t UnifBmc70in1B = 65515;
static const uint16_t UnifAx5705 = 65514;
static const uint16_t UnifSuper24in1Sc03 = 65513;
static shared_ptr<BaseMapper> InitializeFromFile(string romFilename, stringstream *filestream, string ipsFilename, int32_t archiveFileIndex);
};

View File

@ -120,7 +120,7 @@ private:
{ "Sachen-8259B", 138 },
{ "Sachen-8259C", 139 },
{ "Sachen-8259D", 137 },
{ "Super24in1SC03", MapperFactory::UnknownBoard },
{ "Super24in1SC03", MapperFactory::UnifSuper24in1Sc03 },
{ "SuperHIK8in1", 45 },
{ "Supervision16in1", 53 },
{ "T-227-1", MapperFactory::UnknownBoard },