Android: Add recursive game paths to UI
This commit is contained in:
parent
b3c705fa96
commit
77f539355d
|
@ -317,6 +317,7 @@ public final class SettingsFragmentPresenter
|
|||
|
||||
private void addPathsSettings(ArrayList<SettingsItem> sl)
|
||||
{
|
||||
Setting recursiveISOPaths = null;
|
||||
Setting defaultISO = null;
|
||||
Setting NANDRootPath = null;
|
||||
Setting dumpPath = null;
|
||||
|
@ -326,6 +327,7 @@ public final class SettingsFragmentPresenter
|
|||
|
||||
SettingSection coreSection = mSettings.getSection(Settings.SECTION_INI_CORE);
|
||||
SettingSection generalSection = mSettings.getSection(Settings.SECTION_INI_GENERAL);
|
||||
recursiveISOPaths = generalSection.getSetting(SettingsFile.KEY_RECURSIVE_ISO_PATHS);
|
||||
defaultISO = coreSection.getSetting(SettingsFile.KEY_DEFAULT_ISO);
|
||||
NANDRootPath = generalSection.getSetting(SettingsFile.KEY_NAND_ROOT_PATH);
|
||||
dumpPath = generalSection.getSetting(SettingsFile.KEY_DUMP_PATH);
|
||||
|
@ -333,6 +335,9 @@ public final class SettingsFragmentPresenter
|
|||
resourcePackPath = generalSection.getSetting(SettingsFile.KEY_RESOURCE_PACK_PATH);
|
||||
wiiSDCardPath = generalSection.getSetting(SettingsFile.KEY_WII_SD_CARD_PATH);
|
||||
|
||||
sl.add(new CheckBoxSetting(SettingsFile.KEY_RECURSIVE_ISO_PATHS, Settings.SECTION_INI_GENERAL,
|
||||
R.string.search_subfolders, R.string.search_subfolders_description, false,
|
||||
recursiveISOPaths));
|
||||
sl.add(new FilePicker(SettingsFile.FILE_NAME_DOLPHIN, SettingsFile.KEY_DEFAULT_ISO,
|
||||
Settings.SECTION_INI_CORE, R.string.default_ISO, 0, "",
|
||||
MainPresenter.REQUEST_GAME_FILE, defaultISO));
|
||||
|
|
|
@ -59,6 +59,7 @@ public final class SettingsFile
|
|||
public static final String KEY_SLOT_A_DEVICE = "SlotA";
|
||||
public static final String KEY_SLOT_B_DEVICE = "SlotB";
|
||||
public static final String KEY_ENABLE_SAVE_STATES = "EnableSaveStates";
|
||||
public static final String KEY_RECURSIVE_ISO_PATHS = "RecursiveISOPaths";
|
||||
public static final String KEY_DEFAULT_ISO = "DefaultISO";
|
||||
public static final String KEY_NAND_ROOT_PATH = "NANDRootPath";
|
||||
public static final String KEY_DUMP_PATH = "DumpPath";
|
||||
|
|
|
@ -4,6 +4,10 @@ import android.content.Context;
|
|||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||
import org.dolphinemu.dolphinemu.features.settings.utils.SettingsFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
@ -66,13 +70,17 @@ public class GameFileCache
|
|||
*/
|
||||
public boolean scanLibrary(Context context)
|
||||
{
|
||||
boolean recursiveScan = NativeLibrary
|
||||
.GetConfig(SettingsFile.FILE_NAME_DOLPHIN + ".ini", Settings.SECTION_INI_GENERAL,
|
||||
SettingsFile.KEY_RECURSIVE_ISO_PATHS, "False").equals("True");
|
||||
|
||||
removeNonExistentGameFolders(context);
|
||||
|
||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
Set<String> folderPathsSet = preferences.getStringSet(GAME_FOLDER_PATHS_PREFERENCE, EMPTY_SET);
|
||||
String[] folderPaths = folderPathsSet.toArray(new String[folderPathsSet.size()]);
|
||||
|
||||
boolean cacheChanged = update(folderPaths);
|
||||
boolean cacheChanged = update(folderPaths, recursiveScan);
|
||||
cacheChanged |= updateAdditionalMetadata();
|
||||
if (cacheChanged)
|
||||
{
|
||||
|
@ -85,7 +93,7 @@ public class GameFileCache
|
|||
|
||||
public native GameFile addOrGet(String gamePath);
|
||||
|
||||
private native boolean update(String[] folderPaths);
|
||||
private native boolean update(String[] folderPaths, boolean recursiveScan);
|
||||
|
||||
private native boolean updateAdditionalMetadata();
|
||||
|
||||
|
|
|
@ -164,6 +164,8 @@
|
|||
|
||||
<!-- Path Settings -->
|
||||
<string name="paths_submenu">Paths</string>
|
||||
<string name="search_subfolders">Search Subfolders for Game Files</string>
|
||||
<string name="search_subfolders_description">Refresh library after changing this setting.</string>
|
||||
<string name="default_ISO">Default ISO</string>
|
||||
<string name="wii_NAND_root">Wii NAND Root</string>
|
||||
<string name="dump_path">Dump Path</string>
|
||||
|
|
|
@ -37,7 +37,7 @@ JNIEXPORT jobject JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_add
|
|||
jobject obj,
|
||||
jstring path);
|
||||
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_update(
|
||||
JNIEnv* env, jobject obj, jobjectArray folder_paths);
|
||||
JNIEnv* env, jobject obj, jobjectArray folder_paths, jboolean recursive_scan);
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_model_GameFileCache_updateAdditionalMetadata(JNIEnv* env,
|
||||
jobject obj);
|
||||
|
@ -80,7 +80,7 @@ JNIEXPORT jobject JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_add
|
|||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_update(
|
||||
JNIEnv* env, jobject obj, jobjectArray folder_paths)
|
||||
JNIEnv* env, jobject obj, jobjectArray folder_paths, jboolean recursive_scan)
|
||||
{
|
||||
jsize size = env->GetArrayLength(folder_paths);
|
||||
|
||||
|
@ -94,7 +94,8 @@ JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_up
|
|||
env->DeleteLocalRef(path);
|
||||
}
|
||||
|
||||
return GetPointer(env, obj)->Update(UICommon::FindAllGamePaths(folder_paths_vector, false));
|
||||
return GetPointer(env, obj)->Update(
|
||||
UICommon::FindAllGamePaths(folder_paths_vector, recursive_scan));
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
|
|
Loading…
Reference in New Issue