From 124da117b877d0c05db3af8e0e856cca7dd44af9 Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Wed, 10 Aug 2011 23:50:01 +0000 Subject: [PATCH] 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 --- BizHawk.Emulation/Database/GameInfo.cs | 161 +++++++++++----------- BizHawk.MultiClient/MainForm.Designer.cs | 60 ++++---- BizHawk.MultiClient/MainForm.cs | 12 +- BizHawk.MultiClient/config/PathManager.cs | 112 +++++++-------- 4 files changed, 180 insertions(+), 165 deletions(-) diff --git a/BizHawk.Emulation/Database/GameInfo.cs b/BizHawk.Emulation/Database/GameInfo.cs index f64b792fcb..77c5323984 100644 --- a/BizHawk.Emulation/Database/GameInfo.cs +++ b/BizHawk.Emulation/Database/GameInfo.cs @@ -3,96 +3,103 @@ using System.Linq; namespace BizHawk { - public enum RomStatus - { - GoodDump, - BadDump, - Homebrew, - TranslatedRom, - Hack, - BIOS, - Overdump, - NotInDatabase - } + public enum RomStatus + { + GoodDump, + BadDump, + Homebrew, + TranslatedRom, + Hack, + BIOS, + Overdump, + NotInDatabase + } - public class GameInfo - { - public string Name; - public string System; - public string Hash; - public RomStatus Status; - public bool NotInDatabase = true; + public class GameInfo + { + public string Name; + public string System; + public string Hash; + public RomStatus Status; + public bool NotInDatabase = true; - private Dictionary Options = new Dictionary(); + private Dictionary Options = new Dictionary(); - public GameInfo() {} + public GameInfo() + { + Name = "Null"; + System = "NULL"; + Hash = ""; + Status = RomStatus.GoodDump; + NotInDatabase = false; + } - internal GameInfo(CompactGameInfo cgi) - { - Name = cgi.Name; - System = cgi.System; - Hash = cgi.Hash; - Status = cgi.Status; - NotInDatabase = false; - ParseOptionsDictionary(cgi.MetaData); - } + internal GameInfo(CompactGameInfo cgi) + { + Name = cgi.Name; + System = cgi.System; + Hash = cgi.Hash; + Status = cgi.Status; + NotInDatabase = false; + ParseOptionsDictionary(cgi.MetaData); + } - public void AddOption(string option) - { - Options[option] = ""; - } + public void AddOption(string option) + { + Options[option] = ""; + } - public void AddOption(string option, string param) - { - Options[option] = param; - } + public void AddOption(string option, string param) + { + Options[option] = param; + } - public void RemoveOption(string option) - { - Options.Remove(option); - } + public void RemoveOption(string option) + { + Options.Remove(option); + } - public bool this[string option] - { - get { return Options.ContainsKey(option); } - } + public bool this[string option] + { + get { return Options.ContainsKey(option); } + } - public bool OptionPresent(string option) - { - return Options.ContainsKey(option); - } + public bool OptionPresent(string option) + { + return Options.ContainsKey(option); + } - public string OptionValue(string option) - { - if (Options.ContainsKey(option)) - return Options[option]; - return null; - } + public string OptionValue(string option) + { + if (Options.ContainsKey(option)) + return Options[option]; + return null; + } - public ICollection GetOptions() - { - return Options.Keys; + public ICollection GetOptions() + { + return Options.Keys; - } - public IDictionary GetOptionsDict() - { - return new ReadOnlyDictionary(Options); - } + } + public IDictionary GetOptionsDict() + { + return new ReadOnlyDictionary(Options); + } - private void ParseOptionsDictionary(string metaData) - { - if (string.IsNullOrEmpty(metaData)) - return; + private void ParseOptionsDictionary(string metaData) + { + if (string.IsNullOrEmpty(metaData)) + 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) - { - var parts = opt.Split('='); - var key = parts[0]; - var value = parts.Length > 1 ? parts[1] : ""; - Options[key] = value; - } - } - } + foreach (var opt in options) + { + var parts = opt.Split('='); + var key = parts[0]; + var value = parts.Length > 1 ? parts[1] : ""; + Options[key] = value; + } + } + } } diff --git a/BizHawk.MultiClient/MainForm.Designer.cs b/BizHawk.MultiClient/MainForm.Designer.cs index 27babd5bef..4d5b0128db 100644 --- a/BizHawk.MultiClient/MainForm.Designer.cs +++ b/BizHawk.MultiClient/MainForm.Designer.cs @@ -263,7 +263,7 @@ this.menuStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow; this.menuStrip1.Location = new System.Drawing.Point(0, 0); 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.Text = "menuStrip1"; this.menuStrip1.MenuDeactivate += new System.EventHandler(this.menuStrip1_MenuDeactivate); @@ -885,33 +885,33 @@ // this.pauseToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Pause; 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.Click += new System.EventHandler(this.pauseToolStripMenuItem_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(141, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6); // // 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.Click += new System.EventHandler(this.powerToolStripMenuItem_Click); // // 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.Click += new System.EventHandler(this.resetToolStripMenuItem_Click); // // toolStripSeparator8 // this.toolStripSeparator8.Name = "toolStripSeparator8"; - this.toolStripSeparator8.Size = new System.Drawing.Size(141, 6); + this.toolStripSeparator8.Size = new System.Drawing.Size(149, 6); // // sega8bitToolStripMenuItem // @@ -920,7 +920,7 @@ this.overclockWhenKnownSafeToolStripMenuItem, this.forceStereoSeparationToolStripMenuItem}); 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"; // // enableFMChipToolStripMenuItem @@ -1116,7 +1116,7 @@ // this.controllersToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.GameController; 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.Click += new System.EventHandler(this.controllersToolStripMenuItem_Click); // @@ -1124,7 +1124,7 @@ // this.hotkeysToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.HotKeys; 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.Click += new System.EventHandler(this.hotkeysToolStripMenuItem_Click); // @@ -1132,7 +1132,7 @@ // this.messagesToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.MessageConfig; 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.Click += new System.EventHandler(this.messagesToolStripMenuItem_Click); // @@ -1140,7 +1140,7 @@ // this.pathsToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.CopyFolderHS; 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.Click += new System.EventHandler(this.pathsToolStripMenuItem_Click); // @@ -1148,7 +1148,7 @@ // this.soundToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.AudioHS; 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.Click += new System.EventHandler(this.soundToolStripMenuItem_Click); // @@ -1156,14 +1156,14 @@ // this.autofireToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Lightning; 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.Click += new System.EventHandler(this.autofireToolStripMenuItem_Click); // // toolStripSeparator9 // this.toolStripSeparator9.Name = "toolStripSeparator9"; - this.toolStripSeparator9.Size = new System.Drawing.Size(149, 6); + this.toolStripSeparator9.Size = new System.Drawing.Size(146, 6); // // gUIToolStripMenuItem // @@ -1179,7 +1179,7 @@ this.enableContextMenuToolStripMenuItem, this.backupSavestatesToolStripMenuItem}); 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.DropDownOpened += new System.EventHandler(this.gUIToolStripMenuItem_DropDownOpened); // @@ -1277,7 +1277,7 @@ this.miSpeed150, this.miSpeed200}); 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.DropDownOpened += new System.EventHandler(this.frameSkipToolStripMenuItem_DropDownOpened); // @@ -1420,13 +1420,13 @@ // toolStripSeparator10 // this.toolStripSeparator10.Name = "toolStripSeparator10"; - this.toolStripSeparator10.Size = new System.Drawing.Size(149, 6); + this.toolStripSeparator10.Size = new System.Drawing.Size(146, 6); // // saveConfigToolStripMenuItem // this.saveConfigToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Save; 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.Click += new System.EventHandler(this.saveConfigToolStripMenuItem_Click); // @@ -1434,7 +1434,7 @@ // this.loadConfigToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.LoadConfig; 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"; // // toolsToolStripMenuItem @@ -1459,20 +1459,20 @@ // this.toolBoxToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.ToolBox; 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.Click += new System.EventHandler(this.toolBoxToolStripMenuItem_Click); // // toolStripSeparator12 // this.toolStripSeparator12.Name = "toolStripSeparator12"; - this.toolStripSeparator12.Size = new System.Drawing.Size(149, 6); + this.toolStripSeparator12.Size = new System.Drawing.Size(140, 6); // // rAMWatchToolStripMenuItem // this.rAMWatchToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.FindHS; 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.Click += new System.EventHandler(this.RAMWatchToolStripMenuItem_Click); // @@ -1480,7 +1480,7 @@ // this.rAMSearchToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.search; 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.Click += new System.EventHandler(this.rAMSearchToolStripMenuItem_Click); // @@ -1488,7 +1488,7 @@ // this.rAMPokeToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.poke; 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.Click += new System.EventHandler(this.RAMPokeToolStripMenuItem_Click); // @@ -1496,7 +1496,7 @@ // this.hexEditorToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.poke; 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.Click += new System.EventHandler(this.hexEditorToolStripMenuItem_Click); // @@ -1504,20 +1504,20 @@ // this.tAStudioToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.TAStudio; 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.Click += new System.EventHandler(this.tAStudioToolStripMenuItem_Click); // // toolStripSeparator11 // this.toolStripSeparator11.Name = "toolStripSeparator11"; - this.toolStripSeparator11.Size = new System.Drawing.Size(149, 6); + this.toolStripSeparator11.Size = new System.Drawing.Size(140, 6); // // luaConsoleToolStripMenuItem // this.luaConsoleToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Lua; 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.Click += new System.EventHandler(this.luaConsoleToolStripMenuItem_Click); // @@ -1525,7 +1525,7 @@ // this.cheatsToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Freeze; 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.Click += new System.EventHandler(this.cheatsToolStripMenuItem_Click); // @@ -1982,7 +1982,7 @@ this.MainMenuStrip = this.menuStrip1; this.MaximizeBox = false; this.Name = "MainForm"; - this.Text = "0"; + this.Text = "BizHawk"; this.Deactivate += new System.EventHandler(this.MainForm_Deactivate); this.Load += new System.EventHandler(this.MainForm_Load); this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.MainForm_MouseClick); diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 29b95dd156..41d3609136 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -1474,7 +1474,14 @@ namespace BizHawk.MultiClient //handle the initial trigger of a frame advance if (FrameAdvanceTimestamp == DateTime.MinValue) { - if (!EmulatorPaused) PauseEmulator(); + if (!EmulatorPaused && !Global.Emulator.IsLagFrame) + { + + PauseEmulator(); + + } + else if (Global.Emulator.IsLagFrame) + PressFrameAdvance = true; runFrame = true; runloop_frameadvance = true; FrameAdvanceTimestamp = now; @@ -1489,7 +1496,8 @@ namespace BizHawk.MultiClient UnpauseEmulator(); } } - PressFrameAdvance = false; + if (!Global.Emulator.IsLagFrame) + PressFrameAdvance = false; } else { diff --git a/BizHawk.MultiClient/config/PathManager.cs b/BizHawk.MultiClient/config/PathManager.cs index dffd76a173..c383b0202b 100644 --- a/BizHawk.MultiClient/config/PathManager.cs +++ b/BizHawk.MultiClient/config/PathManager.cs @@ -261,64 +261,64 @@ namespace BizHawk.MultiClient return path; } - public static string FilesystemSafeName(GameInfo game) - { - string filesystemSafeName = game.Name.Replace("|", "+"); - return Path.Combine(Path.GetDirectoryName(filesystemSafeName), Path.GetFileNameWithoutExtension(filesystemSafeName)); - } + public static string FilesystemSafeName(GameInfo game) + { + string filesystemSafeName = game.Name.Replace("|", "+"); + return Path.Combine(Path.GetDirectoryName(filesystemSafeName), Path.GetFileNameWithoutExtension(filesystemSafeName)); + } - public static string SaveRamPath(GameInfo game) - { - string name = FilesystemSafeName(game); - switch (game.System) - { - 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 "SG": return Path.Combine(MakeAbsolutePath(Global.Config.PathSGSaveRAM, "SG"), 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 "GB": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBSaveRAM, "GB"), 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 "TI83": return Path.Combine(MakeAbsolutePath(Global.Config.PathTI83SaveRAM, "TI83"), name + ".SaveRAM"); - } - return ""; - } + public static string SaveRamPath(GameInfo game) + { + string name = FilesystemSafeName(game); + switch (game.System) + { + 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 "SG": return Path.Combine(MakeAbsolutePath(Global.Config.PathSGSaveRAM, "SG"), 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 "GB": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBSaveRAM, "GB"), 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 "TI83": return Path.Combine(MakeAbsolutePath(Global.Config.PathTI83SaveRAM, "TI83"), name + ".SaveRAM"); + } + return ""; + } - public static string SaveStatePrefix(GameInfo game) - { - string name = FilesystemSafeName(game); - switch (game.System) - { - case "SMS": return Path.Combine(MakeAbsolutePath(Global.Config.PathSMSSavestates, "SMS"), name); - case "GG": return Path.Combine(MakeAbsolutePath(Global.Config.PathGGSavestates, "GG"), name); - case "SG": return Path.Combine(MakeAbsolutePath(Global.Config.PathSGSavestates, "SG"), name); - case "SGX": 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 "GEN": return Path.Combine(MakeAbsolutePath(Global.Config.PathGenesisSavestates, "GEN"), name); - case "NES": return Path.Combine(MakeAbsolutePath(Global.Config.PathNESSavestates, "NES"), name); - case "TI83": return Path.Combine(MakeAbsolutePath(Global.Config.PathTI83Savestates, "TI83"), name); - } - return ""; - } + public static string SaveStatePrefix(GameInfo game) + { + string name = FilesystemSafeName(game); + switch (game.System) + { + case "SMS": return Path.Combine(MakeAbsolutePath(Global.Config.PathSMSSavestates, "SMS"), name); + case "GG": return Path.Combine(MakeAbsolutePath(Global.Config.PathGGSavestates, "GG"), name); + case "SG": return Path.Combine(MakeAbsolutePath(Global.Config.PathSGSavestates, "SG"), name); + case "SGX": 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 "GEN": return Path.Combine(MakeAbsolutePath(Global.Config.PathGenesisSavestates, "GEN"), name); + case "NES": return Path.Combine(MakeAbsolutePath(Global.Config.PathNESSavestates, "NES"), name); + case "TI83": return Path.Combine(MakeAbsolutePath(Global.Config.PathTI83Savestates, "TI83"), name); + } + return ""; + } - public static string ScreenshotPrefix(GameInfo game) - { - string name = FilesystemSafeName(game); - switch (game.System) - { - case "SMS": return Path.Combine(MakeAbsolutePath(Global.Config.PathSMSScreenshots, "SMS"), name); - case "GG": return Path.Combine(MakeAbsolutePath(Global.Config.PathGGScreenshots, "GG"), name); - case "SG": return Path.Combine(MakeAbsolutePath(Global.Config.PathSGScreenshots, "SG"), name); - case "SGX": 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 "GEN": return Path.Combine(MakeAbsolutePath(Global.Config.PathGenesisScreenshots, "GEN"), name); - case "NES": return Path.Combine(MakeAbsolutePath(Global.Config.PathNESScreenshots, "NES"), name); - case "TI83": return Path.Combine(MakeAbsolutePath(Global.Config.PathTI83Screenshots, "TI83"), name); - } - return ""; - } + public static string ScreenshotPrefix(GameInfo game) + { + string name = FilesystemSafeName(game); + switch (game.System) + { + case "SMS": return Path.Combine(MakeAbsolutePath(Global.Config.PathSMSScreenshots, "SMS"), name); + case "GG": return Path.Combine(MakeAbsolutePath(Global.Config.PathGGScreenshots, "GG"), name); + case "SG": return Path.Combine(MakeAbsolutePath(Global.Config.PathSGScreenshots, "SG"), name); + case "SGX": 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 "GEN": return Path.Combine(MakeAbsolutePath(Global.Config.PathGenesisScreenshots, "GEN"), name); + case "NES": return Path.Combine(MakeAbsolutePath(Global.Config.PathNESScreenshots, "NES"), name); + case "TI83": return Path.Combine(MakeAbsolutePath(Global.Config.PathTI83Screenshots, "TI83"), name); + } + return ""; + } } }