Add default constructor to GameInfo to avoid null reference crashes, right click menu during null emulator now no longer crashes (and probably a number of other situations). Added BizHawk back to the Main form text property instead of 0

This commit is contained in:
andres.delikat 2011-08-10 23:50:01 +00:00
parent 9e9b3051a8
commit 124da117b8
4 changed files with 180 additions and 165 deletions

View File

@ -3,96 +3,103 @@ using System.Linq;
namespace BizHawk namespace BizHawk
{ {
public enum RomStatus public enum RomStatus
{ {
GoodDump, GoodDump,
BadDump, BadDump,
Homebrew, Homebrew,
TranslatedRom, TranslatedRom,
Hack, Hack,
BIOS, BIOS,
Overdump, Overdump,
NotInDatabase NotInDatabase
} }
public class GameInfo public class GameInfo
{ {
public string Name; public string Name;
public string System; public string System;
public string Hash; public string Hash;
public RomStatus Status; public RomStatus Status;
public bool NotInDatabase = true; public bool NotInDatabase = true;
private Dictionary<string, string> Options = new Dictionary<string, string>(); private Dictionary<string, string> Options = new Dictionary<string, string>();
public GameInfo() {} public GameInfo()
{
Name = "Null";
System = "NULL";
Hash = "";
Status = RomStatus.GoodDump;
NotInDatabase = false;
}
internal GameInfo(CompactGameInfo cgi) internal GameInfo(CompactGameInfo cgi)
{ {
Name = cgi.Name; Name = cgi.Name;
System = cgi.System; System = cgi.System;
Hash = cgi.Hash; Hash = cgi.Hash;
Status = cgi.Status; Status = cgi.Status;
NotInDatabase = false; NotInDatabase = false;
ParseOptionsDictionary(cgi.MetaData); ParseOptionsDictionary(cgi.MetaData);
} }
public void AddOption(string option) public void AddOption(string option)
{ {
Options[option] = ""; Options[option] = "";
} }
public void AddOption(string option, string param) public void AddOption(string option, string param)
{ {
Options[option] = param; Options[option] = param;
} }
public void RemoveOption(string option) public void RemoveOption(string option)
{ {
Options.Remove(option); Options.Remove(option);
} }
public bool this[string option] public bool this[string option]
{ {
get { return Options.ContainsKey(option); } get { return Options.ContainsKey(option); }
} }
public bool OptionPresent(string option) public bool OptionPresent(string option)
{ {
return Options.ContainsKey(option); return Options.ContainsKey(option);
} }
public string OptionValue(string option) public string OptionValue(string option)
{ {
if (Options.ContainsKey(option)) if (Options.ContainsKey(option))
return Options[option]; return Options[option];
return null; return null;
} }
public ICollection<string> GetOptions() public ICollection<string> GetOptions()
{ {
return Options.Keys; return Options.Keys;
} }
public IDictionary<string,string> GetOptionsDict() public IDictionary<string, string> GetOptionsDict()
{ {
return new ReadOnlyDictionary<string,string>(Options); return new ReadOnlyDictionary<string, string>(Options);
} }
private void ParseOptionsDictionary(string metaData) private void ParseOptionsDictionary(string metaData)
{ {
if (string.IsNullOrEmpty(metaData)) if (string.IsNullOrEmpty(metaData))
return; return;
var options = metaData.Split(';').Where(opt => string.IsNullOrEmpty(opt) == false).ToArray(); var options = metaData.Split(';').Where(opt => string.IsNullOrEmpty(opt) == false).ToArray();
foreach (var opt in options) foreach (var opt in options)
{ {
var parts = opt.Split('='); var parts = opt.Split('=');
var key = parts[0]; var key = parts[0];
var value = parts.Length > 1 ? parts[1] : ""; var value = parts.Length > 1 ? parts[1] : "";
Options[key] = value; Options[key] = value;
} }
} }
} }
} }

View File

@ -263,7 +263,7 @@
this.menuStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow; this.menuStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow;
this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(470, 40); this.menuStrip1.Size = new System.Drawing.Size(470, 21);
this.menuStrip1.TabIndex = 0; this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1"; this.menuStrip1.Text = "menuStrip1";
this.menuStrip1.MenuDeactivate += new System.EventHandler(this.menuStrip1_MenuDeactivate); this.menuStrip1.MenuDeactivate += new System.EventHandler(this.menuStrip1_MenuDeactivate);
@ -885,33 +885,33 @@
// //
this.pauseToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Pause; this.pauseToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Pause;
this.pauseToolStripMenuItem.Name = "pauseToolStripMenuItem"; this.pauseToolStripMenuItem.Name = "pauseToolStripMenuItem";
this.pauseToolStripMenuItem.Size = new System.Drawing.Size(144, 22); this.pauseToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.pauseToolStripMenuItem.Text = "&Pause"; this.pauseToolStripMenuItem.Text = "&Pause";
this.pauseToolStripMenuItem.Click += new System.EventHandler(this.pauseToolStripMenuItem_Click); this.pauseToolStripMenuItem.Click += new System.EventHandler(this.pauseToolStripMenuItem_Click);
// //
// toolStripSeparator1 // toolStripSeparator1
// //
this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(141, 6); this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6);
// //
// powerToolStripMenuItem // powerToolStripMenuItem
// //
this.powerToolStripMenuItem.Name = "powerToolStripMenuItem"; this.powerToolStripMenuItem.Name = "powerToolStripMenuItem";
this.powerToolStripMenuItem.Size = new System.Drawing.Size(144, 22); this.powerToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.powerToolStripMenuItem.Text = "Power Cycle"; this.powerToolStripMenuItem.Text = "Power Cycle";
this.powerToolStripMenuItem.Click += new System.EventHandler(this.powerToolStripMenuItem_Click); this.powerToolStripMenuItem.Click += new System.EventHandler(this.powerToolStripMenuItem_Click);
// //
// resetToolStripMenuItem // resetToolStripMenuItem
// //
this.resetToolStripMenuItem.Name = "resetToolStripMenuItem"; this.resetToolStripMenuItem.Name = "resetToolStripMenuItem";
this.resetToolStripMenuItem.Size = new System.Drawing.Size(144, 22); this.resetToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.resetToolStripMenuItem.Text = "&Reset"; this.resetToolStripMenuItem.Text = "&Reset";
this.resetToolStripMenuItem.Click += new System.EventHandler(this.resetToolStripMenuItem_Click); this.resetToolStripMenuItem.Click += new System.EventHandler(this.resetToolStripMenuItem_Click);
// //
// toolStripSeparator8 // toolStripSeparator8
// //
this.toolStripSeparator8.Name = "toolStripSeparator8"; this.toolStripSeparator8.Name = "toolStripSeparator8";
this.toolStripSeparator8.Size = new System.Drawing.Size(141, 6); this.toolStripSeparator8.Size = new System.Drawing.Size(149, 6);
// //
// sega8bitToolStripMenuItem // sega8bitToolStripMenuItem
// //
@ -920,7 +920,7 @@
this.overclockWhenKnownSafeToolStripMenuItem, this.overclockWhenKnownSafeToolStripMenuItem,
this.forceStereoSeparationToolStripMenuItem}); this.forceStereoSeparationToolStripMenuItem});
this.sega8bitToolStripMenuItem.Name = "sega8bitToolStripMenuItem"; this.sega8bitToolStripMenuItem.Name = "sega8bitToolStripMenuItem";
this.sega8bitToolStripMenuItem.Size = new System.Drawing.Size(144, 22); this.sega8bitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.sega8bitToolStripMenuItem.Text = "Sega 8-bit"; this.sega8bitToolStripMenuItem.Text = "Sega 8-bit";
// //
// enableFMChipToolStripMenuItem // enableFMChipToolStripMenuItem
@ -1116,7 +1116,7 @@
// //
this.controllersToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.GameController; this.controllersToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.GameController;
this.controllersToolStripMenuItem.Name = "controllersToolStripMenuItem"; this.controllersToolStripMenuItem.Name = "controllersToolStripMenuItem";
this.controllersToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.controllersToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.controllersToolStripMenuItem.Text = "&Controllers..."; this.controllersToolStripMenuItem.Text = "&Controllers...";
this.controllersToolStripMenuItem.Click += new System.EventHandler(this.controllersToolStripMenuItem_Click); this.controllersToolStripMenuItem.Click += new System.EventHandler(this.controllersToolStripMenuItem_Click);
// //
@ -1124,7 +1124,7 @@
// //
this.hotkeysToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.HotKeys; this.hotkeysToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.HotKeys;
this.hotkeysToolStripMenuItem.Name = "hotkeysToolStripMenuItem"; this.hotkeysToolStripMenuItem.Name = "hotkeysToolStripMenuItem";
this.hotkeysToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.hotkeysToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.hotkeysToolStripMenuItem.Text = "&Hotkeys..."; this.hotkeysToolStripMenuItem.Text = "&Hotkeys...";
this.hotkeysToolStripMenuItem.Click += new System.EventHandler(this.hotkeysToolStripMenuItem_Click); this.hotkeysToolStripMenuItem.Click += new System.EventHandler(this.hotkeysToolStripMenuItem_Click);
// //
@ -1132,7 +1132,7 @@
// //
this.messagesToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.MessageConfig; this.messagesToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.MessageConfig;
this.messagesToolStripMenuItem.Name = "messagesToolStripMenuItem"; this.messagesToolStripMenuItem.Name = "messagesToolStripMenuItem";
this.messagesToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.messagesToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.messagesToolStripMenuItem.Text = "&Messages..."; this.messagesToolStripMenuItem.Text = "&Messages...";
this.messagesToolStripMenuItem.Click += new System.EventHandler(this.messagesToolStripMenuItem_Click); this.messagesToolStripMenuItem.Click += new System.EventHandler(this.messagesToolStripMenuItem_Click);
// //
@ -1140,7 +1140,7 @@
// //
this.pathsToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.CopyFolderHS; this.pathsToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.CopyFolderHS;
this.pathsToolStripMenuItem.Name = "pathsToolStripMenuItem"; this.pathsToolStripMenuItem.Name = "pathsToolStripMenuItem";
this.pathsToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.pathsToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.pathsToolStripMenuItem.Text = "Paths..."; this.pathsToolStripMenuItem.Text = "Paths...";
this.pathsToolStripMenuItem.Click += new System.EventHandler(this.pathsToolStripMenuItem_Click); this.pathsToolStripMenuItem.Click += new System.EventHandler(this.pathsToolStripMenuItem_Click);
// //
@ -1148,7 +1148,7 @@
// //
this.soundToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.AudioHS; this.soundToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.AudioHS;
this.soundToolStripMenuItem.Name = "soundToolStripMenuItem"; this.soundToolStripMenuItem.Name = "soundToolStripMenuItem";
this.soundToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.soundToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.soundToolStripMenuItem.Text = "&Sound..."; this.soundToolStripMenuItem.Text = "&Sound...";
this.soundToolStripMenuItem.Click += new System.EventHandler(this.soundToolStripMenuItem_Click); this.soundToolStripMenuItem.Click += new System.EventHandler(this.soundToolStripMenuItem_Click);
// //
@ -1156,14 +1156,14 @@
// //
this.autofireToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Lightning; this.autofireToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Lightning;
this.autofireToolStripMenuItem.Name = "autofireToolStripMenuItem"; this.autofireToolStripMenuItem.Name = "autofireToolStripMenuItem";
this.autofireToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.autofireToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.autofireToolStripMenuItem.Text = "&Autofire..."; this.autofireToolStripMenuItem.Text = "&Autofire...";
this.autofireToolStripMenuItem.Click += new System.EventHandler(this.autofireToolStripMenuItem_Click); this.autofireToolStripMenuItem.Click += new System.EventHandler(this.autofireToolStripMenuItem_Click);
// //
// toolStripSeparator9 // toolStripSeparator9
// //
this.toolStripSeparator9.Name = "toolStripSeparator9"; this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new System.Drawing.Size(149, 6); this.toolStripSeparator9.Size = new System.Drawing.Size(146, 6);
// //
// gUIToolStripMenuItem // gUIToolStripMenuItem
// //
@ -1179,7 +1179,7 @@
this.enableContextMenuToolStripMenuItem, this.enableContextMenuToolStripMenuItem,
this.backupSavestatesToolStripMenuItem}); this.backupSavestatesToolStripMenuItem});
this.gUIToolStripMenuItem.Name = "gUIToolStripMenuItem"; this.gUIToolStripMenuItem.Name = "gUIToolStripMenuItem";
this.gUIToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.gUIToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.gUIToolStripMenuItem.Text = "GUI"; this.gUIToolStripMenuItem.Text = "GUI";
this.gUIToolStripMenuItem.DropDownOpened += new System.EventHandler(this.gUIToolStripMenuItem_DropDownOpened); this.gUIToolStripMenuItem.DropDownOpened += new System.EventHandler(this.gUIToolStripMenuItem_DropDownOpened);
// //
@ -1277,7 +1277,7 @@
this.miSpeed150, this.miSpeed150,
this.miSpeed200}); this.miSpeed200});
this.frameSkipToolStripMenuItem.Name = "frameSkipToolStripMenuItem"; this.frameSkipToolStripMenuItem.Name = "frameSkipToolStripMenuItem";
this.frameSkipToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.frameSkipToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.frameSkipToolStripMenuItem.Text = "Speed/Skip"; this.frameSkipToolStripMenuItem.Text = "Speed/Skip";
this.frameSkipToolStripMenuItem.DropDownOpened += new System.EventHandler(this.frameSkipToolStripMenuItem_DropDownOpened); this.frameSkipToolStripMenuItem.DropDownOpened += new System.EventHandler(this.frameSkipToolStripMenuItem_DropDownOpened);
// //
@ -1420,13 +1420,13 @@
// toolStripSeparator10 // toolStripSeparator10
// //
this.toolStripSeparator10.Name = "toolStripSeparator10"; this.toolStripSeparator10.Name = "toolStripSeparator10";
this.toolStripSeparator10.Size = new System.Drawing.Size(149, 6); this.toolStripSeparator10.Size = new System.Drawing.Size(146, 6);
// //
// saveConfigToolStripMenuItem // saveConfigToolStripMenuItem
// //
this.saveConfigToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Save; this.saveConfigToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Save;
this.saveConfigToolStripMenuItem.Name = "saveConfigToolStripMenuItem"; this.saveConfigToolStripMenuItem.Name = "saveConfigToolStripMenuItem";
this.saveConfigToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.saveConfigToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.saveConfigToolStripMenuItem.Text = "Save Config"; this.saveConfigToolStripMenuItem.Text = "Save Config";
this.saveConfigToolStripMenuItem.Click += new System.EventHandler(this.saveConfigToolStripMenuItem_Click); this.saveConfigToolStripMenuItem.Click += new System.EventHandler(this.saveConfigToolStripMenuItem_Click);
// //
@ -1434,7 +1434,7 @@
// //
this.loadConfigToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.LoadConfig; this.loadConfigToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.LoadConfig;
this.loadConfigToolStripMenuItem.Name = "loadConfigToolStripMenuItem"; this.loadConfigToolStripMenuItem.Name = "loadConfigToolStripMenuItem";
this.loadConfigToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.loadConfigToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.loadConfigToolStripMenuItem.Text = "Load Config"; this.loadConfigToolStripMenuItem.Text = "Load Config";
// //
// toolsToolStripMenuItem // toolsToolStripMenuItem
@ -1459,20 +1459,20 @@
// //
this.toolBoxToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.ToolBox; this.toolBoxToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.ToolBox;
this.toolBoxToolStripMenuItem.Name = "toolBoxToolStripMenuItem"; this.toolBoxToolStripMenuItem.Name = "toolBoxToolStripMenuItem";
this.toolBoxToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.toolBoxToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.toolBoxToolStripMenuItem.Text = "&Tool Box"; this.toolBoxToolStripMenuItem.Text = "&Tool Box";
this.toolBoxToolStripMenuItem.Click += new System.EventHandler(this.toolBoxToolStripMenuItem_Click); this.toolBoxToolStripMenuItem.Click += new System.EventHandler(this.toolBoxToolStripMenuItem_Click);
// //
// toolStripSeparator12 // toolStripSeparator12
// //
this.toolStripSeparator12.Name = "toolStripSeparator12"; this.toolStripSeparator12.Name = "toolStripSeparator12";
this.toolStripSeparator12.Size = new System.Drawing.Size(149, 6); this.toolStripSeparator12.Size = new System.Drawing.Size(140, 6);
// //
// rAMWatchToolStripMenuItem // rAMWatchToolStripMenuItem
// //
this.rAMWatchToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.FindHS; this.rAMWatchToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.FindHS;
this.rAMWatchToolStripMenuItem.Name = "rAMWatchToolStripMenuItem"; this.rAMWatchToolStripMenuItem.Name = "rAMWatchToolStripMenuItem";
this.rAMWatchToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.rAMWatchToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.rAMWatchToolStripMenuItem.Text = "RAM &Watch"; this.rAMWatchToolStripMenuItem.Text = "RAM &Watch";
this.rAMWatchToolStripMenuItem.Click += new System.EventHandler(this.RAMWatchToolStripMenuItem_Click); this.rAMWatchToolStripMenuItem.Click += new System.EventHandler(this.RAMWatchToolStripMenuItem_Click);
// //
@ -1480,7 +1480,7 @@
// //
this.rAMSearchToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.search; this.rAMSearchToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.search;
this.rAMSearchToolStripMenuItem.Name = "rAMSearchToolStripMenuItem"; this.rAMSearchToolStripMenuItem.Name = "rAMSearchToolStripMenuItem";
this.rAMSearchToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.rAMSearchToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.rAMSearchToolStripMenuItem.Text = "RAM &Search"; this.rAMSearchToolStripMenuItem.Text = "RAM &Search";
this.rAMSearchToolStripMenuItem.Click += new System.EventHandler(this.rAMSearchToolStripMenuItem_Click); this.rAMSearchToolStripMenuItem.Click += new System.EventHandler(this.rAMSearchToolStripMenuItem_Click);
// //
@ -1488,7 +1488,7 @@
// //
this.rAMPokeToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.poke; this.rAMPokeToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.poke;
this.rAMPokeToolStripMenuItem.Name = "rAMPokeToolStripMenuItem"; this.rAMPokeToolStripMenuItem.Name = "rAMPokeToolStripMenuItem";
this.rAMPokeToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.rAMPokeToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.rAMPokeToolStripMenuItem.Text = "RAM &Poke"; this.rAMPokeToolStripMenuItem.Text = "RAM &Poke";
this.rAMPokeToolStripMenuItem.Click += new System.EventHandler(this.RAMPokeToolStripMenuItem_Click); this.rAMPokeToolStripMenuItem.Click += new System.EventHandler(this.RAMPokeToolStripMenuItem_Click);
// //
@ -1496,7 +1496,7 @@
// //
this.hexEditorToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.poke; this.hexEditorToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.poke;
this.hexEditorToolStripMenuItem.Name = "hexEditorToolStripMenuItem"; this.hexEditorToolStripMenuItem.Name = "hexEditorToolStripMenuItem";
this.hexEditorToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.hexEditorToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.hexEditorToolStripMenuItem.Text = "&Hex Editor"; this.hexEditorToolStripMenuItem.Text = "&Hex Editor";
this.hexEditorToolStripMenuItem.Click += new System.EventHandler(this.hexEditorToolStripMenuItem_Click); this.hexEditorToolStripMenuItem.Click += new System.EventHandler(this.hexEditorToolStripMenuItem_Click);
// //
@ -1504,20 +1504,20 @@
// //
this.tAStudioToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.TAStudio; this.tAStudioToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.TAStudio;
this.tAStudioToolStripMenuItem.Name = "tAStudioToolStripMenuItem"; this.tAStudioToolStripMenuItem.Name = "tAStudioToolStripMenuItem";
this.tAStudioToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.tAStudioToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.tAStudioToolStripMenuItem.Text = "&TAStudio"; this.tAStudioToolStripMenuItem.Text = "&TAStudio";
this.tAStudioToolStripMenuItem.Click += new System.EventHandler(this.tAStudioToolStripMenuItem_Click); this.tAStudioToolStripMenuItem.Click += new System.EventHandler(this.tAStudioToolStripMenuItem_Click);
// //
// toolStripSeparator11 // toolStripSeparator11
// //
this.toolStripSeparator11.Name = "toolStripSeparator11"; this.toolStripSeparator11.Name = "toolStripSeparator11";
this.toolStripSeparator11.Size = new System.Drawing.Size(149, 6); this.toolStripSeparator11.Size = new System.Drawing.Size(140, 6);
// //
// luaConsoleToolStripMenuItem // luaConsoleToolStripMenuItem
// //
this.luaConsoleToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Lua; this.luaConsoleToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Lua;
this.luaConsoleToolStripMenuItem.Name = "luaConsoleToolStripMenuItem"; this.luaConsoleToolStripMenuItem.Name = "luaConsoleToolStripMenuItem";
this.luaConsoleToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.luaConsoleToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.luaConsoleToolStripMenuItem.Text = "Lua Console"; this.luaConsoleToolStripMenuItem.Text = "Lua Console";
this.luaConsoleToolStripMenuItem.Click += new System.EventHandler(this.luaConsoleToolStripMenuItem_Click); this.luaConsoleToolStripMenuItem.Click += new System.EventHandler(this.luaConsoleToolStripMenuItem_Click);
// //
@ -1525,7 +1525,7 @@
// //
this.cheatsToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Freeze; this.cheatsToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Freeze;
this.cheatsToolStripMenuItem.Name = "cheatsToolStripMenuItem"; this.cheatsToolStripMenuItem.Name = "cheatsToolStripMenuItem";
this.cheatsToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.cheatsToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.cheatsToolStripMenuItem.Text = "Cheats"; this.cheatsToolStripMenuItem.Text = "Cheats";
this.cheatsToolStripMenuItem.Click += new System.EventHandler(this.cheatsToolStripMenuItem_Click); this.cheatsToolStripMenuItem.Click += new System.EventHandler(this.cheatsToolStripMenuItem_Click);
// //
@ -1982,7 +1982,7 @@
this.MainMenuStrip = this.menuStrip1; this.MainMenuStrip = this.menuStrip1;
this.MaximizeBox = false; this.MaximizeBox = false;
this.Name = "MainForm"; this.Name = "MainForm";
this.Text = "0"; this.Text = "BizHawk";
this.Deactivate += new System.EventHandler(this.MainForm_Deactivate); this.Deactivate += new System.EventHandler(this.MainForm_Deactivate);
this.Load += new System.EventHandler(this.MainForm_Load); this.Load += new System.EventHandler(this.MainForm_Load);
this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.MainForm_MouseClick); this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.MainForm_MouseClick);

View File

@ -1474,7 +1474,14 @@ namespace BizHawk.MultiClient
//handle the initial trigger of a frame advance //handle the initial trigger of a frame advance
if (FrameAdvanceTimestamp == DateTime.MinValue) if (FrameAdvanceTimestamp == DateTime.MinValue)
{ {
if (!EmulatorPaused) PauseEmulator(); if (!EmulatorPaused && !Global.Emulator.IsLagFrame)
{
PauseEmulator();
}
else if (Global.Emulator.IsLagFrame)
PressFrameAdvance = true;
runFrame = true; runFrame = true;
runloop_frameadvance = true; runloop_frameadvance = true;
FrameAdvanceTimestamp = now; FrameAdvanceTimestamp = now;
@ -1489,7 +1496,8 @@ namespace BizHawk.MultiClient
UnpauseEmulator(); UnpauseEmulator();
} }
} }
PressFrameAdvance = false; if (!Global.Emulator.IsLagFrame)
PressFrameAdvance = false;
} }
else else
{ {

View File

@ -261,64 +261,64 @@ namespace BizHawk.MultiClient
return path; return path;
} }
public static string FilesystemSafeName(GameInfo game) public static string FilesystemSafeName(GameInfo game)
{ {
string filesystemSafeName = game.Name.Replace("|", "+"); string filesystemSafeName = game.Name.Replace("|", "+");
return Path.Combine(Path.GetDirectoryName(filesystemSafeName), Path.GetFileNameWithoutExtension(filesystemSafeName)); return Path.Combine(Path.GetDirectoryName(filesystemSafeName), Path.GetFileNameWithoutExtension(filesystemSafeName));
} }
public static string SaveRamPath(GameInfo game) public static string SaveRamPath(GameInfo game)
{ {
string name = FilesystemSafeName(game); string name = FilesystemSafeName(game);
switch (game.System) switch (game.System)
{ {
case "SMS": return Path.Combine(MakeAbsolutePath(Global.Config.PathSMSSaveRAM, "SMS"), name + ".SaveRAM"); case "SMS": return Path.Combine(MakeAbsolutePath(Global.Config.PathSMSSaveRAM, "SMS"), name + ".SaveRAM");
case "GG": return Path.Combine(MakeAbsolutePath(Global.Config.PathGGSaveRAM, "GG"), name + ".SaveRAM"); case "GG": return Path.Combine(MakeAbsolutePath(Global.Config.PathGGSaveRAM, "GG"), name + ".SaveRAM");
case "SG": return Path.Combine(MakeAbsolutePath(Global.Config.PathSGSaveRAM, "SG"), name + ".SaveRAM"); case "SG": return Path.Combine(MakeAbsolutePath(Global.Config.PathSGSaveRAM, "SG"), name + ".SaveRAM");
case "SGX": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESaveRAM, "PCE"), name + ".SaveRAM"); case "SGX": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESaveRAM, "PCE"), name + ".SaveRAM");
case "PCE": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESaveRAM, "PCE"), name + ".SaveRAM"); case "PCE": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESaveRAM, "PCE"), name + ".SaveRAM");
case "GB": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBSaveRAM, "GB"), name + ".SaveRAM"); case "GB": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBSaveRAM, "GB"), name + ".SaveRAM");
case "GEN": return Path.Combine(MakeAbsolutePath(Global.Config.PathGenesisSaveRAM, "GEN"), name + ".SaveRAM"); case "GEN": return Path.Combine(MakeAbsolutePath(Global.Config.PathGenesisSaveRAM, "GEN"), name + ".SaveRAM");
case "NES": return Path.Combine(MakeAbsolutePath(Global.Config.PathNESSaveRAM, "NES"), name + ".SaveRAM"); case "NES": return Path.Combine(MakeAbsolutePath(Global.Config.PathNESSaveRAM, "NES"), name + ".SaveRAM");
case "TI83": return Path.Combine(MakeAbsolutePath(Global.Config.PathTI83SaveRAM, "TI83"), name + ".SaveRAM"); case "TI83": return Path.Combine(MakeAbsolutePath(Global.Config.PathTI83SaveRAM, "TI83"), name + ".SaveRAM");
} }
return ""; return "";
} }
public static string SaveStatePrefix(GameInfo game) public static string SaveStatePrefix(GameInfo game)
{ {
string name = FilesystemSafeName(game); string name = FilesystemSafeName(game);
switch (game.System) switch (game.System)
{ {
case "SMS": return Path.Combine(MakeAbsolutePath(Global.Config.PathSMSSavestates, "SMS"), name); case "SMS": return Path.Combine(MakeAbsolutePath(Global.Config.PathSMSSavestates, "SMS"), name);
case "GG": return Path.Combine(MakeAbsolutePath(Global.Config.PathGGSavestates, "GG"), name); case "GG": return Path.Combine(MakeAbsolutePath(Global.Config.PathGGSavestates, "GG"), name);
case "SG": return Path.Combine(MakeAbsolutePath(Global.Config.PathSGSavestates, "SG"), name); case "SG": return Path.Combine(MakeAbsolutePath(Global.Config.PathSGSavestates, "SG"), name);
case "SGX": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE"), name); case "SGX": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE"), name);
case "PCE": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE"), name); case "PCE": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE"), name);
case "GB": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBSavestates, "GB"), name); case "GB": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBSavestates, "GB"), name);
case "GEN": return Path.Combine(MakeAbsolutePath(Global.Config.PathGenesisSavestates, "GEN"), name); case "GEN": return Path.Combine(MakeAbsolutePath(Global.Config.PathGenesisSavestates, "GEN"), name);
case "NES": return Path.Combine(MakeAbsolutePath(Global.Config.PathNESSavestates, "NES"), name); case "NES": return Path.Combine(MakeAbsolutePath(Global.Config.PathNESSavestates, "NES"), name);
case "TI83": return Path.Combine(MakeAbsolutePath(Global.Config.PathTI83Savestates, "TI83"), name); case "TI83": return Path.Combine(MakeAbsolutePath(Global.Config.PathTI83Savestates, "TI83"), name);
} }
return ""; return "";
} }
public static string ScreenshotPrefix(GameInfo game) public static string ScreenshotPrefix(GameInfo game)
{ {
string name = FilesystemSafeName(game); string name = FilesystemSafeName(game);
switch (game.System) switch (game.System)
{ {
case "SMS": return Path.Combine(MakeAbsolutePath(Global.Config.PathSMSScreenshots, "SMS"), name); case "SMS": return Path.Combine(MakeAbsolutePath(Global.Config.PathSMSScreenshots, "SMS"), name);
case "GG": return Path.Combine(MakeAbsolutePath(Global.Config.PathGGScreenshots, "GG"), name); case "GG": return Path.Combine(MakeAbsolutePath(Global.Config.PathGGScreenshots, "GG"), name);
case "SG": return Path.Combine(MakeAbsolutePath(Global.Config.PathSGScreenshots, "SG"), name); case "SG": return Path.Combine(MakeAbsolutePath(Global.Config.PathSGScreenshots, "SG"), name);
case "SGX": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCEScreenshots, "PCE"), name); case "SGX": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCEScreenshots, "PCE"), name);
case "PCE": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCEScreenshots, "PCE"), name); case "PCE": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCEScreenshots, "PCE"), name);
case "GB": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBScreenshots, "GB"), name); case "GB": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBScreenshots, "GB"), name);
case "GEN": return Path.Combine(MakeAbsolutePath(Global.Config.PathGenesisScreenshots, "GEN"), name); case "GEN": return Path.Combine(MakeAbsolutePath(Global.Config.PathGenesisScreenshots, "GEN"), name);
case "NES": return Path.Combine(MakeAbsolutePath(Global.Config.PathNESScreenshots, "NES"), name); case "NES": return Path.Combine(MakeAbsolutePath(Global.Config.PathNESScreenshots, "NES"), name);
case "TI83": return Path.Combine(MakeAbsolutePath(Global.Config.PathTI83Screenshots, "TI83"), name); case "TI83": return Path.Combine(MakeAbsolutePath(Global.Config.PathTI83Screenshots, "TI83"), name);
} }
return ""; return "";
} }
} }
} }