ptitSeb / Serious-Engine

A port to the OpenPandora (and working fine on plain Linux) of the open source version of a game engine developed by Croteam for the classic Serious Sam games. Status: Working (for both FE and SE).
https://pyra-handheld.com/boards/threads/serious-sam-first-encounter.77225/
GNU General Public License v2.0
75 stars 23 forks source link

ApplicationPath is tied to exec location #27

Open bademux opened 3 years ago

bademux commented 3 years ago

Hello,

As per https://github.com/ptitSeb/Serious-Engine/issues/5#issuecomment-465722224 resources path should be independent from binary location Looks like GetExecutablePath shoild be replaced with GetUserDirectory https://github.com/ptitSeb/Serious-Engine/blob/master/Sources/Engine/Engine.cpp#L274 in order to use SDL's Prefs

It is pain to extract game resources into separate folder as the game do some manipulations in the same dir. For most painful things I apply hacks (sorry for ugly bash code):

Add fallback to default lib location if nothing found:

'@@ -107,0 +108 @@\n'\
'+        if (module == NULL) DoOpen(fnm.FileName()+fnm.FileExt());\n'\
| patch target/Sources/Engine/Base/Unix/UnixDynamicLoader.cpp &&

Use GetUserDirectory instead of GetExecutablePath

printf ''\
'@@ -274 +274 @@\n'\
'-  _pFileSystem->GetExecutablePath(strExePath, sizeof (strExePath)-1);\n'\
'+ _pFileSystem->GetUserDirectory(strExePath, sizeof (strExePath)-1);\n'\
| patch target/Sources/Engine/Engine.cpp

And also those two (as a consequence of previous): The game creates log file in dir defined by GetUserDirectory - log file can't be disabled For some reason the game attempts to open libEntitiesMP.so (invocation lfomethere from resource loading code) - empty file should be created bash touch "$UserDirectory/Bin/libEntitiesMP.so"

ref: https://github.com/bademux/serioussam-server/blob/master/Dockerfile