NagyD / SDLPoP

An open-source port of Prince of Persia, based on the disassembly of the DOS version.
GNU General Public License v3.0
1.1k stars 141 forks source link

Locate data files if they are missing in the working directory #148

Closed Falcury closed 6 years ago

Falcury commented 6 years ago

This adds a fallback so that whenever SDLPoP cannot find some file in the current working directory, it can instead load from the folder where the executable lives. This makes it easier to run the game from another location (not having to worry about missing data files).

Also:

NagyD commented 6 years ago

SDLPoP already does something similar if a replay file is passed in the command line: https://github.com/NagyD/SDLPoP/blob/master/src/replay.c#L375

However, there is a difference: the replay code chdir()s into the exe directory, while this code looks for each file in the current directory first. So if the current folder has some DAT files, then they override the default ones.

This makes it easier to run the game from another location

This should also be good for playing mods without losing the music, or mods that don't have all DAT files.