From ffb3c618697a88121ea1c53d6010d546fe5f18a7 Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 26 Jan 2015 22:14:50 -0800 Subject: [PATCH] ram2sav save prevention for regular saves out --- PKHeX.csproj | 1 + PKX/f1-Main.cs | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/PKHeX.csproj b/PKHeX.csproj index 0ce8aa1d7..ec2c4ba44 100644 --- a/PKHeX.csproj +++ b/PKHeX.csproj @@ -114,6 +114,7 @@ True Resources.resx + Form diff --git a/PKX/f1-Main.cs b/PKX/f1-Main.cs index 65c1965da..100491e33 100644 --- a/PKX/f1-Main.cs +++ b/PKX/f1-Main.cs @@ -191,6 +191,7 @@ public Form1() public int savindex; public bool savedited; public byte[] ramsav = null; + public bool ramsavloaded = false; public string pathSDF = null; public string path3DS = null; @@ -572,17 +573,18 @@ private void openFile(byte[] input, string path, string ext) Util.Alert("Injection Binary loaded."); } #endregion #region RAMSAV - if (( /*XY*/ input.Length == 0x70000 || /*ORAS*/ input.Length == 0x80000) && Path.GetFileName(path) == "ramsav.bin") + else if (( /*XY*/ input.Length == 0x70000 || /*ORAS*/ input.Length == 0x80000) && Path.GetFileName(path) == "ramsav.bin") { bool o = (input.Length == 0x80000); - try { openMAIN(ram2sav.getMAIN(input), path, (o) ? "ORAS" : "XY", o); } catch { } + try { openMAIN(ram2sav.getMAIN(input), path, (o) ? "ORAS" : "XY", o, true); } catch { } } #endregion else Util.Error("Attempted to load an unsupported file type/size.", "File Loaded:" + Environment.NewLine + path); } - private void openMAIN(byte[] input, string path, string GameType, bool oras) + private void openMAIN(byte[] input, string path, string GameType, bool oras, bool ram = false) { + ramsavloaded = ram; L_Save.Text = "SAV: " + Path.GetFileName(path); SaveGame = new PKX.Structures.SaveGame(GameType); @@ -599,6 +601,7 @@ private void openMAIN(byte[] input, string path, string GameType, bool oras) } private void open1MB(byte[] input, string path, string GameType, bool oras) { + ramsavloaded = false; L_Save.Text = "SAV: " + Path.GetFileName(path); SaveGame = new PKX.Structures.SaveGame(GameType); savegame_oras = oras; @@ -3239,7 +3242,7 @@ private void clickExportSAV(object sender, EventArgs e) cySAV.InitialDirectory = cyberpath; cySAV.RestoreDirectory = true; } - if (ramsav != null) + if (ramsavloaded && ModifierKeys != Keys.Control) // Export RAM SAV if it is the currently loaded one. { cySAV.Filter = "ramsav|*.bin"; cySAV.FileName = "ramsav.bin";