Android: Convert Cheat to Kotlin

This commit is contained in:
Charles Lombardo 2023-03-01 13:35:43 -05:00
parent fbc617c917
commit 1b61f2c223
2 changed files with 42 additions and 53 deletions

View File

@ -1,53 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-or-later
package org.dolphinemu.dolphinemu.features.cheats.model;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
public interface Cheat
{
int TRY_SET_FAIL_CODE_MIXED_ENCRYPTION = -3;
int TRY_SET_FAIL_NO_CODE_LINES = -2;
int TRY_SET_FAIL_NO_NAME = -1;
int TRY_SET_SUCCESS = 0;
// Result codes greater than 0 represent an error on the corresponding code line (one-indexed)
boolean supportsCreator();
boolean supportsNotes();
boolean supportsCode();
@NonNull
String getName();
@NonNull
default String getCreator()
{
return "";
}
@NonNull
default String getNotes()
{
return "";
}
@NonNull
default String getCode()
{
return "";
}
int trySet(@NonNull String name, @NonNull String creator, @NonNull String notes,
@NonNull String code);
boolean getUserDefined();
boolean getEnabled();
void setEnabled(boolean enabled);
void setChangedCallback(@Nullable Runnable callback);
}

View File

@ -0,0 +1,42 @@
// SPDX-License-Identifier: GPL-2.0-or-later
package org.dolphinemu.dolphinemu.features.cheats.model
interface Cheat {
fun supportsCreator(): Boolean
fun supportsNotes(): Boolean
fun supportsCode(): Boolean
fun getName(): String = ""
fun getCreator(): String = ""
fun getNotes(): String = ""
fun getCode(): String = ""
fun setCheat(
name: String,
creator: String,
notes: String,
code: String
): Int
fun getUserDefined(): Boolean
fun getEnabled(): Boolean
fun setEnabled(isChecked: Boolean)
fun setChangedCallback(callback: Runnable?)
companion object {
// Result codes greater than 0 represent an error on the corresponding code line (one-indexed)
const val TRY_SET_FAIL_CODE_MIXED_ENCRYPTION = -3
const val TRY_SET_FAIL_NO_CODE_LINES = -2
const val TRY_SET_FAIL_NO_NAME = -1
const val TRY_SET_SUCCESS = 0
}
}