From 1b61f2c22319ea2899bdd5f3212e30a88045bf0c Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Wed, 1 Mar 2023 13:35:43 -0500 Subject: [PATCH] Android: Convert Cheat to Kotlin --- .../features/cheats/model/Cheat.java | 53 ------------------- .../dolphinemu/features/cheats/model/Cheat.kt | 42 +++++++++++++++ 2 files changed, 42 insertions(+), 53 deletions(-) delete mode 100644 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/model/Cheat.java create mode 100644 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/model/Cheat.kt diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/model/Cheat.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/model/Cheat.java deleted file mode 100644 index 142931b9cb..0000000000 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/model/Cheat.java +++ /dev/null @@ -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); -} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/model/Cheat.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/model/Cheat.kt new file mode 100644 index 0000000000..848acf3ea1 --- /dev/null +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/model/Cheat.kt @@ -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 + } +}