Compare commits
No commits in common. "d070dc85663fa7b5a7105a746f952ba65d10ee5c" and "44773819d6e19de4642c092bfcdb6ae7c0fa40f3" have entirely different histories.
d070dc8566
...
44773819d6
|
|
@ -1,8 +1,7 @@
|
||||||
# Source files
|
# Source files
|
||||||
ASSET_BUILDER_SOURCES := \
|
ASSET_BUILDER_SOURCES := \
|
||||||
main.c \
|
main.c \
|
||||||
asset_file.c \
|
asset_file.c
|
||||||
errors.c
|
|
||||||
|
|
||||||
# Compiler and flags
|
# Compiler and flags
|
||||||
ASSET_BUILDER_CC = gcc
|
ASSET_BUILDER_CC = gcc
|
||||||
|
|
@ -39,7 +38,7 @@ count_asset_builder_build:
|
||||||
|
|
||||||
# Link asset builder target
|
# Link asset builder target
|
||||||
$(ASSET_BUILDER_OUTPUT): $(ASSET_BUILDER_OBJECTS)
|
$(ASSET_BUILDER_OUTPUT): $(ASSET_BUILDER_OBJECTS)
|
||||||
@echo -e "[100%] $(YELLOW)Linking $(notdir $(ASSET_BUILDER_OUTPUT))$(RESET)"
|
@echo -e "[100%] $(YELLOW)Linking $(ASSET_BUILDER_OUTPUT)$(RESET)"
|
||||||
$(Q)$(SRC_CC) $(ASSET_BUILDER_OBJECTS) -o $@ $(ASSET_BUILDER_LDFLAGS)
|
$(Q)$(SRC_CC) $(ASSET_BUILDER_OBJECTS) -o $@ $(ASSET_BUILDER_LDFLAGS)
|
||||||
|
|
||||||
# Build .o files
|
# Build .o files
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <png.h>
|
#include <png.h>
|
||||||
#include "errors.h"
|
#include <stdlib.h>
|
||||||
|
|
||||||
int parse_png_for_header(const char *input_file_name, asset_header_def_t *asset_header_def);
|
int parse_png_for_header(const char *input_file_name, asset_header_def_t *asset_header_def);
|
||||||
int parse_png_for_content(const char *input_file_name, FILE *output_file);
|
int parse_png_for_content(const char *input_file_name, FILE *output_file);
|
||||||
|
|
@ -14,7 +14,7 @@ int parse_file_for_header(const char *input_file_name, asset_header_def_t *asset
|
||||||
|
|
||||||
if(!file_name_dot)
|
if(!file_name_dot)
|
||||||
{
|
{
|
||||||
return NO_EXTENSION;
|
return -1; // no extension
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *file_name_ext = file_name_dot + 1;
|
const char *file_name_ext = file_name_dot + 1;
|
||||||
|
|
@ -23,40 +23,38 @@ int parse_file_for_header(const char *input_file_name, asset_header_def_t *asset
|
||||||
{
|
{
|
||||||
return parse_png_for_header(input_file_name, asset_header_def);
|
return parse_png_for_header(input_file_name, asset_header_def);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return -2; // extension not supported
|
||||||
|
}
|
||||||
|
|
||||||
return EXTENSION_UNSUPPORTED;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_header_to_file(asset_file_header_t *asset_file_header, FILE *output_file)
|
int write_header_to_file(asset_file_header_t *asset_file_header, FILE *output_file)
|
||||||
{
|
{
|
||||||
size_t ret = fwrite(&asset_file_header->assets_number, sizeof(size_t), 1, output_file);
|
size_t ret = fwrite(&asset_file_header->assets_number, sizeof(size_t), 1, output_file);
|
||||||
if(ret != 1)
|
if(ret != 1)
|
||||||
return WRITE_FAILED;
|
return -8; // failed writing output file
|
||||||
|
|
||||||
for(size_t i = 0; i < asset_file_header->assets_number; i++)
|
for(size_t i = 0; i < asset_file_header->assets_number; i++)
|
||||||
{
|
{
|
||||||
size_t name_length = strlen(asset_file_header->assets_header_def[i].name) + 1;
|
size_t name_length = strlen(asset_file_header->assets_header_def[i].name) + 1;
|
||||||
ret = fwrite(asset_file_header->assets_header_def[i].name, sizeof(unsigned char), name_length, output_file);
|
ret = fwrite(asset_file_header->assets_header_def[i].name, sizeof(unsigned char), name_length, output_file);
|
||||||
if(ret != name_length)
|
if(ret != name_length)
|
||||||
return WRITE_FAILED;
|
return -8; // failed writing output file
|
||||||
|
|
||||||
ret = fwrite(&asset_file_header->assets_header_def[i].start, sizeof(size_t), 1, output_file);
|
ret = fwrite(&asset_file_header->assets_header_def[i].start, sizeof(size_t), 1, output_file);
|
||||||
if(ret != 1)
|
if(ret != 1)
|
||||||
return WRITE_FAILED;
|
return -8; // failed writing output file
|
||||||
}
|
}
|
||||||
|
|
||||||
return NO_ERROR;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int parse_file_for_content_and_write(const char *input_file_name, FILE *output_file)
|
int parse_file_for_content_and_write(const char *input_file_name, FILE *output_file)
|
||||||
{
|
{
|
||||||
const char *file_name_dot = strrchr(input_file_name, '.');
|
const char *file_name_dot = strrchr(input_file_name, '.');
|
||||||
|
|
||||||
if(!file_name_dot)
|
|
||||||
{
|
|
||||||
return NO_EXTENSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *file_name_ext = file_name_dot + 1;
|
const char *file_name_ext = file_name_dot + 1;
|
||||||
|
|
||||||
if(!strcmp(file_name_ext, "png"))
|
if(!strcmp(file_name_ext, "png"))
|
||||||
|
|
@ -64,7 +62,7 @@ int parse_file_for_content_and_write(const char *input_file_name, FILE *output_f
|
||||||
return parse_png_for_content(input_file_name, output_file);
|
return parse_png_for_content(input_file_name, output_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EXTENSION_UNSUPPORTED;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// File specific functions.
|
// File specific functions.
|
||||||
|
|
@ -74,7 +72,7 @@ int parse_png_for_header(const char *file_name, asset_header_def_t *asset_header
|
||||||
|
|
||||||
if(!input_file)
|
if(!input_file)
|
||||||
{
|
{
|
||||||
return OPEN_FAILED;
|
return -3; // failed to open file
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check png autenticity.
|
// Check png autenticity.
|
||||||
|
|
@ -83,7 +81,7 @@ int parse_png_for_header(const char *file_name, asset_header_def_t *asset_header
|
||||||
if(!png_check_sig(sig, 8))
|
if(!png_check_sig(sig, 8))
|
||||||
{
|
{
|
||||||
fclose(input_file);
|
fclose(input_file);
|
||||||
return BAD_SIGNATURE;
|
return -4; // bad signature
|
||||||
}
|
}
|
||||||
|
|
||||||
// PNG structs.
|
// PNG structs.
|
||||||
|
|
@ -91,7 +89,7 @@ int parse_png_for_header(const char *file_name, asset_header_def_t *asset_header
|
||||||
if(!png_ptr)
|
if(!png_ptr)
|
||||||
{
|
{
|
||||||
fclose(input_file);
|
fclose(input_file);
|
||||||
return MEMORY_ALLOC_FAILED;
|
return -5; // out of memory
|
||||||
}
|
}
|
||||||
|
|
||||||
png_infop info_ptr = png_create_info_struct(png_ptr);
|
png_infop info_ptr = png_create_info_struct(png_ptr);
|
||||||
|
|
@ -99,7 +97,7 @@ int parse_png_for_header(const char *file_name, asset_header_def_t *asset_header
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(&png_ptr, NULL, NULL);
|
png_destroy_read_struct(&png_ptr, NULL, NULL);
|
||||||
fclose(input_file);
|
fclose(input_file);
|
||||||
return MEMORY_ALLOC_FAILED;
|
return -5; // out of memory
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill structs and load data.
|
// Fill structs and load data.
|
||||||
|
|
@ -117,7 +115,7 @@ int parse_png_for_header(const char *file_name, asset_header_def_t *asset_header
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
fclose(input_file);
|
fclose(input_file);
|
||||||
return PNG_BIT_DEPTH_UNSUPPORTED;
|
return -6; // png bit depth not supported
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(color_type)
|
switch(color_type)
|
||||||
|
|
@ -129,7 +127,7 @@ int parse_png_for_header(const char *file_name, asset_header_def_t *asset_header
|
||||||
default:
|
default:
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
fclose(input_file);
|
fclose(input_file);
|
||||||
return PNG_COLOR_TYPE_UNSUPPORTED;
|
return -7; // png color type not supported
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill asset def.
|
// Fill asset def.
|
||||||
|
|
@ -139,7 +137,7 @@ int parse_png_for_header(const char *file_name, asset_header_def_t *asset_header
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
fclose(input_file);
|
fclose(input_file);
|
||||||
|
|
||||||
return NO_ERROR;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int parse_png_for_content(const char *input_file_name, FILE *output_file)
|
int parse_png_for_content(const char *input_file_name, FILE *output_file)
|
||||||
|
|
@ -149,7 +147,7 @@ int parse_png_for_content(const char *input_file_name, FILE *output_file)
|
||||||
if(!input_file)
|
if(!input_file)
|
||||||
{
|
{
|
||||||
fclose(input_file);
|
fclose(input_file);
|
||||||
return OPEN_FAILED;
|
return -3; // failed to open file
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check png autenticity.
|
// Check png autenticity.
|
||||||
|
|
@ -158,7 +156,7 @@ int parse_png_for_content(const char *input_file_name, FILE *output_file)
|
||||||
if(!png_check_sig(sig, 8))
|
if(!png_check_sig(sig, 8))
|
||||||
{
|
{
|
||||||
fclose(input_file);
|
fclose(input_file);
|
||||||
return BAD_SIGNATURE;
|
return -4; // bad signature
|
||||||
}
|
}
|
||||||
|
|
||||||
// PNG structs.
|
// PNG structs.
|
||||||
|
|
@ -166,7 +164,7 @@ int parse_png_for_content(const char *input_file_name, FILE *output_file)
|
||||||
if(!png_ptr)
|
if(!png_ptr)
|
||||||
{
|
{
|
||||||
fclose(input_file);
|
fclose(input_file);
|
||||||
return MEMORY_ALLOC_FAILED;
|
return -5; // out of memory
|
||||||
}
|
}
|
||||||
|
|
||||||
png_infop info_ptr = png_create_info_struct(png_ptr);
|
png_infop info_ptr = png_create_info_struct(png_ptr);
|
||||||
|
|
@ -174,7 +172,7 @@ int parse_png_for_content(const char *input_file_name, FILE *output_file)
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(&png_ptr, NULL, NULL);
|
png_destroy_read_struct(&png_ptr, NULL, NULL);
|
||||||
fclose(input_file);
|
fclose(input_file);
|
||||||
return MEMORY_ALLOC_FAILED;
|
return -5; // out of memory
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill structs and load data.
|
// Fill structs and load data.
|
||||||
|
|
@ -192,7 +190,7 @@ int parse_png_for_content(const char *input_file_name, FILE *output_file)
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
fclose(input_file);
|
fclose(input_file);
|
||||||
return WRITE_FAILED;
|
return -8; // failed writing to output file
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = fwrite(&height, sizeof(size_t), 1, output_file);
|
ret = fwrite(&height, sizeof(size_t), 1, output_file);
|
||||||
|
|
@ -200,7 +198,7 @@ int parse_png_for_content(const char *input_file_name, FILE *output_file)
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
fclose(input_file);
|
fclose(input_file);
|
||||||
return WRITE_FAILED;
|
return -8; // failed writing to output file
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare storage.
|
// Prepare storage.
|
||||||
|
|
@ -216,26 +214,19 @@ int parse_png_for_content(const char *input_file_name, FILE *output_file)
|
||||||
{
|
{
|
||||||
for(size_t j = 0; j < row_length; j += 4)
|
for(size_t j = 0; j < row_length; j += 4)
|
||||||
{
|
{
|
||||||
if(pixels[i * row_length + j + 3] < 128)
|
if(!pixels[i * row_length + j + 3])
|
||||||
{
|
{
|
||||||
pixels[i * row_length + j] = 0xFF;
|
pixels[i * row_length + j] = 0xFF;
|
||||||
pixels[i * row_length + j + 1] = 0x00;
|
pixels[i * row_length + j + 1] = 0x00;
|
||||||
pixels[i * row_length + j + 2] = 0xFF;
|
pixels[i * row_length + j + 2] = 0xFF;
|
||||||
}
|
}
|
||||||
else if(pixels[i * row_length + j + 3] < 255)
|
|
||||||
{
|
|
||||||
pixels[i * row_length + j] = 0x80;
|
|
||||||
pixels[i * row_length + j + 1] = 0x00;
|
|
||||||
pixels[i * row_length + j + 2] = 0x80;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ret = fwrite(&pixels[i * row_length + j], sizeof(png_byte), 3, output_file);
|
ret = fwrite(&pixels[i * row_length + j], sizeof(png_byte), 3, output_file);
|
||||||
if(ret != 3)
|
if(ret != 3)
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
fclose(input_file);
|
fclose(input_file);
|
||||||
return WRITE_FAILED;
|
return -8; // failed writing to output file
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -243,5 +234,5 @@ int parse_png_for_content(const char *input_file_name, FILE *output_file)
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
fclose(input_file);
|
fclose(input_file);
|
||||||
|
|
||||||
return NO_ERROR;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
#include "errors.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
void print_error(const char *content)
|
|
||||||
{
|
|
||||||
printf("\033[31merror\033[m: %s\n", content);
|
|
||||||
}
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
#define ASSET_FILE_H
|
#define ASSET_FILE_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
typedef struct asset_header_def_t {
|
typedef struct asset_header_def_t {
|
||||||
|
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
#ifndef ERROR_H
|
|
||||||
#define ERROR_H
|
|
||||||
|
|
||||||
typedef enum error_t {
|
|
||||||
NO_ERROR,
|
|
||||||
NO_EXTENSION,
|
|
||||||
EXTENSION_UNSUPPORTED,
|
|
||||||
OPEN_FAILED,
|
|
||||||
WRITE_FAILED,
|
|
||||||
BAD_SIGNATURE,
|
|
||||||
MEMORY_ALLOC_FAILED,
|
|
||||||
|
|
||||||
// File-format specific errors
|
|
||||||
PNG_BIT_DEPTH_UNSUPPORTED,
|
|
||||||
PNG_COLOR_TYPE_UNSUPPORTED
|
|
||||||
} error_t;
|
|
||||||
|
|
||||||
void print_error(const char *content);
|
|
||||||
|
|
||||||
#endif // ERROR_H
|
|
||||||
|
|
@ -2,15 +2,22 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "asset_file.h"
|
#include "asset_file.h"
|
||||||
#include "errors.h"
|
|
||||||
|
void print_error(const char *content)
|
||||||
|
{
|
||||||
|
printf("\033[31merror\033[m: %s\n", content);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
int exit_status = EXIT_SUCCESS;
|
||||||
|
|
||||||
// Verify arguments minimum number.
|
// Verify arguments minimum number.
|
||||||
if(argc < 3)
|
if(argc < 3)
|
||||||
{
|
{
|
||||||
puts("\033[33musage\033[m: asset_builder output_file input_file [input_file_2 ...]");
|
puts("\033[33musage\033[m: asset_builder output_file input_file [input_file_2 ...]");
|
||||||
return EXIT_FAILURE;
|
exit_status = EXIT_FAILURE;
|
||||||
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Header size and content.
|
// Header size and content.
|
||||||
|
|
@ -45,7 +52,8 @@ int main(int argc, char *argv[])
|
||||||
if(!output_asset_file)
|
if(!output_asset_file)
|
||||||
{
|
{
|
||||||
print_error("could not create output file.");
|
print_error("could not create output file.");
|
||||||
return EXIT_FAILURE;
|
exit_status = EXIT_FAILURE;
|
||||||
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(size_t i = 0; i < asset_file_header.assets_number; i++)
|
for(size_t i = 0; i < asset_file_header.assets_number; i++)
|
||||||
|
|
@ -56,33 +64,41 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
switch(ret)
|
switch(ret)
|
||||||
{
|
{
|
||||||
case NO_EXTENSION:
|
case -1:
|
||||||
print_error("file does not have an extension."); break;
|
print_error("file does not have an extension.");
|
||||||
|
return -1;
|
||||||
|
|
||||||
case EXTENSION_UNSUPPORTED:
|
case -2:
|
||||||
print_error("extension not yet supported."); break;
|
print_error("extension not yet supported.");
|
||||||
|
return -1;
|
||||||
|
|
||||||
case OPEN_FAILED:
|
case -3:
|
||||||
print_error("failed to open file."); break;
|
print_error("failed to open file.");
|
||||||
|
return -1;
|
||||||
|
|
||||||
case BAD_SIGNATURE:
|
case -4:
|
||||||
print_error("file not valid."); break;
|
print_error("file not valid.");
|
||||||
|
return -1;
|
||||||
|
|
||||||
case MEMORY_ALLOC_FAILED:
|
case -5:
|
||||||
print_error("memory allocation failed."); break;
|
print_error("memory allocation failed.");
|
||||||
|
return -1;
|
||||||
|
|
||||||
case PNG_BIT_DEPTH_UNSUPPORTED:
|
case -6:
|
||||||
print_error("png bit depth not supported."); break;
|
print_error("png bit depth not supported.");
|
||||||
|
return -1;
|
||||||
|
|
||||||
case PNG_COLOR_TYPE_UNSUPPORTED:
|
case -7:
|
||||||
print_error("png color type not supported."); break;
|
print_error("png color type not supported.");
|
||||||
|
return -1;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
print_error("unknown error"); break;
|
print_error("unknown error");
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(output_asset_file);
|
exit_status = EXIT_FAILURE;
|
||||||
return EXIT_FAILURE;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate absolute position of assets in the file.
|
// Calculate absolute position of assets in the file.
|
||||||
|
|
@ -94,8 +110,8 @@ int main(int argc, char *argv[])
|
||||||
if(write_header_to_file(&asset_file_header, output_asset_file))
|
if(write_header_to_file(&asset_file_header, output_asset_file))
|
||||||
{
|
{
|
||||||
print_error("can't write to output file.");
|
print_error("can't write to output file.");
|
||||||
fclose(output_asset_file);
|
exit_status = EXIT_FAILURE;
|
||||||
return EXIT_FAILURE;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(size_t i = 0; i < asset_file_header.assets_number; i++)
|
for(size_t i = 0; i < asset_file_header.assets_number; i++)
|
||||||
|
|
@ -106,38 +122,42 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
switch(ret)
|
switch(ret)
|
||||||
{
|
{
|
||||||
case NO_EXTENSION:
|
case -3:
|
||||||
print_error("file does not have an extension."); break;
|
print_error("failed to open file.");
|
||||||
|
return -1;
|
||||||
|
|
||||||
case EXTENSION_UNSUPPORTED:
|
case -4:
|
||||||
print_error("extension not yet supported."); break;
|
print_error("file not valid.");
|
||||||
|
return -1;
|
||||||
|
|
||||||
case OPEN_FAILED:
|
case -5:
|
||||||
print_error("failed to open file."); break;
|
print_error("memory allocation failed.");
|
||||||
|
return -1;
|
||||||
|
|
||||||
case WRITE_FAILED:
|
case -6:
|
||||||
print_error("failed to write to output file."); break;
|
print_error("png bit depth not supported.");
|
||||||
|
return -1;
|
||||||
|
|
||||||
case BAD_SIGNATURE:
|
case -7:
|
||||||
print_error("file not valid."); break;
|
print_error("png color type not supported.");
|
||||||
|
return -1;
|
||||||
|
|
||||||
case MEMORY_ALLOC_FAILED:
|
case -8:
|
||||||
print_error("memory allocation failed."); break;
|
print_error("failed writing to output file.");
|
||||||
|
return -1;
|
||||||
case PNG_BIT_DEPTH_UNSUPPORTED:
|
|
||||||
print_error("png bit depth not supported."); break;
|
|
||||||
|
|
||||||
case PNG_COLOR_TYPE_UNSUPPORTED:
|
|
||||||
print_error("png color type not supported."); break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
print_error("unknown error"); break;
|
print_error("unknown error");
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(output_asset_file);
|
exit_status = EXIT_FAILURE;
|
||||||
return EXIT_FAILURE;
|
goto end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
end:
|
||||||
|
if(output_asset_file) fclose(output_asset_file);
|
||||||
|
|
||||||
|
return exit_status;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ count_src_build:
|
||||||
|
|
||||||
# Link game target
|
# Link game target
|
||||||
$(SOURCE_OUTPUT): $(SOURCE_OBJECTS) $(CORE_OUTPUT)
|
$(SOURCE_OUTPUT): $(SOURCE_OBJECTS) $(CORE_OUTPUT)
|
||||||
@echo -e "[100%] $(YELLOW)Linking $(notdir $(SOURCE_OUTPUT))$(RESET)"
|
@echo -e "[100%] $(YELLOW)Linking $(SOURCE_OUTPUT)$(RESET)"
|
||||||
$(Q)$(SRC_CC) $(SOURCE_OBJECTS) -L./$(BUILD_DIR) $(CORE_OUTPUT) $(CORE_DEPS_FLAGS) -o $@ $(SRC_LDFLAGS)
|
$(Q)$(SRC_CC) $(SOURCE_OBJECTS) -L./$(BUILD_DIR) $(CORE_OUTPUT) $(CORE_DEPS_FLAGS) -o $@ $(SRC_LDFLAGS)
|
||||||
|
|
||||||
# Build .o files
|
# Build .o files
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue