NyxTheShield / TrombLoader

Trombone Champ Custom Chart Loader
Other
73 stars 13 forks source link

Trombloader is unable to load songs on MacOS #36

Closed Guarde closed 1 year ago

Guarde commented 1 year ago

A friendly Mac user and I successfully installed BepInEx to the game on a MacOS device. However attempting to load a custom chart resulted in a blackscreen with notes faintly visible and no music playing.

The following error occurs as the plugin is attempting to load the .ogg (at Plugin.GetClipAudioSync)

UriFormatException: Invalid URI: The Authority/Host could not be parsed.
  at UnityEngineInternal.WebRequestUtils.MakeInitialUrl (System.String targetUrl, System.String localUrl) [0x000c8] in <a5f78ef8005a453aa863503f7ed64467>:0 
  at UnityEngine.Networking.UnityWebRequest.set_url (System.String value) [0x00007] in <a5f78ef8005a453aa863503f7ed64467>:0 
  at UnityEngine.Networking.UnityWebRequest..ctor (System.String url, System.String method, UnityEngine.Networking.DownloadHandler downloadHandler, UnityEngine.Networking.UploadHandler uploadHandler) [0x0001a] in <a5f78ef8005a453aa863503f7ed64467>:0 
  at UnityEngine.Networking.UnityWebRequestMultimedia.GetAudioClip (System.String uri, UnityEngine.AudioType audioType) [0x0000e] in <7e5e565e073b4587968ebb6ef13b9047>:0 
  at TrombLoader.Plugin+<GetAudioClipSync>d__5.MoveNext () [0x00045] in <67e261e65508417587fb3c8ce428cf63>:0 
  at TrombLoader.Class_Patches.GameControllerStartPatch.Prefix (GameController __instance) [0x007f6] in <67e261e65508417587fb3c8ce428cf63>:0 
  at GameController.Start () [0x00005] in <2c1bd930c016469ea082019b9c08a9e7>:0

The above error is followed by a flood of NullReferenceExceptions until the game was closed

One possible cause I've considered is the different file path compared to Windows or Linux as well as the use of backslashes in the file uri. So I tried this:

public IEnumerator GetAudioClip(string path, Action callback = null)
    {
    if (SystemInfo.operatingSystemFamily == OperatingSystemFamily.MacOSX)
        {
            path = "file://" + path;
        }
    else
        {
            path = "file:\\\\" + Path.GetFullPath(path);
        }           

Which turned out unsuccessful and resulted in an identical error... Since I don't want to annoy our friendly community member by throwing poop at the wall until something sticks ill create an issue instead.

I've attached the Player.log of the first time they attempted to load a song with an unaltered Build of Trombloader 1.4.2 (For the sake of their privacy I've replaced all instances of their username with "USERNAME")

Player.log

Guarde commented 1 year ago

Issue solved. Pull request is up ^