From caab4f551281375284cfe88ab9a2a5b69c2ebc2b Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 5 Nov 2021 14:27:40 -0700 Subject: [PATCH] Lossless v1->v2 upgrade --- NHSE.Core/Structures/Villager/VillagerHouse1.cs | 8 ++++++-- NHSE.Core/Structures/Villager/VillagerHouse2.cs | 12 ++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/NHSE.Core/Structures/Villager/VillagerHouse1.cs b/NHSE.Core/Structures/Villager/VillagerHouse1.cs index 436eab0..4607dd3 100644 --- a/NHSE.Core/Structures/Villager/VillagerHouse1.cs +++ b/NHSE.Core/Structures/Villager/VillagerHouse1.cs @@ -36,8 +36,12 @@ public Item DoorDecoItemName public VillagerHouse2 Upgrade() { var data = new byte[VillagerHouse2.SIZE]; + var empty = Item.NONE.ToBytes(); Data.CopyTo(data, 0); - return new VillagerHouse2(data) { DoorDecoItemName = Item.NO_ITEM }; + for (int i = 0; i < 236; i++) + empty.CopyTo(data, 0x1D8 + (i * 0xC)); + VillagerHouse2.Footer.CopyTo(data, 0x1270); + return new VillagerHouse2(data); } } -} \ No newline at end of file +} diff --git a/NHSE.Core/Structures/Villager/VillagerHouse2.cs b/NHSE.Core/Structures/Villager/VillagerHouse2.cs index 97f3d62..8266d88 100644 --- a/NHSE.Core/Structures/Villager/VillagerHouse2.cs +++ b/NHSE.Core/Structures/Villager/VillagerHouse2.cs @@ -32,6 +32,18 @@ public VillagerHouse1 Downgrade() Data.CopyTo(result, 0); return new VillagerHouse1(result); } + + internal static readonly byte[] Footer = + { + 0x4B, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4B, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x9B, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0x40, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xFE, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }; } #pragma warning disable CS8618, CA1815, CA1819, IDE1006, RCS1170