libER 0.1.4.2
ELDEN RING API library
|
Asynchronous file loading using the file capsule system. More...
#include <file.hpp>
Public Types | |
enum | file_request_type : char { LOAD = 0 , RELOAD = 1 , UNLOAD = 2 } |
Supported request types. More... | |
using | loader_type = FD4::FD4FileCap *(*)(CS::CSFile *, const wchar_t *, void *, void *, void *, void *) |
File capsule loader callback signature, for internal use. | |
Public Member Functions | |
file_request (const std::filesystem::path &file, file_request_type type) | |
Construct a new file request. | |
file_request (std::filesystem::path &&file, file_request_type type) | |
Construct a new file request (path move constructor). | |
file_request (const file_request &)=delete | |
file_request (file_request &&) noexcept=delete | |
file_request & | operator= (const file_request &)=delete |
file_request & | operator= (file_request &&) noexcept=delete |
bool | ready () const noexcept |
Check if the file request is ready. | |
liber::optref< FD4::FD4FileCap > | get () const noexcept |
Block until the file request is ready and get the result. | |
liber::optref< FD4::FD4FileCap > | check () const noexcept |
Get the request result whether it had finished or not. | |
Asynchronous file loading using the file capsule system.
Request a file to be loaded/unloaded/reloaded from disk or a .bdt ELDEN RING archive. The operation is executed asynchronously and the result may be acquired from the request whenever it is ready.
Supported request types.
LOAD: Load the requested file. If a file with the same name is already loaded, return it instead.
RELOAD: Load the requested file. If a file with the same name is already loaded, unload it and use the path provided instead.
UNLOAD: Unload the requested file. Does nothing if no files with a matching name are loaded.
|
inline |
Construct a new file request.
By default, the base working directory for relative paths is ELDEN RING/Game.
Paths with an ELDEN RING virtual filesystem root will be treated as such, and the requested file will be loaded from a .bdt archive.
file | a path to the file |
type | the request type |
std::filesystem::filesystem_error | if a file on disk is not found, or if a file extension is not supported |
|
inline |
Construct a new file request (path move constructor).
By default, the base working directory for relative paths is ELDEN RING/Game.
Paths with an ELDEN RING virtual filesystem root will be treated as such, and the requested file will be loaded from a .bdt archive.
file | a path to the file |
type | the request type |
std::filesystem::filesystem_error | if a file on disk is not found, or if a file extension is not supported |
|
inlinenoexcept |
Get the request result whether it had finished or not.
The absense of a value does not indicate that the request is still not ready, as it simply may have failed to find the file. Use from::file_request::ready for that purpose instead.
|
inlinenoexcept |
Block until the file request is ready and get the result.
A file request finishing does not mean it contains a value; it's possible the file was not found.
|
inlinenoexcept |
Check if the file request is ready.
Does not block.