misc cleanups
This commit is contained in:
parent
c4658c3e85
commit
ab9c7699ec
|
@ -40,7 +40,7 @@ namespace BizHawk.Client.Common
|
||||||
},
|
},
|
||||||
Xml = x
|
Xml = x
|
||||||
};
|
};
|
||||||
string fullpath = "";
|
string fullPath = "";
|
||||||
|
|
||||||
var n = y.SelectSingleNode("./LoadAssets");
|
var n = y.SelectSingleNode("./LoadAssets");
|
||||||
if (n != null)
|
if (n != null)
|
||||||
|
@ -75,25 +75,23 @@ namespace BizHawk.Client.Common
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// relative path
|
// relative path
|
||||||
fullpath = Path.GetDirectoryName(f.CanonicalFullPath.Split('|').First()) ?? "";
|
fullPath = Path.GetDirectoryName(f.CanonicalFullPath.Split('|').First()) ?? "";
|
||||||
fullpath = Path.Combine(fullpath, filename.Split('|').First());
|
fullPath = Path.Combine(fullPath, filename.Split('|').First());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var hf = new HawkFile(fullpath))
|
using var hf = new HawkFile(fullPath);
|
||||||
|
if (hf.IsArchive)
|
||||||
{
|
{
|
||||||
if (hf.IsArchive)
|
var archiveItem = hf.ArchiveItems.First(ai => ai.Name == filename.Split('|').Skip(1).First());
|
||||||
{
|
hf.Unbind();
|
||||||
var archiveItem = hf.ArchiveItems.First(ai => ai.Name == filename.Split('|').Skip(1).First());
|
hf.BindArchiveMember(archiveItem);
|
||||||
hf.Unbind();
|
data = hf.GetStream().ReadAllBytes();
|
||||||
hf.BindArchiveMember(archiveItem);
|
|
||||||
data = hf.GetStream().ReadAllBytes();
|
|
||||||
|
|
||||||
filename = filename.Split('|').Skip(1).First();
|
filename = filename.Split('|').Skip(1).First();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
data = File.ReadAllBytes(fullpath.Split('|').First());
|
data = File.ReadAllBytes(fullPath.Split('|').First());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
@ -103,12 +101,10 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
ret.Assets.Add(new KeyValuePair<string, byte[]>(filename, data));
|
ret.Assets.Add(new KeyValuePair<string, byte[]>(filename, data));
|
||||||
ret.AssetFullPaths.Add(fullpath);
|
ret.AssetFullPaths.Add(fullPath);
|
||||||
using (var sha1 = System.Security.Cryptography.SHA1.Create())
|
using var sha1 = System.Security.Cryptography.SHA1.Create();
|
||||||
{
|
sha1.TransformFinalBlock(data, 0, data.Length);
|
||||||
sha1.TransformFinalBlock(data, 0, data.Length);
|
hashStream.Write(sha1.Hash, 0, sha1.Hash.Length);
|
||||||
hashStream.Write(sha1.Hash, 0, sha1.Hash.Length);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret.GI.Hash = hashStream.GetBuffer().HashSHA1(0, (int)hashStream.Length);
|
ret.GI.Hash = hashStream.GetBuffer().HashSHA1(0, (int)hashStream.Length);
|
||||||
|
|
|
@ -13,7 +13,6 @@ namespace BizHawk.Client.Common
|
||||||
public const string STARTSFROMSAVESTATE = "StartsFromSavestate";
|
public const string STARTSFROMSAVESTATE = "StartsFromSavestate";
|
||||||
public const string STARTSFROMSAVERAM = "StartsFromSaveRam";
|
public const string STARTSFROMSAVERAM = "StartsFromSaveRam";
|
||||||
public const string SAVESTATEBINARYBASE64BLOB = "SavestateBinaryBase64Blob"; // this string will not contain base64: ; it's implicit (this is to avoid another big string op to dice off the base64: substring)
|
public const string SAVESTATEBINARYBASE64BLOB = "SavestateBinaryBase64Blob"; // this string will not contain base64: ; it's implicit (this is to avoid another big string op to dice off the base64: substring)
|
||||||
public const string FOURSCORE = "FourScore";
|
|
||||||
public const string SHA1 = "SHA1";
|
public const string SHA1 = "SHA1";
|
||||||
public const string FIRMWARESHA1 = "FirmwareSHA1";
|
public const string FIRMWARESHA1 = "FirmwareSHA1";
|
||||||
public const string PAL = "PAL";
|
public const string PAL = "PAL";
|
||||||
|
@ -24,9 +23,6 @@ namespace BizHawk.Client.Common
|
||||||
// Core Setting
|
// Core Setting
|
||||||
public const string CORE = "Core";
|
public const string CORE = "Core";
|
||||||
|
|
||||||
// Plugin Settings
|
|
||||||
public const string VIDEOPLUGIN = "VideoPlugin";
|
|
||||||
|
|
||||||
public static bool Contains(string val)
|
public static bool Contains(string val)
|
||||||
{
|
{
|
||||||
return typeof(HeaderKeys)
|
return typeof(HeaderKeys)
|
||||||
|
|
|
@ -324,10 +324,8 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public bool HandleMovieLoadState(string path)
|
public bool HandleMovieLoadState(string path)
|
||||||
{
|
{
|
||||||
using (var sr = new StreamReader(path))
|
using var sr = new StreamReader(path);
|
||||||
{
|
return HandleMovieLoadState(sr);
|
||||||
return HandleMovieLoadState(sr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: maybe someone who understands more about what's going on here could rename these step1 and step2 into something more descriptive
|
// TODO: maybe someone who understands more about what's going on here could rename these step1 and step2 into something more descriptive
|
||||||
|
|
|
@ -5,8 +5,8 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
public class PlatformFrameRates
|
public class PlatformFrameRates
|
||||||
{
|
{
|
||||||
// these are political numbers, designed to be in accord with tasvideos.org tradition. theyre not necessarily mathematical factualities (although they may be in some cases)
|
// these are political numbers, designed to be in accord with tasvideos.org tradition. they're not necessarily mathematical factualities (although they may be in some cases)
|
||||||
// it would be nice if we could turn this into a rational expression natively, and also, to write some comments about the derivation and ideal values (since this seems to be where theyre all collected)
|
// it would be nice if we could turn this into a rational expression natively, and also, to write some comments about the derivation and ideal values (since this seems to be where they're all collected)
|
||||||
// are we collecting them anywhere else? for avi-writing code perhaps?
|
// are we collecting them anywhere else? for avi-writing code perhaps?
|
||||||
|
|
||||||
// just some constants, according to specs
|
// just some constants, according to specs
|
||||||
|
@ -66,7 +66,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
// according to ryphecha, using
|
// according to ryphecha, using
|
||||||
// clocks[2] = { 53.693182e06, 53.203425e06 }; //ntsc console, pal console
|
// clocks[2] = { 53.693182e06, 53.203425e06 }; //ntsc console, pal console
|
||||||
// lpf[2][2] = { { 263, 262.5 }, { 314, 312.5 } }; //ntsc,pal; noninterlaced, interlaced
|
// lpf[2][2] = { { 263, 262.5 }, { 314, 312.5 } }; //ntsc,pal; non-interlaced, interlaced
|
||||||
// cpl[2] = { 3412.5, 3405 }; //ntsc mode, pal mode
|
// cpl[2] = { 3412.5, 3405 }; //ntsc mode, pal mode
|
||||||
// PAL PS1: 0, PAL Mode: 0, Interlaced: 0 --- 59.826106 (53.693182e06/(263*3412.5))
|
// PAL PS1: 0, PAL Mode: 0, Interlaced: 0 --- 59.826106 (53.693182e06/(263*3412.5))
|
||||||
// PAL PS1: 0, PAL Mode: 0, Interlaced: 1 --- 59.940060 (53.693182e06/(262.5*3412.5))
|
// PAL PS1: 0, PAL Mode: 0, Interlaced: 1 --- 59.940060 (53.693182e06/(262.5*3412.5))
|
||||||
|
@ -90,22 +90,22 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public TimeSpan MovieTime(IMovie movie)
|
public TimeSpan MovieTime(IMovie movie)
|
||||||
{
|
{
|
||||||
var dblseconds = GetSeconds(movie);
|
var dblSeconds = GetSeconds(movie);
|
||||||
var seconds = (int)(dblseconds % 60);
|
var seconds = (int)(dblSeconds % 60);
|
||||||
var days = seconds / 86400;
|
var days = seconds / 86400;
|
||||||
var hours = seconds / 3600;
|
var hours = seconds / 3600;
|
||||||
var minutes = (seconds / 60) % 60;
|
var minutes = (seconds / 60) % 60;
|
||||||
var milliseconds = (int)((dblseconds - seconds) * 1000);
|
var milliseconds = (int)((dblSeconds - seconds) * 1000);
|
||||||
return new TimeSpan(days, hours, minutes, seconds, milliseconds);
|
return new TimeSpan(days, hours, minutes, seconds, milliseconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
private double Fps(IMovie movie)
|
private double Fps(IMovie movie)
|
||||||
{
|
{
|
||||||
var system = movie.HeaderEntries[HeaderKeys.PLATFORM];
|
var system = movie.HeaderEntries[HeaderKeys.PLATFORM];
|
||||||
var pal = movie.HeaderEntries.ContainsKey(HeaderKeys.PAL) &&
|
var pal = movie.HeaderEntries.ContainsKey(HeaderKeys.PAL)
|
||||||
movie.HeaderEntries[HeaderKeys.PAL] == "1";
|
&& movie.HeaderEntries[HeaderKeys.PAL] == "1";
|
||||||
|
|
||||||
return this[system, pal];
|
return this[system, pal];
|
||||||
}
|
}
|
||||||
|
|
||||||
private double GetSeconds(IMovie movie)
|
private double GetSeconds(IMovie movie)
|
||||||
|
|
|
@ -90,7 +90,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
sb.Append("\r\n");
|
sb.Append("\r\n");
|
||||||
|
|
||||||
// Seperator
|
// Separator
|
||||||
sb.Append("\r\n");
|
sb.Append("\r\n");
|
||||||
|
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
|
|
|
@ -416,7 +416,6 @@ namespace BizHawk.Client.Common
|
||||||
public void Undo(TasMovie movie)
|
public void Undo(TasMovie movie)
|
||||||
{
|
{
|
||||||
bool wasRecording = movie.ChangeLog.IsRecording;
|
bool wasRecording = movie.ChangeLog.IsRecording;
|
||||||
bool wasBinding = movie.BindMarkersToInput;
|
|
||||||
movie.ChangeLog.IsRecording = false;
|
movie.ChangeLog.IsRecording = false;
|
||||||
movie.BindMarkersToInput = _bindMarkers;
|
movie.BindMarkersToInput = _bindMarkers;
|
||||||
|
|
||||||
|
@ -442,7 +441,6 @@ namespace BizHawk.Client.Common
|
||||||
public void Redo(TasMovie movie)
|
public void Redo(TasMovie movie)
|
||||||
{
|
{
|
||||||
bool wasRecording = movie.ChangeLog.IsRecording;
|
bool wasRecording = movie.ChangeLog.IsRecording;
|
||||||
bool wasBinding = movie.BindMarkersToInput;
|
|
||||||
movie.ChangeLog.IsRecording = false;
|
movie.ChangeLog.IsRecording = false;
|
||||||
movie.BindMarkersToInput = _bindMarkers;
|
movie.BindMarkersToInput = _bindMarkers;
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,9 @@ namespace BizHawk.Client.Common
|
||||||
Message = split[1];
|
Message = split[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual int Frame { get; }
|
public int Frame { get; }
|
||||||
|
|
||||||
public virtual string Message { get; set; }
|
public string Message { get; set; }
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,15 +57,9 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
#region API
|
#region API
|
||||||
|
|
||||||
public IEnumerable<long> OutOfRangeAddress
|
public IEnumerable<long> OutOfRangeAddress => _watchList
|
||||||
{
|
.Where(watch => watch.Address >= Domain.Size)
|
||||||
get
|
.Select(watch => watch.Address);
|
||||||
{
|
|
||||||
return _watchList
|
|
||||||
.Where(watch => watch.Address >= Domain.Size)
|
|
||||||
.Select(watch => watch.Address);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
|
@ -154,7 +148,7 @@ namespace BizHawk.Client.Common
|
||||||
"",
|
"",
|
||||||
0,
|
0,
|
||||||
_watchList[index].Previous,
|
_watchList[index].Previous,
|
||||||
(_watchList[index] as IMiniWatchDetails).ChangeCount);
|
((IMiniWatchDetails)_watchList[index]).ChangeCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Watch.GenerateWatch(
|
return Watch.GenerateWatch(
|
||||||
|
|
|
@ -291,6 +291,7 @@
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=taseditor/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=taseditor/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=tasproj/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=tasproj/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Tastudio/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Tastudio/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=tasvideos/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=tempfile/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=tempfile/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=tkey/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=tkey/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=toolform/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=toolform/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
|
Loading…
Reference in New Issue