2018-06-21 07:42:46 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#ifndef __UI_H__
|
|
|
|
#define __UI_H__
|
|
|
|
|
2019-04-21 17:27:33 +01:00
|
|
|
#define FB_WIDTH 1280
|
|
|
|
#define FB_HEIGHT 720
|
|
|
|
|
|
|
|
#define CHAR_PT_SIZE 12
|
|
|
|
#define SCREEN_DPI_CNT 96
|
|
|
|
|
|
|
|
#define BG_COLOR_RGB 50
|
|
|
|
|
|
|
|
#define HIGHLIGHT_BG_COLOR_R 33
|
|
|
|
#define HIGHLIGHT_BG_COLOR_G 34
|
|
|
|
#define HIGHLIGHT_BG_COLOR_B 39
|
|
|
|
|
|
|
|
#define HIGHLIGHT_FONT_COLOR_R 0
|
|
|
|
#define HIGHLIGHT_FONT_COLOR_G 255
|
|
|
|
#define HIGHLIGHT_FONT_COLOR_B 197
|
|
|
|
|
2019-06-20 04:56:14 +01:00
|
|
|
// UTF-8
|
|
|
|
#define UPWARDS_ARROW "\xE2\x86\x91"
|
|
|
|
#define DOWNWARDS_ARROW "\xE2\x86\x93"
|
|
|
|
|
2019-06-28 21:13:54 +01:00
|
|
|
#define COMMON_MAX_ELEMENTS 9
|
2019-06-05 23:44:18 +01:00
|
|
|
#define HFS0_MAX_ELEMENTS 14
|
|
|
|
#define ROMFS_MAX_ELEMENTS 12
|
2019-06-20 04:56:14 +01:00
|
|
|
#define SDCARD_MAX_ELEMENTS 3
|
2019-06-09 02:36:21 +01:00
|
|
|
#define ORPHAN_MAX_ELEMENTS 12
|
2019-06-05 23:44:18 +01:00
|
|
|
|
2019-06-20 04:56:14 +01:00
|
|
|
#define OPTIONS_X_START_POS (35 * CHAR_PT_SIZE)
|
|
|
|
#define OPTIONS_X_END_POS (OPTIONS_X_START_POS + (6 * CHAR_PT_SIZE))
|
|
|
|
#define OPTIONS_X_END_POS_NSP (FB_WIDTH - (4 * CHAR_PT_SIZE))
|
2019-04-21 17:27:33 +01:00
|
|
|
|
|
|
|
#define TAB_WIDTH 4
|
2018-06-21 07:42:46 +01:00
|
|
|
|
2019-06-05 23:44:18 +01:00
|
|
|
#define BROWSER_ICON_DIMENSION 16
|
|
|
|
|
2019-06-20 04:56:14 +01:00
|
|
|
// UTF-16
|
2019-06-05 23:44:18 +01:00
|
|
|
#define NINTENDO_FONT_A "\xE0\xA0"
|
|
|
|
#define NINTENDO_FONT_B "\xE0\xA1"
|
2019-06-28 21:13:54 +01:00
|
|
|
#define NINTENDO_FONT_X "\xE0\xA2"
|
2019-06-09 02:36:21 +01:00
|
|
|
#define NINTENDO_FONT_Y "\xE0\xA3"
|
2019-06-05 23:44:18 +01:00
|
|
|
#define NINTENDO_FONT_L "\xE0\xA4"
|
|
|
|
#define NINTENDO_FONT_R "\xE0\xA5"
|
|
|
|
#define NINTENDO_FONT_ZL "\xE0\xA6"
|
|
|
|
#define NINTENDO_FONT_ZR "\xE0\xA7"
|
|
|
|
#define NINTENDO_FONT_DPAD "\xE0\xAA"
|
|
|
|
#define NINTENDO_FONT_PLUS "\xE0\xB5"
|
|
|
|
#define NINTENDO_FONT_HOME "\xE0\xB9"
|
|
|
|
#define NINTENDO_FONT_LSTICK "\xE0\xC1"
|
|
|
|
#define NINTENDO_FONT_RSTICK "\xE0\xC2"
|
|
|
|
|
2018-06-21 07:42:46 +01:00
|
|
|
typedef enum {
|
2019-04-21 17:27:33 +01:00
|
|
|
resultNone,
|
|
|
|
resultShowMainMenu,
|
2019-06-09 02:36:21 +01:00
|
|
|
resultShowGameCardMenu,
|
2019-04-21 17:27:33 +01:00
|
|
|
resultShowXciDumpMenu,
|
|
|
|
resultDumpXci,
|
2019-05-01 21:24:13 +01:00
|
|
|
resultShowNspDumpMenu,
|
2019-06-05 23:44:18 +01:00
|
|
|
resultShowNspAppDumpMenu,
|
|
|
|
resultShowNspPatchDumpMenu,
|
|
|
|
resultShowNspAddOnDumpMenu,
|
2019-05-01 21:24:13 +01:00
|
|
|
resultDumpNsp,
|
2019-06-05 23:44:18 +01:00
|
|
|
resultShowHfs0Menu,
|
|
|
|
resultShowRawHfs0PartitionDumpMenu,
|
|
|
|
resultDumpRawHfs0Partition,
|
|
|
|
resultShowHfs0PartitionDataDumpMenu,
|
|
|
|
resultDumpHfs0PartitionData,
|
|
|
|
resultShowHfs0BrowserMenu,
|
|
|
|
resultHfs0BrowserGetList,
|
|
|
|
resultShowHfs0Browser,
|
|
|
|
resultHfs0BrowserCopyFile,
|
2019-06-09 02:36:21 +01:00
|
|
|
resultShowExeFsMenu,
|
|
|
|
resultShowExeFsSectionDataDumpMenu,
|
|
|
|
resultDumpExeFsSectionData,
|
|
|
|
resultShowExeFsSectionBrowserMenu,
|
|
|
|
resultExeFsSectionBrowserGetList,
|
|
|
|
resultShowExeFsSectionBrowser,
|
|
|
|
resultExeFsSectionBrowserCopyFile,
|
2019-06-05 23:44:18 +01:00
|
|
|
resultShowRomFsMenu,
|
|
|
|
resultShowRomFsSectionDataDumpMenu,
|
|
|
|
resultDumpRomFsSectionData,
|
|
|
|
resultShowRomFsSectionBrowserMenu,
|
|
|
|
resultRomFsSectionBrowserGetEntries,
|
|
|
|
resultShowRomFsSectionBrowser,
|
|
|
|
resultRomFsSectionBrowserChangeDir,
|
|
|
|
resultRomFsSectionBrowserCopyFile,
|
2019-06-28 21:13:54 +01:00
|
|
|
resultRomFsSectionBrowserCopyDir,
|
2019-04-21 17:27:33 +01:00
|
|
|
resultDumpGameCardCertificate,
|
2019-06-09 02:36:21 +01:00
|
|
|
resultShowSdCardEmmcMenu,
|
|
|
|
resultShowSdCardEmmcTitleMenu,
|
|
|
|
resultShowSdCardEmmcOrphanPatchAddOnMenu,
|
2019-06-28 21:13:54 +01:00
|
|
|
resultShowSdCardEmmcBatchModeMenu,
|
|
|
|
resultSdCardEmmcBatchDump,
|
2019-06-05 23:44:18 +01:00
|
|
|
resultShowUpdateMenu,
|
2019-04-21 17:27:33 +01:00
|
|
|
resultUpdateNSWDBXml,
|
|
|
|
resultUpdateApplication,
|
|
|
|
resultExit
|
2018-06-21 07:42:46 +01:00
|
|
|
} UIResult;
|
|
|
|
|
|
|
|
typedef enum {
|
2019-04-21 17:27:33 +01:00
|
|
|
stateMainMenu,
|
2019-06-09 02:36:21 +01:00
|
|
|
stateGameCardMenu,
|
2019-04-21 17:27:33 +01:00
|
|
|
stateXciDumpMenu,
|
|
|
|
stateDumpXci,
|
2019-05-01 21:24:13 +01:00
|
|
|
stateNspDumpMenu,
|
2019-06-05 23:44:18 +01:00
|
|
|
stateNspAppDumpMenu,
|
|
|
|
stateNspPatchDumpMenu,
|
|
|
|
stateNspAddOnDumpMenu,
|
2019-05-01 21:24:13 +01:00
|
|
|
stateDumpNsp,
|
2019-06-05 23:44:18 +01:00
|
|
|
stateHfs0Menu,
|
|
|
|
stateRawHfs0PartitionDumpMenu,
|
|
|
|
stateDumpRawHfs0Partition,
|
|
|
|
stateHfs0PartitionDataDumpMenu,
|
|
|
|
stateDumpHfs0PartitionData,
|
|
|
|
stateHfs0BrowserMenu,
|
|
|
|
stateHfs0BrowserGetList,
|
|
|
|
stateHfs0Browser,
|
|
|
|
stateHfs0BrowserCopyFile,
|
2019-06-09 02:36:21 +01:00
|
|
|
stateExeFsMenu,
|
|
|
|
stateExeFsSectionDataDumpMenu,
|
|
|
|
stateDumpExeFsSectionData,
|
|
|
|
stateExeFsSectionBrowserMenu,
|
|
|
|
stateExeFsSectionBrowserGetList,
|
|
|
|
stateExeFsSectionBrowser,
|
|
|
|
stateExeFsSectionBrowserCopyFile,
|
2019-06-05 23:44:18 +01:00
|
|
|
stateRomFsMenu,
|
|
|
|
stateRomFsSectionDataDumpMenu,
|
|
|
|
stateDumpRomFsSectionData,
|
|
|
|
stateRomFsSectionBrowserMenu,
|
|
|
|
stateRomFsSectionBrowserGetEntries,
|
|
|
|
stateRomFsSectionBrowser,
|
|
|
|
stateRomFsSectionBrowserChangeDir,
|
|
|
|
stateRomFsSectionBrowserCopyFile,
|
2019-06-28 21:13:54 +01:00
|
|
|
stateRomFsSectionBrowserCopyDir,
|
2019-04-21 17:27:33 +01:00
|
|
|
stateDumpGameCardCertificate,
|
2019-06-09 02:36:21 +01:00
|
|
|
stateSdCardEmmcMenu,
|
|
|
|
stateSdCardEmmcTitleMenu,
|
|
|
|
stateSdCardEmmcOrphanPatchAddOnMenu,
|
2019-06-28 21:13:54 +01:00
|
|
|
stateSdCardEmmcBatchModeMenu,
|
|
|
|
stateSdCardEmmcBatchDump,
|
2019-06-05 23:44:18 +01:00
|
|
|
stateUpdateMenu,
|
2019-04-21 17:27:33 +01:00
|
|
|
stateUpdateNSWDBXml,
|
|
|
|
stateUpdateApplication
|
2018-06-21 07:42:46 +01:00
|
|
|
} UIState;
|
|
|
|
|
2019-06-09 02:36:21 +01:00
|
|
|
typedef enum {
|
|
|
|
MENUTYPE_MAIN = 0,
|
|
|
|
MENUTYPE_GAMECARD,
|
|
|
|
MENUTYPE_SDCARD_EMMC
|
|
|
|
} curMenuType;
|
|
|
|
|
2018-06-21 07:42:46 +01:00
|
|
|
void uiFill(int x, int y, int width, int height, u8 r, u8 g, u8 b);
|
|
|
|
|
2019-06-05 23:44:18 +01:00
|
|
|
void uiDrawIcon(const u8 *icon, int width, int height, int x, int y);
|
|
|
|
|
|
|
|
bool uiLoadJpgFromMem(u8 *rawJpg, size_t rawJpgSize, int expectedWidth, int expectedHeight, int desiredWidth, int desiredHeight, u8 **outBuf);
|
|
|
|
|
|
|
|
bool uiLoadJpgFromFile(const char *filename, int expectedWidth, int expectedHeight, int desiredWidth, int desiredHeight, u8 **outBuf);
|
|
|
|
|
2019-04-21 17:27:33 +01:00
|
|
|
void uiDrawString(const char *string, int x, int y, u8 r, u8 g, u8 b);
|
|
|
|
|
2019-06-20 04:56:14 +01:00
|
|
|
u32 uiGetStrWidth(const char *string);
|
2019-06-09 02:36:21 +01:00
|
|
|
|
2019-04-21 17:27:33 +01:00
|
|
|
void uiRefreshDisplay();
|
|
|
|
|
|
|
|
void uiStatusMsg(const char *fmt, ...);
|
|
|
|
|
2018-06-22 01:46:17 +01:00
|
|
|
void uiUpdateStatusMsg();
|
|
|
|
|
2019-05-01 21:24:13 +01:00
|
|
|
void uiPleaseWait(u8 wait);
|
2018-06-22 01:46:17 +01:00
|
|
|
|
2018-06-21 07:42:46 +01:00
|
|
|
void uiUpdateFreeSpace();
|
|
|
|
|
2019-04-21 17:27:33 +01:00
|
|
|
void uiClearScreen();
|
|
|
|
|
|
|
|
void uiPrintHeadline();
|
|
|
|
|
2018-06-21 07:42:46 +01:00
|
|
|
void uiDeinit();
|
|
|
|
|
2019-06-05 23:44:18 +01:00
|
|
|
int uiInit();
|
|
|
|
|
2018-06-21 07:42:46 +01:00
|
|
|
void uiSetState(UIState state);
|
|
|
|
|
2019-04-21 17:27:33 +01:00
|
|
|
UIState uiGetState();
|
2018-06-21 07:42:46 +01:00
|
|
|
|
2019-04-21 17:27:33 +01:00
|
|
|
UIResult uiProcess();
|
2018-06-21 07:42:46 +01:00
|
|
|
|
|
|
|
#endif
|