Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))

export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
export INCLUDE := -I$(CURDIR)/mupdf/include \
$(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/mupdf/include \
-I$(CURDIR)/$(BUILD)

export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
Expand Down Expand Up @@ -201,10 +201,10 @@ $(BUILD): $(CURDIR)/lib/libmupdf.a
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

# Сборка libmupdf.a через Makefile.switch из корня проекта
# Сборка libmupdf.a через Makefile.mupdf из корня проекта
$(CURDIR)/lib/libmupdf.a:
@echo ">>> Сборка libmupdf.a ..."
@$(MAKE) -f $(CURDIR)/Makefile.switch
@$(MAKE) -f $(CURDIR)/Makefile.mupdf

#---------------------------------------------------------------------------------
clean:
Expand All @@ -218,12 +218,12 @@ endif
#---------------------------------------------------------------------------------
mupdf-clean:
@echo cleaning mupdf ...
@$(MAKE) -f $(CURDIR)/Makefile.switch clean
@$(MAKE) -f $(CURDIR)/Makefile.mupdf clean

#---------------------------------------------------------------------------------
# Ручная пересборка только libmupdf.a (без пересборки всего проекта)
mupdf:
@$(MAKE) -f $(CURDIR)/Makefile.switch
@$(MAKE) -f $(CURDIR)/Makefile.mupdf

#---------------------------------------------------------------------------------
else
Expand Down
2 changes: 2 additions & 0 deletions WookReader.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-CSn
/home/valen/.gemini/antigravity/scratch/levelr/WookReader/WookReader.elf
5 changes: 5 additions & 0 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
#define WOOK_READER_CONFIG_H

extern bool configDarkMode;
extern bool configStatusBar;
extern bool configScreenButtons;
extern bool configKeepZoom;
extern bool configKeepPosition;
extern bool configStatusBarPageTurn;

extern const char* configFile;

Expand Down
1 change: 1 addition & 0 deletions include/helpers/SDL_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ void SDL_DrawCircle(SDL_Renderer *renderer, int x, int y, int r, SDL_Color colou
void SDL_DrawText(SDL_Renderer *renderer, TTF_Font *font, int x, int y, SDL_Color colour, const char *text);
void SDL_DrawRotatedText(SDL_Renderer *renderer, TTF_Font *font, double rotation, int x, int y, SDL_Color colour, const char *text);
void SDL_DrawTextf(SDL_Renderer *renderer, TTF_Font *font, int x, int y, SDL_Color colour, const char* text, ...);
void SDL_DrawTextWrapped(SDL_Renderer *renderer, TTF_Font *font, int x, int y, int wrapWidth, int maxH, SDL_Color colour, const char *text);
void SDL_LoadImage(SDL_Texture **texture, char *path);
void SDL_LoadImageBuf(SDL_Renderer *renderer, SDL_Texture **texture, void *mem, int size);
void SDL_DrawImage(SDL_Renderer *renderer, SDL_Texture *texture, int x, int y);
Expand Down
Binary file added lib/libmupdf.a
Binary file not shown.
34 changes: 24 additions & 10 deletions source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ TTF_Font *ROBOTO_35, *ROBOTO_30, *ROBOTO_27, *ROBOTO_25, *ROBOTO_20, *ROBOTO_15;
bool configDarkMode;
bool configScreenButtons = false;
bool configStatusBar = true;
bool configKeepZoom = false;
bool configKeepPosition = false;
bool configStatusBarPageTurn = false;

void Term_Services() {
Log_Write("Terminate Services");
Expand Down Expand Up @@ -152,17 +155,22 @@ bool Init_Services() {
twiliInitialize();
#endif

// Однократная миграция: если /switch/eBookReader существует, а
// /switch/WookReader ещё нет — переименовываем папку целиком (books, configs,
// logs переезжают вместе).
// Однократная миграция: если /switch/eBookReader o /switch/WookReader existe, y
// /switch/WookReader no — reubicamos la carpeta para no perder la configuración/libros.
{
struct stat st_old, st_new;
bool old_exists =
(stat("/switch/eBookReader", &st_old) == 0 && S_ISDIR(st_old.st_mode));
struct stat st_old_eb, st_old_wook, st_new;
bool eb_exists =
(stat("/switch/eBookReader", &st_old_eb) == 0 && S_ISDIR(st_old_eb.st_mode));
bool wook_exists =
(stat("/switch/WookReader", &st_old_wook) == 0 && S_ISDIR(st_old_wook.st_mode));
bool new_exists =
(stat("/switch/WookReader", &st_new) == 0 && S_ISDIR(st_new.st_mode));
if (old_exists && !new_exists)
rename("/switch/eBookReader", "/switch/WookReader");
if (!new_exists) {
if (wook_exists)
rename("/switch/WookReader", "/switch/WookReader");
else if (eb_exists)
rename("/switch/eBookReader", "/switch/WookReader");
}
}

// Сначала создаём папку и открываем лог
Expand Down Expand Up @@ -202,8 +210,14 @@ bool Init_Services() {
}
Log_Write("Initialized Image");

// MuPDF context deferred to first PDF/EPUB/XPS open (BookReader.cpp)
Log_Write("MuPDF init deferred to first use");
// Initialize MuPDF context on startup so covers are rendered immediately in chooser
ctx = fz_new_context(NULL, NULL, 0);
if (ctx) {
fz_register_document_handlers(ctx);
Log_Write("Initialized MuPDF context on startup");
} else {
Log_Error("Failed to initialize MuPDF context on startup");
}

if (TTF_Init() == -1) {
Log_Error(std::string("TTF_Init failed: ") + TTF_GetError());
Expand Down
Loading