bool RebootApp(void) { // be sure to use current settings as arguments editMetaArguments(); #ifdef FULLCHANNEL ExitApp(); WII_Initialize(); return !(WII_LaunchTitle(TITLE_ID(0x00010001, 0x554c4e52)) < 0); #else // Load meta.xml arguments char filepath[255]; HomebrewXML MetaXML; snprintf(filepath, sizeof(filepath), "%s/meta.xml", Settings.update_path); MetaXML.LoadHomebrewXMLData(filepath); u8 *buffer = NULL; u32 filesize = 0; snprintf(filepath, sizeof(filepath), "%s/boot.dol", Settings.update_path); LoadFileToMem(filepath, &buffer, &filesize); if(!buffer) { return false; } FreeHomebrewBuffer(); CopyHomebrewMemory(buffer, 0, filesize); AddBootArgument(filepath); for(u32 i = 0; i < MetaXML.GetArguments().size(); ++i) { AddBootArgument(MetaXML.GetArguments().at(i).c_str()); } return !(BootHomebrewFromMem() <0); #endif }
HomebrewLaunchWindow::HomebrewLaunchWindow(const std::string & launchPath, GuiImageData * iconImgData) : GuiFrame(0, 0) , buttonClickSound(Resources::GetSound("button_click.mp3")) , backgroundImgData(Resources::GetImageData("launchMenuBox.png")) , backgroundImg(backgroundImgData) , buttonImgData(Resources::GetImageData("button.png")) , iconImage(iconImgData) , titleText((char*)NULL, 42, glm::vec4(1.0f)) , versionText("Version:", 32, glm::vec4(1.0f)) , versionValueText((char*)NULL, 32, glm::vec4(1.0f)) , authorText("Author:", 32, glm::vec4(1.0f)) , authorValueText((char*)NULL, 32, glm::vec4(1.0f)) , descriptionText((char*)NULL, 28, glm::vec4(1.0f)) , loadBtnLabel("Load", 32, glm::vec4(1.0f)) , loadImg(buttonImgData) , loadBtn(loadImg.getWidth(), loadImg.getHeight()) , backBtnLabel("Back", 32, glm::vec4(1.0f)) , backImg(buttonImgData) , backBtn(backImg.getWidth(), backImg.getHeight()) , touchTrigger(GuiTrigger::CHANNEL_1, GuiTrigger::VPAD_TOUCH) , wpadTouchTrigger(GuiTrigger::CHANNEL_2 | GuiTrigger::CHANNEL_3 | GuiTrigger::CHANNEL_4 | GuiTrigger::CHANNEL_5, GuiTrigger::BUTTON_A) , homebrewLaunchPath(launchPath) { width = backgroundImg.getWidth(); height = backgroundImg.getHeight(); append(&backgroundImg); std::string homebrewPath = launchPath; size_t slashPos = homebrewPath.rfind('/'); if(slashPos != std::string::npos) homebrewPath.erase(slashPos); HomebrewXML metaXml; bool xmlReadSuccess = metaXml.LoadHomebrewXMLData((homebrewPath + "/meta.xml").c_str()); int xOffset = 500; int yOffset = height * 0.5f - 75.0f; const char *cpName = xmlReadSuccess ? metaXml.GetName() : launchPath.c_str(); if(strncmp(cpName, "sd:/wiiu/apps/", strlen("sd:/wiiu/apps/")) == 0) cpName += strlen("sd:/wiiu/apps/"); titleText.setText(cpName); titleText.setAlignment(ALIGN_CENTER | ALIGN_MIDDLE); titleText.setPosition(0, yOffset); titleText.setMaxWidth(width - 100, GuiText::DOTTED); append(&titleText); float scaleFactor = 1.0f; iconImage.setAlignment(ALIGN_LEFT | ALIGN_MIDDLE); iconImage.setPosition(100, yOffset - 30 - iconImage.getHeight() * 0.5f * scaleFactor); iconImage.setScale(scaleFactor); append(&iconImage); yOffset -= 50; versionText.setAlignment(ALIGN_LEFT | ALIGN_MIDDLE); versionText.setPosition(width - xOffset, yOffset); append(&versionText); versionValueText.setTextf("%s", xmlReadSuccess ? metaXml.GetVersion() : launchPath.c_str()); versionValueText.setAlignment(ALIGN_LEFT | ALIGN_MIDDLE); versionValueText.setPosition(width - xOffset + 100, yOffset); versionValueText.setMaxWidth(xOffset - 150, GuiText::DOTTED); append(&versionValueText); yOffset -= 30; authorText.setAlignment(ALIGN_LEFT | ALIGN_MIDDLE); authorText.setPosition(width - xOffset, yOffset); append(&authorText); authorValueText.setTextf("%s", metaXml.GetCoder()); authorValueText.setAlignment(ALIGN_LEFT | ALIGN_MIDDLE); authorValueText.setPosition(width - xOffset + 100, yOffset); authorValueText.setMaxWidth(xOffset - 150, GuiText::DOTTED); append(&authorValueText); yOffset -= 50; descriptionText.setText(metaXml.GetLongDescription()); descriptionText.setAlignment(ALIGN_LEFT | ALIGN_TOP); descriptionText.setPosition(100, -250); descriptionText.setMaxWidth(width - 200, GuiText::WRAP); append(&descriptionText); scaleFactor = 1.0f; loadImg.setScale(scaleFactor); loadBtn.setSize(scaleFactor * loadImg.getWidth(), scaleFactor * loadImg.getHeight()); loadBtn.setImage(&loadImg); loadBtn.setLabel(&loadBtnLabel); loadBtn.setAlignment(ALIGN_CENTER | ALIGN_MIDDLE); loadBtn.setPosition(-200, -310); loadBtn.setTrigger(&touchTrigger); loadBtn.setTrigger(&wpadTouchTrigger); loadBtn.setEffectGrow(); loadBtn.setSoundClick(buttonClickSound); loadBtn.clicked.connect(this, &HomebrewLaunchWindow::OnLoadButtonClick); append(&loadBtn); backImg.setScale(scaleFactor); backBtn.setSize(scaleFactor * backImg.getWidth(), scaleFactor * backImg.getHeight()); backBtn.setImage(&backImg); backBtn.setLabel(&backBtnLabel); backBtn.setAlignment(ALIGN_CENTER | ALIGN_MIDDLE); backBtn.setPosition(200, -310); backBtn.setTrigger(&touchTrigger); backBtn.setTrigger(&wpadTouchTrigger); backBtn.setEffectGrow(); backBtn.setSoundClick(buttonClickSound); backBtn.clicked.connect(this, &HomebrewLaunchWindow::OnBackButtonClick); append(&backBtn); }