From e3d7a7ebce5ebb3a3cb2e5f0d7a300818ecf0788 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sun, 23 Oct 2016 12:46:32 -0700 Subject: [PATCH] Partial work towards c-gear Getting this out of my changes list, still very WIP --- PKHeX/Subforms/Save Editors/Gen5/SAV_CGearSkin.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/PKHeX/Subforms/Save Editors/Gen5/SAV_CGearSkin.cs b/PKHeX/Subforms/Save Editors/Gen5/SAV_CGearSkin.cs index 5128b4349..9def44b34 100644 --- a/PKHeX/Subforms/Save Editors/Gen5/SAV_CGearSkin.cs +++ b/PKHeX/Subforms/Save Editors/Gen5/SAV_CGearSkin.cs @@ -46,7 +46,7 @@ private void B_ImportPNG_Click(object sender, EventArgs e) } catch (Exception ex) { - Util.Error("An unexpected error has occurred.", ex); + Util.Error(ex.Message); } } private void B_ExportPNG_Click(object sender, EventArgs e) @@ -109,6 +109,8 @@ private void B_Save_Click(object sender, EventArgs e) if (bgdata.SequenceEqual(new byte[CGearBackground.SIZE_CGB])) return; + // Data present + bgdata = CGearBackground.CGBtoPSK(bgdata, SAV.B2W2); Array.Copy(bgdata, 0, Main.SAV.Data, SAV.CGearDataOffset, bgdata.Length); @@ -120,6 +122,11 @@ private void B_Save_Click(object sender, EventArgs e) ushort skinchkval = SaveUtil.ccitt16(skinchkdata); BitConverter.GetBytes(skinchkval).CopyTo(Main.SAV.Data, SAV.CGearDataOffset + bgdata.Length + 0x112); + // Indicate in the save file that data is present + BitConverter.GetBytes((ushort)0xC21E).CopyTo(Main.SAV.Data, 0x19438); + + + Main.SAV.Data[SAV.CGearInfoOffset + 0x26] = 1; // data present BitConverter.GetBytes(chk).CopyTo(Main.SAV.Data, SAV.CGearInfoOffset + 0x24);