diff --git a/Makefile b/Makefile index 6b8bf9b..1e649e4 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ INCLUDES := include ./libs/log.c/src ./libs/mupdf/include ./libs/mupdf/source/fi ROMFS := romfs MAJOR := 0 -MINOR := 1 +MINOR := 2 MICRO := 0 APP_TITLE := EbookViewerNX diff --git a/include/cbr.h b/include/cbr.h index cc18249..302da4a 100644 --- a/include/cbr.h +++ b/include/cbr.h @@ -4,6 +4,14 @@ #include #include -bool extract_cbr(char *path); +typedef struct s_cbr +{ + struct archive *handle; + struct archive *dst; + int total_page; // total page number + char *path; +} t_cbr; + +bool extract_cbr(char *path, int page_number); #endif diff --git a/include/common.h b/include/common.h index e92e2b3..9b887ab 100644 --- a/include/common.h +++ b/include/common.h @@ -31,5 +31,6 @@ #include "controller.h" #include "init.h" #include "cbr.h" +#include "file.h" #endif diff --git a/include/ebook.h b/include/ebook.h index f97d9a8..60aa260 100644 --- a/include/ebook.h +++ b/include/ebook.h @@ -6,6 +6,7 @@ #define PORTRAIT false #define LANDSCAPE true #define CONFIG_PATH "/switch/ebookViewerNX/config" +#define EBOOK_PATH "/switch/ebookViewerNX/" typedef struct s_ebook { diff --git a/include/file.h b/include/file.h new file mode 100644 index 0000000..2d1264c --- /dev/null +++ b/include/file.h @@ -0,0 +1,7 @@ +#ifndef FILE_H +#define FILE_H + +bool isFileExist(const char *file); +char *get_file_extension(char *str); + +#endif diff --git a/include/graphic.h b/include/graphic.h index 07c9566..e241a5b 100644 --- a/include/graphic.h +++ b/include/graphic.h @@ -10,11 +10,14 @@ #define COVER_WIDTH 350 #define COVER_HEIGHT 500 -#define APP_NAME "ebookViewerNX v0.1" +#define APP_NAME "ebookViewerNX v0.2.0" #define COVER 0 #define READ 1 +#define DEFAULT 0 +#define CBR 1 + typedef struct s_ttf { TTF_Font *font_small; @@ -36,6 +39,7 @@ void print_help(void); void draw_bar(void); void draw_loading(void); void draw_error(char *msg); -void draw_page_number(void); +void draw_page_number(int type); +void draw_message_box(char *msg); #endif diff --git a/source/cbr.c b/source/cbr.c index 3e36994..850860d 100644 --- a/source/cbr.c +++ b/source/cbr.c @@ -1,34 +1,61 @@ #include "common.h" -static u64 count_files(const char *path) +extern t_cbr *cbr; + +static bool init_cbr(t_cbr *cbr, const char *path) { - struct archive *handle = NULL; - u64 count = 0; - int ret = 0; + int ret = 0; - handle = archive_read_new(); - if (handle == NULL) { - log_warn("%s", archive_error_string(handle)); - return (-1); + cbr->handle = archive_read_new(); + if (cbr->handle == NULL) { + log_warn("%s", archive_error_string(cbr->handle)); + return (false); + } + + cbr->dst = archive_write_disk_new(); + if (cbr->dst == NULL) { + log_warn("%s", archive_error_string(cbr->dst)); + return (false); } - ret = archive_read_support_format_all(handle); + ret = archive_read_support_format_all(cbr->handle); if (ret != ARCHIVE_OK) { - log_warn("%s", archive_error_string(handle)); - return (-1); + log_warn("%s", archive_error_string(cbr->handle)); + return (false); } - ret = archive_read_open_filename(handle, path, 1024); + ret = archive_read_open_filename(cbr->handle, path, 1024); if (ret != ARCHIVE_OK) { - printf("%s\n", archive_error_string(handle)); - printf("archive_read_open_filename%d\n", ret); - return 1; + log_warn("%s", archive_error_string(cbr->handle)); + return (false); + } + + log_info("init_cbr() [Success]"); + + return (true); +} + +static void deinit_cbr(t_cbr *cbr) +{ + archive_read_free(cbr->handle); + archive_write_free(cbr->dst); + + log_info("deinit_cbr() [Success]"); +} + +static u64 count_files(t_cbr *cbr, const char *path) +{ + int ret = 0; + size_t count = 0; + + if (init_cbr(cbr, path) == false) { + return (-1); } for (;;) { struct archive_entry *entry = NULL; - ret = archive_read_next_header(handle, &entry); + ret = archive_read_next_header(cbr->handle, &entry); if (ret == ARCHIVE_EOF) { break; } @@ -36,100 +63,182 @@ static u64 count_files(const char *path) count++; } - ret = archive_read_free(handle); + deinit_cbr(cbr); + log_info("count_files() [Success]"); return (count); } -typedef struct s_cbr +// TODO: review return value +static int write_data(t_cbr *cbr) { - struct archive *handle; - struct archive *dst; - u64 max; -} t_cbr; + int ret = 0; + size_t total_length = 0; -static bool init_cbr(t_cbr *cbr, char *path) -{ - int ret = 0; + for (;;) { + const void *chunk = NULL; + size_t length = 0; + s64 offset = 0; - cbr->handle = archive_read_new(); - if (cbr->handle == NULL) { - log_warn("%s", archive_error_string(cbr->handle)); - return (false); + ret = archive_read_data_block(cbr->handle, &chunk, &length, &offset); + if (ret == ARCHIVE_EOF) + return ARCHIVE_OK; + + if (ret != ARCHIVE_OK) + return ret; + + ret = archive_write_data_block(cbr->dst, chunk, length, offset); + if (ret != ARCHIVE_OK) + return ret; } - cbr->dst = archive_write_disk_new(); - if (cbr->handle == NULL) { - log_warn("%s", archive_error_string(cbr->handle)); - return (false); + log_info("write_data() [Success]"); + return -1; +} + +static int myCompare(const void* a, const void* b) +{ + return (strcmp(*(const char**)a, *(const char**)b)); +} + +char **get_archive_content_file_name(char *path, t_cbr *cbr) +{ + u64 count = 0; + int ret = 0; + char **array = NULL; + + array = (char **)calloc(sizeof(char *), cbr->total_page + 1); + if (array == NULL) { + log_warn("calloc error\n"); + return (NULL); } - ret = archive_read_support_format_all(cbr->handle); - if (ret != ARCHIVE_OK) { - log_warn("%s", archive_error_string(cbr->handle)); - return (false); + if (init_cbr(cbr, path) == false) { + return (NULL); } - ret = archive_read_open_filename(cbr->handle, path, 1024); - if (ret != ARCHIVE_OK) { - log_warn("%s", archive_error_string(cbr->handle)); - return (false); + for (;;) { + struct archive_entry *entry = NULL; + + ret = archive_read_next_header(cbr->handle, &entry); + if (ret == ARCHIVE_EOF) { + break; + } + + const char *entry_path = archive_entry_pathname(entry); + if (entry_path == NULL) { + log_warn("%s", archive_error_string(cbr->handle)); + break ; + } + array[count] = strdup(entry_path); + + count++; } - return (true); + deinit_cbr(cbr); + + // Sort files name + qsort(array, cbr->total_page, sizeof(const char *), myCompare); + + log_info("get_archive_content_file_name() [Success]"); + + return (array); } -bool extract_cbr(char *path) +bool extract_cbr(char *path, int page_number) { - t_cbr cbr = {0}; + char **array = NULL; int ret = 0; + u64 count = 0; - cbr.max = count_files(path); + // create temp directory + if (isFileExist("/tmp") == false) { + if (mkdir("/tmp", 0777) == -1) { + log_warn("%s", strerror(errno)); + return (false); + } + } - if (init_cbr(&cbr, path) == false) { + // Count files number in archive + cbr->total_page = count_files(cbr, path); + if (page_number > cbr->total_page) { + log_warn("page %d not exist", page_number); + return (false); + } else if (cbr->total_page == -1) { + log_warn("count_files [Failure]"); return (false); } - mkdir("/tmp", 0777); + // Sort and store all filename in char ** + array = get_archive_content_file_name(path, cbr); + if (array == NULL) { + return (false); + } + + if (init_cbr(cbr, path) == false) { + free_2d_array(array); + return (false); + } for (;;) { - struct archive_entry *entry = NULL; - ret = archive_read_next_header(handle, &cbr.entry); + struct archive_entry *entry = NULL; + + ret = archive_read_next_header(cbr->handle, &entry); if (ret == ARCHIVE_EOF) { break; - } - - if (ret != ARCHIVE_OK) { - Menu_DisplayError("archive_read_next_header failed:", ret); + } else if (ret != ARCHIVE_OK) { + log_warn("%s", archive_error_string(cbr->handle)); if (ret != ARCHIVE_WARN) { break; } } const char *entry_path = archive_entry_pathname(entry); - char new_path[1024]; - - ret = snprintf(new_path, sizeof(new_path), "%s/%s", dest_path, entry_path); - ret = archive_entry_update_pathname_utf8(entry, new_path); - if (!ret) { - Menu_DisplayError("archive_entry_update_pathname_utf8:", ret); - break; + if (entry_path == NULL) { + log_warn("%s", archive_error_string(cbr->handle)); + ret = -1; + break ; } - ret = archive_write_disk_set_options(dst, ARCHIVE_EXTRACT_UNLINK); - ret = archive_write_header(dst, entry); - if (ret != ARCHIVE_OK) { - Menu_DisplayError("archive_write_header failed:", ret); - break; + if (!strcmp(array[page_number], entry_path)) { + cbr->path = (char *)calloc(sizeof(char), PATH_MAX + 1); + if (cbr->path == NULL) { + free_2d_array(array); + deinit_cbr(cbr); + return (false); + } + + snprintf(cbr->path, PATH_MAX, "%s/%s", EBOOK_PATH, entry_path); + + if (isFileExist(cbr->path) == false) { + ret = archive_entry_update_pathname_utf8(entry, cbr->path); + if (!ret) { + log_warn("%s", archive_error_string(cbr->handle)); + break; + } + + ret = archive_write_disk_set_options(cbr->dst, ARCHIVE_EXTRACT_UNLINK); + ret = archive_write_header(cbr->dst, entry); + if (ret != ARCHIVE_OK) { + log_warn("%s", archive_error_string(cbr->handle)); + break; + } + + ret = write_data(cbr); + ret = archive_write_finish_entry(cbr->dst); + + ret = write_data(cbr); + } + + break ; } - ret = Archive_WriteData(handle, dst); - ret = archive_write_finish_entry(dst); count++; } - ret = archive_write_free(cbr.dst); - ret = archive_read_free(cbr.handle); + free_2d_array(array); + deinit_cbr(cbr); + log_info("extract_cbr() [Success]"); return (true); } diff --git a/source/ebook.c b/source/ebook.c index 087cdd7..7d4881e 100644 --- a/source/ebook.c +++ b/source/ebook.c @@ -5,6 +5,7 @@ extern t_ebook *ebook; extern t_transform *trans; extern t_controller *controller; extern t_layout *layout; +extern t_cbr *cbr; bool init_mupdf(void) { @@ -94,13 +95,13 @@ static bool render_page(char *book, int current_page) { char *path = NULL; - path = (char *)calloc(sizeof(char) , strlen("/switch/ebookViewerNX/") + strlen(book) + 1); + path = (char *)calloc(sizeof(char) , strlen(EBOOK_PATH) + strlen(book) + 1); if (path == NULL) { log_fatal("calloc [Failure]"); return (false); } - strcat(path, "/switch/ebookViewerNX/"); + strcat(path, EBOOK_PATH); strcat(path, book); init_mupdf(); @@ -162,7 +163,7 @@ void save_last_page(char *book, int current_page) return ; } - fd_tmp = open("/tmp", O_CREAT | O_RDWR | O_TRUNC, 0777); + fd_tmp = open(EBOOK_PATH"tmp", O_CREAT | O_RDWR | O_TRUNC, 0777); if (fd_tmp == -1) { log_warn("open : %s", strerror(errno)); close(fd); @@ -195,7 +196,7 @@ void save_last_page(char *book, int current_page) if (remove(CONFIG_PATH) == -1) { log_warn("%s", strerror(errno)); } else { - if (rename("/tmp", CONFIG_PATH) == -1) { + if (rename(EBOOK_PATH"tmp", CONFIG_PATH) == -1) { log_warn("%s", strerror(errno)); } } @@ -203,10 +204,76 @@ void save_last_page(char *book, int current_page) log_info("save_last_page() [Success]"); } +void render_cbr_page(char *book, int last_page) +{ + SDL_Surface *image = NULL; + SDL_Texture *texture = NULL; + char cbr_path[PATH_MAX] = {0}; + float ratio = 0; + + // get path + sprintf(cbr_path, EBOOK_PATH"%s", book); + + if (extract_cbr(cbr_path, last_page) == false) { + log_warn("extract_cbr() [Failure]"); + return ; + } + + image = IMG_Load(cbr->path); + if (image == NULL) { + log_warn("%s", IMG_GetError()); + return ; + } + + texture = SDL_CreateTextureFromSurface(graphic->renderer, image); + if (texture == NULL) { + log_warn("%s", IMG_GetError()); + return ; + } + + if (ebook->layout_orientation == PORTRAIT) { + ratio = (float)image->w / (float)WIN_HEIGHT; + + layout->cover.h = image->h / ratio; + layout->cover.w = image->w / ratio; + layout->cover.x = (WIN_WIDTH / 2) - (layout->cover.w / 2); + layout->cover.y = (WIN_HEIGHT /2) - (layout->cover.h / 2); + } else if (ebook->layout_orientation == LANDSCAPE) { + ratio = (float)image->h / (float)WIN_HEIGHT; + + layout->cover.h = image->h / ratio; + layout->cover.w = image->w / ratio; + layout->cover.x = (WIN_WIDTH / 2) - (layout->cover.w / 2); + layout->cover.y = 0; + } + + SDL_FreeSurface(image); + + SDL_SetRenderDrawColor(graphic->renderer, 40, 40, 40, SDL_ALPHA_OPAQUE); + SDL_RenderClear(graphic->renderer); + + // Render cover + if (ebook->layout_orientation == PORTRAIT) { + SDL_RenderCopyEx(graphic->renderer, texture, NULL, &(layout->cover), 90, NULL, SDL_FLIP_NONE); + } else { + SDL_RenderCopyEx(graphic->renderer, texture, NULL, &(layout->cover), 0, NULL, SDL_FLIP_NONE); + } + + SDL_DestroyTexture(texture); + + remove(cbr->path); + + free(cbr->path); + cbr->path = NULL; +} + void ebook_reader(char *book) { bool refresh = true; bool help = false; + char *ext = NULL; + + ext = get_file_extension(book); ebook->read_mode = true; while (appletMainLoop()) { @@ -260,8 +327,12 @@ void ebook_reader(char *book) // printing if (refresh == true) { /*draw_loading();*/ - if (render_page(book, ebook->last_page) == false) { - break ; + if (!strcmp(ext, ".cbr")) { + render_cbr_page(book, ebook->last_page); + } else { + if (render_page(book, ebook->last_page) == false) { + break ; + } } if (layout->show_bar == true) { draw_bar(); diff --git a/source/file.c b/source/file.c new file mode 100644 index 0000000..9e07246 --- /dev/null +++ b/source/file.c @@ -0,0 +1,28 @@ +#include "common.h" + +char *get_file_extension(char *str) +{ + char *ext = NULL; + + if (str == NULL) { + return (NULL); + } + + ext = strrchr(str, '.'); + if (ext == NULL) { + return (NULL); + } + + return (ext); +} + +bool isFileExist(const char *file) +{ + struct stat st = {0}; + + if (stat(file, &st) == -1) { + return (false); + } + + return (true); +} diff --git a/source/graphic.c b/source/graphic.c index 0d1ddcc..ee5f201 100644 --- a/source/graphic.c +++ b/source/graphic.c @@ -4,6 +4,7 @@ extern t_graphic *graphic; extern t_transform *trans; extern t_ebook *ebook; extern t_layout *layout; +extern t_cbr *cbr; void draw_ppm(fz_pixmap *ppm, bool cover) { @@ -72,6 +73,63 @@ static void draw_text(SDL_Renderer *renderer, int x, int y, char *text, TTF_Font log_info("draw_text() [Success]"); } +void draw_cover_cbr(char *book) +{ + SDL_Surface *image = NULL; + SDL_Texture *texture = NULL; + char cbr_path[PATH_MAX] = {0}; + + // get path + sprintf(cbr_path, EBOOK_PATH"%s", book); + + // save image cover in /tmp + if (extract_cbr(cbr_path, 0) == false) { + log_warn("extract_cbr() [Failure]"); + return ; + } + + image = IMG_Load(cbr->path); + if (image == NULL) { + log_warn("%s", IMG_GetError()); + return ; + } + + texture = SDL_CreateTextureFromSurface(graphic->renderer, image); + if (texture == NULL) { + log_warn("%s", IMG_GetError()); + return ; + } + + SDL_FreeSurface(image); + + if (ebook->layout_orientation == LANDSCAPE) { + layout->cover.w = COVER_WIDTH; + layout->cover.h = COVER_HEIGHT; + layout->cover.x = (WIN_WIDTH / 2) - (COVER_WIDTH / 2); + layout->cover.y = (WIN_HEIGHT / 2) - (COVER_HEIGHT / 2) + 20; + } else { + layout->cover.w = COVER_WIDTH * 1.5; + layout->cover.h = COVER_HEIGHT * 1.5; + layout->cover.x = (WIN_WIDTH / 2) - (layout->cover.w / 2); + layout->cover.y = (WIN_HEIGHT / 2) - (layout->cover.h / 2) + 10; + } + + // Render cover + SDL_RenderCopy(graphic->renderer, texture, NULL, &layout->cover); + SDL_DestroyTexture(texture); + + // Draw rect around cover + SDL_SetRenderDrawColor(graphic->renderer, 0, 255, 0, SDL_ALPHA_OPAQUE); + SDL_RenderDrawRect(graphic->renderer, &layout->cover); + + remove(cbr->path); + + free(cbr->path); + cbr->path = NULL; + + log_info("print_cover_cbr() [Success]"); +} + static bool draw_cover(char *book) { char path[PATH_MAX] = {0}; @@ -329,7 +387,7 @@ void draw_bar(void) if (ebook->read_mode == false) { draw_app_name(); } else { - draw_page_number(); + draw_page_number(DEFAULT); } draw_exit_button(); draw_help_button(); @@ -338,18 +396,22 @@ void draw_bar(void) log_info("draw_bar() [Success]"); } -void draw_page_number(void) +void draw_page_number(int type) { SDL_Color color = {255, 255, 255, 255}; - char page_number[20] = {0}; SDL_Rect rect = {0}; + char page_number[20] = {0}; int x = 0; int w = 0; int h = 0; float percentage = 0; // Draw page number - sprintf(page_number, "%d/%d", ebook->last_page + 1, ebook->total_page); + if (type == CBR) { + sprintf(page_number, "%d/%d", ebook->last_page + 1, cbr->total_page); + } else { + sprintf(page_number, "%d/%d", ebook->last_page + 1, ebook->total_page); + } TTF_SizeText(graphic->ttf->font_medium, page_number, &w, &h); x = (WIN_WIDTH / 2) - (w / 2); @@ -425,6 +487,7 @@ void print_help(void) void draw_home_menu(char *book) { + char *ext = NULL; SDL_SetRenderDrawColor(graphic->renderer, 40, 40, 40, 255); SDL_RenderClear(graphic->renderer); @@ -435,16 +498,25 @@ void draw_home_menu(char *book) draw_title(book); // Draw Cover - if (draw_cover(book) == false) { - deinit_mupdf(); + ext = get_file_extension(book); + if (ext == NULL) { return ; } + if (!strcmp(ext, ".cbr")) { + draw_cover_cbr(book); + draw_page_number(CBR); + } else { + if (draw_cover(book) == false) { + deinit_mupdf(); + return ; + } + // Draw Page number + count_page_number(); + draw_page_number(DEFAULT); - // Draw Page number - count_page_number(); - draw_page_number(); + deinit_mupdf(); + } - deinit_mupdf(); log_info("draw_home_menu() [Success]"); } @@ -466,6 +538,41 @@ void draw_loading(void) log_info("draw_loading() [Success]"); } +// TODO: refactor this func +void draw_message_box(char *msg) +{ + SDL_Color color = {255, 255, 255, 255}; + SDL_Rect rect = { + (WIN_WIDTH / 2) - 300, + (WIN_HEIGHT / 2) - 150, + 600, + 300 + }; + int w = 0; + int h = 0; + + SDL_SetRenderDrawColor(graphic->renderer, 60, 60, 60, SDL_ALPHA_OPAQUE); + /*SDL_RenderClear(graphic->renderer);*/ + + SDL_RenderFillRect(graphic->renderer, &rect); + TTF_SizeText(graphic->ttf->font_small, msg, &w, &h); + + draw_text(graphic->renderer, (WIN_WIDTH / 2) - (w / 2), (WIN_HEIGHT / 2) - (h / 2), msg, graphic->ttf->font_small, color, 0); + + while (appletMainLoop()) { + hidScanInput(); + + u64 kDown = hidKeysDown(CONTROLLER_P1_AUTO); + + if (kDown & KEY_PLUS) { + break ; + } + + SDL_RenderPresent(graphic->renderer); + } + +} + void draw_error(char *msg) { SDL_Color color = {255, 255, 255, 255}; diff --git a/source/home.c b/source/home.c index d7e72b5..482e5d0 100644 --- a/source/home.c +++ b/source/home.c @@ -21,7 +21,7 @@ static int count_files_number(void) while ((entry = readdir(dir)) != NULL) { if (entry->d_type == DT_REG) { ext = strrchr(entry->d_name, '.'); - if (ext != NULL && (!strcmp(ext, ".pdf") || !strcmp(ext, ".epub") || !strcmp(ext, ".cbz"))) { + if (ext != NULL && ( !strcmp(ext, ".pdf") || !strcmp(ext, ".epub") || !strcmp(ext, ".cbz") || !strcmp(ext, ".cbr"))) { nb++; } } @@ -62,7 +62,7 @@ static char **get_ebook_list(void) for (int i = 0; (entry = readdir(dir)) != NULL;) { if (entry->d_type == DT_REG) { ext = strrchr(entry->d_name, '.'); - if (ext != NULL && ( !strcmp(ext, ".pdf") || !strcmp(ext, ".epub") || !strcmp(ext, ".cbz"))) { + if (ext != NULL && ( !strcmp(ext, ".pdf") || !strcmp(ext, ".epub") || !strcmp(ext, ".cbz") || !strcmp(ext, ".cbr"))) { file_list[i] = strdup(entry->d_name); i++; } diff --git a/source/init.c b/source/init.c index 34717f4..34f9b6b 100644 --- a/source/init.c +++ b/source/init.c @@ -5,14 +5,15 @@ extern t_transform *trans; extern t_ebook *ebook; extern t_controller *controller; extern t_layout *layout; +extern t_cbr *cbr; static void create_requiered_folder(void) { - if (mkdir("/switch/ebookViewerNX", 0777) != -1) { + if (mkdir(EBOOK_PATH, 0777) != -1) { log_info("/switch/ebookViewerNX created !"); } - int fd = open("/switch/ebookViewerNX/config", O_CREAT, 0777); + int fd = open(EBOOK_PATH"config", O_CREAT, 0777); if (fd == -1) { log_warn("create config failed : %s", strerror(errno)); } @@ -44,13 +45,15 @@ void init_all(void) controller = (t_controller *)calloc(sizeof(t_controller), 1); layout = (t_layout *)calloc(sizeof(t_layout), 1); trans = (t_transform *)calloc(sizeof(t_transform), 1); - if (graphic == NULL || graphic->ttf == NULL || ebook == NULL || controller == NULL || layout == NULL || trans == NULL) { + cbr = (t_cbr *)calloc(sizeof(t_cbr), 1); + if (graphic == NULL || graphic->ttf == NULL || ebook == NULL || controller == NULL || layout == NULL || trans == NULL || cbr == NULL) { free(graphic); free(graphic->ttf); free(ebook); free(controller); free(layout); free(trans); + free(cbr); log_fatal("init_all() : calloc [Failure]"); exit (-1); } @@ -70,6 +73,8 @@ void init_all(void) } create_requiered_folder(); + + log_info("init_all() [Success]"); } void deinit_all(void) @@ -94,6 +99,8 @@ void deinit_all(void) #ifdef __TWILI__ twiliExit(); #endif + + log_info("deinit_all() [Success]"); } bool init_ttf(void) @@ -138,7 +145,7 @@ bool init_graphic(void) free(graphic); return (false); } - if (IMG_Init(IMG_INIT_PNG) < 0) { + if (IMG_Init(IMG_INIT_PNG | IMG_INIT_JPG) < 0) { log_fatal("IMG_Init(): %s\n", IMG_GetError()); SDL_Quit(); free(graphic); diff --git a/source/main.c b/source/main.c index ac314cb..f7aea3c 100644 --- a/source/main.c +++ b/source/main.c @@ -7,15 +7,15 @@ t_transform *trans = NULL; t_ebook *ebook = NULL; t_controller *controller = NULL; t_layout *layout = NULL; +t_cbr *cbr = NULL; int main(void) { init_all(); - /*extract_cbr("/a.cbr");*/ - lblInitialize(); - lblSetCurrentBrightnessSetting(1.0); - lblExit(); + /*lblInitialize();*/ + /*lblSetCurrentBrightnessSetting(1.0);*/ + /*lblExit();*/ home_page();