FNA-XNA / FNA

FNA - Accuracy-focused XNA4 reimplementation for open platforms
https://fna-xna.github.io/
2.63k stars 268 forks source link

Can FNA replace XNA in a binary-distributed game? #166

Closed QianNangong closed 6 years ago

QianNangong commented 6 years ago

I bought a game from Steam which uses XNA as its engine, but I am suffering from an incompatible situation (maybe) between Windows 10 and XNA. Is it possible to replace XNA with FNA without modify the game?

flibitijibibo commented 6 years ago

There's a tool called XnaToFna that can try to make it work, but it does modify the executables just a teeny bit:

https://github.com/0x0ade/XnaToFna

Which game is it?

QianNangong commented 6 years ago

Stardew Valley, it crashes when I fishing or mining. It seems that XnaToFna doesn't works to me, the program will crash on relink stage.

flibitijibibo commented 6 years ago

There seems to be an issue with the content stage, but I'll leave that up to @0x0ade since that's in the tool. This works for me on Linux at least:

XnaToFna.exe --skip-content --skip-xact --skip-gzip Stardew\ Valley.exe 

Also be sure to grab the contents of x86/ from the Native Libraries archive:

http://fna-xna.github.io/download/

QianNangong commented 6 years ago

Even worse.

[XnaToFna] [Version] 17.11.3.34824
[XnaToFna] [ScanPath] Checking assembly Stardew Valley (rw)
[XnaToFna] [ScanPath] XnaToFna-ing Stardew Valley
[XnaToFna] [ScanPath] Scanning directory /Users/alpine/Stardew Valley
[XnaToFna] [ScanPath] Found Content directory: /Users/alpine/Stardew Valley/Content
[XnaToFna] [ScanPath] Checking assembly BmFont (rw)
[XnaToFna] [ScanPath] Checking assembly FNA (r-)
[XnaToFna] [ScanPath] Mapping Microsoft.Xna.Framework -> FNA
[XnaToFna] [ScanPath] Mapping Microsoft.Xna.Framework.Avatar -> FNA
[XnaToFna] [ScanPath] Mapping Microsoft.Xna.Framework.Content.Pipeline -> FNA
[XnaToFna] [ScanPath] Mapping Microsoft.Xna.Framework.Game -> FNA
[XnaToFna] [ScanPath] Mapping Microsoft.Xna.Framework.Graphics -> FNA
[XnaToFna] [ScanPath] Mapping Microsoft.Xna.Framework.Input.Touch -> FNA
[XnaToFna] [ScanPath] Mapping Microsoft.Xna.Framework.Storage -> FNA
[XnaToFna] [ScanPath] Mapping Microsoft.Xna.Framework.Video -> FNA
[XnaToFna] [ScanPath] Mapping Microsoft.Xna.Framework.Xact -> FNA
[XnaToFna] [ScanPath] Checking assembly GalaxyCSharp (rw)
[XnaToFna] [ScanPath] Checking assembly Lidgren.Network (rw)
[XnaToFna] [ScanPath] Checking assembly Netcode (rw)
[XnaToFna] [ScanPath] Checking assembly Stardew Valley (rw)

Unhandled Exception:
System.IO.IOException: Sharing violation on path /Users/alpine/Stardew Valley/Stardew Valley.exe
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <bb7b695b8c6246b3ac1646577aea7650>:0 
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in <bb7b695b8c6246b3ac1646577aea7650>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
  at Mono.Cecil.ModuleDefinition.GetFileStream (System.String fileName, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00006] in <d78877a5c52c41829df4feaac055547e>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00008] in <d78877a5c52c41829df4feaac055547e>:0 
  at MonoMod.MonoModExt.ReadModule (System.String path, Mono.Cecil.ReaderParameters rp) [0x0001d] in <d78877a5c52c41829df4feaac055547e>:0 
  at XnaToFna.XnaToFnaUtil.ScanPath (System.String path) [0x00278] in <d78877a5c52c41829df4feaac055547e>:0 
  at XnaToFna.XnaToFnaUtil.ScanPaths (System.String[] paths) [0x0000a] in <d78877a5c52c41829df4feaac055547e>:0 
  at XnaToFna.XnaToFnaUtil.ScanPath (System.String path) [0x001a5] in <d78877a5c52c41829df4feaac055547e>:0 
  at XnaToFna.Program.Main (System.String[] args) [0x00465] in <d78877a5c52c41829df4feaac055547e>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.IOException: Sharing violation on path /Users/alpine/Stardew Valley/Stardew Valley.exe
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <bb7b695b8c6246b3ac1646577aea7650>:0 
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in <bb7b695b8c6246b3ac1646577aea7650>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
  at Mono.Cecil.ModuleDefinition.GetFileStream (System.String fileName, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00006] in <d78877a5c52c41829df4feaac055547e>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00008] in <d78877a5c52c41829df4feaac055547e>:0 
  at MonoMod.MonoModExt.ReadModule (System.String path, Mono.Cecil.ReaderParameters rp) [0x0001d] in <d78877a5c52c41829df4feaac055547e>:0 
  at XnaToFna.XnaToFnaUtil.ScanPath (System.String path) [0x00278] in <d78877a5c52c41829df4feaac055547e>:0 
  at XnaToFna.XnaToFnaUtil.ScanPaths (System.String[] paths) [0x0000a] in <d78877a5c52c41829df4feaac055547e>:0 
  at XnaToFna.XnaToFnaUtil.ScanPath (System.String path) [0x001a5] in <d78877a5c52c41829df4feaac055547e>:0 
  at XnaToFna.Program.Main (System.String[] args) [0x00465] in <d78877a5c52c41829df4feaac055547e>:0 
flibitijibibo commented 6 years ago

Strange... this is a Mac is it not?

I just checked and it looks like for macOS and Linux there is a permissions issue, I think it's coming from the application opening the executable twice in a row. @0x0ade, does the current system open files multiple times at once?

In any case, I actually ran this in Wine thinking that'd be a close test to a Windows scenario but it seems we're on a Mac... can you try this with either Wine or a Windows setup and then use the processed binaries on macOS?

QianNangong commented 6 years ago

Yes, I'm using Mac for daily use. I've also tried on my PC, but it reports an error like call to a missing method.

flibitijibibo commented 6 years ago

Best guess I can make is to try 17.11.2 instead:

https://github.com/0x0ade/XnaToFna/releases/tag/v17.11.2

QianNangong commented 6 years ago

In fact I'm using 17.11.2, but the version reports 17.11.3.34824.

flibitijibibo commented 6 years ago

Guess we'll have to defer to Maik on this one - gather as much info as you can and file this over there, on the FNA side we're 100% compatible with Stardew so the tool just needs to be fixed:

https://github.com/0x0ade/XnaToFna/issues