Support recording movies that start from SaveRam, note: as of this changeset tastudio does not support this concept and may interact in weird ways with saveram-anchored movies
This commit is contained in:
parent
d22a0db61e
commit
490adc905e
|
@ -21,6 +21,8 @@ namespace BizHawk.Client.Common
|
|||
public static BinaryStateLump Input { get; private set; }
|
||||
[Name("CoreText", "txt")]
|
||||
public static BinaryStateLump CorestateText { get; private set; }
|
||||
[Name("MovieSaveRam", "bin")]
|
||||
public static BinaryStateLump MovieSaveRam { get; private set; }
|
||||
|
||||
// Only for movies they probably shoudln't be leaching this stuff
|
||||
[Name("Header", "txt")]
|
||||
|
|
|
@ -11,6 +11,7 @@ namespace BizHawk.Client.Common
|
|||
public const string AUTHOR = "Author";
|
||||
public const string RERECORDS = "rerecordCount";
|
||||
public const string STARTSFROMSAVESTATE = "StartsFromSavestate";
|
||||
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 FOURSCORE = "FourScore";
|
||||
public const string SHA1 = "SHA1";
|
||||
|
|
|
@ -76,6 +76,31 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
public bool StartsFromSaveRam
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Header.ContainsKey(HeaderKeys.STARTSFROMSAVERAM))
|
||||
{
|
||||
return bool.Parse(Header[HeaderKeys.STARTSFROMSAVERAM]);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
Header.Add(HeaderKeys.STARTSFROMSAVERAM, "True");
|
||||
}
|
||||
else
|
||||
{
|
||||
Header.Remove(HeaderKeys.STARTSFROMSAVERAM);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string GameName
|
||||
{
|
||||
get
|
||||
|
@ -239,5 +264,6 @@ namespace BizHawk.Client.Common
|
|||
public string TextSavestate { get; set; }
|
||||
public byte[] BinarySavestate { get; set; }
|
||||
public int[] SavestateFramebuffer { get; set; }
|
||||
public byte[] SaveRam { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,6 +141,15 @@ namespace BizHawk.Client.Common
|
|||
SavestateFramebuffer[i] = br.ReadInt32();
|
||||
});
|
||||
}
|
||||
|
||||
else if (StartsFromSaveRam)
|
||||
{
|
||||
bl.GetLump(BinaryStateLump.MovieSaveRam, false,
|
||||
delegate(BinaryReader br, long length)
|
||||
{
|
||||
SaveRam = br.ReadBytes((int)length);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Changes = false;
|
||||
|
@ -193,6 +202,10 @@ namespace BizHawk.Client.Common
|
|||
(BinaryWriter bw) => BizHawk.Common.IOExtensions.IOExtensions.Write(bw, SavestateFramebuffer));
|
||||
}
|
||||
}
|
||||
else if (StartsFromSaveRam)
|
||||
{
|
||||
bs.PutLump(BinaryStateLump.MovieSaveRam, (BinaryWriter bw) => bw.Write(SaveRam));
|
||||
}
|
||||
}
|
||||
|
||||
Changes = false;
|
||||
|
|
|
@ -40,6 +40,9 @@ namespace BizHawk.Client.Common
|
|||
set { Header.StartsFromSavestate = value; }
|
||||
}
|
||||
|
||||
// Bkm doesn't support saveram anchored movies
|
||||
public bool StartsFromSaveRam { get { return false; } set { } }
|
||||
|
||||
public string GameName
|
||||
{
|
||||
get { return Header.GameName; }
|
||||
|
@ -91,5 +94,6 @@ namespace BizHawk.Client.Common
|
|||
public string TextSavestate { get; set; }
|
||||
public byte[] BinarySavestate { get; set; }
|
||||
public int[] SavestateFramebuffer { get { return null; } set { } } // eat and ignore framebuffers
|
||||
public byte[] SaveRam { get { return null; } set { } } // Bkm does not support Saveram anchored movies
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
|
|||
|
||||
tas.TextSavestate = old.TextSavestate;
|
||||
tas.BinarySavestate = old.BinarySavestate;
|
||||
tas.SaveRam = old.SaveRam;
|
||||
|
||||
return tas;
|
||||
}
|
||||
|
@ -110,6 +111,7 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
|
|||
|
||||
bk2.TextSavestate = old.TextSavestate;
|
||||
bk2.BinarySavestate = old.BinarySavestate;
|
||||
bk2.SaveRam = old.SaveRam;
|
||||
|
||||
bk2.Save();
|
||||
return bk2;
|
||||
|
|
|
@ -52,8 +52,12 @@ namespace BizHawk.Client.Common
|
|||
byte[] BinarySavestate { get; set; }
|
||||
int[] SavestateFramebuffer { get; set; }
|
||||
|
||||
// saveram anchor
|
||||
byte[] SaveRam { get; set; }
|
||||
|
||||
ulong Rerecords { get; set; }
|
||||
bool StartsFromSavestate { get; set; }
|
||||
bool StartsFromSaveRam { get; set; }
|
||||
string GameName { get; set; }
|
||||
string SystemID { get; set; }
|
||||
string Hash { get; set; }
|
||||
|
|
|
@ -82,6 +82,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
Global.Emulator.ResetCounters();
|
||||
}
|
||||
else if (Global.Emulator.HasSaveRam() && movie.StartsFromSaveRam)
|
||||
{
|
||||
Global.Emulator.AsSaveRam().StoreSaveRam(movie.SaveRam);
|
||||
}
|
||||
|
||||
Global.MovieSession.RunQueuedMovie(record);
|
||||
|
||||
|
|
|
@ -95,7 +95,8 @@
|
|||
this.StartFromCombo.FormattingEnabled = true;
|
||||
this.StartFromCombo.Items.AddRange(new object[] {
|
||||
"Power-On",
|
||||
"Now"});
|
||||
"Now",
|
||||
"SaveRam"});
|
||||
this.StartFromCombo.Location = new System.Drawing.Point(83, 65);
|
||||
this.StartFromCombo.MaxDropDownItems = 32;
|
||||
this.StartFromCombo.Name = "StartFromCombo";
|
||||
|
|
|
@ -28,6 +28,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
.First(i => i.ToString()
|
||||
.ToLower() == "now"));
|
||||
}
|
||||
|
||||
if (!Global.Emulator.HasSaveRam())
|
||||
{
|
||||
StartFromCombo.Items.Remove(
|
||||
StartFromCombo.Items
|
||||
.OfType<object>()
|
||||
.First(i => i.ToString()
|
||||
.ToLower() == "saveram"));
|
||||
}
|
||||
}
|
||||
|
||||
private string MakePath()
|
||||
|
@ -84,6 +93,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
var core = Global.Emulator.AsStatable();
|
||||
|
||||
movieToRecord.StartsFromSavestate = true;
|
||||
movieToRecord.StartsFromSaveRam = false;
|
||||
|
||||
if (core.BinarySaveStatesPreferred)
|
||||
{
|
||||
|
@ -104,11 +114,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
movieToRecord.SavestateFramebuffer = new int[0];
|
||||
if (movieToRecord.SavestateFramebuffer != null)
|
||||
{
|
||||
|
||||
movieToRecord.SavestateFramebuffer = (int[])Global.Emulator.VideoProvider().GetVideoBuffer().Clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (StartFromCombo.SelectedItem.ToString() == "SaveRam" && Global.Emulator.HasSaveRam())
|
||||
{
|
||||
var core = Global.Emulator.AsSaveRam();
|
||||
movieToRecord.StartsFromSavestate = false;
|
||||
movieToRecord.StartsFromSaveRam = true;
|
||||
movieToRecord.SaveRam = core.CloneSaveRam();
|
||||
}
|
||||
|
||||
movieToRecord.PopulateWithDefaultHeaderValues(AuthorBox.Text);
|
||||
movieToRecord.Save();
|
||||
|
|
Loading…
Reference in New Issue