-
-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Import previous melonds saves when found.
- Loading branch information
1 parent
1013a76
commit 28a1f11
Showing
5 changed files
with
68 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...p-shared/src/main/java/com/swordfish/lemuroid/lib/saves/migrators/MelonDsSavesMigrator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.swordfish.lemuroid.lib.saves.migrators | ||
|
||
import com.swordfish.lemuroid.lib.library.db.entity.Game | ||
import com.swordfish.lemuroid.lib.storage.DirectoriesManager | ||
import java.io.File | ||
|
||
object MelonDsSavesMigrator : SavesMigrator { | ||
override fun loadPreviousSaveForGame( | ||
game: Game, | ||
directoriesManager: DirectoriesManager, | ||
): ByteArray? { | ||
val savesDirectory = directoriesManager.getSavesDirectory() | ||
val previousSaveFileName = "${game.fileName.substringBeforeLast(".")}.sav" | ||
val previousSaveFile = File(savesDirectory, previousSaveFileName) | ||
|
||
return if (previousSaveFile.exists() && previousSaveFile.length() > 0) { | ||
previousSaveFile.readBytes() | ||
} else { | ||
null | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...rade-app-shared/src/main/java/com/swordfish/lemuroid/lib/saves/migrators/SavesMigrator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.swordfish.lemuroid.lib.saves.migrators | ||
|
||
import com.swordfish.lemuroid.lib.library.CoreID | ||
import com.swordfish.lemuroid.lib.library.SystemCoreConfig | ||
import com.swordfish.lemuroid.lib.library.db.entity.Game | ||
import com.swordfish.lemuroid.lib.storage.DirectoriesManager | ||
|
||
interface SavesMigrator { | ||
fun loadPreviousSaveForGame( | ||
game: Game, | ||
directoriesManager: DirectoriesManager, | ||
): ByteArray? | ||
} | ||
|
||
fun SystemCoreConfig.getSavesMigrator(): SavesMigrator? { | ||
return when (this.coreID) { | ||
CoreID.MELONDS -> MelonDsSavesMigrator | ||
else -> null | ||
} | ||
} |
https://melonds.kuribo64.net/board/thread.php?id=1633
This 'blow' option did not work on some games. I tried 'noise' and it worked for my current game.