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

fix: Multiple audio file override #677

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

Alystrasz
Copy link
Contributor

This basically prevents audio files from being loaded into memory if matching audio event has already been overriden by a previous mod, preventing a crash from occurring.

This means that audio mods now respect the load priority, i.e. mods with higher priority (= lower int value) will have priority over other mods on audio overrides.

(Btw, if anybody knows the audio system a little bit, I'd be happy to have some experts comments here, as this was largely done through try-and-error)

Test instructions

  1. Install two conflicting audio mods (I used Genji_OS_for_Ronin and Chen_Os_for_Ronin)
  2. Try to launch your game without and with this PR
  3. Compare the two log files
Without PR

I did my tests working with the diag_gs_titanRonin_allyRodeoAttach event:

[2024-03-04] [23:58:56] [NORTHSTAR] [info] Loaded audio override file R2Northstar\packages\MOVEMENT_IS_KEY-Genji_OS_for_Ronin-1.0.5\mods\GenjiRoninOS\audio\diag_gs_titanRonin_allyRodeoAttach.json
[2024-03-04] [23:58:56] [NORTHSTAR] [info] Registering sound event diag_gs_titanRonin_allyRodeoAttach
[2024-03-04] [23:58:56] [NORTHSTAR] [info] Finished async read of audio sample R2Northstar\packages\MOVEMENT_IS_KEY-Genji_OS_for_Ronin-1.0.5\mods\GenjiRoninOS\audio\diag_gs_titanRonin_allyRodeoAttach\Genji_Hello_Is_anyone_there (online-audio-converter.com).wav
[...]
[2024-03-04] [23:58:57] [NORTHSTAR] [info] Finished async read of audio sample R2Northstar\packages\Lin-Chen_Os_for_Ronin-1.0.1\mods\Lin.ChenOsforRonin\audio\diag_gs_titanRonin_allyRodeoAttach\RodeoAttach1.wav
[2024-03-04] [23:58:57] [NORTHSTAR] [info] Finished async read of audio sample R2Northstar\packages\Lin-Chen_Os_for_Ronin-1.0.1\mods\Lin.ChenOsforRonin\audio\diag_gs_titanRonin_allyRodeoAttach\RodeoAttach2.wav
[2024-03-04] [23:58:57] [NORTHSTAR] [info] Finished async read of audio sample R2Northstar\packages\Lin-Chen_Os_for_Ronin-1.0.1\mods\Lin.ChenOsforRonin\audio\diag_gs_titanRonin_allyRodeoAttach\RodeoAttach3.wav
[2024-03-04] [23:58:57] [NORTHSTAR] [info] Finished async read of audio sample R2Northstar\packages\Lin-Chen_Os_for_Ronin-1.0.1\mods\Lin.ChenOsforRonin\audio\diag_gs_titanRonin_allyRodeoAttach\RodeoAttach4.wav
[2024-03-04] [23:58:57] [NORTHSTAR] [info] Finished async read of audio sample R2Northstar\packages\Lin-Chen_Os_for_Ronin-1.0.1\mods\Lin.ChenOsforRonin\audio\diag_gs_titanRonin_allyRodeoAttach\RodeoAttach5.wav
[2024-03-04] [23:58:57] [NORTHSTAR] [info] Loaded audio override file R2Northstar\packages\Lin-Chen_Os_for_Ronin-1.0.1\mods\Lin.ChenOsforRonin\audio\diag_gs_titanRonin_allyRodeoAttach.json
[2024-03-04] [23:58:57] [NORTHSTAR] [info] Registering sound event diag_gs_titanRonin_allyRodeoAttach
[2024-03-04] [23:58:57] [NORTHSTAR] [info] Finished async read of audio sample R2Northstar\packages\Lin-Chen_Os_for_Ronin-1.0.1\mods\Lin.ChenOsforRonin\audio\diag_gs_titanRonin_allyRodeoAttach\RodeoAttach6.wav
[2024-03-04] [23:58:57] [NORTHSTAR] [info] Finished async read of audio sample R2Northstar\packages\Lin-Chen_Os_for_Ronin-1.0.1\mods\Lin.ChenOsforRonin\audio\diag_gs_titanRonin_allyRodeoDetach\RodeoDetach1.wav
[2024-03-04] [23:58:57] [NORTHSTAR] [info] Finished async read of audio sample R2Northstar\packages\Lin-Chen_Os_for_Ronin-1.0.1\mods\Lin.ChenOsforRonin\audio\diag_gs_titanRonin_allyRodeoDetach\RodeoDetach2.wav
[2024-03-04] [23:58:57] [NORTHSTAR] [info] Loaded audio override file R2Northstar\packages\Lin-Chen_Os_for_Ronin-1.0.1\mods\Lin.ChenOsforRonin\audio\diag_gs_titanRonin_allyRodeoDetach.json
[2024-03-04] [23:58:57] [NORTHSTAR] [info] Registering sound event diag_gs_titanRonin_allyRodeoDetach
[2024-03-04] [23:58:57] [NORTHSTAR] [info] Finished async read of audio sample R2Northstar\packages\Lin-Chen_Os_for_Ronin-1.0.1\mods\Lin.ChenOsforRonin\audio\diag_gs_titanRonin_allyRodeoDetach\RodeoDetach3.wav
[2024-03-04] [23:58:57] [NORTHSTAR] [info] Finished async read of audio sample R2Northstar\packages\Lin-Chen_Os_for_Ronin-1.0.1\mods\Lin.ChenOsforRonin\audio\diag_gs_titanRonin_assistedByFriendlyPilot\ABF1.wav
[2024-03-04] [23:58:57] [NORTHSTAR] [info] Loaded audio override file R2Northstar\packages\Lin-Chen_Os_for_Ronin-1.0.1\mods\Lin.ChenOsforRonin\audio\diag_gs_titanRonin_assistedByFriendlyPilot.json
[2024-03-04] [23:58:57] [NORTHSTAR] [info] Registering sound event diag_gs_titanRonin_assistedByFriendlyPilot
[2024-03-04] [23:58:57] [NORTHSTAR] [error] -------------------------------------------
[2024-03-04] [23:58:57] [NORTHSTAR] [error] Northstar has crashed!
[2024-03-04] [23:58:57] [NORTHSTAR] [error] 	Version: 1.24.2.0
[2024-03-04] [23:58:57] [NORTHSTAR] [error] 	EXCEPTION_ACCESS_VIOLATION
[2024-03-04] [23:58:57] [NORTHSTAR] [error] 	Attempted to write to: 0x21fd9279010
[2024-03-04] [23:58:57] [NORTHSTAR] [error] 	At: ucrtbase.dll + 0x1810d
With PR
[2024-03-05] [00:03:04] [NORTHSTAR] [info] Loaded audio override file R2Northstar\packages\MOVEMENT_IS_KEY-Genji_OS_for_Ronin-1.0.5\mods\GenjiRoninOS\audio\diag_gs_titanRonin_allyRodeoAttach.json
[2024-03-05] [00:03:04] [NORTHSTAR] [info] Registering sound event diag_gs_titanRonin_allyRodeoAttach
[2024-03-05] [00:03:04] [NORTHSTAR] [info] Finished async read of audio sample R2Northstar\packages\MOVEMENT_IS_KEY-Genji_OS_for_Ronin-1.0.5\mods\GenjiRoninOS\audio\diag_gs_titanRonin_allyRodeoAttach\Genji_Hello_Is_anyone_there (online-audio-converter.com).wav
[...]
[2024-03-05] [00:03:04] [NORTHSTAR] [warning] R2Northstar\packages\Lin-Chen_Os_for_Ronin-1.0.1\mods\Lin.ChenOsforRonin\audio\diag_gs_titanRonin_allyRodeoAttach\RodeoAttach1.wav couldn't be loaded because diag_gs_titanRonin_allyRodeoAttach event has already been overrided, skipping.
[2024-03-05] [00:03:04] [NORTHSTAR] [warning] R2Northstar\packages\Lin-Chen_Os_for_Ronin-1.0.1\mods\Lin.ChenOsforRonin\audio\diag_gs_titanRonin_allyRodeoAttach\RodeoAttach2.wav couldn't be loaded because diag_gs_titanRonin_allyRodeoAttach event has already been overrided, skipping.
[2024-03-05] [00:03:04] [NORTHSTAR] [warning] R2Northstar\packages\Lin-Chen_Os_for_Ronin-1.0.1\mods\Lin.ChenOsforRonin\audio\diag_gs_titanRonin_allyRodeoAttach\RodeoAttach3.wav couldn't be loaded because diag_gs_titanRonin_allyRodeoAttach event has already been overrided, skipping.
[2024-03-05] [00:03:04] [NORTHSTAR] [warning] R2Northstar\packages\Lin-Chen_Os_for_Ronin-1.0.1\mods\Lin.ChenOsforRonin\audio\diag_gs_titanRonin_allyRodeoAttach\RodeoAttach4.wav couldn't be loaded because diag_gs_titanRonin_allyRodeoAttach event has already been overrided, skipping.
[2024-03-05] [00:03:04] [NORTHSTAR] [warning] R2Northstar\packages\Lin-Chen_Os_for_Ronin-1.0.1\mods\Lin.ChenOsforRonin\audio\diag_gs_titanRonin_allyRodeoAttach\RodeoAttach5.wav couldn't be loaded because diag_gs_titanRonin_allyRodeoAttach event has already been overrided, skipping.
[2024-03-05] [00:03:04] [NORTHSTAR] [warning] R2Northstar\packages\Lin-Chen_Os_for_Ronin-1.0.1\mods\Lin.ChenOsforRonin\audio\diag_gs_titanRonin_allyRodeoAttach\RodeoAttach6.wav couldn't be loaded because diag_gs_titanRonin_allyRodeoAttach event has already been overrided, skipping.
[2024-03-05] [00:03:04] [NORTHSTAR] [warning] Audio override R2Northstar\packages\Lin-Chen_Os_for_Ronin-1.0.1\mods\Lin.ChenOsforRonin\audio\diag_gs_titanRonin_allyRodeoAttach.json has no valid samples! Sounds will not play for this event.
[2024-03-05] [00:03:04] [NORTHSTAR] [info] Loaded audio override file R2Northstar\packages\Lin-Chen_Os_for_Ronin-1.0.1\mods\Lin.ChenOsforRonin\audio\diag_gs_titanRonin_allyRodeoAttach.json
[2024-03-05] [00:03:04] [NORTHSTAR] [warning] "Chen_Os_for_Ronin" mod tried to override sound event "diag_gs_titanRonin_allyRodeoAttach" but it is already overriden, skipping.

@GeckoEidechse
Copy link
Member

cc @EM4Volts this might be of interest for you as well 👀

Copy link
Member

@catornot catornot left a comment

Choose a reason for hiding this comment

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

good pr me thinks :)

primedev/client/audio.cpp Outdated Show resolved Hide resolved
Alystrasz and others added 2 commits April 7, 2024 23:45
@Alystrasz Alystrasz requested a review from catornot April 7, 2024 22:03
Copy link
Member

@catornot catornot left a comment

Choose a reason for hiding this comment

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

looks good now (sorry for the one week delay)

@catornot catornot added the needs testing Changes from the PR still need to be tested label Apr 17, 2024
@Klemmbaustein
Copy link

I tested it, I haven't encountered any problems.

@catornot catornot added READY TO MERGE This mergeable right now and removed needs testing Changes from the PR still need to be tested labels May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
READY TO MERGE This mergeable right now
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

None yet

4 participants