Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File object #25

Merged
merged 7 commits into from
May 5, 2022
Merged
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
21 changes: 21 additions & 0 deletions OmsiHook/OmsiChronoChange.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OmsiHook
{
public class OmsiChronoChange : OmsiObject
{
public OmsiChronoChange() : base() { }

internal OmsiChronoChange(Memory memory, int address) : base(memory, address) { }

public int Scenario
{
get => Memory.ReadMemory<int>(Address + 0x4);
set => Memory.WriteMemory(Address + 0x4, value);
}
}
}
16 changes: 16 additions & 0 deletions OmsiHook/OmsiChronoChangeDel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OmsiHook
{
public class OmsiChronoChangeDel : OmsiChronoChange
{
public OmsiChronoChangeDel() : base() { }

internal OmsiChronoChangeDel(Memory memory, int address) : base(memory, address) { }

}
}
21 changes: 21 additions & 0 deletions OmsiHook/OmsiChronoChangeLabels.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OmsiHook
{
public class OmsiChronoChangeLabels : OmsiChronoChange
{
public OmsiChronoChangeLabels() : base() { }

internal OmsiChronoChangeLabels(Memory memory, int address) : base(memory, address) { }

public string[] StringVars
{
get => Memory.ReadMemoryStringArray(Address + 0x8);
}

}
}
22 changes: 22 additions & 0 deletions OmsiHook/OmsiChronoChangeTyp.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OmsiHook
{
public class OmsiChronoChangeTyp : OmsiChronoChange
{
public OmsiChronoChangeTyp() : base() { }

internal OmsiChronoChangeTyp(Memory memory, int address) : base(memory, address) { }

public string NewTyp
{
get => Memory.ReadMemoryString(Address + 0x8);
set => Memory.WriteMemory(Address + 0x8, value);
}

}
}
154 changes: 154 additions & 0 deletions OmsiHook/OmsiFileObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,159 @@ public class OmsiFileObject : OmsiObject
public OmsiFileObject() : base() { }

internal OmsiFileObject(Memory memory, int address) : base(memory, address) { }

public OmsiComplMapObj MyComplMapObj
{
get => new(Memory, Memory.ReadMemory<int>(Address + 0x4));
}
public uint IDCode
{
get => Memory.ReadMemory<uint>(Address + 0x8);
set => Memory.WriteMemory(Address + 0x8, value);
}
public bool Refreshed
{
get => Memory.ReadMemory<bool>(Address + 0xc);
set => Memory.WriteMemory(Address + 0xc, value);
}
public bool AttachedToObj
{
get => Memory.ReadMemory<bool>(Address + 0xd);
set => Memory.WriteMemory(Address + 0xd, value);
}
public bool AttachedToSpl
{
get => Memory.ReadMemory<bool>(Address + 0xe);
set => Memory.WriteMemory(Address + 0xe, value);
}
public int IsRepeaterOfTile
{
get => Memory.ReadMemory<int>(Address + 0x10);
set => Memory.WriteMemory(Address + 0x10, value);
}
public int RepeaterOffset
{
get => Memory.ReadMemory<int>(Address + 0x14);
set => Memory.WriteMemory(Address + 0x14, value);
}
public string Obj
{
get => Memory.ReadMemoryString(Address + 0x18);
set => Memory.WriteMemory(Address + 0x18, value);
}
public D3DVector Pos
{
get => Memory.ReadMemory<D3DVector>(Address + 0x1c);
set => Memory.WriteMemory(Address + 0x1c, value);
}
public float Hdg
{
get => Memory.ReadMemory<float>(Address + 0x28);
set => Memory.WriteMemory(Address + 0x28, value);
}
public float Pitch
{
get => Memory.ReadMemory<float>(Address + 0x2c);
set => Memory.WriteMemory(Address + 0x2c, value);
}
public float Bank
{
get => Memory.ReadMemory<float>(Address + 0x30);
set => Memory.WriteMemory(Address + 0x30, value);
}
public OmsiFileObject AttObj
{
get => new(Memory, Memory.ReadMemory<int>(Address + 0x34));
}
public OmsiFileSpline AttSpln
{
get => new(Memory, Memory.ReadMemory<int>(Address + 0x38));
}
public int AttPnt
{
get => Memory.ReadMemory<int>(Address + 0x3c);
set => Memory.WriteMemory(Address + 0x3c, value);
}
/// <summary>
/// Spacing ?
/// </summary>
public float Abstand
{
get => Memory.ReadMemory<float>(Address + 0x40);
set => Memory.WriteMemory(Address + 0x40, value);
}
public float Distanz
{
get => Memory.ReadMemory<float>(Address + 0x44);
set => Memory.WriteMemory(Address + 0x44, value);
}
public bool Tangential
{
get => Memory.ReadMemory<bool>(Address + 0x48);
set => Memory.WriteMemory(Address + 0x48, value);
}
public byte Priority
{
get => Memory.ReadMemory<byte>(Address + 0x49);
set => Memory.WriteMemory(Address + 0x49, value);
}
public string[] StringVars
{
get => Memory.ReadMemoryStringArray(Address + 0x4c);
//set => Memory.WriteMemory(Address + 0x49, value);
}
public OmsiComplMapObjInst[] MyInstance
{
get => Memory.ReadMemoryObjArray<OmsiComplMapObjInst>(Address + 0x50);
}
public bool AlignTerrain
{
get => Memory.ReadMemory<bool>(Address + 0x54);
set => Memory.WriteMemory(Address + 0x54, value);
}
public uint MyVarParent_IDCode
{
get => Memory.ReadMemory<uint>(Address + 0x58);
set => Memory.WriteMemory(Address + 0x58, value);
}
public int MyVarParent_Katchel
{
get => Memory.ReadMemory<int>(Address + 0x5c);
set => Memory.WriteMemory(Address + 0x5c, value);
}
public int MyVarParent_Obj
{
get => Memory.ReadMemory<int>(Address + 0x60);
set => Memory.WriteMemory(Address + 0x60, value);
}
public OmsiFileObjectPathInfo[] Paths
{
get => Memory.MarshalStructs<OmsiFileObjectPathInfo, OmsiFileObjectPathInfoInternal>(
Memory.ReadMemoryStructArray<OmsiFileObjectPathInfoInternal>(Address + 0x64));
}
public int Chrono_Origin
{
get => Memory.ReadMemory<int>(Address + 0x68);
set => Memory.WriteMemory(Address + 0x68, value);
}
public OmsiChronoChange[] Chrono_Changes
{
get => Memory.ReadMemoryObjArray<OmsiChronoChange>(Address + 0x6c);
}
public OmsiObjChronoVars Chrono_Active
{
get => new(Memory, Memory.ReadMemory<int>(Address + 0x70));
}
public bool Chrono_Own
{
get => Memory.ReadMemory<bool>(Address + 0x74);
set => Memory.WriteMemory(Address + 0x74, value);
}
public int TempStation
{
get => Memory.ReadMemory<int>(Address + 0x78);
set => Memory.WriteMemory(Address + 0x78, value);
}

}
}
5 changes: 2 additions & 3 deletions OmsiHook/OmsiHOF.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ public string Name
get => Memory.ReadMemoryString(Address + 0x4);
set => Memory.WriteMemory(Address + 0x4, value);
}
/*
public string[] GlobalStrings
{
get => Memory.ReadMemoryObjArray<string>(Address + 0x8);
get => Memory.ReadMemoryStringArray(Address + 0x8);
//set => Memory.WriteMemory(Address + 0x8, value);
}*/
}
public string ServiceTrip
{
get => Memory.ReadMemoryString(Address + 0xc);
Expand Down
32 changes: 32 additions & 0 deletions OmsiHook/OmsiObjChronoVars.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OmsiHook
{
public class OmsiObjChronoVars : OmsiObject
{
public OmsiObjChronoVars() : base() { }

internal OmsiObjChronoVars(Memory memory, int address) : base(memory, address) { }

public byte Deleted
{
get => Memory.ReadMemory<byte>(Address + 0x4);
set => Memory.WriteMemory(Address + 0x4, value);
}
public string ActivFilename
{
get => Memory.ReadMemoryString(Address + 0x8);
set => Memory.WriteMemory(Address + 0x8, value);
}
public string[] StringsPnt
{
get => Memory.ReadMemoryStringArray(Memory.ReadMemory<int>(Address + 0xc));
}


}
}
25 changes: 25 additions & 0 deletions OmsiHook/OmsiStructs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,31 @@ public struct OmsiCollFeedback
public float energie;
}

public struct OmsiFileObjectPathInfo
{
public OmsiPathRule[] rules;
}
public struct OmsiFileObjectPathInfoInternal
{
[OmsiStructArrayPtr(typeof(OmsiPathRule), typeof(OmsiPathRuleInternal))] public int rules;
}

public struct OmsiPathRule
{
public short[] trafficDensity_act;
public float[] trafficDensity;
public short priority_act;
public byte priority;
}

public struct OmsiPathRuleInternal
{
[OmsiObjArrayPtr(typeof(short))] public int trafficDensity_act;
[OmsiObjArrayPtr(typeof(float))] public int trafficDensity;
public short priority_act;
public byte priority;
}

public struct OmsiPointPair
{
public float x;
Expand Down