Skip to content

Commit

Permalink
Fix menu options to set About in latest position
Browse files Browse the repository at this point in the history
  • Loading branch information
RetroGamer74 committed Feb 28, 2019
1 parent d7b2b1d commit 31d58c7
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ include $(DEVKITPRO)/libnx/switch_rules

APP_TITLE := RetroReloaded Updater
APP_AUTHOR := RetroGamer_74
APP_VERSION := 1.0
APP_VERSION := 1.3

ICON := Icon.jpg
TARGET := RetroReloadedUpdater
Expand Down
58 changes: 36 additions & 22 deletions source/UI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static u64 ReleasedInput = 0;

static string title;
static string version;
static string current_RR_version= "1.11"; //Retrieved from release txt file
static string current_RR_version= "1.12"; //Retrieved from release txt file
static string CurrentCFG_Name; //Custom Firmware Name
static string CurrentCFG_Folder; //Custom Firmware Folder
static string CurrentTemplate; //Current Active Template
Expand All @@ -55,6 +55,13 @@ static bool TemplateEnabled;
static bool ProdinfoRW;
static int RRReleaseNumber;

static u32 menuOptionCFWUpdate = 0;
static u32 menuOptionThemeEnable = 1;
static u32 menuOptionSelectTheme = 2;
static u32 menuOptionProdinfo = 3;
static u32 menuOptionAbout = 4;



u32 clippy = 0;

Expand Down Expand Up @@ -154,6 +161,22 @@ void UI::optAbout() {
TYPE_OK);
}


void setMenuOptionValues()
{
if(RRReleaseNumber < RR_MINVERSION)
{
menuOptionAbout = 1;
return;
}

if(RRReleaseNumber >= RR_MINVERSION && RRReleaseNumber < RR_MINVERSIONPRODINFO)
{
menuOptionAbout = 3;
return;
}
}

void UI::optDisableProdinfo() {

bool isProdinfoRW = FS::IsProdinfoRW();
Expand Down Expand Up @@ -242,9 +265,9 @@ void UI::optDisableTemplate() {
void UI::RePaintMenu()
{
mainMenu.clear();

//Main pages
mainMenu.push_back(MenuOption("RR Updates", "Update RR Now!.", nullptr));
mainMenu.push_back(MenuOption("About", "About RetroReloaded Updater.", bind(&UI::optAbout, this)));

if(RRReleaseNumber >= RR_MINVERSION)
{
Expand All @@ -256,39 +279,40 @@ void UI::RePaintMenu()
{
mainMenu.push_back(MenuOption("Prodinfo RW","RO/RW Prodinfo",nullptr));
}
mainMenu.push_back(MenuOption("About", "About RetroReloaded Updater.", bind(&UI::optAbout, this)));



//Subpages
mainMenu[0].subMenu.push_back(MenuOption("Update RR Now", "", bind(&UI::optRRUpdate, this)));
// mainMenu[0].subMenu.push_back(MenuOption("Update RR NRO", "", bind(&UI::optUpdateHB, this)));
mainMenu[menuOptionCFWUpdate].subMenu.push_back(MenuOption("Update RR Now", "", bind(&UI::optRRUpdate, this)));
// mainMenu[menuOptionCFWUpdate].subMenu.push_back(MenuOption("Update RR NRO", "", bind(&UI::optUpdateHB, this)));
if(RRReleaseNumber >= RR_MINVERSION)
{
mainMenu[2].subMenu.push_back(MenuOption("On/Off Template", "", bind(&UI::optDisableTemplate, this)));
mainMenu[menuOptionThemeEnable].subMenu.push_back(MenuOption("On/Off Template", "", bind(&UI::optDisableTemplate, this)));
UI::drawTemplatesOption();
}

if(RRReleaseNumber >= RR_MINVERSIONPRODINFO)
{
mainMenu[4].subMenu.push_back(MenuOption("Prodinfo RO/RW", "",bind(&UI::optDisableProdinfo, this)));
mainMenu[menuOptionProdinfo].subMenu.push_back(MenuOption("Prodinfo RO/RW", "",bind(&UI::optDisableProdinfo, this)));
}

}

void UI::drawTemplatesOption(){
TemplateEnabled = FS::IsTemplatedEnabled();
string TemplateName;
mainMenu[3].subMenu.clear();
mainMenu[2].subMenu.clear();
if(TemplateEnabled)
{
TemplateName = FS::GetToggleMarkWithTemplateName("RR");
mainMenu[3].subMenu.push_back(MenuOption(TemplateName, "", bind(&UI::EnableRRTheme, this)));
mainMenu[menuOptionSelectTheme].subMenu.push_back(MenuOption(TemplateName, "", bind(&UI::EnableRRTheme, this)));
TemplateName = FS::GetToggleMarkWithTemplateName("SB");
mainMenu[3].subMenu.push_back(MenuOption(TemplateName, "", bind(&UI::EnableSBTheme, this)));
mainMenu[menuOptionSelectTheme].subMenu.push_back(MenuOption(TemplateName, "", bind(&UI::EnableSBTheme, this)));
}
else
{
mainMenu[3].subMenu.push_back(MenuOption("Themes Feature", "", bind(&UI::EnableTemplateCapable, this)));
mainMenu[menuOptionSelectTheme].subMenu.push_back(MenuOption("Themes Feature", "", bind(&UI::EnableTemplateCapable, this)));
}


Expand Down Expand Up @@ -387,17 +411,6 @@ UI::UI(string Title, string Version) {

UI::RePaintMenu();

/*
vector<string> paths = FS::EnumDir("/Toolkit/splashes");
for(unsigned int i=0;i<paths.size();i++) {
mainMenu[1].subMenu.push_back(MenuOption(paths[i], "", bind(&UI::optImage, this, i)));
images.push_back(IMG_Load(("/Toolkit/splashes/"+paths[i]).c_str()));
}
*/

//Make dirs
//if(!FS::DirExists("/Toolkit")) FS::MakeDir("/Toolkit", 0777);
//if(!FS::DirExists("/Toolkit/splashes")) FS::MakeDir("/Toolkit/splashes", 0777);
}

void UI::setInstance(UI ui) {
Expand All @@ -414,6 +427,7 @@ void UI::setInstance(UI ui) {

TemplateEnabled = FS::IsTemplatedEnabled();
ProdinfoRW = FS::IsProdinfoRW();
setMenuOptionValues();

if(RRReleaseNumber < RR_MINVERSION)
ui.MessageBox("Warning","Some features are disabled because\nyour RR version is lower than 1.24.\nPlease update!",TYPE_OK);
Expand Down Expand Up @@ -605,7 +619,7 @@ void UI::renderMenu() {
}else{
drawText(subX + 30, subY + 30 + ((j+1)*50), mThemes->txtcolor, mainMenu[i].subMenu[j].getName(), mThemes->fntMedium);
}
if(j == currSubSel && currSel == 1) {
if(j == currSubSel && currSel == menuOptionAbout) {
SDL_Texture* tex = SDL_CreateTextureFromSurface(mRender._renderer, images[currSubSel]);
drawScaled(images[currSubSel], tex, 710, 120, images[currSubSel]->w/3, images[currSubSel]->h/3);
}
Expand Down

0 comments on commit 31d58c7

Please sign in to comment.