diff --git a/OmsiExtensions.sln b/OmsiExtensions.sln index 0c1e459..9ef4945 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 diff --git a/OmsiExtensionsCLI/Program.cs b/OmsiExtensionsCLI/Program.cs index f8a5090..37e6eb8 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/OmsiComplMapObj.cs b/OmsiHook/OmsiComplMapObj.cs index 6218f2e..da0e8d3 100644 --- a/OmsiHook/OmsiComplMapObj.cs +++ b/OmsiHook/OmsiComplMapObj.cs @@ -191,5 +191,33 @@ public int CTC_FarbSchema set => Memory.WriteMemory(Address + 0x244, value); } public OmsiTriggerBox[] TriggerBoxes => 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/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 6a6e9c2..3fc14fe 100644 --- a/OmsiHook/OmsiRoadVehicle.cs +++ b/OmsiHook/OmsiRoadVehicle.cs @@ -3,6 +3,266 @@ public class OmsiRoadVehicle : OmsiVehicle { internal OmsiRoadVehicle(Memory omsiMemory, int baseAddress) : base(omsiMemory, baseAddress) { } - internal OmsiRoadVehicle() : base() { } + public OmsiRoadVehicle() : base() { } + /*public OMSIScriptVarIndizes ScriptVarIndizes + { + get => Memory.ReadMemory(Address + 0x2b8); + set => Memory.WriteMemory(Address + 0x2b8, value); + }*/ + + 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.MarshalStructs( + 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); + } + 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 86393e5..c74b1d5 100644 --- a/OmsiHook/OmsiStructs.cs +++ b/OmsiHook/OmsiStructs.cs @@ -886,6 +886,106 @@ 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; + 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; + 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; + public int parent_obj; // Pointer + public int parent_spl; // Pointer + 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; + } + public struct OmsiTriggerBox { public D3DOBB box; @@ -894,6 +994,117 @@ public struct OmsiTriggerBox 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 OmsiCouplingInternal + { + public D3DVector position; + [OmsiStructArrayPtr(typeof(OmsiCoupleCC))] public int 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; + } + + 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; + } public struct OmsiCollFeedback { public D3DVector position; diff --git a/OmsiHook/OmsiVehicle.cs b/OmsiHook/OmsiVehicle.cs index b25ea4a..491e3a9 100644 --- a/OmsiHook/OmsiVehicle.cs +++ b/OmsiHook/OmsiVehicle.cs @@ -3,6 +3,115 @@ 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); + set => Memory.WriteMemory(Address + 0x264, value); + } + 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 + { + 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); + } + /// + /// 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); + 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); + } + /// + /// Center of Gravity 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 // ANSI String + { + get => Memory.ReadMemoryString(Address + 0x29c); + set => Memory.WriteMemory(Address + 0x29c, value); + } + public string REG_NumberFile // ANSI String + { + get => Memory.ReadMemoryString(Address + 0x2a0); + set => Memory.WriteMemory(Address + 0x20a, value); + } + public string REG_Prefix // ANSI String + { + get => Memory.ReadMemoryString(Address + 0x2a4); + set => Memory.WriteMemory(Address + 0x2a4, value); + } + public string REG_Postfix // ANSI String + { + get => Memory.ReadMemoryString(Address + 0x2a8); + set => Memory.WriteMemory(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