[Gambatte] Many Updates (#2742)
* don't put isCGBMode for movies where CgbDmg mode is being used * various Gambatte accuracy improvements + proper no BIOS support + tracelogger fixes
This commit is contained in:
parent
2c0c6aa0bb
commit
6432d99feb
|
@ -14,6 +14,8 @@
|
|||
**/ipch/**
|
||||
/Assets/dll/*.exp
|
||||
/Assets/dll/*.lib
|
||||
/Assets/dll/*.iobj
|
||||
/Assets/dll/*.ipdb
|
||||
|
||||
*.ilk
|
||||
*.il
|
||||
|
|
Binary file not shown.
|
@ -264,9 +264,9 @@ namespace BizHawk.Client.Common
|
|||
|
||||
if (emulator is Gameboy gb)
|
||||
{
|
||||
if (gb.IsCGBMode())
|
||||
if (gb.IsCGBMode())
|
||||
{
|
||||
movie.HeaderEntries.Add("IsCGBMode", "1");
|
||||
movie.HeaderEntries.Add(gb.IsCGBDMGMode() ? "IsCGBDMGMode" : "IsCGBMode", "1");
|
||||
}
|
||||
|
||||
movie.HeaderEntries.Add(HeaderKeys.CycleCount, "0");
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
using var dlg = new GBPrefs(mainForm.DialogController);
|
||||
dlg.gbPrefControl1.PutSettings(config, game, movieSession, s, ss);
|
||||
dlg.gbPrefControl1.ColorGameBoy = gb.IsCGBMode();
|
||||
dlg.gbPrefControl1.ColorGameBoy = gb.IsCGBMode() && (!gb.IsCGBDMGMode() || ss.EnableBIOS);
|
||||
if (mainForm.ShowDialogAsChild(dlg).IsOk())
|
||||
{
|
||||
dlg.gbPrefControl1.GetSettings(out s, out ss);
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
{
|
||||
_settings = o;
|
||||
_disassembler.UseRGBDSSyntax = _settings.RgbdsSyntax;
|
||||
if (IsCGBMode())
|
||||
if (IsCGBMode() && (!IsCGBDMGMode() || _syncSettings.EnableBIOS))
|
||||
{
|
||||
SetCGBColors(_settings.CGBColors);
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
public class GambatteSyncSettings
|
||||
{
|
||||
[DisplayName("Use official Nintendo BootROM")]
|
||||
[Description("Uses a provided official BootROM (or \"BIOS\") instead of built-in unofficial firmware. You must provide the BootROM. Should be used for TASing.")]
|
||||
[Description("When false, hacks are used to boot without a BIOS. When true, a provided official BootROM (or \"BIOS\") is used. You must provide the BootROM. Should be used for TASing.")]
|
||||
[DefaultValue(false)]
|
||||
public bool EnableBIOS { get; set; }
|
||||
|
||||
|
|
|
@ -20,12 +20,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
Disassembly =
|
||||
LR35902.Disassemble(
|
||||
(ushort) s[1],
|
||||
addr => LibGambatte.gambatte_cpuread(GambatteState, addr),
|
||||
addr => (addr == (ushort)s[1]) ? (byte)((s[12] >> 16) & 0xFF) : ((addr == (ushort)s[1] + 1) ? (byte)((s[12] >> 8) & 0xFF) : (byte)(s[12] & 0xFF)),
|
||||
_settings.RgbdsSyntax,
|
||||
out _).PadRight(36),
|
||||
RegisterInfo =
|
||||
string.Format(
|
||||
"A:{3:x2} B:{4:x2} C:{5:x2} D:{6:x2} E:{7:x2} F:{8:x2} H:{9:x2} L:{10:x2} LY:{13:x2} SP:{2:x2} {11} Cy:{0}",
|
||||
"A:{3:x2} F:{8:x2} B:{4:x2} C:{5:x2} D:{6:x2} E:{7:x2} H:{9:x2} L:{10:x2} LY:{13:x2} SP:{2:x2} {11} Cy:{0}",
|
||||
s[0],
|
||||
s[1] & 0xffff,
|
||||
s[2] & 0xffff,
|
||||
|
@ -38,7 +38,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
s[9] & 0xff,
|
||||
s[10] & 0xff,
|
||||
s[11] != 0 ? "skip" : "",
|
||||
s[12] & 0xff,
|
||||
s[12] & 0xffffff,
|
||||
s[13] & 0xff)
|
||||
});
|
||||
}
|
||||
|
|
|
@ -71,11 +71,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
flags |= LibGambatte.LoadFlags.MULTICART_COMPAT;
|
||||
}
|
||||
|
||||
if (LibGambatte.gambatte_load(GambatteState, file, (uint)file.Length, flags) != 0)
|
||||
{
|
||||
throw new InvalidOperationException($"{nameof(LibGambatte.gambatte_load)}() returned non-zero (is this not a gb or gbc rom?)");
|
||||
}
|
||||
|
||||
byte[] bios;
|
||||
string biosSystemId;
|
||||
string biosId;
|
||||
|
@ -95,21 +90,19 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
if (_syncSettings.EnableBIOS)
|
||||
{
|
||||
bios = comm.CoreFileProvider.GetFirmware(biosSystemId, biosId, true, "BIOS Not Found, Cannot Load. Change SyncSettings to run without BIOS.");
|
||||
if (LibGambatte.gambatte_loadbios(GambatteState, bios, (uint)bios.Length) != 0)
|
||||
{
|
||||
throw new InvalidOperationException($"{nameof(LibGambatte.gambatte_loadbios)}() returned non-zero (bios error)");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var builtinBios = (biosSystemId, biosId) switch {
|
||||
("GB", "World") => Resources.FastDmgBoot,
|
||||
("GBC", "World") => Resources.FastCgbBoot,
|
||||
("GBC", "AGB") => Resources.FastAgbBoot,
|
||||
(_, _) => throw new Exception("Internal GB Error (BIOS??)"),
|
||||
};
|
||||
bios = BizHawk.Common.Util.DecompressGzipFile(new MemoryStream(builtinBios.Value, false));
|
||||
flags |= LibGambatte.LoadFlags.NO_BIOS;
|
||||
}
|
||||
|
||||
if (LibGambatte.gambatte_loadbios(GambatteState, bios, (uint)bios.Length) != 0)
|
||||
if (LibGambatte.gambatte_load(GambatteState, file, (uint)file.Length, flags) != 0)
|
||||
{
|
||||
throw new InvalidOperationException($"{nameof(LibGambatte.gambatte_loadbios)}() returned non-zero (bios error)");
|
||||
throw new InvalidOperationException($"{nameof(LibGambatte.gambatte_load)}() returned non-zero (is this not a gb or gbc rom?)");
|
||||
}
|
||||
|
||||
// set real default colors (before anyone mucks with them at all)
|
||||
|
@ -259,6 +252,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
//return LibGambatte.gambatte_iscgb(GambatteState);
|
||||
return IsCgb;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// true if the emulator is currently emulating CGB in DMG compatibility mode (NOTE: this mode does not take affect until the bootrom unmaps itself)
|
||||
/// </summary>
|
||||
public bool IsCGBDMGMode()
|
||||
{
|
||||
return LibGambatte.gambatte_iscgbdmg(GambatteState);
|
||||
}
|
||||
|
||||
private InputCallbackSystem _inputCallbacks = new InputCallbackSystem();
|
||||
|
||||
|
|
|
@ -25,7 +25,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
/// <summary>Use GBA intial CPU register values when in CGB mode.</summary>
|
||||
GBA_FLAG = 2,
|
||||
/// <summary>Use heuristics to detect and support some multicart MBCs disguised as MBC1.</summary>
|
||||
MULTICART_COMPAT = 4
|
||||
MULTICART_COMPAT = 4,
|
||||
/// <summary>Use heuristics to boot without a BIOS.</summary>
|
||||
NO_BIOS = 8
|
||||
}
|
||||
|
||||
public enum CDLog_AddrType : int
|
||||
|
@ -284,6 +286,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
[DllImport("libgambatte.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern bool gambatte_iscgb(IntPtr core);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the currently loaded ROM image is treated as having CGB-DMG support.
|
||||
/// </summary>
|
||||
/// <param name="core">opaque state pointer</param>
|
||||
[DllImport("libgambatte.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern bool gambatte_iscgbdmg(IntPtr core);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if a ROM image is loaded.
|
||||
/// </summary>
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit b9a38d535aa17223006e1913b507fc333a10b037
|
||||
Subproject commit b5eab7d3893d009390a90c48fb418df4f52522f2
|
Loading…
Reference in New Issue