Update Gambatte (GB Camera Support, Misc Cleanup) (#2897)

* update gambatte (camera support, misc cleanup)

* linux build

* misc

* [Gambatte] fix resets (oops)

* this didn't complain on my side but w/e ig
This commit is contained in:
CasualPokePlayer 2021-08-07 14:50:16 -07:00 committed by GitHub
parent a6e36b30be
commit d37a818f96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 27 additions and 8 deletions

Binary file not shown.

Binary file not shown.

View File

@ -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() && (!gb.IsCGBDMGMode() || ss.EnableBIOS);
dlg.gbPrefControl1.ColorGameBoy = gb.IsCGBMode();
if (mainForm.ShowDialogAsChild(dlg).IsOk())
{
dlg.gbPrefControl1.GetSettings(out s, out ss);

View File

@ -19,7 +19,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
{
_settings = o;
_disassembler.UseRGBDSSyntax = _settings.RgbdsSyntax;
if (IsCGBMode() && (!IsCGBDMGMode() || _syncSettings.EnableBIOS))
if (IsCGBMode())
{
SetCGBColors(_settings.CGBColors);
}

View File

@ -147,7 +147,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
{
cgbDmgColors = ColorsFromTitleHash(file);
}
_settings.GBPalette = cgbDmgColors;
ChangeDMGColors(cgbDmgColors);
}
@ -329,7 +328,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
if (controller.IsPressed("Power"))
{
LibGambatte.gambatte_reset(GambatteState);
bool stall = _syncSettings.EnableBIOS && (_syncSettings.ConsoleMode is GambatteSyncSettings.ConsoleModeType.GBA); // GBA takes 971616 cycles to switch to CGB mode; CGB CPU is inactive during this time.
LibGambatte.gambatte_reset(GambatteState, stall ? 485808u : 0u);
}
if (Tracer.IsEnabled())
@ -382,8 +382,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
case 0x1C: return "MBC5 ROM+RUMBLE"; // = MBC5; break;
case 0x1D: return "MBC5 ROM+RUMBLE+RAM"; // = MBC5; break;
case 0x1E: return "MBC5 ROM+RUMBLE+RAM+BATTERY"; // = MBC5; break;
case 0xFC: return "Pocket Camera ROM+RAM+BATTERY"; // = POCKETCAMERA; break
case 0xFE: return "HuC3 ROM+RAM+BATTERY"; // = HUC3; break;
case 0xFF: return "HuC1 ROM+RAM+BATTERY"; // = HUC1; break;
case 0xFE: return "HuC3 ROM+RAM+BATTERY";
default: return "UNKNOWN";
}
}
@ -429,7 +430,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
case 0x20: throw new UnsupportedGameException("\"MBC6\" Mapper not supported!");
case 0x22: throw new UnsupportedGameException("\"MBC7\" Mapper not supported!");
case 0xfc: throw new UnsupportedGameException("\"Pocket Camera\" Mapper not supported!");
case 0xfc: break;
case 0xfd: throw new UnsupportedGameException("\"Bandai TAMA5\" Mapper not supported!");
case 0xfe: break;
case 0xff: break;

View File

@ -111,8 +111,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
/// Equivalent to reloading a ROM image, or turning a Game Boy Color off and on again.
/// </summary>
/// <param name="core">opaque state pointer</param>
/// <param name="samplesToStall">samples of reset stall</param>
[DllImport("libgambatte", CallingConvention = CallingConvention.Cdecl)]
public static extern void gambatte_reset(IntPtr core);
public static extern void gambatte_reset(IntPtr core, uint samplesToStall);
/// <summary>
/// palette type for gambatte_setdmgpalettecolor
@ -265,6 +266,23 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
[DllImport("libgambatte", CallingConvention = CallingConvention.Cdecl)]
public static extern void gambatte_setlinkcallback(IntPtr core, LinkCallback callback);
/// <summary>
/// type of the camera data request callback
/// </summary>
/// <param name="cameraBuf">pointer to camera buffer</param>
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool CameraCallback(IntPtr cameraBuf);
/// <summary>
/// sets the camera data request callback.
/// the callback will receive the pointer to the buffer.
/// a 128x112 rgb32 image should be copied to the buffer, with success returned.
/// </summary>
/// <param name="core">opaque state pointer</param>
/// <param name="callback">the callback</param>
[DllImport("libgambatte", CallingConvention = CallingConvention.Cdecl)]
public static extern void gambatte_setcameracallback(IntPtr core, CameraCallback callback);
/// <summary>
/// Changes between cycle-based and real-time RTC. Defaults to cycle-based.
/// </summary>

@ -1 +1 @@
Subproject commit b1ba962eb39c4e29569764b6d639cb044349f95f
Subproject commit 7ef069716d3589fad7ab156979e18e13fffd0151