mirror of
https://github.com/kwsch/NLSE.git
synced 2026-09-08 11:25:24 -05:00
Accept other RAM dump variants
This commit is contained in:
5
Main.cs
5
Main.cs
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user