diff --git a/DLSv2/Properties/AssemblyInfo.cs b/DLSv2/Properties/AssemblyInfo.cs index 88c3ed3..8b3daa7 100644 --- a/DLSv2/Properties/AssemblyInfo.cs +++ b/DLSv2/Properties/AssemblyInfo.cs @@ -6,7 +6,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DLS")] -[assembly: AssemblyCopyright("Copyright © 2024")] +[assembly: AssemblyCopyright("Copyright © 2025 TheMaybeast & PNWParksFan")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -14,5 +14,5 @@ [assembly: Guid("64295692-3277-4187-bccf-0af4cb1f9350")] -[assembly: AssemblyVersion("2.0.0.0")] -[assembly: AssemblyFileVersion("2.0.0.0")] \ No newline at end of file +[assembly: AssemblyVersion("2.0.0.2")] +[assembly: AssemblyFileVersion("2.0.0.2")] \ No newline at end of file diff --git a/DLSv2/Utils/DLSExtensions.cs b/DLSv2/Utils/DLSExtensions.cs index 46b7fdc..b1a2fb0 100644 --- a/DLSv2/Utils/DLSExtensions.cs +++ b/DLSv2/Utils/DLSExtensions.cs @@ -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, @@ -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() }; } @@ -140,16 +152,16 @@ public static void ApplyLightModes(this ManagedVehicle managedVehicle, List(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);