fix: decipher more of the pf listing struct

This commit is contained in:
Anna 2021-01-14 18:11:07 -05:00
parent 4d45e21c91
commit d910f5fbe6
2 changed files with 14 additions and 3 deletions

View File

@ -38,6 +38,10 @@ namespace BetterPartyFinder {
private readonly PartyFinderSlot[] _slots;
private readonly byte[] _jobsPresent;
internal IReadOnlyCollection<byte> RawJobsPresent => this._jobsPresent;
internal IReadOnlyCollection<Lazy<ClassJob?>> JobsPresent { get; }
public bool this[ObjectiveFlags flag] => this._objective == 0 || (this._objective & (uint) flag) > 0;
@ -71,6 +75,12 @@ namespace BetterPartyFinder {
this._searchArea = listing.searchArea;
this._slots = listing.slots.Select(accepting => new PartyFinderSlot(accepting)).ToArray();
this._jobsPresent = listing.jobsPresent;
this.JobsPresent = this._jobsPresent
.Select(id => new Lazy<ClassJob?>(() => id == 0
? null
: dataManager.GetExcelSheet<ClassJob>().GetRow(id)))
.ToArray();
}
}

View File

@ -11,6 +11,7 @@ namespace BetterPartyFinder {
[StructLayout(LayoutKind.Sequential)]
public struct PfPacket {
private readonly int unk0;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
private readonly byte[] padding1;
@ -80,14 +81,14 @@ namespace BetterPartyFinder {
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
internal readonly uint[] slots;
private readonly uint job; // job started as?
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
private readonly byte[] header11; // all zero in every pf I've examined
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
internal readonly byte[] jobsPresent;
// Note that ByValTStr will not work here because the strings are UTF-8 and there's only a CharSet for UTF-16 in C#.
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
private readonly byte[] name;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 192)]
private readonly byte[] description;