Update save loading for v1.11.0

This commit is contained in:
Kurt
2021-07-28 18:32:39 -07:00
parent 1bd21f4524
commit bf09cf761e
6 changed files with 122 additions and 0 deletions

View File

@@ -552,5 +552,17 @@ public static class FileHashRevision
});
#endregion
#region REVISION 1.11.0 // Same as 1.10.0
internal const int REV_1110_MAIN = REV_1100_MAIN;
internal const int REV_1110_PERSONAL = REV_190_PERSONAL;
internal const int REV_1110_POSTBOX = REV_170_POSTBOX;
internal const int REV_1110_PHOTO = REV_1100_PHOTO;
internal const int REV_1110_PROFILE = REV_110_PROFILE;
public static readonly FileHashInfo REV_1110 = REV_1100;
#endregion
}
}

View File

@@ -25,6 +25,7 @@ public static class RevisionChecker
new(REV_180_MAIN, REV_180_PERSONAL, REV_180_PHOTO, REV_180_POSTBOX, REV_180_PROFILE), // 1.8.0
new(REV_190_MAIN, REV_190_PERSONAL, REV_190_PHOTO, REV_190_POSTBOX, REV_190_PROFILE), // 1.9.0
new(REV_1100_MAIN,REV_1100_PERSONAL,REV_1100_PHOTO,REV_1100_POSTBOX,REV_1100_PROFILE),// 1.10.0
new(REV_1110_MAIN,REV_1110_PERSONAL,REV_1110_PHOTO,REV_1110_POSTBOX,REV_1110_PROFILE),// 1.11.0
};
private static readonly FileHeaderInfo[] RevisionInfo =
@@ -49,6 +50,7 @@ public static class RevisionChecker
new() { Major = 0x78001, Minor = 0x78001, HeaderRevision = 0, Unk1 = 2, SaveRevision = 17, Unk2 = 2 }, // 1.8.0
new() { Major = 0x7C001, Minor = 0x7C006, HeaderRevision = 0, Unk1 = 2, SaveRevision = 18, Unk2 = 2 }, // 1.9.0
new() { Major = 0x7D001, Minor = 0x7D004, HeaderRevision = 0, Unk1 = 2, SaveRevision = 19, Unk2 = 2 }, // 1.10.0
new() { Major = 0x7E001, Minor = 0x7E001, HeaderRevision = 0, Unk1 = 2, SaveRevision = 20, Unk2 = 2 }, // 1.11.0
};
public static readonly IReadOnlyList<SaveFileSizes> SizeInfo = new[]
@@ -73,6 +75,7 @@ public static class RevisionChecker
SizesByRevision[8], // 1.8.0
SizesByRevision[9], // 1.9.0
SizesByRevision[10], // 1.10.0
SizesByRevision[11], // 1.11.0
};
public static readonly IReadOnlyList<FileHashInfo> HashInfo = new[]
@@ -97,6 +100,7 @@ public static class RevisionChecker
REV_180, // 1.8.0
REV_190, // 1.9.0
REV_1100, // 1.10.0
REV_1110, // 1.11.0
};
public static bool IsRevisionKnown(this FileHeaderInfo info) => info.GetKnownRevisionIndex() >= 0;

View File

@@ -74,6 +74,7 @@ public static MainSaveOffsets GetOffsets(FileHeaderInfo Info)
17 => new MainSaveOffsets18(),
18 => new MainSaveOffsets19(),
19 => new MainSaveOffsets110(),
20 => new MainSaveOffsets111(),
_ => throw new IndexOutOfRangeException("Unknown revision!" + Environment.NewLine + Info),
};
}

View File

@@ -0,0 +1,56 @@
namespace NHSE.Core
{
/// <summary>
/// <inheritdoc cref="MainSaveOffsets"/>
/// </summary>
/// <remarks>Same as <see cref="MainSaveOffsets110"/></remarks>
public class MainSaveOffsets111 : MainSaveOffsets
{
public override int PatternCount => PatternCount2;
#region GSaveLand
public const int GSaveLandStart = 0x110;
public override int Animal => GSaveLandStart + 0x10;
public override int LandMyDesign => GSaveLandStart + 0x1e2610;
public override int PatternsPRO => LandMyDesign + (PatternCount2 * DesignPattern.SIZE);
public override int PatternFlag => PatternsPRO + (PatternCount2 * DesignPatternPRO.SIZE);
public override int PatternTailor => PatternFlag + DesignPattern.SIZE;
public const int GSaveWeather = GSaveLandStart + 0x1e23c0;
public override int WeatherArea => GSaveWeather + 0x14; // Hemisphere
public override int WeatherRandSeed => GSaveWeather + 0x18;
public override int EventFlagLand => GSaveLandStart + 0x22d9b8;
// GSaveMainField
public const int GSaveMainFieldStart = GSaveLandStart + 0x22e1b8;
public override int FieldItem => GSaveMainFieldStart + 0x00000;
public override int LandMakingMap => GSaveMainFieldStart + 0xAAA00;
public override int MainFieldStructure => GSaveMainFieldStart + 0xCF600;
public override int OutsideField => GSaveMainFieldStart + 0xCF998;
public override int MyDesignMap => GSaveMainFieldStart + 0xCFA34;
public override int PlayerHouseList => GSaveLandStart + 0x308be4;
public override int NpcHouseList => GSaveLandStart + 0x43abe4;
public const int GSaveShop = GSaveLandStart + 0x43be2c;
public override int ShopKabu => GSaveShop + 0x2d40; // part of shop; tailor & zakka increased size
public override int Museum => GSaveLandStart + 0x43f1e0;
public override int Visitor => GSaveLandStart + 0x4425e4;
public override int SaveFg => GSaveLandStart + 0x442814;
public override int BulletinBoard => GSaveLandStart + 0x443158;
public override int AirportThemeColor => GSaveLandStart + 0x523d60;
#endregion
#region GSaveLandOther
public const int GSaveLandOtherStart = 0x527ab0;
public override int LostItemBox => GSaveLandOtherStart + 0x3408c0;
public override int LastSavedTime => GSaveLandOtherStart + 0x345220;
#endregion
public override int VillagerSize => Villager2.SIZE;
public override IVillager ReadVillager(byte[] data) => new Villager2(data);
}
}

View File

@@ -64,6 +64,7 @@ public static PersonalOffsets GetOffsets(FileHeaderInfo Info)
17 => new PersonalOffsets18(),
18 => new PersonalOffsets19(),
19 => new PersonalOffsets110(),
20 => new PersonalOffsets111(),
_ => throw new IndexOutOfRangeException("Unknown revision!" + Environment.NewLine + Info),
};
}

View File

@@ -0,0 +1,48 @@
namespace NHSE.Core
{
/// <summary>
/// <inheritdoc cref="PersonalOffsets"/>
/// </summary>
/// <remarks>Same as <see cref="PersonalOffsets18"/>.</remarks>
public sealed class PersonalOffsets111 : PersonalOffsets
{
private const int Player = 0x110;
public override int PersonalId => Player + 0xAFA8;
public override int EventFlagsPlayer => Player + 0xAFE0;
private const int GSaveLifeSupport = Player + 0xBFE0;
public override int CountAchievement => GSaveLifeSupport + 0xE98; // CountAchievement
public override int NowPoint => GSaveLifeSupport + 0x5498; // Nook Miles
public override int TotalPoint => NowPoint + 8; // Total Nook Miles Earned
public override int Birthday => Player + 0x1228c;
public override int ProfileMain => Player + 0x122a0;
public override int ProfilePhoto => ProfileMain + 0x14;
public override int ProfileBirthday => ProfileMain + 0x23058;
public override int ProfileFruit => ProfileMain + 0x2305C;
public override int ProfileTimestamp => ProfileMain + 0x230CC;
public override int ProfileIsMakeVillage => ProfileMain + 0x230D0;
// end player
private const int PlayerOther = 0x36a50;
public override int Pockets1 => PlayerOther + 0x10;
public override int Pockets2 => Pockets1 + (8 * Pockets1Count) + 0x18;
public override int Wallet => Pockets2 + (8 * Pockets2Count) + 0x18;
public override int ItemChest => PlayerOther + 0x18C;
public override int ItemCollectBit => PlayerOther + 0xA058;
public override int ItemRemakeCollectBit => PlayerOther + 0xA7AC;
public override int Manpu => PlayerOther + 0xAF7C;
public override int Bank => PlayerOther + 0x22594;
public override int Recipes => Bank + 0x10;
public override int MaxRecipeID => 0x308;
public override int MaxRemakeBitFlag => 0x7D0 * 32;
public override IReactionStore ReadReactions(byte[] data) => data.Slice(Manpu, GSavePlayerManpu15.SIZE).ToStructure<GSavePlayerManpu15>();
public override void SetReactions(byte[] data, IReactionStore value) => ((GSavePlayerManpu15)value).ToBytes().CopyTo(data, Manpu);
}
}