forked from sruon/ffxivlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathActionList.cs
51 lines (43 loc) · 1.4 KB
/
ActionList.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace ffxivlib
{
public class ActionList : BaseObject<ActionList.ACTIONLIST>
{
public ActionList(ACTIONLIST structure, IntPtr address)
: base(structure, address)
{
Initialize();
}
#region Properties
public Action.ACTIONINFO[] Actions { get; set; }
#endregion
#region Unmanaged structure
[StructLayout(LayoutKind.Explicit, Pack = 1)]
public struct ACTIONLIST
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] [FieldOffset(0x0)] public Action.ACTIONINFO[] Actions;
};
#endregion
}
public partial class FFXIVLIB
{
public IEnumerable<Action> GetActions()
{
var ActionListRet = new List<Action>();
IntPtr pointer = _mr.ResolvePointerPath(Constants.ACTIONPTR);
var i = new ActionList(_mr.CreateStructFromAddress<ActionList.ACTIONLIST>(pointer), pointer);
int idx = 0;
foreach (Action.ACTIONINFO action in i.Actions)
{
ActionListRet.Add(
new Action(action,
i.Address + (idx*Marshal.SizeOf(typeof (Action.ACTIONINFO)))
));
idx++;
}
return ActionListRet;
}
}
}