From 67829e748c0d5d94028ce5e43c1af9616669601f Mon Sep 17 00:00:00 2001 From: Christopher Roy Bratusek Date: Wed, 14 Mar 2012 14:11:55 +0100 Subject: [PATCH] support loading the NAND-Emu (if IOS253 is found) must be either sd:/apps/boot253/boot.dol or usb:/apps/boot253/boot.dol --- source/Prompts/prompt_end.cpp | 54 ++++++++++++++++++++++++++++------- source/main.cpp | 51 ++++++++++++++++++++++----------- 2 files changed, 78 insertions(+), 27 deletions(-) diff --git a/source/Prompts/prompt_end.cpp b/source/Prompts/prompt_end.cpp index b11cfb7..28aad3e 100644 --- a/source/Prompts/prompt_end.cpp +++ b/source/Prompts/prompt_end.cpp @@ -41,12 +41,14 @@ endPrompt() GuiImageData btn(Theme.button); GuiImage systemmenuImg(&btn); GuiImage bootmiiImg(&btn); + GuiImage nandemuImg(&btn); GuiImage shutdownImg(&btn); GuiImage backImg(&btn); - + // Buttons over data GuiImageData btn_over(Theme.button_focus); GuiImage bootmiiImgOver(&btn_over); + GuiImage nandemuImgOver(&btn_over); GuiImage systemmenuImgOver(&btn_over); GuiImage shutdownImgOver(&btn_over); GuiImage backImgOver(&btn_over); @@ -59,29 +61,52 @@ endPrompt() bootmii.SetImage(&bootmiiImg); bootmii.SetImageOver(&bootmiiImgOver); bootmii.SetTrigger(&trigA); - + + GuiText nandemuTxt(tr("Launch NandEmu"), 22, (GXColor){Theme.button_small_text_1, Theme.button_small_text_2, Theme.button_small_text_3, 255}); + GuiButton nandemu(btn.GetWidth(), btn.GetHeight()); + nandemu.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); + nandemu.SetPosition(0, 75); + if(get_bootmii()) + nandemu.SetPosition(0, 120); + nandemu.SetLabel(&nandemuTxt); + nandemu.SetImage(&nandemuImg); + nandemu.SetImageOver(&nandemuImgOver); + nandemu.SetTrigger(&trigA); + GuiText systemmenuTxt(tr("Exit to System Menu"), 22, (GXColor){Theme.button_small_text_1, Theme.button_small_text_2, Theme.button_small_text_3, 255}); GuiButton systemmenu(btn.GetWidth(), btn.GetHeight()); systemmenu.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); systemmenu.SetPosition(0, 90); - if(get_bootmii()) - systemmenu.SetPosition(0, 140); + if(get_bootmii() && get_nandemu()) + { + systemmenu.SetPosition(0, 180); + } + else if (get_bootmii() || get_nandemu()) + { + systemmenu.SetPosition(0, 120); + } systemmenu.SetLabel(&systemmenuTxt); systemmenu.SetImage(&systemmenuImg); systemmenu.SetImageOver(&systemmenuImgOver); systemmenu.SetTrigger(&trigA); - + GuiText shutdownTxt(tr("Shutdown"), 22, (GXColor){Theme.button_small_text_1, Theme.button_small_text_2, Theme.button_small_text_3, 255}); GuiButton shutdown(btn.GetWidth(), btn.GetHeight()); shutdown.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); shutdown.SetPosition(0, 180); - if(get_bootmii()) + if(get_bootmii() && get_nandemu()) + { + shutdown.SetPosition(0, 225); + } + else if (get_bootmii() || get_nandemu()) + { shutdown.SetPosition(0, 205); + } shutdown.SetLabel(&shutdownTxt); shutdown.SetImage(&shutdownImg); shutdown.SetImageOver(&shutdownImgOver); shutdown.SetTrigger(&trigA); - + GuiText backTxt(tr("Back"), 22, (GXColor){Theme.button_small_text_1, Theme.button_small_text_2, Theme.button_small_text_3, 255}); GuiButton back(btn.GetWidth(), btn.GetHeight()); back.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); @@ -100,6 +125,8 @@ endPrompt() promptWindow.Append(&titleTxt); if(get_bootmii()) promptWindow.Append(&bootmii); + if(get_nandemu()) + promptWindow.Append(&nandemu); promptWindow.Append(&systemmenu); promptWindow.Append(&shutdown); promptWindow.Append(&back); @@ -121,21 +148,28 @@ endPrompt() menu = MENU_EXIT; stop = true; } - + + if(nandemu.GetState() == STATE_CLICKED) + { + set_nandemu(2); + menu = MENU_EXIT; + stop = true; + } + if(systemmenu.GetState() == STATE_CLICKED) { PowerOff = SYS_RETURNTOMENU; menu = MENU_EXIT; stop = true; } - + if(shutdown.GetState() == STATE_CLICKED) { PowerOff = SYS_POWEROFF_STANDBY; menu = MENU_EXIT; stop = true; } - + if(back.GetState() == STATE_CLICKED || back2.GetState() == STATE_CLICKED) stop = true; } diff --git a/source/main.cpp b/source/main.cpp index 5cd7e1c..bc761e3 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -15,6 +15,7 @@ #include #include #include +#include //#include "audio.h" #include "filelist.h" @@ -33,6 +34,7 @@ #include "Network/network.h" #include "Network/tcp.h" #include "BootHomebrew/BootHomebrew.h" +#include "BootHomebrew/dolloader.h" #define HAVE_AHBPROT ((*(vu32*)0xcd800064 == 0xFFFFFFFF) ? 1 : 0) @@ -76,7 +78,7 @@ void addAppIos(string foldername, int ios) if(found) appios[i].ios = ios; if(!found) - appios.push_back(app_ios(foldername, ios)); + appios.push_back(app_ios(foldername, ios)); } } @@ -110,6 +112,7 @@ DefaultSettings() { Settings.sd_insert = SDCard_Inserted(); Settings.usb_insert = USBDevice_Inserted(); + Settings.dvd_insert = DVD_Inserted(); Settings.category_name_all = "All"; sprintf (Settings.new_category_name, "New Category"); Settings.current_category = 0; @@ -117,7 +120,7 @@ DefaultSettings() Settings.last_app_pos = -1; Settings.checkrev = -1; sprintf (Settings.code, "NULL"); - + // in kleinbuchstaben umwandeln /* transform(Settings.MyDir.begin(),Settings.MyDir.end(),Settings.MyDir.begin(),::tolower); if(Settings.MyDir.substr(0, Settings.MyDir.find(":/")) == "sd") @@ -126,7 +129,7 @@ DefaultSettings() Settings.MyPath = "usb1" + Settings.MyDir.substr(Settings.MyDir.find(":/"), Settings.MyDir.rfind("/") - Settings.MyDir.find(":/") +1); else Settings.MyPath = Settings.MyDir.substr(0, Settings.MyDir.rfind("/") +1); -*/ +*/ Settings.Apps_from = EFFECT_SLIDE_TOP; // Apps kommen von "EFFECT_SLIDE_TOP", "EFFECT_SLIDE_BOTTOM", "EFFECT_SLIDE_RIGHT", "EFFECT_SLIDE_LEFT" Settings.Apps_to = 0; // Apps geht nach "EFFECT_SLIDE_TOP", "EFFECT_SLIDE_BOTTOM", "EFFECT_SLIDE_RIGHT", "EFFECT_SLIDE_LEFT" Settings.grid = false; @@ -142,7 +145,7 @@ DefaultOptions() sprintf (Options.language, tr("STANDARD")); sprintf (Options.font, tr("STANDARD")); sprintf (Options.temp_code, "NULL"); - + Options.slide_effect = 1; Options.last_category = 1; Options.apps = 4; @@ -170,7 +173,7 @@ main(int argc, char *argv[]) ISFS_Initialize(); // Initialize Nand LoadHBF(); - + DefaultSettings(); DefaultOptions(); DefaultTheme(); @@ -180,28 +183,28 @@ main(int argc, char *argv[]) ResumeNetworkThread(); SetFont(); - + #ifdef HW_RVL pointer = new GuiImageData(Theme.player_point); #endif - + mainWindow = new GuiWindow(screenwidth, screenheight); - + GuiTrigger trigA; trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); - + ResumeGui(); stretch(Settings.top, Settings.bottom, Settings.left, Settings.right); - + if(HAVE_AHBPROT) runtimePatchApply(); - + if(strstr(Options.language, tr("STANDARD"))) translate(); - + AvailableCategory.categories[0] = tr(Settings.category_name_all); check_device(); - + /* while(1) { WPAD_ScanPads(); @@ -218,12 +221,12 @@ main(int argc, char *argv[]) break; } */ MainMenu(MENU_NONE); - + if(boothomebrew) { if(SelectedIOS() != IOS_GetVersion()) IOS_ReloadIOS(SelectedIOS()); - + if(Settings.forwarder_path != "the homebrew channel") { if(strstr(Settings.forwarder_path.c_str(), ":/apps/") != 0) @@ -236,10 +239,24 @@ main(int argc, char *argv[]) } else if(boot_buffer) BootHomebrew(); - + if(get_bootmii() == 2) IOS_ReloadIOS(254); - + + if(get_nandemu() == 2) + { + if(opendir(check_path("sd1:/apps/boot253").c_str()) != NULL) + { + LoadHomebrew ("sd1:/apps/boot253/boot.dol"); + BootHomebrew (); + } + else if (opendir(check_path("usb1:/apps/boot253").c_str()) != NULL) + { + LoadHomebrew ("usb1:/apps/boot253/boot.dol"); + BootHomebrew (); + } + } + if(PowerOff != -1) SYS_ResetSystem(PowerOff, 0, 0);