From 88467d2fbf068ab3393c7e487e2974359106f0c0 Mon Sep 17 00:00:00 2001 From: nattthebear Date: Sun, 21 Feb 2016 08:54:00 -0500 Subject: [PATCH] mgba layer toggle --- .../Consoles/Nintendo/GBA/LibmGBA.cs | 13 +++++ .../Consoles/Nintendo/GBA/MGBAHawk.cs | 54 ++++++++++++++---- output/dll/mgba.dll | Bin 768000 -> 768000 bytes 3 files changed, 57 insertions(+), 10 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/LibmGBA.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/LibmGBA.cs index ace3823951..5de892aa57 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/LibmGBA.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/LibmGBA.cs @@ -60,5 +60,18 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA public static extern void BizGetState(IntPtr ctx, byte[] dest); [DllImport(dll, CallingConvention = cc)] public static extern bool BizPutState(IntPtr ctx, byte[] src); + + [Flags] + public enum Layers : int + { + BG0 = 1, + BG1 = 2, + BG2 = 4, + BG3 = 8, + OBJ = 16 + } + + [DllImport(dll, CallingConvention = cc)] + public static extern void BizSetLayerMask(IntPtr ctx, Layers mask); } } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.cs index 20e5874766..e1f7f6ac95 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.cs @@ -12,14 +12,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA { [CoreAttributes("mGBA", "endrift", true, true, "0.4.0", "https://mgba.io/", false)] [ServiceNotApplicable(typeof(IDriveLight), typeof(IRegionable))] - public class MGBAHawk : IEmulator, IVideoProvider, ISyncSoundProvider, IGBAGPUViewable, ISaveRam, IStatable, IInputPollable, ISettable + public class MGBAHawk : IEmulator, IVideoProvider, ISyncSoundProvider, IGBAGPUViewable, ISaveRam, IStatable, IInputPollable, ISettable { IntPtr core; [CoreConstructor("GBA")] - public MGBAHawk(byte[] file, CoreComm comm, SyncSettings syncSettings, bool deterministic) + public MGBAHawk(byte[] file, CoreComm comm, SyncSettings syncSettings, Settings settings, bool deterministic) { _syncSettings = syncSettings ?? new SyncSettings(); + _settings = settings ?? new Settings(); DeterministicEmulation = deterministic; byte[] bios = comm.CoreFileProvider.GetFirmware("GBA", "Bios", false); @@ -150,7 +151,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA { nsamp = this.nsamp; samples = soundbuff; - Console.WriteLine(nsamp); DiscardSamples(); } public void DiscardSamples() @@ -391,9 +391,48 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA return basetime + increment; } - public object GetSettings() + public Settings GetSettings() { - return null; + return _settings.Clone(); + } + + public bool PutSettings(Settings o) + { + LibmGBA.Layers mask = 0; + if (o.DisplayBG0) mask |= LibmGBA.Layers.BG0; + if (o.DisplayBG1) mask |= LibmGBA.Layers.BG1; + if (o.DisplayBG2) mask |= LibmGBA.Layers.BG2; + if (o.DisplayBG3) mask |= LibmGBA.Layers.BG3; + if (o.DisplayOBJ) mask |= LibmGBA.Layers.OBJ; + LibmGBA.BizSetLayerMask(core, mask); + _settings = o; + return false; + } + + private Settings _settings; + + public class Settings + { + [DefaultValue(true)] + public bool DisplayBG0 { get; set; } + [DefaultValue(true)] + public bool DisplayBG1 { get; set; } + [DefaultValue(true)] + public bool DisplayBG2 { get; set; } + [DefaultValue(true)] + public bool DisplayBG3 { get; set; } + [DefaultValue(true)] + public bool DisplayOBJ { get; set; } + + public Settings Clone() + { + return (Settings)MemberwiseClone(); + } + + public Settings() + { + SettingsUtil.SetDefaultValues(this); + } } public SyncSettings GetSyncSettings() @@ -401,11 +440,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA return _syncSettings.Clone(); } - public bool PutSettings(object o) - { - return false; - } - public bool PutSyncSettings(SyncSettings o) { bool ret = SyncSettings.NeedsReboot(o, _syncSettings); diff --git a/output/dll/mgba.dll b/output/dll/mgba.dll index 32883749a7866b15722c5776ca9fc03aa1266088..eef8de93b2c8ee746a2e7813ded4fabc1409c321 100644 GIT binary patch delta 5405 zcma)A30PIt_CM=z4(GsOo@Xv_Q3HoNbMNKcdr?48Ff~BT5fnAe90(k9Ktv>@Ak_7o zGGC?H->l3$R$7#rX0uUB>U)lbL+14PRHXaXx%R&L`hVa5|L*rK*4}&Vz4ltawf5Tk zu=IN0rPup5uk>pF@Uxc2A#6$SmLHR$vZcExyS%0)DW)|GvY@!N2Ij(!)_X7%Dq9D! zn_>Aom)I1Ljx>r)!+{1)+qt$il6wvgw{GRmhli$#OkG>Ur&ay8h%<&(sA49q^+i4b ztgZX`r$W-66`4y{e{;JJbJ|3PVLJ7#vUe2AJli_LJ2T>QTHP>RD<00#awKFLWNl|p zOY1i8G-zx+=52?!TKxqhJk#1=Fo*w?`p0DWee!_TMnMymWEPp)tA2mgbieh0V1VPT zcZ8vkQ9Dq?fg+3r8@?h!2`t3>A`Au{=K4Si>$d`@`9K<+!8Jb658lEf*0|)%AUb{zOWd&ah?QwU?BGMgHdn=pY?;0@B*IqgDGs< zGA#6`Ex*IR`@!Y%!V>C zHg+bC*1%?1fL$7>WQ7?xlj5qzDGAoVEnJoi1JyVslWi00LsEca zcgPpkp|&@dOdjN^tVo&Gn=4@1o}r4;mmBT{U!aeHONCFdpMjeTcW|458xLzyFcP!i z6eCx{ievCYBR7X~*KFdFC?QKtTsa#z8s9f@S~g-do-uJx5H^F%+*nnE`Jo02Hyozp z;}))(2EVp&(XbmYS-A1+s*w*@t{CZA$sR1l!Dem@JGm5JGjrou?@|;k+%Wdk2pnbM zs@TaR@EZ#k#cD_30vq=N+2L>Jas!r?a7;sXQ0>8}(FZ0sqb`%vQBsv>a_QkD$s9MU z@@nJ2in_KcQ7s{N(71Tpxe%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