lethal-guitar / RigelEngine

A modern re-implementation of the classic DOS game Duke Nukem II
GNU General Public License v2.0
911 stars 60 forks source link

Portable Install #908

Closed AskaLangly closed 1 year ago

AskaLangly commented 1 year ago

Since the player's files are stored in %appdata%\Roaming, could it be possible to add a portable.txt in the game's root, in order to load the user's files from a ~/userdata directory instead? I understand it wouldn't be beneficial for, say, Steam Deck, but it would be nice to have as an added convenience.

lethal-guitar commented 1 year ago

@AskaLangly yeah can do, that's an easy change. Just to clarify, the userdata directory would then also be next to the game files? So for example, if you had a Duke 2 installation at C:\Games\Duke2, then both the portable.txt file as well as the userdata directory would also be in C:\Games\Duke2? Or would userdata be in the user directory (i.e. C:\Users\<name> on Windows)

AskaLangly commented 1 year ago

C:\Games\Duke2\userdata\ ... C:\Games\Duke2\portable.txt

portable.txt would be zero bytes; game's looking for the file by name only.

lethal-guitar commented 1 year ago

Hi @AskaLangly, I've implemented a first version of this and made a build for you to test: https://ci.appveyor.com/api/buildjobs/4hk62nw0gt4ejt53/artifacts/rigelengine_win_x64.zip

Let me know if it works like you expect.

AskaLangly commented 1 year ago

Hello! It works as I imagined it would.

First, I made sure that this build still used AppData, and it read my current save. Then, I created the portable.txt. Before migrating the data over, I let the game create directories; saw userdata pop up. Then, I overwrote what it created with my current save, and it all works.

lethal-guitar commented 1 year ago

Awesome, thanks for testing!

QmwJlHuSg9pa commented 1 year ago

Related: It would be neat if there were an environment variable to explicitly set the game data directory, in case the game files had already been placed elsewhere.

For instance, Flatpak apps and installed games (e.g. Lutris, Steam) may be kept on separate drives.

lethal-guitar commented 1 year ago

@QmwJlHuSg9pa it's already possible to do that by passing the game path as a command line argument:

RigelEngine <path-to-game>