61 lines
1.6 KiB
C#
61 lines
1.6 KiB
C#
using LibXom.Data;
|
|
using LibXom.Streams;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace LibW4M.Data.InputMapping
|
|
{
|
|
public class InputMappingData : SaveDataEntry
|
|
{
|
|
public InputMappingData(W4SaveFile fileBelongs, XomContainer mainContainer) : base(fileBelongs, mainContainer)
|
|
{
|
|
}
|
|
|
|
public override string FriendlyName
|
|
{
|
|
get
|
|
{
|
|
return this.Type.ToString() + " - " + this.Key.ToString() + " - " + this.JoystickAxis.ToString();
|
|
}
|
|
}
|
|
|
|
public int Type;
|
|
public int Key;
|
|
public int JoystickAxis;
|
|
|
|
public override void Load()
|
|
{
|
|
using (XomStreamReader reader = new XomStreamReader(new MemoryStream(this.mainContainer.GetData())))
|
|
{
|
|
reader.Skip(3);
|
|
|
|
this.Type = reader.ReadInt32();
|
|
this.Key = reader.ReadInt32();
|
|
this.JoystickAxis = reader.ReadInt32();
|
|
|
|
}
|
|
}
|
|
|
|
public override void Save()
|
|
{
|
|
using (MemoryStream ms = new MemoryStream())
|
|
{
|
|
using (XomStreamWriter writer = new XomStreamWriter(ms))
|
|
{
|
|
writer.Skip(3);
|
|
|
|
writer.WriteInt32(this.Type);
|
|
writer.WriteInt32(this.Key);
|
|
writer.WriteInt32(this.JoystickAxis);
|
|
|
|
ms.Seek(0x00, SeekOrigin.Begin);
|
|
mainContainer.SetData(ms.ToArray());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|