This file contains global type definitions which are used throughout the entire engine and applicatio...
#define KAPI
Import/export qualifier.
Definition: defines.h:205
unsigned int u32
Unsigned 32-bit integer.
Definition: defines.h:25
_Bool b8
8-bit boolean type
Definition: defines.h:58
unsigned long long u64
Unsigned 64-bit integer.
Definition: defines.h:28
This files contains an implementation of knames.
u64 kname
A kname is a string hash made for quick comparisons versus traditional string comparisons.
Definition: kname.h:36
a structure meant to be included as the first member in the struct of all asset types for quick casti...
Definition: kasset_types.h:167
Definition: kpackage.h:37
Represents data and properties from an asset loaded from the VFS.
Definition: vfs.h:54
const char * text
Definition: vfs.h:66
kname asset_name
The name of the asset stored as a kname.
Definition: vfs.h:56
const char * path
A copy of the asset path.
Definition: vfs.h:60
kname package_name
The name of the package containing the asset, stored as a kname.
Definition: vfs.h:58
const void * bytes
Definition: vfs.h:68
vfs_request_result result
Definition: vfs.h:74
vfs_asset_flags flags
Various flags for the given asset.
Definition: vfs.h:71
u64 size
The size of the asset in bytes.
Definition: vfs.h:63
void * context
Definition: vfs.h:80
u32 context_size
Definition: vfs.h:77
const char ** text_user_types
Definition: vfs.h:23
const char * manifest_file_path
Definition: vfs.h:24
The request options for getting an asset from the VFS.
Definition: vfs.h:93
kname asset_name
The name of the asset to request.
Definition: vfs.h:97
PFN_on_asset_loaded_callback vfs_callback
Definition: vfs.h:105
const void * context
Definition: vfs.h:103
kname package_name
The name of the package to load the asset from.
Definition: vfs.h:95
b8 is_binary
Indicates if the asset is binary. If not, the asset is loaded as text.
Definition: vfs.h:99
u32 context_size
The size of the context in bytes.
Definition: vfs.h:101
struct kpackage * packages
Definition: vfs.h:87
KAPI b8 vfs_asset_write_binary(vfs_state *state, kname asset_name, kname package_name, u64 size, const void *data)
Attempts to write the provided binary data to the VFS (or package).
KAPI void vfs_asset_data_cleanup(vfs_asset_data *data)
Releases resources held by data. NOTE: This does NOT account for any dynamic allocations made within ...
KAPI void vfs_request_direct_from_disk_sync(vfs_state *state, const char *path, b8 is_binary, u32 context_size, const void *context, vfs_asset_data *out_data)
Requests an asset directly a disk path via the VFS synchronously. NOTE: This should be used sparingly...
KAPI const char * vfs_path_for_asset(vfs_state *state, kname package_name, kname asset_name)
Attempts to retrieve the path for the given asset, if it exists.
KAPI b8 vfs_initialize(u64 *memory_requirement, vfs_state *out_state, const vfs_config *config)
Initializes the Virtual File System (VFS). Call twice; once to get memory requirement (passing out_st...
KAPI vfs_asset_data vfs_request_asset_sync(vfs_state *state, vfs_request_info info)
Requests an asset from the VFS synchronously. NOTE: This should be used sparingly as it performs devi...
KAPI b8 vfs_asset_write_text(vfs_state *state, kname asset_name, kname package_name, const char *text)
Attempts to write the provided text data to the VFS (or package).
vfs_request_result
Definition: vfs.h:34
@ VFS_REQUEST_RESULT_NOT_IN_PACKAGE
Definition: vfs.h:40
@ VFS_REQUEST_RESULT_WRITE_ERROR
Definition: vfs.h:46
@ VFS_REQUEST_RESULT_FILE_DOES_NOT_EXIST
Definition: vfs.h:38
@ VFS_REQUEST_RESULT_SUCCESS
Definition: vfs.h:36
@ VFS_REQUEST_RESULT_READ_ERROR
Definition: vfs.h:44
@ VFS_REQUEST_RESULT_INTERNAL_FAILURE
Definition: vfs.h:48
@ VFS_REQUEST_RESULT_PACKAGE_DOES_NOT_EXIST
Definition: vfs.h:42
KAPI void vfs_request_asset(vfs_state *state, vfs_request_info info)
Requests an asset from the VFS, issuing the callback when complete. This call is asynchronous.
struct vfs_config vfs_config
struct vfs_request_info vfs_request_info
The request options for getting an asset from the VFS.
void(* PFN_on_asset_loaded_callback)(struct vfs_state *vfs, vfs_asset_data asset_data)
Definition: vfs.h:83
KAPI const char * vfs_source_path_for_asset(vfs_state *state, kname package_name, kname asset_name)
Attempts to retrieve the source path for the given asset, if one exists.
struct vfs_state vfs_state
KAPI void vfs_request_direct_from_disk(vfs_state *state, const char *path, b8 is_binary, u32 context_size, const void *context, PFN_on_asset_loaded_callback callback)
Requests an asset directly a disk path via the VFS, issuing the callback when complete....
u32 vfs_asset_flags
Definition: vfs.h:32
KAPI void vfs_shutdown(vfs_state *state)
Shuts down the VFS.
struct vfs_asset_data vfs_asset_data
Represents data and properties from an asset loaded from the VFS.
vfs_asset_flag_bits
Definition: vfs.h:27
@ VFS_ASSET_FLAG_NONE
Definition: vfs.h:28
@ VFS_ASSET_FLAG_BINARY_BIT
Definition: vfs.h:29