2021-08-19 21:25:10 +02:00
|
|
|
import yaml
|
2021-08-20 06:43:59 +02:00
|
|
|
from typing import Set
|
2021-08-19 21:25:10 +02:00
|
|
|
|
|
|
|
from bemani.backend.iidx import IIDXFactory
|
|
|
|
from bemani.backend.popn import PopnMusicFactory
|
|
|
|
from bemani.backend.jubeat import JubeatFactory
|
|
|
|
from bemani.backend.bishi import BishiBashiFactory
|
|
|
|
from bemani.backend.ddr import DDRFactory
|
|
|
|
from bemani.backend.sdvx import SoundVoltexFactory
|
|
|
|
from bemani.backend.reflec import ReflecBeatFactory
|
|
|
|
from bemani.backend.museca import MusecaFactory
|
2021-09-04 17:17:22 +02:00
|
|
|
from bemani.backend.mga import MetalGearArcadeFactory
|
2021-08-19 21:25:10 +02:00
|
|
|
from bemani.common import GameConstants
|
2021-08-20 06:43:59 +02:00
|
|
|
from bemani.data import Config, Data
|
2021-08-19 21:25:10 +02:00
|
|
|
|
|
|
|
|
2021-08-20 06:43:59 +02:00
|
|
|
def load_config(filename: str, config: Config) -> None:
|
2021-08-19 21:25:10 +02:00
|
|
|
config.update(yaml.safe_load(open(filename)))
|
|
|
|
config['database']['engine'] = Data.create_engine(config)
|
2021-08-20 06:43:59 +02:00
|
|
|
config['filename'] = filename
|
2021-08-19 21:25:10 +02:00
|
|
|
|
|
|
|
supported_series: Set[GameConstants] = set()
|
|
|
|
for series in GameConstants:
|
|
|
|
if config.get('support', {}).get(series.value, False):
|
|
|
|
supported_series.add(series)
|
|
|
|
config['support'] = supported_series
|
|
|
|
|
|
|
|
|
2021-08-20 06:43:59 +02:00
|
|
|
def register_games(config: Config) -> None:
|
|
|
|
if GameConstants.POPN_MUSIC in config.support:
|
2021-08-19 21:25:10 +02:00
|
|
|
PopnMusicFactory.register_all()
|
2021-08-20 06:43:59 +02:00
|
|
|
if GameConstants.JUBEAT in config.support:
|
2021-08-19 21:25:10 +02:00
|
|
|
JubeatFactory.register_all()
|
2021-08-20 06:43:59 +02:00
|
|
|
if GameConstants.IIDX in config.support:
|
2021-08-19 21:25:10 +02:00
|
|
|
IIDXFactory.register_all()
|
2021-08-20 06:43:59 +02:00
|
|
|
if GameConstants.BISHI_BASHI in config.support:
|
2021-08-19 21:25:10 +02:00
|
|
|
BishiBashiFactory.register_all()
|
2021-08-20 06:43:59 +02:00
|
|
|
if GameConstants.DDR in config.support:
|
2021-08-19 21:25:10 +02:00
|
|
|
DDRFactory.register_all()
|
2021-08-20 06:43:59 +02:00
|
|
|
if GameConstants.SDVX in config.support:
|
2021-08-19 21:25:10 +02:00
|
|
|
SoundVoltexFactory.register_all()
|
2021-08-20 06:43:59 +02:00
|
|
|
if GameConstants.REFLEC_BEAT in config.support:
|
2021-08-19 21:25:10 +02:00
|
|
|
ReflecBeatFactory.register_all()
|
2021-08-20 06:43:59 +02:00
|
|
|
if GameConstants.MUSECA in config.support:
|
2021-08-19 21:25:10 +02:00
|
|
|
MusecaFactory.register_all()
|
2021-09-04 17:17:22 +02:00
|
|
|
if GameConstants.MGA in config.support:
|
|
|
|
MetalGearArcadeFactory.register_all()
|