Add a status icon and notification system for settings that require a core reboot, status bar icon if clicked performs the reboot. Hooked up to the GB/SGB set, SMS Enable FM Chip and overclock settings. May need to flag some other settings too

This commit is contained in:
adelikat 2012-09-29 23:03:51 +00:00
parent b6e4d9996e
commit ff117d2c49
3 changed files with 49 additions and 1 deletions

View File

@ -268,6 +268,7 @@
this.StatusSlot9 = new System.Windows.Forms.ToolStripStatusLabel();
this.StatusSlot10 = new System.Windows.Forms.ToolStripStatusLabel();
this.CheatStatus = new System.Windows.Forms.ToolStripStatusLabel();
this.RebootStatusBarIcon = new System.Windows.Forms.ToolStripStatusLabel();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.cmiOpenRom = new System.Windows.Forms.ToolStripMenuItem();
this.cmiLoadLastRom = new System.Windows.Forms.ToolStripMenuItem();
@ -2164,6 +2165,7 @@
this.EmuStatus,
this.PlayRecordStatus,
this.PauseStrip,
this.RebootStatusBarIcon,
this.AVIStatusLabel,
this.toolStripStatusLabel1,
this.StatusSlot1,
@ -2315,6 +2317,17 @@
this.CheatStatus.Size = new System.Drawing.Size(0, 17);
this.CheatStatus.Click += new System.EventHandler(this.FreezeStatus_Click);
//
// RebootStatusBarIcon
//
this.RebootStatusBarIcon.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.RebootStatusBarIcon.Image = global::BizHawk.MultiClient.Properties.Resources.reboot;
this.RebootStatusBarIcon.Name = "RebootStatusBarIcon";
this.RebootStatusBarIcon.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.RebootStatusBarIcon.Size = new System.Drawing.Size(16, 17);
this.RebootStatusBarIcon.Text = "Reboot";
this.RebootStatusBarIcon.ToolTipText = "A reboot of the core is needed for a setting change to take affect";
this.RebootStatusBarIcon.Click += new System.EventHandler(this.toolStripStatusLabel2_Click);
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -2778,6 +2791,7 @@
private System.Windows.Forms.ToolStripMenuItem loadGBInSGBToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem loadGBInSGBToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem backupSaveramToolStripMenuItem;
private System.Windows.Forms.ToolStripStatusLabel RebootStatusBarIcon;
}
}

View File

@ -178,16 +178,19 @@ namespace BizHawk.MultiClient
private void smsEnableFMChipToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.SmsEnableFM ^= true;
FlagNeedsReboot();
}
private void smsOverclockWhenKnownSafeToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.SmsAllowOverlock ^= true;
FlagNeedsReboot();
}
private void smsForceStereoSeparationToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.SmsForceStereoSeparation ^= true;
FlagNeedsReboot();
}
private void smsSpriteLimitToolStripMenuItem_Click(object sender, EventArgs e)
@ -1910,16 +1913,19 @@ namespace BizHawk.MultiClient
private void forceDMGModeToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.GB_ForceDMG ^= true;
FlagNeedsReboot();
}
private void gBAInCGBModeToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.GB_GBACGB ^= true;
FlagNeedsReboot();
}
private void multicartCompatibilityToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.GB_MulticartCompat ^= true;
FlagNeedsReboot();
}
}
}

View File

@ -37,7 +37,7 @@ namespace BizHawk.MultiClient
public bool TurboFastForward = false;
public bool RestoreReadWriteOnStop = false;
public bool UpdateFrame = false;
public bool NeedsReboot = false;
//avi/wav state
IVideoWriter CurrAviWriter = null;
/// <summary>
@ -1676,6 +1676,8 @@ namespace BizHawk.MultiClient
Global.ActiveController = Global.NullControls;
Global.AutoFireController = Global.AutofireNullControls;
Global.MovieSession.Movie.Stop();
NeedsReboot = false;
SetRebootIconStatus();
}
private static void SaveRam()
@ -3524,6 +3526,7 @@ namespace BizHawk.MultiClient
AVIStatusLabel.Visible = false;
SetPauseStatusbarIcon();
UpdateCheatStatus();
SetRebootIconStatus();
}
private void IncreaseWindowSize()
@ -3701,6 +3704,7 @@ namespace BizHawk.MultiClient
private void loadGBInSGBToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.GB_AsSGB ^= true;
FlagNeedsReboot();
}
private void MainForm_Resize(object sender, EventArgs e)
@ -3721,5 +3725,29 @@ namespace BizHawk.MultiClient
}
}
private void toolStripStatusLabel2_Click(object sender, EventArgs e)
{
RebootCore();
}
private void SetRebootIconStatus()
{
if (NeedsReboot)
{
RebootStatusBarIcon.Visible = true;
}
else
{
RebootStatusBarIcon.Visible = false;
}
}
private void FlagNeedsReboot()
{
NeedsReboot = true;
SetRebootIconStatus();
Global.OSD.AddMessage("Core reboot needed for this setting");
}
}
}