|
23 | 23 | #include "dynamic_libs/sys_functions.h" |
24 | 24 | #include "network/FileDownloader.h" |
25 | 25 |
|
26 | | -HomebrewLaunchWindow::HomebrewLaunchWindow(const std::string & launchPath, GuiImageData * iconImgData, std::string & shortname) |
| 26 | +HomebrewLaunchWindow::HomebrewLaunchWindow(homebrewButton & thisButton) |
27 | 27 | : GuiFrame(0, 0) |
28 | 28 | , buttonClickSound(Resources::GetSound("button_click.mp3")) |
29 | 29 | , backgroundImgData(Resources::GetImageData("launchMenuBox.png")) |
30 | 30 | , backgroundImg(backgroundImgData) |
31 | 31 | , buttonImgData(Resources::GetImageData("button.png")) |
32 | | - , iconImage(iconImgData) |
| 32 | + , iconImage(thisButton.iconImgData) |
33 | 33 | , titleText((char*)NULL, 42, glm::vec4(0,0,0, 1)) |
34 | 34 | , versionText("Version:", 32, glm::vec4(0,0,0, 1)) |
35 | 35 | , versionValueText((char*)NULL, 32, glm::vec4(0,0,0, 1)) |
36 | 36 | , authorText("Author:", 32, glm::vec4(0,0,0, 1)) |
37 | 37 | , authorValueText((char*)NULL, 32, glm::vec4(0,0,0, 1)) |
38 | 38 | , descriptionText((char*)NULL, 28, glm::vec4(0,0,0, 1)) |
39 | 39 | , loadBtnLabel("Download", 32, glm::vec4(1.0f)) |
| 40 | + , delBtnLabel("Delete", 32, glm::vec4(1.0f)) |
40 | 41 | , loadImg(buttonImgData) |
| 42 | + , delImg(buttonImgData) |
41 | 43 | , loadBtn(loadImg.getWidth(), loadImg.getHeight()) |
| 44 | + , delBtn(loadImg.getWidth(), loadImg.getHeight()) |
42 | 45 | , backBtnLabel("Close", 32, glm::vec4(1.0f)) |
43 | 46 | , backImg(buttonImgData) |
44 | 47 | , backBtn(backImg.getWidth(), backImg.getHeight()) |
45 | 48 | , touchTrigger(GuiTrigger::CHANNEL_1, GuiTrigger::VPAD_TOUCH) |
46 | 49 | , wpadTouchTrigger(GuiTrigger::CHANNEL_2 | GuiTrigger::CHANNEL_3 | GuiTrigger::CHANNEL_4 | GuiTrigger::CHANNEL_5, GuiTrigger::BUTTON_A) |
47 | | - , homebrewLaunchPath(launchPath) |
48 | | - , homebrewLaunchName(shortname) |
| 50 | + , selectedButton(thisButton) |
49 | 51 | { |
50 | 52 | width = backgroundImg.getWidth(); |
51 | 53 | height = backgroundImg.getHeight(); |
52 | 54 | append(&backgroundImg); |
53 | 55 |
|
| 56 | + std::string launchPath = selectedButton.execPath; |
54 | 57 | std::string homebrewPath = launchPath; |
55 | 58 | size_t slashPos = homebrewPath.rfind('/'); |
56 | 59 | if(slashPos != std::string::npos) |
@@ -121,6 +124,19 @@ HomebrewLaunchWindow::HomebrewLaunchWindow(const std::string & launchPath, GuiIm |
121 | 124 | loadBtn.setSoundClick(buttonClickSound); |
122 | 125 | loadBtn.clicked.connect(this, &HomebrewLaunchWindow::OnLoadButtonClick); |
123 | 126 | append(&loadBtn); |
| 127 | + |
| 128 | + delImg.setScale(scaleFactor); |
| 129 | + delBtn.setSize(scaleFactor * loadImg.getWidth(), scaleFactor * delImg.getHeight()); |
| 130 | + delBtn.setImage(&delImg); |
| 131 | + delBtn.setLabel(&delBtnLabel); |
| 132 | + delBtn.setAlignment(ALIGN_CENTER | ALIGN_MIDDLE); |
| 133 | + delBtn.setPosition(-200, -310); |
| 134 | + delBtn.setTrigger(&touchTrigger); |
| 135 | + delBtn.setTrigger(&wpadTouchTrigger); |
| 136 | + delBtn.setEffectGrow(); |
| 137 | + delBtn.setSoundClick(buttonClickSound); |
| 138 | + delBtn.clicked.connect(this, &HomebrewLaunchWindow::OnDeleteButtonClick); |
| 139 | +// append(&delBtn); |
124 | 140 |
|
125 | 141 | backImg.setScale(scaleFactor); |
126 | 142 | backBtn.setSize(scaleFactor * backImg.getWidth(), scaleFactor * backImg.getHeight()); |
@@ -177,13 +193,25 @@ void HomebrewLaunchWindow::OnFileLoadFinish(GuiElement *element, const std::stri |
177 | 193 | } |
178 | 194 | } |
179 | 195 |
|
| 196 | +void HomebrewLaunchWindow::OnDeleteButtonClick(GuiButton *button, const GuiController *controller, GuiTrigger *trigger) |
| 197 | +{ |
| 198 | + std::string path = "/apps/"+selectedButton.shortname+"/"+selectedButton.binary; |
| 199 | + std::string sdPath = "sd:/wiiu"+path; |
| 200 | + rename("sdPath", "sd:/.Trashes/oiuwroiuewr"); |
| 201 | +} |
180 | 202 |
|
181 | 203 | void HomebrewLaunchWindow::OnLoadButtonClick(GuiButton *button, const GuiController *controller, GuiTrigger *trigger) |
182 | 204 | { |
183 | | - backBtn.setState(GuiElement::STATE_DISABLED); |
| 205 | +// backBtn.setState(GuiElement::STATE_DISABLED); |
| 206 | + delBtn.setState(GuiElement::STATE_DISABLED); |
184 | 207 | loadBtn.setState(GuiElement::STATE_DISABLED); |
185 | 208 |
|
186 | | - FileDownloader::getFile("http://wiiubru.com/appstore/apps/"+homebrewLaunchName+"/boot.elf", "sd:/wiiu/apps/"+homebrewLaunchName+"/boot.elf", 0); |
| 209 | + std::string path = "/apps/"+selectedButton.shortname; |
| 210 | + std::string sdPath = "sd:/wiiu"+path; |
| 211 | + CreateSubfolder(sdPath.c_str()); |
| 212 | + FileDownloader::getFile("http://wiiubru.com/appstore"+path+"/"+selectedButton.binary, sdPath+"/"+selectedButton.binary, 0); |
| 213 | + FileDownloader::getFile("http://wiiubru.com/appstore"+path+"/meta.xml", sdPath+"/meta.xml", 0); |
| 214 | + FileDownloader::getFile("http://wiiubru.com/appstore"+path+"/icon.png", sdPath+"/icon.png", 0); |
187 | 215 |
|
188 | 216 |
|
189 | 217 | // struct SYSBrowserArgsIn args = {}; |
|
0 commit comments