diff --git a/HBC/META.XML b/HBC/META.XML index d72cf3e2..2d3979c0 100644 --- a/HBC/META.XML +++ b/HBC/META.XML @@ -2,8 +2,8 @@ USB Loader GX USB Loader GX Team - 2.1 r1093 - 201106221731 + 2.1 r1094 + 201106221757 Loads games from USB-devices USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times. diff --git a/Languages/czech.lang b/Languages/czech.lang index 573e2102..a14f7c3b 100644 --- a/Languages/czech.lang +++ b/Languages/czech.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-22 19:31+0200\n" +"POT-Creation-Date: 2011-06-24 21:05+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: David Jelinek (djelinek@hotmail.com) e->e,r->r,u->u, c->c \n" "Language-Team: r1056 - last version on http://djelinek.sweb.cz/_USBLoderGX/czech.lang \n" @@ -198,6 +198,9 @@ msgstr "Hudba na pozadí" msgid "Big thanks to:" msgstr "Velké díky pro:" +msgid "Block Categories Menu" +msgstr "" + msgid "Block Categories Modify" msgstr "" diff --git a/Languages/danish.lang b/Languages/danish.lang index bb5c0643..3939b160 100644 --- a/Languages/danish.lang +++ b/Languages/danish.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-22 19:31+0200\n" +"POT-Creation-Date: 2011-06-24 21:05+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: Fox888[dk]\n" "Language-Team: [dk]\n" @@ -198,6 +198,9 @@ msgstr "Baggrundsmusik" msgid "Big thanks to:" msgstr "En stor tak til:" +msgid "Block Categories Menu" +msgstr "" + msgid "Block Categories Modify" msgstr "" diff --git a/Languages/dutch.lang b/Languages/dutch.lang index 7a385944..2882cd20 100644 --- a/Languages/dutch.lang +++ b/Languages/dutch.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-22 19:31+0200\n" +"POT-Creation-Date: 2011-06-24 21:05+0200\n" "PO-Revision-Date: 2011-06-20 07:25+0100\n" "Last-Translator: glowy\n" "Language-Team: tj_cool, glowy\n" @@ -198,6 +198,9 @@ msgstr "Achtergrondmuziek" msgid "Big thanks to:" msgstr "Grote dank aan:" +msgid "Block Categories Menu" +msgstr "" + msgid "Block Categories Modify" msgstr "Blokkeer categorieën wijzigen" diff --git a/Languages/english.lang b/Languages/english.lang index 12d6d1e1..8615bfc5 100644 --- a/Languages/english.lang +++ b/Languages/english.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-22 19:31+0200\n" +"POT-Creation-Date: 2011-06-24 21:05+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -198,6 +198,9 @@ msgstr "" msgid "Big thanks to:" msgstr "" +msgid "Block Categories Menu" +msgstr "" + msgid "Block Categories Modify" msgstr "" diff --git a/Languages/finnish.lang b/Languages/finnish.lang index 8e974cad..96fa8ac7 100644 --- a/Languages/finnish.lang +++ b/Languages/finnish.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-22 19:31+0200\n" +"POT-Creation-Date: 2011-06-24 21:05+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: c64rmx\n" "Language-Team: \n" @@ -198,6 +198,9 @@ msgstr "Taustamusiikki" msgid "Big thanks to:" msgstr "Isot kiitokset:" +msgid "Block Categories Menu" +msgstr "" + msgid "Block Categories Modify" msgstr "" diff --git a/Languages/french.lang b/Languages/french.lang index 731b7df2..4b6ef224 100644 --- a/Languages/french.lang +++ b/Languages/french.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-22 19:31+0200\n" +"POT-Creation-Date: 2011-06-24 21:05+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: Kin8\n" "Language-Team: Badablek, Amour, ikya, Cyan & Kin8\n" @@ -198,6 +198,9 @@ msgstr "Fond sonore" msgid "Big thanks to:" msgstr "Grand merci à:" +msgid "Block Categories Menu" +msgstr "" + msgid "Block Categories Modify" msgstr "Bloquer modif. catégories" diff --git a/Languages/german.lang b/Languages/german.lang index a0d127ba..bfa2e401 100644 --- a/Languages/german.lang +++ b/Languages/german.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-22 19:31+0200\n" +"POT-Creation-Date: 2011-06-24 21:05+0200\n" "PO-Revision-Date: 2010-07-03 17:35-0800\n" "Last-Translator: TheRealVisitor\n" "Language-Team: Bertilax, Snoozer, wishmasterf, ZEN.13, TheRealVisitor\n" @@ -198,6 +198,9 @@ msgstr "Hintergrundmusik" msgid "Big thanks to:" msgstr "Großen Dank an:" +msgid "Block Categories Menu" +msgstr "" + msgid "Block Categories Modify" msgstr "Sperre Kategorieänderung" diff --git a/Languages/hungarian.lang b/Languages/hungarian.lang index a6404389..1cefb544 100644 --- a/Languages/hungarian.lang +++ b/Languages/hungarian.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-22 19:31+0200\n" +"POT-Creation-Date: 2011-06-24 21:05+0200\n" "PO-Revision-Date: 2009-12-29 11:05+0100\n" "Last-Translator: Springdale\n" "Language-Team: Tusk, Springdale\n" @@ -198,6 +198,9 @@ msgstr "Háttérzene" msgid "Big thanks to:" msgstr "Köszönet:" +msgid "Block Categories Menu" +msgstr "" + msgid "Block Categories Modify" msgstr "" diff --git a/Languages/italian.lang b/Languages/italian.lang index f7842fe2..67a9de3f 100644 --- a/Languages/italian.lang +++ b/Languages/italian.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-22 19:31+0200\n" +"POT-Creation-Date: 2011-06-24 21:05+0200\n" "PO-Revision-Date: 2011-03-10 21:00+0200\n" "Last-Translator: Cambo \n" "Language-Team: Cambo\n" @@ -198,6 +198,9 @@ msgstr "Musica Sottofondo" msgid "Big thanks to:" msgstr "Grazie mille a:" +msgid "Block Categories Menu" +msgstr "" + msgid "Block Categories Modify" msgstr "" diff --git a/Languages/japanese.lang b/Languages/japanese.lang index 849dcec3..23d3f5f9 100644 --- a/Languages/japanese.lang +++ b/Languages/japanese.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-22 19:31+0200\n" +"POT-Creation-Date: 2011-06-24 21:05+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: hosigumayuugi\n" "Language-Team: hosigumayuugi, papa, ichiroling\n" @@ -198,6 +198,9 @@ msgstr "BGM" msgid "Big thanks to:" msgstr "協力:" +msgid "Block Categories Menu" +msgstr "" + msgid "Block Categories Modify" msgstr "カテゴリの編集を制限" diff --git a/Languages/korean.lang b/Languages/korean.lang index adfca39c..ad647dd4 100644 --- a/Languages/korean.lang +++ b/Languages/korean.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-22 19:31+0200\n" +"POT-Creation-Date: 2011-06-24 21:05+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: nextos@korea.com\n" "Language-Team: \n" @@ -198,6 +198,9 @@ msgstr "배경음악" msgid "Big thanks to:" msgstr "감사 :" +msgid "Block Categories Menu" +msgstr "" + msgid "Block Categories Modify" msgstr "" diff --git a/Languages/norwegian.lang b/Languages/norwegian.lang index c0a00053..68b05eb2 100644 --- a/Languages/norwegian.lang +++ b/Languages/norwegian.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-22 19:31+0200\n" +"POT-Creation-Date: 2011-06-24 21:05+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: raschi\n" "Language-Team: raschi\n" @@ -198,6 +198,9 @@ msgstr "Bakgrunnsmusikk" msgid "Big thanks to:" msgstr "Stor takk til:" +msgid "Block Categories Menu" +msgstr "" + msgid "Block Categories Modify" msgstr "" diff --git a/Languages/polish.lang b/Languages/polish.lang index 483f17a1..ca2857d0 100644 --- a/Languages/polish.lang +++ b/Languages/polish.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-22 19:31+0200\n" +"POT-Creation-Date: 2011-06-24 21:05+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: ziom666 (zadania_prog@vp.pl)\n" "Language-Team: \n" @@ -198,6 +198,9 @@ msgstr "Muzyka w tle" msgid "Big thanks to:" msgstr "Podziekowania dla" +msgid "Block Categories Menu" +msgstr "" + msgid "Block Categories Modify" msgstr "" diff --git a/Languages/portuguese_br.lang b/Languages/portuguese_br.lang index d571f3d2..4e866f40 100644 --- a/Languages/portuguese_br.lang +++ b/Languages/portuguese_br.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-22 19:31+0200\n" +"POT-Creation-Date: 2011-06-24 21:05+0200\n" "PO-Revision-Date: 2009-10-23 18:52+0200\n" "Last-Translator: aniemotion\n" "Language-Team: boto12, aniemotion\n" @@ -198,6 +198,9 @@ msgstr "Música de fundo" msgid "Big thanks to:" msgstr "Agradecimentos:" +msgid "Block Categories Menu" +msgstr "" + msgid "Block Categories Modify" msgstr "" diff --git a/Languages/portuguese_pt.lang b/Languages/portuguese_pt.lang index e66cf985..5ea959ba 100644 --- a/Languages/portuguese_pt.lang +++ b/Languages/portuguese_pt.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-22 19:31+0200\n" +"POT-Creation-Date: 2011-06-24 21:05+0200\n" "PO-Revision-Date: 2011-06-14 00:00-0000\n" "Last-Translator: pplucky \n" "Language-Team: Sky8000, pplucky\n" @@ -198,6 +198,9 @@ msgstr "Música de fundo" msgid "Big thanks to:" msgstr "Agradecimentos:" +msgid "Block Categories Menu" +msgstr "" + msgid "Block Categories Modify" msgstr "Bloquear Modif. Categorias" diff --git a/Languages/russian.lang b/Languages/russian.lang index 004758f9..c8a90803 100644 --- a/Languages/russian.lang +++ b/Languages/russian.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-22 19:31+0200\n" +"POT-Creation-Date: 2011-06-24 21:05+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: nikolai_ca\n" "Language-Team: Kir, alendit, nikolai_ca\n" @@ -198,6 +198,9 @@ msgstr "Фоновая музыка" msgid "Big thanks to:" msgstr "Большое спасибо:" +msgid "Block Categories Menu" +msgstr "" + msgid "Block Categories Modify" msgstr "" diff --git a/Languages/schinese.lang b/Languages/schinese.lang index f48ea0cc..86163da7 100644 --- a/Languages/schinese.lang +++ b/Languages/schinese.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-22 19:31+0200\n" +"POT-Creation-Date: 2011-06-24 21:05+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: knife.hu kavid emul8ion\n" "Language-Team: kavid\n" @@ -198,6 +198,9 @@ msgstr "背景音乐" msgid "Big thanks to:" msgstr "非常感谢:" +msgid "Block Categories Menu" +msgstr "" + msgid "Block Categories Modify" msgstr "" diff --git a/Languages/spanish.lang b/Languages/spanish.lang index a12159e9..e8838fbf 100644 --- a/Languages/spanish.lang +++ b/Languages/spanish.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-22 19:31+0200\n" +"POT-Creation-Date: 2011-06-24 21:05+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: SirPalax\n" "Language-Team: Penn, SirPalax\n" @@ -198,6 +198,9 @@ msgstr "Música de fondo" msgid "Big thanks to:" msgstr "Gracias a:" +msgid "Block Categories Menu" +msgstr "" + msgid "Block Categories Modify" msgstr "" diff --git a/Languages/swedish.lang b/Languages/swedish.lang index f105cc51..2ca4780a 100644 --- a/Languages/swedish.lang +++ b/Languages/swedish.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-22 19:31+0200\n" +"POT-Creation-Date: 2011-06-24 21:05+0200\n" "PO-Revision-Date: 2010-01-19 17:39+0200\n" "Last-Translator: Katsurou\n" "Language-Team: Katsurou, pirateX\n" @@ -198,6 +198,9 @@ msgstr "Bakgrundsmusik" msgid "Big thanks to:" msgstr "Stort tack till:" +msgid "Block Categories Menu" +msgstr "" + msgid "Block Categories Modify" msgstr "" diff --git a/Languages/tchinese.lang b/Languages/tchinese.lang index 00489788..081cf2eb 100644 --- a/Languages/tchinese.lang +++ b/Languages/tchinese.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-22 19:31+0200\n" +"POT-Creation-Date: 2011-06-24 21:05+0200\n" "PO-Revision-Date: 2010-02-15 21:00+0800\n" "Last-Translator: Jane.H\n" "Language-Team: kyogc, Miller, Mika Li, Jane.H\n" @@ -198,6 +198,9 @@ msgstr "背景音樂" msgid "Big thanks to:" msgstr "非常感謝:" +msgid "Block Categories Menu" +msgstr "" + msgid "Block Categories Modify" msgstr "" diff --git a/Languages/thai.lang b/Languages/thai.lang index c493813d..f433edc7 100644 --- a/Languages/thai.lang +++ b/Languages/thai.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-22 19:31+0200\n" +"POT-Creation-Date: 2011-06-24 21:05+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: Nitro_subzero \n" "Language-Team: Nitro_subzero\n" @@ -198,6 +198,9 @@ msgstr "ดนตรีเบื้องหลัง" msgid "Big thanks to:" msgstr "ขอขอบคุณ:" +msgid "Block Categories Menu" +msgstr "" + msgid "Block Categories Modify" msgstr "" diff --git a/Languages/turkish.lang b/Languages/turkish.lang index 4254692e..dc110b98 100644 --- a/Languages/turkish.lang +++ b/Languages/turkish.lang @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-22 19:31+0200\n" +"POT-Creation-Date: 2011-06-24 21:05+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "Last-Translator: omercigingelini\n" "Language-Team: omercigingelini\n" @@ -198,6 +198,9 @@ msgstr "Arkaplan müziği" msgid "Big thanks to:" msgstr "Teşekkürler:" +msgid "Block Categories Menu" +msgstr "" + msgid "Block Categories Modify" msgstr "" diff --git a/Themes/Default.them b/Themes/Default.them index 1b0c6993..d8b5f18a 100644 --- a/Themes/Default.them +++ b/Themes/Default.them @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-14 20:50+0200\n" +"POT-Creation-Date: 2011-06-24 21:05+0200\n" "PO-Revision-Date: 2009-10-01 01:00+0200\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" @@ -34,27 +34,6 @@ msgstr "" msgid "r=0 g=0 b=0 a=255 - checkbox browser text color" msgstr "" -msgid "9 - game list browser page size" -msgstr "" - -msgid "right - game browser scrollbar align hor" -msgstr "" - -msgid "top - game browser scrollbar align ver" -msgstr "" - -msgid "0 - game browser scrollbar pos x" -msgstr "" - -msgid "5 - game browser scrollbar pos y" -msgstr "" - -msgid "r=0 g=0 b=0 a=255 - game browser list text color" -msgstr "" - -msgid "r=0 g=0 b=0 a=255 - game browser list text color over" -msgstr "" - msgid "left - carousel layout left arrow align hor" msgstr "" @@ -91,6 +70,27 @@ msgstr "" msgid "255 - tooltip alpha" msgstr "" +msgid "9 - game list browser page size" +msgstr "" + +msgid "right - game browser scrollbar align hor" +msgstr "" + +msgid "top - game browser scrollbar align ver" +msgstr "" + +msgid "0 - game browser scrollbar pos x" +msgstr "" + +msgid "5 - game browser scrollbar pos y" +msgstr "" + +msgid "r=0 g=0 b=0 a=255 - game browser list text color" +msgstr "" + +msgid "r=0 g=0 b=0 a=255 - game browser list text color over" +msgstr "" + msgid "right - options browser scrollbar align hor" msgstr "" diff --git a/source/BoxCover/BoxCover.hpp b/source/BoxCover/BoxCover.hpp index bfe9564d..4fb3d9f0 100644 --- a/source/BoxCover/BoxCover.hpp +++ b/source/BoxCover/BoxCover.hpp @@ -34,7 +34,7 @@ class BoxCover : public GuiImage { public: BoxCover(GuiImageData * img, bool flat = false); - ~BoxCover(); + virtual ~BoxCover(); //! Colors: //! Gray Box (Default): r:233 g:233 b:233 //! Red Box (NSMB): r:198 g:34 b:4 diff --git a/source/FileOperations/fileops.cpp b/source/FileOperations/fileops.cpp index 4342bef7..50211770 100644 --- a/source/FileOperations/fileops.cpp +++ b/source/FileOperations/fileops.cpp @@ -360,23 +360,6 @@ extern "C" int CopyFile(const char * src, const char * dest) return 1; } -/**************************************************************************** -* ClearList -* -* Clearing a vector list -****************************************************************************/ -static inline void ClearList(std::vector &List) -{ - for(u32 i = 0; i < List.size(); ++i) - { - if(List[i]) - free(List[i]); - List[i] = NULL; - } - List.clear(); - std::vector().swap(List); -} - /**************************************************************************** * MoveFile * diff --git a/source/GUI/Text.hpp b/source/GUI/Text.hpp index bba86efc..f6115f91 100644 --- a/source/GUI/Text.hpp +++ b/source/GUI/Text.hpp @@ -20,7 +20,7 @@ class Text: public GuiText //!\param c Font color Text(const char * t, int s, GXColor c); Text(const wchar_t * t, int s, GXColor c); - ~Text(); + virtual ~Text(); //!Sets the text of the GuiText element //!\param t Text void SetText(const char * t); diff --git a/source/GUI/gui.h b/source/GUI/gui.h index 725ee663..d7f8e38a 100644 --- a/source/GUI/gui.h +++ b/source/GUI/gui.h @@ -126,7 +126,7 @@ class GuiTrigger //!Constructor GuiTrigger(); //!Destructor - ~GuiTrigger(); + virtual ~GuiTrigger(); //!Sets a simple trigger. Requires: element is selected, and trigger button is pressed //!\param ch Controller channel number //!\param wiibtns Wii controller trigger button(s) - classic controller buttons are considered separately @@ -180,7 +180,7 @@ class GuiElement //!Constructor GuiElement(); //!Destructor - ~GuiElement(); + virtual ~GuiElement(); //!Set the element's parent //!\param e Pointer to parent element void SetParent(GuiElement * e); @@ -451,7 +451,7 @@ class GuiWindow: public GuiElement //!\param h Height of window GuiWindow(int w, int h); //!Destructor - ~GuiWindow(); + virtual ~GuiWindow(); //!Appends a GuiElement to the GuiWindow //!\param e The GuiElement to append. If it is already in the GuiWindow, it is removed first void Append(GuiElement* e); @@ -544,7 +544,7 @@ class GuiImage: public GuiElement //! = operator for copying images GuiImage &operator=(GuiImage &srcimage); //!Destructor - ~GuiImage(); + virtual ~GuiImage(); //!Sets the image rotation angle for drawing //!\param a Angle (in degrees) void SetAngle(float a); @@ -638,7 +638,7 @@ class GuiText: public GuiElement //!\param t Text GuiText(const char * t); //!Destructor - ~GuiText(); + virtual ~GuiText(); //!Sets the text of the GuiText element //!\param t Text virtual void SetText(const char * t); @@ -740,7 +740,7 @@ class GuiTooltip: public GuiElement GuiTooltip(const char *t, int Alpha = 255); //!Destructor - ~ GuiTooltip(); + virtual ~GuiTooltip(); //!Gets the element's current scale //!Considers scale, scaleDyn, and the parent element's GetScale() value @@ -790,7 +790,7 @@ class GuiButton: public GuiElement GuiSound* sndOver, GuiSound* sndClick, u8 grow, GuiTooltip* tt, int ttx, int tty, int h_align, int v_align); //!Destructor - ~GuiButton(); + virtual ~GuiButton(); //!Sets the button's image //!\param i Pointer to GuiImage object void SetImage(GuiImage* i); @@ -894,7 +894,7 @@ class GuiKeyboard: public GuiWindow { public: GuiKeyboard(char * t, u32 m, int min, int lang); - ~GuiKeyboard(); + virtual ~GuiKeyboard(); void Update(GuiTrigger * t); char kbtextstr[256]; protected: @@ -951,7 +951,7 @@ class GuiNumpad: public GuiWindow { public: GuiNumpad(char * t, u32 max); - ~GuiNumpad(); + virtual ~GuiNumpad(); void Update(GuiTrigger * t); char kbtextstr[256]; protected: diff --git a/source/GUI/gui_checkboxbrowser.hpp b/source/GUI/gui_checkboxbrowser.hpp index 028d7c9d..1e1baa6f 100644 --- a/source/GUI/gui_checkboxbrowser.hpp +++ b/source/GUI/gui_checkboxbrowser.hpp @@ -35,7 +35,7 @@ class GuiCheckboxBrowser : public GuiElement, public sigslot::has_slots<> { public: GuiCheckboxBrowser(int w, int h, int maxSize = 7); - ~GuiCheckboxBrowser(); + virtual ~GuiCheckboxBrowser(); bool AddEntrie(const string &text, bool checked = false); int GetSelected() const { return pageIndex+selectedItem; }; void SetImage(GuiImage *Img); diff --git a/source/GUI/gui_diskcover.cpp b/source/GUI/gui_diskcover.cpp index bbeb19bd..cc8ea1fa 100644 --- a/source/GUI/gui_diskcover.cpp +++ b/source/GUI/gui_diskcover.cpp @@ -68,15 +68,13 @@ void GuiDiskCover::SetState(int s, int c) void Menu_DrawDiskCover(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16 distance, u8 data[], f32 deg_alpha, f32 deg_beta, f32 scaleX, f32 scaleY, u8 alpha, bool shadow); -void Menu_DrawDiskCoverShadow(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16 distance, u8 data[], - f32 deg_alpha, f32 deg_beta, f32 scaleX, f32 scaleY, u8 alpha, bool shadow); void GuiDiskCover::Draw() { LOCK( this ); if (!image || !this->IsVisible()) return; float currScale = this->GetScale(); - + Menu_DrawDiskCover(this->GetLeft(), this->GetTop(), PosZ, width, height, Distance, image, imageangle, deg_beta, widescreen ? currScale * Settings.WSFactor : currScale, currScale, 64, true); Menu_DrawDiskCover(this->GetLeft(), this->GetTop(), PosZ, width, height, Distance, image, imageangle, deg_beta, diff --git a/source/GUI/gui_diskcover.h b/source/GUI/gui_diskcover.h index 083ba580..4bbc75a7 100644 --- a/source/GUI/gui_diskcover.h +++ b/source/GUI/gui_diskcover.h @@ -8,7 +8,7 @@ class GuiDiskCover: public GuiImage public: GuiDiskCover(); GuiDiskCover(GuiImageData * img); - ~GuiDiskCover(); + virtual ~GuiDiskCover(); void SetBeta(f32 beta); void SetBetaRotateEffect(f32 beta, u16 Step); bool GetBetaRotateEffect(); diff --git a/source/GUI/gui_element.cpp b/source/GUI/gui_element.cpp index f6252b3e..152f1ffd 100644 --- a/source/GUI/gui_element.cpp +++ b/source/GUI/gui_element.cpp @@ -471,7 +471,7 @@ void GuiElement::SetEffect(int eff, int speed, f32 circles, int r, f32 startdegr xoffsetDyn = 0; //!position of circle in x yoffsetDyn = 0; //!position of circle in y Radius = r; //!radius of the circle - degree = startdegree; //!for example -90 () to start at top of circle + degree = startdegree; //!for example -90 (�) to start at top of circle circleamount = circles; //!circleamoutn in degrees for example 360 for 1 circle angleDyn = 0.0f; //!this is used by the code to calc the angle anglespeed = anglespeedset; //!This is anglespeed depending on circle speed 1 is same speed and 0.5 half speed @@ -497,11 +497,11 @@ void GuiElement::SetEffect(int eff, int amount, int target) else if (eff & EFFECT_SLIDE_RIGHT) xoffsetDyn = screenwidth; } - if (eff & EFFECT_FADE && amount > 0) + if ((eff & EFFECT_FADE) && amount > 0) { alphaDyn = 0; } - else if (eff & EFFECT_FADE && amount < 0) + else if ((eff & EFFECT_FADE) && amount < 0) { alphaDyn = alpha; @@ -814,7 +814,7 @@ void GuiElement::UnlockElement() // LWP_MutexUnlock(mutex); LWP_MutexLock(_lock_mutex); // only the thread was locked this element, can call unlock - if (_lock_thread == LWP_GetSelf()) // but we check it here safe is safe + if (_lock_thread == LWP_GetSelf()) // but we check it here � safe is safe { if (--_lock_count == 0) // dec count of locks and check if it last lock; { diff --git a/source/GUI/gui_filebrowser.h b/source/GUI/gui_filebrowser.h index a4458813..03e18682 100644 --- a/source/GUI/gui_filebrowser.h +++ b/source/GUI/gui_filebrowser.h @@ -9,7 +9,7 @@ class GuiFileBrowser: public GuiElement, public sigslot::has_slots<> { public: GuiFileBrowser(int w, int h); - ~GuiFileBrowser(); + virtual ~GuiFileBrowser(); void DisableTriggerUpdate(bool set); void ResetState(); void SetFocus(int f); diff --git a/source/GUI/gui_gamebrowser.h b/source/GUI/gui_gamebrowser.h index 55b16a23..e3cb0043 100644 --- a/source/GUI/gui_gamebrowser.h +++ b/source/GUI/gui_gamebrowser.h @@ -1,47 +1,41 @@ -#ifndef _GUIGAMEBROWSER_H_ -#define _GUIGAMEBROWSER_H_ + /**************************************************************************** + * Copyright (C) 2011 + * by Dimok + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any + * damages arising from the use of this software. + * + * Permission is granted to anyone to use this software for any + * purpose, including commercial applications, and to alter it and + * redistribute it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you + * must not claim that you wrote the original software. If you use + * this software in a product, an acknowledgment in the product + * documentation would be appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and + * must not be misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + ***************************************************************************/ +#ifndef GUIGAMEBROWSER_H_ +#define GUIGAMEBROWSER_H_ #include "gui.h" -#include "gui_scrollbar.hpp" -#include "usbloader/disc.h" -class GuiGameBrowser: public GuiElement, public sigslot::has_slots<> +class GuiGameBrowser : public GuiElement { - public: - GuiGameBrowser(int w, int h, int selectedGame = 0); - ~GuiGameBrowser(); - int FindMenuItem(int c, int d); - int GetClickedOption(); - int GetSelectedOption() { return listOffset+selectedItem; } - void ResetState(); - void SetFocus(int f); - void Draw(); - void Update(GuiTrigger * t); - int GetOffset(); - protected: - void onListChange(int SelItem, int SelInd); - void UpdateListEntries(); - int selectedItem; - int listOffset; - int scrollbaron; - int pagesize; - int maxTextWidth; - - int * gameIndex; - GuiButton ** game; - GuiText ** gameTxt; - GuiText ** gameTxtOver; - GuiImage ** gameBg; - GuiImage ** newImg; - - GuiImage * bgGameImg; - - GuiImageData * bgGames; - GuiImageData * bgGamesEntry; - GuiImageData * newGames; - - GuiTrigger * trigA; - - GuiScrollbar scrollBar; + public: + GuiGameBrowser() {}; + virtual ~GuiGameBrowser() {}; + virtual int GetClickedOption() { return 0; }; + virtual int GetSelectedOption() { return 0; }; + virtual void SetSelectedOption(int ind) {}; + virtual void setListOffset(int off) {} + virtual int getListOffset() const { return 0; } }; -#endif + +#endif /* GUIGAMEBROWSER_H_ */ diff --git a/source/GUI/gui_gamecarousel.cpp b/source/GUI/gui_gamecarousel.cpp index 86841ca8..de2870c1 100644 --- a/source/GUI/gui_gamecarousel.cpp +++ b/source/GUI/gui_gamecarousel.cpp @@ -18,6 +18,7 @@ #include "settings/CSettings.h" #include "GUI/LoadCoverImage.h" #include "themes/CTheme.h" +#include "utils/tools.h" #include "main.h" #include @@ -46,13 +47,13 @@ static GuiImageData *GameCarouselLoadCoverImage(void * Arg) /** * Constructor for the GuiGameCarousel class. */ -GuiGameCarousel::GuiGameCarousel(int w, int h, const char *themePath, int selectedGame) : +GuiGameCarousel::GuiGameCarousel(int w, int h, const char *themePath, int offset) : noCover(Resources::GetFile("nocover.png"), Resources::GetFileSize("nocover.png")) { width = w; height = h; pagesize = (gameList.size() < 11) ? gameList.size() : 11; - listOffset = (gameList.size() < 11) ? 0 : gameList.size()-2; + listOffset = (gameList.size() < 11) ? MIN(offset, gameList.size()-1) : MIN(offset, gameList.size())-2; selectable = true; selectedItem = -1; focus = 1; // allow focus @@ -110,37 +111,7 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, const char *themePath, int select game.resize(pagesize); coverImg.resize(pagesize); - for (int i = 0; i < pagesize; i++) - { - //------------------------ - // Index - //------------------------ - gameIndex[i] = GetGameIndex( i, listOffset, gameList.size() ); - - //------------------------ - // Image - //------------------------ - coverImg[i] = new (std::nothrow) GuiImageAsync(GameCarouselLoadCoverImage, gameList[gameIndex[i]], - sizeof(struct discHdr), &noCover); - if (coverImg[i]) coverImg[i]->SetWidescreen(Settings.widescreen); - - //------------------------ - // GameButton - //------------------------ - - 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(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); - } + Refresh(); } /** @@ -173,6 +144,65 @@ GuiGameCarousel::~GuiGameCarousel() } +void GuiGameCarousel::setListOffset(int off) +{ + LOCK( this ); + if(gameList.size() < 11) + listOffset = MIN(off, gameList.size()-1); + else + listOffset = MIN(off, gameList.size()) - 2; + + Refresh(); +} + +int GuiGameCarousel::getListOffset() const +{ + if(gameList.size() < 11) + return listOffset; + else + return (listOffset + 2) % gameList.size(); +} + +void GuiGameCarousel::SetSelectedOption(int ind) +{ + LOCK(this); + selectedItem = LIMIT(ind, 0, MIN(pagesize, MAX(0, gameList.size()-1))); +} + +void GuiGameCarousel::Refresh() +{ + for (int i = 0; i < pagesize; i++) + { + //------------------------ + // Index + //------------------------ + gameIndex[i] = GetGameIndex( i, listOffset, gameList.size() ); + + //------------------------ + // Image + //------------------------ + delete coverImg[i]; + coverImg[i] = new (std::nothrow) GuiImageAsync(GameCarouselLoadCoverImage, gameList[gameIndex[i]], sizeof(struct discHdr), &noCover); + if (coverImg[i]) coverImg[i]->SetWidescreen(Settings.widescreen); + + //------------------------ + // GameButton + //------------------------ + delete game[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(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); + } +} + void GuiGameCarousel::SetFocus(int f) { LOCK( this ); @@ -201,12 +231,6 @@ void GuiGameCarousel::ResetState() } } -int GuiGameCarousel::GetOffset() -{ - LOCK( this ); - return listOffset; -} - int GuiGameCarousel::GetClickedOption() { LOCK( this ); @@ -273,7 +297,7 @@ void GuiGameCarousel::Update(GuiTrigger * t) btnRight->Update(t); btnLeft->Update(t); - if (game[0]->GetEffect() & EFFECT_GOROUND || game[pagesize - 1]->GetEffect() & EFFECT_GOROUND) + if ((game[0]->GetEffect() & EFFECT_GOROUND) || (game[pagesize - 1]->GetEffect() & EFFECT_GOROUND)) { return; // skip when rotate } diff --git a/source/GUI/gui_gamecarousel.h b/source/GUI/gui_gamecarousel.h index dc245e93..43029bb4 100644 --- a/source/GUI/gui_gamecarousel.h +++ b/source/GUI/gui_gamecarousel.h @@ -2,24 +2,26 @@ #define _GUIGAMECAROUSEL_H_ #include -#include "gui.h" +#include "gui_gamebrowser.h" +#include "gui_image_async.h" #include "usbloader/disc.h" -class GuiImageAsync; -class GuiGameCarousel: public GuiElement + +class GuiGameCarousel : public GuiGameBrowser { public: - GuiGameCarousel(int w, int h, const char *themePath, int selectedGame = 0); - ~GuiGameCarousel(); + GuiGameCarousel(int w, int h, const char *themePath, int listOffset = 0); + virtual ~GuiGameCarousel(); int FindMenuItem(int c, int d); int GetClickedOption(); int GetSelectedOption(); + void SetSelectedOption(int ind); + void setListOffset(int off); + int getListOffset() const; + void Refresh(); void ResetState(); void SetFocus(int f); void Draw(); void Update(GuiTrigger * t); - int GetOffset(); - void Reload(); - //GuiText * optionVal[PAGESIZE]; protected: GuiImageData noCover; int selectedItem; diff --git a/source/GUI/gui_gamegrid.cpp b/source/GUI/gui_gamegrid.cpp index e09ad966..0f445131 100644 --- a/source/GUI/gui_gamegrid.cpp +++ b/source/GUI/gui_gamegrid.cpp @@ -19,6 +19,7 @@ #include "themes/CTheme.h" #include "prompts/PromptWindows.h" #include "language/gettext.h" +#include "utils/tools.h" #include "menu.h" #include @@ -35,8 +36,6 @@ #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 } }; @@ -201,11 +200,12 @@ static GuiImageData *GameGridLoadCoverImage(void * Arg) /** * Constructor for the GuiGamegrid class. */ -GuiGameGrid::GuiGameGrid(int w, int h, const char *themePath, int selectedGame) : +GuiGameGrid::GuiGameGrid(int w, int h, const char *themePath, int offset) : noCover(Resources::GetFile("nocoverFlat.png"), Resources::GetFileSize("nocoverFlat.png")) { width = w; height = h; + listOffset = MIN(offset, gameList.size()-1); theme_posX = thInt("0 - game grid layout pos x"); theme_posY = thInt("20 - game grid layout pos y"); @@ -264,7 +264,7 @@ GuiGameGrid::GuiGameGrid(int w, int h, const char *themePath, int selectedGame) // Page-Stuff gameIndex = NULL; - Reload(Settings.gridRows, 0); + Reload(Settings.gridRows, listOffset); } /** @@ -332,12 +332,6 @@ void GuiGameGrid::ResetState() } } -int GuiGameGrid::GetOffset() -{ - LOCK( this ); - return listOffset; -} - int GuiGameGrid::GetClickedOption() { LOCK( this ); @@ -367,6 +361,12 @@ int GuiGameGrid::GetSelectedOption() return found; } +void GuiGameGrid::SetSelectedOption(int ind) +{ + LOCK(this); + selectedItem = LIMIT(ind, 0, MIN(pagesize, MAX(0, gameList.size()-1))); +} + /** * Draw the button on screen */ diff --git a/source/GUI/gui_gamegrid.h b/source/GUI/gui_gamegrid.h index e44d7f92..a4671295 100644 --- a/source/GUI/gui_gamegrid.h +++ b/source/GUI/gui_gamegrid.h @@ -2,23 +2,25 @@ #define _GUIGAMEGRID_H_ #include -#include "gui.h" +#include "gui_gamebrowser.h" +#include "gui_image_async.h" #include "usbloader/disc.h" -class GuiImageAsync; -class GuiGameGrid: public GuiElement +class GuiGameGrid : public GuiGameBrowser { public: GuiGameGrid(int w, int h, const char *themePath, int selectedGame = 0); - ~GuiGameGrid(); + virtual ~GuiGameGrid(); int FindMenuItem(int c, int d); int GetClickedOption(); int GetSelectedOption(); + void SetSelectedOption(int ind); + void setListOffset(int off) { listOffset = off; Reload(rows, listOffset); } + int getListOffset() const { return listOffset; } void ResetState(); void SetFocus(int f); void Draw(); void Update(GuiTrigger * t); - int GetOffset(); void Reload(int Rows, int ListOffset); void ChangeRows(int n); protected: diff --git a/source/GUI/gui_gamebrowser.cpp b/source/GUI/gui_gamelist.cpp similarity index 68% rename from source/GUI/gui_gamebrowser.cpp rename to source/GUI/gui_gamelist.cpp index f87f03eb..48a252fe 100644 --- a/source/GUI/gui_gamebrowser.cpp +++ b/source/GUI/gui_gamelist.cpp @@ -7,16 +7,17 @@ ***************************************************************************/ #include "gui.h" -#include "../wpad.h" +#include "wpad.h" #include -#include "gui_gamebrowser.h" -#include "../settings/CSettings.h" -#include "../main.h" +#include "gui_gamelist.h" +#include "settings/CSettings.h" +#include "main.h" #include "settings/newtitles.h" #include "settings/GameTitles.h" #include "usbloader/GameList.h" #include "themes/CTheme.h" +#include "utils/tools.h" #include "menu.h" #include @@ -25,9 +26,9 @@ #define GAMESELECTSIZE 30 /** - * Constructor for the GuiGameBrowser class. + * Constructor for the GuiGameList class. */ -GuiGameBrowser::GuiGameBrowser(int w, int h, int selectedGame) +GuiGameList::GuiGameList(int w, int h, int offset) : scrollBar(h-10) { width = w; @@ -35,8 +36,8 @@ GuiGameBrowser::GuiGameBrowser(int w, int h, int selectedGame) pagesize = thInt("9 - game list browser page size"); scrollbaron = (gameList.size() > pagesize) ? 1 : 0; selectable = true; - listOffset = selectedGame - (selectedGame % pagesize); - selectedItem = selectedGame - listOffset; + listOffset = LIMIT(offset, 0, MAX(0, gameList.size()-pagesize)); + selectedItem = 0; focus = 1; // allow focus trigA = new GuiTrigger; @@ -49,7 +50,11 @@ GuiGameBrowser::GuiGameBrowser(int w, int h, int selectedGame) scrollBar.SetAlignment(thAlign("right - game browser scrollbar align hor"), thAlign("top - game browser scrollbar align ver")); scrollBar.SetPosition(thInt("0 - game browser scrollbar pos x"), thInt("5 - game browser scrollbar pos y")); scrollBar.SetButtonScroll(WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B); - scrollBar.listChanged.connect(this, &GuiGameBrowser::onListChange); + scrollBar.SetPageSize(pagesize); + scrollBar.SetSelectedItem(selectedItem); + scrollBar.SetSelectedIndex(listOffset); + scrollBar.SetEntrieCount(gameList.size()); + scrollBar.listChanged.connect(this, &GuiGameList::onListChange); bgGameImg = new GuiImage(bgGames); bgGameImg->SetParent(this); @@ -59,21 +64,20 @@ GuiGameBrowser::GuiGameBrowser(int w, int h, int selectedGame) maxTextWidth = bgGameImg->GetWidth() - scrollBar.GetWidth() - 38; - gameIndex = new int[pagesize]; game = new GuiButton *[pagesize]; gameTxt = new GuiText *[pagesize]; gameTxtOver = new GuiText *[pagesize]; gameBg = new GuiImage *[pagesize]; newImg = new GuiImage *[pagesize]; - for (int i = 0; i < pagesize; i++) + for (int i = 0; i < pagesize; ++i) { - gameTxt[i] = new GuiText(GameTitles.GetTitle(gameList[i]), 20, thColor("r=0 g=0 b=0 a=255 - game browser list text color")); + gameTxt[i] = new GuiText((char *) NULL, 20, thColor("r=0 g=0 b=0 a=255 - game browser list text color")); gameTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); gameTxt[i]->SetPosition(24, 0); gameTxt[i]->SetMaxWidth(maxTextWidth, DOTTED); - gameTxtOver[i] = new GuiText(GameTitles.GetTitle(gameList[i]), 20, thColor("r=0 g=0 b=0 a=255 - game browser list text color over")); + gameTxtOver[i] = new GuiText((char *) NULL, 20, thColor("r=0 g=0 b=0 a=255 - game browser list text color over")); gameTxtOver[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); gameTxtOver[i]->SetPosition(24, 0); gameTxtOver[i]->SetMaxWidth(maxTextWidth, SCROLL_HORIZONTAL); @@ -94,16 +98,16 @@ GuiGameBrowser::GuiGameBrowser(int w, int h, int selectedGame) game[i]->SetRumble(false); game[i]->SetTrigger(trigA); game[i]->SetSoundClick(btnSoundClick); - - gameIndex[i] = i; + game[i]->SetVisible(false); + game[i]->SetState(STATE_DISABLED); } UpdateListEntries(); } /** - * Destructor for the GuiGameBrowser class. + * Destructor for the GuiGameList class. */ -GuiGameBrowser::~GuiGameBrowser() +GuiGameList::~GuiGameList() { delete bgGameImg; delete bgGames; @@ -112,7 +116,7 @@ GuiGameBrowser::~GuiGameBrowser() delete trigA; - for (int i = 0; i < pagesize; i++) + for (int i = 0; i < pagesize; ++i) { delete gameTxt[i]; delete gameTxtOver[i]; @@ -120,27 +124,26 @@ GuiGameBrowser::~GuiGameBrowser() delete game[i]; delete newImg[i]; } - delete[] gameIndex; delete[] game; delete[] gameTxt; delete[] gameTxtOver; delete[] gameBg; } -void GuiGameBrowser::SetFocus(int f) +void GuiGameList::SetFocus(int f) { LOCK( this ); if (!gameList.size()) return; focus = f; - for (int i = 0; i < pagesize; i++) + for (int i = 0; i < pagesize; ++i) game[i]->ResetState(); if (f == 1) game[selectedItem]->SetState(STATE_SELECTED); } -void GuiGameBrowser::ResetState() +void GuiGameList::ResetState() { LOCK( this ); if (state != STATE_DISABLED) @@ -149,76 +152,60 @@ void GuiGameBrowser::ResetState() stateChan = -1; } - for (int i = 0; i < pagesize; i++) + for (int i = 0; i < pagesize; ++i) { game[i]->ResetState(); } } -int GuiGameBrowser::GetOffset() -{ - return listOffset; -} -int GuiGameBrowser::GetClickedOption() +int GuiGameList::GetClickedOption() { int found = -1; - for (int i = 0; i < pagesize; i++) + for (int i = 0; i < pagesize; ++i) { if (game[i]->GetState() == STATE_CLICKED) { game[i]->SetState(STATE_SELECTED); - found = gameIndex[i]; + found = listOffset + i; break; } } return found; } -/**************************************************************************** - * FindMenuItem - * - * Help function to find the next visible menu item on the list - ***************************************************************************/ - -int GuiGameBrowser::FindMenuItem(int currentItem, int direction) -{ - int nextItem = currentItem + direction; - - if (nextItem < 0 || nextItem >= gameList.size()) return -1; - - if (strlen(GameTitles.GetTitle(gameList[nextItem])) > 0) - return nextItem; - - return FindMenuItem(nextItem, direction); -} - -void GuiGameBrowser::onListChange(int SelItem, int SelInd) +void GuiGameList::onListChange(int SelItem, int SelInd) { selectedItem = SelItem; listOffset = SelInd; UpdateListEntries(); } +void GuiGameList::setListOffset(int off) +{ + LOCK(this); + listOffset = LIMIT(off, 0, MAX(0, gameList.size()-pagesize)); +} + +void GuiGameList::SetSelectedOption(int ind) +{ + LOCK(this); + selectedItem = LIMIT(ind, 0, MIN(pagesize, MAX(0, gameList.size()-1))); +} + /** * Draw the button on screen */ -void GuiGameBrowser::Draw() +void GuiGameList::Draw() { LOCK( this ); if (!this->IsVisible() || !gameList.size()) return; bgGameImg->Draw(); - int next = listOffset; - - for (int i = 0; i < pagesize; i++) + for (int i = 0, next = listOffset; i < pagesize; ++i, ++next) { - if (next >= 0) - { + if (next < gameList.size()) game[i]->Draw(); - next = this->FindMenuItem(next, 1); - } - else break; } if (scrollbaron == 1) @@ -227,12 +214,11 @@ void GuiGameBrowser::Draw() this->UpdateEffects(); } -void GuiGameBrowser::UpdateListEntries() +void GuiGameList::UpdateListEntries() { - int next = listOffset; - for (int i = 0; i < pagesize; i++) + for (int i = 0, next = listOffset; i < pagesize; ++i, ++next) { - if (next >= 0) + if (next < gameList.size()) { if (game[i]->GetState() == STATE_DISABLED) { @@ -259,9 +245,6 @@ void GuiGameBrowser::UpdateListEntries() } newImg[i]->SetVisible(isNew); } - - gameIndex[i] = next; - next = this->FindMenuItem(next, 1); } else { @@ -271,13 +254,12 @@ void GuiGameBrowser::UpdateListEntries() } } -void GuiGameBrowser::Update(GuiTrigger * t) +void GuiGameList::Update(GuiTrigger * t) { LOCK( this ); if (state == STATE_DISABLED || !t || !gameList.size()) return; static int pressedChan = -1; - int next; if((t->wpad.btns_d & (WPAD_BUTTON_B | WPAD_BUTTON_DOWN | WPAD_BUTTON_UP | WPAD_BUTTON_LEFT | WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_B | WPAD_CLASSIC_BUTTON_UP | WPAD_CLASSIC_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_RIGHT)) || @@ -288,23 +270,22 @@ void GuiGameBrowser::Update(GuiTrigger * t) // update the location of the scroll box based on the position in the option list scrollBar.Update(t); - next = listOffset; - if(pressedChan == -1 || (!t->wpad.btns_h && !t->pad.btns_h)) { - for (int i = 0; i < pagesize; i++) + for (int i = 0, next = listOffset; i < pagesize; ++i, ++next) { - if (next >= 0) next = this->FindMenuItem(next, 1); + if (next >= gameList.size()) + break; - if (i != selectedItem && game[i]->GetState() == STATE_SELECTED) - game[i]->ResetState(); - else if (i == selectedItem && game[i]->GetState() == STATE_DEFAULT) - game[selectedItem]->SetState(STATE_SELECTED, -1); + if (i != selectedItem && game[i]->GetState() == STATE_SELECTED) + game[i]->ResetState(); + else if (i == selectedItem && game[i]->GetState() == STATE_DEFAULT) + game[selectedItem]->SetState(STATE_SELECTED, -1); - game[i]->Update(t); + game[i]->Update(t); - if (game[i]->GetState() == STATE_SELECTED) - selectedItem = i; + if (game[i]->GetState() == STATE_SELECTED) + selectedItem = i; } } diff --git a/source/GUI/gui_gamelist.h b/source/GUI/gui_gamelist.h new file mode 100644 index 00000000..68489a12 --- /dev/null +++ b/source/GUI/gui_gamelist.h @@ -0,0 +1,47 @@ +#ifndef _GUIGAMELIST_H_ +#define _GUIGAMELIST_H_ + +#include "gui_gamebrowser.h" +#include "gui_scrollbar.hpp" +#include "usbloader/disc.h" + +class GuiGameList : public GuiGameBrowser, public sigslot::has_slots<> +{ + public: + GuiGameList(int w, int h, int listOffset = 0); + virtual ~GuiGameList(); + int GetClickedOption(); + int GetSelectedOption() { return listOffset+selectedItem; } + void SetSelectedOption(int ind); + void setListOffset(int off); + int getListOffset() const { return listOffset; } + void ResetState(); + void SetFocus(int f); + void Draw(); + void Update(GuiTrigger * t); + protected: + void onListChange(int SelItem, int SelInd); + void UpdateListEntries(); + int selectedItem; + int listOffset; + int scrollbaron; + int pagesize; + int maxTextWidth; + + GuiButton ** game; + GuiText ** gameTxt; + GuiText ** gameTxtOver; + GuiImage ** gameBg; + GuiImage ** newImg; + + GuiImage * bgGameImg; + + GuiImageData * bgGames; + GuiImageData * bgGamesEntry; + GuiImageData * newGames; + + GuiTrigger * trigA; + + GuiScrollbar scrollBar; +}; +#endif diff --git a/source/GUI/gui_image_async.h b/source/GUI/gui_image_async.h index ee372e3e..4066664c 100644 --- a/source/GUI/gui_image_async.h +++ b/source/GUI/gui_image_async.h @@ -11,7 +11,7 @@ class GuiImageAsync: public GuiImage public: GuiImageAsync(const char *Filename, GuiImageData * PreloadImg); GuiImageAsync(ImageLoaderCallback Callback, const void *Arg, int ArgLen, GuiImageData * PreloadImg); - ~GuiImageAsync(); + virtual ~GuiImageAsync(); static void ClearQueue(); private: diff --git a/source/GUI/gui_optionbrowser.h b/source/GUI/gui_optionbrowser.h index f84b0d89..cac6125d 100644 --- a/source/GUI/gui_optionbrowser.h +++ b/source/GUI/gui_optionbrowser.h @@ -10,7 +10,7 @@ class GuiOptionBrowser: public GuiElement, public sigslot::has_slots<> { public: GuiOptionBrowser(int w, int h, OptionList * l, const char * background); - ~GuiOptionBrowser(); + virtual ~GuiOptionBrowser(); int FindMenuItem(int c, int d); int GetClickedOption(); int GetSelectedOption(); diff --git a/source/GUI/gui_scrollbar.hpp b/source/GUI/gui_scrollbar.hpp index 84b3003d..f2eaa8f3 100644 --- a/source/GUI/gui_scrollbar.hpp +++ b/source/GUI/gui_scrollbar.hpp @@ -30,7 +30,7 @@ class GuiScrollbar : public GuiElement, public sigslot::has_slots<> { public: GuiScrollbar(int height, u8 mode = LISTMODE); - ~GuiScrollbar(); + virtual ~GuiScrollbar(); void SetDPadControl(bool a) { AllowDPad = a; } void SetButtonScroll(u32 button) { ButtonScroll = button; } void ScrollOneUp(); diff --git a/source/GUI/gui_searchbar.h b/source/GUI/gui_searchbar.h index da60e909..203a4d33 100644 --- a/source/GUI/gui_searchbar.h +++ b/source/GUI/gui_searchbar.h @@ -8,7 +8,7 @@ class GuiSearchBar: public GuiWindow { public: GuiSearchBar(const wchar_t *SearchChars); - ~GuiSearchBar(); + virtual ~GuiSearchBar(); void Draw(); void Update(GuiTrigger * t); wchar_t GetClicked(); diff --git a/source/GUI/gui_trigger.cpp b/source/GUI/gui_trigger.cpp index 352204ab..8440991c 100644 --- a/source/GUI/gui_trigger.cpp +++ b/source/GUI/gui_trigger.cpp @@ -144,10 +144,10 @@ bool GuiTrigger::Left() if(wpad.exp.type == WPAD_EXP_CLASSIC) wiibtn = WPAD_CLASSIC_BUTTON_LEFT; - if ((wpad.btns_d | wpad.btns_h) & wiibtn || (pad.btns_d | pad.btns_h) - & PAD_BUTTON_LEFT || pad.stickX < -PADCAL || WPAD_Stick(0, 0) < -PADCAL) + if (((wpad.btns_d | wpad.btns_h) & wiibtn) || ((pad.btns_d | pad.btns_h) + & PAD_BUTTON_LEFT) || pad.stickX < -PADCAL || WPAD_Stick(0, 0) < -PADCAL) { - if (wpad.btns_d & wiibtn || pad.btns_d & PAD_BUTTON_LEFT) + if ((wpad.btns_d & wiibtn) || (pad.btns_d & PAD_BUTTON_LEFT)) { scrollDelay = SCROLL_INITIAL_DELAY; // reset scroll delay. return true; @@ -171,10 +171,10 @@ bool GuiTrigger::Right() if(wpad.exp.type == WPAD_EXP_CLASSIC) wiibtn = WPAD_CLASSIC_BUTTON_RIGHT; - if ((wpad.btns_d | wpad.btns_h) & wiibtn || (pad.btns_d | pad.btns_h) - & PAD_BUTTON_RIGHT || pad.stickX > PADCAL || WPAD_Stick(0, 0) > PADCAL) + if (((wpad.btns_d | wpad.btns_h) & wiibtn) || ((pad.btns_d | pad.btns_h) + & PAD_BUTTON_RIGHT) || pad.stickX > PADCAL || WPAD_Stick(0, 0) > PADCAL) { - if (wpad.btns_d & wiibtn || pad.btns_d & PAD_BUTTON_RIGHT) + if ((wpad.btns_d & wiibtn) || (pad.btns_d & PAD_BUTTON_RIGHT)) { scrollDelay = SCROLL_INITIAL_DELAY; // reset scroll delay. return true; @@ -198,10 +198,10 @@ bool GuiTrigger::Up() if(wpad.exp.type == WPAD_EXP_CLASSIC) wiibtn = WPAD_CLASSIC_BUTTON_UP; - if ((wpad.btns_d | wpad.btns_h) & wiibtn || (pad.btns_d | pad.btns_h) & PAD_BUTTON_UP + if (((wpad.btns_d | wpad.btns_h) & wiibtn) || ((pad.btns_d | pad.btns_h) & PAD_BUTTON_UP) || pad.stickY > PADCAL || WPAD_Stick(0, 1) > PADCAL) { - if (wpad.btns_d & wiibtn || pad.btns_d & PAD_BUTTON_UP) + if ((wpad.btns_d & wiibtn) || (pad.btns_d & PAD_BUTTON_UP)) { scrollDelay = SCROLL_INITIAL_DELAY; // reset scroll delay. return true; @@ -225,10 +225,10 @@ bool GuiTrigger::Down() if(wpad.exp.type == WPAD_EXP_CLASSIC) wiibtn = WPAD_CLASSIC_BUTTON_DOWN; - if ((wpad.btns_d | wpad.btns_h) & wiibtn || (pad.btns_d | pad.btns_h) - & PAD_BUTTON_DOWN || pad.stickY < -PADCAL || WPAD_Stick(0, 1) < -PADCAL) + if (((wpad.btns_d | wpad.btns_h) & wiibtn) || ((pad.btns_d | pad.btns_h) + & PAD_BUTTON_DOWN) || pad.stickY < -PADCAL || WPAD_Stick(0, 1) < -PADCAL) { - if (wpad.btns_d & wiibtn || pad.btns_d & PAD_BUTTON_DOWN) + if ((wpad.btns_d & wiibtn) || (pad.btns_d & PAD_BUTTON_DOWN)) { scrollDelay = SCROLL_INITIAL_DELAY; // reset scroll delay. return true; diff --git a/source/GUI/gui_window.cpp b/source/GUI/gui_window.cpp index 41ac8caf..a8a1c185 100644 --- a/source/GUI/gui_window.cpp +++ b/source/GUI/gui_window.cpp @@ -239,8 +239,7 @@ void GuiWindow::ToggleFocus(GuiTrigger * t) } } // change focus - else if (t->wpad.btns_d & (WPAD_BUTTON_1 | WPAD_BUTTON_1 | WPAD_CLASSIC_BUTTON_PLUS) || t->pad.btns_d - & PAD_BUTTON_B) + else if ((t->wpad.btns_d & (WPAD_BUTTON_1 | WPAD_BUTTON_1 | WPAD_CLASSIC_BUTTON_PLUS)) || (t->pad.btns_d & PAD_BUTTON_B)) { for (i = found; i < _elements.size(); i++) { diff --git a/source/SoundOperations/AifDecoder.hpp b/source/SoundOperations/AifDecoder.hpp index f9c6fd91..5cbb6ea0 100644 --- a/source/SoundOperations/AifDecoder.hpp +++ b/source/SoundOperations/AifDecoder.hpp @@ -34,7 +34,7 @@ class AifDecoder : public SoundDecoder public: AifDecoder(const char * filepath); AifDecoder(const u8 * snd, int len); - ~AifDecoder(); + virtual ~AifDecoder(); int GetFormat() { return Format; }; int GetSampleRate() { return SampleRate; }; int Read(u8 * buffer, int buffer_size, int pos); diff --git a/source/SoundOperations/BNSDecoder.cpp b/source/SoundOperations/BNSDecoder.cpp index e79a2442..145a1f78 100644 --- a/source/SoundOperations/BNSDecoder.cpp +++ b/source/SoundOperations/BNSDecoder.cpp @@ -29,6 +29,8 @@ #include #include "BNSDecoder.hpp" +SoundBlock DecodefromBNS(const u8 *buffer, u32 size); + BNSDecoder::BNSDecoder(const char * filepath) : SoundDecoder(filepath) { diff --git a/source/SoundOperations/BNSDecoder.hpp b/source/SoundOperations/BNSDecoder.hpp index 4c9d76c3..85b5c5ca 100644 --- a/source/SoundOperations/BNSDecoder.hpp +++ b/source/SoundOperations/BNSDecoder.hpp @@ -44,7 +44,7 @@ class BNSDecoder : public SoundDecoder public: BNSDecoder(const char * filepath); BNSDecoder(const u8 * snd, int len); - ~BNSDecoder(); + virtual ~BNSDecoder(); int GetFormat() { return SoundData.format; }; int GetSampleRate() { return SoundData.frequency; }; int Read(u8 * buffer, int buffer_size, int pos); @@ -54,6 +54,4 @@ class BNSDecoder : public SoundDecoder SoundBlock SoundData; }; -SoundBlock DecodefromBNS(const u8 *buffer, u32 size); - #endif diff --git a/source/SoundOperations/Mp3Decoder.cpp b/source/SoundOperations/Mp3Decoder.cpp index f3977029..fcb8f82f 100644 --- a/source/SoundOperations/Mp3Decoder.cpp +++ b/source/SoundOperations/Mp3Decoder.cpp @@ -213,4 +213,6 @@ int Mp3Decoder::Read(u8 * buffer, int buffer_size, int pos) mad_synth_frame(&Synth,&Frame); SynthPos = 0; } + + return 0; } diff --git a/source/SoundOperations/Mp3Decoder.hpp b/source/SoundOperations/Mp3Decoder.hpp index a622f1f3..54aafe1d 100644 --- a/source/SoundOperations/Mp3Decoder.hpp +++ b/source/SoundOperations/Mp3Decoder.hpp @@ -32,7 +32,7 @@ class Mp3Decoder : public SoundDecoder public: Mp3Decoder(const char * filepath); Mp3Decoder(const u8 * sound, int len); - ~Mp3Decoder(); + virtual ~Mp3Decoder(); int GetFormat() { return Format; }; int GetSampleRate() { return SampleRate; }; int Rewind(); diff --git a/source/SoundOperations/OggDecoder.hpp b/source/SoundOperations/OggDecoder.hpp index 49de225e..6b55386a 100644 --- a/source/SoundOperations/OggDecoder.hpp +++ b/source/SoundOperations/OggDecoder.hpp @@ -33,7 +33,7 @@ class OggDecoder : public SoundDecoder public: OggDecoder(const char * filepath); OggDecoder(const u8 * snd, int len); - ~OggDecoder(); + virtual ~OggDecoder(); int GetFormat(); int GetSampleRate(); int Rewind(); diff --git a/source/SoundOperations/SoundDecoder.hpp b/source/SoundOperations/SoundDecoder.hpp index b9e71ad4..a66715d1 100644 --- a/source/SoundOperations/SoundDecoder.hpp +++ b/source/SoundOperations/SoundDecoder.hpp @@ -49,7 +49,7 @@ class SoundDecoder SoundDecoder(); SoundDecoder(const char * filepath); SoundDecoder(const u8 * buffer, int size); - ~SoundDecoder(); + virtual ~SoundDecoder(); virtual int Read(u8 * buffer, int buffer_size, int pos); virtual int Tell() { return CurPos; }; virtual int Seek(int pos) { CurPos = pos; return file_fd->seek(CurPos, SEEK_SET); }; diff --git a/source/SoundOperations/SoundHandler.cpp b/source/SoundOperations/SoundHandler.cpp index a4548886..266c611e 100644 --- a/source/SoundOperations/SoundHandler.cpp +++ b/source/SoundOperations/SoundHandler.cpp @@ -106,14 +106,7 @@ void SoundHandler::RemoveDecoder(int voice) return; if(DecoderList[voice] != NULL) - { - if(DecoderList[voice]->GetSoundType() == SOUND_OGG) delete ((OggDecoder *) DecoderList[voice]); - else if(DecoderList[voice]->GetSoundType() == SOUND_MP3) delete ((Mp3Decoder *) DecoderList[voice]); - else if(DecoderList[voice]->GetSoundType() == SOUND_WAV) delete ((WavDecoder *) DecoderList[voice]); - else if(DecoderList[voice]->GetSoundType() == SOUND_AIF) delete ((AifDecoder *) DecoderList[voice]); - else if(DecoderList[voice]->GetSoundType() == SOUND_BNS) delete ((BNSDecoder *) DecoderList[voice]); - else delete DecoderList[voice]; - } + delete DecoderList[voice]; DecoderList[voice] = NULL; } diff --git a/source/SoundOperations/WavDecoder.hpp b/source/SoundOperations/WavDecoder.hpp index 4681bf2b..8af59fe6 100644 --- a/source/SoundOperations/WavDecoder.hpp +++ b/source/SoundOperations/WavDecoder.hpp @@ -58,7 +58,7 @@ class WavDecoder : public SoundDecoder public: WavDecoder(const char * filepath); WavDecoder(const u8 * snd, int len); - ~WavDecoder(); + virtual ~WavDecoder(); int GetFormat() { return Format; }; int GetSampleRate() { return SampleRate; }; int Read(u8 * buffer, int buffer_size, int pos); diff --git a/source/SoundOperations/gui_bgm.h b/source/SoundOperations/gui_bgm.h index eb54791a..d314c174 100644 --- a/source/SoundOperations/gui_bgm.h +++ b/source/SoundOperations/gui_bgm.h @@ -20,7 +20,7 @@ class GuiBGM: public GuiSound { public: GuiBGM(const u8 *s, int l, int v); - ~GuiBGM(); + virtual ~GuiBGM(); bool Load(const char *path); bool LoadStandard(); bool ParsePath(const char * folderpath); diff --git a/source/SoundOperations/gui_sound.h b/source/SoundOperations/gui_sound.h index becfa948..0f1cfa4b 100644 --- a/source/SoundOperations/gui_sound.h +++ b/source/SoundOperations/gui_sound.h @@ -38,7 +38,7 @@ class GuiSound GuiSound(const char * filepath); GuiSound(const u8 * sound, int filesize, int volume, bool allocated = false, int voice = -1); //!Destructor - ~GuiSound(); + virtual ~GuiSound(); //!Load a file and replace the old one virtual bool Load(const char * filepath); //!Load a file and replace the old one diff --git a/source/cheats/cheatmenu.cpp b/source/cheats/cheatmenu.cpp index 0f538401..48814628 100644 --- a/source/cheats/cheatmenu.cpp +++ b/source/cheats/cheatmenu.cpp @@ -60,9 +60,11 @@ int CheatMenu(const char * gameID) if (download == 1) { download = CodeDownload(gameID); - if (download < 0 || c.openTxtfile(txtfilename) != 1) break; + if (download < 0 || c.openTxtfile(txtfilename) != 1) + break; } - else break; + else + break; case 1: int cntcheats = c.getCnt(); OptionList cheatslst; diff --git a/source/homebrewboot/BootHomebrew.cpp b/source/homebrewboot/BootHomebrew.cpp index 6750a5fa..33ba5c71 100644 --- a/source/homebrewboot/BootHomebrew.cpp +++ b/source/homebrewboot/BootHomebrew.cpp @@ -20,7 +20,6 @@ static u32 homebrewsize = 0; static std::vector Arguments; extern const u8 app_booter_dol[]; -extern const u32 app_booter_dol_size; void AddBootArgument(const char * argv) { diff --git a/source/input.cpp b/source/input.cpp index 3bc82bcd..7ada855d 100644 --- a/source/input.cpp +++ b/source/input.cpp @@ -53,7 +53,7 @@ void UpdatePads() if(userInput[i].wpad.exp.type == WPAD_EXP_NUNCHUK) { - if(userInput[i].wpad.btns_h & WPAD_NUNCHUK_BUTTON_Z && userInput[i].wpad.btns_d & WPAD_NUNCHUK_BUTTON_C) + if((userInput[i].wpad.btns_h & WPAD_NUNCHUK_BUTTON_Z) && (userInput[i].wpad.btns_d & WPAD_NUNCHUK_BUTTON_C)) ScreenShot(); } } diff --git a/source/libs/libwbfs/libwbfs.c b/source/libs/libwbfs/libwbfs.c index 386ed67b..cddca395 100644 --- a/source/libs/libwbfs/libwbfs.c +++ b/source/libs/libwbfs/libwbfs.c @@ -601,7 +601,10 @@ u32 wbfs_extract_disc(wbfs_disc_t*d, rw_sector_callback_t write_dst_wii_sector, int dst_wbs_nlb = p->wbfs_sec_sz / p->wii_sec_sz; copy_buffer = wbfs_ioalloc( p->wbfs_sec_sz ); if (!copy_buffer) - ERROR( "alloc memory" ); + { + wbfs_error( "alloc memory" ); + return 1; + } for (i = 0; i < p->n_wbfs_sec_per_disc; i++) { @@ -616,7 +619,6 @@ u32 wbfs_extract_disc(wbfs_disc_t*d, rw_sector_callback_t write_dst_wii_sector, } wbfs_iofree( copy_buffer ); return 0; - error: return 1; } u64 wbfs_estimate_disc(wbfs_t *p, read_wiidisc_callback_t read_src_wii_disc, void *callback_data, partition_selector_t sel) @@ -722,7 +724,7 @@ int wbfs_extract_file(wbfs_disc_t*d, char *path, void **data) wd = wd_open_disc(read_wiidisc_wbfsdisc, d); if (!wd) { - ERROR( "opening wbfs disc" ); + wbfs_error( "opening wbfs disc" ); return -1; } wd->extracted_size = 0; @@ -734,7 +736,8 @@ int wbfs_extract_file(wbfs_disc_t*d, char *path, void **data) ret = -1; } wd_close_disc(wd); - error: return ret; + + return ret; } int wbfs_get_fragments(wbfs_disc_t *d, _frag_append_t append_fragment, void *callback_data, u32 hdd_sector_size) diff --git a/source/menu/GameBrowseMenu.cpp b/source/menu/GameBrowseMenu.cpp index 3336c41e..6d204afb 100644 --- a/source/menu/GameBrowseMenu.cpp +++ b/source/menu/GameBrowseMenu.cpp @@ -1,6 +1,9 @@ #include #include "GameBrowseMenu.hpp" #include "Controls/DeviceHandler.hpp" +#include "GUI/gui_gamelist.h" +#include "GUI/gui_gamegrid.h" +#include "GUI/gui_gamecarousel.h" #include "GUI/LoadCoverImage.h" #include "prompts/PromptWindows.h" #include "prompts/gameinfo.h" @@ -33,13 +36,10 @@ #include "wpad.h" #include "sys.h" -extern int load_from_fs; extern u8 mountMethod; extern bool updateavailable; extern struct discHdr *dvdheader; -extern int cntMissFiles; -static int lastSelectedGame = 0; static bool WiiMoteInitiated = false; static bool Exiting = false; @@ -52,8 +52,6 @@ GameBrowseMenu::GameBrowseMenu() Exiting = false; show_searchwindow = false; gameBrowser = NULL; - gameGrid = NULL; - gameCarousel = NULL; searchBar = NULL; gameCover = NULL; gameCoverImg = NULL; @@ -476,11 +474,7 @@ GameBrowseMenu::~GameBrowseMenu() delete DownloadBtnTT; delete IDBtnTT; - lastSelectedGame = LIMIT(GetSelectedGame(), 0, gameList.size()-1); - delete gameBrowser; - delete gameGrid; - delete gameCarousel; mainWindow->Remove(searchBar); delete searchBar; @@ -609,18 +603,13 @@ void GameBrowseMenu::ReloadBrowser() } } - if(GetSelectedGame() >= 0) - lastSelectedGame = LIMIT(GetSelectedGame(), 0, gameList.size()-1); - else - lastSelectedGame = LIMIT(lastSelectedGame, 0, gameList.size()-1); + //! Check if the loaded setting is still in range + Settings.SelectedGame = LIMIT(Settings.SelectedGame, 0, gameList.size()-1); + Settings.GameListOffset = LIMIT(Settings.GameListOffset, 0, gameList.size()-1); delete gameBrowser; - delete gameGrid; - delete gameCarousel; delete searchBar; gameBrowser = NULL; - gameGrid = NULL; - gameCarousel = NULL; searchBar = NULL; if (Settings.gameDisplay == LIST_MODE) @@ -653,9 +642,10 @@ void GameBrowseMenu::ReloadBrowser() dvdBtn->SetPosition(Settings.widescreen ? thInt("512 - list layout dvd btn pos x widescreen") : thInt("540 - list layout dvd btn pos x"), thInt("13 - list layout dvd btn pos y")); - gameBrowser = new GuiGameBrowser(thInt("396 - game list layout width"), thInt("280 - game list layout height"), lastSelectedGame); + gameBrowser = new GuiGameList(thInt("396 - game list layout width"), thInt("280 - game list layout height"), Settings.GameListOffset); gameBrowser->SetPosition(thInt("200 - game list layout pos x"), thInt("49 - game list layout pos y")); gameBrowser->SetAlignment(ALIGN_LEFT, ALIGN_CENTRE); + gameBrowser->SetSelectedOption(Settings.SelectedGame); } else if (Settings.gameDisplay == GRID_MODE) { @@ -687,9 +677,9 @@ void GameBrowseMenu::ReloadBrowser() dvdBtn->SetPosition(Settings.widescreen ? thInt("448 - grid layout dvd btn pos x widescreen") : thInt("480 - grid layout dvd btn pos x"), thInt("13 - grid layout dvd btn pos y")); - gameGrid = new GuiGameGrid(thInt("640 - game grid layout width"), thInt("400 - game grid layout height"), Settings.theme_path, lastSelectedGame); - gameGrid->SetPosition(thInt("0 - game grid layout pos x"), thInt("20 - game grid layout pos y")); - gameGrid->SetAlignment(ALIGN_LEFT, ALIGN_CENTRE); + gameBrowser = new GuiGameGrid(thInt("640 - game grid layout width"), thInt("400 - game grid layout height"), Settings.theme_path, Settings.GameListOffset); + gameBrowser->SetPosition(thInt("0 - game grid layout pos x"), thInt("20 - game grid layout pos y")); + gameBrowser->SetAlignment(ALIGN_LEFT, ALIGN_CENTRE); } else if (Settings.gameDisplay == CAROUSEL_MODE) { @@ -721,9 +711,9 @@ void GameBrowseMenu::ReloadBrowser() dvdBtn->SetPosition(Settings.widescreen ? thInt("448 - carousel layout dvd btn pos x widescreen") : thInt("480 - carousel layout dvd btn pos x"), thInt("13 - carousel layout dvd btn pos y")); - gameCarousel = new GuiGameCarousel(thInt("640 - game carousel layout width"), thInt("400 - game carousel layout height"), Settings.theme_path, lastSelectedGame); - gameCarousel->SetPosition(thInt("0 - game carousel layout pos x"), thInt("-20 - game carousel layout pos y")); - gameCarousel->SetAlignment(ALIGN_LEFT, ALIGN_CENTRE); + gameBrowser = new GuiGameCarousel(thInt("640 - game carousel layout width"), thInt("400 - game carousel layout height"), Settings.theme_path, Settings.GameListOffset); + gameBrowser->SetPosition(thInt("0 - game carousel layout pos x"), thInt("-20 - game carousel layout pos y")); + gameBrowser->SetAlignment(ALIGN_LEFT, ALIGN_CENTRE); } @@ -768,12 +758,6 @@ void GameBrowseMenu::ReloadBrowser() if (gameBrowser) Append(gameBrowser); - else if (gameGrid) - Append(gameGrid); - - else if (gameCarousel) - Append(gameCarousel); - if (show_searchwindow) { searchBar = new GuiSearchBar(gameList.GetAvailableSearchChars()); @@ -895,7 +879,7 @@ int GameBrowseMenu::MainLoop() wString oldFilter(gameList.GetCurrentFilter()); gameList.FilterList(oldFilter.c_str()); - if(Settings.GameSort & SORT_FAVORITE && gameList.size() == 0) + if((Settings.GameSort & SORT_FAVORITE) && gameList.size() == 0) { Settings.GameSort &= ~SORT_FAVORITE; gameList.FilterList(oldFilter.c_str()); @@ -1072,6 +1056,37 @@ int GameBrowseMenu::MainLoop() } } + else if(categBtn->GetState() == STATE_CLICKED) + { + if (!Settings.godmode && (Settings.ParentalBlocks & BLOCK_CATEGORIES_MENU)) + { + WindowPrompt(tr( "Permission denied." ), tr( "Console must be unlocked for this option." ), tr( "OK" )); + categBtn->ResetState(); + return returnMenu; + } + + mainWindow->SetState(STATE_DISABLED); + CategorySwitchPrompt promptMenu; + promptMenu.SetAlignment(thAlign("center - category switch prompt align hor"), thAlign("middle - category switch prompt align ver")); + promptMenu.SetPosition(thInt("0 - category switch prompt pos x"), thInt("0 - category switch prompt pos y")); + promptMenu.SetEffect(EFFECT_FADE, 20); + mainWindow->Append(&promptMenu); + + promptMenu.Show(); + + promptMenu.SetEffect(EFFECT_FADE, -20); + while(promptMenu.GetEffect() > 0) usleep(100); + mainWindow->Remove(&promptMenu); + categBtn->ResetState(); + mainWindow->SetState(STATE_DEFAULT); + if(promptMenu.categoriesChanged()) + { + wString oldFilter(gameList.GetCurrentFilter()); + gameList.FilterList(oldFilter.c_str()); + ReloadBrowser(); + } + } + else if (Settings.gameDisplay == LIST_MODE && idBtn->GetState() == STATE_CLICKED) { gprintf("\tidBtn Clicked\n"); @@ -1103,7 +1118,14 @@ int GameBrowseMenu::MainLoop() } } - gameClicked = GetClickedGame(); + if(gameBrowser) + { + //! This is bad, but for saving pupose it will be in main loop + Settings.GameListOffset = gameBrowser->getListOffset(); + Settings.SelectedGame = gameBrowser->GetSelectedOption()-Settings.GameListOffset; + } + + gameClicked = gameBrowser ? gameBrowser->GetClickedOption() : -1; if ((gameClicked >= 0 && gameClicked < (s32) gameList.size()) || mountMethod != 0) { OpenClickedGame(); @@ -1153,30 +1175,6 @@ void GameBrowseMenu::CheckDiscSlotUpdate() rockout(GetSelectedGame()); } - else if(categBtn->GetState() == STATE_CLICKED) - { - mainWindow->SetState(STATE_DISABLED); - CategorySwitchPrompt promptMenu; - promptMenu.SetAlignment(thAlign("center - category switch prompt align hor"), thAlign("middle - category switch prompt align ver")); - promptMenu.SetPosition(thInt("0 - category switch prompt pos x"), thInt("0 - category switch prompt pos y")); - promptMenu.SetEffect(EFFECT_FADE, 20); - mainWindow->Append(&promptMenu); - - promptMenu.Show(); - - promptMenu.SetEffect(EFFECT_FADE, -20); - while(promptMenu.GetEffect() > 0) usleep(100); - mainWindow->Remove(&promptMenu); - categBtn->ResetState(); - mainWindow->SetState(STATE_DEFAULT); - if(promptMenu.categoriesChanged()) - { - wString oldFilter(gameList.GetCurrentFilter()); - gameList.FilterList(oldFilter.c_str()); - ReloadBrowser(); - } - } - if(DiscDriveCoverOld != DiscDriveCover) { if(DiscDriveCover & 0x02) @@ -1220,34 +1218,6 @@ void GameBrowseMenu::UpdateClock() clockTime->SetText(theTime); } -int GameBrowseMenu::GetSelectedGame() -{ - if(gameBrowser) - return gameBrowser->GetSelectedOption(); - - else if(gameCarousel) - return gameCarousel->GetSelectedOption(); - - else if(gameGrid) - return gameGrid->GetSelectedOption(); - - return -1; -} - -int GameBrowseMenu::GetClickedGame() -{ - if(gameBrowser) - return gameBrowser->GetClickedOption(); - - else if(gameCarousel) - return gameCarousel->GetClickedOption(); - - else if(gameGrid) - return gameGrid->GetClickedOption(); - - return -1; -} - void GameBrowseMenu::UpdateGameInfoText(const u8 * gameId) { if(!gameId) @@ -1334,6 +1304,7 @@ int GameBrowseMenu::OpenClickedGame() } rockout(gameSelected); + if(gameBrowser) gameBrowser->SetState(STATE_DISABLED); struct discHdr *header = (mountMethod ? dvdheader : gameList[gameSelected]); @@ -1362,6 +1333,7 @@ int GameBrowseMenu::OpenClickedGame() gameSelected = GamePrompt->GetSelectedGame(); delete GamePrompt; SetState(STATE_DEFAULT); + if(gameBrowser) gameBrowser->SetState(STATE_DISABLED); //update header and id if it was changed header = (mountMethod ? dvdheader : gameList[gameSelected]); snprintf(IDfull, sizeof(IDfull), "%s", (char *) header->id); @@ -1409,6 +1381,7 @@ int GameBrowseMenu::OpenClickedGame() rockout(-1, -1); mountMethod = 0; + if(gameBrowser) gameBrowser->SetState(STATE_DEFAULT); if (searchBar) { diff --git a/source/menu/GameBrowseMenu.hpp b/source/menu/GameBrowseMenu.hpp index db832790..c6c069ec 100644 --- a/source/menu/GameBrowseMenu.hpp +++ b/source/menu/GameBrowseMenu.hpp @@ -1,10 +1,7 @@ #ifndef GAMEBROWSEMENU_HPP_ #define GAMEBROWSEMENU_HPP_ -#include "GUI/gui.h" #include "GUI/gui_gamebrowser.h" -#include "GUI/gui_gamegrid.h" -#include "GUI/gui_gamecarousel.h" #include "GUI/gui_searchbar.h" #include "utils/ThreadedTask.hpp" @@ -12,14 +9,13 @@ class GameBrowseMenu : public GuiWindow { public: GameBrowseMenu(); - ~GameBrowseMenu(); + virtual ~GameBrowseMenu(); static int Execute(); void ReloadBrowser(); - protected: + private: int MainLoop(); int OpenClickedGame(); - int GetSelectedGame(); - int GetClickedGame(); + int GetSelectedGame() { return (gameBrowser ? gameBrowser->GetSelectedOption() : -1); } void UpdateGameInfoText(const u8 * gameId); void LoadCover(struct discHdr *header); void CheckAlternativeDOL(const char * IDfull); @@ -41,8 +37,6 @@ class GameBrowseMenu : public GuiWindow std::vector ToolBar; GuiGameBrowser * gameBrowser; - GuiGameGrid * gameGrid; - GuiGameCarousel * gameCarousel; GuiSearchBar * searchBar; GuiImageData * btnInstall; diff --git a/source/menu/WDMMenu.hpp b/source/menu/WDMMenu.hpp index d611c394..4a376151 100644 --- a/source/menu/WDMMenu.hpp +++ b/source/menu/WDMMenu.hpp @@ -10,7 +10,7 @@ class WDMMenu : public GuiWindow { public: WDMMenu(const struct discHdr * header); - ~WDMMenu(); + virtual ~WDMMenu(); int GetChoice(); static int Show(const struct discHdr * header); static u32 GetAlternateDolOffset() { return AlternateDolOffset; } diff --git a/source/patches/fst.c b/source/patches/fst.c index be146817..57c8e161 100644 --- a/source/patches/fst.c +++ b/source/patches/fst.c @@ -71,8 +71,6 @@ extern const u32 gxdrawhooks[4]; extern const u32 gxflushhooks[4]; extern const u32 ossleepthreadhooks[4]; extern const u32 axnextframehooks[4]; -extern const u32 wpadbuttonsdownhooks[4]; -extern const u32 wpadbuttonsdown2hooks[4]; void SetCheatFilepath(const char * path) { diff --git a/source/patches/patchcode.c b/source/patches/patchcode.c index a584b893..75c8947d 100644 --- a/source/patches/patchcode.c +++ b/source/patches/patchcode.c @@ -36,72 +36,72 @@ //#include "main.h" u32 hooktype = 0; - + extern const char * CheatFilepath; extern void patchhook(u32 address, u32 len); -extern void patchhook2(u32 address, u32 len); -extern void patchhook3(u32 address, u32 len); +//extern void patchhook2(u32 address, u32 len); +//extern void patchhook3(u32 address, u32 len); -extern void multidolpatchone(u32 address, u32 len); -extern void multidolpatchtwo(u32 address, u32 len); +//extern void multidolpatchone(u32 address, u32 len); +//extern void multidolpatchtwo(u32 address, u32 len); -extern void regionfreejap(u32 address, u32 len); -extern void regionfreeusa(u32 address, u32 len); -extern void regionfreepal(u32 address, u32 len); +//extern void regionfreejap(u32 address, u32 len); +//extern void regionfreeusa(u32 address, u32 len); +//extern void regionfreepal(u32 address, u32 len); -extern void removehealthcheck(u32 address, u32 len); +//extern void removehealthcheck(u32 address, u32 len); -extern void copyflagcheck1(u32 address, u32 len); -extern void copyflagcheck2(u32 address, u32 len); -extern void copyflagcheck3(u32 address, u32 len); -extern void copyflagcheck4(u32 address, u32 len); -extern void copyflagcheck5(u32 address, u32 len); +//extern void copyflagcheck1(u32 address, u32 len); +//extern void copyflagcheck2(u32 address, u32 len); +//extern void copyflagcheck3(u32 address, u32 len); +//extern void copyflagcheck4(u32 address, u32 len); +//extern void copyflagcheck5(u32 address, u32 len); -extern void patchupdatecheck(u32 address, u32 len); +//extern void patchupdatecheck(u32 address, u32 len); -extern void movedvdhooks(u32 address, u32 len); +//extern void movedvdhooks(u32 address, u32 len); extern void multidolhook(u32 address); extern void langvipatch(u32 address, u32 len, u8 langbyte); extern void vipatch(u32 address, u32 len); -static const u32 multidolpatch1[2] = { 0x3C03FFB4, 0x28004F43 }; +//static const u32 multidolpatch1[2] = { 0x3C03FFB4, 0x28004F43 }; -static const u32 healthcheckhook[2] = { 0x41810010, 0x881D007D }; +//static const u32 healthcheckhook[2] = { 0x41810010, 0x881D007D }; -static const u32 updatecheckhook[3] = { 0x80650050, 0x80850054, 0xA0A50058 }; +//static const u32 updatecheckhook[3] = { 0x80650050, 0x80850054, 0xA0A50058 }; -static const u32 multidolpatch2[2] = { 0x3F608000, 0x807B0018 }; +//static const u32 multidolpatch2[2] = { 0x3F608000, 0x807B0018 }; -static const u32 recoveryhooks[3] = { 0xA00100AC, 0x5400073E, 0x2C00000F }; +//static const u32 recoveryhooks[3] = { 0xA00100AC, 0x5400073E, 0x2C00000F }; -static const u32 nocopyflag1[3] = { 0x540007FF, 0x4182001C, 0x80630068 }; +//static const u32 nocopyflag1[3] = { 0x540007FF, 0x4182001C, 0x80630068 }; -static const u32 nocopyflag2[3] = { 0x540007FF, 0x41820024, 0x387E12E2 }; +//static const u32 nocopyflag2[3] = { 0x540007FF, 0x41820024, 0x387E12E2 }; // this one is for the GH3 and VC saves //static const u32 nocopyflag3[5] = { // 0x2C030000, 0x40820010, 0x88010020, 0x28000002, 0x41820234 //}; -static const u32 nocopyflag3[5] = { 0x2C030000, 0x41820200, 0x48000058, 0x38610100 }; +//static const u32 nocopyflag3[5] = { 0x2C030000, 0x41820200, 0x48000058, 0x38610100 }; // this removes the display warning for no copy VC and GH3 saves -static const u32 nocopyflag4[4] = { 0x80010008, 0x2C000000, 0x4182000C, 0x3BE00001 }; +//static const u32 nocopyflag4[4] = { 0x80010008, 0x2C000000, 0x4182000C, 0x3BE00001 }; -static const u32 nocopyflag5[3] = { 0x801D0024, 0x540007FF, 0x41820024 }; +//static const u32 nocopyflag5[3] = { 0x801D0024, 0x540007FF, 0x41820024 }; -static const u32 movedvdpatch[3] = { 0x2C040000, 0x41820120, 0x3C608109 }; +//static const u32 movedvdpatch[3] = { 0x2C040000, 0x41820120, 0x3C608109 }; -static const u32 regionfreehooks[5] = { 0x7C600774, 0x2C000001, 0x41820030, 0x40800010, 0x2C000000 }; +//static const u32 regionfreehooks[5] = { 0x7C600774, 0x2C000001, 0x41820030, 0x40800010, 0x2C000000 }; -static const u32 cIOScode[16] = { 0x7f06c378, 0x7f25cb78, 0x387e02c0, 0x4cc63182 }; +//static const u32 cIOScode[16] = { 0x7f06c378, 0x7f25cb78, 0x387e02c0, 0x4cc63182 }; -static const u32 cIOSblock[16] = { 0x2C1800F9, 0x40820008, 0x3B000024 }; +//static const u32 cIOSblock[16] = { 0x2C1800F9, 0x40820008, 0x3B000024 }; -static const u32 fwritepatch[8] = { 0x9421FFD0, 0x7C0802A6, 0x90010034, 0xBF210014, 0x7C9B2378, 0x7CDC3378, 0x7C7A1B78, - 0x7CB92B78 // bushing fwrite - }; +//static const u32 fwritepatch[8] = { 0x9421FFD0, 0x7C0802A6, 0x90010034, 0xBF210014, 0x7C9B2378, 0x7CDC3378, 0x7C7A1B78, +// 0x7CB92B78 // bushing fwrite +// }; static const u32 vipatchcode[3] = { 0x4182000C, 0x4180001C, 0x48000018 }; @@ -131,9 +131,9 @@ const u32 multidolchanhooks[4] = { 0x4200FFF4, 0x48000004, 0x38800000, 0x4E80002 const u32 langpatch[3] = { 0x7C600775, 0x40820010, 0x38000000 }; -static const u32 oldpatch002[3] = { 0x2C000000, 0x40820214, 0x3C608000 }; +//static const u32 oldpatch002[3] = { 0x2C000000, 0x40820214, 0x3C608000 }; -static const u32 newpatch002[3] = { 0x2C000000, 0x48000214, 0x3C608000 }; +//static const u32 newpatch002[3] = { 0x2C000000, 0x48000214, 0x3C608000 }; //--------------------------------------------------------------------------------- bool dogamehooks(void *addr, u32 len) diff --git a/source/prompts/CategoryPrompt.hpp b/source/prompts/CategoryPrompt.hpp index 7825305b..aff25d5a 100644 --- a/source/prompts/CategoryPrompt.hpp +++ b/source/prompts/CategoryPrompt.hpp @@ -30,7 +30,7 @@ class CategoryPrompt : public GuiWindow, public sigslot::has_slots<> { public: CategoryPrompt(const string &title); - ~CategoryPrompt(); + virtual ~CategoryPrompt(); int Show(); bool categoriesChanged() const { return changed; } protected: diff --git a/source/prompts/CategorySelectPrompt.cpp b/source/prompts/CategorySelectPrompt.cpp index e45a40d7..05179e6d 100644 --- a/source/prompts/CategorySelectPrompt.cpp +++ b/source/prompts/CategorySelectPrompt.cpp @@ -62,7 +62,7 @@ void CategorySelectPrompt::onBrowserRefresh() } } - browser->AddEntrie(GameCategories.CategoryList.getCurrentName(), checked); + browser->AddEntrie(tr(GameCategories.CategoryList.getCurrentName().c_str()), checked); } while(GameCategories.CategoryList.goToNext()); diff --git a/source/prompts/CategorySwitchPrompt.cpp b/source/prompts/CategorySwitchPrompt.cpp index b5349a6e..3754a8bf 100644 --- a/source/prompts/CategorySwitchPrompt.cpp +++ b/source/prompts/CategorySwitchPrompt.cpp @@ -59,7 +59,7 @@ void CategorySwitchPrompt::onBrowserRefresh() } } - browser->AddEntrie(GameCategories.CategoryList.getCurrentName(), checked); + browser->AddEntrie(tr(GameCategories.CategoryList.getCurrentName().c_str()), checked); } while(GameCategories.CategoryList.goToNext()); diff --git a/source/prompts/CheckboxPrompt.hpp b/source/prompts/CheckboxPrompt.hpp index 57c9dac8..bbc6249b 100644 --- a/source/prompts/CheckboxPrompt.hpp +++ b/source/prompts/CheckboxPrompt.hpp @@ -43,7 +43,7 @@ class CheckboxPrompt : private PromptWindow, public sigslot::has_slots<> //! Constructor CheckboxPrompt(const char * title = 0, const char *msg = 0); //! Destructor - ~CheckboxPrompt(); + virtual ~CheckboxPrompt(); //! Add new checkbox void AddCheckBox(const char *text); //! Default function to get the button pressed diff --git a/source/prompts/GameWindow.cpp b/source/prompts/GameWindow.cpp index 7634e5eb..e176ef15 100644 --- a/source/prompts/GameWindow.cpp +++ b/source/prompts/GameWindow.cpp @@ -181,7 +181,7 @@ GameWindow::GameWindow(int Selected) Append(FavoriteBtn[i]); } //check if unlocked - if (mountMethod != 2 && (Settings.godmode || !(Settings.ParentalBlocks & BLOCK_GAME_INSTALL))) + if (mountMethod != 2 && (Settings.godmode || !(Settings.ParentalBlocks & BLOCK_GAME_SETTINGS))) { backBtn->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); backBtn->SetPosition(-50, -40); diff --git a/source/prompts/GameWindow.hpp b/source/prompts/GameWindow.hpp index ca7e8347..8a5443dc 100644 --- a/source/prompts/GameWindow.hpp +++ b/source/prompts/GameWindow.hpp @@ -11,7 +11,7 @@ class GameWindow : public GuiWindow { public: GameWindow(int GameSelected); - ~GameWindow(); + virtual ~GameWindow(); int Show(); int GetSelectedGame() { return gameSelected; }; void SetGameBrowseMenu(GameBrowseMenu *m) { browserMenu = m; }; diff --git a/source/prompts/HomebrewPrompt.hpp b/source/prompts/HomebrewPrompt.hpp index 44a4b36b..0acf768b 100644 --- a/source/prompts/HomebrewPrompt.hpp +++ b/source/prompts/HomebrewPrompt.hpp @@ -34,7 +34,7 @@ class HomebrewPrompt : public PromptWindow, public sigslot::has_slots<> HomebrewPrompt(const char *name, const char *coder, const char *version, const char *release_date, const char *long_description, GuiImageData * iconImgData, u64 filesize); - ~HomebrewPrompt(); + virtual ~HomebrewPrompt(); int MainLoop(); private: void onListChange(int SelItem, int SelInd); diff --git a/source/prompts/PromptWindow.hpp b/source/prompts/PromptWindow.hpp index 59c895de..790d2ed6 100644 --- a/source/prompts/PromptWindow.hpp +++ b/source/prompts/PromptWindow.hpp @@ -32,7 +32,7 @@ class PromptWindow : public GuiWindow //! Constructor PromptWindow(const char *title = 0, const char *msg = 0); //! Destructor - ~PromptWindow(); + virtual ~PromptWindow(); //! Set title text void SetTitle(const char *text) { titleTxt->SetText(text); }; //! Set message text diff --git a/source/prompts/PromptWindows.cpp b/source/prompts/PromptWindows.cpp index 4c8f20a1..7ed7b2c3 100644 --- a/source/prompts/PromptWindows.cpp +++ b/source/prompts/PromptWindows.cpp @@ -45,13 +45,8 @@ /*** Extern variables ***/ s32 gameStart = 0; -extern float gamesize; extern u8 shutdown; extern u8 reset; -extern u8 mountMethod; -extern struct discHdr *dvdheader; -extern char game_partition[6]; -extern int connection; /**************************************************************************** * OnScreenNumpad diff --git a/source/settings/CSettings.cpp b/source/settings/CSettings.cpp index 9d7f480b..efc148cb 100644 --- a/source/settings/CSettings.cpp +++ b/source/settings/CSettings.cpp @@ -123,6 +123,8 @@ void CSettings::SetDefault() EnabledCategories.resize(1); EnabledCategories[0] = 0; Wiinnertag = OFF; + SelectedGame = 0; + GameListOffset = 0; } bool CSettings::Load() @@ -279,6 +281,8 @@ bool CSettings::Save() fprintf(file, "\n"); fprintf(file, "Wiinnertag = %d\n", Wiinnertag); fprintf(file, "WiinnertagPath = %s\n", WiinnertagPath); + fprintf(file, "SelectedGame = %d\n", SelectedGame); + fprintf(file, "GameListOffset = %d\n", GameListOffset); fclose(file); return true; @@ -540,6 +544,14 @@ bool CSettings::SetSetting(char *name, char *value) { if (sscanf(value, "%d", &i) == 1) Wiinnertag = i; } + else if(strcmp(name, "SelectedGame") == 0) + { + if (sscanf(value, "%d", &i) == 1) SelectedGame = i; + } + else if(strcmp(name, "GameListOffset") == 0) + { + if (sscanf(value, "%d", &i) == 1) GameListOffset = i; + } else if (strcmp(name, "InstallPartitions") == 0) { InstallPartitions = strtoul(value, 0, 16); diff --git a/source/settings/CSettings.h b/source/settings/CSettings.h index 62242a67..b9a8cc69 100644 --- a/source/settings/CSettings.h +++ b/source/settings/CSettings.h @@ -121,6 +121,8 @@ class CSettings f32 WSFactor; f32 FontScaleFactor; short Wiinnertag; + short SelectedGame; + short GameListOffset; std::vector EnabledCategories; protected: bool ValidVersion(FILE * file); diff --git a/source/settings/SettingsEnums.h b/source/settings/SettingsEnums.h index ec5e732e..05c02cfd 100644 --- a/source/settings/SettingsEnums.h +++ b/source/settings/SettingsEnums.h @@ -172,6 +172,7 @@ enum BLOCK_CATEGORIES_MOD = 0x010000, BLOCK_FEATURE_SETTINGS = 0x020000, BLOCK_HARD_DRIVE_SETTINGS = 0x040000, + BLOCK_CATEGORIES_MENU = 0x080000, BLOCK_ALL = 0xFFFFFFFF, }; diff --git a/source/settings/menus/CustomPathsSM.hpp b/source/settings/menus/CustomPathsSM.hpp index 344e7fb7..df4c85ef 100644 --- a/source/settings/menus/CustomPathsSM.hpp +++ b/source/settings/menus/CustomPathsSM.hpp @@ -30,7 +30,6 @@ class CustomPathsSM : public SettingsMenu { public: CustomPathsSM(); - virtual int GetType() { return CCustomPathsSM; }; protected: void SetOptionValues(); int GetMenuInternal(); diff --git a/source/settings/menus/FeatureSettingsMenu.hpp b/source/settings/menus/FeatureSettingsMenu.hpp index c1a3b23b..cc934421 100644 --- a/source/settings/menus/FeatureSettingsMenu.hpp +++ b/source/settings/menus/FeatureSettingsMenu.hpp @@ -30,7 +30,6 @@ class FeatureSettingsMenu : public SettingsMenu { public: FeatureSettingsMenu(); - virtual int GetType() { return CFeatureSettings; }; protected: void SetOptionValues(); int GetMenuInternal(); diff --git a/source/settings/menus/FlyingButtonsMenu.cpp b/source/settings/menus/FlyingButtonsMenu.cpp index f6127980..de41cceb 100644 --- a/source/settings/menus/FlyingButtonsMenu.cpp +++ b/source/settings/menus/FlyingButtonsMenu.cpp @@ -354,7 +354,7 @@ void FlyingButtonsMenu::ShowButtonsEffects(int effect, int effect_speed) return; //! Don't lock on fade in for initiation purpose - if(effect & EFFECT_FADE && effect_speed > 0) + if((effect & EFFECT_FADE) && effect_speed > 0) return; while (parentElement && MainButton[FirstItem]->GetEffect() > 0) diff --git a/source/settings/menus/FlyingButtonsMenu.hpp b/source/settings/menus/FlyingButtonsMenu.hpp index 3efbe745..f7e10373 100644 --- a/source/settings/menus/FlyingButtonsMenu.hpp +++ b/source/settings/menus/FlyingButtonsMenu.hpp @@ -34,7 +34,7 @@ class FlyingButtonsMenu : public GuiWindow { public: FlyingButtonsMenu(const char * menu_title); - ~FlyingButtonsMenu(); + virtual ~FlyingButtonsMenu(); virtual int MainLoop(); virtual void HideMenu(); virtual void ShowMenu(); diff --git a/source/settings/menus/GUISettingsMenu.hpp b/source/settings/menus/GUISettingsMenu.hpp index 97680648..a92d0495 100644 --- a/source/settings/menus/GUISettingsMenu.hpp +++ b/source/settings/menus/GUISettingsMenu.hpp @@ -30,8 +30,7 @@ class GuiSettingsMenu : public SettingsMenu { public: GuiSettingsMenu(); - ~GuiSettingsMenu(); - virtual int GetType() { return CGUISettingsMenu; }; + virtual ~GuiSettingsMenu(); protected: void SetOptionValues(); int GetMenuInternal(); diff --git a/source/settings/menus/GameLoadSM.hpp b/source/settings/menus/GameLoadSM.hpp index 32f8a92c..a583dbc2 100644 --- a/source/settings/menus/GameLoadSM.hpp +++ b/source/settings/menus/GameLoadSM.hpp @@ -31,8 +31,7 @@ class GameLoadSM : public SettingsMenu { public: GameLoadSM(const char * GameID); - ~GameLoadSM(); - virtual int GetType() { return CGameLoadSM; }; + virtual ~GameLoadSM(); protected: void SetDefaultConfig(); void SetOptionNames(); diff --git a/source/settings/menus/GameSettingsMenu.cpp b/source/settings/menus/GameSettingsMenu.cpp index 618fa22a..ecdad074 100644 --- a/source/settings/menus/GameSettingsMenu.cpp +++ b/source/settings/menus/GameSettingsMenu.cpp @@ -100,6 +100,11 @@ void GameSettingsMenu::CreateSettingsMenu(int menuNr) //! Categories else if(menuNr == Idx++) { + if (!Settings.godmode && (Settings.ParentalBlocks & BLOCK_CATEGORIES_MENU)) + { + WindowPrompt(tr( "Permission denied." ), tr( "Console must be unlocked for this option." ), tr( "OK" )); + return; + } HideMenu(); Remove(backBtn); ResumeGui(); @@ -149,24 +154,6 @@ void GameSettingsMenu::CreateSettingsMenu(int menuNr) void GameSettingsMenu::DeleteSettingsMenu() { - if(!CurrentMenu) - return; - - int type = CurrentMenu->GetType(); - - switch(type) - { - case CGameLoadSM: - delete ((GameLoadSM *) CurrentMenu); - break; - case CUninstallSM: - delete ((UninstallSM *) CurrentMenu); - break; - case CSettingsMenu: - default: - delete CurrentMenu; - break; - } - + delete CurrentMenu; CurrentMenu = NULL; } diff --git a/source/settings/menus/GameSettingsMenu.hpp b/source/settings/menus/GameSettingsMenu.hpp index 919a4538..f70fe6ca 100644 --- a/source/settings/menus/GameSettingsMenu.hpp +++ b/source/settings/menus/GameSettingsMenu.hpp @@ -33,7 +33,7 @@ class GameSettingsMenu : public FlyingButtonsMenu { public: GameSettingsMenu(GameBrowseMenu *parent, struct discHdr * header); - ~GameSettingsMenu(); + virtual ~GameSettingsMenu(); static int Show(GameBrowseMenu *parent, struct discHdr *header); protected: virtual void CreateSettingsMenu(int index); diff --git a/source/settings/menus/GlobalSettings.cpp b/source/settings/menus/GlobalSettings.cpp index 22a2c90a..ea889949 100644 --- a/source/settings/menus/GlobalSettings.cpp +++ b/source/settings/menus/GlobalSettings.cpp @@ -261,39 +261,6 @@ void GlobalSettings::CreateSettingsMenu(int menuNr) void GlobalSettings::DeleteSettingsMenu() { - if(!CurrentMenu) - return; - - int type = CurrentMenu->GetType(); - - switch(type) - { - case CGUISettingsMenu: - delete ((GuiSettingsMenu *) CurrentMenu); - break; - case CLoaderSettings: - delete ((LoaderSettings *) CurrentMenu); - break; - case CParentalControlSM: - delete ((ParentalControlSM *) CurrentMenu); - break; - case CSoundSettingsMenu: - delete ((SoundSettingsMenu *) CurrentMenu); - break; - case CCustomPathsSM: - delete ((CustomPathsSM *) CurrentMenu); - break; - case CFeatureSettings: - delete ((FeatureSettingsMenu *) CurrentMenu); - break; - case CHardDriveSM: - delete ((HardDriveSM *) CurrentMenu); - break; - case CSettingsMenu: - default: - delete CurrentMenu; - break; - } - + delete CurrentMenu; CurrentMenu = NULL; } diff --git a/source/settings/menus/GlobalSettings.hpp b/source/settings/menus/GlobalSettings.hpp index 98e3002d..f61fd0f0 100644 --- a/source/settings/menus/GlobalSettings.hpp +++ b/source/settings/menus/GlobalSettings.hpp @@ -30,7 +30,7 @@ class GlobalSettings : public FlyingButtonsMenu { public: GlobalSettings(); - ~GlobalSettings(); + virtual ~GlobalSettings(); static int Show(); protected: virtual void CreateSettingsMenu(int index); diff --git a/source/settings/menus/HardDriveSM.hpp b/source/settings/menus/HardDriveSM.hpp index 5d0ac6e3..9ee3d200 100644 --- a/source/settings/menus/HardDriveSM.hpp +++ b/source/settings/menus/HardDriveSM.hpp @@ -30,8 +30,7 @@ class HardDriveSM : public SettingsMenu { public: HardDriveSM(); - ~HardDriveSM(); - virtual int GetType() { return CHardDriveSM; }; + virtual ~HardDriveSM(); protected: void SetOptionValues(); int GetMenuInternal(); diff --git a/source/settings/menus/LoaderSettings.hpp b/source/settings/menus/LoaderSettings.hpp index a3b03bdb..17206ace 100644 --- a/source/settings/menus/LoaderSettings.hpp +++ b/source/settings/menus/LoaderSettings.hpp @@ -30,7 +30,6 @@ class LoaderSettings : public SettingsMenu { public: LoaderSettings(); - virtual int GetType() { return CLoaderSettings; }; protected: void SetOptionValues(); int GetMenuInternal(); diff --git a/source/settings/menus/ParentalControlSM.cpp b/source/settings/menus/ParentalControlSM.cpp index 1c82ac4a..4d382390 100644 --- a/source/settings/menus/ParentalControlSM.cpp +++ b/source/settings/menus/ParentalControlSM.cpp @@ -74,6 +74,7 @@ ParentalControlSM::ParentalControlSM() Options->SetName(Idx++, "%s", tr( "Block Cover Downloads" )); Options->SetName(Idx++, "%s", tr( "Block Game Install" )); Options->SetName(Idx++, "%s", tr( "Block GameID Change" )); + Options->SetName(Idx++, "%s", tr( "Block Categories Menu" )); Options->SetName(Idx++, "%s", tr( "Block Categories Modify" )); SetOptionValues(); @@ -157,6 +158,9 @@ void ParentalControlSM::SetOptionValues() //! Settings: Block GameID Change Options->SetValue(Idx++, "%s", tr(OnOffText[((Settings.ParentalBlocks & BLOCK_GAMEID_CHANGE) != 0)])); + //! Settings: Block Categories Menu + Options->SetValue(Idx++, "%s", tr(OnOffText[((Settings.ParentalBlocks & BLOCK_CATEGORIES_MENU) != 0)])); + //! Settings: Block Categories Modify Options->SetValue(Idx++, "%s", tr(OnOffText[((Settings.ParentalBlocks & BLOCK_CATEGORIES_MOD) != 0)])); } @@ -334,6 +338,12 @@ int ParentalControlSM::GetMenuInternal() Settings.ParentalBlocks ^= BLOCK_GAMEID_CHANGE; } + //! Settings: Block Categories Menu + else if (ret == ++Idx) + { + Settings.ParentalBlocks ^= BLOCK_CATEGORIES_MENU; + } + //! Settings: Block Categories Modify else if (ret == ++Idx) { diff --git a/source/settings/menus/ParentalControlSM.hpp b/source/settings/menus/ParentalControlSM.hpp index 7a6b2487..5ecd6ea0 100644 --- a/source/settings/menus/ParentalControlSM.hpp +++ b/source/settings/menus/ParentalControlSM.hpp @@ -30,7 +30,6 @@ class ParentalControlSM : public SettingsMenu { public: ParentalControlSM(); - virtual int GetType() { return CParentalControlSM; }; protected: void SetOptionValues(); int GetMenuInternal(); diff --git a/source/settings/menus/SettingsMenu.hpp b/source/settings/menus/SettingsMenu.hpp index 6d3901df..302372fa 100644 --- a/source/settings/menus/SettingsMenu.hpp +++ b/source/settings/menus/SettingsMenu.hpp @@ -28,28 +28,13 @@ #include "GUI/gui_optionbrowser.h" #include "menu.h" -enum -{ - CSettingsMenu = 0, - CGUISettingsMenu, - CLoaderSettings, - CParentalControlSM, - CSoundSettingsMenu, - CCustomPathsSM, - CGameLoadSM, - CUninstallSM, - CFeatureSettings, - CHardDriveSM, -}; - class SettingsMenu : public GuiWindow { public: SettingsMenu(const char * title, OptionList * option, int returnTo); - ~SettingsMenu(); + virtual ~SettingsMenu(); int GetClickedOption(); int GetMenu(); - virtual int GetType() { return CSettingsMenu; } protected: virtual int GetMenuInternal() { return MENU_NONE; }; int returnToMenu; diff --git a/source/settings/menus/SoundSettingsMenu.hpp b/source/settings/menus/SoundSettingsMenu.hpp index 5f6bbb05..4b17ccba 100644 --- a/source/settings/menus/SoundSettingsMenu.hpp +++ b/source/settings/menus/SoundSettingsMenu.hpp @@ -30,7 +30,6 @@ class SoundSettingsMenu : public SettingsMenu { public: SoundSettingsMenu(); - virtual int GetType() { return CSoundSettingsMenu; }; protected: void SetOptionValues(); int GetMenuInternal(); diff --git a/source/settings/menus/UninstallSM.hpp b/source/settings/menus/UninstallSM.hpp index e639f589..422547da 100644 --- a/source/settings/menus/UninstallSM.hpp +++ b/source/settings/menus/UninstallSM.hpp @@ -30,7 +30,6 @@ class UninstallSM : public SettingsMenu { public: UninstallSM(struct discHdr * header); - virtual int GetType() { return CUninstallSM; }; protected: void SetOptionValues(); int GetMenuInternal(); diff --git a/source/sys.cpp b/source/sys.cpp index f21a1677..a35b2b3b 100644 --- a/source/sys.cpp +++ b/source/sys.cpp @@ -30,9 +30,6 @@ extern "C" extern s32 MagicPatches(s32); } -extern char game_partition[6]; -extern u8 load_from_fs; - //Wiilight stuff static vu32 *_wiilight_reg = (u32*) 0xCD0000C0; void wiilight(int enable) // Toggle wiilight (thanks Bool for wiilight source) diff --git a/source/themes/ThemeDownloader.h b/source/themes/ThemeDownloader.h index da8923a5..15daab35 100644 --- a/source/themes/ThemeDownloader.h +++ b/source/themes/ThemeDownloader.h @@ -31,7 +31,7 @@ class ThemeDownloader : public FlyingButtonsMenu { public: ThemeDownloader(); - ~ThemeDownloader(); + virtual ~ThemeDownloader(); static int Run(); int MainLoop(); protected: diff --git a/source/themes/ThemeMenu.h b/source/themes/ThemeMenu.h index 12089d7e..7f7f3fb0 100644 --- a/source/themes/ThemeMenu.h +++ b/source/themes/ThemeMenu.h @@ -34,7 +34,7 @@ class ThemeMenu : public FlyingButtonsMenu { public: ThemeMenu(); - ~ThemeMenu(); + virtual ~ThemeMenu(); static int Run(); int MainLoop(); protected: diff --git a/source/usbloader/apploader.c b/source/usbloader/apploader.c index 8cfdf702..ad5c2478 100644 --- a/source/usbloader/apploader.c +++ b/source/usbloader/apploader.c @@ -14,8 +14,6 @@ #include "patches/wip.h" #include "settings/SettingsEnums.h" -extern bool geckoinit; - /* Apploader function pointers */ typedef int (*app_main)(void **dst, int *size, int *offset); typedef void (*app_init)(void(*report)(const char *fmt, ...)); diff --git a/source/usbloader/disc.c b/source/usbloader/disc.c index be1eb202..7d170f82 100644 --- a/source/usbloader/disc.c +++ b/source/usbloader/disc.c @@ -350,6 +350,7 @@ void PatchCountryStrings(void *Address, int Size) SearchPattern[0] = 0x01; SearchPattern[1] = 0x55; // U SearchPattern[2] = 0x53; // S + break; } switch (diskid[3]) @@ -372,6 +373,7 @@ void PatchCountryStrings(void *Address, int Size) default: PatchData[1] = 0x55; // U PatchData[2] = 0x53; // S + break; } while (Size >= 4) diff --git a/source/usbloader/frag.c b/source/usbloader/frag.c index 54e85904..700057f8 100644 --- a/source/usbloader/frag.c +++ b/source/usbloader/frag.c @@ -92,22 +92,21 @@ int frag_concat(FragList *ff, FragList *src) // in case a sparse block is requested, // the returned poffset might not be equal to requested offset // the difference should be filled with 0 -int frag_get(FragList *ff, u32 offset, u32 count, - u32 *poffset, u32 *psector, u32 *pcount) +int frag_get(FragList *ff, u32 offset, u32 count, u32 *poffset, u32 *psector, u32 *pcount) { u32 i; u32 delta; //printf("frag_get(%u %u)\n", offset, count); for (i=0; inum; i++) { - if (ff->frag[i].offset <= offset - && ff->frag[i].offset + ff->frag[i].count > offset) + if (ff->frag[i].offset <= offset && ff->frag[i].offset + ff->frag[i].count > offset) { delta = offset - ff->frag[i].offset; *poffset = offset; *psector = ff->frag[i].sector + delta; *pcount = ff->frag[i].count - delta; - if (*pcount > count) *pcount = count; - goto out; + if (*pcount > count) + *pcount = count; + return 0; } if (ff->frag[i].offset > offset && ff->frag[i].offset < offset + count) @@ -117,8 +116,9 @@ int frag_get(FragList *ff, u32 offset, u32 count, *psector = ff->frag[i].sector; *pcount = ff->frag[i].count; count -= delta; - if (*pcount > count) *pcount = count; - goto out; + if (*pcount > count) + *pcount = count; + return 0; } } // not found @@ -131,8 +131,7 @@ int frag_get(FragList *ff, u32 offset, u32 count, *poffset = offset + count; *psector = 0; *pcount = 0; - out: - //printf("=>(%u %u %u)\n", *poffset, *psector, *pcount); + return 0; } diff --git a/source/usbloader/wbfs/wbfs_base.h b/source/usbloader/wbfs/wbfs_base.h index 9385f13f..642e1ef3 100644 --- a/source/usbloader/wbfs/wbfs_base.h +++ b/source/usbloader/wbfs/wbfs_base.h @@ -13,7 +13,7 @@ class Wbfs { public: Wbfs(u32 lba, u32 size, u32 part, u32 usbport); - ~Wbfs() { Close(); }; + virtual ~Wbfs() { Close(); }; static s32 Init(u32); s32 CheckGame(u8 *); s32 GameSize(u8 *, f32 *);