Minor changes

This commit is contained in:
Question 2021-07-13 01:25:32 -05:00
parent 2fae85c7ed
commit f0863aacc2
4 changed files with 71 additions and 50 deletions

View File

@ -45,8 +45,8 @@ INCLUDES := include include/menus/book include/menus/book-chooser include/he
ROMFS := romfs ROMFS := romfs
VERSION_MAJOR := 0 VERSION_MAJOR := 0
VERSION_MINOR := 2 VERSION_MINOR := 3
VERSION_MICRO := 2 VERSION_MICRO := 0
APP_TITLE := eBookReader APP_TITLE := eBookReader
APP_AUTHOR := SeanOMik APP_AUTHOR := SeanOMik

View File

@ -59,16 +59,25 @@ void Menu_StartChoosing() {
SDL_ClearScreen(RENDERER, backColor); SDL_ClearScreen(RENDERER, backColor);
SDL_RenderClear(RENDERER); SDL_RenderClear(RENDERER);
hidScanInput(); //hidScanInput();
padConfigureInput(1, HidNpadStyleSet_NpadStandard);
u64 kDown = hidKeysDown(CONTROLLER_P1_AUTO); PadState pad;
u64 kHeld = hidKeysHeld(CONTROLLER_P1_AUTO); padInitializeDefault(&pad);
padUpdate(&pad);
//u64 kDown = hidKeysDown(CONTROLLER_P1_AUTO);
//u64 kHeld = hidKeysHeld(CONTROLLER_P1_AUTO);
u64 kDown = padGetButtonsDown(&pad);
u64 kHeld = padGetButtons(&pad);
/*if (!isWarningOnScreen && kDown & KEY_PLUS) { /*if (!isWarningOnScreen && kDown & KEY_PLUS) {
break; break;
}*/ }*/
if (kDown & KEY_B) { if (kDown & HidNpadButton_B) {
if (!isWarningOnScreen) { if (!isWarningOnScreen) {
break; break;
} else { } else {
@ -76,7 +85,7 @@ void Menu_StartChoosing() {
} }
} }
if (kDown & KEY_A) { if (kDown & HidNpadButton_A) {
int bookIndex = 0; int bookIndex = 0;
for (const auto & entry : fs::directory_iterator(path)) { for (const auto & entry : fs::directory_iterator(path)) {
string filename = entry.path().filename().string(); string filename = entry.path().filename().string();
@ -109,7 +118,7 @@ void Menu_StartChoosing() {
} }
} }
if (kDown & KEY_DUP) { if (kDown & HidNpadButton_Up) {
if (choosenIndex != 0 && !isWarningOnScreen) { if (choosenIndex != 0 && !isWarningOnScreen) {
choosenIndex--; choosenIndex--;
} else if (choosenIndex == 0) { } else if (choosenIndex == 0) {
@ -117,7 +126,7 @@ void Menu_StartChoosing() {
} }
} }
if (kDown & KEY_DDOWN) { if (kDown & HidNpadButton_Down) {
if (choosenIndex == amountOfFiles-1) { if (choosenIndex == amountOfFiles-1) {
choosenIndex = 0; choosenIndex = 0;
} else if (choosenIndex < amountOfFiles-1 && !isWarningOnScreen) { } else if (choosenIndex < amountOfFiles-1 && !isWarningOnScreen) {
@ -125,7 +134,7 @@ void Menu_StartChoosing() {
} }
} }
if (kDown & KEY_MINUS) { if (kDown & HidNpadButton_Minus) {
configDarkMode = !configDarkMode; configDarkMode = !configDarkMode;
} }

View File

@ -24,75 +24,86 @@ void Menu_OpenBook(char *path) {
bool helpMenu = false; bool helpMenu = false;
// Configure our supported input layout: a single player with standard controller syles
padConfigureInput(1, HidNpadStyleSet_NpadStandard);
// Initialize the default gamepad (which reads handheld mode inputs as well as the first connected controller)
PadState pad;
padInitializeDefault(&pad);
//Touch_Process(&touchInfo);
while(result >= 0 && appletMainLoop()) { while(result >= 0 && appletMainLoop()) {
reader->draw(helpMenu); reader->draw(helpMenu);
hidScanInput(); //hidScanInput();
//Touch_Process(&touchInfo); //u64 kDown = hidKeysDown(CONTROLLER_P1_AUTO);
//u64 kHeld = hidKeysHeld(CONTROLLER_P1_AUTO);
u64 kDown = hidKeysDown(CONTROLLER_P1_AUTO); padUpdate(&pad);
u64 kHeld = hidKeysHeld(CONTROLLER_P1_AUTO);
if (!helpMenu && kDown & KEY_DLEFT) { u64 kDown = padGetButtonsDown(&pad);
if (reader->currentPageLayout() == BookPageLayoutPortrait || (!hidGetHandheldMode())) { u64 kHeld = padGetButtons(&pad);
u64 kUp = padGetButtonsUp(&pad);
if (!helpMenu && kDown & HidNpadButton_Left) {
if (reader->currentPageLayout() == BookPageLayoutPortrait ) {
reader->previous_page(1); reader->previous_page(1);
} else if ((reader->currentPageLayout() == BookPageLayoutLandscape) && (hidGetHandheldMode())) { } else if ((reader->currentPageLayout() == BookPageLayoutLandscape) ) {
reader->zoom_out(); reader->zoom_out();
} }
} else if (!helpMenu && kDown & KEY_DRIGHT) { } else if (!helpMenu && kDown & HidNpadButton_Right) {
if (reader->currentPageLayout() == BookPageLayoutPortrait || (!hidGetHandheldMode())) { if (reader->currentPageLayout() == BookPageLayoutPortrait ) {
reader->next_page(1); reader->next_page(1);
} else if ((reader->currentPageLayout() == BookPageLayoutLandscape) && (hidGetHandheldMode())) { } else if ((reader->currentPageLayout() == BookPageLayoutLandscape) ) {
reader->zoom_in(); reader->zoom_in();
} }
} }
if (!helpMenu && kDown & KEY_R) { if (!helpMenu && kDown & HidNpadButton_R) {
reader->next_page(10); reader->next_page(10);
} else if (!helpMenu && kDown & KEY_L) { } else if (!helpMenu && kDown & HidNpadButton_L) {
reader->previous_page(10); reader->previous_page(10);
} }
if (!helpMenu && ((kDown & KEY_DUP) || (kHeld & KEY_RSTICK_UP))) { if (!helpMenu && ((kDown & HidNpadButton_Up) || (kHeld & HidNpadButton_StickRUp))) {
if (reader->currentPageLayout() == BookPageLayoutPortrait || (!hidGetHandheldMode())) { if (reader->currentPageLayout() == BookPageLayoutPortrait ) {
reader->zoom_in(); reader->zoom_in();
} else if ((reader->currentPageLayout() == BookPageLayoutLandscape) && (hidGetHandheldMode())) { } else if ((reader->currentPageLayout() == BookPageLayoutLandscape) ) {
reader->previous_page(1); reader->previous_page(1);
} }
} else if (!helpMenu && ((kDown & KEY_DDOWN) || (kHeld & KEY_RSTICK_DOWN))) { } else if (!helpMenu && ((kDown & HidNpadButton_Down) || (kHeld & HidNpadButton_StickRDown))) {
if (reader->currentPageLayout() == BookPageLayoutPortrait || (!hidGetHandheldMode())) { if (reader->currentPageLayout() == BookPageLayoutPortrait ) {
reader->zoom_out(); reader->zoom_out();
} else if ((reader->currentPageLayout() == BookPageLayoutLandscape) && (hidGetHandheldMode())) { } else if ((reader->currentPageLayout() == BookPageLayoutLandscape) ) {
reader->next_page(1); reader->next_page(1);
} }
} }
if (!helpMenu && kHeld & KEY_LSTICK_UP) { if (!helpMenu && kHeld & HidNpadButton_StickLUp) {
if (reader->currentPageLayout() == BookPageLayoutPortrait || (!hidGetHandheldMode())) { if (reader->currentPageLayout() == BookPageLayoutPortrait ) {
reader->move_page_up(); reader->move_page_up();
} else if ((reader->currentPageLayout() == BookPageLayoutLandscape) && (hidGetHandheldMode())) { } else if ((reader->currentPageLayout() == BookPageLayoutLandscape) ) {
reader->move_page_left(); reader->move_page_left();
} }
} else if (!helpMenu && kHeld & KEY_LSTICK_DOWN) { } else if (!helpMenu && kHeld & HidNpadButton_StickLDown) {
if (reader->currentPageLayout() == BookPageLayoutPortrait || (!hidGetHandheldMode())) { if (reader->currentPageLayout() == BookPageLayoutPortrait ) {
reader->move_page_down(); reader->move_page_down();
} else if ((reader->currentPageLayout() == BookPageLayoutLandscape) && (hidGetHandheldMode())) { } else if ((reader->currentPageLayout() == BookPageLayoutLandscape) ) {
reader->move_page_right(); reader->move_page_right();
} }
} else if (!helpMenu && kHeld & KEY_LSTICK_RIGHT) { } else if (!helpMenu && kHeld & HidNpadButton_StickLRight) {
if ((reader->currentPageLayout() == BookPageLayoutLandscape) && (hidGetHandheldMode())) { if ((reader->currentPageLayout() == BookPageLayoutLandscape) ) {
//reader->move_page_up(); //reader->move_page_up();
reader->move_page_down(); reader->move_page_down();
} }
} else if (!helpMenu && kHeld & KEY_LSTICK_LEFT) { } else if (!helpMenu && kHeld & HidNpadButton_StickLLeft) {
if ((reader->currentPageLayout() == BookPageLayoutLandscape) && (hidGetHandheldMode())) { if ((reader->currentPageLayout() == BookPageLayoutLandscape) ) {
//reader->move_page_down(); //reader->move_page_down();
reader->move_page_up(); reader->move_page_up();
} }
} }
if (kDown & KEY_B) { if (kDown & HidNpadButton_B) {
if (helpMenu) { if (helpMenu) {
helpMenu = !helpMenu; helpMenu = !helpMenu;
} else { } else {
@ -100,24 +111,24 @@ void Menu_OpenBook(char *path) {
} }
} }
if (!helpMenu && kDown & KEY_X) { if (!helpMenu && kDown & HidNpadButton_X) {
reader->permStatusBar = !reader->permStatusBar; reader->permStatusBar = !reader->permStatusBar;
} }
if (!helpMenu && kDown & KEY_LSTICK || kDown & KEY_RSTICK) { if (!helpMenu && kDown & HidNpadButton_StickL || kDown & HidNpadButton_StickR) {
reader->reset_page(); reader->reset_page();
} }
if (!helpMenu && kDown & KEY_Y) { if (!helpMenu && kDown & HidNpadButton_Y) {
reader->switch_page_layout(); reader->switch_page_layout();
} }
if (!helpMenu && kDown & KEY_MINUS) { if (!helpMenu && kUp & HidNpadButton_Minus) {
configDarkMode = !configDarkMode; configDarkMode = !configDarkMode;
reader->previous_page(0); reader->previous_page(0);
} }
if (kDown & KEY_PLUS) { if (kDown & HidNpadButton_Plus) {
helpMenu = !helpMenu; helpMenu = !helpMenu;
} }

View File

@ -33,7 +33,8 @@ static char *Clock_GetCurrentTime(void) {
static void StatusBar_GetBatteryStatus(int x, int y) { static void StatusBar_GetBatteryStatus(int x, int y) {
u32 percent = 0; u32 percent = 0;
ChargerType state; //ChargerType state;
PsmChargerType state;
int width = 0; int width = 0;
char buf[5]; char buf[5];