From c65d67309e4144a30a78737189c125f8df72b8a2 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Wed, 18 May 2016 20:25:47 -0700 Subject: [PATCH] add dumper optional code Generates encounter binary information for PKHeX --- pk3DS/Subforms/RSWE.cs | 10 ++++++++++ pk3DS/Subforms/XYWE.cs | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/pk3DS/Subforms/RSWE.cs b/pk3DS/Subforms/RSWE.cs index bdfc4b5..346549e 100644 --- a/pk3DS/Subforms/RSWE.cs +++ b/pk3DS/Subforms/RSWE.cs @@ -371,6 +371,16 @@ private void parse(byte[] ed) min[i].Value = data[2]; max[i].Value = data[3]; } + + #if DUMPER + int r = CB_LocationID.SelectedIndex * 56 + 0x1C; + int loc = zonedata[r] + 0x100 * (zonedata[r + 1] & 1); + byte[] edata = BitConverter.GetBytes((ushort) loc).Concat(ed).ToArray(); + + if (!Directory.Exists("encounter_ao")) + Directory.CreateDirectory("encounter_ao"); + File.WriteAllBytes(Path.Combine("encounter_ao", loc.ToString("000") + CB_LocationID.SelectedIndex.ToString("000") + ".bin"), edata); + #endif } private int[] pslot(byte[] slot) // Parse Slot to Bytes { diff --git a/pk3DS/Subforms/XYWE.cs b/pk3DS/Subforms/XYWE.cs index 64e2336..7c5a690 100644 --- a/pk3DS/Subforms/XYWE.cs +++ b/pk3DS/Subforms/XYWE.cs @@ -363,6 +363,16 @@ private void parse(byte[] ed) min[i].Value = data[2]; max[i].Value = data[3]; } + + #if DUMPER + int r = CB_LocationID.SelectedIndex * 56 + 0x1C; + int loc = zonedata[r] + 0x100 * (zonedata[r + 1] & 1); + byte[] edata = BitConverter.GetBytes((ushort)loc).Concat(ed).ToArray(); + + if (!Directory.Exists("encounter_xy")) + Directory.CreateDirectory("encounter_xy"); + File.WriteAllBytes(Path.Combine("encounter_xy", loc.ToString("000") + CB_LocationID.SelectedIndex.ToString("000") + ".bin"), edata); + #endif } private int[] pslot(byte[] slot) {