Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 37 additions & 6 deletions FFXIVClientStructs/FFXIV/Client/System/Framework/TaskManager.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
namespace FFXIVClientStructs.FFXIV.Client.System.Framework;

[StructLayout(LayoutKind.Explicit, Size = 0x4C)]
public struct TaskManagerOsData {
[FieldOffset(0x40)] public nint Handle; // Win32 HANDLE type
}

// Client::System::Framework::TaskManager
[GenerateInterop]
[StructLayout(LayoutKind.Explicit, Size = 0x70)]
public unsafe partial struct TaskManager {
[StaticAddress("4C 89 35 ?? ?? ?? ?? ?? ?? ?? 39 0D", 3, isPointer: true)]
public static partial TaskManager* Instance();

[FieldOffset(0x08)] public TaskManagerOsData OsData;
[FieldOffset(0x08), Obsolete("Use Pool")] public TaskManagerOsData OsData;
[FieldOffset(0x08)] public JobPool Pool;
[FieldOffset(0x58)] public RootTask* TaskList;
[FieldOffset(0x60)] public uint TaskCount;
[FieldOffset(0x68)] public void* UserData; // Set to a float* to Framework->FrameDelta
Expand All @@ -21,6 +17,35 @@ public unsafe partial struct TaskManager {
[MemberFunction("8B C2 48 6B D0 78 48 03 51 58")]
public partial void AddTask(uint priority, Task* task);

public Span<RootTask> TaskListSpan => new(TaskList, (int)TaskCount);

// Client::System::Framework::TaskManager::JobPool
[StructLayout(LayoutKind.Explicit, Size = 0x4C)]
public partial struct JobPool {
[FieldOffset(0x00)] public bool Initialized;
[FieldOffset(0x08)] public InnerThread** Threads;
[FieldOffset(0x10)] public int ThreadCount;

[FieldOffset(0x40)] public nint Handle; // Win32 HANDLE type

public Span<Pointer<InnerThread>> ThreadsSpan => new(Threads, ThreadCount);

// Client::System::Framework::TaskManager::JobPool::InnerThread
// Client::System::Threading::Thread
// Client::System::Common::NonCopyable
[GenerateInterop]
[Inherits<Threading.Thread>]
[StructLayout(LayoutKind.Explicit, Size = 0x48)]
public partial struct InnerThread {
[FieldOffset(0x28)] public JobPool* Pool;
[FieldOffset(0x30)] public int Index;
[FieldOffset(0x34)] private byte Unk34;
[FieldOffset(0x35)] private byte Unk35;
[FieldOffset(0x38)] private int Unk38;
[FieldOffset(0x40)] public nint EventHandle2; // Thread already has an EventHandle, not sure why there is a second one
}
}

// Client::System::Framework::TaskManager::RootTask
// Client::System::Framework::Task
[GenerateInterop]
Expand All @@ -30,3 +55,9 @@ public partial struct RootTask {
[FieldOffset(0x38)] private Task UnkTask;
}
}

// TODO: remove. was replaced with JobPool
[StructLayout(LayoutKind.Explicit, Size = 0x4C)]
public unsafe struct TaskManagerOsData {
[FieldOffset(0x40)] public nint Handle; // Win32 HANDLE type
}
7 changes: 7 additions & 0 deletions ida/data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4079,6 +4079,13 @@ classes:
0x140060C80: Finalizer
0x140060DB0: AddTask
0x140060E20: ExecuteAllTasks
Client::System::Framework::TaskManager::JobPool:
funcs:
0x14005FE50: ctor
Client::System::Framework::TaskManager::JobPool::InnerThread:
vtbls:
- ea: 0x142109328
base: Client::System::Threading::Thread
Client::System::Framework::JobListInterface:
vtbls:
- ea: 0x142109330
Expand Down
Loading