diff --git a/src/android/app/src/main/AndroidManifest.xml b/src/android/app/src/main/AndroidManifest.xml index 5a8f90cd1..8b9438778 100644 --- a/src/android/app/src/main/AndroidManifest.xml +++ b/src/android/app/src/main/AndroidManifest.xml @@ -7,9 +7,6 @@ - @@ -41,18 +38,6 @@ - - - - - - - - - - - { - // Special case: user clicked on a settings row item. - if (item instanceof TvSettingsItem) { - TvSettingsItem settingsItem = (TvSettingsItem) item; - mPresenter.handleOptionSelection(settingsItem.getItemId()); - } else { - TvGameViewHolder holder = (TvGameViewHolder) itemViewHolder; - - // Start the emulation activity and send the path of the clicked ISO to it. - EmulationActivity.launch(TvMainActivity.this, holder.path, holder.title); - } - }); - } - - /** - * MainView - */ - - @Override - public void setVersionString(String version) { - mBrowseFragment.setTitle(version); - } - - @Override - public void refresh() { - recreate(); - } - - @Override - public void launchSettingsActivity(String menuTag) { - SettingsActivity.launch(this, menuTag, ""); - } - - @Override - public void launchFileListActivity() { - FileBrowserHelper.openDirectoryPicker(this, MainPresenter.REQUEST_ADD_DIRECTORY, - R.string.select_game_folder); - } - - @Override - public void showGames(Cursor games) { - ListRow row = buildGamesRow(games); - - // Add row to the adapter only if it is not empty. - if (row != null) { - mRowsAdapter.add(games); - } - } - - /** - * Callback from AddDirectoryActivity. Applies any changes necessary to the GameGridActivity. - * - * @param requestCode An int describing whether the Activity that is returning did so successfully. - * @param resultCode An int describing what Activity is giving us this callback. - * @param result The information the returning Activity is providing us. - */ - @Override - protected void onActivityResult(int requestCode, int resultCode, Intent result) { - switch (requestCode) { - case MainPresenter.REQUEST_ADD_DIRECTORY: - // If the user picked a file, as opposed to just backing out. - if (resultCode == MainActivity.RESULT_OK) { - mPresenter.onDirectorySelected(FileBrowserHelper.getSelectedDirectory(result)); - } - break; - } - } - - @Override - public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { - switch (requestCode) { - case PermissionsHandler.REQUEST_CODE_WRITE_PERMISSION: - if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { - DirectoryInitialization.start(this); - loadGames(); - } else { - Toast.makeText(this, R.string.write_permission_needed, Toast.LENGTH_SHORT) - .show(); - } - break; - default: - super.onRequestPermissionsResult(requestCode, permissions, grantResults); - break; - } - } - - private void buildRowsAdapter() { - mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter()); - - if (PermissionsHandler.hasWriteAccess(this)) { - loadGames(); - } - - mRowsAdapter.add(buildSettingsRow()); - - mBrowseFragment.setAdapter(mRowsAdapter); - } - - private void loadGames() { - mPresenter.loadGames(); - } - - private ListRow buildGamesRow(Cursor games) { - // Create an adapter for this row. - CursorObjectAdapter row = new CursorObjectAdapter(new GameRowPresenter()); - - // If cursor is empty, don't return a Row. - if (!games.moveToFirst()) { - return null; - } - - row.changeCursor(games); - row.setMapper(new CursorMapper() { - @Override - protected void bindColumns(Cursor cursor) { - // No-op? Not sure what this does. - } - - @Override - protected Object bind(Cursor cursor) { - return Game.fromCursor(cursor); - } - }); - - // Create the row, passing it the filled adapter and the header, and give it to the master adapter. - return new ListRow(null, row); - } - - private ListRow buildSettingsRow() { - ArrayObjectAdapter rowItems = new ArrayObjectAdapter(new SettingsRowPresenter()); - - rowItems.add(new TvSettingsItem(R.id.menu_settings_core, - R.drawable.ic_settings_core_tv, - R.string.grid_menu_core_settings)); - - rowItems.add(new TvSettingsItem(R.id.button_add_directory, - R.drawable.ic_add_tv, - R.string.add_directory_title)); - - // Create a header for this row. - HeaderItem header = - new HeaderItem(R.string.preferences_settings, getString(R.string.preferences_settings)); - - return new ListRow(header, rowItems); - } -} diff --git a/src/android/app/src/main/java/org/citra/citra_emu/ui/platform/PlatformGamesFragment.java b/src/android/app/src/main/java/org/citra/citra_emu/ui/platform/PlatformGamesFragment.java index 040b78782..503dc78a8 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/ui/platform/PlatformGamesFragment.java +++ b/src/android/app/src/main/java/org/citra/citra_emu/ui/platform/PlatformGamesFragment.java @@ -3,7 +3,6 @@ package org.citra.citra_emu.ui.platform; import android.database.Cursor; import android.os.Bundle; -import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import androidx.recyclerview.widget.GridLayoutManager; @@ -60,11 +59,6 @@ public final class PlatformGamesFragment extends Fragment implements PlatformGam }); } - @Override - public void refreshScreenshotAtPosition(int position) { - mAdapter.notifyItemChanged(position); - } - @Override public void refresh() { mPresenter.refresh(); diff --git a/src/android/app/src/main/java/org/citra/citra_emu/ui/platform/PlatformGamesView.java b/src/android/app/src/main/java/org/citra/citra_emu/ui/platform/PlatformGamesView.java index e0ecd58d5..4332121eb 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/ui/platform/PlatformGamesView.java +++ b/src/android/app/src/main/java/org/citra/citra_emu/ui/platform/PlatformGamesView.java @@ -11,14 +11,6 @@ public interface PlatformGamesView { */ void refresh(); - /** - * Tell the view that a certain game's screenshot has been updated, - * and should be redrawn on-screen. - * - * @param position The index of the game that should be redrawn. - */ - void refreshScreenshotAtPosition(int position); - /** * To be called when an asynchronous database read completes. Passes the * result, in this case a {@link Cursor}, to the view. diff --git a/src/android/app/src/main/java/org/citra/citra_emu/utils/Animations.java b/src/android/app/src/main/java/org/citra/citra_emu/utils/Animations.java deleted file mode 100644 index 961430c3e..000000000 --- a/src/android/app/src/main/java/org/citra/citra_emu/utils/Animations.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.citra.citra_emu.utils; - -import android.view.View; -import android.view.ViewPropertyAnimator; - -public final class Animations { - private Animations() { - } - - public static ViewPropertyAnimator fadeViewIn(View view) { - view.setVisibility(View.VISIBLE); - - return view.animate() - .withLayer() - .setDuration(100) - .alpha(1.0f); - } - - public static ViewPropertyAnimator fadeViewOut(View view) { - return view.animate() - .withLayer() - .setDuration(300) - .alpha(0.0f); - } -} diff --git a/src/android/app/src/main/java/org/citra/citra_emu/utils/EGLHelper.java b/src/android/app/src/main/java/org/citra/citra_emu/utils/EGLHelper.java deleted file mode 100644 index 2841fadda..000000000 --- a/src/android/app/src/main/java/org/citra/citra_emu/utils/EGLHelper.java +++ /dev/null @@ -1,353 +0,0 @@ -/** - * Copyright 2013 Dolphin Emulator Project - * Licensed under GPLv2+ - * Refer to the license.txt file included. - */ - -package org.citra.citra_emu.utils; - -import android.opengl.GLES30; - -import org.citra.citra_emu.NativeLibrary; - -import javax.microedition.khronos.egl.EGL10; -import javax.microedition.khronos.egl.EGLConfig; -import javax.microedition.khronos.egl.EGLContext; -import javax.microedition.khronos.egl.EGLDisplay; -import javax.microedition.khronos.egl.EGLSurface; -import javax.microedition.khronos.opengles.GL10; - -/** - * Utility class that abstracts all the stuff about - * EGL initialization out of the way if all that is - * wanted is to query the underlying GL API for information. - */ -public final class EGLHelper { - // Renderable type bitmasks - public static final int EGL_OPENGL_ES_BIT = 0x0001; - public static final int EGL_OPENGL_ES2_BIT = 0x0004; - public static final int EGL_OPENGL_BIT = 0x0008; - public static final int EGL_OPENGL_ES3_BIT_KHR = 0x0040; - // API types - public static final int EGL_OPENGL_ES_API = 0x30A0; - public static final int EGL_OPENGL_API = 0x30A2; - private final EGL10 mEGL; - private final EGLDisplay mDisplay; - private EGLConfig[] mEGLConfigs; - private EGLContext mEGLContext; - private EGLSurface mEGLSurface; - private GL10 mGL; - // GL support flags - private boolean supportGL; - private boolean supportGLES2; - private boolean supportGLES3; - - /** - * Constructor - *

- * Initializes the underlying {@link EGLSurface} with a width and height of 1. - * This is useful if all you need to use this class for is to query information - * from specific API contexts. - * - * @param renderableType Bitmask indicating which types of client API contexts - * the framebuffer config must support. - */ - public EGLHelper(int renderableType) { - this(1, 1, renderableType); - } - - /** - * Constructor - * - * @param width Width of the underlying {@link EGLSurface}. - * @param height Height of the underlying {@link EGLSurface}. - * @param renderableType Bitmask indicating which types of client API contexts - * the framebuffer config must support. - */ - public EGLHelper(int width, int height, int renderableType) { - // Initialize handle to an EGL display. - mEGL = (EGL10) EGLContext.getEGL(); - mDisplay = mEGL.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); - - // If a display is present, initialize EGL. - if (mDisplay != EGL10.EGL_NO_DISPLAY) { - int[] version = new int[2]; - if (mEGL.eglInitialize(mDisplay, version)) { - // Detect supported GL APIs, initialize configs, etc. - detect(); - - // Create context and surface - create(width, height, renderableType); - } else { - Log.error("[EGLHelper] Error initializing EGL."); - } - } else { - Log.error("[EGLHelper] Error initializing EGL display."); - } - } - - /** - * Releases all resources associated with this helper. - *

- * This should be called whenever this helper is no longer needed. - */ - public void closeHelper() { - mEGL.eglTerminate(mDisplay); - } - - /** - * Gets information through EGL.
- *

- * Index 0: Vendor
- * Index 1: Version
- * Index 2: Renderer
- * Index 3: Extensions
- * - * @return information retrieved through EGL. - */ - public String[] getEGLInfo() { - return new String[]{ - mGL.glGetString(GL10.GL_VENDOR), - mGL.glGetString(GL10.GL_VERSION), - mGL.glGetString(GL10.GL_RENDERER), - mGL.glGetString(GL10.GL_EXTENSIONS), - }; - } - - /** - * Whether or not this device supports OpenGL. - * - * @return true if this device supports OpenGL; false otherwise. - */ - public boolean supportsOpenGL() { - return supportGL; - } - - /** - * Whether or not this device supports OpenGL ES 2. - *
- * Note that if this returns true, then OpenGL ES 1 is also supported. - * - * @return true if this device supports OpenGL ES 2; false otherwise. - */ - public boolean supportsGLES2() { - return supportGLES2; - } - - /** - * Whether or not this device supports OpenGL ES 3. - *
- * Note that if this returns true, then OpenGL ES 1 and 2 are also supported. - * - * @return true if this device supports OpenGL ES 3; false otherwise. - */ - public boolean supportsGLES3() { - return supportGLES3; - } - - /** - * Gets the underlying {@link EGL10} instance. - * - * @return the underlying {@link EGL10} instance. - */ - public EGL10 getEGL() { - return mEGL; - } - - /** - * Gets the underlying {@link GL10} instance. - * - * @return the underlying {@link GL10} instance. - */ - public GL10 getGL() { - return mGL; - } - - /** - * Gets the underlying {@link EGLDisplay}. - * - * @return the underlying {@link EGLDisplay} - */ - public EGLDisplay getDisplay() { - return mDisplay; - } - - /** - * Gets all supported framebuffer configurations for this device. - * - * @return all supported framebuffer configurations for this device. - */ - public EGLConfig[] getConfigs() { - return mEGLConfigs; - } - - /** - * Gets the underlying {@link EGLContext}. - * - * @return the underlying {@link EGLContext}. - */ - public EGLContext getContext() { - return mEGLContext; - } - - /** - * Gets the underlying {@link EGLSurface}. - * - * @return the underlying {@link EGLSurface}. - */ - public EGLSurface getSurface() { - return mEGLSurface; - } - - // Detects the specific kind of GL modes that are supported - private boolean detect() { - // Get total number of configs available. - int[] numConfigs = new int[1]; - if (!mEGL.eglGetConfigs(mDisplay, null, 0, numConfigs)) { - Log.error("[EGLHelper] Error retrieving number of EGL configs available."); - return false; - } - - // Now get all the configurations - mEGLConfigs = new EGLConfig[numConfigs[0]]; - if (!mEGL.eglGetConfigs(mDisplay, mEGLConfigs, mEGLConfigs.length, numConfigs)) { - Log.error("[EGLHelper] Error retrieving all EGL configs."); - return false; - } - - for (EGLConfig mEGLConfig : mEGLConfigs) { - int[] attribVal = new int[1]; - boolean ret = - mEGL.eglGetConfigAttrib(mDisplay, mEGLConfig, EGL10.EGL_RENDERABLE_TYPE, attribVal); - if (ret) { - if ((attribVal[0] & EGL_OPENGL_BIT) != 0) - supportGL = true; - - if ((attribVal[0] & EGL_OPENGL_ES2_BIT) != 0) - supportGLES2 = true; - - if ((attribVal[0] & EGL_OPENGL_ES3_BIT_KHR) != 0) - supportGLES3 = true; - } - } - - return true; - } - - // Creates the context and surface. - private void create(int width, int height, int renderableType) { - int[] attribs = { - EGL10.EGL_WIDTH, width, - EGL10.EGL_HEIGHT, height, - EGL10.EGL_NONE - }; - - // Initially we just assume GLES2 will be the default context. - int EGL_CONTEXT_CLIENT_VERSION = 0x3098; - int[] ctx_attribs = { - EGL_CONTEXT_CLIENT_VERSION, 2, - EGL10.EGL_NONE - }; - - // Determine the type of context that will be created - // and change the attribute arrays accordingly. - switch (renderableType) { - case EGL_OPENGL_ES_BIT: - ctx_attribs[1] = 1; - break; - - case EGL_OPENGL_BIT: - ctx_attribs[0] = EGL10.EGL_NONE; - break; - - case EGL_OPENGL_ES3_BIT_KHR: - ctx_attribs[1] = 3; - break; - - case EGL_OPENGL_ES2_BIT: - default: // Fall-back to GLES 2. - ctx_attribs[1] = 2; - break; - } - if (renderableType == EGL_OPENGL_BIT) - NativeLibrary.eglBindAPI(EGL_OPENGL_API); - else - NativeLibrary.eglBindAPI(EGL_OPENGL_ES_API); - - mEGLContext = - mEGL.eglCreateContext(mDisplay, mEGLConfigs[0], EGL10.EGL_NO_CONTEXT, ctx_attribs); - mEGLSurface = mEGL.eglCreatePbufferSurface(mDisplay, mEGLConfigs[0], attribs); - mEGL.eglMakeCurrent(mDisplay, mEGLSurface, mEGLSurface, mEGLContext); - mGL = (GL10) mEGLContext.getGL(); - } - - /** - * Simplified call to {@link GL10#glGetString(int)} - *

- * Accepts the following constants: - *

    - *
  • GL_VENDOR - Company responsible for the GL implementation.
  • - *
  • GL_VERSION - Version or release number.
  • - *
  • GL_RENDERER - Name of the renderer
  • - *
  • GL_SHADING_LANGUAGE_VERSION - Version or release number of the shading language
  • - *
- * - * @param glEnum A symbolic constant within {@link GL10}. - * @return the string information represented by {@code glEnum}. - */ - public String glGetString(int glEnum) { - return mGL.glGetString(glEnum); - } - - /** - * Simplified call to {@link GLES30#glGetStringi(int, int)} - *

- * Accepts the following constants: - *

    - *
  • GL_VENDOR - Company responsible for the GL implementation.
  • - *
  • GL_VERSION - Version or release number.
  • - *
  • GL_RENDERER - Name of the renderer
  • - *
  • GL_SHADING_LANGUAGE_VERSION - Version or release number of the shading language
  • - *
  • GL_EXTENSIONS - Extension string supported by the implementation at {@code index}.
  • - *
- * - * @param glEnum A symbolic GL constant - * @param index The index of the string to return. - * @return the string information represented by {@code glEnum} and {@code index}. - */ - public String glGetStringi(int glEnum, int index) { - return GLES30.glGetStringi(glEnum, index); - } - - public boolean SupportsExtension(String extension) { - int[] num_ext = new int[1]; - GLES30.glGetIntegerv(GLES30.GL_NUM_EXTENSIONS, num_ext, 0); - - for (int i = 0; i < num_ext[0]; ++i) { - String ext = GLES30.glGetStringi(GLES30.GL_EXTENSIONS, i); - if (ext.equals(extension)) - return true; - } - return false; - } - - public int GetVersion() { - int[] major = new int[1]; - int[] minor = new int[1]; - GLES30.glGetIntegerv(GLES30.GL_MAJOR_VERSION, major, 0); - GLES30.glGetIntegerv(GLES30.GL_MINOR_VERSION, minor, 0); - return major[0] * 100 + minor[0] * 10; - } - - /** - * Simplified call to {@link GL10#glGetIntegerv(int, int[], int) - * - * @param glEnum A symbolic GL constant. - * @return the integer information represented by {@code glEnum}. - */ - public int glGetInteger(int glEnum) { - int[] val = new int[1]; - mGL.glGetIntegerv(glEnum, val, 0); - return val[0]; - } -} diff --git a/src/android/app/src/main/java/org/citra/citra_emu/viewholders/TvGameViewHolder.java b/src/android/app/src/main/java/org/citra/citra_emu/viewholders/TvGameViewHolder.java deleted file mode 100644 index 4dc6ac119..000000000 --- a/src/android/app/src/main/java/org/citra/citra_emu/viewholders/TvGameViewHolder.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.citra.citra_emu.viewholders; - -import androidx.leanback.widget.ImageCardView; -import androidx.leanback.widget.Presenter; -import android.view.View; -import android.widget.ImageView; - -/** - * A simple class that stores references to views so that the GameAdapter doesn't need to - * keep calling findViewById(), which is expensive. - */ -public final class TvGameViewHolder extends Presenter.ViewHolder { - public ImageCardView cardParent; - - public ImageView imageScreenshot; - - public String gameId; - - // TODO Not need any of this stuff. Currently only the properties dialog needs it. - public String path; - public String title; - public String description; - public int country; - public String company; - public String screenshotPath; - - public TvGameViewHolder(View itemView) { - super(itemView); - - itemView.setTag(this); - - cardParent = (ImageCardView) itemView; - imageScreenshot = cardParent.getMainImageView(); - } -} diff --git a/src/android/app/src/main/java/org/citra/citra_emu/viewholders/TvSettingsViewHolder.java b/src/android/app/src/main/java/org/citra/citra_emu/viewholders/TvSettingsViewHolder.java deleted file mode 100644 index 3bb03963a..000000000 --- a/src/android/app/src/main/java/org/citra/citra_emu/viewholders/TvSettingsViewHolder.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.citra.citra_emu.viewholders; - -import androidx.leanback.widget.ImageCardView; -import androidx.leanback.widget.Presenter; -import android.view.View; - -public final class TvSettingsViewHolder extends Presenter.ViewHolder { - public ImageCardView cardParent; - - // Determines what action to take when this item is clicked. - public int itemId; - - public TvSettingsViewHolder(View itemView) { - super(itemView); - - itemView.setTag(this); - - cardParent = (ImageCardView) itemView; - } -} diff --git a/src/android/app/src/main/res/animator/menu_slide_in_from_left.xml b/src/android/app/src/main/res/animator/menu_slide_in_from_left.xml deleted file mode 100644 index 4612aee13..000000000 --- a/src/android/app/src/main/res/animator/menu_slide_in_from_left.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/android/app/src/main/res/animator/menu_slide_out_to_left.xml b/src/android/app/src/main/res/animator/menu_slide_out_to_left.xml deleted file mode 100644 index 0e21cf848..000000000 --- a/src/android/app/src/main/res/animator/menu_slide_out_to_left.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/android/app/src/main/res/drawable/ic_add_tv.png b/src/android/app/src/main/res/drawable/ic_add_tv.png deleted file mode 100644 index 77f0b3aee..000000000 Binary files a/src/android/app/src/main/res/drawable/ic_add_tv.png and /dev/null differ diff --git a/src/android/app/src/main/res/drawable/ic_settings_core_tv.png b/src/android/app/src/main/res/drawable/ic_settings_core_tv.png deleted file mode 100644 index 361bc89af..000000000 Binary files a/src/android/app/src/main/res/drawable/ic_settings_core_tv.png and /dev/null differ diff --git a/src/android/app/src/main/res/drawable/tv_card_background_gamecube.xml b/src/android/app/src/main/res/drawable/tv_card_background_gamecube.xml deleted file mode 100644 index 5c3614106..000000000 --- a/src/android/app/src/main/res/drawable/tv_card_background_gamecube.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/src/android/app/src/main/res/layout-television/activity_emulation.xml b/src/android/app/src/main/res/layout-television/activity_emulation.xml deleted file mode 100644 index 7632b5a97..000000000 --- a/src/android/app/src/main/res/layout-television/activity_emulation.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/src/android/app/src/main/res/layout-television/fragment_emulation.xml b/src/android/app/src/main/res/layout-television/fragment_emulation.xml deleted file mode 100644 index 27243e841..000000000 --- a/src/android/app/src/main/res/layout-television/fragment_emulation.xml +++ /dev/null @@ -1,7 +0,0 @@ - \ No newline at end of file diff --git a/src/android/app/src/main/res/layout/activity_tv_main.xml b/src/android/app/src/main/res/layout/activity_tv_main.xml deleted file mode 100644 index b14f5c56d..000000000 --- a/src/android/app/src/main/res/layout/activity_tv_main.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/android/app/src/main/res/layout/fragment_ingame_menu.xml b/src/android/app/src/main/res/layout/fragment_ingame_menu.xml deleted file mode 100644 index 49a612bea..000000000 --- a/src/android/app/src/main/res/layout/fragment_ingame_menu.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - -