diff options
Diffstat (limited to 'Source/Android/app/src/main/java')
2 files changed, 22 insertions, 9 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GameFileCache.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GameFileCache.java index a6f5261048..ed0f65741a 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GameFileCache.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GameFileCache.java @@ -96,12 +96,7 @@ public class GameFileCache return pathSet; } - /** - * Scans through the file system and updates the cache to match. - * - * @return true if the cache was modified - */ - public boolean update() + public static String[] getAllGamePaths() { boolean recursiveScan = BooleanSetting.MAIN_RECURSIVE_ISO_PATHS.getBooleanGlobal(); @@ -109,17 +104,33 @@ public class GameFileCache String[] folderPaths = folderPathsSet.toArray(new String[0]); - return update(folderPaths, recursiveScan); + return getAllGamePaths(folderPaths, recursiveScan); } + public static native String[] getAllGamePaths(String[] folderPaths, boolean recursiveScan); + public native int getSize(); public native GameFile[] getAllGames(); public native GameFile addOrGet(String gamePath); - public native boolean update(String[] folderPaths, boolean recursiveScan); + /** + * Sets the list of games to cache. + * + * Games which are in the passed-in list but not in the cache are scanned and added to the cache, + * and games which are in the cache but not in the passed-in list are removed from the cache. + * + * @return true if the cache was modified + */ + public native boolean update(String[] gamePaths); + /** + * For each game that already is in the cache, scans the folder that contains the game + * for additional metadata files (PNG/XML). + * + * @return true if the cache was modified + */ public native boolean updateAdditionalMetadata(); public native boolean load(); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/GameFileCacheService.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/GameFileCacheService.java index 7cff59a3e9..1a9284a9c4 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/GameFileCacheService.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/GameFileCacheService.java @@ -192,9 +192,11 @@ public final class GameFileCacheService extends IntentService { if (gameFileCache != null) { + String[] gamePaths = GameFileCache.getAllGamePaths(); + synchronized (gameFileCache) { - boolean changed = gameFileCache.update(); + boolean changed = gameFileCache.update(gamePaths); if (changed) { updateGameFileArray(); |
