
[Bug]: switching from 0.5.7 -> 0.7.0 causes patches to not work in time
goofyclown opened this issue ยท 0 comments
All of the following criteria must be met
- All Requirements must be installed.
- Changed the title so that it doesn't just says "[Bug]: "
- I have searched the GitHub issues for my bug, even in the closed issues.
All of the following are optional to answer
- Tried reinstalling the Game.
- Tried reinstalling MelonLoader.
- Tried restarting PC.
- Was able to see the Start Screen.
Describe the issue.
the issue is melon loader (ON 0.7 NOT 0.5) cannot patch in time(?) methods that have [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]
or ones directly called by that
my only relevant code is this:
[HarmonyPatch(typeof(AudioBankManager), "LoadBanksWithLabel")]
public static class AudioBankManager_LoadBanksWithLabel
{
public static bool Prefix(string label)
{
Addressables.LoadAssetsAsync<TextAsset>(Addressables.LoadResourceLocationsAsync(label, null).WaitForCompletion(), delegate (TextAsset bank)
{
MelonLogger.Msg($"{label} {bank.name}");
System.IO.File.WriteAllBytes($"C:\\Program Files (x86)\\Steam\\steamapps\\common\\ENA Dream BBQ\\banks\\{bank.name}.bank", bank.bytes);
RuntimeManager.LoadBank(bank, false);
}).WaitForCompletion();
return false;
}
}
The AudioBankManager class:
public static class AudioBankManager
{
// Token: 0x06001849 RID: 6217 RVA: 0x000509B8 File Offset: 0x0004EBB8
private static void LoadBanksWithLabel(string label)
{
Addressables.LoadAssetsAsync<TextAsset>(Addressables.LoadResourceLocationsAsync(label, null).WaitForCompletion(), delegate(TextAsset bank)
{
RuntimeManager.LoadBank(bank, false);
}).WaitForCompletion();
}
// Token: 0x0600184A RID: 6218 RVA: 0x00050A01 File Offset: 0x0004EC01
public static void LoadDefaultBanks()
{
AudioBankManager.LoadBanksWithLabel("fmod_master");
}
// Token: 0x0600184B RID: 6219 RVA: 0x00050A0D File Offset: 0x0004EC0D
public static void LoadAllChapterBanks()
{
AudioBankManager.LoadBanksWithLabel("fmod_c0");
AudioBankManager.LoadBanksWithLabel("fmod_c1");
AudioBankManager.LoadBanksWithLabel("fmod_c2");
AudioBankManager.LoadBanksWithLabel("fmod_c3");
}
}
the thing that calls AudioBankManager:
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]
private static void InitializeAfterAssembliesLoad()
{
AudioBankManager.LoadDefaultBanks();
AudioBankManager.LoadAllChapterBanks();
HUDDialogueProjectManager.Initialize();
Preferences.EstablishExpensivePreferences(PreferenceCategory.VideoScreen | PreferenceCategory.VideoQuality | PreferenceCategory.Audio);
}
all my other patches work fine, just the one that are "directly related" to [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)] don't work
Latest 0.5.7.log
Latest 0.7.0.log
Did you attach your log file?
Yes, I attached my log file to the text box above.