@@ -173,105 +173,110 @@ HomebrewWindow::HomebrewWindow(int w, int h)
173173 std::string fileContents;
174174 std::string targetUrl = std::string (" http://wiiubru.com/appstore/directory.yaml" );
175175 FileDownloader::getFile (targetUrl, fileContents);
176-
177176 std::istringstream f (fileContents);
178- std::string shortname;
179- std::getline (f, shortname);
180- shortname = shortname.substr (5 );
181- std::string name;
182- std::getline (f, name);
183- name = name.substr (2 );
184- std::string author;
185- std::getline (f, author);
186- author = author.substr (2 );
187- std::string desc;
188- std::getline (f, desc);
189- desc = desc.substr (2 );
190- std::string binary;
191- std::getline (f, binary);
192- binary = binary.substr (2 );
193-
194- int idx = homebrewButtons.size ();
195- homebrewButtons.resize (homebrewButtons.size () + 1 );
196-
197- // file path
198- homebrewButtons[idx].execPath = " n" ;
199- homebrewButtons[idx].iconImgData = NULL ;
200-
201- std::string homebrewPath = homebrewButtons[idx].execPath ;
202- size_t slashPos = homebrewPath.rfind (' /' );
203- if (slashPos != std::string::npos)
204- homebrewPath.erase (slashPos);
205-
206- u8 * iconData = NULL ;
207- u32 iconDataSize = 0 ;
208-
209- homebrewButtons[idx].dirPath = homebrewPath;
210-
211- // since we got this app from the sd card, mark it local for now.
212- // if we see it later on the server, update its status appropriately to
213- // update or installed
214- homebrewButtons[idx].status = GET;
215-
216- // download app list from wiiubru
217- std::string targetIcon;
218- std::string targetIconUrl = std::string (" http://wiiubru.com/appstore/apps/" + shortname + " /icon.png" );
219- FileDownloader::getFile (targetIconUrl, targetIcon);
220-
221- // if(targetIcon != NULL)
222- // {
223- homebrewButtons[idx].iconImgData = new GuiImageData ((u8 *)targetIcon.c_str (), targetIcon.size ());
224- // free(iconData);
225- // }
226-
227- const float cfImageScale = 1 .0f ;
228-
229- homebrewButtons[idx].iconImg = new GuiImage (homebrewButtons[idx].iconImgData );
230- homebrewButtons[idx].iconImg ->setAlignment (ALIGN_LEFT | ALIGN_MIDDLE);
231- homebrewButtons[idx].iconImg ->setPosition (60 , 0 );
232- homebrewButtons[idx].iconImg ->setScale (cfImageScale);
233-
234- HomebrewXML metaXml;
235177
236- // bool xmlReadSuccess = metaXml.LoadHomebrewXMLData((homebrewPath + "/meta.xml").c_str());
237-
238- const char *cpName = name.c_str ();
239- const char *cpDescription = desc.c_str ();
240-
241- if (strncmp (cpName, " sd:/wiiu/apps/" , strlen (" sd:/wiiu/apps/" )) == 0 )
242- cpName += strlen (" sd:/wiiu/apps/" );
243-
244- homebrewButtons[idx].nameLabel = new GuiText (cpName, 32 , glm::vec4 (0 , 0 , 0 , 1 ));
245- homebrewButtons[idx].nameLabel ->setAlignment (ALIGN_LEFT | ALIGN_MIDDLE);
246- homebrewButtons[idx].nameLabel ->setMaxWidth (350 , GuiText::SCROLL_HORIZONTAL);
247- homebrewButtons[idx].nameLabel ->setPosition (256 + 80 , 20 );
248-
249- homebrewButtons[idx].descriptionLabel = new GuiText (cpDescription, 32 , glm::vec4 (0 , 0 , 0 , 1 ));
250- homebrewButtons[idx].descriptionLabel ->setAlignment (ALIGN_LEFT | ALIGN_MIDDLE);
251- homebrewButtons[idx].descriptionLabel ->setMaxWidth (350 , GuiText::SCROLL_HORIZONTAL);
252- homebrewButtons[idx].descriptionLabel ->setPosition (256 + 80 , -20 );
253-
254- homebrewButtons[idx].button = new GuiButton (installedButtonImgData->getWidth (), installedButtonImgData->getHeight ());
255-
256- // set the right image for the status
257- homebrewButtons[idx].image = new GuiImage (appButtonImages[homebrewButtons[idx].status ]);
258- homebrewButtons[idx].image ->setScale (0 .9f );
259-
260- homebrewButtons[idx].button ->setImage (homebrewButtons[idx].image );
261- homebrewButtons[idx].button ->setLabel (homebrewButtons[idx].nameLabel , 0 );
262- homebrewButtons[idx].button ->setLabel (homebrewButtons[idx].descriptionLabel , 1 );
263- homebrewButtons[idx].button ->setIcon (homebrewButtons[idx].iconImg );
264- float fXOffset = 0 ;
265- float fYOffset = scrollOffY + (homebrewButtons[idx].image ->getHeight () + 20 .0f ) * 1 .5f - (homebrewButtons[idx].image ->getHeight () + 20 ) * (idx);
266- homebrewButtons[idx].button ->setPosition (currentLeftPosition + fXOffset , fYOffset );
267- homebrewButtons[idx].button ->setTrigger (&touchTrigger);
268- homebrewButtons[idx].button ->setTrigger (&wpadTouchTrigger);
269- homebrewButtons[idx].button ->setEffectGrow ();
270- // homebrewButtons[idx].button->setSoundClick(buttonClickSound);
271- homebrewButtons[idx].button ->clicked .connect (this , &HomebrewWindow::OnHomebrewButtonClick);
272-
273- append (homebrewButtons[idx].button );
274-
178+ // int loops = 0;
179+ // int i2;
180+ while (true )
181+ {
182+ std::string shortname;
183+
184+ if (!std::getline (f, shortname)) break ;
185+ shortname = shortname.substr (5 );
186+ std::string name;
187+ std::getline (f, name);
188+ name = name.substr (2 );
189+ std::string author;
190+ std::getline (f, author);
191+ author = author.substr (2 );
192+ std::string desc;
193+ std::getline (f, desc);
194+ desc = desc.substr (2 );
195+ std::string binary;
196+ std::getline (f, binary);
197+ binary = binary.substr (2 );
198+
199+ int idx = homebrewButtons.size ();
200+ homebrewButtons.resize (homebrewButtons.size () + 1 );
201+
202+ // file path
203+ homebrewButtons[idx].execPath = " " ;
204+ homebrewButtons[idx].iconImgData = NULL ;
205+
206+ std::string homebrewPath = homebrewButtons[idx].execPath ;
207+ size_t slashPos = homebrewPath.rfind (' /' );
208+ if (slashPos != std::string::npos)
209+ homebrewPath.erase (slashPos);
210+
211+ u8 * iconData = NULL ;
212+ u32 iconDataSize = 0 ;
213+
214+ homebrewButtons[idx].dirPath = homebrewPath;
215+
216+ // since we got this app from the sd card, mark it local for now.
217+ // if we see it later on the server, update its status appropriately to
218+ // update or installed
219+ homebrewButtons[idx].status = GET;
220+ homebrewButtons[idx].shortname = shortname;
221+ // download app list from wiiubru
222+ std::string targetIcon;
223+ std::string targetIconUrl = std::string (" http://wiiubru.com/appstore/apps/" + shortname + " /icon.png" );
224+ FileDownloader::getFile (targetIconUrl, targetIcon);
225+
226+ // if(targetIcon != NULL)
227+ // {
228+ homebrewButtons[idx].iconImgData = new GuiImageData ((u8 *)targetIcon.c_str (), targetIcon.size ());
229+ // free(iconData);
230+ // }
231+
232+ const float cfImageScale = 1 .0f ;
233+
234+ homebrewButtons[idx].iconImg = new GuiImage (homebrewButtons[idx].iconImgData );
235+ homebrewButtons[idx].iconImg ->setAlignment (ALIGN_LEFT | ALIGN_MIDDLE);
236+ homebrewButtons[idx].iconImg ->setPosition (60 , 0 );
237+ homebrewButtons[idx].iconImg ->setScale (cfImageScale);
238+
239+ HomebrewXML metaXml;
240+
241+ // bool xmlReadSuccess = metaXml.LoadHomebrewXMLData((homebrewPath + "/meta.xml").c_str());
242+
243+ const char *cpName = name.c_str ();
244+ const char *cpDescription = desc.c_str ();
245+
246+ if (strncmp (cpName, " sd:/wiiu/apps/" , strlen (" sd:/wiiu/apps/" )) == 0 )
247+ cpName += strlen (" sd:/wiiu/apps/" );
248+
249+ homebrewButtons[idx].nameLabel = new GuiText (cpName, 32 , glm::vec4 (0 , 0 , 0 , 1 ));
250+ homebrewButtons[idx].nameLabel ->setAlignment (ALIGN_LEFT | ALIGN_MIDDLE);
251+ homebrewButtons[idx].nameLabel ->setMaxWidth (350 , GuiText::SCROLL_HORIZONTAL);
252+ homebrewButtons[idx].nameLabel ->setPosition (256 + 80 , 20 );
253+
254+ homebrewButtons[idx].descriptionLabel = new GuiText (cpDescription, 32 , glm::vec4 (0 , 0 , 0 , 1 ));
255+ homebrewButtons[idx].descriptionLabel ->setAlignment (ALIGN_LEFT | ALIGN_MIDDLE);
256+ homebrewButtons[idx].descriptionLabel ->setMaxWidth (350 , GuiText::SCROLL_HORIZONTAL);
257+ homebrewButtons[idx].descriptionLabel ->setPosition (256 + 80 , -20 );
258+
259+ homebrewButtons[idx].button = new GuiButton (installedButtonImgData->getWidth (), installedButtonImgData->getHeight ());
260+
261+ // set the right image for the status
262+ homebrewButtons[idx].image = new GuiImage (appButtonImages[homebrewButtons[idx].status ]);
263+ homebrewButtons[idx].image ->setScale (0 .9f );
264+
265+ homebrewButtons[idx].button ->setImage (homebrewButtons[idx].image );
266+ homebrewButtons[idx].button ->setLabel (homebrewButtons[idx].nameLabel , 0 );
267+ homebrewButtons[idx].button ->setLabel (homebrewButtons[idx].descriptionLabel , 1 );
268+ homebrewButtons[idx].button ->setIcon (homebrewButtons[idx].iconImg );
269+ float fXOffset = 0 ;
270+ float fYOffset = scrollOffY + (homebrewButtons[idx].image ->getHeight () + 20 .0f ) * 1 .5f - (homebrewButtons[idx].image ->getHeight () + 20 ) * (idx);
271+ homebrewButtons[idx].button ->setPosition (currentLeftPosition + fXOffset , fYOffset );
272+ homebrewButtons[idx].button ->setTrigger (&touchTrigger);
273+ homebrewButtons[idx].button ->setTrigger (&wpadTouchTrigger);
274+ homebrewButtons[idx].button ->setEffectGrow ();
275+ // homebrewButtons[idx].button->setSoundClick(buttonClickSound);
276+ homebrewButtons[idx].button ->clicked .connect (this , &HomebrewWindow::OnHomebrewButtonClick);
277+
278+ append (homebrewButtons[idx].button );
279+ }
275280
276281// while (std::getline(f, line)) {
277282// if (!strncmp(str, substr, strlen("app: "))) {
@@ -359,13 +364,13 @@ void HomebrewWindow::OnLaunchBoxCloseClick(GuiElement *element)
359364void HomebrewWindow::OnHomebrewButtonClick (GuiButton *button, const GuiController *controller, GuiTrigger *trigger)
360365{
361366 bool disableButtons = false ;
362- return ;
367+ // return;
363368
364369 for (u32 i = 0 ; i < homebrewButtons.size (); i++)
365370 {
366371 if (button == homebrewButtons[i].button )
367372 {
368- HomebrewLaunchWindow * launchBox = new HomebrewLaunchWindow (homebrewButtons[i].execPath , homebrewButtons[i].iconImgData );
373+ HomebrewLaunchWindow * launchBox = new HomebrewLaunchWindow (homebrewButtons[i].execPath , homebrewButtons[i].iconImgData , homebrewButtons[i]. shortname );
369374 launchBox->setEffect (EFFECT_FADE, 10 , 255 );
370375 launchBox->setState (GuiElement::STATE_DISABLED);
371376 launchBox->setPosition (0 .0f , 30 .0f );
0 commit comments