burner/sel.cpp: slight speedup to search function [tumu]

This commit is contained in:
dinkc64 2017-03-28 01:00:11 +00:00
parent af4cab18a9
commit c44640e687
1 changed files with 25 additions and 27 deletions

View File

@ -501,8 +501,13 @@ static int SelListMake()
LoadFavorites();
// Add all the driver names to the list
// Get dialog search string
TCHAR szSearchString[256] = { _T("") };
j = GetDlgItemText(hSelDlg, IDC_SEL_SEARCH, szSearchString, sizeof(szSearchString));
for (UINT32 k = 0; k < j; k++)
szSearchString[k] = _totlower(szSearchString[k]);
// Add all the driver names to the list
// 1st: parents
for (i = 0; i < nBurnDrvCount; i++) {
TV_INSERTSTRUCT TvItem;
@ -524,10 +529,16 @@ static int SelListMake()
continue;
}
if (avOk && (!(nLoadMenuShowY & UNAVAILABLE)) && !gameAv[i]) { // Skip non-available games if needed
continue;
}
if (avOk && (!(nLoadMenuShowY & AVAILABLE)) && gameAv[i]) { // Skip available games if needed
continue;
}
if (DoExtraFilters()) continue;
TCHAR szSearchString[256];
GetDlgItemText(hSelDlg, IDC_SEL_SEARCH, szSearchString, sizeof(szSearchString));
if (szSearchString[0]) {
TCHAR *StringFound = NULL;
TCHAR *StringFound2 = NULL;
@ -540,7 +551,6 @@ static int SelListMake()
wcscpy(szManufacturerName, BurnDrvGetText(DRV_MANUFACTURER));
wcscpy(szSystemName, BurnDrvGetText(DRV_SYSTEM));
for (int k = 0; k < 256; k++) {
szSearchString[k] = _totlower(szSearchString[k]);
szDriverName[k] = _totlower(szDriverName[k]);
szManufacturerName[k] = _totlower(szManufacturerName[k]);
szSystemName[k] = _totlower(szSystemName[k]);
@ -553,14 +563,6 @@ static int SelListMake()
if (!StringFound && !StringFound2 && !StringFound3 && !StringFound4) continue;
}
if (avOk && (!(nLoadMenuShowY & UNAVAILABLE)) && !gameAv[i]) { // Skip non-available games if needed
continue;
}
if (avOk && (!(nLoadMenuShowY & AVAILABLE)) && gameAv[i]) { // Skip available games if needed
continue;
}
memset(&TvItem, 0, sizeof(TvItem));
TvItem.item.mask = TVIF_TEXT | TVIF_PARAM;
TvItem.hInsertAfter = TVI_SORT;
@ -594,23 +596,28 @@ static int SelListMake()
continue;
}
if (avOk && (!(nLoadMenuShowY & UNAVAILABLE)) && !gameAv[i]) { // Skip non-available games if needed
continue;
}
if (avOk && (!(nLoadMenuShowY & AVAILABLE)) && gameAv[i]) { // Skip available games if needed
continue;
}
if (DoExtraFilters()) continue;
TCHAR szSearchString[256];
GetDlgItemText(hSelDlg, IDC_SEL_SEARCH, szSearchString, sizeof(szSearchString));
if (szSearchString[0]) {
TCHAR *StringFound = NULL;
TCHAR *StringFound2 = NULL;
TCHAR *StringFound3 = NULL;
TCHAR *StringFound4 = NULL;
TCHAR szDriverName[256];
TCHAR szDriverName[256] = { _T("") };
TCHAR szManufacturerName[256] = { _T("") };
TCHAR szSystemName[256] = { _T("") };
wcscpy(szDriverName, BurnDrvGetText(DRV_FULLNAME));
wcscpy(szManufacturerName, BurnDrvGetText(DRV_MANUFACTURER));
wcscpy(szSystemName, BurnDrvGetText(DRV_SYSTEM));
for (int k =0; k < 256; k++) {
szSearchString[k] = _totlower(szSearchString[k]);
szDriverName[k] = _totlower(szDriverName[k]);
szManufacturerName[k] = _totlower(szManufacturerName[k]);
szSystemName[k] = _totlower(szSystemName[k]);
@ -623,14 +630,6 @@ static int SelListMake()
if (!StringFound && !StringFound2 && !StringFound3 && !StringFound4) continue;
}
if (avOk && (!(nLoadMenuShowY & UNAVAILABLE)) && !gameAv[i]) { // Skip non-available games if needed
continue;
}
if (avOk && (!(nLoadMenuShowY & AVAILABLE)) && gameAv[i]) { // Skip available games if needed
continue;
}
memset(&TvItem, 0, sizeof(TvItem));
TvItem.item.mask = TVIF_TEXT | TVIF_PARAM;
TvItem.hInsertAfter = TVI_SORT;
@ -681,7 +680,6 @@ static int SelListMake()
}
for (i = 0; i < nTmpDrvCount; i++) {
// See if we need to expand the branch of an unavailable or non-working parent
if (nBurnDrv[i].bIsParent && ((nLoadMenuShowY & AUTOEXPAND) || !gameAv[nBurnDrv[i].nBurnDrvNo] || !CheckWorkingStatus(nBurnDrv[i].nBurnDrvNo))) {
for (j = 0; j < nTmpDrvCount; j++) {