From 0223168ff6d2783756ec433665e26a07d7d29b7c Mon Sep 17 00:00:00 2001 From: Adam Mathieson Date: Wed, 4 May 2022 01:14:41 +0200 Subject: [PATCH 1/2] + General updates to older classes for compatibility with newer marshelers --- OmsiHook/OmsiPartikel.cs | 2 +- OmsiHook/OmsiPartikelemitter.cs | 7 +++---- OmsiHook/OmsiPassengerCabin.cs | 20 +++++++++----------- OmsiHook/OmsiPathPoint.cs | 2 +- OmsiHook/OmsiStructs.cs | 14 ++++++++++++++ 5 files changed, 28 insertions(+), 17 deletions(-) diff --git a/OmsiHook/OmsiPartikel.cs b/OmsiHook/OmsiPartikel.cs index 4618ed7..f6184c9 100644 --- a/OmsiHook/OmsiPartikel.cs +++ b/OmsiHook/OmsiPartikel.cs @@ -5,7 +5,7 @@ namespace OmsiHook public class OmsiPartikel : OmsiObject { internal OmsiPartikel(Memory omsiMemory, int baseAddress) : base(omsiMemory, baseAddress) { } - internal OmsiPartikel() : base() { } + public OmsiPartikel() : base() { } public D3DVector Position { diff --git a/OmsiHook/OmsiPartikelemitter.cs b/OmsiHook/OmsiPartikelemitter.cs index 5943d64..5d1e228 100644 --- a/OmsiHook/OmsiPartikelemitter.cs +++ b/OmsiHook/OmsiPartikelemitter.cs @@ -5,7 +5,7 @@ namespace OmsiHook public class OmsiPartikelEmitter : OmsiObject { internal OmsiPartikelEmitter(Memory omsiMemory, int baseAddress) : base(omsiMemory, baseAddress) { } - internal OmsiPartikelEmitter() : base() { } + public OmsiPartikelEmitter() : base() { } public uint LastEmitTime { @@ -106,12 +106,11 @@ public bool Spotlight_Calc get => Memory.ReadMemory(Address + 0x60); set => Memory.WriteMemory(Address + 0x60, value); } - /* TODO: public OmsiPartikel[] Partikel { - get => omsiMemory.ReadMemory(baseAddress + 0x64); + get => Memory.ReadMemoryObjArray(Address + 0x64); //set => omsiMemory.WriteMemory(baseAddress + 0x64, value); - }*/ + } public int Textur { get => Memory.ReadMemory(Address + 0x68); diff --git a/OmsiHook/OmsiPassengerCabin.cs b/OmsiHook/OmsiPassengerCabin.cs index 789632b..3676891 100644 --- a/OmsiHook/OmsiPassengerCabin.cs +++ b/OmsiHook/OmsiPassengerCabin.cs @@ -9,32 +9,30 @@ public OmsiSeat[] Seats { get => Memory.ReadMemoryStructArray(Address + 0x4); } - /* TODO: public OmsiPathPoint[] Entries { - get => Memory.ReadMemoryStructArray(Address + 0x8); - }*/ + get => Memory.ReadMemoryObjArray(Address + 0x8); + } public OmsiEntryProp[] EntriesProp { get => Memory.ReadMemoryStructArray(Address + 0xc); } - /* TODO: public OmsiPathPoint[] Exits { - get => Memory.ReadMemoryStructArray(Address + 0x10); - }*/ + get => Memory.ReadMemoryObjArray(Address + 0x10); + } public OmsiPassCabinStamper Stamper { get => Memory.ReadMemory(Address + 0x14); } - public OmsiPassCabinStamper TicketSale // TODO: Make Strings work + public OmsiPassCabinTicketSale TicketSale { - get => Memory.ReadMemory(Address + 0x28); + get => Memory.MarshalStruct( + Memory.ReadMemory(Address + 0x28)); } - /* TODO: public OmsiPathPoint[] LinkToOtherVehicle { - get => Memory.ReadMemoryStructArray(Address + 0x7c); - }*/ + get => Memory.ReadMemoryObjArray(Address + 0x7c); + } } } \ No newline at end of file diff --git a/OmsiHook/OmsiPathPoint.cs b/OmsiHook/OmsiPathPoint.cs index f226798..44eb5e2 100644 --- a/OmsiHook/OmsiPathPoint.cs +++ b/OmsiHook/OmsiPathPoint.cs @@ -3,6 +3,6 @@ public class OmsiPathPoint : OmsiObject { internal OmsiPathPoint(Memory omsiMemory, int baseAddress) : base(omsiMemory, baseAddress) { } - internal OmsiPathPoint() : base() { } + public OmsiPathPoint() : base() { } } } \ No newline at end of file diff --git a/OmsiHook/OmsiStructs.cs b/OmsiHook/OmsiStructs.cs index 86393e5..298ca49 100644 --- a/OmsiHook/OmsiStructs.cs +++ b/OmsiHook/OmsiStructs.cs @@ -417,6 +417,20 @@ public struct OmsiPassCabinTicketSale public int changePos_parent_idx; public string changePos_parent_str; // ANSIString public bool valid; + } + public struct OmsiPassCabinTicketSaleInternal + { + public OmsiPathPoint point; + public D3DVector ticketPos; + public D3DVector moneyPos; + public D3DVector moneyPos_var; + public int moneyPos_parent_idx; + [OmsiStrPtr] public int moneyPos_parent_str; // ANSIString + public D3DVector changePos; + public D3DVector changePos_var; + public int changePos_parent_idx; + [OmsiStrPtr] public int changePos_parent_str; // ANSIString + public bool valid; } public struct OmsiTreeInfo { From 45aa333fba5158d50aac53d9704345d7cd75e0a4 Mon Sep 17 00:00:00 2001 From: Adam Mathieson Date: Wed, 4 May 2022 01:26:31 +0200 Subject: [PATCH 2/2] + Omsi FuncClass --- OmsiHook/OmsiFuncClass.cs | 32 ++++++++++++++++++++++++++++++++ OmsiHook/OmsiMap.cs | 14 ++++++-------- OmsiHook/OmsiStructs.cs | 6 ++++++ 3 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 OmsiHook/OmsiFuncClass.cs diff --git a/OmsiHook/OmsiFuncClass.cs b/OmsiHook/OmsiFuncClass.cs new file mode 100644 index 0000000..9a0a355 --- /dev/null +++ b/OmsiHook/OmsiFuncClass.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmsiHook +{ + public class OmsiFuncClass : OmsiObject + { + public OmsiFuncClass() : base() { } + + internal OmsiFuncClass(Memory memory, int address) : base(memory, address) { } + + public OmsiPointPair[] Pnts + { + get => Memory.ReadMemoryStructArray(Address + 0x4); + } + + public bool PreNullIsNull + { + get => Memory.ReadMemory(Address + 0x8); + set => Memory.WriteMemory(Address + 0x8, value); + } + public bool AftNullIsNull + { + get => Memory.ReadMemory(Address + 0x9); + set => Memory.WriteMemory(Address + 0x9, value); + } + + } +} diff --git a/OmsiHook/OmsiMap.cs b/OmsiHook/OmsiMap.cs index 615c9a9..f4c6c27 100644 --- a/OmsiHook/OmsiMap.cs +++ b/OmsiHook/OmsiMap.cs @@ -122,17 +122,15 @@ public bool DynHelperActive public OmsiUnschedVehGroup[] UnschedVehGroups => Memory.MarshalStructs( Memory.ReadMemoryStructArray(Address + 0x100)); - /*public void Func_TrafficDensity_Passenger //TFuncClass + public OmsiFuncClass Func_TrafficDensity_Passenger { - get => omsiMemory.ReadMemory(baseAddress + 0x104); - set => omsiMemory.WriteMemory(baseAddress + 0x104, value); - }*/ + get => new(Memory, Memory.ReadMemory(Address + 0x104)); + } - /*public void Func_TrafficDensity_Road //TFuncClass + public OmsiFuncClass Func_TrafficDensity_Road { - get => omsiMemory.ReadMemory(baseAddress + 0x108); - set => omsiMemory.WriteMemory(baseAddress + 0x108, value); - }*/ + get => new(Memory, Memory.ReadMemory(Address + 0x108)); + } public float Acct_TrafficDensity_Passenger { diff --git a/OmsiHook/OmsiStructs.cs b/OmsiHook/OmsiStructs.cs index 298ca49..4eeb903 100644 --- a/OmsiHook/OmsiStructs.cs +++ b/OmsiHook/OmsiStructs.cs @@ -913,4 +913,10 @@ public struct OmsiCollFeedback public D3DVector position; public float energie; } + + public struct OmsiPointPair + { + public float x; + public float y; + } }