Asset refactor
This commit is contained in:
61
archive/loader/assetlanguage.h
Normal file
61
archive/loader/assetlanguage.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "error/error.h"
|
||||
#include "duskdefs.h"
|
||||
#include <zip.h>
|
||||
|
||||
typedef struct {
|
||||
zip_file_t *zip;
|
||||
zip_int64_t chunksOffset;
|
||||
} assetlanguage_t;
|
||||
|
||||
typedef struct assetcustom_s assetcustom_t;
|
||||
|
||||
/**
|
||||
* Receiving function from the asset manager to handle language assets.
|
||||
*
|
||||
* @param custom Custom asset loading data.
|
||||
* @return Error code.
|
||||
*/
|
||||
errorret_t assetLanguageHandler(assetcustom_t custom);
|
||||
|
||||
/**
|
||||
* Initializes a language asset and loads the header data into memory.
|
||||
*
|
||||
* @param lang Language asset to initialize.
|
||||
* @param zipFile Zip file handle for the language asset.
|
||||
* @return Error code.
|
||||
*/
|
||||
errorret_t assetLanguageInit(assetlanguage_t *lang, zip_file_t *zipFile);
|
||||
|
||||
/**
|
||||
* Reads a string from the language asset into the provided buffer.
|
||||
*
|
||||
* @param lang Language asset to read from.
|
||||
* @param key Language key to read.
|
||||
* @param buffer Buffer to read the string into.
|
||||
* @param bufferSize Size of the provided buffer.
|
||||
* @param outLength Pointer to store the length of the string read.
|
||||
* @return Error code.
|
||||
*/
|
||||
errorret_t assetLanguageRead(
|
||||
assetlanguage_t *lang,
|
||||
const uint32_t key,
|
||||
char_t *buffer,
|
||||
const uint32_t bufferSize,
|
||||
uint32_t *outLength
|
||||
);
|
||||
|
||||
/**
|
||||
* Disposes of language asset resources.
|
||||
*
|
||||
* @param custom Custom asset loading data.
|
||||
* @return Error code.
|
||||
*/
|
||||
void assetLanguageDispose(assetlanguage_t *lang);
|
||||
Reference in New Issue
Block a user