mirror of
https://github.com/izzy2lost/PSX2.git
synced 2026-07-05 15:18:36 -07:00
fix crash on settings change
Now changing settings globally or per game doesn't crash the app. Works on the fly, without crashing.
This commit is contained in:
@@ -825,10 +825,24 @@ public class MainActivity extends AppCompatActivity implements GamesCoverDialogF
|
||||
private void updateRendererButtonLabel() {
|
||||
MaterialButton btn_bios = findViewById(R.id.btn_bios);
|
||||
if (btn_bios != null) {
|
||||
btn_bios.setText(rendererShortLabel(getCurrentRendererPref()));
|
||||
int current = getCurrentRendererPref();
|
||||
try {
|
||||
// Prefer runtime renderer from core to reflect per-game overrides
|
||||
int runtime = NativeApp.getCurrentRenderer();
|
||||
// Only accept expected values
|
||||
if (runtime == -1 || runtime == 12 || runtime == 13 || runtime == 14) {
|
||||
current = runtime;
|
||||
}
|
||||
} catch (Throwable ignored) {}
|
||||
btn_bios.setText(rendererShortLabel(current));
|
||||
}
|
||||
}
|
||||
|
||||
// Public minimal UI refresh hook for dialogs
|
||||
public void refreshQuickUi() {
|
||||
updateRendererButtonLabel();
|
||||
}
|
||||
|
||||
private void setRendererAndSave(int renderer) {
|
||||
SharedPreferences prefs = getSharedPreferences("app_prefs", MODE_PRIVATE);
|
||||
prefs.edit().putInt("renderer", renderer).apply();
|
||||
|
||||
Reference in New Issue
Block a user