rfht / rigg

run independent games
ISC License
18 stars 0 forks source link

System.EntryPointNotFoundException: SetProcessDPIAware assembly #3

Closed nalzok closed 2 months ago

nalzok commented 4 months ago

I am trying to run Crystal Project Demo from GOG on OpenBSD 7.5, but got the following error. In fact, it is unclear to me whether SDL_PLATFORM=Linux is good for a Windows executable, but this is the same command as your YouTube clip. Adding -u none does not help and produces the same error.

$ SDL_PLATFORM=Linux rigg -v mono Crystal\ Project.exe
parsing Dllmap
initializing mono jit for Crystal Project.exe
opening executable: Crystal Project.exe

unveil: /usr/local/share/FNA             "r"
unveil: /usr/lib                         "r"
unveil: /usr/local/lib                   "r"
unveil: /usr/X11R6                       "r"
unveil: /usr/share                       "r"
unveil: /etc                             "r"
unveil: /dev                             "rw"
unveil: /tmp                             "rwc"
unveil: .                                "rwc"
unveil: /home/qys/.config                "rwc"
unveil: /home/qys/.local/share           "rwc"
unveil: /home/qys/.cache/mesa_shader_cac "rwc"
unveil: /home/qys/.mono                  "rwc"
unveil: /home/qys/.sndio                 "rwc"
unveil: /home/qys/.Xauthority            "rw"
unveil: /home/qys/.XCompose              "rwc"
unveil: /home/qys/.Xdefaults             "rwc"
unveil: FNA.dll                          ""
unveil: FNA.dll.config                   ""
unveil: (null)                           "(null)"

executing mono jit with the following arguments: "Crystal Project.exe"

Unhandled Exception:
System.EntryPointNotFoundException: SetProcessDPIAware assembly:<unknown assembly> type:<unknown type> member:(null)
  at (wrapper managed-to-native) Sang.Program.SetProcessDPIAware()
  at Sang.Program.Main () [0x00043] in <e6d5a59832d64426a04a4e11a01c04a6>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.EntryPointNotFoundException: SetProcessDPIAware assembly:<unknown assembly> type:<unknown type> member:(null)
  at (wrapper managed-to-native) Sang.Program.SetProcessDPIAware()
  at Sang.Program.Main () [0x00043] in <e6d5a59832d64426a04a4e11a01c04a6>:0 

The game directory looks like this. I got it by downloading the game on Windows with GOG GALAXY, and then transfering it to OpenBSD.

$ ls -la
total 56112
drwxr-xr-x  3 qys  qys       512 Apr 24 02:23 %USERPROFILE%
drwxr-xr-x  5 qys  qys      1024 Apr 25 22:39 .
drwx------  3 qys  qys       512 Apr 24 01:59 ..
drwxr-xr-x  8 qys  qys       512 Apr 24 01:54 Content
-rw-r--r--  1 qys  qys   2360320 Apr 24 01:54 Crystal Project.exe
-rw-r--r--  1 qys  qys    350378 Apr 24 01:54 FAudio.dll
-rw-r--r--  1 qys  qys    792576 Apr 24 01:54 FNA.dll
-rw-r--r--  1 qys  qys       637 Apr 24 01:54 FNA.dll.config
-rw-r--r--  1 qys  qys    775255 Apr 24 01:54 FNA3D.dll
-rw-r--r--  1 qys  qys  14158336 Apr 24 01:54 Galaxy64.dll
-rw-r--r--  1 qys  qys    423936 Apr 24 01:54 GalaxyCSharp.dll
-rw-r--r--  1 qys  qys   1163264 Apr 24 01:54 GalaxyCSharpGlue.dll
-rw-r--r--  1 qys  qys      1490 Apr 24 01:55 Launch Crystal Project Demo.lnk
-rw-r--r--  1 qys  qys     14336 Apr 24 01:54 MonitorHook.dll
-rw-r--r--  1 qys  qys    513536 Apr 24 01:54 NAudio.dll
-rw-r--r--  1 qys  qys      7680 Apr 24 01:54 NLayer.NAudioSupport.dll
-rw-r--r--  1 qys  qys     73216 Apr 24 01:54 NLayer.dll
-rw-r--r--  1 qys  qys     68096 Apr 24 01:54 NVorbis.dll
-rw-r--r--  1 qys  qys    700336 Apr 24 01:54 Newtonsoft.Json.dll
-rw-r--r--  1 qys  qys   2499584 Apr 24 01:54 SDL2.dll
-rw-r--r--  1 qys  qys    195584 Apr 24 01:54 SharpZipLib.dll
drwxr-xr-x  4 qys  qys       512 Apr 24 01:54 __redist
-rw-r--r--  1 qys  qys     69248 Sep 28  2017 gog.ico
-rw-r--r--  1 qys  qys      3417 Apr 24 01:54 goggame-1548183851.hashdb
-rw-r--r--  1 qys  qys     89325 Apr 24 01:55 goggame-1548183851.ico
-rw-r--r--  1 qys  qys       653 Apr 24 01:54 goggame-1548183851.info
-rw-r--r--  1 qys  qys      3852 Apr 24 01:55 goggame-galaxyFileList.ini
-rw-r--r--  1 qys  qys       125 Apr 24 01:55 goglog.ini
-rw-r--r--  1 qys  qys    382895 Apr 24 01:54 libtheorafile.dll
-rw-------  1 qys  qys    686536 Apr 24 01:59 rigg.core
-rw-r--r--  1 qys  qys     62895 Aug 26  2019 support.ico
-rw-r--r--  1 qys  qys   1327671 Apr 24 01:55 unins000.dat
-rw-r--r--  1 qys  qys   1343048 Apr 24 01:55 unins000.exe
-rw-r--r--  1 qys  qys        41 Apr 24 01:55 unins000.ini
-rw-r--r--  1 qys  qys     23147 Apr 24 01:55 unins000.msg

On the other hand, rigg seems to pass the test on my machine

$ rigg mono MoniInvisible.exe
Checking that /home is invisible

What do you think could be the problem. Does rigg only work for the non-demo version?

By the way, it would be great if you could explain the difference between this project and IndieRunner. Thanks!

rfht commented 4 months ago

SetProcessDPIAware is Windows API.

With few exceptions, it's generally the Linux version that is the most compatible with OpenBSD. You should be able to download this from the GOG web interface to your library (https://www.gog.com/en/account).

I might see if I can add a stub for SetProcessDPIAware to rigg's Dllmap, but this is very likely just the tip of the iceberg of Windows API in use...

Edit: Regarding this and IndieRunner, the difference is that rigg uses unveil, with the benefits described in the man page/README.md, but has a narrow focus because it only works with languages where it can execute the code via a language library. This is possible easiest so far with mono, and hashlink is also manageable. Java and Love2D maybe in the future. The focus of rigg is to get the securities offered by unveil right, and the code is intentionally limited in scope for what it deals with.

IndieRunner should be thought of as a launcher managing all kinds of quirks, for a broad spectrum of games.

Expect upcoming integration, so that IndieRunner will use rigg whenever possible. The 2 approaches complement each other.

rfht commented 4 months ago

Looks like the Linux demo on GOG also fails because it's looking for GOG Galaxy library:

[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'Gala
xy.Api.GalaxyInstancePINVOKE' threw an exception. ---> System.TypeInitializationException: The type i
nitializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: GalaxyCSha
rpGlue assembly:<unknown assembly> type:<unknown type> member:(null)
  at (wrapper managed-to-native) Galaxy.Api.GalaxyInstancePINVOKE+SWIGExceptionHelper.SWIGRegisterExc
eptionCallbacks_GalaxyInstance(Galaxy.Api.GalaxyInstancePINVOKE/SWIGExceptionHelper/ExceptionDelegate
,Galaxy.Api.GalaxyInstancePINVOKE/SWIGExceptionHelper/ExceptionDelegate,Galaxy.Api.GalaxyInstancePINV
OKE/SWIGExceptionHelper/ExceptionDelegate,Galaxy.Api.GalaxyInstancePINVOKE/SWIGExceptionHelper/Except
ionDelegate,Galaxy.Api.GalaxyInstancePINVOKE/SWIGExceptionHelper/ExceptionDelegate,Galaxy.Api.GalaxyI
nstancePINVOKE/SWIGExceptionHelper/ExceptionDelegate,Galaxy.Api.GalaxyInstancePINVOKE/SWIGExceptionHe
lper/ExceptionDelegate,Galaxy.Api.GalaxyInstancePINVOKE/SWIGExceptionHelper/ExceptionDelegate,Galaxy.
Api.GalaxyInstancePINVOKE/SWIGExceptionHelper/ExceptionDelegate,Galaxy.Api.GalaxyInstancePINVOKE/SWIG
ExceptionHelper/ExceptionDelegate,Galaxy.Api.GalaxyInstancePINVOKE/SWIGExceptionHelper/ExceptionDeleg
ate)
  at Galaxy.Api.GalaxyInstancePINVOKE+SWIGExceptionHelper..cctor () [0x000ee] in <efa7bc5d6508448eb95
f2e5aa58f3744>:0
   --- End of inner exception stack trace ---
  at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)
  at Galaxy.Api.GalaxyInstancePINVOKE..cctor () [0x00000] in <efa7bc5d6508448eb95f2e5aa58f3744>:0
   --- End of inner exception stack trace ---
  at Galaxy.Api.InitParams..ctor (System.String _clientID, System.String _clientSecret) [0x00000] in
<efa7bc5d6508448eb95f2e5aa58f3744>:0
  at Sang.Utility.SteamManager.Initialize () [0x00000] in <e771e8afe10f4b2fafd8ee3434e04c2d>:0
  at Sang.GameMain.Initialize () [0x00000] in <e771e8afe10f4b2fafd8ee3434e04c2d>:0
  at Microsoft.Xna.Framework.Game.DoInitialize () [0x00039] in <d180d119668d4a4abb46959bcfad56fe>:0
  at Microsoft.Xna.Framework.Game.Run () [0x0000e] in <d180d119668d4a4abb46959bcfad56fe>:0
  at Sang.Program.Main () [0x0004c] in <e771e8afe10f4b2fafd8ee3434e04c2d>:0

Your best bet is probably the demo version on Steam, because we have an implementation of steamworks API in ports: https://store.steampowered.com/app/1637730/Crystal_Project/

You can use steamctl to download it:

$ doas pkg_add steamctl
$ mkdir /path/to/crystal-project; cd /path/to/crystal-project
$ steamctl depot download -os linux64 -a 1760770
nalzok commented 2 months ago

Thanks for the reply! I have some trouble with steamctl. I know this is not part of your project, but feel free to suggest a workaround if you happen to know one :)

$ steamctl depot download -os linux64 -a 1760770
Traceback (most recent call last):
  File "/usr/local/bin/steamctl", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/steamctl/__main__.py", line 52, in main
    cmd_func = getattr(import_module(subpkg), func)
  File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/local/lib/python3.10/site-packages/steamctl/commands/depot/gcmds.py", line 3, in <module>
    gevent.monkey.patch_socket()
  File "/usr/local/lib/python3.10/site-packages/gevent/monkey.py", line 198, in ignores
    from gevent.events import DoNotPatch
  File "/usr/local/lib/python3.10/site-packages/gevent/events.py", line 74, in <module>
    from pkg_resources import iter_entry_points
ModuleNotFoundError: No module named 'pkg_resources
rfht commented 2 months ago

if this is about Crystal Project, have you tried app id 1637730? This seems to be the correct one, based on the Crystal Project store link (https://store.steampowered.com/app/1637730/Crystal_Project/)

nalzok commented 2 months ago

Yeah, but that one gives me the same error. The Python error message indicates that it's an ModuleNotFoundError, so I suspect it's an internal bug of the steamctl package. I have opened an issue there: https://github.com/ValvePython/steamctl/issues/84, but I doubt if anyone would care because the last commit to steamctl was 2 years ago...

rfht commented 2 months ago

I can download it on -current with steamctl:

$ steamctl depot download -os linux64 -a 1637730

Are you on -current? FYI py-steam was updated 2 months ago: https://github.com/openbsd/ports/commit/38b4698bfd8ac5ecd58a13d9c9dd426600468885

rfht commented 2 months ago

looks like there is a RUN_DEPENDS that sthen@ just committed: https://marc.info/?l=openbsd-ports-cvs&m=171990667717809&w=2

Looks like this should get you pkg_resources which is in your trace above