|
libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
|
#include "stdint.h"#include "ship/Api.h"#include "fast/resource/type/Texture.h"#include "ship/resource/Resource.h"#include <memory>Go to the source code of this file.
Namespaces | |
| namespace | Ship |
| Core namespace for the libultraship engine framework. | |
Functions | |
| void | ResourceSetResourceManager (std::shared_ptr< Ship::ResourceManager > resourceManager) |
| std::shared_ptr< Ship::ResourceManager > | ResourceGetResourceManager () |
| std::shared_ptr< Ship::IResource > | ResourceLoad (const char *name) |
| Loads a resource by its virtual path and returns a type-erased shared pointer. | |
| std::shared_ptr< Ship::IResource > | ResourceLoad (uint64_t crc) |
| Loads a resource by its 64-bit CRC and returns a type-erased shared pointer. | |
| template<class T > | |
| std::shared_ptr< T > | ResourceLoad (const char *name) |
| Loads a resource by its virtual path and casts it to the requested type. | |
| template<class T > | |
| std::shared_ptr< T > | ResourceLoad (uint64_t crc) |
| Loads a resource by CRC and casts it to the requested type. | |
| API_EXPORT uint64_t | ResourceGetCrcByName (const char *name) |
| Returns the 64-bit CRC that corresponds to the given resource path. | |
| API_EXPORT const char * | ResourceGetNameByCrc (uint64_t crc) |
| Returns the virtual path string that corresponds to the given 64-bit CRC. | |
| API_EXPORT size_t | ResourceGetSizeByName (const char *name) |
| Returns the raw data size in bytes of the resource with the given path. | |
| API_EXPORT size_t | ResourceGetSizeByCrc (uint64_t crc) |
| Returns the raw data size in bytes of the resource with the given CRC. | |
| API_EXPORT uint8_t | ResourceGetIsCustomByName (const char *name) |
Returns non-zero if the resource at name originates from a custom/mod archive. | |
| API_EXPORT uint8_t | ResourceGetIsCustomByCrc (uint64_t crc) |
Returns non-zero if the resource at crc originates from a custom/mod archive. | |
| API_EXPORT void * | ResourceGetDataByName (const char *name) |
| Returns a raw pointer to the resource's data buffer by path. | |
| API_EXPORT void * | ResourceGetDataByCrc (uint64_t crc) |
| Returns a raw pointer to the resource's data buffer by CRC. | |
| API_EXPORT uint16_t | ResourceGetTexWidthByName (const char *name) |
Returns the texture width in pixels for the texture resource at name. | |
| API_EXPORT uint16_t | ResourceGetTexWidthByCrc (uint64_t crc) |
Returns the texture width in pixels for the texture resource at crc. | |
| API_EXPORT uint16_t | ResourceGetTexHeightByName (const char *name) |
Returns the texture height in pixels for the texture resource at name. | |
| API_EXPORT uint16_t | ResourceGetTexHeightByCrc (uint64_t crc) |
Returns the texture height in pixels for the texture resource at crc. | |
| API_EXPORT size_t | ResourceGetTexSizeByName (const char *name) |
Returns the total texture data size in bytes for the texture at name. | |
| API_EXPORT size_t | ResourceGetTexSizeByCrc (uint64_t crc) |
Returns the total texture data size in bytes for the texture at crc. | |
| API_EXPORT void | ResourceLoadDirectory (const char *name) |
Synchronously loads all resources whose paths begin with name. | |
| API_EXPORT void | ResourceLoadDirectoryAsync (const char *name) |
Queues all resources under name for background loading. | |
| API_EXPORT void | ResourceDirtyDirectory (const char *name) |
Marks all resources under name as dirty so they are reloaded on next access. | |
| API_EXPORT void | ResourceDirtyByName (const char *name) |
Marks the resource at name as dirty so it is reloaded on next access. | |
| API_EXPORT void | ResourceDirtyByCrc (uint64_t crc) |
Marks the resource at crc as dirty so it is reloaded on next access. | |
| API_EXPORT void | ResourceUnloadByName (const char *name) |
| Evicts the resource with the given path from the resource cache. | |
| API_EXPORT void | ResourceUnloadByCrc (uint64_t crc) |
| Evicts the resource with the given CRC from the resource cache. | |
| API_EXPORT void | ResourceUnloadDirectory (const char *name) |
Evicts all resources whose paths begin with name from the resource cache. | |
| API_EXPORT void | ResourceClearCache () |
| Evicts all resources from the resource cache. | |
| API_EXPORT void | ResourceGetGameVersions (uint32_t *versions, size_t versionsSize, size_t *versionsCount) |
| Retrieves the list of game version hashes present in the loaded archives. | |
| API_EXPORT uint32_t | ResourceHasGameVersion (uint32_t hash) |
| Returns non-zero if the given version hash is present in the loaded archives. | |
| API_EXPORT uint32_t | IsResourceManagerLoaded () |
| Returns non-zero if the ResourceManager has been fully initialised and is ready. | |
| API_EXPORT uint32_t IsResourceManagerLoaded | ( | ) |
Returns non-zero if the ResourceManager has been fully initialised and is ready.
| API_EXPORT void ResourceClearCache | ( | ) |
Evicts all resources from the resource cache.
| API_EXPORT void ResourceDirtyByCrc | ( | uint64_t | crc | ) |
Marks the resource at crc as dirty so it is reloaded on next access.
| API_EXPORT void ResourceDirtyByName | ( | const char * | name | ) |
Marks the resource at name as dirty so it is reloaded on next access.
| API_EXPORT void ResourceDirtyDirectory | ( | const char * | name | ) |
Marks all resources under name as dirty so they are reloaded on next access.
| name | Directory prefix or exact path. |
| API_EXPORT uint64_t ResourceGetCrcByName | ( | const char * | name | ) |
Returns the 64-bit CRC that corresponds to the given resource path.
| API_EXPORT void * ResourceGetDataByCrc | ( | uint64_t | crc | ) |
Returns a raw pointer to the resource's data buffer by CRC.
| API_EXPORT void * ResourceGetDataByName | ( | const char * | name | ) |
Returns a raw pointer to the resource's data buffer by path.
The pointer is valid as long as the resource remains loaded; do not cache it across frames without also holding a reference to the resource.
| API_EXPORT void ResourceGetGameVersions | ( | uint32_t * | versions, |
| size_t | versionsSize, | ||
| size_t * | versionsCount | ||
| ) |
Retrieves the list of game version hashes present in the loaded archives.
| versions | Caller-supplied array to receive the version hashes. |
| versionsSize | Capacity of versions (number of elements). |
| versionsCount | Set to the actual number of versions written to versions. |
| API_EXPORT uint8_t ResourceGetIsCustomByCrc | ( | uint64_t | crc | ) |
Returns non-zero if the resource at crc originates from a custom/mod archive.
| API_EXPORT uint8_t ResourceGetIsCustomByName | ( | const char * | name | ) |
Returns non-zero if the resource at name originates from a custom/mod archive.
| API_EXPORT const char * ResourceGetNameByCrc | ( | uint64_t | crc | ) |
Returns the virtual path string that corresponds to the given 64-bit CRC.
| std::shared_ptr< Ship::ResourceManager > ResourceGetResourceManager | ( | ) |
| API_EXPORT size_t ResourceGetSizeByCrc | ( | uint64_t | crc | ) |
Returns the raw data size in bytes of the resource with the given CRC.
| API_EXPORT size_t ResourceGetSizeByName | ( | const char * | name | ) |
Returns the raw data size in bytes of the resource with the given path.
| API_EXPORT uint16_t ResourceGetTexHeightByCrc | ( | uint64_t | crc | ) |
Returns the texture height in pixels for the texture resource at crc.
| API_EXPORT uint16_t ResourceGetTexHeightByName | ( | const char * | name | ) |
Returns the texture height in pixels for the texture resource at name.
| API_EXPORT size_t ResourceGetTexSizeByCrc | ( | uint64_t | crc | ) |
Returns the total texture data size in bytes for the texture at crc.
| API_EXPORT size_t ResourceGetTexSizeByName | ( | const char * | name | ) |
Returns the total texture data size in bytes for the texture at name.
| API_EXPORT uint16_t ResourceGetTexWidthByCrc | ( | uint64_t | crc | ) |
Returns the texture width in pixels for the texture resource at crc.
| API_EXPORT uint16_t ResourceGetTexWidthByName | ( | const char * | name | ) |
Returns the texture width in pixels for the texture resource at name.
| API_EXPORT uint32_t ResourceHasGameVersion | ( | uint32_t | hash | ) |
Returns non-zero if the given version hash is present in the loaded archives.
| hash | Version hash to search for. |
| std::shared_ptr< Ship::IResource > ResourceLoad | ( | const char * | name | ) |
Loads a resource by its virtual path and returns a type-erased shared pointer.
| name | Virtual path of the resource within the archive (e.g. "textures/foo.png"). |
| std::shared_ptr< T > ResourceLoad | ( | const char * | name | ) |
Loads a resource by its virtual path and casts it to the requested type.
| T | Expected resource type (e.g. Fast::Texture). |
| name | Virtual resource path. |
T, or nullptr if the resource could not be loaded or cast. | std::shared_ptr< Ship::IResource > ResourceLoad | ( | uint64_t | crc | ) |
Loads a resource by its 64-bit CRC and returns a type-erased shared pointer.
| crc | 64-bit CRC of the resource path. |
| std::shared_ptr< T > ResourceLoad | ( | uint64_t | crc | ) |
Loads a resource by CRC and casts it to the requested type.
| T | Expected resource type. |
| crc | 64-bit CRC of the resource path. |
T, or nullptr on failure. | API_EXPORT void ResourceLoadDirectory | ( | const char * | name | ) |
Synchronously loads all resources whose paths begin with name.
| name | Directory prefix (e.g. "textures/") or exact path. |
| API_EXPORT void ResourceLoadDirectoryAsync | ( | const char * | name | ) |
Queues all resources under name for background loading.
| name | Directory prefix or exact path. |
| void ResourceSetResourceManager | ( | std::shared_ptr< Ship::ResourceManager > | resourceManager | ) |
| API_EXPORT void ResourceUnloadByCrc | ( | uint64_t | crc | ) |
Evicts the resource with the given CRC from the resource cache.
| API_EXPORT void ResourceUnloadByName | ( | const char * | name | ) |
Evicts the resource with the given path from the resource cache.
| API_EXPORT void ResourceUnloadDirectory | ( | const char * | name | ) |
Evicts all resources whose paths begin with name from the resource cache.
| name | Directory prefix or exact path. |