diff --git a/OmsiHook/OmsiBoolClass.cs b/OmsiHook/OmsiBoolClass.cs new file mode 100644 index 0000000..62589d7 --- /dev/null +++ b/OmsiHook/OmsiBoolClass.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmsiHook +{ + /// + /// Defines a set of conditions based on various data types. + /// + public class OmsiBoolClass : OmsiObject + { + internal OmsiBoolClass(Memory omsiMemory, int baseAddress) : base(omsiMemory, baseAddress) { } + public OmsiBoolClass() : base() { } + + public OmsiBoolClassCondiBool[] CondisBool + { + get => Memory.ReadMemoryStructArray(Address + 0x4); + } + public OmsiBoolClassCondiInt[] CondisInt + { + get => Memory.ReadMemoryStructArray(Address + 0x8); + } + public OmsiBoolClassCondiFloat[] CondisFloat + { + get => Memory.ReadMemoryStructArray(Address + 0xc); + } + } +} diff --git a/OmsiHook/OmsiSound.cs b/OmsiHook/OmsiSound.cs index 084153a..fbc0931 100644 --- a/OmsiHook/OmsiSound.cs +++ b/OmsiHook/OmsiSound.cs @@ -1,4 +1,6 @@ -namespace OmsiHook +using System; + +namespace OmsiHook { /// /// Sound that is playable by OMSI @@ -7,17 +9,204 @@ public class OmsiSound : OmsiObject { internal OmsiSound(Memory omsiMemory, int baseAddress) : base(omsiMemory, baseAddress) { } public OmsiSound() : base() { } - - /*public DirectSound8 Device + public string FileName { - get => Memory.ReadMemory(Address + 0x4); + get => Memory.ReadMemoryString(Address + 0x4); set => Memory.WriteMemory(Address + 0x4, value); - }*/ - public string FileName + } + /// + /// Pointer to an IDirectSound8 + /// + public IntPtr Device + { + get => new(Memory.ReadMemory(Address + 0x8)); + set => Memory.WriteMemory(Address + 0x8, value.ToInt32()); + } + /// + /// Pointer to an IDirectSoundBuffer8 + /// + public IntPtr SoundBuffer + { + get => new(Memory.ReadMemory(Address + 0xc)); + set => Memory.WriteMemory(Address + 0xc, value.ToInt32()); + } + /// + /// Pointer to an IDirectSoundFXWavesReverb8 + /// + public IntPtr FX_Hall + { + get => new(Memory.ReadMemory(Address + 0x10)); + set => Memory.WriteMemory(Address + 0x10, value.ToInt32()); + } + public float FX_Hall_Gain + { + get => Memory.ReadMemory(Address + 0x14); + set => Memory.WriteMemory(Address + 0x14, value); + } + public float FX_Hall_Time + { + get => Memory.ReadMemory(Address + 0x18); + set => Memory.WriteMemory(Address + 0x18, value); + } + public bool Failed + { + get => Memory.ReadMemory(Address + 0x1c); + set => Memory.WriteMemory(Address + 0x1c, value); + } + public float[] InternVars + { + get => Memory.ReadMemoryStructArray(Address + 0x20); + } + public uint StartTime + { + get => Memory.ReadMemory(Address + 0x24); + set => Memory.WriteMemory(Address + 0x24, value); + } + public int BufferSize + { + get => Memory.ReadMemory(Address + 0x28); + set => Memory.WriteMemory(Address + 0x28, value); + } + public float Prev_Volume + { + get => Memory.ReadMemory(Address + 0x2c); + set => Memory.WriteMemory(Address + 0x2c, value); + } + public int FreqVar + { + get => Memory.ReadMemory(Address + 0x30); + set => Memory.WriteMemory(Address + 0x30, value); + } + public int SampleRate + { + get => Memory.ReadMemory(Address + 0x34); + set => Memory.WriteMemory(Address + 0x34, value); + } + public float RefValue + { + get => Memory.ReadMemory(Address + 0x38); + set => Memory.WriteMemory(Address + 0x38, value); + } + public bool Loop + { + get => Memory.ReadMemory(Address + 0x3c); + set => Memory.WriteMemory(Address + 0x3c, value); + } + public bool Pitch + { + get => Memory.ReadMemory(Address + 0x3d); + set => Memory.WriteMemory(Address + 0x3d, value); + } + public bool Triggered + { + get => Memory.ReadMemory(Address + 0x3e); + set => Memory.WriteMemory(Address + 0x3e, value); + } + public bool CheckLoading + { + get => Memory.ReadMemory(Address + 0x3f); + set => Memory.WriteMemory(Address + 0x3f, value); + } + public bool OnlyOne { - get => Memory.ReadMemoryString(Memory.ReadMemory(Address + 0x8)); - set => Memory.WriteMemory(Address + 0x8, value); + get => Memory.ReadMemory(Address + 0x40); + set => Memory.WriteMemory(Address + 0x40, value); } + /// + /// Only One _ Prohibition? + /// + public bool OnlyOne_Verbot + { + get => Memory.ReadMemory(Address + 0x41); + set => Memory.WriteMemory(Address + 0x41, value); + } + public bool Important + { + get => Memory.ReadMemory(Address + 0x42); + set => Memory.WriteMemory(Address + 0x42, value); + } + public string[] TriggerList + { + get => Memory.ReadMemoryStringArray(Address + 0x44); + } + public bool StartTrigSnd + { + get => Memory.ReadMemory(Address + 0x48); + set => Memory.WriteMemory(Address + 0x48, value); + } + public byte Flag_Viewpoint + { + get => Memory.ReadMemory(Address + 0x49); + set => Memory.WriteMemory(Address + 0x49, value); + } + public bool Is3D + { + get => Memory.ReadMemory(Address + 0x4a); + set => Memory.WriteMemory(Address + 0x4a, value); + } + public D3DVector SndPos + { + get => Memory.ReadMemory(Address + 0x4b); + set => Memory.WriteMemory(Address + 0x4b, value); + } + public float VolDist + { + get => Memory.ReadMemory(Address + 0x58); + set => Memory.WriteMemory(Address + 0x58, value); + } + public bool HasDir + { + get => Memory.ReadMemory(Address + 0x5c); + set => Memory.WriteMemory(Address + 0x5c, value); + } + public D3DVector Dir + { + get => Memory.ReadMemory(Address + 0x5d); + set => Memory.WriteMemory(Address + 0x5d, value); + } + public float VolFaktor + { + get => Memory.ReadMemory(Address + 0x6c); + set => Memory.WriteMemory(Address + 0x6c, value); + } + public int[] VolVars + { + get => Memory.ReadMemoryStructArray(Address + 0x70); + } + public OmsiFuncClass[] VolCurves + { + get => Memory.ReadMemoryObjArray(Address + 0x74); + } + public OmsiBoolClass BoolClass + { + get => new(Memory, Memory.ReadMemory(Address + 0x78)); + } + public bool Playing + { + get => Memory.ReadMemory(Address + 0x7c); + set => Memory.WriteMemory(Address + 0x7c, value); + } + public bool MayPlay + { + get => Memory.ReadMemory(Address + 0x7d); + set => Memory.WriteMemory(Address + 0x7d, value); + } + public bool Stopped_TooFar + { + get => Memory.ReadMemory(Address + 0x7e); + set => Memory.WriteMemory(Address + 0x7e, value); + } + /// + /// Pointer to an IDirectSound3DBuffer + /// + public IntPtr Int3D + { + get => new(Memory.ReadMemory(Address + 0x80)); + set => Memory.WriteMemory(Address + 0x80, value.ToInt32()); + } + + + } } \ No newline at end of file diff --git a/OmsiHook/OmsiStructs.cs b/OmsiHook/OmsiStructs.cs index c6cf8de..9ea06b4 100644 --- a/OmsiHook/OmsiStructs.cs +++ b/OmsiHook/OmsiStructs.cs @@ -1765,4 +1765,35 @@ internal struct OmsiRVFileInternal [OmsiStructArrayPtr(typeof(OmsiRVTypeTour), typeof(OmsiRVTypeTourInternal))] public int list_type_tour; [OmsiStruct(typeof(OmsiRVTypesLine), typeof(OmsiRVTypesLineInternal))] public int list_types_line; } + + /* TODO: Parse the pointers better to get the variables */ + public struct OmsiBoolClassCondiBool + { + /// + /// Pointer to array of float var pointers (OSC accessible variables) + /// + public int vars; + public int varNum; + public bool negative; + } + public struct OmsiBoolClassCondiInt + { + /// + /// Pointer to array of float var pointers (OSC accessible variables) + /// + public int vars; + public int varNum; + public int refValue; + public int comparison; + } + public struct OmsiBoolClassCondiFloat + { + /// + /// Pointer to array of float var pointers (OSC accessible variables) + /// + public int vars; + public int varNum; + public float refValue; + public int comparison; + } }