void c_fbaRL::PrevSysFilter() { bProcessingGames = true; // custom --> show all if(g_opt_nActiveSysFilter == MASKCUSTOM) { g_opt_nActiveSysFilter = MASKALL; for(uint32_t n = 0; n < sizeof(bSysFilter)-2; n++) { bSysFilter[n] = false; } bSysFilter[g_opt_nActiveSysFilter] = true; // refresh filters EndFilterList(); InitFilterList(); return; } // first single filter --> custom if(g_opt_nActiveSysFilter == 0) { g_opt_nActiveSysFilter = MASKCUSTOM; // use values from FBA_RL.ini for(uint32_t n = 0; n < sizeof(bSysFilter)-2; n++) { bSysFilter[n] = g_opt_bCustomSysFilter[n]; } // refresh filters EndFilterList(); InitFilterList(); return; } // previous single system filter --> ... g_opt_nActiveSysFilter--; for(uint32_t n = 0; n < sizeof(bSysFilter)-2; n++) { bSysFilter[n] = false; } bSysFilter[g_opt_nActiveSysFilter] = true; // refresh filters EndFilterList(); InitFilterList(); bProcessingGames = false; }
int c_fbaRL::ParseGameListCache() { bProcessingGames = true; FILE* fp = NULL; fp = fopen("/dev_hdd0/game/FBAL00123/USRDIR/FBA.GAMELIST.CACHE.DAT", "r"); if(fp) { char* pszLine = NULL; pszLine = (char*)malloc(2048+1); memset(pszLine, 0, 2048+1); while (!feof(fp)) { fgets(pszLine, 2048, fp); char* pch = NULL; pch = strstr(pszLine, "<totalgames>"); if(pch) { char* pszOption = NULL; pszOption = (char*)malloc(2048+1); memset(pszOption, 0, 2048+1); strncpy(pszOption, pch+(strlen("<totalgames>")), 2048); pch = strstr(pszOption, "</totalgames>"); pszOption[(int)(pch-pszOption)] = 0; sscanf(pszOption, "%d", &nTotalGames); SAFE_FREE(pszOption) break; } } SAFE_FREE(pszLine) rewind(fp); for(int n = 0; n < nTotalGames; n++) { char* pszLine = NULL; pszLine = (char*)malloc(2048+1); memset(pszLine, 0, 2048+1); while (!feof(fp)) { fgets(pszLine, 2048, fp); char* pch = NULL; char szTag[64] = { 0 }; sprintf(szTag, "<game id=%d>", n); pch = strstr(pszLine, szTag); if(pch) { games[n] = new c_game(n); _GETTAG_STR_VALUE("<title>", "</title>" , games[n]->title) _GETTAG_STR_VALUE("<zipname>", "</zipname>" , games[n]->zipname) _GETTAG_STR_VALUE("<sysmask>", "</sysmask>" , games[n]->sysmask) _GETTAG_BOOL_VALUE("<available>", "</available>", games[n]->bAvailable) if(games[n]->bAvailable) { _GETTAG_STR_VALUE("<path>", "</path>" , games[n]->path) _GETTAG_INT_VALUE("<size>", "</size>" , &games[n]->nSize) } else { fgets(pszLine, 2048, fp); fgets(pszLine, 2048, fp); nMissingGames++; } fgets(pszLine, 2048, fp); pch = strstr(pszLine, "</game>"); if(pch) break; } } SAFE_FREE(pszLine) } fclose(fp); fp = NULL; InitFilterList(); return 1; } InitFilterList(); bProcessingGames = false; return 0; }