fix: allow midi for bms7k and bms14k

This commit is contained in:
zkldi
2023-07-21 00:33:23 +01:00
parent 264ae927a6
commit cc19d2ee8c
4 changed files with 14 additions and 6 deletions
+2 -2
View File
@@ -338,7 +338,7 @@ export const BMS_7K_CONF = {
scoreMeta: z.strictObject({
random: RANDOM_SCHEMA.optional().nullable(),
inputDevice: z.enum(["BM_CONTROLLER", "KEYBOARD"]).optional().nullable(),
inputDevice: z.enum(["BM_CONTROLLER", "KEYBOARD", "MIDI"]).optional().nullable(),
client: z.enum(["lr2oraja", "LR2"]).optional().nullable(),
gauge: z.enum(["EASY", "NORMAL", "HARD", "EX-HARD"]).optional().nullable(),
}),
@@ -356,7 +356,7 @@ export const BMS_14K_CONF = {
scoreMeta: z.strictObject({
random: z.tuple([RANDOM_SCHEMA, RANDOM_SCHEMA]).optional().nullable(),
inputDevice: z.enum(["BM_CONTROLLER", "KEYBOARD"]).optional().nullable(),
inputDevice: z.enum(["BM_CONTROLLER", "KEYBOARD", "MIDI"]).optional().nullable(),
client: z.enum(["lr2oraja", "LR2"]).optional().nullable(),
gauge: z.enum(["EASY", "NORMAL", "HARD", "EX-HARD"]).optional().nullable(),
}),
@@ -15,7 +15,7 @@ import type { DryScore } from "../../../framework/common/types";
import type { ConverterFunction } from "../../common/types";
import type { BeatorajaChart, BeatorajaContext, BeatorajaScore } from "./types";
import type { KtLogger } from "lib/logger/logger";
import type { ChartDocument, SongDocument, Playtypes } from "tachi-common";
import type { ChartDocument, SongDocument, Playtypes, Playtype } from "tachi-common";
import type { Mutable } from "utils/types";
const LAMP_LOOKUP = {
@@ -164,8 +164,16 @@ export const ConverterIRBeatoraja: ConverterFunction<BeatorajaScore, BeatorajaCo
"bms:7K" | "bms:14K"
> | null;
} else {
let playtype: Playtypes["pms"];
// It's still called BM_CONTROLLER even though its popn!
const playtype = data.deviceType === "BM_CONTROLLER" ? "Controller" : "Keyboard";
if (data.deviceType === "BM_CONTROLLER") {
playtype = "Controller";
} else if (data.deviceType === "KEYBOARD") {
playtype = "Keyboard";
} else {
throw new InvalidScoreFailure("MIDI is not allowed for PMS scores.");
}
chart = (await FindChartOnSHA256Playtype(game, data.sha256, playtype)) as ChartDocument<
"pms:Controller" | "pms:Keyboard"
@@ -13,7 +13,7 @@ const PR_BEATORAJA_SCORE = {
exscore: p.isPositiveInteger,
passnotes: p.isPositiveInteger,
gauge: p.or(p.isBetween(0, 100), p.is(-1)),
deviceType: p.isIn("BM_CONTROLLER", "KEYBOARD"),
deviceType: p.isIn("BM_CONTROLLER", "KEYBOARD", "MIDI"),
minbp: p.or(p.isPositiveInteger, p.is(-1)),
option: p.isInteger,
@@ -32,7 +32,7 @@ export interface BeatorajaScore {
exscore: integer;
passnotes: integer;
gauge: number;
deviceType: "BM_CONTROLLER" | "KEYBOARD";
deviceType: "BM_CONTROLLER" | "KEYBOARD" | "MIDI";
minbp: integer;
option: integer;