1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-26 19:52:11 +00:00

Compile time configurable menu logo

This commit is contained in:
Kostas Missos 2018-06-19 17:10:59 +03:00
parent 426551b9b7
commit 171e5ba30f
4 changed files with 50 additions and 10 deletions

View file

@ -42,7 +42,8 @@ OBJS = $(addprefix $(BUILD)/, \
OBJS += $(addprefix $(BUILD)/, diskio.o ff.o ffunicode.o) OBJS += $(addprefix $(BUILD)/, diskio.o ff.o ffunicode.o)
ARCH := -march=armv4t -mtune=arm7tdmi -mthumb -mthumb-interwork ARCH := -march=armv4t -mtune=arm7tdmi -mthumb -mthumb-interwork
CFLAGS = $(ARCH) -O2 -nostdlib -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-inline -std=gnu11 -Wall CUSTOMDEFINES = -DMENU_LOGO_ENABLE
CFLAGS = $(ARCH) -O2 -nostdlib -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-inline -std=gnu11 -Wall $(CUSTOMDEFINES)
LDFLAGS = $(ARCH) -nostartfiles -lgcc -Wl,--nmagic,--gc-sections LDFLAGS = $(ARCH) -nostartfiles -lgcc -Wl,--nmagic,--gc-sections
.PHONY: all clean .PHONY: all clean

View file

@ -17,14 +17,11 @@
#ifndef _HEKATE_LOGOS_H_ #ifndef _HEKATE_LOGOS_H_
#define _HEKATE_LOGOS_H_ #define _HEKATE_LOGOS_H_
#ifdef MENU_LOGO_ENABLE
//158 x 76 @24bpp RGB RAW positioned at 538 x 1180 //158 x 76 @24bpp RGB RAW positioned at 538 x 1180
#define X_HEKATE_LOGO 158 #define SZ_MENU_LOGO 36024
#define Y_HEKATE_LOGO 76 #define SZ_MENU_LOGOLZ 10993
#define X_POS_HEKATE_LOGO 538 static unsigned char Kc_MENU_LOGOlz[SZ_MENU_LOGOLZ] =
#define Y_POS_HEKATE_LOGO 1180
#define SZ_HEKATE_LOGO 36024
#define SZ_HEKATE_LOGOLZ 10993
static unsigned char Kc_HEKATE_LOGOlz[SZ_HEKATE_LOGOLZ] =
{ {
0xAE, 0x1B, 0x1B, 0x1B, 0xAE, 0x1B, 0x1B, 0x1B,
0x1B, 0xAE, 0x04, 0x04, 0xAE, 0x08, 0x08, 0xAE, 0x10, 0x10, 0xAE, 0x07, 0x07, 0x1C, 0x1B, 0x1B, 0x1B, 0xAE, 0x04, 0x04, 0xAE, 0x08, 0x08, 0xAE, 0x10, 0x10, 0xAE, 0x07, 0x07, 0x1C, 0x1B, 0x1B,
@ -715,13 +712,14 @@ static unsigned char Kc_HEKATE_LOGOlz[SZ_HEKATE_LOGOLZ] =
0x03, 0xAE, 0x81, 0x07, 0xB5, 0x0E, 0xAE, 0x82, 0x44, 0xBA, 0x13, 0xAE, 0x0C, 0x8C, 0x27, 0xAE, 0x03, 0xAE, 0x81, 0x07, 0xB5, 0x0E, 0xAE, 0x82, 0x44, 0xBA, 0x13, 0xAE, 0x0C, 0x8C, 0x27, 0xAE,
0x83, 0x4E, 0xBD, 0x6D, 0xAE, 0x0F, 0x8C, 0x4E, 0xAE, 0x83, 0x78, 0xC1, 0x74 0x83, 0x4E, 0xBD, 0x6D, 0xAE, 0x0F, 0x8C, 0x4E, 0xAE, 0x83, 0x78, 0xC1, 0x74
} ; } ;
#endif //MENU_LOGO_ENABLE
//68 x 192 @8bpp Grayscale RAW //68 x 192 @8bpp Grayscale RAW
#define X_BOOTLOGO 68 #define X_BOOTLOGO 68
#define Y_BOOTLOGO 192 #define Y_BOOTLOGO 192
#define SZ_BOOTLOGO 13056 #define SZ_BOOTLOGO 13056
#define SZ_BOOTLOGO_LZ 7826 #define SZ_BOOTLOGO_LZ 7826
unsigned char BOOTLOGO_LZ[SZ_BOOTLOGO_LZ] = static u8 BOOTLOGO_LZ[SZ_BOOTLOGO_LZ] =
{ {
0x00, 0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x04, 0x04, 0x00, 0x08, 0x08, 0x00, 0x10, 0x10, 0x00, 0x05, 0x00, 0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x04, 0x04, 0x00, 0x08, 0x08, 0x00, 0x10, 0x10, 0x00, 0x05,
0x05, 0x1C, 0x1E, 0x20, 0x1F, 0x1D, 0x00, 0x0B, 0x10, 0x1A, 0x00, 0x05, 0x05, 0x00, 0x05, 0x0B, 0x05, 0x1C, 0x1E, 0x20, 0x1F, 0x1D, 0x00, 0x0B, 0x10, 0x1A, 0x00, 0x05, 0x05, 0x00, 0x05, 0x0B,

View file

@ -67,6 +67,10 @@ sdmmc_storage_t sd_storage;
FATFS sd_fs; FATFS sd_fs;
int sd_mounted; int sd_mounted;
#ifdef MENU_LOGO_ENABLE
u8 *Kc_MENU_LOGO;
#endif //MENU_LOGO_ENABLE
int sd_mount() int sd_mount()
{ {
if (sd_mounted) if (sd_mounted)
@ -643,12 +647,18 @@ out:;
void reboot_normal() void reboot_normal()
{ {
sd_unmount(); sd_unmount();
#ifdef MENU_LOGO_ENABLE
free(Kc_MENU_LOGO);
#endif //MENU_LOGO_ENABLE
panic(0x21); // Bypass fuse programming in package1. panic(0x21); // Bypass fuse programming in package1.
} }
void reboot_rcm() void reboot_rcm()
{ {
sd_unmount(); sd_unmount();
#ifdef MENU_LOGO_ENABLE
free(Kc_MENU_LOGO);
#endif //MENU_LOGO_ENABLE
PMC(APBDEV_PMC_SCRATCH0) = 2; // Reboot into rcm. PMC(APBDEV_PMC_SCRATCH0) = 2; // Reboot into rcm.
PMC(0) |= 0x10; PMC(0) |= 0x10;
while (1) while (1)
@ -658,6 +668,9 @@ void reboot_rcm()
void power_off() void power_off()
{ {
sd_unmount(); sd_unmount();
#ifdef MENU_LOGO_ENABLE
free(Kc_MENU_LOGO);
#endif //MENU_LOGO_ENABLE
//TODO: we should probably make sure all regulators are powered off properly. //TODO: we should probably make sure all regulators are powered off properly.
i2c_send_byte(I2C_5, 0x3C, MAX77620_REG_ONOFFCNFG1, MAX77620_ONOFFCNFG1_PWR_OFF); i2c_send_byte(I2C_5, 0x3C, MAX77620_REG_ONOFFCNFG1, MAX77620_ONOFFCNFG1_PWR_OFF);
} }
@ -1269,9 +1282,17 @@ void launch_firmware()
gfx_printf(&gfx_con, "\nUsing default launch configuration...\n"); gfx_printf(&gfx_con, "\nUsing default launch configuration...\n");
sleep(3000000); sleep(3000000);
} }
#ifdef MENU_LOGO_ENABLE
free(Kc_MENU_LOGO);
#endif //MENU_LOGO_ENABLE
if (!hos_launch(cfg_sec)) if (!hos_launch(cfg_sec))
{
#ifdef MENU_LOGO_ENABLE
Kc_MENU_LOGO = (u8 *)malloc(36864);
LZ_Uncompress(Kc_MENU_LOGOlz, Kc_MENU_LOGO, SZ_MENU_LOGOLZ);
#endif //MENU_LOGO_ENABLE
EPRINTF("Failed to launch firmware."); EPRINTF("Failed to launch firmware.");
}
ini_free_section(cfg_sec); ini_free_section(cfg_sec);
@ -1527,6 +1548,10 @@ void ipl_main()
u32 *fb = display_init_framebuffer(); u32 *fb = display_init_framebuffer();
gfx_init_ctxt(&gfx_ctxt, fb, 720, 1280, 768); gfx_init_ctxt(&gfx_ctxt, fb, 720, 1280, 768);
gfx_clear_grey(&gfx_ctxt, 0x1B); gfx_clear_grey(&gfx_ctxt, 0x1B);
#ifdef MENU_LOGO_ENABLE
Kc_MENU_LOGO = (u8 *)malloc(36864);
LZ_Uncompress(Kc_MENU_LOGOlz, Kc_MENU_LOGO, SZ_MENU_LOGOLZ);
#endif //MENU_LOGO_ENABLE
gfx_con_init(&gfx_con, &gfx_ctxt); gfx_con_init(&gfx_con, &gfx_ctxt);
// Enable backlight after initializing gfx // Enable backlight after initializing gfx

View file

@ -18,6 +18,14 @@
#include "tui.h" #include "tui.h"
#include "btn.h" #include "btn.h"
#ifdef MENU_LOGO_ENABLE
extern u8 *Kc_MENU_LOGO;
#define X_MENU_LOGO 158
#define Y_MENU_LOGO 76
#define X_POS_MENU_LOGO 538
#define Y_POS_MENU_LOGO 1180
#endif //MENU_LOGO_ENABLE
void tui_pbar(gfx_con_t *con, int x, int y, u32 val, u32 fgcol, u32 bgcol) void tui_pbar(gfx_con_t *con, int x, int y, u32 val, u32 fgcol, u32 bgcol)
{ {
u32 cx, cy; u32 cx, cy;
@ -44,6 +52,10 @@ void *tui_do_menu(gfx_con_t *con, menu_t *menu)
int idx = 0, prev_idx = 0, cnt = 0x7FFFFFFF; int idx = 0, prev_idx = 0, cnt = 0x7FFFFFFF;
gfx_clear_grey(con->gfx_ctxt, 0x1B); gfx_clear_grey(con->gfx_ctxt, 0x1B);
#ifdef MENU_LOGO_ENABLE
gfx_set_rect_rgb(con->gfx_ctxt, Kc_MENU_LOGO,
X_MENU_LOGO, Y_MENU_LOGO, X_POS_MENU_LOGO, Y_POS_MENU_LOGO);
#endif //MENU_LOGO_ENABLE
while (1) while (1)
{ {
@ -126,6 +138,10 @@ void *tui_do_menu(gfx_con_t *con, menu_t *menu)
break; break;
} }
gfx_clear_grey(con->gfx_ctxt, 0x1B); gfx_clear_grey(con->gfx_ctxt, 0x1B);
#ifdef MENU_LOGO_ENABLE
gfx_set_rect_rgb(con->gfx_ctxt, Kc_MENU_LOGO,
X_MENU_LOGO, Y_MENU_LOGO, X_POS_MENU_LOGO, Y_POS_MENU_LOGO);
#endif //MENU_LOGO_ENABLE
} }
} }