Skip to content
This repository has been archived by the owner on Mar 21, 2020. It is now read-only.

Commit

Permalink
Accept other RAM dump variants
Browse files Browse the repository at this point in the history
  • Loading branch information
kwsch committed Aug 23, 2015
1 parent 2def943 commit fdf10bd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Main.cs
Expand Up @@ -41,18 +41,19 @@ private void tabMain_DragDrop(object sender, DragEventArgs e)
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
string path = files[0]; // open first D&D
long len = new FileInfo(files[0]).Length;
if (Directory.Exists(path))
{
findLoop = false;
root = path;
L_IO.Text = root;
}
else if (new FileInfo(files[0]).Length == 0x80000) // RAM
else if (len == 0x80000 || len == 0xC0000 || len == 0x121000 || len == 0x130000) // RAM
{
if (Util.Prompt(MessageBoxButtons.YesNo, "Edit RAM Dump?" + Environment.NewLine + files[0]) == DialogResult.Yes)
{
byte[] data = File.ReadAllBytes(files[0]);
SaveData = new byte[0x7FA00];
SaveData = new byte[data.Length + 0x80]; // shift 0x80 bytes
Array.Copy(data, 0, SaveData, 0x80, SaveData.Length - 0x80);
new Garden().ShowDialog();
}
Expand Down
3 changes: 2 additions & 1 deletion Subforms/Garden.cs
Expand Up @@ -136,7 +136,8 @@ private void B_Export_Click(object sender, EventArgs e)
return;

byte[] RAM = saveData().Skip(0x80).ToArray();
Array.Resize(ref RAM, 0x80000);
if (RAM.Length < 0x80000)
Array.Resize(ref RAM, 0x80000);

File.WriteAllBytes(sfd.FileName, RAM);
}
Expand Down

0 comments on commit fdf10bd

Please sign in to comment.