From 6f81bce9110afe4cb8927ff862bb4c1e8cf3bfed Mon Sep 17 00:00:00 2001 From: Christopher Roy Bratusek Date: Wed, 14 Mar 2012 17:30:49 +0100 Subject: [PATCH] bugfix: changing crashes in an empty page no longer crashes --- source/Menus/menu_main.cpp | 54 +++++++++++++++++++++++++++----------- updates | 1 + 2 files changed, 39 insertions(+), 16 deletions(-) diff --git a/source/Menus/menu_main.cpp b/source/Menus/menu_main.cpp index 5a3a62e..b37ea9c 100644 --- a/source/Menus/menu_main.cpp +++ b/source/Menus/menu_main.cpp @@ -737,29 +737,51 @@ int MenuMain() if(next_page || rightBtn.GetState() == STATE_CLICKED || (WPAD_ButtonsDown(0) & (WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS) && Options.navigation)) { rightBtn.ResetState(); - Settings.current_page++; - if(Settings.current_page > Settings.total_page) + //Settings.current_page++; + if(Settings.current_page < Settings.total_page) + { + Settings.current_page++; + // Settings.current_page = 1; + Settings.Apps_from = EFFECT_SLIDE_RIGHT; + Settings.Apps_to = EFFECT_SLIDE_LEFT; + + next_page = false; + change = true; + } + else if (Settings.total_page != 1) + { Settings.current_page = 1; - - Settings.Apps_from = EFFECT_SLIDE_RIGHT; - Settings.Apps_to = EFFECT_SLIDE_LEFT; - - next_page = false; - change = true; + Settings.Apps_from = EFFECT_SLIDE_LEFT; + Settings.Apps_to = EFFECT_SLIDE_RIGHT; + next_page = false; + change = true; + } + else { change = false; } } if(previous_page || leftBtn.GetState() == STATE_CLICKED || (WPAD_ButtonsDown(0) & (WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS) && Options.navigation)) { leftBtn.ResetState(); - Settings.current_page--; - if(Settings.current_page == 0) + if(Settings.current_page <= Settings.total_page && Settings.current_page > 1) + { // Settings.current_page = Settings.total_page; + + Settings.current_page--; + Settings.Apps_from = EFFECT_SLIDE_LEFT; + Settings.Apps_to = EFFECT_SLIDE_RIGHT; + + previous_page = false; + change = true; + } + else if (Settings.total_page != 1) + { Settings.current_page = Settings.total_page; - - Settings.Apps_from = EFFECT_SLIDE_LEFT; - Settings.Apps_to = EFFECT_SLIDE_RIGHT; - - previous_page = false; - change = true; + Settings.Apps_from = EFFECT_SLIDE_RIGHT; + Settings.Apps_to = EFFECT_SLIDE_LEFT; + + previous_page = false; + change = true; + } + else { change = false; } } if(change) diff --git a/updates b/updates index e114916..3a2f630 100644 --- a/updates +++ b/updates @@ -9,6 +9,7 @@ usb:/apps/NANDEmu-Boot/boot.dol) - Basic (= non-working) support for Homebew on DVD - No longer show the HBC if it's installed +- changing pages in an empty category no longer crashes - compiled with devkitppc 25-1 and libogc 1.8.10 //rev36: