forked from aers/FFXIVClientStructs
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
63 changed files
with
44,627 additions
and
25,107 deletions.
There are no files selected for viewing
119 changes: 119 additions & 0 deletions
119
FFXIVClientStructs.InteropSourceGenerators/InfoProxyInstanceGenerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
using System.Collections.Immutable; | ||
using FFXIVClientStructs.InteropGenerator; | ||
using FFXIVClientStructs.InteropSourceGenerators.Extensions; | ||
using FFXIVClientStructs.InteropSourceGenerators.Models; | ||
using LanguageExt; | ||
using Microsoft.CodeAnalysis; | ||
using Microsoft.CodeAnalysis.CSharp.Syntax; | ||
|
||
namespace FFXIVClientStructs.InteropSourceGenerators; | ||
|
||
[Generator] | ||
public class InfoProxyInstanceGenerator : IIncrementalGenerator { | ||
private const string InfoProxyAttributeName = "FFXIVClientStructs.Attributes.InfoProxyAttribute"; | ||
|
||
public void Initialize(IncrementalGeneratorInitializationContext context) { | ||
IncrementalValuesProvider<(Validation<DiagnosticInfo, StructInfo> StructInfo, | ||
Validation<DiagnosticInfo, InfoProxyInfo> InfoProxyInfo)> structAndInfoProxyInfos = | ||
context.SyntaxProvider | ||
.ForAttributeWithMetadataName( | ||
InfoProxyAttributeName, | ||
static (node, _) => node is StructDeclarationSyntax { | ||
AttributeLists.Count: > 0 | ||
}, | ||
static (context, _) => { | ||
StructDeclarationSyntax structSyntax = (StructDeclarationSyntax)context.TargetNode; | ||
INamedTypeSymbol symbol = (INamedTypeSymbol)context.TargetSymbol; | ||
return (Struct: StructInfo.GetFromSyntax(structSyntax), | ||
Info: InfoProxyInfo.GetFromRoslyn(structSyntax, symbol)); | ||
}); | ||
|
||
// make sure caching is working | ||
IncrementalValuesProvider<Validation<DiagnosticInfo, StructWithInfoProxyInfos>> structsWithInfoProxyInfos = | ||
structAndInfoProxyInfos.Select(static (item, _) => | ||
(item.StructInfo, item.InfoProxyInfo).Apply(static (si, ai) => | ||
new StructWithInfoProxyInfos(si, ai)) | ||
); | ||
|
||
context.RegisterSourceOutput(structsWithInfoProxyInfos, (sourceContext, item) => { | ||
item.Match( | ||
Fail: diagnosticInfos => { | ||
diagnosticInfos.Iter(dInfo => sourceContext.ReportDiagnostic(dInfo.ToDiagnostic())); | ||
}, | ||
Succ: structWithInfoProxyInfos => { | ||
sourceContext.AddSource(structWithInfoProxyInfos.GetFileName(), structWithInfoProxyInfos.RenderSource()); | ||
}); | ||
}); | ||
|
||
IncrementalValueProvider<ImmutableArray<Validation<DiagnosticInfo, StructWithInfoProxyInfos>>> | ||
collectedStructs = structsWithInfoProxyInfos.Collect(); | ||
|
||
context.RegisterSourceOutput(collectedStructs, | ||
(sourceContext, structs) => { | ||
sourceContext.AddSource("InfoModule.InfoProxyGetter.g.cs", BuildInfoProxyGettersSource(structs)); | ||
}); | ||
} | ||
private static string BuildInfoProxyGettersSource( | ||
ImmutableArray<Validation<DiagnosticInfo, StructWithInfoProxyInfos>> structInfos) { | ||
IndentedStringBuilder builder = new(); | ||
|
||
builder.AppendLine("// <auto-generated/>"); | ||
builder.AppendLine(); | ||
|
||
builder.AppendLine("namespace FFXIVClientStructs.FFXIV.Client.UI.Info;"); | ||
builder.AppendLine(); | ||
|
||
builder.AppendLine("public unsafe partial struct InfoModule"); | ||
builder.AppendLine("{"); | ||
builder.Indent(); | ||
|
||
structInfos.Iter(siv => | ||
siv.IfSuccess(structWithInfoProxyInfos => structWithInfoProxyInfos.RenderInfoProxyGetter(builder))); | ||
|
||
builder.DecrementIndent(); | ||
builder.AppendLine("}"); | ||
|
||
return builder.ToString(); | ||
} | ||
|
||
internal sealed record InfoProxyInfo(StructInfo StructInfo, uint InfoProxyId) { | ||
public static Validation<DiagnosticInfo, InfoProxyInfo> GetFromRoslyn( | ||
StructDeclarationSyntax structSyntax, INamedTypeSymbol namedTypeSymbol) { | ||
Validation<DiagnosticInfo, StructInfo> validStructInfo = | ||
StructInfo.GetFromSyntax(structSyntax); | ||
|
||
Option<AttributeData> infoProxyAttribute = namedTypeSymbol.GetFirstAttributeDataByTypeName(InfoProxyAttributeName); | ||
|
||
Validation<DiagnosticInfo, uint> validInfoProxyId = | ||
infoProxyAttribute.GetValidAttributeArgument<uint>("ID", 0, InfoProxyAttributeName, namedTypeSymbol); | ||
|
||
return (validStructInfo, validInfoProxyId: validInfoProxyId).Apply((structInfo, infoProxyId) => | ||
new InfoProxyInfo(structInfo, infoProxyId)); | ||
} | ||
} | ||
|
||
private sealed record StructWithInfoProxyInfos | ||
(StructInfo StructInfo, InfoProxyInfo InfoProxyInfo) { | ||
public string RenderSource() { | ||
IndentedStringBuilder builder = new(); | ||
|
||
StructInfo.RenderStart(builder); | ||
|
||
builder.AppendLine(); | ||
builder.AppendLine($"public static {StructInfo.Name}* Instance() => ({StructInfo.Name}*)InfoModule.Instance()->GetInfoProxyById((uint){InfoProxyInfo.InfoProxyId});"); | ||
builder.AppendLine(); | ||
|
||
StructInfo.RenderEnd(builder); | ||
|
||
return builder.ToString(); | ||
} | ||
|
||
public string GetFileName() { | ||
return $"{StructInfo.Name}.InstanceGetter.g.cs"; | ||
} | ||
|
||
public void RenderInfoProxyGetter(IndentedStringBuilder builder) { | ||
builder.AppendLine($"public {StructInfo.Name}* Get{StructInfo.Name}() => ({StructInfo.Name}*)GetInfoProxyById((uint){InfoProxyInfo.InfoProxyId});"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
FFXIVClientStructs/FFXIV/Client/Game/InstanceContent/PublicContentBozja.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
using FFXIVClientStructs.FFXIV.Client.Game.UI; | ||
using FFXIVClientStructs.FFXIV.Client.System.String; | ||
|
||
namespace FFXIVClientStructs.FFXIV.Client.Game.InstanceContent; | ||
|
||
// Client::Game::InstanceContent::PublicContentBozja | ||
// Client::Game::InstanceContent::PublicContentDirector | ||
// Client::Game::InstanceContent::ContentDirector | ||
// Client::Game::Event::Director | ||
// Client::Game::Event::LuaEventHandler | ||
// Client::Game::Event::EventHandler | ||
[StructLayout(LayoutKind.Explicit, Size = 0x2CB8)] | ||
public struct PublicContentBozja { | ||
[FieldOffset(0x00)] public PublicContentDirector PublicContentDirector; | ||
|
||
[FieldOffset(0x1098)] public DynamicEventContainer DynamicEventContainer; | ||
|
||
[FieldOffset(0x2BC0)] public uint CurrentExperience; // Mettle | ||
[FieldOffset(0x2BC4)] public uint NeededExperience; | ||
} | ||
|
||
// Client::Game::InstanceContent::DynamicEventContainer | ||
// Client::Game::InstanceContent::ContentSheetWaiterInterface | ||
[StructLayout(LayoutKind.Explicit, Size = 0x1B28)] | ||
public unsafe partial struct DynamicEventContainer { | ||
[FixedSizeArray<DynamicEvent>(16)] | ||
[FieldOffset(0x08)] public fixed byte Events[0x1B0 * 16]; | ||
} | ||
|
||
// Client::Game::InstanceContent::DynamicEvent | ||
// Common::Component::Excel::ExcelSheetWaiter | ||
[StructLayout(LayoutKind.Explicit, Size = 0x1B0)] | ||
public unsafe partial struct DynamicEvent { | ||
// [FieldOffset(0)] public ExcelSheetWaiter ExcelSheetWaiter; | ||
[FieldOffset(0x38)] public uint LGBEventObject; | ||
[FieldOffset(0x3C)] public uint LGBMapRange; | ||
[FieldOffset(0x40)] public uint Quest; // RowId of Quest Sheet | ||
[FieldOffset(0x44)] public uint Announce; // RowId of LogMessage Sheet | ||
[FieldOffset(0x48)] public ushort Unknown0; | ||
[FieldOffset(0x4A)] public ushort Unknown1; | ||
[FieldOffset(0x4C)] public ushort Unknown2; | ||
[FieldOffset(0x4E)] public byte EventType; // RowId of DynamicEventType Sheet | ||
[FieldOffset(0x4F)] public byte EnemyType; // RowId of DynamicEventEnemyType Sheet | ||
[FieldOffset(0x50)] public byte MaxParticipants; | ||
[FieldOffset(0x51)] public byte Unknown4; | ||
[FieldOffset(0x52)] public byte Unknown5; | ||
[FieldOffset(0x54)] public uint StartTimestamp; | ||
[FieldOffset(0x58)] public uint SecondsLeft; | ||
[FieldOffset(0x5C)] public uint SecondsDuration; | ||
|
||
[FieldOffset(0x63)] public DynamicEventState State; | ||
|
||
[FieldOffset(0x65)] public byte Participants; | ||
[FieldOffset(0x66)] public byte Progress; | ||
|
||
[FieldOffset(0x53)] public byte SingleBattle; // RowId of DynamicEventSingleBattle Sheet | ||
[FieldOffset(0x68)] public Utf8String Name; | ||
[FieldOffset(0xD0)] public Utf8String Description; | ||
[FieldOffset(0x138)] public uint IconObjective0; | ||
[FieldOffset(0x13C)] public byte MaxParticipants2; | ||
[FieldOffset(0x158)] public MapMarkerData MapMarker; | ||
} | ||
|
||
public enum DynamicEventState : byte { | ||
Inactive = 0, | ||
Register = 1, | ||
Warmup = 2, | ||
Battle = 3 | ||
} |
33 changes: 33 additions & 0 deletions
33
FFXIVClientStructs/FFXIV/Client/Game/InstanceContent/PublicContentEureka.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using FFXIVClientStructs.FFXIV.Client.System.String; | ||
|
||
namespace FFXIVClientStructs.FFXIV.Client.Game.InstanceContent; | ||
|
||
// Client::Game::InstanceContent::PublicContentEureka | ||
// Client::Game::InstanceContent::PublicContentDirector | ||
// Client::Game::InstanceContent::ContentDirector | ||
// Client::Game::Event::Director | ||
// Client::Game::Event::LuaEventHandler | ||
// Client::Game::Event::EventHandler | ||
[StructLayout(LayoutKind.Explicit, Size = 0x12C8)] | ||
public unsafe partial struct PublicContentEureka { | ||
[FieldOffset(0x00)] public PublicContentDirector PublicContentDirector; | ||
[FieldOffset(0x1090)] public ushort Unk1090; // if set, prints log message 9068 in chat ("Character progression enhancement will be applied to all participants in this duty.") | ||
[FieldOffset(0x1092)] public ushort Unk1092; // if set, prints log message 4217 in chat ("To facilitate the successful completion of this duty, you have been granted the power of the Echo.") | ||
[FieldOffset(0x1094)] public byte MaxElementalLevel; // if set, prints log message 9067 in chat ("If your elemental level is above <value>, it will be synced.") | ||
|
||
[FieldOffset(0x1098)] public uint CurrentExperience; | ||
[FieldOffset(0x109C)] public uint NeededExperience; | ||
[FieldOffset(0x10A0)] public ushort MagiaAetherCharge; | ||
[FieldOffset(0x10A2)] public byte Fire; | ||
[FieldOffset(0x10A3)] public byte Ice; | ||
[FieldOffset(0x10A4)] public byte Wind; | ||
[FieldOffset(0x10A5)] public byte Earth; | ||
[FieldOffset(0x10A6)] public byte Lightning; | ||
[FieldOffset(0x10A7)] public byte Water; | ||
[FieldOffset(0x10A8)] public byte Magicite; | ||
[FieldOffset(0x10A9)] public byte MagiaAether; | ||
|
||
[FixedSizeArray<Utf8String>(4)] | ||
[FieldOffset(0x10B0)] public fixed byte PublicContentTextDataStrings[0x68 * 4]; // starting at row 2000 | ||
[FieldOffset(0x1250)] public Utf8String Unk1250; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace FFXIVClientStructs.FFXIV.Client.Game.UI; | ||
|
||
// Client::Game::UI::CharaCard | ||
[StructLayout(LayoutKind.Explicit, Size = 0x1C8)] | ||
public struct CharaCard { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace FFXIVClientStructs.FFXIV.Client.Game.UI; | ||
|
||
// Client::Game::UI::CollectablesShop | ||
[StructLayout(LayoutKind.Explicit, Size = 0x2B8)] | ||
public struct CollectablesShop { | ||
// Contains Yo-kai data at the end? | ||
} |
10 changes: 10 additions & 0 deletions
10
FFXIVClientStructs/FFXIV/Client/Game/UI/DailyQuestSupply.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using FFXIVClientStructs.FFXIV.Component.GUI; | ||
|
||
namespace FFXIVClientStructs.FFXIV.Client.Game.UI; | ||
|
||
// Client::Game::UI::DailyQuestSupply | ||
// Component::GUI::AtkModuleInterface::AtkEventInterface | ||
[StructLayout(LayoutKind.Explicit, Size = 0x3E8)] | ||
public unsafe struct DailyQuestSupply { | ||
[FieldOffset(0)] public AtkEventInterface AtkEventInterface; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace FFXIVClientStructs.FFXIV.Client.Game.UI; | ||
|
||
// Client::Game::UI::Emj | ||
[StructLayout(LayoutKind.Explicit, Size = 0x38)] | ||
public struct Emj { | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
FFXIVClientStructs/FFXIV/Client/Game/UI/EurekaElementalEdit.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace FFXIVClientStructs.FFXIV.Client.Game.UI; | ||
|
||
// Client::Game::UI::EurekaElementalEdit | ||
[StructLayout(LayoutKind.Explicit, Size = 0x18)] | ||
public struct EurekaElementalEdit { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace FFXIVClientStructs.FFXIV.Client.Game.UI; | ||
|
||
// Client::Game::UI::FishRecord | ||
[StructLayout(LayoutKind.Explicit, Size = 0x2E0)] // presumably shorter | ||
public struct FishRecord { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace FFXIVClientStructs.FFXIV.Client.Game.UI; | ||
|
||
// Client::Game::UI::FishingNote | ||
[StructLayout(LayoutKind.Explicit, Size = 0x50)] | ||
public struct FishingNote { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace FFXIVClientStructs.FFXIV.Client.Game.UI; | ||
|
||
// Client::Game::UI::GCSupply | ||
[StructLayout(LayoutKind.Explicit, Size = 0x2C28)] | ||
public struct GCSupply { | ||
|
||
} |
Oops, something went wrong.