Compare commits

...

5 Commits

Author SHA1 Message Date
En Yi 9134fde7dc Add in rres packer
Packer will pack a rres file based on assets.info
It will also pack in player_spr.info

Will need to figure a way to incorporate sprite info for entities
2023-09-02 19:55:08 +08:00
En Yi 51618cadc6 Reset ZSTD context before starting 2023-09-02 19:54:17 +08:00
En Yi 789d1b2577 Fix incorrect check for invalid assets 2023-09-02 19:51:36 +08:00
En Yi e32fd0fc55 Modify main to use rres loading 2023-09-02 14:34:43 +08:00
En Yi 5cfa0c0fc0 Add id check for each chunk load 2023-09-02 14:34:24 +08:00
7 changed files with 519 additions and 107 deletions

View File

@ -25,6 +25,7 @@ set(GAME_LIBS
add_subdirectory(scenes)
add_subdirectory(res)
add_executable(${PROJECT_NAME}
main.c

7
main.c
View File

@ -30,8 +30,11 @@ int main(void)
init_memory_pools();
init_assets(&engine.assets);
load_from_infofile("res/assets.info", &engine.assets);
init_player_creation("res/player_spr.info", &engine.assets);
//load_from_infofile("res/assets.info", &engine.assets);
//init_player_creation("res/player_spr.info", &engine.assets);
load_from_rres("res/myresources.rres", &engine.assets);
init_player_creation_rres("res/myresources.rres", "player_spr.info", &engine.assets);
init_item_creation(&engine.assets);
LevelScene_t sandbox_scene;
sandbox_scene.scene.engine = &engine;

1
res/.gitignore vendored
View File

@ -3,3 +3,4 @@
!ldtk_repacker.py
!test_assets.info
!testLevels.lvldata
!rres_packer.c

370
res/rres_packer.c 100644
View File

@ -0,0 +1,370 @@
#include "raylib.h"
#define RRES_IMPLEMENTATION
#include "rres.h" // Required to read rres data chunks
#include <stdint.h>
// Load a continuous data buffer from rresResourceChunkData struct
static unsigned char *LoadDataBuffer(rresResourceChunkData data, unsigned int rawSize)
{
unsigned char *buffer = (unsigned char *)RRES_CALLOC((data.propCount + 1)*sizeof(unsigned int) + rawSize, 1);
memcpy(buffer, &data.propCount, sizeof(unsigned int));
for (int i = 0; i < data.propCount; i++) memcpy(buffer + (i + 1)*sizeof(unsigned int), &data.props[i], sizeof(unsigned int));
memcpy(buffer + (data.propCount + 1)*sizeof(unsigned int), data.raw, rawSize);
return buffer;
}
// Unload data buffer
static void UnloadDataBuffer(unsigned char *buffer)
{
RRES_FREE(buffer);
}
static void addTextFile(rresFileHeader* header, const char* filename, FILE* rresFile, rresDirEntry* entry)
{
rresResourceChunkInfo chunkInfo = { 0 }; // Chunk info
rresResourceChunkData chunkData = { 0 }; // Chunk data
//
unsigned char *buffer = NULL;
// ----- Text files
char *text = LoadFileText(filename);
if (text == NULL)
{
printf("Cannot pack text file %s\n", filename);
return;
}
unsigned int rawSize = strlen(text);
// Define chunk info: TEXT
chunkInfo.type[0] = 'T'; // Resource chunk type (FourCC)
chunkInfo.type[1] = 'E'; // Resource chunk type (FourCC)
chunkInfo.type[2] = 'X'; // Resource chunk type (FourCC)
chunkInfo.type[3] = 'T'; // Resource chunk type (FourCC)
// Resource chunk identifier (generated from filename CRC32 hash)
chunkInfo.id = rresComputeCRC32((unsigned char*)filename, strlen(filename));
if (entry != NULL)
{
entry->id = chunkInfo.id;
entry->offset = ftell(rresFile);
entry->fileNameSize = strlen(filename);
strcpy(entry->fileName, filename);
}
chunkInfo.compType = RRES_COMP_NONE, // Data compression algorithm
chunkInfo.cipherType = RRES_CIPHER_NONE, // Data encription algorithm
chunkInfo.flags = 0, // Data flags (if required)
chunkInfo.baseSize = 5*sizeof(unsigned int) + rawSize; // Data base size (uncompressed/unencrypted)
chunkInfo.packedSize = chunkInfo.baseSize; // Data chunk size (compressed/encrypted + custom data appended)
chunkInfo.nextOffset = 0; // Next resource chunk global offset (if resource has multiple chunks)
chunkInfo.reserved = 0; // <reserved>
//
// Define chunk data: TEXT
chunkData.propCount = 4;
chunkData.props = (unsigned int *)RRES_CALLOC(chunkData.propCount, sizeof(unsigned int));
chunkData.props[0] = rawSize; // props[0]:size (bytes)
chunkData.props[1] = RRES_TEXT_ENCODING_UNDEFINED; // props[1]:rresTextEncoding
chunkData.props[2] = RRES_CODE_LANG_UNDEFINED; // props[2]:rresCodeLang
chunkData.props[3] = 0x0409; // props[3]:cultureCode: en-US: English - United States
chunkData.raw = text;
// Get a continuous data buffer from chunkData
buffer = LoadDataBuffer(chunkData, rawSize);
// Compute data chunk CRC32 (propCount + props[] + data)
chunkInfo.crc32 = rresComputeCRC32(buffer, chunkInfo.packedSize);
// Write resource chunk into rres file
fwrite(&chunkInfo, sizeof(rresResourceChunkInfo), 1, rresFile);
fwrite(buffer, 1, chunkInfo.packedSize, rresFile);
// Free required memory
RRES_FREE(chunkData.props);
UnloadDataBuffer(buffer);
UnloadFileText(text);
header->chunkCount++;
}
static bool addRawData(rresFileHeader* header, const char* filename, FILE* rresFile, const char* ext, rresDirEntry* entry)
{
rresResourceChunkInfo chunkInfo = { 0 }; // Chunk info
rresResourceChunkData chunkData = { 0 }; // Chunk data
unsigned char *buffer = NULL;
// Load file data
unsigned int size = 0;
unsigned char* raw = LoadFileData(filename, &size);
if (raw == NULL)
{
printf("Cannot pack raw file %s\n", filename);
UnloadDataBuffer(buffer);
return false;
}
// Define chunk info: RAWD
chunkInfo.type[0] = 'R'; // Resource chunk type (FourCC)
chunkInfo.type[1] = 'A'; // Resource chunk type (FourCC)
chunkInfo.type[2] = 'W'; // Resource chunk type (FourCC)
chunkInfo.type[3] = 'D'; // Resource chunk type (FourCC)
// Resource chunk identifier (generated from filename CRC32 hash)
chunkInfo.id = rresComputeCRC32((unsigned char*)filename, strlen(filename));
if (entry != NULL)
{
entry->id = chunkInfo.id;
entry->offset = ftell(rresFile);
entry->fileNameSize = strlen(filename);
strcpy(entry->fileName, filename);
}
chunkInfo.compType = RRES_COMP_NONE, // Data compression algorithm
chunkInfo.cipherType = RRES_CIPHER_NONE, // Data encription algorithm
chunkInfo.flags = 0, // Data flags (if required)
chunkInfo.baseSize = 5*sizeof(unsigned int) + size; // Data base size (uncompressed/unencrypted)
chunkInfo.packedSize = chunkInfo.baseSize; // Data chunk size (compressed/encrypted + custom data appended)
chunkInfo.nextOffset = 0, // Next resource chunk global offset (if resource has multiple chunks)
chunkInfo.reserved = 0, // <reserved>
// Define chunk data: IMGE
chunkData.propCount = 4;
chunkData.props = (unsigned int *)RRES_CALLOC(chunkData.propCount, sizeof(unsigned int));
chunkData.props[0] = size; // props[0]:width
memcpy(chunkData.props + 1, ext, 4);
chunkData.props[2] = 0x0; // props[2]:rresPixelFormat
chunkData.props[3] = 0x0; // props[2]:rresPixelFormat
chunkData.raw = raw;
// Get a continuous data buffer from chunkData
buffer = LoadDataBuffer(chunkData, size);
// Compute data chunk CRC32 (propCount + props[] + data)
chunkInfo.crc32 = rresComputeCRC32(buffer, chunkInfo.packedSize);
// Write resource chunk into rres file
fwrite(&chunkInfo, sizeof(rresResourceChunkInfo), 1, rresFile);
fwrite(buffer, 1, chunkInfo.packedSize, rresFile);
// Free required memory
RRES_FREE(chunkData.props);
UnloadDataBuffer(buffer);
UnloadFileData(raw);
header->chunkCount++;
return true;
}
static void addCentralDir(rresFileHeader* header, const rresCentralDir* central, FILE* rresFile)
{
rresResourceChunkInfo chunkInfo = { 0 }; // Chunk info
unsigned char *buffer = NULL;
if (header->cdOffset != 0)
{
puts("There's is already a Central Dir");
return;
}
header->cdOffset = ftell(rresFile) - sizeof(rresFileHeader);
unsigned int size = 0;
// TODO: Compute correctly the size
for (unsigned int i = 0; i < central->count; ++i)
{
size += 4 * sizeof(unsigned int) + central->entries[i].fileNameSize;
}
printf("Cdir size: %d\n", size);
unsigned int props[2] = {1, central->count};
// Define chunk info: CDIR
chunkInfo.type[0] = 'C'; // Resource chunk type (FourCC)
chunkInfo.type[1] = 'D'; // Resource chunk type (FourCC)
chunkInfo.type[2] = 'I'; // Resource chunk type (FourCC)
chunkInfo.type[3] = 'R'; // Resource chunk type (FourCC)
chunkInfo.id = 0xCD010203;
chunkInfo.compType = RRES_COMP_NONE, // Data compression algorithm
chunkInfo.cipherType = RRES_CIPHER_NONE, // Data encription algorithm
chunkInfo.flags = 0, // Data flags (if required)
chunkInfo.baseSize = sizeof(props) + size; // Data base size (uncompressed/unencrypted)
chunkInfo.packedSize = chunkInfo.baseSize; // Data chunk size (compressed/encrypted + custom data appended)
chunkInfo.nextOffset = 0; // Next resource chunk global offset (if resource has multiple chunks)
chunkInfo.reserved = 0; // <reserved>
buffer = (unsigned char *)RRES_CALLOC(sizeof(props) + size, 1);
memcpy(buffer, props, sizeof(props));
unsigned char* data_ptr = buffer + sizeof(props);
for (unsigned int i = 0; i < central->count; ++i)
{
printf("Recording CDIR for %s\n", central->entries[i].fileName);
unsigned int n_write = 4 * sizeof(unsigned int) + central->entries[i].fileNameSize;
memcpy(data_ptr, central->entries + i, n_write);
data_ptr += n_write;
}
// Compute data chunk CRC32 (propCount + props[] + data)
chunkInfo.crc32 = rresComputeCRC32(buffer, chunkInfo.packedSize);
// Write resource chunk into rres file
fwrite(&chunkInfo, sizeof(rresResourceChunkInfo), 1, rresFile);
fwrite(buffer, 1, chunkInfo.packedSize, rresFile);
// Free required memory
UnloadDataBuffer(buffer);
header->chunkCount++;
}
typedef enum AssetInfoType
{
TEXTURE_INFO,
SPRITE_INFO,
LEVELPACK_INFO,
INVALID_INFO
}AssetInfoType_t;
int main(void)
{
FILE *rresFile = fopen("myresources.rres", "wb");
// Define rres file header
// NOTE: We are loading 4 files that generate 5 resource chunks to save in rres
rresFileHeader header = {
.id[0] = 'r', // File identifier: rres
.id[1] = 'r', // File identifier: rres
.id[2] = 'e', // File identifier: rres
.id[3] = 's', // File identifier: rres
.version = 100, // File version: 100 for version 1.0
.chunkCount = 0, // Number of resource chunks in the file (MAX: 65535)
.cdOffset = 0, // Central Directory offset in file (0 if not available)
.reserved = 0 // <reserved>
};
#define STARTING_CHUNKS 8
// Central Directory
rresCentralDir central = {
.count = 0,
.entries = NULL
};
central.entries = RRES_CALLOC(sizeof(rresDirEntry), STARTING_CHUNKS);
fseek(rresFile, sizeof(rresFileHeader), SEEK_SET);
addTextFile(&header, "assets.info", rresFile, central.entries);
addTextFile(&header, "player_spr.info", rresFile, central.entries + 1);
central.count = 2;
uint16_t max_chunks = STARTING_CHUNKS;
{
FILE* in_file = fopen("assets.info", "r");
if (in_file == NULL)
{
puts("assets.info must be present");
goto end;
}
char buffer[256];
char* tmp;
AssetInfoType_t info_type = INVALID_INFO;
while (true)
{
tmp = fgets(buffer, 256, in_file);
if (tmp == NULL) break;
tmp[strcspn(tmp, "\r\n")] = '\0';
if (central.count == max_chunks)
{
void* new_ptr = realloc(central.entries, (max_chunks*2) * sizeof(rresDirEntry));
if (new_ptr == NULL)
{
puts("Cannot realloc central entries");
fclose(in_file);
goto end;
}
central.entries = new_ptr;
max_chunks *= 2;
}
if (tmp[0] == '-')
{
tmp++;
if (strcmp(tmp, "Texture") == 0)
{
info_type = TEXTURE_INFO;
}
else if (strcmp(tmp, "LevelPack") == 0)
{
info_type = LEVELPACK_INFO;
}
else
{
info_type = INVALID_INFO;
}
}
else
{
char* name = strtok(buffer, ":");
char* info_str = strtok(NULL, ":");
if (name == NULL || info_str == NULL) continue;
while(*name == ' ' || *name == '\t') name++;
while(*info_str == ' ' || *info_str == '\t') info_str++;
switch(info_type)
{
case TEXTURE_INFO:
{
// ---- SpriteSheets
if (
addRawData(
&header, info_str,
rresFile, GetFileExtension(info_str),
central.entries + central.count
)
)
{
central.count++;
}
}
break;
case LEVELPACK_INFO:
{
// ---- Compressed Level Data
if (
addRawData(
&header, info_str,
rresFile, ".lpk",
central.entries + central.count
)
)
{
central.count++;
}
}
break;
default:
break;
}
}
}
fclose(in_file);
}
addCentralDir(&header, &central, rresFile);
// Write rres file header
fseek(rresFile, 0, SEEK_SET);
fwrite(&header, sizeof(rresFileHeader), 1, rresFile);
end:
fclose(rresFile);
RRES_FREE(central.entries);
return 0;
}

View File

@ -40,107 +40,119 @@ bool load_from_rres(const char* file, Assets_t* assets)
rres_file.dir = rresLoadCentralDirectory(file);
rres_file.fname = file;
rresResourceChunk chunk = rresLoadResourceChunk(file, rresGetResourceId(rres_file.dir, "assets.info")); // Hardcoded
FILE* in_file = fmemopen(chunk.data.raw, chunk.info.baseSize, "rb");
char buffer[256];
char* tmp;
size_t line_num = 0;
AssetInfoType_t info_type = INVALID_INFO;
while (true)
if (rres_file.dir.count == 0)
{
tmp = fgets(buffer, 256, in_file);
if (tmp == NULL) break;
tmp[strcspn(tmp, "\r\n")] = '\0';
puts("Empty central directory");
return false;
}
if (tmp[0] == '-')
int res_id = rresGetResourceId(rres_file.dir, "assets.info");
rresResourceChunk chunk = rresLoadResourceChunk(file, res_id); // Hardcoded
bool okay = false;
if (chunk.info.baseSize > 0)
{
FILE* in_file = fmemopen(chunk.data.raw, chunk.info.baseSize, "rb");
char buffer[256];
char* tmp;
size_t line_num = 0;
AssetInfoType_t info_type = INVALID_INFO;
while (true)
{
tmp++;
if (strcmp(tmp, "Texture") == 0)
tmp = fgets(buffer, 256, in_file);
if (tmp == NULL) break;
tmp[strcspn(tmp, "\r\n")] = '\0';
if (tmp[0] == '-')
{
info_type = TEXTURE_INFO;
}
else if (strcmp(tmp, "Sprite") == 0)
{
info_type = SPRITE_INFO;
}
else if (strcmp(tmp, "LevelPack") == 0)
{
info_type = LEVELPACK_INFO;
tmp++;
if (strcmp(tmp, "Texture") == 0)
{
info_type = TEXTURE_INFO;
}
else if (strcmp(tmp, "Sprite") == 0)
{
info_type = SPRITE_INFO;
}
else if (strcmp(tmp, "LevelPack") == 0)
{
info_type = LEVELPACK_INFO;
}
else
{
info_type = INVALID_INFO;
}
}
else
{
info_type = INVALID_INFO;
}
}
else
{
char* name = strtok(buffer, ":");
char* info_str = strtok(NULL, ":");
if (name == NULL || info_str == NULL) continue;
char* name = strtok(buffer, ":");
char* info_str = strtok(NULL, ":");
if (name == NULL || info_str == NULL) continue;
while(*name == ' ' || *name == '\t') name++;
while(*info_str == ' ' || *info_str == '\t') info_str++;
switch(info_type)
{
case TEXTURE_INFO:
while(*name == ' ' || *name == '\t') name++;
while(*info_str == ' ' || *info_str == '\t') info_str++;
switch(info_type)
{
//if (add_texture(assets, name, info_str) == NULL)
if (add_texture_rres(assets, name, info_str, &rres_file) == NULL)
case TEXTURE_INFO:
{
printf("Unable to add texture at line %lu\n", line_num);
break;
//if (add_texture(assets, name, info_str) == NULL)
if (add_texture_rres(assets, name, info_str, &rres_file) == NULL)
{
printf("Unable to add texture at line %lu\n", line_num);
break;
}
printf("Added texture %s as %s\n", info_str, name);
//strcpy(tmp2, name);
}
printf("Added texture %s as %s\n", info_str, name);
//strcpy(tmp2, name);
break;
case LEVELPACK_INFO:
{
//if (add_level_pack(assets, name, info_str) == NULL)
if (add_level_pack_rres(assets, name, info_str, &rres_file) == NULL)
{
printf("Unable to add level pack at line %lu\n", line_num);
break;
}
printf("Added level pack %s as %s\n", info_str, name);
}
break;
case SPRITE_INFO:
{
SpriteInfo_t spr_info = {0};
if (!parse_sprite_info(info_str, &spr_info))
{
printf("Unable to parse info for sprite at line %lu\n", line_num);
break;
}
//printf("Compare %s,%s = %d\n", tmp2, spr_info.tex, strcmp(tmp2, spr_info.tex));
Texture2D* tex = get_texture(assets, spr_info.tex);
if (tex == NULL)
{
printf("Unable to get texture info %s for sprite %s\n", spr_info.tex, name);
break;
}
printf("Added Sprite %s from texture %s\n", name, spr_info.tex);
Sprite_t* spr = add_sprite(assets, name, tex);
spr->origin = spr_info.origin;
spr->frame_size = spr_info.frame_size;
spr->frame_count = spr_info.frame_count;
spr->speed = spr_info.speed;
}
break;
default:
break;
}
break;
case LEVELPACK_INFO:
{
//if (add_level_pack(assets, name, info_str) == NULL)
if (add_level_pack_rres(assets, name, info_str, &rres_file) == NULL)
{
printf("Unable to add level pack at line %lu\n", line_num);
break;
}
printf("Added level pack %s as %s\n", info_str, name);
}
break;
case SPRITE_INFO:
{
SpriteInfo_t spr_info = {0};
if (!parse_sprite_info(info_str, &spr_info))
{
printf("Unable to parse info for sprite at line %lu\n", line_num);
break;
}
//printf("Compare %s,%s = %d\n", tmp2, spr_info.tex, strcmp(tmp2, spr_info.tex));
Texture2D* tex = get_texture(assets, spr_info.tex);
if (tex == NULL)
{
printf("Unable to get texture info %s for sprite %s\n", spr_info.tex, name);
break;
}
printf("Added Sprite %s from texture %s\n", name, spr_info.tex);
Sprite_t* spr = add_sprite(assets, name, tex);
spr->origin = spr_info.origin;
spr->frame_size = spr_info.frame_size;
spr->frame_count = spr_info.frame_count;
spr->speed = spr_info.speed;
}
break;
default:
break;
}
line_num++;
}
line_num++;
fclose(in_file);
okay = true;
}
fclose(in_file);
rresUnloadResourceChunk(chunk);
rresUnloadCentralDirectory(rres_file.dir);
return true;
return okay;
}
bool load_from_infofile(const char* file, Assets_t* assets)

View File

@ -87,19 +87,25 @@ Texture2D* add_texture_rres(Assets_t* assets, const char* name, const char* file
uint8_t tex_idx = n_loaded[0];
assert(tex_idx < MAX_TEXTURES);
rresResourceChunk chunk = rresLoadResourceChunk(rres_file->fname, rresGetResourceId(rres_file->dir, filename));
int res_id = rresGetResourceId(rres_file->dir, filename);
rresResourceChunk chunk = rresLoadResourceChunk(rres_file->fname, res_id);
//Expect RAW type of png extension
Image image = LoadImageFromMemory(GetFileExtension(filename), chunk.data.raw, chunk.info.baseSize);
Texture2D tex = LoadTextureFromImage(image);
UnloadImage(image);
Texture2D* out_tex = NULL;
if (chunk.info.baseSize > 0)
{
//Expect RAW type of png extension
Image image = LoadImageFromMemory(GetFileExtension(filename), chunk.data.raw, chunk.info.baseSize);
Texture2D tex = LoadTextureFromImage(image);
UnloadImage(image);
textures[tex_idx].texture = tex;
strncpy(textures[tex_idx].name, name, MAX_NAME_LEN);
sc_map_put_s64(&assets->m_textures, textures[tex_idx].name, tex_idx);
n_loaded[0]++;
out_tex = &textures[tex_idx].texture;
}
rresUnloadResourceChunk(chunk);
textures[tex_idx].texture = tex;
strncpy(textures[tex_idx].name, name, MAX_NAME_LEN);
sc_map_put_s64(&assets->m_textures, textures[tex_idx].name, tex_idx);
n_loaded[0]++;
return &textures[tex_idx].texture;
return out_tex;
}
Sprite_t* add_sprite(Assets_t* assets, const char* name, Texture2D* texture)
@ -173,6 +179,7 @@ static LevelPack_t* add_level_pack_zst(Assets_t* assets, const char* name, FILE*
ZSTD_inBuffer input = { level_decompressor.in_buffer, read, 0 };
ZSTD_outBuffer output = { level_decompressor.out_buffer, 4, 0 };
ZSTD_DCtx_reset(level_decompressor.ctx, ZSTD_reset_session_only);
do
{
if (input.pos == input.size)
@ -312,14 +319,21 @@ LevelPack_t* uncompress_level_pack(Assets_t* assets, const char* name, const cha
LevelPack_t* add_level_pack_rres(Assets_t* assets, const char* name, const char* filename, const RresFileInfo_t* rres_file)
{
int res_id = rresGetResourceId(rres_file->dir, filename);
rresResourceChunk chunk = rresLoadResourceChunk(rres_file->fname, res_id);
rresResourceChunk chunk = rresLoadResourceChunk(rres_file->fname, rresGetResourceId(rres_file->dir, filename));
FILE* f_in = fmemopen(chunk.data.raw, chunk.info.baseSize, "rb");
LevelPack_t* pack = add_level_pack_zst(assets, name, f_in);
fclose(f_in);
LevelPack_t* pack = NULL;
if (chunk.info.baseSize > 0 && strcmp(".lpk", (const char*)(chunk.data.props + 1)) == 0)
{
FILE* f_in = fmemopen(chunk.data.raw, chunk.info.baseSize, "rb");
pack = add_level_pack_zst(assets, name, f_in);
fclose(f_in);
}
else
{
printf("Cannot load level pack for %s\n", name);
}
rresUnloadResourceChunk(chunk);
return pack;
}

View File

@ -183,11 +183,22 @@ bool init_player_creation_rres(const char* rres_fname, const char* file, Assets_
rres_file.dir = rresLoadCentralDirectory(rres_fname);
rres_file.fname = rres_fname;
rresResourceChunk chunk = rresLoadResourceChunk(rres_file.fname, rresGetResourceId(rres_file.dir, file)); // Hardcoded
FILE* in_file = fmemopen(chunk.data.raw, chunk.info.baseSize, "rb");
if (rres_file.dir.count == 0)
{
puts("Empty central directory");
return false;
}
bool okay = init_player_file(in_file, assets);
fclose(in_file);
int res_id = rresGetResourceId(rres_file.dir, file);
rresResourceChunk chunk = rresLoadResourceChunk(rres_file.fname, res_id);
bool okay = false;
if (chunk.info.id == res_id)
{
FILE* in_file = fmemopen(chunk.data.raw, chunk.info.baseSize, "rb");
okay = init_player_file(in_file, assets);
fclose(in_file);
}
rresUnloadResourceChunk(chunk);
rresUnloadCentralDirectory(rres_file.dir);