private void loadSAV(object sender, string path)
{
FileInfo fi = new FileInfo(path);
byte[] eventflags = new byte[0x180];
switch (fi.Length)
{
case 0x100000: // ramsav
Array.Copy(File.ReadAllBytes(path), 0x1A0FC, eventflags, 0, 0x180);
break;
case 0x76000: // oras main
Array.Copy(File.ReadAllBytes(path), 0x1A0FC - 0x5400, eventflags, 0, 0x180);
break;
default: // figure it out
if (fi.Name.ToLower().Contains("ram") && fi.Length == 0x80000)
Array.Copy(ram2sav.getMAIN(File.ReadAllBytes(path)), 0x1A0FC - 0x5400, eventflags, 0, 0x180);
else
{ Util.Error("Invalid SAV Size", String.Format("File Size: 0x{1} ({0} bytes)", fi.Length, fi.Length.ToString("X5")), "File Loaded: " + path); return; }
break;
}
Button bs = (Button)sender;
if (bs.Name == "B_LoadOld")
{ Array.Copy(eventflags, olddata, 0x180); TB_OldSAV.Text = path; }
else
{ Array.Copy(eventflags, newdata, 0x180); TB_NewSAV.Text = path; }
}
int entry = -1;