From e6fa5f9e57263d939544c9d7ea2e1ef520ea09a0 Mon Sep 17 00:00:00 2001 From: HeeminTV Date: Sat, 20 Jun 2026 00:23:10 +0900 Subject: [PATCH 1/2] NES: Add cart status for Sunsoft FME-7 --- Core/NES/Mappers/Sunsoft/SunsoftFme7.h | 52 ++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/Core/NES/Mappers/Sunsoft/SunsoftFme7.h b/Core/NES/Mappers/Sunsoft/SunsoftFme7.h index 609afe61d..9e4666595 100644 --- a/Core/NES/Mappers/Sunsoft/SunsoftFme7.h +++ b/Core/NES/Mappers/Sunsoft/SunsoftFme7.h @@ -13,6 +13,7 @@ class SunsoftFme7 : public BaseMapper bool _irqEnabled = false; bool _irqCounterEnabled = false; uint16_t _irqCounter = 0; + uint8_t _regForStatus[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // only used for status display protected: uint16_t GetPrgPageSize() override { return 0x2000; } @@ -85,6 +86,7 @@ class SunsoftFme7 : public BaseMapper _command = value & 0x0F; break; case 0xA000: + _regForStatus[_command] = value; switch(_command) { case 0: case 1: @@ -140,4 +142,54 @@ class SunsoftFme7 : public BaseMapper break; } } + + vector GetMapperStateEntries() override + { + vector entries; + string mirroringType; + uint8_t mirValue = 0; + switch(GetMirroringType()) { + case MirroringType::Horizontal: + mirroringType = "Horizontal"; + mirValue = 3; + break; + case MirroringType::Vertical: + mirroringType = "Vertical"; + mirValue = 2; + break; + case MirroringType::ScreenBOnly: + mirroringType = "Screen B"; + mirValue = 1; + break; + case MirroringType::ScreenAOnly: + mirroringType = "Screen A"; + mirValue = 0; + break; + } + entries.push_back(MapperStateEntry("$8000", "Current Register", _command, MapperStateValueType::Number8)); + + entries.push_back(MapperStateEntry("", "CHR Bank 0", _regForStatus[0], MapperStateValueType::Number8)); + entries.push_back(MapperStateEntry("", "CHR Bank 1", _regForStatus[1], MapperStateValueType::Number8)); + entries.push_back(MapperStateEntry("", "CHR Bank 2", _regForStatus[2], MapperStateValueType::Number8)); + entries.push_back(MapperStateEntry("", "CHR Bank 3", _regForStatus[3], MapperStateValueType::Number8)); + entries.push_back(MapperStateEntry("", "CHR Bank 4", _regForStatus[4], MapperStateValueType::Number8)); + entries.push_back(MapperStateEntry("", "CHR Bank 5", _regForStatus[5], MapperStateValueType::Number8)); + entries.push_back(MapperStateEntry("", "CHR Bank 6", _regForStatus[6], MapperStateValueType::Number8)); + entries.push_back(MapperStateEntry("", "CHR Bank 7", _regForStatus[7], MapperStateValueType::Number8)); + + entries.push_back(MapperStateEntry("", "PRG Bank 0", _regForStatus[8] & 0x3F, MapperStateValueType::Number8)); + entries.push_back(MapperStateEntry("", "PRG Bank 1", _regForStatus[9] & 0x3F, MapperStateValueType::Number8)); + entries.push_back(MapperStateEntry("", "PRG Bank 2", _regForStatus[10] & 0x3F, MapperStateValueType::Number8)); + entries.push_back(MapperStateEntry("", "PRG Bank 3", _regForStatus[11] & 0x3F, MapperStateValueType::Number8)); + + entries.push_back(MapperStateEntry("", "PRG Bank 0 is RAM", (_regForStatus[8] & 0x40) == 0x40, MapperStateValueType::Bool)); + entries.push_back(MapperStateEntry("", "RAM enable", (_regForStatus[8] & 0x80) == 0x80, MapperStateValueType::Bool)); + entries.push_back(MapperStateEntry("", "Mirroring", mirroringType, mirValue)); + + entries.push_back(MapperStateEntry("", "IRQ Enabled", _irqEnabled, MapperStateValueType::Bool)); + entries.push_back(MapperStateEntry("", "IRQ Count Enabled", _irqCounterEnabled, MapperStateValueType::Bool)); + + entries.push_back(MapperStateEntry("", "IRQ Counter Value", _irqCounter, MapperStateValueType::Number16)); + return entries; + } }; \ No newline at end of file From 6ca2887cfa68823b7f4ca4b41fa035a39edc01d5 Mon Sep 17 00:00:00 2001 From: HeeminTV Date: Sat, 20 Jun 2026 19:37:12 +0900 Subject: [PATCH 2/2] NES: Rename some elements in cart status viewer of Sunsoft FME-7 and serialize viewer status --- Core/NES/Mappers/Sunsoft/SunsoftFme7.h | 39 +++++++++++++------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/Core/NES/Mappers/Sunsoft/SunsoftFme7.h b/Core/NES/Mappers/Sunsoft/SunsoftFme7.h index 9e4666595..a83bc1a95 100644 --- a/Core/NES/Mappers/Sunsoft/SunsoftFme7.h +++ b/Core/NES/Mappers/Sunsoft/SunsoftFme7.h @@ -13,7 +13,7 @@ class SunsoftFme7 : public BaseMapper bool _irqEnabled = false; bool _irqCounterEnabled = false; uint16_t _irqCounter = 0; - uint8_t _regForStatus[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // only used for status display + uint8_t _regs[16] = {}; // only used for status display protected: uint16_t GetPrgPageSize() override { return 0x2000; } @@ -28,7 +28,7 @@ class SunsoftFme7 : public BaseMapper { _audio.reset(new Sunsoft5bAudio(_console)); - _command = 0; + _command = GetPowerOnByte() & 0xF; _workRamValue = 0; _irqEnabled = false; _irqCounterEnabled = false; @@ -48,6 +48,7 @@ class SunsoftFme7 : public BaseMapper SV(_irqEnabled); SV(_irqCounterEnabled); SV(_irqCounter); + SVArray(_regs, 16); if(!s.IsSaving()) { UpdateWorkRam(); } @@ -86,7 +87,7 @@ class SunsoftFme7 : public BaseMapper _command = value & 0x0F; break; case 0xA000: - _regForStatus[_command] = value; + _regs[_command] = value; switch(_command) { case 0: case 1: @@ -168,22 +169,22 @@ class SunsoftFme7 : public BaseMapper } entries.push_back(MapperStateEntry("$8000", "Current Register", _command, MapperStateValueType::Number8)); - entries.push_back(MapperStateEntry("", "CHR Bank 0", _regForStatus[0], MapperStateValueType::Number8)); - entries.push_back(MapperStateEntry("", "CHR Bank 1", _regForStatus[1], MapperStateValueType::Number8)); - entries.push_back(MapperStateEntry("", "CHR Bank 2", _regForStatus[2], MapperStateValueType::Number8)); - entries.push_back(MapperStateEntry("", "CHR Bank 3", _regForStatus[3], MapperStateValueType::Number8)); - entries.push_back(MapperStateEntry("", "CHR Bank 4", _regForStatus[4], MapperStateValueType::Number8)); - entries.push_back(MapperStateEntry("", "CHR Bank 5", _regForStatus[5], MapperStateValueType::Number8)); - entries.push_back(MapperStateEntry("", "CHR Bank 6", _regForStatus[6], MapperStateValueType::Number8)); - entries.push_back(MapperStateEntry("", "CHR Bank 7", _regForStatus[7], MapperStateValueType::Number8)); - - entries.push_back(MapperStateEntry("", "PRG Bank 0", _regForStatus[8] & 0x3F, MapperStateValueType::Number8)); - entries.push_back(MapperStateEntry("", "PRG Bank 1", _regForStatus[9] & 0x3F, MapperStateValueType::Number8)); - entries.push_back(MapperStateEntry("", "PRG Bank 2", _regForStatus[10] & 0x3F, MapperStateValueType::Number8)); - entries.push_back(MapperStateEntry("", "PRG Bank 3", _regForStatus[11] & 0x3F, MapperStateValueType::Number8)); - - entries.push_back(MapperStateEntry("", "PRG Bank 0 is RAM", (_regForStatus[8] & 0x40) == 0x40, MapperStateValueType::Bool)); - entries.push_back(MapperStateEntry("", "RAM enable", (_regForStatus[8] & 0x80) == 0x80, MapperStateValueType::Bool)); + entries.push_back(MapperStateEntry("", "CHR Bank 0", _regs[0], MapperStateValueType::Number8)); + entries.push_back(MapperStateEntry("", "CHR Bank 1", _regs[1], MapperStateValueType::Number8)); + entries.push_back(MapperStateEntry("", "CHR Bank 2", _regs[2], MapperStateValueType::Number8)); + entries.push_back(MapperStateEntry("", "CHR Bank 3", _regs[3], MapperStateValueType::Number8)); + entries.push_back(MapperStateEntry("", "CHR Bank 4", _regs[4], MapperStateValueType::Number8)); + entries.push_back(MapperStateEntry("", "CHR Bank 5", _regs[5], MapperStateValueType::Number8)); + entries.push_back(MapperStateEntry("", "CHR Bank 6", _regs[6], MapperStateValueType::Number8)); + entries.push_back(MapperStateEntry("", "CHR Bank 7", _regs[7], MapperStateValueType::Number8)); + + entries.push_back(MapperStateEntry("", "PRG Bank 0", _regs[8] & 0x3F, MapperStateValueType::Number8)); + entries.push_back(MapperStateEntry("", "PRG Bank 0 is RAM", (_regs[8] & 0x40) == 0x40, MapperStateValueType::Bool)); + entries.push_back(MapperStateEntry("", "PRG Bank 1", _regs[9] & 0x3F, MapperStateValueType::Number8)); + entries.push_back(MapperStateEntry("", "PRG Bank 2", _regs[10] & 0x3F, MapperStateValueType::Number8)); + entries.push_back(MapperStateEntry("", "PRG Bank 3", _regs[11] & 0x3F, MapperStateValueType::Number8)); + + entries.push_back(MapperStateEntry("", "RAM Enabled", (_regs[8] & 0x80) == 0x80, MapperStateValueType::Bool)); entries.push_back(MapperStateEntry("", "Mirroring", mirroringType, mirValue)); entries.push_back(MapperStateEntry("", "IRQ Enabled", _irqEnabled, MapperStateValueType::Bool));