diff --git a/BizHawk.Emulation/Interfaces/Base Implementations/Game.cs b/BizHawk.Emulation/Interfaces/Base Implementations/Game.cs index 91e7fd7da9..f6b18f919f 100644 --- a/BizHawk.Emulation/Interfaces/Base Implementations/Game.cs +++ b/BizHawk.Emulation/Interfaces/Base Implementations/Game.cs @@ -4,7 +4,11 @@ using System.IO; namespace BizHawk { - public sealed class Game : IGame + /// + /// THIS CLASS IS NOT USED RIGHT NOW. + /// I dont think it is architecturally going to last. + /// + public sealed class Game //: IGame { public byte[] RomData; private string name; diff --git a/BizHawk.Emulation/Interfaces/Base Implementations/SmdGame.cs b/BizHawk.Emulation/Interfaces/Base Implementations/SmdGame.cs index a986706cf4..f44b77492d 100644 --- a/BizHawk.Emulation/Interfaces/Base Implementations/SmdGame.cs +++ b/BizHawk.Emulation/Interfaces/Base Implementations/SmdGame.cs @@ -6,8 +6,10 @@ namespace BizHawk { /// /// Loader for .SMD Genesis ROM format (Super Magic Drive) + /// THIS CLASS IS NOT USED RIGHT NOW + /// I dont think it is architecturally going to last. /// - public sealed class SmdGame : IGame + public sealed class SmdGame //: IGame { public byte[] RomData; private string name; diff --git a/BizHawk.Emulation/Interfaces/IGame.cs b/BizHawk.Emulation/Interfaces/IGame.cs index 912f7b0bdd..d8efc3db89 100644 --- a/BizHawk.Emulation/Interfaces/IGame.cs +++ b/BizHawk.Emulation/Interfaces/IGame.cs @@ -7,6 +7,11 @@ namespace BizHawk byte[] GetRomData(); byte[] GetFileData(); IList GetOptions(); - string Name { get; } + + //only use this for cosmetic purposes + string Name { get; } + + //use this for path-building purposes + string FilesystemSafeName { get; } } } \ No newline at end of file diff --git a/BizHawk.MultiClient/RomGame.cs b/BizHawk.MultiClient/RomGame.cs index b8a2764694..ba68318327 100644 --- a/BizHawk.MultiClient/RomGame.cs +++ b/BizHawk.MultiClient/RomGame.cs @@ -12,6 +12,7 @@ namespace BizHawk.MultiClient public string System; private string name; + private string filesystemSafeName; private List options; private const int BankSize = 4096; @@ -42,6 +43,11 @@ namespace BizHawk.MultiClient options = new List(info.GetOptions()); CheckForPatchOptions(); + //build a safe filesystem name for use in auxilary files (savestates, saveram, etc) + filesystemSafeName = file.CanonicalName.Replace("|", "+"); + filesystemSafeName = Path.Combine(Path.GetDirectoryName(filesystemSafeName), Path.GetFileNameWithoutExtension(filesystemSafeName)); + + if (patch != null) { using (var patchFile = new HawkFile(patch)) @@ -104,6 +110,7 @@ namespace BizHawk.MultiClient public byte[] GetFileData() { return FileData; } public IList GetOptions() { return options; } public string Name { get { return name; } set { name = value; } } + public string FilesystemSafeName { get { return filesystemSafeName; } } public string SaveRamPath { @@ -111,15 +118,15 @@ namespace BizHawk.MultiClient { switch (System) { - case "SMS": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathSMSSaveRAM, "SMS"), Name + ".SaveRAM"); - case "GG": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathGGSaveRAM, "GG"), Name + ".SaveRAM"); - case "SG": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathSGSaveRAM, "SG"), Name + ".SaveRAM"); - case "SGX": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathPCESaveRAM, "PCE"), Name + ".SaveRAM"); - case "PCE": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathPCESaveRAM, "PCE"), Name + ".SaveRAM"); - case "GB": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathGBSaveRAM, "GB"), Name + ".SaveRAM"); - case "GEN": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathGenesisSaveRAM, "GEN"), Name + ".SaveRAM"); - case "NES": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathNESSaveRAM, "NES"), Name + ".SaveRAM"); - case "TI83": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathTI83SaveRAM, "TI83"), Name + ".SaveRAM"); + case "SMS": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathSMSSaveRAM, "SMS"), filesystemSafeName + ".SaveRAM"); + case "GG": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathGGSaveRAM, "GG"), filesystemSafeName + ".SaveRAM"); + case "SG": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathSGSaveRAM, "SG"), filesystemSafeName + ".SaveRAM"); + case "SGX": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathPCESaveRAM, "PCE"), filesystemSafeName + ".SaveRAM"); + case "PCE": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathPCESaveRAM, "PCE"), filesystemSafeName + ".SaveRAM"); + case "GB": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathGBSaveRAM, "GB"), filesystemSafeName + ".SaveRAM"); + case "GEN": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathGenesisSaveRAM, "GEN"), filesystemSafeName + ".SaveRAM"); + case "NES": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathNESSaveRAM, "NES"), filesystemSafeName + ".SaveRAM"); + case "TI83": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathTI83SaveRAM, "TI83"), filesystemSafeName + ".SaveRAM"); default: return ""; } } @@ -130,19 +137,19 @@ namespace BizHawk.MultiClient get { string Bind = ""; - if (Global.Config.BindSavestatesToMovies && Global.MainForm.UserMovie.GetMovieMode() != MOVIEMODE.FINISHED) //TODO: what about movie finished? + if (Global.Config.BindSavestatesToMovies && Global.MainForm.UserMovie.GetMovieMode() != MOVIEMODE.FINISHED && Global.MainForm.UserMovie.GetMovieMode() != MOVIEMODE.INACTIVE) //TODO: what about movie finished? Bind += " - " + Path.GetFileNameWithoutExtension(Global.MainForm.UserMovie.GetFilePath()); switch (System) { - case "SMS": return PathManager.MakeAbsolutePath(Global.Config.PathSMSSavestates, "SMS") + "/" + Name + Bind; - case "GG": return PathManager.MakeAbsolutePath(Global.Config.PathGGSavestates, "GG") + "/" + Name + Bind; - case "SG": return PathManager.MakeAbsolutePath(Global.Config.PathSGSavestates, "SG") + "/" + Name + Bind; - case "PCE": return PathManager.MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE") + "/" + Name + Bind; - case "SGX": return PathManager.MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE") + "/" + Name + Bind; - case "GB": return PathManager.MakeAbsolutePath(Global.Config.PathGBSavestates, "GB") + "/" + Name + Bind; - case "GEN": return PathManager.MakeAbsolutePath(Global.Config.PathGenesisSavestates, "GEN") + "/" + Name + Bind; - case "NES": return PathManager.MakeAbsolutePath(Global.Config.PathNESSavestates, "NES") + "/" + Name + Bind; - case "TI83": return PathManager.MakeAbsolutePath(Global.Config.PathTI83Savestates, "TI83") + "/" + Name + Bind; + case "SMS": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathSMSSavestates, "SMS") ,filesystemSafeName + Bind); + case "GG": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathGGSavestates, "GG") ,filesystemSafeName + Bind); + case "SG": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathSGSavestates, "SG") ,filesystemSafeName + Bind); + case "PCE": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE") ,filesystemSafeName + Bind); + case "SGX": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE") ,filesystemSafeName + Bind); + case "GB": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathGBSavestates, "GB") ,filesystemSafeName + Bind); + case "GEN": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathGenesisSavestates, "GEN") ,filesystemSafeName + Bind); + case "NES": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathNESSavestates, "NES") ,filesystemSafeName + Bind); + case "TI83": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathTI83Savestates, "TI83"), filesystemSafeName + Bind); default: return ""; } @@ -156,15 +163,15 @@ namespace BizHawk.MultiClient { switch (System) { - case "SMS": return "SMS/Movie/" + Name; - case "GG": return "Game Gear/Movie/" + Name; - case "SG": return "SG-1000/Movie/" + Name; - case "PCE": return "TurboGrafx/Movie/" + Name; - case "SGX": return "TurboGrafx/Movie/" + Name; - case "GB": return "Gameboy/Movie/" + Name; - case "GEN": return "Genesis/Movie/" + Name; - case "NES": return "NES/Movie/" + Name; - case "TI83": return "TI83/Movie/" + Name; + case "SMS": return "SMS/Movie/" + filesystemSafeName; + case "GG": return "Game Gear/Movie/" + filesystemSafeName; + case "SG": return "SG-1000/Movie/" + filesystemSafeName; + case "PCE": return "TurboGrafx/Movie/" + filesystemSafeName; + case "SGX": return "TurboGrafx/Movie/" + filesystemSafeName; + case "GB": return "Gameboy/Movie/" + filesystemSafeName; + case "GEN": return "Genesis/Movie/" + filesystemSafeName; + case "NES": return "NES/Movie/" + filesystemSafeName; + case "TI83": return "TI83/Movie/" + filesystemSafeName; default: return ""; } } diff --git a/BizHawk.MultiClient/tools/Cheats.cs b/BizHawk.MultiClient/tools/Cheats.cs index e76b774228..acc927455f 100644 --- a/BizHawk.MultiClient/tools/Cheats.cs +++ b/BizHawk.MultiClient/tools/Cheats.cs @@ -58,7 +58,7 @@ namespace BizHawk.MultiClient private string MakeDefaultFilename() { - return GetCheatsPath() + "\\" + Global.Game.Name + ".cht"; + return Path.Combine(GetCheatsPath(), Global.Game.FilesystemSafeName + ".cht"); } private void ClearFields()