mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 22:13:51 +00:00
Do config readback immediately after running.
Avoids potential issue where game is started right after exiting again.
This commit is contained in:
parent
0d1c394325
commit
b5c733f692
@ -24,6 +24,7 @@ import android.widget.Toast;
|
||||
public final class MainMenuActivity extends PreferenceActivity {
|
||||
private static MainMenuActivity instance = null;
|
||||
private static final int ACTIVITY_LOAD_ROM = 0;
|
||||
private static final int ACTIVITY_RETROARCH = 1;
|
||||
private static final String TAG = "MainMenu";
|
||||
private static String libretro_path;
|
||||
private static String libretro_name;
|
||||
@ -333,11 +334,18 @@ public final class MainMenuActivity extends PreferenceActivity {
|
||||
myIntent.putExtra("LIBRETRO", libretro_path);
|
||||
myIntent.putExtra("CONFIGFILE", UserPreferences.getDefaultConfigPath(this));
|
||||
myIntent.putExtra("IME", current_ime);
|
||||
startActivity(myIntent);
|
||||
startActivityForResult(myIntent, ACTIVITY_RETROARCH);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ACTIVITY_RETROARCH: {
|
||||
Log.i(TAG, "RetroArch finished running.");
|
||||
UserPreferences.readbackConfigFile(this);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -6,22 +6,48 @@ import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
|
||||
public final class RetroTVMode extends Activity {
|
||||
private static final String TAG = "RetroTVMode";
|
||||
private static final int ACTIVITY_RETROARCH = 1;
|
||||
|
||||
// Need to do this wonky logic as we have to keep this activity alive until
|
||||
// RetroArch is done running.
|
||||
// Have to readback config right after RetroArch has run to avoid potential
|
||||
// broken config state.
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
UserPreferences.updateConfigFile(this);
|
||||
if (savedInstanceState == null
|
||||
|| !savedInstanceState.getBoolean("started", false)) {
|
||||
UserPreferences.updateConfigFile(this);
|
||||
|
||||
Intent myIntent = new Intent(this, RetroActivity.class);
|
||||
String current_ime = Settings.Secure.getString(getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
|
||||
myIntent.putExtra("CONFIGFILE", UserPreferences.getDefaultConfigPath(this));
|
||||
myIntent.putExtra("IME", current_ime);
|
||||
startActivity(myIntent);
|
||||
finish();
|
||||
Intent myIntent = new Intent(this, RetroActivity.class);
|
||||
String current_ime = Settings.Secure.getString(
|
||||
getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
|
||||
myIntent.putExtra("CONFIGFILE",
|
||||
UserPreferences.getDefaultConfigPath(this));
|
||||
myIntent.putExtra("IME", current_ime);
|
||||
startActivityForResult(myIntent, ACTIVITY_RETROARCH);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int reqCode, int resCode, Intent data) {
|
||||
switch (reqCode) {
|
||||
case ACTIVITY_RETROARCH: {
|
||||
Log.i(TAG, "RetroArch finished running.");
|
||||
UserPreferences.readbackConfigFile(this);
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle savedInstanceState) {
|
||||
savedInstanceState.putBoolean("started", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user