allow setting OSD message duration for its callbacks
todo: simulate optional args for Action?
This commit is contained in:
parent
b4394af824
commit
76a29d3563
|
@ -6,7 +6,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
public interface IDialogController
|
public interface IDialogController
|
||||||
{
|
{
|
||||||
void AddOnScreenMessage(string message);
|
void AddOnScreenMessage(string message, int? duration = null);
|
||||||
|
|
||||||
/// <summary>Creates and shows a <c>System.Windows.Forms.OpenFileDialog</c> or equivalent</summary>
|
/// <summary>Creates and shows a <c>System.Windows.Forms.OpenFileDialog</c> or equivalent</summary>
|
||||||
/// <param name="dialogParent">parent window</param>
|
/// <param name="dialogParent">parent window</param>
|
||||||
|
|
|
@ -105,7 +105,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
// For not throwing errors but simply outputting information to the screen
|
// For not throwing errors but simply outputting information to the screen
|
||||||
public Action<string> MessageCallback { get; set; }
|
public Action<string, int?> MessageCallback { get; set; }
|
||||||
|
|
||||||
// TODO: reconsider the need for exposing these;
|
// TODO: reconsider the need for exposing these;
|
||||||
public IEmulator LoadedEmulator { get; private set; }
|
public IEmulator LoadedEmulator { get; private set; }
|
||||||
|
|
|
@ -976,7 +976,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool DisableSecondaryThrottling { get; set; }
|
public static bool DisableSecondaryThrottling { get; set; }
|
||||||
|
|
||||||
public void AddOnScreenMessage(string message) => OSD.AddMessage(message);
|
public void AddOnScreenMessage(string message, int? duration = null) => OSD.AddMessage(message, duration);
|
||||||
|
|
||||||
public void ClearHolds()
|
public void ClearHolds()
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace BizHawk.Emulation.Common
|
||||||
{
|
{
|
||||||
public CoreComm(
|
public CoreComm(
|
||||||
Action<string> showMessage,
|
Action<string> showMessage,
|
||||||
Action<string> notifyMessage,
|
Action<string, int?> notifyMessage,
|
||||||
ICoreFileProvider coreFileProvider,
|
ICoreFileProvider coreFileProvider,
|
||||||
CorePreferencesFlags prefs
|
CorePreferencesFlags prefs
|
||||||
)
|
)
|
||||||
|
@ -33,7 +33,7 @@ namespace BizHawk.Emulation.Common
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a message to show. less annoying (OSD message). Should be used for ignorable helpful messages
|
/// Gets a message to show. less annoying (OSD message). Should be used for ignorable helpful messages
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Action<string> Notify { get; }
|
public Action<string, int?> Notify { get; }
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum CorePreferencesFlags
|
public enum CorePreferencesFlags
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
|
@ -33,7 +34,7 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
|
||||||
_infoCallback = info =>
|
_infoCallback = info =>
|
||||||
{
|
{
|
||||||
var text = info.Replace(". ", "\n").Replace("\n\n", "\n");
|
var text = info.Replace(". ", "\n").Replace("\n\n", "\n");
|
||||||
lp.Comm.Notify(text);
|
lp.Comm.Notify(text, 4 * Regex.Matches(text, "\n").Count);
|
||||||
RomDetails =
|
RomDetails =
|
||||||
_gameFullName + "\r\n\r\n" +
|
_gameFullName + "\r\n\r\n" +
|
||||||
text + (text == "" ? "" : "\r\n") +
|
text + (text == "" ? "" : "\r\n") +
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreComm.Notify(sb.ToString());
|
CoreComm.Notify(sb.ToString(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreComm.Notify(sb.ToString());
|
CoreComm.Notify(sb.ToString(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -52,7 +52,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
{
|
{
|
||||||
if (!DeterministicEmulation)
|
if (!DeterministicEmulation)
|
||||||
{
|
{
|
||||||
CoreComm.Notify("Forcing Deterministic Emulation");
|
CoreComm.Notify("Forcing Deterministic Emulation", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeterministicEmulation = lp.DeterministicEmulationRequested;
|
DeterministicEmulation = lp.DeterministicEmulationRequested;
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Sameboy
|
||||||
{
|
{
|
||||||
_curTrack--;
|
_curTrack--;
|
||||||
LibSameboy.sameboy_switchgbstrack(SameboyState, _curTrack);
|
LibSameboy.sameboy_switchgbstrack(SameboyState, _curTrack);
|
||||||
Comm.Notify($"Switching to Track {_curTrack}");
|
Comm.Notify($"Switching to Track {_curTrack}", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (nextTrack)
|
else if (nextTrack)
|
||||||
|
@ -56,7 +56,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Sameboy
|
||||||
{
|
{
|
||||||
_curTrack++;
|
_curTrack++;
|
||||||
LibSameboy.sameboy_switchgbstrack(SameboyState, _curTrack);
|
LibSameboy.sameboy_switchgbstrack(SameboyState, _curTrack);
|
||||||
Comm.Notify($"Switching to Track {_curTrack}");
|
Comm.Notify($"Switching to Track {_curTrack}", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
||||||
if (game["PAL"] && Region != DisplayType.PAL)
|
if (game["PAL"] && Region != DisplayType.PAL)
|
||||||
{
|
{
|
||||||
Region = DisplayType.PAL;
|
Region = DisplayType.PAL;
|
||||||
comm.Notify("Display was forced to PAL mode for game compatibility.");
|
comm.Notify("Display was forced to PAL mode for game compatibility.", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsGameGear)
|
if (IsGameGear)
|
||||||
|
@ -65,13 +65,13 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
||||||
if (game["Japan"] && _region != SmsSyncSettings.Regions.Japan)
|
if (game["Japan"] && _region != SmsSyncSettings.Regions.Japan)
|
||||||
{
|
{
|
||||||
_region = SmsSyncSettings.Regions.Japan;
|
_region = SmsSyncSettings.Regions.Japan;
|
||||||
comm.Notify("Region was forced to Japan for game compatibility.");
|
comm.Notify("Region was forced to Japan for game compatibility.", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (game["Korea"] && _region != SmsSyncSettings.Regions.Korea)
|
if (game["Korea"] && _region != SmsSyncSettings.Regions.Korea)
|
||||||
{
|
{
|
||||||
_region = SmsSyncSettings.Regions.Korea;
|
_region = SmsSyncSettings.Regions.Korea;
|
||||||
comm.Notify("Region was forced to Korea for game compatibility.");
|
comm.Notify("Region was forced to Korea for game compatibility.", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((game.NotInDatabase || game["FM"]) && SyncSettings.EnableFm && !IsGameGear)
|
if ((game.NotInDatabase || game["FM"]) && SyncSettings.EnableFm && !IsGameGear)
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace BizHawk.Emulation.Cores.Libretro
|
||||||
|
|
||||||
private LibretroApi.retro_message retro_msg = default;
|
private LibretroApi.retro_message retro_msg = default;
|
||||||
|
|
||||||
private readonly Action<string> _notify;
|
private readonly Action<string, int?> _notify;
|
||||||
|
|
||||||
private void FrameAdvancePrep(IController controller)
|
private void FrameAdvancePrep(IController controller)
|
||||||
{
|
{
|
||||||
|
@ -55,7 +55,7 @@ namespace BizHawk.Emulation.Cores.Libretro
|
||||||
if (retro_msg.frames > 0)
|
if (retro_msg.frames > 0)
|
||||||
{
|
{
|
||||||
// TODO: pass frames for duration?
|
// TODO: pass frames for duration?
|
||||||
_notify(Mershul.PtrToStringUtf8(retro_msg.msg));
|
_notify(Mershul.PtrToStringUtf8(retro_msg.msg), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
Frame++;
|
Frame++;
|
||||||
|
|
Loading…
Reference in New Issue