mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-05 19:15:07 +01:00
little fix for the search stuff
This commit is contained in:
parent
572bae91d6
commit
b7a96f77f8
@ -179,6 +179,7 @@ int __Menu_GetGameFilter_NextList(discHdr *gameList, u32 gameCnt, wchar_t **Pgam
|
|||||||
{
|
{
|
||||||
u32 filter_len = wcslen(*PgameFilter);
|
u32 filter_len = wcslen(*PgameFilter);
|
||||||
u32 i, lastChar=0;
|
u32 i, lastChar=0;
|
||||||
|
bool autofill = filter_len > 0; // autofill only when gameFilter is not empty
|
||||||
wchar_t *p;
|
wchar_t *p;
|
||||||
u32 *nextList = new u32[gameCnt]; if(nextList==NULL) return -1;
|
u32 *nextList = new u32[gameCnt]; if(nextList==NULL) return -1;
|
||||||
for(i=0; i<gameCnt; i++)
|
for(i=0; i<gameCnt; i++)
|
||||||
@ -187,8 +188,14 @@ int __Menu_GetGameFilter_NextList(discHdr *gameList, u32 gameCnt, wchar_t **Pgam
|
|||||||
wchar_t *gameName = FreeTypeGX::charToWideChar(get_title(&gameList[i]));
|
wchar_t *gameName = FreeTypeGX::charToWideChar(get_title(&gameList[i]));
|
||||||
if(gameName == NULL) goto error;
|
if(gameName == NULL) goto error;
|
||||||
|
|
||||||
if(wcslen(gameName) > filter_len && (filter_len == 0 || !wcsnicmp(*PgameFilter, gameName, filter_len)))
|
if(wcslen(gameName) > filter_len)
|
||||||
nextFilterChar = towupper(gameName[filter_len]);
|
{
|
||||||
|
if((filter_len == 0 || !wcsnicmp(*PgameFilter, gameName, filter_len)))
|
||||||
|
nextFilterChar = towupper(gameName[filter_len]);
|
||||||
|
}
|
||||||
|
else if(wcslen(gameName) == filter_len)
|
||||||
|
autofill = false; // no autofill when gameNameLen == filterLen
|
||||||
|
|
||||||
nextList[i] = nextFilterChar;
|
nextList[i] = nextFilterChar;
|
||||||
}
|
}
|
||||||
qsort(nextList, gameCnt, sizeof(u32), int_cmp);
|
qsort(nextList, gameCnt, sizeof(u32), int_cmp);
|
||||||
@ -210,7 +217,7 @@ int __Menu_GetGameFilter_NextList(discHdr *gameList, u32 gameCnt, wchar_t **Pgam
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*p = 0;
|
*p = 0;
|
||||||
if(wcslen(*PgameFilterNextList) == 1) // only one nextChar
|
if(wcslen(*PgameFilterNextList) == 1 && autofill) // only one nextChar and autofill is true
|
||||||
{
|
{
|
||||||
wchar_t *newFilter = new wchar_t[filter_len + 2];
|
wchar_t *newFilter = new wchar_t[filter_len + 2];
|
||||||
if(newFilter == NULL) goto error;
|
if(newFilter == NULL) goto error;
|
||||||
|
Loading…
Reference in New Issue
Block a user