Very basic nextage support (for now).

This commit is contained in:
DitFranXX 2021-04-26 02:51:22 +09:00
parent 5797c2ca97
commit 770ac0c66b
4 changed files with 65 additions and 2 deletions

View File

@ -1,5 +1,7 @@
mdb_ex.xml
mdb_mt.xml
mdb_nt.xml
mdb_ex.b64
mdb_mt.b64
mdb.nt.b64
custom_mdb.xml

View File

@ -0,0 +1,58 @@
import { CommonMusicData, readJSONOrXML, readXML } from './helper';
export async function processData() {
const { music } = await readJSONOrXML('data/mdb_nt.json', 'data/mdb_nt.xml', processRawData)
return {
music,
};
}
export async function processRawData(path: string): Promise<CommonMusicData> {
const data = await readXML(path)
const mdb = $(data).elements("mdb.mdb_data");
const music: any[] = [];
for (const m of mdb) {
const d = m.numbers("xg_diff_list");
const contain = m.numbers("contain_stat");
const gf = contain[0];
const dm = contain[1];
if (gf == 0 && dm == 0) {
continue;
}
let type = gf;
if (gf == 0) {
type = dm;
}
music.push({
id: K.ITEM('s32', m.number("music_id")),
cont_gf: K.ITEM('bool', gf == 0 ? 0 : 1),
cont_dm: K.ITEM('bool', dm == 0 ? 0 : 1),
is_secret: K.ITEM('bool', 0),
is_hot: K.ITEM('bool', type == 2 ? 0 : 1),
data_ver: K.ITEM('s32', m.number("data_ver")),
diff: K.ARRAY('u16', [
d[0],
d[1],
d[2],
d[3],
d[4],
d[10],
d[11],
d[12],
d[13],
d[14],
d[5],
d[6],
d[7],
d[8],
d[9],
]),
});
}
return {
music,
};
}

View File

@ -1,6 +1,7 @@
import { getVersion } from "../utils";
import { processData as ExchainMusic } from "../data/Exchain"
import { processData as MatixxMusic } from "../data/Matixx"
import { processData as NextageMusic } from "../data/Nextage"
import { CommonMusicDataField, readJSONOrXML, readXML } from "../data/helper";
export const playableMusic: EPR = async (info, data, send) => {
@ -60,7 +61,9 @@ export const playableMusic: EPR = async (info, data, send) => {
}
if (music.length == 0) {
if (version == 'exchain') {
if (version == 'nextage') {
music = _.get(await NextageMusic(), 'music', []);
} else if (version == 'exchain') {
music = _.get(await ExchainMusic(), 'music', []);
} else {
music = _.get(await MatixxMusic(), 'music', []);

View File

@ -30,7 +30,7 @@ export function register() {
// Helper for register multiple versions.
R.Route(`exchain_${method}`, handler);
R.Route(`matixx_${method}`, handler);
// TODO: NEXTAGE
R.Route(`nextage_${method}`, handler)
// TODO: TB, TBRE and more older version?
};