LDKAssetSourcePackage
typedef struct LDKAssetSourcePackage LDKAssetSourcePackage;
Runtime asset byte source
Resolves logical asset paths against open .box packages first and the configured runtree directory second. It is not a general virtual filesystem; it only resolves packageable asset content.
typedef struct LDKAssetSourcePackage LDKAssetSourcePackage;
typedef LDKAsyncResult LDKAsyncRead;
typedef enum LDKAssetSourceOrigin{
LDK_ASSET_SOURCE_ORIGIN_NONE=0,
LDK_ASSET_SOURCE_ORIGIN_PACKAGE,
LDK_ASSET_SOURCE_ORIGIN_FILESYSTEM,
}LDKAssetSourceOrigin;
typedef struct LDKAssetSourceFile{
LDKAssetSourceOrigin origin;
u64 size;
union{struct{LDKPackage *package;const LDKPackageEntry *entry;}package;XFSPath filesystem_path;}location;
}LDKAssetSourceFile;
typedef struct LDKAssetSource{
XFSPath runtree_path;
LDKAssetSourcePackage *packages;
u64 revision;
}LDKAssetSource;
Set the asset path.
LDK_API bool ldk_asset_path_set(
LDKAssetPath *out_path,
const char *path
);
LDKAssetPath *out_pathconst char *pathTrue if the operation succeeds; false otherwise.
Initialize the asset source.
LDK_API bool ldk_asset_source_initialize(
LDKAssetSource *source,
const char *runtree_path
);
LDKAssetSource *sourceconst char *runtree_pathTrue if the operation succeeds; false otherwise.
Shut down the asset source.
LDK_API void ldk_asset_source_terminate(LDKAssetSource *source);
LDKAssetSource *sourceSet the asset source runtree.
LDK_API bool ldk_asset_source_runtree_set(
LDKAssetSource *source,
const char *runtree_path
);
LDKAssetSource *sourceconst char *runtree_pathTrue if the operation succeeds; false otherwise.
Attach a BOX package as an asset source.
LDK_API LDKAssetSourcePackage * ldk_asset_source_package_open(
LDKAssetSource *source,
const char *path
);
LDKAssetSource *sourceconst char *pathPointer to the requested object or data; NULL when unavailable.
Close a package currently used as an asset source.
LDK_API bool ldk_asset_source_package_close(
LDKAssetSource *source,
LDKAssetSourcePackage *package
);
LDKAssetSource *sourceLDKAssetSourcePackage *packageTrue if the operation succeeds; false otherwise.
Get the asset source package path.
LDK_API const XFSPath * ldk_asset_source_package_path_get(
const LDKAssetSource *source,
const LDKPackage *package
);
const LDKAssetSource *sourceconst LDKPackage *packagePointer to the requested object or data; NULL when unavailable.
Find an asset by logical path in the source configuration.
LDK_API bool ldk_asset_source_find(
const LDKAssetSource *source,
const char *path,
LDKAssetSourceFile *out_file
);
const LDKAssetSource *sourceconst char *pathLDKAssetSourceFile *out_fileTrue if the operation succeeds; false otherwise.
Get the byte size of an asset-source file.
LDK_API u64 ldk_asset_source_file_size(const LDKAssetSourceFile *file);
const LDKAssetSourceFile *fileSize of the result, in bytes where applicable.
Read bytes from an asset source file at the given offset.
LDK_API bool ldk_asset_source_file_read_at(
const LDKAssetSourceFile *file,
u64 offset,
void *out_data,
u64 size,
u64 *out_read
);
const LDKAssetSourceFile *fileu64 offsetvoid *out_datau64 sizeu64 *out_readTrue if the operation succeeds; false otherwise.
Begin asynchronous reading from an asset file at an offset.
LDK_API LDKAsyncRead ldk_asset_source_file_read_at_async(
const LDKAssetSourceFile *file,
u64 offset,
void *out_data,
u64 size,
u64 *out_read
);
const LDKAssetSourceFile *fileu64 offsetvoid *out_datau64 sizeu64 *out_readThe requested value.
Begin asynchronous reading of an asset file.
LDK_API LDKAsyncRead ldk_asset_source_file_read_async(
const LDKAssetSourceFile *file,
void *out_data,
u64 out_size
);
const LDKAssetSourceFile *filevoid *out_datau64 out_sizeThe requested value.
Read the asset source file.
LDK_API bool ldk_asset_source_file_read(
const LDKAssetSourceFile *file,
void *out_data,
u64 out_size
);
const LDKAssetSourceFile *filevoid *out_datau64 out_sizeTrue if the operation succeeds; false otherwise.
Write the asset source file.
LDK_API bool ldk_asset_source_file_write(
const LDKAssetSource *source,
const char *path,
const void *data,
u64 size
);
const LDKAssetSource *sourceconst char *pathconst void *datau64 sizeTrue if the operation succeeds; false otherwise.