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.
This commit is contained in:
Josh (Lotte) 2023-10-31 18:50:21 +11:00 committed by GitHub
parent 11e9fafaed
commit 526fb34eda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);