From 871bd785d05131962dd28d168987ef53467510b3 Mon Sep 17 00:00:00 2001 From: Adam Mathieson Date: Sun, 8 May 2022 12:00:18 +0200 Subject: [PATCH] + ActuWeather class and base pointer --- OmsiHook/OmsiActuWeather.cs | 52 +++++++++++++++++++++++++++++++++++++ OmsiHook/OmsiHook.cs | 7 +++++ 2 files changed, 59 insertions(+) create mode 100644 OmsiHook/OmsiActuWeather.cs diff --git a/OmsiHook/OmsiActuWeather.cs b/OmsiHook/OmsiActuWeather.cs new file mode 100644 index 0000000..d857681 --- /dev/null +++ b/OmsiHook/OmsiActuWeather.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmsiHook +{ + public class OmsiActuWeather : OmsiObject + { + internal OmsiActuWeather(Memory omsiMemory, int baseAddress) : base(omsiMemory, baseAddress) { } + public OmsiActuWeather() : base() { } + /* + public OmsiWebBrowser WebBrowser1 + { + get => new(Memory, Memory.ReadMemory(Address + 0x4)); + }*/ + public bool Active + { + get => Memory.ReadMemory(Address + 0x8); + set => Memory.WriteMemory(Address + 0x8, value); + } + public string ICAO + { + get => Memory.ReadMemoryString(Address + 0xc); + set => Memory.WriteMemory(Address + 0xc, value); + } + /// + /// Delphi DateTime - integer part = days since 30/12/1899, fraction part = time of day + /// + public double LastDownloaded + { + get => Memory.ReadMemory(Address + 0x10); + set => Memory.WriteMemory(Address + 0x10, value); + } + public bool Invalid_ICAO + { + get => Memory.ReadMemory(Address + 0x18); + set => Memory.WriteMemory(Address + 0x18, value); + } + public uint Counter + { + get => Memory.ReadMemory(Address + 0x1c); + set => Memory.WriteMemory(Address + 0x1c, value); + } + public byte Prozess + { + get => Memory.ReadMemory(Address + 0x20); + set => Memory.WriteMemory(Address + 0x20, value); + } + } +} diff --git a/OmsiHook/OmsiHook.cs b/OmsiHook/OmsiHook.cs index 01a4648..d1a7e0a 100644 --- a/OmsiHook/OmsiHook.cs +++ b/OmsiHook/OmsiHook.cs @@ -26,6 +26,13 @@ public class OmsiHook public OmsiTime Time => new(omsiMemory, 0); public OmsiDriver[] Drivers => omsiMemory.MarshalStructs(omsiMemory.ReadMemoryStructArray(0x008614F8)); public int SelectedDriver => omsiMemory.ReadMemory(0x008614FC); + + /// + /// Current real weather config + /// + public OmsiActuWeather ActuWeather => new(omsiMemory, omsiMemory.ReadMemory(0x00861278)); + + /// /// Attaches the hooking application to OMSI.exe. /// Always call this at some point before trying to read and write data.