3030#define DEFAULT_WIILOAD_PORT 4299
3131
3232#define MAX_BUTTONS_ON_PAGE 4
33- // char * repoUrl = "http://wiiubru.com/appstore";
34- char * repoUrl = " 192.168.1.104:8000" ;
33+ char * repoUrl = " http://wiiubru.com/appstore" ;
34+ // char * repoUrl = "192.168.1.104:8000";
3535// char * repoUrl = "http://wiiubru.com/appstore/appstoretest";
3636
3737ProgressWindow* progressWindow;
@@ -324,7 +324,7 @@ void HomebrewWindow::loadLocalApps(int mode)
324324 }
325325
326326 const char *cpName = xmlReadSuccess ? metaXml.GetName () : homebrewButtons[idx]->execPath .c_str ();
327- const char *cpDescription = xmlReadSuccess ? metaXml.GetShortDescription () : " " ;
327+ // const char *cpDescription = xmlReadSuccess ? metaXml.GetShortDescription() : "";
328328 if (strncmp (cpName, " sd:/wiiu/apps/" , strlen (" sd:/wiiu/apps/" )) == 0 )
329329 cpName += strlen (" sd:/wiiu/apps/" );
330330
@@ -564,8 +564,6 @@ HomebrewWindow::HomebrewWindow(int w, int h)
564564 , randomTabBtn(rpxTabImg.getWidth(), rpxTabImg.getHeight())
565565 , touchTrigger(GuiTrigger::CHANNEL_1, GuiTrigger::VPAD_TOUCH)
566566 , wpadTouchTrigger(GuiTrigger::CHANNEL_2 | GuiTrigger::CHANNEL_3 | GuiTrigger::CHANNEL_4 | GuiTrigger::CHANNEL_5, GuiTrigger::BUTTON_A)
567- , buttonLTrigger(GuiTrigger::CHANNEL_ALL, GuiTrigger::BUTTON_L | GuiTrigger::BUTTON_LEFT, true )
568- , buttonRTrigger(GuiTrigger::CHANNEL_ALL, GuiTrigger::BUTTON_R | GuiTrigger::BUTTON_RIGHT, true )
569567{
570568// tcpReceiver.serverReceiveStart.connect(this, &HomebrewWindow::OnTcpReceiveStart);
571569// tcpReceiver.serverReceiveFinished.connect(this, &HomebrewWindow::OnTcpReceiveFinish);
@@ -615,8 +613,10 @@ HomebrewWindow::HomebrewWindow(int w, int h)
615613 append (&hblVersionText);
616614 append (hblRepoText);
617615
618- header = new GuiText (" Homebrew App Store" , 64 , glm::vec4 (1 , 1 , 1 , 1 ));
619- header2 = new GuiText (" Select a Category" , 40 , glm::vec4 (1 , 1 , 1 , 1 ));
616+ // header = new GuiText("Homebrew App Store", 64, glm::vec4(1, 1, 1, 1));
617+ header = new GuiImage (Resources::GetImageData (" title.png" ));
618+ header->setAlignment (ALIGN_TOP);
619+ header2 = new GuiText (" Select a Category" , 30 , glm::vec4 (1 , 1 , 1 , 1 ));
620620
621621
622622 // for now, do this like this
@@ -630,8 +630,8 @@ HomebrewWindow::HomebrewWindow(int w, int h)
630630 backTabBtn.setAlignment (ALIGN_LEFT);
631631 randomTabBtn.setAlignment (ALIGN_RIGHT);
632632
633- backTabBtn.setPosition (0 , 85 );
634- randomTabBtn.setPosition (0 , - 85 );
633+ backTabBtn.setPosition (0 , 0 );
634+ randomTabBtn.setPosition (0 , 0 );
635635
636636 backTabBtn.setEffectGrow ();
637637 randomTabBtn.setEffectGrow ();
@@ -644,10 +644,6 @@ HomebrewWindow::HomebrewWindow(int w, int h)
644644
645645 backTabBtn.clicked .connect (this , &HomebrewWindow::OnHBLTabButtonClick);
646646 randomTabBtn.clicked .connect (this , &HomebrewWindow::OnRPXTabButtonClick);
647-
648-
649- append (&backTabBtn);
650- append (&randomTabBtn);
651647
652648 append (progressWindow);
653649
@@ -696,7 +692,7 @@ void HomebrewWindow::OnCategorySwitch(GuiButton *button, const GuiController *co
696692{
697693
698694 // remove all category buttons
699- for (int x=0 ; x<all_cats.size (); x++)
695+ for (unsigned int x=0 ; x<all_cats.size (); x++)
700696 {
701697 // detect which number category button was pressed
702698 if (all_cats[x] == button)
@@ -709,6 +705,9 @@ void HomebrewWindow::OnCategorySwitch(GuiButton *button, const GuiController *co
709705 removeE (header);
710706 removeE (header2);
711707
708+ append (&backTabBtn);
709+ append (&randomTabBtn);
710+
712711 loadLocalApps (0 );
713712 // change the category based on the click
714713// filter();
@@ -741,43 +740,58 @@ void HomebrewWindow::displayCategories()
741740 clearScreen ();
742741 all_cats.clear ();
743742
744- header->setPosition (0 , 260 );
743+ header->setPosition (0 , 0 );
745744 append (header);
746745
747746 header2->setPosition (0 , -240 );
748747 append (header2);
748+
749+ const char * vals[6 ] = {" all_gray.png" , " games.png" , " emulators.png" , " tools.png" , " loaders.png" , " concepts.png" };
749750
750- appendCategoryButton (" all_gray.png " , -250 , 100 );
751- appendCategoryButton (" games.png " , 0 , 100 );
752- appendCategoryButton (" emulators.png " , 250 , 100 );
753- appendCategoryButton (" tools.png " , -250 , -100 );
754- appendCategoryButton (" loaders.png " , 0 , -100 );
755- appendCategoryButton (" concepts.png " , 250 , -100 );
751+ appendCategoryButton (( char *)vals[ 0 ] , -250 , 100 );
752+ appendCategoryButton (( char *)vals[ 1 ], 0 , 100 );
753+ appendCategoryButton (( char *)vals[ 2 ] , 250 , 100 );
754+ appendCategoryButton (( char *)vals[ 3 ], -250 , -100 );
755+ appendCategoryButton (( char *)vals[ 4 ] , 0 , -100 );
756+ appendCategoryButton (( char *)vals[ 5 ] , 250 , -100 );
756757
757758
758759}
759760
760761
761762void HomebrewWindow::OnHBLTabButtonClick (GuiButton *button, const GuiController *controller, GuiTrigger *trigger)
762763{
763- if (listingMode < 1 || isFiltering) // already hbl mode
764+ if (screenLocked)
765+ {
766+ if (launchBox)
767+ // dismiss any active window
768+ OnLaunchBoxCloseClick (launchBox);
764769 return ;
770+ }
765771
766- listingMode-- ;
772+ listingMode = - 1 ;
767773 clearScreen ();
768774 filter ();
775+
776+ removeE (&backTabBtn);
777+ removeE (&randomTabBtn);
778+
779+ displayCategories ();
769780 globalUpdatePosition = true ;
770781}
771782
772783void HomebrewWindow::OnRPXTabButtonClick (GuiButton *button, const GuiController *controller, GuiTrigger *trigger)
773784{
774- if (listingMode > 3 || isFiltering) // already rpx mode
775- return ;
785+ if (screenLocked)
786+ {
787+ if (launchBox)
788+ // dismiss any active window
789+ removeE (launchBox);
790+ }
776791
777- listingMode++;
778- clearScreen ();
779- filter ();
780- globalUpdatePosition = true ;
792+ // click a random button within the displayed apps
793+ int r = rand () % homebrewButtons.size ();
794+ OnHomebrewButtonClick (homebrewButtons[r]->button , controller, 0 );
781795}
782796
783797void HomebrewWindow::OnOpenEffectFinish (GuiElement *element)
@@ -790,6 +804,10 @@ void HomebrewWindow::OnOpenEffectFinish(GuiElement *element)
790804void HomebrewWindow::OnCloseEffectFinish (GuiElement *element)
791805{
792806 screenLocked = false ;
807+
808+ backTabBtn.clearState (GuiElement::STATE_DISABLED);
809+ randomTabBtn.clearState (GuiElement::STATE_DISABLED);
810+
793811 // ! remove element from draw list and push to delete queue
794812 removeE (element);
795813 AsyncDeleter::pushForDelete (element);
@@ -806,6 +824,7 @@ void HomebrewWindow::OnLaunchBoxCloseClick(GuiElement *element)
806824 element->setState (GuiElement::STATE_DISABLED);
807825 element->setEffect (EFFECT_FADE, -10 , 0 );
808826 element->effectFinished .connect (this , &HomebrewWindow::OnCloseEffectFinish);
827+ launchBox = NULL ;
809828}
810829
811830void HomebrewWindow::OnHomebrewButtonClick (GuiButton *button, const GuiController *controller, GuiTrigger *trigger)
@@ -824,12 +843,13 @@ void HomebrewWindow::OnHomebrewButtonClick(GuiButton *button, const GuiControlle
824843 {
825844 if (button == homebrewButtons[i]->button )
826845 {
827- HomebrewLaunchWindow * launchBox = new HomebrewLaunchWindow (*homebrewButtons[i], this );
828- launchBox->setEffect (EFFECT_FADE, 10 , 255 );
829- launchBox->setState (GuiElement::STATE_DISABLED);
830- launchBox->setPosition (0 .0f , 30 .0f );
831- launchBox->effectFinished .connect (this , &HomebrewWindow::OnOpenEffectFinish);
832- launchBox->backButtonClicked .connect (this , &HomebrewWindow::OnLaunchBoxCloseClick);
846+ launchBox = new HomebrewLaunchWindow (*homebrewButtons[i], this );
847+ HomebrewLaunchWindow* launchBox2 = (HomebrewLaunchWindow*)launchBox;
848+ launchBox2->setEffect (EFFECT_FADE, 10 , 255 );
849+ launchBox2->setState (GuiElement::STATE_DISABLED);
850+ launchBox2->setPosition (0 .0f , 30 .0f );
851+ launchBox2->effectFinished .connect (this , &HomebrewWindow::OnOpenEffectFinish);
852+ launchBox2->backButtonClicked .connect (this , &HomebrewWindow::OnLaunchBoxCloseClick);
833853 log_printf (" creating launchbox" );
834854 append (launchBox);
835855 disableButtons = true ;
0 commit comments