/** * @file RSPTexture.h * @date 25/08/2022 * @author JackCarterSmith * @copyright GPL-v3.0 * @brief Rogue Squadron Parser texture library, used to decode HMT datas * from original game file and access them through public interface. * */ #include "RSPTexture_datatypes.h" #ifndef RSPTEXTURELIB_H_ #define RSPTEXTURELIB_H_ #if defined(_MSC_VER) # define RSPTEXTURE_ABI_EXPORT __declspec(dllexport) # define RSPTEXTURE_ABI_IMPORT __declspec(dllimport) #elif __GNUC__ >= 4 # define RSPTEXTURE_ABI_EXPORT __attribute__ ((visibility("default"))) # define RSPTEXTURE_ABI_IMPORT __attribute__ ((visibility("default"))) #else # define RSPTEXTURE_ABI_EXPORT # define RSPTEXTURE_ABI_IMPORT #endif #if defined(RSPTEXTURE_DLL) # if defined(WIN32) # if defined(RSPTEXTURE_DLLBUILD) # define RSPTEXTURE_EXTERN extern RSPTEXTURE_ABI_EXPORT # else # define RSPTEXTURE_EXTERN extern RSPTEXTURE_ABI_IMPORT # endif # endif #endif #ifndef RSPTEXTURE_EXTERN # define RSPTEXTURE_EXTERN extern #endif #ifdef __cplusplus extern "C" { #endif /////////////////////////////////////////////////////////////////////////////// // Library's functions declaration /////////////////////////////////////////////////////////////////////////////// /** * @brief Get the current library version. * @return Char array of the version, escape char included. */ RSPTEXTURE_EXTERN char* RSPTexture_getVersion( void ); /** * @brief Run texture parser for the specified file in file system. * @details Texture library can process HMT file from file system. It's a easy * approach using this library for debugging purpose. * * @param[out] hmtStruct HMT texture structure to be filled with parsed datas. * @param[in] filePath Path to the HMT file in system. * @param[in] params Parser options. See RSPTEXTURE_PARAMETERS. * * @return Error status, return RSPLIB_SUCCESS in nominal case. */ RSPTEXTURE_EXTERN unsigned short RSPTexture_processHMTFile( T_RSPTEXTURE_HMT* hmtStruct, const char* const filePath, const RSPTEXTURE_PARAMETERS params ); /** * @brief Run texture parser for the specified file in memory. * @details Texture library can process HMT file directly stored in RAM memory, * you must load the file beforehand through a malloc/memcpy call. * @warning No controls routines are implemented to verify file length! * * @param[out] hmtStruct HMT texture structure to be filled with parsed datas. * @param[in] memFilePtr Pointer to the beginning of the file in memory. * @param[in] memFileSize Size of the file in bytes. * @param[in] params Parser options. See RSPTEXTURE_PARAMETERS. * * @return Error status, return RSPLIB_SUCCESS in nominal case. */ RSPTEXTURE_EXTERN unsigned short RSPTexture_processHMTFileMemory( T_RSPTEXTURE_HMT* hmtStruct, const void* const memFilePtr, const long memFileSize, const RSPTEXTURE_PARAMETERS params ); /** * @brief Parse HMT materials for specific ID. * @pre HMT structure should be processed with RSPTexture_processHMTFile() * or RSPTexture_processHMTMemFile() before. * * @param[in] pHmt HMT texture structure to be analyzed. * @param[in] mat_id ID of the material. * @param[in] mat_type Type of the material. * * @return Pointer to T_RSPTEXTURE_MATERIAL if found or NULL otherwise. */ RSPTEXTURE_EXTERN T_RSPTEXTURE_MATERIAL* RSPTexture_getMaterialFromID( const T_RSPTEXTURE_HMT* pHmt, const unsigned short mat_id, const RSPTEX_MAT_TYPE mat_type ); /** * @brief Clean HMT object and it's childrens from memory. * @param[in] hmtStruct Pointer to data to be cleaned up. */ RSPTEXTURE_EXTERN void RSPTexture_freeHMT( T_RSPTEXTURE_HMT* hmtStruct ); #ifdef __cplusplus } #endif #endif /* RSPTEXTURELIB_H_ */