diff --git a/source/cfg.c b/source/cfg.c index af55286f..b62242d9 100644 --- a/source/cfg.c +++ b/source/cfg.c @@ -237,6 +237,7 @@ void CFG_Default(int widescreen) // -1 = non forced Mode THEME.cover_x = 26; THEME.cover_y = 55; THEME.showID = 1; + THEME.maxcharacters = 36; THEME.id_x = 68; THEME.id_y = 305; THEME.region_x = 68; @@ -631,6 +632,13 @@ void theme_set(char *name, char *val) THEME.pagesize = x; } } + + else if (strcmp(cfg_name, "maxcharacters") == 0) { + short x; + if (sscanf(val, "%hd", &x) == 1) { + THEME.maxcharacters = x; + } + } cfg_bool("show_id", &THEME.showID); cfg_bool("show_tooltip", &THEME.showToolTip); diff --git a/source/cfg.h b/source/cfg.h index fe637e9e..2126f916 100644 --- a/source/cfg.h +++ b/source/cfg.h @@ -79,6 +79,7 @@ struct THEME short cover_x; short cover_y; short showID; + short maxcharacters; short id_x; short id_y; short region_x; diff --git a/source/libwiigui/gui_gamebrowser.cpp b/source/libwiigui/gui_gamebrowser.cpp index 5a7ea1ff..b53ceb24 100644 --- a/source/libwiigui/gui_gamebrowser.cpp +++ b/source/libwiigui/gui_gamebrowser.cpp @@ -13,8 +13,12 @@ #include "gui_gamebrowser.h" #include "../cfg.h" +#include +#include + #define GAMESELECTSIZE 30 extern const int vol; +int txtscroll = 0; /** * Constructor for the GuiGameBrowser class. */ @@ -114,18 +118,18 @@ GuiGameBrowser::GuiGameBrowser(int w, int h, struct discHdr * l, int gameCnt, co gameTxt = new GuiText * [pagesize]; gameBg = new GuiImage * [pagesize]; - char buffer[CFG.maxcharacters + 4]; + char buffer[THEME.maxcharacters + 4]; for(int i=0; i < pagesize; i++) { - if (strlen(get_title(&gameList[i])) < (u32)(CFG.maxcharacters + 3)) + if (strlen(get_title(&gameList[i])) < (u32)(THEME.maxcharacters + 3)) { sprintf(buffer, "%s", get_title(&gameList[i])); } else { - sprintf(buffer, get_title(&gameList[i]), CFG.maxcharacters); - buffer[CFG.maxcharacters] = '\0'; + sprintf(buffer, get_title(&gameList[i]), THEME.maxcharacters); + buffer[THEME.maxcharacters] = '\0'; strncat(buffer, "...", 3); } @@ -314,8 +318,7 @@ void GuiGameBrowser::Update(GuiTrigger * t) // scrolldelay affects how fast the list scrolls // when the arrows are clicked float scrolldelay = 3.5; - - + if (scrollbaron == 1) { // update the location of the scroll box based on the position in the option list arrowUpBtn->Update(t); @@ -324,7 +327,7 @@ void GuiGameBrowser::Update(GuiTrigger * t) } next = listOffset; - char buffer[CFG.maxcharacters + 4]; + char buffer[THEME.maxcharacters + 4]; for(int i=0; iSetState(STATE_DEFAULT); } - if (strlen(get_title(&gameList[next])) < (u32)(CFG.maxcharacters + 3)) + if (strlen(get_title(&gameList[next])) < (u32)(THEME.maxcharacters + 3)) { sprintf(buffer, "%s", get_title(&gameList[next])); } else { - sprintf(buffer, get_title(&gameList[next]), CFG.maxcharacters); - buffer[CFG.maxcharacters] = '\0'; + sprintf(buffer, get_title(&gameList[next]), THEME.maxcharacters); + buffer[THEME.maxcharacters] = '\0'; strncat(buffer, "...", 3); }