Fission FSN
Loading...
Searching...
No Matches
fsCAssetPack.h
Go to the documentation of this file.
1#pragma once
2
3// Reads the optional asset packs (.fpk) that rustTools' project asset_pack step
4// folds a game's Content folder into. Entries are scrambled, which keeps casual
5// eyes out of a shipped build; it is not encryption.
6//
7// Paths are Content-relative and matched case-insensitively, with '\\' or '/'
8// separators. Mount once at startup, before any other thread reads assets;
9// reads are then safe from any thread.
10
11#include <cstdint>
12#include <string>
13#include <string_view>
14#include <vector>
15
16namespace fsCAssetPack
17{
18// Mounts every .fpk directly inside pFolder. False if there are none.
19bool mount(const std::string& pFolder);
20bool mountedGet();
21
22bool fileExistsGet(std::string_view pPath);
23bool folderExistsGet(std::string_view pPath);
24// -1 if the file isn't packed.
25std::int64_t fileSizeGet(std::string_view pPath);
26// Reads the whole file into pDest, which must hold fileSizeGet() bytes.
27bool fileRead(std::string_view pPath, void* pDest);
28// Immediate children of a folder; folder names end in '/'.
29std::vector<std::string> folderListGet(std::string_view pPath);
30// For loaders that open files by full path: pFullPath may also sit under the mounted folder.
31bool fileGet(std::string_view pFullPath, std::string& pOut);
32
33// Content-relative key used for lookups: lower case, '/' separated, no leading "./".
34std::string keyGet(std::string_view pPath);
35}
Definition fsCAssetPack.h:17
std::vector< std::string > folderListGet(std::string_view pPath)
Definition fsCAssetPack.cpp:236
bool fileGet(std::string_view pFullPath, std::string &pOut)
Definition fsCAssetPack.cpp:251
bool fileExistsGet(std::string_view pPath)
Definition fsCAssetPack.cpp:193
bool mountedGet()
Definition fsCAssetPack.cpp:188
bool fileRead(std::string_view pPath, void *pDest)
Definition fsCAssetPack.cpp:218
bool mount(const std::string &pFolder)
Definition fsCAssetPack.cpp:162
std::string keyGet(std::string_view pPath)
Definition fsCAssetPack.cpp:142
bool folderExistsGet(std::string_view pPath)
Definition fsCAssetPack.cpp:198
std::int64_t fileSizeGet(std::string_view pPath)
Definition fsCAssetPack.cpp:212