Add asset pack reader library
This commit is contained in:
1 parent
a2cd38d5b6
commit
533d30359d
3 files changed
+54
No files matched your search
@@ -35,12 +35,17 @@ add_library(${PROJECT_NAME} SHARED
|
|||||||
target_include_directories(${PROJECT_NAME} PUBLIC
|
target_include_directories(${PROJECT_NAME} PUBLIC
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
include
|
include
|
||||||
|
intern/pakrd
|
||||||
extern/SDL2/SDL/include
|
extern/SDL2/SDL/include
|
||||||
extern/SDL2/SDL_mixer/include
|
extern/SDL2/SDL_mixer/include
|
||||||
extern/SDL2/SDL_image
|
extern/SDL2/SDL_image
|
||||||
extern/SDL2/SDL_ttf
|
extern/SDL2/SDL_ttf
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_link_directories(${PROJECT_NAME} PUBLIC intern/pakrd)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME} PUBLIC
|
target_link_libraries(${PROJECT_NAME} PUBLIC
|
||||||
|
pakrd
|
||||||
SDL2
|
SDL2
|
||||||
SDL2_image
|
SDL2_image
|
||||||
SDL2_mixer
|
SDL2_mixer
|
||||||
@@ -59,6 +64,7 @@ install(FILES
|
|||||||
include/BitmapFont.h
|
include/BitmapFont.h
|
||||||
include/reusable_ids.h
|
include/reusable_ids.h
|
||||||
include/math_utils.h
|
include/math_utils.h
|
||||||
|
intern/pakrd/pak.h
|
||||||
CONFIGURATIONS Release
|
CONFIGURATIONS Release
|
||||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
)
|
)
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,48 @@
|
|||||||
|
#ifndef PAK_H
|
||||||
|
#define PAK_H
|
||||||
|
|
||||||
|
#include "aliases.h"
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
u64 size;
|
||||||
|
u8 data[];
|
||||||
|
} buf_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
u64 offset;
|
||||||
|
u64 length;
|
||||||
|
char name[];
|
||||||
|
} toc_entry_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
u64 count;
|
||||||
|
u64 size;
|
||||||
|
} toc_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
u64 major;
|
||||||
|
u64 minor;
|
||||||
|
u64 patch;
|
||||||
|
} pak_ver_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
u64 size;
|
||||||
|
u8 data[];
|
||||||
|
} pak_entry_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
u64 magic;
|
||||||
|
pak_ver_t version;
|
||||||
|
toc_t toc;
|
||||||
|
} pak_t;
|
||||||
|
|
||||||
|
typedef struct asset_pack asset_pack_t;
|
||||||
|
|
||||||
|
bool create_asset_pack(const char *dirpath, const char *output);
|
||||||
|
asset_pack_t *load_asset_pack(const char *filepath);
|
||||||
|
buf_t *read_file_from_pack(asset_pack_t *pack, const char *filename);
|
||||||
|
void close_pack_file(buf_t **buf);
|
||||||
|
void close_asset_pack(asset_pack_t **pack);
|
||||||
|
|
||||||
|
#endif // !PAK_H
|
||||||
Reference in new issue
Block a user