(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

View File

@ -123,6 +123,10 @@
</PreferenceScreen> </PreferenceScreen>
<PreferenceScreen android:title="Input Options" > <PreferenceScreen android:title="Input Options" >
<PreferenceCategory android:title="General" > <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 <ListPreference
android:entries="@array/back_options" android:entries="@array/back_options"
android:entryValues="@array/back_options_values" android:entryValues="@array/back_options_values"

View File

@ -168,35 +168,52 @@ public class MainMenuActivity extends PreferenceActivity {
public static String getDefaultConfigPath() { public static String getDefaultConfigPath() {
String internal = System.getenv("INTERNAL_STORAGE"); String internal = System.getenv("INTERNAL_STORAGE");
String external = System.getenv("EXTERNAL_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) { if (external != null) {
String confPath = external + File.separator + "retroarch.cfg"; String confPath = external + append_path;
if (new File(confPath).exists()) if (new File(confPath).exists())
return confPath; return confPath;
} else if (internal != null) { } else if (internal != null) {
String confPath = internal + File.separator + "retroarch.cfg"; String confPath = internal + append_path;
if (new File(confPath).exists()) if (new File(confPath).exists())
return confPath; return confPath;
} else { } else {
String confPath = "/mnt/extsd/retroarch.cfg"; String confPath = "/mnt/extsd" + append_path;
if (new File(confPath).exists()) if (new File(confPath).exists())
return confPath; return confPath;
} }
if (internal != null if (internal != null
&& new File(internal + File.separator + "retroarch.cfg") && new File(internal + append_path)
.canWrite()) .canWrite())
return internal + File.separator + "retroarch.cfg"; return internal + append_path;
else if (external != null else if (external != null
&& new File(internal + File.separator + "retroarch.cfg") && new File(internal + append_path)
.canWrite()) .canWrite())
return external + File.separator + "retroarch.cfg"; return external + append_path;
else if ((MainMenuActivity.getInstance().getApplicationInfo().dataDir) != null) else if ((MainMenuActivity.getInstance().getApplicationInfo().dataDir) != null)
return (MainMenuActivity.getInstance().getApplicationInfo().dataDir) return (MainMenuActivity.getInstance().getApplicationInfo().dataDir)
+ File.separator + "retroarch.cfg"; + append_path;
else else
// emergency fallback, all else failed // emergency fallback, all else failed
return "/mnt/sd/retroarch.cfg"; return "/mnt/sd" + append_path;
} }
public void updateConfigFile() { public void updateConfigFile() {
@ -215,6 +232,10 @@ public class MainMenuActivity extends PreferenceActivity {
config.setString("libretro_name", libretro_name); config.setString("libretro_name", libretro_name);
setCoreTitle(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", config.setBoolean("audio_rate_control",
prefs.getBoolean("audio_rate_control", true)); prefs.getBoolean("audio_rate_control", true));
config.setInt("audio_out_rate", config.setInt("audio_out_rate",

View File

@ -11,7 +11,7 @@ public class ROMActivity extends DirectoryActivity {
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); 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()) if (!startPath.isEmpty() && new File(startPath).exists())
super.setStartDirectory(startPath); super.setStartDirectory(startPath);

View File

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