From ce4037fad8b6d532b5c7dfbf9eb1520335b8a205 Mon Sep 17 00:00:00 2001 From: adelikat Date: Tue, 14 Apr 2020 17:15:46 -0500 Subject: [PATCH] cleanup PopulateWithDefaultHeaderValues() --- .../conversions/MovieConversionExtensions.cs | 33 ++++++++++--------- .../Consoles/Nintendo/GBHawk/GBHawk.cs | 2 +- .../Consoles/Sega/PicoDrive/PicoDrive.cs | 4 ++- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/BizHawk.Client.Common/movie/conversions/MovieConversionExtensions.cs b/BizHawk.Client.Common/movie/conversions/MovieConversionExtensions.cs index 2b2b398446..6d346bbac4 100644 --- a/BizHawk.Client.Common/movie/conversions/MovieConversionExtensions.cs +++ b/BizHawk.Client.Common/movie/conversions/MovieConversionExtensions.cs @@ -331,37 +331,40 @@ namespace BizHawk.Client.Common.MovieConversionExtensions } } - if (Global.Emulator is GBHawk && ((GBHawk)Global.Emulator).is_GBC) + if (Global.Emulator is GBHawk gbHawk && gbHawk.IsCGBMode()) { movie.HeaderEntries.Add("IsCGBMode", "1"); } - if (Global.Emulator is Gameboy && ((Gameboy) Global.Emulator).IsCGBMode()) + if (Global.Emulator is Gameboy gb) { - movie.HeaderEntries.Add("IsCGBMode", "1"); - } + if (gb.IsCGBMode()) + { + movie.HeaderEntries.Add("IsCGBMode", "1"); + } - if (Global.Emulator is Gameboy) - { movie.HeaderEntries.Add(HeaderKeys.CycleCount, "0"); } - if (Global.Emulator is SMS && ((SMS) Global.Emulator).IsSG1000) + if (Global.Emulator is SMS sms) { - movie.HeaderEntries.Add("IsSGMode", "1"); + if (sms.IsSG1000) + { + movie.HeaderEntries.Add("IsSGMode", "1"); + } + + if (sms.IsGameGear) + { + movie.HeaderEntries.Add("IsGGMode", "1"); + } } - if (Global.Emulator is SMS && ((SMS) Global.Emulator).IsGameGear) - { - movie.HeaderEntries.Add("IsGGMode", "1"); - } - - if (Global.Emulator is GPGX && ((GPGX) Global.Emulator).IsMegaCD) + if (Global.Emulator is GPGX gpgx && gpgx.IsMegaCD) { movie.HeaderEntries.Add("IsSegaCDMode", "1"); } - if (Global.Emulator is PicoDrive && Global.Game["32X"]) + if (Global.Emulator is PicoDrive pico && pico.Is32XActive) { movie.HeaderEntries.Add("Is32X", "1"); } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.cs index 0948fe37f9..98e17d5825 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.cs @@ -49,7 +49,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk public int RAM_Bank; public byte VRAM_Bank; - public bool is_GBC; + internal bool is_GBC; public bool GBC_compat; // compatibility mode for GB games played on GBC public bool double_speed; public bool speed_switch; diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/PicoDrive/PicoDrive.cs b/BizHawk.Emulation.Cores/Consoles/Sega/PicoDrive/PicoDrive.cs index 2280dae276..71c100e7b6 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/PicoDrive/PicoDrive.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/PicoDrive/PicoDrive.cs @@ -118,9 +118,11 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.PicoDrive _isPal = _core.IsPal(); VsyncNumerator = _isPal ? 53203424 : 53693175; VsyncDenominator = _isPal ? 3420 * 313 : 3420 * 262; + + Is32XActive = game["32X"]; } - public bool Is32xActive => _core.Is32xActive(); + public bool Is32XActive { get; } public static readonly ControllerDefinition PicoDriveController = new ControllerDefinition {