/** * Copyright (c) 2025 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #pragma once #include "type/assettexture.h" #include "type/assetlanguage.h" #include "type/assetscript.h" #include "type/assetmap.h" #include "type/assetmapchunk.h" #include typedef enum { ASSET_TYPE_NULL, ASSET_TYPE_TEXTURE, ASSET_TYPE_LANGUAGE, ASSET_TYPE_SCRIPT, ASSET_TYPE_MAP, ASSET_TYPE_MAP_CHUNK, ASSET_TYPE_COUNT, } assettype_t; typedef enum { ASSET_LOAD_STRAT_ENTIRE, ASSET_LOAD_STRAT_CUSTOM } assetloadstrat_t; typedef struct assetcustom_s { zip_file_t *zipFile; void *output; } assetcustom_t; typedef struct { const char_t *extension; const size_t dataSize; const assetloadstrat_t loadStrategy; union { errorret_t (*entire)(void *data, void *output); errorret_t (*custom)(assetcustom_t custom); }; } assettypedef_t; static const assettypedef_t ASSET_TYPE_DEFINITIONS[ASSET_TYPE_COUNT] = { [ASSET_TYPE_NULL] = { 0 }, [ASSET_TYPE_TEXTURE] = { .extension = "dpt", .loadStrategy = ASSET_LOAD_STRAT_ENTIRE, .dataSize = sizeof(assettexture_t), .entire = assetTextureLoad }, [ASSET_TYPE_LANGUAGE] = { .extension = "DLF", .loadStrategy = ASSET_LOAD_STRAT_CUSTOM, .custom = assetLanguageHandler }, [ASSET_TYPE_SCRIPT] = { .extension = "lua", .loadStrategy = ASSET_LOAD_STRAT_CUSTOM, .custom = assetScriptHandler }, // [ASSET_TYPE_MAP] = { // .extension = "DMF", // .loadStrategy = ASSET_LOAD_STRAT_CUSTOM, // .custom = assetMapHandler // }, // [ASSET_TYPE_MAP_CHUNK] = { // .extension = "DMC", // .loadStrategy = ASSET_LOAD_STRAT_CUSTOM, // .custom = assetMapChunkHandler // }, };