Update for new gamedata.

This commit is contained in:
Ottermandias 2024-05-23 16:57:16 +02:00
parent 2585de8b21
commit c06d5b0871
4 changed files with 8 additions and 10 deletions

@ -1 +1 @@
Subproject commit 5fa4d0e7972423b73f8cf569bb2bfbeddd825c8a Subproject commit e8220a0a74e9480330e98ed7ca462353434b9649

View file

@ -57,9 +57,7 @@ public partial class TexToolsMeta
if (data == null) if (data == null)
return; return;
using var reader = new BinaryReader(new MemoryStream(data)); var value = GmpEntry.FromTexToolsMeta(data.AsSpan(0, 5));
var value = (GmpEntry)reader.ReadUInt32();
value.UnknownTotal = reader.ReadByte();
var def = ExpandedGmpFile.GetDefault(_metaFileManager, metaFileInfo.PrimaryId); var def = ExpandedGmpFile.GetDefault(_metaFileManager, metaFileInfo.PrimaryId);
if (_keepDefault || value != def) if (_keepDefault || value != def)
MetaManipulations.Add(new GmpManipulation(value, metaFileInfo.PrimaryId)); MetaManipulations.Add(new GmpManipulation(value, metaFileInfo.PrimaryId));

View file

@ -19,8 +19,8 @@ public sealed unsafe class CmpFile : MetaBaseFile
public float this[SubRace subRace, RspAttribute attribute] public float this[SubRace subRace, RspAttribute attribute]
{ {
get => *(float*)(Data + RacialScalingStart + ToRspIndex(subRace) * RspEntry.ByteSize + (int)attribute * 4); get => *(float*)(Data + RacialScalingStart + ToRspIndex(subRace) * RspData.ByteSize + (int)attribute * 4);
set => *(float*)(Data + RacialScalingStart + ToRspIndex(subRace) * RspEntry.ByteSize + (int)attribute * 4) = value; set => *(float*)(Data + RacialScalingStart + ToRspIndex(subRace) * RspData.ByteSize + (int)attribute * 4) = value;
} }
public override void Reset() public override void Reset()
@ -42,7 +42,7 @@ public sealed unsafe class CmpFile : MetaBaseFile
public static float GetDefault(MetaFileManager manager, SubRace subRace, RspAttribute attribute) public static float GetDefault(MetaFileManager manager, SubRace subRace, RspAttribute attribute)
{ {
var data = (byte*)manager.CharacterUtility.DefaultResource(InternalIndex).Address; var data = (byte*)manager.CharacterUtility.DefaultResource(InternalIndex).Address;
return *(float*)(data + RacialScalingStart + ToRspIndex(subRace) * RspEntry.ByteSize + (int)attribute * 4); return *(float*)(data + RacialScalingStart + ToRspIndex(subRace) * RspData.ByteSize + (int)attribute * 4);
} }
private static int ToRspIndex(SubRace subRace) private static int ToRspIndex(SubRace subRace)

View file

@ -157,12 +157,12 @@ public sealed class ExpandedGmpFile : ExpandedEqpGmpBase, IEnumerable<GmpEntry>
public GmpEntry this[PrimaryId idx] public GmpEntry this[PrimaryId idx]
{ {
get => (GmpEntry)GetInternal(idx); get => new() { Value = GetInternal(idx) };
set => SetInternal(idx, (ulong)value); set => SetInternal(idx, value.Value);
} }
public static GmpEntry GetDefault(MetaFileManager manager, PrimaryId primaryIdx) public static GmpEntry GetDefault(MetaFileManager manager, PrimaryId primaryIdx)
=> (GmpEntry)GetDefaultInternal(manager, InternalIndex, primaryIdx, (ulong)GmpEntry.Default); => new() { Value = GetDefaultInternal(manager, InternalIndex, primaryIdx, GmpEntry.Default.Value) };
public void Reset(IEnumerable<PrimaryId> entries) public void Reset(IEnumerable<PrimaryId> entries)
{ {