This commit is contained in:
cah4e3 2018-11-15 11:45:52 +03:00
commit 9955b43c0a
27 changed files with 763 additions and 38 deletions

View File

@ -100,17 +100,10 @@ namespace BizHawk.Client.Common
return Environment.SpecialFolder.Recent.ToString();
}
if (path.Length >= 5 && path.Substring(0, 5) == "%exe%")
{
if (path.Length == 5)
{
return GetExeDirectoryAbsolute();
}
var tmp = path.Remove(0, 5);
tmp = tmp.Insert(0, GetExeDirectoryAbsolute());
return tmp;
}
if (path.StartsWith("%exe%"))
return GetExeDirectoryAbsolute() + path.Substring(5);
if (path.StartsWith("%rom%"))
return Global.Config.LastRomPath + path.Substring(5);
if (path[0] == '.')
{

View File

@ -128,14 +128,14 @@ namespace BizHawk.Client.Common
private static string ResolveToolsPath(string subPath)
{
if (Path.IsPathRooted(subPath))
if (Path.IsPathRooted(subPath) || subPath.StartsWith("%"))
{
return subPath;
}
var toolsPath = Global.Config.PathEntries["Global", "Tools"].Path;
// Hack for backwards compabitilbity, preior to 1.11.5, .wch files were in .\Tools, we don't want that to turn into .Tools\Tools
// Hack for backwards compatibility, prior to 1.11.5, .wch files were in .\Tools, we don't want that to turn into .Tools\Tools
if (subPath == "Tools")
{
return toolsPath;

View File

@ -2133,8 +2133,8 @@ namespace BizHawk.Client.EmuHawk
"Apple II", "*.dsk;*.do;*.po;%ARCH%",
"Virtual Boy", "*.vb;%ARCH%",
"Neo Geo Pocket", "*.ngp;*.ngc;%ARCH%",
"Sinclair ZX Spectrum", "*.tzx;*.tap;*.dsk;*.pzx;*.csw;*.wav;%ARCH%",
"Amstrad CPC", "*.cdt;*.dsk;%ARCH%",
"Sinclair ZX Spectrum", "*.tzx;*.tap;*.dsk;*.pzx;*.csw;*.wav;%ARCH%",
"Amstrad CPC", "*.cdt;*.dsk;%ARCH%",
"All Files", "*.*");
}
@ -2164,8 +2164,8 @@ namespace BizHawk.Client.EmuHawk
"Virtual Boy", "*.vb;%ARCH%",
"Neo Geo Pocket", "*.ngp;*.ngc;%ARCH%",
"Commodore 64", "*.prg; *.d64, *.g64; *.crt; *.tap;%ARCH%",
"Sinclair ZX Spectrum", "*.tzx;*.tap;*.dsk;*.pzx;*.csw;*.wav;%ARCH%",
"All Files", "*.*");
"Sinclair ZX Spectrum", "*.tzx;*.tap;*.dsk;*.pzx;*.csw;*.wav;%ARCH%",
"All Files", "*.*");
}
}
@ -2186,7 +2186,6 @@ namespace BizHawk.Client.EmuHawk
}
var file = new FileInfo(ofd.FileName);
Global.Config.LastRomPath = file.DirectoryName;
_lastOpenRomFilter = ofd.FilterIndex;
var lra = new LoadRomArgs { OpenAdvanced = new OpenAdvanced_OpenRom { Path = file.FullName } };
@ -3550,8 +3549,16 @@ namespace BizHawk.Client.EmuHawk
private LoadRomArgs _currentLoadRomArgs;
// Still needs a good bit of refactoring
public bool LoadRom(string path, LoadRomArgs args)
{
bool ret = _LoadRom(path, args);
if(!ret) return false;
Global.Config.LastRomPath = Path.GetFullPath(Path.GetDirectoryName(path));
return true;
}
// Still needs a good bit of refactoring
public bool _LoadRom(string path, LoadRomArgs args)
{
path = HawkFile.Util_ResolveLink(path);
@ -3696,7 +3703,7 @@ namespace BizHawk.Client.EmuHawk
}
}
if (Emulator is TI83 && Global.Config.TI83autoloadKeyPad)
if (Emulator is TI83 && Global.Config.TI83autoloadKeyPad)
{
GlobalWin.Tools.Load<TI83KeyPad>();
}
@ -3725,15 +3732,15 @@ namespace BizHawk.Client.EmuHawk
}
}
if (Emulator.CoreComm.RomStatusDetails == null && loader.Rom != null)
{
Emulator.CoreComm.RomStatusDetails = $"{loader.Game.Name}\r\nSHA1:{loader.Rom.RomData.HashSHA1()}\r\nMD5:{loader.Rom.RomData.HashMD5()}\r\n";
}
else if (Emulator.CoreComm.RomStatusDetails == null && loader.Rom == null)
{
// single disc game
Emulator.CoreComm.RomStatusDetails = $"{loader.Game.Name}\r\nSHA1:N/A\r\nMD5:N/A\r\n";
}
if (Emulator.CoreComm.RomStatusDetails == null && loader.Rom != null)
{
Emulator.CoreComm.RomStatusDetails = $"{loader.Game.Name}\r\nSHA1:{loader.Rom.RomData.HashSHA1()}\r\nMD5:{loader.Rom.RomData.HashMD5()}\r\n";
}
else if (Emulator.CoreComm.RomStatusDetails == null && loader.Rom == null)
{
// single disc game
Emulator.CoreComm.RomStatusDetails = $"{loader.Game.Name}\r\nSHA1:N/A\r\nMD5:N/A\r\n";
}
if (Emulator.HasBoardInfo())
{

View File

@ -33,6 +33,7 @@ namespace BizHawk.Client.EmuHawk
{
"%recent%",
"%exe%",
"%rom%",
".\\",
"..\\",
};

View File

@ -720,6 +720,7 @@
</Compile>
<Compile Include="Consoles\Nintendo\GBA\VBARegisterHelper.cs" />
<Compile Include="Consoles\Nintendo\GBHawk\Audio.cs" />
<Compile Include="Consoles\Nintendo\GBHawk\GBHawk.ICodeDataLog.cs" />
<Compile Include="Consoles\Nintendo\GBHawk\Mappers\Mapper_WisdomTree.cs" />
<Compile Include="Consoles\Nintendo\GBHawk\Mappers\Mapper_RockMan8.cs" />
<Compile Include="Consoles\Nintendo\GBHawk\Mappers\Mapper_Sachen_MMC2.cs" />

View File

@ -29,7 +29,7 @@ namespace BizHawk.Emulation.Common.Components.LR35902
public const ushort RLC = 14;
public const ushort RL = 15;
public const ushort RRC = 16;
public const ushort RR = 17;
public const ushort RR = 17;
public const ushort CPL = 18;
public const ushort DA = 19;
public const ushort SCF = 20;
@ -44,7 +44,7 @@ namespace BizHawk.Emulation.Common.Components.LR35902
public const ushort SWAP = 29;
public const ushort BIT = 30;
public const ushort RES = 31;
public const ushort SET = 32;
public const ushort SET = 32;
public const ushort EI = 33;
public const ushort DI = 34;
public const ushort HALT = 35;
@ -108,6 +108,18 @@ namespace BizHawk.Emulation.Common.Components.LR35902
this.WriteMemory = WriteMemory;
}
//a little CDL related stuff
public delegate void DoCDLCallbackType(ushort addr, LR35902.eCDLog_Flags flags);
public DoCDLCallbackType CDLCallback;
public enum eCDLog_Flags
{
eCDLog_Flags_ExecFirst = 1,
eCDLog_Flags_ExecOperand = 2,
eCDLog_Flags_Data = 4,
};
// Execute instructions
public void ExecuteOne(ref byte interrupt_src, byte interrupt_enable)
{
@ -117,7 +129,7 @@ namespace BizHawk.Emulation.Common.Components.LR35902
// do nothing
break;
case OP:
// Read the opcode of the next instruction
// Read the opcode of the next instruction
if (EI_pending > 0 && !CB_prefix)
{
EI_pending--;
@ -148,6 +160,7 @@ namespace BizHawk.Emulation.Common.Components.LR35902
{
if (OnExecFetch != null) OnExecFetch(RegPC);
if (TraceCallback != null && !CB_prefix) TraceCallback(State());
if (CDLCallback != null) CDLCallback(RegPC, eCDLog_Flags.eCDLog_Flags_ExecFirst);
FetchInstruction(ReadMemory(RegPC++));
}
instr_pntr = 0;
@ -333,6 +346,7 @@ namespace BizHawk.Emulation.Common.Components.LR35902
{
if (OnExecFetch != null) OnExecFetch(RegPC);
if (TraceCallback != null && !CB_prefix) TraceCallback(State());
if (CDLCallback != null) CDLCallback(RegPC, eCDLog_Flags.eCDLog_Flags_ExecFirst);
RegPC++;
FetchInstruction(ReadMemory(RegPC));
@ -348,10 +362,11 @@ namespace BizHawk.Emulation.Common.Components.LR35902
OP };
}
}
else
else
{
if (OnExecFetch != null) OnExecFetch(RegPC);
if (TraceCallback != null && !CB_prefix) TraceCallback(State());
if (CDLCallback != null) CDLCallback(RegPC, eCDLog_Flags.eCDLog_Flags_ExecFirst);
if (Halt_bug_3)
{
@ -416,6 +431,7 @@ namespace BizHawk.Emulation.Common.Components.LR35902
stopped = false;
if (OnExecFetch != null) OnExecFetch(RegPC);
if (TraceCallback != null && !CB_prefix) TraceCallback(State());
if (CDLCallback != null) CDLCallback(RegPC, eCDLog_Flags.eCDLog_Flags_ExecFirst);
FetchInstruction(ReadMemory(RegPC++));
instr_pntr = 0;
@ -445,6 +461,7 @@ namespace BizHawk.Emulation.Common.Components.LR35902
stopped = false;
if (OnExecFetch != null) OnExecFetch(RegPC);
if (TraceCallback != null && !CB_prefix) TraceCallback(State());
if (CDLCallback != null) CDLCallback(RegPC, eCDLog_Flags.eCDLog_Flags_ExecFirst);
FetchInstruction(ReadMemory(RegPC++));
instr_pntr = 0;
@ -472,6 +489,7 @@ namespace BizHawk.Emulation.Common.Components.LR35902
case OP_G:
if (OnExecFetch != null) OnExecFetch(RegPC);
if (TraceCallback != null) TraceCallback(State());
if (CDLCallback != null) CDLCallback(RegPC, eCDLog_Flags.eCDLog_Flags_ExecFirst);
FetchInstruction(ReadMemory(RegPC)); // note no increment

View File

@ -7,7 +7,13 @@ namespace BizHawk.Emulation.Common.Components.LR35902
{
public void Read_Func(ushort dest, ushort src_l, ushort src_h)
{
Regs[dest] = ReadMemory((ushort)(Regs[src_l] | (Regs[src_h]) << 8));
ushort addr = (ushort)(Regs[src_l] | (Regs[src_h]) << 8);
if (CDLCallback != null)
{
if (src_l == PCl) CDLCallback(addr, eCDLog_Flags.eCDLog_Flags_ExecOperand);
else CDLCallback(addr, eCDLog_Flags.eCDLog_Flags_Data);
}
Regs[dest] = ReadMemory(addr);
}
// speical read for POP AF that always clears the lower 4 bits of F
@ -18,7 +24,9 @@ namespace BizHawk.Emulation.Common.Components.LR35902
public void Write_Func(ushort dest_l, ushort dest_h, ushort src)
{
WriteMemory((ushort)(Regs[dest_l] | (Regs[dest_h]) << 8), (byte)Regs[src]);
ushort addr = (ushort)(Regs[dest_l] | (Regs[dest_h]) << 8);
if (CDLCallback != null) CDLCallback(addr, eCDLog_Flags.eCDLog_Flags_Data);
WriteMemory(addr, (byte)Regs[src]);
}
public void TR_Func(ushort dest, ushort src)

View File

@ -0,0 +1,181 @@
using System;
using System.IO;
using System.Collections.Generic;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Common.Components.LR35902;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
public partial class GBHawk : ICodeDataLogger
{
private ICodeDataLog _cdl;
public void SetCDL(ICodeDataLog cdl)
{
_cdl = cdl;
if (cdl == null)
this.cpu.CDLCallback = null;
else this.cpu.CDLCallback = DoCDL;
}
public void NewCDL(ICodeDataLog cdl)
{
cdl["ROM"] = new byte[MemoryDomains["ROM"].Size];
cdl["HRAM"] = new byte[MemoryDomains["Zero Page RAM"].Size];
cdl["WRAM"] = new byte[MemoryDomains["Main RAM"].Size];
if (MemoryDomains.Has("Cart RAM"))
{
cdl["CartRAM"] = new byte[MemoryDomains["Cart RAM"].Size];
}
cdl.SubType = "GB";
cdl.SubVer = 0;
}
[FeatureNotImplemented]
void ICodeDataLogger.DisassembleCDL(Stream s, ICodeDataLog cdl)
{
}
public void DoCDL2(LR35902.eCDLog_Flags flags, string type, int cdladdr)
{
if (type == null) return;
_cdl[type][cdladdr] |= (byte)flags;
}
public void DoCDL(ushort addr, LR35902.eCDLog_Flags flags)
{
MemoryCallbacks.CallReads(addr, "System Bus");
addr_access = addr;
if (ppu.DMA_start)
{
// some of gekkio's tests require these to be accessible during DMA
if (addr < 0x8000)
{
if (ppu.DMA_addr < 0x80)
{
return;
}
else
{
mapper.MapCDL(addr, flags);
return;
}
}
else if ((addr >= 0xE000) && (addr < 0xF000))
{
DoCDL2(flags, "WRAM", addr - 0xE000);
}
else if ((addr >= 0xF000) && (addr < 0xFE00))
{
DoCDL2(flags, "WRAM", (RAM_Bank * 0x1000) + (addr - 0xF000));
}
else if ((addr >= 0xFE00) && (addr < 0xFEA0) && ppu.DMA_OAM_access)
{
return;
}
else if ((addr >= 0xFF00) && (addr < 0xFF80)) // The game GOAL! Requires Hardware Regs to be accessible
{
return;
}
else if ((addr >= 0xFF80))
{
DoCDL2(flags, "HRAM", addr - 0xFF80);
}
}
if (addr < 0x900)
{
if (addr < 0x100)
{
// return Either BIOS ROM or Game ROM
if ((GB_bios_register & 0x1) == 0)
{
return;
}
else
{
mapper.MapCDL(addr, flags);
return;
}
}
else if (addr >= 0x200)
{
// return Either BIOS ROM or Game ROM
if (((GB_bios_register & 0x1) == 0) && is_GBC)
{
return;
}
else
{
mapper.MapCDL(addr, flags);
return;
}
}
else
{
mapper.MapCDL(addr, flags);
return;
}
}
else if (addr < 0x8000)
{
mapper.MapCDL(addr, flags);
return;
}
else if (addr < 0xA000)
{
return;
}
else if (addr < 0xC000)
{
mapper.MapCDL(addr, flags);
return;
}
else if (addr < 0xD000)
{
return;
}
else if (addr < 0xE000)
{
DoCDL2(flags, "WRAM", (RAM_Bank * 0x1000) + (addr - 0xD000));
}
else if (addr < 0xF000)
{
DoCDL2(flags, "WRAM", addr - 0xE000);
}
else if (addr < 0xFE00)
{
DoCDL2(flags, "WRAM", (RAM_Bank * 0x1000) + (addr - 0xF000));
}
else if (addr < 0xFEA0)
{
return;
}
else if (addr < 0xFF00)
{
return;
}
else if (addr < 0xFF80)
{
return;
}
else if (addr < 0xFFFF)
{
DoCDL2(flags, "HRAM", addr - 0xFF80);
}
else
{
return;
}
}
}
}

View File

@ -1,6 +1,8 @@
using BizHawk.Common;
using System;
using BizHawk.Emulation.Common.Components.LR35902;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
public class MapperBase
@ -44,5 +46,19 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
public virtual void RTC_Get(byte value, int index)
{
}
public virtual void MapCDL(ushort addr, LR35902.eCDLog_Flags flags)
{
}
protected void SetCDLROM(LR35902.eCDLog_Flags flags, int cdladdr)
{
Core.DoCDL2(flags, "ROM", cdladdr);
}
protected void SetCDLRAM(LR35902.eCDLog_Flags flags, int cdladdr)
{
Core.DoCDL2(flags, "CartRAM", cdladdr);
}
}
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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
@ -45,7 +47,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
else
{
return Core._rom[addr];
}
}
}
else if (addr < 0x8000)
{
@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -2,6 +2,8 @@
using BizHawk.Common.NumberExtensions;
using System;
using BizHawk.Emulation.Common.Components.LR35902;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
// MBC5, common mapper for GBC games
@ -63,6 +65,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 (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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -133,7 +133,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
else if (addr < 0xFEA0)
{
if (ppu.OAM_access_read) { return OAM[addr - 0xFE00]; }
else { return 0xFF; }
else { return 0xFF; }
}
else if (addr < 0xFF00)
{