mirror of
https://github.com/SourMesen/Mesen.git
synced 2024-05-20 05:01:03 -04:00
Added tentative support for mapper 198 (incomplete?)
This commit is contained in:
parent
4b09f24fe1
commit
a40e3de438
|
@ -424,6 +424,7 @@
|
|||
<ClInclude Include="IInputProvider.h" />
|
||||
<ClInclude Include="IInputRecorder.h" />
|
||||
<ClInclude Include="KeyManager.h" />
|
||||
<ClInclude Include="MMC3_198.h" />
|
||||
<ClInclude Include="MovieRecorder.h" />
|
||||
<ClInclude Include="AsciiTurboFile.h" />
|
||||
<ClInclude Include="SystemActionManager.h" />
|
||||
|
|
|
@ -1354,6 +1354,9 @@
|
|||
<ClInclude Include="Zapper.h">
|
||||
<Filter>Nes\Input\Controllers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MMC3_198.h">
|
||||
<Filter>Nes\Mappers\MMC</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
|
65
Core/MMC3_198.h
Normal file
65
Core/MMC3_198.h
Normal file
|
@ -0,0 +1,65 @@
|
|||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "MMC3.h"
|
||||
|
||||
//Most likely incorrect/incomplete, but works (with minor glitches) with the 2 games marked as mapper 198 that I am aware of.
|
||||
//Game 1: 吞食天地2 (CHR RAM, but uses chr banking?, has save ram at 6000-7FFF?)
|
||||
//Game 2: Cheng Ji Si Han (ES-1110) (Ch) (CHR RAM, work ram mirrored from 5000-7FFF?, doesn't use chr banking)
|
||||
//These games may actually use different mappers.
|
||||
class MMC3_198 : public MMC3
|
||||
{
|
||||
private:
|
||||
uint8_t _exRegs[4];
|
||||
|
||||
protected:
|
||||
uint32_t GetWorkRamSize() override { return 0x1000; }
|
||||
uint32_t GetWorkRamPageSize() override { return 0x1000; }
|
||||
uint16_t GetChrRamPageSize() override { return 0x400; }
|
||||
bool ForceWorkRamSize() override { return true; }
|
||||
|
||||
void InitMapper() override
|
||||
{
|
||||
_exRegs[0] = 0;
|
||||
_exRegs[1] = 1;
|
||||
_exRegs[2] = GetPRGPageCount() - 2;
|
||||
_exRegs[3] = GetPRGPageCount() - 1;
|
||||
|
||||
//Set 4kb of work ram at $5000, mirrored
|
||||
SetCpuMemoryMapping(0x5000, 0x7FFF, 0, PrgMemoryType::WorkRam);
|
||||
|
||||
MMC3::InitMapper();
|
||||
|
||||
if(GetSaveRamSize() == 0) {
|
||||
SetCpuMemoryMapping(0x5000, 0x7FFF, 0, PrgMemoryType::WorkRam);
|
||||
}
|
||||
}
|
||||
|
||||
void StreamState(bool saving) override
|
||||
{
|
||||
MMC3::StreamState(saving);
|
||||
Stream(_exRegs[0], _exRegs[1], _exRegs[2], _exRegs[3]);
|
||||
}
|
||||
|
||||
void WriteRegister(uint16_t addr, uint8_t value) override
|
||||
{
|
||||
if(addr == 0x8001 && (GetState().Reg8000 & 0x07) >= 6) {
|
||||
_exRegs[(GetState().Reg8000 & 0x07) - 6] = value & (value >= 0x40 ? 0x4F : 0x3F);
|
||||
}
|
||||
MMC3::WriteRegister(addr, value);
|
||||
}
|
||||
|
||||
void SelectPRGPage(uint16_t slot, uint16_t page, PrgMemoryType memoryType) override
|
||||
{
|
||||
MMC3::SelectPRGPage(slot, _exRegs[slot], memoryType);
|
||||
}
|
||||
|
||||
void UpdateChrMapping() override
|
||||
{
|
||||
if(_chrRamSize > 0 && _registers[0] == 0 && _registers[1] == 0 && _registers[2] == 0 && _registers[3] == 0 && _registers[4] == 0 && _registers[5] == 0) {
|
||||
SelectChrPage8x(0, 0, ChrMemoryType::ChrRam);
|
||||
} else {
|
||||
MMC3::UpdateChrMapping();
|
||||
}
|
||||
}
|
||||
};
|
|
@ -150,6 +150,7 @@
|
|||
#include "MMC3_189.h"
|
||||
#include "MMC3_196.h"
|
||||
#include "MMC3_197.h"
|
||||
#include "MMC3_198.h"
|
||||
#include "MMC3_199.h"
|
||||
#include "MMC3_205.h"
|
||||
#include "MMC3_215.h"
|
||||
|
@ -457,6 +458,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
|
|||
case 195: return new MMC3_ChrRam(0x00, 0x03, 4);
|
||||
case 196: return new MMC3_196();
|
||||
case 197: return new MMC3_197();
|
||||
case 198: return new MMC3_198();
|
||||
case 199: return new MMC3_199();
|
||||
case 200: return new Mapper200();
|
||||
case 201: return new Mapper201();
|
||||
|
|
Loading…
Reference in a new issue