Some code refactoring, mostly in an attempt to pick away at the beast that is Mainform.cs
This commit is contained in:
parent
de68fd6025
commit
b3946082a7
|
@ -45,61 +45,61 @@ namespace BizHawk.Client.EmuHawk
|
|||
SaveState0MenuItem.Font = new Font(
|
||||
SaveState0MenuItem.Font.FontFamily,
|
||||
SaveState0MenuItem.Font.Size,
|
||||
StateSlots.HasSlot(0) ? (FontStyle.Italic | FontStyle.Bold) : FontStyle.Regular
|
||||
_stateSlots.HasSlot(0) ? (FontStyle.Italic | FontStyle.Bold) : FontStyle.Regular
|
||||
);
|
||||
|
||||
SaveState1MenuItem.Font = new Font(
|
||||
SaveState1MenuItem.Font.FontFamily,
|
||||
SaveState1MenuItem.Font.Size,
|
||||
StateSlots.HasSlot(1) ? (FontStyle.Italic | FontStyle.Bold) : FontStyle.Regular
|
||||
_stateSlots.HasSlot(1) ? (FontStyle.Italic | FontStyle.Bold) : FontStyle.Regular
|
||||
);
|
||||
|
||||
SaveState2MenuItem.Font = new Font(
|
||||
SaveState2MenuItem.Font.FontFamily,
|
||||
SaveState2MenuItem.Font.Size,
|
||||
StateSlots.HasSlot(2) ? (FontStyle.Italic | FontStyle.Bold) : FontStyle.Regular
|
||||
_stateSlots.HasSlot(2) ? (FontStyle.Italic | FontStyle.Bold) : FontStyle.Regular
|
||||
);
|
||||
|
||||
SaveState3MenuItem.Font = new Font(
|
||||
SaveState3MenuItem.Font.FontFamily,
|
||||
SaveState3MenuItem.Font.Size,
|
||||
StateSlots.HasSlot(3) ? (FontStyle.Italic | FontStyle.Bold) : FontStyle.Regular
|
||||
_stateSlots.HasSlot(3) ? (FontStyle.Italic | FontStyle.Bold) : FontStyle.Regular
|
||||
);
|
||||
|
||||
SaveState4MenuItem.Font = new Font(
|
||||
SaveState4MenuItem.Font.FontFamily,
|
||||
SaveState4MenuItem.Font.Size,
|
||||
StateSlots.HasSlot(4) ? (FontStyle.Italic | FontStyle.Bold) : FontStyle.Regular
|
||||
_stateSlots.HasSlot(4) ? (FontStyle.Italic | FontStyle.Bold) : FontStyle.Regular
|
||||
);
|
||||
|
||||
SaveState5MenuItem.Font = new Font(
|
||||
SaveState5MenuItem.Font.FontFamily,
|
||||
SaveState5MenuItem.Font.Size,
|
||||
StateSlots.HasSlot(5) ? (FontStyle.Italic | FontStyle.Bold) : FontStyle.Regular
|
||||
_stateSlots.HasSlot(5) ? (FontStyle.Italic | FontStyle.Bold) : FontStyle.Regular
|
||||
);
|
||||
|
||||
SaveState6MenuItem.Font = new Font(
|
||||
SaveState6MenuItem.Font.FontFamily,
|
||||
SaveState6MenuItem.Font.Size,
|
||||
StateSlots.HasSlot(6) ? (FontStyle.Italic | FontStyle.Bold) : FontStyle.Regular
|
||||
_stateSlots.HasSlot(6) ? (FontStyle.Italic | FontStyle.Bold) : FontStyle.Regular
|
||||
);
|
||||
|
||||
SaveState7MenuItem.Font = new Font(
|
||||
SaveState7MenuItem.Font.FontFamily,
|
||||
SaveState7MenuItem.Font.Size,
|
||||
StateSlots.HasSlot(7) ? (FontStyle.Italic | FontStyle.Bold) : FontStyle.Regular
|
||||
_stateSlots.HasSlot(7) ? (FontStyle.Italic | FontStyle.Bold) : FontStyle.Regular
|
||||
);
|
||||
|
||||
SaveState8MenuItem.Font = new Font(
|
||||
SaveState8MenuItem.Font.FontFamily,
|
||||
SaveState8MenuItem.Font.Size,
|
||||
StateSlots.HasSlot(8) ? (FontStyle.Italic | FontStyle.Bold) : FontStyle.Regular
|
||||
_stateSlots.HasSlot(8) ? (FontStyle.Italic | FontStyle.Bold) : FontStyle.Regular
|
||||
);
|
||||
|
||||
SaveState9MenuItem.Font = new Font(
|
||||
SaveState9MenuItem.Font.FontFamily,
|
||||
SaveState9MenuItem.Font.Size,
|
||||
StateSlots.HasSlot(9) ? (FontStyle.Italic | FontStyle.Bold) : FontStyle.Regular
|
||||
_stateSlots.HasSlot(9) ? (FontStyle.Italic | FontStyle.Bold) : FontStyle.Regular
|
||||
);
|
||||
|
||||
SaveState1MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Save State 1"].Bindings;
|
||||
|
@ -145,16 +145,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
AutoloadLastSlotMenuItem.Checked = Global.Config.AutoLoadLastSaveSlot;
|
||||
|
||||
LoadNamedStateMenuItem.Enabled = !(Global.Emulator is NullEmulator);
|
||||
LoadState1MenuItem.Enabled = StateSlots.HasSlot(1);
|
||||
LoadState2MenuItem.Enabled = StateSlots.HasSlot(2);
|
||||
LoadState3MenuItem.Enabled = StateSlots.HasSlot(3);
|
||||
LoadState4MenuItem.Enabled = StateSlots.HasSlot(4);
|
||||
LoadState5MenuItem.Enabled = StateSlots.HasSlot(5);
|
||||
LoadState6MenuItem.Enabled = StateSlots.HasSlot(6);
|
||||
LoadState7MenuItem.Enabled = StateSlots.HasSlot(7);
|
||||
LoadState8MenuItem.Enabled = StateSlots.HasSlot(8);
|
||||
LoadState9MenuItem.Enabled = StateSlots.HasSlot(9);
|
||||
LoadState0MenuItem.Enabled = StateSlots.HasSlot(0);
|
||||
LoadState1MenuItem.Enabled = _stateSlots.HasSlot(1);
|
||||
LoadState2MenuItem.Enabled = _stateSlots.HasSlot(2);
|
||||
LoadState3MenuItem.Enabled = _stateSlots.HasSlot(3);
|
||||
LoadState4MenuItem.Enabled = _stateSlots.HasSlot(4);
|
||||
LoadState5MenuItem.Enabled = _stateSlots.HasSlot(5);
|
||||
LoadState6MenuItem.Enabled = _stateSlots.HasSlot(6);
|
||||
LoadState7MenuItem.Enabled = _stateSlots.HasSlot(7);
|
||||
LoadState8MenuItem.Enabled = _stateSlots.HasSlot(8);
|
||||
LoadState9MenuItem.Enabled = _stateSlots.HasSlot(9);
|
||||
LoadState0MenuItem.Enabled = _stateSlots.HasSlot(0);
|
||||
}
|
||||
|
||||
private void SaveSlotSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
|
@ -262,7 +262,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
StopAVIMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Stop A/V"].Bindings;
|
||||
CaptureOSDMenuItem.Checked = Global.Config.AVI_CaptureOSD;
|
||||
|
||||
if (CurrAviWriter == null)
|
||||
if (_currAviWriter == null)
|
||||
{
|
||||
RecordAVMenuItem.Enabled = true;
|
||||
StopAVIMenuItem.Enabled = false;
|
||||
|
@ -282,12 +282,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void OpenRomMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenROM();
|
||||
OpenRom();
|
||||
}
|
||||
|
||||
private void CloseRomMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
CloseROM();
|
||||
CloseRom();
|
||||
}
|
||||
|
||||
private void Savestate1MenuItem_Click(object sender, EventArgs e) { SaveState("QuickSave1"); }
|
||||
|
@ -356,12 +356,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void SaveToCurrentSlotMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
SaveState("QuickSave" + Global.Config.SaveSlot.ToString());
|
||||
SaveState("QuickSave" + Global.Config.SaveSlot);
|
||||
}
|
||||
|
||||
private void LoadCurrentSlotMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadState("QuickSave" + Global.Config.SaveSlot.ToString());
|
||||
LoadState("QuickSave" + Global.Config.SaveSlot);
|
||||
}
|
||||
|
||||
private void ReadonlyMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -416,13 +416,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
GlobalWin.Sound.StopSound();
|
||||
var result = ofd.ShowDialog();
|
||||
GlobalWin.Sound.StartSound();
|
||||
if (result != DialogResult.OK)
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (string fn in ofd.FileNames)
|
||||
foreach (var fn in ofd.FileNames)
|
||||
{
|
||||
ProcessMovieImport(fn);
|
||||
}
|
||||
|
@ -476,9 +472,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void ScreenshotAsMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
string path = String.Format(PathManager.ScreenshotPrefix(Global.Game) + ".{0:yyyy-MM-dd HH.mm.ss}.png", DateTime.Now);
|
||||
var path = String.Format(PathManager.ScreenshotPrefix(Global.Game) + ".{0:yyyy-MM-dd HH.mm.ss}.png", DateTime.Now);
|
||||
|
||||
SaveFileDialog sfd = new SaveFileDialog
|
||||
var sfd = new SaveFileDialog
|
||||
{
|
||||
InitialDirectory = Path.GetDirectoryName(path),
|
||||
FileName = Path.GetFileName(path),
|
||||
|
@ -520,14 +516,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
RebootCoreMenuItem.Enabled = !(Global.Emulator is NullEmulator);
|
||||
|
||||
if (didMenuPause)
|
||||
{
|
||||
PauseMenuItem.Checked = wasPaused;
|
||||
}
|
||||
else
|
||||
{
|
||||
PauseMenuItem.Checked = EmulatorPaused;
|
||||
}
|
||||
PauseMenuItem.Checked = _didMenuPause ? _wasPaused : EmulatorPaused;
|
||||
|
||||
SoftResetMenuItem.Enabled = Global.Emulator.ControllerDefinition.BoolButtons.Contains("Reset") &&
|
||||
(!Global.MovieSession.Movie.IsPlaying || Global.MovieSession.Movie.IsFinished);
|
||||
|
@ -683,7 +672,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
Global.Config.DisplayStatusBar ^= true;
|
||||
|
||||
if (!InFullscreen)
|
||||
if (!_inFullscreen)
|
||||
{
|
||||
MainStatusBar.Visible = Global.Config.DisplayStatusBar;
|
||||
PerformLayout();
|
||||
|
@ -813,7 +802,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void ControllersMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
ControllerConfig controller = new ControllerConfig(Global.Emulator.ControllerDefinition);
|
||||
var controller = new ControllerConfig(Global.Emulator.ControllerDefinition);
|
||||
if (controller.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
InitControls();
|
||||
|
@ -823,7 +812,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void HotkeysMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
HotkeyConfig hotkeys = new HotkeyConfig();
|
||||
var hotkeys = new HotkeyConfig();
|
||||
if (hotkeys.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
InitControls();
|
||||
|
@ -843,7 +832,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void SoundMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
SoundConfig sound = new SoundConfig();
|
||||
var sound = new SoundConfig();
|
||||
if (sound.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
RewireSound();
|
||||
|
@ -868,53 +857,27 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void EnableContextMenuMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.ShowContextMenu ^= true;
|
||||
if (Global.Config.ShowContextMenu)
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("Context menu enabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("Context menu disabled");
|
||||
}
|
||||
GlobalWin.OSD.AddMessage(Global.Config.ShowContextMenu ? "Context menu enabled" : "Context menu disabled");
|
||||
}
|
||||
|
||||
private void BackupSavestatesMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.BackupSavestates ^= true;
|
||||
if (Global.Config.BackupSavestates)
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("Backup savestates enabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("Backup savestates disabled");
|
||||
}
|
||||
GlobalWin.OSD.AddMessage(Global.Config.BackupSavestates ? "Backup savestates enabled" : "Backup savestates disabled");
|
||||
}
|
||||
|
||||
private void AutoSavestatesMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.AutoSavestates ^= true;
|
||||
if (Global.Config.AutoSavestates)
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("AutoSavestates enabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("AutoSavestates disabled");
|
||||
}
|
||||
GlobalWin.OSD.AddMessage(Global.Config.AutoSavestates ? "AutoSavestates enabled" : "AutoSavestates disabled");
|
||||
}
|
||||
|
||||
private void ScreenshotWithSavestatesMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.SaveScreenshotWithStates ^= true;
|
||||
if (Global.Config.SaveScreenshotWithStates)
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("Screenshots will be saved in savestates");
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("Screenshots will not be saved in savestates");
|
||||
}
|
||||
GlobalWin.OSD.AddMessage(Global.Config.SaveScreenshotWithStates
|
||||
? "Screenshots will be saved in savestates"
|
||||
: "Screenshots will not be saved in savestates");
|
||||
}
|
||||
|
||||
private void frameAdvanceSkipLagFramesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -925,14 +888,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void BackupSaveramMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.BackupSaveram ^= true;
|
||||
if (Global.Config.BackupSaveram)
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("Backup saveram enabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("Backup saveram disabled");
|
||||
}
|
||||
GlobalWin.OSD.AddMessage(Global.Config.BackupSaveram ? "Backup saveram enabled" : "Backup saveram disabled");
|
||||
}
|
||||
|
||||
private void PauseWhenMenuActivatedMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -1002,7 +958,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Global.Config.ClockThrottle ^= true;
|
||||
if (Global.Config.ClockThrottle)
|
||||
{
|
||||
bool old = Global.Config.SoundThrottle;
|
||||
var old = Global.Config.SoundThrottle;
|
||||
Global.Config.SoundThrottle = false;
|
||||
if (old)
|
||||
{
|
||||
|
@ -1025,7 +981,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (Global.Config.SoundThrottle)
|
||||
{
|
||||
Global.Config.ClockThrottle = false;
|
||||
bool old = Global.Config.VSyncThrottle;
|
||||
var old = Global.Config.VSyncThrottle;
|
||||
Global.Config.VSyncThrottle = false;
|
||||
if (old)
|
||||
{
|
||||
|
@ -1041,7 +997,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (Global.Config.VSyncThrottle)
|
||||
{
|
||||
Global.Config.ClockThrottle = false;
|
||||
bool old = Global.Config.SoundThrottle;
|
||||
var old = Global.Config.SoundThrottle;
|
||||
Global.Config.SoundThrottle = false;
|
||||
if (old)
|
||||
{
|
||||
|
@ -1224,7 +1180,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void NESGameGenieCodesMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadGameGenieEC();
|
||||
LoadGameGenieEc();
|
||||
}
|
||||
|
||||
private void NESGraphicSettingsMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -1294,7 +1250,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
SMSEnableFMChipMenuItem.Visible =
|
||||
SMSOverclockMenuItem.Visible =
|
||||
SMSForceStereoMenuItem.Visible =
|
||||
!(Global.Game.System == "GG");
|
||||
Global.Game.System != "GG";
|
||||
|
||||
ShowClippedRegionsMenuItem.Visible =
|
||||
HighlightActiveDisplayRegionMenuItem.Visible =
|
||||
|
@ -1346,7 +1302,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void GGGameGenieMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadGameGenieEC();
|
||||
LoadGameGenieEc();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -1373,9 +1329,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void LoadTIFileMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog OFD = new OpenFileDialog();
|
||||
var OFD = new OpenFileDialog();
|
||||
|
||||
if (OFD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||
if (OFD.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -1383,7 +1339,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
string Message = String.Format("Invalid file format. Reason: {0} \nForce transfer? This may cause the calculator to crash.", ex.Message);
|
||||
var Message = String.Format("Invalid file format. Reason: {0} \nForce transfer? This may cause the calculator to crash.", ex.Message);
|
||||
|
||||
if (MessageBox.Show(Message, "Upload Failed", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
|
||||
{
|
||||
|
@ -1421,14 +1377,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
(Global.Emulator as Atari2600).SetBw(Global.Config.Atari2600_BW);
|
||||
}
|
||||
|
||||
if (Global.Config.Atari2600_BW)
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("Setting the Black and White Switch to On");
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("Setting the Black and White Switch to Off");
|
||||
}
|
||||
GlobalWin.OSD.AddMessage(Global.Config.Atari2600_BW
|
||||
? "Setting the Black and White Switch to On"
|
||||
: "Setting the Black and White Switch to Off");
|
||||
}
|
||||
|
||||
private void AtariLeftDifficultyMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -1440,14 +1391,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
(Global.Emulator as Atari2600).SetP0Diff(Global.Config.Atari2600_BW);
|
||||
}
|
||||
|
||||
if (Global.Config.Atari2600_LeftDifficulty)
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("Setting Left Difficulty to B");
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("Setting Left Difficulty to A");
|
||||
}
|
||||
GlobalWin.OSD.AddMessage(Global.Config.Atari2600_LeftDifficulty
|
||||
? "Setting Left Difficulty to B"
|
||||
: "Setting Left Difficulty to A");
|
||||
}
|
||||
|
||||
private void AtariRightDifficultyMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -1459,14 +1405,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
(Global.Emulator as Atari2600).SetP1Diff(Global.Config.Atari2600_BW);
|
||||
}
|
||||
|
||||
if (Global.Config.Atari2600_RightDifficulty)
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("Setting Right Difficulty to B");
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("Setting Right Difficulty to A");
|
||||
}
|
||||
GlobalWin.OSD.AddMessage(Global.Config.Atari2600_RightDifficulty
|
||||
? "Setting Right Difficulty to B"
|
||||
: "Setting Right Difficulty to A");
|
||||
}
|
||||
|
||||
private void AtariShowBGMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -1572,7 +1513,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void GBGameGenieMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadGameGenieEC();
|
||||
LoadGameGenieEc();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -1677,7 +1618,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void SnesGameGenieMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadGameGenieEC();
|
||||
LoadGameGenieEc();
|
||||
}
|
||||
|
||||
private void SnesOptionsMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -1724,6 +1665,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (new N64VideoPluginconfig().ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
GlobalWin.MainForm.FlagNeedsReboot();
|
||||
GlobalWin.OSD.AddMessage("Plugin settings saved");
|
||||
}
|
||||
else
|
||||
|
@ -1780,20 +1722,20 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void MainFormContextMenu_Opening(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
wasPaused = EmulatorPaused;
|
||||
didMenuPause = true;
|
||||
_wasPaused = EmulatorPaused;
|
||||
_didMenuPause = true;
|
||||
PauseEmulator();
|
||||
|
||||
OpenRomContextMenuItem.Visible = (Global.Emulator is NullEmulator) || InFullscreen;
|
||||
OpenRomContextMenuItem.Visible = (Global.Emulator is NullEmulator) || _inFullscreen;
|
||||
|
||||
ShowMenuContextMenuItem.Visible =
|
||||
ShowMenuContextMenuSeparator.Visible =
|
||||
InFullscreen;
|
||||
_inFullscreen;
|
||||
|
||||
LoadLastRomContextMenuItem.Visible =
|
||||
(Global.Emulator is NullEmulator);
|
||||
|
||||
StopAVContextMenuItem.Visible = CurrAviWriter != null;
|
||||
StopAVContextMenuItem.Visible = _currAviWriter != null;
|
||||
|
||||
ContextSeparator_AfterMovie.Visible =
|
||||
ContextSeparator_AfterUndo.Visible =
|
||||
|
@ -1819,7 +1761,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
AddSubtitleContextMenuItem.Visible = !(Global.Emulator is NullEmulator) && Global.MovieSession.Movie.IsActive && Global.ReadOnly;
|
||||
|
||||
ConfigContextMenuItem.Visible = InFullscreen;
|
||||
ConfigContextMenuItem.Visible = _inFullscreen;
|
||||
|
||||
ClearSRAMContextMenuItem.Visible = File.Exists(PathManager.SaveRamPath(Global.Game));
|
||||
|
||||
|
@ -1852,14 +1794,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (file.Exists)
|
||||
{
|
||||
UndoSavestateContextMenuItem.Enabled = true;
|
||||
if (StateSlots.IsRedo(Global.Config.SaveSlot))
|
||||
if (_stateSlots.IsRedo(Global.Config.SaveSlot))
|
||||
{
|
||||
UndoSavestateContextMenuItem.Text = "Redo Save to slot " + Global.Config.SaveSlot.ToString();
|
||||
UndoSavestateContextMenuItem.Text = "Redo Save to slot " + Global.Config.SaveSlot;
|
||||
UndoSavestateContextMenuItem.Image = Properties.Resources.redo;
|
||||
}
|
||||
else
|
||||
{
|
||||
UndoSavestateContextMenuItem.Text = "Undo Save to slot " + Global.Config.SaveSlot.ToString();
|
||||
UndoSavestateContextMenuItem.Text = "Undo Save to slot " + Global.Config.SaveSlot;
|
||||
UndoSavestateContextMenuItem.Image = Properties.Resources.undo;
|
||||
}
|
||||
}
|
||||
|
@ -1870,22 +1812,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
UndoSavestateContextMenuItem.Image = Properties.Resources.undo;
|
||||
}
|
||||
|
||||
if (InFullscreen)
|
||||
if (_inFullscreen)
|
||||
{
|
||||
if (MainMenuStrip.Visible)
|
||||
{
|
||||
ShowMenuContextMenuItem.Text = "Hide Menu";
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowMenuContextMenuItem.Text = "Show Menu";
|
||||
}
|
||||
ShowMenuContextMenuItem.Text = MainMenuStrip.Visible ? "Hide Menu" : "Show Menu";
|
||||
}
|
||||
}
|
||||
|
||||
private void MainFormContextMenu_Closing(object sender, ToolStripDropDownClosingEventArgs e)
|
||||
{
|
||||
if (!wasPaused)
|
||||
if (!_wasPaused)
|
||||
{
|
||||
UnpauseEmulator();
|
||||
}
|
||||
|
@ -1911,7 +1846,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
EditSubtitlesForm form = new EditSubtitlesForm { ReadOnly = Global.ReadOnly };
|
||||
var form = new EditSubtitlesForm { ReadOnly = Global.ReadOnly };
|
||||
form.GetMovie(Global.MovieSession.Movie);
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
@ -1919,11 +1854,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void AddSubtitleContextMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
SubtitleMaker subForm = new SubtitleMaker();
|
||||
var subForm = new SubtitleMaker();
|
||||
subForm.DisableFrame();
|
||||
|
||||
int index = -1;
|
||||
Subtitle sub = new Subtitle();
|
||||
var sub = new Subtitle();
|
||||
for (int x = 0; x < Global.MovieSession.Movie.Subtitles.Count; x++)
|
||||
{
|
||||
sub = Global.MovieSession.Movie.Subtitles[x];
|
||||
|
@ -1956,7 +1891,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
EditCommentsForm form = new EditCommentsForm();
|
||||
var form = new EditCommentsForm();
|
||||
form.GetMovie(Global.MovieSession.Movie);
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
@ -1976,7 +1911,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void ClearSRAMContextMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
CloseROM(clearSRAM: true);
|
||||
CloseRom(clearSram: true);
|
||||
}
|
||||
|
||||
private void ShowMenuContextMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -2015,7 +1950,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
if (StateSlots.HasSlot(slot))
|
||||
if (_stateSlots.HasSlot(slot))
|
||||
{
|
||||
LoadState("QuickSave" + slot);
|
||||
}
|
||||
|
@ -2060,11 +1995,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (!Global.Config.RunInBackground)
|
||||
{
|
||||
if (!wasPaused)
|
||||
if (!_wasPaused)
|
||||
{
|
||||
UnpauseEmulator();
|
||||
}
|
||||
wasPaused = false;
|
||||
_wasPaused = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2074,7 +2009,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (EmulatorPaused)
|
||||
{
|
||||
wasPaused = true;
|
||||
_wasPaused = true;
|
||||
}
|
||||
PauseEmulator();
|
||||
}
|
||||
|
@ -2107,7 +2042,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
protected override void OnClosed(EventArgs e)
|
||||
{
|
||||
exit = true;
|
||||
_exit = true;
|
||||
base.OnClosed(e);
|
||||
}
|
||||
|
||||
|
@ -2121,8 +2056,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
HandlePlatformMenus();
|
||||
if (Global.Config.PauseWhenMenuActivated)
|
||||
{
|
||||
wasPaused = EmulatorPaused;
|
||||
didMenuPause = true;
|
||||
_wasPaused = EmulatorPaused;
|
||||
_didMenuPause = true;
|
||||
PauseEmulator();
|
||||
}
|
||||
}
|
||||
|
@ -2130,7 +2065,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void MainformMenu_MenuDeactivate(object sender, EventArgs e)
|
||||
{
|
||||
GlobalWin.DisplayManager.NeedsToPaint = true;
|
||||
if (!wasPaused)
|
||||
if (!_wasPaused)
|
||||
{
|
||||
UnpauseEmulator();
|
||||
}
|
||||
|
@ -2143,9 +2078,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void FormDragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
string[] filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
bool isLua = false;
|
||||
foreach (string path in filePaths)
|
||||
var filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
var isLua = false;
|
||||
foreach (var path in filePaths)
|
||||
{
|
||||
var extension = Path.GetExtension(path);
|
||||
if (extension != null && extension.ToUpper() == ".LUA")
|
||||
|
@ -2196,7 +2131,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
//tries to open a legacy movie format as if it were a BKM, by importing it
|
||||
if (CurrentlyOpenRom == null)
|
||||
{
|
||||
OpenROM();
|
||||
OpenRom();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,10 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
|
@ -72,12 +66,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
case (10): Global.Config.GifAnimatorSpeed = 32; break;
|
||||
}
|
||||
|
||||
this.Close();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
|
@ -35,13 +29,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void SaveSettings()
|
||||
{
|
||||
//Global
|
||||
string video_settings = VideoResolutionComboBox.SelectedItem.ToString();
|
||||
string[] strArr = video_settings.Split('x');
|
||||
var video_settings = VideoResolutionComboBox.SelectedItem.ToString();
|
||||
var strArr = video_settings.Split('x');
|
||||
Global.Config.N64VideoSizeX = Int32.Parse(strArr[0].Trim());
|
||||
Global.Config.N64VideoSizeY = Int32.Parse(strArr[1].Trim());
|
||||
Global.Config.N64VidPlugin = PluginComboBox.Text;
|
||||
GlobalWin.MainForm.FlagNeedsReboot(); //TODO: this won't always be necessary, keep that in mind
|
||||
|
||||
|
||||
//Rice
|
||||
Global.Config.RicePlugin.NormalAlphaBlender = RiceNormalAlphaBlender_CB.Checked;
|
||||
Global.Config.RicePlugin.FastTextureLoading = RiceFastTextureLoading_CB.Checked;
|
||||
|
@ -144,25 +137,21 @@ namespace BizHawk.Client.EmuHawk
|
|||
Global.Config.GlidePlugin.disable_auxbuf = Glide_disable_auxbuf.Checked;
|
||||
Global.Config.GlidePlugin.fb_get_info = Glide_fb_get_info.Checked;
|
||||
|
||||
if (InputValidate.IsValidSignedNumber(Glide_offset_x.Text))
|
||||
Global.Config.GlidePlugin.offset_x = int.Parse(Glide_offset_x.Text);
|
||||
else
|
||||
Global.Config.GlidePlugin.offset_x = 0;
|
||||
Global.Config.GlidePlugin.offset_x =
|
||||
InputValidate.IsValidSignedNumber(Glide_offset_x.Text) ?
|
||||
int.Parse(Glide_offset_x.Text) : 0;
|
||||
|
||||
if (InputValidate.IsValidSignedNumber(Glide_offset_y.Text))
|
||||
Global.Config.GlidePlugin.offset_y = int.Parse(Glide_offset_y.Text);
|
||||
else
|
||||
Global.Config.GlidePlugin.offset_y = 0;
|
||||
Global.Config.GlidePlugin.offset_y =
|
||||
InputValidate.IsValidSignedNumber(Glide_offset_y.Text) ?
|
||||
int.Parse(Glide_offset_y.Text) : 0;
|
||||
|
||||
if (InputValidate.IsValidSignedNumber(Glide_scale_x.Text))
|
||||
Global.Config.GlidePlugin.scale_x = int.Parse(Glide_scale_x.Text);
|
||||
else
|
||||
Global.Config.GlidePlugin.scale_x = 100000;
|
||||
Global.Config.GlidePlugin.scale_x =
|
||||
InputValidate.IsValidSignedNumber(Glide_scale_x.Text) ?
|
||||
int.Parse(Glide_scale_x.Text) : 100000;
|
||||
|
||||
if (InputValidate.IsValidSignedNumber(Glide_scale_y.Text))
|
||||
Global.Config.GlidePlugin.scale_y = int.Parse(Glide_scale_y.Text);
|
||||
else
|
||||
Global.Config.GlidePlugin.scale_y = 100000;
|
||||
Global.Config.GlidePlugin.scale_y =
|
||||
InputValidate.IsValidSignedNumber(Glide_scale_y.Text) ?
|
||||
int.Parse(Glide_scale_y.Text) : 100000;
|
||||
|
||||
Global.Config.GlidePlugin.UseDefaultHacks = GlideUseDefaultHacks1.Checked || GlideUseDefaultHacks2.Checked;
|
||||
Global.Config.GlidePlugin.alt_tex_size = Glide_alt_tex_size.Checked;
|
||||
|
@ -189,29 +178,24 @@ namespace BizHawk.Client.EmuHawk
|
|||
Global.Config.GlidePlugin.use_sts1_only = Glide_use_sts1_only.Checked;
|
||||
Global.Config.GlidePlugin.wrap_big_tex = Glide_wrap_big_tex.Checked;
|
||||
|
||||
if (InputValidate.IsValidSignedNumber(Glide_depth_bias.Text))
|
||||
Global.Config.GlidePlugin.depth_bias = int.Parse(Glide_depth_bias.Text);
|
||||
else
|
||||
Global.Config.GlidePlugin.depth_bias = 20;
|
||||
Global.Config.GlidePlugin.depth_bias =
|
||||
InputValidate.IsValidSignedNumber(Glide_depth_bias.Text) ?
|
||||
int.Parse(Glide_depth_bias.Text) : 20;
|
||||
|
||||
Global.Config.GlidePlugin.filtering = Glide_filtering.SelectedIndex;
|
||||
|
||||
if (InputValidate.IsValidSignedNumber(Glide_fix_tex_coord.Text))
|
||||
Global.Config.GlidePlugin.fix_tex_coord = int.Parse(Glide_fix_tex_coord.Text);
|
||||
else
|
||||
Global.Config.GlidePlugin.fix_tex_coord = 0;
|
||||
Global.Config.GlidePlugin.fix_tex_coord = InputValidate.IsValidSignedNumber(Glide_fix_tex_coord.Text) ?
|
||||
int.Parse(Glide_fix_tex_coord.Text) : 0;
|
||||
|
||||
Global.Config.GlidePlugin.lodmode = Glide_lodmode.SelectedIndex;
|
||||
|
||||
if (InputValidate.IsValidSignedNumber(Glide_stipple_mode.Text))
|
||||
Global.Config.GlidePlugin.stipple_mode = int.Parse(Glide_stipple_mode.Text);
|
||||
else
|
||||
Global.Config.GlidePlugin.stipple_mode = 2;
|
||||
Global.Config.GlidePlugin.stipple_mode =
|
||||
InputValidate.IsValidSignedNumber(Glide_stipple_mode.Text) ?
|
||||
int.Parse(Glide_stipple_mode.Text) : 2;
|
||||
|
||||
if (InputValidate.IsValidSignedNumber(Glide_stipple_pattern.Text))
|
||||
Global.Config.GlidePlugin.stipple_pattern = int.Parse(Glide_stipple_pattern.Text);
|
||||
else
|
||||
Global.Config.GlidePlugin.stipple_pattern = 1041204192;
|
||||
Global.Config.GlidePlugin.stipple_pattern =
|
||||
InputValidate.IsValidSignedNumber(Glide_stipple_pattern.Text) ?
|
||||
int.Parse(Glide_stipple_pattern.Text) : 1041204192;
|
||||
|
||||
Global.Config.GlidePlugin.swapmode = Glide_swapmode.SelectedIndex;
|
||||
Global.Config.GlidePlugin.enable_hacks_for_game = Glide_enable_hacks_for_game.SelectedIndex;
|
||||
|
@ -240,15 +224,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
Global.Config.Glide64mk2Plugin.alt_tex_size = Glide64mk2_alt_tex_size.Checked;
|
||||
Global.Config.Glide64mk2Plugin.swapmode = Glide64mk2_swapmode.SelectedIndex;
|
||||
|
||||
if (InputValidate.IsValidSignedNumber(Glide64mk2_stipple_pattern.Text))
|
||||
Global.Config.Glide64mk2Plugin.stipple_pattern = int.Parse(Glide64mk2_stipple_pattern.Text);
|
||||
else
|
||||
Global.Config.Glide64mk2Plugin.stipple_pattern = 1041204192;
|
||||
Global.Config.Glide64mk2Plugin.stipple_pattern =
|
||||
InputValidate.IsValidSignedNumber(Glide64mk2_stipple_pattern.Text) ?
|
||||
int.Parse(Glide64mk2_stipple_pattern.Text) : 1041204192;
|
||||
|
||||
if (InputValidate.IsValidSignedNumber(Glide64mk2_stipple_mode.Text))
|
||||
Global.Config.Glide64mk2Plugin.stipple_mode = int.Parse(Glide64mk2_stipple_mode.Text);
|
||||
else
|
||||
Global.Config.Glide64mk2Plugin.stipple_mode = 2;
|
||||
Global.Config.Glide64mk2Plugin.stipple_mode =
|
||||
InputValidate.IsValidSignedNumber(Glide64mk2_stipple_mode.Text) ?
|
||||
int.Parse(Glide64mk2_stipple_mode.Text) : 2;
|
||||
|
||||
Global.Config.Glide64mk2Plugin.lodmode = Glide64mk2_lodmode.SelectedIndex;
|
||||
Global.Config.Glide64mk2Plugin.filtering = Glide64mk2_filtering.SelectedIndex;
|
||||
|
@ -276,11 +258,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
//Load Variables
|
||||
//Global
|
||||
string video_setting = Global.Config.N64VideoSizeX.ToString()
|
||||
var video_setting = Global.Config.N64VideoSizeX
|
||||
+ " x "
|
||||
+ Global.Config.N64VideoSizeY.ToString();
|
||||
+ Global.Config.N64VideoSizeY;
|
||||
|
||||
int index = VideoResolutionComboBox.Items.IndexOf(video_setting);
|
||||
var index = VideoResolutionComboBox.Items.IndexOf(video_setting);
|
||||
if (index >= 0)
|
||||
{
|
||||
VideoResolutionComboBox.SelectedIndex = index;
|
||||
|
@ -331,7 +313,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
RiceColorQuality_Combo.SelectedIndex = Global.Config.RicePlugin.ColorQuality;
|
||||
RiceOpenGLRenderSetting_Combo.SelectedIndex = Global.Config.RicePlugin.OpenGLRenderSetting;
|
||||
RiceAnisotropicFiltering_TB.Value = Global.Config.RicePlugin.AnisotropicFiltering;
|
||||
AnisotropicFiltering_LB.Text = "Anisotropic Filtering: " + RiceAnisotropicFiltering_TB.Value.ToString();
|
||||
AnisotropicFiltering_LB.Text = "Anisotropic Filtering: " + RiceAnisotropicFiltering_TB.Value;
|
||||
|
||||
RiceUseDefaultHacks_CB.Checked = Global.Config.RicePlugin.UseDefaultHacks;
|
||||
|
||||
|
@ -487,7 +469,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void RiceAnisotropicFiltering_TB_Scroll_1(object sender, EventArgs e)
|
||||
{
|
||||
AnisotropicFiltering_LB.Text = "Anisotropic Filtering: " + RiceAnisotropicFiltering_TB.Value.ToString();
|
||||
AnisotropicFiltering_LB.Text = "Anisotropic Filtering: " + RiceAnisotropicFiltering_TB.Value;
|
||||
}
|
||||
|
||||
private void RiceUseDefaultHacks_CB_CheckedChanged(object sender, EventArgs e)
|
||||
|
@ -633,18 +615,19 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public bool GetBoolFromDB(string parameter)
|
||||
{
|
||||
if (Global.Game.OptionPresent(parameter) && Global.Game.OptionValue(parameter) == "true")
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
return Global.Game.OptionPresent(parameter) && Global.Game.OptionValue(parameter) == "true";
|
||||
}
|
||||
|
||||
public int GetIntFromDB(string parameter, int defaultVal)
|
||||
{
|
||||
if (Global.Game.OptionPresent(parameter) && InputValidate.IsValidUnsignedNumber(Global.Game.OptionValue(parameter)))
|
||||
{
|
||||
return int.Parse(Global.Game.OptionValue(parameter));
|
||||
}
|
||||
else
|
||||
{
|
||||
return defaultVal;
|
||||
}
|
||||
}
|
||||
|
||||
public void ToggleRiceHackCheckboxEnable (bool val)
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Global.Config.NESTriangle = tr;
|
||||
Global.Config.NESNoise = no;
|
||||
Global.Config.NESDMC = dmc;
|
||||
GlobalWin.MainForm.SetNESSoundChannels();
|
||||
GlobalWin.MainForm.SetNesSoundChannels();
|
||||
Close();
|
||||
}
|
||||
|
||||
|
@ -73,35 +73,35 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
label6.Text = trackBar1.Value.ToString();
|
||||
Global.Config.NESSquare1 = trackBar1.Value;
|
||||
GlobalWin.MainForm.SetNESSoundChannels();
|
||||
GlobalWin.MainForm.SetNesSoundChannels();
|
||||
}
|
||||
|
||||
private void trackBar2_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
label7.Text = trackBar2.Value.ToString();
|
||||
Global.Config.NESSquare2 = trackBar2.Value;
|
||||
GlobalWin.MainForm.SetNESSoundChannels();
|
||||
GlobalWin.MainForm.SetNesSoundChannels();
|
||||
}
|
||||
|
||||
private void trackBar3_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
label8.Text = trackBar3.Value.ToString();
|
||||
Global.Config.NESTriangle = trackBar3.Value;
|
||||
GlobalWin.MainForm.SetNESSoundChannels();
|
||||
GlobalWin.MainForm.SetNesSoundChannels();
|
||||
}
|
||||
|
||||
private void trackBar4_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
label9.Text = trackBar4.Value.ToString();
|
||||
Global.Config.NESNoise = trackBar4.Value;
|
||||
GlobalWin.MainForm.SetNESSoundChannels();
|
||||
GlobalWin.MainForm.SetNesSoundChannels();
|
||||
}
|
||||
|
||||
private void trackBar5_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
label10.Text = trackBar5.Value.ToString();
|
||||
Global.Config.NESDMC = trackBar5.Value;
|
||||
GlobalWin.MainForm.SetNESSoundChannels();
|
||||
GlobalWin.MainForm.SetNesSoundChannels();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,10 +8,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
public partial class RewindConfig : Form
|
||||
{
|
||||
private long StateSize;
|
||||
private int MediumStateSize;
|
||||
private int LargeStateSize;
|
||||
private int StateSizeCategory = 1; //1 = small, 2 = med, 3 = larg //TODO: enum
|
||||
private long _stateSize;
|
||||
private int _mediumStateSize;
|
||||
private int _largeStateSize;
|
||||
private int _stateSizeCategory = 1; //1 = small, 2 = med, 3 = larg //TODO: enum
|
||||
public RewindConfig()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -30,14 +30,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
RewindFramesUsedLabel.Text = "N/A";
|
||||
}
|
||||
|
||||
|
||||
|
||||
DiskBufferCheckbox.Checked = Global.Config.Rewind_OnDisk;
|
||||
RewindIsThreadedCheckbox.Checked = Global.Config.Rewind_IsThreaded;
|
||||
StateSize = Global.Emulator.SaveStateBinary().Length;
|
||||
_stateSize = Global.Emulator.SaveStateBinary().Length;
|
||||
BufferSizeUpDown.Value = Global.Config.Rewind_BufferSize;
|
||||
|
||||
MediumStateSize = Global.Config.Rewind_MediumStateSize;
|
||||
LargeStateSize = Global.Config.Rewind_LargeStateSize;
|
||||
_mediumStateSize = Global.Config.Rewind_MediumStateSize;
|
||||
_largeStateSize = Global.Config.Rewind_LargeStateSize;
|
||||
|
||||
UseDeltaCompression.Checked = Global.Config.Rewind_UseDelta;
|
||||
|
||||
|
@ -55,20 +55,20 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
SetStateSize();
|
||||
|
||||
int medium_state_size_kb = Global.Config.Rewind_MediumStateSize / 1024;
|
||||
int large_state_size_kb = Global.Config.Rewind_LargeStateSize / 1024;
|
||||
var medium_state_size_kb = Global.Config.Rewind_MediumStateSize / 1024;
|
||||
var large_state_size_kb = Global.Config.Rewind_LargeStateSize / 1024;
|
||||
|
||||
MediumStateTrackbar.Value = medium_state_size_kb;
|
||||
MediumStateUpDown.Value = (decimal)medium_state_size_kb;
|
||||
MediumStateUpDown.Value = medium_state_size_kb;
|
||||
LargeStateTrackbar.Value = large_state_size_kb;
|
||||
LargeStateUpDown.Value = (decimal)large_state_size_kb;
|
||||
LargeStateUpDown.Value = large_state_size_kb;
|
||||
}
|
||||
|
||||
private void SetStateSize()
|
||||
{
|
||||
double num = StateSize / 1024.0;
|
||||
double num = _stateSize / 1024.0;
|
||||
|
||||
if (num >= 1024)
|
||||
if (num >= 1024)
|
||||
{
|
||||
num /= 1024.0;
|
||||
StateSizeLabel.Text = String.Format("{0:0.00}", num) + " mb";
|
||||
|
@ -79,34 +79,34 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
|
||||
SmallLabel1.Text = "Small savestates (less than " + (MediumStateSize / 1024).ToString() + "kb)";
|
||||
MediumLabel1.Text = "Medium savestates (" + (MediumStateSize / 1024).ToString()
|
||||
+ " - " + (LargeStateSize / 1024) + "kb)";
|
||||
LargeLabel1.Text = "Large savestates (" + (LargeStateSize / 1024) + "kb or more)";
|
||||
SmallLabel1.Text = "Small savestates (less than " + (_mediumStateSize / 1024) + "kb)";
|
||||
MediumLabel1.Text = "Medium savestates (" + (_mediumStateSize / 1024)
|
||||
+ " - " + (_largeStateSize / 1024) + "kb)";
|
||||
LargeLabel1.Text = "Large savestates (" + (_largeStateSize / 1024) + "kb or more)";
|
||||
|
||||
if (StateSize >= LargeStateSize)
|
||||
if (_stateSize >= _largeStateSize)
|
||||
{
|
||||
StateSizeCategory = 3;
|
||||
SmallLabel1.Font = new Font(SmallLabel1.Font, FontStyle.Regular);
|
||||
_stateSizeCategory = 3;
|
||||
SmallLabel1.Font = new Font(SmallLabel1.Font, FontStyle.Regular);
|
||||
MediumLabel1.Font = new Font(SmallLabel1.Font, FontStyle.Regular);
|
||||
LargeLabel1.Font = new Font(SmallLabel1.Font, FontStyle.Italic);
|
||||
}
|
||||
else if (StateSize >= MediumStateSize)
|
||||
else if (_stateSize >= _mediumStateSize)
|
||||
{
|
||||
StateSizeCategory = 2;
|
||||
SmallLabel1.Font = new Font(SmallLabel1.Font, FontStyle.Regular);
|
||||
_stateSizeCategory = 2;
|
||||
SmallLabel1.Font = new Font(SmallLabel1.Font, FontStyle.Regular);
|
||||
MediumLabel1.Font = new Font(SmallLabel1.Font, FontStyle.Italic);
|
||||
LargeLabel1.Font = new Font(SmallLabel1.Font, FontStyle.Regular);
|
||||
}
|
||||
else
|
||||
{
|
||||
StateSizeCategory = 1;
|
||||
SmallLabel1.Font = new Font(SmallLabel1.Font, FontStyle.Italic);
|
||||
_stateSizeCategory = 1;
|
||||
SmallLabel1.Font = new Font(SmallLabel1.Font, FontStyle.Italic);
|
||||
MediumLabel1.Font = new Font(SmallLabel1.Font, FontStyle.Regular);
|
||||
LargeLabel1.Font = new Font(SmallLabel1.Font, FontStyle.Regular);
|
||||
}
|
||||
|
||||
CalculateEstimates();
|
||||
CalculateEstimates();
|
||||
}
|
||||
|
||||
private void Cancel_Click(object sender, EventArgs e)
|
||||
|
@ -147,7 +147,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void SetSmallEnabled()
|
||||
{
|
||||
SmallLabel1.Enabled = SmallLabel2.Enabled
|
||||
= SmallSavestateNumeric.Enabled = SmallLabel3.Enabled
|
||||
= SmallSavestateNumeric.Enabled = SmallLabel3.Enabled
|
||||
= SmallStateEnabledBox.Checked;
|
||||
}
|
||||
|
||||
|
@ -203,8 +203,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
LargeStateUpDown.Value = MediumStateUpDown.Value;
|
||||
LargeStateTrackbar.Value = (int)MediumStateUpDown.Value;
|
||||
}
|
||||
MediumStateSize = MediumStateTrackbar.Value * 1024;
|
||||
LargeStateSize = LargeStateTrackbar.Value * 1024;
|
||||
_mediumStateSize = MediumStateTrackbar.Value * 1024;
|
||||
_largeStateSize = LargeStateTrackbar.Value * 1024;
|
||||
SetStateSize();
|
||||
}
|
||||
|
||||
|
@ -216,8 +216,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
LargeStateUpDown.Value = MediumStateUpDown.Value;
|
||||
LargeStateTrackbar.Value = (int)MediumStateUpDown.Value;
|
||||
}
|
||||
MediumStateSize = MediumStateTrackbar.Value * 1024;
|
||||
LargeStateSize = LargeStateTrackbar.Value * 1024;
|
||||
_mediumStateSize = MediumStateTrackbar.Value * 1024;
|
||||
_largeStateSize = LargeStateTrackbar.Value * 1024;
|
||||
SetStateSize();
|
||||
}
|
||||
|
||||
|
@ -232,8 +232,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
LargeStateUpDown.Value = (sender as TrackBar).Value;
|
||||
}
|
||||
MediumStateSize = MediumStateTrackbar.Value * 1024;
|
||||
LargeStateSize = LargeStateTrackbar.Value * 1024;
|
||||
_mediumStateSize = MediumStateTrackbar.Value * 1024;
|
||||
_largeStateSize = LargeStateTrackbar.Value * 1024;
|
||||
SetStateSize();
|
||||
}
|
||||
|
||||
|
@ -248,82 +248,82 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
LargeStateTrackbar.Value = (int)(sender as NumericUpDown).Value;
|
||||
}
|
||||
MediumStateSize = MediumStateTrackbar.Value * 1024;
|
||||
LargeStateSize = LargeStateTrackbar.Value * 1024;
|
||||
_mediumStateSize = MediumStateTrackbar.Value * 1024;
|
||||
_largeStateSize = LargeStateTrackbar.Value * 1024;
|
||||
SetStateSize();
|
||||
}
|
||||
|
||||
private void CalculateEstimates()
|
||||
{
|
||||
long avg_state_size = 0;
|
||||
private void CalculateEstimates()
|
||||
{
|
||||
long avg_state_size;
|
||||
|
||||
if (UseDeltaCompression.Checked || StateSize == 0)
|
||||
{
|
||||
if (UseDeltaCompression.Checked || _stateSize == 0)
|
||||
{
|
||||
|
||||
if (GlobalWin.MainForm.Rewind_Count > 0)
|
||||
{
|
||||
avg_state_size = (long)(GlobalWin.MainForm.Rewind_Size / GlobalWin.MainForm.Rewind_Count);
|
||||
}
|
||||
else
|
||||
{
|
||||
avg_state_size = Global.Emulator.SaveStateBinary().Length;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
avg_state_size = StateSize;
|
||||
}
|
||||
if (GlobalWin.MainForm.Rewind_Count > 0)
|
||||
{
|
||||
avg_state_size = GlobalWin.MainForm.Rewind_Size / GlobalWin.MainForm.Rewind_Count;
|
||||
}
|
||||
else
|
||||
{
|
||||
avg_state_size = Global.Emulator.SaveStateBinary().Length;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
avg_state_size = _stateSize;
|
||||
}
|
||||
|
||||
long buffer_size = (long)(BufferSizeUpDown.Value);
|
||||
buffer_size *= 1024 * 1024;
|
||||
long est_frames = buffer_size / avg_state_size;
|
||||
var buffer_size = (long)(BufferSizeUpDown.Value);
|
||||
buffer_size *= 1024 * 1024;
|
||||
var est_frames = buffer_size / avg_state_size;
|
||||
|
||||
|
||||
|
||||
long est_frequency = 0;
|
||||
switch (StateSizeCategory)
|
||||
{
|
||||
case 1:
|
||||
est_frequency = (long)SmallSavestateNumeric.Value;
|
||||
break;
|
||||
case 2:
|
||||
est_frequency = (long)MediumSavestateNumeric.Value;
|
||||
break;
|
||||
case 3:
|
||||
est_frequency = (long)LargeSavestateNumeric.Value;
|
||||
break;
|
||||
}
|
||||
long est_total_frames = est_frames * est_frequency;
|
||||
double minutes = est_total_frames / 60 / 60;
|
||||
|
||||
AverageStoredStateSizeLabel.Text = String.Format("{0:n0}", avg_state_size) + " bytes";
|
||||
ApproxFramesLabel.Text = String.Format("{0:n0}", est_frames) + " frames";
|
||||
EstTimeLabel.Text = String.Format("{0:n}", minutes) + " minutes";
|
||||
}
|
||||
long est_frequency = 0;
|
||||
switch (_stateSizeCategory)
|
||||
{
|
||||
case 1:
|
||||
est_frequency = (long)SmallSavestateNumeric.Value;
|
||||
break;
|
||||
case 2:
|
||||
est_frequency = (long)MediumSavestateNumeric.Value;
|
||||
break;
|
||||
case 3:
|
||||
est_frequency = (long)LargeSavestateNumeric.Value;
|
||||
break;
|
||||
}
|
||||
long est_total_frames = est_frames * est_frequency;
|
||||
double minutes = est_total_frames / 60 / 60;
|
||||
|
||||
private void BufferSizeUpDown_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
CalculateEstimates();
|
||||
}
|
||||
AverageStoredStateSizeLabel.Text = String.Format("{0:n0}", avg_state_size) + " bytes";
|
||||
ApproxFramesLabel.Text = String.Format("{0:n0}", est_frames) + " frames";
|
||||
EstTimeLabel.Text = String.Format("{0:n}", minutes) + " minutes";
|
||||
}
|
||||
|
||||
private void UseDeltaCompression_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
CalculateEstimates();
|
||||
}
|
||||
private void BufferSizeUpDown_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
CalculateEstimates();
|
||||
}
|
||||
|
||||
private void SmallSavestateNumeric_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
CalculateEstimates();
|
||||
}
|
||||
private void UseDeltaCompression_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
CalculateEstimates();
|
||||
}
|
||||
|
||||
private void MediumSavestateNumeric_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
CalculateEstimates();
|
||||
}
|
||||
private void SmallSavestateNumeric_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
CalculateEstimates();
|
||||
}
|
||||
|
||||
private void LargeSavestateNumeric_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
CalculateEstimates();
|
||||
}
|
||||
private void MediumSavestateNumeric_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
CalculateEstimates();
|
||||
}
|
||||
|
||||
private void LargeSavestateNumeric_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
CalculateEstimates();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -673,7 +673,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void OpenGameGenieEncoderDecoderMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
GlobalWin.MainForm.LoadGameGenieEC();
|
||||
GlobalWin.MainForm.LoadGameGenieEc();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public static void client_closerom()
|
||||
{
|
||||
GlobalWin.MainForm.CloseROM();
|
||||
GlobalWin.MainForm.CloseRom();
|
||||
}
|
||||
|
||||
public static void client_enablerewind(object boolean)
|
||||
|
|
|
@ -125,7 +125,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void NESGameGenie_Click(object sender, EventArgs e)
|
||||
{
|
||||
GlobalWin.MainForm.LoadGameGenieEC();
|
||||
GlobalWin.MainForm.LoadGameGenieEc();
|
||||
}
|
||||
|
||||
private void NESNameTable_Click(object sender, EventArgs e)
|
||||
|
@ -161,17 +161,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void SNESGameGenie_Click(object sender, EventArgs e)
|
||||
{
|
||||
GlobalWin.MainForm.LoadGameGenieEC();
|
||||
GlobalWin.MainForm.LoadGameGenieEc();
|
||||
}
|
||||
|
||||
private void GGGameGenie_Click(object sender, EventArgs e)
|
||||
{
|
||||
GlobalWin.MainForm.LoadGameGenieEC();
|
||||
GlobalWin.MainForm.LoadGameGenieEc();
|
||||
}
|
||||
|
||||
private void GBGameGenie_Click(object sender, EventArgs e)
|
||||
{
|
||||
GlobalWin.MainForm.LoadGameGenieEC();
|
||||
GlobalWin.MainForm.LoadGameGenieEc();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
|
@ -211,6 +209,39 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void UpdateToolsBefore(bool fromLua = false)
|
||||
{
|
||||
if (Has<LuaConsole>())
|
||||
{
|
||||
if (!fromLua)
|
||||
{
|
||||
LuaConsole.StartLuaDrawing();
|
||||
}
|
||||
LuaConsole.LuaImp.CallFrameBeforeEvent();
|
||||
}
|
||||
UpdateBefore();
|
||||
}
|
||||
|
||||
public void UpdateToolsAfter(bool fromLua = false)
|
||||
{
|
||||
if (!fromLua && Has<LuaConsole>())
|
||||
{
|
||||
LuaConsole.ResumeScripts(true);
|
||||
}
|
||||
|
||||
GlobalWin.Tools.UpdateAfter();
|
||||
|
||||
if (Has<LuaConsole>())
|
||||
{
|
||||
LuaConsole.LuaImp.CallFrameAfterEvent();
|
||||
if (!fromLua)
|
||||
{
|
||||
GlobalWin.DisplayManager.PreFrameUpdateLuaSource();
|
||||
LuaConsole.EndLuaDrawing();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Note: Referencing these properties creates an instance of the tool and persists it. They should be referenced by type if this is not desired
|
||||
#region Tools
|
||||
|
||||
|
|
Loading…
Reference in New Issue