Mesen/Core/MMC3_ChrRam.h
Souryo b3a6447a94 BaseMapper - Support for both CHR ROM & RAM at once
Mapper 74, 119, 191, 192, 194, 195 support
2016-01-19 20:16:00 -05:00

40 lines
966 B
C++

#pragma once
#include "stdafx.h"
#include "MMC3.h"
class MMC3_ChrRam : public MMC3
{
private:
uint16_t _firstRamBank;
uint16_t _lastRamBank;
uint16_t _chrRamSize;
protected:
virtual uint16_t GetChrRamPageSize() { return 0x400; }
virtual uint32_t GetChrRamSize() { return _chrRamSize * 0x400; }
virtual void SelectCHRPage(uint16_t slot, uint16_t page, ChrMemoryType memoryType = ChrMemoryType::Default)
{
if(page >= _firstRamBank && page <= _lastRamBank) {
memoryType = ChrMemoryType::ChrRam;
page -= _firstRamBank;
}
MMC3::SelectCHRPage(slot, page, memoryType);
}
virtual void StreamState(bool saving)
{
Stream<uint16_t>(_firstRamBank);
Stream<uint16_t>(_lastRamBank);
Stream<uint16_t>(_chrRamSize);
MMC3::StreamState(saving);
}
public:
MMC3_ChrRam(uint16_t firstRamBank, uint16_t lastRamBank, uint16_t chrRamSize) : _firstRamBank(firstRamBank), _lastRamBank(lastRamBank), _chrRamSize(chrRamSize)
{
InitializeChrRam();
}
};