Android: Convert Control to Kotlin

This commit is contained in:
Charles Lombardo 2023-06-10 05:05:01 -04:00
parent 0454578f45
commit fafbb2199e
2 changed files with 7 additions and 16 deletions

View File

@ -1,8 +1,8 @@
// SPDX-License-Identifier: GPL-2.0-or-later
package org.dolphinemu.dolphinemu.features.input.model.controlleremu;
package org.dolphinemu.dolphinemu.features.input.model.controlleremu
import androidx.annotation.Keep;
import androidx.annotation.Keep
/**
* Represents a C++ ControllerEmu::Control.
@ -10,18 +10,9 @@ import androidx.annotation.Keep;
* The lifetime of this class is managed by C++ code. Calling methods on it after it's destroyed
* in C++ is undefined behavior!
*/
public class Control
{
@Keep
private final long mPointer;
@Keep
class Control private constructor(private val pointer: Long) {
external fun getUiName(): String
@Keep
private Control(long pointer)
{
mPointer = pointer;
}
public native String getUiName();
public native ControlReference getControlReference();
external fun getControlReference(): ControlReference
}

View File

@ -703,7 +703,7 @@ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved)
const jclass control_class =
env->FindClass("org/dolphinemu/dolphinemu/features/input/model/controlleremu/Control");
s_control_class = reinterpret_cast<jclass>(env->NewGlobalRef(control_class));
s_control_pointer = env->GetFieldID(control_class, "mPointer", "J");
s_control_pointer = env->GetFieldID(control_class, "pointer", "J");
s_control_constructor = env->GetMethodID(control_class, "<init>", "(J)V");
env->DeleteLocalRef(control_class);