From b31fbc7e126c6f235041190b07c99241beff1fb1 Mon Sep 17 00:00:00 2001 From: Adam Mathieson Date: Sun, 17 Apr 2022 23:45:42 +0200 Subject: [PATCH 1/8] + OmsiComplMapObj --- OmsiExtensions.sln | 9 ++++- OmsiHook/OmsiComplMapObj.cs | 26 +++++++++++++ OmsiHook/OmsiStructs.cs | 76 +++++++++++++++++++++++++++++++++++++ 3 files changed, 109 insertions(+), 2 deletions(-) diff --git a/OmsiExtensions.sln b/OmsiExtensions.sln index 06a6c8d..deecb4b 100644 --- a/OmsiExtensions.sln +++ b/OmsiExtensions.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.1.32407.343 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31424.327 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OmsiHook", "OmsiHook\OmsiHook.csproj", "{2E750CBE-F868-4AB7-96C2-27560F53E06B}" EndProject @@ -9,6 +9,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OmsiExtensionsUI", "OmsiExt EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OmsiExtensionsCLI", "OmsiExtensionsCLI\OmsiExtensionsCLI.csproj", "{FDA9A525-9722-46D3-B80C-8D2A76ABCA2D}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{678857C6-F8DE-4E47-8E61-CE61A76E7C0E}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/OmsiHook/OmsiComplMapObj.cs b/OmsiHook/OmsiComplMapObj.cs index afba9ad..c9b3a5f 100644 --- a/OmsiHook/OmsiComplMapObj.cs +++ b/OmsiHook/OmsiComplMapObj.cs @@ -239,6 +239,32 @@ public OmsiTriggerBox[] TriggerBoxes { get => Memory.ReadMemoryStructArray(Address + 0x248); }*/ + /* TODO: + public OmsiComplObjPtr ComplObj + { + get => Memory.ReadMemory(Address + 0x24c); + set => Memory.WriteMemory(Address + 0x24c, value); + }*/ + public OmsiPathManager ComplObj + { + get => new OmsiPathManager(Memory, Memory.ReadMemory(Address + 0x250)); + } + public OmsiObjectPathInfo[] Paths + { + get => Memory.ReadMemoryStructArray(Address + 0x254); + } + public OmsiSnapPosition[] SnapPoints + { + get => Memory.ReadMemoryStructArray(Address + 0x258); + } + public OmsiCameraSettings[] ReflCameraSettings + { + get => Memory.ReadMemoryStructArray(Address + 0x25c); + } + public OmsiSplineHelper[] OmsiSplineHelpers + { + get => Memory.ReadMemoryStructArray(Address + 0x260); + } } } \ No newline at end of file diff --git a/OmsiHook/OmsiStructs.cs b/OmsiHook/OmsiStructs.cs index e7b4c32..8889516 100644 --- a/OmsiHook/OmsiStructs.cs +++ b/OmsiHook/OmsiStructs.cs @@ -885,4 +885,80 @@ public struct OmsiTreeTextureSet { public int main, winterSnow; } + + public struct OmsiObjectPathInfo + { + public D3DVector position; + public float hdg; + public float invradius; + public float laenge; + public float grdnt_strt; + public float grdnt_end; + public float neigung_strt; + public float neigung_end; + public float deltaHeight; + public bool use_deltaHeight; + public byte typ; + public float width; + public byte reverse; + public byte blinker; + public int ampel; + public OmsiObjectPathInfo[] blockings; + public bool crossingProblem; + public short switchDir; + [OmsiStructArrayPtr(typeof(OmsiPathInfoRailEnh))] public int rail_enh; + public OmsiThirdRail[] third_rails; + } + + public struct OmsiThirdRail + { + public float pos_x; + public float pos_z; + public byte flags; + public float volt; + public float freq; + public float sigA; + } + + public struct OmsiPathInfoRailEnh + { + public float schienenlaenge; + public bool stoesse; + public float Gleislage_Wellenlaenge; + public float Gleislage_Amp; + public int Gleislage_Pot; + public float Gleislage_Wellenlaenge_Z; + public float Gleislage_Amp_Z; + public int Gleislage_Pot_Z; + } + + public struct OmsiSnapPosition + { + public D3DVector position; + public float hdg; + public float steigung; + public float cant; + [OmsiPtr] public int parent_obj; + [OmsiPtr] public int parent_spl; + public int kachel; + public float offsetSpline; + public float offsetSplineY; + } + + public struct OmsiCameraSettings + { + public float angle_hdg_norm; + public float angle_hgt_norm; + public bool constDist; + public D3DVector pos; + public float dist; + public float sichtwinkel; + public float radius; + } + + public struct OmsiSplineHelper + { + public OmsiSnapPosition pos; + public string splineType; + } } From faa9b2ab4e51e73aebd0e82c6e2d56f629bd4980 Mon Sep 17 00:00:00 2001 From: Adam Mathieson Date: Mon, 18 Apr 2022 00:03:00 +0200 Subject: [PATCH 2/8] + TVehicle --- OmsiHook/OmsiVehicle.cs | 101 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/OmsiHook/OmsiVehicle.cs b/OmsiHook/OmsiVehicle.cs index b25ea4a..9ebf527 100644 --- a/OmsiHook/OmsiVehicle.cs +++ b/OmsiHook/OmsiVehicle.cs @@ -4,5 +4,106 @@ public class OmsiVehicle : OmsiComplMapObj { internal OmsiVehicle(Memory omsiMemory, int baseAddress) : base(omsiMemory, baseAddress) { } internal OmsiVehicle() : base() { } + public int StdCamera + { + get => Memory.ReadMemory(Address + 0x264); + set => Memory.WriteMemory(Address + 0x264, value); + } + public OmsiCameraSettings[] CameraSettingsDriver + { + get => Memory.ReadMemoryStructArray(Address + 0x268); + } + public OmsiCameraSettings[] CameraSettingsPax + { + get => Memory.ReadMemoryStructArray(Address + 0x26c); + } + public D3DVector OutsideCameraCenter + { + get => Memory.ReadMemory(Address + 0x270); + set => Memory.WriteMemory(Address + 0x270, value); + } + public int View_Schedule + { + get => Memory.ReadMemory(Address + 0x27c); + set => Memory.WriteMemory(Address + 0x27c, value); + } + public int View_TicketSelling + { + get => Memory.ReadMemory(Address + 0x280); + set => Memory.WriteMemory(Address + 0x280, value); + } + public byte Station_Side + { + get => Memory.ReadMemory(Address + 0x284); + set => Memory.WriteMemory(Address + 0x284, value); + } + public int Num_Werbung + { + get => Memory.ReadMemory(Address + 0x288); + set => Memory.WriteMemory(Address + 0x288, value); + } + public byte AI_Veh_Type + { + get => Memory.ReadMemory(Address + 0x28c); + set => Memory.WriteMemory(Address + 0x28c, value); + } + public byte REG_Type + { + get => Memory.ReadMemory(Address + 0x28d); + set => Memory.WriteMemory(Address + 0x28d, value); + } + public float Wider_Roll + { + get => Memory.ReadMemory(Address + 0x290); + set => Memory.WriteMemory(Address + 0x290, value); + } + /// + /// Focus Height? + /// + public float Schwerpunkt_height + { + get => Memory.ReadMemory(Address + 0x294); + set => Memory.WriteMemory(Address + 0x294, value); + } + public bool REG_NumberActive + { + get => Memory.ReadMemory(Address + 0x298); + set => Memory.WriteMemory(Address + 0x298, value); + } + public string REG_List + { + get => Memory.ReadMemoryString(Memory.ReadMemory(Address + 0x29c)); + set => Memory.WriteMemory(Memory.ReadMemory(Address + 0x29c), value); + } + public string REG_NumberFile + { + get => Memory.ReadMemoryString(Memory.ReadMemory(Address + 0x2a0)); + set => Memory.WriteMemory(Memory.ReadMemory(Address + 0x2a0), value); + } + public string REG_Prefix + { + get => Memory.ReadMemoryString(Memory.ReadMemory(Address + 0x2a4)); + set => Memory.WriteMemory(Memory.ReadMemory(Address + 0x2a4), value); + } + public string REG_Postfix + { + get => Memory.ReadMemoryString(Memory.ReadMemory(Address + 0x2a8)); + set => Memory.WriteMemory(Memory.ReadMemory(Address + 0x2a8), value); + } + public int Ident_Var + { + get => Memory.ReadMemory(Address + 0x2ac); + set => Memory.WriteMemory(Address + 0x2ac, value); + } + public int KMCounter_Init_StartYear + { + get => Memory.ReadMemory(Address + 0x2b0); + set => Memory.WriteMemory(Address + 0x2b0, value); + } + public int KMCounter_Init_KMPerYear + { + get => Memory.ReadMemory(Address + 0x2b4); + set => Memory.WriteMemory(Address + 0x2b4, value); + } } } \ No newline at end of file From 602d0d08e88a8786ec050aa8b32abea26cba4670 Mon Sep 17 00:00:00 2001 From: Adam Mathieson Date: Mon, 18 Apr 2022 00:51:57 +0200 Subject: [PATCH 3/8] + Start of RV + Add Tickets to tester --- OmsiExtensionsCLI/Program.cs | 1 + OmsiHook/OmsiRoadVehicle.cs | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/OmsiExtensionsCLI/Program.cs b/OmsiExtensionsCLI/Program.cs index 7f1a75e..44a51e2 100644 --- a/OmsiExtensionsCLI/Program.cs +++ b/OmsiExtensionsCLI/Program.cs @@ -18,6 +18,7 @@ static void Main(string[] args) var pos = omsi.PlayerVehicle.Position; var map = omsi.Map; var weather = omsi.Weather; + var tickets = omsi.TicketPack; Console.WriteLine($"Read data: x:{pos.x:F3}\ty:{pos.y:F3}\tz:{pos.z:F3}\t\t" + $"tile:{0}\trow45:{0:F3}\trow47:{0:F3}"); diff --git a/OmsiHook/OmsiRoadVehicle.cs b/OmsiHook/OmsiRoadVehicle.cs index 6a6e9c2..52492de 100644 --- a/OmsiHook/OmsiRoadVehicle.cs +++ b/OmsiHook/OmsiRoadVehicle.cs @@ -4,5 +4,17 @@ public class OmsiRoadVehicle : OmsiVehicle { internal OmsiRoadVehicle(Memory omsiMemory, int baseAddress) : base(omsiMemory, baseAddress) { } internal OmsiRoadVehicle() : base() { } + + /* TODO: + public OmsiScriptVarIndizes ScriptVarIndizes + { + get => Memory.ReadMemory(Address + 0x2b8); + set => Memory.WriteMemory(Address + 0x2b8, value); + }*/ + public bool Show_Dialogue + { + get => Memory.ReadMemory(Address + 0x500); + set => Memory.WriteMemory(Address + 0x500, value); + } } } \ No newline at end of file From 7fd9f171b60b014ba0764d1534dd6db77fc3d07f Mon Sep 17 00:00:00 2001 From: Adam Mathieson Date: Tue, 3 May 2022 00:14:23 +0200 Subject: [PATCH 4/8] + More Merging --- OmsiHook/OmsiComplMapObj.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/OmsiHook/OmsiComplMapObj.cs b/OmsiHook/OmsiComplMapObj.cs index 8508d09..da0e8d3 100644 --- a/OmsiHook/OmsiComplMapObj.cs +++ b/OmsiHook/OmsiComplMapObj.cs @@ -191,11 +191,7 @@ public int CTC_FarbSchema set => Memory.WriteMemory(Address + 0x244, value); } public OmsiTriggerBox[] TriggerBoxes => Memory.ReadMemoryStructArray(Address + 0x248); - /* TODO: - public OmsiTriggerBox[] TriggerBoxes - { - get => Memory.ReadMemoryStructArray(Address + 0x248); - }*/ + /* TODO: public OmsiComplObjPtr ComplObj { From 5963ea49c5e39df3b496dc3b6043936c73725a53 Mon Sep 17 00:00:00 2001 From: Adam Mathieson Date: Tue, 3 May 2022 12:56:10 +0200 Subject: [PATCH 5/8] + TVehicle --- OmsiHook/OmsiVehicle.cs | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/OmsiHook/OmsiVehicle.cs b/OmsiHook/OmsiVehicle.cs index 9ebf527..7ac25fd 100644 --- a/OmsiHook/OmsiVehicle.cs +++ b/OmsiHook/OmsiVehicle.cs @@ -12,10 +12,12 @@ public int StdCamera public OmsiCameraSettings[] CameraSettingsDriver { get => Memory.ReadMemoryStructArray(Address + 0x268); + //set => Memory.WriteMemory(Address + 0x264, value); } public OmsiCameraSettings[] CameraSettingsPax { get => Memory.ReadMemoryStructArray(Address + 0x26c); + //set => Memory.WriteMemory(Address + 0x264, value); } public D3DVector OutsideCameraCenter { @@ -37,11 +39,17 @@ public byte Station_Side get => Memory.ReadMemory(Address + 0x284); set => Memory.WriteMemory(Address + 0x284, value); } + /// + /// Livery index? + /// public int Num_Werbung { get => Memory.ReadMemory(Address + 0x288); set => Memory.WriteMemory(Address + 0x288, value); } + /// + /// ! Warn ! Listed as int in decompilation, but treated as byte due to following struct item + /// public byte AI_Veh_Type { get => Memory.ReadMemory(Address + 0x28c); @@ -58,9 +66,9 @@ public float Wider_Roll set => Memory.WriteMemory(Address + 0x290, value); } /// - /// Focus Height? + /// Center of Gravity Height /// - public float Schwerpunkt_height + public float Schwerpunkt_Height { get => Memory.ReadMemory(Address + 0x294); set => Memory.WriteMemory(Address + 0x294, value); @@ -70,25 +78,25 @@ public bool REG_NumberActive get => Memory.ReadMemory(Address + 0x298); set => Memory.WriteMemory(Address + 0x298, value); } - public string REG_List + public string REG_List // ANSI String { - get => Memory.ReadMemoryString(Memory.ReadMemory(Address + 0x29c)); - set => Memory.WriteMemory(Memory.ReadMemory(Address + 0x29c), value); + get => Memory.ReadMemoryString(Address + 0x29c); + set => Memory.WriteMemory(Address + 0x29c, value); } - public string REG_NumberFile + public string REG_NumberFile // ANSI String { - get => Memory.ReadMemoryString(Memory.ReadMemory(Address + 0x2a0)); - set => Memory.WriteMemory(Memory.ReadMemory(Address + 0x2a0), value); + get => Memory.ReadMemoryString(Address + 0x2a0); + set => Memory.WriteMemory(Address + 0x20a, value); } - public string REG_Prefix + public string REG_Prefix // ANSI String { - get => Memory.ReadMemoryString(Memory.ReadMemory(Address + 0x2a4)); - set => Memory.WriteMemory(Memory.ReadMemory(Address + 0x2a4), value); + get => Memory.ReadMemoryString(Address + 0x2a4); + set => Memory.WriteMemory(Address + 0x2a4, value); } - public string REG_Postfix + public string REG_Postfix // ANSI String { - get => Memory.ReadMemoryString(Memory.ReadMemory(Address + 0x2a8)); - set => Memory.WriteMemory(Memory.ReadMemory(Address + 0x2a8), value); + get => Memory.ReadMemoryString(Address + 0x2a8); + set => Memory.WriteMemory(Address + 0x2a8, value); } public int Ident_Var { From 1d1110b35c449af78578dcf70219ec1764e7528f Mon Sep 17 00:00:00 2001 From: Adam Mathieson Date: Tue, 3 May 2022 19:06:21 +0200 Subject: [PATCH 6/8] + almost done with TRV --- OmsiHook/OmsiRoadVehicle.cs | 198 ++++++++++++++++++++++++++++++++++-- OmsiHook/OmsiStructs.cs | 60 +++++++++++ 2 files changed, 252 insertions(+), 6 deletions(-) diff --git a/OmsiHook/OmsiRoadVehicle.cs b/OmsiHook/OmsiRoadVehicle.cs index 52492de..94a8378 100644 --- a/OmsiHook/OmsiRoadVehicle.cs +++ b/OmsiHook/OmsiRoadVehicle.cs @@ -3,18 +3,204 @@ public class OmsiRoadVehicle : OmsiVehicle { internal OmsiRoadVehicle(Memory omsiMemory, int baseAddress) : base(omsiMemory, baseAddress) { } - internal OmsiRoadVehicle() : base() { } - - /* TODO: - public OmsiScriptVarIndizes ScriptVarIndizes + public OmsiRoadVehicle() : base() { } + /*public OMSIScriptVarIndizes ScriptVarIndizes { - get => Memory.ReadMemory(Address + 0x2b8); + get => Memory.ReadMemory(Address + 0x2b8); set => Memory.WriteMemory(Address + 0x2b8, value); }*/ - public bool Show_Dialogue + + public bool Show_Dialog { get => Memory.ReadMemory(Address + 0x500); set => Memory.WriteMemory(Address + 0x500, value); } + public OmsiAchse[] Achse + { + get => Memory.ReadMemoryStructArray(Address + 0x504); + //set => Memory.WriteMemoryStructArray(Address + 0x504, value); + } + /// + /// Pivot + /// + public float Drehpunk + { + get => Memory.ReadMemory(Address + 0x508); + set => Memory.WriteMemory(Address + 0x508, value); + } + public float Inv_Min_Radius + { + get => Memory.ReadMemory(Address + 0x50c); + set => Memory.WriteMemory(Address + 0x50c, value); + } + public float AI_DeltaHeight + { + get => Memory.ReadMemory(Address + 0x510); + set => Memory.WriteMemory(Address + 0x510, value); + } + public float Rowdy_Factor_Min + { + get => Memory.ReadMemory(Address + 0x514); + set => Memory.WriteMemory(Address + 0x514, value); + } + public float Rowdy_Factor_Max + { + get => Memory.ReadMemory(Address + 0x518); + set => Memory.WriteMemory(Address + 0x518, value); + } + public int Var_AI_Station_Side + { + get => Memory.ReadMemory(Address + 0x51c); + set => Memory.WriteMemory(Address + 0x51c, value); + } + public float AI_Brake_A_Std + { + get => Memory.ReadMemory(Address + 0x520); + set => Memory.WriteMemory(Address + 0x520, value); + } + public float AI_Brake_A_RowVar + { + get => Memory.ReadMemory(Address + 0x524); + set => Memory.WriteMemory(Address + 0x524, value); + } + public float AI_Brake_MueExploit + { + get => Memory.ReadMemory(Address + 0x528); + set => Memory.WriteMemory(Address + 0x528, value); + } + public float AI_Brake_Final + { + get => Memory.ReadMemory(Address + 0x52c); + set => Memory.WriteMemory(Address + 0x52c, value); + } + public float AI_Brake_StopPointOffset + { + get => Memory.ReadMemory(Address + 0x530); + set => Memory.WriteMemory(Address + 0x530, value); + } + public int VehType + { + get => Memory.ReadMemory(Address + 0x534); + set => Memory.WriteMemory(Address + 0x534, value); + } + public OmsiCoupling[] Coupling + { + get => Memory.ReadMemoryStructArray(Address + 0x538); + //set => Memory.WriteMemory(Address + 0x538, value); + } + public OmsiVehicleCouple[] Couple + { + get => Memory.MarshalStructs( + Memory.ReadMemoryStructArray(Address + 0x568)); + //set => Memory.WriteMemory(Address + 0x538, value); + } + public OmsiVehicleCoupleChar Couple_Char + { + get => Memory.ReadMemory(Address + 0x534); + set => Memory.WriteMemory(Address + 0x534, value); + } + public bool Boogies_AVL + { + get => Memory.ReadMemory(Address + 0x588); + set => Memory.WriteMemory(Address + 0x588, value); + } + public float Bookies_Y + { + get => Memory.ReadMemory(Address + 0x58c); + set => Memory.WriteMemory(Address + 0x58c, value); + } + /// + /// ! WARN ! Data type un-known, assumed int due to size + /// + public int Var_Boogie_Wheel_At_Limit + { + get => Memory.ReadMemory(Address + 0x590); + set => Memory.WriteMemory(Address + 0x590, value); + } + /// + /// ! WARN ! Unkown name! + /// + public int Unknown_A + { + get => Memory.ReadMemory(Address + 0x594); + set => Memory.WriteMemory(Address + 0x594, value); + } + /// + /// ! WARN ! Data type un-known, assumed int due to size + /// + public int Var_Boogie_InvRadius + { + get => Memory.ReadMemory(Address + 0x598); + set => Memory.WriteMemory(Address + 0x598, value); + } + /// + /// ! WARN ! Unkown name! + /// + public int Unknown_B + { + get => Memory.ReadMemory(Address + 0x59c); + set => Memory.WriteMemory(Address + 0x59c, value); + } + /// + /// Sine Run Omega ? + /// + public float Sinuslauf_Omega + { + get => Memory.ReadMemory(Address + 0x5a0); + set => Memory.WriteMemory(Address + 0x5a0, value); + } + public float Sinuslauf_D + { + get => Memory.ReadMemory(Address + 0x5a4); + set => Memory.WriteMemory(Address + 0x5a4, value); + } + public float Sinuslauf_YSoll_Faktor + { + get => Memory.ReadMemory(Address + 0x5a8); + set => Memory.WriteMemory(Address + 0x5a8, value); + } + /// + /// Body Lever Arm Z? + /// + public float Wagenkasten_Hebelarm_Z + { + get => Memory.ReadMemory(Address + 0x5ac); + set => Memory.WriteMemory(Address + 0x5ac, value); + } + public float Wagenkasten_rotZPhys_Omega + { + get => Memory.ReadMemory(Address + 0x5b0); + set => Memory.WriteMemory(Address + 0x5b0, value); + } + public float Wagenkasten_rotZPhys_d + { + get => Memory.ReadMemory(Address + 0x5b4); + set => Memory.WriteMemory(Address + 0x5b4, value); + } + public float Wagenkasten_rotXPhys_Omega + { + get => Memory.ReadMemory(Address + 0x5b8); + set => Memory.WriteMemory(Address + 0x5b8, value); + } + public float Wagenkasten_rotXPhys_d + { + get => Memory.ReadMemory(Address + 0x5bc); + set => Memory.WriteMemory(Address + 0x5bc, value); + } + public float Wagenkasten_TransZPhys_Omega + { + get => Memory.ReadMemory(Address + 0x5c0); + set => Memory.WriteMemory(Address + 0x5c0, value); + } + public float Wagenkasten_TransZPhys_d + { + get => Memory.ReadMemory(Address + 0x5c4); + set => Memory.WriteMemory(Address + 0x5c4, value); + } + public OmsiContactShoe[] ContactShoes + { + get => Memory.ReadMemoryStructArray(Address + 0x5c8); + //set => Memory.ReadMemoryStructArray(Address + 0x5c8); + } } } \ No newline at end of file diff --git a/OmsiHook/OmsiStructs.cs b/OmsiHook/OmsiStructs.cs index c6e1055..ab8e933 100644 --- a/OmsiHook/OmsiStructs.cs +++ b/OmsiHook/OmsiStructs.cs @@ -969,4 +969,64 @@ public struct OmsiTriggerBox public float reverb_time; public float reverb_dist; } + + public struct OmsiAchse + { + public float _long; + public float maxWidth; + public float minWidth; + public float feder; + public float maxForce; + public float daempfer; + public float rad_dia; + public bool angetrieben; // Driven? Powered? + public float omega_F; + } + + public struct OmsiCoupling + { + public D3DVector position; + public OmsiCoupleCC[] cc; + } + + public struct OmsiCoupleCC + { + public int read_var; + public int write_var; + public int couple_var; + } + public struct OmsiVehicleCoupleInternal + { + [OmsiStrPtr] public int filename; + public bool reverse; + } + public struct OmsiVehicleCouple + { + public string filename; + public bool reverse; + } + + public struct OmsiVehicleCoupleChar + { + public float alpha_max; + public float beta_min; + public float beta_max; + public int type; + } + + public struct OmsiContactShoe + { + public byte boogie; + public float x_min; + public float x_max; + public float z_min; + public float z_max; + public byte flags; + public int var_volt_veh; + public int var_volt_rail; + public int var_volt_freq; + public int var_x; + public int var_z; + public int var_index; + } } From 8ddb77a5402e249478a1d7479fff3a51acb016fc Mon Sep 17 00:00:00 2001 From: Adam Mathieson Date: Tue, 3 May 2022 22:46:43 +0200 Subject: [PATCH 7/8] + OMSI HOF Class + Rest of RV class + Additional Structs from the above classes ! Warning ! Some elements are mis-typed or mis-labled due to lack of information about data structure. --- OmsiHook/OmsiHOF.cs | 60 ++++++++++++++++++++++++++++++++++++ OmsiHook/OmsiRoadVehicle.cs | 61 +++++++++++++++++++++++++++++++++++++ OmsiHook/OmsiStructs.cs | 47 ++++++++++++++++++++++++++++ 3 files changed, 168 insertions(+) create mode 100644 OmsiHook/OmsiHOF.cs diff --git a/OmsiHook/OmsiHOF.cs b/OmsiHook/OmsiHOF.cs new file mode 100644 index 0000000..dcb12f4 --- /dev/null +++ b/OmsiHook/OmsiHOF.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmsiHook +{ + public class OmsiHOF : OmsiObject + { + internal OmsiHOF(Memory omsiMemory, int baseAddress) : base(omsiMemory, baseAddress) { } + public OmsiHOF() : base() { } + + public string Name + { + get => Memory.ReadMemoryString(Address + 0x4); + set => Memory.WriteMemory(Address + 0x4, value); + } + /* + public string[] GlobalStrings + { + get => Memory.ReadMemoryObjArray(Address + 0x8); + //set => Memory.WriteMemory(Address + 0x8, value); + }*/ + public string ServiceTrip + { + get => Memory.ReadMemoryString(Address + 0xc); + set => Memory.WriteMemory(Address + 0xc, value); + } + public byte TargetStringCount + { + get => Memory.ReadMemory(Address + 0x10); + set => Memory.WriteMemory(Address + 0x10, value); + } + public byte BusStopStringCount + { + get => Memory.ReadMemory(Address + 0x11); + set => Memory.WriteMemory(Address + 0x11, value); + } + public OmsiHOFTarget[] Targets + { + get => Memory.MarshalStructs( + Memory.ReadMemoryStructArray(Address + 0x14)); + //set => Memory.WriteMemory(Address + 0x14, value); + } + public OmsiHofFISBusstop[] Busstops + { + get => Memory.MarshalStructs( + Memory.ReadMemoryStructArray(Address + 0x18)); + //set => Memory.WriteMemory(Address + 0x18, value); + } + public OmsiHofFISTrip[] HofFISTrips + { + get => Memory.MarshalStructs( + Memory.ReadMemoryStructArray(Address + 0x1c)); + //set => Memory.WriteMemory(Address + 0x1c, value); + } + + } +} diff --git a/OmsiHook/OmsiRoadVehicle.cs b/OmsiHook/OmsiRoadVehicle.cs index 94a8378..46f8825 100644 --- a/OmsiHook/OmsiRoadVehicle.cs +++ b/OmsiHook/OmsiRoadVehicle.cs @@ -202,5 +202,66 @@ public OmsiContactShoe[] ContactShoes get => Memory.ReadMemoryStructArray(Address + 0x5c8); //set => Memory.ReadMemoryStructArray(Address + 0x5c8); } + public D3DVector Front_Window_Vector + { + get => Memory.ReadMemory(Address + 0x5cc); + set => Memory.WriteMemory(Address + 0x5cc, value); + } + /// + /// Manufacturer + /// + public string Hersteller + { + get => Memory.ReadMemoryString(Address + 0x5d8); + set => Memory.WriteMemory(Address + 0x5d8, value); + } + public int Var_HOF + { + get => Memory.ReadMemory(Address + 0x5dc); + set => Memory.WriteMemory(Address + 0x5dc, value); + } + public int Var_File_Schedule + { + get => Memory.ReadMemory(Address + 0x5e0); + set => Memory.WriteMemory(Address + 0x5e0, value); + } + /// + /// HOF Files? + /// + public OmsiHOF[] Hoefe + { + get => Memory.ReadMemoryObjArray(Address + 0x5e4); + //set => Memory.WriteMemory(Address + 0x5e4, value); + } + public float FF_Zentr_Max + { + get => Memory.ReadMemory(Address + 0x5e8); + set => Memory.WriteMemory(Address + 0x5e8, value); + } + public float FF_Znetr_MaxSpeed + { + get => Memory.ReadMemory(Address + 0x5ec); + set => Memory.WriteMemory(Address + 0x5ec, value); + } + public float FF_Drag_Max + { + get => Memory.ReadMemory(Address + 0x5f0); + set => Memory.WriteMemory(Address + 0x5f0, value); + } + public float FF_Drag_MaxSpeed + { + get => Memory.ReadMemory(Address + 0x5f4); + set => Memory.WriteMemory(Address + 0x5f4, value); + } + public float FF_Vib_Period + { + get => Memory.ReadMemory(Address + 0x5f8); + set => Memory.WriteMemory(Address + 0x5f8, value); + } + public float FF_Vib_Amp + { + get => Memory.ReadMemory(Address + 0x5fc); + set => Memory.WriteMemory(Address + 0x5fc, value); + } } } \ No newline at end of file diff --git a/OmsiHook/OmsiStructs.cs b/OmsiHook/OmsiStructs.cs index ab8e933..6abc926 100644 --- a/OmsiHook/OmsiStructs.cs +++ b/OmsiHook/OmsiStructs.cs @@ -1029,4 +1029,51 @@ public struct OmsiContactShoe public int var_z; public int var_index; } + + public struct OmsiHOFTarget + { + public int nummer; + public string name; // ANSI String + public string endstelle; // Terminus - ANSI String + public int texNummer; + public string[] strings; + public bool allExit; + } + public struct OmsiHOFTargetInternal + { + public int nummer; + [OmsiStrPtr] public int name; // ANSI String + [OmsiStrPtr] public int endstelle; // Terminus - ANSI String + public int texNummer; + [OmsiStrArrayPtr] public int strings; + public bool allExit; + } + + public struct OmsiHofFISBusstop + { + public string ident; // ANSI String + public string[] strings; + } + public struct OmsiHofFISBusstopInternal + { + [OmsiStrPtr] public int ident; // ANSI String + [OmsiStrArrayPtr] public int strings; + } + + public struct OmsiHofFISTrip + { + public int code; + public string name; // ANSI String + public int target; + public string line; // ANSI String + public string[] busstops; + } + public struct OmsiHofFISTripInternal + { + public int code; + [OmsiStrPtr] public int name; // ANSI String + public int target; + [OmsiStrPtr] public int line; // ANSI String + [OmsiStrArrayPtr] public int busstops; + } } From ef2f4ab8bc3e9839bccf2f32fa78b52ab0046a83 Mon Sep 17 00:00:00 2001 From: Adam Mathieson Date: Tue, 3 May 2022 23:10:56 +0200 Subject: [PATCH 8/8] + PR Corrections --- OmsiHook/OmsiRoadVehicle.cs | 3 ++- OmsiHook/OmsiStructs.cs | 35 ++++++++++++++++++++++++++++++++--- OmsiHook/OmsiVehicle.cs | 2 +- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/OmsiHook/OmsiRoadVehicle.cs b/OmsiHook/OmsiRoadVehicle.cs index 46f8825..3fc14fe 100644 --- a/OmsiHook/OmsiRoadVehicle.cs +++ b/OmsiHook/OmsiRoadVehicle.cs @@ -85,7 +85,8 @@ public int VehType } public OmsiCoupling[] Coupling { - get => Memory.ReadMemoryStructArray(Address + 0x538); + get => Memory.MarshalStructs( + Memory.ReadMemoryStructArray(Address + 0x538)); //set => Memory.WriteMemory(Address + 0x538, value); } public OmsiVehicleCouple[] Couple diff --git a/OmsiHook/OmsiStructs.cs b/OmsiHook/OmsiStructs.cs index b911392..c74b1d5 100644 --- a/OmsiHook/OmsiStructs.cs +++ b/OmsiHook/OmsiStructs.cs @@ -906,10 +906,34 @@ public struct OmsiObjectPathInfo public OmsiObjectPathInfo[] blockings; public bool crossingProblem; public short switchDir; - [OmsiStructArrayPtr(typeof(OmsiPathInfoRailEnh))] public int rail_enh; + public OmsiPathInfoRailEnh[] rail_enh; public OmsiThirdRail[] third_rails; } + public struct OmsiObjectPathInfoInternal + { + public D3DVector position; + public float hdg; + public float invradius; + public float laenge; + public float grdnt_strt; + public float grdnt_end; + public float neigung_strt; + public float neigung_end; + public float deltaHeight; + public bool use_deltaHeight; + public byte typ; + public float width; + public byte reverse; + public byte blinker; + public int ampel; + [OmsiStructArrayPtr(typeof(OmsiObjectPathInfo))] public int blockings; + public bool crossingProblem; + public short switchDir; + [OmsiStructArrayPtr(typeof(OmsiPathInfoRailEnh))] public int rail_enh; + [OmsiStructArrayPtr(typeof(OmsiThirdRail))] public int third_rails; + } + public struct OmsiThirdRail { public float pos_x; @@ -938,8 +962,8 @@ public struct OmsiSnapPosition public float hdg; public float steigung; public float cant; - [OmsiPtr] public int parent_obj; - [OmsiPtr] public int parent_spl; + public int parent_obj; // Pointer + public int parent_spl; // Pointer public int kachel; public float offsetSpline; public float offsetSplineY; @@ -988,6 +1012,11 @@ public struct OmsiCoupling public D3DVector position; public OmsiCoupleCC[] cc; } + public struct OmsiCouplingInternal + { + public D3DVector position; + [OmsiStructArrayPtr(typeof(OmsiCoupleCC))] public int cc; + } public struct OmsiCoupleCC { diff --git a/OmsiHook/OmsiVehicle.cs b/OmsiHook/OmsiVehicle.cs index 7ac25fd..491e3a9 100644 --- a/OmsiHook/OmsiVehicle.cs +++ b/OmsiHook/OmsiVehicle.cs @@ -3,7 +3,7 @@ public class OmsiVehicle : OmsiComplMapObj { internal OmsiVehicle(Memory omsiMemory, int baseAddress) : base(omsiMemory, baseAddress) { } - internal OmsiVehicle() : base() { } + public OmsiVehicle() : base() { } public int StdCamera { get => Memory.ReadMemory(Address + 0x264);