-
-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible to specify full path to game directory and writeable folder? #1425
Comments
configs are written to the directory passed with "-game" parameter i think or XASH3D_BASEDIR env variable, -rodir or XASH3D_RODIR is obviously only for reading |
Doesn't seem to be working... Here are example file location:
It doesn't seem like I can execute xash3d -game with a full path (it errors it can't find gfx.wad). If I set XASH3D_BASEDIR then it looks for both the Xash3D libraries (libxash, etc) AND the game data in the bae folder. |
you have to specify both at the same time, XASH3D_RODIR=(path-to-game-data) XASH3D_BASEDIR=(path-to-store-the-configs) |
Thanks so much for the help but maybe I'm still doing something wrong? For example, if I run "./xash3d -rodir /games -game ~/.config/xash3d" it still writes files to the xash3d executable's folder. (it seems to ignore the -game parameter) However, I can specify -game gearbox (or similar) and it does look for the gearbox data inside the rodir, but it will write the config/saves to the xash3d executable directory. |
I am pretty sure XASH3D_BASEDIR is actually different from the -game parameter, while -rodir behaviour should be the same as the env variable |
if i had to guess you have to use it like this, but I can't test it right now |
Yeah, there aren't any I would recommend writing a simple shell script, that will set up XASH3D_RODIR and XASH3D_BASEDIR environment variables and allow passing any command line parameters. Like this:
This of course can be remade into something more advanced, like I did for Flatpak port: https://github.com/FWGS/xash3d-fwgs/blob/master/scripts/flatpak/run.sh. The XASH3D_BASEDIR is set to be in XDG_DATA_HOME, according to XDG specification. XASH3D_RODIR is detected through scanning default Steam library paths, though it's not very unreliable and we should parse VDF configs instead... but it's still an example of a bundled Xash3D FWGS engine. |
Thanks again so much for the help!! I'm trying to experiment and understand it better, but doesn't Xash3D expect the libraries (libxash, libref_gl) to be located in the BASEDIR? (ie. I would have to copy the libxash/libref libraries into ~/.config/xash3d) I'm trying to have all Xash3D binaries in the same folder (xash3d, libxash, libref_gl) which is read-only, and then the game folder in a different location which is writeable. Does that make sense? |
Libraries are tricky. Game libraries usually found through VFS layer, so they can be both in rodir and basedir. There is specific function called FS_FindLibrary for that. But engine libraries are found through the dynamic linker. That's where I used RPATH flag. I don't know if RPATH is supported on OSX, but it's hardcoded to look into ${ORIGIN} which linker sets to the executable path. |
The dynamic linker behavior on OSX is controlled by DYLD_LIBRARY_PATH environment variable as far as I know in case if RPATH is being ignored. |
Thanks - That is really helpful. Where does Xash3D create its config and save games? Is it always in the current directory + gamename or is it off the BASEDIR? |
@sofakng BASEDIR is the CWD and CWD is always our writable directory. And yes, it preserves the hierarchy, so game-specific configs, saves, screenshots are always saved in game directory, subdirectory in BASEDIR. By the way, keep in mind, RoDir isn't ideal. It's good for app bundles like this or Flatpak, but not ALL mods support it. It actually depends on mod developer, if they did have used standard C/C++ IO, it doesn't go through our Virtual FS layer, and mods might not work as expected because they can't access files in RoDir, they just don't know anything about it. If you're making an app bundle, both RoDir and BaseDir should be accessible to the user. And if they are accessible, and you're not trying to auto-detect Steam folder, you MIGHT actually NOT need RoDir, just place all mod files in BaseDir. |
Aha! I've found part of the problem. It looks like macOS should use @loader_path instead of $ORIGIN. If I modify this line then it finds the libraries perfectly: Line 354 in bee35a1
I found this issue from another project: bazelbuild/bazel#4589 (the other option appears to be @executable_path) |
Like that? |
Yup! That works perfectly. I can then set XASH3D_RODIR and XASH3D_BASEDIR and it works as expected. Thanks so much again! |
Perfect! Tested and working. Thanks again! |
@sofakng btw you really helped with OSX support for the last few days. Do you want to maintain it? @tomkidd also asked about OSX maintainership. You both can team up. If you don't have too much time, ports maintainership is usually passive. It's rare when we have platform-specific bugs, but it would be nice to have continuous builds for Mac, or better integration with Mac exclusive features (???). ======= Here goes the rant, sorry about that, lol. As I said before, the problem to maintain Apple ports for me is that I don't have any hardware atm. It's not like I have a personal grudge against Apple, except about running OSX in virtual machines on non-Macs, it just happens. Yes, all their devices are made for consumer market but usually when I see prices to let's say Mac Mini, I would rather choose something different, rare and outdated or not available to consumer market hardware, especially if you know who to ask for help. Or even if I get a device with Apple M1 or Apple M2, I would rather use it to contribute to Asahi Linux. :) |
Oh, no problem... I'm just glad to have it working and I can't thank you enough for making the changes! @tomkidd runs MacSourcePorts.com and does a fantastic job of maintaining everything. I'd be more than willing to help where I could but he's probably a better person to list as maintainer if he's interested. As for the rant, I understand that Apple devices aren't for everybody. They are typically overpriced and locked down, but it's hard to beat the quality of the screen, keyboard, trackpad, speakers, etc. It was both good and bad when they used x86 processors though. I loved running bootcamp for a full Windows/Linux experience, but the new arm64 chips are crazy efficient. I can't wait for Asahi Linux to mature (especially the video drivers!). I would love for it become a replacement for macOS even! :) Anyways -- thanks again so much for this fantastic project/fork!! |
@sofakng could you then add yourself here https://github.com/FWGS/xash3d-fwgs/blob/master/Documentation/ports.md? We do not ask for email addresses, GitHub handle is enough. |
Yeah for the ports I maintain for Mac Source Ports, I try and hammer everything into using For Xash3D-FWGS, I've got this somewhat hacky way of adding this ability in while also being able to look in the bundle for the DLLs, extras.pk3, etc. and there was this glitch in it for an embarrassingly long time dealing with C string handling that I've merged in a fix for now, but there's been 700+ commits since then and my last rebase attempt was unsuccessful so I'm evaluating how to regroup. In any event though, for that older version I now have an ARM64 bundle happening where you can switch between HL1, BS and OpFor so long as the data folders are in place, my goal is to get that going for Intel/Universal and with the latest changes. |
Sounds good ... I've submitted a pull request: #1427. Hopefully @tomkidd can add his name as well if interested. @tomkidd - I'm not too familiar with app bundles and code signing, but I was able to get everything compiled from the latest code. I was also able to create app bundle using a shell script to call Xash3D with the required parameters so the data is located in ~/Library/Application Support but the executable and libraries (dylibs) are stored in the app bundle. I think the extra code you added to load the libraries isn't needed after @a1batross changed RPATH from '$ORIGIN' to '@loader_path' in the build script. Here is the app bundle so maybe you can take a look and let me know what you think? It's compiled (and unmodified) from the git code except the HLSDK required a small change (FWGS/hlsdk-portable#390) |
If script isn't the best solution, it might be possible to fork
|
I'm using Xash3D-FWGS on macOS and I'm trying to build an app bundle (read-only) so I need a way to specify the full path to the game directories and read/write path for configs and save games.
Is this possible?
It seems like I specify the path to the game files (-rodir) but Xash3D-FWGS will still write config/data to the current path.
The text was updated successfully, but these errors were encountered: