From 88969ffb9fdc3e9ab6a3d379666afcc6bc0d5799 Mon Sep 17 00:00:00 2001 From: dimok321 <15055714+dimok789@users.noreply.github.com> Date: Fri, 24 Sep 2010 17:58:56 +0000 Subject: [PATCH] *Theme Class made and removed all the crap from cfg.c *Lots of changes due to that regarding themes (The very old theme format was completely dropped) --- HBC/META.XML | 4 +- gui.pnproj | 2 +- source/cheats/cheatmenu.cpp | 5 +- source/homebrewboot/HomebrewBrowse.cpp | 5 +- source/libwiigui/gui_customoptionbrowser.cpp | 7 +- source/libwiigui/gui_gamebrowser.cpp | 7 +- source/libwiigui/gui_gamecarousel.cpp | 3 +- source/libwiigui/gui_gamegrid.cpp | 15 +- source/menu.cpp | 4 +- source/menu/menu_disclist.cpp | 189 ++++---- source/menu/menu_format.cpp | 5 +- source/prompts/DiscBrowser.cpp | 3 +- source/prompts/ProgressWindow.cpp | 17 +- source/prompts/PromptWindows.cpp | 107 +++-- source/prompts/TitleBrowser.cpp | 5 +- source/prompts/filebrowser.cpp | 3 +- source/settings/CSettings.cpp | 168 +++---- source/settings/Settings.cpp | 9 +- source/settings/SettingsPrompts.cpp | 7 +- source/settings/cfg.c | 480 +------------------ source/settings/cfg.h | 149 +----- source/themes/CTheme.cpp | 392 +++++++++++++++ source/themes/CTheme.h | 187 ++++++++ source/themes/Theme_Downloader.cpp | 37 +- source/wad/wad.cpp | 32 +- 25 files changed, 909 insertions(+), 933 deletions(-) create mode 100644 source/themes/CTheme.cpp create mode 100644 source/themes/CTheme.h diff --git a/HBC/META.XML b/HBC/META.XML index 632cd38e..46280094 100644 --- a/HBC/META.XML +++ b/HBC/META.XML @@ -2,8 +2,8 @@ USB Loader GX USB Loader GX Team - 1.0 r969 - 201009241511 + 1.0 r970 + 201009241642 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. The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller. diff --git a/gui.pnproj b/gui.pnproj index 6e426dc1..8cbfcf36 100644 --- a/gui.pnproj +++ b/gui.pnproj @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/source/cheats/cheatmenu.cpp b/source/cheats/cheatmenu.cpp index b3723065..ddba4e63 100644 --- a/source/cheats/cheatmenu.cpp +++ b/source/cheats/cheatmenu.cpp @@ -6,6 +6,7 @@ #include "libwiigui/gui_customoptionbrowser.h" #include "prompts/PromptWindows.h" #include "language/gettext.h" +#include "themes/CTheme.h" #include "fatmounter.h" #include "listfiles.h" #include "menu.h" @@ -45,14 +46,14 @@ int CheatMenu(const char * gameID) GuiTrigger trigB; trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B); - GuiText backBtnTxt(tr( "Back" ), 22, THEME.prompttext); + GuiText backBtnTxt(tr( "Back" ), 22, Theme.prompttext); backBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30); GuiImage backBtnImg(&btnOutline); GuiButton backBtn(&backBtnImg, &backBtnImg, 2, 3, -140, 400, &trigA, NULL, btnClick2, 1); backBtn.SetLabel(&backBtnTxt); backBtn.SetTrigger(&trigB); - GuiText createBtnTxt(tr( "Create" ), 22, THEME.prompttext); + GuiText createBtnTxt(tr( "Create" ), 22, Theme.prompttext); createBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30); GuiImage createBtnImg(&btnOutline); GuiButton createBtn(&createBtnImg, &createBtnImg, 2, 3, 160, 400, &trigA, NULL, btnClick2, 1); diff --git a/source/homebrewboot/HomebrewBrowse.cpp b/source/homebrewboot/HomebrewBrowse.cpp index 04e2f75a..a3414801 100644 --- a/source/homebrewboot/HomebrewBrowse.cpp +++ b/source/homebrewboot/HomebrewBrowse.cpp @@ -20,6 +20,7 @@ #include "homebrewboot/HomebrewXML.h" #include "homebrewboot/BootHomebrew.h" #include "network/networkops.h" +#include "themes/CTheme.h" #include "menu.h" #include "menu/menus.h" #include "filelist.h" @@ -147,7 +148,7 @@ int MenuHomebrewBrowse() } /*** Buttons ***/ - GuiText backBtnTxt(tr( "Back" ), 22, THEME.prompttext); + GuiText backBtnTxt(tr( "Back" ), 22, Theme.prompttext); backBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30); GuiImage backBtnImg(&btnOutline); if (Settings.wsprompt == yes) @@ -1067,7 +1068,7 @@ int MenuHomebrewBrowse() wifiBtn.SetAlpha(255); titleTT = new GuiTooltip(GetNetworkIP()); - titleTT->SetAlpha(THEME.tooltipAlpha); + titleTT->SetAlpha(Theme.tooltipAlpha); wifiBtn.SetToolTip(titleTT, 0, -50, 0, 5); wifi_btn_loaded = true; } diff --git a/source/libwiigui/gui_customoptionbrowser.cpp b/source/libwiigui/gui_customoptionbrowser.cpp index 2a1cabfb..eb88cca8 100644 --- a/source/libwiigui/gui_customoptionbrowser.cpp +++ b/source/libwiigui/gui_customoptionbrowser.cpp @@ -12,6 +12,7 @@ #include "../gecko.h" #include "../settings/CSettings.h" #include "gui_customoptionbrowser.h" +#include "themes/CTheme.h" #include @@ -240,17 +241,17 @@ GuiCustomOptionBrowser::GuiCustomOptionBrowser(int w, int h, customOptionList * for (int i = 0; i < size; i++) { - optionTxt[i] = new GuiText(options->GetName(i), 20, THEME.settingstext); + optionTxt[i] = new GuiText(options->GetName(i), 20, Theme.settingstext); optionTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); optionTxt[i]->SetPosition(24, 0); optionTxt[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2 + 24), DOTTED); optionBg[i] = new GuiImage(bgOptionsEntry); - optionVal[i] = new GuiText((char *) NULL, 20, THEME.settingstext); + optionVal[i] = new GuiText((char *) NULL, 20, Theme.settingstext); optionVal[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); - optionValOver[i] = new GuiText((char *) NULL, 20, THEME.settingstext); + optionValOver[i] = new GuiText((char *) NULL, 20, Theme.settingstext); optionValOver[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); optionBtn[i] = new GuiButton(width - 28, GAMESELECTSIZE); diff --git a/source/libwiigui/gui_gamebrowser.cpp b/source/libwiigui/gui_gamebrowser.cpp index 44066c87..95b07f6f 100644 --- a/source/libwiigui/gui_gamebrowser.cpp +++ b/source/libwiigui/gui_gamebrowser.cpp @@ -15,6 +15,7 @@ #include "../main.h" #include "settings/newtitles.h" #include "usbloader/GameList.h" +#include "themes/CTheme.h" #include #include @@ -28,7 +29,7 @@ GuiGameBrowser::GuiGameBrowser(int w, int h, const char *themePath, const u8 *im { width = w; height = h; - pagesize = THEME.pagesize; + pagesize = Theme.pagesize; scrollbaron = (gameList.size() > pagesize) ? 1 : 0; selectable = true; listOffset = MAX( 0, MIN( offset, ( gameList.size() - pagesize ) ) ); @@ -128,12 +129,12 @@ GuiGameBrowser::GuiGameBrowser(int w, int h, const char *themePath, const u8 *im for (int i = 0; i < pagesize; i++) { - gameTxt[i] = new GuiText(get_title(gameList[i]), 20, THEME.gametext); + gameTxt[i] = new GuiText(get_title(gameList[i]), 20, Theme.gametext); gameTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); gameTxt[i]->SetPosition(24, 0); gameTxt[i]->SetMaxWidth(maxTextWidth, DOTTED); - gameTxtOver[i] = new GuiText(get_title(gameList[i]), 20, THEME.gametext); + gameTxtOver[i] = new GuiText(get_title(gameList[i]), 20, Theme.gametext); gameTxtOver[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); gameTxtOver[i]->SetPosition(24, 0); gameTxtOver[i]->SetMaxWidth(maxTextWidth, SCROLL_HORIZONTAL); diff --git a/source/libwiigui/gui_gamecarousel.cpp b/source/libwiigui/gui_gamecarousel.cpp index a21050a5..457719c0 100644 --- a/source/libwiigui/gui_gamecarousel.cpp +++ b/source/libwiigui/gui_gamecarousel.cpp @@ -15,6 +15,7 @@ #include "gui_gamecarousel.h" #include "usbloader/GameList.h" #include "../settings/CSettings.h" +#include "themes/CTheme.h" #include "../main.h" #include @@ -105,7 +106,7 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, const char *themePath, const u8 * btnRight->SetTrigger(trigPlus); btnRight->SetEffectGrow(); - gamename = new GuiText(" ", 18, THEME.info); + gamename = new GuiText(" ", 18, Theme.info); gamename->SetParent(this); gamename->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); gamename->SetPosition(0, 330); diff --git a/source/libwiigui/gui_gamegrid.cpp b/source/libwiigui/gui_gamegrid.cpp index fb4c30b2..8ca68f0a 100644 --- a/source/libwiigui/gui_gamegrid.cpp +++ b/source/libwiigui/gui_gamegrid.cpp @@ -14,6 +14,7 @@ #include "gui_image_async.h" #include "usbloader/GameList.h" #include "../settings/CSettings.h" +#include "themes/CTheme.h" #include "../prompts/PromptWindows.h" #include "../language/gettext.h" #include "../menu.h" @@ -399,8 +400,8 @@ void GuiGameGrid::Draw() for (int i = 0; i < pagesize - rows; i++) { - game[i]->SetPosition(Pos[i][wsi][0] * f1 + Pos[i + rows][wsi][0] * f2 + THEME.gamegrid_x, Pos[i][wsi][1] - * f1 + Pos[i + rows][wsi][1] * f2 + THEME.gamegrid_y); + game[i]->SetPosition(Pos[i][wsi][0] * f1 + Pos[i + rows][wsi][0] * f2 + Theme.gamegrid_x, Pos[i][wsi][1] + * f1 + Pos[i + rows][wsi][1] * f2 + Theme.gamegrid_y); game[i]->SetSkew(Skew[i][0] * f1 + Skew[i + rows][0] * f2, Skew[i][1] * f1 + Skew[i + rows][1] * f2, Skew[i][2] * f1 + Skew[i + rows][2] * f2, Skew[i][3] * f1 + Skew[i + rows][3] * f2, Skew[i][4] * f1 @@ -418,8 +419,8 @@ void GuiGameGrid::Draw() int (*Skew)[8] = VALUE4ROWS( rows, Skew1, Skew2, Skew3 ); for (int i = rows; i < pagesize; i++) { - game[i]->SetPosition(Pos[i][wsi][0] * f1 + Pos[i - rows][wsi][0] * f2 + THEME.gamegrid_x, Pos[i][wsi][1] - * f1 + Pos[i - rows][wsi][1] * f2 + THEME.gamegrid_y); + game[i]->SetPosition(Pos[i][wsi][0] * f1 + Pos[i - rows][wsi][0] * f2 + Theme.gamegrid_x, Pos[i][wsi][1] + * f1 + Pos[i - rows][wsi][1] * f2 + Theme.gamegrid_y); game[i]->SetSkew(Skew[i][0] * f1 + Skew[i - rows][0] * f2, Skew[i][1] * f1 + Skew[i - rows][1] * f2, Skew[i][2] * f1 + Skew[i - rows][2] * f2, Skew[i][3] * f1 + Skew[i - rows][3] * f2, Skew[i][4] * f1 @@ -785,8 +786,8 @@ void GuiGameGrid::Reload(int Rows, int ListOffset) // Tooltip //------------------------ if (gameIndex[i] != -1) - titleTT[i] = new GuiTooltip(get_title(gameList[gameIndex[i]]), THEME.tooltipAlpha); - else titleTT[i] = new GuiTooltip(NULL, THEME.tooltipAlpha); + titleTT[i] = new GuiTooltip(get_title(gameList[gameIndex[i]]), Theme.tooltipAlpha); + else titleTT[i] = new GuiTooltip(NULL, Theme.tooltipAlpha); //------------------------ // ImageData @@ -821,7 +822,7 @@ void GuiGameGrid::Reload(int Rows, int ListOffset) game[i]->SetParent(this); game[i]->SetImage(coverImg[i]); game[i]->SetAlignment(ALIGN_TOP, ALIGN_LEFT); - game[i]->SetPosition(Pos[i][wsi][0] + THEME.gamegrid_x, Pos[i][wsi][1] + THEME.gamegrid_y); + game[i]->SetPosition(Pos[i][wsi][0] + Theme.gamegrid_x, Pos[i][wsi][1] + Theme.gamegrid_y); game[i]->SetSkew(&Skew[i][0]); game[i]->SetTrigger(trigA); game[i]->SetSoundOver(btnSoundOver); diff --git a/source/menu.cpp b/source/menu.cpp index 6ea8c491..06fa82d5 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -19,7 +19,7 @@ #include "network/networkops.h" #include "patches/patchcode.h" #include "settings/Settings.h" -#include "settings/cfg.h" +#include "themes/CTheme.h" #include "themes/Theme_Downloader.h" #include "usbloader/disc.h" #include "usbloader/GameList.h" @@ -117,7 +117,7 @@ static void * UpdateGUI(void *arg) } mainWindow->Draw(); - if (Settings.tooltips == TooltipsOn && THEME.show_tooltip != 0 && mainWindow->GetState() != STATE_DISABLED) mainWindow->DrawTooltip(); + if (Settings.tooltips == TooltipsOn && Theme.show_tooltip != 0 && mainWindow->GetState() != STATE_DISABLED) mainWindow->DrawTooltip(); for (i = 3; i >= 0; i--) { diff --git a/source/menu/menu_disclist.cpp b/source/menu/menu_disclist.cpp index f8adc607..c01b1620 100644 --- a/source/menu/menu_disclist.cpp +++ b/source/menu/menu_disclist.cpp @@ -9,6 +9,7 @@ #include "prompts/DiscBrowser.h" #include "prompts/TitleBrowser.h" #include "settings/Settings.h" +#include "themes/CTheme.h" #include "wpad.h" #include "sys.h" @@ -212,72 +213,72 @@ int MenuDiscList() + used), tr( "free" )); } } - GuiText usedSpaceTxt(spaceinfo, 18, THEME.info); - usedSpaceTxt.SetAlignment(THEME.hddinfo_align, ALIGN_TOP); - usedSpaceTxt.SetPosition(THEME.hddinfo_x, THEME.hddinfo_y); + GuiText usedSpaceTxt(spaceinfo, 18, Theme.info); + usedSpaceTxt.SetAlignment(Theme.hddinfo_align, ALIGN_TOP); + usedSpaceTxt.SetPosition(Theme.hddinfo_x, Theme.hddinfo_y); char GamesCnt[15]; sprintf(GamesCnt, "%s: %i", (mountMethod != 3 ? tr( "Games" ) : tr( "Channels" )), gameList.size()); - GuiText gamecntTxt(GamesCnt, 18, THEME.info); + GuiText gamecntTxt(GamesCnt, 18, Theme.info); GuiButton gamecntBtn(100, 18); - gamecntBtn.SetAlignment(THEME.gamecount_align, ALIGN_TOP); - gamecntBtn.SetPosition(THEME.gamecount_x, THEME.gamecount_y); + gamecntBtn.SetAlignment(Theme.gamecount_align, ALIGN_TOP); + gamecntBtn.SetPosition(Theme.gamecount_x, Theme.gamecount_y); gamecntBtn.SetLabel(&gamecntTxt); gamecntBtn.SetEffectGrow(); gamecntBtn.SetTrigger(&trigA); GuiTooltip installBtnTT(tr( "Install a game" )); if (Settings.wsprompt == yes) installBtnTT.SetWidescreen(Settings.widescreen); - installBtnTT.SetAlpha(THEME.tooltipAlpha); + installBtnTT.SetAlpha(Theme.tooltipAlpha); GuiImage installBtnImg(&btnInstall); GuiImage installBtnImgOver(&btnInstallOver); installBtnImg.SetWidescreen(Settings.widescreen); installBtnImgOver.SetWidescreen(Settings.widescreen); - GuiButton installBtn(&installBtnImg, &installBtnImgOver, ALIGN_LEFT, ALIGN_TOP, THEME.install_x, THEME.install_y, + GuiButton installBtn(&installBtnImg, &installBtnImgOver, ALIGN_LEFT, ALIGN_TOP, Theme.install_x, Theme.install_y, &trigA, &btnSoundOver, btnClick2, 1, &installBtnTT, 24, -30, 0, 5); GuiTooltip settingsBtnTT(tr( "Settings" )); if (Settings.wsprompt == yes) settingsBtnTT.SetWidescreen(Settings.widescreen); - settingsBtnTT.SetAlpha(THEME.tooltipAlpha); + settingsBtnTT.SetAlpha(Theme.tooltipAlpha); GuiImage settingsBtnImg(&btnSettings); settingsBtnImg.SetWidescreen(Settings.widescreen); GuiImage settingsBtnImgOver(&btnSettingsOver); settingsBtnImgOver.SetWidescreen(Settings.widescreen); - GuiButton settingsBtn(&settingsBtnImg, &settingsBtnImgOver, 0, 3, THEME.setting_x, THEME.setting_y, &trigA, + GuiButton settingsBtn(&settingsBtnImg, &settingsBtnImgOver, 0, 3, Theme.setting_x, Theme.setting_y, &trigA, &btnSoundOver, btnClick2, 1, &settingsBtnTT, 65, -30, 0, 5); GuiTooltip homeBtnTT(tr( "Back to HBC or Wii Menu" )); if (Settings.wsprompt == yes) homeBtnTT.SetWidescreen(Settings.widescreen); - settingsBtnTT.SetAlpha(THEME.tooltipAlpha); + settingsBtnTT.SetAlpha(Theme.tooltipAlpha); GuiImage homeBtnImg(&btnhome); homeBtnImg.SetWidescreen(Settings.widescreen); GuiImage homeBtnImgOver(&btnhomeOver); homeBtnImgOver.SetWidescreen(Settings.widescreen); - GuiButton homeBtn(&homeBtnImg, &homeBtnImgOver, 0, 3, THEME.home_x, THEME.home_y, &trigA, &btnSoundOver, btnClick2, + GuiButton homeBtn(&homeBtnImg, &homeBtnImgOver, 0, 3, Theme.home_x, Theme.home_y, &trigA, &btnSoundOver, btnClick2, 1, &homeBtnTT, 15, -30, 1, 5); homeBtn.RemoveSoundClick(); homeBtn.SetTrigger(&trigHome); GuiTooltip poweroffBtnTT(tr( "Power off the Wii" )); if (Settings.wsprompt == yes) poweroffBtnTT.SetWidescreen(Settings.widescreen); - poweroffBtnTT.SetAlpha(THEME.tooltipAlpha); + poweroffBtnTT.SetAlpha(Theme.tooltipAlpha); GuiImage poweroffBtnImg(&btnpwroff); GuiImage poweroffBtnImgOver(&btnpwroffOver); poweroffBtnImg.SetWidescreen(Settings.widescreen); poweroffBtnImgOver.SetWidescreen(Settings.widescreen); - GuiButton poweroffBtn(&poweroffBtnImg, &poweroffBtnImgOver, 0, 3, THEME.power_x, THEME.power_y, &trigA, + GuiButton poweroffBtn(&poweroffBtnImg, &poweroffBtnImgOver, 0, 3, Theme.power_x, Theme.power_y, &trigA, &btnSoundOver, btnClick2, 1, &poweroffBtnTT, -10, -30, 1, 5); GuiTooltip sdcardBtnTT(tr( "Reload SD" )); if (Settings.wsprompt == yes) sdcardBtnTT.SetWidescreen(Settings.widescreen); - sdcardBtnTT.SetAlpha(THEME.tooltipAlpha); + sdcardBtnTT.SetAlpha(Theme.tooltipAlpha); GuiImage sdcardImg(&btnsdcard); GuiImage sdcardImgOver(&btnsdcardOver); sdcardImg.SetWidescreen(Settings.widescreen); sdcardImgOver.SetWidescreen(Settings.widescreen); - GuiButton sdcardBtn(&sdcardImg, &sdcardImgOver, 0, 3, THEME.sdcard_x, THEME.sdcard_y, &trigA, &btnSoundOver, + GuiButton sdcardBtn(&sdcardImg, &sdcardImgOver, 0, 3, Theme.sdcard_x, Theme.sdcard_y, &trigA, &btnSoundOver, btnClick2, 1, &sdcardBtnTT, 15, -30, 0, 5); GuiButton gameInfo(0, 0); @@ -290,7 +291,7 @@ int MenuDiscList() GuiTooltip favoriteBtnTT(tr( "Display favorites" )); if (Settings.wsprompt == yes) favoriteBtnTT.SetWidescreen(Settings.widescreen); - favoriteBtnTT.SetAlpha(THEME.tooltipAlpha); + favoriteBtnTT.SetAlpha(Theme.tooltipAlpha); GuiImage favoriteBtnImg(&imgfavIcon); favoriteBtnImg.SetWidescreen(Settings.widescreen); GuiImage favoriteBtnImg_g(&imgfavIcon_gray); @@ -300,13 +301,13 @@ int MenuDiscList() favoriteBtnImg_g.SetGrayscale(); } favoriteBtnImg_g.SetWidescreen(Settings.widescreen); - GuiButton favoriteBtn(&favoriteBtnImg_g, &favoriteBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_favorite_x, - THEME.gamelist_favorite_y, &trigA, &btnSoundOver, btnClick2, 1, &favoriteBtnTT, -15, 52, 0, 3); + GuiButton favoriteBtn(&favoriteBtnImg_g, &favoriteBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_favorite_x, + Theme.gamelist_favorite_y, &trigA, &btnSoundOver, btnClick2, 1, &favoriteBtnTT, -15, 52, 0, 3); favoriteBtn.SetAlpha(180); GuiTooltip searchBtnTT(tr( "Set Search-Filter" )); if (Settings.wsprompt == yes) searchBtnTT.SetWidescreen(Settings.widescreen); - searchBtnTT.SetAlpha(THEME.tooltipAlpha); + searchBtnTT.SetAlpha(Theme.tooltipAlpha); GuiImage searchBtnImg(&imgsearchIcon); searchBtnImg.SetWidescreen(Settings.widescreen); GuiImage searchBtnImg_g(&imgsearchIcon_gray); @@ -316,13 +317,13 @@ int MenuDiscList() searchBtnImg_g.SetGrayscale(); } searchBtnImg_g.SetWidescreen(Settings.widescreen); - GuiButton searchBtn(&searchBtnImg_g, &searchBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_search_x, - THEME.gamelist_search_y, &trigA, &btnSoundOver, btnClick2, 1, &searchBtnTT, -15, 52, 0, 3); + GuiButton searchBtn(&searchBtnImg_g, &searchBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_search_x, + Theme.gamelist_search_y, &trigA, &btnSoundOver, btnClick2, 1, &searchBtnTT, -15, 52, 0, 3); searchBtn.SetAlpha(180); GuiTooltip abcBtnTT(Settings.fave ? tr( "Sort by rank" ) : tr( "Sort alphabetically" )); if (Settings.wsprompt == yes) abcBtnTT.SetWidescreen(Settings.widescreen); - abcBtnTT.SetAlpha(THEME.tooltipAlpha); + abcBtnTT.SetAlpha(Theme.tooltipAlpha); GuiImage abcBtnImg(Settings.fave ? &imgrankIcon : &imgabcIcon); abcBtnImg.SetWidescreen(Settings.widescreen); GuiImage abcBtnImg_g(Settings.fave ? &imgrankIcon_gray : &imgabcIcon_gray); @@ -332,13 +333,13 @@ int MenuDiscList() abcBtnImg_g.SetGrayscale(); } abcBtnImg_g.SetWidescreen(Settings.widescreen); - GuiButton abcBtn(&abcBtnImg_g, &abcBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_abc_x, THEME.gamelist_abc_y, + GuiButton abcBtn(&abcBtnImg_g, &abcBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_abc_x, Theme.gamelist_abc_y, &trigA, &btnSoundOver, btnClick2, 1, &abcBtnTT, -15, 52, 0, 3); abcBtn.SetAlpha(180); GuiTooltip countBtnTT(tr( "Sort order by most played" )); if (Settings.wsprompt == yes) countBtnTT.SetWidescreen(Settings.widescreen); - countBtnTT.SetAlpha(THEME.tooltipAlpha); + countBtnTT.SetAlpha(Theme.tooltipAlpha); GuiImage countBtnImg(&imgplayCountIcon); countBtnImg.SetWidescreen(Settings.widescreen); GuiImage countBtnImg_g(&imgplayCountIcon_gray); @@ -348,13 +349,13 @@ int MenuDiscList() countBtnImg_g.SetGrayscale(); } countBtnImg_g.SetWidescreen(Settings.widescreen); - GuiButton countBtn(&countBtnImg_g, &countBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_count_x, - THEME.gamelist_count_y, &trigA, &btnSoundOver, btnClick2, 1, &countBtnTT, -15, 52, 0, 3); + GuiButton countBtn(&countBtnImg_g, &countBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_count_x, + Theme.gamelist_count_y, &trigA, &btnSoundOver, btnClick2, 1, &countBtnTT, -15, 52, 0, 3); countBtn.SetAlpha(180); GuiTooltip listBtnTT(tr( "Display as a list" )); if (Settings.wsprompt == yes) listBtnTT.SetWidescreen(Settings.widescreen); - listBtnTT.SetAlpha(THEME.tooltipAlpha); + listBtnTT.SetAlpha(Theme.tooltipAlpha); GuiImage listBtnImg(&imgarrangeList); listBtnImg.SetWidescreen(Settings.widescreen); GuiImage listBtnImg_g(&imgarrangeList_gray); @@ -364,13 +365,13 @@ int MenuDiscList() listBtnImg_g.SetGrayscale(); } listBtnImg_g.SetWidescreen(Settings.widescreen); - GuiButton listBtn(&listBtnImg_g, &listBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_list_x, - THEME.gamelist_list_y, &trigA, &btnSoundOver, btnClick2, 1, &listBtnTT, 15, 52, 1, 3); + GuiButton listBtn(&listBtnImg_g, &listBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_list_x, + Theme.gamelist_list_y, &trigA, &btnSoundOver, btnClick2, 1, &listBtnTT, 15, 52, 1, 3); listBtn.SetAlpha(180); GuiTooltip gridBtnTT(tr( "Display as a grid" )); if (Settings.wsprompt == yes) gridBtnTT.SetWidescreen(Settings.widescreen); - gridBtnTT.SetAlpha(THEME.tooltipAlpha); + gridBtnTT.SetAlpha(Theme.tooltipAlpha); GuiImage gridBtnImg(&imgarrangeGrid); gridBtnImg.SetWidescreen(Settings.widescreen); GuiImage gridBtnImg_g(&imgarrangeGrid_gray); @@ -380,13 +381,13 @@ int MenuDiscList() gridBtnImg_g.SetGrayscale(); } gridBtnImg_g.SetWidescreen(Settings.widescreen); - GuiButton gridBtn(&gridBtnImg_g, &gridBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_grid_x, - THEME.gamelist_grid_y, &trigA, &btnSoundOver, btnClick2, 1, &gridBtnTT, 15, 52, 1, 3); + GuiButton gridBtn(&gridBtnImg_g, &gridBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_grid_x, + Theme.gamelist_grid_y, &trigA, &btnSoundOver, btnClick2, 1, &gridBtnTT, 15, 52, 1, 3); gridBtn.SetAlpha(180); GuiTooltip carouselBtnTT(tr( "Display as a carousel" )); if (Settings.wsprompt == yes) carouselBtnTT.SetWidescreen(Settings.widescreen); - carouselBtnTT.SetAlpha(THEME.tooltipAlpha); + carouselBtnTT.SetAlpha(Theme.tooltipAlpha); GuiImage carouselBtnImg(&imgarrangeCarousel); carouselBtnImg.SetWidescreen(Settings.widescreen); GuiImage carouselBtnImg_g(&imgarrangeCarousel_gray); @@ -396,15 +397,15 @@ int MenuDiscList() carouselBtnImg_g.SetGrayscale(); } carouselBtnImg_g.SetWidescreen(Settings.widescreen); - GuiButton carouselBtn(&carouselBtnImg_g, &carouselBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_carousel_x, - THEME.gamelist_carousel_y, &trigA, &btnSoundOver, btnClick2, 1, &carouselBtnTT, 15, 52, 1, 3); + GuiButton carouselBtn(&carouselBtnImg_g, &carouselBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_carousel_x, + Theme.gamelist_carousel_y, &trigA, &btnSoundOver, btnClick2, 1, &carouselBtnTT, 15, 52, 1, 3); carouselBtn.SetAlpha(180); bool canUnlock = (Settings.parentalcontrol == 0 && Settings.Parental.enabled == 1); GuiTooltip lockBtnTT(canUnlock ? tr( "Unlock Parental Control" ) : tr( "Parental Control disabled" )); if (Settings.wsprompt == yes) lockBtnTT.SetWidescreen(Settings.widescreen); - lockBtnTT.SetAlpha(THEME.tooltipAlpha); + lockBtnTT.SetAlpha(Theme.tooltipAlpha); GuiImage lockBtnImg(&imgLock); lockBtnImg.SetWidescreen(Settings.widescreen); GuiImage lockBtnImg_g(&imgLock_gray); @@ -414,13 +415,13 @@ int MenuDiscList() lockBtnImg_g.SetGrayscale(); } lockBtnImg_g.SetWidescreen(Settings.widescreen); - GuiButton lockBtn(&lockBtnImg_g, &lockBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_lock_x, - THEME.gamelist_lock_y, &trigA, &btnSoundOver, btnClick2, 1, &lockBtnTT, 15, 52, 1, 3); + GuiButton lockBtn(&lockBtnImg_g, &lockBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_lock_x, + Theme.gamelist_lock_y, &trigA, &btnSoundOver, btnClick2, 1, &lockBtnTT, 15, 52, 1, 3); lockBtn.SetAlpha(180); GuiTooltip unlockBtnTT(tr( "Enable Parental Control" )); if (Settings.wsprompt == yes) unlockBtnTT.SetWidescreen(Settings.widescreen); - unlockBtnTT.SetAlpha(THEME.tooltipAlpha); + unlockBtnTT.SetAlpha(Theme.tooltipAlpha); GuiImage unlockBtnImg(&imgUnlock); unlockBtnImg.SetWidescreen(Settings.widescreen); GuiImage unlockBtnImg_g(&imgUnlock_gray); @@ -439,29 +440,29 @@ int MenuDiscList() } /* - GuiButton unlockBtn(&unlockBtnImg_g, &unlockBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_lock_x, THEME.gamelist_lock_y, &trigA, &btnSoundOver, btnClick2,1, &lockBtnTT, 15, 52, 1, 3); + GuiButton unlockBtn(&unlockBtnImg_g, &unlockBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_lock_x, Theme.gamelist_lock_y, &trigA, &btnSoundOver, btnClick2,1, &lockBtnTT, 15, 52, 1, 3); unlockBtn.SetAlpha(180); */ GuiTooltip dvdBtnTT(tr( "Mount DVD drive" )); if (Settings.wsprompt == yes) dvdBtnTT.SetWidescreen(Settings.widescreen); - dvdBtnTT.SetAlpha(THEME.tooltipAlpha); + dvdBtnTT.SetAlpha(Theme.tooltipAlpha); GuiImage dvdBtnImg(&imgdvd); dvdBtnImg.SetWidescreen(Settings.widescreen); GuiImage dvdBtnImg_g(dvdBtnImg); dvdBtnImg_g.SetWidescreen(Settings.widescreen); - GuiButton dvdBtn(&dvdBtnImg_g, &dvdBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_dvd_x, THEME.gamelist_dvd_y, + GuiButton dvdBtn(&dvdBtnImg_g, &dvdBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_dvd_x, Theme.gamelist_dvd_y, &trigA, &btnSoundOver, btnClick2, 1, &dvdBtnTT, 15, 52, 1, 3); dvdBtn.SetAlpha(180); GuiTooltip homebrewBtnTT(tr( "Homebrew Launcher" )); if (Settings.wsprompt == yes) homebrewBtnTT.SetWidescreen(Settings.widescreen); - homebrewBtnTT.SetAlpha(THEME.tooltipAlpha); + homebrewBtnTT.SetAlpha(Theme.tooltipAlpha); GuiImage homebrewImg(&homebrewImgData); GuiImage homebrewImgOver(&homebrewImgDataOver); homebrewImg.SetWidescreen(Settings.widescreen); homebrewImgOver.SetWidescreen(Settings.widescreen); - GuiButton homebrewBtn(&homebrewImg, &homebrewImgOver, ALIGN_LEFT, ALIGN_TOP, THEME.homebrew_x, THEME.homebrew_y, + GuiButton homebrewBtn(&homebrewImg, &homebrewImgOver, ALIGN_LEFT, ALIGN_TOP, Theme.homebrew_x, Theme.homebrew_y, &trigA, &btnSoundOver, btnClick2, 1, &homebrewBtnTT, 15, -30, 1, 5); if (Settings.fave) @@ -512,55 +513,55 @@ int MenuDiscList() if (Settings.gameDisplay == list) { - favoriteBtn.SetPosition(THEME.gamelist_favorite_x, THEME.gamelist_favorite_y); - searchBtn.SetPosition(THEME.gamelist_search_x, THEME.gamelist_search_y); - abcBtn.SetPosition(THEME.gamelist_abc_x, THEME.gamelist_abc_y); - countBtn.SetPosition(THEME.gamelist_count_x, THEME.gamelist_count_y); - listBtn.SetPosition(THEME.gamelist_list_x, THEME.gamelist_list_y); - gridBtn.SetPosition(THEME.gamelist_grid_x, THEME.gamelist_grid_y); - carouselBtn.SetPosition(THEME.gamelist_carousel_x, THEME.gamelist_carousel_y); - lockBtn.SetPosition(THEME.gamelist_lock_x, THEME.gamelist_lock_y); - dvdBtn.SetPosition(THEME.gamelist_dvd_x, THEME.gamelist_dvd_y); + favoriteBtn.SetPosition(Theme.gamelist_favorite_x, Theme.gamelist_favorite_y); + searchBtn.SetPosition(Theme.gamelist_search_x, Theme.gamelist_search_y); + abcBtn.SetPosition(Theme.gamelist_abc_x, Theme.gamelist_abc_y); + countBtn.SetPosition(Theme.gamelist_count_x, Theme.gamelist_count_y); + listBtn.SetPosition(Theme.gamelist_list_x, Theme.gamelist_list_y); + gridBtn.SetPosition(Theme.gamelist_grid_x, Theme.gamelist_grid_y); + carouselBtn.SetPosition(Theme.gamelist_carousel_x, Theme.gamelist_carousel_y); + lockBtn.SetPosition(Theme.gamelist_lock_x, Theme.gamelist_lock_y); + dvdBtn.SetPosition(Theme.gamelist_dvd_x, Theme.gamelist_dvd_y); } else if (Settings.gameDisplay == grid) { - favoriteBtn.SetPosition(THEME.gamegrid_favorite_x, THEME.gamegrid_favorite_y); - searchBtn.SetPosition(THEME.gamegrid_search_x, THEME.gamegrid_search_y); - abcBtn.SetPosition(THEME.gamegrid_abc_x, THEME.gamegrid_abc_y); - countBtn.SetPosition(THEME.gamegrid_count_x, THEME.gamegrid_count_y); - listBtn.SetPosition(THEME.gamegrid_list_x, THEME.gamegrid_list_y); - gridBtn.SetPosition(THEME.gamegrid_grid_x, THEME.gamegrid_grid_y); - carouselBtn.SetPosition(THEME.gamegrid_carousel_x, THEME.gamegrid_carousel_y); - lockBtn.SetPosition(THEME.gamegrid_lock_x, THEME.gamegrid_lock_y); - dvdBtn.SetPosition(THEME.gamegrid_dvd_x, THEME.gamegrid_dvd_y); + favoriteBtn.SetPosition(Theme.gamegrid_favorite_x, Theme.gamegrid_favorite_y); + searchBtn.SetPosition(Theme.gamegrid_search_x, Theme.gamegrid_search_y); + abcBtn.SetPosition(Theme.gamegrid_abc_x, Theme.gamegrid_abc_y); + countBtn.SetPosition(Theme.gamegrid_count_x, Theme.gamegrid_count_y); + listBtn.SetPosition(Theme.gamegrid_list_x, Theme.gamegrid_list_y); + gridBtn.SetPosition(Theme.gamegrid_grid_x, Theme.gamegrid_grid_y); + carouselBtn.SetPosition(Theme.gamegrid_carousel_x, Theme.gamegrid_carousel_y); + lockBtn.SetPosition(Theme.gamegrid_lock_x, Theme.gamegrid_lock_y); + dvdBtn.SetPosition(Theme.gamegrid_dvd_x, Theme.gamegrid_dvd_y); } else if (Settings.gameDisplay == carousel) { - favoriteBtn.SetPosition(THEME.gamecarousel_favorite_x, THEME.gamecarousel_favorite_y); - searchBtn.SetPosition(THEME.gamecarousel_search_x, THEME.gamecarousel_favorite_y); - abcBtn.SetPosition(THEME.gamecarousel_abc_x, THEME.gamecarousel_abc_y); - countBtn.SetPosition(THEME.gamecarousel_count_x, THEME.gamecarousel_count_y); - listBtn.SetPosition(THEME.gamecarousel_list_x, THEME.gamecarousel_list_y); - gridBtn.SetPosition(THEME.gamecarousel_grid_x, THEME.gamecarousel_grid_y); - carouselBtn.SetPosition(THEME.gamecarousel_carousel_x, THEME.gamecarousel_carousel_y); - lockBtn.SetPosition(THEME.gamecarousel_lock_x, THEME.gamecarousel_lock_y); - dvdBtn.SetPosition(THEME.gamecarousel_dvd_x, THEME.gamecarousel_dvd_y); + favoriteBtn.SetPosition(Theme.gamecarousel_favorite_x, Theme.gamecarousel_favorite_y); + searchBtn.SetPosition(Theme.gamecarousel_search_x, Theme.gamecarousel_favorite_y); + abcBtn.SetPosition(Theme.gamecarousel_abc_x, Theme.gamecarousel_abc_y); + countBtn.SetPosition(Theme.gamecarousel_count_x, Theme.gamecarousel_count_y); + listBtn.SetPosition(Theme.gamecarousel_list_x, Theme.gamecarousel_list_y); + gridBtn.SetPosition(Theme.gamecarousel_grid_x, Theme.gamecarousel_grid_y); + carouselBtn.SetPosition(Theme.gamecarousel_carousel_x, Theme.gamecarousel_carousel_y); + lockBtn.SetPosition(Theme.gamecarousel_lock_x, Theme.gamecarousel_lock_y); + dvdBtn.SetPosition(Theme.gamecarousel_dvd_x, Theme.gamecarousel_dvd_y); } //Downloading Covers GuiTooltip DownloadBtnTT(tr( "Click to Download Covers" )); if (Settings.wsprompt == yes) DownloadBtnTT.SetWidescreen(Settings.widescreen); - DownloadBtnTT.SetAlpha(THEME.tooltipAlpha); + DownloadBtnTT.SetAlpha(Theme.tooltipAlpha); GuiButton DownloadBtn(0, 0); DownloadBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP); - DownloadBtn.SetPosition(THEME.covers_x, THEME.covers_y); + DownloadBtn.SetPosition(Theme.covers_x, Theme.covers_y); GuiTooltip IDBtnTT(tr( "Click to change game ID" )); if (Settings.wsprompt == yes) IDBtnTT.SetWidescreen(Settings.widescreen); - IDBtnTT.SetAlpha(THEME.tooltipAlpha); + IDBtnTT.SetAlpha(Theme.tooltipAlpha); GuiButton idBtn(0, 0); idBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP); - idBtn.SetPosition(THEME.id_x, THEME.id_y); + idBtn.SetPosition(Theme.id_x, Theme.id_y); if (Settings.godmode == 1 && mountMethod != 3) //only make the button have trigger & tooltip if in godmode { @@ -585,43 +586,43 @@ int MenuDiscList() GuiGameCarousel * gameCarousel = NULL; if (Settings.gameDisplay == list) { - gameBrowser = new GuiGameBrowser(THEME.gamelist_w, THEME.gamelist_h, Settings.theme_path, bg_options_png, + gameBrowser = new GuiGameBrowser(Theme.gamelist_w, Theme.gamelist_h, Settings.theme_path, bg_options_png, startat, offset); - gameBrowser->SetPosition(THEME.gamelist_x, THEME.gamelist_y); + gameBrowser->SetPosition(Theme.gamelist_x, Theme.gamelist_y); gameBrowser->SetAlignment(ALIGN_LEFT, ALIGN_CENTRE); } else if (Settings.gameDisplay == grid) { - gameGrid = new GuiGameGrid(THEME.gamegrid_w, THEME.gamegrid_h, Settings.theme_path, bg_options_png, 0, 0); - gameGrid->SetPosition(THEME.gamegrid_x, THEME.gamegrid_y); + gameGrid = new GuiGameGrid(Theme.gamegrid_w, Theme.gamegrid_h, Settings.theme_path, bg_options_png, 0, 0); + gameGrid->SetPosition(Theme.gamegrid_x, Theme.gamegrid_y); gameGrid->SetAlignment(ALIGN_LEFT, ALIGN_CENTRE); } else if (Settings.gameDisplay == carousel) { - //GuiGameCarousel gameCarousel(THEME.gamecarousel_w, THEME.gamecarousel_h, gameList, gameList.size(), Settings.theme_path, bg_options_png, startat, offset); + //GuiGameCarousel gameCarousel(Theme.gamecarousel_w, Theme.gamecarousel_h, gameList, gameList.size(), Settings.theme_path, bg_options_png, startat, offset); gameCarousel = new GuiGameCarousel(640, 400, Settings.theme_path, bg_options_png, startat, offset); - gameCarousel->SetPosition(THEME.gamecarousel_x, THEME.gamecarousel_y); + gameCarousel->SetPosition(Theme.gamecarousel_x, Theme.gamecarousel_y); gameCarousel->SetAlignment(ALIGN_LEFT, ALIGN_CENTRE); } GuiText clockTimeBack("88:88", 40, ( GXColor ) - { THEME.clock.r, THEME.clock.g, THEME.clock.b, THEME.clock.a / 6}); - clockTimeBack.SetAlignment(THEME.clock_align, ALIGN_TOP); - clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y); + { Theme.clock.r, Theme.clock.g, Theme.clock.b, Theme.clock.a / 6}); + clockTimeBack.SetAlignment(Theme.clock_align, ALIGN_TOP); + clockTimeBack.SetPosition(Theme.clock_x, Theme.clock_y); clockTimeBack.SetFont(clock_ttf, clock_ttf_size); - GuiText clockTime(theTime, 40, THEME.clock); - clockTime.SetAlignment(THEME.clock_align, ALIGN_TOP); - clockTime.SetPosition(THEME.clock_x, THEME.clock_y); + GuiText clockTime(theTime, 40, Theme.clock); + clockTime.SetAlignment(Theme.clock_align, ALIGN_TOP); + clockTime.SetPosition(Theme.clock_x, Theme.clock_y); clockTime.SetFont(clock_ttf, clock_ttf_size); HaltGui(); GuiWindow w(screenwidth, screenheight); - if (THEME.show_hddinfo == -1 || THEME.show_hddinfo == 1) //force show hdd info + if (Theme.show_hddinfo == -1 || Theme.show_hddinfo == 1) //force show hdd info { w.Append(&usedSpaceTxt); } - if (THEME.show_gamecount == -1 || THEME.show_gamecount == 1) //force show game cnt info + if (Theme.show_gamecount == -1 || Theme.show_gamecount == 1) //force show game cnt info { w.Append(&gamecntBtn); } @@ -1583,9 +1584,9 @@ int MenuDiscList() if ((Settings.sinfo == GameID) || (Settings.sinfo == Both)) { - GameIDTxt = new GuiText(IDfull, 22, THEME.info); + GameIDTxt = new GuiText(IDfull, 22, Theme.info); GameIDTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); - //GameIDTxt->SetPosition(THEME.id_x,THEME.id_y); + //GameIDTxt->SetPosition(Theme.id_x,Theme.id_y); idBtn.SetEffect(EFFECT_FADE, 20); idBtn.SetLabel(GameIDTxt); w.Append(&idBtn); @@ -1593,9 +1594,9 @@ int MenuDiscList() //don't try to show region for channels because all the custom channels wont follow the rules if (((Settings.sinfo == GameRegion) || (Settings.sinfo == Both)) && mountMethod != 3) { - GameRegionTxt = new GuiText(gameregion, 22, THEME.info); + GameRegionTxt = new GuiText(gameregion, 22, Theme.info); GameRegionTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); - GameRegionTxt->SetPosition(THEME.region_x, THEME.region_y); + GameRegionTxt->SetPosition(Theme.region_x, Theme.region_y); GameRegionTxt->SetEffect(EFFECT_FADE, 20); w.Append(GameRegionTxt); } diff --git a/source/menu/menu_format.cpp b/source/menu/menu_format.cpp index ca452b96..05142d32 100644 --- a/source/menu/menu_format.cpp +++ b/source/menu/menu_format.cpp @@ -6,6 +6,7 @@ #include "usbloader/utils.h" #include "usbloader/wbfs.h" #include "libwiigui/gui_customoptionbrowser.h" +#include "themes/CTheme.h" extern int load_from_fs; extern char game_partition[6]; @@ -78,13 +79,13 @@ int MenuFormat() GuiImage poweroffBtnImgOver(&btnpwroffOver); poweroffBtnImg.SetWidescreen(Settings.widescreen); poweroffBtnImgOver.SetWidescreen(Settings.widescreen); - GuiButton poweroffBtn(&poweroffBtnImg, &poweroffBtnImgOver, 0, 3, THEME.power_x, THEME.power_y, &trigA, + GuiButton poweroffBtn(&poweroffBtnImg, &poweroffBtnImgOver, 0, 3, Theme.power_x, Theme.power_y, &trigA, &btnSoundOver, btnClick2, 1); GuiImage exitBtnImg(&btnhome); GuiImage exitBtnImgOver(&btnhomeOver); exitBtnImg.SetWidescreen(Settings.widescreen); exitBtnImgOver.SetWidescreen(Settings.widescreen); - GuiButton exitBtn(&exitBtnImg, &exitBtnImgOver, 0, 3, THEME.home_x, THEME.home_y, &trigA, &btnSoundOver, btnClick2, + GuiButton exitBtn(&exitBtnImg, &exitBtnImgOver, 0, 3, Theme.home_x, Theme.home_y, &trigA, &btnSoundOver, btnClick2, 1); exitBtn.SetTrigger(&trigHome); diff --git a/source/prompts/DiscBrowser.cpp b/source/prompts/DiscBrowser.cpp index d8cc9cec..593a0ba7 100644 --- a/source/prompts/DiscBrowser.cpp +++ b/source/prompts/DiscBrowser.cpp @@ -16,6 +16,7 @@ #include "main.h" #include "sys.h" #include "settings/cfg.h" +#include "themes/CTheme.h" #include "memory.h" #include "../gecko.h" #include "../patches/dvd_broadway.h" @@ -181,7 +182,7 @@ int DiscBrowse(struct discHdr * header) settingsbackgroundbtn.SetPosition(0, 0); settingsbackgroundbtn.SetImage(&settingsbackground); - GuiText cancelBtnTxt(tr( "Back" ), 22, THEME.prompttext); + GuiText cancelBtnTxt(tr( "Back" ), 22, Theme.prompttext); cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30); GuiImage cancelBtnImg(&btnOutline); if (Settings.wsprompt == yes) diff --git a/source/prompts/ProgressWindow.cpp b/source/prompts/ProgressWindow.cpp index 712fd358..ba027015 100644 --- a/source/prompts/ProgressWindow.cpp +++ b/source/prompts/ProgressWindow.cpp @@ -17,6 +17,7 @@ #include "prompts/ProgressWindow.h" #include "usbloader/wbfs.h" #include "usbloader/utils.h" +#include "themes/CTheme.h" /*** Variables used only in this file ***/ static lwp_t progressthread = LWP_THREAD_NULL; @@ -166,39 +167,39 @@ static void ProgressWindow(const char *title, const char *msg1, const char *msg2 progressbarImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); progressbarImg.SetPosition(25, 40); - GuiText titleTxt(title, 26, THEME.prompttext); + GuiText titleTxt(title, 26, Theme.prompttext); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0, 60); - GuiText msg1Txt(msg1, 22, THEME.prompttext); + GuiText msg1Txt(msg1, 22, Theme.prompttext); msg1Txt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); if (msg2) msg1Txt.SetPosition(0, 120); else msg1Txt.SetPosition(0, 100); msg1Txt.SetMaxWidth(430, DOTTED); - GuiText msg2Txt(msg2, 22, THEME.prompttext); + GuiText msg2Txt(msg2, 22, Theme.prompttext); msg2Txt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); msg2Txt.SetPosition(0, 125); msg2Txt.SetMaxWidth(430, DOTTED); - GuiText prsTxt("%", 22, THEME.prompttext); + GuiText prsTxt("%", 22, Theme.prompttext); prsTxt.SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE); prsTxt.SetPosition(-188, 40); - GuiText timeTxt((char*) NULL, 22, THEME.prompttext); + GuiText timeTxt((char*) NULL, 22, Theme.prompttext); timeTxt.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); timeTxt.SetPosition(280, -50); - GuiText sizeTxt((char*) NULL, 22, THEME.prompttext); + GuiText sizeTxt((char*) NULL, 22, Theme.prompttext); sizeTxt.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); sizeTxt.SetPosition(50, -50); - GuiText speedTxt((char*) NULL, 22, THEME.prompttext); + GuiText speedTxt((char*) NULL, 22, Theme.prompttext); speedTxt.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); speedTxt.SetPosition(50, -74); - GuiText prTxt((char*) NULL, 26, THEME.prompttext); + GuiText prTxt((char*) NULL, 26, Theme.prompttext); prTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); prTxt.SetPosition(200, 40); diff --git a/source/prompts/PromptWindows.cpp b/source/prompts/PromptWindows.cpp index 56a1c0aa..fa565123 100644 --- a/source/prompts/PromptWindows.cpp +++ b/source/prompts/PromptWindows.cpp @@ -20,6 +20,7 @@ #include "network/http.h" #include "prompts/PromptWindows.h" #include "prompts/gameinfo.h" +#include "themes/CTheme.h" #include "mload/mload.h" #include "fatmounter.h" #include "listfiles.h" @@ -85,7 +86,7 @@ int OnScreenNumpad(char * var, u32 maxlen) GuiTrigger trigB; trigB.SetSimpleTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B); - GuiText okBtnTxt(tr( "OK" ), 22, THEME.prompttext); + GuiText okBtnTxt(tr( "OK" ), 22, Theme.prompttext); GuiImage okBtnImg(&btnOutline); if (Settings.wsprompt == yes) { @@ -94,7 +95,7 @@ int OnScreenNumpad(char * var, u32 maxlen) } GuiButton okBtn(&okBtnImg, &okBtnImg, 0, 4, 5, -15, &trigA, &btnSoundOver, btnClick2, 1); okBtn.SetLabel(&okBtnTxt); - GuiText cancelBtnTxt(tr( "Cancel" ), 22, THEME.prompttext); + GuiText cancelBtnTxt(tr( "Cancel" ), 22, Theme.prompttext); GuiImage cancelBtnImg(&btnOutline); if (Settings.wsprompt == yes) { @@ -175,7 +176,7 @@ int OnScreenKeyboard(char * var, u32 maxlen, int min) GuiTrigger trigB; trigB.SetSimpleTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B); - GuiText okBtnTxt(tr( "OK" ), 22, THEME.prompttext); + GuiText okBtnTxt(tr( "OK" ), 22, Theme.prompttext); GuiImage okBtnImg(&btnOutline); if (Settings.wsprompt == yes) { @@ -184,7 +185,7 @@ int OnScreenKeyboard(char * var, u32 maxlen, int min) } GuiButton okBtn(&okBtnImg, &okBtnImg, 0, 4, 5, 15, &trigA, &btnSoundOver, btnClick2, 1); okBtn.SetLabel(&okBtnTxt); - GuiText cancelBtnTxt(tr( "Cancel" ), 22, THEME.prompttext); + GuiText cancelBtnTxt(tr( "Cancel" ), 22, Theme.prompttext); GuiImage cancelBtnImg(&btnOutline); if (Settings.wsprompt == yes) { @@ -561,15 +562,15 @@ int WindowPrompt(const char *title, const char *msg, const char *btn1Label, cons dialogBoxImg.SetWidescreen(Settings.widescreen); } - GuiText titleTxt(title, 26, THEME.prompttext); + GuiText titleTxt(title, 26, Theme.prompttext); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0, 55); - GuiText msgTxt(msg, 22, THEME.prompttext); + GuiText msgTxt(msg, 22, Theme.prompttext); msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); msgTxt.SetPosition(0, -40); msgTxt.SetMaxWidth(430); - GuiText btn1Txt(btn1Label, 22, THEME.prompttext); + GuiText btn1Txt(btn1Label, 22, Theme.prompttext); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt == yes) { @@ -581,7 +582,7 @@ int WindowPrompt(const char *title, const char *msg, const char *btn1Label, cons btn1.SetLabel(&btn1Txt); btn1.SetState(STATE_SELECTED); - GuiText btn2Txt(btn2Label, 22, THEME.prompttext); + GuiText btn2Txt(btn2Label, 22, Theme.prompttext); GuiImage btn2Img(&btnOutline); if (Settings.wsprompt == yes) { @@ -592,7 +593,7 @@ int WindowPrompt(const char *title, const char *msg, const char *btn1Label, cons btn2.SetLabel(&btn2Txt); if (!btn3Label && !btn4Label) btn2.SetTrigger(&trigB); - GuiText btn3Txt(btn3Label, 22, THEME.prompttext); + GuiText btn3Txt(btn3Label, 22, Theme.prompttext); GuiImage btn3Img(&btnOutline); if (Settings.wsprompt == yes) { @@ -603,7 +604,7 @@ int WindowPrompt(const char *title, const char *msg, const char *btn1Label, cons btn3.SetLabel(&btn3Txt); if (!btn4Label) btn3.SetTrigger(&trigB); - GuiText btn4Txt(btn4Label, 22, THEME.prompttext); + GuiText btn4Txt(btn4Label, 22, Theme.prompttext); GuiImage btn4Img(&btnOutline); if (Settings.wsprompt == yes) { @@ -1234,7 +1235,7 @@ int GameWindowPrompt() GuiTooltip nameBtnTT(tr( "Rename Game on WBFS" )); if (Settings.wsprompt == yes) nameBtnTT.SetWidescreen(Settings.widescreen); - GuiText nameTxt("", 22, THEME.prompttext); + GuiText nameTxt("", 22, Theme.prompttext); if (Settings.wsprompt == yes) nameTxt.SetWidescreen(Settings.widescreen); nameTxt.SetMaxWidth(350, SCROLL_HORIZONTAL); GuiButton nameBtn(120, 50); @@ -1252,7 +1253,7 @@ int GameWindowPrompt() nameBtn.SetEffectGrow(); } - GuiText sizeTxt((char*) NULL, 22, THEME.prompttext); //TODO: get the size here + GuiText sizeTxt((char*) NULL, 22, Theme.prompttext); //TODO: get the size here sizeTxt.SetAlignment(ALIGN_RIGHT, ALIGN_TOP); sizeTxt.SetPosition(-60, 70); @@ -1268,7 +1269,7 @@ int GameWindowPrompt() diskImg2.SetAngle(angle); diskImg2.SetBeta(180); - GuiText playcntTxt((char*) NULL, 18, THEME.info); + GuiText playcntTxt((char*) NULL, 18, Theme.info); playcntTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); playcntTxt.SetPosition(-115, 45); @@ -1282,7 +1283,7 @@ int GameWindowPrompt() btn1.SetTrigger(&trigA); btn1.SetState(STATE_SELECTED); - GuiText btn2Txt(tr( "Back" ), 22, THEME.prompttext); + GuiText btn2Txt(tr( "Back" ), 22, Theme.prompttext); GuiImage btn2Img(&btnOutline); if (Settings.wsprompt == yes) { @@ -1304,7 +1305,7 @@ int GameWindowPrompt() btn2.SetLabel(&btn2Txt); btn2.SetTrigger(&trigB); - GuiText btn3Txt(tr( "Settings" ), 22, THEME.prompttext); + GuiText btn3Txt(tr( "Settings" ), 22, Theme.prompttext); GuiImage btn3Img(&btnOutline); if (Settings.wsprompt == yes) { @@ -1834,15 +1835,15 @@ int DiscWait(const char *title, const char *msg, const char *btn1Label, const ch dialogBoxImg.SetWidescreen(Settings.widescreen); } - GuiText titleTxt(title, 26, THEME.prompttext); + GuiText titleTxt(title, 26, Theme.prompttext); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0, 60); - GuiText msgTxt(msg, 22, THEME.prompttext); + GuiText msgTxt(msg, 22, Theme.prompttext); msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); msgTxt.SetPosition(0, -40); msgTxt.SetMaxWidth(430); - GuiText btn1Txt(btn1Label, 22, THEME.prompttext); + GuiText btn1Txt(btn1Label, 22, Theme.prompttext); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt == yes) { @@ -1866,7 +1867,7 @@ int DiscWait(const char *title, const char *msg, const char *btn1Label, const ch btn1.SetTrigger(&trigB); btn1.SetState(STATE_SELECTED); - GuiText btn2Txt(btn2Label, 22, THEME.prompttext); + GuiText btn2Txt(btn2Label, 22, Theme.prompttext); GuiImage btn2Img(&btnOutline); if (Settings.wsprompt == yes) { @@ -1892,7 +1893,7 @@ int DiscWait(const char *title, const char *msg, const char *btn1Label, const ch } } - GuiText timerTxt((char*) NULL, 26, THEME.prompttext); + GuiText timerTxt((char*) NULL, 26, Theme.prompttext); timerTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); timerTxt.SetPosition(0, 160); @@ -1984,7 +1985,7 @@ int FormatingPartition(const char *title, partitionEntry *entry) dialogBoxImg.SetWidescreen(Settings.widescreen); } - GuiText titleTxt(title, 26, THEME.prompttext); + GuiText titleTxt(title, 26, Theme.prompttext); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0, 60); @@ -2042,12 +2043,12 @@ bool SearchMissingImages(int choice2) dialogBoxImg.SetWidescreen(Settings.widescreen); } - GuiText titleTxt(tr( "Checking existing artwork" ), 26, THEME.prompttext); + GuiText titleTxt(tr( "Checking existing artwork" ), 26, Theme.prompttext); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0, 60); char msg[20] = " "; - GuiText msgTxt(msg, 22, THEME.prompttext); + GuiText msgTxt(msg, 22, Theme.prompttext); msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); msgTxt.SetPosition(0, -40); @@ -2177,16 +2178,16 @@ bool NetworkInitPrompt() dialogBoxImg.SetWidescreen(Settings.widescreen); } - GuiText titleTxt(tr( "Initializing Network" ), 26, THEME.prompttext); + GuiText titleTxt(tr( "Initializing Network" ), 26, Theme.prompttext); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0, 60); char msg[20] = " "; - GuiText msgTxt(msg, 22, THEME.prompttext); + GuiText msgTxt(msg, 22, Theme.prompttext); msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); msgTxt.SetPosition(0, -40); - GuiText btn1Txt(tr( "Cancel" ), 22, THEME.prompttext); + GuiText btn1Txt(tr( "Cancel" ), 22, Theme.prompttext); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt == yes) { @@ -2308,23 +2309,23 @@ int ProgressDownloadWindow(int choice2) progressbarImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); progressbarImg.SetPosition(25, 40); - GuiText titleTxt(tr( "Downloading file" ), 26, THEME.prompttext); + GuiText titleTxt(tr( "Downloading file" ), 26, Theme.prompttext); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0, 60); - GuiText msgTxt((char*) NULL, 20, THEME.prompttext); + GuiText msgTxt((char*) NULL, 20, Theme.prompttext); msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); msgTxt.SetPosition(0, 130); - GuiText msg2Txt((char*) NULL, 26, THEME.prompttext); + GuiText msg2Txt((char*) NULL, 26, Theme.prompttext); msg2Txt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); msg2Txt.SetPosition(0, 100); - GuiText prTxt((char*) NULL, 26, THEME.prompttext); + GuiText prTxt((char*) NULL, 26, Theme.prompttext); prTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); prTxt.SetPosition(0, 40); - GuiText btn1Txt(tr( "Cancel" ), 22, THEME.prompttext); + GuiText btn1Txt(tr( "Cancel" ), 22, Theme.prompttext); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt == yes) { @@ -2919,24 +2920,24 @@ int ProgressUpdateWindow() char title[50]; sprintf( title, "%s", tr( "Checking for Updates" ) ); - GuiText titleTxt( title, 26, THEME.prompttext ); + GuiText titleTxt( title, 26, Theme.prompttext ); titleTxt.SetAlignment( ALIGN_CENTRE, ALIGN_TOP ); titleTxt.SetPosition( 0, 50 ); char msg[50]; sprintf( msg, "%s", tr( "Initializing Network" ) ); - GuiText msgTxt( msg, 26, THEME.prompttext ); + GuiText msgTxt( msg, 26, Theme.prompttext ); msgTxt.SetAlignment( ALIGN_CENTRE, ALIGN_TOP ); msgTxt.SetPosition( 0, 140 ); char msg2[50] = " "; - GuiText msg2Txt( msg2, 26, THEME.prompttext ); + GuiText msg2Txt( msg2, 26, Theme.prompttext ); msg2Txt.SetAlignment( ALIGN_CENTRE, ALIGN_MIDDLE ); msg2Txt.SetPosition( 0, 50 ); - GuiText prTxt( NULL, 26, THEME.prompttext ); + GuiText prTxt( NULL, 26, Theme.prompttext ); prTxt.SetAlignment( ALIGN_CENTRE, ALIGN_MIDDLE ); prTxt.SetPosition( 0, 7 ); - GuiText btn1Txt( tr( "Cancel" ), 22, THEME.prompttext ); + GuiText btn1Txt( tr( "Cancel" ), 22, Theme.prompttext ); GuiImage btn1Img( &btnOutline ); if ( Settings.wsprompt == yes ) { @@ -3285,24 +3286,24 @@ int ProgressUpdateWindow() char title[50]; sprintf(title, "%s", tr( "Checking for Updates" )); - GuiText titleTxt(title, 26, THEME.prompttext); + GuiText titleTxt(title, 26, Theme.prompttext); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0, 50); char msg[50]; sprintf(msg, "%s", tr( "Initializing Network" )); - GuiText msgTxt(msg, 26, THEME.prompttext); + GuiText msgTxt(msg, 26, Theme.prompttext); msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); msgTxt.SetPosition(0, 140); char msg2[50] = " "; - GuiText msg2Txt(msg2, 26, THEME.prompttext); + GuiText msg2Txt(msg2, 26, Theme.prompttext); msg2Txt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); msg2Txt.SetPosition(0, 50); - GuiText prTxt((char*) NULL, 26, THEME.prompttext); + GuiText prTxt((char*) NULL, 26, Theme.prompttext); prTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); prTxt.SetPosition(0, 7); - GuiText btn1Txt(tr( "Cancel" ), 22, THEME.prompttext); + GuiText btn1Txt(tr( "Cancel" ), 22, Theme.prompttext); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt == yes) { @@ -3661,20 +3662,20 @@ int CodeDownload(const char *id) char title[50]; sprintf(title, "%s", tr( "Code Download" )); - GuiText titleTxt(title, 26, THEME.prompttext); + GuiText titleTxt(title, 26, Theme.prompttext); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0, 50); char msg[50]; sprintf(msg, "%s", tr( "Initializing Network" )); - GuiText msgTxt(msg, 26, THEME.prompttext); + GuiText msgTxt(msg, 26, Theme.prompttext); msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); msgTxt.SetPosition(0, 140); char msg2[50] = " "; - GuiText msg2Txt(msg2, 26, THEME.prompttext); + GuiText msg2Txt(msg2, 26, Theme.prompttext); msg2Txt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); msg2Txt.SetPosition(0, 50); - GuiText btn1Txt(tr( "Cancel" ), 22, THEME.prompttext); + GuiText btn1Txt(tr( "Cancel" ), 22, Theme.prompttext); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt == yes) { @@ -3901,32 +3902,32 @@ int HBCWindowPrompt(const char *name, const char *coder, const char *version, co char tmp[510]; - GuiText nameTxt(name, 30, THEME.prompttext); + GuiText nameTxt(name, 30, Theme.prompttext); nameTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); nameTxt.SetPosition(0, -15); nameTxt.SetMaxWidth(430, SCROLL_HORIZONTAL); if (strcmp(coder, "")) snprintf(tmp, sizeof(tmp), tr( "Coded by: %s" ), coder); - GuiText coderTxt(tmp, 16, THEME.prompttext); + GuiText coderTxt(tmp, 16, Theme.prompttext); coderTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); coderTxt.SetPosition(180, 30); coderTxt.SetMaxWidth(280); if (strcmp(version, "")) snprintf(tmp, sizeof(tmp), tr( "Version: %s" ), version); - GuiText versionTxt(tmp, 16, THEME.prompttext); + GuiText versionTxt(tmp, 16, Theme.prompttext); versionTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); versionTxt.SetPosition(40, 65); versionTxt.SetMaxWidth(430); //if (release_date) //snprintf(tmp, sizeof(tmp), tr("Released: %s"),release_date); - GuiText release_dateTxt(release_date, 16, THEME.prompttext); + GuiText release_dateTxt(release_date, 16, Theme.prompttext); release_dateTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); release_dateTxt.SetPosition(40, 85); release_dateTxt.SetMaxWidth(430); int pagesize = 6; - Text long_descriptionTxt(long_description, 20, THEME.prompttext); + Text long_descriptionTxt(long_description, 20, Theme.prompttext); long_descriptionTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); long_descriptionTxt.SetPosition(46, 117); long_descriptionTxt.SetMaxWidth(360); @@ -3958,11 +3959,11 @@ int HBCWindowPrompt(const char *name, const char *coder, const char *version, co snprintf(filesizeCH, sizeof(filesizeCH), "%s MB", temp2); } - GuiText filesizeTxt(filesizeCH, 16, THEME.prompttext); + GuiText filesizeTxt(filesizeCH, 16, Theme.prompttext); filesizeTxt.SetAlignment(ALIGN_RIGHT, ALIGN_TOP); filesizeTxt.SetPosition(-40, 12); - GuiText btn1Txt(tr( "Load" ), 22, THEME.prompttext); + GuiText btn1Txt(tr( "Load" ), 22, Theme.prompttext); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt == yes) { @@ -3974,7 +3975,7 @@ int HBCWindowPrompt(const char *name, const char *coder, const char *version, co btn1.SetLabel(&btn1Txt); btn1.SetState(STATE_SELECTED); - GuiText btn2Txt(tr( "Back" ), 22, THEME.prompttext); + GuiText btn2Txt(tr( "Back" ), 22, Theme.prompttext); GuiImage btn2Img(&btnOutline); if (Settings.wsprompt == yes) { diff --git a/source/prompts/TitleBrowser.cpp b/source/prompts/TitleBrowser.cpp index 0fb8ea28..6eb7e2e1 100644 --- a/source/prompts/TitleBrowser.cpp +++ b/source/prompts/TitleBrowser.cpp @@ -17,6 +17,7 @@ #include "filelist.h" #include "listfiles.h" #include "settings/cfg.h" +#include "themes/CTheme.h" #include "sys.h" #include "menu.h" #include "audio.h" @@ -147,7 +148,7 @@ bool TitleSelector(char output[]) GuiTrigger trigB; trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B); - GuiText cancelBtnTxt(tr( "Back" ), 22, THEME.prompttext); + GuiText cancelBtnTxt(tr( "Back" ), 22, Theme.prompttext); cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30); GuiImage cancelBtnImg(&btnOutline); if (Settings.wsprompt == yes) @@ -387,7 +388,7 @@ int TitleBrowser() settingsbackgroundbtn.SetPosition(0, 0); settingsbackgroundbtn.SetImage(&settingsbackground); - GuiText cancelBtnTxt(tr( "Back" ), 22, THEME.prompttext); + GuiText cancelBtnTxt(tr( "Back" ), 22, Theme.prompttext); cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30); GuiImage cancelBtnImg(&btnOutline); if (Settings.wsprompt == yes) diff --git a/source/prompts/filebrowser.cpp b/source/prompts/filebrowser.cpp index 736e4713..697dc15a 100644 --- a/source/prompts/filebrowser.cpp +++ b/source/prompts/filebrowser.cpp @@ -21,6 +21,7 @@ #include "menu.h" +#include "themes/CTheme.h" #include "listfiles.h" #include "language/gettext.h" #include "PromptWindows.h" @@ -354,7 +355,7 @@ int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*= usbBtn.SetTrigger(&trigA); usbBtn.SetEffectGrow(); - GuiText okBtnTxt(tr( "OK" ), 22, THEME.prompttext); + GuiText okBtnTxt(tr( "OK" ), 22, Theme.prompttext); GuiImage okBtnImg(&btnOutline); if (Settings.wsprompt == yes) { diff --git a/source/settings/CSettings.cpp b/source/settings/CSettings.cpp index cf98fbd1..70c364cc 100644 --- a/source/settings/CSettings.cpp +++ b/source/settings/CSettings.cpp @@ -28,6 +28,7 @@ #include "CSettings.h" #include "language/gettext.h" +#include "themes/CTheme.h" #include "listfiles.h" #define DEFAULT_APP_PATH "apps/usbloader_gx/" @@ -38,6 +39,7 @@ CSettings Settings; CSettings::CSettings() { + CONF_Init(); strcpy(BootDevice, "SD:"); this->SetDefault(); } @@ -107,7 +109,6 @@ void CSettings::SetDefault() memset(&Parental, 0, sizeof(Parental)); char buf[0x4a]; - CONF_Init(); s32 res = CONF_Get("IPL.PC", buf, 0x4A); if (res > 0) { @@ -120,10 +121,48 @@ void CSettings::SetDefault() memcpy(Parental.pin, buf + 3, 4); memcpy(Parental.answer, buf + 8, 32); } - widescreen = CONF_GetAspectRatio(); + widescreen = (CONF_GetAspectRatio() == CONF_ASPECT_16_9); godmode = (Parental.enabled == 0) ? 1 : 0; - CFG_DefaultTheme(); + Theme.SetDefault(); //! We need to move this later +} + +bool CSettings::Load() +{ + FindConfig(); + + char line[1024]; + char filepath[300]; + snprintf(filepath, sizeof(filepath), "%s", ConfigPath); + + file = fopen(filepath, "r"); + if (!file) return false; + + while (fgets(line, sizeof(line), file)) + { + if (line[0] == '#') continue; + + this->ParseLine(line); + } + fclose(file); + + //!The following needs to be moved later + CFG_LoadGameNum(); + + snprintf(filepath, sizeof(filepath), "%sGXtheme.cfg", theme_path); + Theme.Load(filepath); + + return true; + +} + +bool CSettings::Reset() +{ + this->SetDefault(); + + if (this->Save()) return true; + + return false; } bool CSettings::Save() @@ -201,90 +240,11 @@ bool CSettings::Save() fprintf(file, "fullcopy = %d\n ", fullcopy); fprintf(file, "beta_upgrades = %d\n ", beta_upgrades); fprintf(file, "returnTo = %s\n ", returnTo); - //fprintf(file, "widescreen = %d\n ", widescreen);// no need to save this to the settings. it is determined by the CONF_ stuff and there is no way to adjust it in the gui fclose(file); return true; } -bool CSettings::FindConfig() -{ - bool found = false; - strcpy(BootDevice, "SD:"); - - for (int i = 0; i < 2; ++i) - { - if (i == 1) strcpy(BootDevice, "USB:"); - - snprintf(ConfigPath, sizeof(ConfigPath), "%s/config/GXGlobal.cfg", BootDevice); - if ((found = checkfile(ConfigPath))) break; - - snprintf(ConfigPath, sizeof(ConfigPath), "%s/apps/usbloader_gx/GXGlobal.cfg", BootDevice); - if ((found = checkfile(ConfigPath))) break; - } - - if (!found) - { - FILE * testFp = NULL; - strcpy(BootDevice, "SD:"); - //! No existing config so try to find a place where we can write it too - for (int i = 0; i < 2; ++i) - { - if (i == 1) strcpy(BootDevice, "USB:"); - if (!found) - { - snprintf(ConfigPath, sizeof(ConfigPath), "%s/config/GXGlobal.cfg", BootDevice); - testFp = fopen(ConfigPath, "wb"); - found = (testFp != NULL); - fclose(testFp); - } - if (!found) - { - snprintf(ConfigPath, sizeof(ConfigPath), "%s/apps/usbloader_gx/GXGlobal.cfg", BootDevice); - testFp = fopen(ConfigPath, "wb"); - found = (testFp != NULL); - fclose(testFp); - } - } - } - - return found; -} - -bool CSettings::Load() -{ - FindConfig(); - - char line[1024]; - char filepath[300]; - snprintf(filepath, sizeof(filepath), "%s", ConfigPath); - - file = fopen(filepath, "r"); - if (!file) return false; - - while (fgets(line, sizeof(line), file)) - { - if (line[0] == '#') continue; - - this->ParseLine(line); - } - fclose(file); - - CFG_LoadTheme(widescreen, theme_path); - - return true; - -} - -bool CSettings::Reset() -{ - this->SetDefault(); - - if (this->Save()) return true; - - return false; -} - bool CSettings::SetSetting(char *name, char *value) { int i = 0; @@ -596,6 +556,50 @@ bool CSettings::SetSetting(char *name, char *value) return false; } +bool CSettings::FindConfig() +{ + bool found = false; + strcpy(BootDevice, "SD:"); + + for (int i = 0; i < 2; ++i) + { + if (i == 1) strcpy(BootDevice, "USB:"); + + snprintf(ConfigPath, sizeof(ConfigPath), "%s/config/GXGlobal.cfg", BootDevice); + if ((found = checkfile(ConfigPath))) break; + + snprintf(ConfigPath, sizeof(ConfigPath), "%s/apps/usbloader_gx/GXGlobal.cfg", BootDevice); + if ((found = checkfile(ConfigPath))) break; + } + + if (!found) + { + FILE * testFp = NULL; + strcpy(BootDevice, "SD:"); + //! No existing config so try to find a place where we can write it too + for (int i = 0; i < 2; ++i) + { + if (i == 1) strcpy(BootDevice, "USB:"); + if (!found) + { + snprintf(ConfigPath, sizeof(ConfigPath), "%s/config/GXGlobal.cfg", BootDevice); + testFp = fopen(ConfigPath, "wb"); + found = (testFp != NULL); + fclose(testFp); + } + if (!found) + { + snprintf(ConfigPath, sizeof(ConfigPath), "%s/apps/usbloader_gx/GXGlobal.cfg", BootDevice); + testFp = fopen(ConfigPath, "wb"); + found = (testFp != NULL); + fclose(testFp); + } + } + } + + return found; +} + void CSettings::ParseLine(char *line) { char temp[1024], name[1024], value[1024]; diff --git a/source/settings/Settings.cpp b/source/settings/Settings.cpp index 252810e5..e6532ed6 100644 --- a/source/settings/Settings.cpp +++ b/source/settings/Settings.cpp @@ -10,6 +10,7 @@ #include "settings/SettingsPrompts.h" #include "prompts/filebrowser.h" #include "cheats/cheatmenu.h" +#include "themes/CTheme.h" #include "fatmounter.h" #include "menu.h" #include "menu/menus.h" @@ -156,7 +157,7 @@ int MenuSettings() GuiImage settingsbackground(&settingsbg); - GuiText backBtnTxt(tr( "Back" ), 22, THEME.prompttext); + GuiText backBtnTxt(tr( "Back" ), 22, Theme.prompttext); backBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30); GuiImage backBtnImg(&btnOutline); if (Settings.wsprompt == yes) @@ -1725,7 +1726,7 @@ int MenuSettings() else Settings.Save(); mainWindow->Remove(bgImg); HaltGui(); - CFG_LoadTheme(Settings.widescreen, Settings.theme_path); + Theme.Load(Settings.theme_path); ResumeGui(); menu = MENU_SETTINGS; snprintf(imgPath, sizeof(imgPath), "%splayer1_point.png", @@ -2332,7 +2333,7 @@ int GameSettings(struct discHdr * header) GuiImage settingsbackground(&settingsbg); - GuiText backBtnTxt(tr( "Back" ), 22, THEME.prompttext); + GuiText backBtnTxt(tr( "Back" ), 22, Theme.prompttext); backBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30); GuiImage backBtnImg(&btnOutline); if (Settings.wsprompt == yes) @@ -2347,7 +2348,7 @@ int GameSettings(struct discHdr * header) GuiButton homo(1, 1); homo.SetTrigger(&trigHome); - GuiText saveBtnTxt(tr( "Save" ), 22, THEME.prompttext); + GuiText saveBtnTxt(tr( "Save" ), 22, Theme.prompttext); saveBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30); GuiImage saveBtnImg(&btnOutline); if (Settings.wsprompt == yes) diff --git a/source/settings/SettingsPrompts.cpp b/source/settings/SettingsPrompts.cpp index 2ee89999..3c284dcf 100644 --- a/source/settings/SettingsPrompts.cpp +++ b/source/settings/SettingsPrompts.cpp @@ -8,6 +8,7 @@ #include "libwiigui/gui.h" #include "libwiigui/gui_customoptionbrowser.h" #include "settings/CSettings.h" +#include "themes/CTheme.h" #include "network/URL_List.h" #include "listfiles.h" #include "main.h" @@ -138,7 +139,7 @@ int MenuLanguageSelect() oggmenubackground.SetAlignment( ALIGN_LEFT, ALIGN_TOP ); oggmenubackground.SetPosition( 0, 0 ); - GuiText backBtnTxt( tr( "Back" ) , 22, THEME.prompttext ); + GuiText backBtnTxt( tr( "Back" ) , 22, Theme.prompttext ); backBtnTxt.SetMaxWidth( btnOutline.GetWidth() - 30 ); GuiImage backBtnImg( &btnOutline ); if ( Settings.wsprompt == yes ) @@ -157,7 +158,7 @@ int MenuLanguageSelect() backBtn.SetTrigger( &trigB ); backBtn.SetEffectGrow(); - GuiText defaultBtnTxt( tr( "Default" ) , 22, THEME.prompttext ); + GuiText defaultBtnTxt( tr( "Default" ) , 22, Theme.prompttext ); defaultBtnTxt.SetMaxWidth( btnOutline.GetWidth() - 30 ); GuiImage defaultBtnImg( &btnOutline ); if ( Settings.wsprompt == yes ) @@ -175,7 +176,7 @@ int MenuLanguageSelect() defaultBtn.SetTrigger( &trigA ); defaultBtn.SetEffectGrow(); - GuiText updateBtnTxt( tr( "Update Files" ) , 22, THEME.prompttext ); + GuiText updateBtnTxt( tr( "Update Files" ) , 22, Theme.prompttext ); updateBtnTxt.SetMaxWidth( btnOutline.GetWidth() - 30 ); GuiImage updateBtnImg( &btnOutline ); if ( Settings.wsprompt == yes ) diff --git a/source/settings/cfg.c b/source/settings/cfg.c index ddf3f471..c9f54fa3 100644 --- a/source/settings/cfg.c +++ b/source/settings/cfg.c @@ -11,9 +11,7 @@ #include "cfg.h" #define isspace2(c) (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v') -static bool WideScreen = false; -struct THEME THEME; u8 ocarinaChoice = 0; u8 videoChoice = 0; u8 faveChoice = no; @@ -83,10 +81,6 @@ struct TextMap map_language[] = { { "console", CFG_LANG_CONSOLE }, { "japanese", CFG_LANG_S_CHINESE }, // without a dot between s and chinese to match the language filename "schinese.lang" { "tchinese", CFG_LANG_T_CHINESE }, { "korean", CFG_LANG_KOREAN }, { NULL, -1 } }; -struct TextMap map_alignment[] = { { "left", CFG_ALIGN_LEFT }, { "right", CFG_ALIGN_RIGHT }, { "center", - CFG_ALIGN_CENTRE }, { "top", CFG_ALIGN_TOP }, { "bottom", CFG_ALIGN_BOTTOM }, { "middle", CFG_ALIGN_MIDDLE }, { - NULL, -1 } }; - int map_get_id(struct TextMap *map, char *name) { int i; @@ -156,136 +150,6 @@ void cfg_int(char *name, short *var, int count) } } -/* Mapping */ - -//static char bg_path[100]; - -void CFG_DefaultTheme() // -1 = non forced Mode -{ - //always set Theme defaults - //all alignments are left top here - THEME.gamelist_x = 200; - THEME.gamelist_y = 49;//40; - THEME.gamelist_w = 396; - THEME.gamelist_h = 280; - THEME.gamegrid_w = 640; - THEME.gamegrid_h = 400; - THEME.gamegrid_x = 0; - THEME.gamegrid_y = 20; - THEME.gamecarousel_w = 640; - THEME.gamecarousel_h = 400; - THEME.gamecarousel_x = 0; - THEME.gamecarousel_y = -20; - - THEME.covers_x = 26; - THEME.covers_y = 58; - - THEME.show_id = 1; - THEME.id_x = 68; - THEME.id_y = 305; - THEME.show_region = 1; - THEME.region_x = 68; - THEME.region_y = 30; - - THEME.sdcard_x = 160; - THEME.sdcard_y = 395; - THEME.homebrew_x = 410; - THEME.homebrew_y = 405; - THEME.power_x = 576; - THEME.power_y = 355; - THEME.home_x = 489;//215; - THEME.home_y = 371; - THEME.setting_x = 64;//-210 - THEME.setting_y = 371; - THEME.install_x = 16;//-280 - THEME.install_y = 355; - - THEME.clock = ( GXColor) - { 138, 138, 138, 240}; - THEME.clock_align = CFG_ALIGN_CENTRE; - THEME.clock_x = 0; - THEME.clock_y = 335;//330; - - THEME.info = ( GXColor ) - { 55, 190, 237, 255}; - THEME.show_hddinfo = 1; //default - THEME.hddinfo_align = CFG_ALIGN_CENTRE; - THEME.hddinfo_x = 0; - THEME.hddinfo_y = 400; - THEME.show_gamecount = 1; //default - THEME.gamecount_align = CFG_ALIGN_CENTRE; - THEME.gamecount_x = 0; - THEME.gamecount_y = 420; - - THEME.show_tooltip = 1; //1 means use settings, 0 means force turn off - THEME.tooltipAlpha = 255; - - THEME.prompttext = ( GXColor ) - { 0, 0, 0, 255}; - THEME.settingstext = ( GXColor ) - { 0, 0, 0, 255}; - THEME.gametext = ( GXColor ) - { 0, 0, 0, 255}; - - THEME.pagesize = 9; - - THEME.gamelist_favorite_x = WideScreen ? 256 : 220; - THEME.gamelist_favorite_y = 13; - THEME.gamelist_search_x = WideScreen ? 288 : 260; - THEME.gamelist_search_y = 13; - THEME.gamelist_abc_x = WideScreen ? 320 : 300; - THEME.gamelist_abc_y = 13; - THEME.gamelist_count_x = WideScreen ? 352 : 340; - THEME.gamelist_count_y = 13; - THEME.gamelist_list_x = WideScreen ? 384 : 380; - THEME.gamelist_list_y = 13; - THEME.gamelist_grid_x = WideScreen ? 416 : 420; - THEME.gamelist_grid_y = 13; - THEME.gamelist_carousel_x = WideScreen ? 448 : 460; - THEME.gamelist_carousel_y = 13; - THEME.gamelist_lock_x = WideScreen ? 480 : 500; - THEME.gamelist_lock_y = 13; - THEME.gamelist_dvd_x = WideScreen ? 512 : 540; - THEME.gamelist_dvd_y = 13; - - THEME.gamegrid_favorite_x = WideScreen ? 192 : 160; - THEME.gamegrid_favorite_y = 13; - THEME.gamegrid_search_x = WideScreen ? 224 : 200; - THEME.gamegrid_search_y = 13; - THEME.gamegrid_abc_x = WideScreen ? 256 : 240; - THEME.gamegrid_abc_y = 13; - THEME.gamegrid_count_x = WideScreen ? 288 : 280; - THEME.gamegrid_count_y = 13; - THEME.gamegrid_list_x = WideScreen ? 320 : 320; - THEME.gamegrid_list_y = 13; - THEME.gamegrid_grid_x = WideScreen ? 352 : 360; - THEME.gamegrid_grid_y = 13; - THEME.gamegrid_carousel_x = WideScreen ? 384 : 400; - THEME.gamegrid_carousel_y = 13; - THEME.gamegrid_lock_x = WideScreen ? 416 : 440; - THEME.gamegrid_lock_y = 13; - THEME.gamegrid_dvd_x = WideScreen ? 448 : 480; - THEME.gamegrid_dvd_y = 13; - - THEME.gamecarousel_favorite_x = WideScreen ? 192 : 160; - THEME.gamecarousel_favorite_y = 13; - THEME.gamecarousel_search_x = WideScreen ? 224 : 200; - THEME.gamecarousel_search_y = 13; - THEME.gamecarousel_abc_x = WideScreen ? 256 : 240; - THEME.gamecarousel_abc_y = 13; - THEME.gamecarousel_count_x = WideScreen ? 288 : 280; - THEME.gamecarousel_count_y = 13; - THEME.gamecarousel_list_x = WideScreen ? 320 : 320; - THEME.gamecarousel_list_y = 13; - THEME.gamecarousel_grid_x = WideScreen ? 352 : 360; - THEME.gamecarousel_grid_y = 13; - THEME.gamecarousel_carousel_x = WideScreen ? 384 : 400; - THEME.gamecarousel_carousel_y = 13; - THEME.gamecarousel_lock_x = WideScreen ? 416 : 440; - THEME.gamecarousel_lock_y = 13; - THEME.gamecarousel_dvd_x = WideScreen ? 448 : 480; - THEME.gamecarousel_dvd_y = 13; - } char *cfg_get_title(u8 *id) { @@ -426,339 +290,6 @@ char* trimcopy(char *dest, char *src, int size) return dest; } -static u32 wCOORDS_FLAGS[2] = { 0, 0 }; // space for 64 coords - this is enough, also for the future -#define GET_wCOORD_FLAG(i) (wCOORDS_FLAGS[i/32] & (1UL << (i%32))) -#define SET_wCOORD_FLAG(i) (wCOORDS_FLAGS[i/32] |= (1UL << (i%32))) -#define CLEAR_wCOORD_FLAGS (wCOORDS_FLAGS[0] = wCOORDS_FLAGS[1] = 0) - -#define CFG_COORDS2(name) \ - if ((wcoords_idx++, 1) && !GET_wCOORD_FLAG(wcoords_idx) && \ - strcmp(cfg_name, #name "_coords") == 0) { \ - short x,y; \ - if (sscanf(val, "%hd,%hd", &x, &y) == 2) { \ - THEME.name##_x = x; \ - THEME.name##_y = y; \ - } \ - } \ - else if (WideScreen && \ - strcmp(cfg_name, "w" #name "_coords") == 0) { \ - short x,y; \ - if (sscanf(val, "%hd,%hd", &x, &y) == 2) { \ - THEME.name##_x = x; \ - THEME.name##_y = y; \ - SET_wCOORD_FLAG(wcoords_idx); \ - } \ - } -#define CFG_COORDS4(name) \ - if ((wcoords_idx++, 1) && !GET_wCOORD_FLAG(wcoords_idx) && \ - strcmp(cfg_name, #name "_coords") == 0) { \ - short x,y,w,h; \ - if (sscanf(val, "%hd,%hd,%hd,%hd", &x, &y, &w, &h) == 4) { \ - THEME.name##_x = x; \ - THEME.name##_y = y; \ - THEME.name##_w = w; \ - THEME.name##_h = h; \ - } \ - } \ - else if (WideScreen && \ - strcmp(cfg_name, "w" #name "_coords") == 0) { \ - short x,y,w,h; \ - if (sscanf(val, "%hd,%hd,%hd,%hd", &x, &y, &w, &h) == 4) { \ - THEME.name##_x = x; \ - THEME.name##_y = y; \ - THEME.name##_w = w; \ - THEME.name##_h = h; \ - SET_wCOORD_FLAG(wcoords_idx); \ - } \ - } -#define CFG_COLOR(name) \ - if (strcmp(cfg_name, #name "_color") == 0) { \ - short r,g,b,a; \ - int c = sscanf(val, "%hd,%hd,%hd,%hd", &r, &g, &b, &a); \ - if(c >= 3) { \ - THEME.name.r = r; \ - THEME.name.g = g; \ - THEME.name.b = b; \ - if(c >= 4) \ - THEME.name.a = a; \ - } \ - } -#define CFG_VAL(name) \ - if (strcmp(cfg_name, #name) == 0) { \ - short v; \ - if (sscanf(val, "%hd", &v) == 1) { \ - THEME.name = v; \ - } \ - } - -#define CFG_BOOL(name) if(cfg_bool(#name, &THEME.name)); - -#define CFG_ALIGN(name) if(cfg_map_auto(#name "_align", map_alignment, &THEME.name##_align)); - -#define OLD_FAV_ICON 1 -#define OLD_ABC_ICON 2 -#define OLD_COUNT_ICON 4 -#define OLD_LIST_ICON 8 -#define OLD_GRID_ICON 16 -#define OLD_CAROUSEL_ICON 32 -static short WorkAroundIconSet = 0; -static short WorkAroundBarOffset = 100; - -void theme_set(char *name, char *val) -{ - cfg_name = name; - cfg_val = val; - int wcoords_idx = -1; - - CFG_COORDS4( gamelist ) -else CFG_COORDS4( gamegrid ) - else CFG_COORDS4( gamecarousel ) - - else CFG_COORDS2( covers ) - - else CFG_BOOL( show_id ) - else CFG_COORDS2( id ) - - else CFG_BOOL( show_region ) - else CFG_COORDS2( region ) - - else CFG_COORDS2( sdcard ) - else CFG_COORDS2( homebrew ) - else CFG_COORDS2( power ) - else CFG_COORDS2( home ) - else CFG_COORDS2( setting ) - else CFG_COORDS2( install ) - - else CFG_COORDS2( clock ) - else CFG_ALIGN( clock ) - else CFG_COLOR( clock ) - - else CFG_COLOR( info ) - else CFG_BOOL( show_hddinfo ) - else CFG_ALIGN( hddinfo ) - else CFG_COORDS2( hddinfo ) - - else CFG_BOOL( show_gamecount ) - else CFG_ALIGN( gamecount ) - else CFG_COORDS2( gamecount ) - - else CFG_BOOL( show_tooltip ) - else CFG_VAL( tooltipAlpha ) - - else CFG_COLOR( prompttext ) - else CFG_COLOR( settingstext ) - else CFG_COLOR( gametext ) - - else CFG_VAL( pagesize ) - - else CFG_COORDS2( gamelist_favorite ) - else CFG_COORDS2( gamegrid_favorite ) - else CFG_COORDS2( gamecarousel_favorite ) - - else CFG_COORDS2( gamelist_search ) - else CFG_COORDS2( gamegrid_search ) - else CFG_COORDS2( gamecarousel_search ) - - else CFG_COORDS2( gamelist_abc ) - else CFG_COORDS2( gamegrid_abc ) - else CFG_COORDS2( gamecarousel_abc ) - - else CFG_COORDS2( gamelist_count ) - else CFG_COORDS2( gamegrid_count ) - else CFG_COORDS2( gamecarousel_count ) - - else CFG_COORDS2( gamelist_list ) - else CFG_COORDS2( gamegrid_list ) - else CFG_COORDS2( gamecarousel_list ) - - else CFG_COORDS2( gamelist_grid ) - else CFG_COORDS2( gamegrid_grid ) - else CFG_COORDS2( gamecarousel_grid ) - - else CFG_COORDS2( gamelist_carousel ) - else CFG_COORDS2( gamegrid_carousel ) - else CFG_COORDS2( gamecarousel_carousel ) - - else CFG_COORDS2( gamelist_lock ) - else CFG_COORDS2( gamegrid_lock ) - else CFG_COORDS2( gamecarousel_lock ) - - else CFG_COORDS2( gamelist_dvd ) - else CFG_COORDS2( gamegrid_dvd ) - else CFG_COORDS2( gamecarousel_dvd ) - - //********************************** - // Workaround for old Themes - //********************************** - - else if ( strcmp( cfg_name, "favorite_coords" ) == 0 ) - { - short x, y; - if ( sscanf( val, "%hd,%hd", &x, &y ) == 2 ) - { - // the old Icons are aligned at center and the new at the left top corner. - // we must add 320 and sub the half image width to get the correct position. - x += 300; - // the old stuff is optimized for WideScreen. - // if no WideScreen, we must reposition the pos - if ( !WideScreen ) x -= 20; - // old themes have no search_coords - // set the searchIcon to the Position of the favIcon - THEME.gamelist_search_x = x; - THEME.gamegrid_search_x = THEME.gamecarousel_search_x = x - WorkAroundBarOffset; - THEME.gamelist_search_y = THEME.gamegrid_search_y = THEME.gamecarousel_search_y = y; - // place the favIcon to the left side of the searchIcon - if ( !WideScreen ) x -= WideScreen ? 32 : 40; - THEME.gamelist_favorite_x = x; - THEME.gamegrid_favorite_x = THEME.gamecarousel_favorite_x = x - WorkAroundBarOffset; - THEME.gamelist_favorite_y = THEME.gamegrid_favorite_y = THEME.gamecarousel_favorite_y = y; - WorkAroundIconSet |= OLD_FAV_ICON; - } - } - else if ( strcmp( cfg_name, "abc_coords" ) == 0 ) - { - short x, y; - if ( sscanf( val, "%hd,%hd", &x, &y ) == 2 ) - { - // the old Icons are aligned at center and the new at the left top corner. - // we must add 320 and sub the half image width to get the correct position. - x += 300; - // the old stuff is optimized for WideScreen. - // if no WideScreen, we must reposition the pos - if ( !WideScreen ) x -= 12; - THEME.gamelist_abc_x = x; - THEME.gamegrid_abc_x = THEME.gamecarousel_abc_x = x - WorkAroundBarOffset; - THEME.gamelist_abc_y = THEME.gamegrid_abc_y = THEME.gamecarousel_abc_y = y; - WorkAroundIconSet |= OLD_ABC_ICON; - } - } - else if ( strcmp( cfg_name, "count_coords" ) == 0 ) - { - short x, y; - if ( sscanf( val, "%hd,%hd", &x, &y ) == 2 ) - { - // the old Icons are aligned at center and the new at the left top corner. - // we must add 320 and sub the half image width to get the correct position. - x += 300; - // the old stuff is optimized for WideScreen. - // if no WideScreen, we must reposition the pos - if ( !WideScreen ) x -= 4; - THEME.gamelist_count_x = x; - THEME.gamegrid_count_x = THEME.gamecarousel_count_x = x - WorkAroundBarOffset; - THEME.gamelist_count_y = THEME.gamegrid_count_y = THEME.gamecarousel_count_y = y; - WorkAroundIconSet |= OLD_COUNT_ICON; - } - } - else if ( strcmp( cfg_name, "list_coords" ) == 0 ) - { - short x, y; - if ( sscanf( val, "%hd,%hd", &x, &y ) == 2 ) - { - // the old Icons are aligned at center and the new at the left top corner. - // we must add 320 and sub the half image width to get the correct position. - x += 300; - // the old stuff is optimized for WideScreen. - // if no WideScreen, we must reposition the pos - if ( !WideScreen ) x += 4; - THEME.gamelist_list_x = x; - THEME.gamegrid_list_x = THEME.gamecarousel_list_x = x - WorkAroundBarOffset; - THEME.gamelist_list_y = THEME.gamegrid_list_y = THEME.gamecarousel_list_y = y; - WorkAroundIconSet |= OLD_LIST_ICON; - } - } - else if ( strcmp( cfg_name, "grid_coords" ) == 0 ) - { - short x, y; - if ( sscanf( val, "%hd,%hd", &x, &y ) == 2 ) - { - // the old Icons are aligned at center and the new at the left top corner. - // we must add 320 and sub the half image width to get the correct position. - x += 300; - // the old stuff is optimized for WideScreen. - // if no WideScreen, we must reposition the pos - if ( !WideScreen ) x += 12; - THEME.gamelist_grid_x = x; - THEME.gamegrid_grid_x = THEME.gamecarousel_grid_x = x - WorkAroundBarOffset; - THEME.gamelist_grid_y = THEME.gamegrid_grid_y = THEME.gamecarousel_grid_y = y; - WorkAroundIconSet |= OLD_GRID_ICON; - } - } - else if ( strcmp( cfg_name, "carousel_coords" ) == 0 ) - { - short x, y; - if ( sscanf( val, "%hd,%hd", &x, &y ) == 2 ) - { - // the old Icons are aligned at center and the new at the left top corner. - // we must add 320 and sub the half image width to get the correct position. - x += 300; - // the old stuff is optimized for WideScreen. - // if no WideScreen, we must reposition the pos - if ( !WideScreen ) x += 20; - THEME.gamelist_carousel_x = x; - THEME.gamegrid_carousel_x = THEME.gamecarousel_carousel_x = x - WorkAroundBarOffset; - THEME.gamelist_carousel_y = THEME.gamegrid_carousel_y = THEME.gamecarousel_carousel_y = y; - WorkAroundIconSet |= OLD_CAROUSEL_ICON; - - // old themes have no dvd_coords - // place the dvdIcon to the right side of the carouselIcon - if ( !WideScreen ) x += WideScreen ? 32 : 40; - THEME.gamelist_lock_x = x; - THEME.gamegrid_lock_x = THEME.gamecarousel_lock_x = x - WorkAroundBarOffset; - THEME.gamelist_lock_y = THEME.gamegrid_lock_y = THEME.gamecarousel_lock_y = y; - - x += WideScreen ? 32 : 40; - THEME.gamelist_dvd_x = x; - THEME.gamegrid_dvd_x = THEME.gamecarousel_dvd_x = x - WorkAroundBarOffset; - THEME.gamelist_dvd_y = THEME.gamegrid_dvd_y = THEME.gamecarousel_dvd_y = y; - } - } - - else if ( strcmp( cfg_name, "sortBarOffset" ) == 0 ) - { - short o; - if ( sscanf( val, "%hd", &o ) == 1 ) - { - if ( WorkAroundIconSet & OLD_FAV_ICON ) - { - THEME.gamegrid_favorite_x += WorkAroundBarOffset - o; - THEME.gamecarousel_favorite_x += WorkAroundBarOffset - o; - THEME.gamegrid_search_x += WorkAroundBarOffset - o; - THEME.gamecarousel_search_x += WorkAroundBarOffset - o; - } - if ( WorkAroundIconSet & OLD_ABC_ICON ) - { - THEME.gamegrid_abc_x += WorkAroundBarOffset - o; - THEME.gamecarousel_abc_x += WorkAroundBarOffset - o; - } - if ( WorkAroundIconSet & OLD_COUNT_ICON ) - { - THEME.gamegrid_count_x += WorkAroundBarOffset - o; - THEME.gamecarousel_count_x += WorkAroundBarOffset - o; - } - if ( WorkAroundIconSet & OLD_LIST_ICON ) - { - THEME.gamegrid_list_x += WorkAroundBarOffset - o; - THEME.gamecarousel_list_x += WorkAroundBarOffset - o; - } - if ( WorkAroundIconSet & OLD_GRID_ICON ) - { - THEME.gamegrid_grid_x += WorkAroundBarOffset - o; - THEME.gamecarousel_grid_x += WorkAroundBarOffset - o; - } - if ( WorkAroundIconSet & OLD_CAROUSEL_ICON ) - { - THEME.gamegrid_carousel_x += WorkAroundBarOffset - o; - THEME.gamecarousel_carousel_x += WorkAroundBarOffset - o; - THEME.gamegrid_lock_x += WorkAroundBarOffset - o; - THEME.gamecarousel_lock_x += WorkAroundBarOffset - o; - THEME.gamegrid_dvd_x += WorkAroundBarOffset - o; - THEME.gamecarousel_dvd_x += WorkAroundBarOffset - o; - } - WorkAroundBarOffset = o; - } - } - -} // split line to part1 delimiter part2 bool trimsplit(char *line, char *part1, char *part2, char delim, int size) @@ -1368,18 +899,9 @@ bool CFG_forget_game_num(u8 *id) return cfg_save_game_num(); } -void CFG_LoadTheme(bool wide, const char * theme_path) +void CFG_LoadGameNum() { char pathname[200]; - WideScreen = wide; - - CFG_DefaultTheme(); // set defaults non forced - - WorkAroundIconSet = 0; - WorkAroundBarOffset = 100; // set Workaroundstuff to defaults - CLEAR_wCOORD_FLAGS; - snprintf(pathname, sizeof(pathname), "%sGXtheme.cfg", theme_path); - cfg_parsefile(pathname, &theme_set); //finally set theme information snprintf(pathname, sizeof(pathname), "%s/config/GXGameSettings.cfg", bootDevice); cfg_parsefile(pathname, &parental_set); diff --git a/source/settings/cfg.h b/source/settings/cfg.h index 429b95e6..c79781dd 100644 --- a/source/settings/cfg.h +++ b/source/settings/cfg.h @@ -35,154 +35,8 @@ extern "C" #define CFG_LANG_KOREAN 10 #define CFG_LANG_COUNT 11 -#define CFG_ALIGN_LEFT 0 -#define CFG_ALIGN_RIGHT 1 -#define CFG_ALIGN_CENTRE 2 -#define CFG_ALIGN_TOP 3 -#define CFG_ALIGN_BOTTOM 4 -#define CFG_ALIGN_MIDDLE 5 - extern char bootDevice[10]; - struct THEME - { - short gamelist_x; - short gamelist_y; - short gamelist_w; - short gamelist_h; - short gamegrid_x; - short gamegrid_y; - short gamegrid_w; - short gamegrid_h; - short gamecarousel_x; - short gamecarousel_y; - short gamecarousel_w; - short gamecarousel_h; - - short covers_x; - short covers_y; - - short show_id; - short id_x; - short id_y; - short show_region; - short region_x; - short region_y; - - short sdcard_x; - short sdcard_y; - short homebrew_x; - short homebrew_y; - short power_x; - short power_y; - short home_x; - short home_y; - short setting_x; - short setting_y; - short install_x; - short install_y; - GXColor clock; - short clock_align; - short clock_x; - short clock_y; - - GXColor info; - short show_hddinfo; - short hddinfo_align; - short hddinfo_x; - short hddinfo_y; - - short show_gamecount; - short gamecount_align; - short gamecount_x; - short gamecount_y; - - short show_tooltip; - int tooltipAlpha; - - GXColor prompttext; - GXColor settingstext; - GXColor gametext; - short pagesize; - - // Toolbar Icons in GameList - /* - short favorite_x; - short favorite_y; - short search_x; - short search_y; - short abc_x; - short abc_y; - short count_x; - short count_y; - short list_x; - short list_y; - short grid_x; - short grid_y; - short carousel_x; - short carousel_y; - short sortBarOffset; - */ - // Toolbar Icons in GameList - short gamelist_favorite_x; - short gamelist_favorite_y; - short gamelist_search_x; - short gamelist_search_y; - short gamelist_abc_x; - short gamelist_abc_y; - short gamelist_count_x; - short gamelist_count_y; - short gamelist_list_x; - short gamelist_list_y; - short gamelist_grid_x; - short gamelist_grid_y; - short gamelist_carousel_x; - short gamelist_carousel_y; - short gamelist_dvd_x; - short gamelist_dvd_y; - short gamelist_lock_x; - short gamelist_lock_y; - // Toolbar Icons in GameGrid - short gamegrid_favorite_x; - short gamegrid_favorite_y; - short gamegrid_search_x; - short gamegrid_search_y; - short gamegrid_abc_x; - short gamegrid_abc_y; - short gamegrid_count_x; - short gamegrid_count_y; - short gamegrid_list_x; - short gamegrid_list_y; - short gamegrid_grid_x; - short gamegrid_grid_y; - short gamegrid_carousel_x; - short gamegrid_carousel_y; - short gamegrid_dvd_x; - short gamegrid_dvd_y; - short gamegrid_lock_x; - short gamegrid_lock_y; - // Toolbar Icons in GameCarousel - short gamecarousel_favorite_x; - short gamecarousel_favorite_y; - short gamecarousel_search_x; - short gamecarousel_search_y; - short gamecarousel_abc_x; - short gamecarousel_abc_y; - short gamecarousel_count_x; - short gamecarousel_count_y; - short gamecarousel_list_x; - short gamecarousel_list_y; - short gamecarousel_grid_x; - short gamecarousel_grid_y; - short gamecarousel_carousel_x; - short gamecarousel_carousel_y; - short gamecarousel_dvd_x; - short gamecarousel_dvd_y; - short gamecarousel_lock_x; - short gamecarousel_lock_y; - }; - - extern struct THEME THEME; extern u8 ocarinaChoice; extern u16 playcnt; extern u8 videoChoice; @@ -237,8 +91,7 @@ extern "C" u16 count; }; - void CFG_DefaultTheme(); // -1 = non forced mode - void CFG_LoadTheme(bool widescreen, const char * theme_path); + void CFG_LoadGameNum(); // -1 = non forced mode struct Game_CFG* CFG_get_game_opt(const u8 *id); struct Game_NUM* CFG_get_game_num(const u8 *id); bool CFG_save_game_opt(u8 *id); diff --git a/source/themes/CTheme.cpp b/source/themes/CTheme.cpp new file mode 100644 index 00000000..633e5af5 --- /dev/null +++ b/source/themes/CTheme.cpp @@ -0,0 +1,392 @@ +/**************************************************************************** + * Copyright (C) 2010 + * by Dimok + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any + * damages arising from the use of this software. + * + * Permission is granted to anyone to use this software for any + * purpose, including commercial applications, and to alter it and + * redistribute it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you + * must not claim that you wrote the original software. If you use + * this software in a product, an acknowledgment in the product + * documentation would be appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and + * must not be misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + ***************************************************************************/ +#include +#include +#include +#include + +#include "CTheme.h" +#include "libwiigui/gui.h" + +CTheme Theme; + +typedef struct _TextMap +{ + const char * name; + int id; +} TextMap; + +const TextMap map_alignment[] = +{ + { "left", ALIGN_LEFT }, + { "right", ALIGN_RIGHT }, + { "center", ALIGN_CENTRE }, + { "top", ALIGN_TOP }, + { "bottom", ALIGN_BOTTOM }, + { "middle", ALIGN_MIDDLE }, + { NULL, -1 } +}; + +static u32 wCOORDS_FLAGS[2] = { 0, 0 }; // space for 64 coords - this is enough, also for the future +#define GET_wCOORD_FLAG(i) (wCOORDS_FLAGS[i/32] & (1UL << (i%32))) +#define SET_wCOORD_FLAG(i) (wCOORDS_FLAGS[i/32] |= (1UL << (i%32))) + +#define CFG_COORDS2(name) \ + if ((wcoords_idx++, 1) && !GET_wCOORD_FLAG(wcoords_idx) && \ + strcmp(cfg_name, #name "_coords") == 0) { \ + short x,y; \ + if (sscanf(value, "%hd,%hd", &x, &y) == 2) { \ + name##_x = x; \ + name##_y = y; \ + } \ + return true; \ + } \ + else if (WideScreen && \ + strcmp(cfg_name, "w" #name "_coords") == 0) { \ + short x,y; \ + if (sscanf(value, "%hd,%hd", &x, &y) == 2) { \ + name##_x = x; \ + name##_y = y; \ + SET_wCOORD_FLAG(wcoords_idx); \ + } \ + return true; \ + } + +#define CFG_COORDS4(name) \ + if ((wcoords_idx++, 1) && !GET_wCOORD_FLAG(wcoords_idx) && \ + strcmp(cfg_name, #name "_coords") == 0) { \ + short x,y,w,h; \ + if (sscanf(value, "%hd,%hd,%hd,%hd", &x, &y, &w, &h) == 4) { \ + name##_x = x; \ + name##_y = y; \ + name##_w = w; \ + name##_h = h; \ + } \ + return true; \ + } \ + else if (WideScreen && strcmp(cfg_name, "w" #name "_coords") == 0) \ + { \ + short x,y,w,h; \ + if (sscanf(value, "%hd,%hd,%hd,%hd", &x, &y, &w, &h) == 4) \ + { \ + name##_x = x; \ + name##_y = y; \ + name##_w = w; \ + name##_h = h; \ + SET_wCOORD_FLAG(wcoords_idx); \ + } \ + return true; \ + } + +#define CFG_COLOR(name) \ + if (strcmp(cfg_name, #name "_color") == 0) { \ + short r,g,b,a; \ + int c = sscanf(value, "%hd,%hd,%hd,%hd", &r, &g, &b, &a); \ + if(c >= 3) { \ + name.r = r; \ + name.g = g; \ + name.b = b; \ + if(c >= 4) \ + name.a = a; \ + } \ + return true; \ + } + +#define CFG_VAL(name) \ + if (strcmp(cfg_name, #name) == 0) { \ + short v; \ + if (sscanf(value, "%hd", &v) == 1) { \ + name = v; \ + } \ + return true; \ + } + +#define CFG_ALIGN(varname) \ + for(int i = 0; map_alignment[i].name != NULL; ++i) \ + { \ + if(strcasestr(map_alignment[i].name, value) != NULL) \ + { \ + varname##_align = map_alignment[i].id; \ + break; \ + } \ + return true; \ + } + +CTheme::CTheme() +{ + WideScreen = (CONF_GetAspectRatio() == CONF_ASPECT_16_9); + SetDefault(); +} + +CTheme::~CTheme() +{ +} + +void CTheme::SetDefault() +{ + gamelist_x = 200; + gamelist_y = 49;//40; + gamelist_w = 396; + gamelist_h = 280; + gamegrid_w = 640; + gamegrid_h = 400; + gamegrid_x = 0; + gamegrid_y = 20; + gamecarousel_w = 640; + gamecarousel_h = 400; + gamecarousel_x = 0; + gamecarousel_y = -20; + covers_x = 26; + covers_y = 58; + show_id = 1; + id_x = 68; + id_y = 305; + show_region = 1; + region_x = 68; + region_y = 30; + sdcard_x = 160; + sdcard_y = 395; + homebrew_x = 410; + homebrew_y = 405; + power_x = 576; + power_y = 355; + home_x = 489;//215; + home_y = 371; + setting_x = 64;//-210 + setting_y = 371; + install_x = 16;//-280 + install_y = 355; + clock = (GXColor) {138, 138, 138, 240}; + clock_align = ALIGN_CENTRE; + clock_x = 0; + clock_y = 335;//330; + info = ( GXColor ) {55, 190, 237, 255}; + show_hddinfo = 1; + hddinfo_align = ALIGN_CENTRE; + hddinfo_x = 0; + hddinfo_y = 400; + show_gamecount = 1; //default + gamecount_align = ALIGN_CENTRE; + gamecount_x = 0; + gamecount_y = 420; + show_tooltip = 1; //1 means use settings, 0 means force turn off + tooltipAlpha = 255; + prompttext = (GXColor) {0, 0, 0, 255}; + settingstext = (GXColor) {0, 0, 0, 255}; + gametext = (GXColor) {0, 0, 0, 255}; + pagesize = 9; + gamelist_favorite_x = WideScreen ? 256 : 220; + gamelist_favorite_y = 13; + gamelist_search_x = WideScreen ? 288 : 260; + gamelist_search_y = 13; + gamelist_abc_x = WideScreen ? 320 : 300; + gamelist_abc_y = 13; + gamelist_count_x = WideScreen ? 352 : 340; + gamelist_count_y = 13; + gamelist_list_x = WideScreen ? 384 : 380; + gamelist_list_y = 13; + gamelist_grid_x = WideScreen ? 416 : 420; + gamelist_grid_y = 13; + gamelist_carousel_x = WideScreen ? 448 : 460; + gamelist_carousel_y = 13; + gamelist_lock_x = WideScreen ? 480 : 500; + gamelist_lock_y = 13; + gamelist_dvd_x = WideScreen ? 512 : 540; + gamelist_dvd_y = 13; + gamegrid_favorite_x = WideScreen ? 192 : 160; + gamegrid_favorite_y = 13; + gamegrid_search_x = WideScreen ? 224 : 200; + gamegrid_search_y = 13; + gamegrid_abc_x = WideScreen ? 256 : 240; + gamegrid_abc_y = 13; + gamegrid_count_x = WideScreen ? 288 : 280; + gamegrid_count_y = 13; + gamegrid_list_x = WideScreen ? 320 : 320; + gamegrid_list_y = 13; + gamegrid_grid_x = WideScreen ? 352 : 360; + gamegrid_grid_y = 13; + gamegrid_carousel_x = WideScreen ? 384 : 400; + gamegrid_carousel_y = 13; + gamegrid_lock_x = WideScreen ? 416 : 440; + gamegrid_lock_y = 13; + gamegrid_dvd_x = WideScreen ? 448 : 480; + gamegrid_dvd_y = 13; + gamecarousel_favorite_x = WideScreen ? 192 : 160; + gamecarousel_favorite_y = 13; + gamecarousel_search_x = WideScreen ? 224 : 200; + gamecarousel_search_y = 13; + gamecarousel_abc_x = WideScreen ? 256 : 240; + gamecarousel_abc_y = 13; + gamecarousel_count_x = WideScreen ? 288 : 280; + gamecarousel_count_y = 13; + gamecarousel_list_x = WideScreen ? 320 : 320; + gamecarousel_list_y = 13; + gamecarousel_grid_x = WideScreen ? 352 : 360; + gamecarousel_grid_y = 13; + gamecarousel_carousel_x = WideScreen ? 384 : 400; + gamecarousel_carousel_y = 13; + gamecarousel_lock_x = WideScreen ? 416 : 440; + gamecarousel_lock_y = 13; + gamecarousel_dvd_x = WideScreen ? 448 : 480; + gamecarousel_dvd_y = 13; +} + +bool CTheme::SetSetting(char *name, char *value) +{ + char * cfg_name = name; + int wcoords_idx = -1; + + CFG_COORDS4( gamelist ) + CFG_COORDS4( gamegrid ) + CFG_COORDS4( gamecarousel ) + + CFG_COORDS2( covers ) + + CFG_VAL( show_id ) + CFG_COORDS2( id ) + + CFG_VAL( show_region ) + CFG_COORDS2( region ) + + CFG_COORDS2( sdcard ) + CFG_COORDS2( homebrew ) + CFG_COORDS2( power ) + CFG_COORDS2( home ) + CFG_COORDS2( setting ) + CFG_COORDS2( install ) + + CFG_COORDS2( clock ) + CFG_ALIGN( clock ) + CFG_COLOR( clock ) + + CFG_COLOR( info ) + CFG_VAL( show_hddinfo ) + CFG_ALIGN( hddinfo ) + CFG_COORDS2( hddinfo ) + + CFG_VAL( show_gamecount ) + CFG_ALIGN( gamecount ) + CFG_COORDS2( gamecount ) + + CFG_VAL( show_tooltip ) + CFG_VAL( tooltipAlpha ) + + CFG_COLOR( prompttext ) + CFG_COLOR( settingstext ) + CFG_COLOR( gametext ) + + CFG_VAL( pagesize ) + + CFG_COORDS2( gamelist_favorite ) + CFG_COORDS2( gamegrid_favorite ) + CFG_COORDS2( gamecarousel_favorite ) + + CFG_COORDS2( gamelist_search ) + CFG_COORDS2( gamegrid_search ) + CFG_COORDS2( gamecarousel_search ) + + CFG_COORDS2( gamelist_abc ) + CFG_COORDS2( gamegrid_abc ) + CFG_COORDS2( gamecarousel_abc ) + + CFG_COORDS2( gamelist_count ) + CFG_COORDS2( gamegrid_count ) + CFG_COORDS2( gamecarousel_count ) + + CFG_COORDS2( gamelist_list ) + CFG_COORDS2( gamegrid_list ) + CFG_COORDS2( gamecarousel_list ) + + CFG_COORDS2( gamelist_grid ) + CFG_COORDS2( gamegrid_grid ) + CFG_COORDS2( gamecarousel_grid ) + + CFG_COORDS2( gamelist_carousel ) + CFG_COORDS2( gamegrid_carousel ) + CFG_COORDS2( gamecarousel_carousel ) + + CFG_COORDS2( gamelist_lock ) + CFG_COORDS2( gamegrid_lock ) + CFG_COORDS2( gamecarousel_lock ) + + CFG_COORDS2( gamelist_dvd ) + CFG_COORDS2( gamegrid_dvd ) + CFG_COORDS2( gamecarousel_dvd ) + + return false; +} + +bool CTheme::Load(const char * theme_path) +{ + char filepath[300]; + snprintf(filepath, sizeof(filepath), "%sGXtheme.cfg", theme_path); + + char line[1024]; + wCOORDS_FLAGS[0] = 0; + wCOORDS_FLAGS[1] = 0; + + FILE * file = fopen(filepath, "r"); + if (!file) return false; + + while (fgets(line, sizeof(line), file)) + { + if (line[0] == '#') continue; + + this->ParseLine(line); + } + fclose(file); + + return true; +} + +void CTheme::ParseLine(char *line) +{ + char temp[1024], name[1024], value[1024]; + + strncpy(temp, line, sizeof(temp)); + + char * eq = strchr(temp, '='); + + if (!eq) return; + + *eq = 0; + + this->TrimLine(name, temp, sizeof(name)); + this->TrimLine(value, eq + 1, sizeof(value)); + + this->SetSetting(name, value); +} + +void CTheme::TrimLine(char *dest, char *src, int size) +{ + int len; + while (*src == ' ') + src++; + len = strlen(src); + while (len > 0 && strchr(" \r\n", src[len - 1])) + len--; + if (len >= size) len = size - 1; + strncpy(dest, src, len); + dest[len] = 0; +} diff --git a/source/themes/CTheme.h b/source/themes/CTheme.h new file mode 100644 index 00000000..1262cfe1 --- /dev/null +++ b/source/themes/CTheme.h @@ -0,0 +1,187 @@ +#ifndef _CTHEME_H_ +#define _CTHEME_H_ + +#include +#include +#include + +class CTheme +{ + public: + //!Constructor + CTheme(); + //!Destructor + ~CTheme(); + //!Set Default + void SetDefault(); + //!Load + bool Load(const char * path); + + /** Variables **/ + short gamelist_x; + short gamelist_y; + short gamelist_w; + short gamelist_h; + + short gamegrid_x; + short gamegrid_y; + short gamegrid_w; + short gamegrid_h; + + short gamecarousel_x; + short gamecarousel_y; + short gamecarousel_w; + short gamecarousel_h; + + short covers_x; + short covers_y; + + short show_id; + + short id_x; + short id_y; + + short show_region; + + short region_x; + short region_y; + + short sdcard_x; + short sdcard_y; + + short homebrew_x; + short homebrew_y; + + short power_x; + short power_y; + + short home_x; + short home_y; + + short setting_x; + short setting_y; + + short install_x; + short install_y; + + GXColor clock; + short clock_align; + short clock_x; + short clock_y; + + GXColor info; + short show_hddinfo; + short hddinfo_align; + short hddinfo_x; + short hddinfo_y; + + short show_gamecount; + short gamecount_align; + short gamecount_x; + short gamecount_y; + + short show_tooltip; + int tooltipAlpha; + + GXColor prompttext; + + GXColor settingstext; + + GXColor gametext; + + short pagesize; + + short gamelist_favorite_x; + short gamelist_favorite_y; + + short gamelist_search_x; + short gamelist_search_y; + + short gamelist_abc_x; + short gamelist_abc_y; + + short gamelist_count_x; + short gamelist_count_y; + + short gamelist_list_x; + short gamelist_list_y; + + short gamelist_grid_x; + short gamelist_grid_y; + + short gamelist_carousel_x; + short gamelist_carousel_y; + + short gamelist_dvd_x; + short gamelist_dvd_y; + + short gamelist_lock_x; + short gamelist_lock_y; + + short gamegrid_favorite_x; + short gamegrid_favorite_y; + + short gamegrid_search_x; + short gamegrid_search_y; + + short gamegrid_abc_x; + short gamegrid_abc_y; + + short gamegrid_count_x; + short gamegrid_count_y; + + short gamegrid_list_x; + short gamegrid_list_y; + + short gamegrid_grid_x; + short gamegrid_grid_y; + + short gamegrid_carousel_x; + short gamegrid_carousel_y; + + short gamegrid_dvd_x; + short gamegrid_dvd_y; + + short gamegrid_lock_x; + short gamegrid_lock_y; + + short gamecarousel_favorite_x; + short gamecarousel_favorite_y; + + short gamecarousel_search_x; + short gamecarousel_search_y; + + short gamecarousel_abc_x; + short gamecarousel_abc_y; + + short gamecarousel_count_x; + short gamecarousel_count_y; + + short gamecarousel_list_x; + short gamecarousel_list_y; + + short gamecarousel_grid_x; + short gamecarousel_grid_y; + + short gamecarousel_carousel_x; + short gamecarousel_carousel_y; + + short gamecarousel_dvd_x; + short gamecarousel_dvd_y; + + short gamecarousel_lock_x; + short gamecarousel_lock_y; + + protected: + bool SetSetting(char *name, char *value); + //!Find the config file in the default paths + bool FindConfig(); + + void ParseLine(char *line); + void TrimLine(char *dest, char *src, int size); + bool WideScreen; +}; + +extern CTheme Theme; + +#endif diff --git a/source/themes/Theme_Downloader.cpp b/source/themes/Theme_Downloader.cpp index 57d5bec2..7715668b 100644 --- a/source/themes/Theme_Downloader.cpp +++ b/source/themes/Theme_Downloader.cpp @@ -16,6 +16,7 @@ #include "homebrewboot/HomebrewBrowse.h" #include "network/networkops.h" #include "themes/Theme_List.h" +#include "themes/CTheme.h" #include "menu.h" #include "filelist.h" #include "listfiles.h" @@ -169,25 +170,25 @@ static int Theme_Prompt(const char *title, const char *author, GuiImageData *thu GuiTrigger trigB; trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B); - GuiText titleTxt(tr( "Theme Title:" ), 18, THEME.prompttext); + GuiText titleTxt(tr( "Theme Title:" ), 18, Theme.prompttext); titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); titleTxt.SetPosition(230, 30); - GuiText titleTxt2(title, 18, THEME.prompttext); + GuiText titleTxt2(title, 18, Theme.prompttext); titleTxt2.SetAlignment(ALIGN_LEFT, ALIGN_TOP); titleTxt2.SetPosition(230, 50); titleTxt2.SetMaxWidth(dialogBox.GetWidth() - 220, WRAP); - GuiText authorTxt(tr( "Author:" ), 18, THEME.prompttext); + GuiText authorTxt(tr( "Author:" ), 18, Theme.prompttext); authorTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); authorTxt.SetPosition(230, 100); - GuiText authorTxt2(author, 18, THEME.prompttext); + GuiText authorTxt2(author, 18, Theme.prompttext); authorTxt2.SetAlignment(ALIGN_LEFT, ALIGN_TOP); authorTxt2.SetPosition(230, 120); authorTxt2.SetMaxWidth(dialogBox.GetWidth() - 220, DOTTED); - GuiText downloadBtnTxt(tr( "Download" ), 22, THEME.prompttext); + GuiText downloadBtnTxt(tr( "Download" ), 22, Theme.prompttext); downloadBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30); GuiImage downloadBtnImg(&btnOutline); if (Settings.wsprompt == yes) @@ -200,7 +201,7 @@ static int Theme_Prompt(const char *title, const char *author, GuiImageData *thu downloadBtn.SetLabel(&downloadBtnTxt); downloadBtn.SetScale(0.9); - GuiText backBtnTxt(tr( "Back" ), 22, THEME.prompttext); + GuiText backBtnTxt(tr( "Back" ), 22, Theme.prompttext); backBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30); GuiImage backBtnImg(&btnOutline); if (Settings.wsprompt == yes) @@ -345,7 +346,7 @@ int Theme_Downloader() GuiImage *theme_box_img[pagesize]; GuiButton *MainButton[pagesize]; GuiText *MainButtonTxt[pagesize]; - Theme_List *Theme = NULL; + Theme_List *ThemeList = NULL; /*** Buttons ***/ @@ -371,7 +372,7 @@ int Theme_Downloader() MainButton[2]->SetPosition(90, 230); MainButton[3]->SetPosition(340, 230); - GuiText backBtnTxt(tr( "Back" ), 22, THEME.prompttext); + GuiText backBtnTxt(tr( "Back" ), 22, Theme.prompttext); backBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30); GuiImage backBtnImg(&btnOutline); if (Settings.wsprompt == yes) @@ -463,9 +464,9 @@ int Theme_Downloader() ShowProgress(tr( "Downloading Page List:" ), "", (char *) tr( "Please wait..." ), 0, pagesize); - Theme = new Theme_List(THEME_LINK); + ThemeList = new Theme_List(THEME_LINK); - int ThemesOnPage = Theme->GetThemeCount(); + int ThemesOnPage = ThemeList->GetThemeCount(); if (!ThemesOnPage) { @@ -494,7 +495,7 @@ int Theme_Downloader() for (int i = currenttheme; (i < (currenttheme + pagesize)); i++) { - ShowProgress(tr( "Downloading image:" ), 0, (char *) Theme->GetThemeTitle(i), n, pagesize); + ShowProgress(tr( "Downloading image:" ), 0, (char *) ThemeList->GetThemeTitle(i), n, pagesize); if (MainButtonTxt[n]) delete MainButtonTxt[n]; if (ImageData[n]) delete ImageData[n]; @@ -506,17 +507,17 @@ int Theme_Downloader() if (i < ThemesOnPage) { - MainButtonTxt[n] = new GuiText(Theme->GetThemeTitle(i), 18, ( GXColor ) + MainButtonTxt[n] = new GuiText(ThemeList->GetThemeTitle(i), 18, ( GXColor ) { 0, 0, 0, 255}); MainButtonTxt[n]->SetAlignment(ALIGN_CENTER, ALIGN_TOP); MainButtonTxt[n]->SetPosition(0, 10); MainButtonTxt[n]->SetMaxWidth(theme_box_Data.GetWidth() - 10, DOTTED); - sprintf(url, "%s", Theme->GetImageLink(i)); + sprintf(url, "%s", ThemeList->GetImageLink(i)); char filepath[300]; snprintf(filepath, sizeof(filepath), "%s/tmp/%s.jpg", Settings.theme_downloadpath, - Theme->GetThemeTitle(i)); + ThemeList->GetThemeTitle(i)); FILE * storefile = fopen(filepath, "rb"); @@ -617,8 +618,8 @@ int Theme_Downloader() { if (MainButton[i]->GetState() == STATE_CLICKED) { - snprintf(url, sizeof(url), "%s", Theme->GetDownloadLink(currenttheme + i)); - int ret = Theme_Prompt(Theme->GetThemeTitle(currenttheme + i), Theme->GetThemeAuthor(currenttheme + snprintf(url, sizeof(url), "%s", ThemeList->GetDownloadLink(currenttheme + i)); + int ret = Theme_Prompt(ThemeList->GetThemeTitle(currenttheme + i), ThemeList->GetThemeAuthor(currenttheme + i), ImageData[i], url); MainButton[i]->ResetState(); if (ret == 2) @@ -648,8 +649,8 @@ int Theme_Downloader() if (MainButtonTxt[i]) delete MainButtonTxt[i]; } - if (Theme) delete Theme; - Theme = NULL; + if (ThemeList) delete ThemeList; + ThemeList = NULL; ResumeGui(); diff --git a/source/wad/wad.cpp b/source/wad/wad.cpp index 9760ad13..6a3b5865 100644 --- a/source/wad/wad.cpp +++ b/source/wad/wad.cpp @@ -15,6 +15,8 @@ #include "language/gettext.h" #include "menu.h" #include "filelist.h" +#include "themes/CTheme.h" + /*** Extern functions ***/ extern void ResumeGui(); extern void HaltGui(); @@ -137,7 +139,7 @@ s32 Wad_Install(FILE *fp) dialogBoxImg.SetWidescreen(Settings.widescreen); } - GuiText btn1Txt(tr( "OK" ), 22, THEME.prompttext); + GuiText btn1Txt(tr( "OK" ), 22, Theme.prompttext); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt == yes) { @@ -173,33 +175,33 @@ s32 Wad_Install(FILE *fp) char title[50]; sprintf(title, "%s", tr( "Installing wad" )); - GuiText titleTxt(title, 26, THEME.prompttext); + GuiText titleTxt(title, 26, Theme.prompttext); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0, 40); char msg[50]; sprintf(msg, " "); // sprintf(msg, "%s", tr("Initializing Network")); - GuiText msg1Txt((char*) NULL, 20, THEME.prompttext); + GuiText msg1Txt((char*) NULL, 20, Theme.prompttext); msg1Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); msg1Txt.SetPosition(50, 75); // char msg2[50] = " "; - GuiText msg2Txt((char*) NULL, 20, THEME.prompttext); + GuiText msg2Txt((char*) NULL, 20, Theme.prompttext); msg2Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); msg2Txt.SetPosition(50, 98); - GuiText msg3Txt((char*) NULL, 20, THEME.prompttext); + GuiText msg3Txt((char*) NULL, 20, Theme.prompttext); msg3Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); msg3Txt.SetPosition(50, 121); - GuiText msg4Txt((char*) NULL, 20, THEME.prompttext); + GuiText msg4Txt((char*) NULL, 20, Theme.prompttext); msg4Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); msg4Txt.SetPosition(50, 144); - GuiText msg5Txt((char*) NULL, 20, THEME.prompttext); + GuiText msg5Txt((char*) NULL, 20, Theme.prompttext); msg5Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); msg5Txt.SetPosition(50, 167); - GuiText prTxt((char*) NULL, 26, THEME.prompttext); + GuiText prTxt((char*) NULL, 26, Theme.prompttext); prTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); prTxt.SetPosition(0, 50); @@ -460,7 +462,7 @@ s32 Wad_Uninstall(FILE *fp) dialogBoxImg.SetWidescreen(Settings.widescreen); } - GuiText btn1Txt(tr( "OK" ), 22, THEME.prompttext); + GuiText btn1Txt(tr( "OK" ), 22, Theme.prompttext); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt == yes) { @@ -473,27 +475,27 @@ s32 Wad_Uninstall(FILE *fp) char title[50]; sprintf(title, "%s", tr( "Uninstalling wad" )); - GuiText titleTxt(title, 26, THEME.prompttext); + GuiText titleTxt(title, 26, Theme.prompttext); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0, 40); - GuiText msg1Txt((char*) NULL, 18, THEME.prompttext); + GuiText msg1Txt((char*) NULL, 18, Theme.prompttext); msg1Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); msg1Txt.SetPosition(50, 75); - GuiText msg2Txt((char*) NULL, 18, THEME.prompttext); + GuiText msg2Txt((char*) NULL, 18, Theme.prompttext); msg2Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); msg2Txt.SetPosition(50, 98); - GuiText msg3Txt((char*) NULL, 18, THEME.prompttext); + GuiText msg3Txt((char*) NULL, 18, Theme.prompttext); msg3Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); msg3Txt.SetPosition(50, 121); - GuiText msg4Txt((char*) NULL, 18, THEME.prompttext); + GuiText msg4Txt((char*) NULL, 18, Theme.prompttext); msg4Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); msg4Txt.SetPosition(50, 144); - GuiText msg5Txt((char*) NULL, 18, THEME.prompttext); + GuiText msg5Txt((char*) NULL, 18, Theme.prompttext); msg5Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); msg5Txt.SetPosition(50, 167);