From 51af45fb0e58a26c21c247b408e964eb47020656 Mon Sep 17 00:00:00 2001 From: Adam Mathieson Date: Wed, 4 May 2022 00:25:03 +0200 Subject: [PATCH 1/6] + Start to File Object --- OmsiHook/OmsiFileObject.cs | 96 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/OmsiHook/OmsiFileObject.cs b/OmsiHook/OmsiFileObject.cs index 878d3bb..9613e86 100644 --- a/OmsiHook/OmsiFileObject.cs +++ b/OmsiHook/OmsiFileObject.cs @@ -5,5 +5,101 @@ public class OmsiFileObject : OmsiObject public OmsiFileObject() : base() { } internal OmsiFileObject(Memory memory, int address) : base(memory, address) { } + + public OmsiComplMapObj MyComplMapObj + { + get => new(Memory, Memory.ReadMemory(Address + 0x4)); + } + public uint IDCode + { + get => Memory.ReadMemory(Address + 0x8); + set => Memory.WriteMemory(Address + 0x8, value); + } + public bool Refreshed + { + get => Memory.ReadMemory(Address + 0xc); + set => Memory.WriteMemory(Address + 0xc, value); + } + public bool AttachedToObj + { + get => Memory.ReadMemory(Address + 0xd); + set => Memory.WriteMemory(Address + 0xd, value); + } + public bool AttachedToSpl + { + get => Memory.ReadMemory(Address + 0xe); + set => Memory.WriteMemory(Address + 0xe, value); + } + public int IsRepeaterOfTile + { + get => Memory.ReadMemory(Address + 0x10); + set => Memory.WriteMemory(Address + 0x10, value); + } + public int RepeaterOffset + { + get => Memory.ReadMemory(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(Address + 0x1c); + set => Memory.WriteMemory(Address + 0x1c, value); + } + public float Hdg + { + get => Memory.ReadMemory(Address + 0x28); + set => Memory.WriteMemory(Address + 0x28, value); + } + public float Pitch + { + get => Memory.ReadMemory(Address + 0x2c); + set => Memory.WriteMemory(Address + 0x2c, value); + } + public float Bank + { + get => Memory.ReadMemory(Address + 0x30); + set => Memory.WriteMemory(Address + 0x30, value); + } + public OmsiFileObject AttObj + { + get => new(Memory, Memory.ReadMemory(Address + 0x34)); + } + public OmsiFileSpline AttSpln + { + get => new(Memory, Memory.ReadMemory(Address + 0x38)); + } + public int AttPnt + { + get => Memory.ReadMemory(Address + 0x3c); + set => Memory.WriteMemory(Address + 0x3c, value); + } + /// + /// Spacing ? + /// + public float Abstand + { + get => Memory.ReadMemory(Address + 0x40); + set => Memory.WriteMemory(Address + 0x40, value); + } + public float Distanz + { + get => Memory.ReadMemory(Address + 0x44); + set => Memory.WriteMemory(Address + 0x44, value); + } + public bool Tangential + { + get => Memory.ReadMemory(Address + 0x48); + set => Memory.WriteMemory(Address + 0x48, value); + } + public byte Priority + { + get => Memory.ReadMemory(Address + 0x49); + set => Memory.WriteMemory(Address + 0x49, value); + } } } \ No newline at end of file From a48bd88359b4b765bfea72865a87e9f8dc4a8f11 Mon Sep 17 00:00:00 2001 From: Adam Mathieson Date: Wed, 4 May 2022 00:47:05 +0200 Subject: [PATCH 2/6] + Add ChronoChange + Add ChronoVars + Finish FileObject (appart from StringVars) --- OmsiHook/OmsiChronoChange.cs | 21 +++++++++++++ OmsiHook/OmsiFileObject.cs | 57 +++++++++++++++++++++++++++++++++++ OmsiHook/OmsiObjChronoVars.cs | 33 ++++++++++++++++++++ OmsiHook/OmsiStructs.cs | 25 +++++++++++++++ 4 files changed, 136 insertions(+) create mode 100644 OmsiHook/OmsiChronoChange.cs create mode 100644 OmsiHook/OmsiObjChronoVars.cs diff --git a/OmsiHook/OmsiChronoChange.cs b/OmsiHook/OmsiChronoChange.cs new file mode 100644 index 0000000..8c2c57c --- /dev/null +++ b/OmsiHook/OmsiChronoChange.cs @@ -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(Address + 0x4); + set => Memory.WriteMemory(Address + 0x4, value); + } + } +} diff --git a/OmsiHook/OmsiFileObject.cs b/OmsiHook/OmsiFileObject.cs index 9613e86..f2d538f 100644 --- a/OmsiHook/OmsiFileObject.cs +++ b/OmsiHook/OmsiFileObject.cs @@ -101,5 +101,62 @@ public byte Priority get => Memory.ReadMemory(Address + 0x49); set => Memory.WriteMemory(Address + 0x49, value); } + /*public string[] StringVars + { + get => Memory.ReadMemoryObjArray(Address + 0x4c); + //set => Memory.WriteMemory(Address + 0x49, value); + }*/ + public OmsiComplMapObjInst[] MyInstance + { + get => Memory.ReadMemoryObjArray(Address + 0x50); + } + public bool AlignTerrain + { + get => Memory.ReadMemory(Address + 0x54); + set => Memory.WriteMemory(Address + 0x54, value); + } + public uint MyVarParent_IDCode + { + get => Memory.ReadMemory(Address + 0x58); + set => Memory.WriteMemory(Address + 0x58, value); + } + public int MyVarParent_Katchel + { + get => Memory.ReadMemory(Address + 0x5c); + set => Memory.WriteMemory(Address + 0x5c, value); + } + public int MyVarParent_Obj + { + get => Memory.ReadMemory(Address + 0x60); + set => Memory.WriteMemory(Address + 0x60, value); + } + public OmsiFileObjectPathInfo[] Paths + { + get => Memory.ReadMemoryStructArray(Address + 0x64); + } + public int Chrono_Origin + { + get => Memory.ReadMemory(Address + 0x68); + set => Memory.WriteMemory(Address + 0x68, value); + } + public OmsiChronoChange[] Chrono_Changes + { + get => Memory.ReadMemoryObjArray(Address + 0x6c); + } + public OmsiObjChronoVars Chrono_Active + { + get => new(Memory, Memory.ReadMemory(Address + 0x70)); + } + public bool Chrono_Own + { + get => Memory.ReadMemory(Address + 0x74); + set => Memory.WriteMemory(Address + 0x74, value); + } + public int TempStation + { + get => Memory.ReadMemory(Address + 0x78); + set => Memory.WriteMemory(Address + 0x78, value); + } + } } \ No newline at end of file diff --git a/OmsiHook/OmsiObjChronoVars.cs b/OmsiHook/OmsiObjChronoVars.cs new file mode 100644 index 0000000..a38feef --- /dev/null +++ b/OmsiHook/OmsiObjChronoVars.cs @@ -0,0 +1,33 @@ +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(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.ReadMemoryObjArray(Memory.ReadMemory(Address + 0xc)); + }*/ + + + } +} diff --git a/OmsiHook/OmsiStructs.cs b/OmsiHook/OmsiStructs.cs index 86393e5..8a684af 100644 --- a/OmsiHook/OmsiStructs.cs +++ b/OmsiHook/OmsiStructs.cs @@ -899,4 +899,29 @@ public struct OmsiCollFeedback public D3DVector position; public float energie; } + + public struct OmsiFileObjectPathInfo + { + public OmsiPathRule[] rules; + } + public struct OmsiFileObjectPathInfoInternal + { + [OmsiStructArrayPtr(typeof(OmsiPathRule))] 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; + } } From abcb8a074d324ff1506ef18b8492f2c93661b292 Mon Sep 17 00:00:00 2001 From: Adam Mathieson Date: Wed, 4 May 2022 00:57:14 +0200 Subject: [PATCH 3/6] + Other ChronoChange classes --- OmsiHook/OmsiChronoChangeDel.cs | 16 ++++++++++++++++ OmsiHook/OmsiChronoChangeLabels.cs | 21 +++++++++++++++++++++ OmsiHook/OmsiChronoChangeTyp.cs | 22 ++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 OmsiHook/OmsiChronoChangeDel.cs create mode 100644 OmsiHook/OmsiChronoChangeLabels.cs create mode 100644 OmsiHook/OmsiChronoChangeTyp.cs diff --git a/OmsiHook/OmsiChronoChangeDel.cs b/OmsiHook/OmsiChronoChangeDel.cs new file mode 100644 index 0000000..b8eb03c --- /dev/null +++ b/OmsiHook/OmsiChronoChangeDel.cs @@ -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) { } + + } +} diff --git a/OmsiHook/OmsiChronoChangeLabels.cs b/OmsiHook/OmsiChronoChangeLabels.cs new file mode 100644 index 0000000..15b2143 --- /dev/null +++ b/OmsiHook/OmsiChronoChangeLabels.cs @@ -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.ReadMemoryObjArray(Address + 0x8); + }*/ + + } +} diff --git a/OmsiHook/OmsiChronoChangeTyp.cs b/OmsiHook/OmsiChronoChangeTyp.cs new file mode 100644 index 0000000..ee24505 --- /dev/null +++ b/OmsiHook/OmsiChronoChangeTyp.cs @@ -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); + } + + } +} From 9f824aedc52d470d4bae8861ad54f3b8ee0d10b6 Mon Sep 17 00:00:00 2001 From: Adam Mathieson Date: Thu, 5 May 2022 00:43:19 +0200 Subject: [PATCH 4/6] + Some Corrections --- OmsiHook/OmsiChronoChangeLabels.cs | 6 +++--- OmsiHook/OmsiHOF.cs | 5 ++--- OmsiHook/OmsiObjChronoVars.cs | 5 ++--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/OmsiHook/OmsiChronoChangeLabels.cs b/OmsiHook/OmsiChronoChangeLabels.cs index 15b2143..67dc5ac 100644 --- a/OmsiHook/OmsiChronoChangeLabels.cs +++ b/OmsiHook/OmsiChronoChangeLabels.cs @@ -12,10 +12,10 @@ public OmsiChronoChangeLabels() : base() { } internal OmsiChronoChangeLabels(Memory memory, int address) : base(memory, address) { } - /*public string[] StringVars + public string[] StringVars { - get => Memory.ReadMemoryObjArray(Address + 0x8); - }*/ + get => Memory.ReadMemoryStringArray(Address + 0x8); + } } } diff --git a/OmsiHook/OmsiHOF.cs b/OmsiHook/OmsiHOF.cs index dcb12f4..c82dca9 100644 --- a/OmsiHook/OmsiHOF.cs +++ b/OmsiHook/OmsiHOF.cs @@ -16,12 +16,11 @@ public string Name get => Memory.ReadMemoryString(Address + 0x4); set => Memory.WriteMemory(Address + 0x4, value); } - /* public string[] GlobalStrings { - get => Memory.ReadMemoryObjArray(Address + 0x8); + get => Memory.ReadMemoryStringArray(Address + 0x8); //set => Memory.WriteMemory(Address + 0x8, value); - }*/ + } public string ServiceTrip { get => Memory.ReadMemoryString(Address + 0xc); diff --git a/OmsiHook/OmsiObjChronoVars.cs b/OmsiHook/OmsiObjChronoVars.cs index a38feef..3dbedc3 100644 --- a/OmsiHook/OmsiObjChronoVars.cs +++ b/OmsiHook/OmsiObjChronoVars.cs @@ -22,11 +22,10 @@ public string ActivFilename get => Memory.ReadMemoryString(Address + 0x8); set => Memory.WriteMemory(Address + 0x8, value); } - /* public string[] StringsPnt { - get => Memory.ReadMemoryObjArray(Memory.ReadMemory(Address + 0xc)); - }*/ + get => Memory.ReadMemoryStringArray(Memory.ReadMemory(Address + 0xc)); + } } From da664f5e1b1a281dc7a427aa9073465cda1a8770 Mon Sep 17 00:00:00 2001 From: Adam Mathieson Date: Thu, 5 May 2022 00:50:30 +0200 Subject: [PATCH 5/6] + More corrections --- OmsiHook/OmsiFileObject.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/OmsiHook/OmsiFileObject.cs b/OmsiHook/OmsiFileObject.cs index f2d538f..9771be1 100644 --- a/OmsiHook/OmsiFileObject.cs +++ b/OmsiHook/OmsiFileObject.cs @@ -101,11 +101,11 @@ public byte Priority get => Memory.ReadMemory(Address + 0x49); set => Memory.WriteMemory(Address + 0x49, value); } - /*public string[] StringVars + public string[] StringVars { - get => Memory.ReadMemoryObjArray(Address + 0x4c); + get => Memory.ReadMemoryStringArray(Address + 0x4c); //set => Memory.WriteMemory(Address + 0x49, value); - }*/ + } public OmsiComplMapObjInst[] MyInstance { get => Memory.ReadMemoryObjArray(Address + 0x50); @@ -132,7 +132,8 @@ public int MyVarParent_Obj } public OmsiFileObjectPathInfo[] Paths { - get => Memory.ReadMemoryStructArray(Address + 0x64); + get => Memory.MarshalStructs( + Memory.ReadMemoryStructArray(Address + 0x64)); } public int Chrono_Origin { From 67cc756eb5e7f83572af8d24d03ee917df5265c9 Mon Sep 17 00:00:00 2001 From: Adam Mathieson Date: Thu, 5 May 2022 00:52:47 +0200 Subject: [PATCH 6/6] + Path Rule Changes --- OmsiHook/OmsiStructs.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OmsiHook/OmsiStructs.cs b/OmsiHook/OmsiStructs.cs index 695ccfc..98d0d7a 100644 --- a/OmsiHook/OmsiStructs.cs +++ b/OmsiHook/OmsiStructs.cs @@ -1131,7 +1131,7 @@ public struct OmsiFileObjectPathInfo } public struct OmsiFileObjectPathInfoInternal { - [OmsiStructArrayPtr(typeof(OmsiPathRule))] public int rules; + [OmsiStructArrayPtr(typeof(OmsiPathRule), typeof(OmsiPathRuleInternal))] public int rules; } public struct OmsiPathRule