mirror of
https://github.com/encounter/Decrypt9.git
synced 2026-03-30 11:06:30 -07:00
52 lines
1.9 KiB
C
52 lines
1.9 KiB
C
#include "theme.h"
|
|
#ifdef USE_THEME
|
|
#include "fs.h"
|
|
#include "decryptor/nand.h"
|
|
|
|
bool ImportFrameBuffer(const char* path, u32 use_top) {
|
|
u32 bufsize = BYTES_PER_PIXEL * SCREEN_HEIGHT * ((use_top) ? SCREEN_WIDTH_TOP : SCREEN_WIDTH_BOT);
|
|
u8* buffer0 = (use_top) ? TOP_SCREEN0 : BOT_SCREEN0;
|
|
u8* buffer1 = (use_top) ? TOP_SCREEN1 : BOT_SCREEN1;
|
|
bool result;
|
|
|
|
if (!FileOpen(path)) return false;
|
|
result = FileRead(buffer0, bufsize, 0);
|
|
memcpy(buffer1, buffer0, bufsize);
|
|
FileClose();
|
|
|
|
return result;
|
|
}
|
|
|
|
void LoadThemeGfx(const char* filename, bool use_top) {
|
|
char path[256];
|
|
#ifdef APP_TITLE
|
|
snprintf(path, 256, "//3ds/%s/UI/%s", APP_TITLE, filename);
|
|
if (ImportFrameBuffer(path, use_top)) return;
|
|
#endif
|
|
snprintf(path, 256, "//%s/%s", USE_THEME, filename);
|
|
if (!ImportFrameBuffer(path, use_top))
|
|
DrawStringF(10, 230, true, "Not found: %s", filename);
|
|
}
|
|
|
|
void LoadThemeGfxMenu(u32 index) {
|
|
char filename[16];
|
|
snprintf(filename, 16, "menu%04lu.bin", index);
|
|
LoadThemeGfx(filename, !LOGO_TOP); // this goes where the logo goes not
|
|
}
|
|
|
|
void LoadThemeGfxLogo(void) {
|
|
LoadThemeGfx(GFX_LOGO, LOGO_TOP);
|
|
#if defined LOGO_TEXT_X && defined LOGO_TEXT_Y
|
|
u32 emunand_state = CheckEmuNand();
|
|
DrawStringF(LOGO_TEXT_X, LOGO_TEXT_Y - 8, LOGO_TOP, "SD card: %lluMB/%lluMB & %s", RemainingStorageSpace() / 1024 / 1024, TotalStorageSpace() / 1024 / 1024, (emunand_state == EMUNAND_READY) ? "EmuNAND ready" : (emunand_state == EMUNAND_GATEWAY) ? "GW EmuNAND" : (emunand_state == EMUNAND_REDNAND) ? "RedNAND" : "no EmuNAND");
|
|
DrawStringF(LOGO_TEXT_X + 56, LOGO_TEXT_Y - 28, LOGO_TOP, "Game directory: %s", GAME_DIR);
|
|
#ifdef WORK_DIR
|
|
if (DirOpen(WORK_DIR)) {
|
|
DrawStringF(LOGO_TEXT_X + 48, LOGO_TEXT_Y - 18, LOGO_TOP, "Work directory: %s", WORK_DIR);
|
|
DirClose();
|
|
}
|
|
#endif
|
|
#endif
|
|
}
|
|
#endif
|