diff --git a/HBC/META.XML b/HBC/META.XML index 4cdda8a6..2befe043 100644 --- a/HBC/META.XML +++ b/HBC/META.XML @@ -2,8 +2,8 @@ USB Loader GX USB Loader GX Team - 2.1 r1088 - 201106051007 + 2.1 r1089 + 201106101221 Loads games from USB-devices USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times. diff --git a/Languages/czech.lang b/Languages/czech.lang index 44c8212d..36303132 100644 --- a/Languages/czech.lang +++ b/Languages/czech.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-10 14:06+0200\n" +"POT-Creation-Date: 2011-06-14 16:22+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: David Jelinek (djelinek@hotmail.com) e->e,r->r,u->u, c->c \n" "Language-Team: r1056 - last version on http://djelinek.sweb.cz/_USBLoderGX/czech.lang \n" @@ -774,10 +774,10 @@ msgstr "Jak si prejete provést aktualizaci?" msgid "How to Shutdown?" msgstr "Jakým zpusobem ukoncit?" -msgid "Import categories" +msgid "Import Categories" msgstr "" -msgid "Import categories from WiiTDB" +msgid "Import categories" msgstr "" msgid "Import operation successfully completed." @@ -1152,6 +1152,9 @@ msgstr "Odstranit aktualizaci" msgid "Rename Game on WBFS" msgstr "Prejmenovat hru na WBFS" +msgid "Rename category" +msgstr "" + msgid "Reset" msgstr "" diff --git a/Languages/danish.lang b/Languages/danish.lang index 685cbf5b..7cc15872 100644 --- a/Languages/danish.lang +++ b/Languages/danish.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-10 14:06+0200\n" +"POT-Creation-Date: 2011-06-14 16:22+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: Fox888[dk]\n" "Language-Team: [dk]\n" @@ -774,10 +774,10 @@ msgstr "Hvordan skal der opdateres?" msgid "How to Shutdown?" msgstr "Hvordan skal der slukkes?" -msgid "Import categories" +msgid "Import Categories" msgstr "" -msgid "Import categories from WiiTDB" +msgid "Import categories" msgstr "" msgid "Import operation successfully completed." @@ -1152,6 +1152,9 @@ msgstr "Fjern opdatering" msgid "Rename Game on WBFS" msgstr "Omdøb spil på WBFS" +msgid "Rename category" +msgstr "" + msgid "Reset" msgstr "Nulstil" diff --git a/Languages/dutch.lang b/Languages/dutch.lang index 215c3f3e..4f695450 100644 --- a/Languages/dutch.lang +++ b/Languages/dutch.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-10 14:09+0200\n" +"POT-Creation-Date: 2011-06-14 16:22+0200\n" "PO-Revision-Date: 2011-06-10 08:07+0100\n" "Last-Translator: glowy\n" "Language-Team: tj_cool, glowy\n" @@ -774,12 +774,12 @@ msgstr "Hoe wil je updaten?" msgid "How to Shutdown?" msgstr "Hoe uitzetten?" +msgid "Import Categories" +msgstr "" + msgid "Import categories" msgstr "Importeer categorieën" -msgid "Import categories from WiiTDB" -msgstr "Importeer categorieën van WiiTDB" - msgid "Import operation successfully completed." msgstr "Importeren succesvol afgerond" @@ -1152,6 +1152,9 @@ msgstr "Verwijder update" msgid "Rename Game on WBFS" msgstr "Spel hernoemen op WBFS" +msgid "Rename category" +msgstr "" + msgid "Reset" msgstr "" @@ -1574,6 +1577,9 @@ msgstr "van" msgid "seconds left" msgstr "seconden over" +#~ msgid "Import categories from WiiTDB" +#~ msgstr "Importeer categorieën van WiiTDB" + #~ msgid " Wad Saved as:" #~ msgstr " Wad opgeslagen als:" diff --git a/Languages/english.lang b/Languages/english.lang index 975ee0d9..1070d0a5 100644 --- a/Languages/english.lang +++ b/Languages/english.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-10 14:06+0200\n" +"POT-Creation-Date: 2011-06-14 16:22+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -774,10 +774,10 @@ msgstr "" msgid "How to Shutdown?" msgstr "" -msgid "Import categories" +msgid "Import Categories" msgstr "" -msgid "Import categories from WiiTDB" +msgid "Import categories" msgstr "" msgid "Import operation successfully completed." @@ -1152,6 +1152,9 @@ msgstr "" msgid "Rename Game on WBFS" msgstr "" +msgid "Rename category" +msgstr "" + msgid "Reset" msgstr "" diff --git a/Languages/finnish.lang b/Languages/finnish.lang index e09eaff7..adcee5c3 100644 --- a/Languages/finnish.lang +++ b/Languages/finnish.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-10 14:06+0200\n" +"POT-Creation-Date: 2011-06-14 16:22+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: c64rmx\n" "Language-Team: \n" @@ -774,10 +774,10 @@ msgstr "Kuinka haluat päivittää?" msgid "How to Shutdown?" msgstr "Miten sammutetaan?" -msgid "Import categories" +msgid "Import Categories" msgstr "" -msgid "Import categories from WiiTDB" +msgid "Import categories" msgstr "" msgid "Import operation successfully completed." @@ -1152,6 +1152,9 @@ msgstr "" msgid "Rename Game on WBFS" msgstr "Uudelleennimeä peli" +msgid "Rename category" +msgstr "" + msgid "Reset" msgstr "" diff --git a/Languages/french.lang b/Languages/french.lang index 5552b6ed..63a430d4 100644 --- a/Languages/french.lang +++ b/Languages/french.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-10 14:09+0200\n" +"POT-Creation-Date: 2011-06-14 16:22+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: Cyan\n" "Language-Team: Badablek, Amour, ikya & Kin8\n" @@ -774,10 +774,10 @@ msgstr "Comment faire la Mise à jour ?" msgid "How to Shutdown?" msgstr "Arrêt de la Wii ?" -msgid "Import categories" -msgstr "Importer les catégories" +msgid "Import Categories" +msgstr "" -msgid "Import categories from WiiTDB" +msgid "Import categories" msgstr "Importer les catégories" msgid "Import operation successfully completed." @@ -1152,6 +1152,9 @@ msgstr "Supprimer MàJ" msgid "Rename Game on WBFS" msgstr "Renommer un jeu" +msgid "Rename category" +msgstr "" + msgid "Reset" msgstr "Réinitialisation" @@ -1574,6 +1577,9 @@ msgstr "sur" msgid "seconds left" msgstr "secondes restantes" +#~ msgid "Import categories from WiiTDB" +#~ msgstr "Importer les catégories" + #~ msgid " Wad Saved as:" #~ msgstr " WAD sauvegardé sous:" diff --git a/Languages/german.lang b/Languages/german.lang index 54c127f2..ec8a868a 100644 --- a/Languages/german.lang +++ b/Languages/german.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-10 14:09+0200\n" +"POT-Creation-Date: 2011-06-14 16:22+0200\n" "PO-Revision-Date: 2010-07-03 17:35-0800\n" "Last-Translator: TheRealVisitor\n" "Language-Team: Bertilax, Snoozer, wishmasterf, ZEN.13, TheRealVisitor\n" @@ -774,12 +774,12 @@ msgstr "Was soll aktualisiert werden?" msgid "How to Shutdown?" msgstr "Wie soll ausgeschaltet werden?" +msgid "Import Categories" +msgstr "" + msgid "Import categories" msgstr "Importiere Kategorien" -msgid "Import categories from WiiTDB" -msgstr "Import. Kategorien (WiiTDB)" - msgid "Import operation successfully completed." msgstr "Import erfolgreich." @@ -1152,6 +1152,9 @@ msgstr "Update entfernen" msgid "Rename Game on WBFS" msgstr "Spiel umbenennen" +msgid "Rename category" +msgstr "" + msgid "Reset" msgstr "Zurücksetzen" @@ -1574,6 +1577,9 @@ msgstr "von" msgid "seconds left" msgstr "Sekunden verbleiben" +#~ msgid "Import categories from WiiTDB" +#~ msgstr "Import. Kategorien (WiiTDB)" + #~ msgid " Wad Saved as:" #~ msgstr " WAD gespeichert als:" diff --git a/Languages/hungarian.lang b/Languages/hungarian.lang index 93a12bfa..2e59f7c9 100644 --- a/Languages/hungarian.lang +++ b/Languages/hungarian.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-10 14:06+0200\n" +"POT-Creation-Date: 2011-06-14 16:22+0200\n" "PO-Revision-Date: 2009-12-29 11:05+0100\n" "Last-Translator: Springdale\n" "Language-Team: Tusk, Springdale\n" @@ -774,10 +774,10 @@ msgstr "Hogyan szeretnél frissíteni?" msgid "How to Shutdown?" msgstr "Hogyan kapcsoljon ki?" -msgid "Import categories" +msgid "Import Categories" msgstr "" -msgid "Import categories from WiiTDB" +msgid "Import categories" msgstr "" msgid "Import operation successfully completed." @@ -1152,6 +1152,9 @@ msgstr "" msgid "Rename Game on WBFS" msgstr "WBFS játék átnevezése" +msgid "Rename category" +msgstr "" + msgid "Reset" msgstr "" diff --git a/Languages/italian.lang b/Languages/italian.lang index 12a0bfb4..193cfb1b 100644 --- a/Languages/italian.lang +++ b/Languages/italian.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-10 14:06+0200\n" +"POT-Creation-Date: 2011-06-14 16:22+0200\n" "PO-Revision-Date: 2011-03-10 21:00+0200\n" "Last-Translator: Cambo \n" "Language-Team: Cambo\n" @@ -774,10 +774,10 @@ msgstr "Come Vuoi Aggiornare ?" msgid "How to Shutdown?" msgstr "Spegnimento Wii?" -msgid "Import categories" +msgid "Import Categories" msgstr "" -msgid "Import categories from WiiTDB" +msgid "Import categories" msgstr "" msgid "Import operation successfully completed." @@ -1152,6 +1152,9 @@ msgstr "Rimuovi Agg." msgid "Rename Game on WBFS" msgstr "Rinomina Gioco su WBFS" +msgid "Rename category" +msgstr "" + msgid "Reset" msgstr "Resetta" diff --git a/Languages/japanese.lang b/Languages/japanese.lang index a9794fbe..e947e09b 100644 --- a/Languages/japanese.lang +++ b/Languages/japanese.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-10 14:06+0200\n" +"POT-Creation-Date: 2011-06-14 16:22+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: hosigumayuugi\n" "Language-Team: hosigumayuugi, papa, ichiroling\n" @@ -774,12 +774,12 @@ msgstr "更新方法の選択" msgid "How to Shutdown?" msgstr "終了方法の選択" +msgid "Import Categories" +msgstr "" + msgid "Import categories" msgstr "カテゴリをインポート" -msgid "Import categories from WiiTDB" -msgstr "WiiTDBからカテゴリをインポート" - msgid "Import operation successfully completed." msgstr "インポートに成功しました" @@ -1152,6 +1152,9 @@ msgstr "更新を取り除く" msgid "Rename Game on WBFS" msgstr "WBFS内のゲーム名を変更" +msgid "Rename category" +msgstr "" + msgid "Reset" msgstr "リセット" @@ -1574,6 +1577,9 @@ msgstr "中" msgid "seconds left" msgstr "秒で完了" +#~ msgid "Import categories from WiiTDB" +#~ msgstr "WiiTDBからカテゴリをインポート" + #~ msgid " Wad Saved as:" #~ msgstr "WADを保存しました:" diff --git a/Languages/korean.lang b/Languages/korean.lang index 635894de..39dd011a 100644 --- a/Languages/korean.lang +++ b/Languages/korean.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-10 14:06+0200\n" +"POT-Creation-Date: 2011-06-14 16:22+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: nextos@korea.com\n" "Language-Team: \n" @@ -774,10 +774,10 @@ msgstr "업데이트 할까요?" msgid "How to Shutdown?" msgstr "어떻게 종료할까요?" -msgid "Import categories" +msgid "Import Categories" msgstr "" -msgid "Import categories from WiiTDB" +msgid "Import categories" msgstr "" msgid "Import operation successfully completed." @@ -1152,6 +1152,9 @@ msgstr "" msgid "Rename Game on WBFS" msgstr "WBFS에서 게임 이름 변경" +msgid "Rename category" +msgstr "" + msgid "Reset" msgstr "" diff --git a/Languages/norwegian.lang b/Languages/norwegian.lang index 40b9f889..e3c69778 100644 --- a/Languages/norwegian.lang +++ b/Languages/norwegian.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-10 14:06+0200\n" +"POT-Creation-Date: 2011-06-14 16:22+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: raschi\n" "Language-Team: raschi\n" @@ -774,10 +774,10 @@ msgstr "Hvordan vil du oppdatere?" msgid "How to Shutdown?" msgstr "Hvordan skru av?" -msgid "Import categories" +msgid "Import Categories" msgstr "" -msgid "Import categories from WiiTDB" +msgid "Import categories" msgstr "" msgid "Import operation successfully completed." @@ -1152,6 +1152,9 @@ msgstr "Fjern oppdatering" msgid "Rename Game on WBFS" msgstr "Gi nytt navn til spill på WBFS" +msgid "Rename category" +msgstr "" + msgid "Reset" msgstr "" diff --git a/Languages/polish.lang b/Languages/polish.lang index 54d4d9c4..3d2ff36f 100644 --- a/Languages/polish.lang +++ b/Languages/polish.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-10 14:06+0200\n" +"POT-Creation-Date: 2011-06-14 16:22+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: ziom666 (zadania_prog@vp.pl)\n" "Language-Team: \n" @@ -774,10 +774,10 @@ msgstr "Wybierz rodzaj aktualizacji" msgid "How to Shutdown?" msgstr "Wybierz rodzaj zamkniecia" -msgid "Import categories" +msgid "Import Categories" msgstr "" -msgid "Import categories from WiiTDB" +msgid "Import categories" msgstr "" msgid "Import operation successfully completed." @@ -1152,6 +1152,9 @@ msgstr "" msgid "Rename Game on WBFS" msgstr "Zmien tytul gry na WBFS" +msgid "Rename category" +msgstr "" + msgid "Reset" msgstr "" diff --git a/Languages/portuguese_br.lang b/Languages/portuguese_br.lang index f75a8b72..041c2408 100644 --- a/Languages/portuguese_br.lang +++ b/Languages/portuguese_br.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-10 14:06+0200\n" +"POT-Creation-Date: 2011-06-14 16:22+0200\n" "PO-Revision-Date: 2009-10-23 18:52+0200\n" "Last-Translator: aniemotion\n" "Language-Team: boto12, aniemotion\n" @@ -774,10 +774,10 @@ msgstr "Como pretende atualizar o programa?" msgid "How to Shutdown?" msgstr "Como desligar?" -msgid "Import categories" +msgid "Import Categories" msgstr "" -msgid "Import categories from WiiTDB" +msgid "Import categories" msgstr "" msgid "Import operation successfully completed." @@ -1152,6 +1152,9 @@ msgstr "Remover atualização" msgid "Rename Game on WBFS" msgstr "Alterar nome do jogo na partição WBFS" +msgid "Rename category" +msgstr "" + msgid "Reset" msgstr "" diff --git a/Languages/portuguese_pt.lang b/Languages/portuguese_pt.lang index b21c4315..0d2792ec 100644 --- a/Languages/portuguese_pt.lang +++ b/Languages/portuguese_pt.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-10 14:06+0200\n" +"POT-Creation-Date: 2011-06-14 16:22+0200\n" "PO-Revision-Date: 2011-03-11 20:00-0000\n" "Last-Translator: pplucky (Sky8000)\n" "Language-Team: pplucky (Sky8000 )\n" @@ -774,10 +774,10 @@ msgstr "O que deseja actualizar?" msgid "How to Shutdown?" msgstr "Como desligar a consola?" -msgid "Import categories" +msgid "Import Categories" msgstr "" -msgid "Import categories from WiiTDB" +msgid "Import categories" msgstr "" msgid "Import operation successfully completed." @@ -1152,6 +1152,9 @@ msgstr "Remover actualização" msgid "Rename Game on WBFS" msgstr "Alterar nome do jogo (WBFS)" +msgid "Rename category" +msgstr "" + msgid "Reset" msgstr "Reinicializar" diff --git a/Languages/russian.lang b/Languages/russian.lang index 2a44b327..00caa0e5 100644 --- a/Languages/russian.lang +++ b/Languages/russian.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-10 14:06+0200\n" +"POT-Creation-Date: 2011-06-14 16:22+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: nikolai_ca\n" "Language-Team: Kir, alendit, nikolai_ca\n" @@ -774,10 +774,10 @@ msgstr "Что вы хотите обновить ?" msgid "How to Shutdown?" msgstr "Способ отключения?" -msgid "Import categories" +msgid "Import Categories" msgstr "" -msgid "Import categories from WiiTDB" +msgid "Import categories" msgstr "" msgid "Import operation successfully completed." @@ -1152,6 +1152,9 @@ msgstr "" msgid "Rename Game on WBFS" msgstr "Переименовать игры в WBFS" +msgid "Rename category" +msgstr "" + msgid "Reset" msgstr "" diff --git a/Languages/schinese.lang b/Languages/schinese.lang index d09dd350..4c67f8e8 100644 --- a/Languages/schinese.lang +++ b/Languages/schinese.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-10 14:06+0200\n" +"POT-Creation-Date: 2011-06-14 16:22+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: knife.hu kavid emul8ion\n" "Language-Team: kavid\n" @@ -774,10 +774,10 @@ msgstr "你要升级哪些文件?" msgid "How to Shutdown?" msgstr "如何关机?" -msgid "Import categories" +msgid "Import Categories" msgstr "" -msgid "Import categories from WiiTDB" +msgid "Import categories" msgstr "" msgid "Import operation successfully completed." @@ -1152,6 +1152,9 @@ msgstr "删除更新" msgid "Rename Game on WBFS" msgstr "改变 WBFS (硬盘)上的游戏名称" +msgid "Rename category" +msgstr "" + msgid "Reset" msgstr "重启" diff --git a/Languages/spanish.lang b/Languages/spanish.lang index a46e2a31..b9efb7cd 100644 --- a/Languages/spanish.lang +++ b/Languages/spanish.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-10 14:06+0200\n" +"POT-Creation-Date: 2011-06-14 16:22+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: SirPalax\n" "Language-Team: Penn, SirPalax\n" @@ -774,10 +774,10 @@ msgstr "¿Cómo quieres actualizar?" msgid "How to Shutdown?" msgstr "¿Cómo quieres apagar?" -msgid "Import categories" +msgid "Import Categories" msgstr "" -msgid "Import categories from WiiTDB" +msgid "Import categories" msgstr "" msgid "Import operation successfully completed." @@ -1152,6 +1152,9 @@ msgstr "Quitar actualización" msgid "Rename Game on WBFS" msgstr "Renombrar juego en WBFS" +msgid "Rename category" +msgstr "" + msgid "Reset" msgstr "" diff --git a/Languages/swedish.lang b/Languages/swedish.lang index 78be6334..e3399333 100644 --- a/Languages/swedish.lang +++ b/Languages/swedish.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-10 14:06+0200\n" +"POT-Creation-Date: 2011-06-14 16:22+0200\n" "PO-Revision-Date: 2010-01-19 17:39+0200\n" "Last-Translator: Katsurou\n" "Language-Team: Katsurou, pirateX\n" @@ -774,10 +774,10 @@ msgstr "Hur vill du uppdatera?" msgid "How to Shutdown?" msgstr "Hur vill du stänga av?" -msgid "Import categories" +msgid "Import Categories" msgstr "" -msgid "Import categories from WiiTDB" +msgid "Import categories" msgstr "" msgid "Import operation successfully completed." @@ -1152,6 +1152,9 @@ msgstr "" msgid "Rename Game on WBFS" msgstr "Döp om spel på WBFS" +msgid "Rename category" +msgstr "" + msgid "Reset" msgstr "" diff --git a/Languages/tchinese.lang b/Languages/tchinese.lang index 18208d4c..2e6f24d1 100644 --- a/Languages/tchinese.lang +++ b/Languages/tchinese.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-10 14:06+0200\n" +"POT-Creation-Date: 2011-06-14 16:22+0200\n" "PO-Revision-Date: 2010-02-15 21:00+0800\n" "Last-Translator: Jane.H\n" "Language-Team: kyogc, Miller, Mika Li, Jane.H\n" @@ -774,10 +774,10 @@ msgstr "是否執行更新?" msgid "How to Shutdown?" msgstr "關機選項?" -msgid "Import categories" +msgid "Import Categories" msgstr "" -msgid "Import categories from WiiTDB" +msgid "Import categories" msgstr "" msgid "Import operation successfully completed." @@ -1152,6 +1152,9 @@ msgstr "移除更新" msgid "Rename Game on WBFS" msgstr "變更WBFS上的遊戲名稱" +msgid "Rename category" +msgstr "" + msgid "Reset" msgstr "重新啟動" diff --git a/Languages/thai.lang b/Languages/thai.lang index f59ecca6..62a6dd42 100644 --- a/Languages/thai.lang +++ b/Languages/thai.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-10 14:06+0200\n" +"POT-Creation-Date: 2011-06-14 16:22+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: Nitro_subzero \n" "Language-Team: Nitro_subzero\n" @@ -774,10 +774,10 @@ msgstr "ต้องการอัพเดทแบบไหน ?" msgid "How to Shutdown?" msgstr "ต้องการปิดแบบไหน ?" -msgid "Import categories" +msgid "Import Categories" msgstr "" -msgid "Import categories from WiiTDB" +msgid "Import categories" msgstr "" msgid "Import operation successfully completed." @@ -1152,6 +1152,9 @@ msgstr "" msgid "Rename Game on WBFS" msgstr "เปลี่ยนชื่อเกมส์บน WBFS" +msgid "Rename category" +msgstr "" + msgid "Reset" msgstr "" diff --git a/Languages/turkish.lang b/Languages/turkish.lang index 46748e7f..39ab39bc 100644 --- a/Languages/turkish.lang +++ b/Languages/turkish.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-10 14:06+0200\n" +"POT-Creation-Date: 2011-06-14 16:22+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: omercigingelini\n" "Language-Team: omercigingelini\n" @@ -774,10 +774,10 @@ msgstr "Nasıl güncellemek istiyorsun?" msgid "How to Shutdown?" msgstr "Nasıl Kapansın?" -msgid "Import categories" +msgid "Import Categories" msgstr "" -msgid "Import categories from WiiTDB" +msgid "Import categories" msgstr "" msgid "Import operation successfully completed." @@ -1152,6 +1152,9 @@ msgstr "" msgid "Rename Game on WBFS" msgstr "WBFS'deki oyunu yeniden isimlendir" +msgid "Rename category" +msgstr "" + msgid "Reset" msgstr "" diff --git a/Makefile b/Makefile index ed6edcab..5547ce3d 100644 --- a/Makefile +++ b/Makefile @@ -17,10 +17,7 @@ include $(DEVKITPPC)/wii_rules TARGET := boot BUILD := build SOURCES := source \ - source/libwiigui \ - source/images \ - source/fonts \ - source/sounds \ + source/GUI \ source/Controls \ source/system \ source/libs/libwbfs \ @@ -48,7 +45,10 @@ SOURCES := source \ source/utils \ source/utils/minizip \ source/usbloader/wbfs -DATA := data +DATA := data \ + data/images \ + data/fonts \ + data/sounds INCLUDES := source #--------------------------------------------------------------------------------- @@ -97,19 +97,20 @@ export DEPSDIR := $(CURDIR)/$(BUILD) # automatically build a list of object files for our project #--------------------------------------------------------------------------------- SVNREV := $(shell bash ./svnrev.sh) +IMPORTFILES := $(shell bash ./filelist.sh) export CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) export CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) -ELFFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.elf))) +ELFFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.elf))) BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.bin))) -TTFFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.ttf))) -PNGFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.png))) -OGGFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.ogg))) -PCMFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.pcm))) -WAVFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.wav))) +TTFFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.ttf))) +PNGFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.png))) +OGGFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.ogg))) +PCMFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.pcm))) +WAVFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.wav))) DOLFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.dol))) -MP3FILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.mp3))) +MP3FILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.mp3))) #--------------------------------------------------------------------------------- # use CXX for linking C++ projects, CC for standard C @@ -120,12 +121,12 @@ else export LD := $(CXX) endif -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ +export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ $(sFILES:.s=.o) $(SFILES:.S=.o) \ - $(TTFFILES:.ttf=.ttf.o) $(PNGFILES:.png=.png.o) $(addsuffix .o,$(DOLFILES))\ + $(TTFFILES:.ttf=.ttf.o) $(PNGFILES:.png=.png.o) $(addsuffix .o,$(DOLFILES)) \ $(OGGFILES:.ogg=.ogg.o) $(PCMFILES:.pcm=.pcm.o) $(MP3FILES:.mp3=.mp3.o) \ - $(WAVFILES:.wav=.wav.o) $(addsuffix .o,$(ELFFILES)) $(CURDIR)/data/magic_patcher.o + $(WAVFILES:.wav=.wav.o) $(addsuffix .o,$(ELFFILES)) $(addsuffix .o,$(BINFILES)) \ + $(CURDIR)/data/magic_patcher.o #--------------------------------------------------------------------------------- # build a list of include paths diff --git a/Themes/Default.them b/Themes/Default.them index 92e4ae55..3cf85f9f 100644 --- a/Themes/Default.them +++ b/Themes/Default.them @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-03 22:18+0200\n" +"POT-Creation-Date: 2011-06-14 16:37+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" @@ -19,15 +19,36 @@ msgstr "" "Theme-Team: Example\n" "Theme-Version: Example\n" -msgid "r=0 g=0 b=0 a=255 - prompt windows text color" +msgid "right - checkbox browser scrollbar align hor" msgstr "" -msgid "r=0 g=0 b=0 a=255 - settings text color" +msgid "top - checkbox browser scrollbar align ver" +msgstr "" + +msgid "0 - checkbox browser scrollbar pos x" +msgstr "" + +msgid "5 - checkbox browser scrollbar pos y" +msgstr "" + +msgid "r=0 g=0 b=0 a=255 - checkbox browser text color" msgstr "" msgid "9 - game list browser page size" msgstr "" +msgid "right - game browser scrollbar align hor" +msgstr "" + +msgid "top - game browser scrollbar align ver" +msgstr "" + +msgid "0 - game browser scrollbar pos x" +msgstr "" + +msgid "5 - game browser scrollbar pos y" +msgstr "" + msgid "r=0 g=0 b=0 a=255 - game browser list text color" msgstr "" @@ -70,6 +91,24 @@ msgstr "" msgid "255 - tooltip alpha" msgstr "" +msgid "right - options browser scrollbar align hor" +msgstr "" + +msgid "top - options browser scrollbar align ver" +msgstr "" + +msgid "0 - options browser scrollbar pos x" +msgstr "" + +msgid "5 - options browser scrollbar pos y" +msgstr "" + +msgid "r=0 g=0 b=0 a=255 - settings text color" +msgstr "" + +msgid "r=0 g=0 b=0 a=255 - prompt windows button text color" +msgstr "" + msgid "r=55 g=190 b=237 a=255 - hdd info color" msgstr "" @@ -376,6 +415,9 @@ msgstr "" msgid "288 - carousel layout category btn pos x widescreen" msgstr "" +msgid "13 - carousel layout category btn pos y" +msgstr "" + msgid "320 - carousel layout list btn pos x" msgstr "" @@ -451,11 +493,176 @@ msgstr "" msgid "68 - region info text pos x" msgstr "" +msgid "r=0 g=0 b=0 a=255 - category prompt title text color" +msgstr "" + +msgid "center - category prompt title text align hor" +msgstr "" + +msgid "top - category prompt title text align ver" +msgstr "" + +msgid "0 - category prompt title text pos x" +msgstr "" + +msgid "10 - category prompt title text pos y" +msgstr "" + +msgid "center - category prompt browser align hor" +msgstr "" + +msgid "top - category prompt browser align ver" +msgstr "" + +msgid "0 - category prompt browser pos x" +msgstr "" + +msgid "45 - category prompt browser pos y" +msgstr "" + +msgid "left - category prompt add button text align hor" +msgstr "" + +msgid "top - category prompt add button text align ver" +msgstr "" + +msgid "10 - category prompt add button text pos x" +msgstr "" + +msgid "6 - category prompt add button text pos y" +msgstr "" + +msgid "left - category prompt add button align hor" +msgstr "" + +msgid "top - category prompt add button align ver" +msgstr "" + +msgid "180 - category prompt add button pos x" +msgstr "" + +msgid "330 - category prompt add button pos y" +msgstr "" + +msgid "left - category prompt delete button text align hor" +msgstr "" + +msgid "top - category prompt delete button text align ver" +msgstr "" + +msgid "10 - category prompt delete button text pos x" +msgstr "" + +msgid "6 - category prompt delete button text pos y" +msgstr "" + +msgid "left - category prompt delete button align hor" +msgstr "" + +msgid "top - category prompt delete button align ver" +msgstr "" + +msgid "330 - category prompt delete button pos y" +msgstr "" + +msgid "5 - category prompt delete button pos x" +msgstr "" + +msgid "left - category prompt edit button text align hor" +msgstr "" + +msgid "top - category prompt edit button text align ver" +msgstr "" + +msgid "10 - category prompt edit button text pos x" +msgstr "" + +msgid "6 - category prompt edit button text pos y" +msgstr "" + +msgid "left - category prompt edit button align hor" +msgstr "" + +msgid "top - category prompt edit button align ver" +msgstr "" + +msgid "180 - category prompt edit button pos x" +msgstr "" + +msgid "362 - category prompt edit button pos y" +msgstr "" + +msgid "bottom - category prompt save button align ver" +msgstr "" + +msgid "center - category prompt save button align hor" +msgstr "" + +msgid "-110 - category prompt save button pos x" +msgstr "" + +msgid "0 - category prompt save button pos y" +msgstr "" + +msgid "bottom - category prompt back button align ver" +msgstr "" + +msgid "center - category prompt back button align hor" +msgstr "" + +msgid "0 - category prompt back button pos y" +msgstr "" + +msgid "110 - category prompt back button pos x" +msgstr "" + +msgid "r=0 g=0 b=0 a=255 - prompt windows text color" +msgstr "" + +msgid "r=0 g=0 b=0 a=255 - game window name text color" +msgstr "" + +msgid "r=0 g=0 b=0 a=255 - game window size text color" +msgstr "" + +msgid "r=0 g=0 b=0 a=255 - game window playcount text color" +msgstr "" + msgid "r=0 g=0 b=0 a=255 - game window details button text color" msgstr "" msgid "r=30 g=30 b=240 a=255 - game window details button over text color" msgstr "" +msgid "center - settings option browser align hor" +msgstr "" + +msgid "top - settings option browser align ver" +msgstr "" + +msgid "0 - settings option browser pos x" +msgstr "" + +msgid "90 - settings option browser pos y" +msgstr "" + +msgid "r=0 g=0 b=0 a=255 - settings title text color" +msgstr "" + +msgid "center - settings title text align hor" +msgstr "" + +msgid "top - settings title text align ver" +msgstr "" + +msgid "0 - settings title text pos x" +msgstr "" + +msgid "40 - settings title text pos y" +msgstr "" + +msgid "310 - settings title text max width" +msgstr "" + msgid "1 - Enable tooltips: 0 for off and 1 for on" msgstr "" diff --git a/data/certs.dat b/data/certs.dat deleted file mode 100644 index 2184107d..00000000 Binary files a/data/certs.dat and /dev/null differ diff --git a/source/fonts/clock.ttf b/data/fonts/clock.ttf similarity index 100% rename from source/fonts/clock.ttf rename to data/fonts/clock.ttf diff --git a/source/fonts/font.ttf b/data/fonts/font.ttf similarity index 100% rename from source/fonts/font.ttf rename to data/fonts/font.ttf diff --git a/data/haxx.certs b/data/haxx.certs deleted file mode 100644 index 32dd50ca..00000000 Binary files a/data/haxx.certs and /dev/null differ diff --git a/source/images/abcIcon.png b/data/images/abcIcon.png similarity index 100% rename from source/images/abcIcon.png rename to data/images/abcIcon.png diff --git a/source/images/add.png b/data/images/add.png similarity index 100% rename from source/images/add.png rename to data/images/add.png diff --git a/source/images/addressbar_textbox.png b/data/images/addressbar_textbox.png similarity index 100% rename from source/images/addressbar_textbox.png rename to data/images/addressbar_textbox.png diff --git a/source/images/arrangeCarousel.png b/data/images/arrangeCarousel.png similarity index 100% rename from source/images/arrangeCarousel.png rename to data/images/arrangeCarousel.png diff --git a/source/images/arrangeCarousel_gray.png b/data/images/arrangeCarousel_gray.png similarity index 100% rename from source/images/arrangeCarousel_gray.png rename to data/images/arrangeCarousel_gray.png diff --git a/source/images/arrangeGrid.png b/data/images/arrangeGrid.png similarity index 100% rename from source/images/arrangeGrid.png rename to data/images/arrangeGrid.png diff --git a/source/images/arrangeGrid_gray.png b/data/images/arrangeGrid_gray.png similarity index 100% rename from source/images/arrangeGrid_gray.png rename to data/images/arrangeGrid_gray.png diff --git a/source/images/arrangeList.png b/data/images/arrangeList.png similarity index 100% rename from source/images/arrangeList.png rename to data/images/arrangeList.png diff --git a/source/images/arrangeList_gray.png b/data/images/arrangeList_gray.png similarity index 100% rename from source/images/arrangeList_gray.png rename to data/images/arrangeList_gray.png diff --git a/source/images/background.png b/data/images/background.png similarity index 100% rename from source/images/background.png rename to data/images/background.png diff --git a/source/images/balanceboard.png b/data/images/balanceboard.png similarity index 100% rename from source/images/balanceboard.png rename to data/images/balanceboard.png diff --git a/source/images/balanceboardR.png b/data/images/balanceboardR.png similarity index 100% rename from source/images/balanceboardR.png rename to data/images/balanceboardR.png diff --git a/source/images/battery.png b/data/images/battery.png similarity index 100% rename from source/images/battery.png rename to data/images/battery.png diff --git a/source/images/battery_bar.png b/data/images/battery_bar.png similarity index 100% rename from source/images/battery_bar.png rename to data/images/battery_bar.png diff --git a/source/images/battery_bar_red.png b/data/images/battery_bar_red.png similarity index 100% rename from source/images/battery_bar_red.png rename to data/images/battery_bar_red.png diff --git a/source/images/battery_bar_white.png b/data/images/battery_bar_white.png similarity index 100% rename from source/images/battery_bar_white.png rename to data/images/battery_bar_white.png diff --git a/source/images/battery_red.png b/data/images/battery_red.png similarity index 100% rename from source/images/battery_red.png rename to data/images/battery_red.png diff --git a/source/images/battery_white.png b/data/images/battery_white.png similarity index 100% rename from source/images/battery_white.png rename to data/images/battery_white.png diff --git a/source/images/bg_browser.png b/data/images/bg_browser.png similarity index 100% rename from source/images/bg_browser.png rename to data/images/bg_browser.png diff --git a/data/images/bg_browser_selection.png b/data/images/bg_browser_selection.png new file mode 100644 index 00000000..d9f49780 Binary files /dev/null and b/data/images/bg_browser_selection.png differ diff --git a/source/images/bg_options.png b/data/images/bg_options.png similarity index 100% rename from source/images/bg_options.png rename to data/images/bg_options.png diff --git a/data/images/bg_options_entry.png b/data/images/bg_options_entry.png new file mode 100644 index 00000000..532b5e30 Binary files /dev/null and b/data/images/bg_options_entry.png differ diff --git a/source/images/bg_options_settings.png b/data/images/bg_options_settings.png similarity index 100% rename from source/images/bg_options_settings.png rename to data/images/bg_options_settings.png diff --git a/source/images/boxBorder.png b/data/images/boxBorder.png similarity index 100% rename from source/images/boxBorder.png rename to data/images/boxBorder.png diff --git a/source/images/browser.png b/data/images/browser.png similarity index 100% rename from source/images/browser.png rename to data/images/browser.png diff --git a/source/images/browser_over.png b/data/images/browser_over.png similarity index 100% rename from source/images/browser_over.png rename to data/images/browser_over.png diff --git a/source/images/button_dialogue_box.png b/data/images/button_dialogue_box.png similarity index 100% rename from source/images/button_dialogue_box.png rename to data/images/button_dialogue_box.png diff --git a/source/images/button_install.png b/data/images/button_install.png similarity index 100% rename from source/images/button_install.png rename to data/images/button_install.png diff --git a/source/images/button_install_over.png b/data/images/button_install_over.png similarity index 100% rename from source/images/button_install_over.png rename to data/images/button_install_over.png diff --git a/source/images/category.png b/data/images/category.png similarity index 100% rename from source/images/category.png rename to data/images/category.png diff --git a/data/images/categoryPrompt.png b/data/images/categoryPrompt.png new file mode 100644 index 00000000..8066e134 Binary files /dev/null and b/data/images/categoryPrompt.png differ diff --git a/source/images/category_gray.png b/data/images/category_gray.png similarity index 100% rename from source/images/category_gray.png rename to data/images/category_gray.png diff --git a/source/images/cero_a.png b/data/images/cero_a.png similarity index 100% rename from source/images/cero_a.png rename to data/images/cero_a.png diff --git a/source/images/cero_b.png b/data/images/cero_b.png similarity index 100% rename from source/images/cero_b.png rename to data/images/cero_b.png diff --git a/source/images/cero_c.png b/data/images/cero_c.png similarity index 100% rename from source/images/cero_c.png rename to data/images/cero_c.png diff --git a/source/images/cero_d.png b/data/images/cero_d.png similarity index 100% rename from source/images/cero_d.png rename to data/images/cero_d.png diff --git a/source/images/cero_z.png b/data/images/cero_z.png similarity index 100% rename from source/images/cero_z.png rename to data/images/cero_z.png diff --git a/source/images/Channel_btn.png b/data/images/channel_btn.png similarity index 100% rename from source/images/Channel_btn.png rename to data/images/channel_btn.png diff --git a/data/images/checkBoxSelection.png b/data/images/checkBoxSelection.png new file mode 100644 index 00000000..4b01949c Binary files /dev/null and b/data/images/checkBoxSelection.png differ diff --git a/source/images/classiccontroller.png b/data/images/classiccontroller.png similarity index 100% rename from source/images/classiccontroller.png rename to data/images/classiccontroller.png diff --git a/source/images/classiccontrollerR.png b/data/images/classiccontrollerR.png similarity index 100% rename from source/images/classiccontrollerR.png rename to data/images/classiccontrollerR.png diff --git a/source/images/closebutton.png b/data/images/closebutton.png similarity index 100% rename from source/images/closebutton.png rename to data/images/closebutton.png diff --git a/source/images/credits_bg.png b/data/images/credits_bg.png similarity index 100% rename from source/images/credits_bg.png rename to data/images/credits_bg.png diff --git a/source/images/credits_button.png b/data/images/credits_button.png similarity index 100% rename from source/images/credits_button.png rename to data/images/credits_button.png diff --git a/source/images/credits_button_over.png b/data/images/credits_button_over.png similarity index 100% rename from source/images/credits_button_over.png rename to data/images/credits_button_over.png diff --git a/source/images/dancepad.png b/data/images/dancepad.png similarity index 100% rename from source/images/dancepad.png rename to data/images/dancepad.png diff --git a/source/images/dancepadR.png b/data/images/dancepadR.png similarity index 100% rename from source/images/dancepadR.png rename to data/images/dancepadR.png diff --git a/source/images/dialogue_box.png b/data/images/dialogue_box.png similarity index 100% rename from source/images/dialogue_box.png rename to data/images/dialogue_box.png diff --git a/source/images/dialogue_box_startgame.png b/data/images/dialogue_box_startgame.png similarity index 100% rename from source/images/dialogue_box_startgame.png rename to data/images/dialogue_box_startgame.png diff --git a/source/images/drums.png b/data/images/drums.png similarity index 100% rename from source/images/drums.png rename to data/images/drums.png diff --git a/source/images/drumsR.png b/data/images/drumsR.png similarity index 100% rename from source/images/drumsR.png rename to data/images/drumsR.png diff --git a/source/images/dvd.png b/data/images/dvd.png similarity index 100% rename from source/images/dvd.png rename to data/images/dvd.png diff --git a/source/images/dvd_gray.png b/data/images/dvd_gray.png similarity index 100% rename from source/images/dvd_gray.png rename to data/images/dvd_gray.png diff --git a/source/images/esrb_ao.png b/data/images/esrb_ao.png similarity index 100% rename from source/images/esrb_ao.png rename to data/images/esrb_ao.png diff --git a/source/images/esrb_e.png b/data/images/esrb_e.png similarity index 100% rename from source/images/esrb_e.png rename to data/images/esrb_e.png diff --git a/source/images/esrb_ec.png b/data/images/esrb_ec.png similarity index 100% rename from source/images/esrb_ec.png rename to data/images/esrb_ec.png diff --git a/source/images/esrb_eten.png b/data/images/esrb_eten.png similarity index 100% rename from source/images/esrb_eten.png rename to data/images/esrb_eten.png diff --git a/source/images/esrb_m.png b/data/images/esrb_m.png similarity index 100% rename from source/images/esrb_m.png rename to data/images/esrb_m.png diff --git a/source/images/esrb_t.png b/data/images/esrb_t.png similarity index 100% rename from source/images/esrb_t.png rename to data/images/esrb_t.png diff --git a/source/images/exit_bottom.png b/data/images/exit_bottom.png similarity index 100% rename from source/images/exit_bottom.png rename to data/images/exit_bottom.png diff --git a/source/images/exit_bottom_over.png b/data/images/exit_bottom_over.png similarity index 100% rename from source/images/exit_bottom_over.png rename to data/images/exit_bottom_over.png diff --git a/source/images/exit_button.png b/data/images/exit_button.png similarity index 100% rename from source/images/exit_button.png rename to data/images/exit_button.png diff --git a/source/images/exit_top.png b/data/images/exit_top.png similarity index 100% rename from source/images/exit_top.png rename to data/images/exit_top.png diff --git a/source/images/exit_top_over.png b/data/images/exit_top_over.png similarity index 100% rename from source/images/exit_top_over.png rename to data/images/exit_top_over.png diff --git a/source/images/favIcon.png b/data/images/favIcon.png similarity index 100% rename from source/images/favIcon.png rename to data/images/favIcon.png diff --git a/source/images/favIcon_gray.png b/data/images/favIcon_gray.png similarity index 100% rename from source/images/favIcon_gray.png rename to data/images/favIcon_gray.png diff --git a/source/images/favorite.png b/data/images/favorite.png similarity index 100% rename from source/images/favorite.png rename to data/images/favorite.png diff --git a/source/images/gameinfo1.png b/data/images/gameinfo1.png similarity index 100% rename from source/images/gameinfo1.png rename to data/images/gameinfo1.png diff --git a/source/images/gameinfo1a.png b/data/images/gameinfo1a.png similarity index 100% rename from source/images/gameinfo1a.png rename to data/images/gameinfo1a.png diff --git a/source/images/gameinfo2.png b/data/images/gameinfo2.png similarity index 100% rename from source/images/gameinfo2.png rename to data/images/gameinfo2.png diff --git a/source/images/gameinfo2a.png b/data/images/gameinfo2a.png similarity index 100% rename from source/images/gameinfo2a.png rename to data/images/gameinfo2a.png diff --git a/source/images/gcncontroller.png b/data/images/gcncontroller.png similarity index 100% rename from source/images/gcncontroller.png rename to data/images/gcncontroller.png diff --git a/source/images/gcncontrollerR.png b/data/images/gcncontrollerR.png similarity index 100% rename from source/images/gcncontrollerR.png rename to data/images/gcncontrollerR.png diff --git a/source/images/guitar.png b/data/images/guitar.png similarity index 100% rename from source/images/guitar.png rename to data/images/guitar.png diff --git a/source/images/guitarR.png b/data/images/guitarR.png similarity index 100% rename from source/images/guitarR.png rename to data/images/guitarR.png diff --git a/source/images/gxlogo.png b/data/images/gxlogo.png similarity index 100% rename from source/images/gxlogo.png rename to data/images/gxlogo.png diff --git a/source/images/icon_folder.png b/data/images/icon_folder.png similarity index 100% rename from source/images/icon_folder.png rename to data/images/icon_folder.png diff --git a/source/images/keyboard_backspace_over.png b/data/images/keyboard_backspace_over.png similarity index 100% rename from source/images/keyboard_backspace_over.png rename to data/images/keyboard_backspace_over.png diff --git a/source/images/keyboard_clear_over.png b/data/images/keyboard_clear_over.png similarity index 100% rename from source/images/keyboard_clear_over.png rename to data/images/keyboard_clear_over.png diff --git a/source/images/keyboard_key.png b/data/images/keyboard_key.png similarity index 100% rename from source/images/keyboard_key.png rename to data/images/keyboard_key.png diff --git a/source/images/keyboard_key_over.png b/data/images/keyboard_key_over.png similarity index 100% rename from source/images/keyboard_key_over.png rename to data/images/keyboard_key_over.png diff --git a/source/images/keyboard_largekey_over.png b/data/images/keyboard_largekey_over.png similarity index 100% rename from source/images/keyboard_largekey_over.png rename to data/images/keyboard_largekey_over.png diff --git a/source/images/keyboard_mediumkey_over.png b/data/images/keyboard_mediumkey_over.png similarity index 100% rename from source/images/keyboard_mediumkey_over.png rename to data/images/keyboard_mediumkey_over.png diff --git a/source/images/keyboard_textbox.png b/data/images/keyboard_textbox.png similarity index 100% rename from source/images/keyboard_textbox.png rename to data/images/keyboard_textbox.png diff --git a/source/images/little_star.png b/data/images/little_star.png similarity index 100% rename from source/images/little_star.png rename to data/images/little_star.png diff --git a/source/images/lock.png b/data/images/lock.png similarity index 100% rename from source/images/lock.png rename to data/images/lock.png diff --git a/source/images/lock_gray.png b/data/images/lock_gray.png similarity index 100% rename from source/images/lock_gray.png rename to data/images/lock_gray.png diff --git a/source/images/menu_button.png b/data/images/menu_button.png similarity index 100% rename from source/images/menu_button.png rename to data/images/menu_button.png diff --git a/source/images/menu_button_over.png b/data/images/menu_button_over.png similarity index 100% rename from source/images/menu_button_over.png rename to data/images/menu_button_over.png diff --git a/source/images/microphone.png b/data/images/microphone.png similarity index 100% rename from source/images/microphone.png rename to data/images/microphone.png diff --git a/source/images/microphoneR.png b/data/images/microphoneR.png similarity index 100% rename from source/images/microphoneR.png rename to data/images/microphoneR.png diff --git a/source/images/motionplus.png b/data/images/motionplus.png similarity index 100% rename from source/images/motionplus.png rename to data/images/motionplus.png diff --git a/source/images/motionplusR.png b/data/images/motionplusR.png similarity index 100% rename from source/images/motionplusR.png rename to data/images/motionplusR.png diff --git a/source/images/new.png b/data/images/new.png similarity index 100% rename from source/images/new.png rename to data/images/new.png diff --git a/source/images/nintendods.png b/data/images/nintendods.png similarity index 100% rename from source/images/nintendods.png rename to data/images/nintendods.png diff --git a/source/images/nintendodsR.png b/data/images/nintendodsR.png similarity index 100% rename from source/images/nintendodsR.png rename to data/images/nintendodsR.png diff --git a/source/images/nocover.png b/data/images/nocover.png similarity index 100% rename from source/images/nocover.png rename to data/images/nocover.png diff --git a/source/images/nocoverFlat.png b/data/images/nocoverFlat.png similarity index 100% rename from source/images/nocoverFlat.png rename to data/images/nocoverFlat.png diff --git a/source/images/nocoverFull.png b/data/images/nocoverFull.png similarity index 100% rename from source/images/nocoverFull.png rename to data/images/nocoverFull.png diff --git a/source/images/nodisc.png b/data/images/nodisc.png similarity index 100% rename from source/images/nodisc.png rename to data/images/nodisc.png diff --git a/source/images/norating.png b/data/images/norating.png similarity index 100% rename from source/images/norating.png rename to data/images/norating.png diff --git a/source/images/not_favorite.png b/data/images/not_favorite.png similarity index 100% rename from source/images/not_favorite.png rename to data/images/not_favorite.png diff --git a/source/images/nunchuk.png b/data/images/nunchuk.png similarity index 100% rename from source/images/nunchuk.png rename to data/images/nunchuk.png diff --git a/source/images/nunchukR.png b/data/images/nunchukR.png similarity index 100% rename from source/images/nunchukR.png rename to data/images/nunchukR.png diff --git a/data/images/oneButtonScroll.png b/data/images/oneButtonScroll.png new file mode 100644 index 00000000..fe89678d Binary files /dev/null and b/data/images/oneButtonScroll.png differ diff --git a/source/images/pageindicator.png b/data/images/pageindicator.png similarity index 100% rename from source/images/pageindicator.png rename to data/images/pageindicator.png diff --git a/source/images/pegi_12.png b/data/images/pegi_12.png similarity index 100% rename from source/images/pegi_12.png rename to data/images/pegi_12.png diff --git a/source/images/pegi_16.png b/data/images/pegi_16.png similarity index 100% rename from source/images/pegi_16.png rename to data/images/pegi_16.png diff --git a/source/images/pegi_18.png b/data/images/pegi_18.png similarity index 100% rename from source/images/pegi_18.png rename to data/images/pegi_18.png diff --git a/source/images/pegi_3.png b/data/images/pegi_3.png similarity index 100% rename from source/images/pegi_3.png rename to data/images/pegi_3.png diff --git a/source/images/pegi_7.png b/data/images/pegi_7.png similarity index 100% rename from source/images/pegi_7.png rename to data/images/pegi_7.png diff --git a/source/images/playCountIcon.png b/data/images/playCountIcon.png similarity index 100% rename from source/images/playCountIcon.png rename to data/images/playCountIcon.png diff --git a/source/images/player1_grab.png b/data/images/player1_grab.png similarity index 100% rename from source/images/player1_grab.png rename to data/images/player1_grab.png diff --git a/source/images/player1_point.png b/data/images/player1_point.png similarity index 100% rename from source/images/player1_point.png rename to data/images/player1_point.png diff --git a/source/images/player2_grab.png b/data/images/player2_grab.png similarity index 100% rename from source/images/player2_grab.png rename to data/images/player2_grab.png diff --git a/source/images/player2_point.png b/data/images/player2_point.png similarity index 100% rename from source/images/player2_point.png rename to data/images/player2_point.png diff --git a/source/images/player3_grab.png b/data/images/player3_grab.png similarity index 100% rename from source/images/player3_grab.png rename to data/images/player3_grab.png diff --git a/source/images/player3_point.png b/data/images/player3_point.png similarity index 100% rename from source/images/player3_point.png rename to data/images/player3_point.png diff --git a/source/images/player4_grab.png b/data/images/player4_grab.png similarity index 100% rename from source/images/player4_grab.png rename to data/images/player4_grab.png diff --git a/source/images/player4_point.png b/data/images/player4_point.png similarity index 100% rename from source/images/player4_point.png rename to data/images/player4_point.png diff --git a/source/images/playersSort.png b/data/images/playersSort.png similarity index 100% rename from source/images/playersSort.png rename to data/images/playersSort.png diff --git a/source/images/progressbar.png b/data/images/progressbar.png similarity index 100% rename from source/images/progressbar.png rename to data/images/progressbar.png diff --git a/source/images/progressbar_empty.png b/data/images/progressbar_empty.png similarity index 100% rename from source/images/progressbar_empty.png rename to data/images/progressbar_empty.png diff --git a/source/images/progressbar_outline.png b/data/images/progressbar_outline.png similarity index 100% rename from source/images/progressbar_outline.png rename to data/images/progressbar_outline.png diff --git a/source/images/rankIcon.png b/data/images/rankIcon.png similarity index 100% rename from source/images/rankIcon.png rename to data/images/rankIcon.png diff --git a/source/images/remove.png b/data/images/remove.png similarity index 100% rename from source/images/remove.png rename to data/images/remove.png diff --git a/data/images/rename.png b/data/images/rename.png new file mode 100644 index 00000000..5f089f58 Binary files /dev/null and b/data/images/rename.png differ diff --git a/source/images/rplayer1_point.png b/data/images/rplayer1_point.png similarity index 100% rename from source/images/rplayer1_point.png rename to data/images/rplayer1_point.png diff --git a/source/images/rplayer2_point.png b/data/images/rplayer2_point.png similarity index 100% rename from source/images/rplayer2_point.png rename to data/images/rplayer2_point.png diff --git a/source/images/rplayer3_point.png b/data/images/rplayer3_point.png similarity index 100% rename from source/images/rplayer3_point.png rename to data/images/rplayer3_point.png diff --git a/source/images/rplayer4_point.png b/data/images/rplayer4_point.png similarity index 100% rename from source/images/rplayer4_point.png rename to data/images/rplayer4_point.png diff --git a/data/images/scrollBarBottom.png b/data/images/scrollBarBottom.png new file mode 100644 index 00000000..426fdc25 Binary files /dev/null and b/data/images/scrollBarBottom.png differ diff --git a/data/images/scrollBarTile.png b/data/images/scrollBarTile.png new file mode 100644 index 00000000..d50b3b6e Binary files /dev/null and b/data/images/scrollBarTile.png differ diff --git a/data/images/scrollBarTop.png b/data/images/scrollBarTop.png new file mode 100644 index 00000000..60c39133 Binary files /dev/null and b/data/images/scrollBarTop.png differ diff --git a/data/images/scrollbar_arrowdown.png b/data/images/scrollbar_arrowdown.png new file mode 100644 index 00000000..e415212a Binary files /dev/null and b/data/images/scrollbar_arrowdown.png differ diff --git a/data/images/scrollbar_arrowup.png b/data/images/scrollbar_arrowup.png new file mode 100644 index 00000000..14f465ad Binary files /dev/null and b/data/images/scrollbar_arrowup.png differ diff --git a/data/images/scrollbar_box.png b/data/images/scrollbar_box.png new file mode 100644 index 00000000..ada1580f Binary files /dev/null and b/data/images/scrollbar_box.png differ diff --git a/source/images/sdcard.png b/data/images/sdcard.png similarity index 100% rename from source/images/sdcard.png rename to data/images/sdcard.png diff --git a/source/images/sdcard_over.png b/data/images/sdcard_over.png similarity index 100% rename from source/images/sdcard_over.png rename to data/images/sdcard_over.png diff --git a/source/images/searchIcon.png b/data/images/searchIcon.png similarity index 100% rename from source/images/searchIcon.png rename to data/images/searchIcon.png diff --git a/source/images/searchIcon_gray.png b/data/images/searchIcon_gray.png similarity index 100% rename from source/images/searchIcon_gray.png rename to data/images/searchIcon_gray.png diff --git a/source/images/settings_background.png b/data/images/settings_background.png similarity index 100% rename from source/images/settings_background.png rename to data/images/settings_background.png diff --git a/source/images/settings_button.png b/data/images/settings_button.png similarity index 100% rename from source/images/settings_button.png rename to data/images/settings_button.png diff --git a/source/images/settings_button_over.png b/data/images/settings_button_over.png similarity index 100% rename from source/images/settings_button_over.png rename to data/images/settings_button_over.png diff --git a/source/images/settings_title.png b/data/images/settings_title.png similarity index 100% rename from source/images/settings_title.png rename to data/images/settings_title.png diff --git a/source/images/settings_title_over.png b/data/images/settings_title_over.png similarity index 100% rename from source/images/settings_title_over.png rename to data/images/settings_title_over.png diff --git a/source/images/startgame_arrow_left.png b/data/images/startgame_arrow_left.png similarity index 100% rename from source/images/startgame_arrow_left.png rename to data/images/startgame_arrow_left.png diff --git a/source/images/startgame_arrow_right.png b/data/images/startgame_arrow_right.png similarity index 100% rename from source/images/startgame_arrow_right.png rename to data/images/startgame_arrow_right.png diff --git a/source/images/theme_box.png b/data/images/theme_box.png similarity index 100% rename from source/images/theme_box.png rename to data/images/theme_box.png diff --git a/source/images/theme_dialogue_box.png b/data/images/theme_dialogue_box.png similarity index 100% rename from source/images/theme_dialogue_box.png rename to data/images/theme_dialogue_box.png diff --git a/source/images/tooltip_left.png b/data/images/tooltip_left.png similarity index 100% rename from source/images/tooltip_left.png rename to data/images/tooltip_left.png diff --git a/source/images/tooltip_right.png b/data/images/tooltip_right.png similarity index 100% rename from source/images/tooltip_right.png rename to data/images/tooltip_right.png diff --git a/source/images/tooltip_tile.png b/data/images/tooltip_tile.png similarity index 100% rename from source/images/tooltip_tile.png rename to data/images/tooltip_tile.png diff --git a/source/images/unlock.png b/data/images/unlock.png similarity index 100% rename from source/images/unlock.png rename to data/images/unlock.png diff --git a/source/images/unlock_gray.png b/data/images/unlock_gray.png similarity index 100% rename from source/images/unlock_gray.png rename to data/images/unlock_gray.png diff --git a/source/images/wbackground.png b/data/images/wbackground.png similarity index 100% rename from source/images/wbackground.png rename to data/images/wbackground.png diff --git a/source/images/wdialogue_box_startgame.png b/data/images/wdialogue_box_startgame.png similarity index 100% rename from source/images/wdialogue_box_startgame.png rename to data/images/wdialogue_box_startgame.png diff --git a/source/images/wheel.png b/data/images/wheel.png similarity index 100% rename from source/images/wheel.png rename to data/images/wheel.png diff --git a/source/images/wheelR.png b/data/images/wheelR.png similarity index 100% rename from source/images/wheelR.png rename to data/images/wheelR.png diff --git a/source/images/wifi1.png b/data/images/wifi1.png similarity index 100% rename from source/images/wifi1.png rename to data/images/wifi1.png diff --git a/source/images/wifi12.png b/data/images/wifi12.png similarity index 100% rename from source/images/wifi12.png rename to data/images/wifi12.png diff --git a/source/images/wifi16.png b/data/images/wifi16.png similarity index 100% rename from source/images/wifi16.png rename to data/images/wifi16.png diff --git a/source/images/wifi2.png b/data/images/wifi2.png similarity index 100% rename from source/images/wifi2.png rename to data/images/wifi2.png diff --git a/source/images/wifi3.png b/data/images/wifi3.png similarity index 100% rename from source/images/wifi3.png rename to data/images/wifi3.png diff --git a/source/images/wifi32.png b/data/images/wifi32.png similarity index 100% rename from source/images/wifi32.png rename to data/images/wifi32.png diff --git a/source/images/wifi4.png b/data/images/wifi4.png similarity index 100% rename from source/images/wifi4.png rename to data/images/wifi4.png diff --git a/source/images/wifi8.png b/data/images/wifi8.png similarity index 100% rename from source/images/wifi8.png rename to data/images/wifi8.png diff --git a/source/images/Wifi_btn.png b/data/images/wifi_btn.png similarity index 100% rename from source/images/Wifi_btn.png rename to data/images/wifi_btn.png diff --git a/source/images/wiimote.png b/data/images/wiimote.png similarity index 100% rename from source/images/wiimote.png rename to data/images/wiimote.png diff --git a/source/images/Wiimote1.png b/data/images/wiimote1.png similarity index 100% rename from source/images/Wiimote1.png rename to data/images/wiimote1.png diff --git a/source/images/Wiimote2.png b/data/images/wiimote2.png similarity index 100% rename from source/images/Wiimote2.png rename to data/images/wiimote2.png diff --git a/source/images/Wiimote3.png b/data/images/wiimote3.png similarity index 100% rename from source/images/Wiimote3.png rename to data/images/wiimote3.png diff --git a/source/images/Wiimote4.png b/data/images/wiimote4.png similarity index 100% rename from source/images/Wiimote4.png rename to data/images/wiimote4.png diff --git a/source/images/wiimote_poweroff.png b/data/images/wiimote_poweroff.png similarity index 100% rename from source/images/wiimote_poweroff.png rename to data/images/wiimote_poweroff.png diff --git a/source/images/wiimote_poweroff_over.png b/data/images/wiimote_poweroff_over.png similarity index 100% rename from source/images/wiimote_poweroff_over.png rename to data/images/wiimote_poweroff_over.png diff --git a/source/images/wiispeak.png b/data/images/wiispeak.png similarity index 100% rename from source/images/wiispeak.png rename to data/images/wiispeak.png diff --git a/source/images/wiispeakR.png b/data/images/wiispeakR.png similarity index 100% rename from source/images/wiispeakR.png rename to data/images/wiispeakR.png diff --git a/source/images/zapper.png b/data/images/zapper.png similarity index 100% rename from source/images/zapper.png rename to data/images/zapper.png diff --git a/source/images/zapperR.png b/data/images/zapperR.png similarity index 100% rename from source/images/zapperR.png rename to data/images/zapperR.png diff --git a/source/sounds/bg_music.ogg b/data/sounds/bg_music.ogg similarity index 100% rename from source/sounds/bg_music.ogg rename to data/sounds/bg_music.ogg diff --git a/source/sounds/button_click.wav b/data/sounds/button_click.wav similarity index 100% rename from source/sounds/button_click.wav rename to data/sounds/button_click.wav diff --git a/source/sounds/button_click2.wav b/data/sounds/button_click2.wav similarity index 100% rename from source/sounds/button_click2.wav rename to data/sounds/button_click2.wav diff --git a/source/sounds/button_over.wav b/data/sounds/button_over.wav similarity index 100% rename from source/sounds/button_over.wav rename to data/sounds/button_over.wav diff --git a/source/sounds/credits_music.ogg b/data/sounds/credits_music.ogg similarity index 100% rename from source/sounds/credits_music.ogg rename to data/sounds/credits_music.ogg diff --git a/source/sounds/menuin.ogg b/data/sounds/menuin.ogg similarity index 100% rename from source/sounds/menuin.ogg rename to data/sounds/menuin.ogg diff --git a/source/sounds/menuout.ogg b/data/sounds/menuout.ogg similarity index 100% rename from source/sounds/menuout.ogg rename to data/sounds/menuout.ogg diff --git a/source/sounds/success.ogg b/data/sounds/success.ogg similarity index 100% rename from source/sounds/success.ogg rename to data/sounds/success.ogg diff --git a/filelist.sh b/filelist.sh new file mode 100644 index 00000000..a91de27d --- /dev/null +++ b/filelist.sh @@ -0,0 +1,61 @@ +#! /bin/bash +# +# Automatic resource file list generation +# Created by Dimok + +outFile="./source/themes/filelist.h" +count_old=$(cat $outFile 2>/dev/null | tr -d '\n\n' | sed 's/[^0-9]*\([0-9]*\).*/\1/') + +count=0 +for i in $(find ./data/images/ ./data/sounds/ ./data/fonts/ -maxdepth 1 -type f \( ! -printf "%f\n" \)) +do + files[count]=$i + count=$((count+1)) +done + +if [ "$count_old" != "$count" ] || [ ! -f $outFile ] +then + +echo "Generating filelist.h for $count files." >&2 +cat < $outFile +/**************************************************************************** + * USB Loader GX resource files. + * This file is generated automatically. + * Includes $count files. + * + * NOTE: + * Any manual modification of this file will be overwriten by the generation. + ****************************************************************************/ +#ifndef _FILELIST_H_ +#define _FILELIST_H_ + +#include + +EOF + +for i in ${files[@]} +do + filename=${i%.*} + extension=${i##*.} + echo 'extern const u8 '$filename'_'$extension'[];' >> $outFile + echo 'extern const u32 '$filename'_'$extension'_size;' >> $outFile + echo '' >> $outFile +done + +echo 'RecourceFile Resources::RecourceFiles[] =' >> $outFile +echo '{' >> $outFile + +for i in ${files[@]} +do + filename=${i%.*} + extension=${i##*.} + echo -e '\t{"'$i'", '$filename'_'$extension', '$filename'_'$extension'_size, NULL, 0},' >> $outFile +done + +echo -e '\t{NULL, NULL, 0, NULL, 0}' >> $outFile +echo '};' >> $outFile + +echo '' >> $outFile +echo '#endif' >> $outFile + +fi diff --git a/gui.pnproj b/gui.pnproj index 68a2ffe4..11852976 100644 --- a/gui.pnproj +++ b/gui.pnproj @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/source/BoxCover/BoxCover.hpp b/source/BoxCover/BoxCover.hpp index 63c21382..bfe9564d 100644 --- a/source/BoxCover/BoxCover.hpp +++ b/source/BoxCover/BoxCover.hpp @@ -24,7 +24,7 @@ #ifndef BOX_COVER_HPP_ #define BOX_COVER_HPP_ -#include "libwiigui/gui.h" +#include "GUI/gui.h" #define EFFECT_BOX_FLY_CENTRE 0x2000000 #define EFFECT_BOX_FLY_BACK 0x4000000 diff --git a/source/Controls/DeviceHandler.cpp b/source/Controls/DeviceHandler.cpp index e5368026..82eaba86 100644 --- a/source/Controls/DeviceHandler.cpp +++ b/source/Controls/DeviceHandler.cpp @@ -161,11 +161,12 @@ static inline bool USBSpinUp() return started; } -bool DeviceHandler::SetUSBPort(int port) +bool DeviceHandler::SetUSBPort(int port, bool spinup) { int ret = USBStorage2_SetPort(port); - USBSpinUp(); + if(spinup) + USBSpinUp(); return ret >= 0; } diff --git a/source/Controls/DeviceHandler.hpp b/source/Controls/DeviceHandler.hpp index 9e6bc18f..5a55eaac 100644 --- a/source/Controls/DeviceHandler.hpp +++ b/source/Controls/DeviceHandler.hpp @@ -83,7 +83,7 @@ class DeviceHandler static const char * GetFSName(int dev); static const char * PathToFSName(const char * path) { return GetFSName(PathToDriveType(path)); }; static const DISC_INTERFACE * GetUSBInterface(); - static bool SetUSBPort(int port); + static bool SetUSBPort(int port, bool spinup = true); static void SetUSBPortFromPartition(int part); private: DeviceHandler() : sd(0), usb(0) { }; diff --git a/source/libwiigui/LoadCoverImage.cpp b/source/GUI/LoadCoverImage.cpp similarity index 98% rename from source/libwiigui/LoadCoverImage.cpp rename to source/GUI/LoadCoverImage.cpp index 7b39eb9e..1b9ae77c 100644 --- a/source/libwiigui/LoadCoverImage.cpp +++ b/source/GUI/LoadCoverImage.cpp @@ -1,4 +1,4 @@ -#include "libwiigui/gui.h" +#include "GUI/gui.h" #include "usbloader/disc.h" #include "FileOperations/fileops.h" #include "settings/CSettings.h" diff --git a/source/libwiigui/LoadCoverImage.h b/source/GUI/LoadCoverImage.h similarity index 100% rename from source/libwiigui/LoadCoverImage.h rename to source/GUI/LoadCoverImage.h diff --git a/source/libwiigui/OptionList.cpp b/source/GUI/OptionList.cpp similarity index 100% rename from source/libwiigui/OptionList.cpp rename to source/GUI/OptionList.cpp diff --git a/source/libwiigui/OptionList.hpp b/source/GUI/OptionList.hpp similarity index 100% rename from source/libwiigui/OptionList.hpp rename to source/GUI/OptionList.hpp diff --git a/source/libwiigui/Text.cpp b/source/GUI/Text.cpp similarity index 98% rename from source/libwiigui/Text.cpp rename to source/GUI/Text.cpp index e962c54e..aff1366c 100644 --- a/source/libwiigui/Text.cpp +++ b/source/GUI/Text.cpp @@ -218,7 +218,7 @@ void Text::FillRows() ClearDynamicText(); - for (int i = 0; i < linestodraw && i < (int) TextLines.size(); i++) + for (int i = 0; i < linestodraw && curLineStart+i < (int) TextLines.size(); i++) { if (i >= (int) textDyn.size()) { diff --git a/source/libwiigui/Text.hpp b/source/GUI/Text.hpp similarity index 98% rename from source/libwiigui/Text.hpp rename to source/GUI/Text.hpp index 6c171d82..bba86efc 100644 --- a/source/libwiigui/Text.hpp +++ b/source/GUI/Text.hpp @@ -1,7 +1,7 @@ #ifndef _TEXT_HPP_ #define _TEXT_HPP_ -#include "libwiigui/gui.h" +#include "GUI/gui.h" #include "wstring.hpp" typedef struct diff --git a/source/libwiigui/gui.h b/source/GUI/gui.h similarity index 88% rename from source/libwiigui/gui.h rename to source/GUI/gui.h index 8f023288..725ee663 100644 --- a/source/libwiigui/gui.h +++ b/source/GUI/gui.h @@ -1,33 +1,31 @@ -/*!\mainpage libwiigui Documentation +/**************************************************************************** + * LibWiiGui by Tantric (C) 2009 + * USB Loader GX Team (C) 2009-2011 * - * \section Introduction - * libwiigui is a GUI library for the Wii, created to help structure the - * design of a complicated GUI interface, and to enable an author to create - * a sophisticated, feature-rich GUI. It was originally conceived and written - * after I started to design a GUI for Snes9x GX, and found libwiisprite and - * GRRLIB inadequate for the purpose. It uses GX for drawing, and makes use - * of PNGU for displaying images and FreeTypeGX for text. It was designed to - * be flexible and is easy to modify - don't be afraid to change the way it - * works or expand it to suit your GUI's purposes! If you do, and you think - * your changes might benefit others, please share them so they might be - * added to the project! + * The LibWiiGui library was used as the base for the creation of + * the GUI in USB Loader GX. + * Several modifications and additions were made to the library + * It does no longer match the original LibWiiGui implementation. * - * \section Quickstart - * Start from the supplied template example. For more advanced uses, see the - * source code for Snes9x GX, FCE Ultra GX, and Visual Boy Advance GX. - - * \section Contact - * If you have any suggestions for the library or documentation, or want to - * contribute, please visit the libwiigui website: - - * http://code.google.com/p/libwiigui/ - * \section Credits - * This library was wholly designed and written by Tantric. Thanks to the - * authors of PNGU and FreeTypeGX, of which this library makes use. Thanks - * also to the authors of GRRLIB and libwiisprite for laying the foundations. + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any + * damages arising from the use of this software. * - */ - + * Permission is granted to anyone to use this software for any + * purpose, including commercial applications, and to alter it and + * redistribute it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you + * must not claim that you wrote the original software. If you use + * this software in a product, an acknowledgment in the product + * documentation would be appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and + * must not be misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + ***************************************************************************/ #ifndef LIBWIIGUI_H #define LIBWIIGUI_H @@ -334,6 +332,12 @@ class GuiElement //!\param x X coordinate //!\param y Y coordinate void SetPosition(int x, int y, int z = 0); + //!Sets the element's relative position + int GetRelLeft(); + int GetRelTop(); + //!Sets the element's setup position + int GetLeftPos() const { return xoffset; } + int GetTopPos() const { return yoffset; } //!Updates the element's effects (dynamic values) //!Called by Draw(), used for animation purposes void UpdateEffects(); @@ -548,7 +552,8 @@ class GuiImage: public GuiElement float GetAngle(); //!Sets the number of times to draw the image horizontally //!\param t Number of times to draw the image - void SetTile(int t); + void SetTileHorizontal(int t); + void SetTileVertical(int t); // true set horizontal scale to 0.8 //added void SetWidescreen(bool w); //!Constantly called to draw the image @@ -608,7 +613,8 @@ class GuiImage: public GuiElement int imgType; //!< Type of image data (IMAGE_TEXTURE, IMAGE_COLOR, IMAGE_DATA) u8 * image; //!< Poiner to image data. May be shared with GuiImageData data f32 imageangle; //!< Angle to draw the image - int tile; //!< Number of times to draw (tile) the image horizontally + int tileHorizontal; //!< Number of times to draw (tile) the image horizontally + int tileVertical; //!< Number of times to draw (tile) the image vertically int stripe; //!< Alpha value (0-255) to apply a stripe effect to the texture short widescreen; //added bool parentangle; @@ -972,120 +978,4 @@ class GuiNumpad: public GuiWindow GuiTrigger * trigB; }; -//!Display a list of menu options -class GuiOptionBrowser: public GuiElement -{ - public: - GuiOptionBrowser(int w, int h, OptionList * l, const char *imagebg, int scrollbar); - GuiOptionBrowser(int w, int h, OptionList * l, const char *imagebg, int scrollbar, int start); - ~GuiOptionBrowser(); - void SetCol2Position(int x); - int FindMenuItem(int c, int d); - int GetClickedOption(); - int GetSelectedOption(); - void ResetState(); - void SetFocus(int f); - void Draw(); - void TriggerUpdate(); - void Update(GuiTrigger * t); - GuiText * optionVal[PAGESIZE]; - protected: - int selectedItem; - int listOffset; - bool listChanged; - OptionList * options; - int optionIndex[PAGESIZE]; - GuiButton * optionBtn[PAGESIZE]; - GuiText * optionTxt[PAGESIZE]; - GuiImage * optionBg[PAGESIZE]; - - GuiButton * arrowUpBtn; - GuiButton * arrowDownBtn; - GuiButton * scrollbarBoxBtn; - - GuiImage * bgOptionsImg; - GuiImage * bgOptionsOverImg; - GuiImage * scrollbarImg; - GuiImage * arrowDownImg; - GuiImage * arrowDownOverImg; - GuiImage * arrowUpImg; - GuiImage * arrowUpOverImg; - GuiImage * scrollbarBoxImg; - GuiImage * scrollbarBoxOverImg; - - GuiImageData * bgOptions; - GuiImageData * bgOptionsOver; - GuiImageData * bgOptionsEntry; - GuiImageData * scrollbar; - GuiImageData * arrowDown; - GuiImageData * arrowDownOver; - GuiImageData * arrowUp; - GuiImageData * arrowUpOver; - GuiImageData * scrollbarBox; - GuiImageData * scrollbarBoxOver; - - GuiTrigger * trigA; - GuiTrigger * trigB; - GuiTrigger * trigHeldA; -}; - -//!Display a list of files -class GuiFileBrowser: public GuiElement -{ - public: - GuiFileBrowser(int w, int h); - ~GuiFileBrowser(); - void DisableTriggerUpdate(bool set); - void ResetState(); - void SetFocus(int f); - void Draw(); - void TriggerUpdate(); - void Update(GuiTrigger * t); - GuiButton * fileList[PAGESIZE]; - protected: - int selectedItem; - bool listChanged; - bool triggerdisabled; - - GuiText * fileListText[PAGESIZE]; - GuiText * fileListTextOver[PAGESIZE]; - GuiImage * fileListBg[PAGESIZE]; - //GuiImage * fileListArchives[PAGESIZE]; - //GuiImage * fileListDefault[PAGESIZE]; - GuiImage * fileListFolder[PAGESIZE]; - //GuiImage * fileListGFX[PAGESIZE]; - //GuiImage * fileListPLS[PAGESIZE]; - //GuiImage * fileListSFX[PAGESIZE]; - //GuiImage * fileListTXT[PAGESIZE]; - //GuiImage * fileListXML[PAGESIZE]; - - GuiButton * arrowUpBtn; - GuiButton * arrowDownBtn; - GuiButton * scrollbarBoxBtn; - - GuiImage * bgFileSelectionImg; - GuiImage * scrollbarImg; - GuiImage * arrowDownImg; - GuiImage * arrowUpImg; - GuiImage * scrollbarBoxImg; - - GuiImageData * bgFileSelection; - GuiImageData * bgFileSelectionEntry; - //GuiImageData * fileArchives; - //GuiImageData * fileDefault; - GuiImageData * fileFolder; - //GuiImageData * fileGFX; - //GuiImageData * filePLS; - //GuiImageData * fileSFX; - //GuiImageData * fileTXT; - //GuiImageData * fileXML; - GuiImageData * scrollbar; - GuiImageData * arrowDown; - GuiImageData * arrowUp; - GuiImageData * scrollbarBox; - - GuiTrigger * trigA; - GuiTrigger * trigHeldA; -}; - #endif diff --git a/source/libwiigui/gui_box.cpp b/source/GUI/gui_box.cpp similarity index 100% rename from source/libwiigui/gui_box.cpp rename to source/GUI/gui_box.cpp diff --git a/source/libwiigui/gui_box.hpp b/source/GUI/gui_box.hpp similarity index 98% rename from source/libwiigui/gui_box.hpp rename to source/GUI/gui_box.hpp index 858afc91..e20b7bbc 100644 --- a/source/libwiigui/gui_box.hpp +++ b/source/GUI/gui_box.hpp @@ -24,7 +24,7 @@ #ifndef GUIBOX_HPP_ #define GUIBOX_HPP_ -#include "libwiigui/gui.h" +#include "GUI/gui.h" class GuiBox : public GuiElement { diff --git a/source/libwiigui/gui_button.cpp b/source/GUI/gui_button.cpp similarity index 97% rename from source/libwiigui/gui_button.cpp rename to source/GUI/gui_button.cpp index c5c87944..6f4b468e 100644 --- a/source/libwiigui/gui_button.cpp +++ b/source/GUI/gui_button.cpp @@ -311,17 +311,6 @@ void GuiButton::SetState(int s, int c) } Clicked(this, c, p); } - else if (s == STATE_HELD) - { - POINT p = {0, 0}; - - if (userInput[c].wpad.ir.valid) - { - p.x = userInput[c].wpad.ir.x; - p.y = userInput[c].wpad.ir.y; - } - Held(this, c, p); - } } /** @@ -533,6 +522,17 @@ void GuiButton::Update(GuiTrigger * t) { this->SetState(STATE_HELD, t->chan); } + else if (held && state == STATE_HELD && Held.connected()) + { + POINT p = {0, 0}; + + if (userInput[t->chan].wpad.ir.valid) + { + p.x = userInput[t->chan].wpad.ir.x; + p.y = userInput[t->chan].wpad.ir.y; + } + Held(this, t->chan, p); + } } } } diff --git a/source/libwiigui/gui_checkbox.cpp b/source/GUI/gui_checkbox.cpp similarity index 69% rename from source/libwiigui/gui_checkbox.cpp rename to source/GUI/gui_checkbox.cpp index 02c7698f..7a9572f9 100644 --- a/source/libwiigui/gui_checkbox.cpp +++ b/source/GUI/gui_checkbox.cpp @@ -68,6 +68,13 @@ void GuiCheckbox::SetSize(int w, int h) Blackbox.SetSize(w, h); Whitebox.SetSize(w-WHITEBOX_RED_SIZE, h-WHITEBOX_RED_SIZE); Whitebox.SetPosition(WHITEBOX_RED_SIZE/2, WHITEBOX_RED_SIZE/2); + SetAlignment(alignmentHor, alignmentVert); +} + +void GuiCheckbox::SetClickSize(int w, int h) +{ + width = w; + height = h; } void GuiCheckbox::SetTransparent(bool b) @@ -84,6 +91,40 @@ void GuiCheckbox::SetState(int s, int c) GuiButton::SetState(s, c); } +void GuiCheckbox::SetAlignment(int h, int v) +{ + GuiButton::SetAlignment(h, v); + Checksign.SetAlignment(h, v); + Cross.SetAlignment(h, v); + Blackbox.SetAlignment(h, v); + Whitebox.SetAlignment(h, v); + + if(h == ALIGN_RIGHT) + { + Checksign.SetPosition(-WHITEBOX_RED_SIZE/2, Checksign.GetTopPos()); + Cross.SetPosition(-WHITEBOX_RED_SIZE/2, Cross.GetTopPos()); + Whitebox.SetPosition(-WHITEBOX_RED_SIZE/2, Whitebox.GetTopPos()); + } + else if(h == ALIGN_CENTER) + { + Checksign.SetPosition(0, Checksign.GetTopPos()); + Cross.SetPosition(0, Cross.GetTopPos()); + Whitebox.SetPosition(0, Whitebox.GetTopPos()); + } + if(v == ALIGN_BOTTOM) + { + Checksign.SetPosition(Checksign.GetLeftPos(), -WHITEBOX_RED_SIZE/2); + Cross.SetPosition(Cross.GetLeftPos(), -WHITEBOX_RED_SIZE/2); + Whitebox.SetPosition(Whitebox.GetLeftPos(), -WHITEBOX_RED_SIZE/2); + } + else if(v == ALIGN_MIDDLE) + { + Checksign.SetPosition(Checksign.GetLeftPos(), 0); + Cross.SetPosition(Cross.GetLeftPos(), 0); + Whitebox.SetPosition(Whitebox.GetLeftPos(), 0); + } +} + void GuiCheckbox::Draw() { GuiButton::Draw(); diff --git a/source/libwiigui/gui_checkbox.hpp b/source/GUI/gui_checkbox.hpp similarity index 90% rename from source/libwiigui/gui_checkbox.hpp rename to source/GUI/gui_checkbox.hpp index 9a822b7e..884d3aa9 100644 --- a/source/libwiigui/gui_checkbox.hpp +++ b/source/GUI/gui_checkbox.hpp @@ -24,10 +24,10 @@ #ifndef GUICHECKBOX_HPP_ #define GUICHECKBOX_HPP_ -#include "libwiigui/gui.h" -#include "libwiigui/gui_box.hpp" -#include "libwiigui/gui_cross.hpp" -#include "libwiigui/gui_checksign.hpp" +#include "GUI/gui.h" +#include "GUI/gui_box.hpp" +#include "GUI/gui_cross.hpp" +#include "GUI/gui_checksign.hpp" class GuiCheckbox : public GuiButton { @@ -36,6 +36,8 @@ class GuiCheckbox : public GuiButton GuiCheckbox(int w, int h, int style = CHECKSIGN); void SetTransparent(bool b); void SetSize(int w, int h); + void SetClickSize(int w, int h); + void SetAlignment(int h, int v); void SetChecked(bool c) { LOCK(this); Checked = c; } bool IsChecked() const { return Checked; } virtual void SetState(int s, int c = -1); diff --git a/source/GUI/gui_checkboxbrowser.cpp b/source/GUI/gui_checkboxbrowser.cpp new file mode 100644 index 00000000..2ef44ddb --- /dev/null +++ b/source/GUI/gui_checkboxbrowser.cpp @@ -0,0 +1,200 @@ +/**************************************************************************** + * Copyright (C) 2011 + * by Dimok + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any + * damages arising from the use of this software. + * + * Permission is granted to anyone to use this software for any + * purpose, including commercial applications, and to alter it and + * redistribute it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you + * must not claim that you wrote the original software. If you use + * this software in a product, an acknowledgment in the product + * documentation would be appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and + * must not be misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + ***************************************************************************/ +#include "gui_checkboxbrowser.hpp" +#include "themes/Resources.h" +#include "themes/gettheme.h" +#include "wstring.hpp" + + +GuiCheckboxBrowser::GuiCheckboxBrowser(int w, int h, int s) + : scrollBar(h-10) +{ + width = w; + height = h; + backgroundImg = NULL; + selectedItem = 0; + pageIndex = 0; + pressedChan = -1; + maxSize = s; + scrollBar.SetParent(this); + scrollBar.SetAlignment(thAlign("right - checkbox browser scrollbar align hor"), thAlign("top - checkbox browser scrollbar align ver")); + scrollBar.SetPosition(thInt("0 - checkbox browser scrollbar pos x"), thInt("5 - checkbox browser scrollbar pos y")); + scrollBar.SetButtonScroll(WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B); + scrollBar.listChanged.connect(this, &GuiCheckboxBrowser::onListChange); + trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); + markImgData = Resources::GetImageData("checkBoxSelection.png"); + markImg = new GuiImage(markImgData); + markImg->SetParent(this); +} + +GuiCheckboxBrowser::~GuiCheckboxBrowser() +{ + Clear(); + + delete markImg; + delete markImgData; +} + +void GuiCheckboxBrowser::SetImage(GuiImage *Img) +{ + LOCK(this); + backgroundImg = Img; + if(backgroundImg) + backgroundImg->SetParent(this); +} + +void GuiCheckboxBrowser::Clear() +{ + LOCK(this); + for(u32 i = 0; i < checkBoxList.size(); ++i) + { + delete textLineList[i]; + delete checkBoxList[i]; + } + + textLineList.clear(); + checkBoxList.clear(); +} + +bool GuiCheckboxBrowser::AddEntrie(const string &text, bool checked) +{ + LOCK(this); + int currentSize = checkBoxList.size(); + textLineList.resize(currentSize+1); + checkBoxList.resize(currentSize+1); + + checkBoxList[currentSize] = new GuiCheckbox(30, 30); + checkBoxList[currentSize]->SetParent(this); + checkBoxList[currentSize]->SetChecked(checked); + checkBoxList[currentSize]->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); + checkBoxList[currentSize]->SetTrigger(&trigA); + checkBoxList[currentSize]->SetClickSize(width-30-scrollBar.GetWidth(), 30); + checkBoxList[currentSize]->Clicked.connect(this, &GuiCheckboxBrowser::OnCheckboxClick); + + textLineList[currentSize] = new GuiText(text.c_str(), 18, thColor("r=0 g=0 b=0 a=255 - checkbox browser text color")); + textLineList[currentSize]->SetParent(this); + textLineList[currentSize]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); + + if(textLineDrawn.size() < (u32) maxSize) + { + textLineDrawn.push_back(textLineList[currentSize]); + checkBoxDrawn.push_back(checkBoxList[currentSize]); + } + + return true; +} + +void GuiCheckboxBrowser::OnCheckboxClick(GuiButton *sender, int chan, const POINT &pointer) +{ + LOCK(this); + sender->ResetState(); + + for(u32 i = 0; i < checkBoxDrawn.size(); ++i) + { + if(sender == checkBoxDrawn[i]) + { + checkBoxClicked(checkBoxDrawn[i], pageIndex+i); + return; + } + } +} + +void GuiCheckboxBrowser::onListChange(int SelItem, int SelInd) +{ + selectedItem = SelItem; + pageIndex = SelInd; + RefreshList(); +} + +void GuiCheckboxBrowser::RefreshList() +{ + LOCK(this); + for(u32 i = 0; i < checkBoxDrawn.size(); i++) + { + checkBoxDrawn[i] = checkBoxList[pageIndex+i]; + checkBoxDrawn[i]->SetPosition(-scrollBar.GetWidth()-10, 15+i*(checkBoxDrawn[i]->GetHeight()+6)); + + textLineDrawn[i] = textLineList[pageIndex+i]; + textLineDrawn[i]->SetPosition(25, 15+i*(checkBoxDrawn[i]->GetHeight()+6)+(checkBoxDrawn[i]->GetHeight()-textLineDrawn[i]->GetFontSize())/2+2); + } +} + +void GuiCheckboxBrowser::Draw() +{ + if(backgroundImg) + backgroundImg->Draw(); + + if(checkBoxList.size() >= (u32) maxSize) + scrollBar.Draw(); + + for(u32 i = 0; i < checkBoxDrawn.size(); ++i) + { + textLineDrawn[i]->Draw(); + checkBoxDrawn[i]->Draw(); + } + + markImg->Draw(); +} + +void GuiCheckboxBrowser::Update(GuiTrigger *t) +{ + if(state == STATE_DISABLED || !t) + return; + + if(checkBoxList.size() >= maxSize) + scrollBar.Update(t); + + if((t->wpad.btns_d & (WPAD_BUTTON_B | WPAD_BUTTON_DOWN | WPAD_BUTTON_UP | WPAD_BUTTON_LEFT | WPAD_BUTTON_RIGHT | + WPAD_CLASSIC_BUTTON_B | WPAD_CLASSIC_BUTTON_UP | WPAD_CLASSIC_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_RIGHT)) || + (t->pad.btns_d & (PAD_BUTTON_UP | PAD_BUTTON_DOWN))) + pressedChan = t->chan; + + for(u32 i = 0; i < checkBoxDrawn.size(); i++) + { + if(pressedChan == -1 || (!t->wpad.btns_h && !t->pad.btns_h)) + { + if(i != (u32) selectedItem && checkBoxDrawn[i]->GetState() == STATE_SELECTED) + checkBoxDrawn[i]->ResetState(); + else if(i == (u32) selectedItem && checkBoxDrawn[i]->GetState() == STATE_DEFAULT) + checkBoxDrawn[selectedItem]->SetState(STATE_SELECTED, -1); + + + checkBoxDrawn[i]->Update(t); + + if(checkBoxDrawn[i]->GetState() == STATE_SELECTED) + selectedItem = i; + } + + if(i == (u32) selectedItem) + markImg->SetPosition(5, 15+i*(checkBoxDrawn[i]->GetHeight()+6)+(checkBoxDrawn[i]->GetHeight()-markImg->GetHeight())/2); + } + + if(pressedChan == t->chan && !t->wpad.btns_d && !t->wpad.btns_h) + pressedChan = -1; + + scrollBar.SetPageSize(checkBoxDrawn.size()); + scrollBar.SetSelectedItem(selectedItem); + scrollBar.SetSelectedIndex(pageIndex); + scrollBar.SetEntrieCount(checkBoxList.size()); +} diff --git a/source/GUI/gui_checkboxbrowser.hpp b/source/GUI/gui_checkboxbrowser.hpp new file mode 100644 index 00000000..1d3ad55d --- /dev/null +++ b/source/GUI/gui_checkboxbrowser.hpp @@ -0,0 +1,65 @@ +/**************************************************************************** + * Copyright (C) 2011 + * by Dimok + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any + * damages arising from the use of this software. + * + * Permission is granted to anyone to use this software for any + * purpose, including commercial applications, and to alter it and + * redistribute it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you + * must not claim that you wrote the original software. If you use + * this software in a product, an acknowledgment in the product + * documentation would be appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and + * must not be misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + ***************************************************************************/ +#ifndef CHECKBOXBROWSER_HPP_ +#define CHECKBOXBROWSER_HPP_ + +#include +#include +#include "gui_checkbox.hpp" +#include "gui_scrollbar.hpp" + +using namespace std; + +class GuiCheckboxBrowser : public GuiElement, public sigslot::has_slots<> +{ + public: + GuiCheckboxBrowser(int w, int h, int maxSize = 7); + ~GuiCheckboxBrowser(); + bool AddEntrie(const string &text, bool checked = false); + int GetSelected() const { return pageIndex+selectedItem; }; + void SetImage(GuiImage *Img); + void RefreshList(); + void Clear(); + void Draw(); + void Update(GuiTrigger *t); + sigslot::signal2 checkBoxClicked; + private: + void onListChange(int SelItem, int SelInd); + void OnCheckboxClick(GuiButton *sender, int chan, const POINT &pointer); + u16 maxSize; + int selectedItem; + int pageIndex; + int pressedChan; + GuiScrollbar scrollBar; + GuiTrigger trigA; + GuiImage *backgroundImg; + GuiImageData *markImgData; + GuiImage *markImg; + vector textLineDrawn; + vector checkBoxDrawn; + vector textLineList; + vector checkBoxList; +}; + +#endif diff --git a/source/libwiigui/gui_checksign.cpp b/source/GUI/gui_checksign.cpp similarity index 100% rename from source/libwiigui/gui_checksign.cpp rename to source/GUI/gui_checksign.cpp diff --git a/source/libwiigui/gui_checksign.hpp b/source/GUI/gui_checksign.hpp similarity index 98% rename from source/libwiigui/gui_checksign.hpp rename to source/GUI/gui_checksign.hpp index 2127312b..83842fe4 100644 --- a/source/libwiigui/gui_checksign.hpp +++ b/source/GUI/gui_checksign.hpp @@ -24,7 +24,7 @@ #ifndef GUICHECKSIGN_HPP_ #define GUICHECKSIGN_HPP_ -#include "libwiigui/gui.h" +#include "GUI/gui.h" class GuiChecksign : public GuiElement { diff --git a/source/libwiigui/gui_circle.cpp b/source/GUI/gui_circle.cpp similarity index 100% rename from source/libwiigui/gui_circle.cpp rename to source/GUI/gui_circle.cpp diff --git a/source/libwiigui/gui_circle.hpp b/source/GUI/gui_circle.hpp similarity index 98% rename from source/libwiigui/gui_circle.hpp rename to source/GUI/gui_circle.hpp index eada84e6..f90cd639 100644 --- a/source/libwiigui/gui_circle.hpp +++ b/source/GUI/gui_circle.hpp @@ -24,7 +24,7 @@ #ifndef GUICIRCLE_HPP_ #define GUICIRCLE_HPP_ -#include "libwiigui/gui.h" +#include "gui.h" class GuiCircle : public GuiElement { diff --git a/source/libwiigui/gui_cross.cpp b/source/GUI/gui_cross.cpp similarity index 100% rename from source/libwiigui/gui_cross.cpp rename to source/GUI/gui_cross.cpp diff --git a/source/libwiigui/gui_cross.hpp b/source/GUI/gui_cross.hpp similarity index 98% rename from source/libwiigui/gui_cross.hpp rename to source/GUI/gui_cross.hpp index 83ada4c1..ed481c9e 100644 --- a/source/libwiigui/gui_cross.hpp +++ b/source/GUI/gui_cross.hpp @@ -24,7 +24,7 @@ #ifndef GUICROSS_HPP_ #define GUICROSS_HPP_ -#include "libwiigui/gui.h" +#include "GUI/gui.h" class GuiCross : public GuiElement { diff --git a/source/libwiigui/gui_diskcover.cpp b/source/GUI/gui_diskcover.cpp similarity index 100% rename from source/libwiigui/gui_diskcover.cpp rename to source/GUI/gui_diskcover.cpp diff --git a/source/libwiigui/gui_diskcover.h b/source/GUI/gui_diskcover.h similarity index 100% rename from source/libwiigui/gui_diskcover.h rename to source/GUI/gui_diskcover.h diff --git a/source/libwiigui/gui_element.cpp b/source/GUI/gui_element.cpp similarity index 98% rename from source/libwiigui/gui_element.cpp rename to source/GUI/gui_element.cpp index 570150a3..f6252b3e 100644 --- a/source/libwiigui/gui_element.cpp +++ b/source/GUI/gui_element.cpp @@ -160,6 +160,26 @@ int GuiElement::GetTop() return y + yoffset; } +int GuiElement::GetRelLeft() +{ + GuiElement *tmp = parentElement; + parentElement = NULL; + int pos = GetLeft(); + parentElement = tmp; + + return pos; +} + +int GuiElement::GetRelTop() +{ + GuiElement *tmp = parentElement; + parentElement = NULL; + int pos = GetTop(); + parentElement = tmp; + + return pos; +} + void GuiElement::SetMinX(int x) { LOCK( this ); diff --git a/source/GUI/gui_filebrowser.cpp b/source/GUI/gui_filebrowser.cpp new file mode 100644 index 00000000..dce08778 --- /dev/null +++ b/source/GUI/gui_filebrowser.cpp @@ -0,0 +1,230 @@ +/**************************************************************************** + * libwiigui + * + * Tantric 2009 + * + * gui_filebrowser.cpp + * + * GUI class definitions + ***************************************************************************/ + +#include "gui_filebrowser.h" +#include "prompts/filebrowser.h" +#include "settings/CSettings.h" +#include "themes/CTheme.h" + +/** + * Constructor for the GuiFileBrowser class. + */ +GuiFileBrowser::GuiFileBrowser(int w, int h) + : scrollBar(h-10) +{ + width = w; + height = h; + selectedItem = 0; + selectable = true; + triggerdisabled = false; // trigger disable + focus = 0; // allow focus + + trigA = new GuiTrigger; + trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); + + bgFileSelection = new GuiImageData(Resources::GetFile("bg_browser.png"), Resources::GetFileSize("bg_browser.png")); + bgFileSelectionImg = new GuiImage(bgFileSelection); + bgFileSelectionImg->SetParent(this); + bgFileSelectionImg->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); + + bgFileSelectionEntry = Resources::GetImageData("bg_browser_selection.png"); + + fileFolder = Resources::GetImageData("icon_folder.png"); + + scrollBar.SetParent(this); + scrollBar.SetAlignment(ALIGN_RIGHT, ALIGN_TOP); + scrollBar.SetPosition(0, 5); + scrollBar.listChanged.connect(this, &GuiFileBrowser::onListChange); + + for (int i = 0; i < FILEBROWSERSIZE; i++) + { + fileListText[i] = new GuiText((char *) NULL, 20, ( GXColor ) {0, 0, 0, 0xff}); + fileListText[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); + fileListText[i]->SetPosition(5, 0); + fileListText[i]->SetMaxWidth(bgFileSelectionImg->GetWidth() - (scrollBar.GetWidth() + 40), DOTTED); + + fileListTextOver[i] = new GuiText((char *) NULL, 20, ( GXColor ) {0, 0, 0, 0xff}); + fileListTextOver[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); + fileListTextOver[i]->SetPosition(5, 0); + fileListTextOver[i]->SetMaxWidth(bgFileSelectionImg->GetWidth() - (scrollBar.GetWidth() + 40), SCROLL_HORIZONTAL); + + fileListBg[i] = new GuiImage(bgFileSelectionEntry); + fileListFolder[i] = new GuiImage(fileFolder); + fileList[i] = new GuiButton(350, 30); + fileList[i]->SetParent(this); + fileList[i]->SetLabel(fileListText[i]); + fileList[i]->SetLabelOver(fileListTextOver[i]); + fileList[i]->SetImageOver(fileListBg[i]); + fileList[i]->SetPosition(2, 30 * i + 3); + fileList[i]->SetTrigger(trigA); + fileList[i]->SetRumble(false); + fileList[i]->SetSoundClick(btnSoundClick); + } +} + +/** + * Destructor for the GuiFileBrowser class. + */ +GuiFileBrowser::~GuiFileBrowser() +{ + delete bgFileSelectionImg; + + delete bgFileSelection; + delete bgFileSelectionEntry; + delete fileFolder; + + delete trigA; + + for (int i = 0; i < FILEBROWSERSIZE; i++) + { + delete fileListText[i]; + delete fileListTextOver[i]; + delete fileList[i]; + delete fileListBg[i]; + delete fileListFolder[i]; + } +} + +void GuiFileBrowser::SetFocus(int f) +{ + LOCK( this ); + focus = f; + + for (int i = 0; i < FILEBROWSERSIZE; i++) + fileList[i]->ResetState(); + + if (f == 1) + fileList[selectedItem]->SetState(STATE_SELECTED); +} + +void GuiFileBrowser::DisableTriggerUpdate(bool set) +{ + LOCK( this ); + triggerdisabled = set; +} + +void GuiFileBrowser::ResetState() +{ + LOCK( this ); + state = STATE_DEFAULT; + stateChan = -1; + selectedItem = 0; + + for (int i = 0; i < FILEBROWSERSIZE; i++) + { + fileList[i]->ResetState(); + } +} + +void GuiFileBrowser::UpdateList() +{ + LOCK( this ); + for (int i = 0; i < FILEBROWSERSIZE; i++) + { + if (browser->pageIndex + i < (int) browser->browserList.size()) + { + if (fileList[i]->GetState() == STATE_DISABLED) + fileList[i]->SetState(STATE_DEFAULT); + + fileList[i]->SetVisible(true); + + fileListText[i]->SetText(browser->browserList[browser->pageIndex + i].displayname); + fileListTextOver[i]->SetText(browser->browserList[browser->pageIndex + i].displayname); + + if (browser->browserList[browser->pageIndex + i].isdir) // directory + { + fileList[i]->SetIcon(fileListFolder[i]); + fileListText[i]->SetPosition(30, 0); + fileListTextOver[i]->SetPosition(30, 0); + } + else + { + fileList[i]->SetIcon(NULL); + fileListText[i]->SetPosition(10, 0); + fileListTextOver[i]->SetPosition(10, 0); + } + } + else + { + fileList[i]->SetVisible(false); + fileList[i]->SetState(STATE_DISABLED); + } + } +} + +void GuiFileBrowser::onListChange(int SelItem, int SelInd) +{ + selectedItem = SelItem; + browser->pageIndex = SelInd; + UpdateList(); +} + +/** + * Draw the button on screen + */ +void GuiFileBrowser::Draw() +{ + LOCK( this ); + if (!this->IsVisible()) return; + + bgFileSelectionImg->Draw(); + + for (int i = 0; i < FILEBROWSERSIZE; i++) + { + fileList[i]->Draw(); + } + + if(browser->browserList.size() > FILEBROWSERSIZE) + scrollBar.Draw(); + + this->UpdateEffects(); +} + +void GuiFileBrowser::Update(GuiTrigger * t) +{ + LOCK( this ); + if (state == STATE_DISABLED || !t || triggerdisabled) + return; + + static int pressedChan = -1; + + if((t->wpad.btns_d & (WPAD_BUTTON_B | WPAD_BUTTON_DOWN | WPAD_BUTTON_UP | WPAD_BUTTON_LEFT | WPAD_BUTTON_RIGHT | + WPAD_CLASSIC_BUTTON_B | WPAD_CLASSIC_BUTTON_UP | WPAD_CLASSIC_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_RIGHT)) || + (t->pad.btns_d & (PAD_BUTTON_UP | PAD_BUTTON_DOWN))) + pressedChan = t->chan; + + if(browser->browserList.size() > FILEBROWSERSIZE) + scrollBar.Update(t); + + if(pressedChan == -1 || (!t->wpad.btns_h && !t->pad.btns_h)) + { + for (int i = 0; i < FILEBROWSERSIZE; i++) + { + if (i != selectedItem && fileList[i]->GetState() == STATE_SELECTED) + fileList[i]->ResetState(); + else if (i == selectedItem && fileList[i]->GetState() == STATE_DEFAULT) + fileList[selectedItem]->SetState(STATE_SELECTED, -1); + + fileList[i]->Update(t); + + if (fileList[i]->GetState() == STATE_SELECTED) + selectedItem = i; + } + } + + + if(pressedChan == t->chan && !t->wpad.btns_d && !t->wpad.btns_h) + pressedChan = -1; + + scrollBar.SetPageSize(FILEBROWSERSIZE); + scrollBar.SetSelectedItem(selectedItem); + scrollBar.SetSelectedIndex(browser->pageIndex); + scrollBar.SetEntrieCount(browser->browserList.size()); +} diff --git a/source/GUI/gui_filebrowser.h b/source/GUI/gui_filebrowser.h new file mode 100644 index 00000000..a4458813 --- /dev/null +++ b/source/GUI/gui_filebrowser.h @@ -0,0 +1,41 @@ +#ifndef GUI_FILEBROWSER_H_ +#define GUI_FILEBROWSER_H_ + +#include "gui.h" +#include "gui_scrollbar.hpp" + +//!Display a list of files +class GuiFileBrowser: public GuiElement, public sigslot::has_slots<> +{ + public: + GuiFileBrowser(int w, int h); + ~GuiFileBrowser(); + void DisableTriggerUpdate(bool set); + void ResetState(); + void SetFocus(int f); + void Draw(); + void UpdateList(); + void Update(GuiTrigger * t); + GuiButton * fileList[PAGESIZE]; + protected: + void onListChange(int SelItem, int SelInd); + int selectedItem; + bool triggerdisabled; + + GuiText * fileListText[PAGESIZE]; + GuiText * fileListTextOver[PAGESIZE]; + GuiImage * fileListBg[PAGESIZE]; + GuiImage * fileListFolder[PAGESIZE]; + + GuiImage * bgFileSelectionImg; + + GuiImageData * bgFileSelection; + GuiImageData * bgFileSelectionEntry; + GuiImageData * fileFolder; + + GuiTrigger * trigA; + GuiScrollbar scrollBar; +}; + + +#endif diff --git a/source/GUI/gui_gamebrowser.cpp b/source/GUI/gui_gamebrowser.cpp new file mode 100644 index 00000000..f87f03eb --- /dev/null +++ b/source/GUI/gui_gamebrowser.cpp @@ -0,0 +1,321 @@ +/**************************************************************************** + * libwiigui + * + * gui_gamebrowser.cpp + * + * GUI class definitions + ***************************************************************************/ + +#include "gui.h" +#include "../wpad.h" + +#include +#include "gui_gamebrowser.h" +#include "../settings/CSettings.h" +#include "../main.h" +#include "settings/newtitles.h" +#include "settings/GameTitles.h" +#include "usbloader/GameList.h" +#include "themes/CTheme.h" +#include "menu.h" + +#include +#include + +#define GAMESELECTSIZE 30 + +/** + * Constructor for the GuiGameBrowser class. + */ +GuiGameBrowser::GuiGameBrowser(int w, int h, int selectedGame) + : scrollBar(h-10) +{ + width = w; + height = h; + pagesize = thInt("9 - game list browser page size"); + scrollbaron = (gameList.size() > pagesize) ? 1 : 0; + selectable = true; + listOffset = selectedGame - (selectedGame % pagesize); + selectedItem = selectedGame - listOffset; + focus = 1; // allow focus + + trigA = new GuiTrigger; + trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); + + bgGames = Resources::GetImageData("bg_options.png"); + newGames = Resources::GetImageData("new.png"); + + scrollBar.SetParent(this); + scrollBar.SetAlignment(thAlign("right - game browser scrollbar align hor"), thAlign("top - game browser scrollbar align ver")); + scrollBar.SetPosition(thInt("0 - game browser scrollbar pos x"), thInt("5 - game browser scrollbar pos y")); + scrollBar.SetButtonScroll(WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B); + scrollBar.listChanged.connect(this, &GuiGameBrowser::onListChange); + + bgGameImg = new GuiImage(bgGames); + bgGameImg->SetParent(this); + bgGameImg->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); + + bgGamesEntry = Resources::GetImageData("bg_options_entry.png"); + + maxTextWidth = bgGameImg->GetWidth() - scrollBar.GetWidth() - 38; + + gameIndex = new int[pagesize]; + game = new GuiButton *[pagesize]; + gameTxt = new GuiText *[pagesize]; + gameTxtOver = new GuiText *[pagesize]; + gameBg = new GuiImage *[pagesize]; + newImg = new GuiImage *[pagesize]; + + for (int i = 0; i < pagesize; i++) + { + gameTxt[i] = new GuiText(GameTitles.GetTitle(gameList[i]), 20, thColor("r=0 g=0 b=0 a=255 - game browser list text color")); + gameTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); + gameTxt[i]->SetPosition(24, 0); + gameTxt[i]->SetMaxWidth(maxTextWidth, DOTTED); + + gameTxtOver[i] = new GuiText(GameTitles.GetTitle(gameList[i]), 20, thColor("r=0 g=0 b=0 a=255 - game browser list text color over")); + gameTxtOver[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); + gameTxtOver[i]->SetPosition(24, 0); + gameTxtOver[i]->SetMaxWidth(maxTextWidth, SCROLL_HORIZONTAL); + + gameBg[i] = new GuiImage(bgGamesEntry); + + newImg[i] = new GuiImage(newGames); + newImg[i]->SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE); + newImg[i]->SetVisible(false); + + game[i] = new GuiButton(width - scrollBar.GetWidth(), GAMESELECTSIZE); + game[i]->SetParent(this); + game[i]->SetLabel(gameTxt[i]); + game[i]->SetLabelOver(gameTxtOver[i]); + game[i]->SetIcon(newImg[i]); + game[i]->SetImageOver(gameBg[i]); + game[i]->SetPosition(5, GAMESELECTSIZE * i + 4); + game[i]->SetRumble(false); + game[i]->SetTrigger(trigA); + game[i]->SetSoundClick(btnSoundClick); + + gameIndex[i] = i; + } + UpdateListEntries(); +} + +/** + * Destructor for the GuiGameBrowser class. + */ +GuiGameBrowser::~GuiGameBrowser() +{ + delete bgGameImg; + delete bgGames; + delete bgGamesEntry; + delete newGames; + + delete trigA; + + for (int i = 0; i < pagesize; i++) + { + delete gameTxt[i]; + delete gameTxtOver[i]; + delete gameBg[i]; + delete game[i]; + delete newImg[i]; + } + delete[] gameIndex; + delete[] game; + delete[] gameTxt; + delete[] gameTxtOver; + delete[] gameBg; +} + +void GuiGameBrowser::SetFocus(int f) +{ + LOCK( this ); + if (!gameList.size()) return; + + focus = f; + + for (int i = 0; i < pagesize; i++) + game[i]->ResetState(); + + if (f == 1) game[selectedItem]->SetState(STATE_SELECTED); +} + +void GuiGameBrowser::ResetState() +{ + LOCK( this ); + if (state != STATE_DISABLED) + { + state = STATE_DEFAULT; + stateChan = -1; + } + + for (int i = 0; i < pagesize; i++) + { + game[i]->ResetState(); + } +} + +int GuiGameBrowser::GetOffset() +{ + return listOffset; +} +int GuiGameBrowser::GetClickedOption() +{ + int found = -1; + for (int i = 0; i < pagesize; i++) + { + if (game[i]->GetState() == STATE_CLICKED) + { + game[i]->SetState(STATE_SELECTED); + found = gameIndex[i]; + break; + } + } + return found; +} + +/**************************************************************************** + * FindMenuItem + * + * Help function to find the next visible menu item on the list + ***************************************************************************/ + +int GuiGameBrowser::FindMenuItem(int currentItem, int direction) +{ + int nextItem = currentItem + direction; + + if (nextItem < 0 || nextItem >= gameList.size()) return -1; + + if (strlen(GameTitles.GetTitle(gameList[nextItem])) > 0) + return nextItem; + + return FindMenuItem(nextItem, direction); +} + +void GuiGameBrowser::onListChange(int SelItem, int SelInd) +{ + selectedItem = SelItem; + listOffset = SelInd; + UpdateListEntries(); +} + +/** + * Draw the button on screen + */ +void GuiGameBrowser::Draw() +{ + LOCK( this ); + if (!this->IsVisible() || !gameList.size()) return; + + bgGameImg->Draw(); + + int next = listOffset; + + for (int i = 0; i < pagesize; i++) + { + if (next >= 0) + { + game[i]->Draw(); + next = this->FindMenuItem(next, 1); + } + else break; + } + + if (scrollbaron == 1) + scrollBar.Draw(); + + this->UpdateEffects(); +} + +void GuiGameBrowser::UpdateListEntries() +{ + int next = listOffset; + for (int i = 0; i < pagesize; i++) + { + if (next >= 0) + { + if (game[i]->GetState() == STATE_DISABLED) + { + game[i]->SetVisible(true); + game[i]->SetState(STATE_DEFAULT); + } + gameTxt[i]->SetText(GameTitles.GetTitle(gameList[next])); + gameTxt[i]->SetPosition(24, 0); + gameTxtOver[i]->SetText(GameTitles.GetTitle(gameList[next])); + gameTxtOver[i]->SetPosition(24, 0); + + if (Settings.marknewtitles) + { + bool isNew = NewTitles::Instance()->IsNew(gameList[next]->id); + if (isNew) + { + gameTxt[i]->SetMaxWidth(maxTextWidth - (newGames->GetWidth() + 1), DOTTED); + gameTxtOver[i]->SetMaxWidth(maxTextWidth - (newGames->GetWidth() + 1), SCROLL_HORIZONTAL); + } + else + { + gameTxt[i]->SetMaxWidth(maxTextWidth, DOTTED); + gameTxtOver[i]->SetMaxWidth(maxTextWidth, SCROLL_HORIZONTAL); + } + newImg[i]->SetVisible(isNew); + } + + gameIndex[i] = next; + next = this->FindMenuItem(next, 1); + } + else + { + game[i]->SetVisible(false); + game[i]->SetState(STATE_DISABLED); + } + } +} + +void GuiGameBrowser::Update(GuiTrigger * t) +{ + LOCK( this ); + if (state == STATE_DISABLED || !t || !gameList.size()) return; + + static int pressedChan = -1; + int next; + + if((t->wpad.btns_d & (WPAD_BUTTON_B | WPAD_BUTTON_DOWN | WPAD_BUTTON_UP | WPAD_BUTTON_LEFT | WPAD_BUTTON_RIGHT | + WPAD_CLASSIC_BUTTON_B | WPAD_CLASSIC_BUTTON_UP | WPAD_CLASSIC_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_RIGHT)) || + (t->pad.btns_d & (PAD_BUTTON_UP | PAD_BUTTON_DOWN))) + pressedChan = t->chan; + + if (scrollbaron == 1) + // update the location of the scroll box based on the position in the option list + scrollBar.Update(t); + + next = listOffset; + + if(pressedChan == -1 || (!t->wpad.btns_h && !t->pad.btns_h)) + { + for (int i = 0; i < pagesize; i++) + { + if (next >= 0) next = this->FindMenuItem(next, 1); + + if (i != selectedItem && game[i]->GetState() == STATE_SELECTED) + game[i]->ResetState(); + else if (i == selectedItem && game[i]->GetState() == STATE_DEFAULT) + game[selectedItem]->SetState(STATE_SELECTED, -1); + + game[i]->Update(t); + + if (game[i]->GetState() == STATE_SELECTED) + selectedItem = i; + } + } + + if(pressedChan == t->chan && !t->wpad.btns_d && !t->wpad.btns_h) + pressedChan = -1; + + scrollBar.SetPageSize(pagesize); + scrollBar.SetSelectedItem(selectedItem); + scrollBar.SetSelectedIndex(listOffset); + scrollBar.SetEntrieCount(gameList.size()); + + if (updateCB) updateCB(this); +} + diff --git a/source/libwiigui/gui_gamebrowser.h b/source/GUI/gui_gamebrowser.h similarity index 55% rename from source/libwiigui/gui_gamebrowser.h rename to source/GUI/gui_gamebrowser.h index 772b1999..55b16a23 100644 --- a/source/libwiigui/gui_gamebrowser.h +++ b/source/GUI/gui_gamebrowser.h @@ -2,9 +2,10 @@ #define _GUIGAMEBROWSER_H_ #include "gui.h" -#include "../usbloader/disc.h" +#include "gui_scrollbar.hpp" +#include "usbloader/disc.h" -class GuiGameBrowser: public GuiElement +class GuiGameBrowser: public GuiElement, public sigslot::has_slots<> { public: GuiGameBrowser(int w, int h, int selectedGame = 0); @@ -17,9 +18,8 @@ class GuiGameBrowser: public GuiElement void Draw(); void Update(GuiTrigger * t); int GetOffset(); - void Reload(); - //GuiText * optionVal[PAGESIZE]; protected: + void onListChange(int SelItem, int SelInd); void UpdateListEntries(); int selectedItem; int listOffset; @@ -34,31 +34,14 @@ class GuiGameBrowser: public GuiElement GuiImage ** gameBg; GuiImage ** newImg; - GuiButton * arrowUpBtn; - GuiButton * arrowDownBtn; - GuiButton * scrollbarBoxBtn; - GuiImage * bgGameImg; - GuiImage * scrollbarImg; - GuiImage * arrowDownImg; - GuiImage * arrowDownOverImg; - GuiImage * arrowUpImg; - GuiImage * arrowUpOverImg; - GuiImage * scrollbarBoxImg; - GuiImage * scrollbarBoxOverImg; GuiImageData * bgGames; GuiImageData * bgGamesEntry; GuiImageData * newGames; - GuiImageData * scrollbar; - GuiImageData * arrowDown; - GuiImageData * arrowDownOver; - GuiImageData * arrowUp; - GuiImageData * arrowUpOver; - GuiImageData * scrollbarBox; - GuiImageData * scrollbarBoxOver; GuiTrigger * trigA; - GuiTrigger * trigHeldA; + + GuiScrollbar scrollBar; }; #endif diff --git a/source/libwiigui/gui_gamecarousel.cpp b/source/GUI/gui_gamecarousel.cpp similarity index 99% rename from source/libwiigui/gui_gamecarousel.cpp rename to source/GUI/gui_gamecarousel.cpp index 91ce2030..86841ca8 100644 --- a/source/libwiigui/gui_gamecarousel.cpp +++ b/source/GUI/gui_gamecarousel.cpp @@ -16,7 +16,7 @@ #include "usbloader/GameList.h" #include "settings/GameTitles.h" #include "settings/CSettings.h" -#include "libwiigui/LoadCoverImage.h" +#include "GUI/LoadCoverImage.h" #include "themes/CTheme.h" #include "main.h" diff --git a/source/libwiigui/gui_gamecarousel.h b/source/GUI/gui_gamecarousel.h similarity index 100% rename from source/libwiigui/gui_gamecarousel.h rename to source/GUI/gui_gamecarousel.h diff --git a/source/libwiigui/gui_gamegrid.cpp b/source/GUI/gui_gamegrid.cpp similarity index 99% rename from source/libwiigui/gui_gamegrid.cpp rename to source/GUI/gui_gamegrid.cpp index a8ae0605..e09ad966 100644 --- a/source/libwiigui/gui_gamegrid.cpp +++ b/source/GUI/gui_gamegrid.cpp @@ -12,7 +12,7 @@ #include #include "gui_gamegrid.h" #include "gui_image_async.h" -#include "libwiigui/LoadCoverImage.h" +#include "GUI/LoadCoverImage.h" #include "usbloader/GameList.h" #include "settings/GameTitles.h" #include "settings/CSettings.h" diff --git a/source/libwiigui/gui_gamegrid.h b/source/GUI/gui_gamegrid.h similarity index 100% rename from source/libwiigui/gui_gamegrid.h rename to source/GUI/gui_gamegrid.h diff --git a/source/libwiigui/gui_image.cpp b/source/GUI/gui_image.cpp similarity index 89% rename from source/libwiigui/gui_image.cpp rename to source/GUI/gui_image.cpp index aadd3299..6e767495 100644 --- a/source/libwiigui/gui_image.cpp +++ b/source/GUI/gui_image.cpp @@ -19,7 +19,8 @@ GuiImage::GuiImage() width = 0; height = 0; imageangle = 0; - tile = -1; + tileHorizontal = -1; + tileVertical = -1; stripe = 0; widescreen = 0; xx1 = 0; @@ -48,7 +49,8 @@ GuiImage::GuiImage(GuiImageData * img) height = 0; } imageangle = 0; - tile = -1; + tileHorizontal = -1; + tileVertical = -1; stripe = 0; widescreen = 0; parentangle = true; @@ -69,7 +71,8 @@ GuiImage::GuiImage(u8 * img, int w, int h) width = w; height = h; imageangle = 0; - tile = -1; + tileHorizontal = -1; + tileVertical = -1; stripe = 0; widescreen = 0; parentangle = true; @@ -90,7 +93,8 @@ GuiImage::GuiImage(int w, int h, GXColor c) width = w; height = h; imageangle = 0; - tile = -1; + tileHorizontal = -1; + tileVertical = -1; stripe = 0; widescreen = 0; parentangle = true; @@ -131,7 +135,8 @@ GuiImage::GuiImage(GuiImage &srcimage) : memcpy(image, srcimage.GetImage(), len); DCFlushRange(image, len); imageangle = srcimage.GetAngle(); - tile = -1; + tileHorizontal = -1; + tileVertical = -1; stripe = 0; widescreen = 0; parentangle = true; @@ -157,7 +162,8 @@ GuiImage::GuiImage(GuiImage *srcimage) : memcpy(image, srcimage->GetImage(), len); DCFlushRange(image, len); imageangle = srcimage->GetAngle(); - tile = -1; + tileHorizontal = -1; + tileVertical = -1; stripe = 0; widescreen = 0; parentangle = true; @@ -188,7 +194,8 @@ GuiImage &GuiImage::operator=(GuiImage & srcimage) memcpy(image, srcimage.GetImage(), len); DCFlushRange(image, len); imageangle = srcimage.GetAngle(); - tile = -1; + tileHorizontal = -1; + tileVertical = -1; stripe = 0; widescreen = 0; parentangle = true; @@ -267,10 +274,16 @@ float GuiImage::GetAngle() return imageangle; } -void GuiImage::SetTile(int t) +void GuiImage::SetTileHorizontal(int t) { LOCK( this ); - tile = t; + tileHorizontal = t; +} + +void GuiImage::SetTileVertical(int t) +{ + LOCK( this ); + tileVertical = t; } void GuiImage::SetWidescreen(bool w) @@ -428,7 +441,7 @@ void GuiImage::ColorStripe(int shift) void GuiImage::Draw() { LOCK( this ); - if (!image || !this->IsVisible() || tile == 0) return; + if (!image || !this->IsVisible() || tileHorizontal == 0) return; float currScale = this->GetScale(); int currLeft = this->GetLeft(); @@ -437,12 +450,19 @@ void GuiImage::Draw() if (currAngleDyn && parentangle) imageangle = currAngleDyn; - if (tile > 0) + if (tileHorizontal > 0) { - for (int i = 0; i < tile; i++) + for (int i = 0; i < tileHorizontal; i++) Menu_DrawImg(currLeft + width * i, this->GetTop(), zoffset, width, height, image, imageangle, - widescreen ? currScale * Settings.WSFactor : currScale, currScale, this->GetAlpha(), xx1, yy1, xx2, yy2, xx3, - yy3, xx4, yy4); + widescreen ? currScale * Settings.WSFactor : currScale, currScale, this->GetAlpha(), xx1, + yy1, xx2, yy2, xx3, yy3, xx4, yy4); + } + else if(tileVertical > 0) + { + for (int i = 0; i < tileVertical; i++) + Menu_DrawImg(currLeft, this->GetTop() + height * i, zoffset, width, height, image, imageangle, + widescreen ? currScale * Settings.WSFactor : currScale, currScale, this->GetAlpha(), xx1, + yy1, xx2, yy2, xx3, yy3, xx4, yy4); } else { diff --git a/source/libwiigui/gui_image_async.cpp b/source/GUI/gui_image_async.cpp similarity index 100% rename from source/libwiigui/gui_image_async.cpp rename to source/GUI/gui_image_async.cpp diff --git a/source/libwiigui/gui_image_async.h b/source/GUI/gui_image_async.h similarity index 97% rename from source/libwiigui/gui_image_async.h rename to source/GUI/gui_image_async.h index 3f440b4a..ee372e3e 100644 --- a/source/libwiigui/gui_image_async.h +++ b/source/GUI/gui_image_async.h @@ -2,7 +2,7 @@ #define _GUIIMAGEASYNC_H_ #include -#include "libwiigui/gui.h" +#include "gui.h" typedef GuiImageData * (*ImageLoaderCallback)(void *arg); diff --git a/source/libwiigui/gui_imagedata.cpp b/source/GUI/gui_imagedata.cpp similarity index 100% rename from source/libwiigui/gui_imagedata.cpp rename to source/GUI/gui_imagedata.cpp diff --git a/source/libwiigui/gui_imagedata.h b/source/GUI/gui_imagedata.h similarity index 100% rename from source/libwiigui/gui_imagedata.h rename to source/GUI/gui_imagedata.h diff --git a/source/libwiigui/gui_keyboard.cpp b/source/GUI/gui_keyboard.cpp similarity index 100% rename from source/libwiigui/gui_keyboard.cpp rename to source/GUI/gui_keyboard.cpp diff --git a/source/libwiigui/gui_numpad.cpp b/source/GUI/gui_numpad.cpp similarity index 100% rename from source/libwiigui/gui_numpad.cpp rename to source/GUI/gui_numpad.cpp diff --git a/source/GUI/gui_optionbrowser.cpp b/source/GUI/gui_optionbrowser.cpp new file mode 100644 index 00000000..4efd1031 --- /dev/null +++ b/source/GUI/gui_optionbrowser.cpp @@ -0,0 +1,324 @@ +/**************************************************************************** + * libwiigui + * + * gui_customoptionbrowser.cpp + * + * GUI class definitions + ***************************************************************************/ + +#include "gui.h" +#include "../wpad.h" +#include "../main.h" +#include "../gecko.h" +#include "../settings/CSettings.h" +#include "gui_optionbrowser.h" +#include "themes/CTheme.h" +#include "utils/tools.h" +#include "menu.h" + +#include + +#define GAMESELECTSIZE 30 + +/** +GuiOptionBrowser * Constructor for the GuiOptionBrowser class. + */ +GuiOptionBrowser::GuiOptionBrowser(int w, int h, OptionList * l, const char * custombg) + : scrollBar(h-10) +{ + width = w; + height = h; + options = l; + selectable = true; + selectedItem = 0; + focus = 1; // allow focus + coL2 = 50; + scrollbaron = false; + listChanged = true; + listOffset = 0; + + trigA = new GuiTrigger; + trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); + + bgOptions = Resources::GetImageData(custombg); + + bgOptionsImg = new GuiImage(bgOptions); + bgOptionsImg->SetParent(this); + bgOptionsImg->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); + + bgOptionsEntry = Resources::GetImageData("bg_options_entry.png"); + + scrollBar.SetParent(this); + scrollBar.SetAlignment(thAlign("right - options browser scrollbar align hor"), thAlign("top - options browser scrollbar align ver")); + scrollBar.SetPosition(thInt("0 - options browser scrollbar pos x"), thInt("5 - options browser scrollbar pos y")); + scrollBar.listChanged.connect(this, &GuiOptionBrowser::onListChange); + + for (int i = 0; i < PAGESIZE; i++) + { + optionTxt[i] = new GuiText((wchar_t *) NULL, 20, thColor("r=0 g=0 b=0 a=255 - settings text color")); + optionTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); + optionTxt[i]->SetPosition(24, 0); + optionTxt[i]->SetMaxWidth(bgOptionsImg->GetWidth()-scrollBar.GetWidth()-40, DOTTED); + + optionBg[i] = new GuiImage(bgOptionsEntry); + + optionVal[i] = new GuiText((wchar_t *) NULL, 20, thColor("r=0 g=0 b=0 a=255 - settings text color")); + optionVal[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); + + optionValOver[i] = new GuiText((wchar_t *) NULL, 20, thColor("r=0 g=0 b=0 a=255 - settings text color")); + optionValOver[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); + + optionBtn[i] = new GuiButton(width - scrollBar.GetWidth(), GAMESELECTSIZE); + optionBtn[i]->SetParent(this); + optionBtn[i]->SetLabel(optionTxt[i], 0); + optionBtn[i]->SetLabel(optionVal[i], 1); + optionBtn[i]->SetLabelOver(optionValOver[i], 1); + optionBtn[i]->SetImageOver(optionBg[i]); + optionBtn[i]->SetPosition(10, GAMESELECTSIZE * i + 4); + optionBtn[i]->SetRumble(false); + optionBtn[i]->SetTrigger(trigA); + optionBtn[i]->SetSoundClick(btnSoundClick); + } +} + +/** + * Destructor for the GuiOptionBrowser class. + */ +GuiOptionBrowser::~GuiOptionBrowser() +{ + delete bgOptionsImg; + delete bgOptions; + delete bgOptionsEntry; + + delete trigA; + + for (int i = 0; i < PAGESIZE; i++) + { + delete optionTxt[i]; + delete optionVal[i]; + delete optionValOver[i]; + delete optionBg[i]; + delete optionBtn[i]; + } +} + +void GuiOptionBrowser::SetFocus(int f) +{ + focus = f; + + for (int i = 0; i < PAGESIZE; i++) + optionBtn[i]->ResetState(); + + if (f == 1) optionBtn[selectedItem]->SetState(STATE_SELECTED); +} + +void GuiOptionBrowser::ResetState() +{ + if (state != STATE_DISABLED) + { + state = STATE_DEFAULT; + stateChan = -1; + } + + for (int i = 0; i < PAGESIZE; i++) + { + optionBtn[i]->ResetState(); + } +} + +int GuiOptionBrowser::GetClickedOption() +{ + for (int i = 0; i < PAGESIZE; i++) + { + if (optionBtn[i]->GetState() == STATE_CLICKED) + { + optionBtn[i]->SetState(STATE_SELECTED); + return optionIndex[i]; + } + } + + return -1; +} + +int GuiOptionBrowser::GetSelectedOption() +{ + for (int i = 0; i < PAGESIZE; i++) + { + if (optionBtn[i]->GetState() == STATE_SELECTED) + { + return optionIndex[i]; + } + } + return -1; +} + +void GuiOptionBrowser::SetClickable(bool enable) +{ + for (int i = 0; i < PAGESIZE; i++) + { + optionBtn[i]->SetClickable(enable); + } +} + +void GuiOptionBrowser::SetOffset(int optionnumber) +{ + listOffset = optionnumber; + selectedItem = optionnumber; +} + +void GuiOptionBrowser::onListChange(int SelItem, int SelInd) +{ + selectedItem = SelItem; + listOffset = SelInd; + UpdateListEntries(); +} + +/**************************************************************************** + * FindMenuItem + * + * Help function to find the next visible menu item on the list + ***************************************************************************/ + +int GuiOptionBrowser::FindMenuItem(int currentItem, int direction) +{ + int nextItem = currentItem + direction; + + if (nextItem < 0 || nextItem >= options->GetLength()) return -1; + + if (strlen(options->GetName(nextItem)) > 0) + return nextItem; + + return FindMenuItem(nextItem, direction); +} + +/** + * Draw the button on screen + */ +void GuiOptionBrowser::Draw() +{ + if (!this->IsVisible()) return; + + bgOptionsImg->Draw(); + + int next = listOffset; + + for (int i = 0; i < PAGESIZE; i++) + { + if (next >= 0) + { + optionBtn[i]->Draw(); + next = this->FindMenuItem(next, 1); + } + else break; + } + + if (scrollbaron) + scrollBar.Draw(); + + this->UpdateEffects(); +} + +void GuiOptionBrowser::UpdateListEntries() +{ + LOCK(this); + scrollbaron = options->GetLength() > PAGESIZE; + if (listOffset < 0) listOffset = this->FindMenuItem(-1, 1); + int next = listOffset; + + int maxNameWidth = 0; + for (int i = 0; i < PAGESIZE; i++) + { + if (next >= 0) + { + if (optionBtn[i]->GetState() == STATE_DISABLED) + { + optionBtn[i]->SetVisible(true); + optionBtn[i]->SetState(STATE_DEFAULT); + } + + optionTxt[i]->SetText(options->GetName(next)); + if (maxNameWidth < optionTxt[i]->GetTextWidth()) maxNameWidth = optionTxt[i]->GetTextWidth(); + optionVal[i]->SetText(options->GetValue(next)); + optionValOver[i]->SetText(options->GetValue(next)); + + optionIndex[i] = next; + next = this->FindMenuItem(next, 1); + } + else + { + optionBtn[i]->SetVisible(false); + optionBtn[i]->SetState(STATE_DISABLED); + } + } + + if (coL2 < (24 + maxNameWidth + 16)) + coL2 = 24 + maxNameWidth + 16; + + for (int i = 0; i < PAGESIZE; i++) + { + if (optionBtn[i]->GetState() != STATE_DISABLED) + { + optionVal[i]->SetPosition(coL2, 0); + optionVal[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2 + scrollBar.GetWidth()+10), DOTTED); + + optionValOver[i]->SetPosition(coL2, 0); + optionValOver[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2 + scrollBar.GetWidth()+10), SCROLL_HORIZONTAL); + } + } +} + +void GuiOptionBrowser::Update(GuiTrigger * t) +{ + if (state == STATE_DISABLED || !t) return; + + static int pressedChan = -1; + + if((t->wpad.btns_d & (WPAD_BUTTON_B | WPAD_BUTTON_DOWN | WPAD_BUTTON_UP | WPAD_BUTTON_LEFT | WPAD_BUTTON_RIGHT | + WPAD_CLASSIC_BUTTON_B | WPAD_CLASSIC_BUTTON_UP | WPAD_CLASSIC_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_RIGHT)) || + (t->pad.btns_d & (PAD_BUTTON_UP | PAD_BUTTON_DOWN))) + pressedChan = t->chan; + + if (scrollbaron) + // update the location of the scroll box based on the position in the option list + scrollBar.Update(t); + + int next = listOffset; + + if(pressedChan == -1 || (!t->wpad.btns_h && !t->pad.btns_h)) + { + for(int i = 0; i < PAGESIZE; i++) + { + if (next >= 0) next = this->FindMenuItem(next, 1); + + if (i != selectedItem && optionBtn[i]->GetState() == STATE_SELECTED) + { + optionBtn[i]->ResetState(); + } + else if (i == selectedItem && optionBtn[i]->GetState() == STATE_DEFAULT) + { + optionBtn[selectedItem]->SetState(STATE_SELECTED); + } + + optionBtn[i]->Update(t); + + if (optionBtn[i]->GetState() == STATE_SELECTED) + selectedItem = i; + } + } + + if(pressedChan == t->chan && !t->wpad.btns_d && !t->wpad.btns_h) + pressedChan = -1; + + scrollBar.SetPageSize(PAGESIZE); + scrollBar.SetSelectedItem(selectedItem); + scrollBar.SetSelectedIndex(listOffset); + scrollBar.SetEntrieCount(options->GetLength()); + + if (options->IsChanged()) + { + UpdateListEntries(); + listChanged = false; + } + + if (updateCB) updateCB(this); +} diff --git a/source/libwiigui/gui_customoptionbrowser.h b/source/GUI/gui_optionbrowser.h similarity index 52% rename from source/libwiigui/gui_customoptionbrowser.h rename to source/GUI/gui_optionbrowser.h index 9291b2fa..f84b0d89 100644 --- a/source/libwiigui/gui_customoptionbrowser.h +++ b/source/GUI/gui_optionbrowser.h @@ -1,15 +1,16 @@ -#ifndef GUI_CUSTOMBROWSER_H_ -#define GUI_CUSTOMBROWSER_H_ +#ifndef GUI_OPTIONBROWSER_H_ +#define GUI_OPTIONBROWSER_H_ #include "gui.h" +#include "gui_scrollbar.hpp" #include //!Display a list of menu options -class GuiCustomOptionBrowser: public GuiElement +class GuiOptionBrowser: public GuiElement, public sigslot::has_slots<> { public: - GuiCustomOptionBrowser(int w, int h, OptionList * l, const char * background); - ~GuiCustomOptionBrowser(); + GuiOptionBrowser(int w, int h, OptionList * l, const char * background); + ~GuiOptionBrowser(); int FindMenuItem(int c, int d); int GetClickedOption(); int GetSelectedOption(); @@ -20,11 +21,13 @@ class GuiCustomOptionBrowser: public GuiElement void Draw(); void Update(GuiTrigger * t); protected: + void onListChange(int SelItem, int SelInd); void UpdateListEntries(); int selectedItem; int listOffset; int coL2; bool scrollbaron; + bool listChanged; OptionList * options; int optionIndex[PAGESIZE]; @@ -34,31 +37,13 @@ class GuiCustomOptionBrowser: public GuiElement GuiText * optionValOver[PAGESIZE]; GuiImage * optionBg[PAGESIZE]; - GuiButton * arrowUpBtn; - GuiButton * arrowDownBtn; - GuiButton * scrollbarBoxBtn; - GuiImage * bgOptionsImg; - GuiImage * scrollbarImg; - GuiImage * arrowDownImg; - GuiImage * arrowDownOverImg; - GuiImage * arrowUpImg; - GuiImage * arrowUpOverImg; - GuiImage * scrollbarBoxImg; - GuiImage * scrollbarBoxOverImg; GuiImageData * bgOptions; GuiImageData * bgOptionsEntry; - GuiImageData * scrollbar; - GuiImageData * arrowDown; - GuiImageData * arrowDownOver; - GuiImageData * arrowUp; - GuiImageData * arrowUpOver; - GuiImageData * scrollbarBox; - GuiImageData * scrollbarBoxOver; GuiTrigger * trigA; - GuiTrigger * trigHeldA; + GuiScrollbar scrollBar; }; #endif diff --git a/source/GUI/gui_scrollbar.cpp b/source/GUI/gui_scrollbar.cpp new file mode 100644 index 00000000..b1743249 --- /dev/null +++ b/source/GUI/gui_scrollbar.cpp @@ -0,0 +1,481 @@ +/*************************************************************************** + * Copyright (C) 2011 + * by Dimok + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any + * damages arising from the use of this software. + * + * Permission is granted to anyone to use this software for any + * purpose, including commercial applications, and to alter it and + * redistribute it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you + * must not claim that you wrote the original software. If you use + * this software in a product, an acknowledgment in the product + * documentation would be appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and + * must not be misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + ***************************************************************************/ +#include "themes/Resources.h" +#include "menu/menus.h" +#include "gui_scrollbar.hpp" +#include "utils/tools.h" + +GuiScrollbar::GuiScrollbar(int h, u8 m) +{ + SelItem = 0; + SelInd = 0; + RowSize = 0; + PageSize = 0; + EntrieCount = 0; + ScrollSpeed = 15; + ButtonScroll = 0; + ButtonScrollSpeed = 20; + ScrollState = 0; + pressedChan = -1; + AllowDPad = true; + Mode = m; + listChanged.connect(this, &GuiScrollbar::setScrollboxPosition); + + scrollbarTop = Resources::GetImageData("scrollBarTop.png"); + scrollbarBottom = Resources::GetImageData("scrollBarBottom.png"); + scrollbarTile = Resources::GetImageData("scrollBarTile.png"); + arrowDown = Resources::GetImageData("scrollbar_arrowdown.png"); + arrowDownOver = Resources::GetImageData("scrollbar_arrowdown.png"); + arrowUp = Resources::GetImageData("scrollbar_arrowup.png"); + arrowUpOver = Resources::GetImageData("scrollbar_arrowup.png"); + scrollbarBox = Resources::GetImageData("scrollbar_box.png"); + scrollbarBoxOver = Resources::GetImageData("scrollbar_box.png"); + oneButtonScrollImgData = Resources::GetImageData("oneButtonScroll.png"); + + height = h; + width = MAX(scrollbarBox->GetWidth(), scrollbarTile->GetWidth()); + + MinHeight = arrowUp->GetHeight(); + MaxHeight = height-scrollbarBox->GetHeight()-arrowDown->GetHeight(); + + trigHeldA = new GuiTrigger; + trigHeldA->SetHeldTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); + + int Tiles = (height-scrollbarTop->GetHeight()-scrollbarBottom->GetHeight())/4; + int PositionY = 0; + ButtonPositionX = 0; + + oneButtonScrollImg = new GuiImage(oneButtonScrollImgData); + + scrollbarTopImg = new GuiImage(scrollbarTop); + scrollbarTopImg->SetParent(this); + scrollbarTopImg->SetAlignment(ALIGN_CENTER, ALIGN_TOP); + scrollbarTopImg->SetPosition(0, PositionY); + PositionY += scrollbarTop->GetHeight(); + + scrollbarTileImg = new GuiImage(scrollbarTile); + scrollbarTileImg->SetParent(this); + scrollbarTileImg->SetAlignment(ALIGN_CENTER, ALIGN_TOP); + scrollbarTileImg->SetPosition(0, PositionY); + scrollbarTileImg->SetTileVertical(Tiles); + PositionY += Tiles*scrollbarTile->GetHeight(); + + scrollbarBottomImg = new GuiImage(scrollbarBottom); + scrollbarBottomImg->SetParent(this); + scrollbarBottomImg->SetAlignment(ALIGN_CENTER, ALIGN_TOP); + scrollbarBottomImg->SetPosition(0, PositionY); + + arrowDownImg = new GuiImage(arrowDown); + arrowDownOverImg = new GuiImage(arrowDownOver); + arrowUpImg = new GuiImage(arrowUp); + arrowUpOverImg = new GuiImage(arrowUpOver); + scrollbarBoxImg = new GuiImage(scrollbarBox); + scrollbarBoxOverImg = new GuiImage(scrollbarBoxOver); + + arrowUpBtn = new GuiButton(arrowUpImg->GetWidth(), arrowUpImg->GetHeight()); + arrowUpBtn->SetParent(this); + arrowUpBtn->SetImage(arrowUpImg); + arrowUpBtn->SetImageOver(arrowUpOverImg); + arrowUpBtn->SetAlignment(ALIGN_CENTER, ALIGN_TOP); + arrowUpBtn->SetPosition(ButtonPositionX, 0); + arrowUpBtn->SetHoldable(true); + arrowUpBtn->SetTrigger(trigHeldA); + arrowUpBtn->SetSoundOver(btnSoundOver); + arrowUpBtn->SetSoundClick(btnSoundClick); + arrowUpBtn->Held.connect(this, &GuiScrollbar::OnUpButtonHold); + + arrowDownBtn = new GuiButton(arrowDownImg->GetWidth(), arrowDownImg->GetHeight()); + arrowDownBtn->SetParent(this); + arrowDownBtn->SetImage(arrowDownImg); + arrowDownBtn->SetImageOver(arrowDownOverImg); + arrowDownBtn->SetAlignment(ALIGN_CENTER, ALIGN_BOTTOM); + arrowDownBtn->SetPosition(ButtonPositionX, 0); + arrowDownBtn->SetHoldable(true); + arrowDownBtn->SetTrigger(trigHeldA); + arrowDownBtn->SetSoundOver(btnSoundOver); + arrowDownBtn->SetSoundClick(btnSoundClick); + arrowDownBtn->Held.connect(this, &GuiScrollbar::OnDownButtonHold); + + scrollbarBoxBtn = new GuiButton(scrollbarBoxImg->GetWidth(), scrollbarBoxImg->GetHeight()); + scrollbarBoxBtn->SetParent(this); + scrollbarBoxBtn->SetImage(scrollbarBoxImg); + scrollbarBoxBtn->SetImageOver(scrollbarBoxOverImg); + scrollbarBoxBtn->SetAlignment(ALIGN_CENTER, ALIGN_TOP); + scrollbarBoxBtn->SetPosition(ButtonPositionX, MinHeight); + scrollbarBoxBtn->SetMinY(MinHeight); + scrollbarBoxBtn->SetMaxY(MaxHeight); + scrollbarBoxBtn->SetHoldable(true); + scrollbarBoxBtn->SetTrigger(trigHeldA); + scrollbarBoxBtn->Held.connect(this, &GuiScrollbar::OnBoxButtonHold); +} + +GuiScrollbar::~GuiScrollbar() +{ + delete scrollbarTop; + delete scrollbarBottom; + delete scrollbarTile; + delete arrowDown; + delete arrowDownOver; + delete arrowUp; + delete arrowUpOver; + delete scrollbarBox; + delete scrollbarBoxOver; + delete oneButtonScrollImg; + + delete arrowUpBtn; + delete arrowDownBtn; + delete scrollbarBoxBtn; + + delete scrollbarTopImg; + delete scrollbarBottomImg; + delete scrollbarTileImg; + delete arrowDownImg; + delete arrowDownOverImg; + delete arrowUpImg; + delete arrowUpOverImg; + delete scrollbarBoxImg; + delete scrollbarBoxOverImg; + delete oneButtonScrollImgData; + + delete trigHeldA; +} + +void GuiScrollbar::ScrollOneUp() +{ + if(Mode == ICONMODE) + { + if(SelInd+SelItem-RowSize >= 0) + { + SelItem = SelItem-RowSize; + if(SelItem < 0) + { + // move list up by 1 + SelInd = SelInd-RowSize; + SelItem = SelItem+RowSize; + } + } + } + else if(Mode == LISTMODE) + { + if(SelItem == 0 && SelInd > 0) + { + // move list up by 1 + --SelInd; + } + else if(SelInd+SelItem > 0) + { + --SelItem; + } + } +} + +void GuiScrollbar::ScrollOneDown() +{ + if(Mode == ICONMODE) + { + int i = RowSize; + while(SelInd+SelItem+RowSize >= EntrieCount && i > 0 && SelItem > 0 && RowSize < EntrieCount) + { + --i; + --SelItem; + } + if(SelInd+SelItem+RowSize < EntrieCount) + { + SelItem = SelItem+RowSize; + if(SelItem >= PageSize) + { + // move list down by 1 + SelInd += RowSize; + SelItem = SelItem-RowSize; + } + } + } + else if(Mode == LISTMODE) + { + if(SelInd+SelItem + 1 < EntrieCount) + { + if(SelItem == PageSize-1) + { + // move list down by 1 + SelInd++; + } + else + { + SelItem++; + } + } + } +} + +void GuiScrollbar::OnUpButtonHold(GuiButton *sender, int pointer, const POINT &p) +{ + if(ScrollState < ScrollSpeed) + return; + + ScrollOneUp(); + + ScrollState = 0; + listChanged(SelItem, SelInd); +} + +void GuiScrollbar::OnDownButtonHold(GuiButton *sender, int pointer, const POINT &p) +{ + if(ScrollState < ScrollSpeed) + return; + + ScrollOneDown(); + + ScrollState = 0; + listChanged(SelItem, SelInd); +} + +void GuiScrollbar::OnBoxButtonHold(GuiButton *sender, int pointer, const POINT &p) +{ + if(ScrollState < ScrollSpeed) + return; + + if(!userInput[pointer].wpad.ir.valid) + return; + + int y = p.y-this->GetTop()-scrollbarBox->GetHeight()/2; + + int positionWiimote = LIMIT(y-MinHeight, 0, MaxHeight-MinHeight); + + int newSelected = (int) ((float) positionWiimote / (float) (MaxHeight-MinHeight) * (float) (EntrieCount-1)); + + if(Mode == ICONMODE) + { + int rows = (int) floor(((float) (newSelected-SelInd-SelItem)) / ((float) RowSize)); + + while(SelInd+rows*RowSize >= EntrieCount-PageSize+RowSize) + rows--; + + int pageIndex = LIMIT(SelInd+rows*RowSize, 0, EntrieCount-1-RowSize); + + if(newSelected <= 0) + SelItem = 0; + else if(newSelected >= EntrieCount-1) + SelItem = EntrieCount-1-pageIndex; + + SelInd = pageIndex; + } + else if(Mode == LISTMODE) + { + int diff = newSelected-SelInd-SelItem; + + if(newSelected <= 0) + { + SelItem = 0; + SelInd = 0; + } + else if(newSelected >= EntrieCount-1) + { + SelItem = (PageSize-1 < EntrieCount-1) ? PageSize-1 : EntrieCount-1; + SelInd = EntrieCount-PageSize; + } + else if(newSelected < PageSize && SelInd == 0 && diff < 0) + { + SelItem = MAX(SelItem+diff, 0); + } + else if(EntrieCount-newSelected < PageSize && SelInd == EntrieCount-PageSize && diff > 0) + { + SelItem = MIN(SelItem+diff, PageSize-1); + } + else + { + SelInd = LIMIT(SelInd+diff, 0, ((EntrieCount-PageSize < 0) ? 0 : EntrieCount-PageSize)); + } + } + + ScrollState = 0; + listChanged(SelItem, SelInd); +} + +void GuiScrollbar::SetPageSize(int size) +{ + if(PageSize == size) + return; + + PageSize = size; + listChanged(SelItem, SelInd); +} + +void GuiScrollbar::SetRowSize(int size) +{ + if(RowSize == size) + return; + + RowSize = size; + listChanged(SelItem, SelInd); +} + +void GuiScrollbar::SetSelectedItem(int pos) +{ + if(SelItem == pos) + return; + + SelItem = pos; + listChanged(SelItem, SelInd); +} + +void GuiScrollbar::SetSelectedIndex(int pos) +{ + if(SelInd == pos) + return; + + SelInd = pos; + listChanged(SelItem, SelInd); +} + +void GuiScrollbar::SetEntrieCount(int cnt) +{ + if(EntrieCount == cnt) + return; + + EntrieCount = cnt; + listChanged(SelItem, SelInd); +} + +void GuiScrollbar::setScrollboxPosition(int SelItem, int SelInd) +{ + if(Mode == ICONMODE) + { + u8 row = (u8) floor((float) SelItem / (float) RowSize); + + int position = MinHeight+(MaxHeight-MinHeight)*(SelInd+row*RowSize)/(EntrieCount-1); + + if(position < MinHeight) + position = MinHeight; + else if(position > MaxHeight || ((SelInd+PageSize >= (EntrieCount-1)) && row > 1)) + position = MaxHeight; + + scrollbarBoxBtn->SetPosition(ButtonPositionX, position); + } + else if(Mode == LISTMODE) + { + int position = MinHeight+(MaxHeight-MinHeight)*(SelInd+SelItem)/(EntrieCount-1); + + if(position < MinHeight) + position = MinHeight; + else if(position > MaxHeight || (SelInd+SelItem >= EntrieCount-1)) + position = MaxHeight; + + scrollbarBoxBtn->SetPosition(ButtonPositionX, position); + } +} + +void GuiScrollbar::CheckDPadControls(GuiTrigger *t) +{ + if(t->Up()) + { + ScrollOneUp(); + listChanged(SelItem, SelInd); + } + else if(t->Down()) + { + ScrollOneDown(); + listChanged(SelItem, SelInd); + } + + else if(t->Left() && Mode == LISTMODE) + { + SelInd -= PageSize; + if(SelInd < 0) + { + SelInd = 0; + SelItem = 0; + } + listChanged(SelItem, SelInd); + } + else if(t->Right() && Mode == LISTMODE) + { + SelInd += PageSize; + if(SelInd+PageSize >= EntrieCount) + { + SelInd = EntrieCount-PageSize; + SelItem = PageSize-1; + } + listChanged(SelItem, SelInd); + } +} + +void GuiScrollbar::ScrollByButton(GuiTrigger *t) +{ + static int pressedPosition = -1; + + if(!t->wpad.ir.valid || ScrollState < ButtonScrollSpeed-ButtonScrollSpeed*fabs(pressedPosition-t->wpad.ir.y)/250.f) + return; + + if(pressedChan == -1 && (t->wpad.btns_d & ButtonScroll) && + parentElement && parentElement->IsInside(t->wpad.ir.x, t->wpad.ir.y)) + { + pressedPosition = t->wpad.ir.y; + pressedChan = t->chan; + oneButtonScrollImg->SetPosition(t->wpad.ir.x-oneButtonScrollImg->GetWidth()/2, t->wpad.ir.y-oneButtonScrollImg->GetHeight()/2); + } + + if(pressedChan == t->chan && (t->wpad.btns_h & ButtonScroll)) + { + if(pressedPosition-oneButtonScrollImg->GetHeight()/2 > t->wpad.ir.y) + ScrollOneUp(); + else if(pressedPosition+oneButtonScrollImg->GetHeight()/2 < t->wpad.ir.y) + ScrollOneDown(); + + ScrollState = 0; + listChanged(SelItem, SelInd); + } + + if(pressedChan == t->chan && !t->wpad.btns_d && !t->wpad.btns_h) + { + pressedChan = -1; + pressedPosition = -1; + } +} + +void GuiScrollbar::Draw() +{ + scrollbarTileImg->Draw(); + scrollbarTopImg->Draw(); + scrollbarBottomImg->Draw(); + arrowUpBtn->Draw(); + arrowDownBtn->Draw(); + scrollbarBoxBtn->Draw(); + if(pressedChan >= 0 && userInput[pressedChan].wpad.ir.valid) + oneButtonScrollImg->Draw(); + + UpdateEffects(); +} + +void GuiScrollbar::Update(GuiTrigger * t) +{ + arrowUpBtn->Update(t); + arrowDownBtn->Update(t); + scrollbarBoxBtn->Update(t); + if(AllowDPad) + CheckDPadControls(t); + if(ButtonScroll) + ScrollByButton(t); + + ++ScrollState; +} diff --git a/source/GUI/gui_scrollbar.hpp b/source/GUI/gui_scrollbar.hpp new file mode 100644 index 00000000..84b3003d --- /dev/null +++ b/source/GUI/gui_scrollbar.hpp @@ -0,0 +1,109 @@ +/*************************************************************************** + * Copyright (C) 2011 + * by Dimok + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any + * damages arising from the use of this software. + * + * Permission is granted to anyone to use this software for any + * purpose, including commercial applications, and to alter it and + * redistribute it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you + * must not claim that you wrote the original software. If you use + * this software in a product, an acknowledgment in the product + * documentation would be appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and + * must not be misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + ***************************************************************************/ +#ifndef GUISCROLLBAR_HPP_ +#define GUISCROLLBAR_HPP_ + +#include "gui.h" + +class GuiScrollbar : public GuiElement, public sigslot::has_slots<> +{ + public: + GuiScrollbar(int height, u8 mode = LISTMODE); + ~GuiScrollbar(); + void SetDPadControl(bool a) { AllowDPad = a; } + void SetButtonScroll(u32 button) { ButtonScroll = button; } + void ScrollOneUp(); + void ScrollOneDown(); + int GetSelectedItem() { return SelItem; }; + int GetSelectedIndex() { return SelInd; }; + void SetScrollSpeed(u16 speed) { ScrollSpeed = speed; }; + void SetButtonScrollSpeed(u16 speed) { ButtonScrollSpeed = speed; }; + void Draw(); + void Update(GuiTrigger * t); + enum + { + ICONMODE = 0, + LISTMODE, + }; + //! Signals + sigslot::signal2 listChanged; + //! Slots + void SetPageSize(int size); + void SetRowSize(int size); + void SetSelectedItem(int pos); + void SetSelectedIndex(int pos); + void SetEntrieCount(int cnt); + protected: + void setScrollboxPosition(int SelItem, int SelInd); + void OnUpButtonHold(GuiButton *sender, int pointer, const POINT &p); + void OnDownButtonHold(GuiButton *sender, int pointer, const POINT &p); + void OnBoxButtonHold(GuiButton *sender, int pointer, const POINT &p); + void CheckDPadControls(GuiTrigger *t); + void ScrollByButton(GuiTrigger *t); + + u8 Mode; + u32 ScrollState; + u16 ScrollSpeed; + u16 ButtonScrollSpeed; + u32 ButtonScroll; + bool AllowDPad; + + int MinHeight; + int MaxHeight; + int SelItem; + int SelInd; + int RowSize; + int PageSize; + int EntrieCount; + int ButtonPositionX; + int pressedChan; + bool listchanged; + + GuiButton * arrowUpBtn; + GuiButton * arrowDownBtn; + GuiButton * scrollbarBoxBtn; + GuiImage * scrollbarTopImg; + GuiImage * scrollbarBottomImg; + GuiImage * scrollbarTileImg; + GuiImage * arrowDownImg; + GuiImage * arrowDownOverImg; + GuiImage * arrowUpImg; + GuiImage * arrowUpOverImg; + GuiImage * scrollbarBoxImg; + GuiImage * scrollbarBoxOverImg; + GuiImage * oneButtonScrollImg; + GuiImageData * scrollbarTop; + GuiImageData * scrollbarBottom; + GuiImageData * scrollbarTile; + GuiImageData * arrowDown; + GuiImageData * arrowDownOver; + GuiImageData * arrowUp; + GuiImageData * arrowUpOver; + GuiImageData * scrollbarBox; + GuiImageData * scrollbarBoxOver; + GuiImageData * oneButtonScrollImgData; + GuiTrigger * trigHeldA; +}; + +#endif diff --git a/source/libwiigui/gui_searchbar.cpp b/source/GUI/gui_searchbar.cpp similarity index 100% rename from source/libwiigui/gui_searchbar.cpp rename to source/GUI/gui_searchbar.cpp diff --git a/source/libwiigui/gui_searchbar.h b/source/GUI/gui_searchbar.h similarity index 100% rename from source/libwiigui/gui_searchbar.h rename to source/GUI/gui_searchbar.h diff --git a/source/libwiigui/gui_text.cpp b/source/GUI/gui_text.cpp similarity index 91% rename from source/libwiigui/gui_text.cpp rename to source/GUI/gui_text.cpp index 60e2a6d1..d0f4d3d0 100644 --- a/source/libwiigui/gui_text.cpp +++ b/source/GUI/gui_text.cpp @@ -185,7 +185,8 @@ void GuiText::SetText(const wchar_t * t) { LOCK( this ); - if (text) delete[] text; + if (text) + delete [] text; text = NULL; ClearDynamicText(); @@ -214,7 +215,8 @@ void GuiText::ClearDynamicText() { for (u32 i = 0; i < textDyn.size(); i++) { - if (textDyn[i]) delete[] textDyn[i]; + if (textDyn[i]) + delete [] textDyn[i]; } textDyn.clear(); } @@ -370,15 +372,13 @@ void GuiText::MakeDottedText() while (text[i]) { - currentWidth += (font ? font : fontSystem)->getCharWidth(text[i], currentSize, i > 0 ? text[i - 1] : 0x0000); - if (currentWidth >= maxWidth) + currentWidth += (font ? font : fontSystem)->getCharWidth(text[i], currentSize, i > 0 ? text[i - 1] : 0); + if (currentWidth >= maxWidth && i > 2) { - if (i > 3) - { - textDyn[pos][i - 3] = '.'; - textDyn[pos][i - 2] = '.'; - textDyn[pos][i - 1] = '.'; - } + textDyn[pos][i - 2] = '.'; + textDyn[pos][i - 1] = '.'; + textDyn[pos][i] = '.'; + i++; break; } @@ -399,11 +399,11 @@ void GuiText::ScrollText() textDyn[pos] = new wchar_t[maxWidth]; - while (text[i] && currentWidth < maxWidth-40) + while (text[i] && currentWidth < maxWidth) { textDyn[pos][i] = text[i]; - currentWidth += (font ? font : fontSystem)->getCharWidth(text[i], currentSize, i > 0 ? text[i - 1] : 0x0000); + currentWidth += (font ? font : fontSystem)->getCharWidth(text[i], currentSize, i > 0 ? text[i - 1] : 0); ++i; } @@ -423,10 +423,10 @@ void GuiText::ScrollText() return; } - int strlen = wcslen(text); + int stringlen = wcslen(text); ++textScrollPos; - if (textScrollPos > strlen) + if (textScrollPos > stringlen) { textScrollPos = 0; textScrollInitialDelay = TEXT_SCROLL_INITIAL_DELAY; @@ -435,27 +435,30 @@ void GuiText::ScrollText() int ch = textScrollPos; int pos = textDyn.size() - 1; - if (textDyn[pos]) delete[] textDyn[pos]; - - textDyn[pos] = new wchar_t[maxWidth]; + if (!textDyn[pos]) new wchar_t[maxWidth]; int i = 0, currentWidth = 0; - while (currentWidth < maxWidth-40) + while (currentWidth < maxWidth) { - if (ch > strlen - 1) + if (ch > stringlen - 1) { textDyn[pos][i++] = ' '; + currentWidth += (font ? font : fontSystem)->getCharWidth(L' ', currentSize, ch > 0 ? text[ch - 1] : 0); textDyn[pos][i++] = ' '; + currentWidth += (font ? font : fontSystem)->getCharWidth(L' ', currentSize, L' '); textDyn[pos][i++] = ' '; + currentWidth += (font ? font : fontSystem)->getCharWidth(L' ', currentSize, L' '); ch = 0; + + if(currentWidth >= maxWidth) + break; } textDyn[pos][i] = text[ch]; + currentWidth += (font ? font : fontSystem)->getCharWidth(text[ch], currentSize, ch > 0 ? text[ch - 1] : 0); ++ch; ++i; - - currentWidth += (font ? font : fontSystem)->getCharWidth(text[ch], currentSize, ch > 0 ? text[ch - 1] : 0x0000); } textDyn[pos][i] = 0; } diff --git a/source/libwiigui/gui_tooltip.cpp b/source/GUI/gui_tooltip.cpp similarity index 98% rename from source/libwiigui/gui_tooltip.cpp rename to source/GUI/gui_tooltip.cpp index 76729258..f9e86f4a 100644 --- a/source/libwiigui/gui_tooltip.cpp +++ b/source/GUI/gui_tooltip.cpp @@ -75,7 +75,7 @@ void GuiTooltip::SetText(const char * t) if (tile_cnt < 0) tile_cnt = 0; } tileImage->SetPosition(leftImage->GetWidth(), 0); - tileImage->SetTile(tile_cnt); + tileImage->SetTileHorizontal(tile_cnt); rightImage->SetPosition(leftImage->GetWidth() + tile_cnt * tileImage->GetWidth(), 0); width = leftImage->GetWidth() + tile_cnt * tileImage->GetWidth() + rightImage->GetWidth(); } diff --git a/source/libwiigui/gui_trigger.cpp b/source/GUI/gui_trigger.cpp similarity index 100% rename from source/libwiigui/gui_trigger.cpp rename to source/GUI/gui_trigger.cpp diff --git a/source/libwiigui/gui_window.cpp b/source/GUI/gui_window.cpp similarity index 100% rename from source/libwiigui/gui_window.cpp rename to source/GUI/gui_window.cpp diff --git a/source/libwiigui/sigslot.h b/source/GUI/sigslot.h similarity index 100% rename from source/libwiigui/sigslot.h rename to source/GUI/sigslot.h diff --git a/source/SoundOperations/gui_sound.cpp b/source/SoundOperations/gui_sound.cpp index a9b8aa8a..8140cd7f 100644 --- a/source/SoundOperations/gui_sound.cpp +++ b/source/SoundOperations/gui_sound.cpp @@ -24,7 +24,7 @@ * for WiiXplorer 2010 ***************************************************************************/ #include -#include "libwiigui/gui.h" +#include "GUI/gui.h" #include "utils/uncompress.h" #include "FileOperations/fileops.h" #include "SoundHandler.hpp" diff --git a/source/StartUpProcess.cpp b/source/StartUpProcess.cpp index 2aeb6364..111aaeeb 100644 --- a/source/StartUpProcess.cpp +++ b/source/StartUpProcess.cpp @@ -1,6 +1,6 @@ #include #include "StartUpProcess.h" -#include "libwiigui/gui.h" +#include "GUI/gui.h" #include "video.h" #include "audio.h" #include "input.h" @@ -15,6 +15,10 @@ #include "settings/CGameStatistics.h" #include "settings/CGameCategories.hpp" #include "usbloader/usbstorage2.h" +#include "usbloader/MountGamePartition.h" +#include "usbloader/GameBooter.hpp" +#include "usbloader/GameList.h" +#include "utils/tools.h" #include "sys.h" StartUpProcess::StartUpProcess() @@ -47,6 +51,35 @@ StartUpProcess::~StartUpProcess() delete messageTxt; } +int StartUpProcess::ParseArguments(int argc, char *argv[]) +{ + int quickBoot = -1; + + //! The arguments override + for(int i = 0; i < argc; ++i) + { + if(!argv[i]) continue; + + gprintf("Boot argument %i: %s\n", i+1, argv[i]); + + char *ptr = strcasestr(argv[i], "-ios="); + if(ptr) + Settings.cios = LIMIT(atoi(ptr+strlen("-ios=")), 200, 255); + + ptr = strcasestr(argv[i], "-usbport="); + if(ptr) + { + Settings.USBPort = LIMIT(atoi(ptr+strlen("-usbport=")), 0, 1); + DeviceHandler::SetUSBPort(Settings.USBPort, false); + } + + if(strlen(argv[i]) == 6 && strchr(argv[i], '=') == 0 && strchr(argv[i], '-') == 0) + quickBoot = i; + } + + return quickBoot; +} + void StartUpProcess::TextFade(int direction) { if(direction > 0) @@ -110,14 +143,21 @@ bool StartUpProcess::USBSpinUp() return started; } -bool StartUpProcess::Run() +int StartUpProcess::Run(int argc, char *argv[]) { + int quickGameBoot = ParseArguments(argc, argv); + StartUpProcess Process; - return Process.Execute(); + int ret = Process.Execute(); + + if(quickGameBoot != -1) + return QuickGameBoot(argv[quickGameBoot]); + + return ret; } -bool StartUpProcess::Execute() +int StartUpProcess::Execute() { SetTextf("Start up\n"); @@ -150,7 +190,7 @@ bool StartUpProcess::Execute() // Loading now the cios setup in the settings IosLoader::LoadAppCios(); - SetTextf("Loaded cIOS %i R%i\n", IOS_GetVersion(), IOS_GetRevision()); + SetTextf("Reloading into cIOS %i R%i\n", IOS_GetVersion(), IOS_GetRevision()); DeviceHandler::Instance()->MountSD(); USBSpinUp(); @@ -161,7 +201,7 @@ bool StartUpProcess::Execute() { Settings.USBPort = 0; } - else if(Settings.USBPort == 1) + else if(Settings.USBPort == 1 && USBStorage2_GetPort() != Settings.USBPort) { SetTextf("Changing USB Port to %i\n", Settings.USBPort); DeviceHandler::Instance()->UnMountAllUSB(); @@ -180,7 +220,7 @@ bool StartUpProcess::Execute() setlocale(LC_CTYPE, "C-UTF-8"); setlocale(LC_MESSAGES, "C-UTF-8"); - return true; + return 0; } void StartUpProcess::Draw() @@ -191,3 +231,23 @@ void StartUpProcess::Draw() messageTxt->Draw(); Menu_Render(); } + +int StartUpProcess::QuickGameBoot(const char * gameID) +{ + MountGamePartition(false); + + struct discHdr *header = NULL; + for(int i = 0; i < gameList.size(); ++i) + { + if(strncasecmp((char *) gameList[i]->id, gameID, 6) == 0) + header = gameList[i]; + } + + if(!header) + return -1; + + GameStatistics.SetPlayCount(header->id, GameStatistics.GetPlayCount(header->id)+1); + GameStatistics.Save(); + + return GameBooter::BootGame(gameID); +} diff --git a/source/StartUpProcess.h b/source/StartUpProcess.h index d785ee66..cab04c2f 100644 --- a/source/StartUpProcess.h +++ b/source/StartUpProcess.h @@ -1,20 +1,22 @@ #ifndef STARTUPPROCESS_H_ #define STARTUPPROCESS_H_ -#include "libwiigui/gui.h" +#include "GUI/gui.h" class StartUpProcess { public: - static bool Run(); + static int Run(int argc, char *argv[]); private: StartUpProcess(); ~StartUpProcess(); - bool Execute(); + int Execute(); bool USBSpinUp(); void TextFade(int direction); void SetTextf(const char * format, ...); void Draw(); + static int ParseArguments(int argc, char *argv[]); + static int QuickGameBoot(const char * gameID); GuiImageData * GXImageData; GuiImage * background; diff --git a/source/cheats/cheatmenu.cpp b/source/cheats/cheatmenu.cpp index 28e824e9..0f538401 100644 --- a/source/cheats/cheatmenu.cpp +++ b/source/cheats/cheatmenu.cpp @@ -1,9 +1,8 @@ #include #include -#include -#include "libwiigui/gui.h" -#include "libwiigui/gui_customoptionbrowser.h" +#include "GUI/gui.h" +#include "GUI/gui_optionbrowser.h" #include "prompts/PromptWindows.h" #include "language/gettext.h" #include "themes/CTheme.h" @@ -30,14 +29,14 @@ int CheatMenu(const char * gameID) GuiTrigger trigB; trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B); - GuiText backBtnTxt(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + GuiText backBtnTxt(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); backBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30); GuiImage backBtnImg(&btnOutline); GuiButton backBtn(&backBtnImg, &backBtnImg, 2, 3, -140, 400, &trigA, NULL, btnSoundClick2, 1); backBtn.SetLabel(&backBtnTxt); backBtn.SetTrigger(&trigB); - GuiText createBtnTxt(tr( "Create" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + GuiText createBtnTxt(tr( "Create" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); createBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30); GuiImage createBtnImg(&btnOutline); GuiButton createBtn(&createBtnImg, &createBtnImg, 2, 3, 160, 400, &trigA, NULL, btnSoundClick2, 1); @@ -67,7 +66,7 @@ int CheatMenu(const char * gameID) case 1: int cntcheats = c.getCnt(); OptionList cheatslst; - GuiCustomOptionBrowser chtBrowser(400, 280, &cheatslst, "bg_options_settings.png"); + GuiOptionBrowser chtBrowser(400, 280, &cheatslst, "bg_options_settings.png"); chtBrowser.SetPosition(0, 90); chtBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); chtBrowser.SetClickable(true); diff --git a/source/filelist.h b/source/filelist.h deleted file mode 100644 index f9e5563e..00000000 --- a/source/filelist.h +++ /dev/null @@ -1,574 +0,0 @@ -/**************************************************************************** - * libwiigui Template - * Tantric 2009 - * - * imagelist.h - * Contains a list of all of the files in the images, fonts, sounds folders - ***************************************************************************/ - -#ifndef _FILELIST_H_ -#define _FILELIST_H_ - -#include - -extern const u8 font_ttf[]; -extern const u32 font_ttf_size; - -extern const u8 clock_ttf[]; -extern const u32 clock_ttf_size; - -extern const u8 closebutton_png[]; -extern const u32 closebutton_png_size; - -extern const u8 gxlogo_png[]; -extern const u32 gxlogo_png_size; - -extern const u8 sdcard_png[]; -extern const u32 sdcard_png_size; - -extern const u8 sdcard_over_png[]; -extern const u32 sdcard_over_png_size; - -extern const u8 Wifi_btn_png[]; -extern const u32 Wifi_btn_png_size; - -extern const u8 Channel_btn_png[]; -extern const u32 Channel_btn_png_size; - -extern const u8 wiimote_png[]; -extern const u32 wiimote_png_size; - -extern const u8 bg_music_ogg[]; -extern const u32 bg_music_ogg_size; - -extern const u8 credits_music_ogg[]; -extern const u32 credits_music_ogg_size; - -extern const u8 gameinfo1_png[]; -extern const u32 gameinfo1_png_size; - -extern const u8 gameinfo2_png[]; -extern const u32 gameinfo2_png_size; - -extern const u8 gameinfo1a_png[]; -extern const u32 gameinfo1a_png_size; - -extern const u8 gameinfo2a_png[]; -extern const u32 gameinfo2a_png_size; - -extern const u8 menuin_ogg[]; -extern const u32 menuin_ogg_size; - -extern const u8 menuout_ogg[]; -extern const u32 menuout_ogg_size; - -extern const u8 success_ogg[]; -extern const u32 success_ogg_size; - -extern const u8 credits_button_png[]; -extern const u32 credits_button_png_size; - -extern const u8 credits_button_over_png[]; -extern const u32 credits_button_over_png_size; - -extern const u8 button_over_wav[]; -extern const u32 button_over_wav_size; - -extern const u8 button_click_wav[]; -extern const u32 button_click_wav_size; - -extern const u8 button_click2_wav[]; -extern const u32 button_click2_wav_size; - -extern const u8 tooltip_left_png[]; -extern const u32 tooltip_left_png_size; - -extern const u8 tooltip_tile_png[]; -extern const u32 tooltip_tile_png_size; - -extern const u8 tooltip_right_png[]; -extern const u32 tooltip_right_png_size; - -extern const u8 startgame_arrow_left_png[]; -extern const u32 startgame_arrow_left_png_size; - -extern const u8 startgame_arrow_right_png[]; -extern const u32 startgame_arrow_right_png_size; - -extern const u8 credits_bg_png[]; -extern const u32 credits_bg_png_size; - -extern const u8 little_star_png[]; -extern const u32 little_star_png_size; - -extern const u8 background_png[]; -extern const u32 background_png_size; - -extern const u8 wbackground_png[]; -extern const u32 wbackground_png_size; - -extern const u8 bg_options_settings_png[]; -extern const u32 bg_options_settings_png_size; - -extern const u8 settings_background_png[]; -extern const u32 settings_background_png_size; - -extern const u8 bg_browser_png[]; -extern const u32 bg_browser_png_size; - -extern const u8 icon_folder_png[]; -extern const u32 icon_folder_png_size; - -extern const u8 bg_browser_selection_png[]; -extern const u32 bg_browser_selection_png_size; - -extern const u8 addressbar_textbox_png[]; -extern const u32 addressbar_textbox_png_size; - -extern const u8 browser_png[]; -extern const u32 browser_png_size; - -extern const u8 browser_over_png[]; -extern const u32 browser_over_png_size; - -extern const u8 nocover_png[]; -extern const u32 nocover_png_size; - -extern const u8 nocoverFlat_png[]; -extern const u32 nocoverFlat_png_size; - -extern const u8 nodisc_png[]; -extern const u32 nodisc_png_size; - -extern const u8 theme_dialogue_box_png[]; -extern const u32 theme_dialogue_box_png_size; - -extern const u8 button_install_png[]; -extern const u32 button_install_png_size; - -extern const u8 button_install_over_png[]; -extern const u32 button_install_over_png_size; - -extern const u8 dialogue_box_startgame_png[]; -extern const u32 dialogue_box_startgame_png_size; - -extern const u8 wdialogue_box_startgame_png[]; -extern const u32 wdialogue_box_startgame_png_size; - -extern const u8 button_dialogue_box_png[]; -extern const u32 button_dialogue_box_png_size; - -extern const u8 keyboard_textbox_png[]; -extern const u32 keyboard_textbox_png_size; - -extern const u8 keyboard_key_png[]; -extern const u32 keyboard_key_png_size; - -extern const u8 keyboard_key_over_png[]; -extern const u32 keyboard_key_over_png_size; - -extern const u8 keyboard_mediumkey_over_png[]; -extern const u32 keyboard_mediumkey_over_png_size; - -extern const u8 keyboard_largekey_over_png[]; -extern const u32 keyboard_largekey_over_png_size; - -extern const u8 keyboard_backspace_over_png[]; -extern const u32 keyboard_backspace_over_png_size; - -extern const u8 keyboard_clear_over_png[]; -extern const u32 keyboard_clear_over_png_size; - -extern const u8 menu_button_png[]; -extern const u32 menu_button_png_size; - -extern const u8 menu_button_over_png[]; -extern const u32 menu_button_over_png_size; - -extern const u8 settings_button_png[]; -extern const u32 settings_button_png_size; - -extern const u8 settings_button_over_png[]; -extern const u32 settings_button_over_png_size; - -extern const u8 wiimote_poweroff_png[]; -extern const u32 wiimote_poweroff_png_size; - -extern const u8 dialogue_box_png[]; -extern const u32 dialogue_box_png_size; - -extern const u8 theme_box_png[]; -extern const u32 theme_box_png_size; - -extern const u8 wiimote_poweroff_over_png[]; -extern const u32 wiimote_poweroff_over_png_size; - -extern const u8 bg_options_png[]; -extern const u32 bg_options_png_size; - -extern const u8 bg_options_entry_png[]; -extern const u32 bg_options_entry_png_size; - -extern const u8 scrollbar_png[]; -extern const u32 scrollbar_png_size; - -extern const u8 scrollbar_arrowup_png[]; -extern const u32 scrollbar_arrowup_png_size; - -extern const u8 scrollbar_arrowdown_png[]; -extern const u32 scrollbar_arrowdown_png_size; - -extern const u8 scrollbar_box_png[]; -extern const u32 scrollbar_box_png_size; - -extern const u8 progressbar_png[]; -extern const u32 progressbar_png_size; - -extern const u8 progressbar_empty_png[]; -extern const u32 progressbar_empty_png_size; - -extern const u8 progressbar_outline_png[]; -extern const u32 progressbar_outline_png_size; - -extern const u8 player1_point_png[]; -extern const u32 player1_point_png_size; - -extern const u8 player2_point_png[]; -extern const u32 player2_point_png_size; - -extern const u8 player3_point_png[]; -extern const u32 player3_point_png_size; - -extern const u8 player4_point_png[]; -extern const u32 player4_point_png_size; - -extern const u8 player1_grab_png[]; -extern const u32 player1_grab_png_size; - -extern const u8 player2_grab_png[]; -extern const u32 player2_grab_png_size; - -extern const u8 player3_grab_png[]; -extern const u32 player3_grab_png_size; - -extern const u8 player4_grab_png[]; -extern const u32 player4_grab_png_size; - -extern const u8 rplayer1_point_png[]; -extern const u32 rplayer1_point_png_size; - -extern const u8 rplayer2_point_png[]; -extern const u32 rplayer2_point_png_size; - -extern const u8 rplayer3_point_png[]; -extern const u32 rplayer3_point_png_size; - -extern const u8 rplayer4_point_png[]; -extern const u32 rplayer4_point_png_size; - -extern const u8 battery_png[]; -extern const u32 battery_png_size; - -extern const u8 battery_bar_png[]; -extern const u32 battery_bar_png_size; - -extern const u8 battery_white_png[]; -extern const u32 battery_white_png_size; - -extern const u8 battery_bar_white_png[]; -extern const u32 battery_bar_white_png_size; - -extern const u8 battery_red_png[]; -extern const u32 battery_red_png_size; - -extern const u8 battery_bar_red_png[]; -extern const u32 battery_bar_red_png_size; - -extern const u8 exit_top_png[]; -extern const u32 exit_top_png_size; - -extern const u8 exit_top_over_png[]; -extern const u32 exit_top_over_png_size; - -extern const u8 exit_bottom_png[]; -extern const u32 exit_bottom_png_size; - -extern const u8 exit_bottom_over_png[]; -extern const u32 exit_bottom_over_png_size; - -extern const u8 exit_button_png[]; -extern const u32 exit_button_png_size; - -extern const u8 favorite_png[]; -extern const u32 favorite_png_size; - -extern const u8 not_favorite_png[]; -extern const u32 not_favorite_png_size; - -extern const u8 favIcon_png[]; -extern const u32 favIcon_png_size; - -extern const u8 favIcon_gray_png[]; -extern const u32 favIcon_gray_png_size; - -extern const u8 searchIcon_png[]; -extern const u32 searchIcon_png_size; - -extern const u8 searchIcon_gray_png[]; -extern const u32 searchIcon_gray_png_size; - -extern const u8 abcIcon_png[]; -extern const u32 abcIcon_png_size; - -extern const u8 abcIcon_gray_png[]; -extern const u32 abcIcon_gray_png_size; - -extern const u8 rankIcon_png[]; -extern const u32 rankIcon_png_size; - -extern const u8 rankIcon_gray_png[]; -extern const u32 rankIcon_gray_png_size; - -extern const u8 playCountIcon_png[]; -extern const u32 playCountIcon_png_size; - -extern const u8 playCountIcon_gray_png[]; -extern const u32 playCountIcon_gray_png_size; - -extern const u8 arrangeList_png[]; -extern const u32 arrangeList_png_size; - -extern const u8 arrangeList_gray_png[]; -extern const u32 arrangeList_gray_png_size; - -extern const u8 arrangeGrid_png[]; -extern const u32 arrangeGrid_png_size; - -extern const u8 arrangeGrid_gray_png[]; -extern const u32 arrangeGrid_gray_png_size; - -extern const u8 arrangeCarousel_png[]; -extern const u32 arrangeCarousel_png_size; - -extern const u8 arrangeCarousel_gray_png[]; -extern const u32 arrangeCarousel_gray_png_size; - -extern const u8 settings_title_png[]; -extern const u32 settings_title_png_size; - -extern const u8 settings_title_over_png[]; -extern const u32 settings_title_over_png_size; - -extern const u8 pageindicator_png[]; -extern const u32 pageindicator_png_size; - -extern const u8 Wiimote1_png[]; -extern const u32 Wiimote1_png_size; - -extern const u8 Wiimote2_png[]; -extern const u32 Wiimote2_png_size; - -extern const u8 Wiimote4_png[]; -extern const u32 Wiimote4_png_size; - -extern const u8 wifi1_png[]; -extern const u32 wifi1_png_size; - -extern const u8 wifi2_png[]; -extern const u32 wifi2_png_size; - -extern const u8 wifi3_png[]; -extern const u32 wifi3_png_size; - -extern const u8 wifi4_png[]; -extern const u32 wifi4_png_size; - -extern const u8 wifi8_png[]; -extern const u32 wifi8_png_size; - -extern const u8 wifi12_png[]; -extern const u32 wifi12_png_size; - -extern const u8 wifi16_png[]; -extern const u32 wifi16_png_size; - -extern const u8 wifi32_png[]; -extern const u32 wifi32_png_size; - -extern const u8 norating_png[]; -extern const u32 norating_png_size; - -extern const u8 guitar_png[]; -extern const u32 guitar_png_size; -extern const u8 guitarR_png[]; -extern const u32 guitarR_png_size; - -extern const u8 microphone_png[]; -extern const u32 microphone_png_size; -extern const u8 microphoneR_png[]; -extern const u32 microphoneR_png_size; - -extern const u8 gcncontroller_png[]; -extern const u32 gcncontroller_png_size; -extern const u8 gcncontrollerR_png[]; -extern const u32 gcncontrollerR_png_size; - -extern const u8 classiccontroller_png[]; -extern const u32 classiccontroller_png_size; -extern const u8 classiccontrollerR_png[]; -extern const u32 classiccontrollerR_png_size; - -extern const u8 nunchuk_png[]; -extern const u32 nunchuk_png_size; -extern const u8 nunchukR_png[]; -extern const u32 nunchukR_png_size; - -extern const u8 dancepad_png[]; -extern const u32 dancepad_png_size; -extern const u8 dancepadR_png[]; -extern const u32 dancepadR_png_size; - -extern const u8 balanceboard_png[]; -extern const u32 balanceboard_png_size; -extern const u8 balanceboardR_png[]; -extern const u32 balanceboardR_png_size; - -extern const u8 drums_png[]; -extern const u32 drums_png_size; -extern const u8 drumsR_png[]; -extern const u32 drumsR_png_size; - -extern const u8 motionplus_png[]; -extern const u32 motionplus_png_size; -extern const u8 motionplusR_png[]; -extern const u32 motionplusR_png_size; - -extern const u8 wheel_png[]; -extern const u32 wheel_png_size; -extern const u8 wheelR_png[]; -extern const u32 wheelR_png_size; - -extern const u8 zapper_png[]; -extern const u32 zapper_png_size; -extern const u8 zapperR_png[]; -extern const u32 zapperR_png_size; - -extern const u8 wiispeak_png[]; -extern const u32 wiispeak_png_size; -extern const u8 wiispeakR_png[]; -extern const u32 wiispeakR_png_size; - -extern const u8 nintendods_png[]; -extern const u32 nintendods_png_size; -extern const u8 nintendodsR_png[]; -extern const u32 nintendodsR_png_size; - -extern const u8 esrb_ec_png[]; -extern const u32 esrb_ec_png_size; - -extern const u8 esrb_e_png[]; -extern const u32 esrb_e_png_size; - -extern const u8 esrb_eten_png[]; -extern const u32 esrb_eten_png_size; - -extern const u8 esrb_t_png[]; -extern const u32 esrb_t_png_size; - -extern const u8 esrb_m_png[]; -extern const u32 esrb_m_png_size; - -extern const u8 esrb_ao_png[]; -extern const u32 esrb_ao_png_size; - -extern const u8 cero_a_png[]; -extern const u32 cero_a_png_size; - -extern const u8 cero_b_png[]; -extern const u32 cero_b_png_size; - -extern const u8 cero_c_png[]; -extern const u32 cero_c_png_size; - -extern const u8 cero_d_png[]; -extern const u32 cero_d_png_size; - -extern const u8 cero_z_png[]; -extern const u32 cero_z_png_size; - -extern const u8 pegi_3_png[]; -extern const u32 pegi_3_png_size; - -extern const u8 pegi_7_png[]; -extern const u32 pegi_7_png_size; - -extern const u8 pegi_12_png[]; -extern const u32 pegi_12_png_size; - -extern const u8 pegi_16_png[]; -extern const u32 pegi_16_png_size; - -extern const u8 pegi_18_png[]; -extern const u32 pegi_18_png_size; - -extern const u8 usbport_png[]; -extern const u32 usbport_png_size; - -extern const u8 dvd_png[]; -extern const u32 dvd_png_size; - -extern const u8 dvd_gray_png[]; -extern const u32 dvd_gray_png_size; - -extern const u8 new_png[]; -extern const u32 new_png_size; - -extern const u8 lock_png[]; -extern const u32 lock_png_size; - -extern const u8 lock_gray_png[]; -extern const u32 lock_gray_png_size; - -extern const u8 unlock_png[]; -extern const u32 unlock_png_size; - -extern const u8 unlock_gray_png[]; -extern const u32 unlock_gray_png_size; - -extern const u8 boxBorder_png[]; -extern const u32 boxBorder_png_size; - -extern const u8 nocoverFull_png[]; -extern const u32 nocoverFull_png_size; - -extern const u8 playersSort_png[]; -extern const u32 playersSort_png_size; - -extern const u8 add_png[]; -extern const u32 add_png_size; - -extern const u8 back_png[]; -extern const u32 back_png_size; - -extern const u8 forward_png[]; -extern const u32 forward_png_size; - -extern const u8 categoryPrompt_png[]; -extern const u32 categoryPrompt_png_size; - -extern const u8 categoryLine_png[]; -extern const u32 categoryLine_png_size; - -extern const u8 remove_png[]; -extern const u32 remove_png_size; - -extern const u8 category_png[]; -extern const u32 category_png_size; - -extern const u8 category_gray_png[]; -extern const u32 category_gray_png_size; - -extern const u8 stub_bin[]; -extern const u32 stub_bin_size; - -#endif diff --git a/source/homebrewboot/HomebrewBrowser.cpp b/source/homebrewboot/HomebrewBrowser.cpp index b783606f..4372ec28 100644 --- a/source/homebrewboot/HomebrewBrowser.cpp +++ b/source/homebrewboot/HomebrewBrowser.cpp @@ -24,12 +24,14 @@ #include "HomebrewBrowser.hpp" #include "themes/CTheme.h" #include "prompts/PromptWindows.h" +#include "prompts/HomebrewPrompt.hpp" #include "language/gettext.h" #include "network/networkops.h" #include "utils/minizip/miniunz.h" #include "usbloader/utils.h" #include "prompts/TitleBrowser.h" #include "homebrewboot/BootHomebrew.h" +#include "FileOperations/fileops.h" #include "prompts/ProgressWindow.h" #include "wstring.hpp" #include "HomebrewXML.h" @@ -48,7 +50,7 @@ HomebrewBrowser::HomebrewBrowser() ResumeNetworkWait(); wifiNotSet = true; - wifiImgData = Resources::GetImageData("Wifi_btn.png"); + wifiImgData = Resources::GetImageData("wifi_btn.png"); wifiToolTip = new GuiTooltip(" "); wifiImg = new GuiImage(wifiImgData); wifiBtn = new GuiButton(wifiImgData->GetWidth(), wifiImgData->GetHeight()); @@ -61,7 +63,7 @@ HomebrewBrowser::HomebrewBrowser() wifiBtn->SetTrigger(trigA); Append(wifiBtn); - channelImgData = Resources::GetImageData("Channel_btn.png"); + channelImgData = Resources::GetImageData("channel_btn.png"); channelBtnImg = new GuiImage(channelImgData); channelBtnImg->SetWidescreen(Settings.widescreen); channelBtn = new GuiButton(channelBtnImg->GetWidth(), channelBtnImg->GetHeight()); @@ -283,12 +285,39 @@ void HomebrewBrowser::MainButtonClicked(int button) wString HomebrewName(MainButtonTxt[button]->GetText()); - int choice = HBCWindowPrompt(HomebrewName.toUTF8().c_str(), MetaXML.GetCoder(), MetaXML.GetVersion(), + HomebrewPrompt *HBCWindowPrompt = new HomebrewPrompt(HomebrewName.toUTF8().c_str(), MetaXML.GetCoder(), MetaXML.GetVersion(), MetaXML.GetReleasedate(), MetaXML.GetLongDescription(), IconImgData[button % 4], filesize); + mainWindow->SetState(STATE_DISABLED); + mainWindow->Append(HBCWindowPrompt); + + int choice = HBCWindowPrompt->MainLoop(); + + delete HBCWindowPrompt; + + mainWindow->SetState(STATE_DEFAULT); + if (choice == 1) { - BootHomebrew(HomebrewList->GetFilepath(button)); + u8 *buffer = NULL; + u64 filesize = 0; + LoadFileToMem(HomebrewList->GetFilepath(button), &buffer, &filesize); + if(!buffer) + { + WindowPrompt(tr("Error"), tr("Not enough memory."), tr("OK")); + return; + } + FreeHomebrewBuffer(); + CopyHomebrewMemory(buffer, 0, filesize); + + AddBootArgument(HomebrewList->GetFilepath(button)); + + for(u32 i = 0; i < MetaXML.GetArguments().size(); ++i) + { + AddBootArgument(MetaXML.GetArguments().at(i).c_str()); + } + + BootHomebrewFromMem(); } } diff --git a/source/homebrewboot/HomebrewXML.cpp b/source/homebrewboot/HomebrewXML.cpp index 34b19cc3..4bb54bf5 100644 --- a/source/homebrewboot/HomebrewXML.cpp +++ b/source/homebrewboot/HomebrewXML.cpp @@ -8,6 +8,7 @@ #include #include "FileOperations/fileops.h" #include "xml/xml.h" +#include "gecko.h" #include "HomebrewXML.h" @@ -75,6 +76,16 @@ int HomebrewXML::LoadHomebrewXMLData(const char* filename) Releasedate = Entrie; + node = mxmlFindElement(node, nodetree, "arguments", NULL, NULL, MXML_DESCEND_FIRST); + + while(node) + { + Entrie[0] = '\0'; + node = GetTextFromNode(node, nodetree, (char*) "arg", NULL, NULL, MXML_DESCEND, Entrie, ENTRIE_SIZE); + if(node) + Arguments.push_back(std::string(Entrie)); + } + delete[] Entrie; mxmlDelete(node); diff --git a/source/homebrewboot/HomebrewXML.h b/source/homebrewboot/HomebrewXML.h index 6032fd02..d3d2c6fa 100644 --- a/source/homebrewboot/HomebrewXML.h +++ b/source/homebrewboot/HomebrewXML.h @@ -6,6 +6,7 @@ #define ___HOMEBREWXML_H_ #include +#include class HomebrewXML { @@ -22,6 +23,7 @@ class HomebrewXML const char * GetReleasedate() const; const char * GetShortDescription() const; const char * GetLongDescription() const; + const std::vector & GetArguments() const { return Arguments; }; protected: std::string Name; @@ -30,6 +32,7 @@ class HomebrewXML std::string Releasedate; std::string ShortDescription; std::string LongDescription; + std::vector Arguments; }; #endif diff --git a/source/images/back.png b/source/images/back.png deleted file mode 100644 index 68ed8a13..00000000 Binary files a/source/images/back.png and /dev/null differ diff --git a/source/images/bg_browser_selection.png b/source/images/bg_browser_selection.png deleted file mode 100644 index 2bdc02db..00000000 Binary files a/source/images/bg_browser_selection.png and /dev/null differ diff --git a/source/images/bg_options_entry.png b/source/images/bg_options_entry.png deleted file mode 100644 index db4e2472..00000000 Binary files a/source/images/bg_options_entry.png and /dev/null differ diff --git a/source/images/categoryLine.png b/source/images/categoryLine.png deleted file mode 100644 index 768dedf9..00000000 Binary files a/source/images/categoryLine.png and /dev/null differ diff --git a/source/images/categoryPrompt.png b/source/images/categoryPrompt.png deleted file mode 100644 index d999140d..00000000 Binary files a/source/images/categoryPrompt.png and /dev/null differ diff --git a/source/images/forward.png b/source/images/forward.png deleted file mode 100644 index c4da8a9a..00000000 Binary files a/source/images/forward.png and /dev/null differ diff --git a/source/images/scrollbar.png b/source/images/scrollbar.png deleted file mode 100644 index 032074db..00000000 Binary files a/source/images/scrollbar.png and /dev/null differ diff --git a/source/images/scrollbar_arrowdown.png b/source/images/scrollbar_arrowdown.png deleted file mode 100644 index ebd748c6..00000000 Binary files a/source/images/scrollbar_arrowdown.png and /dev/null differ diff --git a/source/images/scrollbar_arrowup.png b/source/images/scrollbar_arrowup.png deleted file mode 100644 index 6cef2fa0..00000000 Binary files a/source/images/scrollbar_arrowup.png and /dev/null differ diff --git a/source/images/scrollbar_box.png b/source/images/scrollbar_box.png deleted file mode 100644 index 9b568f3e..00000000 Binary files a/source/images/scrollbar_box.png and /dev/null differ diff --git a/source/images/usbport.png b/source/images/usbport.png deleted file mode 100644 index 78de06a8..00000000 Binary files a/source/images/usbport.png and /dev/null differ diff --git a/source/input.cpp b/source/input.cpp index 2d91ba91..3bc82bcd 100644 --- a/source/input.cpp +++ b/source/input.cpp @@ -18,7 +18,7 @@ #include "menu.h" #include "video.h" #include "input.h" -#include "libwiigui/gui.h" +#include "GUI/gui.h" #include "sys.h" int rumbleRequest[4] = { 0, 0, 0, 0 }; diff --git a/source/libwiigui/gui_customoptionbrowser.cpp b/source/libwiigui/gui_customoptionbrowser.cpp deleted file mode 100644 index 9ea9509d..00000000 --- a/source/libwiigui/gui_customoptionbrowser.cpp +++ /dev/null @@ -1,531 +0,0 @@ -/**************************************************************************** - * libwiigui - * - * gui_customoptionbrowser.cpp - * - * GUI class definitions - ***************************************************************************/ - -#include "gui.h" -#include "../wpad.h" -#include "../main.h" -#include "../gecko.h" -#include "../settings/CSettings.h" -#include "gui_customoptionbrowser.h" -#include "themes/CTheme.h" -#include "utils/tools.h" -#include "menu.h" - -#include - -#define GAMESELECTSIZE 30 - -/** - * Constructor for the GuiCustomOptionBrowser class. - */ -GuiCustomOptionBrowser::GuiCustomOptionBrowser(int w, int h, OptionList * l, const char * custombg) -{ - width = w; - height = h; - options = l; - selectable = true; - selectedItem = 0; - focus = 1; // allow focus - coL2 = 50; - scrollbaron = false; - listOffset = 0; - - trigA = new GuiTrigger; - trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); - trigHeldA = new GuiTrigger; - trigHeldA->SetHeldTrigger(-1, WPAD_BUTTON_A, PAD_BUTTON_A); - - bgOptions = Resources::GetImageData(custombg); - - bgOptionsImg = new GuiImage(bgOptions); - bgOptionsImg->SetParent(this); - bgOptionsImg->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); - - bgOptionsEntry = Resources::GetImageData("bg_options_entry.png"); - - scrollbar = Resources::GetImageData("scrollbar.png"); - scrollbarImg = new GuiImage(scrollbar); - scrollbarImg->SetParent(this); - scrollbarImg->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); - scrollbarImg->SetPosition(0, 4); - - arrowDown = Resources::GetImageData("scrollbar_arrowdown.png"); - arrowDownImg = new GuiImage(arrowDown); - arrowDownOver = Resources::GetImageData("scrollbar_arrowdown.png"); - arrowDownOverImg = new GuiImage(arrowDownOver); - arrowUp = Resources::GetImageData("scrollbar_arrowup.png"); - arrowUpImg = new GuiImage(arrowUp); - arrowUpOver = Resources::GetImageData("scrollbar_arrowup.png"); - arrowUpOverImg = new GuiImage(arrowUpOver); - scrollbarBox = Resources::GetImageData("scrollbar_box.png"); - scrollbarBoxImg = new GuiImage(scrollbarBox); - scrollbarBoxOver = Resources::GetImageData("scrollbar_box.png"); - scrollbarBoxOverImg = new GuiImage(scrollbarBoxOver); - - arrowUpBtn = new GuiButton(arrowUpImg->GetWidth(), arrowUpImg->GetHeight()); - arrowUpBtn->SetParent(this); - arrowUpBtn->SetImage(arrowUpImg); - arrowUpBtn->SetImageOver(arrowUpOverImg); - arrowUpBtn->SetImageHold(arrowUpOverImg); - arrowUpBtn->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); - arrowUpBtn->SetPosition(width / 2 - 18 + 7, -18); - arrowUpBtn->SetSelectable(false); - arrowUpBtn->SetTrigger(trigA); - arrowUpBtn->SetEffectOnOver(EFFECT_SCALE, 50, 130); - arrowUpBtn->SetSoundClick(btnSoundClick); - - arrowDownBtn = new GuiButton(arrowDownImg->GetWidth(), arrowDownImg->GetHeight()); - arrowDownBtn->SetParent(this); - arrowDownBtn->SetImage(arrowDownImg); - arrowDownBtn->SetImageOver(arrowDownOverImg); - arrowDownBtn->SetImageHold(arrowDownOverImg); - arrowDownBtn->SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM); - arrowDownBtn->SetPosition(width / 2 - 18 + 7, 18); - arrowDownBtn->SetSelectable(false); - arrowDownBtn->SetTrigger(trigA); - arrowDownBtn->SetEffectOnOver(EFFECT_SCALE, 50, 130); - arrowDownBtn->SetSoundClick(btnSoundClick); - - scrollbarBoxBtn = new GuiButton(scrollbarBoxImg->GetWidth(), scrollbarBoxImg->GetHeight()); - scrollbarBoxBtn->SetParent(this); - scrollbarBoxBtn->SetImage(scrollbarBoxImg); - scrollbarBoxBtn->SetImageOver(scrollbarBoxOverImg); - scrollbarBoxBtn->SetImageHold(scrollbarBoxOverImg); - scrollbarBoxBtn->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); - scrollbarBoxBtn->SetSelectable(false); - scrollbarBoxBtn->SetEffectOnOver(EFFECT_SCALE, 50, 120); - scrollbarBoxBtn->SetMinY(0); - scrollbarBoxBtn->SetMaxY(height - 30); - scrollbarBoxBtn->SetHoldable(true); - scrollbarBoxBtn->SetTrigger(trigHeldA); - - for (int i = 0; i < PAGESIZE; i++) - { - optionTxt[i] = new GuiText((wchar_t *) NULL, 20, thColor("r=0 g=0 b=0 a=255 - settings text color")); - optionTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); - optionTxt[i]->SetPosition(24, 0); - optionTxt[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2 + 24), DOTTED); - - optionBg[i] = new GuiImage(bgOptionsEntry); - - optionVal[i] = new GuiText((wchar_t *) NULL, 20, thColor("r=0 g=0 b=0 a=255 - settings text color")); - optionVal[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); - - optionValOver[i] = new GuiText((wchar_t *) NULL, 20, thColor("r=0 g=0 b=0 a=255 - settings text color")); - optionValOver[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); - - optionBtn[i] = new GuiButton(width - 28, GAMESELECTSIZE); - optionBtn[i]->SetParent(this); - optionBtn[i]->SetLabel(optionTxt[i], 0); - optionBtn[i]->SetLabel(optionVal[i], 1); - optionBtn[i]->SetLabelOver(optionValOver[i], 1); - optionBtn[i]->SetImageOver(optionBg[i]); - optionBtn[i]->SetPosition(10, GAMESELECTSIZE * i + 4); - optionBtn[i]->SetRumble(false); - optionBtn[i]->SetTrigger(trigA); - optionBtn[i]->SetSoundClick(btnSoundClick); - } -} - -/** - * Destructor for the GuiCustomOptionBrowser class. - */ -GuiCustomOptionBrowser::~GuiCustomOptionBrowser() -{ - delete arrowUpBtn; - delete arrowDownBtn; - delete scrollbarBoxBtn; - delete scrollbarImg; - delete arrowDownImg; - delete arrowDownOverImg; - delete arrowUpImg; - delete arrowUpOverImg; - delete scrollbarBoxImg; - delete scrollbarBoxOverImg; - delete scrollbar; - delete arrowDown; - delete arrowDownOver; - delete arrowUp; - delete arrowUpOver; - delete scrollbarBox; - delete scrollbarBoxOver; - - delete bgOptionsImg; - delete bgOptions; - delete bgOptionsEntry; - - delete trigA; - delete trigHeldA; - - for (int i = 0; i < PAGESIZE; i++) - { - delete optionTxt[i]; - delete optionVal[i]; - delete optionValOver[i]; - delete optionBg[i]; - delete optionBtn[i]; - } -} - -void GuiCustomOptionBrowser::SetFocus(int f) -{ - focus = f; - - for (int i = 0; i < PAGESIZE; i++) - optionBtn[i]->ResetState(); - - if (f == 1) optionBtn[selectedItem]->SetState(STATE_SELECTED); -} - -void GuiCustomOptionBrowser::ResetState() -{ - if (state != STATE_DISABLED) - { - state = STATE_DEFAULT; - stateChan = -1; - } - - for (int i = 0; i < PAGESIZE; i++) - { - optionBtn[i]->ResetState(); - } -} - -int GuiCustomOptionBrowser::GetClickedOption() -{ - for (int i = 0; i < PAGESIZE; i++) - { - if (optionBtn[i]->GetState() == STATE_CLICKED) - { - optionBtn[i]->SetState(STATE_SELECTED); - return optionIndex[i]; - } - } - - return -1; -} - -int GuiCustomOptionBrowser::GetSelectedOption() -{ - for (int i = 0; i < PAGESIZE; i++) - { - if (optionBtn[i]->GetState() == STATE_SELECTED) - { - return optionIndex[i]; - } - } - return -1; -} - -void GuiCustomOptionBrowser::SetClickable(bool enable) -{ - for (int i = 0; i < PAGESIZE; i++) - { - optionBtn[i]->SetClickable(enable); - } -} - -void GuiCustomOptionBrowser::SetOffset(int optionnumber) -{ - listOffset = optionnumber; - selectedItem = optionnumber; -} - -/**************************************************************************** - * FindMenuItem - * - * Help function to find the next visible menu item on the list - ***************************************************************************/ - -int GuiCustomOptionBrowser::FindMenuItem(int currentItem, int direction) -{ - int nextItem = currentItem + direction; - - if (nextItem < 0 || nextItem >= options->GetLength()) return -1; - - if (strlen(options->GetName(nextItem)) > 0) - return nextItem; - - return FindMenuItem(nextItem, direction); -} - -/** - * Draw the button on screen - */ -void GuiCustomOptionBrowser::Draw() -{ - if (!this->IsVisible()) return; - - bgOptionsImg->Draw(); - - int next = listOffset; - - for (int i = 0; i < PAGESIZE; i++) - { - if (next >= 0) - { - optionBtn[i]->Draw(); - next = this->FindMenuItem(next, 1); - } - else break; - } - - if (PAGESIZE < options->GetLength()) - { - scrollbarImg->Draw(); - arrowUpBtn->Draw(); - arrowDownBtn->Draw(); - scrollbarBoxBtn->Draw(); - } - this->UpdateEffects(); -} - -void GuiCustomOptionBrowser::UpdateListEntries() -{ - LOCK(this); - scrollbaron = options->GetLength() > PAGESIZE; - if (listOffset < 0) listOffset = this->FindMenuItem(-1, 1); - int next = listOffset; - - int maxNameWidth = 0; - for (int i = 0; i < PAGESIZE; i++) - { - if (next >= 0) - { - if (optionBtn[i]->GetState() == STATE_DISABLED) - { - optionBtn[i]->SetVisible(true); - optionBtn[i]->SetState(STATE_DEFAULT); - } - - optionTxt[i]->SetText(options->GetName(next)); - if (maxNameWidth < optionTxt[i]->GetTextWidth()) maxNameWidth = optionTxt[i]->GetTextWidth(); - optionVal[i]->SetText(options->GetValue(next)); - optionValOver[i]->SetText(options->GetValue(next)); - - optionIndex[i] = next; - next = this->FindMenuItem(next, 1); - } - else - { - optionBtn[i]->SetVisible(false); - optionBtn[i]->SetState(STATE_DISABLED); - } - } - - if (coL2 < (24 + maxNameWidth + 16)) - coL2 = 24 + maxNameWidth + 16; - - for (int i = 0; i < PAGESIZE; i++) - { - if (optionBtn[i]->GetState() != STATE_DISABLED) - { - optionVal[i]->SetPosition(coL2, 0); - optionVal[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2 + 24), DOTTED); - - optionValOver[i]->SetPosition(coL2, 0); - optionValOver[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2 + 24), SCROLL_HORIZONTAL); - } - } -} - -void GuiCustomOptionBrowser::Update(GuiTrigger * t) -{ - if (state == STATE_DISABLED || !t) return; - - int next, prev, length = options->GetLength(); - int old_listOffset = listOffset; - - if (scrollbaron) - { - // update the location of the scroll box based on the position in the option list - arrowUpBtn->Update(t); - arrowDownBtn->Update(t); - scrollbarBoxBtn->Update(t); - } - - if(options->IsChanged()) - UpdateListEntries(); - - next = listOffset; - - if (!(t->wpad.btns_h & WPAD_BUTTON_UP || t->wpad.btns_h & WPAD_BUTTON_DOWN || - t->wpad.btns_h & WPAD_CLASSIC_BUTTON_UP || t->wpad.btns_h & WPAD_CLASSIC_BUTTON_DOWN || - t->pad.btns_h & PAD_BUTTON_UP || t->pad.btns_h & PAD_BUTTON_DOWN)) - { - for (int i = 0; i < PAGESIZE; i++) - { - if (next >= 0) next = this->FindMenuItem(next, 1); - - if (focus) - { - if (i != selectedItem && optionBtn[i]->GetState() == STATE_SELECTED) - { - optionBtn[i]->ResetState(); - } - else if (i == selectedItem && optionBtn[i]->GetState() == STATE_DEFAULT) - { - optionBtn[selectedItem]->SetState(STATE_SELECTED); - } - } - - optionBtn[i]->Update(t); - - if (optionBtn[i]->GetState() == STATE_SELECTED) - { - selectedItem = i; - } - } - } - - // pad/joystick navigation - if (!focus) return; // skip navigation - - if (t->Down()) - { - next = this->FindMenuItem(optionIndex[selectedItem], 1); - - if (next >= 0) - { - if (selectedItem == PAGESIZE - 1) - { - // move list down by 1 - listOffset = this->FindMenuItem(listOffset, 1); - } - else if (optionBtn[selectedItem + 1]->IsVisible()) - { - optionBtn[selectedItem]->ResetState(); - optionBtn[selectedItem + 1]->SetState(STATE_SELECTED, t->chan); - selectedItem++; - } - } - } - else if (t->Up()) - { - prev = this->FindMenuItem(optionIndex[selectedItem], -1); - - if (prev >= 0) - { - if (selectedItem == 0) - { - // move list up by 1 - listOffset = prev; - } - else - { - optionBtn[selectedItem]->ResetState(); - optionBtn[selectedItem - 1]->SetState(STATE_SELECTED, t->chan); - selectedItem--; - } - } - } - - if (!scrollbaron) - return; - - if (arrowDownBtn->GetState() == STATE_CLICKED || arrowDownBtn->GetState() == STATE_HELD) - { - next = this->FindMenuItem(optionIndex[selectedItem], 1); - - if (next >= 0) - { - if (selectedItem == PAGESIZE - 1) - { - // move list down by 1 - listOffset = this->FindMenuItem(listOffset, 1); - } - else if (optionBtn[selectedItem + 1]->IsVisible()) - { - optionBtn[selectedItem]->ResetState(); - optionBtn[selectedItem + 1]->SetState(STATE_SELECTED, t->chan); - selectedItem++; - } - scrollbarBoxBtn->Draw(); - usleep(35000); - } - if (!(t->wpad.btns_h & WPAD_BUTTON_A || t->wpad.btns_h & WPAD_CLASSIC_BUTTON_A || - t->pad.btns_h & PAD_BUTTON_A)) - { - arrowDownBtn->ResetState(); - } - } - else if (arrowUpBtn->GetState() == STATE_CLICKED || arrowUpBtn->GetState() == STATE_HELD) - { - prev = this->FindMenuItem(optionIndex[selectedItem], -1); - - if (prev >= 0) - { - if (selectedItem == 0) - { - // move list up by 1 - listOffset = prev; - } - else - { - optionBtn[selectedItem]->ResetState(); - optionBtn[selectedItem - 1]->SetState(STATE_SELECTED, t->chan); - selectedItem--; - } - scrollbarBoxBtn->Draw(); - usleep(35000); - } - if (!(t->wpad.btns_h & WPAD_BUTTON_A || t->wpad.btns_h & WPAD_CLASSIC_BUTTON_A || - t->pad.btns_h & PAD_BUTTON_A)) - { - arrowUpBtn->ResetState(); - } - } - - if (scrollbarBoxBtn->GetState() == STATE_HELD && scrollbarBoxBtn->GetStateChan() == t->chan && t->wpad.ir.valid - && options->GetLength() > PAGESIZE) - { - scrollbarBoxBtn->SetPosition(width / 2 - 18 + 7, 0); - - int position = t->wpad.ir.y - scrollbarBoxBtn->GetHeight()/2 - scrollbarBoxBtn->GetTop(); - position = LIMIT(position, 0, 237); - - listOffset = (int) (((float) position / 237.0f)*length); - selectedItem = (int) (((float) listOffset / (float) length)*(PAGESIZE-1)); - - if (listOffset <= 0) - { - listOffset = 0; - selectedItem = 0; - } - else if (listOffset + PAGESIZE >= length) - { - listOffset = length - PAGESIZE; - } - } - int positionbar = 237 * (listOffset + selectedItem) / length; - - if (positionbar > 216) positionbar = 216; - scrollbarBoxBtn->SetPosition(width / 2 - 18 + 7, positionbar + 8); - - if (t->Right()) - { - if (listOffset < length && length > PAGESIZE) - { - listOffset = listOffset + PAGESIZE; - if (listOffset + PAGESIZE >= length) listOffset = length - PAGESIZE; - } - } - else if (t->Left()) - { - if (listOffset > 0) - { - listOffset = listOffset - PAGESIZE; - if (listOffset < 0) listOffset = 0; - } - } - - if (old_listOffset != listOffset) - UpdateListEntries(); - - if (updateCB) updateCB(this); -} diff --git a/source/libwiigui/gui_filebrowser.cpp b/source/libwiigui/gui_filebrowser.cpp deleted file mode 100644 index d2a5e07c..00000000 --- a/source/libwiigui/gui_filebrowser.cpp +++ /dev/null @@ -1,456 +0,0 @@ -/**************************************************************************** - * libwiigui - * - * Tantric 2009 - * - * gui_filebrowser.cpp - * - * GUI class definitions - ***************************************************************************/ - -#include "gui.h" -#include "prompts/filebrowser.h" -#include "settings/CSettings.h" -#include "themes/CTheme.h" - -/** - * Constructor for the GuiFileBrowser class. - */ -GuiFileBrowser::GuiFileBrowser(int w, int h) -{ - width = w; - height = h; - selectedItem = 0; - selectable = true; - listChanged = true; // trigger an initial list update - triggerdisabled = false; // trigger disable - focus = 0; // allow focus - - trigA = new GuiTrigger; - trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); - - trigHeldA = new GuiTrigger; - trigHeldA->SetHeldTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); - - bgFileSelection = new GuiImageData(Resources::GetFile("bg_browser.png"), Resources::GetFileSize("bg_browser.png")); - bgFileSelectionImg = new GuiImage(bgFileSelection); - bgFileSelectionImg->SetParent(this); - bgFileSelectionImg->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); - - bgFileSelectionEntry = Resources::GetImageData("bg_browser_selection.png"); - - fileFolder = Resources::GetImageData("icon_folder.png"); - - scrollbar = Resources::GetImageData("scrollbar.png"); - scrollbarImg = new GuiImage(scrollbar); - scrollbarImg->SetParent(this); - scrollbarImg->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); - scrollbarImg->SetPosition(0, 2); - scrollbarImg->SetSkew(0, 0, 0, 0, 0, -30, 0, -30); - - arrowDown = Resources::GetImageData("scrollbar_arrowdown.png"); - arrowDownImg = new GuiImage(arrowDown); - arrowUp = Resources::GetImageData("scrollbar_arrowup.png"); - arrowUpImg = new GuiImage(arrowUp); - scrollbarBox = Resources::GetImageData("scrollbar_box.png"); - scrollbarBoxImg = new GuiImage(scrollbarBox); - - arrowUpBtn = new GuiButton(arrowUpImg->GetWidth(), arrowUpImg->GetHeight()); - arrowUpBtn->SetParent(this); - arrowUpBtn->SetImage(arrowUpImg); - arrowUpBtn->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); - arrowUpBtn->SetPosition(12, -12); - arrowUpBtn->SetSelectable(false); - arrowUpBtn->SetClickable(false); - arrowUpBtn->SetHoldable(true); - arrowUpBtn->SetTrigger(trigHeldA); - arrowUpBtn->SetSoundOver(btnSoundOver); - arrowUpBtn->SetSoundClick(btnSoundClick); - - arrowDownBtn = new GuiButton(arrowDownImg->GetWidth(), arrowDownImg->GetHeight()); - arrowDownBtn->SetParent(this); - arrowDownBtn->SetImage(arrowDownImg); - arrowDownBtn->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); - arrowDownBtn->SetPosition(12, 12); - arrowDownBtn->SetSelectable(false); - arrowDownBtn->SetClickable(false); - arrowDownBtn->SetHoldable(true); - arrowDownBtn->SetTrigger(trigHeldA); - arrowDownBtn->SetSoundOver(btnSoundOver); - arrowDownBtn->SetSoundClick(btnSoundClick); - - scrollbarBoxBtn = new GuiButton(scrollbarBoxImg->GetWidth(), scrollbarBoxImg->GetHeight()); - scrollbarBoxBtn->SetParent(this); - scrollbarBoxBtn->SetImage(scrollbarBoxImg); - scrollbarBoxBtn->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); - scrollbarBoxBtn->SetPosition(-10, 0); - scrollbarBoxBtn->SetMinY(-10); - scrollbarBoxBtn->SetMaxY(156); - scrollbarBoxBtn->SetSelectable(false); - scrollbarBoxBtn->SetClickable(false); - scrollbarBoxBtn->SetHoldable(true); - scrollbarBoxBtn->SetTrigger(trigHeldA); - - for (int i = 0; i < FILEBROWSERSIZE; i++) - { - fileListText[i] = new GuiText((char *) NULL, 20, ( GXColor ) - { 0, 0, 0, 0xff}); - fileListText[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); - fileListText[i]->SetPosition(5, 0); - fileListText[i]->SetMaxWidth(bgFileSelectionImg->GetWidth() - (arrowDownImg->GetWidth() + 20), DOTTED); - - fileListTextOver[i] = new GuiText((char *) NULL, 20, ( GXColor ) - { 0, 0, 0, 0xff}); - fileListTextOver[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); - fileListTextOver[i]->SetPosition(5, 0); - fileListTextOver[i]->SetMaxWidth(bgFileSelectionImg->GetWidth() - (arrowDownImg->GetWidth() + 20), - SCROLL_HORIZONTAL); - - fileListBg[i] = new GuiImage(bgFileSelectionEntry); - //fileListArchives[i] = new GuiImage(fileArchives); - //fileListDefault[i] = new GuiImage(fileDefault); - fileListFolder[i] = new GuiImage(fileFolder); - //fileListGFX[i] = new GuiImage(fileGFX); - //fileListPLS[i] = new GuiImage(filePLS); - //fileListSFX[i] = new GuiImage(fileSFX); - //fileListTXT[i] = new GuiImage(fileTXT); - //fileListXML[i] = new GuiImage(fileXML); - fileList[i] = new GuiButton(350, 30); - fileList[i]->SetParent(this); - fileList[i]->SetLabel(fileListText[i]); - fileList[i]->SetLabelOver(fileListTextOver[i]); - fileList[i]->SetImageOver(fileListBg[i]); - fileList[i]->SetPosition(2, 30 * i + 3); - fileList[i]->SetTrigger(trigA); - fileList[i]->SetRumble(false); - fileList[i]->SetSoundClick(btnSoundClick); - } -} - -/** - * Destructor for the GuiFileBrowser class. - */ -GuiFileBrowser::~GuiFileBrowser() -{ - delete arrowUpBtn; - delete arrowDownBtn; - delete scrollbarBoxBtn; - - delete bgFileSelectionImg; - delete scrollbarImg; - delete arrowDownImg; - delete arrowUpImg; - delete scrollbarBoxImg; - - delete bgFileSelection; - delete bgFileSelectionEntry; - //delete fileArchives; - //delete fileDefault; - delete fileFolder; - //delete fileGFX; - //delete filePLS; - //delete fileSFX; - //delete fileTXT; - //delete fileXML; - delete scrollbar; - delete arrowDown; - delete arrowUp; - delete scrollbarBox; - - delete trigHeldA; - delete trigA; - - for (int i = 0; i < FILEBROWSERSIZE; i++) - { - delete fileListText[i]; - delete fileListTextOver[i]; - delete fileList[i]; - delete fileListBg[i]; - //delete fileListArchives[i]; - //delete fileListDefault[i]; - delete fileListFolder[i]; - //delete fileListGFX[i]; - //delete fileListPLS[i]; - //delete fileListSFX[i]; - //delete fileListTXT[i]; - //delete fileListXML[i]; - } -} - -void GuiFileBrowser::SetFocus(int f) -{ - LOCK( this ); - focus = f; - - for (int i = 0; i < FILEBROWSERSIZE; i++) - fileList[i]->ResetState(); - - if (f == 1) fileList[selectedItem]->SetState(STATE_SELECTED); -} - -void GuiFileBrowser::DisableTriggerUpdate(bool set) -{ - LOCK( this ); - triggerdisabled = set; -} - -void GuiFileBrowser::ResetState() -{ - LOCK( this ); - state = STATE_DEFAULT; - stateChan = -1; - selectedItem = 0; - - for (int i = 0; i < FILEBROWSERSIZE; i++) - { - fileList[i]->ResetState(); - } -} - -void GuiFileBrowser::TriggerUpdate() -{ - LOCK( this ); - listChanged = true; -} - -/** - * Draw the button on screen - */ -void GuiFileBrowser::Draw() -{ - LOCK( this ); - if (!this->IsVisible()) return; - - bgFileSelectionImg->Draw(); - - for (int i = 0; i < FILEBROWSERSIZE; i++) - { - fileList[i]->Draw(); - } - - scrollbarImg->Draw(); - arrowUpBtn->Draw(); - arrowDownBtn->Draw(); - scrollbarBoxBtn->Draw(); - - this->UpdateEffects(); -} - -void GuiFileBrowser::Update(GuiTrigger * t) -{ - LOCK( this ); - if (state == STATE_DISABLED || !t || triggerdisabled) return; - - int position = 0; - int positionWiimote = 0; - - arrowUpBtn->Update(t); - arrowDownBtn->Update(t); - scrollbarBoxBtn->Update(t); - - // move the file listing to respond to wiimote cursor movement - if (scrollbarBoxBtn->GetState() == STATE_HELD && scrollbarBoxBtn->GetStateChan() == t->chan && t->wpad.ir.valid - && browser->browserList.size() > FILEBROWSERSIZE) - { - scrollbarBoxBtn->SetPosition(20, -10); - positionWiimote = t->wpad.ir.y - 60 - scrollbarBoxBtn->GetTop(); - - if (positionWiimote < scrollbarBoxBtn->GetMinY()) - positionWiimote = scrollbarBoxBtn->GetMinY(); - else if (positionWiimote > scrollbarBoxBtn->GetMaxY()) positionWiimote = scrollbarBoxBtn->GetMaxY(); - - browser->pageIndex = (positionWiimote * browser->browserList.size()) / 136.0 - selectedItem; - - if (browser->pageIndex <= 0) - { - browser->pageIndex = 0; - } - else if (browser->pageIndex + FILEBROWSERSIZE >= (int) browser->browserList.size()) - { - browser->pageIndex = browser->browserList.size() - FILEBROWSERSIZE; - } - listChanged = true; - focus = false; - - } - - if (arrowDownBtn->GetState() == STATE_HELD && arrowDownBtn->GetStateChan() == t->chan) - { - t->wpad.btns_h |= WPAD_BUTTON_DOWN; - if (!this->IsFocused()) ((GuiWindow *) this->GetParent())->ChangeFocus(this); - - } - else if (arrowUpBtn->GetState() == STATE_HELD && arrowUpBtn->GetStateChan() == t->chan) - { - t->wpad.btns_h |= WPAD_BUTTON_UP; - if (!this->IsFocused()) ((GuiWindow *) this->GetParent())->ChangeFocus(this); - - } - - /* // pad/joystick navigation - if(!focus) - { - goto endNavigation; // skip navigation - listChanged = false; - } - */ - if (t->Right()) - { - if (browser->pageIndex < (int) browser->browserList.size() && browser->browserList.size() > FILEBROWSERSIZE) - { - browser->pageIndex += FILEBROWSERSIZE; - if (browser->pageIndex + FILEBROWSERSIZE >= (int) browser->browserList.size()) browser->pageIndex - = browser->browserList.size() - FILEBROWSERSIZE; - listChanged = true; - } - } - else if (t->Left()) - { - if (browser->pageIndex > 0) - { - browser->pageIndex -= FILEBROWSERSIZE; - if (browser->pageIndex < 0) browser->pageIndex = 0; - listChanged = true; - } - } - else if (t->Down()) - { - if (browser->pageIndex + selectedItem + 1 < (int) browser->browserList.size()) - { - if (selectedItem == FILEBROWSERSIZE - 1) - { - // move list down by 1 - browser->pageIndex++; - listChanged = true; - } - else if (fileList[selectedItem + 1]->IsVisible()) - { - fileList[selectedItem]->ResetState(); - fileList[++selectedItem]->SetState(STATE_SELECTED, t->chan); - } - } - } - else if (t->Up()) - { - if (selectedItem == 0 && browser->pageIndex + selectedItem > 0) - { - // move list up by 1 - browser->pageIndex--; - listChanged = true; - } - else if (selectedItem > 0) - { - fileList[selectedItem]->ResetState(); - fileList[--selectedItem]->SetState(STATE_SELECTED, t->chan); - } - } - - //endNavigation: - - for (int i = 0; i < FILEBROWSERSIZE; i++) - { - if (listChanged) - { - bool haveselected = false; - if (browser->pageIndex + i < (int) browser->browserList.size()) - { - if (fileList[i]->GetState() == STATE_DISABLED) fileList[i]->SetState(STATE_DEFAULT); - - if (fileList[i]->GetState() == STATE_SELECTED) haveselected = true; - - fileList[i]->SetVisible(true); - - fileListText[i]->SetText(browser->browserList[browser->pageIndex + i].displayname); - fileListTextOver[i]->SetText(browser->browserList[browser->pageIndex + i].displayname); - - if (browser->browserList[browser->pageIndex + i].isdir) // directory - { - fileList[i]->SetIcon(fileListFolder[i]); - fileListText[i]->SetPosition(30, 0); - fileListTextOver[i]->SetPosition(30, 0); - } - else - { - /* - char *fileext = strrchr(browserList[browser.pageIndex+i].displayname, '.'); - fileListText[i]->SetPosition(32,0); - fileListTextOver[i]->SetPosition(32,0); - if(fileext) - { - if(!strcasecmp(fileext, ".png") || !strcasecmp(fileext, ".jpg") || !strcasecmp(fileext, ".jpeg") || - !strcasecmp(fileext, ".gif") || !strcasecmp(fileext, ".tga") || !strcasecmp(fileext, ".tpl") || - !strcasecmp(fileext, ".bmp")) { - fileList[i]->SetIcon(fileListGFX[i]); - } else if(!strcasecmp(fileext, ".mp3") || !strcasecmp(fileext, ".ogg") || !strcasecmp(fileext, ".flac") || - !strcasecmp(fileext, ".mpc") || !strcasecmp(fileext, ".m4a") || !strcasecmp(fileext, ".wav")) { - fileList[i]->SetIcon(fileListSFX[i]); - } else if(!strcasecmp(fileext, ".pls") || !strcasecmp(fileext, ".m3u")) { - fileList[i]->SetIcon(fileListPLS[i]); - } else if(!strcasecmp(fileext, ".txt")) { - fileList[i]->SetIcon(fileListTXT[i]); - } else if(!strcasecmp(fileext, ".xml")) { - fileList[i]->SetIcon(fileListXML[i]); - } else if(!strcasecmp(fileext, ".rar") || !strcasecmp(fileext, ".zip") || - !strcasecmp(fileext, ".gz") || !strcasecmp(fileext, ".7z")) { - fileList[i]->SetIcon(fileListArchives[i]); - } else { - fileList[i]->SetIcon(fileListDefault[i]); - } - } else { - fileList[i]->SetIcon(fileListDefault[i]); - } - */ - fileList[i]->SetIcon(NULL); - fileListText[i]->SetPosition(10, 0); - fileListTextOver[i]->SetPosition(10, 0); - } - } - else - { - fileList[i]->SetVisible(false); - fileList[i]->SetState(STATE_DISABLED); - } - if (!haveselected && browser->pageIndex < (int) browser->browserList.size()) fileList[i]->SetState( - STATE_SELECTED, t->chan); - - } - - if (i != selectedItem && fileList[i]->GetState() == STATE_SELECTED) - fileList[i]->ResetState(); - else if (focus && i == selectedItem && fileList[i]->GetState() == STATE_DEFAULT) fileList[selectedItem]->SetState( - STATE_SELECTED, t->chan); - - int currChan = t->chan; - - if (t->wpad.ir.valid && !fileList[i]->IsInside(t->wpad.ir.x, t->wpad.ir.y)) t->chan = -1; - - fileList[i]->Update(t); - t->chan = currChan; - - if (fileList[i]->GetState() == STATE_SELECTED) - { - selectedItem = i; - } - } - - // update the location of the scroll box based on the position in the file list - if (positionWiimote > 0) - { - position = positionWiimote; // follow wiimote cursor - } - else - { - position = 136 * (browser->pageIndex + FILEBROWSERSIZE / 2.0) / (browser->browserList.size() * 1.0); - - if (browser->pageIndex / (FILEBROWSERSIZE / 2.0) < 1) - position = -10; - else if ((browser->pageIndex + FILEBROWSERSIZE) / (FILEBROWSERSIZE * 1.0) >= (browser->browserList.size()) - / (FILEBROWSERSIZE * 1.0)) position = 156; - } - - scrollbarBoxBtn->SetPosition(12, position + 26); - - listChanged = false; - - if (updateCB) updateCB(this); -} diff --git a/source/libwiigui/gui_gamebrowser.cpp b/source/libwiigui/gui_gamebrowser.cpp deleted file mode 100644 index bd4f0b1d..00000000 --- a/source/libwiigui/gui_gamebrowser.cpp +++ /dev/null @@ -1,623 +0,0 @@ -/**************************************************************************** - * libwiigui - * - * gui_gamebrowser.cpp - * - * GUI class definitions - ***************************************************************************/ - -#include "gui.h" -#include "../wpad.h" - -#include -#include "gui_gamebrowser.h" -#include "../settings/CSettings.h" -#include "../main.h" -#include "settings/newtitles.h" -#include "settings/GameTitles.h" -#include "usbloader/GameList.h" -#include "themes/CTheme.h" -#include "menu.h" - -#include -#include - -#define GAMESELECTSIZE 30 -// scrolldelay affects how fast the list scrolls -// when the arrows are clicked -static const u32 DEFAULT_SCROLL_DELAY = 4; - -/** - * Constructor for the GuiGameBrowser class. - */ -GuiGameBrowser::GuiGameBrowser(int w, int h, int selectedGame) -{ - width = w; - height = h; - pagesize = thInt("9 - game list browser page size"); - scrollbaron = (gameList.size() > pagesize) ? 1 : 0; - selectable = true; - listOffset = selectedGame - (selectedGame % pagesize); - selectedItem = selectedGame - listOffset; - focus = 1; // allow focus - - trigA = new GuiTrigger; - trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); - trigHeldA = new GuiTrigger; - trigHeldA->SetHeldTrigger(-1, WPAD_BUTTON_A, PAD_BUTTON_A); - - bgGames = Resources::GetImageData("bg_options.png"); - newGames = Resources::GetImageData("new.png"); - - bgGameImg = new GuiImage(bgGames); - bgGameImg->SetParent(this); - bgGameImg->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); - - maxTextWidth = bgGameImg->GetWidth() - 24 - 4; - - bgGamesEntry = Resources::GetImageData("bg_options_entry.png"); - - scrollbar = Resources::GetImageData("scrollbar.png"); - scrollbarImg = new GuiImage(scrollbar); - scrollbarImg->SetParent(this); - scrollbarImg->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); - scrollbarImg->SetPosition(0, 4); - - maxTextWidth -= scrollbarImg->GetWidth() + 4; - - arrowDown = Resources::GetImageData("scrollbar_arrowdown.png"); - arrowDownImg = new GuiImage(arrowDown); - arrowDownOver = Resources::GetImageData("scrollbar_arrowdown.png"); - arrowDownOverImg = new GuiImage(arrowDownOver); - arrowUp = Resources::GetImageData("scrollbar_arrowup.png"); - arrowUpImg = new GuiImage(arrowUp); - arrowUpOver = Resources::GetImageData("scrollbar_arrowup.png"); - arrowUpOverImg = new GuiImage(arrowUpOver); - scrollbarBox = Resources::GetImageData("scrollbar_box.png"); - scrollbarBoxImg = new GuiImage(scrollbarBox); - scrollbarBoxOver = Resources::GetImageData("scrollbar_box.png"); - scrollbarBoxOverImg = new GuiImage(scrollbarBoxOver); - - arrowUpBtn = new GuiButton(arrowUpImg->GetWidth(), arrowUpImg->GetHeight()); - arrowUpBtn->SetParent(this); - arrowUpBtn->SetImage(arrowUpImg); - arrowUpBtn->SetImageOver(arrowUpOverImg); - arrowUpBtn->SetImageHold(arrowUpOverImg); - arrowUpBtn->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); - arrowUpBtn->SetPosition(width / 2 - 18 + 7, -18); - arrowUpBtn->SetSelectable(false); - arrowUpBtn->SetTrigger(trigA); - arrowUpBtn->SetEffectOnOver(EFFECT_SCALE, 50, 130); - arrowUpBtn->SetSoundClick(btnSoundClick); - - arrowDownBtn = new GuiButton(arrowDownImg->GetWidth(), arrowDownImg->GetHeight()); - arrowDownBtn->SetParent(this); - arrowDownBtn->SetImage(arrowDownImg); - arrowDownBtn->SetImageOver(arrowDownOverImg); - arrowDownBtn->SetImageHold(arrowDownOverImg); - arrowDownBtn->SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM); - arrowDownBtn->SetPosition(width / 2 - 18 + 7, 18); - arrowDownBtn->SetSelectable(false); - arrowDownBtn->SetTrigger(trigA); - arrowDownBtn->SetEffectOnOver(EFFECT_SCALE, 50, 130); - arrowDownBtn->SetSoundClick(btnSoundClick); - - scrollbarBoxBtn = new GuiButton(scrollbarBoxImg->GetWidth(), scrollbarBoxImg->GetHeight()); - scrollbarBoxBtn->SetParent(this); - scrollbarBoxBtn->SetImage(scrollbarBoxImg); - scrollbarBoxBtn->SetImageOver(scrollbarBoxOverImg); - scrollbarBoxBtn->SetImageHold(scrollbarBoxOverImg); - scrollbarBoxBtn->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); - scrollbarBoxBtn->SetSelectable(false); - scrollbarBoxBtn->SetEffectOnOver(EFFECT_SCALE, 50, 120); - scrollbarBoxBtn->SetMinY(0); - scrollbarBoxBtn->SetMaxY(height - 30); - scrollbarBoxBtn->SetHoldable(true); - scrollbarBoxBtn->SetTrigger(trigHeldA); - - gameIndex = new int[pagesize]; - game = new GuiButton *[pagesize]; - gameTxt = new GuiText *[pagesize]; - gameTxtOver = new GuiText *[pagesize]; - gameBg = new GuiImage *[pagesize]; - newImg = new GuiImage *[pagesize]; - - for (int i = 0; i < pagesize; i++) - { - gameTxt[i] = new GuiText(GameTitles.GetTitle(gameList[i]), 20, thColor("r=0 g=0 b=0 a=255 - game browser list text color")); - gameTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); - gameTxt[i]->SetPosition(24, 0); - gameTxt[i]->SetMaxWidth(maxTextWidth, DOTTED); - - gameTxtOver[i] = new GuiText(GameTitles.GetTitle(gameList[i]), 20, thColor("r=0 g=0 b=0 a=255 - game browser list text color over")); - gameTxtOver[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); - gameTxtOver[i]->SetPosition(24, 0); - gameTxtOver[i]->SetMaxWidth(maxTextWidth, SCROLL_HORIZONTAL); - - gameBg[i] = new GuiImage(bgGamesEntry); - - newImg[i] = new GuiImage(newGames); - newImg[i]->SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE); - newImg[i]->SetVisible(false); - - game[i] = new GuiButton(width - 28, GAMESELECTSIZE); - game[i]->SetParent(this); - game[i]->SetLabel(gameTxt[i]); - game[i]->SetLabelOver(gameTxtOver[i]); - game[i]->SetIcon(newImg[i]); - game[i]->SetImageOver(gameBg[i]); - game[i]->SetPosition(5, GAMESELECTSIZE * i + 4); - game[i]->SetRumble(false); - game[i]->SetTrigger(trigA); - game[i]->SetSoundClick(btnSoundClick); - - gameIndex[i] = i; - } - UpdateListEntries(); -} - -/** - * Destructor for the GuiGameBrowser class. - */ -GuiGameBrowser::~GuiGameBrowser() -{ - delete arrowUpBtn; - delete arrowDownBtn; - delete scrollbarBoxBtn; - delete scrollbarImg; - delete arrowDownImg; - delete arrowDownOverImg; - delete arrowUpImg; - delete arrowUpOverImg; - delete scrollbarBoxImg; - delete scrollbarBoxOverImg; - delete scrollbar; - delete arrowDown; - delete arrowDownOver; - delete arrowUp; - delete arrowUpOver; - delete scrollbarBox; - delete scrollbarBoxOver; - delete bgGameImg; - delete bgGames; - delete bgGamesEntry; - delete newGames; - - delete trigA; - delete trigHeldA; - - for (int i = 0; i < pagesize; i++) - { - delete gameTxt[i]; - delete gameTxtOver[i]; - delete gameBg[i]; - delete game[i]; - delete newImg[i]; - } - delete[] gameIndex; - delete[] game; - delete[] gameTxt; - delete[] gameTxtOver; - delete[] gameBg; -} - -void GuiGameBrowser::SetFocus(int f) -{ - LOCK( this ); - if (!gameList.size()) return; - - focus = f; - - for (int i = 0; i < pagesize; i++) - game[i]->ResetState(); - - if (f == 1) game[selectedItem]->SetState(STATE_SELECTED); -} - -void GuiGameBrowser::ResetState() -{ - LOCK( this ); - if (state != STATE_DISABLED) - { - state = STATE_DEFAULT; - stateChan = -1; - } - - for (int i = 0; i < pagesize; i++) - { - game[i]->ResetState(); - } -} - -int GuiGameBrowser::GetOffset() -{ - return listOffset; -} -int GuiGameBrowser::GetClickedOption() -{ - int found = -1; - for (int i = 0; i < pagesize; i++) - { - if (game[i]->GetState() == STATE_CLICKED) - { - game[i]->SetState(STATE_SELECTED); - found = gameIndex[i]; - break; - } - } - return found; -} - -/**************************************************************************** - * FindMenuItem - * - * Help function to find the next visible menu item on the list - ***************************************************************************/ - -int GuiGameBrowser::FindMenuItem(int currentItem, int direction) -{ - int nextItem = currentItem + direction; - - if (nextItem < 0 || nextItem >= gameList.size()) return -1; - - if (strlen(GameTitles.GetTitle(gameList[nextItem])) > 0) - return nextItem; - - return FindMenuItem(nextItem, direction); -} - -/** - * Draw the button on screen - */ -void GuiGameBrowser::Draw() -{ - LOCK( this ); - if (!this->IsVisible() || !gameList.size()) return; - - bgGameImg->Draw(); - - int next = listOffset; - - for (int i = 0; i < pagesize; i++) - { - if (next >= 0) - { - game[i]->Draw(); - next = this->FindMenuItem(next, 1); - } - else break; - } - - if (scrollbaron == 1) - { - scrollbarImg->Draw(); - arrowUpBtn->Draw(); - arrowDownBtn->Draw(); - scrollbarBoxBtn->Draw(); - } - this->UpdateEffects(); -} - -void GuiGameBrowser::UpdateListEntries() -{ - int next = listOffset; - for (int i = 0; i < pagesize; i++) - { - if (next >= 0) - { - if (game[i]->GetState() == STATE_DISABLED) - { - game[i]->SetVisible(true); - game[i]->SetState(STATE_DEFAULT); - } - gameTxt[i]->SetText(GameTitles.GetTitle(gameList[next])); - gameTxt[i]->SetPosition(24, 0); - gameTxtOver[i]->SetText(GameTitles.GetTitle(gameList[next])); - gameTxtOver[i]->SetPosition(24, 0); - - if (Settings.marknewtitles) - { - bool isNew = NewTitles::Instance()->IsNew(gameList[next]->id); - if (isNew) - { - gameTxt[i]->SetMaxWidth(maxTextWidth - (newGames->GetWidth() + 1), DOTTED); - gameTxtOver[i]->SetMaxWidth(maxTextWidth - (newGames->GetWidth() + 1), SCROLL_HORIZONTAL); - } - else - { - gameTxt[i]->SetMaxWidth(maxTextWidth, DOTTED); - gameTxtOver[i]->SetMaxWidth(maxTextWidth, SCROLL_HORIZONTAL); - } - newImg[i]->SetVisible(isNew); - } - - gameIndex[i] = next; - next = this->FindMenuItem(next, 1); - } - else - { - game[i]->SetVisible(false); - game[i]->SetState(STATE_DISABLED); - } - } -} - -void GuiGameBrowser::Update(GuiTrigger * t) -{ - LOCK( this ); - if (state == STATE_DISABLED || !t || !gameList.size()) return; - - static int pressedChan = -1; - int next, prev; - int old_listOffset = listOffset; - static int position2; - static u32 scrolldelay = 0; - - if(t->wpad.btns_d) - { - pressedChan = t->chan; - } - - if (scrollbaron == 1) - { - // update the location of the scroll box based on the position in the option list - arrowUpBtn->Update(t); - arrowDownBtn->Update(t); - scrollbarBoxBtn->Update(t); - } - - next = listOffset; - - if(pressedChan == -1 || (pressedChan == t->chan && !(t->wpad.btns_h & WPAD_BUTTON_UP) && - !(t->wpad.btns_h & WPAD_BUTTON_DOWN) && !(t->wpad.btns_h & WPAD_BUTTON_B))) - { - for (int i = 0; i < pagesize; i++) - { - if (next >= 0) next = this->FindMenuItem(next, 1); - - if (focus) - { - if (i != selectedItem && game[i]->GetState() == STATE_SELECTED) - game[i]->ResetState(); - else if (i == selectedItem && game[i]->GetState() == STATE_DEFAULT) - game[selectedItem]->SetState(STATE_SELECTED, -1); - } - - game[i]->Update(t); - - if (game[i]->GetState() == STATE_SELECTED) - { - selectedItem = i; - } - } - } - - // pad and joystick navigation - if (!focus || !gameList.size()) return; // skip navigation - - if (scrollbaron == 1) - { - if (t->Down() || arrowDownBtn->GetState() == STATE_CLICKED || arrowDownBtn->GetState() == STATE_HELD) //down - { - if(scrolldelay > 0) - --scrolldelay; - else - { - if(arrowDownBtn->GetState() == STATE_CLICKED || arrowDownBtn->GetState() == STATE_HELD) - scrolldelay = DEFAULT_SCROLL_DELAY; - next = this->FindMenuItem(gameIndex[selectedItem], 1); - - if (next >= 0) - { - if (selectedItem == pagesize - 1) - { - // move list down by 1 - listOffset = this->FindMenuItem(listOffset, 1); - } - else if (game[selectedItem + 1]->IsVisible()) - { - game[selectedItem]->ResetState(); - game[selectedItem + 1]->SetState(STATE_SELECTED, t->chan); - selectedItem++; - } - } - } - if (pressedChan == -1 || (pressedChan == t->chan && !(t->wpad.btns_d & WPAD_BUTTON_A) && !(t->wpad.btns_h & WPAD_BUTTON_A))) - arrowDownBtn->ResetState(); - } - else if (t->Up() || arrowUpBtn->GetState() == STATE_CLICKED || arrowUpBtn->GetState() == STATE_HELD) //up - { - if(scrolldelay > 0) - --scrolldelay; - else - { - if(arrowUpBtn->GetState() == STATE_CLICKED || arrowUpBtn->GetState() == STATE_HELD) - scrolldelay = DEFAULT_SCROLL_DELAY; - prev = this->FindMenuItem(gameIndex[selectedItem], -1); - - if (prev >= 0) - { - if (selectedItem == 0) - { - // move list up by 1 - listOffset = prev; - } - else - { - game[selectedItem]->ResetState(); - game[selectedItem - 1]->SetState(STATE_SELECTED, t->chan); - selectedItem--; - } - } - } - if (pressedChan == -1 || (pressedChan == t->chan && !(t->wpad.btns_d & WPAD_BUTTON_A) && !(t->wpad.btns_h & WPAD_BUTTON_A))) - arrowUpBtn->ResetState(); - } - int position1 = t->wpad.ir.y; - - if (position2 == 0 && t->wpad.ir.valid) - { - position2 = position1; - } - - if (pressedChan == t->chan && (t->wpad.btns_h & WPAD_BUTTON_B) && t->wpad.ir.valid) - { - if(scrolldelay > 0) - --scrolldelay; - else - { - scrolldelay = DEFAULT_SCROLL_DELAY-2; - scrollbarBoxBtn->ScrollIsOn(1); - if (position2 > position1) - { - prev = this->FindMenuItem(gameIndex[selectedItem], -1); - - if (prev >= 0) - { - if (selectedItem == 0) - { - // move list up by 1 - listOffset = prev; - } - else - { - game[selectedItem]->ResetState(); - game[selectedItem - 1]->SetState(STATE_SELECTED, t->chan); - selectedItem--; - } - } - } - else if (position2 < position1) - { - next = this->FindMenuItem(gameIndex[selectedItem], 1); - if (next >= 0) - { - if (selectedItem == pagesize - 1) - { - // move list down by 1 - listOffset = this->FindMenuItem(listOffset, 1); - } - else if (game[selectedItem + 1]->IsVisible()) - { - game[selectedItem]->ResetState(); - game[selectedItem + 1]->SetState(STATE_SELECTED, t->chan); - selectedItem++; - } - } - } - } - } - else if (pressedChan == -1 || (pressedChan == t->chan && !(t->wpad.btns_h & WPAD_BUTTON_B))) - { - scrollbarBoxBtn->ScrollIsOn(0); - position2 = 0; - } - - if (scrollbarBoxBtn->GetState() == STATE_HELD && scrollbarBoxBtn->GetStateChan() == t->chan && t->wpad.ir.valid - && gameList.size() > pagesize) - { - // allow dragging of scrollbar box - scrollbarBoxBtn->SetPosition(width / 2 - 18 + 7, 0); - int position = t->wpad.ir.y - 32 - scrollbarBoxBtn->GetTop(); - - listOffset = (position * gameList.size()) / (25.2 * pagesize) - selectedItem; - - if (listOffset <= 0) - { - listOffset = 0; - selectedItem = 0; - } - else if (listOffset + pagesize >= gameList.size()) - { - listOffset = gameList.size() - pagesize; - selectedItem = pagesize - 1; - } - - } - int positionbar = (25.2 * pagesize) * (listOffset + selectedItem) / gameList.size(); - - if (positionbar > (24 * pagesize)) positionbar = (24 * pagesize); - scrollbarBoxBtn->SetPosition(width / 2 - 18 + 7, positionbar + 8); - - if (t->Right()) //skip pagesize # of games if right is pressed - { - if (listOffset < gameList.size() && gameList.size() > pagesize) - { - listOffset = listOffset + pagesize; - if (listOffset + pagesize >= gameList.size()) listOffset = gameList.size() - pagesize; - } - } - else if (t->Left()) - { - if (listOffset > 0) - { - listOffset = listOffset - pagesize; - if (listOffset < 0) listOffset = 0; - } - } - - } - else - { - if (t->Down()) //if there isn't a scrollbar and down is pressed - { - next = this->FindMenuItem(gameIndex[selectedItem], 1); - - if (next >= 0) - { - if (selectedItem == pagesize - 1) - { - // move list down by 1 - listOffset = this->FindMenuItem(listOffset, 1); - } - else if (game[selectedItem + 1]->IsVisible()) - { - game[selectedItem]->ResetState(); - game[selectedItem + 1]->SetState(STATE_SELECTED, t->chan); - selectedItem++; - } - } - } - else if (t->Up()) //up - { - prev = this->FindMenuItem(gameIndex[selectedItem], -1); - - if (prev >= 0) - { - if (selectedItem == 0) - { - // move list up by 1 - listOffset = prev; - } - else - { - game[selectedItem]->ResetState(); - game[selectedItem - 1]->SetState(STATE_SELECTED, t->chan); - selectedItem--; - } - } - } - } - - if(pressedChan == t->chan && !t->wpad.btns_d && !t->wpad.btns_h) - { - pressedChan = -1; - } - - if (old_listOffset != listOffset) UpdateListEntries(); - - if (updateCB) updateCB(this); -} - -void GuiGameBrowser::Reload() -{ - LOCK( this ); - scrollbaron = (gameList.size() > pagesize) ? 1 : 0; - selectedItem = 0; - listOffset = 0; - focus = 1; - UpdateListEntries(); - - for (int i = 0; i < pagesize; i++) - game[i]->ResetState(); -} diff --git a/source/libwiigui/gui_optionbrowser.cpp b/source/libwiigui/gui_optionbrowser.cpp deleted file mode 100644 index 32086efb..00000000 --- a/source/libwiigui/gui_optionbrowser.cpp +++ /dev/null @@ -1,666 +0,0 @@ -/**************************************************************************** - * libwiigui - * - * Tantric 2009 - * - * gui_optionbrowser.cpp - * - * GUI class definitions - ***************************************************************************/ - -#include "gui.h" -#include "../wpad.h" -#include "settings/CSettings.h" -#include "themes/CTheme.h" - -#include - -#define GAMESELECTSIZE 30 - -static int scrollbaron = 0, startat = 0, loaded = 0; -/** - * Constructor for the GuiOptionBrowser class. - */ -GuiOptionBrowser::GuiOptionBrowser(int w, int h, OptionList * l, const char *imagebg, int scrollon) -{ - width = w; - height = h; - options = l; - scrollbaron = scrollon; - selectable = true; - listOffset = this->FindMenuItem(-1, 1); - listChanged = true; // trigger an initial list update - selectedItem = 0; - focus = 1; // allow focus - - trigA = new GuiTrigger; - trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); - trigHeldA = new GuiTrigger; - trigHeldA->SetHeldTrigger(-1, WPAD_BUTTON_A, PAD_BUTTON_A); - - bgOptions = Resources::GetImageData(imagebg); - bgOptionsImg = new GuiImage(bgOptions); - bgOptionsImg->SetParent(this); - bgOptionsImg->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); - - bgOptionsEntry = Resources::GetImageData("bg_options_entry.png"); - if (scrollbaron == 1) - { - scrollbar = Resources::GetImageData("scrollbar.png"); - scrollbarImg = new GuiImage(scrollbar); - scrollbarImg->SetParent(this); - scrollbarImg->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); - scrollbarImg->SetPosition(0, 4); - - arrowDown = Resources::GetImageData("scrollbar_arrowdown.png"); - arrowDownImg = new GuiImage(arrowDown); - arrowDownOver = Resources::GetImageData("scrollbar_arrowdown.png"); - arrowDownOverImg = new GuiImage(arrowDownOver); - arrowUp = Resources::GetImageData("scrollbar_arrowup.png"); - arrowUpImg = new GuiImage(arrowUp); - arrowUpOver = Resources::GetImageData("scrollbar_arrowup.png"); - arrowUpOverImg = new GuiImage(arrowUpOver); - scrollbarBox = Resources::GetImageData("scrollbar_box.png"); - scrollbarBoxImg = new GuiImage(scrollbarBox); - scrollbarBoxOver = Resources::GetImageData("scrollbar_box.png"); - scrollbarBoxOverImg = new GuiImage(scrollbarBoxOver); - - arrowUpBtn = new GuiButton(arrowUpImg->GetWidth(), arrowUpImg->GetHeight()); - arrowUpBtn->SetParent(this); - arrowUpBtn->SetImage(arrowUpImg); - arrowUpBtn->SetImageOver(arrowUpOverImg); - arrowUpBtn->SetImageHold(arrowUpOverImg); - arrowUpBtn->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); - arrowUpBtn->SetPosition(width / 2 - 18 + 7, -18); - arrowUpBtn->SetSelectable(false); - arrowUpBtn->SetTrigger(trigA); - arrowUpBtn->SetEffectOnOver(EFFECT_SCALE, 50, 130); - arrowUpBtn->SetSoundClick(btnSoundClick); - - arrowDownBtn = new GuiButton(arrowDownImg->GetWidth(), arrowDownImg->GetHeight()); - arrowDownBtn->SetParent(this); - arrowDownBtn->SetImage(arrowDownImg); - arrowDownBtn->SetImageOver(arrowDownOverImg); - arrowDownBtn->SetImageHold(arrowDownOverImg); - arrowDownBtn->SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM); - arrowDownBtn->SetPosition(width / 2 - 18 + 7, 18); - arrowDownBtn->SetSelectable(false); - arrowDownBtn->SetTrigger(trigA); - arrowDownBtn->SetEffectOnOver(EFFECT_SCALE, 50, 130); - arrowDownBtn->SetSoundClick(btnSoundClick); - - scrollbarBoxBtn = new GuiButton(scrollbarBoxImg->GetWidth(), scrollbarBoxImg->GetHeight()); - scrollbarBoxBtn->SetParent(this); - scrollbarBoxBtn->SetImage(scrollbarBoxImg); - scrollbarBoxBtn->SetImageOver(scrollbarBoxOverImg); - scrollbarBoxBtn->SetImageHold(scrollbarBoxOverImg); - scrollbarBoxBtn->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); - scrollbarBoxBtn->SetSelectable(false); - scrollbarBoxBtn->SetEffectOnOver(EFFECT_SCALE, 50, 120); - scrollbarBoxBtn->SetMinY(0); - scrollbarBoxBtn->SetMaxY(height); - scrollbarBoxBtn->SetHoldable(true); - scrollbarBoxBtn->SetTrigger(trigHeldA); - } - - // optionBg = new GuiImage(bgOptionsEntry); - for (int i = 0; i < PAGESIZE; i++) - { - optionTxt[i] = new GuiText((char *) NULL, 20, ( GXColor ) - { 0, 0, 0, 0xff}); - optionTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); - optionTxt[i]->SetPosition(24, 0); - - optionBg[i] = new GuiImage(bgOptionsEntry); - - optionVal[i] = new GuiText((char *) NULL, 20, ( GXColor ) - { 0, 0, 0, 0xff}); - optionVal[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); - optionVal[i]->SetPosition(250, 0); - - optionBtn[i] = new GuiButton(width - 28, GAMESELECTSIZE); - optionBtn[i]->SetParent(this); - optionBtn[i]->SetLabel(optionTxt[i], 0); - optionBtn[i]->SetLabel(optionVal[i], 1); - optionBtn[i]->SetImageOver(optionBg[i]); - optionBtn[i]->SetPosition(5, GAMESELECTSIZE * i + 4); - optionBtn[i]->SetRumble(false); - optionBtn[i]->SetTrigger(trigA); - optionBtn[i]->SetSoundClick(btnSoundClick); - } -} - -/** - * Constructor for the GuiOptionBrowser class. - */ -GuiOptionBrowser::GuiOptionBrowser(int w, int h, OptionList * l, const char *imagebg, int scrollon, int start) -{ - width = w; - height = h; - options = l; - startat = start; - loaded = 0; - scrollbaron = scrollon; - selectable = true; - listOffset = this->FindMenuItem(-1, 1); - selectedItem = 0; - focus = 1; // allow focus - - trigA = new GuiTrigger; - trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); - trigHeldA = new GuiTrigger; - trigHeldA->SetHeldTrigger(-1, WPAD_BUTTON_A, PAD_BUTTON_A); - - bgOptions = Resources::GetImageData(imagebg); - - bgOptionsImg = new GuiImage(bgOptions); - bgOptionsImg->SetParent(this); - bgOptionsImg->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); - - bgOptionsEntry = Resources::GetImageData("bg_options_entry.png"); - if (scrollbaron == 1) - { - scrollbar = Resources::GetImageData("scrollbar.png"); - scrollbarImg = new GuiImage(scrollbar); - scrollbarImg->SetParent(this); - scrollbarImg->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); - scrollbarImg->SetPosition(0, 4); - - arrowDown = Resources::GetImageData("scrollbar_arrowdown.png"); - arrowDownImg = new GuiImage(arrowDown); - arrowDownOver = Resources::GetImageData("scrollbar_arrowdown.png"); - arrowDownOverImg = new GuiImage(arrowDownOver); - arrowUp = Resources::GetImageData("scrollbar_arrowup.png"); - arrowUpImg = new GuiImage(arrowUp); - arrowUpOver = Resources::GetImageData("scrollbar_arrowup.png"); - arrowUpOverImg = new GuiImage(arrowUpOver); - scrollbarBox = Resources::GetImageData("scrollbar_box.png"); - scrollbarBoxImg = new GuiImage(scrollbarBox); - scrollbarBoxOver = Resources::GetImageData("scrollbar_box.png"); - scrollbarBoxOverImg = new GuiImage(scrollbarBoxOver); - - arrowUpBtn = new GuiButton(arrowUpImg->GetWidth(), arrowUpImg->GetHeight()); - arrowUpBtn->SetParent(this); - arrowUpBtn->SetImage(arrowUpImg); - arrowUpBtn->SetImageOver(arrowUpOverImg); - arrowUpBtn->SetImageHold(arrowUpOverImg); - arrowUpBtn->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); - arrowUpBtn->SetPosition(width / 2 - 18 + 7, -18); - arrowUpBtn->SetSelectable(false); - arrowUpBtn->SetTrigger(trigA); - arrowUpBtn->SetEffectOnOver(EFFECT_SCALE, 50, 130); - arrowUpBtn->SetSoundClick(btnSoundClick); - - arrowDownBtn = new GuiButton(arrowDownImg->GetWidth(), arrowDownImg->GetHeight()); - arrowDownBtn->SetParent(this); - arrowDownBtn->SetImage(arrowDownImg); - arrowDownBtn->SetImageOver(arrowDownOverImg); - arrowDownBtn->SetImageHold(arrowDownOverImg); - arrowDownBtn->SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM); - arrowDownBtn->SetPosition(width / 2 - 18 + 7, 18); - arrowDownBtn->SetSelectable(false); - arrowDownBtn->SetTrigger(trigA); - arrowDownBtn->SetEffectOnOver(EFFECT_SCALE, 50, 130); - arrowDownBtn->SetSoundClick(btnSoundClick); - - scrollbarBoxBtn = new GuiButton(scrollbarBoxImg->GetWidth(), scrollbarBoxImg->GetHeight()); - scrollbarBoxBtn->SetParent(this); - scrollbarBoxBtn->SetImage(scrollbarBoxImg); - scrollbarBoxBtn->SetImageOver(scrollbarBoxOverImg); - scrollbarBoxBtn->SetImageHold(scrollbarBoxOverImg); - scrollbarBoxBtn->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); - scrollbarBoxBtn->SetSelectable(false); - scrollbarBoxBtn->SetEffectOnOver(EFFECT_SCALE, 50, 120); - scrollbarBoxBtn->SetMinY(0); - scrollbarBoxBtn->SetMaxY(height - 30); - scrollbarBoxBtn->SetHoldable(true); - scrollbarBoxBtn->SetTrigger(trigHeldA); - } - - // optionBg = new GuiImage(bgOptionsEntry); - for (int i = 0; i < PAGESIZE; i++) - { - optionTxt[i] = new GuiText(options->GetName(i), 20, ( GXColor ) {0, 0, 0, 0xff}); - optionTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); - optionTxt[i]->SetPosition(24, 0); - - optionBg[i] = new GuiImage(bgOptionsEntry); - - optionVal[i] = new GuiText((char *) NULL, 20, ( GXColor ) - { 0, 0, 0, 0xff}); - optionVal[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); - optionVal[i]->SetPosition(250, 0); - - optionBtn[i] = new GuiButton(width - 28, GAMESELECTSIZE); - optionBtn[i]->SetParent(this); - optionBtn[i]->SetLabel(optionTxt[i], 0); - optionBtn[i]->SetLabel(optionVal[i], 1); - optionBtn[i]->SetImageOver(optionBg[i]); - optionBtn[i]->SetPosition(5, GAMESELECTSIZE * i + 4); - optionBtn[i]->SetTrigger(trigA); - optionBtn[i]->SetSoundClick(btnSoundClick); - } -} - -/** - * Destructor for the GuiOptionBrowser class. - */ -GuiOptionBrowser::~GuiOptionBrowser() -{ - if (scrollbaron == 1) - { - delete arrowUpBtn; - delete arrowDownBtn; - delete scrollbarBoxBtn; - delete scrollbarImg; - delete arrowDownImg; - delete arrowDownOverImg; - delete arrowUpImg; - delete arrowUpOverImg; - delete scrollbarBoxImg; - delete scrollbarBoxOverImg; - delete scrollbar; - delete arrowDown; - delete arrowDownOver; - delete arrowUp; - delete arrowUpOver; - delete scrollbarBox; - delete scrollbarBoxOver; - } - delete bgOptionsImg; - delete bgOptions; - delete bgOptionsEntry; - loaded = 0; - - delete trigA; - - // delete optionBg; - for (int i = 0; i < PAGESIZE; i++) - { - delete optionTxt[i]; - delete optionVal[i]; - delete optionBg[i]; - delete optionBtn[i]; - } -} - -void GuiOptionBrowser::SetCol2Position(int x) -{ - LOCK( this ); - for (int i = 0; i < PAGESIZE; i++) - optionVal[i]->SetPosition(x, 0); -} - -void GuiOptionBrowser::SetFocus(int f) -{ - LOCK( this ); - focus = f; - - for (int i = 0; i < PAGESIZE; i++) - optionBtn[i]->ResetState(); - - if (f == 1) optionBtn[selectedItem]->SetState(STATE_SELECTED); -} - -void GuiOptionBrowser::ResetState() -{ - LOCK( this ); - if (state != STATE_DISABLED) - { - state = STATE_DEFAULT; - stateChan = -1; - } - - for (int i = 0; i < PAGESIZE; i++) - { - optionBtn[i]->ResetState(); - } -} - -int GuiOptionBrowser::GetClickedOption() -{ - int found = -1; - for (int i = 0; i < PAGESIZE; i++) - { - if (optionBtn[i]->GetState() == STATE_CLICKED) - { - optionBtn[i]->SetState(STATE_SELECTED); - found = optionIndex[i]; - break; - } - } - return found; -} - -int GuiOptionBrowser::GetSelectedOption() -{ - int found = -1; - for (int i = 0; i < PAGESIZE; i++) - { - if (optionBtn[i]->GetState() == STATE_SELECTED) - { - optionBtn[i]->SetState(STATE_SELECTED); - found = optionIndex[i]; - break; - } - } - return found; -} - -/**************************************************************************** - * FindMenuItem - * - * Help function to find the next visible menu item on the list - ***************************************************************************/ - -int GuiOptionBrowser::FindMenuItem(int currentItem, int direction) -{ - int nextItem = currentItem + direction; - - if (nextItem < 0 || nextItem >= options->GetLength()) return -1; - - if (options->GetName(nextItem) && strlen(options->GetName(nextItem)) > 0) - return nextItem; - else - return FindMenuItem(nextItem, direction); -} - -/** - * Draw the button on screen - */ -void GuiOptionBrowser::Draw() -{ - LOCK( this ); - if (!this->IsVisible()) return; - - bgOptionsImg->Draw(); - - int next = listOffset; - - for (int i = 0; i < PAGESIZE; i++) - { - if (next >= 0) - { - optionBtn[i]->Draw(); - next = this->FindMenuItem(next, 1); - } - else break; - } - - if (scrollbaron == 1) - { - scrollbarImg->Draw(); - arrowUpBtn->Draw(); - arrowDownBtn->Draw(); - scrollbarBoxBtn->Draw(); - } - this->UpdateEffects(); -} - -void GuiOptionBrowser::TriggerUpdate() -{ - listChanged = true; -} - -void GuiOptionBrowser::Update(GuiTrigger * t) -{ - LOCK( this ); - int next, prev, lang = options->GetLength(); - - //go to the last game selected - if ((loaded == 0) && (startat > 0)) - { - - if (startat > (lang - 9)) - { - listOffset = (lang - 9); - selectedItem = startat; - optionBtn[selectedItem]->SetState(STATE_SELECTED, t->chan); - } - else if (startat < 9) - { - selectedItem = startat; - optionBtn[selectedItem]->SetState(STATE_SELECTED, t->chan); - } - else if(startat < PAGESIZE) - { - listOffset = (startat - 4); - selectedItem = startat; - optionBtn[selectedItem]->SetState(STATE_SELECTED, t->chan); - } - this->SetFocus(1); - loaded = 1; - } - - if (state == STATE_DISABLED || !t) return; - - // scrolldelay affects how fast the list scrolls - // when the arrows are clicked - float scrolldelay = 3.5; - - if (scrollbaron == 1) - { - // update the location of the scroll box based on the position in the option list - - - arrowUpBtn->Update(t); - arrowDownBtn->Update(t); - scrollbarBoxBtn->Update(t); - } - next = listOffset; - - if (listChanged) - { - for (int i = 0; i < PAGESIZE; i++) - { - if (next >= 0) - { - if (optionBtn[i]->GetState() == STATE_DISABLED) - { - optionBtn[i]->SetVisible(true); - optionBtn[i]->SetState(STATE_DEFAULT); - } - - optionTxt[i]->SetText(options->GetName(next)); - optionVal[i]->SetText(options->GetValue(next)); - optionIndex[i] = next; - next = this->FindMenuItem(next, 1); - } - else - { - optionBtn[i]->SetVisible(false); - optionBtn[i]->SetState(STATE_DISABLED); - } - } - } - for (int i = 0; i < PAGESIZE; i++) - { - if (focus) - { - if (i != selectedItem && optionBtn[i]->GetState() == STATE_SELECTED) - optionBtn[i]->ResetState(); - else if (i == selectedItem && optionBtn[i]->GetState() == STATE_DEFAULT) optionBtn[selectedItem]->SetState( - STATE_SELECTED, t->chan); - } - - optionBtn[i]->Update(t); - - if (optionBtn[i]->GetState() == STATE_SELECTED) - { - selectedItem = i; - } - } - - // pad/joystick navigation - if (!focus) return; // skip navigation - - if (scrollbaron == 1) - { - - if (t->Down() || arrowDownBtn->GetState() == STATE_CLICKED || ////////////////////////////////////////////down - arrowDownBtn->GetState() == STATE_HELD) - { - - next = this->FindMenuItem(optionIndex[selectedItem], 1); - - if (next >= 0) - { - if (selectedItem == PAGESIZE - 1) - { - // move list down by 1 - listOffset = this->FindMenuItem(listOffset, 1); - } - else if (optionBtn[selectedItem + 1]->IsVisible()) - { - optionBtn[selectedItem]->ResetState(); - optionBtn[selectedItem + 1]->SetState(STATE_SELECTED, t->chan); - selectedItem++; - } - scrollbarBoxBtn->Draw(); - usleep(10000 * scrolldelay); - - } - WPAD_ScanPads(); - u8 cnt, buttons = 0; - /* Get pressed buttons */ - for (cnt = 0; cnt < 4; cnt++) - buttons |= WPAD_ButtonsHeld(cnt); - if (buttons == WPAD_BUTTON_A) - { - - } - else - { - arrowDownBtn->ResetState(); - - } - - } - else if (t->Up() || arrowUpBtn->GetState() == STATE_CLICKED || ////////////////////////////////////////////up - arrowUpBtn->GetState() == STATE_HELD) - { - prev = this->FindMenuItem(optionIndex[selectedItem], -1); - - if (prev >= 0) - { - if (selectedItem == 0) - { - // move list up by 1 - listOffset = prev; - } - else - { - optionBtn[selectedItem]->ResetState(); - optionBtn[selectedItem - 1]->SetState(STATE_SELECTED, t->chan); - selectedItem--; - } - scrollbarBoxBtn->Draw(); - usleep(10000 * scrolldelay); - - } - WPAD_ScanPads(); - u8 cnt, buttons = 0; - /* Get pressed buttons */ - for (cnt = 0; cnt < 4; cnt++) - buttons |= WPAD_ButtonsHeld(cnt); - if (buttons == WPAD_BUTTON_A) - { - - } - else - { - arrowUpBtn->ResetState(); - - } - } - - if (scrollbarBoxBtn->GetState() == STATE_HELD && scrollbarBoxBtn->GetStateChan() == t->chan && t->wpad.ir.valid - && options->GetLength() > PAGESIZE) - { - scrollbarBoxBtn->SetPosition(width / 2 - 18 + 7, 0); - int position = t->wpad.ir.y - 50 - scrollbarBoxBtn->GetTop(); - - listOffset = (position * lang) / 180 - selectedItem; - - if (listOffset <= 0) - { - listOffset = 0; - selectedItem = 0; - } - else if (listOffset + PAGESIZE >= lang) - { - listOffset = lang - PAGESIZE; - selectedItem = PAGESIZE - 1; - } - - } - int positionbar = 237 * (listOffset + selectedItem) / lang; - - if (positionbar > 216) positionbar = 216; - scrollbarBoxBtn->SetPosition(width / 2 - 18 + 7, positionbar + 8); - - if (t->Right()) - { - if (listOffset < lang && lang > PAGESIZE) - { - listOffset = listOffset + PAGESIZE; - if (listOffset + PAGESIZE >= lang) listOffset = lang - PAGESIZE; - } - } - else if (t->Left()) - { - if (listOffset > 0) - { - listOffset = listOffset - PAGESIZE; - if (listOffset < 0) listOffset = 0; - } - } - - } - else - { - - if (t->Down()) - { - next = this->FindMenuItem(optionIndex[selectedItem], 1); - - if (next >= 0) - { - if (selectedItem == PAGESIZE - 1) - { - // move list down by 1 - listOffset = this->FindMenuItem(listOffset, 1); - listChanged = true; - } - else if (optionBtn[selectedItem + 1]->IsVisible()) - { - optionBtn[selectedItem]->ResetState(); - optionBtn[selectedItem + 1]->SetState(STATE_SELECTED, t->chan); - selectedItem++; - } - } - } - else if (t->Up()) - { - prev = this->FindMenuItem(optionIndex[selectedItem], -1); - - if (prev >= 0) - { - if (selectedItem == 0) - { - // move list up by 1 - listOffset = prev; - listChanged = true; - } - else - { - optionBtn[selectedItem]->ResetState(); - optionBtn[selectedItem - 1]->SetState(STATE_SELECTED, t->chan); - selectedItem--; - } - } - } - } - - if (updateCB) updateCB(this); -} diff --git a/source/lstub.cpp b/source/lstub.cpp index 5047e27f..deda3314 100644 --- a/source/lstub.cpp +++ b/source/lstub.cpp @@ -6,11 +6,13 @@ #include #include "lstub.h" -#include "filelist.h" #include "gecko.h" #include "wad/nandtitle.h" +extern const u8 stub_bin[]; +extern const u32 stub_bin_size; + static char* determineStubTIDLocation() { u32 *stubID = (u32*) 0x80001818; diff --git a/source/main.cpp b/source/main.cpp index 1833965d..23d84008 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -19,16 +19,9 @@ #include #include "video.h" -#include "themes/CTheme.h" #include "menu/menus.h" -#include "main.h" -#include "Controls/DeviceHandler.hpp" -#include "settings/CSettings.h" #include "memory/mem2.h" #include "wad/nandtitle.h" -#include "system/IosLoader.h" -#include "usbloader/MountGamePartition.h" -#include "usbloader/GameBooter.hpp" #include "StartUpProcess.h" #include "sys.h" @@ -38,15 +31,6 @@ extern "C" void __exception_setreload(int t); } -static int QuickGameBoot(const char * gameID) -{ - DeviceHandler::Instance()->MountAll(); - Settings.Load(); - - MountGamePartition(false); - return GameBooter::BootGame(gameID); -} - int main(int argc, char *argv[]) { MEM2_init(48); @@ -58,10 +42,8 @@ int main(int argc, char *argv[]) NandTitles.Get(); setlocale(LC_ALL, "en.UTF-8"); - if(argc > 1 && argv[1]) - return QuickGameBoot(argv[1]); - - StartUpProcess::Run(); + if(StartUpProcess::Run(argc, argv) < 0) + return -1; MainMenu(MENU_DISCLIST); return 0; diff --git a/source/menu.cpp b/source/menu.cpp index f6ce217b..55a11e70 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -9,7 +9,7 @@ ***************************************************************************/ #include -#include "libwiigui/gui.h" +#include "GUI/gui.h" #include "homebrewboot/BootHomebrew.h" #include "homebrewboot/HomebrewBrowser.hpp" #include "prompts/ProgressWindow.h" @@ -42,7 +42,7 @@ /*** Variables that are also used extern ***/ GuiWindow * mainWindow = NULL; -GuiImageData * pointer[4]; +GuiImageData * pointer[4] = { NULL, NULL, NULL, NULL }; GuiImage * bgImg = NULL; GuiImageData * background = NULL; GuiBGM * bgMusic = NULL; diff --git a/source/menu.h b/source/menu.h index f535941f..ea15b034 100644 --- a/source/menu.h +++ b/source/menu.h @@ -10,7 +10,7 @@ #define _MENU_H_ #include -#include "libwiigui/gui.h" +#include "GUI/gui.h" #include "settings/CSettings.h" #include "main.h" diff --git a/source/menu/GameBrowseMenu.cpp b/source/menu/GameBrowseMenu.cpp index 428978a4..b87ec1cb 100644 --- a/source/menu/GameBrowseMenu.cpp +++ b/source/menu/GameBrowseMenu.cpp @@ -1,7 +1,7 @@ #include #include "GameBrowseMenu.hpp" #include "Controls/DeviceHandler.hpp" -#include "libwiigui/LoadCoverImage.h" +#include "GUI/LoadCoverImage.h" #include "prompts/PromptWindows.h" #include "prompts/gameinfo.h" #include "prompts/DiscBrowser.h" @@ -709,7 +709,7 @@ void GameBrowseMenu::ReloadBrowser() sortBtn->SetPosition(Settings.widescreen ? thInt("256 - carousel layout abc/sort btn pos x widescreen") : thInt("240 - carousel layout abc/sort btn pos x"), thInt("13 - carousel layout abc/sort btn pos y")); categBtn->SetPosition(Settings.widescreen ? thInt("288 - carousel layout category btn pos x widescreen") : thInt("280 - carousel layout category btn pos x"), - thInt("13 - carousel layout abc/sort btn pos y")); + thInt("13 - carousel layout category btn pos y")); listBtn->SetPosition(Settings.widescreen ? thInt("320 - carousel layout list btn pos x widescreen") : thInt("320 - carousel layout list btn pos x"), thInt("13 - carousel layout list btn pos y")); gridBtn->SetPosition(Settings.widescreen ? thInt("352 - carousel layout grid btn pos x widescreen") : thInt("360 - carousel layout grid btn pos x"), @@ -846,6 +846,7 @@ int GameBrowseMenu::MainLoop() HaltGui(); bgMusic->Pause(); Settings.Save(); + DeviceHandler::Instance()->UnMountSD(); DeviceHandler::Instance()->MountSD(); gprintf("\tLoading config...%s\n", Settings.Load() ? "done" : "failed"); gprintf("\tLoading language...%s\n", Settings.LoadLanguage(Settings.language_path, CONSOLE_DEFAULT) ? "done" : "failed"); @@ -1154,7 +1155,7 @@ void GameBrowseMenu::CheckDiscSlotUpdate() else if(categBtn->GetState() == STATE_CLICKED) { - SetState(STATE_DISABLED); + mainWindow->SetState(STATE_DISABLED); CategorySwitchPrompt promptMenu; promptMenu.SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE); promptMenu.SetEffect(EFFECT_FADE, 20); @@ -1166,7 +1167,7 @@ void GameBrowseMenu::CheckDiscSlotUpdate() while(promptMenu.GetEffect() > 0) usleep(100); mainWindow->Remove(&promptMenu); categBtn->ResetState(); - SetState(STATE_DEFAULT); + mainWindow->SetState(STATE_DEFAULT); if(promptMenu.categoriesChanged()) { wString oldFilter(gameList.GetCurrentFilter()); diff --git a/source/menu/GameBrowseMenu.hpp b/source/menu/GameBrowseMenu.hpp index 17cbbbd1..db832790 100644 --- a/source/menu/GameBrowseMenu.hpp +++ b/source/menu/GameBrowseMenu.hpp @@ -1,11 +1,11 @@ #ifndef GAMEBROWSEMENU_HPP_ #define GAMEBROWSEMENU_HPP_ -#include "libwiigui/gui.h" -#include "libwiigui/gui_gamebrowser.h" -#include "libwiigui/gui_gamegrid.h" -#include "libwiigui/gui_gamecarousel.h" -#include "libwiigui/gui_searchbar.h" +#include "GUI/gui.h" +#include "GUI/gui_gamebrowser.h" +#include "GUI/gui_gamegrid.h" +#include "GUI/gui_gamecarousel.h" +#include "GUI/gui_searchbar.h" #include "utils/ThreadedTask.hpp" class GameBrowseMenu : public GuiWindow diff --git a/source/menu/WDMMenu.cpp b/source/menu/WDMMenu.cpp index 57689317..6ed2ab67 100644 --- a/source/menu/WDMMenu.cpp +++ b/source/menu/WDMMenu.cpp @@ -63,7 +63,7 @@ WDMMenu::WDMMenu(const struct discHdr * header) backBtn->SetTrigger(trigB); Append(backBtn); - optionBrowser = new GuiCustomOptionBrowser(396, 280, Options, "bg_options_settings.png"); + optionBrowser = new GuiOptionBrowser(396, 280, Options, "bg_options_settings.png"); optionBrowser->SetPosition(0, 90); optionBrowser->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); Append(optionBrowser); diff --git a/source/menu/WDMMenu.hpp b/source/menu/WDMMenu.hpp index 011d2b28..d611c394 100644 --- a/source/menu/WDMMenu.hpp +++ b/source/menu/WDMMenu.hpp @@ -1,8 +1,8 @@ #ifndef WDMMENU_HPP_ #define WDMMENU_HPP_ -#include "libwiigui/gui.h" -#include "libwiigui/gui_customoptionbrowser.h" +#include "GUI/gui.h" +#include "GUI/gui_optionbrowser.h" #include "usbloader/disc.h" #include "usbloader/WDMFile.hpp" @@ -38,7 +38,7 @@ class WDMMenu : public GuiWindow GuiImage * defaultBtnImg; GuiButton * defaultBtn; - GuiCustomOptionBrowser * optionBrowser; + GuiOptionBrowser * optionBrowser; }; #endif diff --git a/source/menu/menu_partition_selection.cpp b/source/menu/menu_partition_selection.cpp index 5749d262..785fa474 100644 --- a/source/menu/menu_partition_selection.cpp +++ b/source/menu/menu_partition_selection.cpp @@ -4,7 +4,7 @@ #include "usbloader/usbstorage2.h" #include "usbloader/utils.h" #include "usbloader/wbfs.h" -#include "libwiigui/gui_customoptionbrowser.h" +#include "GUI/gui_optionbrowser.h" #include "Controls/DeviceHandler.hpp" #include "themes/CTheme.h" @@ -71,7 +71,7 @@ int SelectPartitionMenu() &trigA, btnSoundOver, btnSoundClick2, 1); exitBtn.SetTrigger(&trigHome); - GuiCustomOptionBrowser optionBrowser(396, 280, &options, "bg_options_settings.png"); + GuiOptionBrowser optionBrowser(396, 280, &options, "bg_options_settings.png"); optionBrowser.SetPosition(0, 40); optionBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); diff --git a/source/menu/menus.h b/source/menu/menus.h index 0733afdc..3e2ad916 100644 --- a/source/menu/menus.h +++ b/source/menu/menus.h @@ -1,7 +1,7 @@ #ifndef _MENUS_H #define _MENUS_H -#include "libwiigui/gui.h" +#include "GUI/gui.h" #include "language/gettext.h" #include "prompts/PromptWindows.h" #include "menu.h" diff --git a/source/prompts/CategoryPrompt.cpp b/source/prompts/CategoryPrompt.cpp index 931106be..b356d498 100644 --- a/source/prompts/CategoryPrompt.cpp +++ b/source/prompts/CategoryPrompt.cpp @@ -24,226 +24,173 @@ #include #include "CategoryPrompt.hpp" #include "settings/CGameCategories.hpp" -#include "themes/Resources.h" +#include "settings/CSettings.h" #include "language/gettext.h" +#include "themes/gettheme.h" +#include "themes/Resources.h" #include "menu/menus.h" CategoryPrompt::CategoryPrompt(const string &title) : GuiWindow(0, 0) { - int posX = 15; - const int posY = 50; - const int distance = 10; + changed = false; + trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); + trigB.SetSimpleTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B); + trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, PAD_BUTTON_START); + + btnOutline = Resources::GetImageData("button_dialogue_box.png"); bgImgData = Resources::GetImageData("categoryPrompt.png"); + browserImgData = Resources::GetImageData("bg_options.png"); addImgData = Resources::GetImageData("add.png"); - prevImgData = Resources::GetImageData("back.png"); - forwardImgData = Resources::GetImageData("forward.png"); - trashImgData = Resources::GetImageData("remove.png"); - lineImgData = Resources::GetImageData("categoryLine.png"); + deleteImgData = Resources::GetImageData("remove.png"); + editImgData = Resources::GetImageData("rename.png"); bgImg = new GuiImage(bgImgData); Append(bgImg); - width = bgImgData->GetWidth(); - height = bgImgData->GetHeight(); + width = bgImg->GetWidth(); + height = bgImg->GetHeight()+btnOutline->GetHeight()*0.9f; - addImg = new GuiImage(addImgData); - prevImg = new GuiImage(prevImgData); - forwardImg = new GuiImage(forwardImgData); - trashImg = new GuiImage(trashImgData); - lineImg = new GuiImage(lineImgData); - - trigA = new GuiTrigger; - trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); - trigB = new GuiTrigger; - trigB->SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B); - trigHome = new GuiTrigger; - trigHome->SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, PAD_BUTTON_START); - trigLeft = new GuiTrigger; - trigLeft->SetButtonOnlyTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT); - trigRight = new GuiTrigger; - trigRight->SetButtonOnlyTrigger(-1, WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT, PAD_BUTTON_RIGHT); - trigMinus = new GuiTrigger; - trigMinus->SetButtonOnlyTrigger(-1, WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS, 0); - trigPlus = new GuiTrigger; - trigPlus->SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, 0); - - homeButton = new GuiButton(0, 0); - homeButton->SetTrigger(trigHome); - Append(homeButton); - - backButton = new GuiButton(0, 0); - backButton->SetTrigger(trigB); - Append(backButton); - - titleTxt = new GuiText(title.c_str(), 30, (GXColor) {0, 0, 0, 255}); - titleTxt->SetAlignment(ALIGN_CENTER, ALIGN_TOP); - titleTxt->SetPosition(0, 10); + titleTxt = new GuiText(title.c_str(), 30, thColor("r=0 g=0 b=0 a=255 - category prompt title text color")); + titleTxt->SetAlignment(thAlign("center - category prompt title text align hor"), thAlign("top - category prompt title text align ver")); + titleTxt->SetPosition(thInt("0 - category prompt title text pos x"), thInt("10 - category prompt title text pos y")); Append(titleTxt); - previousButton = new GuiButton(prevImg->GetWidth(), prevImg->GetHeight()); - previousButton->SetImage(prevImg); - previousButton->SetAlignment(ALIGN_LEFT, ALIGN_TOP); - previousButton->SetPosition(posX, posY); - previousButton->SetSoundOver(btnSoundOver); - previousButton->SetSoundClick(btnSoundClick); - previousButton->SetTrigger(trigA); - previousButton->SetTrigger(trigLeft); - previousButton->SetTrigger(trigMinus); - previousButton->SetEffectGrow(); - previousButton->Clicked.connect(this, &CategoryPrompt::OnPreviousButtonClick); - Append(previousButton); - posX += distance + previousButton->GetWidth(); + browserImg = new GuiImage(browserImgData); + browser = new GuiCheckboxBrowser(browserImg->GetWidth(), browserImg->GetHeight()); + browser->SetImage(browserImg); + browser->SetAlignment(thAlign("center - category prompt browser align hor"), thAlign("top - category prompt browser align ver")); + browser->SetPosition(thInt("0 - category prompt browser pos x"), thInt("45 - category prompt browser pos y")); + Append(browser); - categoryTxt = new GuiText((char *) NULL, 26, (GXColor) {0, 0, 0, 255}); - categoryTxt->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE); - categoryTxt->SetMaxWidth(lineImg->GetWidth()-10, DOTTED); - categoryTxt->SetPosition(0, 2); + homeButton = new GuiButton(0, 0); + homeButton->SetTrigger(&trigHome); + Append(homeButton); - editButton = new GuiButton(lineImg->GetWidth(), lineImg->GetHeight()); - editButton->SetImage(lineImg); - editButton->SetLabel(categoryTxt); - editButton->SetAlignment(ALIGN_LEFT, ALIGN_TOP); - editButton->SetPosition(posX, posY); - editButton->SetSoundOver(btnSoundOver); - editButton->SetSoundClick(btnSoundClick); - editButton->SetTrigger(trigA); - editButton->SetEffectGrow(); - Append(editButton); - posX += distance + editButton->GetWidth(); - - enabledButton = new GuiCheckbox(32, 32); - enabledButton->SetAlignment(ALIGN_LEFT, ALIGN_TOP); - enabledButton->SetPosition(posX, posY); - enabledButton->SetSoundOver(btnSoundOver); - enabledButton->SetSoundClick(btnSoundClick); - enabledButton->SetTrigger(trigA); - enabledButton->Clicked.connect(this, &CategoryPrompt::OnEnableButtonClick); - Append(enabledButton); - posX += distance + enabledButton->GetWidth(); - - forwardButton = new GuiButton(forwardImg->GetWidth(), forwardImg->GetHeight()); - forwardButton->SetImage(forwardImg); - forwardButton->SetAlignment(ALIGN_LEFT, ALIGN_TOP); - forwardButton->SetPosition(posX, posY); - forwardButton->SetSoundOver(btnSoundOver); - forwardButton->SetSoundClick(btnSoundClick); - forwardButton->SetTrigger(trigA); - forwardButton->SetTrigger(trigRight); - forwardButton->SetTrigger(trigPlus); - forwardButton->SetEffectGrow(); - forwardButton->Clicked.connect(this, &CategoryPrompt::OnForwardButtonClick); - Append(forwardButton); - posX += 35 + forwardImg->GetWidth(); - - posTxt = new GuiText((char *) NULL, 26, (GXColor) {0, 0, 0, 255}); - posTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); - posTxt->SetPosition(posX, posY+4); - Append(posTxt); - - addTxt = new GuiText(tr("Add category"), 24, (GXColor) {0, 0, 0, 255}); - addTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); + addImg = new GuiImage(addImgData); + addTxt = new GuiText(tr("Add category"), 24, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); addTxt->SetMaxWidth(180, DOTTED); - addTxt->SetPosition(10+addImg->GetWidth(), 6); + addTxt->SetAlignment(thAlign("left - category prompt add button text align hor"), thAlign("top - category prompt add button text align ver")); + addTxt->SetPosition(thInt("10 - category prompt add button text pos x")+addImg->GetWidth(), thInt("6 - category prompt add button text pos y")); addButton = new GuiButton(addImg->GetWidth()+10+addTxt->GetTextWidth(), addImg->GetHeight()); addButton->SetImage(addImg); addButton->SetLabel(addTxt); - addButton->SetAlignment(ALIGN_LEFT, ALIGN_TOP); - addButton->SetPosition(15, 100); + addButton->SetAlignment(thAlign("left - category prompt add button align hor"), thAlign("top - category prompt add button align ver")); + addButton->SetPosition(width/2-thInt("180 - category prompt add button pos x")-addImg->GetWidth()/2, thInt("330 - category prompt add button pos y")); addButton->SetSoundOver(btnSoundOver); addButton->SetSoundClick(btnSoundClick); - addButton->SetTrigger(trigA); + addButton->SetTrigger(&trigA); addButton->SetEffectGrow(); Append(addButton); - deleteTxt = new GuiText(tr("Delete category"), 24, (GXColor) {0, 0, 0, 255}); - deleteTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); + deleteImg = new GuiImage(deleteImgData); + deleteTxt = new GuiText(tr("Delete category"), 24, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); deleteTxt->SetMaxWidth(180, DOTTED); - deleteTxt->SetPosition(trashImg->GetWidth()+10, 6); + deleteTxt->SetAlignment(thAlign("left - category prompt delete button text align hor"), thAlign("top - category prompt delete button text align ver")); + deleteTxt->SetPosition(thInt("10 - category prompt delete button text pos x")+deleteImg->GetWidth(), thInt("6 - category prompt delete button text pos y")); - deleteButton = new GuiButton(trashImg->GetWidth()+10+deleteTxt->GetTextWidth(), trashImg->GetHeight()); - deleteButton->SetImage(trashImg); + deleteButton = new GuiButton(deleteImg->GetWidth()+10+deleteTxt->GetTextWidth(), deleteImg->GetHeight()); + deleteButton->SetImage(deleteImg); deleteButton->SetLabel(deleteTxt); - deleteButton->SetAlignment(ALIGN_LEFT, ALIGN_TOP); - deleteButton->SetPosition(10+180+addImg->GetWidth(), 100); + deleteButton->SetAlignment(thAlign("left - category prompt delete button align hor"), thAlign("top - category prompt delete button align ver")); + deleteButton->SetPosition(width/2+thInt("5 - category prompt delete button pos x"), thInt("330 - category prompt delete button pos y")); deleteButton->SetSoundOver(btnSoundOver); deleteButton->SetSoundClick(btnSoundClick); - deleteButton->SetTrigger(trigA); + deleteButton->SetTrigger(&trigA); deleteButton->SetEffectGrow(); Append(deleteButton); + + editImg = new GuiImage(editImgData); + editTxt = new GuiText(tr("Rename category"), 24, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); + editTxt->SetAlignment(thAlign("left - category prompt edit button text align hor"), thAlign("top - category prompt edit button text align ver")); + editTxt->SetPosition(thInt("10 - category prompt edit button text pos x")+editImg->GetWidth(), thInt("6 - category prompt edit button text pos y")); + editTxt->SetMaxWidth(180, DOTTED); + + editButton = new GuiButton(editImg->GetWidth()+10+editTxt->GetTextWidth(), editImg->GetHeight()); + editButton->SetImage(editImg); + editButton->SetLabel(editTxt); + editButton->SetAlignment(thAlign("left - category prompt edit button align hor"), thAlign("top - category prompt edit button align ver")); + editButton->SetPosition(width/2-thInt("180 - category prompt edit button pos x")-addImg->GetWidth()/2, thInt("362 - category prompt edit button pos y")); + editButton->SetSoundOver(btnSoundOver); + editButton->SetSoundClick(btnSoundClick); + editButton->SetTrigger(&trigA); + editButton->SetEffectGrow(); + Append(editButton); + + saveImg = new GuiImage(btnOutline); + saveImg->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); + saveImg->SetScale(0.9f); + saveTxt = new GuiText(tr("Save"), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); + saveButton = new GuiButton(saveImg->GetWidth()*0.9f, saveImg->GetHeight()*0.9f); + saveButton->SetImage(saveImg); + saveButton->SetLabel(saveTxt); + saveButton->SetAlignment(thAlign("center - category prompt save button align hor"), thAlign("bottom - category prompt save button align ver")); + saveButton->SetPosition(thInt("-110 - category prompt save button pos x"), thInt("0 - category prompt save button pos y")); + saveButton->SetSoundOver(btnSoundOver); + saveButton->SetSoundClick(btnSoundClick); + saveButton->SetTrigger(&trigA); + saveButton->SetEffectGrow(); + Append(saveButton); + + backImg = new GuiImage(btnOutline); + backImg->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); + backImg->SetScale(0.9f); + backTxt = new GuiText(tr("Back"), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); + backBtn = new GuiButton(backImg->GetWidth()*0.9f, backImg->GetHeight()*0.9f); + backBtn->SetImage(backImg); + backBtn->SetLabel(backTxt); + backBtn->SetAlignment(thAlign("center - category prompt back button align hor"), thAlign("bottom - category prompt back button align ver")); + backBtn->SetPosition(thInt("110 - category prompt back button pos x"), thInt("0 - category prompt back button pos y")); + backBtn->SetSoundOver(btnSoundOver); + backBtn->SetSoundClick(btnSoundClick); + backBtn->SetTrigger(&trigA); + backBtn->SetEffectGrow(); + Append(backBtn); + + browserRefresh(); } CategoryPrompt::~CategoryPrompt() { + RemoveAll(); + delete browser; + + delete btnOutline; delete bgImgData; - delete addImgData; - delete prevImgData; - delete forwardImgData; - delete trashImgData; - delete lineImgData; - delete bgImg; + delete browserImgData; + delete browserImg; + delete addImgData; delete addImg; - delete prevImg; - delete forwardImg; - delete trashImg; - delete lineImg; + delete deleteImgData; + delete deleteImg; + delete editImgData; + delete editImg; + delete backImg; + delete saveImg; + delete backBtn; + delete homeButton; delete addButton; - delete previousButton; - delete backButton; - delete forwardButton; delete deleteButton; delete editButton; - delete homeButton; - delete enabledButton; + delete saveButton; delete titleTxt; - delete categoryTxt; - delete posTxt; delete addTxt; delete deleteTxt; - - delete trigA; - delete trigB; - delete trigHome; - delete trigLeft; - delete trigRight; - delete trigPlus; - delete trigMinus; + delete editTxt; + delete backTxt; + delete saveTxt; } -void CategoryPrompt::OnForwardButtonClick(GuiButton *sender, int chan, const POINT &pointer) +int CategoryPrompt::Show() { - nextCategory(); - categoryChanged(categoryTxt, posTxt, enabledButton); - sender->ResetState(); -} - -void CategoryPrompt::OnPreviousButtonClick(GuiButton *sender, int chan, const POINT &pointer) -{ - previousCategory(); - categoryChanged(categoryTxt, posTxt, enabledButton); - sender->ResetState(); -} - -void CategoryPrompt::OnEnableButtonClick(GuiButton *sender, int chan, const POINT &pointer) -{ - changed = true; - checkBoxClicked(enabledButton); - sender->ResetState(); -} - -int CategoryPrompt::MainLoop() -{ - categoryChanged(categoryTxt, posTxt, enabledButton); - - while(backButton->GetState() != STATE_CLICKED) + while(backBtn->GetState() != STATE_CLICKED) { usleep(100); - if (shutdown) Sys_Shutdown(); else if (reset) @@ -253,15 +200,23 @@ int CategoryPrompt::MainLoop() { gprintf("\thomeButton clicked\n"); WindowExitPrompt(); - + SetState(STATE_DEFAULT); homeButton->ResetState(); } + else if(saveButton->GetState() == STATE_CLICKED) + { + if(categoriesChanged()) + GameCategories.Save(); + return 1; + } + else if(addButton->GetState() == STATE_CLICKED) { if(!Settings.godmode && (Settings.ParentalBlocks & BLOCK_CATEGORIES_MOD)) { WindowPrompt(tr( "Permission denied." ), tr( "Console must be unlocked to be able to use this." ), tr( "OK" )); + SetState(STATE_DEFAULT); addButton->ResetState(); continue; } @@ -272,11 +227,12 @@ int CategoryPrompt::MainLoop() if(result) { GameCategories.CategoryList.AddCategory(entered); - GameCategories.Save(); GameCategories.CategoryList.findCategory(entered); - categoryChanged(categoryTxt, posTxt, enabledButton); + browserRefresh(); + markChanged(); } + SetState(STATE_DEFAULT); addButton->ResetState(); } @@ -285,13 +241,15 @@ int CategoryPrompt::MainLoop() if(!Settings.godmode && (Settings.ParentalBlocks & BLOCK_CATEGORIES_MOD)) { WindowPrompt(tr( "Permission denied." ), tr( "Console must be unlocked to be able to use this." ), tr( "OK" )); + SetState(STATE_DEFAULT); deleteButton->ResetState(); continue; } - if(GameCategories.CategoryList.getCurrentID() == 0) + if(browser->GetSelected() == 0) { WindowPrompt(tr("Error"), tr("You cannot delete this category."), tr("OK")); + SetState(STATE_DEFAULT); deleteButton->ResetState(); continue; } @@ -299,18 +257,19 @@ int CategoryPrompt::MainLoop() int choice = WindowPrompt(tr("Warning"), tr("Are you sure you want to delete this category?"), tr("Yes"), tr("Cancel")); if(choice) { - int pos = GameCategories.CategoryList.pos()-1; + GameCategories.CategoryList.goToFirst(); + for(int i = 0; i < browser->GetSelected(); ++i) + GameCategories.CategoryList.goToNext(); int categoryID = GameCategories.CategoryList.getCurrentID(); GameCategories.CategoryList.RemoveCategory(categoryID); GameCategories.RemoveCategory(categoryID); - GameCategories.Save(); GameCategories.CategoryList.goToFirst(); - for(int i = 0; i < pos; ++i) - GameCategories.CategoryList.goToNext(); - categoryChanged(categoryTxt, posTxt, enabledButton); + browserRefresh(); + markChanged(); } + SetState(STATE_DEFAULT); deleteButton->ResetState(); } @@ -319,10 +278,15 @@ int CategoryPrompt::MainLoop() if(!Settings.godmode && (Settings.ParentalBlocks & BLOCK_CATEGORIES_MOD)) { WindowPrompt(tr( "Permission denied." ), tr( "Console must be unlocked to be able to use this." ), tr( "OK" )); + SetState(STATE_DEFAULT); editButton->ResetState(); continue; } + GameCategories.CategoryList.goToFirst(); + for(int i = 0; i < browser->GetSelected(); ++i) + GameCategories.CategoryList.goToNext(); + char entered[512]; snprintf(entered, sizeof(entered), tr(GameCategories.CategoryList.getCurrentName().c_str())); @@ -330,18 +294,21 @@ int CategoryPrompt::MainLoop() if(result) { GameCategories.CategoryList.SetCategory(GameCategories.CategoryList.getCurrentID(), entered); - int pos = GameCategories.CategoryList.pos(); - GameCategories.Save(); GameCategories.CategoryList.goToFirst(); - for(int i = 0; i < pos; ++i) - GameCategories.CategoryList.goToNext(); - categoryChanged(categoryTxt, posTxt, enabledButton); + browserRefresh(); + markChanged(); } + SetState(STATE_DEFAULT); editButton->ResetState(); } } + //! Reset to old file in case of cancel + if(categoriesChanged()) + resetChanges(); + return 0; } + diff --git a/source/prompts/CategoryPrompt.hpp b/source/prompts/CategoryPrompt.hpp index 95f2fa78..8201164c 100644 --- a/source/prompts/CategoryPrompt.hpp +++ b/source/prompts/CategoryPrompt.hpp @@ -21,67 +21,58 @@ * 3. This notice may not be removed or altered from any source * distribution. ***************************************************************************/ -#ifndef CATEGORYPROMPT_HPP_ -#define CATEGORYPROMPT_HPP_ +#ifndef CATEGORY_PROMPT_HPP_ +#define CATEGORY_PROMPT_HPP_ -#include "libwiigui/gui.h" -#include "libwiigui/gui_checkbox.hpp" +#include "GUI/gui_checkboxbrowser.hpp" class CategoryPrompt : public GuiWindow, public sigslot::has_slots<> { public: - CategoryPrompt(const std::string &title); + CategoryPrompt(const string &title); ~CategoryPrompt(); + int Show(); bool categoriesChanged() const { return changed; } protected: - int MainLoop(); - sigslot::signal3 categoryChanged; - sigslot::signal0<> nextCategory; - sigslot::signal0<> previousCategory; - sigslot::signal1 checkBoxClicked; + void markChanged() { changed = true; } + sigslot::signal0<> browserRefresh; + sigslot::signal0<> resetChanges; + GuiCheckboxBrowser *browser; private: - void OnForwardButtonClick(GuiButton *sender, int chan, const POINT &pointer); - void OnPreviousButtonClick(GuiButton *sender, int chan, const POINT &pointer); - void OnEnableButtonClick(GuiButton *sender, int chan, const POINT &pointer); - bool changed; GuiImageData *bgImgData; + GuiImageData *browserImgData; + GuiImageData *btnOutline; GuiImageData *addImgData; - GuiImageData *prevImgData; - GuiImageData *forwardImgData; - GuiImageData *trashImgData; - GuiImageData *lineImgData; + GuiImageData *deleteImgData; + GuiImageData *editImgData; + GuiImage *browserImg; GuiImage *bgImg; GuiImage *addImg; - GuiImage *prevImg; - GuiImage *forwardImg; - GuiImage *trashImg; - GuiImage *lineImg; + GuiImage *deleteImg; + GuiImage *editImg; + GuiImage *backImg; + GuiImage *saveImg; + GuiButton *backBtn; + GuiButton *homeButton; GuiButton *addButton; - GuiButton *previousButton; - GuiButton *forwardButton; - GuiButton *backButton; GuiButton *deleteButton; GuiButton *editButton; - GuiButton *homeButton; - GuiCheckbox *enabledButton; + GuiButton *saveButton; GuiText *titleTxt; - GuiText *categoryTxt; - GuiText *posTxt; GuiText *addTxt; GuiText *deleteTxt; + GuiText *editTxt; + GuiText *backTxt; + GuiText *saveTxt; - GuiTrigger *trigA; - GuiTrigger *trigB; - GuiTrigger *trigHome; - GuiTrigger *trigLeft; - GuiTrigger *trigRight; - GuiTrigger *trigMinus; - GuiTrigger *trigPlus; + GuiTrigger trigA; + GuiTrigger trigB; + GuiTrigger trigHome; }; #endif diff --git a/source/prompts/CategorySelectPrompt.cpp b/source/prompts/CategorySelectPrompt.cpp index d20e4d62..b1d0aabb 100644 --- a/source/prompts/CategorySelectPrompt.cpp +++ b/source/prompts/CategorySelectPrompt.cpp @@ -26,55 +26,55 @@ #include "settings/CSettings.h" #include "language/gettext.h" #include "utils/StringTools.h" +#include "gecko.h" CategorySelectPrompt::CategorySelectPrompt(struct discHdr * header) : CategoryPrompt(fmt("%s - %s", (char *) header->id, tr("Categories"))), gameHeader(header) { - categoryChanged.connect(this, &CategorySelectPrompt::OnCategoryChange); - nextCategory.connect(this, &CategorySelectPrompt::OnNextCategory); - previousCategory.connect(this, &CategorySelectPrompt::OnPreviousCategory); - checkBoxClicked.connect(this, &CategorySelectPrompt::OnCheckboxClicked); + browser->checkBoxClicked.connect(this, &CategorySelectPrompt::OnCheckboxClick); + browserRefresh.connect(this, &CategorySelectPrompt::onBrowserRefresh); + resetChanges.connect(this, &CategorySelectPrompt::onResetChanges); + + browserRefresh(); } -CategorySelectPrompt::~CategorySelectPrompt() +void CategorySelectPrompt::onResetChanges() { - int pos = GameCategories.CategoryList.pos()-1; - GameCategories.Save(); + GameCategories.Load(Settings.ConfigPath); +} + +void CategorySelectPrompt::onBrowserRefresh() +{ + browser->Clear(); GameCategories.CategoryList.goToFirst(); - for(int i = 0; i < pos; ++i) - GameCategories.CategoryList.goToNext(); -} - -void CategorySelectPrompt::OnNextCategory() -{ - GameCategories.CategoryList.goToNextCicle(); -} - -void CategorySelectPrompt::OnPreviousCategory() -{ - GameCategories.CategoryList.goToPreviousCicle(); -} - -void CategorySelectPrompt::OnCategoryChange(GuiText *catTxt, GuiText *positionTxt, GuiCheckbox *checkBox) -{ - catTxt->SetText(tr(GameCategories.CategoryList.getCurrentName().c_str())); - positionTxt->SetTextf("%i / %i", GameCategories.CategoryList.pos()+1, GameCategories.CategoryList.size()); - checkBox->SetChecked(false); - - const vector gameCat = GameCategories[gameHeader->id]; - for(u32 i = 0; i < gameCat.size(); ++i) + do { - if(gameCat[i] == GameCategories.CategoryList.getCurrentID()) + bool checked = false; + const vector gameCat = GameCategories[gameHeader->id]; + + for(u32 i = 0; i < gameCat.size(); ++i) { - checkBox->SetChecked(true); - break; + if(gameCat[i] == GameCategories.CategoryList.getCurrentID()) + { + checked = true; + break; + } } + + browser->AddEntrie(GameCategories.CategoryList.getCurrentName(), checked); } + while(GameCategories.CategoryList.goToNext()); + + GameCategories.CategoryList.goToFirst(); } -void CategorySelectPrompt::OnCheckboxClicked(GuiCheckbox *checkBox) +void CategorySelectPrompt::OnCheckboxClick(GuiCheckbox *checkBox, int index) { + GameCategories.CategoryList.goToFirst(); + for(int i = 0; i < index; ++i) + GameCategories.CategoryList.goToNext(); + if(GameCategories.CategoryList.getCurrentID() == 0) { checkBox->SetChecked(true); @@ -89,7 +89,10 @@ void CategorySelectPrompt::OnCheckboxClicked(GuiCheckbox *checkBox) if(gameCat[i] == GameCategories.CategoryList.getCurrentID()) { if(!checkBox->IsChecked()) + { GameCategories.RemoveCategory((const char *) gameHeader->id, gameCat[i]); + markChanged(); + } break; } } @@ -97,5 +100,6 @@ void CategorySelectPrompt::OnCheckboxClicked(GuiCheckbox *checkBox) if(i == gameCat.size() && checkBox->IsChecked()) { GameCategories.SetCategory(gameHeader->id, GameCategories.CategoryList.getCurrentID()); + markChanged(); } } diff --git a/source/prompts/CategorySelectPrompt.hpp b/source/prompts/CategorySelectPrompt.hpp index 8fdb5045..1511b6e8 100644 --- a/source/prompts/CategorySelectPrompt.hpp +++ b/source/prompts/CategorySelectPrompt.hpp @@ -31,13 +31,11 @@ class CategorySelectPrompt : public CategoryPrompt { public: CategorySelectPrompt(struct discHdr * header); - ~CategorySelectPrompt(); - int Show() { return CategoryPrompt::MainLoop(); }; private: - void OnCheckboxClicked(GuiCheckbox *checkBox); - void OnCategoryChange(GuiText *categoryTxt, GuiText *posTxt, GuiCheckbox *checkBox); - void OnNextCategory(); - void OnPreviousCategory(); + void OnCheckboxClick(GuiCheckbox *checkBox, int index); + void onBrowserRefresh(); + void onResetChanges(); + struct discHdr * gameHeader; }; diff --git a/source/prompts/CategorySwitchPrompt.cpp b/source/prompts/CategorySwitchPrompt.cpp index 0d1aee15..b3bc5f63 100644 --- a/source/prompts/CategorySwitchPrompt.cpp +++ b/source/prompts/CategorySwitchPrompt.cpp @@ -27,49 +27,61 @@ #include "language/gettext.h" CategorySwitchPrompt::CategorySwitchPrompt() - : CategoryPrompt(tr("Show Categories")) + : CategoryPrompt(tr("Show Categories")), oldSetting(Settings.EnabledCategories) { - categoryChanged.connect(this, &CategorySwitchPrompt::OnCategoryChange); - nextCategory.connect(this, &CategorySwitchPrompt::OnNextCategory); - previousCategory.connect(this, &CategorySwitchPrompt::OnPreviousCategory); - checkBoxClicked.connect(this, &CategorySwitchPrompt::OnCheckboxClicked); + browser->checkBoxClicked.connect(this, &CategorySwitchPrompt::OnCheckboxClick); + browserRefresh.connect(this, &CategorySwitchPrompt::onBrowserRefresh); + resetChanges.connect(this, &CategorySwitchPrompt::onResetChanges); + + browserRefresh(); } -void CategorySwitchPrompt::OnNextCategory() +void CategorySwitchPrompt::onResetChanges() { - GameCategories.CategoryList.goToNextCicle(); + Settings.EnabledCategories = oldSetting; + GameCategories.Load(Settings.ConfigPath); } -void CategorySwitchPrompt::OnPreviousCategory() +void CategorySwitchPrompt::onBrowserRefresh() { - GameCategories.CategoryList.goToPreviousCicle(); -} - -void CategorySwitchPrompt::OnCategoryChange(GuiText *catTxt, GuiText *positionTxt, GuiCheckbox *checkBox) -{ - catTxt->SetText(tr(GameCategories.CategoryList.getCurrentName().c_str())); - positionTxt->SetTextf("%i / %i", GameCategories.CategoryList.pos()+1, GameCategories.CategoryList.size()); - checkBox->SetChecked(false); - - for(u32 i = 0; i < Settings.EnabledCategories.size(); ++i) + browser->Clear(); + GameCategories.CategoryList.goToFirst(); + do { - if(Settings.EnabledCategories[i] == GameCategories.CategoryList.getCurrentID()) + bool checked = false; + + for(u32 i = 0; i < Settings.EnabledCategories.size(); ++i) { - checkBox->SetChecked(true); - break; + if(Settings.EnabledCategories[i] == GameCategories.CategoryList.getCurrentID()) + { + checked = true; + break; + } } + + browser->AddEntrie(GameCategories.CategoryList.getCurrentName(), checked); } + while(GameCategories.CategoryList.goToNext()); + + GameCategories.CategoryList.goToFirst(); } -void CategorySwitchPrompt::OnCheckboxClicked(GuiCheckbox *checkBox) +void CategorySwitchPrompt::OnCheckboxClick(GuiCheckbox *checkBox, int index) { + GameCategories.CategoryList.goToFirst(); + for(int i = 0; i < index; ++i) + GameCategories.CategoryList.goToNext(); + u32 i; for(i = 0; i < Settings.EnabledCategories.size(); ++i) { if(Settings.EnabledCategories[i] == GameCategories.CategoryList.getCurrentID()) { if(!checkBox->IsChecked()) + { Settings.EnabledCategories.erase(Settings.EnabledCategories.begin()+i); + markChanged(); + } break; } } @@ -77,5 +89,6 @@ void CategorySwitchPrompt::OnCheckboxClicked(GuiCheckbox *checkBox) if(i == Settings.EnabledCategories.size() && checkBox->IsChecked()) { Settings.EnabledCategories.push_back(GameCategories.CategoryList.getCurrentID()); + markChanged(); } } diff --git a/source/prompts/CategorySwitchPrompt.hpp b/source/prompts/CategorySwitchPrompt.hpp index ccd54161..5f791f5a 100644 --- a/source/prompts/CategorySwitchPrompt.hpp +++ b/source/prompts/CategorySwitchPrompt.hpp @@ -30,12 +30,12 @@ class CategorySwitchPrompt : public CategoryPrompt { public: CategorySwitchPrompt(); - int Show() { return CategoryPrompt::MainLoop(); }; private: - void OnCheckboxClicked(GuiCheckbox *checkBox); - void OnCategoryChange(GuiText *categoryTxt, GuiText *posTxt, GuiCheckbox *checkBox); - void OnNextCategory(); - void OnPreviousCategory(); + void OnCheckboxClick(GuiCheckbox *checkBox, int index); + void onBrowserRefresh(); + void onResetChanges(); + + const std::vector oldSetting; }; #endif diff --git a/source/prompts/CheckboxPrompt.hpp b/source/prompts/CheckboxPrompt.hpp index 029fdab6..57c9dac8 100644 --- a/source/prompts/CheckboxPrompt.hpp +++ b/source/prompts/CheckboxPrompt.hpp @@ -24,7 +24,7 @@ #ifndef _CHECKBOXPROMPT_HPP_ #define _CHECKBOXPROMPT_HPP_ -#include "libwiigui/gui_checkbox.hpp" +#include "GUI/gui_checkbox.hpp" #include "PromptWindow.hpp" enum diff --git a/source/prompts/DiscBrowser.cpp b/source/prompts/DiscBrowser.cpp index 548b3d04..1d2b87b3 100644 --- a/source/prompts/DiscBrowser.cpp +++ b/source/prompts/DiscBrowser.cpp @@ -6,8 +6,8 @@ ***************************************************************************/ #include #include "language/gettext.h" -#include "libwiigui/gui.h" -#include "libwiigui/gui_customoptionbrowser.h" +#include "GUI/gui.h" +#include "GUI/gui_optionbrowser.h" #include "prompts/PromptWindows.h" #include "menu/menus.h" #include "usbloader/disc.h" @@ -116,7 +116,7 @@ int DiscBrowse(const char * GameID, char * alternatedname, int alternatedname_si settingsbackgroundbtn.SetPosition(0, 0); settingsbackgroundbtn.SetImage(&settingsbackground); - GuiText cancelBtnTxt(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + GuiText cancelBtnTxt(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30); GuiImage cancelBtnImg(&btnOutline); if (Settings.wsprompt == ON) @@ -129,7 +129,7 @@ int DiscBrowse(const char * GameID, char * alternatedname, int alternatedname_si cancelBtn.SetLabel(&cancelBtnTxt); cancelBtn.SetTrigger(&trigB); - GuiCustomOptionBrowser optionBrowser3(396, 280, &options, "bg_options_settings.png"); + GuiOptionBrowser optionBrowser3(396, 280, &options, "bg_options_settings.png"); optionBrowser3.SetPosition(0, 90); optionBrowser3.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); diff --git a/source/prompts/GameWindow.cpp b/source/prompts/GameWindow.cpp index 07f045ab..91511d56 100644 --- a/source/prompts/GameWindow.cpp +++ b/source/prompts/GameWindow.cpp @@ -60,7 +60,7 @@ GameWindow::GameWindow(int Selected) nameBtnTT = new GuiTooltip(tr( "Rename Game on WBFS" )); if (Settings.wsprompt) nameBtnTT->SetWidescreen(Settings.widescreen); - nameTxt = new GuiText("", 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + nameTxt = new GuiText("", 22, thColor("r=0 g=0 b=0 a=255 - game window name text color")); if (Settings.wsprompt) nameTxt->SetWidescreen(Settings.widescreen); nameTxt->SetMaxWidth(350, SCROLL_HORIZONTAL); nameBtn = new GuiButton(120, 50); @@ -77,7 +77,7 @@ GameWindow::GameWindow(int Selected) nameBtn->SetEffectGrow(); } - sizeTxt = new GuiText((char*) NULL, 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + sizeTxt = new GuiText((char*) NULL, 22, thColor("r=0 g=0 b=0 a=255 - game window size text color")); sizeTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); sizeTxt->SetPosition(-60, 70); @@ -92,7 +92,7 @@ GameWindow::GameWindow(int Selected) diskImg2->SetAngle(0); diskImg2->SetBeta(180); - playcntTxt = new GuiText((char*) NULL, 18, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + playcntTxt = new GuiText((char*) NULL, 18, thColor("r=0 g=0 b=0 a=255 - game window playcount text color")); playcntTxt->SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); playcntTxt->SetPosition(-115, 45); @@ -105,7 +105,7 @@ GameWindow::GameWindow(int Selected) gameBtn->SetTrigger(trigA); gameBtn->SetState(STATE_SELECTED); - backBtnTxt = new GuiText(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + backBtnTxt = new GuiText(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); backBtnImg = new GuiImage(btnOutline); if (Settings.wsprompt) { @@ -118,7 +118,7 @@ GameWindow::GameWindow(int Selected) backBtn->SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM); backBtn->SetPosition(0, -40); - settingsBtnTxt = new GuiText(tr( "Settings" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + settingsBtnTxt = new GuiText(tr( "Settings" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); settingsBtnImg = new GuiImage(btnOutline); if (Settings.wsprompt) { diff --git a/source/prompts/GameWindow.hpp b/source/prompts/GameWindow.hpp index c2679a1e..ca7e8347 100644 --- a/source/prompts/GameWindow.hpp +++ b/source/prompts/GameWindow.hpp @@ -1,8 +1,8 @@ #ifndef GAMEWINDOW_HPP_ #define GAMEWINDOW_HPP_ -#include "libwiigui/gui.h" -#include "libwiigui/gui_diskcover.h" +#include "GUI/gui.h" +#include "GUI/gui_diskcover.h" #include "menu/GameBrowseMenu.hpp" #define FAVORITE_STARS 5 diff --git a/source/prompts/HomebrewPrompt.cpp b/source/prompts/HomebrewPrompt.cpp new file mode 100644 index 00000000..c143f2d5 --- /dev/null +++ b/source/prompts/HomebrewPrompt.cpp @@ -0,0 +1,176 @@ +/**************************************************************************** + * Copyright (C) 2011 + * by Dimok + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any + * damages arising from the use of this software. + * + * Permission is granted to anyone to use this software for any + * purpose, including commercial applications, and to alter it and + * redistribute it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you + * must not claim that you wrote the original software. If you use + * this software in a product, an acknowledgment in the product + * documentation would be appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and + * must not be misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + ***************************************************************************/ +#include +#include "HomebrewPrompt.hpp" +#include "themes/gettheme.h" +#include "themes/Resources.h" +#include "language/gettext.h" +#include "utils/StringTools.h" +#include "menu/menus.h" + +HomebrewPrompt::HomebrewPrompt(const char *name, const char *coder, const char *version, + const char *release_date, const char *long_description, + GuiImageData * iconImgData, u64 filesize) + : PromptWindow(NULL, NULL) +{ + SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); + SetPosition(0, 6); + + whiteBox = Resources::GetImageData("bg_options.png"); + + iconImg = new GuiImage(iconImgData); + iconImg->SetAlignment(ALIGN_LEFT, ALIGN_TOP); + iconImg->SetPosition(45, 10); + + dialogBoxImg->SetSkew(0, -80, 0, -80, 0, 50, 0, 50); + dialogBoxImg->SetWidescreen(false); + + whiteBoxImg = new GuiImage(whiteBox); + whiteBoxImg->SetPosition(0, 110); + whiteBoxImg->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); + whiteBoxImg->SetSkew(0, 0, 0, 0, 0, -120, 0, -120); + + nameTxt = new GuiText(name, 30, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + nameTxt->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); + nameTxt->SetPosition(0, -15); + nameTxt->SetMaxWidth(430, SCROLL_HORIZONTAL); + + coderTxt = new GuiText(fmt(tr( "Coded by: %s" ), coder), 16, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + coderTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); + coderTxt->SetPosition(180, 30); + coderTxt->SetMaxWidth(280); + + versionTxt = new GuiText(fmt(tr( "Version: %s" ), version), 16, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + versionTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); + versionTxt->SetPosition(40, 65); + versionTxt->SetMaxWidth(430); + + release_dateTxt = new GuiText(release_date, 16, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + release_dateTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); + release_dateTxt->SetPosition(40, 85); + release_dateTxt->SetMaxWidth(430); + + const int pagesize = 6; + long_descriptionTxt = new Text(long_description, 20, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + long_descriptionTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); + long_descriptionTxt->SetPosition(46, 117); + long_descriptionTxt->SetMaxWidth(358); + long_descriptionTxt->SetLinesToDraw(pagesize); + long_descriptionTxt->Refresh(); + + //convert filesize from u64 to char and put unit of measurement after it + char filesizeCH[15]; + if (filesize <= 1024.0) + snprintf(filesizeCH, sizeof(filesizeCH), "%lld B", filesize); + if (filesize > 1024.0) + snprintf(filesizeCH, sizeof(filesizeCH), "%0.2f KB", filesize / 1024.0); + if (filesize > 1048576.0) + snprintf(filesizeCH, sizeof(filesizeCH), "%0.2f MB", filesize / 1048576.0); + + filesizeTxt = new GuiText(filesizeCH, 16, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + filesizeTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); + filesizeTxt->SetPosition(-40, 12); + + scrollBar = new GuiScrollbar(150); + scrollBar->SetAlignment(ALIGN_LEFT, ALIGN_TOP); + scrollBar->SetPosition(393, 115); + scrollBar->SetPageSize(pagesize); + scrollBar->SetEntrieCount(long_descriptionTxt->GetTotalLinesCount()); + scrollBar->listChanged.connect(this, &HomebrewPrompt::onListChange); + + Append(whiteBoxImg); + if(strcmp(long_description, "") != 0 && long_descriptionTxt->GetTotalLinesCount() > pagesize) + Append(scrollBar); + + if(strcmp(name, "") != 0) Append(nameTxt); + if(strcmp(version, "") != 0) Append(versionTxt); + if(strcmp(coder, "") != 0) Append(coderTxt); + if(strcmp(release_date, "") != 0) Append(release_dateTxt); + if(strcmp(long_description, "") != 0) Append(long_descriptionTxt); + Append(filesizeTxt); + Append(iconImg); + + AddButton(tr( "Load" )); + AddButton(tr( "Back" )); + + Button[0]->SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); + Button[0]->SetPosition(40, 2); + Button[1]->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); + Button[1]->SetPosition(-40, 2); +} + +HomebrewPrompt::~HomebrewPrompt() +{ + ResumeGui(); + + SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50); + while(parentElement && this->GetEffect() > 0) usleep(100); + + if(parentElement) + ((GuiWindow *) parentElement)->Remove(this); + parentElement = NULL; + + RemoveAll(); + + delete whiteBox; + delete iconImg; + delete whiteBoxImg; + delete nameTxt; + delete coderTxt; + delete versionTxt; + delete release_dateTxt; + delete long_descriptionTxt; + delete filesizeTxt; + delete scrollBar; +} + +void HomebrewPrompt::onListChange(int SelItem, int SelInd) +{ + long_descriptionTxt->SetTextLine(SelItem+SelInd); +} + +int HomebrewPrompt::MainLoop() +{ + int choice = -1; + + while (choice == -1) + { + usleep(100); + + if (shutdown) + { + wiilight(0); + Sys_Shutdown(); + } + else if (reset) + { + wiilight(0); + Sys_Reboot(); + } + + choice = GetChoice(); + } + + return choice; +} diff --git a/source/prompts/HomebrewPrompt.hpp b/source/prompts/HomebrewPrompt.hpp new file mode 100644 index 00000000..44a4b36b --- /dev/null +++ b/source/prompts/HomebrewPrompt.hpp @@ -0,0 +1,56 @@ +/**************************************************************************** + * Copyright (C) 2011 + * by Dimok + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any + * damages arising from the use of this software. + * + * Permission is granted to anyone to use this software for any + * purpose, including commercial applications, and to alter it and + * redistribute it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you + * must not claim that you wrote the original software. If you use + * this software in a product, an acknowledgment in the product + * documentation would be appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and + * must not be misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + ***************************************************************************/ +#ifndef HOMEBREWPROMPT_HPP_ +#define HOMEBREWPROMPT_HPP_ + +#include "GUI/gui_scrollbar.hpp" +#include "GUI/Text.hpp" +#include "PromptWindow.hpp" + +class HomebrewPrompt : public PromptWindow, public sigslot::has_slots<> +{ + public: + HomebrewPrompt(const char *name, const char *coder, const char *version, + const char *release_date, const char *long_description, + GuiImageData * iconImgData, u64 filesize); + ~HomebrewPrompt(); + int MainLoop(); + private: + void onListChange(int SelItem, int SelInd); + + GuiImageData *whiteBox; + + GuiImage *whiteBoxImg; + GuiImage *iconImg; + + GuiText *nameTxt; + GuiText *coderTxt; + GuiText *versionTxt; + GuiText *release_dateTxt; + GuiText *filesizeTxt; + Text *long_descriptionTxt; + GuiScrollbar *scrollBar; +}; + +#endif diff --git a/source/prompts/ProgressWindow.cpp b/source/prompts/ProgressWindow.cpp index 10d2f9df..e67cf1a4 100644 --- a/source/prompts/ProgressWindow.cpp +++ b/source/prompts/ProgressWindow.cpp @@ -14,7 +14,7 @@ #include "menu/menus.h" #include "sys.h" #include "language/gettext.h" -#include "libwiigui/gui.h" +#include "GUI/gui.h" #include "prompts/ProgressWindow.h" #include "usbloader/wbfs.h" #include "usbloader/utils.h" @@ -246,7 +246,7 @@ static void ProgressWindow(const char *title, const char *msg1, const char *msg2 GuiImage progressbarEmptyImg(&progressbarEmpty); progressbarEmptyImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); progressbarEmptyImg.SetPosition(35, 40); - progressbarEmptyImg.SetTile(100); + progressbarEmptyImg.SetTileHorizontal(100); GuiImageData progressbar(Resources::GetFile("progressbar.png"), Resources::GetFileSize("progressbar.png")); GuiImage progressbarImg(&progressbar); @@ -295,7 +295,7 @@ static void ProgressWindow(const char *title, const char *msg1, const char *msg2 progressbarOutlineImg.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); progressbarOutlineImg.SetPosition(0, 40); progressbarEmptyImg.SetPosition(80, 40); - progressbarEmptyImg.SetTile(78); + progressbarEmptyImg.SetTileHorizontal(78); progressbarImg.SetPosition(80, 40); msg1Txt.SetMaxWidth(380, DOTTED); msg2Txt.SetMaxWidth(380, DOTTED); @@ -308,7 +308,7 @@ static void ProgressWindow(const char *title, const char *msg1, const char *msg2 sizeTxt.SetFontSize(20); } - GuiText cancelTxt(tr( "Cancel" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + GuiText cancelTxt(tr( "Cancel" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); GuiImage cancelImg(&btnOutline); if (Settings.wsprompt) { diff --git a/source/prompts/PromptWindow.cpp b/source/prompts/PromptWindow.cpp index cac125eb..11be5f48 100644 --- a/source/prompts/PromptWindow.cpp +++ b/source/prompts/PromptWindow.cpp @@ -191,7 +191,7 @@ void PromptWindow::AddButton(const char *text) ButtonImg.resize(size+1); Button.resize(size+1); - ButtonTxt[size] = new GuiText(text, 20, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + ButtonTxt[size] = new GuiText(text, 20, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); ButtonImg[size] = new GuiImage(btnOutline); if (Settings.wsprompt) { diff --git a/source/prompts/PromptWindow.hpp b/source/prompts/PromptWindow.hpp index 7f83f3ee..59c895de 100644 --- a/source/prompts/PromptWindow.hpp +++ b/source/prompts/PromptWindow.hpp @@ -24,7 +24,7 @@ #ifndef _PROMPTWINDOW_HPP_ #define _PROMPTWINDOW_HPP_ -#include "libwiigui/gui.h" +#include "GUI/gui.h" class PromptWindow : public GuiWindow { diff --git a/source/prompts/PromptWindows.cpp b/source/prompts/PromptWindows.cpp index 4421db10..989d4f2f 100644 --- a/source/prompts/PromptWindows.cpp +++ b/source/prompts/PromptWindows.cpp @@ -14,9 +14,9 @@ #include "usbloader/GameList.h" #include "usbloader/utils.h" #include "language/gettext.h" -#include "libwiigui/gui.h" -#include "libwiigui/gui_diskcover.h" -#include "libwiigui/Text.hpp" +#include "GUI/gui.h" +#include "GUI/gui_diskcover.h" +#include "GUI/Text.hpp" #include "settings/CGameStatistics.h" #include "settings/GameTitles.h" #include "network/networkops.h" @@ -72,7 +72,7 @@ int OnScreenNumpad(char * var, u32 maxlen) GuiTrigger trigB; trigB.SetSimpleTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B); - GuiText okBtnTxt(tr( "OK" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + GuiText okBtnTxt(tr( "OK" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); GuiImage okBtnImg(&btnOutline); if (Settings.wsprompt) { @@ -81,7 +81,7 @@ int OnScreenNumpad(char * var, u32 maxlen) } GuiButton okBtn(&okBtnImg, &okBtnImg, 0, 4, 5, -15, &trigA, btnSoundOver, btnSoundClick2, 1); okBtn.SetLabel(&okBtnTxt); - GuiText cancelBtnTxt(tr( "Cancel" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + GuiText cancelBtnTxt(tr( "Cancel" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); GuiImage cancelBtnImg(&btnOutline); if (Settings.wsprompt) { @@ -95,6 +95,8 @@ int OnScreenNumpad(char * var, u32 maxlen) numpad.Append(&okBtn); numpad.Append(&cancelBtn); + int oldState = mainWindow->GetState(); + HaltGui(); mainWindow->SetState(STATE_DISABLED); mainWindow->Append(&numpad); @@ -117,7 +119,7 @@ int OnScreenNumpad(char * var, u32 maxlen) HaltGui(); mainWindow->Remove(&numpad); - mainWindow->SetState(STATE_DEFAULT); + mainWindow->SetState(oldState); ResumeGui(); gprintf("\t%s", (save == 1 ? "saved" : "discarded")); return save; @@ -145,7 +147,7 @@ int OnScreenKeyboard(char * var, u32 maxlen, int min) GuiTrigger trigB; trigB.SetSimpleTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B); - GuiText okBtnTxt(tr( "OK" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + GuiText okBtnTxt(tr( "OK" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); GuiImage okBtnImg(&btnOutline); if (Settings.wsprompt) { @@ -154,7 +156,7 @@ int OnScreenKeyboard(char * var, u32 maxlen, int min) } GuiButton okBtn(&okBtnImg, &okBtnImg, 0, 4, 5, 15, &trigA, btnSoundOver, btnSoundClick2, 1); okBtn.SetLabel(&okBtnTxt); - GuiText cancelBtnTxt(tr( "Cancel" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + GuiText cancelBtnTxt(tr( "Cancel" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); GuiImage cancelBtnImg(&btnOutline); if (Settings.wsprompt) { @@ -168,6 +170,8 @@ int OnScreenKeyboard(char * var, u32 maxlen, int min) keyboard.Append(&okBtn); keyboard.Append(&cancelBtn); + int oldState = mainWindow->GetState(); + HaltGui(); mainWindow->SetState(STATE_DISABLED); mainWindow->Append(&keyboard); @@ -190,7 +194,7 @@ int OnScreenKeyboard(char * var, u32 maxlen, int min) HaltGui(); mainWindow->Remove(&keyboard); - mainWindow->SetState(STATE_DEFAULT); + mainWindow->SetState(oldState); ResumeGui(); gprintf("\t%s", (save ? "saved" : "discarded")); return save; @@ -549,6 +553,7 @@ int WindowPrompt(const char *title, const char *msg, const char *btn1Label, cons if(btn4Label) Window->AddButton(btn4Label); + int oldState = mainWindow->GetState(); mainWindow->SetState(STATE_DISABLED); mainWindow->Append(Window); mainWindow->ChangeFocus(Window); @@ -574,7 +579,7 @@ int WindowPrompt(const char *title, const char *msg, const char *btn1Label, cons delete Window; - mainWindow->SetState(STATE_DEFAULT); + mainWindow->SetState(oldState); gprintf(" %i\n", choice); return choice; @@ -645,7 +650,7 @@ int WindowExitPrompt() batteryImg[i] = new GuiImage(&battery); batteryImg[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); batteryImg[i]->SetPosition(36, 0); - batteryImg[i]->SetTile(0); + batteryImg[i]->SetTileHorizontal(0); batteryBarImg[i] = new GuiImage(&batteryBar); batteryBarImg[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); batteryBarImg[i]->SetPosition(33, 0); @@ -769,6 +774,8 @@ int WindowExitPrompt() promptWindow.Append(batteryBtn[2]); promptWindow.Append(batteryBtn[3]); + int oldState = mainWindow->GetState(); + HaltGui(); mainWindow->SetState(STATE_DISABLED); mainWindow->Append(&promptWindow); @@ -796,13 +803,13 @@ int WindowExitPrompt() batteryBarImg[i]->SetImage(&batteryBar); } - batteryImg[i]->SetTile(level); + batteryImg[i]->SetTileHorizontal(level); batteryBtn[i]->SetAlpha(255); } else // controller not connected { - batteryImg[i]->SetTile(0); + batteryImg[i]->SetTileHorizontal(0); batteryImg[i]->SetImage(&battery); batteryBtn[i]->SetAlpha(70); } @@ -908,7 +915,7 @@ int WindowExitPrompt() homein->Stop(); delete homein; mainWindow->Remove(&promptWindow); - mainWindow->SetState(STATE_DEFAULT); + mainWindow->SetState(oldState); while (homeout->IsPlaying() > 0) usleep(100); homeout->Stop(); @@ -961,7 +968,7 @@ int DiscWait(const char *title, const char *msg, const char *btn1Label, const ch msgTxt.SetPosition(0, -40); msgTxt.SetMaxWidth(430); - GuiText btn1Txt(btn1Label, 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + GuiText btn1Txt(btn1Label, 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt) { @@ -985,7 +992,7 @@ int DiscWait(const char *title, const char *msg, const char *btn1Label, const ch btn1.SetTrigger(&trigB); btn1.SetState(STATE_SELECTED); - GuiText btn2Txt(btn2Label, 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + GuiText btn2Txt(btn2Label, 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); GuiImage btn2Img(&btnOutline); if (Settings.wsprompt) { @@ -1185,7 +1192,7 @@ bool NetworkInitPrompt() msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); msgTxt.SetPosition(0, -40); - GuiText btn1Txt(tr( "Cancel" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + GuiText btn1Txt(tr( "Cancel" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt) { @@ -1283,7 +1290,7 @@ int CodeDownload(const char *id) msg2Txt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); msg2Txt.SetPosition(0, 50); - GuiText btn1Txt(tr( "Cancel" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + GuiText btn1Txt(tr( "Cancel" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt) { @@ -1399,217 +1406,3 @@ int CodeDownload(const char *id) return ret; } -/**************************************************************************** - * HBCWindowPrompt - * - * Displays a prompt window to user, with information, an error message, or - * presenting a user with a choice of up to 2 Buttons. - * - ***************************************************************************/ -int HBCWindowPrompt(const char *name, const char *coder, const char *version, const char *release_date, - const char *long_description, GuiImageData * iconImgData, u64 filesize) -{ - int choice = -1; - - GuiWindow promptWindow(472, 320); - promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); - promptWindow.SetPosition(0, 6); - - GuiTrigger trigA; - trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); - GuiTrigger trigB; - trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B); - GuiTrigger trigU; - trigU.SetButtonOnlyTrigger(-1, WPAD_BUTTON_UP | WPAD_CLASSIC_BUTTON_UP, PAD_BUTTON_UP); - GuiTrigger trigD; - trigD.SetButtonOnlyTrigger(-1, WPAD_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_DOWN, PAD_BUTTON_DOWN); - - GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png")); - GuiImageData dialogBox(Resources::GetFile("dialogue_box.png"), Resources::GetFileSize("dialogue_box.png")); - GuiImageData whiteBox(Resources::GetFile("bg_options.png"), Resources::GetFileSize("bg_options.png")); - - GuiImageData scrollbar(Resources::GetFile("scrollbar.png"), Resources::GetFileSize("scrollbar.png")); - GuiImage scrollbarImg(&scrollbar); - scrollbarImg.SetAlignment(ALIGN_RIGHT, ALIGN_TOP); - scrollbarImg.SetPosition(-40, 114); - scrollbarImg.SetSkew(0, 0, 0, 0, 0, -120, 0, -120); - - GuiImageData arrowDown(Resources::GetFile("scrollbar_arrowdown.png"), Resources::GetFileSize("scrollbar_arrowdown.png")); - GuiImage arrowDownImg(&arrowDown); - arrowDownImg.SetScale(.8); - - GuiImageData arrowUp(Resources::GetFile("scrollbar_arrowup.png"), Resources::GetFileSize("scrollbar_arrowup.png")); - GuiImage arrowUpImg(&arrowUp); - arrowUpImg.SetScale(.8); - - GuiButton arrowUpBtn(arrowUpImg.GetWidth(), arrowUpImg.GetHeight()); - arrowUpBtn.SetImage(&arrowUpImg); - arrowUpBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP); - arrowUpBtn.SetPosition(-25, 91); - arrowUpBtn.SetTrigger(&trigA); - arrowUpBtn.SetTrigger(&trigU); - arrowUpBtn.SetEffectOnOver(EFFECT_SCALE, 50, 130); - arrowUpBtn.SetSoundClick(btnSoundClick2); - - GuiButton arrowDownBtn(arrowDownImg.GetWidth(), arrowDownImg.GetHeight()); - arrowDownBtn.SetImage(&arrowDownImg); - arrowDownBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); - arrowDownBtn.SetPosition(-25, -27); - arrowDownBtn.SetTrigger(&trigA); - arrowDownBtn.SetTrigger(&trigD); - arrowDownBtn.SetEffectOnOver(EFFECT_SCALE, 50, 130); - arrowDownBtn.SetSoundClick(btnSoundClick2); - - GuiImage *iconImg = new GuiImage(iconImgData); - iconImg->SetAlignment(ALIGN_LEFT, ALIGN_TOP); - iconImg->SetPosition(45, 10); - - GuiImage dialogBoxImg(&dialogBox); - dialogBoxImg.SetSkew(0, -80, 0, -80, 0, 50, 0, 50); - - GuiImage whiteBoxImg(&whiteBox); - whiteBoxImg.SetPosition(0, 110); - whiteBoxImg.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); - whiteBoxImg.SetSkew(0, 0, 0, 0, 0, -120, 0, -120); - - GuiText nameTxt(name, 30, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); - nameTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); - nameTxt.SetPosition(0, -15); - nameTxt.SetMaxWidth(430, SCROLL_HORIZONTAL); - - GuiText coderTxt(fmt(tr( "Coded by: %s" ), coder), 16, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); - coderTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); - coderTxt.SetPosition(180, 30); - coderTxt.SetMaxWidth(280); - - GuiText versionTxt(fmt(tr( "Version: %s" ), version), 16, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); - versionTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); - versionTxt.SetPosition(40, 65); - versionTxt.SetMaxWidth(430); - - GuiText release_dateTxt(release_date, 16, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); - release_dateTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); - release_dateTxt.SetPosition(40, 85); - release_dateTxt.SetMaxWidth(430); - - int pagesize = 6; - Text long_descriptionTxt(long_description, 20, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); - long_descriptionTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); - long_descriptionTxt.SetPosition(46, 117); - long_descriptionTxt.SetMaxWidth(360); - long_descriptionTxt.SetLinesToDraw(pagesize); - long_descriptionTxt.Refresh(); - - //convert filesize from u64 to char and put unit of measurement after it - char filesizeCH[15]; - if (filesize <= 1024.0) - snprintf(filesizeCH, sizeof(filesizeCH), "%lld B", filesize); - if (filesize > 1024.0) - snprintf(filesizeCH, sizeof(filesizeCH), "%0.2f KB", filesize / 1024.0); - if (filesize > 1048576.0) - snprintf(filesizeCH, sizeof(filesizeCH), "%0.2f MB", filesize / 1048576.0); - - GuiText filesizeTxt(filesizeCH, 16, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); - filesizeTxt.SetAlignment(ALIGN_RIGHT, ALIGN_TOP); - filesizeTxt.SetPosition(-40, 12); - - GuiText btn1Txt(tr( "Load" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); - GuiImage btn1Img(&btnOutline); - if (Settings.wsprompt) - { - btn1Txt.SetWidescreen(Settings.widescreen); - btn1Img.SetWidescreen(Settings.widescreen); - } - - GuiButton btn1(&btn1Img, &btn1Img, 0, 3, 0, 0, &trigA, btnSoundOver, btnSoundClick2, 1); - btn1.SetLabel(&btn1Txt); - btn1.SetState(STATE_SELECTED); - - GuiText btn2Txt(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); - GuiImage btn2Img(&btnOutline); - if (Settings.wsprompt) - { - btn2Txt.SetWidescreen(Settings.widescreen); - btn2Img.SetWidescreen(Settings.widescreen); - } - GuiButton btn2(&btn2Img, &btn2Img, 0, 3, 0, 0, &trigA, btnSoundOver, btnSoundClick2, 1); - btn2.SetLabel(&btn2Txt); - btn2.SetTrigger(&trigB); - - btn1.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); - btn1.SetPosition(40, 2); - btn2.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); - btn2.SetPosition(-40, 2); - - promptWindow.Append(&dialogBoxImg); - promptWindow.Append(&whiteBoxImg); - promptWindow.Append(&scrollbarImg); - promptWindow.Append(&arrowDownBtn); - promptWindow.Append(&arrowUpBtn); - - if(strcmp(name, "") != 0) promptWindow.Append(&nameTxt); - if(strcmp(version, "") != 0) promptWindow.Append(&versionTxt); - if(strcmp(coder, "") != 0) promptWindow.Append(&coderTxt); - if(strcmp(release_date, "") != 0) promptWindow.Append(&release_dateTxt); - if(strcmp(long_description, "") != 0) promptWindow.Append(&long_descriptionTxt); - promptWindow.Append(&filesizeTxt); - promptWindow.Append(iconImg); - promptWindow.Append(&btn1); - promptWindow.Append(&btn2); - - promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50); - HaltGui(); - mainWindow->SetState(STATE_DISABLED); - mainWindow->Append(&promptWindow); - mainWindow->ChangeFocus(&promptWindow); - ResumeGui(); - - while (choice == -1) - { - VIDEO_WaitVSync(); - - if (shutdown == 1) - { - wiilight(0); - Sys_Shutdown(); - } - else if (reset == 1) - { - wiilight(0); - Sys_Reboot(); - } - - if (btn1.GetState() == STATE_CLICKED) - choice = 1; - else if (btn2.GetState() == STATE_CLICKED) - choice = 0; - - else if (arrowUpBtn.GetState() == STATE_CLICKED || arrowUpBtn.GetState() == STATE_HELD) - { - long_descriptionTxt.PreviousLine(); - - usleep(6000); - if (!((ButtonsHold() & WPAD_BUTTON_UP) || (ButtonsHold() & PAD_BUTTON_UP))) arrowUpBtn.ResetState(); - } - else if (arrowDownBtn.GetState() == STATE_CLICKED || arrowDownBtn.GetState() == STATE_HELD) - { - long_descriptionTxt.NextLine(); - - usleep(60000); - if (!((ButtonsHold() & WPAD_BUTTON_DOWN) || (ButtonsHold() & PAD_BUTTON_DOWN))) arrowDownBtn.ResetState(); - } - } - - promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50); - while (promptWindow.GetEffect() > 0) - usleep(100); - HaltGui(); - mainWindow->Remove(&promptWindow); - mainWindow->SetState(STATE_DEFAULT); - ResumeGui(); - - delete iconImg; - - return choice; -} - diff --git a/source/prompts/PromptWindows.h b/source/prompts/PromptWindows.h index 7f58570b..1e14d03f 100644 --- a/source/prompts/PromptWindows.h +++ b/source/prompts/PromptWindows.h @@ -8,7 +8,7 @@ #ifndef _PROMPTWINDOWS_H_ #define _PROMPTWINDOWS_H_ -#include "libwiigui/gui.h" +#include "GUI/gui.h" int WindowPrompt(const char *title, const char *msg = NULL, const char * btn1Label = NULL, const char * btn2Label = NULL, const char * btn3Label = NULL, const char * btn4Label = NULL, int wait = -1); @@ -22,7 +22,5 @@ int FormatingPartition(const char *title, int part_num); bool NetworkInitPrompt(); int WindowScreensaver(); int CodeDownload(const char *id); -int HBCWindowPrompt(const char *name, const char *coder, const char *version, const char *release_date, - const char *long_description, GuiImageData * iconImgData, u64 filesize); #endif diff --git a/source/prompts/TitleBrowser.cpp b/source/prompts/TitleBrowser.cpp index dfc57ecc..12ff4b5e 100644 --- a/source/prompts/TitleBrowser.cpp +++ b/source/prompts/TitleBrowser.cpp @@ -9,8 +9,8 @@ #include #include "language/gettext.h" -#include "libwiigui/gui.h" -#include "libwiigui/gui_customoptionbrowser.h" +#include "GUI/gui.h" +#include "GUI/gui_optionbrowser.h" #include "prompts/PromptWindows.h" #include "prompts/ProgressWindow.h" #include "network/networkops.h" @@ -134,7 +134,7 @@ bool TitleSelector(char output[]) GuiTrigger trigB; trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B); - GuiText cancelBtnTxt(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + GuiText cancelBtnTxt(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30); GuiImage cancelBtnImg(&btnOutline); if (Settings.wsprompt) @@ -146,7 +146,7 @@ bool TitleSelector(char output[]) cancelBtn.SetLabel(&cancelBtnTxt); cancelBtn.SetTrigger(&trigB); - GuiCustomOptionBrowser optionBrowser4(396, 280, &options4, "bg_options_settings.png"); + GuiOptionBrowser optionBrowser4(396, 280, &options4, "bg_options_settings.png"); optionBrowser4.SetPosition(0, 90); optionBrowser4.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); @@ -370,7 +370,7 @@ int TitleBrowser() settingsbackgroundbtn.SetPosition(0, 0); settingsbackgroundbtn.SetImage(&settingsbackground); - GuiText cancelBtnTxt(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + GuiText cancelBtnTxt(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30); GuiImage cancelBtnImg(&btnOutline); if (Settings.wsprompt) @@ -383,11 +383,11 @@ int TitleBrowser() cancelBtn.SetLabel(&cancelBtnTxt); cancelBtn.SetTrigger(&trigB); - GuiCustomOptionBrowser optionBrowser3(396, 280, &options3, "bg_options_settings.png"); + GuiOptionBrowser optionBrowser3(396, 280, &options3, "bg_options_settings.png"); optionBrowser3.SetPosition(0, 90); optionBrowser3.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); - GuiImageData wifiImgData(Resources::GetFile("Wifi_btn.png"), Resources::GetFileSize("Wifi_btn.png")); + GuiImageData wifiImgData(Resources::GetFile("wifi_btn.png"), Resources::GetFileSize("wifi_btn.png")); GuiImage wifiImg(&wifiImgData); if (Settings.wsprompt) { diff --git a/source/prompts/filebrowser.cpp b/source/prompts/filebrowser.cpp index 5aeea416..5db465e2 100644 --- a/source/prompts/filebrowser.cpp +++ b/source/prompts/filebrowser.cpp @@ -25,7 +25,7 @@ #include "FileOperations/fileops.h" #include "language/gettext.h" #include "PromptWindows.h" -#include "libwiigui/gui.h" +#include "GUI/gui_filebrowser.h" #include "sys.h" #include "filebrowser.h" @@ -355,7 +355,7 @@ int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*= usbBtn.SetTrigger(&trigA); usbBtn.SetEffectGrow(); - GuiText okBtnTxt(tr( "OK" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + GuiText okBtnTxt(tr( "OK" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); GuiImage okBtnImg(&btnOutline); if (Settings.wsprompt) { @@ -444,7 +444,7 @@ int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*= LOCK( &fileBrowser ); ParseDirectory((char*) NULL, Flags, Filter); fileBrowser.ResetState(); - fileBrowser.TriggerUpdate(); + fileBrowser.UpdateList(); AdressText.SetTextf("%s%s", browser->rootdir, browser->dir); } clickedIndex = -1; @@ -480,7 +480,7 @@ int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*= if (ParseDirectory((curDevice + i) % browsers.size(), Flags, Filter) == 0) { fileBrowser.ResetState(); - fileBrowser.TriggerUpdate(); + fileBrowser.UpdateList(); AdressText.SetTextf("%s%s", browser->rootdir, browser->dir); usbBtnTxt.SetText(browsers[(curDevice + 1) % browsers.size()].rootdir); break; @@ -520,7 +520,7 @@ int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*= if (ParseDirectory(newfolder, Flags, Filter) == 0) { fileBrowser.ResetState(); - fileBrowser.TriggerUpdate(); + fileBrowser.UpdateList(); AdressText.SetTextf("%s%s", browser->rootdir, browser->dir); usbBtnTxt.SetText(browsers[(curDevice + 1) % browsers.size()].rootdir); } diff --git a/source/prompts/gameinfo.cpp b/source/prompts/gameinfo.cpp index efe212db..daffcdf2 100644 --- a/source/prompts/gameinfo.cpp +++ b/source/prompts/gameinfo.cpp @@ -8,8 +8,8 @@ #include "usbloader/wbfs.h" #include "settings/CGameCategories.hpp" #include "language/gettext.h" -#include "libwiigui/gui.h" -#include "libwiigui/Text.hpp" +#include "GUI/gui.h" +#include "GUI/Text.hpp" #include "xml/xml.h" #include "menu.h" #include "menu/menus.h" @@ -389,6 +389,9 @@ static int InternalShowGameInfo(char *ID) else if (GameInfo.Players == 2) playersImgData = Resources::GetImageData("wiimote2.png"); + else if (GameInfo.Players == 3) + playersImgData = Resources::GetImageData("wiimote3.png"); + else if (GameInfo.Players == 4) playersImgData = Resources::GetImageData("wiimote4.png"); diff --git a/source/settings/CCategoryList.hpp b/source/settings/CCategoryList.hpp index 6ebc4a5a..6cb6c2da 100644 --- a/source/settings/CCategoryList.hpp +++ b/source/settings/CCategoryList.hpp @@ -51,6 +51,7 @@ class CCategoryList bool findCategory(unsigned int id) { listIter = nameList.find(id); return listIter != nameList.end(); }; int pos() const { return distance(nameList.begin(), listIter); } int size() const { return nameList.size(); } + void clear() { nameList.clear(); } private: string configPath; map::const_iterator listIter; diff --git a/source/settings/CGameCategories.cpp b/source/settings/CGameCategories.cpp index 12710ff3..32c4fb33 100644 --- a/source/settings/CGameCategories.cpp +++ b/source/settings/CGameCategories.cpp @@ -98,6 +98,8 @@ bool CGameCategories::Load(string filepath) if(!buffer) return false; + clear(); + mxml_node_t *xmlfile = mxmlLoadString(NULL, (const char *) buffer, MXML_OPAQUE_CALLBACK); if(!ValidVersion(xmlfile)) diff --git a/source/settings/CGameCategories.hpp b/source/settings/CGameCategories.hpp index 8adcee0f..41da6113 100644 --- a/source/settings/CGameCategories.hpp +++ b/source/settings/CGameCategories.hpp @@ -51,6 +51,7 @@ class CGameCategories const vector &operator[](const char *gameID) const; const vector &operator[](const unsigned char *gameID) const { return operator[]((const char *) gameID); } bool ImportFromWiiTDB(const string &xmlpath); + void clear() { List.clear(); CategoryList.clear(); }; static bool isInCategory(const char *gameID, unsigned int id); CCategoryList CategoryList; diff --git a/source/settings/SettingsPrompts.cpp b/source/settings/SettingsPrompts.cpp index e7f8845e..163dd56e 100644 --- a/source/settings/SettingsPrompts.cpp +++ b/source/settings/SettingsPrompts.cpp @@ -6,8 +6,8 @@ #include "language/UpdateLanguage.h" #include "prompts/PromptWindows.h" #include "prompts/ProgressWindow.h" -#include "libwiigui/gui.h" -#include "libwiigui/gui_customoptionbrowser.h" +#include "GUI/gui.h" +#include "GUI/gui_optionbrowser.h" #include "settings/CSettings.h" #include "settings/GameTitles.h" #include "themes/CTheme.h" @@ -128,7 +128,7 @@ int MenuLanguageSelect() oggmenubackground.SetAlignment( ALIGN_LEFT, ALIGN_TOP ); oggmenubackground.SetPosition( 0, 0 ); - GuiText backBtnTxt( tr( "Back" ) , 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + GuiText backBtnTxt( tr( "Back" ) , 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); backBtnTxt.SetMaxWidth( btnOutline.GetWidth() - 30 ); GuiImage backBtnImg( &btnOutline ); if ( Settings.wsprompt == ON ) @@ -147,7 +147,7 @@ int MenuLanguageSelect() backBtn.SetTrigger( &trigB ); backBtn.SetEffectGrow(); - GuiText defaultBtnTxt( tr( "Default" ) , 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + GuiText defaultBtnTxt( tr( "Default" ) , 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); defaultBtnTxt.SetMaxWidth( btnOutline.GetWidth() - 30 ); GuiImage defaultBtnImg( &btnOutline ); if ( Settings.wsprompt == ON ) @@ -165,7 +165,7 @@ int MenuLanguageSelect() defaultBtn.SetTrigger( &trigA ); defaultBtn.SetEffectGrow(); - GuiText updateBtnTxt( tr( "Update Files" ) , 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + GuiText updateBtnTxt( tr( "Update Files" ) , 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); updateBtnTxt.SetMaxWidth( btnOutline.GetWidth() - 30 ); GuiImage updateBtnImg( &btnOutline ); if ( Settings.wsprompt == ON ) @@ -196,7 +196,7 @@ int MenuLanguageSelect() } - GuiCustomOptionBrowser optionBrowser4( 396, 280, &options2, "bg_options_settings.png"); + GuiOptionBrowser optionBrowser4( 396, 280, &options2, "bg_options_settings.png"); optionBrowser4.SetPosition( 0, 90 ); optionBrowser4.SetAlignment( ALIGN_CENTRE, ALIGN_TOP ); diff --git a/source/settings/menus/FlyingButtonsMenu.cpp b/source/settings/menus/FlyingButtonsMenu.cpp index 7fbd7ae7..f6127980 100644 --- a/source/settings/menus/FlyingButtonsMenu.cpp +++ b/source/settings/menus/FlyingButtonsMenu.cpp @@ -81,7 +81,7 @@ FlyingButtonsMenu::FlyingButtonsMenu(const char * menu_title) homeBtn->SetTrigger(trigHome); Append(homeBtn); - backBtnTxt = new GuiText(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + backBtnTxt = new GuiText(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); backBtnTxt->SetMaxWidth(btnOutline->GetWidth() - 30); backBtnImg = new GuiImage(btnOutline); if (Settings.wsprompt == ON) diff --git a/source/settings/menus/FlyingButtonsMenu.hpp b/source/settings/menus/FlyingButtonsMenu.hpp index 5b24e4f0..3efbe745 100644 --- a/source/settings/menus/FlyingButtonsMenu.hpp +++ b/source/settings/menus/FlyingButtonsMenu.hpp @@ -26,7 +26,7 @@ #include #include -#include "libwiigui/gui.h" +#include "GUI/gui.h" #include "SettingsMenu.hpp" #include "menu.h" diff --git a/source/settings/menus/GUISettingsMenu.cpp b/source/settings/menus/GUISettingsMenu.cpp index c28d0b55..ca236730 100644 --- a/source/settings/menus/GUISettingsMenu.cpp +++ b/source/settings/menus/GUISettingsMenu.cpp @@ -127,7 +127,7 @@ GuiSettingsMenu::GuiSettingsMenu() Options->SetName(Idx++, "%s", tr( "Mark new games" )); Options->SetName(Idx++, "%s", tr( "Show Free Space" )); Options->SetName(Idx++, "%s", tr( "HOME Menu" )); - Options->SetName(Idx++, "%s", tr( "Import categories from WiiTDB" )); + Options->SetName(Idx++, "%s", tr( "Import Categories" )); SetOptionValues(); diff --git a/source/settings/menus/GameLoadSM.cpp b/source/settings/menus/GameLoadSM.cpp index 97e9b211..663d0119 100644 --- a/source/settings/menus/GameLoadSM.cpp +++ b/source/settings/menus/GameLoadSM.cpp @@ -103,7 +103,7 @@ GameLoadSM::GameLoadSM(const char * GameID) trigA = new GuiTrigger(); trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); - saveBtnTxt = new GuiText(tr( "Save" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + saveBtnTxt = new GuiText(tr( "Save" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); saveBtnTxt->SetMaxWidth(btnOutline->GetWidth() - 30); saveBtnImg = new GuiImage (btnOutline); if (Settings.wsprompt == ON) diff --git a/source/settings/menus/GameSettingsMenu.cpp b/source/settings/menus/GameSettingsMenu.cpp index 3252c38a..5f8b1f6d 100644 --- a/source/settings/menus/GameSettingsMenu.cpp +++ b/source/settings/menus/GameSettingsMenu.cpp @@ -101,14 +101,9 @@ void GameSettingsMenu::CreateSettingsMenu(int menuNr) else if(menuNr == Idx++) { HideMenu(); - titleTxt = new GuiText(MenuTitle.c_str(), 28, ( GXColor ) {0, 0, 0, 255}); - titleTxt->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); - titleTxt->SetPosition(0, 40); - titleTxt->SetMaxWidth(310, SCROLL_HORIZONTAL); - Append(titleTxt); Remove(backBtn); ResumeGui(); - SetState(STATE_DISABLED); + mainWindow->SetState(STATE_DISABLED); CategorySelectPrompt promptMenu(DiscHeader); promptMenu.SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE); promptMenu.SetEffect(EFFECT_FADE, 20); @@ -125,10 +120,7 @@ void GameSettingsMenu::CreateSettingsMenu(int menuNr) gameList.FilterList(oldFilter.c_str()); browserMenu->ReloadBrowser(); } - SetState(STATE_DEFAULT); - Remove(titleTxt); - delete titleTxt; - titleTxt = NULL; + mainWindow->SetState(STATE_DEFAULT); Append(backBtn); ShowMenu(); } diff --git a/source/settings/menus/SettingsMenu.cpp b/source/settings/menus/SettingsMenu.cpp index fa7b40dc..a6c64171 100644 --- a/source/settings/menus/SettingsMenu.cpp +++ b/source/settings/menus/SettingsMenu.cpp @@ -57,14 +57,14 @@ SettingsMenu::SettingsMenu(const char * title, OptionList * opts, int returnTo) Append(backBtn); } - optionBrowser = new GuiCustomOptionBrowser(396, 280, Options, "bg_options_settings.png"); - optionBrowser->SetPosition(0, 90); - optionBrowser->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); + optionBrowser = new GuiOptionBrowser(396, 280, Options, "bg_options_settings.png"); + optionBrowser->SetAlignment(thAlign("center - settings option browser align hor"), thAlign("top - settings option browser align ver")); + optionBrowser->SetPosition(thInt("0 - settings option browser pos x"), thInt("90 - settings option browser pos y")); - titleTxt = new GuiText(title, 28, (GXColor) {0, 0, 0, 255}); - titleTxt->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); - titleTxt->SetPosition(0, 40); - titleTxt->SetMaxWidth(310, SCROLL_HORIZONTAL); + titleTxt = new GuiText(title, 28, thColor("r=0 g=0 b=0 a=255 - settings title text color")); + titleTxt->SetAlignment(thAlign("center - settings title text align hor"), thAlign("top - settings title text align ver")); + titleTxt->SetPosition(thInt("0 - settings title text pos x"), thInt("40 - settings title text pos y")); + titleTxt->SetMaxWidth(thInt("310 - settings title text max width"), SCROLL_HORIZONTAL); Append(optionBrowser); Append(titleTxt); diff --git a/source/settings/menus/SettingsMenu.hpp b/source/settings/menus/SettingsMenu.hpp index b23a618b..24e08dfd 100644 --- a/source/settings/menus/SettingsMenu.hpp +++ b/source/settings/menus/SettingsMenu.hpp @@ -24,8 +24,8 @@ #ifndef SETTINGS_MENU_HPP_ #define SETTINGS_MENU_HPP_ -#include "libwiigui/gui.h" -#include "libwiigui/gui_customoptionbrowser.h" +#include "GUI/gui.h" +#include "GUI/gui_optionbrowser.h" #include "menu.h" enum @@ -64,7 +64,7 @@ class SettingsMenu : public GuiWindow GuiImage * backBtnImg; GuiButton * backBtn; - GuiCustomOptionBrowser * optionBrowser; + GuiOptionBrowser * optionBrowser; }; diff --git a/source/themes/CTheme.cpp b/source/themes/CTheme.cpp index 1bd5ff97..b3763586 100644 --- a/source/themes/CTheme.cpp +++ b/source/themes/CTheme.cpp @@ -27,7 +27,7 @@ #include #include "CTheme.h" -#include "libwiigui/gui.h" +#include "GUI/gui.h" #include "settings/CSettings.h" #include "FileOperations/fileops.h" #include "menu/menus.h" diff --git a/source/themes/Resources.cpp b/source/themes/Resources.cpp index 3c6d4de6..0834edde 100644 --- a/source/themes/Resources.cpp +++ b/source/themes/Resources.cpp @@ -1,199 +1,8 @@ #include #include #include "FileOperations/fileops.h" -#include "filelist.h" #include "Resources.h" - -RecourceFile Resources::RecourceFiles[] = -{ - {"closebutton.png", closebutton_png, closebutton_png_size, NULL, 0}, - {"gxlogo.png", gxlogo_png, gxlogo_png_size, NULL, 0}, - {"sdcard.png", sdcard_png, sdcard_png_size, NULL, 0}, - {"sdcard_over.png", sdcard_over_png, sdcard_over_png_size, NULL, 0}, - {"Wifi_btn.png", Wifi_btn_png, Wifi_btn_png_size, NULL, 0}, - {"wiimote.png", wiimote_png, wiimote_png_size, NULL, 0}, - {"gameinfo1.png", gameinfo1_png, gameinfo1_png_size, NULL, 0}, - {"gameinfo2.png", gameinfo2_png, gameinfo2_png_size, NULL, 0}, - {"gameinfo1a.png", gameinfo1a_png, gameinfo1a_png_size, NULL, 0}, - {"gameinfo2a.png", gameinfo2a_png, gameinfo2a_png_size, NULL, 0}, - {"credits_button.png", credits_button_png, credits_button_png_size, NULL, 0}, - {"credits_button_over.png", credits_button_over_png, credits_button_over_png_size, NULL, 0}, - {"tooltip_left.png", tooltip_left_png, tooltip_left_png_size, NULL, 0}, - {"tooltip_tile.png", tooltip_tile_png, tooltip_tile_png_size, NULL, 0}, - {"tooltip_right.png", tooltip_right_png, tooltip_right_png_size, NULL, 0}, - {"startgame_arrow_left.png", startgame_arrow_left_png, startgame_arrow_left_png_size, NULL, 0}, - {"startgame_arrow_right.png", startgame_arrow_right_png, startgame_arrow_right_png_size, NULL, 0}, - {"credits_bg.png", credits_bg_png, credits_bg_png_size, NULL, 0}, - {"little_star.png", little_star_png, little_star_png_size, NULL, 0}, - {"background.png", background_png, background_png_size, NULL, 0}, - {"wbackground.png", wbackground_png, wbackground_png_size, NULL, 0}, - {"bg_options_settings.png", bg_options_settings_png, bg_options_settings_png_size, NULL, 0}, - {"settings_background.png", settings_background_png, settings_background_png_size, NULL, 0}, - {"bg_browser.png", bg_browser_png, bg_browser_png_size, NULL, 0}, - {"icon_folder.png", icon_folder_png, icon_folder_png_size, NULL, 0}, - {"bg_browser_selection.png", bg_browser_selection_png, bg_browser_selection_png_size, NULL, 0}, - {"addressbar_textbox.png", addressbar_textbox_png, addressbar_textbox_png_size, NULL, 0}, - {"browser.png", browser_png, browser_png_size, NULL, 0}, - {"browser_over.png", browser_over_png, browser_over_png_size, NULL, 0}, - {"nocover.png", nocover_png, nocover_png_size, NULL, 0}, - {"nocoverFlat.png", nocoverFlat_png, nocoverFlat_png_size, NULL, 0}, - {"nodisc.png", nodisc_png, nodisc_png_size, NULL, 0}, - {"theme_dialogue_box.png", theme_dialogue_box_png, theme_dialogue_box_png_size, NULL, 0}, - {"button_install.png", button_install_png, button_install_png_size, NULL, 0}, - {"button_install_over.png", button_install_over_png, button_install_over_png_size, NULL, 0}, - {"dialogue_box_startgame.png", dialogue_box_startgame_png, dialogue_box_startgame_png_size, NULL, 0}, - {"wdialogue_box_startgame.png", wdialogue_box_startgame_png, wdialogue_box_startgame_png_size, NULL, 0}, - {"button_dialogue_box.png", button_dialogue_box_png, button_dialogue_box_png_size, NULL, 0}, - {"keyboard_textbox.png", keyboard_textbox_png, keyboard_textbox_png_size, NULL, 0}, - {"keyboard_key.png", keyboard_key_png, keyboard_key_png_size, NULL, 0}, - {"keyboard_key_over.png", keyboard_key_over_png, keyboard_key_over_png_size, NULL, 0}, - {"keyboard_mediumkey_over.png", keyboard_mediumkey_over_png, keyboard_mediumkey_over_png_size, NULL, 0}, - {"keyboard_largekey_over.png", keyboard_largekey_over_png, keyboard_largekey_over_png_size, NULL, 0}, - {"keyboard_backspace_over.png", keyboard_backspace_over_png, keyboard_backspace_over_png_size, NULL, 0}, - {"keyboard_clear_over.png", keyboard_clear_over_png, keyboard_clear_over_png_size, NULL, 0}, - {"menu_button.png", menu_button_png, menu_button_png_size, NULL, 0}, - {"menu_button_over.png", menu_button_over_png, menu_button_over_png_size, NULL, 0}, - {"settings_button.png", settings_button_png, settings_button_png_size, NULL, 0}, - {"settings_button_over.png", settings_button_over_png, settings_button_over_png_size, NULL, 0}, - {"wiimote_poweroff.png", wiimote_poweroff_png, wiimote_poweroff_png_size, NULL, 0}, - {"dialogue_box.png", dialogue_box_png, dialogue_box_png_size, NULL, 0}, - {"theme_box.png", theme_box_png, theme_box_png_size, NULL, 0}, - {"wiimote_poweroff_over.png", wiimote_poweroff_over_png, wiimote_poweroff_over_png_size, NULL, 0}, - {"bg_options.png", bg_options_png, bg_options_png_size, NULL, 0}, - {"bg_options_entry.png", bg_options_entry_png, bg_options_entry_png_size, NULL, 0}, - {"scrollbar.png", scrollbar_png, scrollbar_png_size, NULL, 0}, - {"scrollbar_arrowup.png", scrollbar_arrowup_png, scrollbar_arrowup_png_size, NULL, 0}, - {"scrollbar_arrowdown.png", scrollbar_arrowdown_png, scrollbar_arrowdown_png_size, NULL, 0}, - {"scrollbar_box.png", scrollbar_box_png, scrollbar_box_png_size, NULL, 0}, - {"progressbar.png", progressbar_png, progressbar_png_size, NULL, 0}, - {"progressbar_empty.png", progressbar_empty_png, progressbar_empty_png_size, NULL, 0}, - {"progressbar_outline.png", progressbar_outline_png, progressbar_outline_png_size, NULL, 0}, - {"player1_point.png", player1_point_png, player1_point_png_size, NULL, 0}, - {"player2_point.png", player2_point_png, player2_point_png_size, NULL, 0}, - {"player3_point.png", player3_point_png, player3_point_png_size, NULL, 0}, - {"player4_point.png", player4_point_png, player4_point_png_size, NULL, 0}, - {"player1_grab.png", player1_grab_png, player1_grab_png_size, NULL, 0}, - {"player2_grab.png", player2_grab_png, player2_grab_png_size, NULL, 0}, - {"player3_grab.png", player3_grab_png, player3_grab_png_size, NULL, 0}, - {"player4_grab.png", player4_grab_png, player4_grab_png_size, NULL, 0}, - {"rplayer1_point.png", rplayer1_point_png, rplayer1_point_png_size, NULL, 0}, - {"rplayer2_point.png", rplayer2_point_png, rplayer2_point_png_size, NULL, 0}, - {"rplayer3_point.png", rplayer3_point_png, rplayer3_point_png_size, NULL, 0}, - {"rplayer4_point.png", rplayer4_point_png, rplayer4_point_png_size, NULL, 0}, - {"battery.png", battery_png, battery_png_size, NULL, 0}, - {"battery_bar.png", battery_bar_png, battery_bar_png_size, NULL, 0}, - {"battery_white.png", battery_white_png, battery_white_png_size, NULL, 0}, - {"battery_red.png", battery_red_png, battery_red_png_size, NULL, 0}, - {"battery_bar_white.png", battery_bar_white_png, battery_bar_white_png_size, NULL, 0}, - {"battery_bar_red.png", battery_bar_red_png, battery_bar_red_png_size, NULL, 0}, - {"exit_top.png", exit_top_png, exit_top_png_size, NULL, 0}, - {"exit_top_over.png", exit_top_over_png, exit_top_over_png_size, NULL, 0}, - {"exit_bottom.png", exit_bottom_png, exit_bottom_png_size, NULL, 0}, - {"exit_bottom_over.png", exit_bottom_over_png, exit_bottom_over_png_size, NULL, 0}, - {"exit_button.png", exit_button_png, exit_button_png_size, NULL, 0}, - {"favorite.png", favorite_png, favorite_png_size, NULL, 0}, - {"not_favorite.png", not_favorite_png, not_favorite_png_size, NULL, 0}, - {"favIcon.png", favIcon_png, favIcon_png_size, NULL, 0}, - {"favIcon_gray.png", favIcon_gray_png, favIcon_gray_png_size, NULL, 0}, - {"searchIcon.png", searchIcon_png, searchIcon_png_size, NULL, 0}, - {"searchIcon_gray.png", searchIcon_gray_png, searchIcon_gray_png_size, NULL, 0}, - {"abcIcon.png", abcIcon_png, abcIcon_png_size, NULL, 0}, - {"rankIcon.png", rankIcon_png, rankIcon_png_size, NULL, 0}, - {"playCountIcon.png", playCountIcon_png, playCountIcon_png_size, NULL, 0}, - {"playersSort.png", playersSort_png, playersSort_png_size, NULL, 0}, - {"arrangeList.png", arrangeList_png, arrangeList_png_size, NULL, 0}, - {"arrangeList_gray.png", arrangeList_gray_png, arrangeList_gray_png_size, NULL, 0}, - {"arrangeGrid.png", arrangeGrid_png, arrangeGrid_png_size, NULL, 0}, - {"arrangeGrid_gray.png", arrangeGrid_gray_png, arrangeGrid_gray_png_size, NULL, 0}, - {"arrangeCarousel.png", arrangeCarousel_png, arrangeCarousel_png_size, NULL, 0}, - {"arrangeCarousel_gray.png", arrangeCarousel_gray_png, arrangeCarousel_gray_png_size, NULL, 0}, - {"settings_title.png", settings_title_png, settings_title_png_size, NULL, 0}, - {"settings_title_over.png", settings_title_over_png, settings_title_over_png_size, NULL, 0}, - {"pageindicator.png", pageindicator_png, pageindicator_png_size, NULL, 0}, - {"Wiimote1.png", Wiimote1_png, Wiimote1_png_size, NULL, 0}, - {"Wiimote2.png", Wiimote2_png, Wiimote2_png_size, NULL, 0}, - {"Wiimote4.png", Wiimote4_png, Wiimote4_png_size, NULL, 0}, - {"wifi1.png", wifi1_png, wifi1_png_size, NULL, 0}, - {"wifi2.png", wifi2_png, wifi2_png_size, NULL, 0}, - {"wifi3.png", wifi3_png, wifi3_png_size, NULL, 0}, - {"wifi4.png", wifi4_png, wifi4_png_size, NULL, 0}, - {"wifi8.png", wifi8_png, wifi8_png_size, NULL, 0}, - {"wifi12.png", wifi12_png, wifi12_png_size, NULL, 0}, - {"wifi16.png", wifi16_png, wifi16_png_size, NULL, 0}, - {"wifi32.png", wifi32_png, wifi32_png_size, NULL, 0}, - {"norating.png", norating_png, norating_png_size, NULL, 0}, - {"guitar.png", guitar_png, guitar_png_size, NULL, 0}, - {"guitarR.png", guitarR_png, guitarR_png_size, NULL, 0}, - {"microphone.png", microphone_png, microphone_png_size, NULL, 0}, - {"microphoneR.png", microphoneR_png, microphoneR_png_size, NULL, 0}, - {"gcncontroller.png", gcncontroller_png, gcncontroller_png_size, NULL, 0}, - {"gcncontrollerR.png", gcncontrollerR_png, gcncontrollerR_png_size, NULL, 0}, - {"classiccontroller.png", classiccontroller_png, classiccontroller_png_size, NULL, 0}, - {"classiccontrollerR.png", classiccontrollerR_png, classiccontrollerR_png_size, NULL, 0}, - {"nunchuk.png", nunchuk_png, nunchuk_png_size, NULL, 0}, - {"nunchukR.png", nunchukR_png, nunchukR_png_size, NULL, 0}, - {"dancepad.png", dancepad_png, dancepad_png_size, NULL, 0}, - {"dancepadR.png", dancepadR_png, dancepadR_png_size, NULL, 0}, - {"balanceboard.png", balanceboard_png, balanceboard_png_size, NULL, 0}, - {"balanceboardR.png", balanceboardR_png, balanceboardR_png_size, NULL, 0}, - {"drums.png", drums_png, drums_png_size, NULL, 0}, - {"drumsR.png", drumsR_png, drumsR_png_size, NULL, 0}, - {"motionplus.png", motionplus_png, motionplus_png_size, NULL, 0}, - {"motionplusR.png", motionplusR_png, motionplusR_png_size, NULL, 0}, - {"wheel.png", wheel_png, wheel_png_size, NULL, 0}, - {"wheelR.png", wheelR_png, wheelR_png_size, NULL, 0}, - {"zapper.png", zapper_png, zapper_png_size, NULL, 0}, - {"zapperR.png", zapperR_png, zapperR_png_size, NULL, 0}, - {"wiispeak.png", wiispeak_png, wiispeak_png_size, NULL, 0}, - {"wiispeakR.png", wiispeakR_png, wiispeakR_png_size, NULL, 0}, - {"nintendods.png", nintendods_png, nintendods_png_size, NULL, 0}, - {"nintendodsR.png", nintendodsR_png, nintendodsR_png_size, NULL, 0}, - {"esrb_ec.png", esrb_ec_png, esrb_ec_png_size, NULL, 0}, - {"esrb_e.png", esrb_e_png, esrb_e_png_size, NULL, 0}, - {"esrb_eten.png", esrb_eten_png, esrb_eten_png_size, NULL, 0}, - {"esrb_t.png", esrb_t_png, esrb_t_png_size, NULL, 0}, - {"esrb_m.png", esrb_m_png, esrb_m_png_size, NULL, 0}, - {"esrb_ao.png", esrb_ao_png, esrb_ao_png_size, NULL, 0}, - {"cero_a.png", cero_a_png, cero_a_png_size, NULL, 0}, - {"cero_b.png", cero_b_png, cero_b_png_size, NULL, 0}, - {"cero_c.png", cero_c_png, cero_c_png_size, NULL, 0}, - {"cero_d.png", cero_d_png, cero_d_png_size, NULL, 0}, - {"cero_z.png", cero_z_png, cero_z_png_size, NULL, 0}, - {"pegi_3.png", pegi_3_png, pegi_3_png_size, NULL, 0}, - {"pegi_7.png", pegi_7_png, pegi_7_png_size, NULL, 0}, - {"pegi_12.png", pegi_12_png, pegi_12_png_size, NULL, 0}, - {"pegi_16.png", pegi_16_png, pegi_16_png_size, NULL, 0}, - {"pegi_18.png", pegi_18_png, pegi_18_png_size, NULL, 0}, - {"dvd.png", dvd_png, dvd_png_size, NULL, 0}, - {"dvd_gray.png", dvd_gray_png, dvd_gray_png_size, NULL, 0}, - {"new.png", new_png, new_png_size, NULL, 0}, - {"lock.png", lock_png, lock_png_size, NULL, 0}, - {"lock_gray.png", lock_gray_png, lock_gray_png_size, NULL, 0}, - {"unlock.png", unlock_png, unlock_png_size, NULL, 0}, - {"unlock_gray.png", unlock_gray_png, unlock_gray_png_size, NULL, 0}, - {"Channel_btn.png", Channel_btn_png, Channel_btn_png_size, NULL, 0}, - {"boxBorder.png", boxBorder_png, boxBorder_png_size, NULL, 0}, - {"nocoverFull.png", nocoverFull_png, nocoverFull_png_size, NULL, 0}, - {"add.png", add_png, add_png_size, NULL, 0}, - {"back.png", back_png, back_png_size, NULL, 0}, - {"forward.png", forward_png, forward_png_size, NULL, 0}, - {"categoryPrompt.png", categoryPrompt_png, categoryPrompt_png_size, NULL, 0}, - {"categoryLine.png", categoryLine_png, categoryLine_png_size, NULL, 0}, - {"remove.png", remove_png, remove_png_size, NULL, 0}, - {"category.png", category_png, category_png_size, NULL, 0}, - {"category_gray.png", category_gray_png, category_gray_png_size, NULL, 0}, - {"button_click.wav", button_click_wav, button_click_wav_size, NULL, 0}, - {"button_click2.wav", button_click2_wav, button_click2_wav_size, NULL, 0}, - {"button_over.wav", button_over_wav, button_over_wav_size, NULL, 0}, - {"bg_music.ogg", bg_music_ogg, bg_music_ogg_size, NULL, 0}, - {"credits_music.ogg", credits_music_ogg, credits_music_ogg_size, NULL, 0}, - {"menuin.ogg", menuin_ogg, menuin_ogg_size, NULL, 0}, - {"menuout.ogg", menuout_ogg, menuout_ogg_size, NULL, 0}, - {"success.ogg", success_ogg, success_ogg_size, NULL, 0}, - {"font.ttf", font_ttf, font_ttf_size, NULL, 0}, - {"clock.ttf", clock_ttf, clock_ttf_size, NULL, 0}, - {NULL, NULL, 0, NULL, 0} -}; +#include "filelist.h" void Resources::Clear() { diff --git a/source/themes/Resources.h b/source/themes/Resources.h index 65afc944..a4216767 100644 --- a/source/themes/Resources.h +++ b/source/themes/Resources.h @@ -1,7 +1,7 @@ #ifndef RECOURCES_H_ #define RECOURCES_H_ -#include "libwiigui/gui_imagedata.h" +#include "GUI/gui_imagedata.h" typedef struct _RecourceFile { diff --git a/source/themes/ThemeDownloader.cpp b/source/themes/ThemeDownloader.cpp index a4cce52b..6b34581c 100644 --- a/source/themes/ThemeDownloader.cpp +++ b/source/themes/ThemeDownloader.cpp @@ -69,7 +69,7 @@ ThemeDownloader::ThemeDownloader() ThemePreviews[i] = NULL; - defaultBtnTxt = new GuiText(tr( "Default" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + defaultBtnTxt = new GuiText(tr( "Default" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); defaultBtnTxt->SetMaxWidth(btnOutline->GetWidth() - 30); defaultBtnImg = new GuiImage(btnOutline); if (Settings.wsprompt) @@ -326,7 +326,7 @@ void ThemeDownloader::MainButtonClicked(int button) authorTxt2.SetPosition(230, 120); authorTxt2.SetMaxWidth(dialogBox.GetWidth() - 220, DOTTED); - GuiText downloadBtnTxt(tr( "Download" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + GuiText downloadBtnTxt(tr( "Download" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); downloadBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30); GuiImage downloadBtnImg(&btnOutline); if (Settings.wsprompt) @@ -338,7 +338,7 @@ void ThemeDownloader::MainButtonClicked(int button) downloadBtn.SetLabel(&downloadBtnTxt); downloadBtn.SetScale(0.9); - GuiText backBtnTxt(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + GuiText backBtnTxt(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); backBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30); GuiImage backBtnImg(&btnOutline); if (Settings.wsprompt) diff --git a/source/themes/ThemeMenu.cpp b/source/themes/ThemeMenu.cpp index 8ea10068..68eaca2f 100644 --- a/source/themes/ThemeMenu.cpp +++ b/source/themes/ThemeMenu.cpp @@ -53,7 +53,7 @@ ThemeMenu::ThemeMenu() for(int i = 0; i < 4; ++i) ThemePreviews[i] = NULL; - defaultBtnTxt = new GuiText(tr( "Default" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + defaultBtnTxt = new GuiText(tr( "Default" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); defaultBtnTxt->SetMaxWidth(btnOutline->GetWidth() - 30); defaultBtnImg = new GuiImage(btnOutline); if (Settings.wsprompt) @@ -348,7 +348,7 @@ void ThemeMenu::MainButtonClicked(int button) versionTxt2.SetPosition(235+versionTxt.GetTextWidth(), PositionY); versionTxt2.SetMaxWidth(dialogBox.GetWidth() - 220, DOTTED); - GuiText applyBtnTxt(tr( "Apply" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + GuiText applyBtnTxt(tr( "Apply" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); applyBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30); GuiImage applyBtnImg(&btnOutline); if (Settings.wsprompt) @@ -360,7 +360,7 @@ void ThemeMenu::MainButtonClicked(int button) applyBtn.SetLabel(&applyBtnTxt); applyBtn.SetScale(0.9); - GuiText backBtnTxt(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + GuiText backBtnTxt(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); backBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30); GuiImage backBtnImg(&btnOutline); if (Settings.wsprompt) diff --git a/source/themes/filelist.h b/source/themes/filelist.h new file mode 100644 index 00000000..2c24da28 --- /dev/null +++ b/source/themes/filelist.h @@ -0,0 +1,775 @@ +/**************************************************************************** + * USB Loader GX resource files. + * This file is generated automatically. + * Includes 189 files. + * + * NOTE: + * Any manual modification of this file will be overwriten by the generation. + ****************************************************************************/ +#ifndef _FILELIST_H_ +#define _FILELIST_H_ + +#include + +extern const u8 abcIcon_png[]; +extern const u32 abcIcon_png_size; + +extern const u8 add_png[]; +extern const u32 add_png_size; + +extern const u8 addressbar_textbox_png[]; +extern const u32 addressbar_textbox_png_size; + +extern const u8 arrangeCarousel_png[]; +extern const u32 arrangeCarousel_png_size; + +extern const u8 arrangeCarousel_gray_png[]; +extern const u32 arrangeCarousel_gray_png_size; + +extern const u8 arrangeGrid_png[]; +extern const u32 arrangeGrid_png_size; + +extern const u8 arrangeGrid_gray_png[]; +extern const u32 arrangeGrid_gray_png_size; + +extern const u8 arrangeList_png[]; +extern const u32 arrangeList_png_size; + +extern const u8 arrangeList_gray_png[]; +extern const u32 arrangeList_gray_png_size; + +extern const u8 background_png[]; +extern const u32 background_png_size; + +extern const u8 balanceboard_png[]; +extern const u32 balanceboard_png_size; + +extern const u8 balanceboardR_png[]; +extern const u32 balanceboardR_png_size; + +extern const u8 battery_png[]; +extern const u32 battery_png_size; + +extern const u8 battery_bar_png[]; +extern const u32 battery_bar_png_size; + +extern const u8 battery_bar_red_png[]; +extern const u32 battery_bar_red_png_size; + +extern const u8 battery_bar_white_png[]; +extern const u32 battery_bar_white_png_size; + +extern const u8 battery_red_png[]; +extern const u32 battery_red_png_size; + +extern const u8 battery_white_png[]; +extern const u32 battery_white_png_size; + +extern const u8 bg_browser_png[]; +extern const u32 bg_browser_png_size; + +extern const u8 bg_browser_selection_png[]; +extern const u32 bg_browser_selection_png_size; + +extern const u8 bg_options_png[]; +extern const u32 bg_options_png_size; + +extern const u8 bg_options_entry_png[]; +extern const u32 bg_options_entry_png_size; + +extern const u8 bg_options_settings_png[]; +extern const u32 bg_options_settings_png_size; + +extern const u8 boxBorder_png[]; +extern const u32 boxBorder_png_size; + +extern const u8 browser_png[]; +extern const u32 browser_png_size; + +extern const u8 browser_over_png[]; +extern const u32 browser_over_png_size; + +extern const u8 button_dialogue_box_png[]; +extern const u32 button_dialogue_box_png_size; + +extern const u8 button_install_png[]; +extern const u32 button_install_png_size; + +extern const u8 button_install_over_png[]; +extern const u32 button_install_over_png_size; + +extern const u8 category_png[]; +extern const u32 category_png_size; + +extern const u8 categoryPrompt_png[]; +extern const u32 categoryPrompt_png_size; + +extern const u8 category_gray_png[]; +extern const u32 category_gray_png_size; + +extern const u8 cero_a_png[]; +extern const u32 cero_a_png_size; + +extern const u8 cero_b_png[]; +extern const u32 cero_b_png_size; + +extern const u8 cero_c_png[]; +extern const u32 cero_c_png_size; + +extern const u8 cero_d_png[]; +extern const u32 cero_d_png_size; + +extern const u8 cero_z_png[]; +extern const u32 cero_z_png_size; + +extern const u8 channel_btn_png[]; +extern const u32 channel_btn_png_size; + +extern const u8 checkBoxSelection_png[]; +extern const u32 checkBoxSelection_png_size; + +extern const u8 classiccontroller_png[]; +extern const u32 classiccontroller_png_size; + +extern const u8 classiccontrollerR_png[]; +extern const u32 classiccontrollerR_png_size; + +extern const u8 closebutton_png[]; +extern const u32 closebutton_png_size; + +extern const u8 credits_bg_png[]; +extern const u32 credits_bg_png_size; + +extern const u8 credits_button_png[]; +extern const u32 credits_button_png_size; + +extern const u8 credits_button_over_png[]; +extern const u32 credits_button_over_png_size; + +extern const u8 dancepad_png[]; +extern const u32 dancepad_png_size; + +extern const u8 dancepadR_png[]; +extern const u32 dancepadR_png_size; + +extern const u8 dialogue_box_png[]; +extern const u32 dialogue_box_png_size; + +extern const u8 dialogue_box_startgame_png[]; +extern const u32 dialogue_box_startgame_png_size; + +extern const u8 drums_png[]; +extern const u32 drums_png_size; + +extern const u8 drumsR_png[]; +extern const u32 drumsR_png_size; + +extern const u8 dvd_png[]; +extern const u32 dvd_png_size; + +extern const u8 dvd_gray_png[]; +extern const u32 dvd_gray_png_size; + +extern const u8 esrb_ao_png[]; +extern const u32 esrb_ao_png_size; + +extern const u8 esrb_e_png[]; +extern const u32 esrb_e_png_size; + +extern const u8 esrb_ec_png[]; +extern const u32 esrb_ec_png_size; + +extern const u8 esrb_eten_png[]; +extern const u32 esrb_eten_png_size; + +extern const u8 esrb_m_png[]; +extern const u32 esrb_m_png_size; + +extern const u8 esrb_t_png[]; +extern const u32 esrb_t_png_size; + +extern const u8 exit_bottom_png[]; +extern const u32 exit_bottom_png_size; + +extern const u8 exit_bottom_over_png[]; +extern const u32 exit_bottom_over_png_size; + +extern const u8 exit_button_png[]; +extern const u32 exit_button_png_size; + +extern const u8 exit_top_png[]; +extern const u32 exit_top_png_size; + +extern const u8 exit_top_over_png[]; +extern const u32 exit_top_over_png_size; + +extern const u8 favIcon_png[]; +extern const u32 favIcon_png_size; + +extern const u8 favIcon_gray_png[]; +extern const u32 favIcon_gray_png_size; + +extern const u8 favorite_png[]; +extern const u32 favorite_png_size; + +extern const u8 gameinfo1_png[]; +extern const u32 gameinfo1_png_size; + +extern const u8 gameinfo1a_png[]; +extern const u32 gameinfo1a_png_size; + +extern const u8 gameinfo2_png[]; +extern const u32 gameinfo2_png_size; + +extern const u8 gameinfo2a_png[]; +extern const u32 gameinfo2a_png_size; + +extern const u8 gcncontroller_png[]; +extern const u32 gcncontroller_png_size; + +extern const u8 gcncontrollerR_png[]; +extern const u32 gcncontrollerR_png_size; + +extern const u8 guitar_png[]; +extern const u32 guitar_png_size; + +extern const u8 guitarR_png[]; +extern const u32 guitarR_png_size; + +extern const u8 gxlogo_png[]; +extern const u32 gxlogo_png_size; + +extern const u8 icon_folder_png[]; +extern const u32 icon_folder_png_size; + +extern const u8 keyboard_backspace_over_png[]; +extern const u32 keyboard_backspace_over_png_size; + +extern const u8 keyboard_clear_over_png[]; +extern const u32 keyboard_clear_over_png_size; + +extern const u8 keyboard_key_png[]; +extern const u32 keyboard_key_png_size; + +extern const u8 keyboard_key_over_png[]; +extern const u32 keyboard_key_over_png_size; + +extern const u8 keyboard_largekey_over_png[]; +extern const u32 keyboard_largekey_over_png_size; + +extern const u8 keyboard_mediumkey_over_png[]; +extern const u32 keyboard_mediumkey_over_png_size; + +extern const u8 keyboard_textbox_png[]; +extern const u32 keyboard_textbox_png_size; + +extern const u8 little_star_png[]; +extern const u32 little_star_png_size; + +extern const u8 lock_png[]; +extern const u32 lock_png_size; + +extern const u8 lock_gray_png[]; +extern const u32 lock_gray_png_size; + +extern const u8 menu_button_png[]; +extern const u32 menu_button_png_size; + +extern const u8 menu_button_over_png[]; +extern const u32 menu_button_over_png_size; + +extern const u8 microphone_png[]; +extern const u32 microphone_png_size; + +extern const u8 microphoneR_png[]; +extern const u32 microphoneR_png_size; + +extern const u8 motionplus_png[]; +extern const u32 motionplus_png_size; + +extern const u8 motionplusR_png[]; +extern const u32 motionplusR_png_size; + +extern const u8 new_png[]; +extern const u32 new_png_size; + +extern const u8 nintendods_png[]; +extern const u32 nintendods_png_size; + +extern const u8 nintendodsR_png[]; +extern const u32 nintendodsR_png_size; + +extern const u8 nocover_png[]; +extern const u32 nocover_png_size; + +extern const u8 nocoverFlat_png[]; +extern const u32 nocoverFlat_png_size; + +extern const u8 nocoverFull_png[]; +extern const u32 nocoverFull_png_size; + +extern const u8 nodisc_png[]; +extern const u32 nodisc_png_size; + +extern const u8 norating_png[]; +extern const u32 norating_png_size; + +extern const u8 not_favorite_png[]; +extern const u32 not_favorite_png_size; + +extern const u8 nunchuk_png[]; +extern const u32 nunchuk_png_size; + +extern const u8 nunchukR_png[]; +extern const u32 nunchukR_png_size; + +extern const u8 oneButtonScroll_png[]; +extern const u32 oneButtonScroll_png_size; + +extern const u8 pageindicator_png[]; +extern const u32 pageindicator_png_size; + +extern const u8 pegi_12_png[]; +extern const u32 pegi_12_png_size; + +extern const u8 pegi_16_png[]; +extern const u32 pegi_16_png_size; + +extern const u8 pegi_18_png[]; +extern const u32 pegi_18_png_size; + +extern const u8 pegi_3_png[]; +extern const u32 pegi_3_png_size; + +extern const u8 pegi_7_png[]; +extern const u32 pegi_7_png_size; + +extern const u8 playCountIcon_png[]; +extern const u32 playCountIcon_png_size; + +extern const u8 player1_grab_png[]; +extern const u32 player1_grab_png_size; + +extern const u8 player1_point_png[]; +extern const u32 player1_point_png_size; + +extern const u8 player2_grab_png[]; +extern const u32 player2_grab_png_size; + +extern const u8 player2_point_png[]; +extern const u32 player2_point_png_size; + +extern const u8 player3_grab_png[]; +extern const u32 player3_grab_png_size; + +extern const u8 player3_point_png[]; +extern const u32 player3_point_png_size; + +extern const u8 player4_grab_png[]; +extern const u32 player4_grab_png_size; + +extern const u8 player4_point_png[]; +extern const u32 player4_point_png_size; + +extern const u8 playersSort_png[]; +extern const u32 playersSort_png_size; + +extern const u8 progressbar_png[]; +extern const u32 progressbar_png_size; + +extern const u8 progressbar_empty_png[]; +extern const u32 progressbar_empty_png_size; + +extern const u8 progressbar_outline_png[]; +extern const u32 progressbar_outline_png_size; + +extern const u8 rankIcon_png[]; +extern const u32 rankIcon_png_size; + +extern const u8 remove_png[]; +extern const u32 remove_png_size; + +extern const u8 rename_png[]; +extern const u32 rename_png_size; + +extern const u8 rplayer1_point_png[]; +extern const u32 rplayer1_point_png_size; + +extern const u8 rplayer2_point_png[]; +extern const u32 rplayer2_point_png_size; + +extern const u8 rplayer3_point_png[]; +extern const u32 rplayer3_point_png_size; + +extern const u8 rplayer4_point_png[]; +extern const u32 rplayer4_point_png_size; + +extern const u8 scrollBarBottom_png[]; +extern const u32 scrollBarBottom_png_size; + +extern const u8 scrollBarTile_png[]; +extern const u32 scrollBarTile_png_size; + +extern const u8 scrollBarTop_png[]; +extern const u32 scrollBarTop_png_size; + +extern const u8 scrollbar_arrowdown_png[]; +extern const u32 scrollbar_arrowdown_png_size; + +extern const u8 scrollbar_arrowup_png[]; +extern const u32 scrollbar_arrowup_png_size; + +extern const u8 scrollbar_box_png[]; +extern const u32 scrollbar_box_png_size; + +extern const u8 sdcard_png[]; +extern const u32 sdcard_png_size; + +extern const u8 sdcard_over_png[]; +extern const u32 sdcard_over_png_size; + +extern const u8 searchIcon_png[]; +extern const u32 searchIcon_png_size; + +extern const u8 searchIcon_gray_png[]; +extern const u32 searchIcon_gray_png_size; + +extern const u8 settings_background_png[]; +extern const u32 settings_background_png_size; + +extern const u8 settings_button_png[]; +extern const u32 settings_button_png_size; + +extern const u8 settings_button_over_png[]; +extern const u32 settings_button_over_png_size; + +extern const u8 settings_title_png[]; +extern const u32 settings_title_png_size; + +extern const u8 settings_title_over_png[]; +extern const u32 settings_title_over_png_size; + +extern const u8 startgame_arrow_left_png[]; +extern const u32 startgame_arrow_left_png_size; + +extern const u8 startgame_arrow_right_png[]; +extern const u32 startgame_arrow_right_png_size; + +extern const u8 theme_box_png[]; +extern const u32 theme_box_png_size; + +extern const u8 theme_dialogue_box_png[]; +extern const u32 theme_dialogue_box_png_size; + +extern const u8 tooltip_left_png[]; +extern const u32 tooltip_left_png_size; + +extern const u8 tooltip_right_png[]; +extern const u32 tooltip_right_png_size; + +extern const u8 tooltip_tile_png[]; +extern const u32 tooltip_tile_png_size; + +extern const u8 unlock_png[]; +extern const u32 unlock_png_size; + +extern const u8 unlock_gray_png[]; +extern const u32 unlock_gray_png_size; + +extern const u8 wbackground_png[]; +extern const u32 wbackground_png_size; + +extern const u8 wdialogue_box_startgame_png[]; +extern const u32 wdialogue_box_startgame_png_size; + +extern const u8 wheel_png[]; +extern const u32 wheel_png_size; + +extern const u8 wheelR_png[]; +extern const u32 wheelR_png_size; + +extern const u8 wifi1_png[]; +extern const u32 wifi1_png_size; + +extern const u8 wifi12_png[]; +extern const u32 wifi12_png_size; + +extern const u8 wifi16_png[]; +extern const u32 wifi16_png_size; + +extern const u8 wifi2_png[]; +extern const u32 wifi2_png_size; + +extern const u8 wifi3_png[]; +extern const u32 wifi3_png_size; + +extern const u8 wifi32_png[]; +extern const u32 wifi32_png_size; + +extern const u8 wifi4_png[]; +extern const u32 wifi4_png_size; + +extern const u8 wifi8_png[]; +extern const u32 wifi8_png_size; + +extern const u8 wifi_btn_png[]; +extern const u32 wifi_btn_png_size; + +extern const u8 wiimote_png[]; +extern const u32 wiimote_png_size; + +extern const u8 wiimote1_png[]; +extern const u32 wiimote1_png_size; + +extern const u8 wiimote2_png[]; +extern const u32 wiimote2_png_size; + +extern const u8 wiimote3_png[]; +extern const u32 wiimote3_png_size; + +extern const u8 wiimote4_png[]; +extern const u32 wiimote4_png_size; + +extern const u8 wiimote_poweroff_png[]; +extern const u32 wiimote_poweroff_png_size; + +extern const u8 wiimote_poweroff_over_png[]; +extern const u32 wiimote_poweroff_over_png_size; + +extern const u8 wiispeak_png[]; +extern const u32 wiispeak_png_size; + +extern const u8 wiispeakR_png[]; +extern const u32 wiispeakR_png_size; + +extern const u8 zapper_png[]; +extern const u32 zapper_png_size; + +extern const u8 zapperR_png[]; +extern const u32 zapperR_png_size; + +extern const u8 bg_music_ogg[]; +extern const u32 bg_music_ogg_size; + +extern const u8 button_click_wav[]; +extern const u32 button_click_wav_size; + +extern const u8 button_click2_wav[]; +extern const u32 button_click2_wav_size; + +extern const u8 button_over_wav[]; +extern const u32 button_over_wav_size; + +extern const u8 credits_music_ogg[]; +extern const u32 credits_music_ogg_size; + +extern const u8 menuin_ogg[]; +extern const u32 menuin_ogg_size; + +extern const u8 menuout_ogg[]; +extern const u32 menuout_ogg_size; + +extern const u8 success_ogg[]; +extern const u32 success_ogg_size; + +extern const u8 clock_ttf[]; +extern const u32 clock_ttf_size; + +extern const u8 font_ttf[]; +extern const u32 font_ttf_size; + +RecourceFile Resources::RecourceFiles[] = +{ + {"abcIcon.png", abcIcon_png, abcIcon_png_size, NULL, 0}, + {"add.png", add_png, add_png_size, NULL, 0}, + {"addressbar_textbox.png", addressbar_textbox_png, addressbar_textbox_png_size, NULL, 0}, + {"arrangeCarousel.png", arrangeCarousel_png, arrangeCarousel_png_size, NULL, 0}, + {"arrangeCarousel_gray.png", arrangeCarousel_gray_png, arrangeCarousel_gray_png_size, NULL, 0}, + {"arrangeGrid.png", arrangeGrid_png, arrangeGrid_png_size, NULL, 0}, + {"arrangeGrid_gray.png", arrangeGrid_gray_png, arrangeGrid_gray_png_size, NULL, 0}, + {"arrangeList.png", arrangeList_png, arrangeList_png_size, NULL, 0}, + {"arrangeList_gray.png", arrangeList_gray_png, arrangeList_gray_png_size, NULL, 0}, + {"background.png", background_png, background_png_size, NULL, 0}, + {"balanceboard.png", balanceboard_png, balanceboard_png_size, NULL, 0}, + {"balanceboardR.png", balanceboardR_png, balanceboardR_png_size, NULL, 0}, + {"battery.png", battery_png, battery_png_size, NULL, 0}, + {"battery_bar.png", battery_bar_png, battery_bar_png_size, NULL, 0}, + {"battery_bar_red.png", battery_bar_red_png, battery_bar_red_png_size, NULL, 0}, + {"battery_bar_white.png", battery_bar_white_png, battery_bar_white_png_size, NULL, 0}, + {"battery_red.png", battery_red_png, battery_red_png_size, NULL, 0}, + {"battery_white.png", battery_white_png, battery_white_png_size, NULL, 0}, + {"bg_browser.png", bg_browser_png, bg_browser_png_size, NULL, 0}, + {"bg_browser_selection.png", bg_browser_selection_png, bg_browser_selection_png_size, NULL, 0}, + {"bg_options.png", bg_options_png, bg_options_png_size, NULL, 0}, + {"bg_options_entry.png", bg_options_entry_png, bg_options_entry_png_size, NULL, 0}, + {"bg_options_settings.png", bg_options_settings_png, bg_options_settings_png_size, NULL, 0}, + {"boxBorder.png", boxBorder_png, boxBorder_png_size, NULL, 0}, + {"browser.png", browser_png, browser_png_size, NULL, 0}, + {"browser_over.png", browser_over_png, browser_over_png_size, NULL, 0}, + {"button_dialogue_box.png", button_dialogue_box_png, button_dialogue_box_png_size, NULL, 0}, + {"button_install.png", button_install_png, button_install_png_size, NULL, 0}, + {"button_install_over.png", button_install_over_png, button_install_over_png_size, NULL, 0}, + {"category.png", category_png, category_png_size, NULL, 0}, + {"categoryPrompt.png", categoryPrompt_png, categoryPrompt_png_size, NULL, 0}, + {"category_gray.png", category_gray_png, category_gray_png_size, NULL, 0}, + {"cero_a.png", cero_a_png, cero_a_png_size, NULL, 0}, + {"cero_b.png", cero_b_png, cero_b_png_size, NULL, 0}, + {"cero_c.png", cero_c_png, cero_c_png_size, NULL, 0}, + {"cero_d.png", cero_d_png, cero_d_png_size, NULL, 0}, + {"cero_z.png", cero_z_png, cero_z_png_size, NULL, 0}, + {"channel_btn.png", channel_btn_png, channel_btn_png_size, NULL, 0}, + {"checkBoxSelection.png", checkBoxSelection_png, checkBoxSelection_png_size, NULL, 0}, + {"classiccontroller.png", classiccontroller_png, classiccontroller_png_size, NULL, 0}, + {"classiccontrollerR.png", classiccontrollerR_png, classiccontrollerR_png_size, NULL, 0}, + {"closebutton.png", closebutton_png, closebutton_png_size, NULL, 0}, + {"credits_bg.png", credits_bg_png, credits_bg_png_size, NULL, 0}, + {"credits_button.png", credits_button_png, credits_button_png_size, NULL, 0}, + {"credits_button_over.png", credits_button_over_png, credits_button_over_png_size, NULL, 0}, + {"dancepad.png", dancepad_png, dancepad_png_size, NULL, 0}, + {"dancepadR.png", dancepadR_png, dancepadR_png_size, NULL, 0}, + {"dialogue_box.png", dialogue_box_png, dialogue_box_png_size, NULL, 0}, + {"dialogue_box_startgame.png", dialogue_box_startgame_png, dialogue_box_startgame_png_size, NULL, 0}, + {"drums.png", drums_png, drums_png_size, NULL, 0}, + {"drumsR.png", drumsR_png, drumsR_png_size, NULL, 0}, + {"dvd.png", dvd_png, dvd_png_size, NULL, 0}, + {"dvd_gray.png", dvd_gray_png, dvd_gray_png_size, NULL, 0}, + {"esrb_ao.png", esrb_ao_png, esrb_ao_png_size, NULL, 0}, + {"esrb_e.png", esrb_e_png, esrb_e_png_size, NULL, 0}, + {"esrb_ec.png", esrb_ec_png, esrb_ec_png_size, NULL, 0}, + {"esrb_eten.png", esrb_eten_png, esrb_eten_png_size, NULL, 0}, + {"esrb_m.png", esrb_m_png, esrb_m_png_size, NULL, 0}, + {"esrb_t.png", esrb_t_png, esrb_t_png_size, NULL, 0}, + {"exit_bottom.png", exit_bottom_png, exit_bottom_png_size, NULL, 0}, + {"exit_bottom_over.png", exit_bottom_over_png, exit_bottom_over_png_size, NULL, 0}, + {"exit_button.png", exit_button_png, exit_button_png_size, NULL, 0}, + {"exit_top.png", exit_top_png, exit_top_png_size, NULL, 0}, + {"exit_top_over.png", exit_top_over_png, exit_top_over_png_size, NULL, 0}, + {"favIcon.png", favIcon_png, favIcon_png_size, NULL, 0}, + {"favIcon_gray.png", favIcon_gray_png, favIcon_gray_png_size, NULL, 0}, + {"favorite.png", favorite_png, favorite_png_size, NULL, 0}, + {"gameinfo1.png", gameinfo1_png, gameinfo1_png_size, NULL, 0}, + {"gameinfo1a.png", gameinfo1a_png, gameinfo1a_png_size, NULL, 0}, + {"gameinfo2.png", gameinfo2_png, gameinfo2_png_size, NULL, 0}, + {"gameinfo2a.png", gameinfo2a_png, gameinfo2a_png_size, NULL, 0}, + {"gcncontroller.png", gcncontroller_png, gcncontroller_png_size, NULL, 0}, + {"gcncontrollerR.png", gcncontrollerR_png, gcncontrollerR_png_size, NULL, 0}, + {"guitar.png", guitar_png, guitar_png_size, NULL, 0}, + {"guitarR.png", guitarR_png, guitarR_png_size, NULL, 0}, + {"gxlogo.png", gxlogo_png, gxlogo_png_size, NULL, 0}, + {"icon_folder.png", icon_folder_png, icon_folder_png_size, NULL, 0}, + {"keyboard_backspace_over.png", keyboard_backspace_over_png, keyboard_backspace_over_png_size, NULL, 0}, + {"keyboard_clear_over.png", keyboard_clear_over_png, keyboard_clear_over_png_size, NULL, 0}, + {"keyboard_key.png", keyboard_key_png, keyboard_key_png_size, NULL, 0}, + {"keyboard_key_over.png", keyboard_key_over_png, keyboard_key_over_png_size, NULL, 0}, + {"keyboard_largekey_over.png", keyboard_largekey_over_png, keyboard_largekey_over_png_size, NULL, 0}, + {"keyboard_mediumkey_over.png", keyboard_mediumkey_over_png, keyboard_mediumkey_over_png_size, NULL, 0}, + {"keyboard_textbox.png", keyboard_textbox_png, keyboard_textbox_png_size, NULL, 0}, + {"little_star.png", little_star_png, little_star_png_size, NULL, 0}, + {"lock.png", lock_png, lock_png_size, NULL, 0}, + {"lock_gray.png", lock_gray_png, lock_gray_png_size, NULL, 0}, + {"menu_button.png", menu_button_png, menu_button_png_size, NULL, 0}, + {"menu_button_over.png", menu_button_over_png, menu_button_over_png_size, NULL, 0}, + {"microphone.png", microphone_png, microphone_png_size, NULL, 0}, + {"microphoneR.png", microphoneR_png, microphoneR_png_size, NULL, 0}, + {"motionplus.png", motionplus_png, motionplus_png_size, NULL, 0}, + {"motionplusR.png", motionplusR_png, motionplusR_png_size, NULL, 0}, + {"new.png", new_png, new_png_size, NULL, 0}, + {"nintendods.png", nintendods_png, nintendods_png_size, NULL, 0}, + {"nintendodsR.png", nintendodsR_png, nintendodsR_png_size, NULL, 0}, + {"nocover.png", nocover_png, nocover_png_size, NULL, 0}, + {"nocoverFlat.png", nocoverFlat_png, nocoverFlat_png_size, NULL, 0}, + {"nocoverFull.png", nocoverFull_png, nocoverFull_png_size, NULL, 0}, + {"nodisc.png", nodisc_png, nodisc_png_size, NULL, 0}, + {"norating.png", norating_png, norating_png_size, NULL, 0}, + {"not_favorite.png", not_favorite_png, not_favorite_png_size, NULL, 0}, + {"nunchuk.png", nunchuk_png, nunchuk_png_size, NULL, 0}, + {"nunchukR.png", nunchukR_png, nunchukR_png_size, NULL, 0}, + {"oneButtonScroll.png", oneButtonScroll_png, oneButtonScroll_png_size, NULL, 0}, + {"pageindicator.png", pageindicator_png, pageindicator_png_size, NULL, 0}, + {"pegi_12.png", pegi_12_png, pegi_12_png_size, NULL, 0}, + {"pegi_16.png", pegi_16_png, pegi_16_png_size, NULL, 0}, + {"pegi_18.png", pegi_18_png, pegi_18_png_size, NULL, 0}, + {"pegi_3.png", pegi_3_png, pegi_3_png_size, NULL, 0}, + {"pegi_7.png", pegi_7_png, pegi_7_png_size, NULL, 0}, + {"playCountIcon.png", playCountIcon_png, playCountIcon_png_size, NULL, 0}, + {"player1_grab.png", player1_grab_png, player1_grab_png_size, NULL, 0}, + {"player1_point.png", player1_point_png, player1_point_png_size, NULL, 0}, + {"player2_grab.png", player2_grab_png, player2_grab_png_size, NULL, 0}, + {"player2_point.png", player2_point_png, player2_point_png_size, NULL, 0}, + {"player3_grab.png", player3_grab_png, player3_grab_png_size, NULL, 0}, + {"player3_point.png", player3_point_png, player3_point_png_size, NULL, 0}, + {"player4_grab.png", player4_grab_png, player4_grab_png_size, NULL, 0}, + {"player4_point.png", player4_point_png, player4_point_png_size, NULL, 0}, + {"playersSort.png", playersSort_png, playersSort_png_size, NULL, 0}, + {"progressbar.png", progressbar_png, progressbar_png_size, NULL, 0}, + {"progressbar_empty.png", progressbar_empty_png, progressbar_empty_png_size, NULL, 0}, + {"progressbar_outline.png", progressbar_outline_png, progressbar_outline_png_size, NULL, 0}, + {"rankIcon.png", rankIcon_png, rankIcon_png_size, NULL, 0}, + {"remove.png", remove_png, remove_png_size, NULL, 0}, + {"rename.png", rename_png, rename_png_size, NULL, 0}, + {"rplayer1_point.png", rplayer1_point_png, rplayer1_point_png_size, NULL, 0}, + {"rplayer2_point.png", rplayer2_point_png, rplayer2_point_png_size, NULL, 0}, + {"rplayer3_point.png", rplayer3_point_png, rplayer3_point_png_size, NULL, 0}, + {"rplayer4_point.png", rplayer4_point_png, rplayer4_point_png_size, NULL, 0}, + {"scrollBarBottom.png", scrollBarBottom_png, scrollBarBottom_png_size, NULL, 0}, + {"scrollBarTile.png", scrollBarTile_png, scrollBarTile_png_size, NULL, 0}, + {"scrollBarTop.png", scrollBarTop_png, scrollBarTop_png_size, NULL, 0}, + {"scrollbar_arrowdown.png", scrollbar_arrowdown_png, scrollbar_arrowdown_png_size, NULL, 0}, + {"scrollbar_arrowup.png", scrollbar_arrowup_png, scrollbar_arrowup_png_size, NULL, 0}, + {"scrollbar_box.png", scrollbar_box_png, scrollbar_box_png_size, NULL, 0}, + {"sdcard.png", sdcard_png, sdcard_png_size, NULL, 0}, + {"sdcard_over.png", sdcard_over_png, sdcard_over_png_size, NULL, 0}, + {"searchIcon.png", searchIcon_png, searchIcon_png_size, NULL, 0}, + {"searchIcon_gray.png", searchIcon_gray_png, searchIcon_gray_png_size, NULL, 0}, + {"settings_background.png", settings_background_png, settings_background_png_size, NULL, 0}, + {"settings_button.png", settings_button_png, settings_button_png_size, NULL, 0}, + {"settings_button_over.png", settings_button_over_png, settings_button_over_png_size, NULL, 0}, + {"settings_title.png", settings_title_png, settings_title_png_size, NULL, 0}, + {"settings_title_over.png", settings_title_over_png, settings_title_over_png_size, NULL, 0}, + {"startgame_arrow_left.png", startgame_arrow_left_png, startgame_arrow_left_png_size, NULL, 0}, + {"startgame_arrow_right.png", startgame_arrow_right_png, startgame_arrow_right_png_size, NULL, 0}, + {"theme_box.png", theme_box_png, theme_box_png_size, NULL, 0}, + {"theme_dialogue_box.png", theme_dialogue_box_png, theme_dialogue_box_png_size, NULL, 0}, + {"tooltip_left.png", tooltip_left_png, tooltip_left_png_size, NULL, 0}, + {"tooltip_right.png", tooltip_right_png, tooltip_right_png_size, NULL, 0}, + {"tooltip_tile.png", tooltip_tile_png, tooltip_tile_png_size, NULL, 0}, + {"unlock.png", unlock_png, unlock_png_size, NULL, 0}, + {"unlock_gray.png", unlock_gray_png, unlock_gray_png_size, NULL, 0}, + {"wbackground.png", wbackground_png, wbackground_png_size, NULL, 0}, + {"wdialogue_box_startgame.png", wdialogue_box_startgame_png, wdialogue_box_startgame_png_size, NULL, 0}, + {"wheel.png", wheel_png, wheel_png_size, NULL, 0}, + {"wheelR.png", wheelR_png, wheelR_png_size, NULL, 0}, + {"wifi1.png", wifi1_png, wifi1_png_size, NULL, 0}, + {"wifi12.png", wifi12_png, wifi12_png_size, NULL, 0}, + {"wifi16.png", wifi16_png, wifi16_png_size, NULL, 0}, + {"wifi2.png", wifi2_png, wifi2_png_size, NULL, 0}, + {"wifi3.png", wifi3_png, wifi3_png_size, NULL, 0}, + {"wifi32.png", wifi32_png, wifi32_png_size, NULL, 0}, + {"wifi4.png", wifi4_png, wifi4_png_size, NULL, 0}, + {"wifi8.png", wifi8_png, wifi8_png_size, NULL, 0}, + {"wifi_btn.png", wifi_btn_png, wifi_btn_png_size, NULL, 0}, + {"wiimote.png", wiimote_png, wiimote_png_size, NULL, 0}, + {"wiimote1.png", wiimote1_png, wiimote1_png_size, NULL, 0}, + {"wiimote2.png", wiimote2_png, wiimote2_png_size, NULL, 0}, + {"wiimote3.png", wiimote3_png, wiimote3_png_size, NULL, 0}, + {"wiimote4.png", wiimote4_png, wiimote4_png_size, NULL, 0}, + {"wiimote_poweroff.png", wiimote_poweroff_png, wiimote_poweroff_png_size, NULL, 0}, + {"wiimote_poweroff_over.png", wiimote_poweroff_over_png, wiimote_poweroff_over_png_size, NULL, 0}, + {"wiispeak.png", wiispeak_png, wiispeak_png_size, NULL, 0}, + {"wiispeakR.png", wiispeakR_png, wiispeakR_png_size, NULL, 0}, + {"zapper.png", zapper_png, zapper_png_size, NULL, 0}, + {"zapperR.png", zapperR_png, zapperR_png_size, NULL, 0}, + {"bg_music.ogg", bg_music_ogg, bg_music_ogg_size, NULL, 0}, + {"button_click.wav", button_click_wav, button_click_wav_size, NULL, 0}, + {"button_click2.wav", button_click2_wav, button_click2_wav_size, NULL, 0}, + {"button_over.wav", button_over_wav, button_over_wav_size, NULL, 0}, + {"credits_music.ogg", credits_music_ogg, credits_music_ogg_size, NULL, 0}, + {"menuin.ogg", menuin_ogg, menuin_ogg_size, NULL, 0}, + {"menuout.ogg", menuout_ogg, menuout_ogg_size, NULL, 0}, + {"success.ogg", success_ogg, success_ogg_size, NULL, 0}, + {"clock.ttf", clock_ttf, clock_ttf_size, NULL, 0}, + {"font.ttf", font_ttf, font_ttf_size, NULL, 0}, + {NULL, NULL, 0, NULL, 0} +}; + +#endif diff --git a/source/usbloader/GameBooter.cpp b/source/usbloader/GameBooter.cpp index 052c19ea..bc839d33 100644 --- a/source/usbloader/GameBooter.cpp +++ b/source/usbloader/GameBooter.cpp @@ -255,6 +255,7 @@ int GameBooter::BootGame(const char * gameID) } //! Do all the game patches + gprintf("Applying game patches...\n"); gamepatches(videoChoice, languageChoice, countrystrings, viChoice, ocarinaChoice, fix002, reloadblock, iosChoice, returnToChoice); //! Load Ocarina codes @@ -268,6 +269,7 @@ int GameBooter::BootGame(const char * gameID) //! Remember game's USB port int usbport = USBStorage2_GetPort(); + gprintf("Shutting down devices...\n"); //! Flush all caches and close up all devices WBFS_CloseAll(); DeviceHandler::DestroyInstance(); diff --git a/source/utils/ResourceManager.h b/source/utils/ResourceManager.h index e1897087..17c49411 100644 --- a/source/utils/ResourceManager.h +++ b/source/utils/ResourceManager.h @@ -26,7 +26,7 @@ #include -#include "libwiigui/gui.h" +#include "GUI/gui.h" #include diff --git a/source/utils/rockout.cpp b/source/utils/rockout.cpp index 5391cdb9..aa0d2235 100644 --- a/source/utils/rockout.cpp +++ b/source/utils/rockout.cpp @@ -1,4 +1,4 @@ -#include "libwiigui/gui.h" +#include "GUI/gui.h" #include "themes/CTheme.h" #include "usbloader/GameList.h" #include "settings/GameTitles.h" diff --git a/source/utils/tools.h b/source/utils/tools.h index 8f8badb9..cc2d1623 100644 --- a/source/utils/tools.h +++ b/source/utils/tools.h @@ -1,6 +1,7 @@ #ifndef TOOLS_H_ #define TOOLS_H_ +#define ABS(x) ( (x) >= (0) ? (x) : (-(x)) ) #define LIMIT(x, min, max) ( ((x) < (min)) ? (min) : ((x) > (max)) ? (max) : (x) ) #define ALIGN(x) (((x) + 3) & ~3) #define ALIGN32(x) (((x) + 31) & ~31) diff --git a/source/video.cpp b/source/video.cpp index ed85d606..27cc4d35 100644 --- a/source/video.cpp +++ b/source/video.cpp @@ -17,7 +17,7 @@ #include "input.h" #include "gecko.h" -#include "libwiigui/gui.h" +#include "GUI/gui.h" #define DEFAULT_FIFO_SIZE 256 * 1024 static unsigned int *xfb[2] = { NULL, NULL }; // Double buffered diff --git a/source/wad/wad.cpp b/source/wad/wad.cpp index 831c1d13..80ccc89a 100644 --- a/source/wad/wad.cpp +++ b/source/wad/wad.cpp @@ -11,7 +11,7 @@ #include "nandtitle.h" #include "prompts/PromptWindows.h" -#include "libwiigui/gui.h" +#include "GUI/gui.h" #include "language/gettext.h" #include "menu.h" #include "themes/CTheme.h" @@ -124,7 +124,7 @@ s32 Wad_Install(FILE *fp) dialogBoxImg.SetWidescreen(Settings.widescreen); } - GuiText btn1Txt(tr( "OK" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + GuiText btn1Txt(tr( "OK" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt) { @@ -148,7 +148,7 @@ s32 Wad_Install(FILE *fp) GuiImage progressbarEmptyImg(&progressbarEmpty); progressbarEmptyImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); progressbarEmptyImg.SetPosition(25, 50); - progressbarEmptyImg.SetTile(100); + progressbarEmptyImg.SetTileHorizontal(100); GuiImageData progressbar(Resources::GetFile("progressbar.png"), Resources::GetFileSize("progressbar.png")); GuiImage progressbarImg(&progressbar); @@ -192,7 +192,7 @@ s32 Wad_Install(FILE *fp) progressbarOutlineImg.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); progressbarOutlineImg.SetPosition(0, 50); progressbarEmptyImg.SetPosition(80, 50); - progressbarEmptyImg.SetTile(78); + progressbarEmptyImg.SetTileHorizontal(78); progressbarImg.SetPosition(80, 50); msg1Txt.SetPosition(90, 75); @@ -358,11 +358,11 @@ s32 Wad_Install(FILE *fp) prTxt.SetTextf("%i%%", 100 * (cnt * len + idx) / (tmd_data->num_contents * len)); if ((Settings.wsprompt) && (Settings.widescreen)) { - progressbarImg.SetTile(78 * (cnt * len + idx) / (tmd_data->num_contents * len)); + progressbarImg.SetTileHorizontal(78 * (cnt * len + idx) / (tmd_data->num_contents * len)); } else { - progressbarImg.SetTile(100 * (cnt * len + idx) / (tmd_data->num_contents * len)); + progressbarImg.SetTileHorizontal(100 * (cnt * len + idx) / (tmd_data->num_contents * len)); } } @@ -438,7 +438,7 @@ s32 Wad_Uninstall(FILE *fp) dialogBoxImg.SetWidescreen(Settings.widescreen); } - GuiText btn1Txt(tr( "OK" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color")); + GuiText btn1Txt(tr( "OK" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color")); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt) { diff --git a/source/xml/xml.cpp b/source/xml/xml.cpp index 2d62def1..f696cf35 100644 --- a/source/xml/xml.cpp +++ b/source/xml/xml.cpp @@ -82,7 +82,7 @@ void CloseXMLDatabase() } } -void GetTextFromNode(mxml_node_t *currentnode, mxml_node_t *topnode, const char *nodename, const char *attributename, +mxml_node_t *GetTextFromNode(mxml_node_t *currentnode, mxml_node_t *topnode, const char *nodename, const char *attributename, char *value, int descend, char *dest, int destsize) { *element_text = 0; @@ -103,12 +103,12 @@ void GetTextFromNode(mxml_node_t *currentnode, mxml_node_t *topnode, const char { strcpy(dest, ""); } + + return nodefound; } bool OpenXMLFile(char *filename) { - //if (xmldebug) dbg_time1(); - if (xml_loaded) return false; nodedata = NULL; diff --git a/source/xml/xml.h b/source/xml/xml.h index cd40b089..3e8686c1 100644 --- a/source/xml/xml.h +++ b/source/xml/xml.h @@ -15,7 +15,7 @@ void GetPublisherFromGameid(char *idtxt, char *dest, int destsize); const char *ConvertLangTextToCode(char *langtext); int ConvertRating(const char *ratingvalue, const char *fromrating, const char *torating); char *MemInfo(); -void GetTextFromNode(mxml_node_t *currentnode, mxml_node_t *topnode, const char *nodename, const char *attributename, +mxml_node_t *GetTextFromNode(mxml_node_t *currentnode, mxml_node_t *topnode, const char *nodename, const char *attributename, char *value, int descend, char *dest, int destsize); char * get_nodetext(mxml_node_t *node, char *buffer, int buflen);