Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions DLSv2/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DLS")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyCopyright("Copyright © 2025 TheMaybeast & PNWParksFan")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: ComVisible(false)]

[assembly: Guid("64295692-3277-4187-bccf-0af4cb1f9350")]

[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyVersion("2.0.0.2")]
[assembly: AssemblyFileVersion("2.0.0.2")]
118 changes: 65 additions & 53 deletions DLSv2/Utils/DLSExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@ public static LightMode GetEmptyMode(this Vehicle veh)
};
}

private static EmergencyLighting blankEL = EmergencyLighting.GetByName("DLS_EMPTY_LIGHTING_DO_NOT_EDIT") ?? new EmergencyLighting() { Name = "DLS_EMPTY_LIGHTING_DO_NOT_EDIT" };

internal static SirenSetting GetDefaultSirenSetting(this Vehicle veh)
{
var defaultEl = veh.DefaultEmergencyLighting;
// Use a blank EmergencyLighting instance if the vehicle does not have a default
var defaultEl = veh.DefaultEmergencyLighting ?? blankEL;

return new SirenSetting()
{
TimeMultiplier = defaultEl.TimeMultiplier,
Expand All @@ -69,52 +73,60 @@ internal static SirenSetting GetDefaultSirenSetting(this Vehicle veh)
RightTailLightSequencer = new SequencerWrapper(defaultEl.RightTailLightSequence),
RightTailLightMultiples = defaultEl.RightTailLightMultiples,

Sirens = Enumerable.Range(0, EmergencyLighting.MaxLights).Select(i => new SirenEntry(i + 1)
{
// Main Light Settings
LightColor = defaultEl.Lights[i].Color,
Intensity = defaultEl.Lights[i].Intensity,
LightGroup = defaultEl.Lights[i].LightGroup,
Rotate = defaultEl.Lights[i].Rotate,
Scale = defaultEl.Lights[i].Scale,
ScaleFactor = defaultEl.Lights[i].ScaleFactor,
Flash = defaultEl.Lights[i].Flash,
SpotLight = defaultEl.Lights[i].SpotLight,
CastShadows = defaultEl.Lights[i].CastShadows,
Light = defaultEl.Lights[i].Light,

// Rotation Settings
Rotation = new LightDetailEntry()
{
DeltaDeg = defaultEl.Lights[i].RotationDelta,
StartDeg = defaultEl.Lights[i].RotationStart,
Speed = defaultEl.Lights[i].RotationSpeed,
Sequence = new Sequencer(defaultEl.Lights[i].RotationSequence),
Multiples = defaultEl.Lights[i].RotationMultiples,
Direction = defaultEl.Lights[i].RotationDirection,
SyncToBPM = defaultEl.Lights[i].RotationSynchronizeToBpm
},

// Flashiness Settings
Flashiness = new LightDetailEntry
Sirens = Enumerable.Range(0, EmergencyLighting.MaxLights).Select(i => {

// Copy settings from default for all sirens that exist on the setting, and pull in
// blank entries for any that don't (which can happen for built-in siren settings that
// have only 20 entries even if SSLA is installed)
var light = (i < defaultEl.Lights.Length) ? defaultEl.Lights[i] : blankEL.Lights[0];

return new SirenEntry(i + 1)
{
DeltaDeg = defaultEl.Lights[i].FlashinessDelta,
StartDeg = defaultEl.Lights[i].FlashinessStart,
Speed = defaultEl.Lights[i].FlashinessSpeed,
Sequence = new Sequencer(defaultEl.Lights[i].FlashinessSequence),
Multiples = defaultEl.Lights[i].FlashinessMultiples,
Direction = defaultEl.Lights[i].FlashinessDirection,
SyncToBPM = defaultEl.Lights[i].FlashinessSynchronizeToBpm
},

// Corona Settings
Corona = new CoronaEntry()
{
CoronaIntensity = defaultEl.Lights[i].CoronaIntensity,
CoronaSize = defaultEl.Lights[i].CoronaSize,
CoronaPull = defaultEl.Lights[i].CoronaPull,
CoronaFaceCamera = defaultEl.Lights[i].CoronaFaceCamera,
}
// Main Light Settings
LightColor = light.Color,
Intensity = light.Intensity,
LightGroup = light.LightGroup,
Rotate = light.Rotate,
Scale = light.Scale,
ScaleFactor = light.ScaleFactor,
Flash = light.Flash,
SpotLight = light.SpotLight,
CastShadows = light.CastShadows,
Light = light.Light,

// Rotation Settings
Rotation = new LightDetailEntry()
{
DeltaDeg = light.RotationDelta,
StartDeg = light.RotationStart,
Speed = light.RotationSpeed,
Sequence = new Sequencer(light.RotationSequence),
Multiples = light.RotationMultiples,
Direction = light.RotationDirection,
SyncToBPM = light.RotationSynchronizeToBpm
},

// Flashiness Settings
Flashiness = new LightDetailEntry
{
DeltaDeg = light.FlashinessDelta,
StartDeg = light.FlashinessStart,
Speed = light.FlashinessSpeed,
Sequence = new Sequencer(light.FlashinessSequence),
Multiples = light.FlashinessMultiples,
Direction = light.FlashinessDirection,
SyncToBPM = light.FlashinessSynchronizeToBpm
},

// Corona Settings
Corona = new CoronaEntry()
{
CoronaIntensity = light.CoronaIntensity,
CoronaSize = light.CoronaSize,
CoronaPull = light.CoronaPull,
CoronaFaceCamera = light.CoronaFaceCamera,
}
};
}).ToArray()
};
}
Expand All @@ -140,16 +152,16 @@ public static void ApplyLightModes(this ManagedVehicle managedVehicle, List<Ligh
}
else
{
if (EmergencyLighting.GetByName("DLS_" + key) == null)
if (EmergencyLighting.GetByName("DLS_" + key) != null)
{
eL = vehicle.EmergencyLighting.Clone();
eL.Name = "DLS_" + key;
("Created \"" + eL.Name + "\" EL").ToLog(LogLevel.DEBUG);
eL = EmergencyLighting.GetByName("DLS_" + key);
("Allocated \"" + eL.Name + "\" EL from Game Memory").ToLog(LogLevel.DEBUG);
}
else
{
eL = EmergencyLighting.GetByName("DLS_" + key);
("Allocated \"" + eL.Name + "\" EL from Game Memory").ToLog(LogLevel.DEBUG);
eL = new EmergencyLighting();
eL.Name = "DLS_" + key;
("Created \"" + eL.Name + "\" EL").ToLog(LogLevel.DEBUG);
}
}

Expand All @@ -162,7 +174,7 @@ public static void ApplyLightModes(this ManagedVehicle managedVehicle, List<Ligh

foreach (var mode in modes)
{
if (mode.ApplyDefaultSirenSettings)
if (mode.ApplyDefaultSirenSettings && vehicle.DefaultEmergencyLighting != null)
eL.Copy(vehicle.DefaultEmergencyLighting);

SirenApply.ApplySirenSettingsToEmergencyLighting(mode.SirenSettings, eL);
Expand Down
4 changes: 2 additions & 2 deletions DLSv2/Utils/Game/SirenSounds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public static void MemoryInit()
{
InitAudSoundSet = Marshal.GetDelegateForFunctionPointer<InitAudSoundSetDelegate>(address);
}
address = Game.FindPattern("48 8B 8B ?? ?? 00 00 E8 ?? ?? ?? ?? 48 8B 8B 70 13 00 00");

address = Game.FindPattern("48 8B 8B ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 8B 8B ?? ?? ?? ?? 48 85 C9 74 ?? 48 8B D3");
if (Memory.AssertAddress(address, nameof(CVehicle_AudVehicleAudioEntityOffset)))
{
CVehicle_AudVehicleAudioEntityOffset = Marshal.ReadInt32(address + 3);
Expand Down