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
|
||||
{
|
||||
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>
|
||||
/// <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
|
||||
public Action<string> MessageCallback { get; set; }
|
||||
public Action<string, int?> MessageCallback { get; set; }
|
||||
|
||||
// TODO: reconsider the need for exposing these;
|
||||
public IEmulator LoadedEmulator { get; private set; }
|
||||
|
|
|
@ -976,7 +976,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// </summary>
|
||||
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()
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace BizHawk.Emulation.Common
|
|||
{
|
||||
public CoreComm(
|
||||
Action<string> showMessage,
|
||||
Action<string> notifyMessage,
|
||||
Action<string, int?> notifyMessage,
|
||||
ICoreFileProvider coreFileProvider,
|
||||
CorePreferencesFlags prefs
|
||||
)
|
||||
|
@ -33,7 +33,7 @@ namespace BizHawk.Emulation.Common
|
|||
/// <summary>
|
||||
/// Gets a message to show. less annoying (OSD message). Should be used for ignorable helpful messages
|
||||
/// </summary>
|
||||
public Action<string> Notify { get; }
|
||||
public Action<string, int?> Notify { get; }
|
||||
|
||||
[Flags]
|
||||
public enum CorePreferencesFlags
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
|
@ -33,7 +34,7 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
|
|||
_infoCallback = info =>
|
||||
{
|
||||
var text = info.Replace(". ", "\n").Replace("\n\n", "\n");
|
||||
lp.Comm.Notify(text);
|
||||
lp.Comm.Notify(text, 4 * Regex.Matches(text, "\n").Count);
|
||||
RomDetails =
|
||||
_gameFullName + "\r\n\r\n" +
|
||||
text + (text == "" ? "" : "\r\n") +
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
|||
break;
|
||||
}
|
||||
|
||||
CoreComm.Notify(sb.ToString());
|
||||
CoreComm.Notify(sb.ToString(), null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
break;
|
||||
}
|
||||
|
||||
CoreComm.Notify(sb.ToString());
|
||||
CoreComm.Notify(sb.ToString(), null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
{
|
||||
if (!DeterministicEmulation)
|
||||
{
|
||||
CoreComm.Notify("Forcing Deterministic Emulation");
|
||||
CoreComm.Notify("Forcing Deterministic Emulation", null);
|
||||
}
|
||||
|
||||
DeterministicEmulation = lp.DeterministicEmulationRequested;
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Sameboy
|
|||
{
|
||||
_curTrack--;
|
||||
LibSameboy.sameboy_switchgbstrack(SameboyState, _curTrack);
|
||||
Comm.Notify($"Switching to Track {_curTrack}");
|
||||
Comm.Notify($"Switching to Track {_curTrack}", null);
|
||||
}
|
||||
}
|
||||
else if (nextTrack)
|
||||
|
@ -56,7 +56,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Sameboy
|
|||
{
|
||||
_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)
|
||||
{
|
||||
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)
|
||||
|
@ -65,13 +65,13 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
|||
if (game["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)
|
||||
{
|
||||
_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)
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace BizHawk.Emulation.Cores.Libretro
|
|||
|
||||
private LibretroApi.retro_message retro_msg = default;
|
||||
|
||||
private readonly Action<string> _notify;
|
||||
private readonly Action<string, int?> _notify;
|
||||
|
||||
private void FrameAdvancePrep(IController controller)
|
||||
{
|
||||
|
@ -55,7 +55,7 @@ namespace BizHawk.Emulation.Cores.Libretro
|
|||
if (retro_msg.frames > 0)
|
||||
{
|
||||
// TODO: pass frames for duration?
|
||||
_notify(Mershul.PtrToStringUtf8(retro_msg.msg));
|
||||
_notify(Mershul.PtrToStringUtf8(retro_msg.msg), null);
|
||||
}
|
||||
|
||||
Frame++;
|
||||
|
|
Loading…
Reference in New Issue