From a65c8f88bac5ec0c403c8ae45b6979f73d1a3a32 Mon Sep 17 00:00:00 2001 From: giantpune Date: Thu, 1 Oct 2009 10:35:40 +0000 Subject: [PATCH] little fixes --- source/menu.cpp | 21 ++-- source/prompts/TitleBrowser.cpp | 180 -------------------------------- source/usbloader/getentries.cpp | 12 ++- 3 files changed, 18 insertions(+), 195 deletions(-) diff --git a/source/menu.cpp b/source/menu.cpp index 1b9c324b..1a6ef266 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -338,15 +338,7 @@ int MenuDiscList() { dvdheader = new struct discHdr; u8 mountMethodOLD =0; - - - ///WII_Initialize(); - ///WII_LaunchTitle(TITLE_ID(0x00010001,0xJODI)); - - - - - WDVD_GetCoverStatus(&covert); + WDVD_GetCoverStatus(&covert); u32 covertOld=covert; wchar_t searchChar; @@ -1290,7 +1282,7 @@ int MenuDiscList() { } } else if (dvdBtn.GetState() == STATE_CLICKED) { - mountMethodOLD = (mountMethod==0||mountMethod==3?mountMethod:0); + mountMethodOLD = (mountMethod==3?mountMethod:0); mountMethod=DiscMount(dvdID); dvdheader->id[0]=dvdID[0]; @@ -1301,7 +1293,10 @@ int MenuDiscList() { dvdheader->id[5]=dvdID[5]; dvdBtn.ResetState(); - rockout(1); + char ass[20]; + sprintf(ass,"%i",mountMethod); + WindowPrompt(ass,0,"ok"); + rockout(); //break; } if (Settings.gameDisplay==grid) { @@ -1432,7 +1427,9 @@ int MenuDiscList() { } } - if (((gameSelected >= 0) && (gameSelected < (s32)gameCnt)) || mountMethod==1 || mountMethod==2) { + if (((gameSelected >= 0) && (gameSelected < (s32)gameCnt)) + || mountMethod==1 + || mountMethod==2) { if(searchBar) { HaltGui(); diff --git a/source/prompts/TitleBrowser.cpp b/source/prompts/TitleBrowser.cpp index df04b010..513a242f 100644 --- a/source/prompts/TitleBrowser.cpp +++ b/source/prompts/TitleBrowser.cpp @@ -46,186 +46,6 @@ extern u8 reset; extern u32 infilesize; extern wchar_t *gameFilter; -inline int wcsnicmp(const wchar_t *s1, const wchar_t *s2, int len) -{ - if (len <= 0) - return (0); - do - { - int r = towupper(*s1) - towupper(*s2++); - if (r) return r; - if (*s1++ == 0) - break; - } while (--len != 0); - - return (0); -} - - -/******************************************************************************** -* put istalled titles into a struct so it can be handled by all the other -* shitloads of functions we have easily -* -*********************************************************************************/ -int buildTitleList1(int t, wchar_t* gameFilter, discHdr ** PgameList, u32 *PgameCnt){ - - struct discHdr *buffer = NULL; - u32 i = 0; - u32 cnt, cnt2=0, len; - u32 num_titles; - u32 titles[100] ATTRIBUTE_ALIGN(32); - u32 num_sys_titles; - u32 sys_titles[10] ATTRIBUTE_ALIGN(32); - s32 ret = -1; - FILE *f; - char path[100]; - - ISFS_Initialize(); - - sprintf(path,"%s/config/database.txt",bootDevice); - f = fopen(path, "r"); - - ret = getTitles_TypeCount(typei, &num_titles); - if (ret < 0) { - return -1; - } - - ret = getTitles_Type(typei, titles, num_titles); - if (ret < 0) { - return -2; - } - - ret = getTitles_TypeCount(0x00010002, &num_sys_titles); - if (ret < 0) { - return -3; - } - - ret = getTitles_Type(0x00010002, sys_titles, num_sys_titles); - if (ret < 0) { - return -4; - } - - cnt = (num_titles+num_sys_titles); - len = sizeof(struct discHdr) * cnt; - buffer = (struct discHdr *)memalign(32, len); - if (!buffer) - return -1; - - memset(buffer, 0, len); - - char name[64]; - while (i < (num_titles+num_sys_titles)) { - //start from the beginning of the file each loop - if (f)rewind(f); - char text[15]; - strcpy(name,"");//make sure name is empty - u8 found=0; - - sprintf(text, "%s", titleText(ititle,sizeof(header->title),"%s",tmp); - //break; - } - } - } - if (!found) { - if (getName00(header->title, TITLE_ID(i=0) - found=2; - - if (!found) { - if (getNameBN(header->title, TITLE_ID(i=0) - found=3; - - if (!found) - snprintf(header->title,sizeof(header->title),"%s (%08x)",text,iid[0]=text[0]; - header->id[1]=text[1]; - header->id[2]=text[2]; - header->id[3]=text[3]; - header->id[4]='G'; - header->id[5]='P'; - -//not using these filters right now, but i left them in just in case - // Filters - /*if (Settings.fave) { - struct Game_NUM* game_num = CFG_get_game_num(header->id); - if (!game_num || game_num->favorite==0) - continue; - } - - if (Settings.parentalcontrol && !Settings.godmode ) { - if (get_block(header) >= Settings.parentalcontrol) - continue; - }*/ - - if(gameFilter && *gameFilter) { - u32 filter_len = wcslen(gameFilter); - wchar_t *gameName = FreeTypeGX::charToWideChar(get_title(header)); - if (!gameName || wcsnicmp(gameName, gameFilter, filter_len)) { - delete [] gameName; - continue; - } - } - if(i != cnt2) - buffer[cnt2] = buffer[i]; - cnt2++; - } - i++; - } - - fclose(f); - - Uninstall_FromTitle(TITLE_ID(1, 0)); - ISFS_Deinitialize(); - - if(cnt > cnt2) - { - cnt = cnt2; - buffer = (struct discHdr *)realloc(buffer, sizeof(struct discHdr) * cnt); - } - if (!buffer) - return -1; - - if (Settings.sort==pcount) { - qsort(buffer, cnt, sizeof(struct discHdr), __Menu_EntryCmpCount); - } else { - qsort(buffer, cnt, sizeof(struct discHdr), __Menu_EntryCmp); - } - /*PgameList = buffer; - buffer = NULL; - PgameCnt = cnt;*/ - - if(PgameList) *PgameList = buffer; else free(buffer); - if(PgameCnt) *PgameCnt = cnt; - - return 0; - - return cnt; -} /******************************************************************************** * TitleBrowser- opens a browser with a list of installed Titles diff --git a/source/usbloader/getentries.cpp b/source/usbloader/getentries.cpp index 8a211905..09972e58 100644 --- a/source/usbloader/getentries.cpp +++ b/source/usbloader/getentries.cpp @@ -510,9 +510,15 @@ int __Menu_GetEntries(int t, const wchar_t* Filter) { if(new_gameFilter == NULL) return -1; for(;;) { - if(buildTitleList(t, new_gameFilter, &new_gameList, &new_gameCnt) < 0) - //if(__Menu_GetGameList(t, new_gameFilter, &new_gameList, &new_gameCnt) < 0) - return -1; + if (mountMethod==3) + {if(buildTitleList(t, new_gameFilter, &new_gameList, &new_gameCnt) < 0) + return -1;} + + else + {if(__Menu_GetGameList(t, new_gameFilter, &new_gameList, &new_gameCnt) < 0) + return -1;} + + if(new_gameCnt > 0 || new_gameFilter[0] == 0) break; new_gameFilter[wcslen(new_gameFilter)-1] = 0;