-
Notifications
You must be signed in to change notification settings - Fork 217
Resource loading order
yvt edited this page Sep 24, 2020
·
6 revisions
-
loose files: files which are not packaged and put directly in a
Resources
directory or one of its subdirectories are called loose files. -
packed files: files packaged into
.pak
are called packed files. -
pak files: packages including one or more packed files. They have the extension
.pak
(or.zip
, as of 0.0.13).
Suppose the program wants to load a texture from the path Textures/SomeTexture.png
...
- OpenSpades searches loose files in the user-specific
Resources
directory.C:\Users\myusername\AppData\Roaming\OpenSpades\Resources\Textures\SomeTexture.png
-
/home/myusername/.local/openspades/Resources/Textures/SomeTexture.png
FIXME: needs verification
- OpenSpades searches loose files in the global
Resources
directory that is located near the executable file.E:\Downloads\OpenSpades-0.0.42\Resources\Textures\SomeTexture.png
/usr/local/share/games/openspades/Resources/Textures/SomeTexture.png
- And then OpenSpades searches every pak files in the following order: first, paks whose file name does not look like
pak0123456789.pak
, in alphabetic order. (note: Pak files are detected using the method of the step one and two.)-
Textures/SomeTexture.png
insideE:\Downloads\OpenSpades-0.0.42\Resources\CupcakesGunMod.pak
-
Textures/SomeTexture.png
insideE:\Downloads\OpenSpades-0.0.42\Resources\CupcakesGunMod2.pak
(only if the above one wasn't found)
-
- Second, paks whose file name looks like
pak0123456789-xxxx.pak
, in the reverse order of the number.-
Textures/SomeTexture.png
insideE:\Downloads\OpenSpades-0.0.42\Resources\pak020-NewerDefaultAssets.pak
-
Textures/SomeTexture.png
insideE:\Downloads\OpenSpades-0.0.42\Resources\pak010-OlderDefaultAssets.pak
(only if the above one wasn't found)
-
- If the file is not found yet at this point, the suffix
.weak
is appended to the file name, and the steps 1-4 are tried again.
In this way,
- Users can override the standard behavior just by copying
something.pak
into one ofResources
directories. - Patching the official package becomes easier by using the next index number (ex.
pak010-0.14.0-patch.pak
,pak011-0.14.1-patch.pak
).
Pak files are implemented as merely renamed ZIP files. Additional formats (for example, encrypted bundles for IP protection) might be supported in the future.
This wiki is in the middle of an update process to match the latest changes of OpenSpades 0.1.2
It may contain outdated, incorrect or incomplete information.
Please contact the repository owner (@yvt) via email or ask a question in the issue tracker if there is any obscure information you are looking for that can't be found in neither the source code nor in this wiki.