(Android Phoenix) Preliminary per-core config settings - maister:

things like ROM path don't currently work correctly per core when
configured individually - please look at it
This commit is contained in:
twinaphex 2013-08-19 01:14:01 +02:00
parent 05ae971aae
commit 220411be67
4 changed files with 36 additions and 11 deletions
android/phoenix

@ -123,6 +123,10 @@
</PreferenceScreen>
<PreferenceScreen android:title="Input Options" >
<PreferenceCategory android:title="General" >
<CheckBoxPreference android:title="Enable global configuration"
android:summary="Enable global settings for all cores. Leave disabled if you want per-core settings."
android:key="global_config_enable"
android:defaultValue="true"/>
<ListPreference
android:entries="@array/back_options"
android:entryValues="@array/back_options_values"

@ -168,35 +168,52 @@ public class MainMenuActivity extends PreferenceActivity {
public static String getDefaultConfigPath() {
String internal = System.getenv("INTERNAL_STORAGE");
String external = System.getenv("EXTERNAL_STORAGE");
SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(MainMenuActivity.getInstance()
.getBaseContext());
boolean global_config_enable = prefs.getBoolean("global_config_enable", true);
boolean config_same_as_native_lib_dir = libretro_path.equals(MainMenuActivity.getInstance().getApplicationInfo().nativeLibraryDir);
String append_path;
if (!global_config_enable && (config_same_as_native_lib_dir == false)) {
String sanitized_name = libretro_path.substring(libretro_path.lastIndexOf("/")+1,libretro_path.lastIndexOf("."));
sanitized_name = sanitized_name.replace("neon", "");
sanitized_name = sanitized_name.replace("libretro_","");
append_path = File.separator + sanitized_name + "retroarch.cfg";
}
else {
append_path = File.separator + "retroarch.cfg";
}
if (external != null) {
String confPath = external + File.separator + "retroarch.cfg";
String confPath = external + append_path;
if (new File(confPath).exists())
return confPath;
} else if (internal != null) {
String confPath = internal + File.separator + "retroarch.cfg";
String confPath = internal + append_path;
if (new File(confPath).exists())
return confPath;
} else {
String confPath = "/mnt/extsd/retroarch.cfg";
String confPath = "/mnt/extsd" + append_path;
if (new File(confPath).exists())
return confPath;
}
if (internal != null
&& new File(internal + File.separator + "retroarch.cfg")
&& new File(internal + append_path)
.canWrite())
return internal + File.separator + "retroarch.cfg";
return internal + append_path;
else if (external != null
&& new File(internal + File.separator + "retroarch.cfg")
&& new File(internal + append_path)
.canWrite())
return external + File.separator + "retroarch.cfg";
return external + append_path;
else if ((MainMenuActivity.getInstance().getApplicationInfo().dataDir) != null)
return (MainMenuActivity.getInstance().getApplicationInfo().dataDir)
+ File.separator + "retroarch.cfg";
+ append_path;
else
// emergency fallback, all else failed
return "/mnt/sd/retroarch.cfg";
return "/mnt/sd" + append_path;
}
public void updateConfigFile() {
@ -215,6 +232,10 @@ public class MainMenuActivity extends PreferenceActivity {
config.setString("libretro_name", libretro_name);
setCoreTitle(libretro_name);
config.setString("rgui_browser_directory",
prefs.getString("rgui_browser_directory", ""));
config.setBoolean("global_config_enable",
prefs.getBoolean("global_config_enable", true));
config.setBoolean("audio_rate_control",
prefs.getBoolean("audio_rate_control", true));
config.setInt("audio_out_rate",

@ -11,7 +11,7 @@ public class ROMActivity extends DirectoryActivity {
public void onCreate(Bundle savedInstanceState) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
String startPath = prefs.getString("phoenix_rom_dir", "");
String startPath = prefs.getString("rgui_browser_directory", "");
if (!startPath.isEmpty() && new File(startPath).exists())
super.setStartDirectory(startPath);

@ -5,7 +5,7 @@ import android.os.Bundle;
public class ROMDirActivity extends DirectoryActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.setPathSettingKey("phoenix_rom_dir");
super.setPathSettingKey("rgui_browser_directory");
super.setIsDirectoryTarget(true);
super.onCreate(savedInstanceState);
}