MaKiPL / OpenVIII-monogame

Open source Final Fantasy VIII engine implementation in C# working on Windows and Linux (Android and iOS planned too!) [Monogame]
MIT License
642 stars 59 forks source link

Windows Registry and Open AL fix #33

Closed Albeoris closed 5 years ago

Albeoris commented 5 years ago
  1. Addeded IGameLocationProvider. Invoke GameLocation.Current.DataPath to get the game data path. WindowsGameLocationProvider can read the path from the Windows registry. LinuxGameLocationProvider contains only hardcoded paths.

  2. Added OpenALWindowsHook. This hook loads OpenAL (soft_oal.dll) from the specified location if it wasn't found by the native code.

    /* This hook loads OpenAL (soft_oal.dll) from the specified location if it wasn't found by the native code.

    Reproduction:
        Try to build and run this project from the directory containing # (e.g. "C:\Git\C#\OpenVIII")
    
    Cause:
        Incorrectly determined DLL directory.
        Method: MonoGame.OpenAL.AL.GetNativeLibrary (MonoGame.Framework.dll)
        Line: string directoryName = Path.GetDirectoryName(new Uri(typeof (AL).Assembly.CodeBase).LocalPath);
            Uri.OriginalString: file:///C:/Git/C#/OpenVIII/FF8/bin/x64/Debug/MonoGame.Framework.DLL
            Uri.LocalPath: C:\\Git\\C
            Uri.Fragment: #/OpenVIII/FF8/bin/x64/Debug/MonoGame.Framework.DLL
            GetDirectoryName: C:\Git
            Expected: C:\Git\C#\OpenVIII\FF8\bin\x64\Debug
    
    Exception:       
        Microsoft.Xna.Framework.Audio.NoAudioHardwareException (0x80004005): OpenAL device could not be initialized. ---> System.NullReferenceException:
           at Microsoft.Xna.Framework.Audio.OpenALSoundController.OpenSoundController()
           at Microsoft.Xna.Framework.Audio.OpenALSoundController.OpenSoundController()
           at Microsoft.Xna.Framework.Audio.OpenALSoundController..ctor()
           at Microsoft.Xna.Framework.Audio.OpenALSoundController.get_GetInstance()
           at Microsoft.Xna.Framework.SdlGamePlatform..ctor(Game game)
           at Microsoft.Xna.Framework.Game..ctor()
           at FF8.Game1..ctor()
           at FF8.Program.Main()

    */