diff options
| author | JosJuice <josjuice@gmail.com> | 2021-10-31 23:44:54 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-31 23:44:54 +0100 |
| commit | 96a6d6fd9566bfa18231b31de2830f46f858926d (patch) | |
| tree | 086f268ce09e014aa1a0a5d4b790cffb938c8084 /Source/Android/jni/MainAndroid.cpp | |
| parent | fb8b9f3251a9880a878cbe0580bc081ca12bd9a8 (diff) | |
| parent | 8b0624f53e7c2636ffb71155128a0c5a13ac0ccd (diff) | |
Merge pull request #10184 from JosJuice/android-riivolution
Android: Allow starting game with Riivolution patches from the GUI
Diffstat (limited to 'Source/Android/jni/MainAndroid.cpp')
| -rw-r--r-- | Source/Android/jni/MainAndroid.cpp | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/Source/Android/jni/MainAndroid.cpp b/Source/Android/jni/MainAndroid.cpp index 14197d79d2..c08106ee4f 100644 --- a/Source/Android/jni/MainAndroid.cpp +++ b/Source/Android/jni/MainAndroid.cpp @@ -48,6 +48,7 @@ #include "DiscIO/Blob.h" #include "DiscIO/Enums.h" +#include "DiscIO/RiivolutionParser.h" #include "DiscIO/ScrubbedBlob.h" #include "DiscIO/Volume.h" @@ -547,7 +548,7 @@ static float GetRenderSurfaceScale(JNIEnv* env) return env->CallStaticFloatMethod(native_library_class, get_render_surface_scale_method); } -static void Run(JNIEnv* env, const std::vector<std::string>& paths, +static void Run(JNIEnv* env, const std::vector<std::string>& paths, bool riivolution, const std::optional<std::string>& savestate_path = {}, bool delete_savestate = false) { @@ -564,6 +565,16 @@ static void Run(JNIEnv* env, const std::vector<std::string>& paths, if (boot) boot->delete_savestate = delete_savestate; + if (riivolution && std::holds_alternative<BootParameters::Disc>(boot->parameters)) + { + const std::string& riivolution_dir = File::GetUserPath(D_RIIVOLUTION_IDX); + const DiscIO::Volume& volume = *std::get<BootParameters::Disc>(boot->parameters).volume; + + AddRiivolutionPatches(boot.get(), DiscIO::Riivolution::GenerateRiivolutionPatchesFromConfig( + riivolution_dir, volume.GetGameID(), volume.GetRevision(), + volume.GetDiscNumber())); + } + WindowSystemInfo wsi(WindowSystemType::Android, nullptr, s_surf, s_surf); wsi.render_surface_scale = GetRenderSurfaceScale(env); @@ -616,17 +627,19 @@ static void Run(JNIEnv* env, const std::vector<std::string>& paths, IDCache::GetFinishEmulationActivity()); } -JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run___3Ljava_lang_String_2( - JNIEnv* env, jclass, jobjectArray jPaths) +JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run___3Ljava_lang_String_2Z( + JNIEnv* env, jclass, jobjectArray jPaths, jboolean jRiivolution) { - Run(env, JStringArrayToVector(env, jPaths)); + Run(env, JStringArrayToVector(env, jPaths), jRiivolution); } JNIEXPORT void JNICALL -Java_org_dolphinemu_dolphinemu_NativeLibrary_Run___3Ljava_lang_String_2Ljava_lang_String_2Z( - JNIEnv* env, jclass, jobjectArray jPaths, jstring jSavestate, jboolean jDeleteSavestate) +Java_org_dolphinemu_dolphinemu_NativeLibrary_Run___3Ljava_lang_String_2ZLjava_lang_String_2Z( + JNIEnv* env, jclass, jobjectArray jPaths, jboolean jRiivolution, jstring jSavestate, + jboolean jDeleteSavestate) { - Run(env, JStringArrayToVector(env, jPaths), GetJString(env, jSavestate), jDeleteSavestate); + Run(env, JStringArrayToVector(env, jPaths), jRiivolution, GetJString(env, jSavestate), + jDeleteSavestate); } JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ChangeDisc(JNIEnv* env, jclass, |
