diff --git a/core/ui/gui.cpp b/core/ui/gui.cpp index 33825ca77..b1fc5c97a 100644 --- a/core/ui/gui.cpp +++ b/core/ui/gui.cpp @@ -1768,11 +1768,14 @@ static void gui_settings_general() ImGui::Text("%s", s.c_str()); ImguiStyleVar _(ImGuiStyleVar_FramePadding, ScaledVec2(24, 3)); #ifdef __ANDROID__ - if (ImGui::Button("Import")) - hostfs::importHomeDirectory(); - ImGui::SameLine(); - if (ImGui::Button("Export")) - hostfs::exportHomeDirectory(); + { + DisabledScope _(!config::UseSafFilePicker); + if (ImGui::Button("Import")) + hostfs::importHomeDirectory(); + ImGui::SameLine(); + if (ImGui::Button("Export")) + hostfs::exportHomeDirectory(); + } #endif #ifdef TARGET_MAC if (ImGui::Button("Reveal in Finder")) diff --git a/shell/android-studio/flycast/src/main/java/com/flycast/emulator/BaseGLActivity.java b/shell/android-studio/flycast/src/main/java/com/flycast/emulator/BaseGLActivity.java index e3c470f28..37d676ad6 100644 --- a/shell/android-studio/flycast/src/main/java/com/flycast/emulator/BaseGLActivity.java +++ b/shell/android-studio/flycast/src/main/java/com/flycast/emulator/BaseGLActivity.java @@ -3,7 +3,6 @@ package com.flycast.emulator; import android.Manifest; import android.app.Activity; import android.app.AlertDialog; -import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; @@ -35,9 +34,6 @@ import com.flycast.emulator.periph.InputDeviceManager; import com.flycast.emulator.periph.SipEmulator; import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Locale; @@ -96,19 +92,13 @@ public abstract class BaseGLActivity extends Activity implements ActivityCompat. new HttpClient().nativeInit(); String homeDir = prefs.getString(Config.pref_home, ""); - // Check that home dir is valid, migrate if needed - String newHome = checkHomeDirectory(homeDir); - if (newHome != null) { - if (!newHome.equals(homeDir)) - prefs.edit().putString(Config.pref_home, newHome).apply(); - finishCreation(); + // Check that home dir is valid + if (homeDir.isEmpty()) { + // home dir not set: use default + homeDir = getDefaultHomeDir(); + prefs.edit().putString(Config.pref_home, homeDir).apply(); } - Log.i("flycast", "BaseGLActivity.onCreate done"); - } - protected void finishCreation() - { - String homeDir = prefs.getString(Config.pref_home, getDefaultHomeDir()); String result = JNIdc.initEnvironment((Emulator)getApplicationContext(), getFilesDir().getAbsolutePath(), homeDir, Locale.getDefault().toString()); if (result != null) { @@ -178,7 +168,7 @@ public abstract class BaseGLActivity extends Activity implements ActivityCompat. pendingIntentUrl = gameUri.toString(); } } - Log.i("flycast", "BaseGLActivity.finishCreation done"); + Log.i("flycast", "BaseGLActivity.onCreate done"); } private void setStorageDirectories() @@ -430,132 +420,6 @@ public abstract class BaseGLActivity extends Activity implements ActivityCompat. return dir.getAbsolutePath(); } - private String checkHomeDirectory(String homeDir) - { - if (homeDir.isEmpty()) - // home dir not set: use default - return getDefaultHomeDir(); - // must account for the fact that homeDir may be on internal storage but external storage is now available - if (homeDir.startsWith(getDefaultHomeDir()) || homeDir.startsWith(getFilesDir().getAbsolutePath())) - // home dir is ok - return homeDir; - if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) - // no need to migrate on Android 9 or earlier - return homeDir; - // migration disabled for now - return homeDir; - /* - // Only ask to migrate once - String migrationPref = "legacy-storage-migration-done"; - if (prefs.getBoolean(migrationPref, false)) - return homeDir; - // Ask the user if he wants to migrate - AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this); - dlgAlert.setMessage("The current Flycast home folder will be inaccessible in future versions.\n\n" - + "Do you want to move config and save files to a valid location?"); - dlgAlert.setTitle("Migrate Home"); - dlgAlert.setPositiveButton("Yes", - (dialog, id) -> BaseGLActivity.this.migrateHome(homeDir)); - dlgAlert.setNegativeButton("No", - (dialog, id) -> BaseGLActivity.this.finishCreation()); - dlgAlert.setIcon(android.R.drawable.ic_dialog_alert); - dlgAlert.setCancelable(false); - dlgAlert.create().show(); - // Don't ask again - prefs.edit().putBoolean(migrationPref, true).apply(); - - return null; - */ - } - - private boolean migrationThreadCancelled = false; - private void migrateHome(String oldHome) - { - File source = new File(oldHome); - File dest = new File(getDefaultHomeDir()); - ProgressDialog progress = ProgressDialog.show(this, "Migrating", "Moving files to their new home", - true, true, dialogInterface -> migrationThreadCancelled = true); - progress.show(); - - migrationThreadCancelled = false; - Thread thread = new Thread(new Runnable() { - private void moveFile(File file, File toDir) - { - //Log.d("flycast", "Moving " + file.getAbsolutePath() + " to " + toDir.getAbsolutePath()); - try { - File dest = new File(toDir, file.getName()); - // file.renameTo(dest) doesn't seem to work - FileInputStream in = new FileInputStream(file); - FileOutputStream out = new FileOutputStream(dest); - byte[] buf = new byte[8192]; - while (true) { - int len = in.read(buf); - if (len == -1) - break; - out.write(buf, 0, len); - } - out.close(); - in.close(); - file.delete(); - } catch (IOException e) { - Log.e("flycast", "Error moving " + file.getAbsolutePath(), e); - } - } - - private void moveDir(File from, File to) - { - //Log.d("flycast", "Moving dir " + from.getAbsolutePath() + " to " + to.getAbsolutePath()); - if (!from.exists()) - return; - File[] files = from.listFiles(); - if (files == null) { - Log.e("flycast", "Can't list content of " + from.getAbsolutePath()); - return; - } - for (File file : files) - { - if (migrationThreadCancelled) - break; - if (file.isFile()) - moveFile(file, to); - else if (file.isDirectory() && !file.getName().equals("boxart")) { - File subDir = new File(to, file.getName()); - subDir.mkdir(); - moveDir(file, subDir); - } - } - from.delete(); - } - - private void migrate() - { - moveFile(new File(source, "emu.cfg"), dest); - if (migrationThreadCancelled) - return; - File mappings = new File(dest, "mappings"); - mappings.mkdirs(); - moveDir(new File(source, "mappings"), mappings); - if (migrationThreadCancelled) - return; - File data = new File(dest, "data"); - data.mkdirs(); - moveDir(new File(source, "data"), data); - } - - @Override - public void run() - { - migrate(); - runOnUiThread(() -> { - prefs.edit().putString(Config.pref_home, getDefaultHomeDir()).apply(); - progress.dismiss(); - BaseGLActivity.this.finishCreation(); - }); - } - }); - thread.start(); - } - // Called from native code public void onGameStateChange(boolean started) { runOnUiThread(new Runnable() { diff --git a/shell/android-studio/flycast/src/main/java/com/flycast/emulator/NativeGLActivity.java b/shell/android-studio/flycast/src/main/java/com/flycast/emulator/NativeGLActivity.java index 7041eb70d..1cb336993 100644 --- a/shell/android-studio/flycast/src/main/java/com/flycast/emulator/NativeGLActivity.java +++ b/shell/android-studio/flycast/src/main/java/com/flycast/emulator/NativeGLActivity.java @@ -35,19 +35,13 @@ public final class NativeGLActivity extends BaseGLActivity { super.onCreate(savedInstanceState); - Log.i("flycast", "NativeGLActivity.onCreate done"); - } - - protected void finishCreation() - { - super.finishCreation(); // Create the actual GL view mView = new NativeGLView(this); mLayout = new RelativeLayout(this); mLayout.addView(mView); setContentView(mLayout); - Log.i("flycast", "NativeGLActivity.finishCreation done"); + Log.i("flycast", "NativeGLActivity.onCreate done"); } @Override diff --git a/shell/android-studio/screenshots/TV/flycast-banner.png b/shell/android-studio/screenshots/TV/flycast-banner.png new file mode 100644 index 000000000..83a715057 Binary files /dev/null and b/shell/android-studio/screenshots/TV/flycast-banner.png differ diff --git a/shell/android-studio/screenshots/TV/tv_screenshot_cheevos.png b/shell/android-studio/screenshots/TV/tv_screenshot_cheevos.png new file mode 100644 index 000000000..7c2790f61 Binary files /dev/null and b/shell/android-studio/screenshots/TV/tv_screenshot_cheevos.png differ diff --git a/shell/android-studio/screenshots/TV/tv_screenshot_gameplay.png b/shell/android-studio/screenshots/TV/tv_screenshot_gameplay.png new file mode 100644 index 000000000..e07a9d5b9 Binary files /dev/null and b/shell/android-studio/screenshots/TV/tv_screenshot_gameplay.png differ diff --git a/shell/android-studio/screenshots/TV/tv_screenshot_library.png b/shell/android-studio/screenshots/TV/tv_screenshot_library.png new file mode 100644 index 000000000..bf49a7cfc Binary files /dev/null and b/shell/android-studio/screenshots/TV/tv_screenshot_library.png differ diff --git a/shell/android-studio/screenshots/TV/tv_screenshot_pausemenu.png b/shell/android-studio/screenshots/TV/tv_screenshot_pausemenu.png new file mode 100644 index 000000000..0a2cc83c0 Binary files /dev/null and b/shell/android-studio/screenshots/TV/tv_screenshot_pausemenu.png differ diff --git a/shell/android-studio/screenshots/TV/tv_screenshot_settings.png b/shell/android-studio/screenshots/TV/tv_screenshot_settings.png new file mode 100644 index 000000000..b5a4ed888 Binary files /dev/null and b/shell/android-studio/screenshots/TV/tv_screenshot_settings.png differ