Add OSD message notifier to CoreComm

This commit is contained in:
beirich 2014-03-18 03:03:53 +00:00
parent c825720d33
commit c179fd5fd6
8 changed files with 32 additions and 22 deletions

View File

@ -315,7 +315,6 @@ namespace BizHawk.Client.DBMan
if (regionStr.Length > 0) if (regionStr.Length > 0)
romName += " ("+regionStr+")"; romName += " ("+regionStr+")";
string versionStr = "";
if (rom.VersionTags != null) if (rom.VersionTags != null)
{ {
var versions = rom.VersionTags.Split(';'); var versions = rom.VersionTags.Split(';');

View File

@ -149,7 +149,7 @@ namespace BizHawk.Client.EmuHawk
Input.Initialize(); Input.Initialize();
InitControls(); InitControls();
Global.CoreComm = new CoreComm(ShowMessageCoreComm); Global.CoreComm = new CoreComm(ShowMessageCoreComm, NotifyCoreComm);
CoreFileProvider.SyncCoreCommInputSignals(); CoreFileProvider.SyncCoreCommInputSignals();
Global.Emulator = new NullEmulator(Global.CoreComm); Global.Emulator = new NullEmulator(Global.CoreComm);
Global.ActiveController = Global.NullControls; Global.ActiveController = Global.NullControls;
@ -2752,6 +2752,11 @@ namespace BizHawk.Client.EmuHawk
MessageBox.Show(this, e.Message, e.AttemptedCoreLoad + " load warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); MessageBox.Show(this, e.Message, e.AttemptedCoreLoad + " load warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
} }
private void NotifyCoreComm(string message)
{
GlobalWin.OSD.AddMessage(message);
}
// Still needs a good bit of refactoring // Still needs a good bit of refactoring
public bool LoadRom(string path, bool deterministicemulation = false, bool hasmovie = false) public bool LoadRom(string path, bool deterministicemulation = false, bool hasmovie = false)
{ {
@ -2775,7 +2780,7 @@ namespace BizHawk.Client.EmuHawk
// the new settings objects // the new settings objects
CommitCoreSettingsToConfig(); CommitCoreSettingsToConfig();
var nextComm = new CoreComm(ShowMessageCoreComm); var nextComm = new CoreComm(ShowMessageCoreComm, NotifyCoreComm);
CoreFileProvider.SyncCoreCommInputSignals(nextComm); CoreFileProvider.SyncCoreCommInputSignals(nextComm);
var result = loader.LoadRom(path, nextComm); var result = loader.LoadRom(path, nextComm);
@ -2956,7 +2961,7 @@ namespace BizHawk.Client.EmuHawk
CommitCoreSettingsToConfig(); CommitCoreSettingsToConfig();
Global.Emulator.Dispose(); Global.Emulator.Dispose();
Global.CoreComm = new CoreComm(ShowMessageCoreComm); Global.CoreComm = new CoreComm(ShowMessageCoreComm, NotifyCoreComm);
CoreFileProvider.SyncCoreCommInputSignals(); CoreFileProvider.SyncCoreCommInputSignals();
Global.Emulator = new NullEmulator(Global.CoreComm); Global.Emulator = new NullEmulator(Global.CoreComm);
Global.ActiveController = Global.NullControls; Global.ActiveController = Global.NullControls;
@ -2976,7 +2981,7 @@ namespace BizHawk.Client.EmuHawk
if (GlobalWin.Tools.AskSave()) if (GlobalWin.Tools.AskSave())
{ {
CloseGame(clearSram); CloseGame(clearSram);
Global.CoreComm = new CoreComm(ShowMessageCoreComm); Global.CoreComm = new CoreComm(ShowMessageCoreComm, NotifyCoreComm);
CoreFileProvider.SyncCoreCommInputSignals(); CoreFileProvider.SyncCoreCommInputSignals();
Global.Emulator = new NullEmulator(Global.CoreComm); Global.Emulator = new NullEmulator(Global.CoreComm);
Global.Game = GameInfo.GetNullGame(); Global.Game = GameInfo.GetNullGame();

View File

@ -69,7 +69,7 @@ namespace BizHawk.Client.EmuHawk
ldr = new RomLoader(); ldr = new RomLoader();
ldr.OnLoadError += OnLoadError; ldr.OnLoadError += OnLoadError;
ldr.ChooseArchive = ChooseArchive; ldr.ChooseArchive = ChooseArchive;
Comm = new CoreComm(CommMessage); Comm = new CoreComm(CommMessage, CommMessage);
CoreFileProvider.SyncCoreCommInputSignals(Comm); CoreFileProvider.SyncCoreCommInputSignals(Comm);
} }

View File

@ -53,9 +53,15 @@ namespace BizHawk.Emulation.Common
/// </summary> /// </summary>
public Action<string> ShowMessage { get; private set; } public Action<string> ShowMessage { get; private set; }
public CoreComm(Action<string> ShowMessage) /// <summary>
/// show a message. less annoying (OSD message). Should be used for ignorable helpful messages
/// </summary>
public Action<string> Notify { get; private set; }
public CoreComm(Action<string> ShowMessage, Action<string> NotifyMessage)
{ {
this.ShowMessage = ShowMessage; this.ShowMessage = ShowMessage;
this.Notify = NotifyMessage;
} }
} }

View File

@ -46,8 +46,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
GambatteLinkSyncSettings _SyncSettings = (GambatteLinkSyncSettings)SyncSettings ?? GambatteLinkSyncSettings.GetDefaults(); GambatteLinkSyncSettings _SyncSettings = (GambatteLinkSyncSettings)SyncSettings ?? GambatteLinkSyncSettings.GetDefaults();
CoreComm = comm; CoreComm = comm;
L = new Gameboy(new CoreComm(comm.ShowMessage), leftinfo, leftrom, _Settings.L, _SyncSettings.L); L = new Gameboy(new CoreComm(comm.ShowMessage, comm.Notify), leftinfo, leftrom, _Settings.L, _SyncSettings.L);
R = new Gameboy(new CoreComm(comm.ShowMessage), rightinfo, rightrom, _Settings.R, _SyncSettings.R); R = new Gameboy(new CoreComm(comm.ShowMessage, comm.Notify), rightinfo, rightrom, _Settings.R, _SyncSettings.R);
// connect link cable // connect link cable
LibGambatte.gambatte_linkstatus(L.GambatteState, 259); LibGambatte.gambatte_linkstatus(L.GambatteState, 259);

View File

@ -20,7 +20,6 @@ using BizHawk.Emulation.Cores.Components.Z80;
+ Or a "force region to japan if game is only for japan" thing. Which one is better? + Or a "force region to japan if game is only for japan" thing. Which one is better?
+ I confess, Mapper system needs some refactoring and love. But right now I want to get all games to work and THEN refactor it. + I confess, Mapper system needs some refactoring and love. But right now I want to get all games to work and THEN refactor it.
+ Savestate system.... maybe use a zeromus-like system. Except maintain the text-savestate compatibility. Might give up some speed for improved maintainability tho. + Savestate system.... maybe use a zeromus-like system. Except maintain the text-savestate compatibility. Might give up some speed for improved maintainability tho.
+ Make corecomm OSD notifier system
**********************************************************/ **********************************************************/
@ -108,7 +107,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
if (game["PAL"] && DisplayType != DisplayType.PAL) if (game["PAL"] && DisplayType != DisplayType.PAL)
{ {
DisplayType = DisplayType.PAL; DisplayType = DisplayType.PAL;
Console.WriteLine("Display was forced to PAL mode for game compatibility."); // TODO change to corecomm.notify when it exists CoreComm.Notify("Display was forced to PAL mode for game compatibility.");
} }
if (IsGameGear) if (IsGameGear)
DisplayType = DisplayType.NTSC; // all game gears run at 60hz/NTSC mode DisplayType = DisplayType.NTSC; // all game gears run at 60hz/NTSC mode
@ -119,7 +118,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
if (game["Japan"] && Region != "Japan") if (game["Japan"] && Region != "Japan")
{ {
Region = "Japan"; Region = "Japan";
Console.WriteLine("Region was forced to Japan for game compatibility."); // TODO corecomm.notify CoreComm.Notify("Region was forced to Japan for game compatibility.");
} }
if (game.NotInDatabase || game["FM"] && SyncSettings.EnableFM && !IsGameGear) if (game.NotInDatabase || game["FM"] && SyncSettings.EnableFM && !IsGameGear)
@ -190,9 +189,9 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
Port3E = 0xF7; Port3E = 0xF7;
if (BiosRom == null && game["RequireBios"]) if (BiosRom == null && game["RequireBios"])
Console.WriteLine("BIOS image not available. This game requires BIOS to function."); // TODO corecomm.notify CoreComm.Notify("BIOS image not available. This game requires BIOS to function.");
if (SyncSettings.UseBIOS && BiosRom == null) if (SyncSettings.UseBIOS && BiosRom == null)
Console.WriteLine("BIOS was selected, but rom image not available. BIOS not enabled."); // TODO corecomm.notify CoreComm.Notify("BIOS was selected, but rom image not available. BIOS not enabled.");
} }
SetupMemoryDomains(); SetupMemoryDomains();

View File

@ -28,6 +28,9 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
void RenderBackgroundM0(bool show) void RenderBackgroundM0(bool show)
{ {
if (ScanLine >= FrameHeight)
return;
if (DisplayOn == false) if (DisplayOn == false)
{ {
Array.Clear(FrameBuffer, ScanLine * 256, 256); Array.Clear(FrameBuffer, ScanLine * 256, 256);
@ -63,6 +66,9 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
void RenderBackgroundM2(bool show) void RenderBackgroundM2(bool show)
{ {
if (ScanLine >= FrameHeight)
return;
if (DisplayOn == false) if (DisplayOn == false)
{ {
Array.Clear(FrameBuffer, ScanLine * 256, 256); Array.Clear(FrameBuffer, ScanLine * 256, 256);
@ -100,6 +106,9 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
void RenderTmsSprites(bool show) void RenderTmsSprites(bool show)
{ {
if (ScanLine >= FrameHeight || DisplayOn == false)
return;
if (EnableDoubledSprites == false) if (EnableDoubledSprites == false)
RenderTmsSpritesStandard(show); RenderTmsSpritesStandard(show);
else else
@ -108,8 +117,6 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
void RenderTmsSpritesStandard(bool show) void RenderTmsSpritesStandard(bool show)
{ {
if (DisplayOn == false) return;
Array.Clear(ScanlinePriorityBuffer, 0, 256); Array.Clear(ScanlinePriorityBuffer, 0, 256);
Array.Clear(SpriteCollisionBuffer, 0, 256); Array.Clear(SpriteCollisionBuffer, 0, 256);
@ -176,8 +183,6 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
void RenderTmsSpritesDouble(bool show) void RenderTmsSpritesDouble(bool show)
{ {
if (DisplayOn == false) return;
Array.Clear(ScanlinePriorityBuffer, 0, 256); Array.Clear(ScanlinePriorityBuffer, 0, 256);
Array.Clear(SpriteCollisionBuffer, 0, 256); Array.Clear(SpriteCollisionBuffer, 0, 256);

View File

@ -385,15 +385,11 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
} }
else if (TmsMode == 2) else if (TmsMode == 2)
{ {
if (ScanLine >= FrameHeight) // TODO fix this other way
return;
RenderBackgroundM2(Sms.Settings.DispBG); RenderBackgroundM2(Sms.Settings.DispBG);
RenderTmsSprites(Sms.Settings.DispOBJ); RenderTmsSprites(Sms.Settings.DispOBJ);
} }
else if (TmsMode == 0) else if (TmsMode == 0)
{ {
if (ScanLine >= FrameHeight) // TODO fix this other way
return;
RenderBackgroundM0(Sms.Settings.DispBG); RenderBackgroundM0(Sms.Settings.DispBG);
RenderTmsSprites(Sms.Settings.DispOBJ); RenderTmsSprites(Sms.Settings.DispOBJ);
} }