summaryrefslogtreecommitdiffstats
path: root/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/Game.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/android/app/src/main/java/org/yuzu/yuzu_emu/model/Game.kt')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/model/Game.kt43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/Game.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/Game.kt
index 2fa3ab31b..f1ea1e20f 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/Game.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/Game.kt
@@ -3,10 +3,18 @@
package org.yuzu.yuzu_emu.model
+import android.net.Uri
import android.os.Parcelable
import java.util.HashSet
import kotlinx.parcelize.Parcelize
import kotlinx.serialization.Serializable
+import org.yuzu.yuzu_emu.NativeLibrary
+import org.yuzu.yuzu_emu.R
+import org.yuzu.yuzu_emu.YuzuApplication
+import org.yuzu.yuzu_emu.utils.DirectoryInitialization
+import org.yuzu.yuzu_emu.utils.FileUtil
+import java.time.LocalDateTime
+import java.time.format.DateTimeFormatter
@Parcelize
@Serializable
@@ -15,12 +23,44 @@ class Game(
val path: String,
val programId: String = "",
val developer: String = "",
- val version: String = "",
+ var version: String = "",
val isHomebrew: Boolean = false
) : Parcelable {
val keyAddedToLibraryTime get() = "${path}_AddedToLibraryTime"
val keyLastPlayedTime get() = "${path}_LastPlayed"
+ val settingsName: String
+ get() {
+ val programIdLong = programId.toLong()
+ return if (programIdLong == 0L) {
+ FileUtil.getFilename(Uri.parse(path))
+ } else {
+ "0" + programIdLong.toString(16).uppercase()
+ }
+ }
+
+ val programIdHex: String
+ get() {
+ val programIdLong = programId.toLong()
+ return if (programIdLong == 0L) {
+ "0"
+ } else {
+ "0" + programIdLong.toString(16).uppercase()
+ }
+ }
+
+ val saveZipName: String
+ get() = "$title ${YuzuApplication.appContext.getString(R.string.save_data).lowercase()} - ${
+ LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))
+ }.zip"
+
+ val saveDir: String
+ get() = DirectoryInitialization.userDirectory + "/nand" +
+ NativeLibrary.getSavePath(programId)
+
+ val addonDir: String
+ get() = DirectoryInitialization.userDirectory + "/load/" + programIdHex + "/"
+
override fun equals(other: Any?): Boolean {
if (other !is Game) {
return false
@@ -34,6 +74,7 @@ class Game(
result = 31 * result + path.hashCode()
result = 31 * result + programId.hashCode()
result = 31 * result + developer.hashCode()
+ result = 31 * result + version.hashCode()
result = 31 * result + isHomebrew.hashCode()
return result
}