mirror of
https://github.com/libretro/MesenCE.git
synced 2026-11-10 11:11:32 -10:00
* Code: Add auto-formatting rules for C++ projects (clang-format) and enforce code style via "clang-format" and "dotnet format" * fix ui format warnings
44 lines
836 B
C++
44 lines
836 B
C++
#include "pch.h"
|
|
#include "PCE/PceSf2RomMapper.h"
|
|
#include "PCE/PceConsole.h"
|
|
#include "PCE/PceMemoryManager.h"
|
|
#include "Utilities/Serializer.h"
|
|
|
|
PceSf2RomMapper::PceSf2RomMapper(PceConsole* console)
|
|
{
|
|
_console = console;
|
|
_mappedBanks[0] = true;
|
|
}
|
|
|
|
void PceSf2RomMapper::Write(uint8_t bank, uint16_t addr, uint8_t value)
|
|
{
|
|
if((addr & 0x1FF0) == 0x1FF0) {
|
|
_selectedBank = addr & 0x0F;
|
|
UpdateMappings();
|
|
}
|
|
}
|
|
|
|
void PceSf2RomMapper::UpdateMappings()
|
|
{
|
|
uint32_t bankOffsets[8] = {
|
|
0x00,
|
|
0x10,
|
|
0x20,
|
|
0x30,
|
|
0x40u + (_selectedBank * 0x40),
|
|
0x50u + (_selectedBank * 0x40),
|
|
0x60u + (_selectedBank * 0x40),
|
|
0x70u + (_selectedBank * 0x40)
|
|
};
|
|
|
|
_console->GetMemoryManager()->UpdateMappings(bankOffsets);
|
|
}
|
|
|
|
void PceSf2RomMapper::Serialize(Serializer& s)
|
|
{
|
|
SV(_selectedBank);
|
|
if(!s.IsSaving()) {
|
|
UpdateMappings();
|
|
}
|
|
}
|