nxengine / nxengine-evo

nxengine refactoring
https://discord.gg/jnwmA7DhQh
GNU General Public License v3.0
491 stars 82 forks source link

nxengine-evo not looking for game data in present working directory #281

Closed MxSelfDestruct closed 1 year ago

MxSelfDestruct commented 1 year ago

Trying to run nxengine-evo on Linux (Ubuntu 22.04.2) and it only seems to want to look in /usr/local/share/nxengine/ for game data.

~/games/cave-story$ ./nxengine-evo 
[16:57:38.103] [info] [settings.cpp:28 tryload]: Loading settings...
[16:57:38.103] [error] [settings.cpp:33 tryload]: Couldn't open file /home/nat/.local/share/nxengine/settings.dat.
[16:57:38.103] [info] [settings.cpp:77 settings_load]: No saved settings; using defaults.
[16:57:38.199] [info] [Renderer.cpp:134 initVideo]: Renderer::initVideo: using: opengl renderer
[16:57:38.203] [error] [Font.cpp:81 load]: Error opening font file /usr/local/share/nxengine/data/font_1.fnt
[16:57:38.203] [critical] [main.cpp:58 fatal]: fatal: 'Failed to initialize graphics.'
~/games/cave-story$ ls data
ArmsImage.pbm        bkMoon480fix.pbm    font_1.fnt       Npc
ArmsItem.tsc         bkMoon.pbm          font_2_0.png     npc.tbl
Arms.pbm             bkRed.pbm           font_2.fnt       org
bk0.pbm              bkSunset480fix.pbm  font_3_0.png     pxt
bkBlack.pbm          bkSunset.pbm        font_3_1.png     spot.png
bkBlue.pbm           bkWater.pbm         font_3.fnt       sprites.sif
bkFall.pbm           Bullet.pbm          font_4_0.png     Stage
bkFog480fix.pbm      Caret.pbm           font_4.fnt       stage.dat
bkFog.pbm            casts.pbm           font_5_0.png     StageImage.pbm
bkGard.pbm           Credit.tsc          font_5.fnt       StageMeta
bkGray.pbm           endpic              Head.tsc         StageSelect.tsc
bkGreen.pbm          Face_0.pbm          ItemImage.pbm    system.json
bkHellish480fix.pbm  Face_1.pbm          lang             TextBox.pbm
bkHellish.pbm        Face_2.pbm          Loading.pbm      tilekey.dat
bkLight480fix.pbm    Face.pbm            music_dirs.json  Title.pbm
bkLight.pbm          Fade.pbm            music.json       wavetable.dat
bkMaze.pbm           font_1_0.png        MyChar.pbm

the game data folder is in the same folder as the executable. can I force it to look in the current directory for game data?

xordspar0 commented 1 year ago

It's only available as a build-time option. If you build with cmake -DPORTABLE=ON it will instead look in data/ in the same directory as the binary.

The AppImage build uses portable mode to make the binary location- and root-independent.

MxSelfDestruct commented 1 year ago

Ah, that worked! Thank you very much.

coreybruce commented 1 year ago

It's only available as a build-time option. If you build with cmake -DPORTABLE=ON it will instead look in data/ in the same directory as the binary.

The AppImage build uses portable mode to make the binary location- and root-independent.

Please add this to the build instructions on Linux/Mac as there is no documentation of this on the build instructions