Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
SoundAPI Repo Fix
Stops the SoundAPI error storm and makes sound packs play again. Swaps loaforc's SoundAPI looping-sound method for a null-safe version so pack audio works and the NullReferenceException flood stops.
| Last updated | 2 hours ago |
| Total downloads | 8 |
| Total rating | 0 |
| Categories | Misc Audio AI Generated |
| Dependency string | TheMorningStar-SoundAPI_Repo_Fix-1.0.0 |
| Dependants | 0 other packages depend on this package |
This mod requires the following mods to function
BepInEx-BepInExPack
BepInEx pack for Mono Unity games. Preconfigured and ready to use.
Preferred version: 5.4.2100README
SoundAPI Repo Fix
Stops the SoundAPI error storm and makes sound packs play again.
What it does
loaforc's SoundAPI patches the game's looping-sound method on the assumption that every sound has an audio source. On current R.E.P.O. some do not, so it throws a NullReferenceException on every looping-sound call, over 1200 per session, and pack audio dies with it. The API is deprecated, so no upstream fix is coming. This replaces that one method with a version that does the same work and skips sounds that have no audio source. Packs with a digit in the name, like FNAF2Sighting, hit a second SoundAPI bug and also need Sound Pack Name Fix.
Installation
- Install BepInEx.
- Put
SoundApiRepoFix.dllinBepInEx/plugins/. Requires loaforc's SoundAPI, REPO edition. This patches it and does not replace it.
Confirmed working with
- bazou-RandomMusicShop
- FluxTeam-WiiShopChannelMusic
- LanguidRat-RickrollingRadio
- JacuJ-GnomedGnomeSounds
- Toaken-FNAF2Sighting
- NEVAR-PolishCowMusicBoxValuable
For developers - detailed breakdown
GUID: themorningstar.soundapirepofix, hard dependency on me.loaforc.soundapi.repo.
One Harmony patch. The broken method is loaforcsSoundAPI.REPO.Patches.SoundPatch.ResetAudioInfoFetched, which is SoundAPI's own Harmony prefix on the game's Sound.PlayLoop. It reads __instance.Source.clip with no null check, and some Sound objects now have a null Source, so it throws on every PlayLoop call.
This prefixes their prefix with a replacement that returns false, which skips their original, and reproduces the intended behavior with a guard: when Source is non-null and Source.clip is null, it sets AudioInfoFetched to false.
If ResetAudioInfoFetched is not found, meaning SoundAPI changed its layout, it logs an error and patches nothing. It fixes the crash path only. A pack that fails SoundAPI's name validation, which rejects any digit, still will not register. That is Sound Pack Name Fix's job.