diff --git a/Languages/czech.lang b/Languages/czech.lang index ff906678..1a546d04 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: 2009-09-20 04:59+0200\n" +"POT-Creation-Date: 2009-09-27 20:15+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: David Jelinek (djelinek@hotmail.com) \n" "Language-Team: r719 - last version on http://volny.cz/djelinek/_USBLoderGX/czech.lang \n" @@ -46,6 +46,9 @@ msgstr "2 (Mladistvý 12+)" msgid "20 min" msgstr "20 minut" +msgid "2D Cover Path" +msgstr "" + msgid "3 (Mature 16+)" msgstr "3 (Zralý 16+)" @@ -55,6 +58,9 @@ msgstr "3 minuty" msgid "30 min" msgstr "30 minut" +msgid "3D Cover Path" +msgstr "" + msgid "3D Covers" msgstr "3D Obaly" @@ -284,9 +290,6 @@ msgstr "Nelze nastavit USB" msgid "Cover Download" msgstr "Stažení obalu" -msgid "Cover Path" -msgstr "Cesta k obalum" - msgid "Coverpath Change" msgstr "Zmena cesty k obalom" @@ -911,6 +914,9 @@ msgstr "" msgid "Sept" msgstr "Zárí" +msgid "Set Search-Filter" +msgstr "" + msgid "Set as backgroundmusic?" msgstr "Nastavit jako hudbu na pozadí?" @@ -1193,3 +1199,6 @@ msgstr "z " msgid "seconds left" msgstr "sekund zbývá" + +#~ msgid "Cover Path" +#~ msgstr "Cesta k obalum" diff --git a/Languages/danish.lang b/Languages/danish.lang index 90d97721..2aa7fb4e 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: 2009-09-20 04:59+0200\n" +"POT-Creation-Date: 2009-09-27 20:15+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: dorf[dk]\n" "Language-Team: \n" @@ -46,6 +46,9 @@ msgstr "2 (Unge teenagere 12+)" msgid "20 min" msgstr "20 min." +msgid "2D Cover Path" +msgstr "" + msgid "3 (Mature 16+)" msgstr "3 (Modne teenagere 12+)" @@ -55,6 +58,9 @@ msgstr "3 min." msgid "30 min" msgstr "30 min." +msgid "3D Cover Path" +msgstr "" + msgid "3D Covers" msgstr "3D-Covers" @@ -284,9 +290,6 @@ msgstr "Kunne ikke sætte USB." msgid "Cover Download" msgstr "Cover-download" -msgid "Cover Path" -msgstr "Sti til covers" - msgid "Coverpath Change" msgstr "Ændringer af sti til covers" @@ -911,6 +914,9 @@ msgstr "Valgt DOL" msgid "Sept" msgstr "Sept" +msgid "Set Search-Filter" +msgstr "" + msgid "Set as backgroundmusic?" msgstr "Indstil som baggrundsmusik?" @@ -1194,6 +1200,9 @@ msgstr "af" msgid "seconds left" msgstr "sekunder tilbage" +#~ msgid "Cover Path" +#~ msgstr "Sti til covers" + #~ msgid "Don't bother the USB Loader GX Team about errors in this file." #~ msgstr "Lad være med at fortælle holdet bag USB Loader GX om fejl i denne fil." diff --git a/Languages/dutch.lang b/Languages/dutch.lang index 4196745a..6bf8fce4 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: 2009-09-20 04:59+0200\n" +"POT-Creation-Date: 2009-09-27 20:15+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: tj_cool\n" "Language-Team: \n" @@ -46,6 +46,9 @@ msgstr "2 (Tiener 12+)" msgid "20 min" msgstr "20 min" +msgid "2D Cover Path" +msgstr "" + msgid "3 (Mature 16+)" msgstr "3 (Adolescenten 16+)" @@ -55,6 +58,9 @@ msgstr "3 min" msgid "30 min" msgstr "30 min" +msgid "3D Cover Path" +msgstr "" + msgid "3D Covers" msgstr "3D Hoesjes" @@ -284,9 +290,6 @@ msgstr "Kan USB niet instellen" msgid "Cover Download" msgstr "Download hoesjes" -msgid "Cover Path" -msgstr "Locatie hoesjes" - msgid "Coverpath Change" msgstr "Hoesjesmap wijzigen" @@ -911,6 +914,9 @@ msgstr "" msgid "Sept" msgstr "Sept" +msgid "Set Search-Filter" +msgstr "" + msgid "Set as backgroundmusic?" msgstr "Instellen als achtergrondmuziek?" @@ -1194,6 +1200,9 @@ msgstr "van" msgid "seconds left" msgstr "seconden over:" +#~ msgid "Cover Path" +#~ msgstr "Locatie hoesjes" + #~ msgid "Don't bother the USB Loader GX Team about errors in this file." #~ msgstr "Val het USB loader GX team niet lastig over fouten in dit bestand." diff --git a/Languages/english.lang b/Languages/english.lang index 59c711ed..44678c85 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: 2009-09-20 04:59+0200\n" +"POT-Creation-Date: 2009-09-27 20:15+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -46,6 +46,9 @@ msgstr "" msgid "20 min" msgstr "" +msgid "2D Cover Path" +msgstr "" + msgid "3 (Mature 16+)" msgstr "" @@ -55,6 +58,9 @@ msgstr "" msgid "30 min" msgstr "" +msgid "3D Cover Path" +msgstr "" + msgid "3D Covers" msgstr "" @@ -284,9 +290,6 @@ msgstr "" msgid "Cover Download" msgstr "" -msgid "Cover Path" -msgstr "" - msgid "Coverpath Change" msgstr "" @@ -911,6 +914,9 @@ msgstr "" msgid "Sept" msgstr "" +msgid "Set Search-Filter" +msgstr "" + msgid "Set as backgroundmusic?" msgstr "" diff --git a/Languages/finnish.lang b/Languages/finnish.lang index 70965253..7b86c50d 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: 2009-09-20 04:59+0200\n" +"POT-Creation-Date: 2009-09-27 20:15+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: c64rmx\n" "Language-Team: \n" @@ -46,6 +46,9 @@ msgstr "2 (Teinit 12+)" msgid "20 min" msgstr "" +msgid "2D Cover Path" +msgstr "" + msgid "3 (Mature 16+)" msgstr "3 (Teinit 16+)" @@ -55,6 +58,9 @@ msgstr "" msgid "30 min" msgstr "" +msgid "3D Cover Path" +msgstr "" + msgid "3D Covers" msgstr "3D Kannet" @@ -284,9 +290,6 @@ msgstr "USB:tä ei voitu asettaa" msgid "Cover Download" msgstr "Kansien lataus" -msgid "Cover Path" -msgstr "Kansien polku" - msgid "Coverpath Change" msgstr "Kansipolun vaihto" @@ -911,6 +914,9 @@ msgstr "Valittu DOL" msgid "Sept" msgstr "syys" +msgid "Set Search-Filter" +msgstr "" + msgid "Set as backgroundmusic?" msgstr "Aseta taustamusiikiksi?" @@ -1194,6 +1200,9 @@ msgstr "josta" msgid "seconds left" msgstr "sekuntia jäljellä" +#~ msgid "Cover Path" +#~ msgstr "Kansien polku" + #~ msgid "No partitions found" #~ msgstr "Osioita ei löytynyt" diff --git a/Languages/french.lang b/Languages/french.lang index f1b0ba99..b3aa09d3 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: 2009-09-20 04:59+0200\n" +"POT-Creation-Date: 2009-09-27 20:15+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: Kin8\n" "Language-Team: Badablek, Amour, ikya, dj_skual & Kin8\n" @@ -46,6 +46,9 @@ msgstr "2 (Adolescents 12+)" msgid "20 min" msgstr "20 min." +msgid "2D Cover Path" +msgstr "" + msgid "3 (Mature 16+)" msgstr "3 (Matures 16+)" @@ -55,6 +58,9 @@ msgstr "3 min." msgid "30 min" msgstr "30 min." +msgid "3D Cover Path" +msgstr "" + msgid "3D Covers" msgstr "Jaquettes 3D" @@ -284,9 +290,6 @@ msgstr "Accès USB impossible." msgid "Cover Download" msgstr "Téléchargement Jaquettes" -msgid "Cover Path" -msgstr "Dossier Jaquettes" - msgid "Coverpath Change" msgstr "Dossier des Jaquettes" @@ -911,6 +914,9 @@ msgstr "Choix du DOL" msgid "Sept" msgstr "Sept" +msgid "Set Search-Filter" +msgstr "" + msgid "Set as backgroundmusic?" msgstr "Utiliser comme fond sonore ?" @@ -1194,6 +1200,9 @@ msgstr "sur" msgid "seconds left" msgstr "secondes restantes" +#~ msgid "Cover Path" +#~ msgstr "Dossier Jaquettes" + #~ msgid "You need to start this game one time to create a save file, then exit and start it again." #~ msgstr "Vous devez lancer ce jeu une fois pour créer une sauvegarde, puis éteindre et le lancer à nouveau." diff --git a/Languages/german.lang b/Languages/german.lang index d0c09bda..f268886b 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: 2009-09-20 04:59+0200\n" +"POT-Creation-Date: 2009-09-27 20:15+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: wishmasterf\n" "Language-Team: Snoozer, wishmasterf\n" @@ -46,6 +46,9 @@ msgstr "2 (Jugendliche 12+)" msgid "20 min" msgstr "20 min" +msgid "2D Cover Path" +msgstr "" + msgid "3 (Mature 16+)" msgstr "3 (Erwachsene 16+)" @@ -55,6 +58,9 @@ msgstr "3 min" msgid "30 min" msgstr "30 min" +msgid "3D Cover Path" +msgstr "" + msgid "3D Covers" msgstr "3D Cover" @@ -284,9 +290,6 @@ msgstr "Konnte USB nicht setzen." msgid "Cover Download" msgstr "Cover Download" -msgid "Cover Path" -msgstr "Cover Pfad" - msgid "Coverpath Change" msgstr "Cover Pfad ändern" @@ -911,6 +914,9 @@ msgstr "Ausgewähltes DOL" msgid "Sept" msgstr "Sept" +msgid "Set Search-Filter" +msgstr "" + msgid "Set as backgroundmusic?" msgstr "Als Hintergrundmusik wählen?" @@ -1194,6 +1200,9 @@ msgstr "von" msgid "seconds left" msgstr "Sekunden verbleiben" +#~ msgid "Cover Path" +#~ msgstr "Cover Pfad" + #~ msgid "Don't bother the USB Loader GX Team about errors in this file." #~ msgstr "Beschweren Sie sich nicht bei uns über hier angezeigte Fehler." diff --git a/Languages/hungarian.lang b/Languages/hungarian.lang index 3a9676a0..632f7cb2 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: 2009-09-20 04:59+0200\n" +"POT-Creation-Date: 2009-09-27 20:15+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: Tusk\n" "Language-Team: \n" @@ -46,6 +46,9 @@ msgstr "2 (Tinédzserek 14+)" msgid "20 min" msgstr "" +msgid "2D Cover Path" +msgstr "" + msgid "3 (Mature 16+)" msgstr "3 (Kamaszok 16+)" @@ -55,6 +58,9 @@ msgstr "" msgid "30 min" msgstr "" +msgid "3D Cover Path" +msgstr "" + msgid "3D Covers" msgstr "3D Borítók" @@ -284,9 +290,6 @@ msgstr "" msgid "Cover Download" msgstr "Boritó Letöltés" -msgid "Cover Path" -msgstr "Boritó Útvonala" - msgid "Coverpath Change" msgstr "" @@ -911,6 +914,9 @@ msgstr "" msgid "Sept" msgstr "Szep" +msgid "Set Search-Filter" +msgstr "" + msgid "Set as backgroundmusic?" msgstr "Beállítod háttérzenének?" @@ -1194,6 +1200,9 @@ msgstr " " msgid "seconds left" msgstr "hátralévõ másodperc" +#~ msgid "Cover Path" +#~ msgstr "Boritó Útvonala" + #~ msgid "No partitions found" #~ msgstr "Nem találtam particiót" diff --git a/Languages/italian.lang b/Languages/italian.lang index e9755847..3c81791f 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: 2009-09-20 04:59+0200\n" +"POT-Creation-Date: 2009-09-27 20:15+0200\n" "PO-Revision-Date: 2009-08-05 10:00+0200\n" "Last-Translator: Cambo \n" "Language-Team: FoxeJoe & Cambo\n" @@ -46,6 +46,9 @@ msgstr "2 (Ragazzini 12+)" msgid "20 min" msgstr "20 minuti" +msgid "2D Cover Path" +msgstr "" + msgid "3 (Mature 16+)" msgstr "3 (Ragazzi 16+)" @@ -55,6 +58,9 @@ msgstr "3 minuti" msgid "30 min" msgstr "30 minuti" +msgid "3D Cover Path" +msgstr "" + msgid "3D Covers" msgstr "Copertine 3D" @@ -284,9 +290,6 @@ msgstr "Non è stato possibile impostare la porta USB." msgid "Cover Download" msgstr "Scaricamento Copertine" -msgid "Cover Path" -msgstr "Percorso Copertine" - msgid "Coverpath Change" msgstr "Modifica Percorso Copertine" @@ -911,6 +914,9 @@ msgstr "File DOL selezionato" msgid "Sept" msgstr "settembre" +msgid "Set Search-Filter" +msgstr "" + msgid "Set as backgroundmusic?" msgstr "Imposto come Musica Sottofondo?" @@ -1194,6 +1200,9 @@ msgstr "di" msgid "seconds left" msgstr "secondi mancanti" +#~ msgid "Cover Path" +#~ msgstr "Percorso Copertine" + #~ msgid "Don't bother the USB Loader GX Team about errors in this file." #~ msgstr "Non infastidire il team di sviluppo dell'USB Loader GX per errori in questo file." diff --git a/Languages/japanese.lang b/Languages/japanese.lang index 5bdbcf5f..8975dcfa 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: 2009-09-20 04:59+0200\n" +"POT-Creation-Date: 2009-09-27 20:15+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: hosigumayuugi\n" "Language-Team: \n" @@ -46,6 +46,9 @@ msgstr "2 (中学生 12+)" msgid "20 min" msgstr "20分" +msgid "2D Cover Path" +msgstr "" + msgid "3 (Mature 16+)" msgstr "3 (高校生 16+)" @@ -55,6 +58,9 @@ msgstr "3分" msgid "30 min" msgstr "30分" +msgid "3D Cover Path" +msgstr "" + msgid "3D Covers" msgstr "3D カバー" @@ -284,9 +290,6 @@ msgstr "USBをセットできません" msgid "Cover Download" msgstr "カバー ダウンロード" -msgid "Cover Path" -msgstr "カバーパス" - msgid "Coverpath Change" msgstr "カバーパスの変更" @@ -911,6 +914,9 @@ msgstr "DOLの場所" msgid "Sept" msgstr "9月" +msgid "Set Search-Filter" +msgstr "" + msgid "Set as backgroundmusic?" msgstr "BGMに設定しますか" @@ -1194,6 +1200,9 @@ msgstr "" msgid "seconds left" msgstr "完了までの秒数" +#~ msgid "Cover Path" +#~ msgstr "カバーパス" + #~ msgid "Don't bother the USB Loader GX Team about errors in this file." #~ msgstr "GXの開発チームは、このファイルに関するエラーに対応しません。" diff --git a/Languages/korean.lang b/Languages/korean.lang index aeba2c73..e28f6206 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: 2009-09-20 04:59+0200\n" +"POT-Creation-Date: 2009-09-27 20:15+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: nextos@korea.com\n" "Language-Team: \n" @@ -46,6 +46,9 @@ msgstr "2 (12세 이상)" msgid "20 min" msgstr "20 분" +msgid "2D Cover Path" +msgstr "" + msgid "3 (Mature 16+)" msgstr "3 (16세 이상)" @@ -55,6 +58,9 @@ msgstr "3 분" msgid "30 min" msgstr "30 분" +msgid "3D Cover Path" +msgstr "" + msgid "3D Covers" msgstr "3D 커버" @@ -284,9 +290,6 @@ msgstr "USB 를 설정할수 없음." msgid "Cover Download" msgstr "표지 다운로드" -msgid "Cover Path" -msgstr "표지 경로" - msgid "Coverpath Change" msgstr "커퍼경로 변경" @@ -911,6 +914,9 @@ msgstr "" msgid "Sept" msgstr "9월" +msgid "Set Search-Filter" +msgstr "" + msgid "Set as backgroundmusic?" msgstr "벼경음악 설정?" @@ -1194,6 +1200,9 @@ msgstr "중" msgid "seconds left" msgstr "초 남았습니다" +#~ msgid "Cover Path" +#~ msgstr "표지 경로" + #~ msgid "Don't bother the USB Loader GX Team about errors in this file." #~ msgstr "이화일의 에러로 USB Loader GX 팀에 연락하지 마세요." diff --git a/Languages/norwegian.lang b/Languages/norwegian.lang index 8e2146b0..b94dd030 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: 2009-09-20 04:59+0200\n" +"POT-Creation-Date: 2009-09-27 20:15+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: raschi\n" "Language-Team: \n" @@ -46,6 +46,9 @@ msgstr "2 (Ungdom 12+)" msgid "20 min" msgstr "20 min" +msgid "2D Cover Path" +msgstr "" + msgid "3 (Mature 16+)" msgstr "3 (Ungdom 16+)" @@ -55,6 +58,9 @@ msgstr "3 min" msgid "30 min" msgstr "30 min" +msgid "3D Cover Path" +msgstr "" + msgid "3D Covers" msgstr "3D cover" @@ -284,9 +290,6 @@ msgstr "Kan ikke velge USB." msgid "Cover Download" msgstr "Cover nedlasting" -msgid "Cover Path" -msgstr "Cover sti" - msgid "Coverpath Change" msgstr "Endre cover sti" @@ -911,6 +914,9 @@ msgstr "Valgt DOL fil" msgid "Sept" msgstr "Sep" +msgid "Set Search-Filter" +msgstr "" + msgid "Set as backgroundmusic?" msgstr "Bruk som bakgrunnsmusikk?" @@ -1194,6 +1200,9 @@ msgstr "av" msgid "seconds left" msgstr "sekunder gjenstår" +#~ msgid "Cover Path" +#~ msgstr "Cover sti" + #~ msgid "Don't bother the USB Loader GX Team about errors in this file." #~ msgstr "Ikke bry USB Loader GX teamet med feil i denne filen." diff --git a/Languages/polish.lang b/Languages/polish.lang index d1459a61..68a0906c 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: 2009-09-20 04:59+0200\n" +"POT-Creation-Date: 2009-09-27 20:15+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: ziom666 (zadania_prog@vp.pl)\n" "Language-Team: \n" @@ -46,6 +46,9 @@ msgstr "2 (mlodziez 12+)" msgid "20 min" msgstr "" +msgid "2D Cover Path" +msgstr "" + msgid "3 (Mature 16+)" msgstr "3 (dojrzaly 16+)" @@ -55,6 +58,9 @@ msgstr "" msgid "30 min" msgstr "" +msgid "3D Cover Path" +msgstr "" + msgid "3D Covers" msgstr "Okladki 3D" @@ -284,9 +290,6 @@ msgstr "Nie mozna ustawic USB" msgid "Cover Download" msgstr "Pobierz okladki" -msgid "Cover Path" -msgstr "Sciezka okladek" - msgid "Coverpath Change" msgstr "Zmien Sciezke okladek" @@ -911,6 +914,9 @@ msgstr "" msgid "Sept" msgstr "Wrzesien" +msgid "Set Search-Filter" +msgstr "" + msgid "Set as backgroundmusic?" msgstr "Ustawic jako muzyke w tle?" @@ -1194,6 +1200,9 @@ msgstr "z" msgid "seconds left" msgstr "sekund pozostalo" +#~ msgid "Cover Path" +#~ msgstr "Sciezka okladek" + #~ msgid "Don't bother the USB Loader GX Team about errors in this file." #~ msgstr "Nie informuj team USB Loader GX o bledach w tym pliku." diff --git a/Languages/portuguese_br.lang b/Languages/portuguese_br.lang index 05fb7594..64a296c4 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: 2009-09-20 04:59+0200\n" +"POT-Creation-Date: 2009-09-27 20:15+0200\n" "PO-Revision-Date: 2009-08-11 19:45\n" "Last-Translator: boto12\n" "Language-Team: \n" @@ -46,6 +46,9 @@ msgstr "2 (Adolescente 12+)" msgid "20 min" msgstr "20 minutos" +msgid "2D Cover Path" +msgstr "" + msgid "3 (Mature 16+)" msgstr "3 (Adulto 16+)" @@ -55,6 +58,9 @@ msgstr "3 minutos" msgid "30 min" msgstr "30 minutos" +msgid "3D Cover Path" +msgstr "" + msgid "3D Covers" msgstr "Capas 3D" @@ -284,9 +290,6 @@ msgstr "Não foi possível configurar a porta USB." msgid "Cover Download" msgstr "Download de Capas" -msgid "Cover Path" -msgstr "Pasta Capas" - msgid "Coverpath Change" msgstr "Alterar Pasta das Capas" @@ -911,6 +914,9 @@ msgstr "DOL selecionado" msgid "Sept" msgstr "Set" +msgid "Set Search-Filter" +msgstr "" + msgid "Set as backgroundmusic?" msgstr "Definir como música de fundo?" @@ -1194,5 +1200,8 @@ msgstr "de" msgid "seconds left" msgstr "segundos restantes" +#~ msgid "Cover Path" +#~ msgstr "Pasta Capas" + #~ msgid "Don't bother the USB Loader GX Team about errors in this file." #~ msgstr "Não incomode a equipe do USB Loader GX por erros neste arquivo." diff --git a/Languages/portuguese_pt.lang b/Languages/portuguese_pt.lang index 93010aa1..95c46616 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: 2009-09-20 04:59+0200\n" +"POT-Creation-Date: 2009-09-27 20:15+0200\n" "PO-Revision-Date: 2009-08-11 12:25\n" "Last-Translator: Sky8000\n" "Language-Team: \n" @@ -46,6 +46,9 @@ msgstr "2 (Adolescente 12+)" msgid "20 min" msgstr "20 minutos" +msgid "2D Cover Path" +msgstr "" + msgid "3 (Mature 16+)" msgstr "3 (Adulto 16+)" @@ -55,6 +58,9 @@ msgstr "3 minutos" msgid "30 min" msgstr "30 minutos" +msgid "3D Cover Path" +msgstr "" + msgid "3D Covers" msgstr "Capas 3D" @@ -284,9 +290,6 @@ msgstr "Não foi possível configurar a porta USB." msgid "Cover Download" msgstr "Download de Capas" -msgid "Cover Path" -msgstr "Pasta Capas" - msgid "Coverpath Change" msgstr "Alterar Pasta das Capas" @@ -911,6 +914,9 @@ msgstr "DOL Seleccionado" msgid "Sept" msgstr "Set" +msgid "Set Search-Filter" +msgstr "" + msgid "Set as backgroundmusic?" msgstr "Definir como música de fundo?" @@ -1194,6 +1200,9 @@ msgstr "de" msgid "seconds left" msgstr "segundos restantes" +#~ msgid "Cover Path" +#~ msgstr "Pasta Capas" + #~ msgid "Don't bother the USB Loader GX Team about errors in this file." #~ msgstr "Não incomodes a equipa do USB Loader GX por erros neste ficheiro." diff --git a/Languages/russian.lang b/Languages/russian.lang index 868769c6..69d40520 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: 2009-09-20 04:59+0200\n" +"POT-Creation-Date: 2009-09-27 20:15+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: Kir\n" "Language-Team: Kir\n" @@ -46,6 +46,9 @@ msgstr "2 (Подростки 12+)" msgid "20 min" msgstr "" +msgid "2D Cover Path" +msgstr "" + msgid "3 (Mature 16+)" msgstr "3 (Подростки 16+)" @@ -55,6 +58,9 @@ msgstr "" msgid "30 min" msgstr "" +msgid "3D Cover Path" +msgstr "" + msgid "3D Covers" msgstr "3D Обложки" @@ -284,9 +290,6 @@ msgstr "Не могу настроить USB" msgid "Cover Download" msgstr "Скачать обложку" -msgid "Cover Path" -msgstr "Путь к обложкам" - msgid "Coverpath Change" msgstr "Изменить путь к обложкам" @@ -911,6 +914,9 @@ msgstr "" msgid "Sept" msgstr "Сен" +msgid "Set Search-Filter" +msgstr "" + msgid "Set as backgroundmusic?" msgstr "установить как фоновую музыку" @@ -1194,6 +1200,9 @@ msgstr "из" msgid "seconds left" msgstr "секунд осталось" +#~ msgid "Cover Path" +#~ msgstr "Путь к обложкам" + #~ msgid "Leaving so you can restart..." #~ msgstr "Выхожу для перезапуска..." diff --git a/Languages/schinese.lang b/Languages/schinese.lang index fa1bf775..f562a988 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: 2009-09-20 04:59+0200\n" +"POT-Creation-Date: 2009-09-27 20:15+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: knife.hu\n" "Language-Team: \n" @@ -46,6 +46,9 @@ msgstr "2 (12岁以上)" msgid "20 min" msgstr "20 分钟" +msgid "2D Cover Path" +msgstr "" + msgid "3 (Mature 16+)" msgstr "3 (16岁以上)" @@ -55,6 +58,9 @@ msgstr "3 分钟" msgid "30 min" msgstr "30 分钟" +msgid "3D Cover Path" +msgstr "" + msgid "3D Covers" msgstr "3D 封面" @@ -284,9 +290,6 @@ msgstr "无法设置 USB." msgid "Cover Download" msgstr "下载封面" -msgid "Cover Path" -msgstr "封面路径" - msgid "Coverpath Change" msgstr "变更封面路径" @@ -911,6 +914,9 @@ msgstr "已选择 DOL" msgid "Sept" msgstr "九月" +msgid "Set Search-Filter" +msgstr "" + msgid "Set as backgroundmusic?" msgstr "设置成背景音乐?" @@ -1194,6 +1200,9 @@ msgstr "的" msgid "seconds left" msgstr "剩余秒数" +#~ msgid "Cover Path" +#~ msgstr "封面路径" + #~ msgid "No partitions found" #~ msgstr "找不到分区" diff --git a/Languages/spanish.lang b/Languages/spanish.lang index 1901db8b..428798a4 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: 2009-09-20 04:59+0200\n" +"POT-Creation-Date: 2009-09-27 20:15+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: Penn\n" "Language-Team: \n" @@ -46,6 +46,9 @@ msgstr "2 (Adolescente 12+)" msgid "20 min" msgstr "20 min" +msgid "2D Cover Path" +msgstr "" + msgid "3 (Mature 16+)" msgstr "3 (Maduro 16+)" @@ -55,6 +58,9 @@ msgstr "3 min" msgid "30 min" msgstr "30 min" +msgid "3D Cover Path" +msgstr "" + msgid "3D Covers" msgstr "Carátulas 3D" @@ -284,9 +290,6 @@ msgstr "No se pudo configurar USB." msgid "Cover Download" msgstr "Descarga de Carátulas" -msgid "Cover Path" -msgstr "Ruta Carátulas" - msgid "Coverpath Change" msgstr "Cambio ruta Carátulas" @@ -911,6 +914,9 @@ msgstr "" msgid "Sept" msgstr "Sept" +msgid "Set Search-Filter" +msgstr "" + msgid "Set as backgroundmusic?" msgstr "¿Poner como másica de fondo?" @@ -1194,6 +1200,9 @@ msgstr "de" msgid "seconds left" msgstr "segundos restantes" +#~ msgid "Cover Path" +#~ msgstr "Ruta Carátulas" + #~ msgid "Don't bother the USB Loader GX Team about errors in this file." #~ msgstr "No molestes al equipo del USB Loader GX sobre errores en este archivo." diff --git a/Languages/swedish.lang b/Languages/swedish.lang index 451a79b5..7ef7dfa2 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: 2009-09-20 04:59+0200\n" +"POT-Creation-Date: 2009-09-27 20:15+0200\n" "PO-Revision-Date: 2009-08-02 12:20+0200\n" "Last-Translator: Katsurou\n" "Language-Team: Katsurou, pirateX\n" @@ -46,6 +46,9 @@ msgstr "2 (Tonåringar 12+)" msgid "20 min" msgstr "20 min" +msgid "2D Cover Path" +msgstr "" + msgid "3 (Mature 16+)" msgstr "3 (Mogen 16+)" @@ -55,6 +58,9 @@ msgstr "3 min" msgid "30 min" msgstr "30 min" +msgid "3D Cover Path" +msgstr "" + msgid "3D Covers" msgstr "3D-Omslag" @@ -284,9 +290,6 @@ msgstr "Kunde inte ställa in USB." msgid "Cover Download" msgstr "Omslagsnedladdning" -msgid "Cover Path" -msgstr "Omslagsmapp" - msgid "Coverpath Change" msgstr "Ändra omslagsmapp" @@ -911,6 +914,9 @@ msgstr "" msgid "Sept" msgstr "Sept" +msgid "Set Search-Filter" +msgstr "" + msgid "Set as backgroundmusic?" msgstr "Ställ in som bakgrundsmusik?" @@ -1194,6 +1200,9 @@ msgstr "av" msgid "seconds left" msgstr "sekunder kvar" +#~ msgid "Cover Path" +#~ msgstr "Omslagsmapp" + #~ msgid "Don't bother the USB Loader GX Team about errors in this file." #~ msgstr "Rapportera inte fel i denna fil till USB Loader GX teamet." diff --git a/Languages/tchinese.lang b/Languages/tchinese.lang index ae637345..d8d96acd 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: 2009-09-20 04:59+0200\n" +"POT-Creation-Date: 2009-09-27 20:15+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: kyogc\n" "Language-Team: \n" @@ -46,6 +46,9 @@ msgstr "(青少年 12歲以上)" msgid "20 min" msgstr "20分鐘" +msgid "2D Cover Path" +msgstr "" + msgid "3 (Mature 16+)" msgstr "(青年 16歲以上)" @@ -55,6 +58,9 @@ msgstr "3分鐘" msgid "30 min" msgstr "30分鐘" +msgid "3D Cover Path" +msgstr "" + msgid "3D Covers" msgstr "3D封面" @@ -284,9 +290,6 @@ msgstr "無法設置USB" msgid "Cover Download" msgstr "下載封面" -msgid "Cover Path" -msgstr "封面路徑" - msgid "Coverpath Change" msgstr "變更封面路徑" @@ -911,6 +914,9 @@ msgstr "" msgid "Sept" msgstr "九月" +msgid "Set Search-Filter" +msgstr "" + msgid "Set as backgroundmusic?" msgstr "設定背景音樂" @@ -1194,6 +1200,9 @@ msgstr "剩餘空間 總容量" msgid "seconds left" msgstr "剩餘秒數" +#~ msgid "Cover Path" +#~ msgstr "封面路徑" + #~ msgid "Don't bother the USB Loader GX Team about errors in this file." #~ msgstr "檔案錯誤" diff --git a/Languages/thai.lang b/Languages/thai.lang index 1ecba14a..bea70efa 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: 2009-09-20 04:59+0200\n" +"POT-Creation-Date: 2009-09-27 20:15+0200\n" "PO-Revision-Date: 2009-09-19 14:00+0700\n" "Last-Translator: Nitro_subzero \n" "Language-Team: Nitro_subzero\n" @@ -46,6 +46,9 @@ msgstr "2 (วัยรุ่น 12+)" msgid "20 min" msgstr "20 นาที" +msgid "2D Cover Path" +msgstr "" + msgid "3 (Mature 16+)" msgstr "3 (เต็มวัย 16+)" @@ -55,6 +58,9 @@ msgstr "3 นาที" msgid "30 min" msgstr "30 นาที" +msgid "3D Cover Path" +msgstr "" + msgid "3D Covers" msgstr "หน้าปก 3D" @@ -284,9 +290,6 @@ msgstr "ไม่สามารถตั้งค่า USB ได้" msgid "Cover Download" msgstr "ดาวน์โหลดปก" -msgid "Cover Path" -msgstr "ที่เก็บ ปก" - msgid "Coverpath Change" msgstr "ที่เก็บ ปก ถูกเปลี่ยนแปลง" @@ -911,6 +914,9 @@ msgstr "DOL ที่เลือก" msgid "Sept" msgstr "กย." +msgid "Set Search-Filter" +msgstr "" + msgid "Set as backgroundmusic?" msgstr "เลือกเป็น Background music?" @@ -1194,6 +1200,9 @@ msgstr "ของ" msgid "seconds left" msgstr "วินาทีที่เหลือ" +#~ msgid "Cover Path" +#~ msgstr "ที่เก็บ ปก" + #~ msgid "Don't bother the USB Loader GX Team about errors in this file." #~ msgstr "อย่ารบกวนผู้พัฒนา USB Loader GX ถ้ามีข้อผิดพลาดกับไฟล์นี้ " diff --git a/Languages/turkish.lang b/Languages/turkish.lang index 32ec8e15..7e58d7e8 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: 2009-09-20 04:59+0200\n" +"POT-Creation-Date: 2009-09-27 20:15+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -46,6 +46,9 @@ msgstr "" msgid "20 min" msgstr "" +msgid "2D Cover Path" +msgstr "" + msgid "3 (Mature 16+)" msgstr "" @@ -55,6 +58,9 @@ msgstr "" msgid "30 min" msgstr "" +msgid "3D Cover Path" +msgstr "" + msgid "3D Covers" msgstr "3B Kapaklar" @@ -284,9 +290,6 @@ msgstr "" msgid "Cover Download" msgstr "Kapak Indirme" -msgid "Cover Path" -msgstr "Kapak Yolu" - msgid "Coverpath Change" msgstr "" @@ -911,6 +914,9 @@ msgstr "" msgid "Sept" msgstr "" +msgid "Set Search-Filter" +msgstr "" + msgid "Set as backgroundmusic?" msgstr "" @@ -1194,6 +1200,9 @@ msgstr "/" msgid "seconds left" msgstr "saniye kaldi" +#~ msgid "Cover Path" +#~ msgstr "Kapak Yolu" + #~ msgid "No partitions found" #~ msgstr "Bölüm bulunamadi" diff --git a/source/FreeTypeGX.cpp b/source/FreeTypeGX.cpp index d4f774cb..26622777 100644 --- a/source/FreeTypeGX.cpp +++ b/source/FreeTypeGX.cpp @@ -90,8 +90,8 @@ FreeTypeGX::~FreeTypeGX() { */ wchar_t* FreeTypeGX::charToWideChar(char* strChar) { wchar_t *strWChar; - strWChar = new wchar_t[strlen(strChar) + 1]; - + try {strWChar = new wchar_t[strlen(strChar) + 1];} + catch (...) { return 0; } // UTF-8 int bt; bt = mbstowcs(strWChar, strChar, strlen(strChar)); diff --git a/source/buffer.cpp b/source/buffer.cpp deleted file mode 100644 index cdc1b8fc..00000000 --- a/source/buffer.cpp +++ /dev/null @@ -1,289 +0,0 @@ -/**************************************************************************** - * USB Loader GX Team - * buffer.cpp - * - * Loading covers in a background thread - ***************************************************************************/ - -#include -#include - -#include "libwiigui/gui.h" -#include "usbloader/disc.h" -#include "settings/cfg.h" -#include "buffer.h" -#include "main.h" - -#define BUFFERSIZE 9 - -extern struct discHdr * gameList; -extern u32 gameCnt; - -static lwp_t bufferthread = LWP_THREAD_NULL; -static bool BufferHalt = true; -static int loading = 0; -static int offset = 0; -static int direction = 1; -static bool changed = false; -static bool firstime = true; - -static GuiImageData NoCoverData(nocover_png); -static GuiImageData * cover[BUFFERSIZE]; -static GuiImage * coverImg[BUFFERSIZE]; -static GuiImage * NoCover[BUFFERSIZE]; - -GuiImage * ImageBuffer(int imagenumber) { - if ((BUFFERSIZE-1 > imagenumber) && direction >= 0) { - return coverImg[imagenumber]; - } - - if ((0 < imagenumber) && direction < 0) { - return coverImg[imagenumber]; - } - - if (loading == BUFFERSIZE) { - return coverImg[imagenumber]; - } - - return NoCover[imagenumber]; -} - -void LoadImages() { - if (!changed || BufferHalt) - return; - - char ID[4]; - char IDfull[7]; - char imgPath[200]; - - for (u32 i = offset; (int) i < offset+BUFFERSIZE; i++) { - - struct discHdr *header; - if (i > gameCnt-1) - header = &gameList[i-gameCnt]; - else - header = &gameList[i]; - - snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]); - snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]); - - - snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, IDfull); //Load full id image - - //firsttime loading images into memory - if (firstime) { - - if (coverImg[loading]) { - delete coverImg[loading]; - coverImg[loading] = NULL; - } - if (cover[loading]) { - delete cover[loading]; - cover[loading] = NULL; - } - - cover[loading] = new GuiImageData(imgPath,0); - if (!cover[loading]->GetImage()) { - delete cover[loading]; - cover[loading] = NULL; - snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, ID); //Load short id image - cover[loading] = new GuiImageData(imgPath, 0); - if (!cover[loading]->GetImage()) { - delete cover[loading]; - cover[loading] = NULL; - snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.theme_path); //Load no image - cover[loading] = new GuiImageData(imgPath, nocover_png); - } - } - coverImg[loading] = new GuiImage(cover[loading]); - - } else { - - if (direction >= 0) { - - if (loading < BUFFERSIZE-1) { - - if (coverImg[loading]) { - delete coverImg[loading]; - coverImg[loading] = NULL; - } - - if (loading == 0) { - if (cover[loading]) { - delete cover[loading]; - cover[loading] = NULL; - } - cover[loading] = new GuiImageData(NULL, 0); - cover[loading] = cover[loading+1]; - } else { - cover[loading] = cover[loading+1]; - } - - coverImg[loading] = new GuiImage(cover[loading]); - - } else { - - cover[loading] = new GuiImageData(imgPath,0); - if (!cover[loading]->GetImage()) { - delete cover[loading]; - cover[loading] = NULL; - snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, ID); //Load short id image - cover[loading] = new GuiImageData(imgPath, 0); - if (!cover[loading]->GetImage()) { - delete cover[loading]; - cover[loading] = NULL; - snprintf(imgPath, sizeof(imgPath), "%snoimage.png", Settings.covers_path); //Load no image - cover[loading] = new GuiImageData(imgPath, nocover_png); - } - } - if (coverImg[loading]) { - delete coverImg[loading]; - coverImg[loading] = NULL; - } - coverImg[loading] = new GuiImage(cover[loading]); - } - } else if (direction < 0) { - - if (BUFFERSIZE-loading-1 > 0) { - - if (coverImg[BUFFERSIZE-loading-1]) { - delete coverImg[BUFFERSIZE-loading-1]; - coverImg[BUFFERSIZE-loading-1] = NULL; - } - - if (BUFFERSIZE-loading-1 == BUFFERSIZE-1) { - if (cover[BUFFERSIZE-loading-1]) { - delete cover[BUFFERSIZE-loading-1]; - cover[BUFFERSIZE-loading-1] = NULL; - } - cover[BUFFERSIZE-loading-1] = new GuiImageData(NULL, 0); - cover[BUFFERSIZE-loading-1] = cover[BUFFERSIZE-loading-1-1]; - } else { - cover[BUFFERSIZE-loading-1] = cover[BUFFERSIZE-loading-1-1]; - coverImg[BUFFERSIZE-loading-1] = new GuiImage(cover[BUFFERSIZE-loading-1]); - } - - } else { - - header = &gameList[offset]; - - snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]); - snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]); - - snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, IDfull); //Load full id image - - cover[0] = new GuiImageData(imgPath,0); - if (!cover[0]->GetImage()) { - delete cover[0]; - cover[0] = NULL; - snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, ID); //Load short id image - cover[0] = new GuiImageData(imgPath, 0); - if (!cover[0]->GetImage()) { - delete cover[0]; - cover[0] = NULL; - snprintf(imgPath, sizeof(imgPath), "%snoimage.png", Settings.covers_path); //Load no image - cover[0] = new GuiImageData(imgPath, nocover_png); - } - } - if (coverImg[0]) { - delete coverImg[0]; - coverImg[0] = NULL; - } - coverImg[0] = new GuiImage(cover[0]); - } - } - } - loading++; - } - - loading = BUFFERSIZE; - changed = false; - firstime = false; -} - -void NewOffset(int off, int d) { - if (offset == off || loading < BUFFERSIZE) - return; - - direction = d; - - offset = off; - - loading = 0; - changed = true; -} - -/**************************************************************************** - * HaltBuffer - ***************************************************************************/ -void HaltBufferThread() { - BufferHalt = true; - firstime = true; - changed = true; - loading = 0; - offset = 0; - direction = 0; - - // wait for thread to finish - while (!LWP_ThreadIsSuspended(bufferthread)) - usleep(100); - - for (int i = 0; i < BUFFERSIZE; i++) { - delete cover[i]; - cover[i] = NULL; - delete coverImg[i]; - coverImg[i] = NULL; - delete NoCover[i]; - NoCover[i] = NULL; - } -} - -/**************************************************************************** - * ResumeBufferThread - ***************************************************************************/ -void ResumeBufferThread(int offset) { - BufferHalt = false; - firstime = true; - changed = true; - loading = 0; - offset = offset; - direction = 0; - - for (u8 i = 0; i < BUFFERSIZE; i++) { - if (NoCover[i] != NULL) { - delete NoCover[i]; - NoCover[i] = NULL; - } - NoCover[i] = new GuiImage(&NoCoverData); - } - - LWP_ResumeThread(bufferthread); -} - -/********************************************************************************* - * Bufferthread - *********************************************************************************/ -static void * bufferinitcallback(void *arg) { - while (1) { - if (BufferHalt) - LWP_SuspendThread(bufferthread); - - LoadImages(); - } - return NULL; -} - -/**************************************************************************** - * InitBufferThread with priority 50 - ***************************************************************************/ -void InitBufferThread() { - LWP_CreateThread(&bufferthread, bufferinitcallback, NULL, NULL, 0, 50); -} - -/**************************************************************************** - * ShutdownThread - ***************************************************************************/ -void ShutdownBufferThread() { - LWP_JoinThread (bufferthread, NULL); - bufferthread = LWP_THREAD_NULL; -} diff --git a/source/buffer.h b/source/buffer.h deleted file mode 100644 index 32a39d86..00000000 --- a/source/buffer.h +++ /dev/null @@ -1,18 +0,0 @@ -/**************************************************************************** - * USB Loader GX Team - * buffer.cpp - * - * Loading covers in a background thread - ***************************************************************************/ - -#ifndef _BUFFER_H_ -#define _BUFFER_H_ - -GuiImage * ImageBuffer(int imagenumber); -void NewOffset(int off, int d); -void InitBufferThread(); -void ShutdownBufferThread(); -void ResumeBufferThread(int offset); -void HaltBufferThread(); - -#endif diff --git a/source/cheats/cheatmenu.cpp b/source/cheats/cheatmenu.cpp index eed599f9..a76e7cec 100644 --- a/source/cheats/cheatmenu.cpp +++ b/source/cheats/cheatmenu.cpp @@ -42,14 +42,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, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText backBtnTxt(tr("Back") , 22, THEME.prompttext); backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); GuiImage backBtnImg(&btnOutline); GuiButton backBtn(&backBtnImg,&backBtnImg, 2, 3, -140, 400, &trigA, NULL, &btnClick,1); backBtn.SetLabel(&backBtnTxt); backBtn.SetTrigger(&trigB); - GuiText createBtnTxt(tr("Create") , 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText createBtnTxt(tr("Create") , 22, THEME.prompttext); createBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); GuiImage createBtnImg(&btnOutline); GuiButton createBtn(&createBtnImg,&createBtnImg, 2, 3, 160, 400, &trigA, NULL, &btnClick,1); diff --git a/source/filelist.h b/source/filelist.h index bcbe921f..ab883887 100644 --- a/source/filelist.h +++ b/source/filelist.h @@ -173,6 +173,12 @@ 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_size; @@ -311,6 +317,9 @@ extern const u32 not_favorite_png_size; extern const u8 favIcon_png[]; extern const u32 favIcon_png_size; +extern const u8 searchIcon_png[]; +extern const u32 searchIcon_png_size; + extern const u8 abcIcon_png[]; extern const u32 abcIcon_png_size; @@ -326,23 +335,8 @@ extern const u32 arrangeGrid_png_size; extern const u8 arrangeCarousel_png[]; extern const u32 arrangeCarousel_png_size; -extern const u8 favIcon_gray_png[]; -extern const u32 favIcon_gray_png_size; - -extern const u8 abcIcon_gray_png[]; -extern const u32 abcIcon_gray_png_size; - -extern const u8 playCountIcon_gray_png[]; -extern const u32 playCountIcon_gray_png_size; - -extern const u8 arrangeGrid_gray_png[]; -extern const u32 arrangeGrid_gray_png_size; - -extern const u8 arrangeList_gray_png[]; -extern const u32 arrangeList_gray_png_size; - -extern const u8 arrangeCarousel_gray_png[]; -extern const u32 arrangeCarousel_gray_png_size; +extern const u8 searchBar_png[]; +extern const u32 searchBar_png_png_size; extern const u8 settings_title_png[]; extern const u32 settings_title_png_size; diff --git a/source/homebrewboot/HomebrewBrowse.cpp b/source/homebrewboot/HomebrewBrowse.cpp index 04eb3f39..79abed01 100644 --- a/source/homebrewboot/HomebrewBrowse.cpp +++ b/source/homebrewboot/HomebrewBrowse.cpp @@ -138,7 +138,7 @@ int MenuHomebrewBrowse() { } /*** Buttons ***/ - GuiText backBtnTxt(tr("Back") , 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText backBtnTxt(tr("Back") , 22, THEME.prompttext); backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); GuiImage backBtnImg(&btnOutline); if (Settings.wsprompt == yes) { diff --git a/source/images/abcIcon.png b/source/images/abcIcon.png index b2b6cedb..b0edf71a 100644 Binary files a/source/images/abcIcon.png and b/source/images/abcIcon.png differ diff --git a/source/images/abcIcon_gray.png b/source/images/abcIcon_gray.png deleted file mode 100644 index 573d9792..00000000 Binary files a/source/images/abcIcon_gray.png and /dev/null differ diff --git a/source/images/arrangeCarousel.png b/source/images/arrangeCarousel.png index a92af535..b76d5d8b 100644 Binary files a/source/images/arrangeCarousel.png and b/source/images/arrangeCarousel.png differ diff --git a/source/images/arrangeCarousel_gray.png b/source/images/arrangeCarousel_gray.png deleted file mode 100644 index dfe51cae..00000000 Binary files a/source/images/arrangeCarousel_gray.png and /dev/null differ diff --git a/source/images/arrangeGrid.png b/source/images/arrangeGrid.png index 44d74c42..615fb402 100644 Binary files a/source/images/arrangeGrid.png and b/source/images/arrangeGrid.png differ diff --git a/source/images/arrangeGrid_gray.png b/source/images/arrangeGrid_gray.png deleted file mode 100644 index 2da58f39..00000000 Binary files a/source/images/arrangeGrid_gray.png and /dev/null differ diff --git a/source/images/arrangeList.png b/source/images/arrangeList.png index dd90792b..7c8567af 100644 Binary files a/source/images/arrangeList.png and b/source/images/arrangeList.png differ diff --git a/source/images/arrangeList_gray.png b/source/images/arrangeList_gray.png deleted file mode 100644 index d3fcd842..00000000 Binary files a/source/images/arrangeList_gray.png and /dev/null differ diff --git a/source/images/favIcon_gray.png b/source/images/favIcon_gray.png deleted file mode 100644 index 5bf8a82d..00000000 Binary files a/source/images/favIcon_gray.png and /dev/null differ diff --git a/source/images/playCountIcon.png b/source/images/playCountIcon.png index d3ed1896..af55ba49 100644 Binary files a/source/images/playCountIcon.png and b/source/images/playCountIcon.png differ diff --git a/source/images/playCountIcon_gray.png b/source/images/playCountIcon_gray.png deleted file mode 100644 index 8b1d4dff..00000000 Binary files a/source/images/playCountIcon_gray.png and /dev/null differ diff --git a/source/images/searchIcon.png b/source/images/searchIcon.png new file mode 100644 index 00000000..a8435cea Binary files /dev/null and b/source/images/searchIcon.png differ diff --git a/source/libwiigui/gui.h b/source/libwiigui/gui.h index 3d7ff25b..1531c8aa 100644 --- a/source/libwiigui/gui.h +++ b/source/libwiigui/gui.h @@ -476,8 +476,6 @@ private: GuiElement *element; }; #define LOCK(e) SimpleLock LOCK(e) -//disabled because of problems with FW 4.0 -//#define LOCK(e) //!Allows GuiElements to be grouped together into a "window" class GuiWindow : public GuiElement @@ -571,6 +569,8 @@ class GuiImageData //!Gets the image height //!\return image height int GetHeight(); + //!Sets the image to grayscale + void SetGrayscale(void); protected: u8 * data; //!< Image data int height; //!< Height of image @@ -651,6 +651,7 @@ class GuiImage : public GuiElement void SetStripe(int s); s32 z; void SetSkew(int XX1, int YY1,int XX2, int YY2,int XX3, int YY3,int XX4, int YY4); + void SetSkew(int *skew /* int skew[8] */ ); int xx1; int yy1; int xx2; @@ -696,6 +697,7 @@ class GuiText : public GuiElement //!\param t Text void SetText(const char * t); void SetTextf(const char *format, ...) __attribute__((format(printf,2,3))); + void SetText(const wchar_t * t); //!Sets up preset values to be used by GuiText(t) //!Useful when printing multiple text elements, all with the same attributes set //!\param sz Font size @@ -771,7 +773,7 @@ class GuiTooltip : public GuiElement public: //!Constructor //!\param t Text - GuiTooltip(const char *t); + GuiTooltip(const char *t, int Alpha=255); //!Destructor ~ GuiTooltip(); @@ -889,6 +891,7 @@ class GuiButton : public GuiElement //!Deactivate/Activate pointing on Games while B scrolling void ScrollIsOn(int f); void SetSkew(int XX1, int YY1,int XX2, int YY2,int XX3, int YY3,int XX4, int YY4); + void SetSkew(int *skew /* int skew[8] */ ); protected: GuiImage * image; //!< Button image (default) GuiImage * imageOver; //!< Button image for STATE_SELECTED diff --git a/source/libwiigui/gui_button.cpp b/source/libwiigui/gui_button.cpp index 7669ae37..fc114f5e 100644 --- a/source/libwiigui/gui_button.cpp +++ b/source/libwiigui/gui_button.cpp @@ -44,6 +44,8 @@ GuiButton::GuiButton(int w, int h) selectable = true; holdable = false; clickable = true; + + time1 = time2 = 0; } GuiButton::GuiButton(GuiImage* img, GuiImage* imgOver, int hor, int vert, int x, int y, GuiTrigger* trig, GuiSound* sndOver, GuiSound* sndClick, u8 grow) @@ -53,7 +55,7 @@ GuiButton::GuiButton(GuiImage* img, GuiImage* imgOver, int hor, int vert, int x, image = img; image->SetParent(this); imageOver = imgOver; - imageOver->SetParent(this); + if(imageOver) imageOver->SetParent(this); imageHold = NULL; imageClick = NULL; icon = NULL; @@ -87,6 +89,7 @@ GuiButton::GuiButton(GuiImage* img, GuiImage* imgOver, int hor, int vert, int x, effectAmountOver = 4; effectTargetOver = 110; } + time1 = time2 = 0; } GuiButton::GuiButton(GuiImage* img, GuiImage* imgOver, int hor, int vert, int x, int y, GuiTrigger* trig, GuiSound* sndOver, GuiSound* sndClick, u8 grow, GuiTooltip* tt, int ttx, int tty, int h_align, int v_align) @@ -96,7 +99,7 @@ GuiButton::GuiButton(GuiImage* img, GuiImage* imgOver, int hor, int vert, int x, image = img; image->SetParent(this); imageOver = imgOver; - imageOver->SetParent(this); + if(imageOver) imageOver->SetParent(this); imageHold = NULL; imageClick = NULL; icon = NULL; @@ -135,6 +138,8 @@ GuiButton::GuiButton(GuiImage* img, GuiImage* imgOver, int hor, int vert, int x, toolTip->SetParent(this); toolTip->SetAlignment(h_align, v_align); toolTip->SetPosition(ttx,tty); + + time1 = time2 = 0; } /** @@ -263,7 +268,8 @@ void GuiButton::RemoveSoundClick() } void GuiButton::SetSkew(int XX1, int YY1,int XX2, int YY2,int XX3, int YY3,int XX4, int YY4) { - + if(image) + { image->xx1 = XX1; image->yy1 = YY1; image->xx2 = XX2; @@ -272,6 +278,13 @@ void GuiButton::SetSkew(int XX1, int YY1,int XX2, int YY2,int XX3, int YY3,int X image->yy3 = YY3; image->xx4 = XX4; image->yy4 = YY4; + } +} + +void GuiButton::SetSkew(int *skew) +{ + if(image) + image->SetSkew(skew); } @@ -308,7 +321,7 @@ void GuiButton::Draw() void GuiButton::DrawTooltip() { LOCK(this); - if(state == STATE_SELECTED && toolTip) + if(this->IsVisible() && state == STATE_SELECTED && toolTip) { if (time2 == 0) { @@ -344,7 +357,7 @@ void GuiButton::ScrollIsOn(int f) void GuiButton::Update(GuiTrigger * t) { LOCK(this); - if(state == STATE_CLICKED || state == STATE_DISABLED || !t) + if(!this->IsVisible() || state == STATE_CLICKED || state == STATE_DISABLED || !t) return; else if(parentElement && parentElement->GetState() == STATE_DISABLED) return; diff --git a/source/libwiigui/gui_customoptionbrowser.cpp b/source/libwiigui/gui_customoptionbrowser.cpp index f4c08139..254d6a03 100644 --- a/source/libwiigui/gui_customoptionbrowser.cpp +++ b/source/libwiigui/gui_customoptionbrowser.cpp @@ -179,17 +179,17 @@ GuiCustomOptionBrowser::GuiCustomOptionBrowser(int w, int h, customOptionList * for(int i=0; i < size; i++) { - optionTxt[i] = new GuiText(options->GetName(i), 20, (GXColor){THEME.settingsTxt_r, THEME.settingsTxt_g, THEME.settingsTxt_b, 0xff}); + optionTxt[i] = new GuiText(options->GetName(i), 20, THEME.settingstext); optionTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); optionTxt[i]->SetPosition(24,0); optionTxt[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2+24), GuiText::DOTTED); optionBg[i] = new GuiImage(bgOptionsEntry); - optionVal[i] = new GuiText(NULL, 20, (GXColor){THEME.settingsTxt_r, THEME.settingsTxt_g, THEME.settingsTxt_b, 0xff}); + optionVal[i] = new GuiText(NULL, 20, THEME.settingstext); optionVal[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); - optionValOver[i] = new GuiText(NULL, 20, (GXColor){THEME.settingsTxt_r, THEME.settingsTxt_g, THEME.settingsTxt_b, 0xff}); + optionValOver[i] = new GuiText(NULL, 20, THEME.settingstext); optionValOver[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); optionBtn[i] = new GuiButton(width-28,GAMESELECTSIZE); diff --git a/source/libwiigui/gui_element.cpp b/source/libwiigui/gui_element.cpp index 99ad3bda..ac9424ac 100644 --- a/source/libwiigui/gui_element.cpp +++ b/source/libwiigui/gui_element.cpp @@ -13,7 +13,7 @@ /** * Constructor for the Object class. */ -mutex_t GuiElement::mutex = 0; +mutex_t GuiElement::mutex = LWP_MUTEX_NULL; GuiElement::GuiElement() { xoffset = 0; @@ -65,7 +65,7 @@ GuiElement::GuiElement() // default alignment - align to top left alignmentVert = ALIGN_TOP; alignmentHor = ALIGN_LEFT; - if(mutex == 0) LWP_MutexInit(&mutex, true); + if(mutex == LWP_MUTEX_NULL) LWP_MutexInit(&mutex, true); } /** diff --git a/source/libwiigui/gui_gamebrowser.cpp b/source/libwiigui/gui_gamebrowser.cpp index cf03013a..2f083331 100644 --- a/source/libwiigui/gui_gamebrowser.cpp +++ b/source/libwiigui/gui_gamebrowser.cpp @@ -124,13 +124,13 @@ GuiGameBrowser::GuiGameBrowser(int w, int h, struct discHdr * l, int gameCnt, co for(int i=0; i < pagesize; i++) { - gameTxt[i] = new GuiText(get_title(&gameList[i]), 20, (GXColor){THEME.gameText_r, THEME.gameText_g, THEME.gameText_b, 0xff}); + gameTxt[i] = new GuiText(get_title(&gameList[i]), 20, THEME.gametext); gameTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); gameTxt[i]->SetPosition(24,0); gameTxt[i]->SetMaxWidth(maxTextWidth, GuiText::DOTTED); - gameTxtOver[i] = new GuiText(get_title(&gameList[i]), 20, (GXColor){THEME.gameText_r, THEME.gameText_g, THEME.gameText_b, 0xff}); + gameTxtOver[i] = new GuiText(get_title(&gameList[i]), 20, THEME.gametext); gameTxtOver[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); gameTxtOver[i]->SetPosition(24,0); gameTxtOver[i]->SetMaxWidth(maxTextWidth, GuiText::SCROLL); @@ -413,7 +413,7 @@ void GuiGameBrowser::Update(GuiTrigger * t) game[selectedItem+1]->SetState(STATE_SELECTED, t->chan); selectedItem++; } - scrollbarBoxBtn->Draw(); +// scrollbarBoxBtn->Draw(); usleep(10000 * scrolldelay); } if (!(ButtonsHold() & WPAD_BUTTON_A)) @@ -436,7 +436,7 @@ void GuiGameBrowser::Update(GuiTrigger * t) game[selectedItem-1]->SetState(STATE_SELECTED, t->chan); selectedItem--; } - scrollbarBoxBtn->Draw(); +// scrollbarBoxBtn->Draw(); usleep(10000 * scrolldelay); } if (!(ButtonsHold() & WPAD_BUTTON_A)) @@ -470,7 +470,7 @@ void GuiGameBrowser::Update(GuiTrigger * t) game[selectedItem-1]->SetState(STATE_SELECTED, t->chan); selectedItem--; } - scrollbarBoxBtn->Draw(); +// scrollbarBoxBtn->Draw(); usleep(10000 * scrolldelay); } } @@ -491,7 +491,7 @@ void GuiGameBrowser::Update(GuiTrigger * t) game[selectedItem+1]->SetState(STATE_SELECTED, t->chan); selectedItem++; } - scrollbarBoxBtn->Draw(); +// scrollbarBoxBtn->Draw(); usleep(10000 * scrolldelay); } } diff --git a/source/libwiigui/gui_gamebrowser.h b/source/libwiigui/gui_gamebrowser.h index 173db5f6..cc6a1a26 100644 --- a/source/libwiigui/gui_gamebrowser.h +++ b/source/libwiigui/gui_gamebrowser.h @@ -7,7 +7,7 @@ class GuiGameBrowser : public GuiElement { public: - GuiGameBrowser(int w, int h, struct discHdr * l, int gameCnt, const char *themePath, const u8 *imagebg, int selected = 0, int offset = 0); + GuiGameBrowser(int w, int h, struct discHdr *l, int gameCnt, const char *themePath, const u8 *imagebg, int selected = 0, int offset = 0); ~GuiGameBrowser(); int FindMenuItem(int c, int d); int GetClickedOption(); diff --git a/source/libwiigui/gui_gamecarousel.cpp b/source/libwiigui/gui_gamecarousel.cpp index 64ebb4a3..acb57be5 100644 --- a/source/libwiigui/gui_gamecarousel.cpp +++ b/source/libwiigui/gui_gamecarousel.cpp @@ -8,12 +8,13 @@ #include "gui.h" #include "../wpad.h" +#include "../menu.h" #include +#include "gui_image_async.h" #include "gui_gamecarousel.h" #include "../settings/cfg.h" #include "../main.h" -#include "../buffer.h" #include #include @@ -27,24 +28,34 @@ #define SPEED_STEP 4 #define SPEED_LIMIT 250 +static inline int OFFSETLIMIT(int Offset, int gameCnt) +{ + while(Offset < 0) Offset+=gameCnt; + return Offset%gameCnt; +} +#define GetGameIndex(pageEntry, listOffset, gameCnt) OFFSETLIMIT(listOffset+pageEntry, gameCnt) +static GuiImageData *GameCarouselLoadCoverImage(void * Arg) +{ + return LoadCoverImage((struct discHdr *)Arg, true, false); +} /** * Constructor for the GuiGameCarousel class. */ -GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int count, const char *themePath, const u8 *imagebg, int selected, int offset) +GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int count, const char *themePath, const u8 *imagebg, int selected, int offset) : +noCover(nocover_png) { width = w; height = h; gameCnt = count; gameList = l; - pagesize = (gameCnt < PAGESIZE) ? gameCnt : PAGESIZE; + pagesize = (gameCnt < 11) ? gameCnt : 11; listOffset = 0; selectable = true; - selectedItem = 0; - if (selectedItem==0)selectedItem=(pagesize+1)/2; + selectedItem = -1; focus = 1; // allow focus - firstPic = 0; clickedItem = -1; - speed = SHIFT_SPEED; + + speed = 0; char imgPath[100]; trigA = new GuiTrigger; @@ -96,31 +107,65 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int count, co btnRight->SetTrigger(trigPlus); btnRight->SetEffectGrow(); - ResumeBufferThread(listOffset); - - ttgame = new GuiTooltip(" "); - - gamename = new GuiText(" ", 18, (GXColor) {THEME.info_r, THEME.info_g, THEME.info_b, 255}); + gamename = new GuiText(" ", 18, THEME.info); gamename->SetParent(this); gamename->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); gamename->SetPosition(0, 330); gamename->SetMaxWidth(280, GuiText::DOTTED); - gameIndex = new int[pagesize]; - game = new GuiButton * [pagesize]; + gameIndex = new int[pagesize]; + game = new GuiButton * [pagesize]; + titleTT = new GuiTooltip * [pagesize]; + coverImg = new GuiImageAsync * [pagesize]; + + for(int i=0; i < pagesize; i++) + { + //------------------------ + // Index + //------------------------ + gameIndex[i] = GetGameIndex(i, listOffset, gameCnt); + + //------------------------ + // Tooltip + //------------------------ + titleTT[i] = new GuiTooltip(get_title(&gameList[gameIndex[i]]), THEME.tooltipAlpha); + + //------------------------ + // Image + //------------------------ + coverImg[i] = new(std::nothrow) GuiImageAsync(GameCarouselLoadCoverImage, &gameList[gameIndex[i]], sizeof(struct discHdr), &noCover); + if(coverImg[i]) + coverImg[i]->SetWidescreen(CFG.widescreen); + + //------------------------ + // GameButton + //------------------------ - for(int i=0; i < pagesize; i++) { game[i] = new GuiButton(122,244); game[i]->SetParent(this); game[i]->SetAlignment(ALIGN_CENTRE,ALIGN_MIDDLE); game[i]->SetPosition(0,740); - game[i]->SetImage(ImageBuffer((listOffset+i) % gameCnt)); + game[i]->SetImage(coverImg[i]); game[i]->SetScale(SCALE); game[i]->SetRumble(false); game[i]->SetTrigger(trigA); game[i]->SetSoundClick(btnSoundClick); game[i]->SetClickable(true); game[i]->SetEffect(EFFECT_GOROUND, IN_SPEED, 90-(pagesize-2*i-1)*DEG_OFFSET/2, RADIUS, 180, 1, 0, RADIUS); + switch((i*3)/pagesize) + { + case 0: + game[i]->SetToolTip(titleTT[i], 122/2, -244/4, ALIGN_LEFT, ALIGN_MIDDLE); + break; + case 1: + game[i]->SetToolTip(titleTT[i], 0, -244/4, ALIGN_CENTRE, ALIGN_MIDDLE); + break; + case 2: + game[i]->SetToolTip(titleTT[i], -122/2, -244/4, ALIGN_RIGHT, ALIGN_MIDDLE); + break; + default: + break; + } } } @@ -130,8 +175,6 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int count, co */ GuiGameCarousel::~GuiGameCarousel() { - HaltBufferThread(); - delete imgRight; delete imgLeft; delete btnLeftImg; @@ -146,15 +189,18 @@ GuiGameCarousel::~GuiGameCarousel() delete trigMinus; delete btnSoundClick; delete btnSoundOver; - delete ttgame; delete gamename; for(int i=0; iResetState(); - if(f == 1) + if(f == 1 && selectedItem>=0) game[selectedItem]->SetState(STATE_SELECTED); } @@ -189,22 +235,20 @@ void GuiGameCarousel::ResetState() int GuiGameCarousel::GetOffset() { + LOCK(this); return listOffset; } int GuiGameCarousel::GetClickedOption() { + LOCK(this); int found = -1; - if (clickedItem>=0 && clickedItem<=pagesize){ - if (game[(clickedItem+1) % pagesize]->GetState()==STATE_SELECTED){ - found = (clickedItem+listOffset+1) % gameCnt; - game[(clickedItem+1) % pagesize]->SetState(STATE_SELECTED); - game[clickedItem]->SetState(STATE_SELECTED); - } else { - game[clickedItem]->SetState(STATE_SELECTED); - found= (clickedItem+listOffset) % gameCnt;} - clickedItem=-1; + if (clickedItem>=0) + { + game[clickedItem]->SetState(STATE_SELECTED); + found = gameIndex[clickedItem]; + clickedItem=-1; } return found; } @@ -212,41 +256,20 @@ int GuiGameCarousel::GetClickedOption() int GuiGameCarousel::GetSelectedOption() { + LOCK(this); int found = -1; - for(int i=pagesize-1; i>-1; i--) { - if(game[i]->GetState() == STATE_SELECTED) { + for(int i=0; iGetState() == STATE_SELECTED) + { game[i]->SetState(STATE_SELECTED); - found = (listOffset+i) % gameCnt; + found = gameIndex[i]; break; } } return found; } - -/**************************************************************************** - * FindMenuItem - * - * Help function to find the next visible menu item on the list - ***************************************************************************/ - -int GuiGameCarousel::FindMenuItem(int currentItem, int direction) -{ - int nextItem = currentItem + direction; - - if(nextItem < 0 || nextItem >= gameCnt) - if(gameCnt <= pagesize) - return -1; - else - nextItem = (nextItem < 0) ? nextItem + gameCnt : nextItem - gameCnt; - - if(strlen(get_title(&gameList[nextItem])) > 0) - return nextItem; - else - return FindMenuItem(nextItem, direction); -} - - /** * Draw the button on screen */ @@ -256,31 +279,22 @@ void GuiGameCarousel::Draw() if(!this->IsVisible() || !gameCnt) return; - int next = listOffset; - - for(int i=0; i= 0) { - game[i]->SetImage(ImageBuffer(i)); - game[i]->Draw(); - next = this->FindMenuItem(next, 1); - } else break; - } + for(int i=0; iDraw(); - //!Draw tooltip after the Images to have it on top - for(int i=0; i= 0) { - if(Settings.tooltips == TooltipsOn) - game[i]->DrawTooltip(); - next = this->FindMenuItem(next, 1); - } else break; - } gamename->Draw(); - if(gameCnt > pagesize) { + if(gameCnt > 6) + { btnRight->Draw(); btnLeft->Draw(); - } + } + + //!Draw tooltip after the Images to have it on top + if (focus && Settings.tooltips == TooltipsOn) + for(int i=0; iDrawTooltip(); this->UpdateEffects(); } @@ -292,136 +306,216 @@ void GuiGameCarousel::Update(GuiTrigger * t) if(state == STATE_DISABLED || !t || !gameCnt) return; - if(!(game[0]->GetEffect() || game[0]->GetEffectOnOver())) { - for(int i=0; iSetEffectGrow(); - } - } - - if(speed > SPEED_LIMIT) - speed = SPEED_LIMIT; - btnRight->Update(t); btnLeft->Update(t); - - if(btnRight->GetState() == STATE_CLICKED) { - if(Settings.xflip==sysmenu ||Settings.xflip==yes) { - NewOffset(listOffset, 1); - } else { - NewOffset(listOffset, -1); - } - } else if(btnLeft->GetState() == STATE_CLICKED) { - if(Settings.xflip==sysmenu ||Settings.xflip==yes) { - NewOffset(listOffset, -1); - } else { - NewOffset(listOffset, 1); - } - } - - int next = listOffset; - - for(int i=0; i= 0) { - if(game[i]->GetState() == STATE_DISABLED) { - game[i]->SetVisible(true); - game[i]->SetState(STATE_DEFAULT); - game[i]->RemoveToolTip(); - } - game[i]->SetEffectOnOver(EFFECT_SCALE, 1, 130); - gameIndex[i] = next; - next = this->FindMenuItem(next, 1); - } else { - game[i]->SetVisible(false); - game[i]->SetState(STATE_DISABLED); - } - - 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, t->chan); - } - game[i]->Update(t); - - if(game[i]->GetState() == STATE_SELECTED) { - selectedItem = i; - } - if(game[i]->GetState() == STATE_CLICKED) { - clickedItem = i; - } + + if(game[0]->GetEffect() & EFFECT_GOROUND || game[pagesize-1]->GetEffect() & EFFECT_GOROUND) + { + return; // skip when rotate } - ///Tooltip stuff - struct discHdr *header = &gameList[this->GetSelectedOption()]; - ttgame->SetText(get_title(header)); - game[selectedItem]->SetToolTip(ttgame, 0, 0); - ttgame->SetPosition(0, 20); - if(selectedItem < PAGESIZE/2+1) - ttgame->SetAlignment(ALIGN_LEFT, ALIGN_TOP); - else - ttgame->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); - - ///GameText - gamename->SetText(get_title(header)); - - /// navigation - if(!focus || gameCnt <= pagesize || (game[0]->GetEffect() && game[pagesize-1]->GetEffect())) - return; // skip navigation - - if (((btnLeft->GetState() == STATE_CLICKED) &&(Settings.xflip!=sysmenu)&&(Settings.xflip!=yes)) - ||((btnRight->GetState() == STATE_CLICKED) &&((Settings.xflip==sysmenu)||(Settings.xflip==yes)))){ - - u16 buttons = ButtonsHold(); - if(!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_MINUS) || t->Left() || - (buttons & WPAD_BUTTON_PLUS) || t->Right())) { - btnLeft->ResetState(); - btnRight->ResetState(); - speed = SHIFT_SPEED; - return; + // find selected + clicked + int selectedItem_old = selectedItem; + selectedItem = -1; + clickedItem = -1; + for(int i=pagesize-1; i>=0; i--) + { + game[i]->Update(t); + if(game[i]->GetState() == STATE_SELECTED) + { + selectedItem = i; + } + if(game[i]->GetState() == STATE_CLICKED) + { + clickedItem = i; } - for(int i=0; iStopEffect(); - } - - listOffset = (listOffset+1 < gameCnt) ? listOffset+1 : 0; - firstPic = (firstPic+1 < pagesize) ? firstPic+1 : 0; - - game[pagesize-1]->SetPosition(0, RADIUS); - - - for (int i=0; iSetEffect(EFFECT_GOROUND, -speed, DEG_OFFSET, RADIUS, 270-(pagesize-2*i-3)*DEG_OFFSET/2, 1, 0, RADIUS); - } - speed+=SPEED_STEP; } - else if (((btnRight->GetState() == STATE_CLICKED) &&(Settings.xflip!=sysmenu)&&(Settings.xflip!=yes)) - ||((btnLeft->GetState() == STATE_CLICKED) &&((Settings.xflip==sysmenu)||(Settings.xflip==yes)))){ - - u16 buttons = ButtonsHold(); - if(!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_MINUS) || t->Left() || - (buttons & WPAD_BUTTON_PLUS) || t->Right())) { - btnLeft->ResetState(); - btnRight->ResetState(); - speed = SHIFT_SPEED; - return; + /// OnOver-Effect + GameText + Tooltop + if(selectedItem_old != selectedItem) + { + if(selectedItem>=0) + { + game[selectedItem]->SetEffect(EFFECT_SCALE, 1, 130); + char *gameTitle = get_title(&gameList[gameIndex[selectedItem]]); + gamename->SetText(gameTitle); } - - for(int i=0; iStopEffect(); + else + gamename->SetText((char*)NULL); + if(selectedItem_old>=0) + { + game[selectedItem_old]->SetEffect(EFFECT_SCALE, -1, 100); + game[selectedItem_old]->RemoveToolTip(); } - listOffset = (listOffset-1 < 0) ? gameCnt-1 : listOffset-1; - firstPic = (firstPic-1 < 0) ? pagesize-1 : firstPic-1; - - game[0]->SetPosition(0, RADIUS); - - for(int i=0; iSetEffect(EFFECT_GOROUND, speed, DEG_OFFSET, RADIUS, 270-(pagesize-2*i+1)*DEG_OFFSET/2, 1, 0, RADIUS); - } - speed+=SPEED_STEP; } + // navigation + if(focus && gameCnt>6) + { + int newspeed = 0; + // Left/Right Navigation + if (btnLeft->GetState() == STATE_CLICKED) + { + WPAD_ScanPads(); + u16 buttons = 0; + for(int i=0; i<4; i++) + buttons |= WPAD_ButtonsHeld(i); + if(!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_MINUS) || t->Left())) + { + btnLeft->ResetState(); + return; + } + + if (Settings.xflip==sysmenu || Settings.xflip==yes || Settings.xflip==disk3d) + newspeed = SHIFT_SPEED; + else + newspeed = -SHIFT_SPEED; + } + else if(btnRight->GetState() == STATE_CLICKED) + { + WPAD_ScanPads(); + u16 buttons = 0; + for(int i=0; i<4; i++) + buttons |= WPAD_ButtonsHeld(i); + if(!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_PLUS) || t->Right())) + { + btnRight->ResetState(); + return; + } + if (Settings.xflip==sysmenu ||Settings.xflip==yes || Settings.xflip==disk3d) + newspeed = -SHIFT_SPEED; + else + newspeed = SHIFT_SPEED; + } + if(newspeed) + { + if(speed==0) + speed = newspeed; + else if(speed>0) + { + if((speed+=SPEED_STEP) > SPEED_LIMIT) + speed = SPEED_LIMIT; + } + else + { + if((speed-=SPEED_STEP) < -SPEED_LIMIT) + speed = -SPEED_LIMIT; + } + } + else + speed = 0; + + + if(speed > 0) // rotate right + { + GuiButton *tmpButton; + GuiTooltip *tmpTT; + listOffset = OFFSETLIMIT(listOffset - 1, gameCnt); // set the new listOffset + // Save right Button + TollTip and destroy right Image + Image-Data + delete coverImg[pagesize-1]; coverImg[pagesize-1] = NULL;game[pagesize-1]->SetImage(NULL); + tmpButton = game[pagesize-1]; + tmpTT = titleTT[pagesize-1]; + + // Move all Page-Entries one step right + for (int i=pagesize-1; i>=1; i--) + { + titleTT[i] = titleTT[i-1]; + coverImg[i] = coverImg[i-1]; + game[i] = game[i-1]; + gameIndex[i] = gameIndex[i-1]; + } + // set saved Button & gameIndex to right + gameIndex[0] = listOffset; + titleTT[0] = tmpTT; + titleTT[0] ->SetText(get_title(&gameList[gameIndex[0]])); + coverImg[0] = new GuiImageAsync(GameCarouselLoadCoverImage, &gameList[gameIndex[0]], sizeof(struct discHdr), &noCover); + coverImg[0] ->SetWidescreen(CFG.widescreen); + + game[0] = tmpButton; + game[0] ->SetImage(coverImg[0]); + + + for(int i=0; iStopEffect(); + game[i]->ResetState(); + game[i]->SetEffect(EFFECT_GOROUND, speed, DEG_OFFSET, RADIUS, 270-(pagesize-2*i+1)*DEG_OFFSET/2, 1, 0, RADIUS); + game[i]->UpdateEffects(); // rotate one step for liquid scrolling + + // Set Tooltip-Position + switch((i*3)/pagesize) + { + case 0: + game[i]->SetToolTip(titleTT[i], 122/4, -244/4, ALIGN_LEFT, ALIGN_MIDDLE); + break; + case 1: + game[i]->SetToolTip(titleTT[i], 0, -244/4, ALIGN_CENTRE, ALIGN_MIDDLE); + break; + case 2: + game[i]->SetToolTip(titleTT[i], -122/4, -244/4, ALIGN_RIGHT, ALIGN_MIDDLE); + break; + default: + break; + } + } + } + else if(speed < 0) // rotate left + { + GuiButton *tmpButton; + GuiTooltip *tmpTT; + listOffset = OFFSETLIMIT(listOffset + 1, gameCnt); // set the new listOffset + // Save left Button + TollTip and destroy left Image + Image-Data + delete coverImg[0]; coverImg[0] = NULL;game[0]->SetImage(NULL); + tmpButton = game[0]; + tmpTT = titleTT[0]; + + // Move all Page-Entries one step left + for (int i=0; i<(pagesize-1); i++) + { + titleTT[i] = titleTT[i+1]; + coverImg[i] = coverImg[i+1]; + game[i] = game[i+1]; + gameIndex[i] = gameIndex[i+1]; + } + // set saved Button & gameIndex to right + int ii = pagesize-1; + gameIndex[ii] = OFFSETLIMIT(listOffset + ii, gameCnt); + titleTT[ii] = tmpTT; + titleTT[ii] ->SetText(get_title(&gameList[gameIndex[0]])); + coverImg[ii] = new GuiImageAsync(GameCarouselLoadCoverImage, &gameList[gameIndex[ii]], sizeof(struct discHdr), &noCover); + coverImg[ii] ->SetWidescreen(CFG.widescreen); + + game[ii] = tmpButton; + game[ii] ->SetImage(coverImg[ii]); + + + for(int i=0; iStopEffect(); + game[i]->ResetState(); + game[i]->SetEffect(EFFECT_GOROUND, speed, DEG_OFFSET, RADIUS, 270-(pagesize-2*i-3)*DEG_OFFSET/2, 1, 0, RADIUS); + game[i]->UpdateEffects(); // rotate one step for liquid scrolling + + // Set Tooltip-Position + switch((i*3)/pagesize) + { + case 0: + game[i]->SetToolTip(titleTT[i], 122/4, -244/4, ALIGN_LEFT, ALIGN_MIDDLE); + break; + case 1: + game[i]->SetToolTip(titleTT[i], 0, -244/4, ALIGN_CENTRE, ALIGN_MIDDLE); + break; + case 2: + game[i]->SetToolTip(titleTT[i], -122/4, -244/4, ALIGN_RIGHT, ALIGN_MIDDLE); + break; + default: + break; + } + } + } + + } if(updateCB) updateCB(this); } diff --git a/source/libwiigui/gui_gamecarousel.h b/source/libwiigui/gui_gamecarousel.h index ed0df063..a272b283 100644 --- a/source/libwiigui/gui_gamecarousel.h +++ b/source/libwiigui/gui_gamecarousel.h @@ -3,7 +3,7 @@ #include "gui.h" #include "../usbloader/disc.h" - +class GuiImageAsync; class GuiGameCarousel : public GuiElement { public: @@ -20,11 +20,11 @@ class GuiGameCarousel : public GuiElement void Reload(struct discHdr * l, int count); //GuiText * optionVal[PAGESIZE]; protected: + GuiImageData noCover; int selectedItem; int listOffset; int scrollbaron; int pagesize; - int firstPic; int speed; int clickedItem; @@ -32,10 +32,9 @@ class GuiGameCarousel : public GuiElement int gameCnt; int * gameIndex; - GuiButton ** game; - - GuiTooltip * ttgame; + GuiTooltip ** titleTT; + GuiImageAsync ** coverImg; GuiText * gamename; diff --git a/source/libwiigui/gui_gamegrid.cpp b/source/libwiigui/gui_gamegrid.cpp index 6445778d..36ca3e22 100644 --- a/source/libwiigui/gui_gamegrid.cpp +++ b/source/libwiigui/gui_gamegrid.cpp @@ -1,2092 +1,965 @@ -/**************************************************************************** - * libwiigui - * - * gui_gameGrid.cpp - * - * GUI class definitions - ***************************************************************************/ - -#include "gui.h" -#include "../wpad.h" - -#include -#include "gui_gamegrid.h" -#include "../settings/cfg.h" -#include "../prompts/PromptWindows.h" -#include "../language/gettext.h" -#include "../menu.h" -#include "fatmounter.h" - -#include -#include -#include - -#define SCALE 0.8f -#define DEG_OFFSET 7 -#define RADIUS 780 -#define IN_SPEED 175 -#define SHIFT_SPEED 100 -#define SPEED_STEP 4 -#define SAFETY 320 - -#include "../main.h" - - - - -extern const int vol; -int mover=0, mover2=0; -u8 goback=0; -int goLeft = 0, goRight=0; -char debugbuffer[100]; -int c; -int selectedOld=0; -int wait=0,wait1=0; -bool isover=false; - -/** - * Constructor for the GuiGamegrid class. - */ -GuiGameGrid::GuiGameGrid(int w, int h, struct discHdr * l, int count, const char *themePath, const u8 *imagebg, int selected, int offset) -{ - width = w; - height = h; - gameCnt = (count < SAFETY) ? count : SAFETY; - gameList = l; - c=count; - listOffset = 0; - selectable = true; - selectedItem = 0; - focus = 1; // allow focus - firstPic = 0; - clickedItem = -1; - speed = SHIFT_SPEED; - char imgPath[100]; - rows =3; - drawTTs=0; - - - - if ((count<42)&&(rows==3))rows=2; - if ((count<16)&&(rows==2))rows=1; - if (gameCnt<6)gameCnt=6; - - if (rows==1)pagesize = 6; - else if (rows==2)pagesize = 16; - else if (rows==3)pagesize = 42; - - - //if (realCntSetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); - trigL = new GuiTrigger; - trigL->SetButtonOnlyTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT); - trigR = new GuiTrigger; - trigR->SetButtonOnlyTrigger(-1, WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT, PAD_BUTTON_RIGHT); - trig1 = new GuiTrigger; - trig1->SetButtonOnlyTrigger(-1, WPAD_BUTTON_UP | WPAD_CLASSIC_BUTTON_X, PAD_BUTTON_X); - trig2 = new GuiTrigger; - trig2->SetButtonOnlyTrigger(-1, WPAD_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_Y, PAD_BUTTON_Y); - trigPlus = new GuiTrigger; - trigPlus->SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, 0); - trigMinus = new GuiTrigger; - trigMinus->SetButtonOnlyTrigger(-1, WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS, 0); - - btnSoundClick = new GuiSound(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, Settings.sfxvolume); - btnSoundOver = new GuiSound(button_over_pcm, button_over_pcm_size, SOUND_PCM, Settings.sfxvolume); - - int btnHeight = (int) lround(sqrt(RADIUS*RADIUS - 90000)-RADIUS-50); - - btnLeft = new GuiButton(0,0); - btnLeft->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); - btnLeft->SetPosition(20, btnHeight); - btnLeft->SetParent(this); - btnLeft->SetSoundOver(btnSoundOver); - btnLeft->SetTrigger(trigL); - btnLeft->SetTrigger(trigMinus); - - /*debugTxt = new GuiText("fag", 14, (GXColor){0,0,0, 255}); - debugTxt->SetParent(this); - debugTxt->SetAlignment(2,5); - debugTxt->SetPosition(0,180);*/ - - - btnRight = new GuiButton(0,0); - btnRight->SetParent(this); - btnRight->SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE); - btnRight->SetPosition(-20, btnHeight); - btnRight->SetSoundOver(btnSoundOver); - btnRight->SetTrigger(trigR); - btnRight->SetTrigger(trigPlus); - - btnRowUp = new GuiButton(0,0); - btnRowUp->SetParent(this); - btnRowUp->SetAlignment(ALIGN_LEFT, ALIGN_TOP); - btnRowUp->SetPosition(0,0); - btnRowUp->SetTrigger(trig2); - - btnRowDown = new GuiButton(0,0); - btnRowDown->SetParent(this); - btnRowDown->SetAlignment(ALIGN_LEFT, ALIGN_TOP); - btnRowDown->SetPosition(0,0); - btnRowDown->SetTrigger(trig1); - - titleTT = new GuiTooltip(" "); - titleTT->SetAlignment(ALIGN_LEFT, ALIGN_TOP); - titleTT->SetPosition(-100,0); - titleTT->SetAlpha(THEME.tooltipAlpha); - - gameIndex = new int[pagesize]; - game = new GuiButton * [pagesize]; - bob = new int[pagesize]; - coverImg = new GuiImage * [gameCnt]; - cover = new GuiImageData * [gameCnt]; - - if(!gameCnt) - return; - - for(int i=0; ipagesize?gameCnt:pagesize; - - for(int i=0; i < n; i++) { - - struct discHdr *header = &gameList[i]; - snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]); - snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]); - - snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, IDfull); //Load full id image - cover[i] = new GuiImageData(imgPath,0); - if (!cover[i]->GetImage()) { - delete cover[i]; - snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, ID); //Load short id image - cover[i] = new GuiImageData(imgPath, 0); - if (!cover[i]->GetImage()) { - delete cover[i]; - snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.theme_path); //Load no image - cover[i] = new GuiImageData(imgPath, nocoverFlat_png); - } - } - - coverImg[i] = new GuiImage(cover[i]); - coverImg[i]->SetWidescreen(CFG.widescreen); - if (Settings.gridRows==2)coverImg[i]->SetScale(.6);//these are the numbers for 2 rows - else if (Settings.gridRows==3)coverImg[i]->SetScale(.26);//these are the numbers for 3 rows - - //titleTxt[i] = new GuiText(get_title(&gameList[i]), 20, (GXColor){0,0,0, 0xff}); - - - } - - for(int i=0; i < pagesize; i++) { - game[i] = new GuiButton(160,224);//for 1 row - if (Settings.gridRows==2)game[i]->SetSize(75,133);//these are the numbers for 2 rows - else if (Settings.gridRows==3)game[i]->SetSize(35,68);//these are the numbers for 3 rows - game[i]->SetParent(this); - game[i]->SetAlignment(ALIGN_TOP,ALIGN_LEFT); - game[i]->SetPosition(-200,740); - game[i]->SetImage(coverImg[((listOffset+i) % gameCnt)]); - if (Settings.gridRows==3)coverImg[(listOffset+i) % gameCnt]->SetPosition(0,-80);// only for 3 rows - if (Settings.gridRows==2)coverImg[(listOffset+i) % gameCnt]->SetPosition(0,-50);// only for 2 rows - game[i]->SetRumble(false); - game[i]->SetTrigger(trigA); - game[i]->SetSoundClick(btnSoundClick); - game[i]->SetClickable(true); - game[i]->SetVisible(true); - //coverImg[i]->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50); - - } - for (int i=gameCnt-1;iSetVisible(false); - game[i]->SetClickable(false); - game[i]->RemoveSoundOver();} - - //if(CFG.widescreen){ - - rows =Settings.gridRows; - if ((count<42)&&(rows==3))rows=2; - if ((count<16)&&(rows==2))rows=1; - if (gameCnt<6)gameCnt=6; - - if (rows==1)pagesize = 6; - else if (rows==2)pagesize = 16; - else if (rows==3)pagesize = 42; - - Settings.gridRows = rows; - if(isInserted(bootDevice)) { - cfg_save_global(); - } - - if (rows==1) - { - if(CFG.widescreen){ - game[0]->SetPosition(-70,74); - game[1]->SetPosition(88,74); - game[2]->SetPosition(239,74); - game[3]->SetPosition(390,74); - game[4]->SetPosition(550,74); - }else{ - game[bob[0]]->SetPosition(-130,74); - game[bob[1]]->SetPosition(60,74); - game[bob[2]]->SetPosition(239,74); - game[bob[3]]->SetPosition(420,74); - game[bob[4]]->SetPosition(612,74); - } - game[0]->SetSkew(-10,-44,10,-26,10,26,-10,44); - game[1]->SetSkew(-6,-22,6,-14,6,14,-6,22); - game[2]->SetSkew(0,-11,0,-11,0,11,0,11); - game[3]->SetSkew(-6,-14,6,-22,6,22,-6,14); - game[4]->SetSkew(-10,-26,10,-44,10,44,-10,26); - } - else if (rows ==2) - { - if(CFG.widescreen){ - game[0]->SetPosition(3,50); - game[1]->SetPosition(3,193); - game[2]->SetPosition(97,50); - game[3]->SetPosition(97,193); - game[4]->SetPosition(187,50); - game[5]->SetPosition(187,193); - game[6]->SetPosition(272,50); - game[7]->SetPosition(272,193); - game[8]->SetPosition(358,50); - game[9]->SetPosition(358,193); - game[10]->SetPosition(449,50); - game[11]->SetPosition(449,193); - game[12]->SetPosition(545,50); - game[13]->SetPosition(545,193); - game[14]->SetPosition(700,0); - game[15]->SetPosition(700,0); - }else{ - game[0]->SetPosition(-54,50); - game[1]->SetPosition(-54,193); - game[2]->SetPosition(58,50); - game[3]->SetPosition(58,193); - game[4]->SetPosition(166,50); - game[5]->SetPosition(166,193); - game[6]->SetPosition(272,50); - game[7]->SetPosition(272,193); - game[8]->SetPosition(378,50); - game[9]->SetPosition(378,193); - game[10]->SetPosition(487,50); - game[11]->SetPosition(487,193); - game[12]->SetPosition(599,50); - game[13]->SetPosition(599,193); - game[14]->SetPosition(700,0); - game[15]->SetPosition(700,0); - } - game[0]->SetSkew(-4.5,-49,4.5,-27,4.5,0,-4.5,0); - game[1]->SetSkew(-4.5,0,4.5,0,4.5,27,-4.5,49); - game[2]->SetSkew(-4,-22,4,-14,4,0,-4,0); - game[3]->SetSkew(-4,0,4,0,4,14,-4,22); - game[4]->SetSkew(0,-9,0,-5,0,0,0,0); - game[5]->SetSkew(0,0,0,0,0,5,0,9); - game[6]->SetSkew(0,0,0,0,0,0,0,0); - game[7]->SetSkew(0,0,0,0,0,0,0,0); - game[8]->SetSkew(0,-5,0,-9,0,0,0,0); - game[9]->SetSkew(0,0,0,0,0,9,0,5); - game[10]->SetSkew(-4,-14,4,-22,4,0,-4,0); - game[11]->SetSkew(-4,0,4,0,4,22,-4,14); - game[12]->SetSkew(-4.5,-27,4.5,-49,4.5,0,-4.5,0); - game[13]->SetSkew(-4.5,0,4.5,0,4.5,49,-4.5,27); - } - - else if (rows==3) - { - if(CFG.widescreen){ - game[0]->SetPosition(13,58); - game[1]->SetPosition(13,153); - game[2]->SetPosition(13,250); - - game[3]->SetPosition(68,67); - game[4]->SetPosition(68,153); - game[5]->SetPosition(68,239); - - game[6]->SetPosition(120,74); - game[7]->SetPosition(120,153); - game[8]->SetPosition(120,232); - - game[9]->SetPosition(170,78); - game[10]->SetPosition(170,153); - game[11]->SetPosition(170,228); - - game[12]->SetPosition(214,80); - game[13]->SetPosition(214,153); - game[14]->SetPosition(214,226); - - game[15]->SetPosition(258,81); - game[16]->SetPosition(258,153); - game[17]->SetPosition(258,224); - - game[18]->SetPosition(302,81); - game[19]->SetPosition(302,153); - game[20]->SetPosition(302,223); - - game[21]->SetPosition(346,81); - game[22]->SetPosition(346,153); - game[23]->SetPosition(346,223); - - game[24]->SetPosition(390,80); - game[25]->SetPosition(390,153); - game[26]->SetPosition(390,225); - - game[27]->SetPosition(434,77); - game[28]->SetPosition(434,153); - game[29]->SetPosition(434,227); - - game[30]->SetPosition(484,73); - game[31]->SetPosition(484,153); - game[32]->SetPosition(484,231); - - game[33]->SetPosition(537,67); - game[34]->SetPosition(537,153); - game[35]->SetPosition(537,239); - - game[36]->SetPosition(591,58); - game[37]->SetPosition(591,153); - game[38]->SetPosition(591,250); - } - else{ - game[0]->SetPosition(-29,58); - game[1]->SetPosition(-29,153); - game[2]->SetPosition(-29,250); - - game[3]->SetPosition(33,67); - game[4]->SetPosition(33,153); - game[5]->SetPosition(33,239); - - game[6]->SetPosition(92,74); - game[7]->SetPosition(92,153); - game[8]->SetPosition(92,232); - - game[9]->SetPosition(149,78); - game[10]->SetPosition(149,153); - game[11]->SetPosition(149,228); - - game[12]->SetPosition(200,80); - game[13]->SetPosition(200,153); - game[14]->SetPosition(200,226); - - game[15]->SetPosition(251,81); - game[16]->SetPosition(251,153); - game[17]->SetPosition(251,224); - - game[18]->SetPosition(302,81); - game[19]->SetPosition(302,153); - game[20]->SetPosition(302,223); - - game[21]->SetPosition(353,81); - game[22]->SetPosition(353,153); - game[23]->SetPosition(353,223); - - game[24]->SetPosition(404,80); - game[25]->SetPosition(404,153); - game[26]->SetPosition(404,225); - - game[27]->SetPosition(457,77); - game[28]->SetPosition(457,153); - game[29]->SetPosition(457,227); - - game[30]->SetPosition(512,73); - game[31]->SetPosition(512,153); - game[32]->SetPosition(512,231); - - game[33]->SetPosition(572,67); - game[34]->SetPosition(572,153); - game[35]->SetPosition(572,239); - - game[36]->SetPosition(633,58); - game[37]->SetPosition(633,153); - game[38]->SetPosition(633,250); - } - game[0]->SetSkew(-38,-110,15,-42,15,65,-38,32); - game[1]->SetSkew(-38,-75,15,-48,15,45,-38,72); - game[2]->SetSkew(-38,-52,15,-70,15,27,-38,100); - - game[3]->SetSkew(-38,-70,15,-24,15,40,-38,27); - game[4]->SetSkew(-38,-50,15,-35,15,40,-38,50); - game[5]->SetSkew(-38,-34,15,-47,15,24,-38,58); - - game[6]->SetSkew(-27,-55,19,-22,19,30,-27,22); - game[7]->SetSkew(-27,-40,19,-30,19,30,-27,40); - game[8]->SetSkew(-27,-20,19,-30,19,20,-27,50); - - game[9]->SetSkew(-19,-28,0,-17,0,15,-19,10); - game[10]->SetSkew(-19,-30,0,-20,0,12,-19,30); - game[11]->SetSkew(-19,-15,0,-20,0,10,-19,24); - - game[12]->SetSkew(-10,-20,3,-13,3,14,-10,10); - game[13]->SetSkew(-10,-20,3,-18,3,18,-10,20); - game[14]->SetSkew(-10,-10,3,-10,3,0,-10,10); - - game[15]->SetSkew(-10,-15,3,-12,3,13,-10,13); - game[16]->SetSkew(-10,-17,3,-10,3,10,-10,17); - game[17]->SetSkew(-10,-10,3,-15,3,10,-10,10); - - game[18]->SetSkew(-10,-10,3,-10,3,14,-10,14); - game[19]->SetSkew(-10,-10,3,-10,3,10,-10,10);//middle - game[20]->SetSkew(-10,-10,3,-10,3,10,-10,10); - - game[21]->SetSkew(-14,-10,4,-20,3,10,-14,10); - game[22]->SetSkew(-14,-10,4,-17,3,17,-14,10); - game[23]->SetSkew(-14,-10,4,-10,3,10,-14,10); - - game[24]->SetSkew(-10,-13,3,-20,3,14,-10,10); - game[25]->SetSkew(-10,-18,3,-20,3,20,-10,18); - game[26]->SetSkew(-10,-10,3,-10,3,20,-10,5); - - game[27]->SetSkew(-19,-17,0,-28,0,10,-19,15); - game[28]->SetSkew(-19,-20,0,-30,0,30,-19,12); - game[29]->SetSkew(-19,-20,0,-15,0,30,-19,10); - - game[30]->SetSkew(-27,-22,19,-55,19,22,-27,30); - game[31]->SetSkew(-27,-30,19,-40,19,40,-27,30); - game[32]->SetSkew(-27,-30,19,-20,19,55,-27,20); - - game[33]->SetSkew(-38,-24,15,-70,15,27,-38,40); - game[34]->SetSkew(-38,-35,15,-50,15,50,-38,40); - game[35]->SetSkew(-38,-47,15,-34,15,58,-38,24); - - game[36]->SetSkew(-38,-42,15,-110,15,32,-38,60); - game[37]->SetSkew(-38,-48,15,-75,15,70,-38,45); - game[38]->SetSkew(-38,-70,15,-52,15,100,-38,27); - } - - - - - // } - // else - // WindowPrompt("Oops","Your Wii must be in 16:9 mode to see the gamewall.",0, tr("OK"), 0,0); - - //} - -} - - -/** - * Destructor for the GuiGameGrid class. - */ -GuiGameGrid::~GuiGameGrid() -{ - - delete btnRight; - delete btnLeft; - delete btnRowUp; - delete btnRowDown; - - delete trigA; - delete trigL; - delete trigR; - delete trigPlus; - delete trigMinus; - delete trig1; - delete trig2; - delete btnSoundClick; - delete btnSoundOver; - - for(int i=0; iResetState(); - - if(f == 1) - game[bob[selectedItem]]->SetState(STATE_SELECTED); -} - - -void GuiGameGrid::ResetState() -{ - LOCK(this); - if(state != STATE_DISABLED) { - state = STATE_DEFAULT; - stateChan = -1; - } - - for(int i=0; iResetState(); - } -} - - -int GuiGameGrid::GetOffset() -{ - return listOffset; -} - - -int GuiGameGrid::GetClickedOption() -{ - int found = -1; - if (clickedItem>-1){ - game[bob[clickedItem]]->SetState(STATE_SELECTED); - found= (clickedItem+listOffset) % gameCnt; - clickedItem=-1; - } - return found; -} - - -int GuiGameGrid::GetSelectedOption() -{ - int found = -1; - for(int i=0; iGetState() == STATE_SELECTED) { - game[bob[i]]->SetState(STATE_SELECTED); - found = (listOffset+i) % gameCnt; - break; - } - } - return found; -} -/**************************************************************************** - * FindMenuItem - * - * Help function to find the next visible menu item on the list - ***************************************************************************/ - -int GuiGameGrid::FindMenuItem(int currentItem, int direction) -{ - int nextItem = currentItem + direction; - - if(nextItem < 0 || nextItem >= gameCnt) - if(gameCnt <= pagesize) - return -1; - else - nextItem = (nextItem < 0) ? nextItem + gameCnt : nextItem - gameCnt; - - if(strlen(get_title(&gameList[nextItem])) > 0) - return nextItem; - else - return FindMenuItem(nextItem, direction); -} - - -/** - * Draw the button on screen - */ -void GuiGameGrid::Draw() -{ - LOCK(this); - if(!this->IsVisible() || !gameCnt) - return; - - if(c>0){ - - int next = listOffset; - - for(int i=0; i= 0) { - game[bob[i]]->Draw(); - next = this->FindMenuItem(next, 1); - } else break; - } - - if(gameCnt > pagesize) { - btnRight->Draw(); - btnLeft->Draw(); - } - - btnRowUp->Draw(); - btnRowDown->Draw(); - //debugTxt->Draw(); - if ((wait>75)&&(Settings.tooltips == TooltipsOn)&&(drawTTs!=0)) - titleTT->Draw(); - - - - - this->UpdateEffects(); - } -} - - - -/** - * Change the number of rows - */ -void GuiGameGrid::ChangeRows(int n) -{ - if(!gameCnt) - return; - - rows=n; - Settings.gridRows = rows; - if(isInserted(bootDevice)) { - cfg_save_global(); - } - - for(int i=0; iSetWidescreen(CFG.widescreen); - if (rows==2)coverImg[i]->SetScale(.6);//these are the numbers for 2 rows - else if (rows==3)coverImg[i]->SetScale(.26);//these are the numbers for 3 rows - - } - //set pagesize - if (n==1)pagesize=6; - else if (n==2)pagesize=16; - else if (n==3)pagesize=42; - - - firstPic=0; - drawTTs=0; - - // create new buttons based on pagesize - for(int i=0; i < pagesize; i++) { - if (n==1)game[i]->SetSize(160,224);//for 1 row - if (n==2)game[i]->SetSize(75,133);//these are the numbers for 2 rows - else if (n==3)game[i]->SetSize(35,68);//these are the numbers for 3 rows - game[i]->SetPosition(0,740);//hide unused buttons - game[i]->SetImage(listOffset+iSetPosition(0,0):coverImg[listOffset+i-gameCnt]->SetPosition(0,0);}// only for 1 row - if (n==2){listOffset+iSetPosition(0,-50):coverImg[listOffset+i-gameCnt]->SetPosition(0,-50);}// only for 2 row - if (n==3){listOffset+iSetPosition(0,-80):coverImg[listOffset+i-gameCnt]->SetPosition(0,-80);}// only for 3 row - bob[i] = i; - - - } - //if(CFG.widescreen) - //{ - - if (n==1) - { - if(CFG.widescreen){ - game[bob[0]]->SetPosition(-70,74); - game[bob[1]]->SetPosition(88,74); - game[bob[2]]->SetPosition(239,74); - game[bob[3]]->SetPosition(390,74); - game[bob[4]]->SetPosition(550,74); - } - else{ - game[bob[0]]->SetPosition(-130,74); - game[bob[1]]->SetPosition(60,74); - game[bob[2]]->SetPosition(239,74); - game[bob[3]]->SetPosition(420,74); - game[bob[4]]->SetPosition(612,74); - } - - game[bob[0]]->SetSkew(-10,-44,10,-26,10,26,-10,44); - game[bob[1]]->SetSkew(-6,-22,6,-14,6,14,-6,22); - game[bob[2]]->SetSkew(0,-11,0,-11,0,11,0,11); - game[bob[3]]->SetSkew(-6,-14,6,-22,6,22,-6,14); - game[bob[4]]->SetSkew(-10,-26,10,-44,10,44,-10,26); - } - else if (n == 2) - { - if(CFG.widescreen){ - game[bob[0]]->SetPosition(3,50); - game[bob[1]]->SetPosition(3,193); - game[bob[2]]->SetPosition(97,50); - game[bob[3]]->SetPosition(97,193); - game[bob[4]]->SetPosition(187,50); - game[bob[5]]->SetPosition(187,193); - game[bob[6]]->SetPosition(272,50); - game[bob[7]]->SetPosition(272,193); - game[bob[8]]->SetPosition(358,50); - game[bob[9]]->SetPosition(358,193); - game[bob[10]]->SetPosition(449,50); - game[bob[11]]->SetPosition(449,193); - game[bob[12]]->SetPosition(545,50); - game[bob[13]]->SetPosition(545,193); - } - else{ - game[bob[0]]->SetPosition(-54,50); - game[bob[1]]->SetPosition(-54,193); - game[bob[2]]->SetPosition(58,50); - game[bob[3]]->SetPosition(58,193); - game[bob[4]]->SetPosition(166,50); - game[bob[5]]->SetPosition(166,193); - game[bob[6]]->SetPosition(272,50); - game[bob[7]]->SetPosition(272,193); - game[bob[8]]->SetPosition(378,50); - game[bob[9]]->SetPosition(378,193); - game[bob[10]]->SetPosition(487,50); - game[bob[11]]->SetPosition(487,193); - game[bob[12]]->SetPosition(599,50); - game[bob[13]]->SetPosition(599,193); - game[bob[14]]->SetPosition(700,0); - game[bob[15]]->SetPosition(700,0); - } - game[bob[0]]->SetSkew(-4.5,-49,4.5,-27,4.5,0,-4.5,0); - game[bob[1]]->SetSkew(-4.5,0,4.5,0,4.5,27,-4.5,49); - game[bob[2]]->SetSkew(-4,-22,4,-14,4,0,-4,0); - game[bob[3]]->SetSkew(-4,0,4,0,4,14,-4,22); - game[bob[4]]->SetSkew(0,-9,0,-5,0,0,0,0); - game[bob[5]]->SetSkew(0,0,0,0,0,5,0,9); - game[bob[6]]->SetSkew(0,0,0,0,0,0,0,0); - game[bob[7]]->SetSkew(0,0,0,0,0,0,0,0); - game[bob[8]]->SetSkew(0,-5,0,-9,0,0,0,0); - game[bob[9]]->SetSkew(0,0,0,0,0,9,0,5); - game[bob[10]]->SetSkew(-4,-14,4,-22,4,0,-4,0); - game[bob[11]]->SetSkew(-4,0,4,0,4,22,-4,14); - game[bob[12]]->SetSkew(-4.5,-27,4.5,-49,4.5,0,-4.5,0); - game[bob[13]]->SetSkew(-4.5,0,4.5,0,4.5,49,-4.5,27); - } - else if (n==3) - { - if(CFG.widescreen){ - game[bob[0]]->SetPosition(13,58); - game[bob[1]]->SetPosition(13,153); - game[bob[2]]->SetPosition(13,250); - - game[bob[3]]->SetPosition(68,67); - game[bob[4]]->SetPosition(68,153); - game[bob[5]]->SetPosition(68,239); - - game[bob[6]]->SetPosition(120,74); - game[bob[7]]->SetPosition(120,153); - game[bob[8]]->SetPosition(120,232); - - game[bob[9]]->SetPosition(170,78); - game[bob[10]]->SetPosition(170,153); - game[bob[11]]->SetPosition(170,228); - - game[bob[12]]->SetPosition(214,80); - game[bob[13]]->SetPosition(214,153); - game[bob[14]]->SetPosition(214,226); - - game[bob[15]]->SetPosition(258,81); - game[bob[16]]->SetPosition(258,153); - game[bob[17]]->SetPosition(258,224); - - game[bob[18]]->SetPosition(302,81); - game[bob[19]]->SetPosition(302,153); - game[bob[20]]->SetPosition(302,223); - - game[bob[21]]->SetPosition(346,81); - game[bob[22]]->SetPosition(346,153); - game[bob[23]]->SetPosition(346,223); - - game[bob[24]]->SetPosition(390,80); - game[bob[25]]->SetPosition(390,153); - game[bob[26]]->SetPosition(390,225); - - game[bob[27]]->SetPosition(434,77); - game[bob[28]]->SetPosition(434,153); - game[bob[29]]->SetPosition(434,227); - - game[bob[30]]->SetPosition(484,73); - game[bob[31]]->SetPosition(484,153); - game[bob[32]]->SetPosition(484,231); - - game[bob[33]]->SetPosition(537,67); - game[bob[34]]->SetPosition(537,153); - game[bob[35]]->SetPosition(537,239); - - game[bob[36]]->SetPosition(591,58); - game[bob[37]]->SetPosition(591,153); - game[bob[38]]->SetPosition(591,250); - } - else{ - game[bob[0]]->SetPosition(-29,58); - game[bob[1]]->SetPosition(-29,153); - game[bob[2]]->SetPosition(-29,250); - - game[bob[3]]->SetPosition(33,67); - game[bob[4]]->SetPosition(33,153); - game[bob[5]]->SetPosition(33,239); - - game[bob[6]]->SetPosition(92,74); - game[bob[7]]->SetPosition(92,153); - game[bob[8]]->SetPosition(92,232); - - game[bob[9]]->SetPosition(149,78); - game[bob[10]]->SetPosition(149,153); - game[bob[11]]->SetPosition(149,228); - - game[bob[12]]->SetPosition(200,80); - game[bob[13]]->SetPosition(200,153); - game[bob[14]]->SetPosition(200,226); - - game[bob[15]]->SetPosition(251,81); - game[bob[16]]->SetPosition(251,153);// - game[bob[17]]->SetPosition(251,224); - - game[bob[18]]->SetPosition(302,81);// - game[bob[19]]->SetPosition(302,153);// - game[bob[20]]->SetPosition(302,223);// - - game[bob[21]]->SetPosition(353,81); - game[bob[22]]->SetPosition(353,153); - game[bob[23]]->SetPosition(353,223); - - game[bob[24]]->SetPosition(404,80); - game[bob[25]]->SetPosition(404,153); - game[bob[26]]->SetPosition(404,225); - - game[bob[27]]->SetPosition(457,77); - game[bob[28]]->SetPosition(457,153); - game[bob[29]]->SetPosition(457,227); - - game[bob[30]]->SetPosition(512,73); - game[bob[31]]->SetPosition(512,153); - game[bob[32]]->SetPosition(512,231); - - game[bob[33]]->SetPosition(572,67); - game[bob[34]]->SetPosition(572,153); - game[bob[35]]->SetPosition(572,239); - - game[bob[36]]->SetPosition(633,58); - game[bob[37]]->SetPosition(633,153); - game[bob[38]]->SetPosition(633,250); - } - - game[bob[0]]->SetSkew(-38,-110,15,-42,15,65,-38,32); - game[bob[1]]->SetSkew(-38,-75,15,-48,15,45,-38,72); - game[bob[2]]->SetSkew(-38,-52,15,-70,15,27,-38,100); - - game[bob[3]]->SetSkew(-38,-70,15,-24,15,40,-38,27); - game[bob[4]]->SetSkew(-38,-50,15,-35,15,40,-38,50); - game[bob[5]]->SetSkew(-38,-34,15,-47,15,24,-38,58); - - game[bob[6]]->SetSkew(-27,-55,19,-22,19,30,-27,22); - game[bob[7]]->SetSkew(-27,-40,19,-30,19,30,-27,40); - game[bob[8]]->SetSkew(-27,-20,19,-30,19,20,-27,50); - - game[bob[9]]->SetSkew(-19,-28,0,-17,0,15,-19,10); - game[bob[10]]->SetSkew(-19,-30,0,-20,0,12,-19,30); - game[bob[11]]->SetSkew(-19,-15,0,-20,0,10,-19,24); - - game[bob[12]]->SetSkew(-10,-20,3,-13,3,14,-10,10); - game[bob[13]]->SetSkew(-10,-20,3,-18,3,18,-10,20); - game[bob[14]]->SetSkew(-10,-10,3,-10,3,0,-10,10); - - game[bob[15]]->SetSkew(-10,-15,3,-12,3,13,-10,13); - game[bob[16]]->SetSkew(-10,-17,3,-10,3,10,-10,17); - game[bob[17]]->SetSkew(-10,-10,3,-15,3,10,-10,10); - - game[bob[18]]->SetSkew(-10,-10,3,-10,3,14,-10,14); - game[bob[19]]->SetSkew(-10,-10,3,-10,3,10,-10,10);//middle - game[bob[20]]->SetSkew(-10,-10,3,-10,3,10,-10,10); - - game[bob[21]]->SetSkew(-14,-10,4,-20,3,10,-14,10); - game[bob[22]]->SetSkew(-14,-10,4,-17,3,17,-14,10); - game[bob[23]]->SetSkew(-14,-10,4,-10,3,10,-14,10); - - game[bob[24]]->SetSkew(-10,-13,3,-20,3,14,-10,10); - game[bob[25]]->SetSkew(-10,-18,3,-20,3,20,-10,18); - game[bob[26]]->SetSkew(-10,-10,3,-10,3,20,-10,5); - - game[bob[27]]->SetSkew(-19,-17,0,-28,0,10,-19,15); - game[bob[28]]->SetSkew(-19,-20,0,-30,0,30,-19,12); - game[bob[29]]->SetSkew(-19,-20,0,-15,0,30,-19,10); - - game[bob[30]]->SetSkew(-27,-22,19,-55,19,22,-27,30); - game[bob[31]]->SetSkew(-27,-30,19,-40,19,40,-27,30); - game[bob[32]]->SetSkew(-27,-30,19,-20,19,55,-27,20); - - game[bob[33]]->SetSkew(-38,-24,15,-70,15,27,-38,40); - game[bob[34]]->SetSkew(-38,-35,15,-50,15,50,-38,40); - game[bob[35]]->SetSkew(-38,-47,15,-34,15,58,-38,24); - - game[bob[36]]->SetSkew(-38,-42,15,-110,15,32,-38,60); - game[bob[37]]->SetSkew(-38,-48,15,-75,15,70,-38,45); - game[bob[38]]->SetSkew(-38,-70,15,-52,15,100,-38,27); - } - - //} -} - - -void GuiGameGrid::Update(GuiTrigger * t) -{ - LOCK(this); - if(state == STATE_DISABLED || !t || !gameCnt) - return; - - if(!(game[0]->GetEffect() || game[0]->GetEffectOnOver())) { - for(int i=0; iSetEffectGrow(); - } - } - //if (realCnt!=0)goRight=(12*(pagesize-realCnt)/2); - // for debugging - //snprintf(debugbuffer, sizeof(debugbuffer), "count: %i listOffset: %i", count,listOffset); - //debugTxt->SetText(debugbuffer); - //debugTxt->Draw(); - - btnRight->Update(t); - btnLeft->Update(t); - btnRowUp->Update(t); - btnRowDown->Update(t); - - int next = listOffset; - - - for(int i=0; i= 0) { - if(game[bob[i]]->GetState() == STATE_DISABLED) { - game[bob[i]]->SetVisible(true); - game[bob[i]]->SetState(STATE_DEFAULT); - } - gameIndex[i] = next; - next = this->FindMenuItem(next, 1); - } else { - game[bob[i]]->SetVisible(false); - game[bob[i]]->SetState(STATE_DISABLED); - } - - if(focus) { - if(i != selectedItem && game[bob[i]]->GetState() == STATE_SELECTED) - game[bob[i]]->ResetState(); - else if(i == selectedItem && game[bob[i]]->GetState() == STATE_DEFAULT); - game[bob[selectedItem]]->SetState(STATE_SELECTED, t->chan); - } - game[bob[i]]->Update(t); - - if(game[bob[i]]->GetState() == STATE_SELECTED) { - selectedItem = i; - } - if(game[bob[i]]->GetState() == STATE_CLICKED) { - clickedItem = i; - } - - } - - this->SetPosition(this->GetLeft()+mover2,this->GetTop()); - if (goback==1)mover2= (mover2<0? mover2+1:mover2-1); - if (mover2==0)goback=0; - - /*u16 buttons = ButtonsHold(); - if(buttons & WPAD_BUTTON_B) { - int x = t->wpad.ir.x; - int center = this->GetWidth()/2; - if (xcenter)goRight=12; - usleep(xDraw();} - //return; - }*/ - - - // navigation - if(!focus || gameCnt < pagesize || (c==0)||(game[bob[0]]->GetEffect() && game[bob[pagesize-1]]->GetEffect())) - return; // skip navigation - - if (btnLeft->GetState() == STATE_CLICKED) { - WPAD_ScanPads(); - u16 buttons = 0; - for(int i=0; i<4; i++) - buttons |= WPAD_ButtonsHeld(i); - if(!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_MINUS) || t->Left())) { - btnLeft->ResetState(); - speed = SHIFT_SPEED; - return; - } - - if (Settings.xflip==sysmenu ||Settings.xflip==yes) - goRight=12; - else - goLeft=12; - wait=0;wait1=0; - - - } - if (goLeft>0){ - - for (int i=1; iSetImage(coverImg[(listOffset + pagesize-i) % gameCnt]); - if (rows==1)coverImg[(listOffset+i) % gameCnt]->SetPosition(0,0);// only for 1 row - if (rows==3)coverImg[(listOffset + pagesize-i) % gameCnt]->SetPosition(0,-80);// only for 3 rows - if (rows==2)coverImg[(listOffset + pagesize-i) % gameCnt]->SetPosition(0,-50);// only for 2 rows - - } - if (mover<11){ - - if (rows==1){ - if(CFG.widescreen) - { - game[bob[0]]->SetPosition(-70-(mover * 16),74); - game[bob[1]]->SetPosition(88-(mover * 15.8),74); - game[bob[2]]->SetPosition(239-(mover * 15.1),74); - game[bob[3]]->SetPosition(390-(mover * 15.1),74); - game[bob[4]]->SetPosition(550-(mover * 16),74); - game[bob[5]]->SetPosition(710-(mover * 16),74); - }else{ - game[bob[0]]->SetPosition(-130-(mover * 19),74); - game[bob[1]]->SetPosition(60-(mover * 19),74); - game[bob[2]]->SetPosition(239-(mover * 17.9),74); - game[bob[3]]->SetPosition(420-(mover * 18.1),74); - game[bob[4]]->SetPosition(612-(mover * 19.2),74); - game[bob[5]]->SetPosition(772-(mover * 16),74); - } - - - - //if (mover>5)game[bob[0]]->SetSkew(-10,-26,10,-44,10,44,-10,26); - //SetSkew(-10(mover * ),-44(mover * ),10(mover * ),-26(mover * ), - // 10(mover * ),26(mover * ),-10(mover * ),44(mover * )); - - game[bob[1]]->SetSkew(-6-(mover * .4),-22-(mover * 2.2),6+(mover * .4),-14-(mover * 1.2), - 6+(mover * .4),14+(mover * 1.2),-6-(mover * .4),22+(mover * 2.2)); - - game[bob[2]]->SetSkew(0-(mover * .6),-11-(mover * 1.1),0+(mover * .6),-11-(mover * .3) - ,0+(mover * .6),11+(mover * .3),0-(mover * .6),11+(mover * 1.1)); - - game[bob[3]]->SetSkew(-6+(mover * .6),-14+(mover * .3),6-(mover * .6),-22+(mover * 1.1), - 6-(mover * .6),22-(mover * 1.1),-6+(mover * .6),14-(mover * .3)); - - game[bob[4]]->SetSkew(-10+(mover * .4),-26+(mover * 1.2),10-(mover * .4),-44+(mover * 2.2), - 10-(mover * .4),44-(mover * 2.2),-10+(mover * .4),26-(mover * 1.2)); - - game[bob[5]]->SetSkew(-14+(mover * .4),-34+(mover * 1.2),14-(mover * .4),-66+(mover * 2.2), - 14-(mover * .4),66-(mover * 2.2),-14+(mover * .4),34-(mover * 1.2)); - } - else if (rows ==2) - { - if(CFG.widescreen) - { - - game[bob[0]]->SetPosition(3-(mover * 9.4),50); - game[bob[1]]->SetPosition(3-(mover * 9.4),193); - game[bob[2]]->SetPosition(97-(mover * 9.4),50); - game[bob[3]]->SetPosition(97-(mover * 9.4),193); - game[bob[4]]->SetPosition(187-(mover * 9),50); - game[bob[5]]->SetPosition(187-(mover * 9),193); - game[bob[6]]->SetPosition(272-(mover * 8.5),50); - game[bob[7]]->SetPosition(272-(mover * 8.5),193); - game[bob[8]]->SetPosition(358-(mover * 8.5),50); - game[bob[9]]->SetPosition(358-(mover * 8.5),193); - game[bob[10]]->SetPosition(449-(mover * 9),50); - game[bob[11]]->SetPosition(449-(mover * 9),193); - game[bob[12]]->SetPosition(545-(mover * 9.6),50); - game[bob[13]]->SetPosition(545-(mover * 9.6),193); - game[bob[14]]->SetPosition(641-(mover * 9.6),50); - game[bob[15]]->SetPosition(641-(mover * 9.6),193); - }else{ - game[bob[0]]->SetPosition(-54-(mover * 11.2),50); - game[bob[1]]->SetPosition(-54-(mover * 11.2),193); - game[bob[2]]->SetPosition(58-(mover * 11.2),50); - game[bob[3]]->SetPosition(58-(mover * 11.2),193); - game[bob[4]]->SetPosition(166-(mover * 10.8),50); - game[bob[5]]->SetPosition(166-(mover * 10.8),193); - game[bob[6]]->SetPosition(272-(mover * 10.6),50); - game[bob[7]]->SetPosition(272-(mover * 10.6),193); - game[bob[8]]->SetPosition(378-(mover * 10.6),50); - game[bob[9]]->SetPosition(378-(mover * 10.6),193); - game[bob[10]]->SetPosition(487-(mover * 10.9),50); - game[bob[11]]->SetPosition(487-(mover * 10.9),193); - game[bob[12]]->SetPosition(599-(mover * 11.2),50); - game[bob[13]]->SetPosition(599-(mover * 11.2),193); - game[bob[14]]->SetPosition(700-(mover * 10.1),50); - game[bob[15]]->SetPosition(700-(mover * 10.1),193); - } - - game[bob[2]]->SetSkew(-4-(mover * .05),-22-(mover * 2.7),4+(mover * .05),-14-(mover * 1.3), - 4+(mover * .05),0,-4-(mover * .05),0); - - game[bob[3]]->SetSkew(-4-(mover * .05),0,4+(mover * .05),0, - 4+(mover * .05),14+(mover * 1.3),-4-(mover * .05),22+(mover * 2.7)); - - game[bob[4]]->SetSkew(0-(mover * .4),-9-(mover * 1.3),0+(mover * .4),-5-(mover * .9), - 0+(mover * .4),0,0-(mover * .4),0); - - game[bob[5]]->SetSkew(0-(mover * .4),0,0+(mover * .4),0, - 0+(mover *.4),5+(mover * .9),0-(mover * .4),9+(mover * 1.3)); - - game[bob[6]]->SetSkew(0,0-(mover * .9),0,0-(mover * .5), - 0,0,0,0); - - game[bob[7]]->SetSkew(0,0,0,0, - 0,0+(mover * .5),0,0+(mover * .9)); - - game[bob[8]]->SetSkew(0,-5+(mover * .5),0,-9+(mover * .9), - 0,0,0,0); - - game[bob[9]]->SetSkew(0,0,0,0, - 0,9-(mover * .9),0,5-(mover * .5)); - - game[bob[10]]->SetSkew(-4+(mover * .4),-14+(mover * .9),4-(mover * .4),-22+(mover *1.3), - 4-(mover * .4),0,-4+(mover * .4),0); - - game[bob[11]]->SetSkew(-4+(mover * .4),0,4-(mover * .4),0, - 4-(mover * .4),22-(mover * 1.3),-4+(mover * .4),14-(mover * .9)); - - game[bob[12]]->SetSkew(-4.5+(mover *.05),-27+(mover *1.3),4.5-(mover *.05),-49+(mover *2.7), - 4.5-(mover *.05),0,-4.5+(mover *.05),0); - - game[bob[13]]->SetSkew(-4.5+(mover *.05),0,4.5-(mover *.05),0,4.5-(mover *.05), - 49-(mover *2.7),-4.5+(mover *.05),27-(mover *1.3)); - - game[bob[14]]->SetSkew(-4.5,-27,4.5,-49,4.5,0,-4.5,0); - game[bob[15]]->SetSkew(-4.5,0,4.5,0,4.5,49,-4.5,27); - } - else if (rows==3) - { - if (CFG.widescreen){ - game[bob[0]]->SetPosition(13-(mover * 5.5),58-(mover * .9)); - game[bob[1]]->SetPosition(13-(mover * 5.5),153); - game[bob[2]]->SetPosition(13-(mover * 5.5),250+(mover * 1.1)); - - game[bob[3]]->SetPosition(68-(mover * 5.5),67-(mover * .9)); - game[bob[4]]->SetPosition(68-(mover * 5.5),153); - game[bob[5]]->SetPosition(68-(mover * 5.5),239+(mover * 1.1)); - - game[bob[6]]->SetPosition(120-(mover * 5.2),74-(mover * .7)); - game[bob[7]]->SetPosition(120-(mover * 5.2),153); - game[bob[8]]->SetPosition(120-(mover * 5.2),232+(mover * .7)); - - game[bob[9]]->SetPosition(170-(mover * 5),78-(mover * .4)); - game[bob[10]]->SetPosition(170-(mover * 5),153); - game[bob[11]]->SetPosition(170-(mover * 5),228+(mover * .4)); - - game[bob[12]]->SetPosition(214-(mover * 4.4),80-(mover * .2)); - game[bob[13]]->SetPosition(214-(mover * 4.4),153); - game[bob[14]]->SetPosition(214-(mover * 4.4),226+(mover * .2)); - - game[bob[15]]->SetPosition(258-(mover * 4.4),81-(mover * .1)); - game[bob[16]]->SetPosition(258-(mover * 4.4),153); - game[bob[17]]->SetPosition(258-(mover * 4.4),224+(mover * .2)); - - game[bob[18]]->SetPosition(302-(mover * 4.4),81); - game[bob[19]]->SetPosition(302-(mover * 4.4),153); - game[bob[20]]->SetPosition(302-(mover * 4.4),223+(mover * .1)); - - game[bob[21]]->SetPosition(346-(mover * 4.4),81); - game[bob[22]]->SetPosition(346-(mover * 4.4),153); - game[bob[23]]->SetPosition(346-(mover * 4.4),223); - - game[bob[24]]->SetPosition(390-(mover * 4.4),80+(mover * .1)); - game[bob[25]]->SetPosition(390-(mover * 4.4),153); - game[bob[26]]->SetPosition(390-(mover * 4.4),225-(mover * .2)); - - game[bob[27]]->SetPosition(434-(mover * 4.4),77+(mover * .3)); - game[bob[28]]->SetPosition(434-(mover * 4.4),153); - game[bob[29]]->SetPosition(434-(mover * 4.4),227-(mover * .2)); - - game[bob[30]]->SetPosition(484-(mover * 5),73+(mover * .4)); - game[bob[31]]->SetPosition(484-(mover * 5),153); - game[bob[32]]->SetPosition(484-(mover * 5),231-(mover * .4)); - - game[bob[33]]->SetPosition(537-(mover * 5.3),67+(mover * .6)); - game[bob[34]]->SetPosition(537-(mover * 5.3),153); - game[bob[35]]->SetPosition(537-(mover * 5.3),239-(mover * .8)); - - game[bob[36]]->SetPosition(591-(mover * 5.4),58+(mover * .9)); - game[bob[37]]->SetPosition(591-(mover * 5.4),153); - game[bob[38]]->SetPosition(591-(mover * 5.4),250-(mover * 1.1)); - - game[bob[39]]->SetPosition(645-(mover * 5.4),58); - game[bob[40]]->SetPosition(645-(mover * 5.4),153); - game[bob[41]]->SetPosition(645-(mover * 5.4),250); - } - else{ - game[bob[0]]->SetPosition(-29-(mover * 6.2),58-(mover * .9)); - game[bob[1]]->SetPosition(-29-(mover * 6.2),153); - game[bob[2]]->SetPosition(-29-(mover * 6.2),250+(mover * 1.1)); - - game[bob[3]]->SetPosition(33-(mover * 6.2),67-(mover * .9)); - game[bob[4]]->SetPosition(33-(mover * 6.2),153); - game[bob[5]]->SetPosition(33-(mover * 6.2),239+(mover * 1.1)); - - game[bob[6]]->SetPosition(92-(mover * 5.9),74-(mover * .7)); - game[bob[7]]->SetPosition(92-(mover * 5.9),153); - game[bob[8]]->SetPosition(92-(mover * 5.9),232+(mover * .7)); - - game[bob[9]]->SetPosition(149-(mover * 5.7),78-(mover * .4)); - game[bob[10]]->SetPosition(149-(mover * 5.7),153); - game[bob[11]]->SetPosition(149-(mover * 5.7),228+(mover * .4)); - - game[bob[12]]->SetPosition(200-(mover * 5.1),80-(mover * .2)); - game[bob[13]]->SetPosition(200-(mover * 5.1),153); - game[bob[14]]->SetPosition(200-(mover * 5.1),226+(mover * .2)); - - game[bob[15]]->SetPosition(251-(mover * 5.1),81-(mover * .1)); - game[bob[16]]->SetPosition(251-(mover * 5.1),153);// - game[bob[17]]->SetPosition(251-(mover * 5.1),224+(mover * .2)); - - game[bob[18]]->SetPosition(302-(mover * 5.1),81);// - game[bob[19]]->SetPosition(302-(mover * 5.1),153);// - game[bob[20]]->SetPosition(302-(mover * 5.1),223+(mover * .1));// - - game[bob[21]]->SetPosition(353-(mover * 5.1),81); - game[bob[22]]->SetPosition(353-(mover * 5.1),153); - game[bob[23]]->SetPosition(353-(mover * 5.1),223); - - game[bob[24]]->SetPosition(404-(mover * 5.1),80+(mover * .1)); - game[bob[25]]->SetPosition(404-(mover * 5.1),153); - game[bob[26]]->SetPosition(404-(mover * 5.1),225-(mover * .2)); - - game[bob[27]]->SetPosition(457-(mover * 5.3),77+(mover * .3)); - game[bob[28]]->SetPosition(457-(mover * 5.3),153); - game[bob[29]]->SetPosition(457-(mover * 5.3),227-(mover * .2)); - - game[bob[30]]->SetPosition(512-(mover * 5.5),73+(mover * .4)); - game[bob[31]]->SetPosition(512-(mover * 5.5),153); - game[bob[32]]->SetPosition(512-(mover * 5.5),231-(mover * .4)); - - game[bob[33]]->SetPosition(572-(mover * 6),67+(mover * .6)); - game[bob[34]]->SetPosition(572-(mover * 6),153); - game[bob[35]]->SetPosition(572-(mover * 6),239-(mover * .8)); - - game[bob[36]]->SetPosition(633-(mover * 6.1),58+(mover * .9)); - game[bob[37]]->SetPosition(633-(mover * 6.1),153); - game[bob[38]]->SetPosition(633-(mover * 6.1),250-(mover * 1.1)); - - game[bob[39]]->SetPosition(687-(mover * 5.4),58); - game[bob[40]]->SetPosition(687-(mover * 5.4),153); - game[bob[41]]->SetPosition(687-(mover * 5.4),250); - } - - //game[bob[0]]->SetSkew(-38,-110,15,-42,15,65,-38,32); - //game[bob[1]]->SetSkew(-38,-75,15,-48,15,45,-38,72); - //game[bob[2]]->SetSkew(-38,-52,15,-70,15,27,-38,100); - - game[bob[3]]->SetSkew(-38,-70-(mover * 4),15,-24-(mover * 1.8),15,40+(mover * 1.5),-38,27+(mover * .5)); - game[bob[4]]->SetSkew(-38,-50-(mover * 2.5),15,-35-(mover * .7),15,40-(mover * .5),-38,50+(mover * 1.2)); - game[bob[5]]->SetSkew(-38,-34-(mover * 1.8),15,-47-(mover * 2.3),15,24+(mover * .3),-38,58+(mover * 4.2)); - - game[bob[6]]->SetSkew(-27-(mover * 1.1),-55-(mover * 1.5),19-(mover * .4),-22-(mover * .2),19-(mover * .4),30+(mover * 1),-27-(mover * 1.1),22+(mover * .5)); - game[bob[7]]->SetSkew(-27-(mover * 1.1),-40-(mover * 1),19-(mover * .4),-30-(mover * .5),19-(mover * .4),30-(mover * 1),-27-(mover * 1.1),40+(mover * 1)); - game[bob[8]]->SetSkew(-27-(mover * 1.1),-20-(mover * 1.4),19-(mover * .4),-30-(mover * 1.7),19-(mover * .4),20+(mover * .4),-27-(mover * 1.1),50+(mover * .8)); - - game[bob[9]]->SetSkew(-19-(mover * .8),-28-(mover * 1.7),0+(mover * 1.9),-17-(mover * .5),0+(mover * 1.9),15+(mover * 1.5),-19-(mover * .8),10+(mover * 1.2)); - game[bob[10]]->SetSkew(-19-(mover * .8),-30-(mover * 1),0+(mover * 1.9),-20-(mover * 1),0+(mover * 1.9),12+(mover * 1.8),-19-(mover * .8),30+(mover * 1)); - game[bob[11]]->SetSkew(-19-(mover * .8),-15-(mover * .5),0+(mover * 1.9),-20-(mover * 1),0+(mover * 1.9),10+(mover * 1),-19-(mover * .8),24+(mover * 2.2)); - - game[bob[12]]->SetSkew(-10-(mover * .9),-20-(mover * .8),3-(mover * .3),-13-(mover * .4),3-(mover * .3),14+(mover * .1),-10-(mover * .9),10); - game[bob[13]]->SetSkew(-10-(mover * .9),-20-(mover * 1),3-(mover * .3),-18-(mover * .2),3-(mover * .3),18-(mover * .1),-10-(mover * .9),20+(mover * 1)); - game[bob[14]]->SetSkew(-10-(mover * .9),-10-(mover * .5),3-(mover * .3),-10-(mover * 1),3-(mover * .3),0+(mover * 1),-10-(mover * .9),10+(mover * 1.4)); - - game[bob[15]]->SetSkew(-10,-15-(mover * .5),3,-12-(mover * .1),3,13+(mover * .1),-10,13-(mover * .3)); - game[bob[16]]->SetSkew(-10,-17-(mover * .3),3,-10-(mover * .8),3,10+(mover * .8),-10,17+(mover * .3)); - game[bob[17]]->SetSkew(-10,-10,3,-15+(mover * .5),3,10-(mover * 1),-10,10); - - game[bob[18]]->SetSkew(-10,-10-(mover * .5),3,-10-(mover * .2),3,14-(mover * .1),-10,14-(mover * .1)); - game[bob[19]]->SetSkew(-10,-10-(mover * .7),3,-10,3,10,-10,10+(mover * .7));//middle - game[bob[20]]->SetSkew(-10,-10,3,-10-(mover * .5),3,10,-10,10); - - game[bob[21]]->SetSkew(-14,-10,4-(mover * .1),-20+(mover * 1),3,10+(mover * .4),-14,10); - game[bob[22]]->SetSkew(-14,-10,4-(mover * .1),-17+(mover * .7),3,17-(mover * .7),-14,10); - game[bob[23]]->SetSkew(-14,-10,4-(mover * .1),-10,3,10,-14+(mover * .4),10); - - game[bob[24]]->SetSkew(-10-(mover * .4),-13-(mover * .3),3+(mover * .1),-20,3,14-(mover * .4),-10-(mover * .4),10); - game[bob[25]]->SetSkew(-10-(mover * .4),-18-(mover * .8),3+(mover * .1),-20+(mover * .3),3,20-(mover * .3),-10-(mover * .4),18-(mover * .8)); - game[bob[26]]->SetSkew(-10-(mover * .4),-10,3+(mover * .1),-10,3,20-(mover * 1),-10-(mover * .4),5+(mover * .5)); - - game[bob[27]]->SetSkew(-19+(mover * .9),-17+(mover * .4),0+(mover * .3),-28+(mover * .8),0+(mover * .3),10+(mover * .4),-19+(mover * .9),15-(mover * .5)); - game[bob[28]]->SetSkew(-19+(mover * .9),-20+(mover * .2),0+(mover * .3),-30+(mover * 1),0+(mover * .3),20-(mover * 1),-19+(mover * .9),12+(mover * .6)); - game[bob[29]]->SetSkew(-19+(mover * .9),-20+(mover * 1),0+(mover * .3),-15+(mover * .5),0+(mover * .3),30-(mover * 1),-19+(mover * .9),10); - - game[bob[30]]->SetSkew(-27+(mover * .8),-22+(mover * .5),19-(mover * .9),-55+(mover * 1.7),19-(mover * .9),22-(mover * 1.2),-27+(mover * .8),30-(mover * 1.5)); - game[bob[31]]->SetSkew(-27+(mover * .8),-30+(mover * 1),19-(mover * .9),-40+(mover * 1),19-(mover * .9),40-(mover * 2),-27+(mover * .8),30-(mover * 1.8)); - game[bob[32]]->SetSkew(-27+(mover * .8),-30+(mover * 1),19-(mover * .9),-20+(mover * .5),19-(mover * .9),55-(mover * 1.5),-27+(mover * .8),20-(mover * 1)); - - game[bob[33]]->SetSkew(-38+(mover * 1.1),-24+(mover * .2),15+(mover * .4),-70+(mover * 1.5),15+(mover * .4),27-(mover * .5),-38+(mover * 1.1),40-(mover * 1)); - game[bob[34]]->SetSkew(-38+(mover * 1.1),-35+(mover * .5),15+(mover * .4),-50+(mover * 1),15+(mover * .4),50-(mover * 1),-38+(mover * 1.1),40-(mover * 1)); - game[bob[35]]->SetSkew(-38+(mover * 1.1),-47+(mover * 1.7),15+(mover * .4),-34+(mover * 1.4),15+(mover * .4),58-(mover * .3),-38+(mover * 1.1),24-(mover * .4)); - - game[bob[36]]->SetSkew(-38,-42+(mover * 1.8),15,-110+(mover * 4),15,32-(mover * .5),-38,60-(mover * 2)); - game[bob[37]]->SetSkew(-38,-48+(mover * 1.3),15,-75+(mover * 2.5),15,70-(mover * 2),-38,45-(mover * .5)); - game[bob[38]]->SetSkew(-38,-70+(mover * 2.3),15,-52+(mover * 1.8),15,100-(mover * 4.2),-38,27-(mover * .3)); - - game[bob[39]]->SetSkew(-38,-42,15,-110,15,32,-38,60); - game[bob[40]]->SetSkew(-38,-48,15,-75,15,65,-38,45); - game[bob[41]]->SetSkew(-38,-70,15,-52,15,100,-38,27); - } - - - mover++; - goLeft--; - - } - else {goLeft=0;mover=0; - listOffset = (listOffset+rows < gameCnt) ? listOffset+rows : ((listOffset+rows) - gameCnt); - firstPic = (firstPic+rows < pagesize) ? firstPic+rows : 0; - - for (int i=0; iGetState() == STATE_CLICKED) { - WPAD_ScanPads(); - u16 buttons = 0; - for(int i=0; i<4; i++) - buttons |= WPAD_ButtonsHeld(i); - if(!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_PLUS) || t->Right()|| t->Left()|| (buttons & WPAD_BUTTON_MINUS))) { - btnRight->ResetState(); - speed=SHIFT_SPEED; - return; - } - if (Settings.xflip==sysmenu ||Settings.xflip==yes) - goLeft=12; - else - goRight=12; - wait=0;wait1=0; - - - - - } - if (goRight>0){ - if (mover<11){ - - - - for (int i=1; i<(rows+1); i++){ - int tmp = listOffset-i; - - if (tmp<0)tmp=(gameCnt-i); - - game[bob[pagesize-(i)]]->SetImage(coverImg[tmp]); - - if (rows==1)coverImg[tmp]->SetPosition(0,0);// only for 1 row - if (rows==3)coverImg[tmp]->SetPosition(0,-80);// only for 3 rows - if (rows==2)coverImg[tmp]->SetPosition(0,-50);// only for 2 rows - } - if (rows==1){ - if(CFG.widescreen) - { - game[bob[0]]->SetPosition(-70+(mover * 15.8),74); - game[bob[1]]->SetPosition(88+(mover * 15.1),74); - game[bob[2]]->SetPosition(239+(mover * 15.1),74); - game[bob[3]]->SetPosition(390+(mover * 16),74); - game[bob[4]]->SetPosition(550+(mover * 16),74); - game[bob[5]]->SetPosition(-230+(mover * 16),74); - }else{ - game[bob[5]]->SetPosition(-290+(mover * 16),74); - game[bob[0]]->SetPosition(-130+(mover * 19),74); - game[bob[1]]->SetPosition(60+(mover * 17.9),74); - game[bob[2]]->SetPosition(239+(mover * 18.1),74); - game[bob[3]]->SetPosition(420+(mover * 19.2),74); - game[bob[4]]->SetPosition(612+(mover * 19.2),74); - } - - game[bob[0]]->SetSkew(-10+(mover * .4),-44+(mover * 2.2),10-(mover * .4),-26+(mover * 1.2), - 10-(mover * .4),26-(mover * 1.2),-10+(mover * .4),44-(mover * 2.2)); - - game[bob[1]]->SetSkew(-6+(mover * .6),-22+(mover * 1.1),6-(mover * .6),-14+(mover * .3), - 6-(mover * .6),14-(mover * .3),-6+(mover * .6),22-(mover * 1.1)); - - game[bob[2]]->SetSkew(0-(mover * .6),-11-(mover * .3),0+(mover * .6),-11-(mover * 1.1) - ,0+(mover * .6),11+(mover * 1.1),0-(mover * .6),11+(mover * .3)); - - game[bob[3]]->SetSkew(-6-(mover * .4),-14-(mover * 1.2),6+(mover * .4),-22-(mover * 2.2), - 6+(mover * .4),22+(mover * 2.2),-6-(mover * .4),14+(mover * 1.2)); - - game[bob[4]]->SetSkew(-10-(mover * .4),-26+(mover * 1.2),10+(mover * .4),-44-(mover * 2.2), - 10+(mover * .4),44+(mover * 2.2),-10-(mover * .4),26+(mover * 1.2)); - - game[bob[5]]->SetSkew(-10,-44,10,-26,10,26,-10,44); - } - else if (rows==2) - { - if (CFG.widescreen){ - game[bob[0]]->SetPosition(3+(mover * 9.4),50); - game[bob[1]]->SetPosition(3+(mover * 9.4),193); - game[bob[2]]->SetPosition(97+(mover * 9),50); - game[bob[3]]->SetPosition(97+(mover * 9),193); - game[bob[4]]->SetPosition(187+(mover * 8.5),50); - game[bob[5]]->SetPosition(187+(mover * 8.5),193); - game[bob[6]]->SetPosition(272+(mover * 8.5),50); - game[bob[7]]->SetPosition(272+(mover * 8.5),193); - game[bob[8]]->SetPosition(358+(mover * 9),50); - game[bob[9]]->SetPosition(358+(mover * 9),193); - game[bob[10]]->SetPosition(449+(mover * 9.6),50); - game[bob[11]]->SetPosition(449+(mover * 9.6),193); - game[bob[12]]->SetPosition(545+(mover * 9.6),50); - game[bob[13]]->SetPosition(545+(mover * 9.6),193); - game[bob[14]]->SetPosition(-93+(mover * 9.6),50); - game[bob[15]]->SetPosition(-93+(mover * 9.6),193); - } - else{ - game[bob[0]]->SetPosition(-54+(mover * 11.2),50); - game[bob[1]]->SetPosition(-54+(mover * 11.2),193); - game[bob[2]]->SetPosition(58+(mover * 10.8),50); - game[bob[3]]->SetPosition(58+(mover * 10.8),193); - game[bob[4]]->SetPosition(166+(mover * 10.6),50); - game[bob[5]]->SetPosition(166+(mover * 10.6),193); - game[bob[6]]->SetPosition(272+(mover * 10.6),50); - game[bob[7]]->SetPosition(272+(mover * 10.6),193); - game[bob[8]]->SetPosition(378+(mover * 10.9),50); - game[bob[9]]->SetPosition(378+(mover * 10.9),193); - game[bob[10]]->SetPosition(487+(mover * 11.2),50); - game[bob[11]]->SetPosition(487+(mover * 11.2),193); - game[bob[12]]->SetPosition(599+(mover * 10.1),50); - game[bob[13]]->SetPosition(599+(mover * 10.1),193); - game[bob[14]]->SetPosition(-155+(mover * 10.1),50); - game[bob[15]]->SetPosition(-155+(mover * 10.1),193); - } - - - game[bob[0]]->SetSkew(-4.5+(mover * .05),-49+(mover * 2.7),4.5-(mover * .05),-27+(mover * 1.3), - 4.5-(mover * .05),0,-4.5+(mover * .05),0); - - game[bob[1]]->SetSkew(-4.5+(mover * .05),0,4.5-(mover * .05),0, - 4.5-(mover * .05),27-(mover * 1.3),-4.5+(mover * .05),49-(mover * 2.7)); - - game[bob[2]]->SetSkew(-4+(mover * .4),-22+(mover * 1.3),4-(mover * .4),-14+(mover * .9), - 4-(mover * .4),0,-4+(mover * .4),0); - - game[bob[3]]->SetSkew(-4+(mover * .4),0,4-(mover * .4),0, - 4-(mover * .4),14-(mover * .9),-4+(mover * .4),22-(mover * 1.3)); - - game[bob[4]]->SetSkew(0,-9+(mover * .9),0,-5+(mover * .5), - 0,0,0,0); - - game[bob[5]]->SetSkew(0,0,0,0, - 0,5-(mover * .5),0,9-(mover * .9)); - - game[bob[6]]->SetSkew(0,0-(mover * .5),0,0-(mover * .9), - 0,0,0,0); - - game[bob[7]]->SetSkew(0,0,0,0, - 0,0+(mover * .9),0,0+(mover * .5)); - - game[bob[8]]->SetSkew(0-(mover * .4),-5-(mover * .9),0+(mover * .4),-9-(mover * 1.3), - 0+(mover * .4),0,0-(mover * .4),0); - - game[bob[9]]->SetSkew(0-(mover * .4),0,0+(mover * .4),0, - 0+(mover * .4),9+(mover * 1.3),0-(mover * .4),5+(mover * .9)); - - game[bob[10]]->SetSkew(-4-(mover * .05),-14-(mover * 1.3),4+(mover * .05),-22-(mover * 2.7), - 4+(mover * .05),0,-4-(mover * .05),0); - - game[bob[11]]->SetSkew(-4-(mover * .05),0,4+(mover * .05),0, - 4+(mover * .05),22+(mover * 2.7),-4-(mover * .05),14+(mover * 1.3)); - - game[bob[12]]->SetSkew(-4.5,-27,4.5,-49,4.5,0,-4.5,0); - - game[bob[13]]->SetSkew(-4.5,0,4.5,0,4.5,49,-4.5,27); - game[bob[14]]->SetSkew(-4.5,-49,4.5,-27,4.5,0,-4.5,0); - game[bob[15]]->SetSkew(-4.5,0,4.5,0,4.5,27,-4.5,49); - } - else if (rows==3) - { - if(CFG.widescreen){ - game[bob[39]]->SetPosition(-42+(mover *5.5),58); - game[bob[40]]->SetPosition(-42+(mover *5.5),153); - game[bob[41]]->SetPosition(-42+(mover *5.5),250); - - game[bob[0]]->SetPosition(13+(mover *5.5),58+(mover *.9)); - game[bob[1]]->SetPosition(13+(mover *5.5),153); - game[bob[2]]->SetPosition(13+(mover *5.5),250-(mover *1.1)); - - game[bob[3]]->SetPosition(68+(mover *5.2),67+(mover *.7)); - game[bob[4]]->SetPosition(68+(mover *5.2),153); - game[bob[5]]->SetPosition(68+(mover *5.2),239-(mover *.7)); - - game[bob[6]]->SetPosition(120+(mover *5),74+(mover *.4)); - game[bob[7]]->SetPosition(120+(mover *5),153); - game[bob[8]]->SetPosition(120+(mover *5),232-(mover *.4)); - - game[bob[9]]->SetPosition(170+(mover *4.4),78+(mover *.2)); - game[bob[10]]->SetPosition(170+(mover *4.4),153); - game[bob[11]]->SetPosition(170+(mover *4.4),228-(mover *.2)); - - game[bob[12]]->SetPosition(214+(mover *4.4),80+(mover *.1)); - game[bob[13]]->SetPosition(214+(mover *4.4),153); - game[bob[14]]->SetPosition(214+(mover *4.4),226-(mover *.2)); - - game[bob[15]]->SetPosition(258+(mover *4.4),81); - game[bob[16]]->SetPosition(258+(mover *4.4),153); - game[bob[17]]->SetPosition(258+(mover *4.4),224-(mover *.1)); - - game[bob[18]]->SetPosition(302+(mover *4.4),81); - game[bob[19]]->SetPosition(302+(mover *4.4),153); - game[bob[20]]->SetPosition(302+(mover *4.4),223); - - game[bob[21]]->SetPosition(346+(mover *4.4),81-(mover *.1)); - game[bob[22]]->SetPosition(346+(mover *4.4),153); - game[bob[23]]->SetPosition(346+(mover *4.4),223+(mover *.2)); - - game[bob[24]]->SetPosition(390+(mover *4.4),80-(mover *.3)); - game[bob[25]]->SetPosition(390+(mover *4.4),153); - game[bob[26]]->SetPosition(390+(mover *4.4),225+(mover *.2)); - - game[bob[27]]->SetPosition(434+(mover *5),77-(mover *.4)); - game[bob[28]]->SetPosition(434+(mover *5),153); - game[bob[29]]->SetPosition(434+(mover *5),227+(mover *.4)); - - game[bob[30]]->SetPosition(484+(mover *5.3),73-(mover *.6)); - game[bob[31]]->SetPosition(484+(mover *5.3),153); - game[bob[32]]->SetPosition(484+(mover *5.3),231+(mover *.8)); - - game[bob[33]]->SetPosition(537+(mover *5.4),67-(mover *.9)); - game[bob[34]]->SetPosition(537+(mover *5.4),153); - game[bob[35]]->SetPosition(537+(mover *5.4),239+(mover *1.1)); - - game[bob[36]]->SetPosition(591+(mover *5.4),58); - game[bob[37]]->SetPosition(591+(mover *5.4),153); - game[bob[38]]->SetPosition(591+(mover *5.4),250); - - } - else{ - game[bob[39]]->SetPosition(-84+(mover *5.5),58); - game[bob[40]]->SetPosition(-84+(mover *5.5),153); - game[bob[41]]->SetPosition(-84+(mover *5.5),250); - - game[bob[0]]->SetPosition(-29+(mover * 6.2),58+(mover * .9)); - game[bob[1]]->SetPosition(-29+(mover * 6.2),153); - game[bob[2]]->SetPosition(-29+(mover * 6.2),250-(mover * 1.1)); - - game[bob[3]]->SetPosition(33+(mover * 5.9),67+(mover * .7)); - game[bob[4]]->SetPosition(33+(mover * 5.9),153); - game[bob[5]]->SetPosition(33+(mover * 5.9),239-(mover * .7)); - - game[bob[6]]->SetPosition(92+(mover * 5.7),74+(mover * .4)); - game[bob[7]]->SetPosition(92+(mover * 5.7),153); - game[bob[8]]->SetPosition(92+(mover * 5.7),232-(mover * .4)); - - game[bob[9]]->SetPosition(149+(mover * 5.1),78+(mover * .2)); - game[bob[10]]->SetPosition(149+(mover * 5.1),153); - game[bob[11]]->SetPosition(149+(mover * 5.1),228-(mover * .2)); - - game[bob[12]]->SetPosition(200+(mover * 5.1),80+(mover * .1)); - game[bob[13]]->SetPosition(200+(mover * 5.1),153); - game[bob[14]]->SetPosition(200+(mover * 5.1),226-(mover * .2)); - - game[bob[15]]->SetPosition(251+(mover * 5.1),81); - game[bob[16]]->SetPosition(251+(mover * 5.1),153);// - game[bob[17]]->SetPosition(251+(mover * 5.1),224-(mover * .1)); - - game[bob[18]]->SetPosition(302+(mover * 5.2),81);// - game[bob[19]]->SetPosition(302+(mover * 5.2),153);// - game[bob[20]]->SetPosition(302+(mover * 5.2),223);// - - game[bob[21]]->SetPosition(353+(mover * 5.1),81-(mover * .1)); - game[bob[22]]->SetPosition(353+(mover * 5.1),153); - game[bob[23]]->SetPosition(353+(mover * 5.1),223+(mover * .2)); - - game[bob[24]]->SetPosition(404+(mover * 5.3),80-(mover * .3)); - game[bob[25]]->SetPosition(404+(mover * 5.3),153); - game[bob[26]]->SetPosition(404+(mover * 5.3),225+(mover * .2)); - - game[bob[27]]->SetPosition(457+(mover * 5.5),77-(mover * .4)); - game[bob[28]]->SetPosition(457+(mover * 5.5),153); - game[bob[29]]->SetPosition(457+(mover * 5.5),227+(mover * .4)); - - game[bob[30]]->SetPosition(512+(mover * 6),73-(mover * .6)); - game[bob[31]]->SetPosition(512+(mover * 6),153); - game[bob[32]]->SetPosition(512+(mover * 6),231+(mover * .8)); - - game[bob[33]]->SetPosition(572+(mover * 6),67-(mover * .9)); - game[bob[34]]->SetPosition(572+(mover * 6),153); - game[bob[35]]->SetPosition(572+(mover * 6),239+(mover * 1.1)); - - game[bob[36]]->SetPosition(633+(mover * 6),58); - game[bob[37]]->SetPosition(633+(mover * 6),153); - game[bob[38]]->SetPosition(633+(mover * 6),250); - } - game[bob[39]]->SetSkew(-38,-110,15,-42,15,65,-38,32); - game[bob[40]]->SetSkew(-38,-75,15,-48,15,45,-38,72); - game[bob[41]]->SetSkew(-38,-52,15,-70,15,27,-38,100); - - game[bob[0]]->SetSkew(-38,-110+(mover * .4),15,-42+(mover * 1.8),15,65-(mover * 2.5),-38,32-(mover * .5)); - game[bob[1]]->SetSkew(-38,-75+(mover * 2.5),15,-48+(mover * 1.3),15,45-(mover * .5),-38,72-(mover * 2.2)); - game[bob[2]]->SetSkew(-38,-52+(mover * 1.8),15,-70+(mover * 2.3),15,27+(mover * .3),-38,100-(mover * 4.2)); - - game[bob[3]]->SetSkew(-38+(mover * 1.1),-70+(mover * 1.5),15+(mover * .4),-24-(mover * .2),15+(mover * .4),40-(mover * 1),-38+(mover * 1.1),27-(mover * .5)); - game[bob[4]]->SetSkew(-38+(mover * 1.1),-50+(mover * 1),15+(mover * .4),-35-(mover * .5),15+(mover * .4),40-(mover * 1),-38+(mover * 1.1),50-(mover * 1)); - game[bob[5]]->SetSkew(-38+(mover * 1.1),-34+(mover * 1.4),15+(mover * .4),-47+(mover * 1.7),15+(mover * .4),24-(mover * .4),-38+(mover * 1.1),58-(mover * .8)); - - game[bob[6]]->SetSkew(-27+(mover * .8),-55+(mover * 1.7),19-(mover * .9),-22+(mover * .5),19-(mover * .9),30-(mover * 1.5),-27+(mover * .8),22-(mover * 1.2)); - game[bob[7]]->SetSkew(-27+(mover * .8),-40+(mover * 1),19-(mover * .9),-30+(mover * 1),19-(mover * .9),30-(mover * 1.8),-27+(mover * .8),40-(mover * 1)); - game[bob[8]]->SetSkew(-27+(mover * .8),-20+(mover * .5),19-(mover * .9),-30+(mover * 1),19-(mover * .9),20-(mover * 1),-27+(mover * .8),50-(mover * 2.6)); - - game[bob[9]]->SetSkew(-19+(mover * .9),-28+(mover * .8),0+(mover * .3),-17-(mover * .4),0+(mover * .3),15-(mover * 1),-19+(mover * .9),10); - game[bob[10]]->SetSkew(-19+(mover * .9),-30+(mover * 1),0+(mover * .3),-20-(mover * .2),0+(mover * .3),12+(mover * .6),-19+(mover * .9),30-(mover * 1)); - game[bob[11]]->SetSkew(-19+(mover * .9),-15+(mover * .5),0+(mover * .3),-20+(mover * 1),0+(mover * .3),10,-19+(mover * .9),24-(mover * 1.4)); - - game[bob[12]]->SetSkew(-10,-20+(mover * .5),3,-13+(mover * .1),3,14-(mover * .1),-10,10+(mover * .3)); - game[bob[13]]->SetSkew(-10,-20+(mover * .3),3,-18+(mover * .8),3,18-(mover * .8),-10,20-(mover * .3)); - game[bob[14]]->SetSkew(-10,-10,3,-10-(mover * .5),3,0+(mover * 1),-10,10); - - game[bob[15]]->SetSkew(-10,-15+(mover * .5),3,-12+(mover * .2),3,13+(mover * .1),-10,13+(mover * .1)); - game[bob[16]]->SetSkew(-10,-17+(mover * .7),3,-10,3,10,-10,17-(mover * .7)); - game[bob[17]]->SetSkew(-10,-10,3,-15+(mover * .5),3,10,-10,10); - - game[bob[18]]->SetSkew(-10,-10,3+(mover * .1),-10-(mover * 1),3,14-(mover * .4),-10-(mover * .4),14-(mover * .4)); - game[bob[19]]->SetSkew(-10,-10,3+(mover * .1),-10-(mover * .7),3,10+(mover * .7),-10-(mover * .4),10);//middle - game[bob[20]]->SetSkew(-10,-10,3+(mover * .1),-10,3,10,-10-(mover * .4),10); - - game[bob[21]]->SetSkew(-14+(mover * .4),-10-(mover * .3),4-(mover * .1),-20,3,10+(mover * .4),-14,10); - game[bob[22]]->SetSkew(-14+(mover * .4),-10-(mover * .8),4-(mover * .1),-17-(mover * .3),3,17+(mover * .3),-14,10+(mover * .8)); - game[bob[23]]->SetSkew(-14+(mover * .4),-10,4-(mover * .1),-10,3,10+(mover * 1),-14,10-(mover * .5)); - - game[bob[24]]->SetSkew(-10-(mover * .9),-13,3-(mover * .3),-20,3-(mover * .3),14,-10-(mover * .9),10); - game[bob[25]]->SetSkew(-10-(mover * .9),-18,3-(mover * .3),-20,3-(mover * .3),20,-10-(mover * .9),18); - game[bob[26]]->SetSkew(-10-(mover * .9),-10,3-(mover * .3),-10,3-(mover * .3),20,-10-(mover * .9),5); - - game[bob[27]]->SetSkew(-19-(mover * .8),-17,0+(mover * 1.9),-28,0+(mover * 1.9),10+(mover * 1.2),-19-(mover * .8),15+(mover * 1.5)); - game[bob[28]]->SetSkew(-19-(mover * .8),-20,0+(mover * 1.9),-30,0+(mover * 1.9),30+(mover * 1),-19-(mover * .8),12+(mover * 1.8)); - game[bob[29]]->SetSkew(-19-(mover * .8),-20,0+(mover * 1.9),-15,0+(mover * 1.9),30+(mover * 1.5),-19-(mover * .8),10+(mover * 1)); - - game[bob[30]]->SetSkew(-27-(mover * 1.1),-22-(mover * .2),19-(mover * .4),-55-(mover * 1.5),19-(mover * .4),22+(mover * .5),-27-(mover * 1.1),30+(mover * 1)); - game[bob[31]]->SetSkew(-27-(mover * 1.1),-30-(mover * .5),19-(mover * .4),-40-(mover * 1),19-(mover * .4),40+(mover * 1),-27-(mover * 1.1),30+(mover * 1)); - game[bob[32]]->SetSkew(-27-(mover * 1.1),-30-(mover * 1.7),19-(mover * .4),-20-(mover * 1.4),19-(mover * .4),55+(mover * .3),-27-(mover * 1.1),20+(mover * .4)); - - game[bob[33]]->SetSkew(-38,-24-(mover * 1.8),15,-70-(mover * 4),15,27+(mover * .5),-38,40+(mover * .2)); - game[bob[34]]->SetSkew(-38,-35-(mover * 1.3),15,-50-(mover * 2.5),15,50+(mover * 2),-38,40+(mover * .5)); - game[bob[35]]->SetSkew(-38,-47-(mover * 2.7),15,-34-(mover * 1.8),15,58+(mover * 4.2),-38,24+(mover * .3)); - - game[bob[36]]->SetSkew(-38,-42+(mover * 1.8),15,-110,15,32,-38,60); - game[bob[37]]->SetSkew(-38,-48+(mover * 1.3),15,-75,15,70,-38,45); - game[bob[38]]->SetSkew(-38,-70+(mover * 2.3),15,-52+(mover * 1.8),15,100,-38,27); - - } - mover++; - goRight--; - - } - else {goRight=0;mover=0; - listOffset = (listOffset-rows < 0) ? gameCnt-rows : listOffset-rows; - firstPic = (firstPic-rows < 0) ? pagesize-rows : firstPic-rows; - - for(int i=0; iSetText(debugbuffer); - - } - } - } - - - int ttoffset=0; - if (rows==1)ttoffset=70; - if (rows==2)ttoffset=35; - if(!CFG.widescreen){ - ttoffset=25; - if (rows==1)ttoffset=150; - if (rows==2)ttoffset=55; - } - char titlebuffer[50]; - int selected = this->GetSelectedOption(); - //3 different loops here with different alignment for tooltips - //depending on where on the screen the game is - for(int i=0; i < (pagesize/3); i++) { - game[i]->RemoveToolTip(); - - if (game[bob[i]]->GetState()==STATE_SELECTED) - { - - game[bob[i]]->SetToolTip(titleTT,ttoffset,0,0,5); - } - } - for(int i=(pagesize/3); i < (2* pagesize/3); i++) { - game[i]->RemoveToolTip(); - - if (game[bob[i]]->GetState()==STATE_SELECTED) - { - game[bob[i]]->SetToolTip(titleTT,0,0,2,5); - isover=true; - } - } - for(int i=(2* pagesize/3); i < pagesize; i++) { - game[i]->RemoveToolTip(); - - if (game[bob[i]]->GetState()==STATE_SELECTED) - { - game[bob[i]]->SetToolTip(titleTT,-ttoffset,0,1,5); - } - } - snprintf(titlebuffer, sizeof(titlebuffer), "%s",get_title(&gameList[this->GetSelectedOption()])); - if (selected!=selectedOld){ - drawTTs=1; - delete titleTT; - titleTT = new GuiTooltip(titlebuffer); - titleTT->SetAlpha(THEME.tooltipAlpha); - wait=0;wait1=0; - } - selectedOld=selected; - if (wait1==0){wait++;if(wait>500)wait1=1;}//500 *2 is the time that the tooltips stay on screen - if ((wait1==1)&&(wait>-1)){wait--;} - - - //snprintf(debugbuffer, sizeof(debugbuffer), "faggot %i %s", GetOverImage(t),get_title(&gameList[this->GetSelectedOption()])); - //debugTxt->SetText(debugbuffer); - if ((btnRowUp->GetState() == STATE_CLICKED)&&(c>0)) { - if ((rows==1)&&(gameCnt>=16))this->ChangeRows(2); - else if ((rows==2)&&(gameCnt>=42))this->ChangeRows(3); - btnRowUp->ResetState(); - return; - } - - if ((btnRowDown->GetState() == STATE_CLICKED)&&(c>0)) { - if (rows==3)this->ChangeRows(2); - else if (rows==2)this->ChangeRows(1); - btnRowDown->ResetState(); - return; - } - - if(updateCB) - updateCB(this); -} - - -void GuiGameGrid::Reload(struct discHdr * l, int count) -{ - for(int i=0; i<42; i++) { - delete game[i]; - } - for(int i=0; iid[0], header->id[1], header->id[2]); - snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]); - - snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, IDfull); //Load full id image - cover[i] = new GuiImageData(imgPath,0); - if (!cover[i]->GetImage()) { - delete cover[i]; - snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, ID); //Load short id image - cover[i] = new GuiImageData(imgPath, 0); - if (!cover[i]->GetImage()) { - delete cover[i]; - snprintf(imgPath, sizeof(imgPath), "%snoimage.png", Settings.covers_path); //Load no image - cover[i] = new GuiImageData(imgPath, nocoverFlat_png); - } - } - - coverImg[i] = new GuiImage(cover[i]); - coverImg[i]->SetWidescreen(CFG.widescreen); - if (rows==2)coverImg[i]->SetScale(.6);//these are the numbers for 2 rows - else if (rows==3)coverImg[i]->SetScale(.26);//these are the numbers for 3 rows - - } - - for(int i=0; i < pagesize; i++) { - game[i] = new GuiButton(160,224);//for 1 row - if (rows==2)game[i]->SetSize(75,133);//these are the numbers for 2 rows - else if (rows==3)game[i]->SetSize(35,68);//these are the numbers for 3 rows - game[i]->SetParent(this); - game[i]->SetAlignment(ALIGN_TOP,ALIGN_LEFT); - game[i]->SetPosition(-200,740); - game[i]->SetImage(coverImg[(listOffset+i) % gameCnt]); - if (rows==3)coverImg[(listOffset+i) % gameCnt]->SetPosition(0,-80);// only for 3 rows - if (rows==2)coverImg[(listOffset+i) % gameCnt]->SetPosition(0,-50);// only for 2 rows - game[i]->SetRumble(false); - game[i]->SetTrigger(trigA); - game[i]->SetSoundClick(btnSoundClick); - game[i]->SetClickable(true); - } - for (int i=gameCnt-1;iSetVisible(false); - game[i]->SetClickable(false); - game[i]->RemoveSoundOver();} - - if (rows==1) - { - if(CFG.widescreen){ - game[bob[0]]->SetPosition(-70,74); - game[bob[1]]->SetPosition(88,74); - game[bob[2]]->SetPosition(239,74); - game[bob[3]]->SetPosition(390,74); - game[bob[4]]->SetPosition(550,74); - } - else{ - game[bob[0]]->SetPosition(-130,74); - game[bob[1]]->SetPosition(60,74); - game[bob[2]]->SetPosition(239,74); - game[bob[3]]->SetPosition(420,74); - game[bob[4]]->SetPosition(612,74); - } - - game[bob[0]]->SetSkew(-10,-44,10,-26,10,26,-10,44); - game[bob[1]]->SetSkew(-6,-22,6,-14,6,14,-6,22); - game[bob[2]]->SetSkew(0,-11,0,-11,0,11,0,11); - game[bob[3]]->SetSkew(-6,-14,6,-22,6,22,-6,14); - game[bob[4]]->SetSkew(-10,-26,10,-44,10,44,-10,26); - } - else if (rows == 2) - { - if(CFG.widescreen){ - game[bob[0]]->SetPosition(3,50); - game[bob[1]]->SetPosition(3,193); - game[bob[2]]->SetPosition(97,50); - game[bob[3]]->SetPosition(97,193); - game[bob[4]]->SetPosition(187,50); - game[bob[5]]->SetPosition(187,193); - game[bob[6]]->SetPosition(272,50); - game[bob[7]]->SetPosition(272,193); - game[bob[8]]->SetPosition(358,50); - game[bob[9]]->SetPosition(358,193); - game[bob[10]]->SetPosition(449,50); - game[bob[11]]->SetPosition(449,193); - game[bob[12]]->SetPosition(545,50); - game[bob[13]]->SetPosition(545,193); - } - else{ - game[bob[0]]->SetPosition(-54,50); - game[bob[1]]->SetPosition(-54,193); - game[bob[2]]->SetPosition(58,50); - game[bob[3]]->SetPosition(58,193); - game[bob[4]]->SetPosition(166,50); - game[bob[5]]->SetPosition(166,193); - game[bob[6]]->SetPosition(272,50); - game[bob[7]]->SetPosition(272,193); - game[bob[8]]->SetPosition(378,50); - game[bob[9]]->SetPosition(378,193); - game[bob[10]]->SetPosition(487,50); - game[bob[11]]->SetPosition(487,193); - game[bob[12]]->SetPosition(599,50); - game[bob[13]]->SetPosition(599,193); - game[bob[14]]->SetPosition(700,0); - game[bob[15]]->SetPosition(700,0); - } - game[bob[0]]->SetSkew(-4.5,-49,4.5,-27,4.5,0,-4.5,0); - game[bob[1]]->SetSkew(-4.5,0,4.5,0,4.5,27,-4.5,49); - game[bob[2]]->SetSkew(-4,-22,4,-14,4,0,-4,0); - game[bob[3]]->SetSkew(-4,0,4,0,4,14,-4,22); - game[bob[4]]->SetSkew(0,-9,0,-5,0,0,0,0); - game[bob[5]]->SetSkew(0,0,0,0,0,5,0,9); - game[bob[6]]->SetSkew(0,0,0,0,0,0,0,0); - game[bob[7]]->SetSkew(0,0,0,0,0,0,0,0); - game[bob[8]]->SetSkew(0,-5,0,-9,0,0,0,0); - game[bob[9]]->SetSkew(0,0,0,0,0,9,0,5); - game[bob[10]]->SetSkew(-4,-14,4,-22,4,0,-4,0); - game[bob[11]]->SetSkew(-4,0,4,0,4,22,-4,14); - game[bob[12]]->SetSkew(-4.5,-27,4.5,-49,4.5,0,-4.5,0); - game[bob[13]]->SetSkew(-4.5,0,4.5,0,4.5,49,-4.5,27); - } - else if (rows==3) - { - if(CFG.widescreen){ - game[bob[0]]->SetPosition(13,58); - game[bob[1]]->SetPosition(13,153); - game[bob[2]]->SetPosition(13,250); - - game[bob[3]]->SetPosition(68,67); - game[bob[4]]->SetPosition(68,153); - game[bob[5]]->SetPosition(68,239); - - game[bob[6]]->SetPosition(120,74); - game[bob[7]]->SetPosition(120,153); - game[bob[8]]->SetPosition(120,232); - - game[bob[9]]->SetPosition(170,78); - game[bob[10]]->SetPosition(170,153); - game[bob[11]]->SetPosition(170,228); - - game[bob[12]]->SetPosition(214,80); - game[bob[13]]->SetPosition(214,153); - game[bob[14]]->SetPosition(214,226); - - game[bob[15]]->SetPosition(258,81); - game[bob[16]]->SetPosition(258,153); - game[bob[17]]->SetPosition(258,224); - - game[bob[18]]->SetPosition(302,81); - game[bob[19]]->SetPosition(302,153); - game[bob[20]]->SetPosition(302,223); - - game[bob[21]]->SetPosition(346,81); - game[bob[22]]->SetPosition(346,153); - game[bob[23]]->SetPosition(346,223); - - game[bob[24]]->SetPosition(390,80); - game[bob[25]]->SetPosition(390,153); - game[bob[26]]->SetPosition(390,225); - - game[bob[27]]->SetPosition(434,77); - game[bob[28]]->SetPosition(434,153); - game[bob[29]]->SetPosition(434,227); - - game[bob[30]]->SetPosition(484,73); - game[bob[31]]->SetPosition(484,153); - game[bob[32]]->SetPosition(484,231); - - game[bob[33]]->SetPosition(537,67); - game[bob[34]]->SetPosition(537,153); - game[bob[35]]->SetPosition(537,239); - - game[bob[36]]->SetPosition(591,58); - game[bob[37]]->SetPosition(591,153); - game[bob[38]]->SetPosition(591,250); - } - else{ - game[bob[0]]->SetPosition(-29,58); - game[bob[1]]->SetPosition(-29,153); - game[bob[2]]->SetPosition(-29,250); - - game[bob[3]]->SetPosition(33,67); - game[bob[4]]->SetPosition(33,153); - game[bob[5]]->SetPosition(33,239); - - game[bob[6]]->SetPosition(92,74); - game[bob[7]]->SetPosition(92,153); - game[bob[8]]->SetPosition(92,232); - - game[bob[9]]->SetPosition(149,78); - game[bob[10]]->SetPosition(149,153); - game[bob[11]]->SetPosition(149,228); - - game[bob[12]]->SetPosition(200,80); - game[bob[13]]->SetPosition(200,153); - game[bob[14]]->SetPosition(200,226); - - game[bob[15]]->SetPosition(251,81); - game[bob[16]]->SetPosition(251,153);// - game[bob[17]]->SetPosition(251,224); - - game[bob[18]]->SetPosition(302,81);// - game[bob[19]]->SetPosition(302,153);// - game[bob[20]]->SetPosition(302,223);// - - game[bob[21]]->SetPosition(353,81); - game[bob[22]]->SetPosition(353,153); - game[bob[23]]->SetPosition(353,223); - - game[bob[24]]->SetPosition(404,80); - game[bob[25]]->SetPosition(404,153); - game[bob[26]]->SetPosition(404,225); - - game[bob[27]]->SetPosition(457,77); - game[bob[28]]->SetPosition(457,153); - game[bob[29]]->SetPosition(457,227); - - game[bob[30]]->SetPosition(512,73); - game[bob[31]]->SetPosition(512,153); - game[bob[32]]->SetPosition(512,231); - - game[bob[33]]->SetPosition(572,67); - game[bob[34]]->SetPosition(572,153); - game[bob[35]]->SetPosition(572,239); - - game[bob[36]]->SetPosition(633,58); - game[bob[37]]->SetPosition(633,153); - game[bob[38]]->SetPosition(633,250); - } - - game[bob[0]]->SetSkew(-38,-110,15,-42,15,65,-38,32); - game[bob[1]]->SetSkew(-38,-75,15,-48,15,45,-38,72); - game[bob[2]]->SetSkew(-38,-52,15,-70,15,27,-38,100); - - game[bob[3]]->SetSkew(-38,-70,15,-24,15,40,-38,27); - game[bob[4]]->SetSkew(-38,-50,15,-35,15,40,-38,50); - game[bob[5]]->SetSkew(-38,-34,15,-47,15,24,-38,58); - - game[bob[6]]->SetSkew(-27,-55,19,-22,19,30,-27,22); - game[bob[7]]->SetSkew(-27,-40,19,-30,19,30,-27,40); - game[bob[8]]->SetSkew(-27,-20,19,-30,19,20,-27,50); - - game[bob[9]]->SetSkew(-19,-28,0,-17,0,15,-19,10); - game[bob[10]]->SetSkew(-19,-30,0,-20,0,12,-19,30); - game[bob[11]]->SetSkew(-19,-15,0,-20,0,10,-19,24); - - game[bob[12]]->SetSkew(-10,-20,3,-13,3,14,-10,10); - game[bob[13]]->SetSkew(-10,-20,3,-18,3,18,-10,20); - game[bob[14]]->SetSkew(-10,-10,3,-10,3,0,-10,10); - - game[bob[15]]->SetSkew(-10,-15,3,-12,3,13,-10,13); - game[bob[16]]->SetSkew(-10,-17,3,-10,3,10,-10,17); - game[bob[17]]->SetSkew(-10,-10,3,-15,3,10,-10,10); - - game[bob[18]]->SetSkew(-10,-10,3,-10,3,14,-10,14); - game[bob[19]]->SetSkew(-10,-10,3,-10,3,10,-10,10);//middle - game[bob[20]]->SetSkew(-10,-10,3,-10,3,10,-10,10); - - game[bob[21]]->SetSkew(-14,-10,4,-20,3,10,-14,10); - game[bob[22]]->SetSkew(-14,-10,4,-17,3,17,-14,10); - game[bob[23]]->SetSkew(-14,-10,4,-10,3,10,-14,10); - - game[bob[24]]->SetSkew(-10,-13,3,-20,3,14,-10,10); - game[bob[25]]->SetSkew(-10,-18,3,-20,3,20,-10,18); - game[bob[26]]->SetSkew(-10,-10,3,-10,3,20,-10,5); - - game[bob[27]]->SetSkew(-19,-17,0,-28,0,10,-19,15); - game[bob[28]]->SetSkew(-19,-20,0,-30,0,30,-19,12); - game[bob[29]]->SetSkew(-19,-20,0,-15,0,30,-19,10); - - game[bob[30]]->SetSkew(-27,-22,19,-55,19,22,-27,30); - game[bob[31]]->SetSkew(-27,-30,19,-40,19,40,-27,30); - game[bob[32]]->SetSkew(-27,-30,19,-20,19,55,-27,20); - - game[bob[33]]->SetSkew(-38,-24,15,-70,15,27,-38,40); - game[bob[34]]->SetSkew(-38,-35,15,-50,15,50,-38,40); - game[bob[35]]->SetSkew(-38,-47,15,-34,15,58,-38,24); - - game[bob[36]]->SetSkew(-38,-42,15,-110,15,32,-38,60); - game[bob[37]]->SetSkew(-38,-48,15,-75,15,70,-38,45); - game[bob[38]]->SetSkew(-38,-70,15,-52,15,100,-38,27); - } - - -} - +/**************************************************************************** + * libwiigui + * + * gui_gameGrid.cpp + * + * GUI class definitions + ***************************************************************************/ + +#include "gui.h" +#include "../wpad.h" + +#include +#include "gui_gamegrid.h" +#include "gui_image_async.h" +#include "../settings/cfg.h" +#include "../prompts/PromptWindows.h" +#include "../language/gettext.h" +#include "../menu.h" +#include "fatmounter.h" + +#include +#include +#include + +//#define SCALE 0.8f +//#define DEG_OFFSET 7 +#define RADIUS 780 +//#define IN_SPEED 175 +//#define SHIFT_SPEED 100 +//#define SPEED_STEP 4 +//#define SAFETY 320 +#define goSteps 10 +#include "../main.h" + + + + +extern const int vol; + +static int Skew1[7][8] = { + {-14,-66,14,-34,14,34,-14,66}, + {-10,-44,10,-26,10,26,-10,44}, + {-6,-22,6,-14,6,14,-6,22}, + {0,-11,0,-11,0,11,0,11}, + {-6,-14,6,-22,6,22,-6,14}, + {-10,-26,10,-44,10,44,-10,26}, + {-14,-34,14,-66,14,66,-14,34} + }; +static int Pos1[7][2][2] = { + // {{16:9 x,y},{ 4:3 x,y}} + {{-230,74}, {-320,74}}, + {{-70,74}, {-130,74}}, + {{88,74}, {60,74}}, + {{239,74}, {239,74}}, + {{390,74}, {420,74}}, + {{550,74}, {612,74}}, + {{710,74}, {772,74}} + }; +static int Skew2[18][8] = { + {-5,-49,5,-27,5,0,-5,0}, + {-5,0,5,0,5,27,-5,49}, + + {-5,-49,5,-27,5,0,-5,0}, + {-5,0,5,0,5,27,-5,49}, + + {-4,-22,4,-14,4,0,-4,0}, + {-4,0,4,0,4,14,-4,22}, + + {0,-9,0,-5,0,0,0,0}, + {0,0,0,0,0,5,0,9}, + + {0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0}, + + {0,-5,0,-9,0,0,0,0}, + {0,0,0,0,0,9,0,5}, + + {-4,-14,4,-22,4,0,-4,0}, + {-4,0,4,0,4,22,-4,14}, + + {-5,-27,5,-49,5,0,-5,0}, + {-5,0,5,0,5,49,-5,27}, + + {-5,-27,5,-49,5,0,-5,0}, + {-5,0,5,0,5,49,-5,27} + }; +static int Pos2[18][2][2] = { + // {{16:9 x,y},{ 4:3 x,y}} + {{-91,50}, {-166,50}}, + {{-91,193},{-166,193}}, + + {{3,50}, {-54,50}}, + {{3,193}, {-54,193}}, + + {{97,50}, {58,50}}, + {{97,193}, {58,193}}, + + {{187,50}, {166,50}}, + {{187,193}, {166,193}}, + + {{272,50}, {272,50}}, + {{272,193}, {272,193}}, + + {{358,50}, {378,50}}, + {{358,193}, {378,193}}, + + {{449,50}, {487,50}}, + {{449,193}, {487,193}}, + + {{545,50}, {599,50}}, + {{545,193}, {599,193}}, + + {{641,50}, {700,50}}, + {{641,193}, {700,193}} + }; +static int Skew3[45][8] = { + {-38,-110,15,-42,15,65,-38,32}, + {-38,-75,15,-48,15,45,-38,72}, + {-38,-52,15,-70,15,27,-38,100}, + + {-38,-110,15,-42,15,65,-38,32}, + {-38,-75,15,-48,15,45,-38,72}, + {-38,-52,15,-70,15,27,-38,100}, + + {-38,-70,15,-24,15,40,-38,27}, + {-38,-50,15,-35,15,40,-38,50}, + {-38,-34,15,-47,15,24,-38,58}, + + {-27,-55,19,-22,19,30,-27,22}, + {-27,-40,19,-30,19,30,-27,40}, + {-27,-20,19,-30,19,20,-27,50}, + + {-19,-28,0,-17,0,15,-19,10}, + {-19,-30,0,-20,0,12,-19,30}, + {-19,-15,0,-20,0,10,-19,24}, + + {-10,-20,3,-13,3,14,-10,10}, + {-10,-20,3,-18,3,18,-10,20}, + {-10,-10,3,-10,3,0,-10,10}, + + {-10,-15,3,-12,3,13,-10,13}, + {-10,-17,3,-10,3,10,-10,17}, + {-10,-10,3,-15,3,10,-10,10}, + + {-10,-10,3,-10,3,14,-10,14}, + {-10,-10,3,-10,3,10,-10,10},//middle + {-10,-10,3,-10,3,10,-10,10}, + + {-14,-10,4,-20,3,10,-14,10}, + {-14,-10,4,-17,3,17,-14,10}, + {-14,-10,4,-10,3,10,-14,10}, + + {-10,-13,3,-20,3,14,-10,10}, + {-10,-18,3,-20,3,20,-10,18}, + {-10,-10,3,-10,3,20,-10,5}, + + {-19,-17,0,-28,0,10,-19,15}, + {-19,-20,0,-30,0,30,-19,12}, + {-19,-20,0,-15,0,30,-19,10}, + + {-27,-22,19,-55,19,22,-27,30}, + {-27,-30,19,-40,19,40,-27,30}, + {-27,-30,19,-20,19,55,-27,20}, + + {-38,-24,15,-70,15,27,-38,40}, + {-38,-35,15,-50,15,50,-38,40}, + {-38,-47,15,-34,15,58,-38,24}, + + {-38,-42,15,-110,15,32,-38,60}, + {-38,-48,15,-75,15,70,-38,45}, + {-38,-70,15,-52,15,100,-38,27}, + + {-38,-42,15,-110,15,32,-38,60}, + {-38,-48,15,-75,15,70,-38,45}, + {-38,-70,15,-52,15,100,-38,27} + }; +static int Pos3[45][2][2] = { + // {{16:9 x,y},{ 4:3 x,y}} + {{-42,49}, {-91,49}}, + {{-42,153},{-91,153}}, + {{-42,261},{-91,261}}, + + {{13,58}, {-29,58}}, + {{13,153}, {-29,153}}, + {{13,250}, {-29,250}}, + + {{68,67}, {33,67}}, + {{68,153}, {33,153}}, + {{68,239}, {33,239}}, + + {{120,74}, {92,74}}, + {{120,153}, {92,153}}, + {{120,232}, {92,232}}, + + {{170,78}, {149,78}}, + {{170,153}, {149,153}}, + {{170,228}, {149,228}}, + + {{214,80}, {200,80}}, + {{214,153}, {200,153}}, + {{214,226}, {200,226}}, + + {{258,81}, {251,81}}, + {{258,153}, {251,153}}, + {{258,224}, {251,224}}, + + {{302,81}, {302,81}}, + {{302,153}, {302,153}}, + {{302,223}, {302,223}}, + + {{346,81}, {353,81}}, + {{346,153}, {353,153}}, + {{346,223}, {353,223}}, + + {{390,80}, {404,80}}, + {{390,153}, {404,153}}, + {{390,225}, {404,225}}, + + {{434,77}, {457,77}}, + {{434,153}, {457,153}}, + {{434,227}, {457,227}}, + + {{484,73}, {512,73}}, + {{484,153}, {512,153}}, + {{484,231}, {512,231}}, + + {{537,67}, {572,67}}, + {{537,153}, {572,153}}, + {{537,239}, {572,239}}, + + {{591,58}, {633,58}}, + {{591,153}, {633,153}}, + {{591,250}, {633,250}}, + + {{645,58}, {633,58}}, + {{645,153}, {633,153}}, + {{645,250}, {633,250}} + + }; +#define VALUE4ROWS(rows, val1, val2, val3) (rows==3 ? val3 : (rows==2 ? val2 : val1)) +#define ROWS2PAGESIZE(rows) (rows==3 ? 45 : (rows==2 ? 18 : 7)) +static inline int OFFSETLIMIT(int Offset, int rows, int gameCnt) +{ + gameCnt += ( rows - ( gameCnt % rows ) ) % rows; // add count of skiped Entries at end if List + while(Offset > gameCnt) Offset -= gameCnt; + while(Offset < 0) Offset += gameCnt; + return Offset; +} + +// Help-Function to Calc GameIndex +static int GetGameIndex(int pageEntry, int rows, int listOffset, int gameCnt) +{ + int skip = ( rows - ( gameCnt % rows ) ) % rows; // count of skiped Entries at end if List + int pagesize = ROWS2PAGESIZE(rows); + + if( gameCnt < (pagesize-2*rows) ) + { + int listStart = (pagesize-gameCnt)>>1; // align list on the center + listStart = listStart - (listStart%rows); // align listStart to the top row + if(pageEntry < listStart || pageEntry >= listStart + gameCnt) + return -1; + return pageEntry - listStart; + } + else + { + listOffset = listOffset - (listOffset%rows); // align listOffset to the top row + listOffset = listOffset - 2*rows; // align listOffset to the left full visible column + if(listOffset < 0) + listOffset += gameCnt + skip; // set the correct Offset + pageEntry = (listOffset + pageEntry) % (gameCnt + skip); // get offset of pageEntry + if(pageEntry >= gameCnt) + return -1; + return pageEntry; + } +} +static GuiImageData *GameGridLoadCoverImage(void * Arg) +{ + return LoadCoverImage((struct discHdr *)Arg, false, false); +} +/** + * Constructor for the GuiGamegrid class. + */ +GuiGameGrid::GuiGameGrid(int w, int h, struct discHdr * l, int count, const char *themePath, const u8 *imagebg, int selected, int offset) : +noCover(nocoverFlat_png) +{ + width = w; + height = h; +// gameCnt = count; will be set later in Reload +// gameList = l; will be set later in Reload +// listOffset = 0; will be set later in Reload +// goLeft = 0; will be set later in Reload +// goRight = 0; will be set later in Reload + + selectable = true; + focus = 1; // allow focus +// selectedItem = -1; will be set later in Reload +// clickedItem = -1; will be set later in Reload +/* will be set later in Reload + rows = Settings.gridRows; + if ((count<45)&&(rows==3))rows=2; + if ((count<18)&&(rows==2))rows=1; + + pagesize = ROWS2PAGESIZE(rows); +*/ + trigA = new GuiTrigger; + trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); + trigL = new GuiTrigger; + trigL->SetButtonOnlyTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT); + trigR = new GuiTrigger; + trigR->SetButtonOnlyTrigger(-1, WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT, PAD_BUTTON_RIGHT); + trig1 = new GuiTrigger; + trig1->SetButtonOnlyTrigger(-1, WPAD_BUTTON_UP | WPAD_CLASSIC_BUTTON_X, PAD_BUTTON_X); + trig2 = new GuiTrigger; + trig2->SetButtonOnlyTrigger(-1, WPAD_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_Y, PAD_BUTTON_Y); + trigPlus = new GuiTrigger; + trigPlus->SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, 0); + trigMinus = new GuiTrigger; + trigMinus->SetButtonOnlyTrigger(-1, WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS, 0); + + btnSoundClick = new GuiSound(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, Settings.sfxvolume); + btnSoundOver = new GuiSound(button_over_pcm, button_over_pcm_size, SOUND_PCM, Settings.sfxvolume); + + int btnHeight = (int) lround(sqrt(RADIUS*RADIUS - 90000)-RADIUS-50); + + // Button Left + btnLeft = new GuiButton(0,0); + btnLeft->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); + btnLeft->SetPosition(20, btnHeight); + btnLeft->SetParent(this); + btnLeft->SetSoundOver(btnSoundOver); + btnLeft->SetTrigger(trigL); + btnLeft->SetTrigger(trigMinus); + + // Button Right + btnRight = new GuiButton(0,0); + btnRight->SetParent(this); + btnRight->SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE); + btnRight->SetPosition(-20, btnHeight); + btnRight->SetSoundOver(btnSoundOver); + btnRight->SetTrigger(trigR); + btnRight->SetTrigger(trigPlus); + + // Button RowUp + btnRowUp = new GuiButton(0,0); + btnRowUp->SetParent(this); + btnRowUp->SetAlignment(ALIGN_LEFT, ALIGN_TOP); + btnRowUp->SetPosition(0,0); + btnRowUp->SetTrigger(trig2); + + // Button RowDown + btnRowDown = new GuiButton(0,0); + btnRowDown->SetParent(this); + btnRowDown->SetAlignment(ALIGN_LEFT, ALIGN_TOP); + btnRowDown->SetPosition(0,0); + btnRowDown->SetTrigger(trig1); + + // Page-Stuff + gameIndex = NULL; + titleTT = NULL; +// cover = NULL; + coverImg = NULL; + game = NULL; + + Reload(l, count, Settings.gridRows, 0); +} + + +/** + * Destructor for the GuiGameGrid class. + */ +GuiGameGrid::~GuiGameGrid() +{ + + delete btnRight; + delete btnLeft; + delete btnRowUp; + delete btnRowDown; + + delete trigA; + delete trigL; + delete trigR; + delete trigPlus; + delete trigMinus; + delete trig1; + delete trig2; + delete btnSoundClick; + delete btnSoundOver; + + for(int i=pagesize-1; i>=0; i--) + { + delete game[i]; + delete coverImg[i]; + delete titleTT[i]; + } + + delete [] gameIndex; + delete [] game; + delete [] coverImg; + delete [] titleTT; +} + + +void GuiGameGrid::SetFocus(int f) +{ + LOCK(this); + if(!gameCnt) + return; + + focus = f; + + for(int i=0; iResetState(); + + if(f == 1 && selectedItem >= 0) + game[selectedItem]->SetState(STATE_SELECTED); +} + + +void GuiGameGrid::ResetState() +{ + LOCK(this); + if(state != STATE_DISABLED) + { + state = STATE_DEFAULT; + stateChan = -1; + } + + for(int i=0; iResetState(); + } +} + + +int GuiGameGrid::GetOffset() +{ + LOCK(this); + return listOffset; +} + + +int GuiGameGrid::GetClickedOption() +{ + LOCK(this); + int found = -1; + if (clickedItem>=0) + { + game[clickedItem]->SetState(STATE_SELECTED); + found = gameIndex[clickedItem]; + clickedItem=-1; + } + return found; +} + + +int GuiGameGrid::GetSelectedOption() +{ + LOCK(this); + int found = -1; + for(int i=0; iGetState() == STATE_SELECTED) + { + game[i]->SetState(STATE_SELECTED); + found = gameIndex[i]; + break; + } + } + return found; +} + +/** + * Draw the button on screen + */ +void GuiGameGrid::Draw() +{ + LOCK(this); + if(!this->IsVisible() || !gameCnt) + return; + + if(goLeft>0) + { + goLeft--; + int wsi = CFG.widescreen ? 0:1; + float f2 = ((float)goLeft)/goSteps; + float f1 = 1.0-f2; + int (*Pos)[2][2] = VALUE4ROWS(rows, Pos1, Pos2, Pos3); + int (*Skew)[8] = VALUE4ROWS(rows, Skew1, Skew2, Skew3); + + for(int i=0; iSetPosition( Pos[i][wsi][0]*f1 + Pos[i+rows][wsi][0]*f2, + Pos[i][wsi][1]*f1 + Pos[i+rows][wsi][1]*f2); + + game[i]->SetSkew( Skew[i][0]*f1 + Skew[i+rows][0]*f2, + Skew[i][1]*f1 + Skew[i+rows][1]*f2, + Skew[i][2]*f1 + Skew[i+rows][2]*f2, + Skew[i][3]*f1 + Skew[i+rows][3]*f2, + Skew[i][4]*f1 + Skew[i+rows][4]*f2, + Skew[i][5]*f1 + Skew[i+rows][5]*f2, + Skew[i][6]*f1 + Skew[i+rows][6]*f2, + Skew[i][7]*f1 + Skew[i+rows][7]*f2); + } + } + else if(goRight>0) + { + goRight--; + int wsi = CFG.widescreen ? 0:1; + float f2 = ((float)goRight)/goSteps; + float f1 = 1.0-f2; + int (*Pos)[2][2] = VALUE4ROWS(rows, Pos1, Pos2, Pos3); + int (*Skew)[8] = VALUE4ROWS(rows, Skew1, Skew2, Skew3); + for(int i=rows; iSetPosition( Pos[i][wsi][0]*f1 + Pos[i-rows][wsi][0]*f2, + Pos[i][wsi][1]*f1 + Pos[i-rows][wsi][1]*f2); + + game[i]->SetSkew( Skew[i][0]*f1 + Skew[i-rows][0]*f2, + Skew[i][1]*f1 + Skew[i-rows][1]*f2, + Skew[i][2]*f1 + Skew[i-rows][2]*f2, + Skew[i][3]*f1 + Skew[i-rows][3]*f2, + Skew[i][4]*f1 + Skew[i-rows][4]*f2, + Skew[i][5]*f1 + Skew[i-rows][5]*f2, + Skew[i][6]*f1 + Skew[i-rows][6]*f2, + Skew[i][7]*f1 + Skew[i-rows][7]*f2); + } + } + + for(int i=0; iDraw(); + if(gameCnt > pagesize-2*rows) + { + btnRight->Draw(); + btnLeft->Draw(); + } + + btnRowUp->Draw(); + btnRowDown->Draw(); + + if (focus && Settings.tooltips == TooltipsOn) + for(int i=0; iDrawTooltip(); + + this->UpdateEffects(); +} + + + +/** + * Change the number of rows + */ +void GuiGameGrid::ChangeRows(int n) +{ + LOCK(this); + if(n != rows) + Reload(gameList, gameCnt, n, -1); +} + + +void GuiGameGrid::Update(GuiTrigger * t) +{ + LOCK(this); + if(state == STATE_DISABLED || !t || !gameCnt) + return; + + if(!(game[0]->GetEffect() || game[0]->GetEffectOnOver())) + { + for(int i=0; iSetEffectGrow(); + } + + btnRight->Update(t); + btnLeft->Update(t); + btnRowUp->Update(t); + btnRowDown->Update(t); + + selectedItem = -1; + clickedItem = -1; + for(int i=0; iUpdate(t); + if(game[i]->GetState() == STATE_SELECTED) + { + selectedItem = i; + } + if(game[i]->GetState() == STATE_CLICKED) + { + clickedItem = i; + } + + } + // navigation + if(focus && gameCnt >= (pagesize-2*rows) && goLeft==0 && goRight==0) + { + // Left/Right Navigation + + if (btnLeft->GetState() == STATE_CLICKED) + { + WPAD_ScanPads(); + u16 buttons = 0; + for(int i=0; i<4; i++) + buttons |= WPAD_ButtonsHeld(i); + if(!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_MINUS) || t->Left())) + { + btnLeft->ResetState(); + return; + } + + if (Settings.xflip==sysmenu || Settings.xflip==yes || Settings.xflip==disk3d) + goRight = goSteps; + else + goLeft = goSteps; + } + else if(btnRight->GetState() == STATE_CLICKED) + { + WPAD_ScanPads(); + u16 buttons = 0; + for(int i=0; i<4; i++) + buttons |= WPAD_ButtonsHeld(i); + if(!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_PLUS) || t->Right())) + { + btnRight->ResetState(); + return; + } + if (Settings.xflip==sysmenu ||Settings.xflip==yes || Settings.xflip==disk3d) + goLeft = goSteps; + else + goRight = goSteps; + } + + if (goLeft == goSteps) + { + GuiButton *tmpButton[rows]; + GuiTooltip *tmpTooltip[rows]; + listOffset = OFFSETLIMIT(listOffset + rows, rows, gameCnt); // set the new listOffset + // Save left Tooltip & Button and destroy left Image + Image-Data + for (int i=0; iSetImage(NULL); + tmpTooltip[i] = titleTT[i]; + tmpButton[i] = game[i]; + } + // Move all Page-Entries one step left + for (int i=0; i<(pagesize-rows); i++) + { + titleTT[i] = titleTT[i+rows]; + coverImg[i] = coverImg[i+rows]; + game[i] = game[i+rows]; + gameIndex[i] = gameIndex[i+rows]; + } + // set saved Tooltip, Button & gameIndex to right + int wsi = CFG.widescreen ? 0:1; + int (*Pos)[2][2] = VALUE4ROWS(rows, Pos1, Pos2, Pos3); + int (*Skew)[8] = VALUE4ROWS(rows, Skew1, Skew2, Skew3); + + for (int i=0; iSetWidescreen(CFG.widescreen); + coverImg[ii] ->SetScale(VALUE4ROWS(rows, 1.0, 0.6, 0.26)); + coverImg[ii] ->SetPosition(0,VALUE4ROWS(rows, 0, -50, -80)); + } + titleTT[ii] ->SetText(get_title(&gameList[gameIndex[ii]])); + } + else + { + titleTT[ii] ->SetText(NULL); + } + + game[ii] = tmpButton[i]; + game[ii] ->SetImage(coverImg[ii]); + game[ii] ->SetPosition(Pos[ii][wsi][0], Pos[ii][wsi][1]); + game[ii] ->SetSkew(&Skew[ii][0]); + game[ii] ->RemoveToolTip(); + if(gameIndex[ii] != -1) + { + game[ii] ->SetClickable(true); + game[ii] ->SetVisible(true); + } + else + { + game[ii] ->SetVisible(false); + game[ii] ->SetClickable(false); + game[ii] ->RemoveSoundOver(); + } + } + // Set Tooltip-Position + int ttoffset_x = CFG.widescreen ? VALUE4ROWS(rows, 70, 35, 0) : VALUE4ROWS(rows, 150, 55, 25); + int ttoffset_y = -VALUE4ROWS(rows, 224, 133, 68)/4; + for (int i=0; iSetToolTip(titleTT[i], ttoffset_x, ttoffset_y, ALIGN_LEFT, ALIGN_MIDDLE); + break; + case 1: + game[i]->SetToolTip(titleTT[i], 0, ttoffset_y, ALIGN_CENTRE, ALIGN_MIDDLE); + break; + case 2: + game[i]->SetToolTip(titleTT[i], -ttoffset_x, ttoffset_y, ALIGN_RIGHT, ALIGN_MIDDLE); + break; + default: + break; + } + } + } + else if (goRight == goSteps) + { + GuiButton *tmpButton[rows]; + GuiTooltip *tmpTooltip[rows]; + listOffset = OFFSETLIMIT(listOffset - rows, rows, gameCnt); // set the new listOffset + // Save right Button & Tooltip and destroy right Image-Data + for (int i=0; iSetImage(NULL); + tmpTooltip[i] = titleTT[ii]; + tmpButton[i] = game[ii]; + } + // Move all Page-Entries one step right + for (int i=pagesize-1; i>=rows; i--) + { + titleTT[i] = titleTT[i-rows]; + coverImg[i] = coverImg[i-rows]; + game[i] = game[i-rows]; + gameIndex[i] = gameIndex[i-rows]; + } + // set saved Image, Button & gameIndex to left + int wsi = CFG.widescreen ? 0:1; + int (*Pos)[2][2] = VALUE4ROWS(rows, Pos1, Pos2, Pos3); + int (*Skew)[8] = VALUE4ROWS(rows, Skew1, Skew2, Skew3); + + for (int i=0; iSetWidescreen(CFG.widescreen); + coverImg[i] ->SetScale(VALUE4ROWS(rows, 1.0, 0.6, 0.26)); + coverImg[i] ->SetPosition(0,VALUE4ROWS(rows, 0, -50, -80)); + } + titleTT[i] ->SetText(get_title(&gameList[gameIndex[i]])); + } + else + { + titleTT[i] ->SetText(NULL); + } + game[i] = tmpButton[i]; + game[i] ->SetImage(coverImg[i]); + game[i] ->SetPosition(Pos[i][wsi][0], Pos[i][wsi][1]); + game[i] ->SetSkew(&Skew[i][0]); + game[i] ->RemoveToolTip(); + if(gameIndex[i] != -1) + { + game[i] ->SetClickable(true); + game[i] ->SetVisible(true); + } + else + { + game[i] ->SetVisible(false); + game[i] ->SetClickable(false); + game[i] ->RemoveSoundOver(); + } + } + // Set Tooltip-Position + int ttoffset_x = CFG.widescreen ? VALUE4ROWS(rows, 70, 35, 0) : VALUE4ROWS(rows, 150, 55, 25); + int ttoffset_y = -VALUE4ROWS(rows, 224, 133, 68)/4; + for (int i=0; i< pagesize; i++) + { + switch((i*3)/pagesize) + { + case 0: + game[i]->SetToolTip(titleTT[i], ttoffset_x, ttoffset_y, ALIGN_LEFT, ALIGN_MIDDLE); + break; + case 1: + game[i]->SetToolTip(titleTT[i], 0, ttoffset_y, ALIGN_CENTRE, ALIGN_MIDDLE); + break; + case 2: + game[i]->SetToolTip(titleTT[i], -ttoffset_x, ttoffset_y, ALIGN_RIGHT, ALIGN_MIDDLE); + break; + default: + break; + } + } + } + } + + if ((btnRowUp->GetState() == STATE_CLICKED)) + { + if ((rows==1)&&(gameCnt>=18))this->ChangeRows(2); + else if ((rows==2)&&(gameCnt>=45))this->ChangeRows(3); + btnRowUp->ResetState(); + return; + } + + if ((btnRowDown->GetState() == STATE_CLICKED)) + { + if (rows==3)this->ChangeRows(2); + else if (rows==2)this->ChangeRows(1); + btnRowDown->ResetState(); + return; + } + + if(updateCB) + updateCB(this); +} + + +void GuiGameGrid::Reload(struct discHdr * l, int count, int Rows, int ListOffset) +{ + LOCK(this); + + // CleanUp + if(game) + for(int i=pagesize-1; i>=0; i--) + delete game[i]; + + if(coverImg) + for(int i=pagesize-1; i>=0; i--) + delete coverImg[i]; + +// if(cover) +// for(int i=pagesize-1; i>=0; i--) +// delete cover[i]; + + if(titleTT) + for(int i=pagesize-1; i>=0; i--) + delete titleTT[i]; + + delete [] gameIndex; + delete [] game; + delete [] coverImg; +// delete [] cover; + delete [] titleTT; + + gameList = l; + gameCnt = count; + goLeft = 0; + goRight = 0; + + rows = Rows > 3 ? 3 : (Rows < 1 ? 1 : Rows); + if ((count<45)&&(rows==3))rows=2; + if ((count<18)&&(rows==2))rows=1; + + if(ListOffset>=0) // if ListOffset < 0 then no change + listOffset = ListOffset; + listOffset = OFFSETLIMIT(listOffset, rows, gameCnt); + + selectedItem = -1; + clickedItem = -1; + + pagesize = ROWS2PAGESIZE(rows); + + // Page-Stuff + gameIndex = new int[pagesize]; + titleTT = new GuiTooltip *[pagesize]; +// cover = new GuiImageData *[pagesize]; + coverImg = new GuiImageAsync *[pagesize]; + game = new GuiButton *[pagesize]; + + + int wsi = CFG.widescreen ? 0:1; + int (*Pos)[2][2] = VALUE4ROWS(rows, Pos1, Pos2, Pos3); + int (*Skew)[8] = VALUE4ROWS(rows, Skew1, Skew2, Skew3); + + int ttoffset_x = CFG.widescreen ? VALUE4ROWS(rows, 70, 35, 0) : VALUE4ROWS(rows, 150, 55, 25); + int ttoffset_y = -VALUE4ROWS(rows, 224, 133, 68)/4; + + for(int i=0; i < pagesize; i++) + { + //------------------------ + // Index + //------------------------ + gameIndex[i] = GetGameIndex(i, rows, listOffset, gameCnt); + + //------------------------ + // Tooltip + //------------------------ + if( gameIndex[i] != -1 ) + titleTT[i] = new GuiTooltip(get_title(&gameList[gameIndex[i]]), THEME.tooltipAlpha); + else + titleTT[i] = new GuiTooltip(NULL, THEME.tooltipAlpha); + + //------------------------ + // ImageData + //------------------------ +// if( gameIndex[i] != -1 ) +// cover[i] = LoadCoverImage(&gameList[gameIndex[i]], false /*bool Prefere3D*/); +// else +// cover[i] = new GuiImageData(NULL); + + //------------------------ + // Image + //------------------------ + coverImg[i] = NULL; + if( gameIndex[i] != -1 ) + { + coverImg[i] = new GuiImageAsync(GameGridLoadCoverImage, &gameList[gameIndex[i]], sizeof(struct discHdr), &noCover); + if(coverImg[i]) + { + coverImg[i]->SetWidescreen(CFG.widescreen); + // if ( rows == 2 ) coverImg[i]->SetScale(.6); //these are the numbers for 2 rows + // else if ( rows == 3 ) coverImg[i]->SetScale(.26); //these are the numbers for 3 rows + coverImg[i]->SetScale(VALUE4ROWS(rows, 1.0, 0.6, 0.26)); + coverImg[i]->SetPosition(0,VALUE4ROWS(rows, 0, -50, -80)); + } + } + + //------------------------ + // GameButton + //------------------------ + game[i] = new GuiButton(VALUE4ROWS(rows, 160, 75, 35), VALUE4ROWS(rows, 224, 133, 68)); + game[i]->SetParent(this); + game[i]->SetImage(coverImg[i]); + game[i]->SetAlignment(ALIGN_TOP,ALIGN_LEFT); + game[i]->SetPosition(Pos[i][wsi][0], Pos[i][wsi][1]); + game[i]->SetSkew(&Skew[i][0]); + game[i]->SetTrigger(trigA); + game[i]->SetSoundOver(btnSoundOver); + game[i]->SetSoundClick(btnSoundClick); + game[i]->SetRumble(false); + switch((i*3)/pagesize) + { + case 0: + game[i]->SetToolTip(titleTT[i], ttoffset_x, ttoffset_y, ALIGN_LEFT, ALIGN_MIDDLE); + break; + case 1: + game[i]->SetToolTip(titleTT[i], 0, ttoffset_y, ALIGN_CENTRE, ALIGN_MIDDLE); + break; + case 2: + game[i]->SetToolTip(titleTT[i], -ttoffset_x, ttoffset_y, ALIGN_RIGHT, ALIGN_MIDDLE); + break; + default: + break; + } + if(gameIndex[i] >= 0) + { + game[i]->SetClickable(true); + game[i]->SetVisible(true); + } + else + { + game[i]->SetVisible(false); + game[i]->SetClickable(false); + // game[i]->RemoveSoundOver(); + } + } + Settings.gridRows = rows; + if(isInserted(bootDevice)) + cfg_save_global(); +} + diff --git a/source/libwiigui/gui_gamegrid.h b/source/libwiigui/gui_gamegrid.h index 4d742922..e8c30113 100644 --- a/source/libwiigui/gui_gamegrid.h +++ b/source/libwiigui/gui_gamegrid.h @@ -3,7 +3,7 @@ #include "gui.h" #include "../usbloader/disc.h" - +class GuiImageAsync; class GuiGameGrid : public GuiElement { public: @@ -17,32 +17,26 @@ class GuiGameGrid : public GuiElement void Draw(); void Update(GuiTrigger * t); int GetOffset(); - void Reload(struct discHdr * l, int count); + void Reload(struct discHdr * l, int count, int Rows, int ListOffset); void ChangeRows(int n); protected: + GuiImageData noCover; int selectedItem; int listOffset; - int scrollbaron; int pagesize; - int firstPic; - int speed; int clickedItem; int rows; - int drawTTs; - + int goLeft; + int goRight; struct discHdr * gameList; int gameCnt; int * gameIndex; - int * bob; - GuiButton ** game; - - GuiImage ** coverImg; - GuiImageData ** cover; + GuiTooltip ** titleTT; + GuiImageAsync ** coverImg; - GuiText * debugTxt; GuiButton * btnRight; GuiButton * btnLeft; @@ -55,9 +49,6 @@ class GuiGameGrid : public GuiElement GuiImageData * imgLeft; GuiImageData * imgRight; - GuiTooltip * titleTT; - - GuiSound * btnSoundOver; GuiSound * btnSoundClick; GuiTrigger * trigA; diff --git a/source/libwiigui/gui_image.cpp b/source/libwiigui/gui_image.cpp index 9208f467..f3166b01 100644 --- a/source/libwiigui/gui_image.cpp +++ b/source/libwiigui/gui_image.cpp @@ -34,9 +34,18 @@ GuiImage::GuiImage() GuiImage::GuiImage(GuiImageData * img) { - image = img->GetImage(); - width = img->GetWidth(); - height = img->GetHeight(); + if(img) + { + image = img->GetImage(); + width = img->GetWidth(); + height = img->GetHeight(); + } + else + { + image = NULL; + width = 0; + height = 0; + } imageangle = 0; tile = -1; stripe = 0; @@ -111,13 +120,8 @@ GuiImage::GuiImage(int w, int h, GXColor c) DCFlushRange(image, len); } -GuiImage::GuiImage(GuiImage &srcimage) +GuiImage::GuiImage(GuiImage &srcimage) : GuiElement() { - if((imgType == IMAGE_COLOR || imgType == IMAGE_COPY) && image) { - free(image); - image = NULL; - } - width = srcimage.GetWidth(); height = srcimage.GetHeight(); int len = width * height * 4; @@ -141,13 +145,8 @@ GuiImage::GuiImage(GuiImage &srcimage) imgType = IMAGE_COPY; } -GuiImage::GuiImage(GuiImage *srcimage) +GuiImage::GuiImage(GuiImage *srcimage) : GuiElement() { - if((imgType == IMAGE_COLOR || imgType == IMAGE_COPY) && image) { - free(image); - image = NULL; - } - width = srcimage->GetWidth(); height = srcimage->GetHeight(); int len = width * height * 4; @@ -307,7 +306,7 @@ void GuiImage::SetGrayscale(void) for(int x = 0; x < width; x++) { for(int y = 0; y < height; y++) { - offset = (((y >> 2)<<4)*this->GetWidth()) + ((x >> 2)<<6) + (((y%4 << 2) + x%4 ) << 1); + offset = (((y >> 2)<<4)*width) + ((x >> 2)<<6) + (((y%4 << 2) + x%4 ) << 1); color.r = *(image+offset+1); color.g = *(image+offset+32); color.b = *(image+offset+33); @@ -331,14 +330,26 @@ void GuiImage::SetStripe(int s) void GuiImage::SetSkew(int XX1, int YY1,int XX2, int YY2,int XX3, int YY3,int XX4, int YY4) { - xx1 = XX1; - yy1 = YY1; - xx2 = XX2; - yy2 = YY2; - xx3 = XX3; - yy3 = YY3; - xx4 = XX4; - yy4 = YY4; + xx1 = XX1; + yy1 = YY1; + xx2 = XX2; + yy2 = YY2; + xx3 = XX3; + yy3 = YY3; + xx4 = XX4; + yy4 = YY4; +} +void GuiImage::SetSkew(int *skew) +{ + + xx1 = *skew++; + yy1 = *skew++; + xx2 = *skew++; + yy2 = *skew++; + xx3 = *skew++; + yy3 = *skew++; + xx4 = *skew++; + yy4 = *skew; } diff --git a/source/libwiigui/gui_image_async.cpp b/source/libwiigui/gui_image_async.cpp new file mode 100644 index 00000000..a16f7363 --- /dev/null +++ b/source/libwiigui/gui_image_async.cpp @@ -0,0 +1,196 @@ +/**************************************************************************** + * libwiigui + * + * Tantric 2009 + * + * gui_imagea_sync.cpp + * + * GUI class definitions + ***************************************************************************/ + +#include "gui.h" +//#include +#include +#include "gui_image_async.h" +static mutex_t debugLock = LWP_MUTEX_NULL; + +void debug(int Line, const char* Format, ...) +{ + if(debugLock==0) LWP_MutexInit(&debugLock, false); + + LWP_MutexLock(debugLock); + + FILE *fp = fopen("SD:/debug.txt", "a"); + if(fp) + { + char theTime[10]; + time_t rawtime = time(0); //this fixes code dump caused by the clock + struct tm * timeinfo = localtime (&rawtime); + strftime(theTime, sizeof(theTime), "%H:%M:%S", timeinfo); + char format[10+strlen(Format)+strlen(theTime)]; + sprintf(format, "%s %i - %s\n", theTime, Line, Format); + va_list va; + va_start(va, Format); + vfprintf(fp, format, va); + va_end(va); + fclose(fp); + } + LWP_MutexUnlock(debugLock); +} +//#define DEBUG(format, ...) debug(__LINE__, format, ##__VA_ARGS__) +#define DEBUG(format, ...) + +static void *memdup(const void* src, size_t len) +{ + void *dst = malloc(len); + if(dst) memcpy(dst, src, len); + return dst; +} +static std::vector List; +static u32 ThreadCount = 0; +static lwp_t Thread = LWP_THREAD_NULL; +static mutex_t ListLock = LWP_MUTEX_NULL; +static mutex_t InUseLock = LWP_MUTEX_NULL; +static GuiImageAsync *InUse = NULL; +static bool Quit = false; +static bool CanSleep = true; +void *GuiImageAsyncThread(void *arg) +{ + while(!Quit) + { + LWP_MutexLock(ListLock); + if(List.size()) + { + LWP_MutexLock(InUseLock); + + InUse = List.front(); + List.erase(List.begin()); + + LWP_MutexUnlock(ListLock); + + if(InUse) + { + GuiImageData *data = InUse->callback(InUse->arg); + InUse->loadet_imgdata = data; + if(InUse->loadet_imgdata && InUse->loadet_imgdata->GetImage()) + { + // InUse->SetImage(InUse->loadet_imgdata); cant use here. There can occur a deadlock + // Sets the image directly without lock. This is not fine, but it prevents a deadlock + InUse->image = InUse->loadet_imgdata->GetImage(); + InUse->width = InUse->loadet_imgdata->GetWidth(); + InUse->height = InUse->loadet_imgdata->GetHeight(); + } + } + InUse = NULL; + LWP_MutexUnlock(InUseLock); + } + else + { + LWP_MutexUnlock(ListLock); + if(!Quit && CanSleep) + LWP_SuspendThread(Thread); + } + CanSleep = true; + } + Quit = false; + return NULL; +} + +static u32 GuiImageAsyncThreadInit() +{ + if(0 == ThreadCount++) + { + CanSleep = false; + LWP_MutexInit(&ListLock, false); + LWP_MutexInit(&InUseLock, false); + LWP_CreateThread(&Thread, GuiImageAsyncThread, NULL, NULL, 0, 75); +// while(!CanSleep) +// usleep(20); + } + return ThreadCount; +} +static u32 GuiImageAsyncThreadExit() +{ + if(--ThreadCount == 0) + { + Quit = true; + LWP_ResumeThread(Thread); +// while(Quit) +// usleep(20); + LWP_JoinThread(Thread, NULL); + LWP_MutexDestroy(ListLock); + LWP_MutexDestroy(InUseLock); + Thread = LWP_THREAD_NULL; + ListLock = LWP_MUTEX_NULL; + InUseLock = LWP_MUTEX_NULL; + } + return ThreadCount; +} + + +static void GuiImageAsyncThread_AddImage(GuiImageAsync* Image) +{ + LWP_MutexLock(ListLock); + List.push_back(Image); + LWP_MutexUnlock(ListLock); + CanSleep = false; +// if(LWP_ThreadIsSuspended(Thread)) + LWP_ResumeThread(Thread); +} +static void GuiImageAsyncThread_RemoveImage(GuiImageAsync* Image) +{ + LWP_MutexLock(ListLock); + for(std::vector::iterator iter=List.begin(); iter != List.end(); iter++) + { + if(*iter == Image) + { + List.erase(iter); + LWP_MutexUnlock(ListLock); + return; + } + } + if(InUse == Image) + { + LWP_MutexLock(InUseLock); + LWP_MutexUnlock(InUseLock); + } + LWP_MutexUnlock(ListLock); +} + + +/** + * Constructor for the GuiImageAsync class. + */ +GuiImageData *StdImageLoaderCallback(void *arg) +{ + return new GuiImageData((char*)arg, NULL); +} + +GuiImageAsync::GuiImageAsync(const char *Filename, GuiImageData * PreloadImg) : + GuiImage(PreloadImg), + loadet_imgdata(NULL), + callback(StdImageLoaderCallback), + arg(strdup(Filename)) +{ + GuiImageAsyncThreadInit(); + GuiImageAsyncThread_AddImage(this); +} +GuiImageAsync::GuiImageAsync(ImageLoaderCallback Callback, void *Arg, int ArgLen, GuiImageData * PreloadImg) : + GuiImage(PreloadImg), + loadet_imgdata(NULL), + callback(Callback), + arg(memdup(Arg, ArgLen)) +{ +DEBUG("Constructor %p", this); + GuiImageAsyncThreadInit(); + GuiImageAsyncThread_AddImage(this); +} +GuiImageAsync::~GuiImageAsync() +{ + GuiImageAsyncThread_RemoveImage(this); + GuiImageAsyncThreadExit(); +DEBUG("Deconstructor %p (loadet_imgdata=%p)", this, loadet_imgdata); + if(loadet_imgdata) delete loadet_imgdata; + if(arg) free(arg); +} + diff --git a/source/libwiigui/gui_image_async.h b/source/libwiigui/gui_image_async.h new file mode 100644 index 00000000..9c746b84 --- /dev/null +++ b/source/libwiigui/gui_image_async.h @@ -0,0 +1,27 @@ +#ifndef _GUIIMAGEASYNC_H_ +#define _GUIIMAGEASYNC_H_ + +#// arg is a pointer created with malloc() +// when the image is destroied then will also the arg deleted with free() +typedef GuiImageData * (*ImageLoaderCallback)(void *arg); + +class GuiImageAsync : public GuiImage +{ +public: + GuiImageAsync(const char *Filename, GuiImageData * PreloadImg); + GuiImageAsync(ImageLoaderCallback Callback, void *arg, int arglen, GuiImageData * PreloadImg); + ~GuiImageAsync(); + +private: + GuiImageData *loadet_imgdata; +friend void loader(GuiImageAsync *InUse); + +friend void Setter(GuiImageAsync *InUse); + friend void *GuiImageAsyncThread(void *arg); + ImageLoaderCallback callback; + void *arg; +}; + + + +#endif /*_GUIIMAGEASYNC_H_*/ diff --git a/source/libwiigui/gui_imagedata.cpp b/source/libwiigui/gui_imagedata.cpp index 6cc53b88..85ff180a 100644 --- a/source/libwiigui/gui_imagedata.cpp +++ b/source/libwiigui/gui_imagedata.cpp @@ -179,3 +179,23 @@ int GuiImageData::GetHeight() { return height; } +void GuiImageData::SetGrayscale(void) +{ + GXColor color; + u32 offset, gray; + + for(int x = 0; x < width; x++) { + for(int y = 0; y < height; y++) { + offset = (((y >> 2)<<4)*width) + ((x >> 2)<<6) + (((y%4 << 2) + x%4 ) << 1); + color.r = *(data+offset+1); + color.g = *(data+offset+32); + color.b = *(data+offset+33); + + gray = (77*color.r + 150*color.g + 28*color.b)/255; + + *(data+offset+1) = gray; + *(data+offset+32) = gray; + *(data+offset+33) = gray; + } + } +} diff --git a/source/libwiigui/gui_searchbar.cpp b/source/libwiigui/gui_searchbar.cpp new file mode 100644 index 00000000..70d89841 --- /dev/null +++ b/source/libwiigui/gui_searchbar.cpp @@ -0,0 +1,172 @@ +#include "gui.h" +#include "gui_searchbar.h" + +#include "../wpad.h" +#include "../main.h" +#include "../settings/cfg.h" +#include "../usbloader/getentries.h" + +extern GuiWindow * mainWindow; + +class cSearchButton +{ +public: + cSearchButton(wchar_t *Char, GuiImageData *keyImageData, GuiImageData *keyOverImageData, int x, int y, GuiTrigger* trig, GuiSound* sndOver, GuiSound* sndClick) + : + wchar(*Char), + image(keyImageData), + imageOver(keyOverImageData), + text(NULL, 20, (GXColor){0, 0, 0, 0xff}), + button(&image, &imageOver, ALIGN_LEFT, ALIGN_TOP, x, y, trig, sndOver, sndClick, 1) + { + text.SetText(Char); + button.SetLabel(&text); + } + wchar_t wchar; + GuiImage image; + GuiImage imageOver; + GuiText text; + GuiButton button; +private: + +}; + + +GuiSearchBar::GuiSearchBar(const wchar_t *SearchChars) +: +inSide(0), +text(NULL, 22, (GXColor) {0, 0, 0, 255}), +buttons(0), +keyImageData(keyboard_key_png), +keyOverImageData(keyboard_key_over_png), +sndOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, Settings.sfxvolume), +sndClick(button_click_pcm, button_click_pcm_size, SOUND_PCM, Settings.sfxvolume) +{ + char imgPath[100]; + trig.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); + SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); + + cnt = wcslen(SearchChars); + buttons = new cSearchButton*[cnt]; + + wchar_t charstr[2] = {0, 0}; + int lines = (cnt+9)/10; + int buttonsPerLine = (cnt+lines-1)/lines; + width = 10+buttonsPerLine*42+10; + int x_start=10, x=0, y_start=10+42, y=0; + if(width < 200) { x_start += (200-width)>>1; width=200; } + for(int i=0; i= buttonsPerLine) x=0; + if(x == 0) y++; + charstr[0] = SearchChars[i]; + buttons[i] = new cSearchButton(charstr, &keyImageData, &keyOverImageData, x_start+x*42, y_start-42+y*42, &trig, &sndOver, &sndClick); + this->Append(&(buttons[i]->button)); + } + height = 10+42+y*42+10; + + + text.SetText(gameFilter); + text.SetPosition(10, 15); + text.SetAlignment(ALIGN_LEFT, ALIGN_TOP); + text.SetWidescreen(CFG.widescreen); + text.SetMaxWidth(width-(10+2*42+10), GuiText::SCROLL); + this->Append(&text); + + snprintf(imgPath, sizeof(imgPath), "%skeyboard_backspace_over.png", CFG.theme_path); + imgBacspaceBtn = new GuiImageData(imgPath, keyboard_backspace_over_png); + BacspaceBtnImg_Over = new GuiImage(imgBacspaceBtn); + BacspaceBtnImg = new GuiImage(BacspaceBtnImg_Over); BacspaceBtnImg->SetGrayscale(); + BacspaceBtn = new GuiButton(BacspaceBtnImg,BacspaceBtnImg_Over, ALIGN_RIGHT, ALIGN_TOP, -52, 10, &trig, &sndOver, &sndClick,1); + this->Append(BacspaceBtn); + + snprintf(imgPath, sizeof(imgPath), "%skeyboard_clear_over.png", CFG.theme_path); + imgClearBtn = new GuiImageData(imgPath, keyboard_clear_over_png); + ClearBtnImg_Over = new GuiImage(imgClearBtn); + ClearBtnImg = new GuiImage(ClearBtnImg_Over); ClearBtnImg->SetGrayscale(); + ClearBtn = new GuiButton(ClearBtnImg,ClearBtnImg_Over, ALIGN_RIGHT, ALIGN_TOP, -10, 10, &trig, &sndOver, &sndClick,1); + this->Append(ClearBtn); + + +// SetPosition(100,100); + +} +GuiSearchBar::~GuiSearchBar() +{ + if(buttons) + { + for(int i=0; iGetLeft(),this->GetTop(),width, height,(GXColor){0, 0, 0, 0xa0},1); + Menu_DrawRectangle(this->GetLeft()+10,this->GetTop()+15,width-(10+2*42+10), 22,(GXColor){255, 255, 255, 255},1); + GuiWindow::Draw(); +} +void GuiSearchBar::Update(GuiTrigger * t) +{ + LOCK(this); + if(_elements.size() == 0 || (state == STATE_DISABLED && parentElement)) + return; + #ifdef HW_RVL + // cursor + if(t->wpad.ir.valid && state != STATE_DISABLED) + { + if(this->IsInside(t->wpad.ir.x, t->wpad.ir.y)) + { + if(inSide == 0) + { + mainWindow->SetState(STATE_DISABLED); + this->SetState(STATE_DEFAULT); + } + inSide |= 1 << t->chan; + } + else if(inSide) + { + inSide &= ~(1 << t->chan); + if(inSide == 0) + mainWindow->SetState(STATE_DEFAULT); + } + } + #endif + GuiWindow::Update(t); +} +wchar_t GuiSearchBar::GetClicked() +{ + if(buttons) + { + for(int i=0; ibutton.GetState() == STATE_CLICKED) + { + buttons[i]->button.ResetState(); + return buttons[i]->wchar; + } + } + } + if(BacspaceBtn->GetState() == STATE_CLICKED) + return 8; + if(ClearBtn->GetState() == STATE_CLICKED) + return 7; + + return 0; +} + +/* +private: + SearchButtons *buttons; +}*/ + + diff --git a/source/libwiigui/gui_searchbar.h b/source/libwiigui/gui_searchbar.h new file mode 100644 index 00000000..920a05c2 --- /dev/null +++ b/source/libwiigui/gui_searchbar.h @@ -0,0 +1,38 @@ +#include "gui.h" + + +class cSearchButton; + + +class GuiSearchBar : public GuiWindow +{ +public: + GuiSearchBar(const wchar_t *SearchChars); + ~GuiSearchBar(); + void Draw(); + void Update(GuiTrigger * t); + wchar_t GetClicked(); +private: + u16 inSide; + + GuiText text; + + GuiImageData* imgBacspaceBtn; + GuiImage* BacspaceBtnImg; + GuiImage* BacspaceBtnImg_Over; + GuiButton* BacspaceBtn; + + GuiImageData* imgClearBtn; + GuiImage* ClearBtnImg; + GuiImage* ClearBtnImg_Over; + GuiButton* ClearBtn; + + cSearchButton **buttons; + int cnt; + GuiImageData keyImageData; + GuiImageData keyOverImageData; + GuiTrigger trig; + GuiSound sndOver; + GuiSound sndClick; + +}; diff --git a/source/libwiigui/gui_text.cpp b/source/libwiigui/gui_text.cpp index a58525a8..3eaf0cc1 100644 --- a/source/libwiigui/gui_text.cpp +++ b/source/libwiigui/gui_text.cpp @@ -149,6 +149,23 @@ void GuiText::SetTextf(const char *format, ...) } va_end(va); } +void GuiText::SetText(const wchar_t * t) +{ + LOCK(this); + if(text) + delete [] text; + text = NULL; + + if(t) + { + int len = wcslen(t); + text = new wchar_t[len+1]; + if(text) wcscpy(text, t); + } + scrollPos2 = 0; + scrollDelay = 0; +} + void GuiText::SetPresets(int sz, GXColor c, int w, int wrap, u16 s, int h, int v) { diff --git a/source/libwiigui/gui_tooltip.cpp b/source/libwiigui/gui_tooltip.cpp index 7fe37df6..f232eb82 100644 --- a/source/libwiigui/gui_tooltip.cpp +++ b/source/libwiigui/gui_tooltip.cpp @@ -18,7 +18,7 @@ static GuiImageData tooltipRight(tooltip_right_png); /** * Constructor for the GuiTooltip class. */ -GuiTooltip::GuiTooltip(const char *t) +GuiTooltip::GuiTooltip(const char *t, int Alpha/*=255*/) : leftImage(&tooltipLeft), tileImage(&tooltipTile), rightImage(&tooltipRight) { @@ -31,6 +31,7 @@ leftImage(&tooltipLeft), tileImage(&tooltipTile), rightImage(&tooltipRight) tileImage.SetParentAngle(false); rightImage.SetParentAngle(false); SetText(t); + SetAlpha(Alpha); } /* diff --git a/source/menu.cpp b/source/menu.cpp index 177c04c8..6a0c41a1 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -16,7 +16,9 @@ #include "libwiigui/gui_gamegrid.h" #include "libwiigui/gui_gamecarousel.h" #include "libwiigui/gui_gamebrowser.h" +#include "libwiigui/gui_searchbar.h" #include "libwiigui/gui_customoptionbrowser.h" +#include "libwiigui/gui_image_async.h" #include "usbloader/usbstorage.h" #include "usbloader/wbfs.h" #include "usbloader/disc.h" @@ -44,7 +46,6 @@ #include "wpad.h" #include "listfiles.h" #include "fatmounter.h" -#include "buffer.h" #include "xml/xml.h" #include "wad/title.h" @@ -80,8 +81,6 @@ extern FreeTypeGX *fontClock; extern u8 shutdown; extern u8 reset; extern int cntMissFiles; -extern struct discHdr * gameList; -extern u32 gameCnt; extern s32 gameSelected, gameStart; extern const u8 data1; extern u8 boothomebrew; @@ -129,7 +128,7 @@ static void * UpdateGUI (void *arg) { } else { if (!ExitRequested) { mainWindow->Draw(); - if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0 && mainWindow->GetState() != STATE_DISABLED) + if (Settings.tooltips == TooltipsOn && THEME.show_tooltip != 0 && mainWindow->GetState() != STATE_DISABLED) mainWindow->DrawTooltip(); #ifdef HW_RVL @@ -197,7 +196,6 @@ static void * UpdateGUI (void *arg) { void InitGUIThreads() { LWP_CreateThread(&guithread, UpdateGUI, NULL, NULL, 0, 75); InitProgressThread(); - InitBufferThread(); InitNetworkThread(); if (Settings.autonetwork) @@ -247,9 +245,75 @@ void rockout(int f = 0) { ResumeGui(); } +/**************************************************************************** + * LoadCoverImage + ***************************************************************************/ +GuiImageData *LoadCoverImage(struct discHdr *header, bool Prefere3D, bool noCover) +{ + if(!header) return NULL; + GuiImageData *Cover = NULL; + char ID[4]; + char IDfull[7]; + char Path[100]; + bool flag = Prefere3D; + + + snprintf(ID, sizeof(ID), "%c%c%c", header->id[0], header->id[1], header->id[2]); + snprintf(IDfull, sizeof(IDfull), "%s%c%c%c", ID, header->id[3], header->id[4], header->id[5]); + + for(int i=0; i<2; ++i) + { + char *coverPath = flag ? Settings.covers_path : Settings.covers2d_path; flag = !flag; + //Load full id image + snprintf(Path, sizeof(Path), "%s%s.png", coverPath, IDfull); + delete Cover; Cover = new(std::nothrow) GuiImageData(Path, NULL); + //Load short id image + if (!Cover || !Cover->GetImage()) + { + snprintf(Path, sizeof(Path), "%s%s.png", coverPath, ID); + delete Cover; Cover = new(std::nothrow) GuiImageData(Path, NULL); + } + if(Cover && Cover->GetImage()) + break; + } + //Load no image + if (noCover && (!Cover || !Cover->GetImage())) + { + flag = Prefere3D; + for(int i=0; i<2; ++i) + { + const char *nocoverPath = (flag ? "%snoimage.png" : "%snoimage2d.png"); flag = !flag; + snprintf(Path, sizeof(Path), nocoverPath, CFG.theme_path); + delete Cover; Cover = new(std::nothrow) GuiImageData(Path, (Prefere3D ? nocover_png : nocoverFlat_png)); + if (Cover && Cover->GetImage()) + break; + } + } + if(Cover && !Cover->GetImage()) + { + delete Cover; + Cover = NULL; + } + return Cover; +} /**************************************************************************** * MenuDiscList ***************************************************************************/ +GuiButton *Toolbar[7]; +void DiscListWinUpdateCallback(void * e) +{ + GuiWindow *w = (GuiWindow *)e; + for(int i=0; i<7; ++i) + { + if(Toolbar[i]->GetState() == STATE_SELECTED) + { + w->Remove(Toolbar[i]); + w->Append(Toolbar[i]); // draw the selected Icon allways on top + break; + } + } +} + int MenuDiscList() { @@ -268,7 +332,7 @@ int MenuDiscList() { WDVD_GetCoverStatus(&covert); u32 covertOld=covert; - + wchar_t searchChar; //SCREENSAVER //WPad_SetIdleTime(300); //needs the time in seconds int check = 0; //to skip the first cycle when wiimote isn't completely connected @@ -334,28 +398,36 @@ int MenuDiscList() { snprintf(imgPath, sizeof(imgPath), "%sfavIcon.png", CFG.theme_path); GuiImageData imgfavIcon(imgPath, favIcon_png); - snprintf(imgPath, sizeof(imgPath), "%sfavIcon_gray.png", CFG.theme_path); - GuiImageData imgfavIcon_gray(imgPath, favIcon_gray_png); +// snprintf(imgPath, sizeof(imgPath), "%sfavIcon_gray.png", CFG.theme_path); +// GuiImageData imgfavIcon_gray(imgPath, favIcon_gray_png); + snprintf(imgPath, sizeof(imgPath), "%ssearchIcon.png", CFG.theme_path); + GuiImageData imgsearchIcon(imgPath, searchIcon_png); +// snprintf(imgPath, sizeof(imgPath), "%ssearchIcon_gray.png", CFG.theme_path); +// GuiImageData imgsearchIcon_gray(imgPath, searchIcon_gray_png); snprintf(imgPath, sizeof(imgPath), "%sabcIcon.png", CFG.theme_path); GuiImageData imgabcIcon(imgPath, abcIcon_png); - snprintf(imgPath, sizeof(imgPath), "%sabcIcon_gray.png", CFG.theme_path); - GuiImageData imgabcIcon_gray(imgPath, abcIcon_gray_png); +// snprintf(imgPath, sizeof(imgPath), "%sabcIcon_gray.png", CFG.theme_path); +// GuiImageData imgabcIcon_gray(imgPath, abcIcon_gray_png); snprintf(imgPath, sizeof(imgPath), "%splayCountIcon.png", CFG.theme_path); GuiImageData imgplayCountIcon(imgPath, playCountIcon_png); - snprintf(imgPath, sizeof(imgPath), "%splayCountIcon_gray.png", CFG.theme_path); - GuiImageData imgplayCountIcon_gray(imgPath, playCountIcon_gray_png); +// snprintf(imgPath, sizeof(imgPath), "%splayCountIcon_gray.png", CFG.theme_path); +// GuiImageData imgplayCountIcon_gray(imgPath, playCountIcon_gray_png); snprintf(imgPath, sizeof(imgPath), "%sarrangeGrid.png", CFG.theme_path); GuiImageData imgarrangeGrid(imgPath, arrangeGrid_png); - snprintf(imgPath, sizeof(imgPath), "%sarrangeGrid_gray.png", CFG.theme_path); - GuiImageData imgarrangeGrid_gray(imgPath, arrangeGrid_gray_png); +// snprintf(imgPath, sizeof(imgPath), "%sarrangeGrid_gray.png", CFG.theme_path); +// GuiImageData imgarrangeGrid_gray(imgPath, arrangeGrid_gray_png); snprintf(imgPath, sizeof(imgPath), "%sarrangeList.png", CFG.theme_path); GuiImageData imgarrangeList(imgPath, arrangeList_png); - snprintf(imgPath, sizeof(imgPath), "%sarrangeList_gray.png", CFG.theme_path); - GuiImageData imgarrangeList_gray(imgPath, arrangeList_gray_png); +// snprintf(imgPath, sizeof(imgPath), "%sarrangeList_gray.png", CFG.theme_path); +// GuiImageData imgarrangeList_gray(imgPath, arrangeList_gray_png); snprintf(imgPath, sizeof(imgPath), "%sarrangeCarousel.png", CFG.theme_path); GuiImageData imgarrangeCarousel(imgPath, arrangeCarousel_png); - snprintf(imgPath, sizeof(imgPath), "%sarrangeCarousel_gray.png", CFG.theme_path); - GuiImageData imgarrangeCarousel_gray(imgPath, arrangeCarousel_gray_png); +// snprintf(imgPath, sizeof(imgPath), "%sarrangeCarousel_gray.png", CFG.theme_path); +// GuiImageData imgarrangeCarousel_gray(imgPath, arrangeCarousel_gray_png); + + snprintf(imgPath, sizeof(imgPath), "%ssearchBar.png", CFG.theme_path); + GuiImageData imgsearchBar(imgPath, searchBar_png); + snprintf(imgPath, sizeof(imgPath), "%sbrowser.png", CFG.theme_path); GuiImageData homebrewImgData(imgPath, browser_png); snprintf(imgPath, sizeof(imgPath), "%sbrowser_over.png", CFG.theme_path); @@ -374,17 +446,17 @@ int MenuDiscList() { char spaceinfo[30]; sprintf(spaceinfo,"%.2fGB %s %.2fGB %s",freespace,tr("of"),(freespace+used),tr("free")); - GuiText usedSpaceTxt(spaceinfo, 18, (GXColor) {THEME.info_r, THEME.info_g, THEME.info_b, 255}); - usedSpaceTxt.SetAlignment(THEME.hddInfoAlign, ALIGN_TOP); - usedSpaceTxt.SetPosition(THEME.hddInfo_x, THEME.hddInfo_y); + GuiText usedSpaceTxt(spaceinfo, 18, THEME.info); + usedSpaceTxt.SetAlignment(THEME.hddinfo_align, ALIGN_TOP); + usedSpaceTxt.SetPosition(THEME.hddinfo_x, THEME.hddinfo_y); char GamesCnt[15]; sprintf(GamesCnt,"%s: %i",tr("Games"), gameCnt); - GuiText gamecntTxt(GamesCnt, 18, (GXColor) {THEME.info_r, THEME.info_g, THEME.info_b, 255}); + GuiText gamecntTxt(GamesCnt, 18, THEME.info); GuiButton gamecntBtn(100,18); - gamecntBtn.SetAlignment(THEME.gameCntAlign, ALIGN_TOP); - gamecntBtn.SetPosition(THEME.gameCnt_x,THEME.gameCnt_y); + gamecntBtn.SetAlignment(THEME.gamecount_align, ALIGN_TOP); + gamecntBtn.SetPosition(THEME.gamecount_x,THEME.gamecount_y); gamecntBtn.SetLabel(&gamecntTxt); gamecntBtn.SetEffectGrow(); gamecntBtn.SetTrigger(&trigA); @@ -460,21 +532,35 @@ int MenuDiscList() { favoriteBtnTT.SetWidescreen(CFG.widescreen); favoriteBtnTT.SetAlpha(THEME.tooltipAlpha); GuiImage favoriteBtnImg(&imgfavIcon); - GuiImage favoriteBtnImg_g(&imgfavIcon_gray); favoriteBtnImg.SetWidescreen(CFG.widescreen); + GuiImage favoriteBtnImg_g(favoriteBtnImg);favoriteBtnImg_g.SetGrayscale(); +// GuiImage favoriteBtnImg_g(&imgfavIcon_gray); favoriteBtnImg_g.SetWidescreen(CFG.widescreen); - GuiButton favoriteBtn(&favoriteBtnImg_g,&favoriteBtnImg_g, 2, 3, THEME.favorite_x, THEME.favorite_y, &trigA, &btnSoundOver, &btnClick,1, &favoriteBtnTT, -15, 52, 0, 3); + GuiButton favoriteBtn(&favoriteBtnImg_g,&favoriteBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_favorite_x, THEME.gamelist_favorite_y, &trigA, &btnSoundOver, &btnClick,1, &favoriteBtnTT, -15, 52, 0, 3); favoriteBtn.SetAlpha(180); + GuiTooltip searchBtnTT(tr("Set Search-Filter")); + if (Settings.wsprompt == yes) + searchBtnTT.SetWidescreen(CFG.widescreen); + searchBtnTT.SetAlpha(THEME.tooltipAlpha); + GuiImage searchBtnImg(&imgsearchIcon); + searchBtnImg.SetWidescreen(CFG.widescreen); + GuiImage searchBtnImg_g(searchBtnImg); searchBtnImg_g.SetGrayscale(); +// GuiImage searchBtnImg_g(&imgsearchIcon_gray); + searchBtnImg_g.SetWidescreen(CFG.widescreen); + GuiButton searchBtn(&searchBtnImg_g,&searchBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_search_x, THEME.gamelist_search_y, &trigA, &btnSoundOver, &btnClick,1, &searchBtnTT, -15, 52, 0, 3); + searchBtn.SetAlpha(180); + GuiTooltip abcBtnTT(tr("Sort alphabetically")); if (Settings.wsprompt == yes) abcBtnTT.SetWidescreen(CFG.widescreen); abcBtnTT.SetAlpha(THEME.tooltipAlpha); GuiImage abcBtnImg(&imgabcIcon); abcBtnImg.SetWidescreen(CFG.widescreen); - GuiImage abcBtnImg_g(&imgabcIcon_gray); + GuiImage abcBtnImg_g(abcBtnImg); abcBtnImg_g.SetGrayscale(); +// GuiImage abcBtnImg_g(&imgabcIcon_gray); abcBtnImg_g.SetWidescreen(CFG.widescreen); - GuiButton abcBtn(&abcBtnImg_g,&abcBtnImg_g, 2, 3, THEME.abc_x, THEME.abc_y, &trigA, &btnSoundOver, &btnClick,1,&abcBtnTT, -15, 52, 0, 3); + GuiButton abcBtn(&abcBtnImg_g,&abcBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_abc_x, THEME.gamelist_abc_y, &trigA, &btnSoundOver, &btnClick,1,&abcBtnTT, -15, 52, 0, 3); abcBtn.SetAlpha(180); GuiTooltip countBtnTT(tr("Sort order by most played")); @@ -483,9 +569,10 @@ int MenuDiscList() { countBtnTT.SetAlpha(THEME.tooltipAlpha); GuiImage countBtnImg(&imgplayCountIcon); countBtnImg.SetWidescreen(CFG.widescreen); - GuiImage countBtnImg_g(&imgplayCountIcon_gray); + GuiImage countBtnImg_g(countBtnImg); countBtnImg_g.SetGrayscale(); +// GuiImage countBtnImg_g(&imgplayCountIcon_gray); countBtnImg_g.SetWidescreen(CFG.widescreen); - GuiButton countBtn(&countBtnImg_g,&countBtnImg_g, 2, 3, THEME.count_x, THEME.count_y, &trigA, &btnSoundOver, &btnClick,1, &countBtnTT, -15, 52, 0, 3); + GuiButton countBtn(&countBtnImg_g,&countBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_count_x, THEME.gamelist_count_y, &trigA, &btnSoundOver, &btnClick,1, &countBtnTT, -15, 52, 0, 3); countBtn.SetAlpha(180); GuiTooltip listBtnTT(tr("Display as a list")); @@ -494,9 +581,10 @@ int MenuDiscList() { listBtnTT.SetAlpha(THEME.tooltipAlpha); GuiImage listBtnImg(&imgarrangeList); listBtnImg.SetWidescreen(CFG.widescreen); - GuiImage listBtnImg_g(&imgarrangeList_gray); + GuiImage listBtnImg_g(listBtnImg); listBtnImg_g.SetGrayscale(); +// GuiImage listBtnImg_g(&imgarrangeList_gray); listBtnImg_g.SetWidescreen(CFG.widescreen); - GuiButton listBtn(&listBtnImg_g,&listBtnImg_g, 2, 3, THEME.list_x, THEME.list_y, &trigA, &btnSoundOver, &btnClick,1, &listBtnTT, 15, 52, 1, 3); + GuiButton listBtn(&listBtnImg_g,&listBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_list_x, THEME.gamelist_list_y, &trigA, &btnSoundOver, &btnClick,1, &listBtnTT, 15, 52, 1, 3); listBtn.SetAlpha(180); GuiTooltip gridBtnTT(tr("Display as a grid")); @@ -505,21 +593,23 @@ int MenuDiscList() { gridBtnTT.SetAlpha(THEME.tooltipAlpha); GuiImage gridBtnImg(&imgarrangeGrid); gridBtnImg.SetWidescreen(CFG.widescreen); - GuiImage gridBtnImg_g(&imgarrangeGrid_gray); + GuiImage gridBtnImg_g(gridBtnImg); gridBtnImg_g.SetGrayscale(); +// GuiImage gridBtnImg_g(&imgarrangeGrid_gray); gridBtnImg_g.SetWidescreen(CFG.widescreen); - GuiButton gridBtn(&gridBtnImg_g,&gridBtnImg_g, 2, 3, THEME.grid_x, THEME.grid_y, &trigA, &btnSoundOver, &btnClick,1, &gridBtnTT, 15, 52, 1, 3); + GuiButton gridBtn(&gridBtnImg_g,&gridBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_grid_x, THEME.gamelist_grid_y, &trigA, &btnSoundOver, &btnClick,1, &gridBtnTT, 15, 52, 1, 3); gridBtn.SetAlpha(180); - GuiTooltip carouselBtnTT(tr("Display as a carousel")); - if (Settings.wsprompt == yes) - carouselBtnTT.SetWidescreen(CFG.widescreen); - carouselBtnTT.SetAlpha(THEME.tooltipAlpha); - GuiImage carouselBtnImg(&imgarrangeCarousel); - carouselBtnImg.SetWidescreen(CFG.widescreen); - GuiImage carouselBtnImg_g(&imgarrangeCarousel_gray); - carouselBtnImg_g.SetWidescreen(CFG.widescreen); - GuiButton carouselBtn(&carouselBtnImg_g,&carouselBtnImg_g, 2, 3, THEME.carousel_x, THEME.carousel_y, &trigA, &btnSoundOver, &btnClick,1, &carouselBtnTT, 15, 52, 1, 3); - carouselBtn.SetAlpha(180); + GuiTooltip carouselBtnTT(tr("Display as a carousel")); + if (Settings.wsprompt == yes) + carouselBtnTT.SetWidescreen(CFG.widescreen); + carouselBtnTT.SetAlpha(THEME.tooltipAlpha); + GuiImage carouselBtnImg(&imgarrangeCarousel); + carouselBtnImg.SetWidescreen(CFG.widescreen); + GuiImage carouselBtnImg_g(carouselBtnImg); carouselBtnImg_g.SetGrayscale(); +// GuiImage carouselBtnImg_g(&imgarrangeCarousel_gray); + carouselBtnImg_g.SetWidescreen(CFG.widescreen); + GuiButton carouselBtn(&carouselBtnImg_g,&carouselBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_carousel_x, THEME.gamelist_carousel_y, &trigA, &btnSoundOver, &btnClick,1, &carouselBtnTT, 15, 52, 1, 3); + carouselBtn.SetAlpha(180); GuiTooltip homebrewBtnTT(tr("Homebrew Launcher")); if (Settings.wsprompt == yes) @@ -529,13 +619,24 @@ int MenuDiscList() { GuiImage homebrewImgOver(&homebrewImgDataOver); homebrewImg.SetWidescreen(CFG.widescreen); homebrewImgOver.SetWidescreen(CFG.widescreen); - GuiButton homebrewBtn(&homebrewImg,&homebrewImgOver, 0, 3, THEME.homebrew_x, THEME.homebrew_y, &trigA, &btnSoundOver, &btnClick,1,&homebrewBtnTT,15,-30,1,5); + GuiButton homebrewBtn(&homebrewImg,&homebrewImgOver, ALIGN_LEFT, ALIGN_TOP, THEME.homebrew_x, THEME.homebrew_y, &trigA, &btnSoundOver, &btnClick,1,&homebrewBtnTT,15,-30,1,5); if (Settings.fave) { favoriteBtn.SetImage(&favoriteBtnImg); favoriteBtn.SetImageOver(&favoriteBtnImg); favoriteBtn.SetAlpha(255); } + static bool show_searchwindow = false; + if(gameFilter && *gameFilter) + { + if(show_searchwindow && gameCnt==1) + show_searchwindow = false; + if(!show_searchwindow) + searchBtn.SetEffect(EFFECT_PULSE, 10, 105); + searchBtn.SetImage(&searchBtnImg); + searchBtn.SetImageOver(&searchBtnImg); + searchBtn.SetAlpha(255); + } if (Settings.sort==all) { abcBtn.SetImage(&abcBtnImg); abcBtn.SetImageOver(&abcBtnImg); @@ -559,38 +660,30 @@ int MenuDiscList() { carouselBtn.SetAlpha(255); } if (Settings.gameDisplay==list) { - if (CFG.widescreen) { - favoriteBtn.SetPosition(THEME.favorite_x, THEME.favorite_y); - abcBtn.SetPosition(THEME.abc_x, THEME.abc_y); - countBtn.SetPosition(THEME.count_x, THEME.count_y); - listBtn.SetPosition(THEME.list_x, THEME.list_y); - gridBtn.SetPosition(THEME.grid_x, THEME.grid_y); - carouselBtn.SetPosition(THEME.carousel_x, THEME.carousel_y); - } else { - favoriteBtn.SetPosition(THEME.favorite_x-20, THEME.favorite_y); - abcBtn.SetPosition(THEME.abc_x-12, THEME.abc_y); - countBtn.SetPosition(THEME.count_x-4, THEME.count_y); - listBtn.SetPosition(THEME.list_x+4, THEME.list_y); - gridBtn.SetPosition(THEME.grid_x+12, THEME.grid_y); - carouselBtn.SetPosition(THEME.carousel_x+20, THEME.carousel_y); - } - } else { - if (CFG.widescreen) { - favoriteBtn.SetPosition(THEME.favorite_x-THEME.sortBarOffset, THEME.favorite_y); - abcBtn.SetPosition(THEME.abc_x-THEME.sortBarOffset, THEME.abc_y); - countBtn.SetPosition(THEME.count_x-THEME.sortBarOffset, THEME.count_y); - listBtn.SetPosition(THEME.list_x-THEME.sortBarOffset, THEME.list_y); - gridBtn.SetPosition(THEME.grid_x-THEME.sortBarOffset, THEME.grid_y); - carouselBtn.SetPosition(THEME.carousel_x-THEME.sortBarOffset, THEME.carousel_y); - } else { - favoriteBtn.SetPosition(THEME.favorite_x-20-THEME.sortBarOffset, THEME.favorite_y); - abcBtn.SetPosition(THEME.abc_x-12-THEME.sortBarOffset, THEME.abc_y); - countBtn.SetPosition(THEME.count_x-4-THEME.sortBarOffset, THEME.count_y); - listBtn.SetPosition(THEME.list_x+4-THEME.sortBarOffset, THEME.list_y); - gridBtn.SetPosition(THEME.grid_x+12-THEME.sortBarOffset, THEME.grid_y); - carouselBtn.SetPosition(THEME.carousel_x+20-THEME.sortBarOffset, THEME.carousel_y); - } - } + favoriteBtn.SetPosition(THEME.gamelist_favorite_x, THEME.gamelist_favorite_y); + searchBtn.SetPosition(THEME.gamelist_search_x, THEME.gamelist_search_y); + abcBtn.SetPosition(THEME.gamelist_abc_x, THEME.gamelist_abc_y); + countBtn.SetPosition(THEME.gamelist_count_x, THEME.gamelist_count_y); + listBtn.SetPosition(THEME.gamelist_list_x, THEME.gamelist_list_y); + gridBtn.SetPosition(THEME.gamelist_grid_x, THEME.gamelist_grid_y); + carouselBtn.SetPosition(THEME.gamelist_carousel_x, THEME.gamelist_carousel_y); + } else if(Settings.gameDisplay==grid) { + favoriteBtn.SetPosition(THEME.gamegrid_favorite_x, THEME.gamegrid_favorite_y); + searchBtn.SetPosition(THEME.gamegrid_search_x, THEME.gamegrid_search_y); + abcBtn.SetPosition(THEME.gamegrid_abc_x, THEME.gamegrid_abc_y); + countBtn.SetPosition(THEME.gamegrid_count_x, THEME.gamegrid_count_y); + listBtn.SetPosition(THEME.gamegrid_list_x, THEME.gamegrid_list_y); + gridBtn.SetPosition(THEME.gamegrid_grid_x, THEME.gamegrid_grid_y); + carouselBtn.SetPosition(THEME.gamegrid_carousel_x, THEME.gamegrid_carousel_y); + } else if(Settings.gameDisplay==carousel) { + favoriteBtn.SetPosition(THEME.gamecarousel_favorite_x, THEME.gamecarousel_favorite_y); + searchBtn.SetPosition(THEME.gamecarousel_search_x, THEME.gamecarousel_favorite_y); + abcBtn.SetPosition(THEME.gamecarousel_abc_x, THEME.gamecarousel_abc_y); + countBtn.SetPosition(THEME.gamecarousel_count_x, THEME.gamecarousel_count_y); + listBtn.SetPosition(THEME.gamecarousel_list_x, THEME.gamecarousel_list_y); + gridBtn.SetPosition(THEME.gamecarousel_grid_x, THEME.gamecarousel_grid_y); + carouselBtn.SetPosition(THEME.gamecarousel_carousel_x, THEME.gamecarousel_carousel_y); + } //Downloading Covers @@ -600,7 +693,7 @@ int MenuDiscList() { DownloadBtnTT.SetAlpha(THEME.tooltipAlpha); GuiButton DownloadBtn(0,0); DownloadBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP); - DownloadBtn.SetPosition(THEME.cover_x,THEME.cover_y); + DownloadBtn.SetPosition(THEME.covers_x,THEME.covers_y); GuiTooltip IDBtnTT(tr("Click to change game ID")); if (Settings.wsprompt == yes) @@ -631,8 +724,8 @@ int MenuDiscList() { GuiGameGrid * gameGrid = NULL; GuiGameCarousel * gameCarousel = NULL; if (Settings.gameDisplay==list) { - gameBrowser = new GuiGameBrowser(THEME.selection_w, THEME.selection_h, gameList, gameCnt, CFG.theme_path, bg_options_png, startat, offset); - gameBrowser->SetPosition(THEME.selection_x, THEME.selection_y); + gameBrowser = new GuiGameBrowser(THEME.gamelist_w, THEME.gamelist_h, gameList, gameCnt, CFG.theme_path, bg_options_png, startat, offset); + gameBrowser->SetPosition(THEME.gamelist_x, THEME.gamelist_y); gameBrowser->SetAlignment(ALIGN_LEFT, ALIGN_CENTRE); } else if (Settings.gameDisplay==grid) { gameGrid = new GuiGameGrid(THEME.gamegrid_w,THEME.gamegrid_h, gameList, gameCnt, CFG.theme_path, bg_options_png, 0, 0); @@ -645,22 +738,22 @@ int MenuDiscList() { gameCarousel->SetAlignment(ALIGN_LEFT, ALIGN_CENTRE); } - GuiText clockTimeBack("88:88", 40, (GXColor) {THEME.clock_r, THEME.clock_g, THEME.clock_b, 40}); - clockTimeBack.SetAlignment(THEME.clockAlign, ALIGN_TOP); + GuiText clockTimeBack("88:88", 40, (GXColor) {THEME.clock.r, THEME.clock.g, THEME.clock.b, THEME.clock.a/6}); + clockTimeBack.SetAlignment(THEME.clock_align, ALIGN_TOP); clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y); clockTimeBack.SetFont(fontClock); - GuiText clockTime(theTime, 40, (GXColor) {THEME.clock_r, THEME.clock_g, THEME.clock_b, 240}); - clockTime.SetAlignment(THEME.clockAlign, ALIGN_TOP); + GuiText clockTime(theTime, 40, THEME.clock); + clockTime.SetAlignment(THEME.clock_align, ALIGN_TOP); clockTime.SetPosition(THEME.clock_x, THEME.clock_y); clockTime.SetFont(fontClock); HaltGui(); GuiWindow w(screenwidth, screenheight); - if (THEME.showHDD == -1 || THEME.showHDD == 1) { //force show hdd info + if (THEME.show_hddinfo == -1 || THEME.show_hddinfo == 1) { //force show hdd info w.Append(&usedSpaceTxt); } - if (THEME.showGameCnt == -1 || THEME.showGameCnt == 1) { //force show game cnt info + if (THEME.show_gamecount == -1 || THEME.show_gamecount == 1) { //force show game cnt info w.Append(&gamecntBtn); } w.Append(&sdcardBtn); @@ -672,13 +765,26 @@ int MenuDiscList() { w.Append(&settingsBtn); w.Append(&DownloadBtn); w.Append(&idBtn); + + // Begin Toolbar w.Append(&favoriteBtn); + Toolbar[0] = &favoriteBtn; + w.Append(&searchBtn); + Toolbar[1] = &searchBtn; w.Append(&abcBtn); + Toolbar[2] = &abcBtn; w.Append(&countBtn); + Toolbar[3] = &countBtn; w.Append(&listBtn); + Toolbar[4] = &listBtn; w.Append(&gridBtn); + Toolbar[5] = &gridBtn; w.Append(&carouselBtn); - if (Settings.godmode == 1) + Toolbar[6] = &carouselBtn; + w.SetUpdateCallback(DiscListWinUpdateCallback); + // End Toolbar + + if (Settings.godmode == 1) w.Append(&homebrewBtn); if ((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) { @@ -697,6 +803,13 @@ int MenuDiscList() { } mainWindow->Append(&w); + GuiSearchBar *searchBar=NULL; + if(show_searchwindow) { + searchBar = new GuiSearchBar(gameFilterNextList); + if(searchBar) + mainWindow->Append(searchBar); + } + ResumeGui(); while (menu == MENU_NONE) { @@ -973,6 +1086,62 @@ int MenuDiscList() { } + else if (searchBtn.GetState() == STATE_CLICKED) { + + show_searchwindow=!show_searchwindow; + HaltGui(); + if(searchBar) + { + mainWindow->Remove(searchBar); + delete searchBar; + searchBar = NULL; + } + if(show_searchwindow) + { + if(gameFilter && *gameFilter) + { + searchBtn.StopEffect(); + searchBtn.SetEffectGrow(); + } + searchBar = new GuiSearchBar(gameFilterNextList); + if(searchBar) + mainWindow->Append(searchBar); + } + else + { + if(gameFilter && *gameFilter) + searchBtn.SetEffect(EFFECT_PULSE, 10, 105); + } + searchBtn.ResetState(); + ResumeGui(); + } + + else if (searchBar && (searchChar=searchBar->GetClicked())) { + if(searchChar > 27) + { + int len = gameFilter ? wcslen(gameFilter) : 0; + wchar_t newFilter[len+2]; + if(gameFilter) + wcscpy(newFilter, gameFilter); + newFilter[len] = searchChar; + newFilter[len+1] = 0; + + + __Menu_GetEntries(0, newFilter); + } + else if(searchChar == 7) // Clear + { + __Menu_GetEntries(0, L""); + } + else if(searchChar == 8) // Backspace + { + __Menu_GetEntries(0, gameFilterPrev); + } + + menu = MENU_DISCLIST; + break; + } + else if (abcBtn.GetState() == STATE_CLICKED) { if (Settings.sort != all) { Settings.sort=all; @@ -1097,7 +1266,7 @@ int MenuDiscList() { selectedold = selectimg;//update displayed cover, game ID, and region if the selected game changes struct discHdr *header = &gameList[selectimg]; snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]); - snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]); + snprintf (IDfull,sizeof(IDfull),"%s%c%c%c", ID, header->id[3], header->id[4], header->id[5]); w.Remove(&DownloadBtn); if (GameIDTxt) { @@ -1144,18 +1313,7 @@ int MenuDiscList() { cover = NULL; } - snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, IDfull); - cover = new GuiImageData(imgPath,0); //load short id - if (!cover->GetImage()) { //if could not load the short id image - delete cover; - snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, ID); - cover = new GuiImageData(imgPath, 0); //load full id image - if (!cover->GetImage()) { - delete cover; - snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.theme_path); - cover = new GuiImageData(imgPath, nocover_png); //load no image - } - } + cover = LoadCoverImage(header); if (coverImg) { delete coverImg; @@ -1168,7 +1326,7 @@ int MenuDiscList() { w.Append(&DownloadBtn); if ((Settings.sinfo == GameID) || (Settings.sinfo == Both)) { - GameIDTxt = new GuiText(IDfull, 22, (GXColor) {THEME.info_r, THEME.info_g, THEME.info_b, 255}); + GameIDTxt = new GuiText(IDfull, 22, THEME.info); GameIDTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); //GameIDTxt->SetPosition(THEME.id_x,THEME.id_y); idBtn.SetEffect(EFFECT_FADE, 20); @@ -1177,7 +1335,7 @@ int MenuDiscList() { } if ((Settings.sinfo == GameRegion) || (Settings.sinfo == Both)) { - GameRegionTxt = new GuiText(gameregion, 22, (GXColor) {THEME.info_r, THEME.info_g, THEME.info_b, 255}); + GameRegionTxt = new GuiText(gameregion, 22, THEME.info); GameRegionTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); GameRegionTxt->SetPosition(THEME.region_x, THEME.region_y); GameRegionTxt->SetEffect(EFFECT_FADE, 20); @@ -1204,7 +1362,13 @@ int MenuDiscList() { } if ((gameSelected >= 0) && (gameSelected < (s32)gameCnt)) { - rockout(); + if(searchBar) + { + HaltGui(); + mainWindow->Remove(searchBar); + ResumeGui(); + } + rockout(); struct discHdr *header = &gameList[gameSelected]; WBFS_GameSize(header->id, &size); if (strlen(get_title(header)) < (MAX_CHARACTERS + 3)) { @@ -1387,6 +1551,12 @@ int MenuDiscList() { } + if(searchBar) + { + HaltGui(); + mainWindow->Append(searchBar); + ResumeGui(); + } } // to skip the first call of windowScreensaver at startup when wiimote is not connected if (IsWpadConnected()) { @@ -1439,6 +1609,8 @@ int MenuDiscList() { HaltGui(); mainWindow->RemoveAll(); mainWindow->Append(bgImg); + delete searchBar; + searchBar = NULL; delete gameBrowser; gameBrowser = NULL; delete gameGrid; diff --git a/source/menu.h b/source/menu.h index 0819c0bf..144bca0e 100644 --- a/source/menu.h +++ b/source/menu.h @@ -30,5 +30,7 @@ enum { MENU_HOMEBREWBROWSE, BOOTHOMEBREW }; +class GuiImageData; +GuiImageData *LoadCoverImage(struct discHdr *header, bool Prefere3D=true, bool noCover=true); #endif diff --git a/source/prompts/DiscBrowser.cpp b/source/prompts/DiscBrowser.cpp index f30473eb..a1c25858 100644 --- a/source/prompts/DiscBrowser.cpp +++ b/source/prompts/DiscBrowser.cpp @@ -163,7 +163,7 @@ int DiscBrowse(struct discHdr * header) { settingsbackgroundbtn.SetPosition(0, 0); settingsbackgroundbtn.SetImage(&settingsbackground); - GuiText cancelBtnTxt(tr("Back"), 22, (GXColor) { THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText cancelBtnTxt(tr("Back"), 22, THEME.prompttext); cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); GuiImage cancelBtnImg(&btnOutline); if (Settings.wsprompt == yes) { diff --git a/source/prompts/ProgressWindow.cpp b/source/prompts/ProgressWindow.cpp index 45821ddd..21774bd2 100644 --- a/source/prompts/ProgressWindow.cpp +++ b/source/prompts/ProgressWindow.cpp @@ -155,11 +155,11 @@ static void ProgressWindow(const char *title, const char *msg1, const char *msg2 progressbarImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); progressbarImg.SetPosition(25, 40); - GuiText titleTxt(title, 26, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText titleTxt(title, 26, THEME.prompttext); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0,60); - GuiText msg1Txt(msg1, 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255} ); + GuiText msg1Txt(msg1, 22, THEME.prompttext ); msg1Txt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); if (msg2) msg1Txt.SetPosition(0,120); @@ -167,28 +167,28 @@ static void ProgressWindow(const char *title, const char *msg1, const char *msg2 msg1Txt.SetPosition(0,100); msg1Txt.SetMaxWidth(430, GuiText::DOTTED); - GuiText msg2Txt(msg2, 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255} ); + GuiText msg2Txt(msg2, 22, THEME.prompttext ); msg2Txt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); msg2Txt.SetPosition(0,125); msg2Txt.SetMaxWidth(430, GuiText::DOTTED); - GuiText prsTxt("%", 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText prsTxt("%", 22, THEME.prompttext); prsTxt.SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE); prsTxt.SetPosition(-188,40); - GuiText timeTxt(NULL, 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText timeTxt(NULL, 22, THEME.prompttext); timeTxt.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); timeTxt.SetPosition(280,-50); - GuiText sizeTxt(NULL, 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText sizeTxt(NULL, 22, THEME.prompttext); sizeTxt.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); sizeTxt.SetPosition(50, -50); - GuiText speedTxt(NULL, 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText speedTxt(NULL, 22, THEME.prompttext); speedTxt.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); speedTxt.SetPosition(50, -74); - GuiText prTxt(NULL, 26, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText prTxt(NULL, 26, THEME.prompttext); prTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); prTxt.SetPosition(200, 40); diff --git a/source/prompts/PromptWindows.cpp b/source/prompts/PromptWindows.cpp index a583cefd..c2955fbc 100644 --- a/source/prompts/PromptWindows.cpp +++ b/source/prompts/PromptWindows.cpp @@ -85,7 +85,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, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText okBtnTxt(tr("OK"), 22, THEME.prompttext); GuiImage okBtnImg(&btnOutline); if (Settings.wsprompt == yes) { okBtnTxt.SetWidescreen(CFG.widescreen); @@ -93,7 +93,7 @@ int OnScreenKeyboard(char * var, u32 maxlen, int min) { } GuiButton okBtn(&okBtnImg,&okBtnImg, 0, 4, 5, 15, &trigA, &btnSoundOver, &btnClick,1); okBtn.SetLabel(&okBtnTxt); - GuiText cancelBtnTxt(tr("Cancel"), 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText cancelBtnTxt(tr("Cancel"), 22, THEME.prompttext); GuiImage cancelBtnImg(&btnOutline); if (Settings.wsprompt == yes) { cancelBtnTxt.SetWidescreen(CFG.widescreen); @@ -458,15 +458,15 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label, dialogBoxImg.SetWidescreen(CFG.widescreen); } - GuiText titleTxt(title, 26, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText titleTxt(title, 26, THEME.prompttext); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0,55); - GuiText msgTxt(msg, 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText msgTxt(msg, 22, THEME.prompttext); msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); msgTxt.SetPosition(0,-40); msgTxt.SetMaxWidth(430); - GuiText btn1Txt(btn1Label, 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText btn1Txt(btn1Label, 22, THEME.prompttext); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt == yes) { btn1Txt.SetWidescreen(CFG.widescreen); @@ -477,7 +477,7 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label, btn1.SetLabel(&btn1Txt); btn1.SetState(STATE_SELECTED); - GuiText btn2Txt(btn2Label, 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText btn2Txt(btn2Label, 22, THEME.prompttext); GuiImage btn2Img(&btnOutline); if (Settings.wsprompt == yes) { btn2Txt.SetWidescreen(CFG.widescreen); @@ -488,7 +488,7 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label, if (!btn3Label && !btn4Label) btn2.SetTrigger(&trigB); - GuiText btn3Txt(btn3Label, 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText btn3Txt(btn3Label, 22, THEME.prompttext); GuiImage btn3Img(&btnOutline); if (Settings.wsprompt == yes) { btn3Txt.SetWidescreen(CFG.widescreen); @@ -499,7 +499,7 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label, if (!btn4Label) btn3.SetTrigger(&trigB); - GuiText btn4Txt(btn4Label, 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText btn4Txt(btn4Label, 22, THEME.prompttext); GuiImage btn4Img(&btnOutline); if (Settings.wsprompt == yes) { btn4Txt.SetWidescreen(CFG.widescreen); @@ -1033,7 +1033,7 @@ int GameWindowPrompt() { GuiTooltip nameBtnTT(tr("Rename Game on WBFS")); if (Settings.wsprompt == yes) nameBtnTT.SetWidescreen(CFG.widescreen); - GuiText nameTxt("", 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText nameTxt("", 22, THEME.prompttext); if (Settings.wsprompt == yes) nameTxt.SetWidescreen(CFG.widescreen); nameTxt.SetMaxWidth(350, GuiText::SCROLL); @@ -1051,7 +1051,7 @@ int GameWindowPrompt() { nameBtn.SetEffectGrow(); } - GuiText sizeTxt(NULL, 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //TODO: get the size here + GuiText sizeTxt(NULL, 22, THEME.prompttext); //TODO: get the size here sizeTxt.SetAlignment(ALIGN_RIGHT, ALIGN_TOP); sizeTxt.SetPosition(-60,70); @@ -1067,7 +1067,7 @@ int GameWindowPrompt() { diskImg2.SetAngle(angle); diskImg2.SetBeta(180); - GuiText playcntTxt(NULL, 18, (GXColor) {THEME.info_r, THEME.info_g, THEME.info_b, 255}); + GuiText playcntTxt(NULL, 18, THEME.info); playcntTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); playcntTxt.SetPosition(-115,45); @@ -1081,7 +1081,7 @@ int GameWindowPrompt() { btn1.SetTrigger(&trigA); btn1.SetState(STATE_SELECTED); - GuiText btn2Txt(tr("Back"), 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText btn2Txt(tr("Back"), 22, THEME.prompttext); GuiImage btn2Img(&btnOutline); if (Settings.wsprompt == yes) { btn2Txt.SetWidescreen(CFG.widescreen); @@ -1099,7 +1099,7 @@ int GameWindowPrompt() { btn2.SetLabel(&btn2Txt); btn2.SetTrigger(&trigB); - GuiText btn3Txt(tr("Settings"), 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText btn3Txt(tr("Settings"), 22, THEME.prompttext); GuiImage btn3Img(&btnOutline); if (Settings.wsprompt == yes) { btn3Txt.SetWidescreen(CFG.widescreen); @@ -1181,6 +1181,8 @@ int GameWindowPrompt() { if (diskCover) delete diskCover; + + snprintf(imgPath,sizeof(imgPath),"%s%s.png", Settings.disc_path, IDFull); //changed to current full id diskCover = new GuiImageData(imgPath,0); @@ -1484,15 +1486,15 @@ DiscWait(const char *title, const char *msg, const char *btn1Label, const char * dialogBoxImg.SetWidescreen(CFG.widescreen); } - GuiText titleTxt(title, 26, (GXColor) { THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText titleTxt(title, 26, THEME.prompttext); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0,60); - GuiText msgTxt(msg, 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText msgTxt(msg, 22, THEME.prompttext); msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); msgTxt.SetPosition(0,-40); msgTxt.SetMaxWidth(430); - GuiText btn1Txt(btn1Label, 22, (GXColor) { THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText btn1Txt(btn1Label, 22, THEME.prompttext); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt == yes) { btn1Txt.SetWidescreen(CFG.widescreen); @@ -1512,7 +1514,7 @@ DiscWait(const char *title, const char *msg, const char *btn1Label, const char * btn1.SetTrigger(&trigB); btn1.SetState(STATE_SELECTED); - GuiText btn2Txt(btn2Label, 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText btn2Txt(btn2Label, 22, THEME.prompttext); GuiImage btn2Img(&btnOutline); if (Settings.wsprompt == yes) { btn2Txt.SetWidescreen(CFG.widescreen); @@ -1533,7 +1535,7 @@ DiscWait(const char *title, const char *msg, const char *btn1Label, const char * } } - GuiText timerTxt(NULL, 26, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText timerTxt(NULL, 26, THEME.prompttext); timerTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); timerTxt.SetPosition(0,160); @@ -1621,7 +1623,7 @@ FormatingPartition(const char *title, partitionEntry *entry) { dialogBoxImg.SetWidescreen(CFG.widescreen); } - GuiText titleTxt(title, 26, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText titleTxt(title, 26, THEME.prompttext); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0,60); @@ -1676,12 +1678,12 @@ bool SearchMissingImages(int choice2) { dialogBoxImg.SetWidescreen(CFG.widescreen); } - GuiText titleTxt(tr("Checking existing artwork"), 26, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText titleTxt(tr("Checking existing artwork"), 26, THEME.prompttext); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0,60); char msg[20] = " "; - GuiText msgTxt(msg, 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText msgTxt(msg, 22, THEME.prompttext); msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); msgTxt.SetPosition(0,-40); @@ -1710,16 +1712,18 @@ bool SearchMissingImages(int choice2) { for (i = 0; i < gameCnt && cntMissFiles < 500; i++) { struct discHdr* header = &gameList[i]; if (choice2 != 3) { + + char *covers_path = choice2==1 ? Settings.covers2d_path : Settings.covers_path; snprintf (filename,sizeof(filename),"%c%c%c.png", header->id[0], header->id[1], header->id[2]); - found2 = findfile(filename, Settings.covers_path); + found2 = findfile(filename, covers_path); snprintf (filename,sizeof(filename),"%c%c%c%c.png", header->id[0], header->id[1], header->id[2], header->id[3]); - found3 = findfile(filename, Settings.covers_path); + found3 = findfile(filename, covers_path); snprintf(filename,sizeof(filename),"%c%c%c%c%c%c.png",header->id[0], header->id[1], header->id[2], header->id[3], header->id[4], header->id[5]); //full id - found1 = findfile(filename, Settings.covers_path); + found1 = findfile(filename, covers_path); if (!found1 && !found2 && !found3) { //if could not find any image snprintf(missingFiles[cntMissFiles],11,"%s",filename); cntMissFiles++; @@ -1787,16 +1791,16 @@ bool NetworkInitPrompt() { dialogBoxImg.SetWidescreen(CFG.widescreen); } - GuiText titleTxt(tr("Initializing Network"), 26, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText titleTxt(tr("Initializing Network"), 26, THEME.prompttext); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0,60); char msg[20] = " "; - GuiText msgTxt(msg, 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText msgTxt(msg, 22, THEME.prompttext); msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); msgTxt.SetPosition(0,-40); - GuiText btn1Txt(tr("Cancel"), 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText btn1Txt(tr("Cancel"), 22, THEME.prompttext); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt == yes) { btn1Txt.SetWidescreen(CFG.widescreen); @@ -1908,23 +1912,23 @@ ProgressDownloadWindow(int choice2) { progressbarImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); progressbarImg.SetPosition(25, 40); - GuiText titleTxt(tr("Downloading file"), 26, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText titleTxt(tr("Downloading file"), 26, THEME.prompttext); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0,60); - GuiText msgTxt(NULL, 20, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText msgTxt(NULL, 20, THEME.prompttext); msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); msgTxt.SetPosition(0,130); - GuiText msg2Txt(NULL, 26, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText msg2Txt(NULL, 26, THEME.prompttext); msg2Txt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); msg2Txt.SetPosition(0,100); - GuiText prTxt(NULL, 26, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText prTxt(NULL, 26, THEME.prompttext); prTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); prTxt.SetPosition(0, 40); - GuiText btn1Txt(tr("Cancel"), 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText btn1Txt(tr("Cancel"), 22, THEME.prompttext); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt == yes) { btn1Txt.SetWidescreen(CFG.widescreen); @@ -1979,6 +1983,12 @@ ProgressDownloadWindow(int choice2) { cntMissFiles = 0; } } + if (stat(Settings.covers2d_path, &st) != 0) { + if (subfoldercreate(Settings.covers2d_path) != 1) { + WindowPrompt(tr("Error !"),tr("Can't create directory"),tr("OK")); + cntMissFiles = 0; + } + } if (stat(Settings.disc_path,&st) != 0) { if (subfoldercreate(Settings.disc_path) != 1) { WindowPrompt(tr("Error !"),tr("Can't create directory"),tr("OK")); @@ -2180,10 +2190,10 @@ ProgressDownloadWindow(int choice2) { //Creates URL depending from which Country the game is switch (missingFiles[i][3]) { case 'J': - sprintf(URLFile,"%sJA/%s",server3d,missingFiles[i]); + sprintf(URLFile,"%sJA/%s",server2d,missingFiles[i]); break; case 'W': - sprintf(URLFile,"%sZH/%s",server3d,missingFiles[i]); + sprintf(URLFile,"%sZH/%s",server2d,missingFiles[i]); break; case 'K': sprintf(URLFile,"%sKO/%s",server2d,missingFiles[i]); @@ -2205,7 +2215,7 @@ ProgressDownloadWindow(int choice2) { break; } - sprintf(imgPath,"%s%s", Settings.covers_path, missingFiles[i]); + sprintf(imgPath,"%s%s", Settings.covers2d_path, missingFiles[i]); file = downloadfile(URLFile); if (!(file.size == 36864 || file.size <= 1024 || file.size == 7386 || file.size <= 1174 || file.size == 4446 || file.data == NULL)) { @@ -2248,7 +2258,7 @@ ProgressDownloadWindow(int choice2) { } /**Temporary redownloading 1st image because of a fucking corruption bug **/ - +#if 0 // is no longer necessary, since libfat is fixed char URLFile[100]; struct block file = downloadfile(URLFile); if (choice2 == 2) { @@ -2273,7 +2283,7 @@ ProgressDownloadWindow(int choice2) { if (choice2 == 1) { while (triesRemove(&promptWindow); mainWindow->SetState(STATE_DEFAULT); @@ -2385,24 +2395,24 @@ int ProgressUpdateWindow() { char title[50]; sprintf(title, "%s", tr("Checking for Updates")); - GuiText titleTxt(title, 26, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText titleTxt(title, 26, THEME.prompttext); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0,50); char msg[50]; sprintf(msg, "%s", tr("Initializing Network")); - GuiText msgTxt(msg, 26, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText msgTxt(msg, 26, THEME.prompttext); msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); msgTxt.SetPosition(0,140); char msg2[50] = " "; - GuiText msg2Txt(msg2, 26, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText msg2Txt(msg2, 26, THEME.prompttext); msg2Txt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); msg2Txt.SetPosition(0, 50); - GuiText prTxt(NULL, 26, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText prTxt(NULL, 26, THEME.prompttext); prTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); prTxt.SetPosition(0, 7); - GuiText btn1Txt(tr("Cancel"), 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText btn1Txt(tr("Cancel"), 22, THEME.prompttext); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt == yes) { btn1Txt.SetWidescreen(CFG.widescreen); @@ -2720,24 +2730,24 @@ int ProgressUpdateWindow() { char title[50]; sprintf(title, "%s", tr("Checking for Updates")); - GuiText titleTxt(title, 26, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText titleTxt(title, 26, THEME.prompttext); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0,50); char msg[50]; sprintf(msg, "%s", tr("Initializing Network")); - GuiText msgTxt(msg, 26, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText msgTxt(msg, 26, THEME.prompttext); msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); msgTxt.SetPosition(0,140); char msg2[50] = " "; - GuiText msg2Txt(msg2, 26, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText msg2Txt(msg2, 26, THEME.prompttext); msg2Txt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); msg2Txt.SetPosition(0, 50); - GuiText prTxt(NULL, 26, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText prTxt(NULL, 26, THEME.prompttext); prTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); prTxt.SetPosition(0, 7); - GuiText btn1Txt(tr("Cancel"), 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText btn1Txt(tr("Cancel"), 22, THEME.prompttext); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt == yes) { btn1Txt.SetWidescreen(CFG.widescreen); @@ -3013,20 +3023,20 @@ int CodeDownload(const char *id) { char title[50]; sprintf(title, "%s", tr("Code Download")); - GuiText titleTxt(title, 26, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText titleTxt(title, 26, THEME.prompttext); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0,50); char msg[50]; sprintf(msg, "%s", tr("Initializing Network")); - GuiText msgTxt(msg, 26, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText msgTxt(msg, 26, THEME.prompttext); msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); msgTxt.SetPosition(0,140); char msg2[50] = " "; - GuiText msg2Txt(msg2, 26, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText msg2Txt(msg2, 26, THEME.prompttext); msg2Txt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); msg2Txt.SetPosition(0, 50); - GuiText btn1Txt(tr("Cancel"), 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText btn1Txt(tr("Cancel"), 22, THEME.prompttext); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt == yes) { btn1Txt.SetWidescreen(CFG.widescreen); @@ -3238,7 +3248,7 @@ HBCWindowPrompt(const char *name, const char *coder, const char *version, char tmp[510]; - GuiText nameTxt(name,30 , (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText nameTxt(name,30 , THEME.prompttext); nameTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); nameTxt.SetPosition(0,-15); nameTxt.SetMaxWidth(430, GuiText::SCROLL); @@ -3246,27 +3256,27 @@ HBCWindowPrompt(const char *name, const char *coder, const char *version, if (strcmp(coder,"")) snprintf(tmp, sizeof(tmp), tr("Coded by: %s"),coder); - GuiText coderTxt(tmp, 16, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255} ); + GuiText coderTxt(tmp, 16, THEME.prompttext ); coderTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); coderTxt.SetPosition(180,30); coderTxt.SetMaxWidth(280); if (strcmp(version,"")) snprintf(tmp, sizeof(tmp), tr("Version: %s"),version); - GuiText versionTxt(tmp,16 , (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText versionTxt(tmp,16 , THEME.prompttext); versionTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); versionTxt.SetPosition(40,65); versionTxt.SetMaxWidth(430); //if (release_date) //snprintf(tmp, sizeof(tmp), tr("Released: %s"),release_date); - GuiText release_dateTxt(release_date,16 , (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText release_dateTxt(release_date,16 , THEME.prompttext); release_dateTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); release_dateTxt.SetPosition(40,85); release_dateTxt.SetMaxWidth(430); int pagesize = 6; - GuiText long_descriptionTxt(long_description, 20, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText long_descriptionTxt(long_description, 20, THEME.prompttext); long_descriptionTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); long_descriptionTxt.SetPosition(46,117); long_descriptionTxt.SetMaxWidth(360); @@ -3294,11 +3304,11 @@ HBCWindowPrompt(const char *name, const char *coder, const char *version, snprintf(filesizeCH, sizeof(filesizeCH), "%s MB",temp2); } - GuiText filesizeTxt(filesizeCH, 16, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText filesizeTxt(filesizeCH, 16, THEME.prompttext); filesizeTxt.SetAlignment(ALIGN_RIGHT, ALIGN_TOP); filesizeTxt.SetPosition(-40,12); - GuiText btn1Txt(tr("Load"), 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText btn1Txt(tr("Load"), 22, THEME.prompttext); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt == yes) { btn1Txt.SetWidescreen(CFG.widescreen); @@ -3309,7 +3319,7 @@ HBCWindowPrompt(const char *name, const char *coder, const char *version, btn1.SetLabel(&btn1Txt); btn1.SetState(STATE_SELECTED); - GuiText btn2Txt(tr("Back"), 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText btn2Txt(tr("Back"), 22, THEME.prompttext); GuiImage btn2Img(&btnOutline); if (Settings.wsprompt == yes) { btn2Txt.SetWidescreen(CFG.widescreen); diff --git a/source/prompts/TitleBrowser.cpp b/source/prompts/TitleBrowser.cpp index 4077a112..f593aa6a 100644 --- a/source/prompts/TitleBrowser.cpp +++ b/source/prompts/TitleBrowser.cpp @@ -247,7 +247,7 @@ int TitleBrowser(u32 type) { settingsbackgroundbtn.SetPosition(0, 0); settingsbackgroundbtn.SetImage(&settingsbackground); - GuiText cancelBtnTxt(tr("Back"), 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText cancelBtnTxt(tr("Back"), 22, THEME.prompttext); cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); GuiImage cancelBtnImg(&btnOutline); if (Settings.wsprompt == yes) { diff --git a/source/prompts/filebrowser.cpp b/source/prompts/filebrowser.cpp index a4db70e1..40f13286 100644 --- a/source/prompts/filebrowser.cpp +++ b/source/prompts/filebrowser.cpp @@ -319,7 +319,7 @@ main: usbBtn.SetTrigger(&trigA); usbBtn.SetEffectGrow(); - GuiText okBtnTxt(tr("Ok"), 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText okBtnTxt(tr("Ok"), 22, THEME.prompttext); GuiImage okBtnImg(&btnOutline); if (Settings.wsprompt == yes) { okBtnTxt.SetWidescreen(CFG.widescreen); diff --git a/source/settings/Settings.cpp b/source/settings/Settings.cpp index 56b23e31..a86c18ee 100644 --- a/source/settings/Settings.cpp +++ b/source/settings/Settings.cpp @@ -115,7 +115,7 @@ int MenuSettings() { GuiImage settingsbackground(&settingsbg); - GuiText backBtnTxt(tr("Back") , 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText backBtnTxt(tr("Back") , 22, THEME.prompttext); backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); GuiImage backBtnImg(&btnOutline); if (Settings.wsprompt == yes) { @@ -1172,16 +1172,17 @@ int MenuSettings() { titleTxt.SetText(tr("Custom Paths")); exit = false; for (int i = 0; i <= MAXOPTIONS; i++) options2.SetName(i, NULL); - if (Settings.godmode) - options2.SetName(0, "%s", tr("Cover Path")); - options2.SetName(1, "%s", tr("Discimage Path")); - options2.SetName(2, "%s", tr("ThemePath")); - options2.SetName(3, "%s", tr("XMLPath")); - options2.SetName(4, "%s", tr("Updatepath")); - options2.SetName(5, "%s", tr("Cheatcodes Path")); - options2.SetName(6, "%s", tr("TXTCheatcodes Path")); - options2.SetName(7, "%s", tr("Dol Path")); - options2.SetName(8, "%s", tr("Homebrew Apps Path")); +// if (Settings.godmode) + options2.SetName(0, "%s", tr("3D Cover Path")); + options2.SetName(1, "%s", tr("2D Cover Path")); + options2.SetName(2, "%s", tr("Discimage Path")); + options2.SetName(3, "%s", tr("ThemePath")); + options2.SetName(4, "%s", tr("XMLPath")); + options2.SetName(5, "%s", tr("Updatepath")); + options2.SetName(6, "%s", tr("Cheatcodes Path")); + options2.SetName(7, "%s", tr("TXTCheatcodes Path")); + options2.SetName(8, "%s", tr("Dol Path")); + options2.SetName(9, "%s", tr("Homebrew Apps Path")); for (int i = 0; i <= MAXOPTIONS; i++) options2.SetValue(i, NULL); w.Append(&optionBrowser2); optionBrowser2.SetClickable(true); @@ -1197,14 +1198,15 @@ int MenuSettings() { VIDEO_WaitVSync (); options2.SetValue(0, "%s", Settings.covers_path); - options2.SetValue(1, "%s", Settings.disc_path); - options2.SetValue(2, "%s", CFG.theme_path); - options2.SetValue(3, "%s", Settings.titlestxt_path); - options2.SetValue(4, "%s", Settings.update_path); - options2.SetValue(5, "%s", Settings.Cheatcodespath); - options2.SetValue(6, "%s", Settings.TxtCheatcodespath); - options2.SetValue(7, "%s", Settings.dolpath); - options2.SetValue(8, "%s", Settings.homebrewapps_path); + options2.SetValue(1, "%s", Settings.covers2d_path); + options2.SetValue(2, "%s", Settings.disc_path); + options2.SetValue(3, "%s", CFG.theme_path); + options2.SetValue(4, "%s", Settings.titlestxt_path); + options2.SetValue(5, "%s", Settings.update_path); + options2.SetValue(6, "%s", Settings.Cheatcodespath); + options2.SetValue(7, "%s", Settings.TxtCheatcodespath); + options2.SetValue(8, "%s", Settings.dolpath); + options2.SetValue(9, "%s", Settings.homebrewapps_path); if (backBtn.GetState() == STATE_CLICKED) { backBtn.ResetState(); @@ -1249,7 +1251,7 @@ int MenuSettings() { w.Remove(&backBtn); char entered[43] = ""; strncpy(entered, Settings.covers_path, sizeof(entered)); - titleTxt.SetText(tr("Cover Path")); + titleTxt.SetText(tr("3D Cover Path")); int result = BrowseDevice(entered); //int result = OnScreenKeyboard(entered,43,0); titleTxt.SetText(tr("Custom Paths")); @@ -1270,7 +1272,34 @@ int MenuSettings() { WindowPrompt(tr("Coverpath Change"),tr("Console should be unlocked to modify it."),tr("OK")); } break; - case 1: + case 1: + if ( Settings.godmode == 1) { + w.Remove(&optionBrowser2); + w.Remove(&backBtn); + char entered[43] = ""; + strncpy(entered, Settings.covers2d_path, sizeof(entered)); + titleTxt.SetText(tr("2D Cover Path")); + int result = BrowseDevice(entered); + //int result = OnScreenKeyboard(entered,43,0); + titleTxt.SetText(tr("Custom Paths")); + w.Append(&optionBrowser2); + w.Append(&backBtn); + if ( result == 1 ) { + int len = (strlen(entered)-1); + if (entered[len] !='/') + strncat (entered, "/", 1); + strncpy(Settings.covers2d_path, entered, sizeof(Settings.covers2d_path)); + WindowPrompt(tr("Coverpath Changed"),0,tr("OK")); +// if(!isSdInserted()) { + if (!isInserted(bootDevice)) { + WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to save."), tr("OK")); + } + } + } else { + WindowPrompt(tr("Coverpath Change"),tr("Console should be unlocked to modify it."),tr("OK")); + } + break; + case 2: if ( Settings.godmode == 1) { w.Remove(&optionBrowser2); w.Remove(&backBtn); @@ -1297,7 +1326,7 @@ int MenuSettings() { WindowPrompt(tr("Discpath change"),tr("Console should be unlocked to modify it."),tr("OK")); } break; - case 2: + case 3: if ( Settings.godmode == 1) { w.Remove(&optionBrowser2); w.Remove(&backBtn); @@ -1355,7 +1384,7 @@ int MenuSettings() { WindowPrompt(tr("Themepath change"),tr("Console should be unlocked to modify it."),tr("OK")); } break; - case 3: + case 4: if ( Settings.godmode == 1) { w.Remove(&optionBrowser2); w.Remove(&backBtn); @@ -1387,7 +1416,7 @@ int MenuSettings() { WindowPrompt(tr("XMLPath change"),tr("Console should be unlocked to modify it."),tr("OK")); } break; - case 4: + case 5: if ( Settings.godmode == 1) { w.Remove(&optionBrowser2); w.Remove(&backBtn); @@ -1409,7 +1438,7 @@ int MenuSettings() { } else WindowPrompt(0,tr("Console should be unlocked to modify it."),tr("OK")); break; - case 5: + case 6: if ( Settings.godmode == 1) { w.Remove(&optionBrowser2); w.Remove(&backBtn); @@ -1431,7 +1460,7 @@ int MenuSettings() { } else WindowPrompt(0,tr("Console should be unlocked to modify it."),tr("OK")); break; - case 6: + case 7: if ( Settings.godmode == 1) { w.Remove(&optionBrowser2); w.Remove(&backBtn); @@ -1453,7 +1482,7 @@ int MenuSettings() { } else WindowPrompt(0,tr("Console should be unlocked to modify it."),tr("OK")); break; - case 7: + case 8: if ( Settings.godmode == 1) { w.Remove(&optionBrowser2); w.Remove(&backBtn); @@ -1480,7 +1509,7 @@ int MenuSettings() { WindowPrompt(tr("Dolpath change"),tr("Console should be unlocked to modify it."),tr("OK")); } break; - case 8: + case 9: if ( Settings.godmode == 1) { w.Remove(&optionBrowser2); w.Remove(&backBtn); @@ -1785,7 +1814,7 @@ int GameSettings(struct discHdr * header) { GuiImage settingsbackground(&settingsbg); - GuiText backBtnTxt(tr("Back") , 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText backBtnTxt(tr("Back") , 22, THEME.prompttext); backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); GuiImage backBtnImg(&btnOutline); if (Settings.wsprompt == yes) { @@ -1799,7 +1828,7 @@ int GameSettings(struct discHdr * header) { GuiButton homo(1,1); homo.SetTrigger(&trigHome); - GuiText saveBtnTxt(tr("Save"), 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText saveBtnTxt(tr("Save"), 22, THEME.prompttext); saveBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); GuiImage saveBtnImg(&btnOutline); if (Settings.wsprompt == yes) { diff --git a/source/settings/SettingsPrompts.cpp b/source/settings/SettingsPrompts.cpp index 4e464d0a..fe541585 100644 --- a/source/settings/SettingsPrompts.cpp +++ b/source/settings/SettingsPrompts.cpp @@ -81,7 +81,7 @@ bool MenuOGG() { oggmenubackground.SetAlignment(ALIGN_LEFT, ALIGN_TOP); oggmenubackground.SetPosition(0, 0); - GuiText backBtnTxt(tr("Back") , 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText backBtnTxt(tr("Back") , 22, THEME.prompttext); backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); GuiImage backBtnImg(&btnOutline); if (Settings.wsprompt == yes) { @@ -99,7 +99,7 @@ bool MenuOGG() { backBtn.SetTrigger(&trigB); backBtn.SetEffectGrow(); - GuiText defaultBtnTxt(tr("Default") , 22, (GXColor) { THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText defaultBtnTxt(tr("Default") , 22, THEME.prompttext); defaultBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); GuiImage defaultBtnImg(&btnOutline); if (Settings.wsprompt == yes) { @@ -363,7 +363,7 @@ int MenuLanguageSelect() { oggmenubackground.SetAlignment(ALIGN_LEFT, ALIGN_TOP); oggmenubackground.SetPosition(0, 0); - GuiText backBtnTxt(tr("Back") , 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText backBtnTxt(tr("Back") , 22, THEME.prompttext); backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); GuiImage backBtnImg(&btnOutline); if (Settings.wsprompt == yes) { @@ -381,7 +381,7 @@ int MenuLanguageSelect() { backBtn.SetTrigger(&trigB); backBtn.SetEffectGrow(); - GuiText defaultBtnTxt(tr("Default") , 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText defaultBtnTxt(tr("Default") , 22, THEME.prompttext); defaultBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); GuiImage defaultBtnImg(&btnOutline); if (Settings.wsprompt == yes) { @@ -398,7 +398,7 @@ int MenuLanguageSelect() { defaultBtn.SetTrigger(&trigA); defaultBtn.SetEffectGrow(); - GuiText updateBtnTxt(tr("Update Files") , 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText updateBtnTxt(tr("Update Files") , 22, THEME.prompttext); updateBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); GuiImage updateBtnImg(&btnOutline); if (Settings.wsprompt == yes) { diff --git a/source/settings/cfg.c b/source/settings/cfg.c index 0d9e9f9e..b06aa934 100644 --- a/source/settings/cfg.c +++ b/source/settings/cfg.c @@ -192,6 +192,7 @@ void CFG_Default(int widescreen) { // -1 = non forced Mode if (widescreen == -1) { snprintf(Settings.covers_path, sizeof(Settings.covers_path), "%s/images/", bootDevice); //default image path + snprintf(Settings.covers2d_path, sizeof(Settings.covers2d_path), "%s/images/2D/", bootDevice); //default image path snprintf(Settings.disc_path, sizeof(Settings.disc_path), "%s/images/disc/", bootDevice); snprintf(Settings.titlestxt_path, sizeof(Settings.titlestxt_path), "%s/config/", bootDevice);//default path for disc images char * empty = ""; @@ -205,94 +206,114 @@ void CFG_Default(int widescreen) { // -1 = non forced Mode snprintf(Settings.TxtCheatcodespath, sizeof(Settings.TxtCheatcodespath), "%s/txtcodes/", bootDevice); snprintf(Settings.dolpath, sizeof(Settings.dolpath), "%s/", bootDevice); sprintf(Settings.ogg_path, "notset"); + } + //always set Theme defaults + //all alignments are left top here + THEME.gamelist_x = 200; + THEME.gamelist_y = 49;//40; + THEME.gamelist_w = 396; + THEME.gamelist_h = 280; + THEME.gamegrid_w = 640; + THEME.gamegrid_h = 400; + THEME.gamegrid_x = 0; + THEME.gamegrid_y = 20; + THEME.gamecarousel_w = 640; + THEME.gamecarousel_h = 400; + THEME.gamecarousel_x = 0; + THEME.gamecarousel_y = -20; + + THEME.covers_x = 26; + THEME.covers_y = 58; + + THEME.show_id = 1; + THEME.id_x = 68; + THEME.id_y = 305; + THEME.show_region = 1; + THEME.region_x = 68; + THEME.region_y = 30; - //all alignments are left top here - THEME.selection_x = 200; - THEME.selection_y = 49;//40; - THEME.selection_w = 396; - THEME.selection_h = 280; - THEME.batteryUnused = 70; - THEME.gamegrid_w = 640; - THEME.gamegrid_h = 400; - THEME.gamegrid_x = 0; - THEME.gamegrid_y = 20; - THEME.gamecarousel_w = 640; - THEME.gamecarousel_h = 400; - THEME.gamecarousel_x = 0; - THEME.gamecarousel_y = -20; - THEME.clock_r = 138; - THEME.clock_g = 138; - THEME.clock_b = 138; - THEME.settingsTxt_r = 0; - THEME.settingsTxt_g = 0; - THEME.settingsTxt_b = 0; - THEME.cover_x = 26; - THEME.cover_y = 58; - THEME.homebrew_x = 410; - THEME.homebrew_y = 405; - THEME.showID = 1; - // THEME.maxcharacters = 36; - THEME.id_x = 68; - THEME.id_y = 305; - THEME.region_x = 68; - THEME.region_y = 30; - THEME.power_x = 576; - THEME.tooltipAlpha = 255; - THEME.power_y = 355; - THEME.home_x = 489;//215; - THEME.home_y = 371; - THEME.setting_x = 64;//-210 - THEME.setting_y = 371; - THEME.showHDD = 1; //default - THEME.showGameCnt = 1; //default - THEME.showToolTip = 1; //1 means use settings, 0 means force turn off - THEME.install_x = 16;//-280 - THEME.install_y = 355; - THEME.showBattery = 1; - THEME.showRegion = 1; - THEME.hddInfo_x = 0; - THEME.hddInfo_y = 400; - THEME.hddInfoAlign = CFG_ALIGN_CENTRE; - THEME.gameCnt_x = 0; - THEME.gameCnt_y = 420; - THEME.gameCntAlign = CFG_ALIGN_CENTRE; - THEME.battery1_x = 245; - THEME.battery1_y = 400; - THEME.battery2_x = 335; - THEME.battery2_y = 400; - THEME.battery3_x = 245; - THEME.battery3_y = 425; - THEME.battery4_x = 335; - THEME.battery4_y = 425; - THEME.info_r = 55; - THEME.info_g = 190; - THEME.info_b = 237; - THEME.prompttxt_r = 0; - THEME.prompttxt_g = 0; - THEME.prompttxt_b = 0; - THEME.clock_x = 0; - THEME.clock_y = 335;//330; - THEME.clockAlign = CFG_ALIGN_CENTRE; - THEME.sdcard_x = 160; - THEME.sdcard_y = 395; - THEME.gameText_r = 0; - THEME.gameText_g = 0; - THEME.gameText_b = 0; - THEME.pagesize = 9; - THEME.favorite_x = 4; - THEME.favorite_y = 13; - THEME.abc_x = 36; - THEME.abc_y = 13; - THEME.list_x = 100; - THEME.list_y = 13; - THEME.grid_x = 132; - THEME.grid_y = 13; - THEME.carousel_x = 164; - THEME.carousel_y = 13; - THEME.count_x = 68; - THEME.count_y = 13; - THEME.sortBarOffset = 100; - } + THEME.sdcard_x = 160; + THEME.sdcard_y = 395; + THEME.homebrew_x = 410; + THEME.homebrew_y = 405; + THEME.power_x = 576; + THEME.power_y = 355; + THEME.home_x = 489;//215; + THEME.home_y = 371; + THEME.setting_x = 64;//-210 + THEME.setting_y = 371; + THEME.install_x = 16;//-280 + THEME.install_y = 355; + + THEME.clock = (GXColor) {138, 138, 138, 240}; + THEME.clock_align = CFG_ALIGN_CENTRE; + THEME.clock_x = 0; + THEME.clock_y = 335;//330; + + + THEME.info = (GXColor) {55, 190, 237, 255}; + THEME.show_hddinfo = 1; //default + THEME.hddinfo_align = CFG_ALIGN_CENTRE; + THEME.hddinfo_x = 0; + THEME.hddinfo_y = 400; + THEME.show_gamecount = 1; //default + THEME.gamecount_align = CFG_ALIGN_CENTRE; + THEME.gamecount_x = 0; + THEME.gamecount_y = 420; + + THEME.show_tooltip = 1; //1 means use settings, 0 means force turn off + THEME.tooltipAlpha = 255; + + THEME.prompttext = (GXColor) {0, 0, 0, 255}; + THEME.settingstext = (GXColor) {0, 0, 0, 255}; + THEME.gametext = (GXColor) {0, 0, 0, 255}; + + THEME.pagesize = 9; + + THEME.gamelist_favorite_x = CFG.widescreen ? 288 : 260; + THEME.gamelist_favorite_y = 13; + THEME.gamelist_search_x = CFG.widescreen ? 320 : 300; + THEME.gamelist_search_y = 13; + THEME.gamelist_abc_x = CFG.widescreen ? 352 : 340; + THEME.gamelist_abc_y = 13; + THEME.gamelist_count_x = CFG.widescreen ? 384 : 380; + THEME.gamelist_count_y = 13; + THEME.gamelist_list_x = CFG.widescreen ? 416 : 420; + THEME.gamelist_list_y = 13; + THEME.gamelist_grid_x = CFG.widescreen ? 448 : 460; + THEME.gamelist_grid_y = 13; + THEME.gamelist_carousel_x = CFG.widescreen ? 480 : 500; + THEME.gamelist_carousel_y = 13; + + THEME.gamegrid_favorite_x = CFG.widescreen ? 208 : 180; + THEME.gamegrid_favorite_y = 13; + THEME.gamegrid_search_x = CFG.widescreen ? 240 : 220; + THEME.gamegrid_search_y = 13; + THEME.gamegrid_abc_x = CFG.widescreen ? 272 : 260; + THEME.gamegrid_abc_y = 13; + THEME.gamegrid_count_x = CFG.widescreen ? 304 : 300; + THEME.gamegrid_count_y = 13; + THEME.gamegrid_list_x = CFG.widescreen ? 336 : 340; + THEME.gamegrid_list_y = 13; + THEME.gamegrid_grid_x = CFG.widescreen ? 368 : 380; + THEME.gamegrid_grid_y = 13; + THEME.gamegrid_carousel_x = CFG.widescreen ? 400 : 420; + THEME.gamegrid_carousel_y = 13; + + THEME.gamecarousel_favorite_x = CFG.widescreen ? 208 : 180; + THEME.gamecarousel_favorite_y = 13; + THEME.gamecarousel_search_x = CFG.widescreen ? 240 : 220; + THEME.gamecarousel_search_y = 13; + THEME.gamecarousel_abc_x = CFG.widescreen ? 272 : 260; + THEME.gamecarousel_abc_y = 13; + THEME.gamecarousel_count_x = CFG.widescreen ? 304 : 300; + THEME.gamecarousel_count_y = 13; + THEME.gamecarousel_list_x = CFG.widescreen ? 336 : 340; + THEME.gamecarousel_list_y = 13; + THEME.gamecarousel_grid_x = CFG.widescreen ? 368 : 380; + THEME.gamecarousel_grid_y = 13; + THEME.gamecarousel_carousel_x = CFG.widescreen ? 400 : 420; + THEME.gamecarousel_carousel_y = 13; } void Global_Default(void) { @@ -301,9 +322,9 @@ void Global_Default(void) { Settings.language = ConsoleLangDefault; Settings.ocarina = off; Settings.hddinfo = hr12; - Settings.sinfo = ((THEME.showID) ? GameID : Neither); + Settings.sinfo = ((THEME.show_id) ? GameID : Neither); Settings.rumble = RumbleOn; - if (THEME.showRegion) { + if (THEME.show_region) { Settings.sinfo = ((Settings.sinfo == GameID) ? Both : GameRegion); } Settings.volume = 80; @@ -453,6 +474,11 @@ void path_set(char *name, char *val) { return; } + if (strcmp(name, "cover2d_path") == 0) { + strcopy(Settings.covers2d_path, val, sizeof(Settings.covers2d_path)); + return; + } + if (strcmp(name, "disc_path") == 0) { strcopy(Settings.disc_path, val, sizeof(Settings.disc_path)); return; @@ -502,324 +528,243 @@ void path_set(char *name, char *val) { } +#define CFG_COORDS2(name) \ + if (strcmp(cfg_name, #name "_coords") == 0) { \ + short x,y; \ + if (sscanf(val, "%hd,%hd", &x, &y) == 2) { \ + THEME.name##_x = x; \ + THEME.name##_y = y; \ + } \ + } +#define CFG_COORDS4(name) \ + if (strcmp(cfg_name, #name "_coords") == 0) { \ + short x,y,w,h; \ + if (sscanf(val, "%hd,%hd,%hd,%hd", &x, &y, &w, &h) == 4) { \ + THEME.name##_x = x; \ + THEME.name##_y = y; \ + THEME.name##_w = w; \ + THEME.name##_h = h; \ + } \ + } +#define CFG_COLOR(name) \ + if (strcmp(cfg_name, #name "_color") == 0) { \ + short r,g,b,a; \ + int c = sscanf(val, "%hd,%hd,%hd,%hd", &r, &g, &b, &a); \ + if(c >= 3) { \ + THEME.name.r = r; \ + THEME.name.g = g; \ + THEME.name.b = b; \ + if(c >= 4) \ + THEME.name.a = a; \ + } \ + } +#define CFG_VAL(name) \ + if (strcmp(cfg_name, #name) == 0) { \ + short v; \ + if (sscanf(val, "%hd", &v) == 1) { \ + THEME.name = v; \ + } \ + } + +#define CFG_BOOL(name) if(cfg_bool(#name, &THEME.name)); + +#define CFG_ALIGN(name) if(cfg_map_auto(#name "_align", map_alignment, &THEME.name##_align)); + +#define OLD_FAV_ICON 1 +#define OLD_ABC_ICON 2 +#define OLD_COUNT_ICON 4 +#define OLD_LIST_ICON 8 +#define OLD_GRID_ICON 16 +#define OLD_CAROUSEL_ICON 32 +short WorkAroundIconSet=0; +short WorkAroundBarOffset=100; + void theme_set(char *name, char *val) { - cfg_name = name; - cfg_val = val; + cfg_name = name; + cfg_val = val; - if (strcmp(cfg_name, "gamelist_coords") == 0) { - int x,y,w,h; - if (sscanf(val, "%d,%d,%d,%d", &x, &y, &w, &h) == 4) { - THEME.selection_x = x - (x % 4); - THEME.selection_y = y; - THEME.selection_w = w; - THEME.selection_h = h; - } - } + CFG_COORDS4(gamelist) + else CFG_COORDS4(gamegrid) + else CFG_COORDS4(gamecarousel) + + else CFG_COORDS2(covers) - if (strcmp(cfg_name, "gamegrid_coords") == 0) { - int x,y,w,h; - if (sscanf(val, "%d,%d,%d,%d", &x, &y, &w, &h) == 4) { - THEME.gamegrid_x = x - (x % 4); - THEME.gamegrid_y = y; - THEME.gamegrid_w = w; - THEME.gamegrid_h = h; - } - } + else CFG_BOOL(show_id) + else CFG_COORDS2(id) - if (strcmp(cfg_name, "gamecarousel_coords") == 0) { - int x,y,w,h; - if (sscanf(val, "%d,%d,%d,%d", &x, &y, &w, &h) == 4) { - THEME.gamecarousel_x = x - (x % 4); - THEME.gamecarousel_y = y; - THEME.gamecarousel_w = w; - THEME.gamecarousel_h = h; - } - } + else CFG_BOOL(show_region) + else CFG_COORDS2(region) - else if (strcmp(cfg_name, "covers_coords") == 0) { - short x,y; - if (sscanf(val, "%hd,%hd", &x, &y) == 2) { - THEME.cover_x = x - (x % 4); - THEME.cover_y = y; - } - } + else CFG_COORDS2(sdcard) + else CFG_COORDS2(homebrew) + else CFG_COORDS2(power) + else CFG_COORDS2(home) + else CFG_COORDS2(setting) + else CFG_COORDS2(install) + + else CFG_COORDS2(clock) + else CFG_ALIGN(clock) + else CFG_COLOR(clock) - else if (strcmp(cfg_name, "id_coords") == 0) { - short x,y; - if (sscanf(val, "%hd,%hd", &x, &y) == 2) { - THEME.id_x = x - (x % 4); - THEME.id_y = y; - } - } + else CFG_COLOR(info) + else CFG_BOOL(show_hddinfo) + else CFG_ALIGN(hddinfo) + else CFG_COORDS2(hddinfo) - else if (strcmp(cfg_name, "hddinfo_coords") == 0) { - short x,y; - if (sscanf(val, "%hd,%hd", &x, &y) == 2) { - THEME.hddInfo_x = x - (x % 4); - THEME.hddInfo_y = y; - } - } + else CFG_BOOL(show_gamecount) + else CFG_ALIGN(gamecount) + else CFG_COORDS2(gamecount) - else if (strcmp(cfg_name, "gamecount_coords") == 0) { - short x,y; - if (sscanf(val, "%hd,%hd", &x, &y) == 2) { - THEME.gameCnt_x = x - (x % 4); - THEME.gameCnt_y = y; - } - } + else CFG_BOOL(show_tooltip) + else CFG_VAL(tooltipAlpha) - else if (strcmp(cfg_name, "region_coords") == 0) { - short x,y; - if (sscanf(val, "%hd,%hd", &x, &y) == 2) { - THEME.region_x = x - (x % 4); - THEME.region_y = y; - } - } + else CFG_COLOR(prompttext) + else CFG_COLOR(settingstext) + else CFG_COLOR(gametext) - else if (strcmp(cfg_name, "homebrew_coords") == 0) { - short x,y; - if (sscanf(val, "%hd,%hd", &x, &y) == 2) { - THEME.homebrew_x = x - (x % 4); - THEME.homebrew_y = y; - } - } + else CFG_VAL(pagesize) - else if (strcmp(cfg_name, "power_coords") == 0) { - short x,y; - if (sscanf(val, "%hd,%hd", &x, &y) == 2) { - THEME.power_x = x - (x % 4); - THEME.power_y = y; - } - } + else CFG_COORDS2(gamelist_favorite) + else CFG_COORDS2(gamegrid_favorite) + else CFG_COORDS2(gamecarousel_favorite) - else if (strcmp(cfg_name, "home_coords") == 0) { - short x,y; - if (sscanf(val, "%hd,%hd", &x, &y) == 2) { - THEME.home_x = x - (x % 4); - THEME.home_y = y; - } - } + else CFG_COORDS2(gamelist_search) + else CFG_COORDS2(gamegrid_search) + else CFG_COORDS2(gamecarousel_search) + + else CFG_COORDS2(gamelist_abc) + else CFG_COORDS2(gamegrid_abc) + else CFG_COORDS2(gamecarousel_abc) - else if (strcmp(cfg_name, "setting_coords") == 0) { - short x,y; - if (sscanf(val, "%hd,%hd", &x, &y) == 2) { - THEME.setting_x = x - (x % 4); - THEME.setting_y = y; - } - } + else CFG_COORDS2(gamelist_count) + else CFG_COORDS2(gamegrid_count) + else CFG_COORDS2(gamecarousel_count) - else if (strcmp(cfg_name, "install_coords") == 0) { - short x,y; - if (sscanf(val, "%hd,%hd", &x, &y) == 2) { - THEME.install_x = x - (x % 4); - THEME.install_y = y; - } - } + else CFG_COORDS2(gamelist_list) + else CFG_COORDS2(gamegrid_list) + else CFG_COORDS2(gamecarousel_list) - else if (strcmp(cfg_name, "battery1_coords") == 0) { - short x,y; - if (sscanf(val, "%hd,%hd", &x, &y) == 2) { - THEME.battery1_x = x - (x % 4); - THEME.battery1_y = y; - } - } + else CFG_COORDS2(gamelist_grid) + else CFG_COORDS2(gamegrid_grid) + else CFG_COORDS2(gamecarousel_grid) - else if (strcmp(cfg_name, "battery2_coords") == 0) { - short x,y; - if (sscanf(val, "%hd,%hd", &x, &y) == 2) { - THEME.battery2_x = x - (x % 4); - THEME.battery2_y = y; - } - } + else CFG_COORDS2(gamelist_carousel) + else CFG_COORDS2(gamegrid_carousel) + else CFG_COORDS2(gamecarousel_carousel) - else if (strcmp(cfg_name, "battery3_coords") == 0) { - short x,y; - if (sscanf(val, "%hd,%hd", &x, &y) == 2) { - THEME.battery3_x = x - (x % 4); - THEME.battery3_y = y; - } - } + //********************************** + // Workaround for old Themes + //********************************** + else if (strcmp(cfg_name, "favorite_coords") == 0) { + short x,y; + if (sscanf(val, "%hd,%hd", &x, &y) == 2) { + if(!CFG.widescreen) x-=20; + // old themes have no search_coords + // set the searchIcon to the Position of the favIcon + THEME.gamelist_search_x = x; + THEME.gamegrid_search_x = THEME.gamecarousel_search_x = x-WorkAroundBarOffset; + THEME.gamelist_search_y = THEME.gamegrid_search_y = THEME.gamecarousel_search_y = y; + // place the favIcon to the left side of the searchIcon + if(!CFG.widescreen) x-= CFG.widescreen ? 32 : 40; + THEME.gamelist_favorite_x = x; + THEME.gamegrid_favorite_x = THEME.gamecarousel_favorite_x = x-WorkAroundBarOffset; + THEME.gamelist_favorite_y = THEME.gamegrid_favorite_y = THEME.gamecarousel_favorite_y = y; + WorkAroundIconSet |= OLD_FAV_ICON; + } + } + else if (strcmp(cfg_name, "abc_coords") == 0) { + short x,y; + if (sscanf(val, "%hd,%hd", &x, &y) == 2) { + if(!CFG.widescreen) x-=12; + THEME.gamelist_abc_x = x; + THEME.gamegrid_abc_x = THEME.gamecarousel_abc_x = x-WorkAroundBarOffset; + THEME.gamelist_abc_y = THEME.gamegrid_abc_y = THEME.gamecarousel_abc_y = y; + WorkAroundIconSet |= OLD_ABC_ICON; + } + } + else if (strcmp(cfg_name, "count_coords") == 0) { + short x,y; + if (sscanf(val, "%hd,%hd", &x, &y) == 2) { + if(!CFG.widescreen) x-=4; + THEME.gamelist_count_x = x; + THEME.gamegrid_count_x = THEME.gamecarousel_count_x = x-WorkAroundBarOffset; + THEME.gamelist_count_y = THEME.gamegrid_count_y = THEME.gamecarousel_count_y = y; + WorkAroundIconSet |= OLD_COUNT_ICON; + } + } + else if (strcmp(cfg_name, "list_coords") == 0) { + short x,y; + if (sscanf(val, "%hd,%hd", &x, &y) == 2) { + if(!CFG.widescreen) x+=4; + THEME.gamelist_list_x = x; + THEME.gamegrid_list_x = THEME.gamecarousel_list_x = x-WorkAroundBarOffset; + THEME.gamelist_list_y = THEME.gamegrid_list_y = THEME.gamecarousel_list_y = y; + WorkAroundIconSet |= OLD_LIST_ICON; + } + } + else if (strcmp(cfg_name, "grid_coords") == 0) { + short x,y; + if (sscanf(val, "%hd,%hd", &x, &y) == 2) { + if(!CFG.widescreen) x+=12; + THEME.gamelist_grid_x = x; + THEME.gamegrid_grid_x = THEME.gamecarousel_grid_x = x-WorkAroundBarOffset; + THEME.gamelist_grid_y = THEME.gamegrid_grid_y = THEME.gamecarousel_grid_y = y; + WorkAroundIconSet |= OLD_GRID_ICON; + } + } + else if (strcmp(cfg_name, "carousel_coords") == 0) { + short x,y; + if (sscanf(val, "%hd,%hd", &x, &y) == 2) { + if(!CFG.widescreen) x+=20; + THEME.gamelist_carousel_x = x; + THEME.gamegrid_carousel_x = THEME.gamecarousel_carousel_x = x-WorkAroundBarOffset; + THEME.gamelist_carousel_y = THEME.gamegrid_carousel_y = THEME.gamecarousel_carousel_y = y; + WorkAroundIconSet |= OLD_CAROUSEL_ICON; + } + } - else if (strcmp(cfg_name, "battery4_coords") == 0) { - short x,y; - if (sscanf(val, "%hd,%hd", &x, &y) == 2) { - THEME.battery4_x = x - (x % 4); - THEME.battery4_y = y; - } - } - - else if (strcmp(cfg_name, "clock_coords") == 0) { - short x,y; - if (sscanf(val, "%hd,%hd", &x, &y) == 2) { - THEME.clock_x = x - (x % 4); - THEME.clock_y = y; - } - } - - else if (strcmp(cfg_name, "sdcard_coords") == 0) { - short x,y; - if (sscanf(val, "%hd,%hd", &x, &y) == 2) { - THEME.sdcard_x = x - (x % 4); - THEME.sdcard_y = y; - } - } - - else if (strcmp(cfg_name, "favorite_coords") == 0) { - short x,y; - if (sscanf(val, "%hd,%hd", &x, &y) == 2) { - THEME.favorite_x = x - (x % 4); - THEME.favorite_y = y; - } - } - - else if (strcmp(cfg_name, "abc_coords") == 0) { - short x,y; - if (sscanf(val, "%hd,%hd", &x, &y) == 2) { - THEME.abc_x = x - (x % 4); - THEME.abc_y = y; - } - } - - else if (strcmp(cfg_name, "count_coords") == 0) { - short x,y; - if (sscanf(val, "%hd,%hd", &x, &y) == 2) { - THEME.count_x = x - (x % 4); - THEME.count_y = y; - } - } - - else if (strcmp(cfg_name, "carousel_coords") == 0) { - short x,y; - if (sscanf(val, "%hd,%hd", &x, &y) == 2) { - THEME.carousel_x = x - (x % 4); - THEME.carousel_y = y; - } - } - - else if (strcmp(cfg_name, "grid_coords") == 0) { - short x,y; - if (sscanf(val, "%hd,%hd", &x, &y) == 2) { - THEME.grid_x = x - (x % 4); - THEME.grid_y = y; - } - } - - else if (strcmp(cfg_name, "list_coords") == 0) { - short x,y; - if (sscanf(val, "%hd,%hd", &x, &y) == 2) { - THEME.list_x = x - (x % 4); - THEME.list_y = y; - } - } - - else if (strcmp(cfg_name, "sortBarOffset") == 0) { - short x; - if (sscanf(val, "%hd", &x) == 1) { - THEME.sortBarOffset = x; - } - } - - else if (strcmp(cfg_name, "info_color") == 0) { - short x,y,z; - if (sscanf(val, "%hd,%hd, %hd", &x, &y, &z) == 3) { - THEME.info_r = x; - THEME.info_g = y; - THEME.info_b = z; - } - } - - else if (strcmp(cfg_name, "gametext_color") == 0) { - short x,y,z; - if (sscanf(val, "%hd,%hd, %hd", &x, &y, &z) == 3) { - THEME.gameText_r = x; - THEME.gameText_g = y; - THEME.gameText_b = z; - } - } - - else if (strcmp(cfg_name, "prompttext_color") == 0) { - short x,y,z; - if (sscanf(val, "%hd,%hd, %hd", &x, &y, &z) == 3) { - THEME.prompttxt_r = x; - THEME.prompttxt_g = y; - THEME.prompttxt_b = z; - } - } - - else if (strcmp(cfg_name, "clock_color") == 0) { - short x,y,z; - if (sscanf(val, "%hd,%hd, %hd", &x, &y, &z) == 3) { - THEME.clock_r = x; - THEME.clock_g = y; - THEME.clock_b = z; - } - } - - else if (strcmp(cfg_name, "settingstext_color") == 0) { - short x,y,z; - if (sscanf(val, "%hd,%hd, %hd", &x, &y, &z) == 3) { - THEME.settingsTxt_r = x; - THEME.settingsTxt_g = y; - THEME.settingsTxt_b = z; - } - } - - else if (strcmp(cfg_name, "pagesize") == 0) { - short x; - if (sscanf(val, "%hd", &x) == 1) { - THEME.pagesize = x; - } - } - - else if (strcmp(cfg_name, "batteryUnused") == 0) { - short x; - if (sscanf(val, "%hd", &x) == 1) { - THEME.batteryUnused = x; - } - } else if (strcmp(cfg_name, "tooltipAlpha") == 0) { - short x; - if (sscanf(val, "%hd", &x) == 1) { - THEME.tooltipAlpha = x; - } - } - - /* - else if (strcmp(cfg_name, "maxcharacters") == 0) { - short x; - if (sscanf(val, "%hd", &x) == 1) { - THEME.maxcharacters = x; - } - } - */ + else if (strcmp(cfg_name, "sortBarOffset") == 0) { + short o; + if (sscanf(val, "%hd", &o) == 1) { + if(WorkAroundIconSet & OLD_FAV_ICON) + { + THEME.gamegrid_favorite_x += WorkAroundBarOffset - o; + THEME.gamecarousel_favorite_x += WorkAroundBarOffset - o; + THEME.gamegrid_search_x += WorkAroundBarOffset - o; + THEME.gamecarousel_search_x += WorkAroundBarOffset - o; + } + if(WorkAroundIconSet & OLD_ABC_ICON) + { + THEME.gamegrid_abc_x += WorkAroundBarOffset - o; + THEME.gamecarousel_abc_x += WorkAroundBarOffset - o; + } + if(WorkAroundIconSet & OLD_COUNT_ICON) + { + THEME.gamegrid_count_x += WorkAroundBarOffset - o; + THEME.gamecarousel_count_x += WorkAroundBarOffset - o; + } + if(WorkAroundIconSet & OLD_LIST_ICON) + { + THEME.gamegrid_list_x += WorkAroundBarOffset - o; + THEME.gamecarousel_list_x += WorkAroundBarOffset - o; + } + if(WorkAroundIconSet & OLD_GRID_ICON) + { + THEME.gamegrid_grid_x += WorkAroundBarOffset - o; + THEME.gamecarousel_grid_x += WorkAroundBarOffset - o; + } + if(WorkAroundIconSet & OLD_CAROUSEL_ICON) + { + THEME.gamegrid_carousel_x += WorkAroundBarOffset - o; + THEME.gamecarousel_carousel_x += WorkAroundBarOffset - o; + } + WorkAroundBarOffset = o; + } + } - - cfg_bool("show_id", &THEME.showID); - cfg_bool("show_tooltip", &THEME.showToolTip); - cfg_bool("show_hddinfo", &THEME.showHDD); - cfg_bool("show_gamecount", &THEME.showGameCnt); - cfg_bool("show_region", &THEME.showRegion); - cfg_bool("show_battery", &THEME.showBattery); - cfg_map_auto("hddinfo_align", map_alignment, &THEME.hddInfoAlign); - cfg_map_auto("gamecount_align", map_alignment, &THEME.gameCntAlign); - cfg_map_auto("clock_align", map_alignment, &THEME.clockAlign); - - /* - else if (strcmp(cfg_name, "entry_lines") == 0) { - int x; - if (sscanf(val, "%d", &x) == 1) { - ENTRIES_PER_PAGE = x; - } - } - - else if (strcmp(cfg_name, "max_characters") == 0) { - int x; - if (sscanf(val, "%d", &x) == 1) { - MAX_CHARACTERS = x; - } - }*/ } void global_cfg_set(char *name, char *val) { @@ -1206,6 +1151,7 @@ bool cfg_save_global() { // save global settings fprintf(f, "wsprompt = %d\n", Settings.wsprompt); fprintf(f, "parentalcontrol = %d\n ", Settings.parentalcontrol); fprintf(f, "cover_path = %s\n ", Settings.covers_path); + fprintf(f, "cover2d_path = %s\n ", Settings.covers2d_path); if (CFG.widescreen) { fprintf(f, "wtheme_path = %s\n ", CFG.theme_path); } else { @@ -1559,9 +1505,9 @@ bool cfg_load_global() { Settings.keyset = us; Settings.hddinfo = hr12; Settings.gameDisplay = list; - Settings.sinfo = ((THEME.showID) ? GameID : Neither); + Settings.sinfo = ((THEME.show_id) ? GameID : Neither); Settings.rumble = RumbleOn; - if (THEME.showRegion) { + if (THEME.show_region) { Settings.sinfo = ((Settings.sinfo == GameID) ? Both : GameRegion); } Settings.volume = 80; @@ -1655,7 +1601,8 @@ void CFG_Load(void) { cfg_parsefile(pathname, &widescreen_set); //first set widescreen cfg_parsefile(pathname, &path_set); //then set config and layout options - snprintf(pathname, sizeof(pathname), "%sGXtheme.cfg", CFG.theme_path); + WorkAroundIconSet=0; WorkAroundBarOffset=100; // set Workaroundstuff to defaults + snprintf(pathname, sizeof(pathname), "%sGXtheme.cfg", CFG.theme_path); cfg_parsefile(pathname, &theme_set); //finally set theme information // set GUI language, use Wii's language setting if language is set to default diff --git a/source/settings/cfg.h b/source/settings/cfg.h index 9daee0c0..497ee1d2 100644 --- a/source/settings/cfg.h +++ b/source/settings/cfg.h @@ -50,96 +50,131 @@ extern "C" { }; - struct THEME { - int selection_x; - int selection_y; - int selection_w; - int selection_h; - int gamegrid_x; - int gamegrid_y; - int gamegrid_w; - int gamegrid_h; - int tooltipAlpha; - int gamecarousel_x; - int gamecarousel_y; - int gamecarousel_w; - int gamecarousel_h; - short cover_x; - short cover_y; - short showID; -// short maxcharacters; - short batteryUnused; - short homebrew_x; - short homebrew_y; - short id_x; - short id_y; - short region_x; - short region_y; - short power_x; - short power_y; - short home_x; - short home_y; - short battery1_x; - short battery2_x; - short battery3_x; - short battery4_x; - short battery1_y; - short battery2_y; - short battery3_y; - short battery4_y; - short favorite_x; - short favorite_y; - short abc_x; - short abc_y; - short list_x; - short list_y; - short grid_x; - short grid_y; - short carousel_x; - short carousel_y; - short count_x; - short count_y; - short sortBarOffset; -// short showPower; -// short showHome; - short setting_x; - short setting_y; - short install_x; - short install_y; - short showHDD; - short hddInfoAlign; - short hddInfo_x; - short hddInfo_y; - short showGameCnt; - short gameCntAlign; - short gameCnt_x; - short gameCnt_y; - short showRegion; - short showBattery; - short showToolTip; - //color - short info_r; - short info_g; - short info_b; - short prompttxt_r; - short prompttxt_g; - short prompttxt_b; - short settingsTxt_r; - short settingsTxt_g; - short settingsTxt_b; - short clock_r; - short clock_g; - short clock_b; - short clock_x; - short clock_y; - short clockAlign; - short sdcard_x; - short sdcard_y; - short gameText_r; - short gameText_g; - short gameText_b; - short pagesize; - }; + struct THEME { + short gamelist_x; + short gamelist_y; + short gamelist_w; + short gamelist_h; + short gamegrid_x; + short gamegrid_y; + short gamegrid_w; + short gamegrid_h; + short gamecarousel_x; + short gamecarousel_y; + short gamecarousel_w; + short gamecarousel_h; + + short covers_x; + short covers_y; + + short show_id; + short id_x; + short id_y; + short show_region; + short region_x; + short region_y; + + short sdcard_x; + short sdcard_y; + short homebrew_x; + short homebrew_y; + short power_x; + short power_y; + short home_x; + short home_y; + short setting_x; + short setting_y; + short install_x; + short install_y; + GXColor clock; + short clock_align; + short clock_x; + short clock_y; + + GXColor info; + short show_hddinfo; + short hddinfo_align; + short hddinfo_x; + short hddinfo_y; + + short show_gamecount; + short gamecount_align; + short gamecount_x; + short gamecount_y; + + short show_tooltip; + int tooltipAlpha; + + GXColor prompttext; + GXColor settingstext; + GXColor gametext; + short pagesize; + +// Toolbar Icons in GameList +/* + short favorite_x; + short favorite_y; + short search_x; + short search_y; + short abc_x; + short abc_y; + short count_x; + short count_y; + short list_x; + short list_y; + short grid_x; + short grid_y; + short carousel_x; + short carousel_y; + short sortBarOffset; +*/ +// Toolbar Icons in GameList + short gamelist_favorite_x; + short gamelist_favorite_y; + short gamelist_search_x; + short gamelist_search_y; + short gamelist_abc_x; + short gamelist_abc_y; + short gamelist_count_x; + short gamelist_count_y; + short gamelist_list_x; + short gamelist_list_y; + short gamelist_grid_x; + short gamelist_grid_y; + short gamelist_carousel_x; + short gamelist_carousel_y; +// Toolbar Icons in GameGrid + short gamegrid_favorite_x; + short gamegrid_favorite_y; + short gamegrid_search_x; + short gamegrid_search_y; + short gamegrid_abc_x; + short gamegrid_abc_y; + short gamegrid_count_x; + short gamegrid_count_y; + short gamegrid_list_x; + short gamegrid_list_y; + short gamegrid_grid_x; + short gamegrid_grid_y; + short gamegrid_carousel_x; + short gamegrid_carousel_y; +// Toolbar Icons in GameCarousel + short gamecarousel_favorite_x; + short gamecarousel_favorite_y; + short gamecarousel_search_x; + short gamecarousel_search_y; + short gamecarousel_abc_x; + short gamecarousel_abc_y; + short gamecarousel_count_x; + short gamecarousel_count_y; + short gamecarousel_list_x; + short gamecarousel_list_y; + short gamecarousel_grid_x; + short gamecarousel_grid_y; + short gamecarousel_carousel_x; + short gamecarousel_carousel_y; + + }; extern struct CFG CFG; extern struct THEME THEME; @@ -341,7 +376,8 @@ extern "C" { u8 patchcountrystrings; u8 screensaver; short godmode; - char covers_path[100]; + char covers_path[100]; + char covers2d_path[100]; char theme_path[100]; char wtheme_path[100]; char disc_path[100]; diff --git a/source/usbloader/disc.h b/source/usbloader/disc.h index ee1f8aed..1a09cfef 100644 --- a/source/usbloader/disc.h +++ b/source/usbloader/disc.h @@ -1,6 +1,8 @@ #ifndef _DISC_H_ #define _DISC_H_ +#include /* for define ATTRIBUTE_PACKED */ + #ifdef __cplusplus extern "C" { #endif diff --git a/source/usbloader/getentries.cpp b/source/usbloader/getentries.cpp index bdcd48cd..43722aa3 100644 --- a/source/usbloader/getentries.cpp +++ b/source/usbloader/getentries.cpp @@ -3,12 +3,44 @@ #include "settings/cfg.h" #include "usbloader/wbfs.h" #include "main.h" +#include +#include "getentries.h" +#include +#include +struct discHdr * gameList=NULL; +s32 gameSelected=0, gameStart=0; +u32 gameCnt=0; +wchar_t *gameFilter=NULL; +wchar_t *gameFilterNextList=NULL; +wchar_t *gameFilterPrev=NULL; + +/**************************************************************************** + * wcsdup based on new wchar_t [...] + ***************************************************************************/ +wchar_t *wcsdup(const wchar_t *src) +{ + int len = wcslen(src)+1; + wchar_t *dst = new wchar_t[len]; + if(dst) wcscpy(dst, src); + return dst; +} +inline int wcsnicmp(const wchar_t *s1, const wchar_t *s2, int len) +{ + if (len <= 0) + return (0); + do + { + int r = towupper(*s1) - towupper(*s2++); + if (r) return r; + if (*s1++ == 0) + break; + } while (--len != 0); + + return (0); +} -struct discHdr * gameList; -u32 gameCnt; -s32 gameSelected, gameStart; /**************************************************************************** * EntryCmp @@ -52,17 +84,158 @@ s32 __Menu_EntryCmpCount(const void *a, const void *b) { return ret; } +/**************************************************************************** + * Get PrevFilter + ***************************************************************************/ + +int __Menu_GetPrevFilter(int t, wchar_t* gameFilter, u32 gameFiltered, wchar_t **PgameFilterPrev) +{ + + std::vector nameList; + + struct discHdr *buffer = NULL; + u32 cnt, len, i; + s32 ret; + + wchar_t *new_gameFilterPrev = wcsdup(gameFilter); + + + /* Get list length */ + ret = WBFS_GetCount(&cnt); + if (ret < 0) + return ret; + + /* Buffer length */ + len = sizeof(struct discHdr) * cnt; + + /* Allocate memory */ + buffer = (struct discHdr *)memalign(32, len); + if (!buffer) + return -1; + + /* Clear buffer */ + memset(buffer, 0, len); + + /* Get header list */ + ret = WBFS_GetHeaders(buffer, cnt, sizeof(struct discHdr)); + if (ret < 0) { + if (buffer) free(buffer); + return ret; + } + /* Fill nameList */ + for (i = 0; i < cnt; i++) + { + struct discHdr *header = &buffer[i]; + + /* Filter Favorite */ + if (Settings.fave && t==0) + { + struct Game_NUM* game_num = CFG_get_game_num(header->id); + if (!game_num || game_num->favorite==0) + continue; + } + /* Filter Pparental */ + if (Settings.parentalcontrol && !Settings.godmode && t==0) + if(get_block(header) >= Settings.parentalcontrol) + continue; + + wchar_t *wname = FreeTypeGX::charToWideChar(get_title(header)); + if(wname) nameList.push_back(wname); + } + + /* delete buffer */ + if(buffer) free(buffer); + + /* Find Prev-Filter */ + len = wcslen(new_gameFilterPrev); + while(len) + { + cnt = 0; + new_gameFilterPrev[--len] = 0; + for(std::vector::iterator iter = nameList.begin(); iter < nameList.end(); iter++) + { + if(!wcsncmp(*iter, new_gameFilterPrev, len)) + cnt++; + } + if(cnt > gameFiltered) + break; + } + /* Clean name List */ + for(std::vector::iterator iter = nameList.begin(); iter < nameList.end(); iter++) + delete [] *iter; + + if(PgameFilterPrev) + *PgameFilterPrev = new_gameFilterPrev; + + return 0; +} +/**************************************************************************** + * Get GameFilter NextList + ***************************************************************************/ + +int int_cmp(const void *a, const void *b) { return *((u32*)a)-*((u32*)b); } + +int __Menu_GetGameFilter_NextList(discHdr *gameList, u32 gameCnt, wchar_t **PgameFilter, wchar_t **PgameFilterNextList) +{ + u32 filter_len = wcslen(*PgameFilter); + u32 i, lastChar=0; + wchar_t *p; + u32 *nextList = new u32[gameCnt]; if(nextList==NULL) return -1; + for(i=0; i filter_len && (filter_len == 0 || !wcsnicmp(*PgameFilter, gameName, filter_len))) + nextFilterChar = towupper(gameName[filter_len]); + nextList[i] = nextFilterChar; + } + qsort(nextList, gameCnt, sizeof(u32), int_cmp); + + *PgameFilterNextList = new wchar_t[gameCnt+1]; + if(*PgameFilterNextList == NULL) goto error; + + + p = *PgameFilterNextList; + lastChar = 0; + for(i=0; iid); - if (game_num) { - favorite = game_num->favorite; - } - if (favorite==1) { - buffer2 = (discHdr *) realloc(buffer2, (cnt2+1) * sizeof(struct discHdr)); - if (!buffer2) { - free(buffer); - return -1; - } - - memcpy((buffer2 + cnt2), (buffer + i), sizeof(struct discHdr)); - cnt2++; - } - } - if (buffer2) { - free(buffer); - buffer = buffer2; - buffer2 = NULL; - } else { - memset(buffer, 0, len); - } - cnt = cnt2; - } - - if (Settings.parentalcontrol && !Settings.godmode && t==0) { - u32 cnt2 = 0; - - for (u32 i = 0; i < cnt; i++) { - header = &buffer[i]; - if (get_block(header) < Settings.parentalcontrol) { - buffer2 = (discHdr *) realloc(buffer2, (cnt2+1) * sizeof(struct discHdr)); - if (!buffer2) { - free(buffer); - return -1; - } - - memcpy((buffer2 + cnt2), (buffer + i), sizeof(struct discHdr)); - cnt2++; - } - } - if (buffer2) { - free(buffer); - buffer = buffer2; - buffer2 = NULL; - } else { - memset(buffer, 0, len); - } - cnt = cnt2; - } - - if (Settings.sort==pcount) { - qsort(buffer, cnt, sizeof(struct discHdr), __Menu_EntryCmpCount); - } else { - qsort(buffer, cnt, sizeof(struct discHdr), __Menu_EntryCmp); - } - - /* Free memory */ - if (gameList) - free(gameList); - - /* Set values */ - gameList = buffer; - buffer = NULL; - gameCnt = cnt; - - /* Reset variables */ - gameSelected = gameStart = 0; + /* Filters */ + if (Settings.fave && t==0) { + struct Game_NUM* game_num = CFG_get_game_num(header->id); + if (!game_num || game_num->favorite==0) + continue; + } + + if (Settings.parentalcontrol && !Settings.godmode && t==0) { + if (get_block(header) >= Settings.parentalcontrol) + continue; + } + + if(gameFilter && *gameFilter && t==0) { + u32 filter_len = wcslen(gameFilter); + wchar_t *gameName = FreeTypeGX::charToWideChar(get_title(header)); + if (!gameName || wcsnicmp(gameName, gameFilter, filter_len)) { + delete [] gameName; + continue; + } + } + if(i != cnt2) + buffer[cnt2] = buffer[i]; + cnt2++; + } + if(cnt > cnt2) + { + cnt = cnt2; + buffer = (struct discHdr *)realloc(buffer, sizeof(struct discHdr) * cnt); + } + if (!buffer) + return -1; + + if (Settings.sort==pcount) { + qsort(buffer, cnt, sizeof(struct discHdr), __Menu_EntryCmpCount); + } else { + qsort(buffer, cnt, sizeof(struct discHdr), __Menu_EntryCmp); + } + /* Set values */ + if(PgameList) *PgameList = buffer; else free(buffer); + if(PgameCnt) *PgameCnt = cnt; + return 0; } + +int __Menu_GetEntries(int t, const wchar_t* Filter) { + + u32 new_gameCnt = 0; + struct discHdr *new_gameList = NULL; + wchar_t *new_gameFilter = NULL; + wchar_t *new_gameFilterNextList = NULL; + wchar_t *new_gameFilterPrev = NULL; + + new_gameFilter = wcsdup(Filter ? Filter : (gameFilter ? gameFilter : L"") ); + if(new_gameFilter == NULL) return -1; + for(;;) + { + if(__Menu_GetGameList(t, new_gameFilter, &new_gameList, &new_gameCnt) < 0) + return -1; + if(new_gameCnt > 0 || new_gameFilter[0] == 0) + break; + new_gameFilter[wcslen(new_gameFilter)-1] = 0; + } + /* init GameFilterNextList */ + if(__Menu_GetGameFilter_NextList(new_gameList, new_gameCnt, &new_gameFilter, &new_gameFilterNextList) < 0) + goto error; + + /* init GameFilterPrev */ + if(__Menu_GetPrevFilter(t, new_gameFilter, new_gameCnt, &new_gameFilterPrev) < 0) + goto error; + + /* Set values */ + if(gameList) free(gameList); + if(gameFilter) delete [] gameFilter; + if(gameFilterNextList) delete [] gameFilterNextList; + if(gameFilterPrev) delete [] gameFilterPrev; + + gameList = new_gameList; + gameCnt = new_gameCnt; + gameFilter = new_gameFilter; + gameFilterNextList = new_gameFilterNextList; + gameFilterPrev = new_gameFilterPrev; + + /* Reset variables */ + gameSelected = gameStart = 0; + return 0; +error: // clean up + if(new_gameList) free(new_gameList); + if(new_gameFilter) delete [] new_gameFilter; + if(new_gameFilterNextList) delete [] new_gameFilterNextList; + if(new_gameFilterPrev) delete [] new_gameFilterPrev; + return -1; +} diff --git a/source/usbloader/getentries.h b/source/usbloader/getentries.h index 36909fdd..4a85e7ee 100644 --- a/source/usbloader/getentries.h +++ b/source/usbloader/getentries.h @@ -8,10 +8,24 @@ #ifndef _GETENTRIES_H_ #define _GETENTRIES_H_ +#include + +struct discHdr; +extern discHdr *gameList; +extern u32 gameCnt; +extern wchar_t *gameFilter; +extern wchar_t *gameFilterNextList; +extern wchar_t *gameFilterPrev; + //! param t //! make this 1 if you want the function to ignore the rules //! (settings and parental control) when making the game list. //! -int __Menu_GetEntries(int t=0); +//! param Filter +//! set this Parameter to Filter the List +//! if this Parameter=NULL then the filter is not changed +//! if this Parameter="" then no filter is activ +//! +int __Menu_GetEntries(int t=0, const wchar_t* Filter=NULL); #endif diff --git a/source/wad/wad.cpp b/source/wad/wad.cpp index 15d7dfb1..f9c35069 100644 --- a/source/wad/wad.cpp +++ b/source/wad/wad.cpp @@ -139,7 +139,7 @@ s32 Wad_Install(FILE *fp) if (Settings.wsprompt == yes){ dialogBoxImg.SetWidescreen(CFG.widescreen);} - GuiText btn1Txt(tr("Ok"), 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText btn1Txt(tr("Ok"), 22, THEME.prompttext); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt == yes){ btn1Txt.SetWidescreen(CFG.widescreen); @@ -171,33 +171,33 @@ s32 Wad_Install(FILE *fp) char title[50]; sprintf(title, "%s", tr("Installing wad")); - GuiText titleTxt(title, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText titleTxt(title, 26, THEME.prompttext); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0,40); char msg[50]; sprintf(msg, " "); // sprintf(msg, "%s", tr("Initializing Network")); - GuiText msg1Txt(NULL, 20, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText msg1Txt(NULL, 20, THEME.prompttext); msg1Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); msg1Txt.SetPosition(50,75); // char msg2[50] = " "; - GuiText msg2Txt(NULL, 20, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText msg2Txt(NULL, 20, THEME.prompttext); msg2Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); msg2Txt.SetPosition(50, 98); - GuiText msg3Txt(NULL, 20, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText msg3Txt(NULL, 20, THEME.prompttext); msg3Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); msg3Txt.SetPosition(50, 121); - GuiText msg4Txt(NULL, 20, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText msg4Txt(NULL, 20, THEME.prompttext); msg4Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); msg4Txt.SetPosition(50, 144); - GuiText msg5Txt(NULL, 20, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText msg5Txt(NULL, 20, THEME.prompttext); msg5Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); msg5Txt.SetPosition(50, 167); - GuiText prTxt(NULL, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText prTxt(NULL, 26, THEME.prompttext); prTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); prTxt.SetPosition(0, 50); @@ -236,6 +236,7 @@ s32 Wad_Install(FILE *fp) ///start the wad shit bool fail = false; wadHeader *header = NULL; + void *pvoid; signed_blob *p_certs = NULL, *p_crl = NULL, *p_tik = NULL, *p_tmd = NULL; tmd *tmd_data = NULL; @@ -247,49 +248,51 @@ s32 Wad_Install(FILE *fp) ResumeGui(); msg1Txt.SetText(tr(">> Reading WAD data...")); HaltGui(); +#define SetPointer(a, p) a=(typeof(a))p // WAD header //ret = __Wad_ReadAlloc(fp, (void *)header, offset, sizeof(wadHeader)); - ret = __Wad_ReadAlloc(fp, (void **)&header, offset, sizeof(wadHeader)); + ret = __Wad_ReadAlloc(fp, &pvoid, offset, sizeof(wadHeader)); if (ret < 0) goto err; - else - offset += round_up(header->header_len, 64); + SetPointer(header, pvoid); + offset += round_up(header->header_len, 64); // WAD certificates //ret = __Wad_ReadAlloc(fp, (void *)&p_certs, offset, header->certs_len); - ret = __Wad_ReadAlloc(fp, (void **)&p_certs, offset, header->certs_len); + ret = __Wad_ReadAlloc(fp, &pvoid, offset, header->certs_len); if (ret < 0) goto err; - else - offset += round_up(header->certs_len, 64); + SetPointer(p_certs, pvoid); + offset += round_up(header->certs_len, 64); // WAD crl if (header->crl_len) { //ret = __Wad_ReadAlloc(fp, (void *)&p_crl, offset, header->crl_len); - ret = __Wad_ReadAlloc(fp, (void **)&p_crl, offset, header->crl_len); + ret = __Wad_ReadAlloc(fp, &pvoid, offset, header->crl_len); if (ret < 0) goto err; - else - offset += round_up(header->crl_len, 64); + SetPointer(p_crl, pvoid); + offset += round_up(header->crl_len, 64); } // WAD ticket //ret = __Wad_ReadAlloc(fp, (void *)&p_tik, offset, header->tik_len); - ret = __Wad_ReadAlloc(fp, (void **)&p_tik, offset, header->tik_len); + ret = __Wad_ReadAlloc(fp, &pvoid, offset, header->tik_len); if (ret < 0) goto err; - else - offset += round_up(header->tik_len, 64); + SetPointer(p_tik, pvoid); + offset += round_up(header->tik_len, 64); // WAD TMD //ret = __Wad_ReadAlloc(fp, (void *)&p_tmd, offset, header->tmd_len); - ret = __Wad_ReadAlloc(fp, (void **)&p_tmd, offset, header->tmd_len); + ret = __Wad_ReadAlloc(fp, &pvoid, offset, header->tmd_len); if (ret < 0) goto err; - else - offset += round_up(header->tmd_len, 64); + SetPointer(p_tmd, pvoid); + offset += round_up(header->tmd_len, 64); + ResumeGui(); msg1Txt.SetText(tr("Reading WAD data... Ok!")); msg2Txt.SetText(tr(">> Installing ticket...")); @@ -465,7 +468,7 @@ s32 Wad_Uninstall(FILE *fp) if (Settings.wsprompt == yes){ dialogBoxImg.SetWidescreen(CFG.widescreen);} - GuiText btn1Txt(tr("Ok"), 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText btn1Txt(tr("Ok"), 22, THEME.prompttext); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt == yes){ btn1Txt.SetWidescreen(CFG.widescreen); @@ -476,27 +479,27 @@ s32 Wad_Uninstall(FILE *fp) char title[50]; sprintf(title, "%s", tr("Uninstalling wad")); - GuiText titleTxt(title, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText titleTxt(title, 26, THEME.prompttext); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0,40); - GuiText msg1Txt(NULL, 18, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText msg1Txt(NULL, 18, THEME.prompttext); msg1Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); msg1Txt.SetPosition(50,75); - GuiText msg2Txt(NULL, 18, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText msg2Txt(NULL, 18, THEME.prompttext); msg2Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); msg2Txt.SetPosition(50, 98); - GuiText msg3Txt(NULL, 18, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText msg3Txt(NULL, 18, THEME.prompttext); msg3Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); msg3Txt.SetPosition(50, 121); - GuiText msg4Txt(NULL, 18, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText msg4Txt(NULL, 18, THEME.prompttext); msg4Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); msg4Txt.SetPosition(50, 144); - GuiText msg5Txt(NULL, 18, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText msg5Txt(NULL, 18, THEME.prompttext); msg5Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); msg5Txt.SetPosition(50, 167); @@ -527,7 +530,8 @@ s32 Wad_Uninstall(FILE *fp) //sleep(3); ///start the wad shit - wadHeader *header = NULL; + wadHeader *header = NULL; + void *pvoid = NULL; tikview *viewData = NULL; u64 tid; @@ -537,7 +541,7 @@ s32 Wad_Uninstall(FILE *fp) msg1Txt.SetText(tr(">> Reading WAD data...")); // WAD header - ret = __Wad_ReadAlloc(fp, (void **)&header, 0, sizeof(wadHeader)); + ret = __Wad_ReadAlloc(fp, &pvoid, 0, sizeof(wadHeader)); if (ret < 0) { char errTxt[50]; sprintf(errTxt,"%sret = %d",tr(">> Reading WAD data...ERROR! "),ret); @@ -545,6 +549,7 @@ s32 Wad_Uninstall(FILE *fp) //printf(" ERROR! (ret = %d)\n", ret); goto out; } + SetPointer(header, pvoid); // Get title ID ret = __Wad_GetTitleID(fp, header, &tid);