Mesen-S icon indicating copy to clipboard operation
Mesen-S copied to clipboard

Can't run from read-only directory

Open KAMiKAZOW opened this issue 5 years ago • 4 comments

Even though I selected to place config files in the user directory, Mesen-S still tries to write to its own directory:

Screenshot_20190519_124623

I've encountered it under Linux but I assume Mesen-S getting installed in "C:\Program Files" and then executed as non-administrator user would lead to the same error message.

KAMiKAZOW avatar May 19 '19 10:05 KAMiKAZOW

This is because I've been unable to find a way on Linux to get Mono to load the C++ library from another folder than the one the Mesen-S.exe file is in (Mono doesn't appear to ever try loading the library from the process' current folder, unlike .NET). Because of this, the program has to extract the "libMesenSCore" library in the same folder as Mesen-S.exe itself.

Mind you the last time I took a look at this was 3 years ago when I first ported Mesen to Linux, so it's possible a solution exists and I just haven't found it yet.

SourMesen avatar May 19 '19 19:05 SourMesen

Wait, Dependencies/libMesenSCore.x64.dll is a compressed version of libMesenSCore.dll? I simply copied the file with the new file name next to Mesen-S.exe and it appears to work (don't have a ROM at hand right now but the window loads).

Why place it in the Dependencies folder with the architecture in the file name in the first place?

KAMiKAZOW avatar May 19 '19 21:05 KAMiKAZOW

Nothing in the Dependencies folder is meant to be "installed". Everything in the dependencies folder is zipped up, and that zip file is embedded into the Mesen-S.exe executable and either read directly from the embedded file or extracted to the disk at runtime.

It's meant to be a single-executable program that serves as both the "setup" and the program itself. In "official" builds, the executable contains both Windows and Linux DLLs for both x86 and x64, and only extracts the library needed based on the OS. (Though 32-bit currently doesn't work in Mesen-S due to some differences in how I've handled the interop wrapper vs Mesen)

SourMesen avatar May 19 '19 23:05 SourMesen

It's meant to be a single-executable program that serves as both the "setup" and the program itself.

I don't see the benefit of this approach but maybe it's a Windows thing.

Anyway, I got Mesen-S successfully packaged for Linux (openSUSE, sadly no Fedora because llvm-gold isn't available there) in a traditional way – probably as good as its exotic setup permits.

KAMiKAZOW avatar May 21 '19 21:05 KAMiKAZOW