mirror of
https://github.com/kichikuou/system3-sdl2.git
synced 2026-09-22 22:58:12 +03:00
Android: Support audio file names prefixed with track numbers
This commit is contained in:
@@ -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<String?> = 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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user