diff options
| author | JosJuice <josjuice@gmail.com> | 2021-10-24 16:29:38 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2021-10-30 23:24:36 +0200 |
| commit | 34021b5ebc8d13478058e63b3d67cc1fccb9de29 (patch) | |
| tree | 4d6cae156e027f78b30b50895dc982ebdca21562 /Source/Android/jni/MainAndroid.cpp | |
| parent | 05b4aecf18cac8b49ee7ef7314d2fac97ec82363 (diff) | |
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, |
