From 98fe38982f9ee702375b417280b721bb3d02acd1 Mon Sep 17 00:00:00 2001 From: James Liu <17558260+JamesLewisLiu@users.noreply.github.com> Date: Wed, 3 Dec 2025 23:04:36 +0800 Subject: [PATCH] Add support for prefixed MDB XML filenames --- gitadora@asphyxia/data/mdb/index.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/gitadora@asphyxia/data/mdb/index.ts b/gitadora@asphyxia/data/mdb/index.ts index 73b6dd8..586e88a 100644 --- a/gitadora@asphyxia/data/mdb/index.ts +++ b/gitadora@asphyxia/data/mdb/index.ts @@ -101,9 +101,18 @@ export function findMDBFile(fileNameWithoutExtension: string, path: string = nul } for (const ext of allowedFormats) { - const filePath = path + fileNameWithoutExtension + ext - if (IO.Exists(filePath)) { - return filePath + const candidateFileNames = ext === ".xml" + ? [ + `mdb_${fileNameWithoutExtension}${ext}`, + `${fileNameWithoutExtension}${ext}`, + ] + : [`${fileNameWithoutExtension}${ext}`] + + for (const fileName of candidateFileNames) { + const filePath = path + fileName + if (IO.Exists(filePath)) { + return filePath + } } } @@ -116,7 +125,7 @@ export async function loadSongsForGameVersion(gameVer: string, processHandler?: let mdbFile = findMDBFile(ver, mdbFolder) if (mdbFile == null) { - throw `No valid MDB files were found in the data/mdb subfolder. Ensure that this folder contains at least one of the following: ${ver}.json, ${ver}.xml or ${ver}.b64` + throw `No valid MDB files were found in the data/mdb subfolder. Ensure that this folder contains at least one of the following: ${ver}.json, mdb_${ver}.xml (${ver}.xml as fallback) or ${ver}.b64` } const music = await readMDBFile(mdbFile, processHandler ?? defaultProcessRawXmlData)