diff --git a/android/app/src/main/java/io/github/kichikuou/system3/Launcher.kt b/android/app/src/main/java/io/github/kichikuou/system3/Launcher.kt index 13ca138..27caab6 100644 --- a/android/app/src/main/java/io/github/kichikuou/system3/Launcher.kt +++ b/android/app/src/main/java/io/github/kichikuou/system3/Launcher.kt @@ -216,7 +216,7 @@ class Launcher private constructor(private val rootDir: File) { // A helper class which generates playlist.txt in the game root directory. private class GameConfigWriter { private var hasAdisk = false - private val audioRegex = """.*?(\d+)\.(wav|mp3|ogg)""".toRegex(RegexOption.IGNORE_CASE) + private val audioRegex = """((\d+).*|.*?(\d+))\.(wav|mp3|ogg)""".toRegex(RegexOption.IGNORE_CASE) private val audioFiles: Array = arrayOfNulls(100) fun maybeAdd(path: String) { @@ -226,7 +226,7 @@ class Launcher private constructor(private val rootDir: File) { hasAdisk = true } audioRegex.matchEntire(name)?.let { - val track = it.groupValues[1].toInt() + val track = it.groupValues[2].toIntOrNull() ?: it.groupValues[3].toInt() if (0 < track && track <= audioFiles.size) audioFiles[track - 1] = path }