WiiUpdateCallback: Add interface for update callback

This commit is contained in:
OatmealDome 2022-01-09 15:42:26 -05:00
parent e4372a317d
commit 7c86baee50
3 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,11 @@
// SPDX-License-Identifier: GPL-2.0-or-later
package org.dolphinemu.dolphinemu.utils;
import androidx.annotation.Keep;
public interface WiiUpdateCallback
{
@Keep
boolean run(int processed, int total, long titleId);
}

View File

@ -73,6 +73,9 @@ static jmethodID s_patch_cheat_constructor;
static jclass s_riivolution_patches_class;
static jfieldID s_riivolution_patches_pointer;
static jclass s_wii_update_cb_class;
static jmethodID s_wii_update_cb_run;
namespace IDCache
{
JNIEnv* GetEnvForThread()
@ -338,6 +341,16 @@ jfieldID GetRiivolutionPatchesPointer()
return s_riivolution_patches_pointer;
}
jclass GetWiiUpdateCallbackClass()
{
return s_wii_update_cb_class;
}
jmethodID GetWiiUpdateCallbackFunction()
{
return s_wii_update_cb_run;
}
} // namespace IDCache
extern "C" {
@ -474,6 +487,12 @@ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved)
s_riivolution_patches_pointer = env->GetFieldID(riivolution_patches_class, "mPointer", "J");
env->DeleteLocalRef(riivolution_patches_class);
const jclass wii_update_cb_class =
env->FindClass("org/dolphinemu/dolphinemu/utils/WiiUpdateCallback");
s_wii_update_cb_class = reinterpret_cast<jclass>(env->NewGlobalRef(wii_update_cb_class));
s_wii_update_cb_run = env->GetMethodID(s_wii_update_cb_class, "run", "(IIJ)Z");
env->DeleteLocalRef(wii_update_cb_class);
return JNI_VERSION;
}
@ -498,5 +517,6 @@ JNIEXPORT void JNI_OnUnload(JavaVM* vm, void* reserved)
env->DeleteGlobalRef(s_gecko_cheat_class);
env->DeleteGlobalRef(s_patch_cheat_class);
env->DeleteGlobalRef(s_riivolution_patches_class);
env->DeleteGlobalRef(s_wii_update_cb_class);
}
}

View File

@ -72,4 +72,7 @@ jmethodID GetPatchCheatConstructor();
jclass GetRiivolutionPatchesClass();
jfieldID GetRiivolutionPatchesPointer();
jclass GetWiiUpdateCallbackClass();
jmethodID GetWiiUpdateCallbackFunction();
} // namespace IDCache