From 6dd6314c872f74c1d5bc3022c1b3ce544dc67286 Mon Sep 17 00:00:00 2001 From: zeromus Date: Wed, 14 Nov 2018 21:27:13 -0500 Subject: [PATCH] gbhawk CDL - all the mappers. not tested very thoroughly. --- .../Nintendo/GBHawk/Mappers/Mapper_Camera.cs | 21 +++++++++ .../Nintendo/GBHawk/Mappers/Mapper_Default.cs | 21 +++++++++ .../Nintendo/GBHawk/Mappers/Mapper_HuC1.cs | 43 +++++++++++++++++ .../Nintendo/GBHawk/Mappers/Mapper_HuC3.cs | 21 +++++++++ .../Nintendo/GBHawk/Mappers/Mapper_MBC1.cs | 41 +++++++++++++++++ .../GBHawk/Mappers/Mapper_MBC1_Multi.cs | 41 +++++++++++++++++ .../Nintendo/GBHawk/Mappers/Mapper_MBC2.cs | 26 +++++++++++ .../Nintendo/GBHawk/Mappers/Mapper_MBC3.cs | 46 ++++++++++++++++++- .../Nintendo/GBHawk/Mappers/Mapper_MBC6.cs | 21 +++++++++ .../Nintendo/GBHawk/Mappers/Mapper_MBC7.cs | 33 +++++++++++++ .../Nintendo/GBHawk/Mappers/Mapper_MMM01.cs | 21 +++++++++ .../GBHawk/Mappers/Mapper_RockMan8.cs | 20 ++++++++ .../GBHawk/Mappers/Mapper_Sachen_MMC1.cs | 39 ++++++++++++++++ .../GBHawk/Mappers/Mapper_Sachen_MMC2.cs | 40 ++++++++++++++++ .../Nintendo/GBHawk/Mappers/Mapper_TAMA5.cs | 21 +++++++++ .../GBHawk/Mappers/Mapper_WisdomTree.cs | 14 ++++++ 16 files changed, 468 insertions(+), 1 deletion(-) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Camera.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Camera.cs index b6ad35bb1b..d5e0be860c 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Camera.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Camera.cs @@ -2,6 +2,8 @@ using BizHawk.Common.NumberExtensions; using System; +using BizHawk.Emulation.Common.Components.LR35902; + namespace BizHawk.Emulation.Cores.Nintendo.GBHawk { // Default mapper with no bank switching @@ -31,6 +33,25 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk } } + public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags) + { + if (addr < 0x8000) + { + SetCDLROM(flags, addr); + } + else + { + if (Core.cart_RAM != null) + { + SetCDLRAM(flags, addr - 0xA000); + } + else + { + return; + } + } + } + public override byte PeekMemory(ushort addr) { return ReadMemory(addr); diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Default.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Default.cs index 2df4c92454..77a73c0602 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Default.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Default.cs @@ -2,6 +2,8 @@ using BizHawk.Common.NumberExtensions; using System; +using BizHawk.Emulation.Common.Components.LR35902; + namespace BizHawk.Emulation.Cores.Nintendo.GBHawk { // Default mapper with no bank switching @@ -31,6 +33,25 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk } } + public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags) + { + if (addr < 0x8000) + { + SetCDLROM(flags, addr); + } + else + { + if (Core.cart_RAM != null) + { + SetCDLRAM(flags, addr - 0xA000); + } + else + { + return; + } + } + } + public override byte PeekMemory(ushort addr) { return ReadMemory(addr); diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_HuC1.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_HuC1.cs index 6f63e13541..61f015b5a1 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_HuC1.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_HuC1.cs @@ -2,6 +2,8 @@ using BizHawk.Common.NumberExtensions; using System; +using BizHawk.Emulation.Common.Components.LR35902; + namespace BizHawk.Emulation.Cores.Nintendo.GBHawk { // hudson mapper used in ex Daikaijuu monogatari @@ -75,6 +77,47 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk } } + public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags) + { + if (addr < 0x4000) + { + SetCDLROM(flags, addr); + } + else if (addr < 0x8000) + { + SetCDLROM(flags, (addr - 0x4000) + ROM_bank * 0x4000); + } + else if ((addr >= 0xA000) && (addr < 0xC000)) + { + if (RAM_enable) + { + if (Core.cart_RAM != null) + { + if (((addr - 0xA000) + RAM_bank * 0x2000) < Core.cart_RAM.Length) + { + SetCDLRAM(flags, (addr - 0xA000) + RAM_bank * 0x2000); + } + else + { + return; + } + } + else + { + return; + } + } + else + { + return; + } + } + else + { + return; + } + } + public override byte PeekMemory(ushort addr) { return ReadMemory(addr); diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_HuC3.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_HuC3.cs index 0daf88475a..0c16a29779 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_HuC3.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_HuC3.cs @@ -2,6 +2,8 @@ using BizHawk.Common.NumberExtensions; using System; +using BizHawk.Emulation.Common.Components.LR35902; + namespace BizHawk.Emulation.Cores.Nintendo.GBHawk { // Default mapper with no bank switching @@ -31,6 +33,25 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk } } + public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags) + { + if (addr < 0x8000) + { + SetCDLROM(flags, addr); + } + else + { + if (Core.cart_RAM != null) + { + SetCDLRAM(flags, addr - 0xA000); + } + else + { + return; + } + } + } + public override byte PeekMemory(ushort addr) { return ReadMemory(addr); diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC1.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC1.cs index 039dd1842e..e2b280ddff 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC1.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC1.cs @@ -2,6 +2,8 @@ using BizHawk.Common.NumberExtensions; using System; +using BizHawk.Emulation.Common.Components.LR35902; + namespace BizHawk.Emulation.Cores.Nintendo.GBHawk { // MBC1 with bank switching and RAM @@ -72,6 +74,45 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk } } + public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags) + { + if (addr < 0x4000) + { + // lowest bank is fixed, but is still effected by mode + if (sel_mode) + { + SetCDLROM(flags, (ROM_bank & 0x60) * 0x4000 + addr); + } + else + { + SetCDLROM(flags, addr); + } + } + else if (addr < 0x8000) + { + SetCDLROM(flags, (addr - 0x4000) + ROM_bank * 0x4000); + } + else + { + if (Core.cart_RAM != null) + { + if (RAM_enable && (((addr - 0xA000) + RAM_bank * 0x2000) < Core.cart_RAM.Length)) + { + SetCDLRAM(flags, (addr - 0xA000) + RAM_bank * 0x2000); + } + else + { + return; + } + + } + else + { + return; + } + } + } + public override byte PeekMemory(ushort addr) { return ReadMemory(addr); diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC1_Multi.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC1_Multi.cs index d72112aa40..8a01891cb3 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC1_Multi.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC1_Multi.cs @@ -2,6 +2,8 @@ using BizHawk.Common.NumberExtensions; using System; +using BizHawk.Emulation.Common.Components.LR35902; + namespace BizHawk.Emulation.Cores.Nintendo.GBHawk { // MBC1 with bank switching and RAM @@ -68,6 +70,45 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk } } + public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags) + { + if (addr < 0x4000) + { + // lowest bank is fixed, but is still effected by mode + if (sel_mode) + { + SetCDLROM(flags, ((ROM_bank & 0x60) >> 1) * 0x4000 + addr); + } + else + { + SetCDLROM(flags, addr); + } + } + else if (addr < 0x8000) + { + SetCDLROM(flags, (addr - 0x4000) + (((ROM_bank & 0x60) >> 1) | (ROM_bank & 0xF)) * 0x4000); + } + else + { + if (Core.cart_RAM != null) + { + if (RAM_enable && (((addr - 0xA000) + RAM_bank * 0x2000) < Core.cart_RAM.Length)) + { + SetCDLRAM(flags, (addr - 0xA000) + RAM_bank * 0x2000); + } + else + { + return; + } + + } + else + { + return; + } + } + } + public override byte PeekMemory(ushort addr) { return ReadMemory(addr); diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC2.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC2.cs index 7510d00522..51537b6cbc 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC2.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC2.cs @@ -2,6 +2,8 @@ using BizHawk.Common.NumberExtensions; using System; +using BizHawk.Emulation.Common.Components.LR35902; + namespace BizHawk.Emulation.Cores.Nintendo.GBHawk { // MBC2 with bank switching and RAM @@ -44,6 +46,30 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk } } + public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags) + { + if (addr < 0x4000) + { + SetCDLROM(flags, addr); + } + else if (addr < 0x8000) + { + SetCDLROM(flags, (addr - 0x4000) + ROM_bank * 0x4000); + } + else if ((addr >= 0xA000) && (addr < 0xA200)) + { + if (RAM_enable) + { + SetCDLRAM(flags, addr - 0xA000); + } + return; + } + else + { + return; + } + } + public override byte PeekMemory(ushort addr) { return ReadMemory(addr); diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC3.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC3.cs index e0649675ab..8d77992172 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC3.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC3.cs @@ -2,6 +2,8 @@ using BizHawk.Common.NumberExtensions; using System; +using BizHawk.Emulation.Common.Components.LR35902; + namespace BizHawk.Emulation.Cores.Nintendo.GBHawk { // MBC3 mapper with Real Time Clock @@ -79,7 +81,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk { return 0xFF; } - } + } else { return 0xFF; @@ -87,6 +89,48 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk } } + public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags) + { + if (addr < 0x4000) + { + SetCDLROM(flags, addr); + } + else if (addr < 0x8000) + { + SetCDLROM(flags, (addr - 0x4000) + ROM_bank * 0x4000); + } + else + { + if (RAM_enable) + { + if ((Core.cart_RAM != null) && (RAM_bank < 3)) + { + if (((addr - 0xA000) + RAM_bank * 0x2000) < Core.cart_RAM.Length) + { + SetCDLRAM(flags, (addr - 0xA000) + RAM_bank * 0x2000); + } + else + { + return; + } + } + + if ((RAM_bank >= 8) && (RAM_bank < 0xC)) + { + return; + } + else + { + return; + } + } + else + { + return; + } + } + } + public override byte PeekMemory(ushort addr) { return ReadMemory(addr); diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC6.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC6.cs index 5cbdd331ff..84ce6bbba2 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC6.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC6.cs @@ -2,6 +2,8 @@ using BizHawk.Common.NumberExtensions; using System; +using BizHawk.Emulation.Common.Components.LR35902; + namespace BizHawk.Emulation.Cores.Nintendo.GBHawk { // Default mapper with no bank switching @@ -31,6 +33,25 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk } } + public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags) + { + if (addr < 0x8000) + { + SetCDLROM(flags, addr); + } + else + { + if (Core.cart_RAM != null) + { + SetCDLRAM(flags, addr - 0xA000); + } + else + { + return; + } + } + } + public override byte PeekMemory(ushort addr) { return ReadMemory(addr); diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC7.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC7.cs index 41b9dd1506..52d4c62ccc 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC7.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC7.cs @@ -2,6 +2,8 @@ using BizHawk.Common.NumberExtensions; using System; +using BizHawk.Emulation.Common.Components.LR35902; + namespace BizHawk.Emulation.Cores.Nintendo.GBHawk { // Mapper with built in EEPROM, also used with Kirby's tilt 'n tumble @@ -81,6 +83,37 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk } } + public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags) + { + if (addr < 0x4000) + { + SetCDLROM(flags, addr); + } + else if (addr < 0x8000) + { + SetCDLROM(flags, (addr - 0x4000) + ROM_bank * 0x4000); + } + else if (addr < 0xA000) + { + return; + } + else if (addr < 0xB000) + { + if (RAM_enable_1 && RAM_enable_2) + { + return; + } + else + { + return; + } + } + else + { + return; + } + } + public override byte PeekMemory(ushort addr) { return ReadMemory(addr); diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MMM01.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MMM01.cs index 0a45601998..5e6364a082 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MMM01.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MMM01.cs @@ -2,6 +2,8 @@ using BizHawk.Common.NumberExtensions; using System; +using BizHawk.Emulation.Common.Components.LR35902; + namespace BizHawk.Emulation.Cores.Nintendo.GBHawk { // Default mapper with no bank switching @@ -31,6 +33,25 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk } } + public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags) + { + if (addr < 0x8000) + { + SetCDLROM(flags, addr); + } + else + { + if (Core.cart_RAM != null) + { + SetCDLRAM(flags, addr - 0xA000); + } + else + { + return; + } + } + } + public override byte PeekMemory(ushort addr) { return ReadMemory(addr); diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_RockMan8.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_RockMan8.cs index a45175f84e..845074051d 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_RockMan8.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_RockMan8.cs @@ -2,6 +2,8 @@ using BizHawk.Common.NumberExtensions; using System; +using BizHawk.Emulation.Common.Components.LR35902; + namespace BizHawk.Emulation.Cores.Nintendo.GBHawk { // RockMan 8, just some simple bankswitching @@ -37,6 +39,24 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk } } + public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags) + { + if (addr < 0x4000) + { + // lowest bank is fixed + SetCDLROM(flags, addr); + + } + else if (addr < 0x8000) + { + SetCDLROM(flags, (addr - 0x4000) + ROM_bank * 0x4000); + } + else + { + return; + } + } + public override byte PeekMemory(ushort addr) { return ReadMemory(addr); diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Sachen_MMC1.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Sachen_MMC1.cs index c96600a6fd..c568a099e6 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Sachen_MMC1.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Sachen_MMC1.cs @@ -2,6 +2,8 @@ using BizHawk.Common.NumberExtensions; using System; +using BizHawk.Emulation.Common.Components.LR35902; + namespace BizHawk.Emulation.Cores.Nintendo.GBHawk { // Sachen Bootleg Mapper @@ -69,6 +71,43 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk } } + public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags) + { + if (addr < 0x4000) + { + if (locked) + { + // header is scrambled + if ((addr >= 0x100) && (addr < 0x200)) + { + int temp0 = (addr & 1); + int temp1 = (addr & 2); + int temp4 = (addr & 0x10); + int temp6 = (addr & 0x40); + + temp0 = temp0 << 6; + temp1 = temp1 << 3; + temp4 = temp4 >> 3; + temp6 = temp6 >> 6; + + addr &= 0x1AC; + addr |= (ushort)(temp0 | temp1 | temp4 | temp6); + } + addr |= 0x80; + } + + SetCDLROM(flags, addr + BASE_ROM_Bank * 0x4000); + } + else if (addr < 0x8000) + { + SetCDLROM(flags, (addr - 0x4000) + ROM_bank * 0x4000); + } + else + { + return; + } + } + public override byte PeekMemory(ushort addr) { return ReadMemory(addr); diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Sachen_MMC2.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Sachen_MMC2.cs index 29f16a8212..3b0512f61e 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Sachen_MMC2.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Sachen_MMC2.cs @@ -2,6 +2,8 @@ using BizHawk.Common.NumberExtensions; using System; +using BizHawk.Emulation.Common.Components.LR35902; + namespace BizHawk.Emulation.Cores.Nintendo.GBHawk { // Sachen Bootleg Mapper @@ -72,6 +74,44 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk } } + public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags) + { + if (addr < 0x4000) + { + // header is scrambled + if ((addr >= 0x100) && (addr < 0x200)) + { + int temp0 = (addr & 1); + int temp1 = (addr & 2); + int temp4 = (addr & 0x10); + int temp6 = (addr & 0x40); + + temp0 = temp0 << 6; + temp1 = temp1 << 3; + temp4 = temp4 >> 3; + temp6 = temp6 >> 6; + + addr &= 0x1AC; + addr |= (ushort)(temp0 | temp1 | temp4 | temp6); + } + + if (locked_GBC) { addr |= 0x80; } + + SetCDLROM(flags, addr + BASE_ROM_Bank * 0x4000); + } + else if (addr < 0x8000) + { + int temp_bank = (ROM_bank & ~ROM_bank_mask) | (ROM_bank_mask & BASE_ROM_Bank); + temp_bank &= ROM_mask; + + SetCDLROM(flags, (addr - 0x4000) + temp_bank * 0x4000); + } + else + { + return; + } + } + public override byte PeekMemory(ushort addr) { return ReadMemory(addr); diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_TAMA5.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_TAMA5.cs index dc6c6d8d9f..2bbf751e71 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_TAMA5.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_TAMA5.cs @@ -2,6 +2,8 @@ using BizHawk.Common.NumberExtensions; using System; +using BizHawk.Emulation.Common.Components.LR35902; + namespace BizHawk.Emulation.Cores.Nintendo.GBHawk { // Default mapper with no bank switching @@ -31,6 +33,25 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk } } + public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags) + { + if (addr < 0x8000) + { + SetCDLROM(flags, addr); + } + else + { + if (Core.cart_RAM != null) + { + SetCDLRAM(flags, addr - 0xA000); + } + else + { + return; + } + } + } + public override byte PeekMemory(ushort addr) { return ReadMemory(addr); diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_WisdomTree.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_WisdomTree.cs index 9d60fc865c..18566457a5 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_WisdomTree.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_WisdomTree.cs @@ -2,6 +2,8 @@ using BizHawk.Common.NumberExtensions; using System; +using BizHawk.Emulation.Common.Components.LR35902; + namespace BizHawk.Emulation.Cores.Nintendo.GBHawk { // Wisdom tree mapper (32K bank switching) @@ -32,6 +34,18 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk } } + public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags) + { + if (addr < 0x8000) + { + SetCDLROM(flags, ROM_bank * 0x8000 + addr); + } + else + { + return; + } + } + public override byte PeekMemory(ushort addr) { return ReadMemory(addr);