2011-05-04 02:00:08 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
|
|
|
|
|
namespace BizHawk.MultiClient
|
|
|
|
|
{
|
2011-07-06 01:53:15 +00:00
|
|
|
|
public static class PathManager
|
|
|
|
|
{
|
|
|
|
|
public static string GetExeDirectoryAbsolute()
|
|
|
|
|
{
|
2012-12-23 16:30:00 +00:00
|
|
|
|
var uri = new Uri(Assembly.GetEntryAssembly().GetName().CodeBase);
|
|
|
|
|
string module = uri.LocalPath + System.Web.HttpUtility.UrlDecode(uri.Fragment);
|
|
|
|
|
return Path.GetDirectoryName(module);
|
2011-07-06 01:53:15 +00:00
|
|
|
|
}
|
2011-05-04 02:00:08 +00:00
|
|
|
|
|
2011-06-11 22:15:08 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Makes a path relative to the %exe% dir
|
|
|
|
|
/// </summary>
|
2012-12-30 17:52:40 +00:00
|
|
|
|
public static string MakeProgramRelativePath(string path) { return MakeAbsolutePath("%exe%/" + path); }
|
2011-06-11 22:15:08 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The location of the default INI file
|
|
|
|
|
/// </summary>
|
2013-03-08 22:21:04 +00:00
|
|
|
|
public static string DefaultIniPath
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
string blah = MakeProgramRelativePath("config.ini");
|
|
|
|
|
return blah;
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-06-11 22:15:08 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets absolute base as derived from EXE
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
2011-07-06 01:53:15 +00:00
|
|
|
|
public static string GetBasePathAbsolute()
|
|
|
|
|
{
|
|
|
|
|
if (Global.Config.BasePath.Length < 1) //If empty, then EXE path
|
|
|
|
|
return GetExeDirectoryAbsolute();
|
2011-05-04 02:00:08 +00:00
|
|
|
|
|
2011-07-06 01:53:15 +00:00
|
|
|
|
if (Global.Config.BasePath.Length >= 5 &&
|
|
|
|
|
Global.Config.BasePath.Substring(0, 5) == "%exe%")
|
|
|
|
|
return GetExeDirectoryAbsolute();
|
|
|
|
|
if (Global.Config.BasePath[0] == '.')
|
|
|
|
|
{
|
|
|
|
|
if (Global.Config.BasePath.Length == 1)
|
|
|
|
|
return GetExeDirectoryAbsolute();
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (Global.Config.BasePath.Length == 2 &&
|
|
|
|
|
Global.Config.BasePath == ".\\")
|
|
|
|
|
return GetExeDirectoryAbsolute();
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
string tmp = Global.Config.BasePath;
|
|
|
|
|
tmp = tmp.Remove(0, 1);
|
|
|
|
|
tmp = tmp.Insert(0, GetExeDirectoryAbsolute());
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-05-04 02:00:08 +00:00
|
|
|
|
|
2011-07-06 01:53:15 +00:00
|
|
|
|
if (Global.Config.BasePath.Substring(0, 2) == "..")
|
|
|
|
|
return RemoveParents(Global.Config.BasePath, GetExeDirectoryAbsolute());
|
2011-05-04 02:00:08 +00:00
|
|
|
|
|
2011-07-06 01:53:15 +00:00
|
|
|
|
//In case of error, return EXE path
|
|
|
|
|
return GetExeDirectoryAbsolute();
|
|
|
|
|
}
|
2011-05-04 02:00:08 +00:00
|
|
|
|
|
2011-07-06 01:53:15 +00:00
|
|
|
|
public static string GetPlatformBase(string system)
|
|
|
|
|
{
|
|
|
|
|
switch (system)
|
|
|
|
|
{
|
2012-11-06 06:19:27 +00:00
|
|
|
|
case "C64":
|
|
|
|
|
return Global.Config.BaseC64;
|
2012-11-04 23:29:06 +00:00
|
|
|
|
case "PSX":
|
|
|
|
|
return Global.Config.BasePSX;
|
2012-09-07 06:18:58 +00:00
|
|
|
|
case "INTV":
|
|
|
|
|
return Global.Config.BaseINTV;
|
2012-03-31 13:41:00 +00:00
|
|
|
|
case "A26":
|
2012-11-27 02:24:15 +00:00
|
|
|
|
return Global.Config.BaseAtari2600;
|
|
|
|
|
case "A78":
|
|
|
|
|
return Global.Config.BaseAtari7800;
|
2011-07-06 01:53:15 +00:00
|
|
|
|
case "NES":
|
|
|
|
|
return Global.Config.BaseNES;
|
|
|
|
|
case "SG":
|
|
|
|
|
return Global.Config.BaseSG;
|
|
|
|
|
case "GG":
|
|
|
|
|
return Global.Config.BaseGG;
|
|
|
|
|
case "SMS":
|
|
|
|
|
return Global.Config.BaseSMS;
|
|
|
|
|
case "SGX":
|
|
|
|
|
case "PCE":
|
2011-09-24 17:05:34 +00:00
|
|
|
|
case "PCECD":
|
2011-07-06 01:53:15 +00:00
|
|
|
|
return Global.Config.BasePCE;
|
|
|
|
|
case "TI83":
|
|
|
|
|
return Global.Config.BaseTI83;
|
|
|
|
|
case "GEN":
|
|
|
|
|
return Global.Config.BaseGenesis;
|
|
|
|
|
case "GB":
|
|
|
|
|
return Global.Config.BaseGameboy;
|
2012-09-04 07:14:29 +00:00
|
|
|
|
case "SNES":
|
|
|
|
|
return Global.Config.BaseSNES;
|
2012-11-17 21:12:51 +00:00
|
|
|
|
case "Coleco":
|
|
|
|
|
return Global.Config.BaseCOL;
|
2012-11-20 03:17:53 +00:00
|
|
|
|
case "GBA":
|
|
|
|
|
return Global.Config.BaseGBA;
|
2013-05-01 02:37:26 +00:00
|
|
|
|
case "N64":
|
|
|
|
|
return Global.Config.BaseN64;
|
|
|
|
|
case "SATURN":
|
|
|
|
|
return Global.Config.BaseSaturn;
|
2011-08-07 19:30:01 +00:00
|
|
|
|
case "NULL":
|
2011-07-06 01:53:15 +00:00
|
|
|
|
default:
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-05-04 02:00:08 +00:00
|
|
|
|
|
2012-12-30 17:33:33 +00:00
|
|
|
|
public static string StandardFirmwareName(string name)
|
|
|
|
|
{
|
2012-12-30 17:52:40 +00:00
|
|
|
|
return Path.Combine(MakeAbsolutePath(Global.Config.FirmwaresPath), name);
|
2012-12-30 17:33:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-12-30 17:52:40 +00:00
|
|
|
|
public static string MakeAbsolutePath(string path, string system = null)
|
2011-07-06 01:53:15 +00:00
|
|
|
|
{
|
|
|
|
|
//This function translates relative path and special identifiers in absolute paths
|
2011-05-04 02:00:08 +00:00
|
|
|
|
|
2011-07-06 01:53:15 +00:00
|
|
|
|
if (path.Length < 1)
|
|
|
|
|
return GetBasePathAbsolute();
|
2011-05-04 02:00:08 +00:00
|
|
|
|
|
2011-07-06 01:53:15 +00:00
|
|
|
|
if (path == "%recent%")
|
|
|
|
|
{
|
|
|
|
|
return Environment.SpecialFolder.Recent.ToString();
|
|
|
|
|
}
|
2011-05-04 02:00:08 +00:00
|
|
|
|
|
2011-07-06 01:53:15 +00:00
|
|
|
|
if (path.Length >= 5 && path.Substring(0, 5) == "%exe%")
|
|
|
|
|
{
|
|
|
|
|
if (path.Length == 5)
|
|
|
|
|
return GetExeDirectoryAbsolute();
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
string tmp = path.Remove(0, 5);
|
|
|
|
|
tmp = tmp.Insert(0, GetExeDirectoryAbsolute());
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-05-04 02:00:08 +00:00
|
|
|
|
|
2011-07-06 01:53:15 +00:00
|
|
|
|
if (path[0] == '.')
|
|
|
|
|
{
|
2012-12-30 17:52:40 +00:00
|
|
|
|
if (!String.IsNullOrWhiteSpace(system))
|
2011-07-06 01:53:15 +00:00
|
|
|
|
{
|
2011-05-04 02:00:08 +00:00
|
|
|
|
|
2011-07-06 01:53:15 +00:00
|
|
|
|
path = path.Remove(0, 1);
|
|
|
|
|
path = path.Insert(0, GetPlatformBase(system));
|
|
|
|
|
}
|
|
|
|
|
if (path.Length == 1)
|
|
|
|
|
return GetBasePathAbsolute();
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (path[0] == '.')
|
|
|
|
|
{
|
|
|
|
|
path = path.Remove(0, 1);
|
|
|
|
|
path = path.Insert(0, GetBasePathAbsolute());
|
|
|
|
|
}
|
2011-05-04 02:00:08 +00:00
|
|
|
|
|
2011-07-06 01:53:15 +00:00
|
|
|
|
return path;
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-05-04 02:00:08 +00:00
|
|
|
|
|
2011-07-06 01:53:15 +00:00
|
|
|
|
//If begins wtih .. do alorithm to determine how many ..\.. combos and deal with accordingly, return drive letter only if too many ..
|
2011-05-04 02:00:08 +00:00
|
|
|
|
|
2011-07-06 01:53:15 +00:00
|
|
|
|
if ((path[0] > 'A' && path[0] < 'Z') || (path[0] > 'a' && path[0] < 'z'))
|
|
|
|
|
{
|
|
|
|
|
//C:\
|
|
|
|
|
if (path.Length > 2 && path[1] == ':' && path[2] == '\\')
|
|
|
|
|
return path;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//file:\ is an acceptable path as well, and what FileBrowserDialog returns
|
|
|
|
|
if (path.Length >= 6 && path.Substring(0, 6) == "file:\\")
|
|
|
|
|
return path;
|
|
|
|
|
else
|
|
|
|
|
return GetExeDirectoryAbsolute(); //bad path
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-05-04 02:00:08 +00:00
|
|
|
|
|
2011-07-06 01:53:15 +00:00
|
|
|
|
//all pad paths default to EXE
|
|
|
|
|
return GetExeDirectoryAbsolute();
|
|
|
|
|
}
|
2011-05-04 02:00:08 +00:00
|
|
|
|
|
2011-07-06 01:53:15 +00:00
|
|
|
|
public static string RemoveParents(string path, string workingpath)
|
|
|
|
|
{
|
|
|
|
|
//determines number of parents, then removes directories from working path, return absolute path result
|
|
|
|
|
//Ex: "..\..\Bob\", "C:\Projects\Emulators\Bizhawk" will return "C:\Projects\Bob\"
|
|
|
|
|
int x = NumParentDirectories(path);
|
|
|
|
|
if (x > 0)
|
|
|
|
|
{
|
2012-09-04 20:40:39 +00:00
|
|
|
|
int y = StringHelpers.HowMany(path, "..\\");
|
|
|
|
|
int z = StringHelpers.HowMany(workingpath, "\\");
|
2011-07-06 01:53:15 +00:00
|
|
|
|
if (y >= z)
|
|
|
|
|
{
|
|
|
|
|
//Return drive letter only, working path must be absolute?
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
else return path;
|
|
|
|
|
}
|
2011-05-04 02:00:08 +00:00
|
|
|
|
|
2011-07-06 01:53:15 +00:00
|
|
|
|
public static int NumParentDirectories(string path)
|
|
|
|
|
{
|
|
|
|
|
//determine the number of parent directories in path and return result
|
2012-09-04 20:40:39 +00:00
|
|
|
|
int x = StringHelpers.HowMany(path, '\\');
|
2011-07-06 01:53:15 +00:00
|
|
|
|
if (x > 0)
|
|
|
|
|
{
|
2012-09-04 20:40:39 +00:00
|
|
|
|
return StringHelpers.HowMany(path, "..\\");
|
2011-07-06 01:53:15 +00:00
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2011-05-04 02:00:08 +00:00
|
|
|
|
|
2011-07-06 01:53:15 +00:00
|
|
|
|
public static bool IsRecent(string path)
|
|
|
|
|
{
|
|
|
|
|
if (path == "%recent%")
|
|
|
|
|
return true;
|
|
|
|
|
else
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2011-05-21 01:13:48 +00:00
|
|
|
|
|
2012-11-29 18:42:13 +00:00
|
|
|
|
public static string GetLuaPath()
|
|
|
|
|
{
|
2012-12-30 17:52:40 +00:00
|
|
|
|
return MakeAbsolutePath(Global.Config.LuaPath);
|
2012-11-29 18:42:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-07-06 01:53:15 +00:00
|
|
|
|
public static string GetRomsPath(string sysID)
|
|
|
|
|
{
|
|
|
|
|
string path = "";
|
2011-05-21 01:13:48 +00:00
|
|
|
|
|
2011-07-06 01:53:15 +00:00
|
|
|
|
if (Global.Config.UseRecentForROMs)
|
|
|
|
|
return Environment.SpecialFolder.Recent.ToString();
|
|
|
|
|
|
|
|
|
|
switch (sysID)
|
|
|
|
|
{
|
2012-11-06 06:19:27 +00:00
|
|
|
|
case "C64":
|
|
|
|
|
path = PathManager.MakeAbsolutePath(Global.Config.PathC64ROMs, "C64");
|
|
|
|
|
break;
|
2012-11-04 23:29:06 +00:00
|
|
|
|
case "PSX":
|
|
|
|
|
path = PathManager.MakeAbsolutePath(Global.Config.PathPSXROMs, "PSX");
|
|
|
|
|
break;
|
2012-09-07 06:18:58 +00:00
|
|
|
|
case "INTV":
|
2012-11-04 23:29:06 +00:00
|
|
|
|
path = PathManager.MakeAbsolutePath(Global.Config.PathINTVROMs, "INTV");
|
2012-09-07 06:18:58 +00:00
|
|
|
|
break;
|
2012-09-04 07:14:29 +00:00
|
|
|
|
case "SNES":
|
|
|
|
|
path = PathManager.MakeAbsolutePath(Global.Config.PathSNESROMs, "SNES");
|
|
|
|
|
break;
|
2012-03-31 13:41:00 +00:00
|
|
|
|
case "A26":
|
2012-11-27 02:24:15 +00:00
|
|
|
|
path = PathManager.MakeAbsolutePath(Global.Config.PathAtari2600ROMs, "A26");
|
|
|
|
|
break;
|
|
|
|
|
case "A78":
|
|
|
|
|
path = PathManager.MakeAbsolutePath(Global.Config.PathAtari7800ROMs, "A78");
|
2012-03-31 13:41:00 +00:00
|
|
|
|
break;
|
2011-07-06 01:53:15 +00:00
|
|
|
|
case "NES":
|
|
|
|
|
path = PathManager.MakeAbsolutePath(Global.Config.PathNESROMs, "NES");
|
|
|
|
|
break;
|
|
|
|
|
case "SMS":
|
|
|
|
|
path = PathManager.MakeAbsolutePath(Global.Config.PathSMSROMs, "SMS");
|
|
|
|
|
break;
|
|
|
|
|
case "SG":
|
|
|
|
|
path = PathManager.MakeAbsolutePath(Global.Config.PathSGROMs, "SG");
|
|
|
|
|
break;
|
|
|
|
|
case "GG":
|
|
|
|
|
path = PathManager.MakeAbsolutePath(Global.Config.PathGGROMs, "GG");
|
|
|
|
|
break;
|
|
|
|
|
case "GEN":
|
|
|
|
|
path = PathManager.MakeAbsolutePath(Global.Config.PathGenesisROMs, "GEN");
|
|
|
|
|
break;
|
|
|
|
|
case "SFX":
|
|
|
|
|
case "PCE":
|
2011-09-24 17:05:34 +00:00
|
|
|
|
case "PCECD":
|
2011-08-25 02:52:35 +00:00
|
|
|
|
path = PathManager.MakeAbsolutePath(Global.Config.PathPCEROMs, "PCE");
|
2011-07-06 01:53:15 +00:00
|
|
|
|
break;
|
|
|
|
|
case "GB":
|
|
|
|
|
path = PathManager.MakeAbsolutePath(Global.Config.PathGBROMs, "GB");
|
|
|
|
|
break;
|
2012-11-25 17:21:29 +00:00
|
|
|
|
case "GBA":
|
|
|
|
|
path = PathManager.MakeAbsolutePath(Global.Config.PathGBAROMs, "GBA");
|
|
|
|
|
break;
|
2011-07-06 01:53:15 +00:00
|
|
|
|
case "TI83":
|
|
|
|
|
path = PathManager.MakeAbsolutePath(Global.Config.PathTI83ROMs, "TI83");
|
|
|
|
|
break;
|
2012-11-17 22:38:32 +00:00
|
|
|
|
case "Coleco":
|
|
|
|
|
path = PathManager.MakeAbsolutePath(Global.Config.PathCOLROMs, "Coleco");
|
|
|
|
|
break;
|
2011-07-06 01:53:15 +00:00
|
|
|
|
default:
|
2012-12-30 17:52:40 +00:00
|
|
|
|
path = PathManager.MakeAbsolutePath(Global.Config.BaseROMPath);
|
2011-07-06 01:53:15 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return path;
|
|
|
|
|
}
|
2011-08-04 03:20:54 +00:00
|
|
|
|
|
2011-09-04 19:24:40 +00:00
|
|
|
|
public static string RemoveInvalidFileSystemChars(string name)
|
|
|
|
|
{
|
|
|
|
|
string newStr = name;
|
|
|
|
|
char[] chars = Path.GetInvalidFileNameChars();
|
|
|
|
|
foreach (char c in chars)
|
|
|
|
|
{
|
|
|
|
|
newStr = newStr.Replace(c.ToString(), "");
|
|
|
|
|
}
|
|
|
|
|
return newStr;
|
|
|
|
|
}
|
|
|
|
|
|
2011-08-10 23:50:01 +00:00
|
|
|
|
public static string FilesystemSafeName(GameInfo game)
|
|
|
|
|
{
|
|
|
|
|
string filesystemSafeName = game.Name.Replace("|", "+");
|
2011-09-04 19:24:40 +00:00
|
|
|
|
filesystemSafeName = RemoveInvalidFileSystemChars(filesystemSafeName);
|
2012-07-22 20:26:38 +00:00
|
|
|
|
//zero 22-jul-2012 - i dont think this is used the same way it used to. game.Name shouldnt be a path, so this stuff is illogical.
|
|
|
|
|
//if game.Name is a path, then someone shouldve made it not-a-path already.
|
|
|
|
|
//return Path.Combine(Path.GetDirectoryName(filesystemSafeName), Path.GetFileNameWithoutExtension(filesystemSafeName));
|
|
|
|
|
return filesystemSafeName;
|
2011-08-10 23:50:01 +00:00
|
|
|
|
}
|
2011-08-04 03:20:54 +00:00
|
|
|
|
|
2011-08-10 23:50:01 +00:00
|
|
|
|
public static string SaveRamPath(GameInfo game)
|
|
|
|
|
{
|
|
|
|
|
string name = FilesystemSafeName(game);
|
2012-09-03 19:42:53 +00:00
|
|
|
|
if (Global.MovieSession.Movie.IsActive)
|
2012-03-03 18:11:07 +00:00
|
|
|
|
{
|
|
|
|
|
|
2011-09-17 14:23:23 +00:00
|
|
|
|
name += "." + Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename);
|
2012-03-03 18:11:07 +00:00
|
|
|
|
}
|
2011-09-17 14:23:23 +00:00
|
|
|
|
|
2011-08-10 23:50:01 +00:00
|
|
|
|
switch (game.System)
|
|
|
|
|
{
|
2012-11-04 23:29:06 +00:00
|
|
|
|
case "INTV": return Path.Combine(MakeAbsolutePath(Global.Config.PathINTVSaveRAM, "INTV"), name + ".SaveRAM");
|
2011-08-10 23:50:01 +00:00
|
|
|
|
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");
|
2011-09-24 17:05:34 +00:00
|
|
|
|
case "PCECD": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESaveRAM, "PCE"), name + ".SaveRAM");
|
2012-10-07 14:52:03 +00:00
|
|
|
|
case "GB": case "GBC": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBSaveRAM, "GB"), name + ".SaveRAM");
|
2012-11-25 17:21:29 +00:00
|
|
|
|
case "GBA": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBASaveRAM, "GBA"), name + ".SaveRAM");
|
2011-08-10 23:50:01 +00:00
|
|
|
|
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");
|
2012-12-16 18:39:05 +00:00
|
|
|
|
case "A78": return Path.Combine(MakeAbsolutePath(Global.Config.PathAtari7800SaveRAM, "A78"), name + ".SaveRAM");
|
2012-09-04 07:14:29 +00:00
|
|
|
|
case "SNES": return Path.Combine(MakeAbsolutePath(Global.Config.PathSNESSaveRAM, "SNES"), name + ".SaveRAM");
|
2012-11-04 23:29:06 +00:00
|
|
|
|
case "PSX": return Path.Combine(MakeAbsolutePath(Global.Config.PathPSXSaveRAM, "PSX"), name + ".SaveRAM");
|
2012-03-03 18:11:07 +00:00
|
|
|
|
default: return Path.Combine(GetBasePathAbsolute(), name + ".SaveRAM");
|
2011-08-10 23:50:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2011-08-04 03:20:54 +00:00
|
|
|
|
|
2012-04-22 13:56:34 +00:00
|
|
|
|
public static string GetSaveStatePath(GameInfo game)
|
|
|
|
|
{
|
|
|
|
|
switch (game.System)
|
|
|
|
|
{
|
|
|
|
|
default: return GetRomsPath(game.System);
|
2012-11-04 23:29:06 +00:00
|
|
|
|
case "INTV": return MakeAbsolutePath(Global.Config.PathINTVSavestates, "INTV");
|
2012-11-27 02:24:15 +00:00
|
|
|
|
case "A26": return MakeAbsolutePath(Global.Config.PathAtari2600Savestates, "A26");
|
|
|
|
|
case "A78": return MakeAbsolutePath(Global.Config.PathAtari7800Savestates, "A78");
|
2012-04-22 13:56:34 +00:00
|
|
|
|
case "SMS": return MakeAbsolutePath(Global.Config.PathSMSSavestates, "SMS");
|
|
|
|
|
case "GG": return MakeAbsolutePath(Global.Config.PathGGSavestates, "GG");
|
|
|
|
|
case "SG": return MakeAbsolutePath(Global.Config.PathSGSavestates, "SG");
|
|
|
|
|
case "SGX": return MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE");
|
|
|
|
|
case "PCE": return MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE");
|
|
|
|
|
case "PCECD": return MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE");
|
2012-10-07 14:52:03 +00:00
|
|
|
|
case "GB": case "GBC": return MakeAbsolutePath(Global.Config.PathGBSavestates, "GB");
|
2012-11-25 17:21:29 +00:00
|
|
|
|
case "GBA": return MakeAbsolutePath(Global.Config.PathGBASavestates, "GBA");
|
2012-04-22 13:56:34 +00:00
|
|
|
|
case "GEN": return MakeAbsolutePath(Global.Config.PathGenesisSavestates, "GEN");
|
|
|
|
|
case "NES": return MakeAbsolutePath(Global.Config.PathNESSavestates, "NES");
|
|
|
|
|
case "TI83": return MakeAbsolutePath(Global.Config.PathTI83Savestates, "TI83");
|
2012-09-04 07:14:29 +00:00
|
|
|
|
case "SNES": return MakeAbsolutePath(Global.Config.PathSNESSavestates, "SNES");
|
2012-11-04 23:29:06 +00:00
|
|
|
|
case "PSX": return MakeAbsolutePath(Global.Config.PathPSXSavestates, "PSX");
|
2012-11-06 06:19:27 +00:00
|
|
|
|
case "C64": return MakeAbsolutePath(Global.Config.PathC64Savestates, "C64");
|
2012-11-17 22:38:32 +00:00
|
|
|
|
case "Coleco": return MakeAbsolutePath(Global.Config.PathCOLSavestates, "Coleco");
|
2012-04-22 13:56:34 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-08-10 23:50:01 +00:00
|
|
|
|
public static string SaveStatePrefix(GameInfo game)
|
|
|
|
|
{
|
|
|
|
|
string name = FilesystemSafeName(game);
|
2012-09-03 19:42:53 +00:00
|
|
|
|
|
|
|
|
|
if (Global.Config.BindSavestatesToMovies && Global.MovieSession.Movie.IsActive)
|
|
|
|
|
{
|
2011-09-05 00:50:50 +00:00
|
|
|
|
name += "." + Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename);
|
2012-09-03 19:42:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-08-10 23:50:01 +00:00
|
|
|
|
switch (game.System)
|
|
|
|
|
{
|
2012-11-04 23:29:06 +00:00
|
|
|
|
case "INTV": return Path.Combine(MakeAbsolutePath(Global.Config.PathINTVSavestates, "INTV"), name);
|
2012-11-27 02:24:15 +00:00
|
|
|
|
case "A26": return Path.Combine(MakeAbsolutePath(Global.Config.PathAtari2600Savestates, "A26"), name);
|
|
|
|
|
case "A78": return Path.Combine(MakeAbsolutePath(Global.Config.PathAtari7800Savestates, "A78"), name);
|
2011-08-10 23:50:01 +00:00
|
|
|
|
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);
|
2011-09-24 17:05:34 +00:00
|
|
|
|
case "PCECD": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE"), name);
|
2012-10-07 14:52:03 +00:00
|
|
|
|
case "GB": case "GBC": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBSavestates, "GB"), name);
|
2012-11-25 17:21:29 +00:00
|
|
|
|
case "GBA": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBASavestates, "GBA"), name);
|
2011-08-10 23:50:01 +00:00
|
|
|
|
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);
|
2012-09-04 07:14:29 +00:00
|
|
|
|
case "SNES": return Path.Combine(MakeAbsolutePath(Global.Config.PathSNESSavestates, "SNES"), name);
|
2012-11-04 23:29:06 +00:00
|
|
|
|
case "PSX": return Path.Combine(MakeAbsolutePath(Global.Config.PathPSXSavestates, "PSX"), name);
|
2012-11-06 06:19:27 +00:00
|
|
|
|
case "C64": return Path.Combine(MakeAbsolutePath(Global.Config.PathC64Savestates, "C64"), name);
|
2012-11-17 22:38:32 +00:00
|
|
|
|
case "Coleco": return Path.Combine(MakeAbsolutePath(Global.Config.PathCOLSavestates, "Coleco"), name);
|
2011-08-10 23:50:01 +00:00
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
2011-08-04 03:20:54 +00:00
|
|
|
|
|
2011-08-10 23:50:01 +00:00
|
|
|
|
public static string ScreenshotPrefix(GameInfo game)
|
|
|
|
|
{
|
|
|
|
|
string name = FilesystemSafeName(game);
|
|
|
|
|
switch (game.System)
|
|
|
|
|
{
|
2012-11-04 23:29:06 +00:00
|
|
|
|
case "INTV": return Path.Combine(MakeAbsolutePath(Global.Config.PathINTVScreenshots, "INTV"), name);
|
2012-11-27 02:24:15 +00:00
|
|
|
|
case "A26": return Path.Combine(MakeAbsolutePath(Global.Config.PathAtari2600Screenshots, "A26"), name);
|
|
|
|
|
case "A78": return Path.Combine(MakeAbsolutePath(Global.Config.PathAtari7800Screenshots, "A78"), name);
|
2011-08-10 23:50:01 +00:00
|
|
|
|
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);
|
2011-09-24 17:05:34 +00:00
|
|
|
|
case "PCECD": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCEScreenshots, "PCE"), name);
|
2012-10-07 14:52:03 +00:00
|
|
|
|
case "GB": case "GBC": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBScreenshots, "GB"), name);
|
2012-11-25 17:21:29 +00:00
|
|
|
|
case "GBA": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBAScreenshots, "GBA"), name);
|
2011-08-10 23:50:01 +00:00
|
|
|
|
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);
|
2012-09-04 07:14:29 +00:00
|
|
|
|
case "SNES": return Path.Combine(MakeAbsolutePath(Global.Config.PathSNESScreenshots, "SNES"), name);
|
2012-11-04 23:29:06 +00:00
|
|
|
|
case "PSX": return Path.Combine(MakeAbsolutePath(Global.Config.PathPSXScreenshots, "PSX"), name);
|
2012-11-17 22:38:32 +00:00
|
|
|
|
case "Coleco": return Path.Combine(MakeAbsolutePath(Global.Config.PathCOLScreenshots, "Coleco"), name);
|
2011-08-10 23:50:01 +00:00
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
2011-07-06 01:53:15 +00:00
|
|
|
|
}
|
2011-05-04 02:00:08 +00:00
|
|
|
|
}
|