Fix saving of header data from record movie dialog, small fix for inputlog header data
This commit is contained in:
parent
945577dadd
commit
29510ddd58
|
@ -883,9 +883,12 @@ namespace BizHawk.MultiClient
|
|||
if (File.Exists(game.SaveRamPath))
|
||||
LoadSaveRam();
|
||||
|
||||
if (UserMovie.GetMovieMode() != MOVIEMODE.INACTIVE)
|
||||
if (UserMovie.GetMovieMode() == MOVIEMODE.INACTIVE)
|
||||
{
|
||||
InputLog.SetHeaderLine(MovieHeader.PLATFORM, Global.Emulator.SystemId);
|
||||
InputLog.SetHeaderLine(MovieHeader.GAMENAME, Global.Game.FilesystemSafeName);
|
||||
InputLog.SetHeaderLine(MovieHeader.GUID, MovieHeader.MakeGUID());
|
||||
InputLog.SetHeaderLine(MovieHeader.AUTHOR, Global.Config.DefaultAuthor);
|
||||
CreateNewInputLog(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,16 +7,16 @@ using System.Reflection;
|
|||
|
||||
namespace BizHawk.MultiClient
|
||||
{
|
||||
public static class PathManager
|
||||
{
|
||||
public static string GetExeDirectoryAbsolute()
|
||||
{
|
||||
string p = Path.GetDirectoryName(Assembly.GetEntryAssembly().GetName().CodeBase);
|
||||
if (p.Substring(0, 6) == "file:\\")
|
||||
p = p.Remove(0, 6);
|
||||
string z = p;
|
||||
return p;
|
||||
}
|
||||
public static class PathManager
|
||||
{
|
||||
public static string GetExeDirectoryAbsolute()
|
||||
{
|
||||
string p = Path.GetDirectoryName(Assembly.GetEntryAssembly().GetName().CodeBase);
|
||||
if (p.Substring(0, 6) == "file:\\")
|
||||
p = p.Remove(0, 6);
|
||||
string z = p;
|
||||
return p;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Makes a path relative to the %exe% dir
|
||||
|
@ -32,232 +32,232 @@ namespace BizHawk.MultiClient
|
|||
/// Gets absolute base as derived from EXE
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetBasePathAbsolute()
|
||||
{
|
||||
if (Global.Config.BasePath.Length < 1) //If empty, then EXE path
|
||||
return GetExeDirectoryAbsolute();
|
||||
public static string GetBasePathAbsolute()
|
||||
{
|
||||
if (Global.Config.BasePath.Length < 1) //If empty, then EXE path
|
||||
return GetExeDirectoryAbsolute();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Global.Config.BasePath.Substring(0, 2) == "..")
|
||||
return RemoveParents(Global.Config.BasePath, GetExeDirectoryAbsolute());
|
||||
if (Global.Config.BasePath.Substring(0, 2) == "..")
|
||||
return RemoveParents(Global.Config.BasePath, GetExeDirectoryAbsolute());
|
||||
|
||||
//In case of error, return EXE path
|
||||
return GetExeDirectoryAbsolute();
|
||||
}
|
||||
//In case of error, return EXE path
|
||||
return GetExeDirectoryAbsolute();
|
||||
}
|
||||
|
||||
public static string GetPlatformBase(string system)
|
||||
{
|
||||
switch (system)
|
||||
{
|
||||
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":
|
||||
return Global.Config.BasePCE;
|
||||
case "TI83":
|
||||
return Global.Config.BaseTI83;
|
||||
case "GEN":
|
||||
return Global.Config.BaseGenesis;
|
||||
case "GB":
|
||||
return Global.Config.BaseGameboy;
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
public static string GetPlatformBase(string system)
|
||||
{
|
||||
switch (system)
|
||||
{
|
||||
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":
|
||||
return Global.Config.BasePCE;
|
||||
case "TI83":
|
||||
return Global.Config.BaseTI83;
|
||||
case "GEN":
|
||||
return Global.Config.BaseGenesis;
|
||||
case "GB":
|
||||
return Global.Config.BaseGameboy;
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static string MakeAbsolutePath(string path, string system)
|
||||
{
|
||||
//This function translates relative path and special identifiers in absolute paths
|
||||
public static string MakeAbsolutePath(string path, string system)
|
||||
{
|
||||
//This function translates relative path and special identifiers in absolute paths
|
||||
|
||||
if (path.Length < 1)
|
||||
return GetBasePathAbsolute();
|
||||
if (path.Length < 1)
|
||||
return GetBasePathAbsolute();
|
||||
|
||||
if (path == "%recent%")
|
||||
{
|
||||
return Environment.SpecialFolder.Recent.ToString();
|
||||
}
|
||||
if (path == "%recent%")
|
||||
{
|
||||
return Environment.SpecialFolder.Recent.ToString();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (path[0] == '.')
|
||||
{
|
||||
if (system.Length > 0)
|
||||
{
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
}
|
||||
if (path[0] == '.')
|
||||
{
|
||||
if (system.Length > 0)
|
||||
{
|
||||
|
||||
//If begins wtih .. do alorithm to determine how many ..\.. combos and deal with accordingly, return drive letter only if too many ..
|
||||
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());
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
//all pad paths default to EXE
|
||||
return GetExeDirectoryAbsolute();
|
||||
}
|
||||
//If begins wtih .. do alorithm to determine how many ..\.. combos and deal with accordingly, return drive letter only if too many ..
|
||||
|
||||
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)
|
||||
{
|
||||
int y = HowMany(path, "..\\");
|
||||
int z = HowMany(workingpath, "\\");
|
||||
if (y >= z)
|
||||
{
|
||||
//Return drive letter only, working path must be absolute?
|
||||
}
|
||||
return "";
|
||||
}
|
||||
else return path;
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
public static int NumParentDirectories(string path)
|
||||
{
|
||||
//determine the number of parent directories in path and return result
|
||||
int x = HowMany(path, '\\');
|
||||
if (x > 0)
|
||||
{
|
||||
return HowMany(path, "..\\");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//all pad paths default to EXE
|
||||
return GetExeDirectoryAbsolute();
|
||||
}
|
||||
|
||||
public static int HowMany(string str, string s)
|
||||
{
|
||||
int count = 0;
|
||||
for (int x = 0; x < (str.Length - s.Length); x++)
|
||||
{
|
||||
if (str.Substring(x, s.Length) == s)
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
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)
|
||||
{
|
||||
int y = HowMany(path, "..\\");
|
||||
int z = HowMany(workingpath, "\\");
|
||||
if (y >= z)
|
||||
{
|
||||
//Return drive letter only, working path must be absolute?
|
||||
}
|
||||
return "";
|
||||
}
|
||||
else return path;
|
||||
}
|
||||
|
||||
public static int HowMany(string str, char c)
|
||||
{
|
||||
int count = 0;
|
||||
for (int x = 0; x < str.Length; x++)
|
||||
{
|
||||
if (str[x] == c)
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
public static int NumParentDirectories(string path)
|
||||
{
|
||||
//determine the number of parent directories in path and return result
|
||||
int x = HowMany(path, '\\');
|
||||
if (x > 0)
|
||||
{
|
||||
return HowMany(path, "..\\");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static bool IsRecent(string path)
|
||||
{
|
||||
if (path == "%recent%")
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
public static int HowMany(string str, string s)
|
||||
{
|
||||
int count = 0;
|
||||
for (int x = 0; x < (str.Length - s.Length); x++)
|
||||
{
|
||||
if (str.Substring(x, s.Length) == s)
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public static string GetRomsPath(string sysID)
|
||||
{
|
||||
string path = "";
|
||||
public static int HowMany(string str, char c)
|
||||
{
|
||||
int count = 0;
|
||||
for (int x = 0; x < str.Length; x++)
|
||||
{
|
||||
if (str[x] == c)
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
if (Global.Config.UseRecentForROMs)
|
||||
return Environment.SpecialFolder.Recent.ToString();
|
||||
public static bool IsRecent(string path)
|
||||
{
|
||||
if (path == "%recent%")
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (sysID)
|
||||
{
|
||||
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":
|
||||
path = PathManager.MakeAbsolutePath(Global.Config.PathPCEROMs, "GB");
|
||||
break;
|
||||
case "GB":
|
||||
path = PathManager.MakeAbsolutePath(Global.Config.PathGBROMs, "GB");
|
||||
break;
|
||||
case "TI83":
|
||||
path = PathManager.MakeAbsolutePath(Global.Config.PathTI83ROMs, "TI83");
|
||||
break;
|
||||
default:
|
||||
path = PathManager.GetBasePathAbsolute();
|
||||
break;
|
||||
}
|
||||
public static string GetRomsPath(string sysID)
|
||||
{
|
||||
string path = "";
|
||||
|
||||
return path;
|
||||
}
|
||||
}
|
||||
if (Global.Config.UseRecentForROMs)
|
||||
return Environment.SpecialFolder.Recent.ToString();
|
||||
|
||||
switch (sysID)
|
||||
{
|
||||
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":
|
||||
path = PathManager.MakeAbsolutePath(Global.Config.PathPCEROMs, "GB");
|
||||
break;
|
||||
case "GB":
|
||||
path = PathManager.MakeAbsolutePath(Global.Config.PathGBROMs, "GB");
|
||||
break;
|
||||
case "TI83":
|
||||
path = PathManager.MakeAbsolutePath(Global.Config.PathTI83ROMs, "TI83");
|
||||
break;
|
||||
default:
|
||||
path = PathManager.GetBasePathAbsolute();
|
||||
break;
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,6 @@ namespace BizHawk.MultiClient
|
|||
MakeBackup = false;
|
||||
}
|
||||
Log.Clear();
|
||||
Header = new MovieHeader(MainForm.EMUVERSION, MovieHeader.MovieVersion, Global.Emulator.SystemId, Global.Game.FilesystemSafeName, "", 0);
|
||||
}
|
||||
|
||||
public void StartPlayback()
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue