salvadorc17 / Prince-Monogame

Monogame implementation of Prince of Persia 2
GNU General Public License v2.0
43 stars 8 forks source link

Linux support? #5

Open neuromancer opened 5 years ago

neuromancer commented 5 years ago

I wonder if this neat reimplementation can support Linux. I tested it in ArchLinux but I had the modify one path to a font file (PR #4) to fix one issue, however, the game will crash after the first introduction screen:

$ mono PrinceGame.exe

Unhandled Exception:
System.IO.DirectoryNotFoundException: Could not find a part of the path '/tmp/mozilla_g0/Content/Levels\'.
  at System.IO.Enumeration.FileSystemEnumerator`1[TResult].CreateDirectoryHandle (System.String path, System.Boolean ignoreNotFound) [0x00032] in <4f52a2659e1844fea7ab38854dcbcf68>:0 
  at System.IO.Enumeration.FileSystemEnumerator`1[TResult]..ctor (System.String directory, System.IO.EnumerationOptions options) [0x00048] in <4f52a2659e1844fea7ab38854dcbcf68>:0 
  at System.IO.Enumeration.FileSystemEnumerable`1+DelegateEnumerator[TResult]..ctor (System.IO.Enumeration.FileSystemEnumerable`1[TResult] enumerable) [0x00000] in <4f52a2659e1844fea7ab38854dcbcf68>:0 
  at System.IO.Enumeration.FileSystemEnumerable`1[TResult]..ctor (System.String directory, System.IO.Enumeration.FileSystemEnumerable`1+FindTransform[TResult] transform, System.IO.EnumerationOptions options) [0x00042] in <4f52a2659e1844fea7ab38854dcbcf68>:0 
  at System.IO.Enumeration.FileSystemEnumerableFactory.FileInfos (System.String directory, System.String expression, System.IO.EnumerationOptions options) [0x00014] in <4f52a2659e1844fea7ab38854dcbcf68>:0 
  at System.IO.DirectoryInfo.InternalEnumerateInfos (System.String path, System.String searchPattern, System.IO.SearchTarget searchTarget, System.IO.EnumerationOptions options) [0x00037] in <4f52a2659e1844fea7ab38854dcbcf68>:0 
  at System.IO.DirectoryInfo.GetFiles (System.String searchPattern, System.IO.EnumerationOptions enumerationOptions) [0x00000] in <4f52a2659e1844fea7ab38854dcbcf68>:0 
  at System.IO.DirectoryInfo.GetFiles () [0x0000b] in <4f52a2659e1844fea7ab38854dcbcf68>:0 
  at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo.GetFiles()
  at PrinceGame.Maze.PopNet () [0x00017] in <d61e664e24854e4b85cb740a2edef624>:0 
  at PrinceGame.Maze..ctor (Microsoft.Xna.Framework.Graphics.GraphicsDevice GraphicsDevice__1, Microsoft.Xna.Framework.Content.ContentManager contentmanager) [0x00045] in <d61e664e24854e4b85cb740a2edef624>:0 
  at PrinceGame.PrinceOfPersiaGame.Activate (System.Boolean instancePreserved) [0x00038] in <d61e664e24854e4b85cb740a2edef624>:0 
  at PrinceGame.ScreenManager.AddScreen (PrinceGame.GameScreen screen, System.Nullable`1[T] controllingPlayer) [0x00027] in <d61e664e24854e4b85cb740a2edef624>:0 
  at PrinceGame.LoadingScreen.Update (Microsoft.Xna.Framework.GameTime gameTime, System.Boolean otherScreenHasFocus, System.Boolean coveredByOtherScreen) [0x0004d] in <d61e664e24854e4b85cb740a2edef624>:0 
  at PrinceGame.ScreenManager.Update (Microsoft.Xna.Framework.GameTime gameTime) [0x000a7] in <d61e664e24854e4b85cb740a2edef624>:0 
  at Microsoft.Xna.Framework.Game.<.cctor>b__19 (Microsoft.Xna.Framework.IUpdateable updateable, Microsoft.Xna.Framework.GameTime gameTime) [0x00000] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Game+SortingFilteringCollection`1[T].ForEachFilteredItem[TUserData] (System.Action`2[T1,T2] action, TUserData userData) [0x0007d] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Game.Update (Microsoft.Xna.Framework.GameTime gameTime) [0x00000] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at PrinceGame.Game1.Update (Microsoft.Xna.Framework.GameTime gameTime) [0x0003a] in <d61e664e24854e4b85cb740a2edef624>:0 
  at Microsoft.Xna.Framework.Game.DoUpdate (Microsoft.Xna.Framework.GameTime gameTime) [0x00019] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Game.Tick () [0x000ee] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.OpenTKGamePlatform.RunLoop () [0x00021] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Game.Run (Microsoft.Xna.Framework.GameRunBehavior runBehavior) [0x00080] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Game.Run () [0x0000c] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at PrinceGame.Program.Main () [0x00007] in <d61e664e24854e4b85cb740a2edef624>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.DirectoryNotFoundException: Could not find a part of the path '/tmp/mozilla_g0/Content/Levels\'.
  at System.IO.Enumeration.FileSystemEnumerator`1[TResult].CreateDirectoryHandle (System.String path, System.Boolean ignoreNotFound) [0x00032] in <4f52a2659e1844fea7ab38854dcbcf68>:0 
  at System.IO.Enumeration.FileSystemEnumerator`1[TResult]..ctor (System.String directory, System.IO.EnumerationOptions options) [0x00048] in <4f52a2659e1844fea7ab38854dcbcf68>:0 
  at System.IO.Enumeration.FileSystemEnumerable`1+DelegateEnumerator[TResult]..ctor (System.IO.Enumeration.FileSystemEnumerable`1[TResult] enumerable) [0x00000] in <4f52a2659e1844fea7ab38854dcbcf68>:0 
  at System.IO.Enumeration.FileSystemEnumerable`1[TResult]..ctor (System.String directory, System.IO.Enumeration.FileSystemEnumerable`1+FindTransform[TResult] transform, System.IO.EnumerationOptions options) [0x00042] in <4f52a2659e1844fea7ab38854dcbcf68>:0 
  at System.IO.Enumeration.FileSystemEnumerableFactory.FileInfos (System.String directory, System.String expression, System.IO.EnumerationOptions options) [0x00014] in <4f52a2659e1844fea7ab38854dcbcf68>:0 
  at System.IO.DirectoryInfo.InternalEnumerateInfos (System.String path, System.String searchPattern, System.IO.SearchTarget searchTarget, System.IO.EnumerationOptions options) [0x00037] in <4f52a2659e1844fea7ab38854dcbcf68>:0 
  at System.IO.DirectoryInfo.GetFiles (System.String searchPattern, System.IO.EnumerationOptions enumerationOptions) [0x00000] in <4f52a2659e1844fea7ab38854dcbcf68>:0 
  at System.IO.DirectoryInfo.GetFiles () [0x0000b] in <4f52a2659e1844fea7ab38854dcbcf68>:0 
  at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo.GetFiles()
  at PrinceGame.Maze.PopNet () [0x00017] in <d61e664e24854e4b85cb740a2edef624>:0 
  at PrinceGame.Maze..ctor (Microsoft.Xna.Framework.Graphics.GraphicsDevice GraphicsDevice__1, Microsoft.Xna.Framework.Content.ContentManager contentmanager) [0x00045] in <d61e664e24854e4b85cb740a2edef624>:0 
  at PrinceGame.PrinceOfPersiaGame.Activate (System.Boolean instancePreserved) [0x00038] in <d61e664e24854e4b85cb740a2edef624>:0 
  at PrinceGame.ScreenManager.AddScreen (PrinceGame.GameScreen screen, System.Nullable`1[T] controllingPlayer) [0x00027] in <d61e664e24854e4b85cb740a2edef624>:0 
  at PrinceGame.LoadingScreen.Update (Microsoft.Xna.Framework.GameTime gameTime, System.Boolean otherScreenHasFocus, System.Boolean coveredByOtherScreen) [0x0004d] in <d61e664e24854e4b85cb740a2edef624>:0 
  at PrinceGame.ScreenManager.Update (Microsoft.Xna.Framework.GameTime gameTime) [0x000a7] in <d61e664e24854e4b85cb740a2edef624>:0 
  at Microsoft.Xna.Framework.Game.<.cctor>b__19 (Microsoft.Xna.Framework.IUpdateable updateable, Microsoft.Xna.Framework.GameTime gameTime) [0x00000] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Game+SortingFilteringCollection`1[T].ForEachFilteredItem[TUserData] (System.Action`2[T1,T2] action, TUserData userData) [0x0007d] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Game.Update (Microsoft.Xna.Framework.GameTime gameTime) [0x00000] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at PrinceGame.Game1.Update (Microsoft.Xna.Framework.GameTime gameTime) [0x0003a] in <d61e664e24854e4b85cb740a2edef624>:0 
  at Microsoft.Xna.Framework.Game.DoUpdate (Microsoft.Xna.Framework.GameTime gameTime) [0x00019] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Game.Tick () [0x000ee] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.OpenTKGamePlatform.RunLoop () [0x00021] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Game.Run (Microsoft.Xna.Framework.GameRunBehavior runBehavior) [0x00080] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Game.Run () [0x0000c] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at PrinceGame.Program.Main () [0x00007] in <d61e664e24854e4b85cb740a2edef624>:0 

It seems that the Level directory is not correctly loaded.

salvadorc17 commented 5 years ago

Will try myself running on linux, and do changes if needed

neuromancer commented 5 years ago

Great!, let me know if you need additional testing.

salvadorc17 commented 5 years ago

I have made update for it, let me know how it works

neuromancer commented 4 years ago

It's getting closer, but still failing to load content and some dll:

$ mono PrinceGame.exe
ERROR:Content.Load<dContentRes>System.Collections.Generic.KeyNotFoundException: The given key 'SPRITES/PLAYER/DOS/KID_86' was not present in the dictionary.
  at System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) [0x0001e] in <4f52a2659e1844fea7ab38854dcbcf68>:0 
  at PrinceGame.Sequence.Initialize (Microsoft.Xna.Framework.Content.ContentManager Content) [0x0007c] in <b38917dd33fa42728da08f838c0b3bc3>:0 CONFIG_SPRITE_KIDKid_86

Unhandled Exception:
Microsoft.Xna.Framework.Audio.NoAudioHardwareException (0x80004005): OpenAL drivers could not be found. ---> System.DllNotFoundException: openal32.dll
  at (wrapper managed-to-native) OpenTK.Audio.OpenAL.AL.GetError()
  at Microsoft.Xna.Framework.Audio.OALSoundBuffer..ctor () [0x00006] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Audio.OALSoundBuffer..ctor () [0x0003f] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Audio.SoundEffectInstance.InitializeSound () [0x0000b] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Audio.SoundEffect.PlatformSetupInstance (Microsoft.Xna.Framework.Audio.SoundEffectInstance inst) [0x00000] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Audio.SoundEffect.GetPooledInstance (System.Boolean forXAct) [0x00017] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Audio.SoundEffect.Play () [0x00000] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at PrinceGame.RoomNew.StartNewLife (Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice) [0x0001f] in <b38917dd33fa42728da08f838c0b3bc3>:0 
  at PrinceGame.PrinceOfPersiaGame.Activate (System.Boolean instancePreserved) [0x0005e] in <b38917dd33fa42728da08f838c0b3bc3>:0 
  at PrinceGame.ScreenManager.AddScreen (PrinceGame.GameScreen screen, System.Nullable`1[T] controllingPlayer) [0x00024] in <b38917dd33fa42728da08f838c0b3bc3>:0 
  at PrinceGame.LoadingScreen.Update (Microsoft.Xna.Framework.GameTime gameTime, System.Boolean otherScreenHasFocus, System.Boolean coveredByOtherScreen) [0x0004c] in <b38917dd33fa42728da08f838c0b3bc3>:0 
  at PrinceGame.ScreenManager.Update (Microsoft.Xna.Framework.GameTime gameTime) [0x000a3] in <b38917dd33fa42728da08f838c0b3bc3>:0 
  at Microsoft.Xna.Framework.Game.<.cctor>b__19 (Microsoft.Xna.Framework.IUpdateable updateable, Microsoft.Xna.Framework.GameTime gameTime) [0x00000] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Game+SortingFilteringCollection`1[T].ForEachFilteredItem[TUserData] (System.Action`2[T1,T2] action, TUserData userData) [0x0007d] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Game.Update (Microsoft.Xna.Framework.GameTime gameTime) [0x00000] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at PrinceGame.Game1.Update (Microsoft.Xna.Framework.GameTime gameTime) [0x00037] in <b38917dd33fa42728da08f838c0b3bc3>:0 
  at Microsoft.Xna.Framework.Game.DoUpdate (Microsoft.Xna.Framework.GameTime gameTime) [0x00019] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Game.Tick () [0x000ee] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.OpenTKGamePlatform.RunLoop () [0x00021] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Game.Run (Microsoft.Xna.Framework.GameRunBehavior runBehavior) [0x00080] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Game.Run () [0x0000c] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at PrinceGame.Program.Main () [0x00007] in <b38917dd33fa42728da08f838c0b3bc3>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: Microsoft.Xna.Framework.Audio.NoAudioHardwareException (0x80004005): OpenAL drivers could not be found. ---> System.DllNotFoundException: openal32.dll
  at (wrapper managed-to-native) OpenTK.Audio.OpenAL.AL.GetError()
  at Microsoft.Xna.Framework.Audio.OALSoundBuffer..ctor () [0x00006] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Audio.OALSoundBuffer..ctor () [0x0003f] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Audio.SoundEffectInstance.InitializeSound () [0x0000b] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Audio.SoundEffect.PlatformSetupInstance (Microsoft.Xna.Framework.Audio.SoundEffectInstance inst) [0x00000] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Audio.SoundEffect.GetPooledInstance (System.Boolean forXAct) [0x00017] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Audio.SoundEffect.Play () [0x00000] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at PrinceGame.RoomNew.StartNewLife (Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice) [0x0001f] in <b38917dd33fa42728da08f838c0b3bc3>:0 
  at PrinceGame.PrinceOfPersiaGame.Activate (System.Boolean instancePreserved) [0x0005e] in <b38917dd33fa42728da08f838c0b3bc3>:0 
  at PrinceGame.ScreenManager.AddScreen (PrinceGame.GameScreen screen, System.Nullable`1[T] controllingPlayer) [0x00024] in <b38917dd33fa42728da08f838c0b3bc3>:0 
  at PrinceGame.LoadingScreen.Update (Microsoft.Xna.Framework.GameTime gameTime, System.Boolean otherScreenHasFocus, System.Boolean coveredByOtherScreen) [0x0004c] in <b38917dd33fa42728da08f838c0b3bc3>:0 
  at PrinceGame.ScreenManager.Update (Microsoft.Xna.Framework.GameTime gameTime) [0x000a3] in <b38917dd33fa42728da08f838c0b3bc3>:0 
  at Microsoft.Xna.Framework.Game.<.cctor>b__19 (Microsoft.Xna.Framework.IUpdateable updateable, Microsoft.Xna.Framework.GameTime gameTime) [0x00000] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Game+SortingFilteringCollection`1[T].ForEachFilteredItem[TUserData] (System.Action`2[T1,T2] action, TUserData userData) [0x0007d] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Game.Update (Microsoft.Xna.Framework.GameTime gameTime) [0x00000] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at PrinceGame.Game1.Update (Microsoft.Xna.Framework.GameTime gameTime) [0x00037] in <b38917dd33fa42728da08f838c0b3bc3>:0 
  at Microsoft.Xna.Framework.Game.DoUpdate (Microsoft.Xna.Framework.GameTime gameTime) [0x00019] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Game.Tick () [0x000ee] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.OpenTKGamePlatform.RunLoop () [0x00021] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Game.Run (Microsoft.Xna.Framework.GameRunBehavior runBehavior) [0x00080] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at Microsoft.Xna.Framework.Game.Run () [0x0000c] in <8aff2b1aaaf54352b748cdd5a59b5d55>:0 
  at PrinceGame.Program.Main () [0x00007] in <b38917dd33fa42728da08f838c0b3bc3>:0
salvadorc17 commented 4 years ago

Something in the enviroment and your current system should be failing, im able to use with Mono and Ubuntu.

image