diff --git a/Source/Android/app/src/main/AndroidManifest.xml b/Source/Android/app/src/main/AndroidManifest.xml index 5062741456..e46eaf7797 100644 --- a/Source/Android/app/src/main/AndroidManifest.xml +++ b/Source/Android/app/src/main/AndroidManifest.xml @@ -127,6 +127,11 @@ android:label="@string/user_data_submenu" android:theme="@style/DolphinSettingsBase" /> + + diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java index 123cd6c066..974832878e 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java @@ -379,12 +379,13 @@ public final class NativeLibrary /** * Begins emulation. */ - public static native void Run(String[] path); + public static native void Run(String[] path, boolean riivolution); /** * Begins emulation from the specified savestate. */ - public static native void Run(String[] path, String savestatePath, boolean deleteSavestate); + public static native void Run(String[] path, boolean riivolution, String savestatePath, + boolean deleteSavestate); public static native void ChangeDisc(String path); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/AppLinkActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/AppLinkActivity.java index 47b9a17842..b36acfe292 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/AppLinkActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/AppLinkActivity.java @@ -140,6 +140,6 @@ public class AppLinkActivity extends FragmentActivity mAfterDirectoryInitializationRunner.cancel(); mAfterDirectoryInitializationRunner = null; } - EmulationActivity.launch(this, GameFileCacheService.findSecondDiscAndGetPaths(game)); + EmulationActivity.launch(this, GameFileCacheService.findSecondDiscAndGetPaths(game), false); } } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java index 9eeab5adcb..644fca916f 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java @@ -79,11 +79,13 @@ public final class EmulationActivity extends AppCompatActivity private boolean activityRecreated; private String[] mPaths; + private boolean mRiivolution; private boolean mIgnoreWarnings; private static boolean sUserPausedEmulation; private boolean mMenuToastShown; public static final String EXTRA_SELECTED_GAMES = "SelectedGames"; + public static final String EXTRA_RIIVOLUTION = "Riivolution"; public static final String EXTRA_IGNORE_WARNINGS = "IgnoreWarnings"; public static final String EXTRA_USER_PAUSED_EMULATION = "sUserPausedEmulation"; public static final String EXTRA_MENU_TOAST_SHOWN = "MenuToastShown"; @@ -164,12 +166,12 @@ public final class EmulationActivity extends AppCompatActivity EmulationActivity.MENU_ACTION_MOTION_CONTROLS); } - public static void launch(FragmentActivity activity, String filePath) + public static void launch(FragmentActivity activity, String filePath, boolean riivolution) { - launch(activity, new String[]{filePath}); + launch(activity, new String[]{filePath}, riivolution); } - public static void launch(FragmentActivity activity, String[] filePaths) + public static void launch(FragmentActivity activity, String[] filePaths, boolean riivolution) { if (sIgnoreLaunchRequests) return; @@ -183,7 +185,7 @@ public final class EmulationActivity extends AppCompatActivity FileBrowserHelper.isPathEmptyOrValid(StringSetting.MAIN_RESOURCEPACK_PATH) && FileBrowserHelper.isPathEmptyOrValid(StringSetting.MAIN_SD_PATH)) { - launchWithoutChecks(activity, filePaths); + launchWithoutChecks(activity, filePaths, riivolution); } else { @@ -192,18 +194,20 @@ public final class EmulationActivity extends AppCompatActivity builder.setPositiveButton(R.string.yes, (dialogInterface, i) -> SettingsActivity.launch(activity, MenuTag.CONFIG_PATHS)); builder.setNeutralButton(R.string.continue_anyway, (dialogInterface, i) -> - launchWithoutChecks(activity, filePaths)); + launchWithoutChecks(activity, filePaths, riivolution)); builder.show(); } }); } - private static void launchWithoutChecks(FragmentActivity activity, String[] filePaths) + private static void launchWithoutChecks(FragmentActivity activity, String[] filePaths, + boolean riivolution) { sIgnoreLaunchRequests = true; Intent launcher = new Intent(activity, EmulationActivity.class); launcher.putExtra(EXTRA_SELECTED_GAMES, filePaths); + launcher.putExtra(EXTRA_RIIVOLUTION, riivolution); activity.startActivity(launcher); } @@ -251,6 +255,7 @@ public final class EmulationActivity extends AppCompatActivity // Get params we were passed Intent gameToEmulate = getIntent(); mPaths = gameToEmulate.getStringArrayExtra(EXTRA_SELECTED_GAMES); + mRiivolution = gameToEmulate.getBooleanExtra(EXTRA_RIIVOLUTION, false); mIgnoreWarnings = gameToEmulate.getBooleanExtra(EXTRA_IGNORE_WARNINGS, false); sUserPausedEmulation = gameToEmulate.getBooleanExtra(EXTRA_USER_PAUSED_EMULATION, false); mMenuToastShown = false; @@ -283,7 +288,7 @@ public final class EmulationActivity extends AppCompatActivity .findFragmentById(R.id.frame_emulation_fragment); if (mEmulationFragment == null) { - mEmulationFragment = EmulationFragment.newInstance(mPaths); + mEmulationFragment = EmulationFragment.newInstance(mPaths, mRiivolution); getSupportFragmentManager().beginTransaction() .add(R.id.frame_emulation_fragment, mEmulationFragment) .commit(); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.java index 560c17f4fc..15210eea2f 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.java @@ -141,7 +141,7 @@ public final class GameAdapter extends RecyclerView.Adapter impl GameViewHolder holder = (GameViewHolder) view.getTag(); String[] paths = GameFileCacheService.findSecondDiscAndGetPaths(holder.gameFile); - EmulationActivity.launch((FragmentActivity) view.getContext(), paths); + EmulationActivity.launch((FragmentActivity) view.getContext(), paths, false); } /** diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GamePropertiesDialog.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GamePropertiesDialog.java index e0340139f2..0bdccda214 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GamePropertiesDialog.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GamePropertiesDialog.java @@ -15,6 +15,7 @@ import org.dolphinemu.dolphinemu.DolphinApplication; import org.dolphinemu.dolphinemu.R; import org.dolphinemu.dolphinemu.activities.ConvertActivity; import org.dolphinemu.dolphinemu.features.cheats.ui.CheatsActivity; +import org.dolphinemu.dolphinemu.features.riivolution.ui.RiivolutionBootActivity; import org.dolphinemu.dolphinemu.features.settings.model.Settings; import org.dolphinemu.dolphinemu.features.settings.model.StringSetting; import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag; @@ -34,6 +35,7 @@ public class GamePropertiesDialog extends DialogFragment private static final String ARG_GAME_ID = "game_id"; private static final String ARG_GAMETDB_ID = "gametdb_id"; public static final String ARG_REVISION = "revision"; + public static final String ARG_DISC_NUMBER = "disc_number"; private static final String ARG_PLATFORM = "platform"; private static final String ARG_SHOULD_ALLOW_CONVERSION = "should_allow_conversion"; @@ -46,6 +48,7 @@ public class GamePropertiesDialog extends DialogFragment arguments.putString(ARG_GAME_ID, gameFile.getGameId()); arguments.putString(ARG_GAMETDB_ID, gameFile.getGameTdbId()); arguments.putInt(ARG_REVISION, gameFile.getRevision()); + arguments.putInt(ARG_DISC_NUMBER, gameFile.getDiscNumber()); arguments.putInt(ARG_PLATFORM, gameFile.getPlatform()); arguments.putBoolean(ARG_SHOULD_ALLOW_CONVERSION, gameFile.shouldAllowConversion()); fragment.setArguments(arguments); @@ -61,6 +64,7 @@ public class GamePropertiesDialog extends DialogFragment final String gameId = requireArguments().getString(ARG_GAME_ID); final String gameTdbId = requireArguments().getString(ARG_GAMETDB_ID); final int revision = requireArguments().getInt(ARG_REVISION); + final int discNumber = requireArguments().getInt(ARG_DISC_NUMBER); final int platform = requireArguments().getInt(ARG_PLATFORM); final boolean shouldAllowConversion = requireArguments().getBoolean(ARG_SHOULD_ALLOW_CONVERSION); @@ -75,14 +79,11 @@ public class GamePropertiesDialog extends DialogFragment GameDetailsDialog.newInstance(path).show(requireActivity() .getSupportFragmentManager(), "game_details")); - if (shouldAllowConversion) - { - itemsBuilder.add(R.string.properties_convert, (dialog, i) -> - ConvertActivity.launch(getContext(), path)); - } - if (isDisc) { + itemsBuilder.add(R.string.properties_start_with_riivolution, (dialog, i) -> + RiivolutionBootActivity.launch(getContext(), path, gameId, revision, discNumber)); + itemsBuilder.add(R.string.properties_set_default_iso, (dialog, i) -> { try (Settings settings = new Settings()) @@ -94,6 +95,12 @@ public class GamePropertiesDialog extends DialogFragment }); } + if (shouldAllowConversion) + { + itemsBuilder.add(R.string.properties_convert, (dialog, i) -> + ConvertActivity.launch(getContext(), path)); + } + itemsBuilder.add(R.string.properties_edit_game_settings, (dialog, i) -> SettingsActivity.launch(getContext(), MenuTag.SETTINGS, gameId, revision, isWii)); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/riivolution/ui/RiivolutionBootActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/riivolution/ui/RiivolutionBootActivity.java new file mode 100644 index 0000000000..1b6e55df98 --- /dev/null +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/riivolution/ui/RiivolutionBootActivity.java @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +package org.dolphinemu.dolphinemu.features.riivolution.ui; + +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.widget.Button; + +import androidx.appcompat.app.AppCompatActivity; + +import org.dolphinemu.dolphinemu.R; +import org.dolphinemu.dolphinemu.activities.EmulationActivity; + +public class RiivolutionBootActivity extends AppCompatActivity +{ + private static final String ARG_GAME_PATH = "game_path"; + private static final String ARG_GAME_ID = "game_id"; + private static final String ARG_REVISION = "revision"; + private static final String ARG_DISC_NUMBER = "disc_number"; + + public static void launch(Context context, String gamePath, String gameId, int revision, + int discNumber) + { + Intent launcher = new Intent(context, RiivolutionBootActivity.class); + launcher.putExtra(ARG_GAME_PATH, gamePath); + launcher.putExtra(ARG_GAME_ID, gameId); + launcher.putExtra(ARG_REVISION, revision); + launcher.putExtra(ARG_DISC_NUMBER, discNumber); + context.startActivity(launcher); + } + + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + + setContentView(R.layout.activity_riivolution_boot); + + Intent intent = getIntent(); + + String path = getIntent().getStringExtra(ARG_GAME_PATH); + String gameId = intent.getStringExtra(ARG_GAME_ID); + int revision = intent.getIntExtra(ARG_REVISION, -1); + int discNumber = intent.getIntExtra(ARG_DISC_NUMBER, -1); + + Button buttonStart = findViewById(R.id.button_start); + buttonStart.setOnClickListener((v) -> EmulationActivity.launch(this, path, true)); + } +} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java index 4e9e864137..463b6ff9de 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java @@ -29,19 +29,22 @@ import java.io.File; public final class EmulationFragment extends Fragment implements SurfaceHolder.Callback { private static final String KEY_GAMEPATHS = "gamepaths"; + private static final String KEY_RIIVOLUTION = "riivolution"; private InputOverlay mInputOverlay; private String[] mGamePaths; + private boolean mRiivolution; private boolean mRunWhenSurfaceIsValid; private boolean mLoadPreviousTemporaryState; private EmulationActivity activity; - public static EmulationFragment newInstance(String[] gamePaths) + public static EmulationFragment newInstance(String[] gamePaths, boolean riivolution) { Bundle args = new Bundle(); args.putStringArray(KEY_GAMEPATHS, gamePaths); + args.putBoolean(KEY_RIIVOLUTION, riivolution); EmulationFragment fragment = new EmulationFragment(); fragment.setArguments(args); @@ -76,6 +79,7 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C setRetainInstance(true); mGamePaths = getArguments().getStringArray(KEY_GAMEPATHS); + mRiivolution = getArguments().getBoolean(KEY_RIIVOLUTION); } /** @@ -267,12 +271,12 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C if (mLoadPreviousTemporaryState) { Log.debug("[EmulationFragment] Starting emulation thread from previous state."); - NativeLibrary.Run(mGamePaths, getTemporaryStateFilePath(), true); + NativeLibrary.Run(mGamePaths, mRiivolution, getTemporaryStateFilePath(), true); } else { Log.debug("[EmulationFragment] Starting emulation thread."); - NativeLibrary.Run(mGamePaths); + NativeLibrary.Run(mGamePaths, mRiivolution); } EmulationActivity.stopIgnoringLaunchRequests(); }, "NativeEmulation"); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainActivity.java index f55486d51d..cc17b71aae 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainActivity.java @@ -216,7 +216,7 @@ public final class MainActivity extends AppCompatActivity case MainPresenter.REQUEST_GAME_FILE: FileBrowserHelper.runAfterExtensionCheck(this, uri, FileBrowserHelper.GAME_LIKE_EXTENSIONS, - () -> EmulationActivity.launch(this, result.getData().toString())); + () -> EmulationActivity.launch(this, result.getData().toString(), false)); break; case MainPresenter.REQUEST_WAD_FILE: diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java index 38b8fed094..f8a78c4934 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java @@ -153,7 +153,7 @@ public final class TvMainActivity extends FragmentActivity // Start the emulation activity and send the path of the clicked ISO to it. String[] paths = GameFileCacheService.findSecondDiscAndGetPaths(holder.gameFile); - EmulationActivity.launch(TvMainActivity.this, paths); + EmulationActivity.launch(TvMainActivity.this, paths, false); } }); } @@ -255,7 +255,7 @@ public final class TvMainActivity extends FragmentActivity case MainPresenter.REQUEST_GAME_FILE: FileBrowserHelper.runAfterExtensionCheck(this, uri, FileBrowserHelper.GAME_LIKE_EXTENSIONS, - () -> EmulationActivity.launch(this, result.getData().toString())); + () -> EmulationActivity.launch(this, result.getData().toString(), false)); break; case MainPresenter.REQUEST_WAD_FILE: diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/StartupHandler.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/StartupHandler.java index 547d6934d1..5132e023bb 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/StartupHandler.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/StartupHandler.java @@ -51,7 +51,7 @@ public final class StartupHandler if (start_files != null && start_files.length > 0) { // Start the emulation activity, send the ISO passed in and finish the main activity - EmulationActivity.launch(parent, start_files); + EmulationActivity.launch(parent, start_files, false); parent.finish(); } } diff --git a/Source/Android/app/src/main/res/layout/activity_riivolution_boot.xml b/Source/Android/app/src/main/res/layout/activity_riivolution_boot.xml new file mode 100644 index 0000000000..6ca71f5b1f --- /dev/null +++ b/Source/Android/app/src/main/res/layout/activity_riivolution_boot.xml @@ -0,0 +1,36 @@ + + + + + + + + + +