Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

+ OmsiSound Completed for @sjain882 #43

Merged
merged 4 commits into from
May 23, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions OmsiHook/OmsiBoolClass.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OmsiHook
{
/// <summary>
/// Defines a set of conditions based on various data types.
/// </summary>
public class OmsiBoolClass : OmsiObject
{
internal OmsiBoolClass(Memory omsiMemory, int baseAddress) : base(omsiMemory, baseAddress) { }
public OmsiBoolClass() : base() { }

public OmsiBoolClassCondiBool[] CondisBool
{
get => Memory.ReadMemoryStructArray<OmsiBoolClassCondiBool>(Address + 0x4);
}
public OmsiBoolClassCondiInt[] CondisInt
{
get => Memory.ReadMemoryStructArray<OmsiBoolClassCondiInt>(Address + 0x8);
}
public OmsiBoolClassCondiFloat[] CondisFloat
{
get => Memory.ReadMemoryStructArray<OmsiBoolClassCondiFloat>(Address + 0xc);
}
}
}
199 changes: 193 additions & 6 deletions OmsiHook/OmsiSound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,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<DirectSound8>(Address + 0x4);
get => Memory.ReadMemoryString(Address + 0x4);
set => Memory.WriteMemory(Address + 0x4, value);
}*/
public string FileName
}
/// <summary>
/// Pointer to an IDirectSound8
/// </summary>
public int Device
{
get => Memory.ReadMemoryString(Memory.ReadMemory<int>(Address + 0x8));
get => Memory.ReadMemory<int>(Address + 0x8);
set => Memory.WriteMemory(Address + 0x8, value);
}
/// <summary>
/// Pointer to an IDirectSoundBuffer8
/// </summary>
public int SoundBuffer
{
get => Memory.ReadMemory<int>(Address + 0xc);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please cast to an IntPtr

set => Memory.WriteMemory(Address + 0xc, value);
}
/// <summary>
/// Pointer to an IDirectSoundFXWavesReverb8
/// </summary>
public int FX_Hall
{
get => Memory.ReadMemory<int>(Address + 0x10);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please cast to an IntPtr

set => Memory.WriteMemory(Address + 0x10, value);
}
public float FX_Hall_Gain
{
get => Memory.ReadMemory<float>(Address + 0x14);
set => Memory.WriteMemory(Address + 0x14, value);
}
public float FX_Hall_Time
{
get => Memory.ReadMemory<float>(Address + 0x18);
set => Memory.WriteMemory(Address + 0x18, value);
}
public bool Failed
{
get => Memory.ReadMemory<bool>(Address + 0x1c);
set => Memory.WriteMemory(Address + 0x1c, value);
}
public float[] InternVars
{
get => Memory.ReadMemoryStructArray<float>(Address + 0x20);
}
public uint StartTime
{
get => Memory.ReadMemory<uint>(Address + 0x24);
set => Memory.WriteMemory(Address + 0x24, value);
}
public int BufferSize
{
get => Memory.ReadMemory<int>(Address + 0x28);
set => Memory.WriteMemory(Address + 0x28, value);
}
public float Prev_Volume
{
get => Memory.ReadMemory<float>(Address + 0x2c);
set => Memory.WriteMemory(Address + 0x2c, value);
}
public int FreqVar
{
get => Memory.ReadMemory<int>(Address + 0x30);
set => Memory.WriteMemory(Address + 0x30, value);
}
public int SampleRate
{
get => Memory.ReadMemory<int>(Address + 0x34);
set => Memory.WriteMemory(Address + 0x34, value);
}
public float RefValue
{
get => Memory.ReadMemory<float>(Address + 0x38);
set => Memory.WriteMemory(Address + 0x38, value);
}
public bool Loop
{
get => Memory.ReadMemory<bool>(Address + 0x3c);
set => Memory.WriteMemory(Address + 0x3c, value);
}
public bool Pitch
{
get => Memory.ReadMemory<bool>(Address + 0x3d);
set => Memory.WriteMemory(Address + 0x3d, value);
}
public bool Triggered
{
get => Memory.ReadMemory<bool>(Address + 0x3e);
set => Memory.WriteMemory(Address + 0x3e, value);
}
public bool CheckLoading
{
get => Memory.ReadMemory<bool>(Address + 0x3f);
set => Memory.WriteMemory(Address + 0x3f, value);
}
public bool OnlyOne
{
get => Memory.ReadMemory<bool>(Address + 0x40);
set => Memory.WriteMemory(Address + 0x40, value);
}
/// <summary>
/// Only One _ Prohibition?
/// </summary>
public bool OnlyOne_Verbot
{
get => Memory.ReadMemory<bool>(Address + 0x41);
set => Memory.WriteMemory(Address + 0x41, value);
}
public bool Important
{
get => Memory.ReadMemory<bool>(Address + 0x42);
set => Memory.WriteMemory(Address + 0x42, value);
}
public string[] TriggerList
{
get => Memory.ReadMemoryStringArray(Address + 0x44);
}
public bool StartTrigSnd
{
get => Memory.ReadMemory<bool>(Address + 0x48);
set => Memory.WriteMemory(Address + 0x48, value);
}
public byte Flag_Viewpoint
{
get => Memory.ReadMemory<byte>(Address + 0x49);
set => Memory.WriteMemory(Address + 0x49, value);
}
public bool Is3D
{
get => Memory.ReadMemory<bool>(Address + 0x4a);
set => Memory.WriteMemory(Address + 0x4a, value);
}
public D3DVector SndPos
{
get => Memory.ReadMemory<D3DVector>(Address + 0x4b);
set => Memory.WriteMemory(Address + 0x4b, value);
}
public float VolDist
{
get => Memory.ReadMemory<float>(Address + 0x58);
set => Memory.WriteMemory(Address + 0x58, value);
}
public bool HasDir
{
get => Memory.ReadMemory<bool>(Address + 0x5c);
set => Memory.WriteMemory(Address + 0x5c, value);
}
public D3DVector Dir
{
get => Memory.ReadMemory<D3DVector>(Address + 0x5d);
set => Memory.WriteMemory(Address + 0x5d, value);
}
public float VolFaktor
{
get => Memory.ReadMemory<float>(Address + 0x6c);
set => Memory.WriteMemory(Address + 0x6c, value);
}
public int[] VolVars
{
get => Memory.ReadMemoryStructArray<int>(Address + 0x70);
}
public OmsiFuncClass[] VolCurves
{
get => Memory.ReadMemoryObjArray<OmsiFuncClass>(Address + 0x74);
}
public OmsiBoolClass BoolClass
{
get => new(Memory, Memory.ReadMemory<int>(Address + 0x78));
}
public bool Playing
{
get => Memory.ReadMemory<bool>(Address + 0x7c);
set => Memory.WriteMemory(Address + 0x7c, value);
}
public bool MayPlay
{
get => Memory.ReadMemory<bool>(Address + 0x7d);
set => Memory.WriteMemory(Address + 0x7d, value);
}
public bool Stopped_TooFar
{
get => Memory.ReadMemory<bool>(Address + 0x7e);
set => Memory.WriteMemory(Address + 0x7e, value);
}
/// <summary>
/// Pointer to an IDirectSound3DBuffer
/// </summary>
public int Int3D
{
get => Memory.ReadMemory<int>(Address + 0x80);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cast to IntPtr

set => Memory.WriteMemory(Address + 0x80, value);
}




}
}
31 changes: 31 additions & 0 deletions OmsiHook/OmsiStructs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
/// <summary>
/// Pointer to array of float var pointers (OSC accessible variables)
/// </summary>
public int vars;
public int varNum;
public bool negative;
}
public struct OmsiBoolClassCondiInt
{
/// <summary>
/// Pointer to array of float var pointers (OSC accessible variables)
/// </summary>
public int vars;
public int varNum;
public int refValue;
public int comparison;
}
public struct OmsiBoolClassCondiFloat
{
/// <summary>
/// Pointer to array of float var pointers (OSC accessible variables)
/// </summary>
public int vars;
public int varNum;
public float refValue;
public int comparison;
}
}