@@ -262,6 +262,12 @@ static int cacheGetPrefetchLimit(const image_cache_t *cache)
262262 return cache -> count - 1 < 4 ? cache -> count - 1 : 4 ;
263263}
264264
265+ static int cacheShouldPreferLoadedVictim (const image_cache_t * cache , unsigned char priority , int effectiveMode )
266+ {
267+ return cache != NULL && priority == CACHE_REQ_PRIORITY_INTERACTIVE && effectiveMode == MMCE_MODE &&
268+ cache -> suffix != NULL && strcmp (cache -> suffix , "COV" ) == 0 ;
269+ }
270+
265271static int cacheGetEffectiveMode (const item_list_t * list , const char * value )
266272{
267273 int mode ;
@@ -1349,14 +1355,30 @@ static GSTEXTURE *cacheGetTextureInternal(image_cache_t *cache, item_list_t *lis
13491355 return NULL ;
13501356 }
13511357
1352- for (int i = 0 ; i < cache -> count ; i ++ ) {
1353- entry = & cache -> content [i ];
1354- if ((entry -> state == CACHE_ENTRY_FREE || entry -> state == CACHE_ENTRY_READY || entry -> state == CACHE_ENTRY_PRIMED ||
1355- entry -> state == CACHE_ENTRY_DISPLAYABLE || entry -> state == CACHE_ENTRY_FAILED ) &&
1356- entry -> lastUsed < rtime ) {
1357- oldestEntry = entry ;
1358- oldestEntryId = i ;
1359- rtime = entry -> lastUsed ;
1358+ if (cacheShouldPreferLoadedVictim (cache , priority , effectiveMode )) {
1359+ for (int i = 0 ; i < cache -> count ; i ++ ) {
1360+ entry = & cache -> content [i ];
1361+ if ((entry -> state == CACHE_ENTRY_READY || entry -> state == CACHE_ENTRY_PRIMED ||
1362+ entry -> state == CACHE_ENTRY_DISPLAYABLE || entry -> state == CACHE_ENTRY_FAILED ) &&
1363+ entry -> lastUsed < rtime ) {
1364+ oldestEntry = entry ;
1365+ oldestEntryId = i ;
1366+ rtime = entry -> lastUsed ;
1367+ }
1368+ }
1369+ }
1370+
1371+ if (oldestEntry == NULL ) {
1372+ rtime = guiFrameId ;
1373+ for (int i = 0 ; i < cache -> count ; i ++ ) {
1374+ entry = & cache -> content [i ];
1375+ if ((entry -> state == CACHE_ENTRY_FREE || entry -> state == CACHE_ENTRY_READY || entry -> state == CACHE_ENTRY_PRIMED ||
1376+ entry -> state == CACHE_ENTRY_DISPLAYABLE || entry -> state == CACHE_ENTRY_FAILED ) &&
1377+ entry -> lastUsed < rtime ) {
1378+ oldestEntry = entry ;
1379+ oldestEntryId = i ;
1380+ rtime = entry -> lastUsed ;
1381+ }
13601382 }
13611383 }
13621384
0 commit comments