From 526fb34edaafb8d4f48b7fa765f9b0cab6f09f32 Mon Sep 17 00:00:00 2001 From: "Josh (Lotte)" Date: Tue, 31 Oct 2023 18:50:21 +1100 Subject: [PATCH] Extra owner bytes fix (#637) Added code that zeroes out the 4 bytes beginning at offset `0x70` of the pattern array that seemingly causes mismatches in imported pattern ownership. Exposed this fix via extra testing with different saves and different pattern dumps. --- NHSE.Core/Save/Offsets/MainSaveOffsets.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NHSE.Core/Save/Offsets/MainSaveOffsets.cs b/NHSE.Core/Save/Offsets/MainSaveOffsets.cs index c861e60..298d355 100644 --- a/NHSE.Core/Save/Offsets/MainSaveOffsets.cs +++ b/NHSE.Core/Save/Offsets/MainSaveOffsets.cs @@ -116,6 +116,8 @@ public void WritePattern(DesignPattern p, byte[] data, int index, byte[] playerI throw new ArgumentOutOfRangeException(nameof(index)); playerID.CopyTo(p.Data, 0x54); // overwrite playerID bytes so player owns townID.CopyTo(p.Data, 0x38); // overwrite townID bytes so player owns + byte[] wipeflag = new byte[] { 0x00, 0x00, 0x00, 0x00 }; // wipe so player owns + wipeflag.CopyTo(p.Data, 0x70); p.Data.CopyTo(data, LandMyDesign + (index * DesignPattern.SIZE)); byte[] editedflag = new byte[] { 0x00 }; editedflag.CopyTo(data, PatternsEditFlagStart + index); // set edited flag for name import to work @@ -141,6 +143,8 @@ public void WritePatternPRO(DesignPatternPRO p, byte[] data, int index, byte[] p throw new ArgumentOutOfRangeException(nameof(index)); playerID.CopyTo(p.Data, 0x54); // overwrite playerID bytes so player owns townID.CopyTo(p.Data, 0x38); // overwrite townID bytes so player owns + byte[] wipeflag = new byte[] { 0x00, 0x00, 0x00, 0x00 }; // wipe so player owns + wipeflag.CopyTo(p.Data, 0x70); p.Data.CopyTo(data, PatternsPRO + (index * DesignPatternPRO.SIZE)); byte[] editedflag = new byte[] { 0x00 }; editedflag.CopyTo(data, PatternsProEditFlagStart + index);