diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/model/ARCheat.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/model/ARCheat.java deleted file mode 100644 index 8a168e8bc5..0000000000 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/model/ARCheat.java +++ /dev/null @@ -1,60 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -package org.dolphinemu.dolphinemu.features.cheats.model; - -import androidx.annotation.Keep; -import androidx.annotation.NonNull; - -public class ARCheat extends AbstractCheat -{ - @Keep - private final long mPointer; - - public ARCheat() - { - mPointer = createNew(); - } - - @Keep - private ARCheat(long pointer) - { - mPointer = pointer; - } - - @Override - public native void finalize(); - - private native long createNew(); - - public boolean supportsCreator() - { - return false; - } - - public boolean supportsNotes() - { - return false; - } - - @NonNull - public native String getName(); - - @NonNull - public native String getCode(); - - public native boolean getUserDefined(); - - public native boolean getEnabled(); - - @Override - protected native int trySetImpl(@NonNull String name, @NonNull String creator, - @NonNull String notes, @NonNull String code); - - @Override - protected native void setEnabledImpl(boolean enabled); - - @NonNull - public static native ARCheat[] loadCodes(String gameId, int revision); - - public static native void saveCodes(String gameId, int revision, ARCheat[] codes); -} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/model/ARCheat.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/model/ARCheat.kt new file mode 100644 index 0000000000..7d3013ee32 --- /dev/null +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/model/ARCheat.kt @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +package org.dolphinemu.dolphinemu.features.cheats.model + +import androidx.annotation.Keep + +class ARCheat : AbstractCheat { + @Keep + private val pointer: Long + + constructor() { + pointer = createNew() + } + + @Keep + private constructor(pointer: Long) { + this.pointer = pointer + } + + external fun finalize() + + private external fun createNew(): Long + + override fun supportsCreator(): Boolean = false + + override fun supportsNotes(): Boolean = false + + external override fun getName(): String + + external override fun getCode(): String + + external override fun getUserDefined(): Boolean + + external override fun getEnabled(): Boolean + + external override fun setEnabledImpl(enabled: Boolean) + + external override fun setCheatImpl( + name: String, + creator: String, + notes: String, + code: String + ): Int + + companion object { + @JvmStatic + external fun loadCodes(gameId: String, revision: Int): Array + + @JvmStatic + external fun saveCodes(gameId: String, revision: Int, codes: Array) + } +} diff --git a/Source/Android/jni/AndroidCommon/IDCache.cpp b/Source/Android/jni/AndroidCommon/IDCache.cpp index 31511b485c..da6050f643 100644 --- a/Source/Android/jni/AndroidCommon/IDCache.cpp +++ b/Source/Android/jni/AndroidCommon/IDCache.cpp @@ -500,7 +500,7 @@ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) const jclass ar_cheat_class = env->FindClass("org/dolphinemu/dolphinemu/features/cheats/model/ARCheat"); s_ar_cheat_class = reinterpret_cast(env->NewGlobalRef(ar_cheat_class)); - s_ar_cheat_pointer = env->GetFieldID(ar_cheat_class, "mPointer", "J"); + s_ar_cheat_pointer = env->GetFieldID(ar_cheat_class, "pointer", "J"); s_ar_cheat_constructor = env->GetMethodID(ar_cheat_class, "", "(J)V"); env->DeleteLocalRef(ar_cheat_class); diff --git a/Source/Android/jni/Cheats/ARCheat.cpp b/Source/Android/jni/Cheats/ARCheat.cpp index 3211e35c18..a3af52827a 100644 --- a/Source/Android/jni/Cheats/ARCheat.cpp +++ b/Source/Android/jni/Cheats/ARCheat.cpp @@ -81,7 +81,7 @@ Java_org_dolphinemu_dolphinemu_features_cheats_model_ARCheat_getEnabled(JNIEnv* return static_cast(GetPointer(env, obj)->enabled); } -JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_features_cheats_model_ARCheat_trySetImpl( +JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_features_cheats_model_ARCheat_setCheatImpl( JNIEnv* env, jobject obj, jstring name, jstring creator, jstring notes, jstring code_string) { ActionReplay::ARCode* code = GetPointer(env, obj);