Android: Convert GraphicsMod to Kotlin
This commit is contained in:
parent
5f6995fe6c
commit
9e090c6bab
|
@ -1,61 +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;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
public class GraphicsMod extends ReadOnlyCheat
|
||||
{
|
||||
@Keep
|
||||
private final long mPointer;
|
||||
|
||||
// When a C++ GraphicsModGroup object is destroyed, it also destroys the GraphicsMods it owns.
|
||||
// To avoid getting dangling pointers, we keep a reference to the GraphicsModGroup here.
|
||||
@Keep
|
||||
private final GraphicsModGroup mParent;
|
||||
|
||||
@Keep
|
||||
private GraphicsMod(long pointer, GraphicsModGroup parent)
|
||||
{
|
||||
mPointer = pointer;
|
||||
mParent = parent;
|
||||
}
|
||||
|
||||
public boolean supportsCreator()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean supportsNotes()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean supportsCode()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public native String getName();
|
||||
|
||||
@NonNull
|
||||
public native String getCreator();
|
||||
|
||||
@NonNull
|
||||
public native String getNotes();
|
||||
|
||||
public boolean getUserDefined()
|
||||
{
|
||||
// Technically graphics mods can be user defined, but we don't support editing graphics mods
|
||||
// in the GUI, and editability is what this really controls
|
||||
return false;
|
||||
}
|
||||
|
||||
public native boolean getEnabled();
|
||||
|
||||
@Override
|
||||
protected native void setEnabledImpl(boolean enabled);
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
package org.dolphinemu.dolphinemu.features.cheats.model
|
||||
|
||||
import androidx.annotation.Keep
|
||||
|
||||
class GraphicsMod @Keep private constructor(
|
||||
@Keep private val pointer: Long,
|
||||
// When a C++ GraphicsModGroup object is destroyed, it also destroys the GraphicsMods it owns.
|
||||
// To avoid getting dangling pointers, we keep a reference to the GraphicsModGroup here.
|
||||
@Keep private val parent: GraphicsModGroup
|
||||
) : ReadOnlyCheat() {
|
||||
override fun supportsCreator(): Boolean = true
|
||||
|
||||
override fun supportsNotes(): Boolean = true
|
||||
|
||||
override fun supportsCode(): Boolean = false
|
||||
|
||||
external override fun getName(): String
|
||||
|
||||
external override fun getCreator(): String
|
||||
|
||||
external override fun getNotes(): String
|
||||
|
||||
// Technically graphics mods can be user defined, but we don't support editing graphics mods
|
||||
// in the GUI, and editability is what this really controls
|
||||
override fun getUserDefined(): Boolean = false
|
||||
|
||||
external override fun getEnabled(): Boolean
|
||||
|
||||
external override fun setEnabledImpl(enabled: Boolean)
|
||||
}
|
|
@ -529,7 +529,7 @@ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved)
|
|||
const jclass graphics_mod_class =
|
||||
env->FindClass("org/dolphinemu/dolphinemu/features/cheats/model/GraphicsMod");
|
||||
s_graphics_mod_class = reinterpret_cast<jclass>(env->NewGlobalRef(graphics_mod_class));
|
||||
s_graphics_mod_pointer = env->GetFieldID(graphics_mod_class, "mPointer", "J");
|
||||
s_graphics_mod_pointer = env->GetFieldID(graphics_mod_class, "pointer", "J");
|
||||
s_graphics_mod_constructor =
|
||||
env->GetMethodID(graphics_mod_class, "<init>",
|
||||
"(JLorg/dolphinemu/dolphinemu/features/cheats/model/GraphicsModGroup;)V");
|
||||
|
|
Loading…
Reference in New Issue