コード例 #1
0
ファイル: GameHooks.cs プロジェクト: Nopezal/Prism
        public void UpdateMusic(ref BgmEntry e)
        {
            var pe = new Ref <BgmEntry>(e);

            HookManager.Call(updateMusic, pe);
            e = pe.Value;
        }
コード例 #2
0
        public BgmEntry AddOrUpdateBgmEntry(BgmEntry bgmEntry)
        {
            var keyRefs    = GetToneIdKeyReferences(bgmEntry.ToneId, bgmEntry.FileName);
            var bgmEntries = GetBgmEntriesFromStateManager();

            //Create
            if (!bgmEntries.ContainsKey(bgmEntry.ToneId))
            {
                CreateNewBgmEntryInStateManager(keyRefs);
            }

            //Update
            UpdateBgmEntryInStateManager(keyRefs, bgmEntry);

            //Return mapping BgmEntry
            return(GetBgmEntry(bgmEntry.ToneId));
        }
コード例 #3
0
 internal static void Reset()
 {
     Title = FrostMoon = PumpkinMoon
         = MoonLord = MartianMadness = LunarPillar = Plantera = Boss2 = Boss1 = Boss3 = Golem = QueenBee = Pirates = GoblinArmy
         = Underworld = Eclipse = Space = Lihzahrd = Mushrooms = UgCorruption = Corruption = UgCrimson = Crimson = Dungeon = Meteor = Jungle = Snow = Ice
         = UgHallow = UgDesert = Underground = BloodMoon = Rain = Night = Hallow = Ocean = Desert = Day
         = Ambient = null;
 }
コード例 #4
0
        internal static void FillVanilla()
        {
            // do not include ambient background
            MusicBoxes = Enumerable.Range(1, 37).Select(c => new BgmEntry(Bgm.VanillaBgmOf(MusicBoxIdToCueId(c)), BgmPriority.MusicBox, () => Main.musicBox == c)).ToArray();

            Title = new BgmEntry(Bgm.VanillaBgmOf(6), BgmPriority.Title, () => Main.gameMenu);

            FrostMoon   = new BgmEntry(Bgm.VanillaBgmOf(32), BgmPriority.Event, () => Main.snowMoon   );
            PumpkinMoon = new BgmEntry(Bgm.VanillaBgmOf(30), BgmPriority.Event, () => Main.pumpkinMoon);

            MoonLord       = new BgmEntry(Bgm.VanillaBgmOf(38), BgmPriority.Boss, () => Bgm.justScanned ? (Bgm.bossMusicId & BossBgms.MoonLord      ) != 0 : Bgm.AnyNPCsForMusic(MoonLordNPCs      ));
            MartianMadness = new BgmEntry(Bgm.VanillaBgmOf(37), BgmPriority.Boss, () => Bgm.justScanned ? (Bgm.bossMusicId & BossBgms.MartianMadness) != 0 : Bgm.AnyNPCsForMusic(MartianMadnessNPCs));
            LunarPillar    = new BgmEntry(Bgm.VanillaBgmOf(34), BgmPriority.Boss, () => Bgm.justScanned ? (Bgm.bossMusicId & BossBgms.LunarPillar   ) != 0 : Bgm.AnyNPCsForMusic(LunarPillarNPCs   ));
            Plantera       = new BgmEntry(Bgm.VanillaBgmOf(24), BgmPriority.Boss, () => Bgm.justScanned ? (Bgm.bossMusicId & BossBgms.Plantera      ) != 0 : Bgm.AnyNPCsForMusic(PlanteraNPCs      ));
            Boss2          = new BgmEntry(Bgm.VanillaBgmOf(12), BgmPriority.Boss, () => Bgm.justScanned ? (Bgm.bossMusicId & BossBgms.Boss2         ) != 0 : Bgm.AnyNPCsForMusic(Boss2NPCs         ));
            Boss1          = new BgmEntry(Bgm.VanillaBgmOf( 5), BgmPriority.Boss, () => Bgm.justScanned ? (Bgm.bossMusicId & BossBgms.Boss1         ) != 0 : Bgm.AnyNPCsForMusic(IsBoss1Boss       ));
            Boss3          = new BgmEntry(Bgm.VanillaBgmOf(13), BgmPriority.Boss, () => Bgm.justScanned ? (Bgm.bossMusicId & BossBgms.Boss3         ) != 0 : Bgm.AnyNPCsForMusic(Boss3NPCs         ));
            Golem          = new BgmEntry(Bgm.VanillaBgmOf(17), BgmPriority.Boss, () => Bgm.justScanned ? (Bgm.bossMusicId & BossBgms.Golem         ) != 0 : Bgm.AnyNPCsForMusic(GolemNPCs         ));
            QueenBee       = new BgmEntry(Bgm.VanillaBgmOf(25), BgmPriority.Boss, () => Bgm.justScanned ? (Bgm.bossMusicId & BossBgms.QueenBee      ) != 0 : Bgm.AnyNPCsForMusic(QueenBeeNPCs      ));
            Pirates        = new BgmEntry(Bgm.VanillaBgmOf(35), BgmPriority.Boss, () => Bgm.justScanned ? (Bgm.bossMusicId & BossBgms.Pirates       ) != 0 : Bgm.AnyNPCsForMusic(PiratesNPCs       ));
            GoblinArmy     = new BgmEntry(Bgm.VanillaBgmOf(39), BgmPriority.Boss, () => Bgm.justScanned ? (Bgm.bossMusicId & BossBgms.GoblinArmy    ) != 0 : Bgm.AnyNPCsForMusic(GoblinArmyNPCs    ));

            Underworld   = new BgmEntry(Bgm.VanillaBgmOf(36), BgmPriority.Biome, () => Main.player[Main.myPlayer].position.Y > (Main.maxTilesY - 200) * 16);
            Eclipse      = new BgmEntry(Bgm.VanillaBgmOf(27), BgmPriority.Biome, () => Main.eclipse && Main.player[Main.myPlayer].position.Y < Main.worldSurface * 16 + Main.screenHeight / 2);
            Space        = new BgmEntry(Bgm.VanillaBgmOf(15), BgmPriority.Biome, IsInSpace);
            Lihzahrd     = new BgmEntry(Bgm.VanillaBgmOf(26), BgmPriority.Biome, () => Main.tile[(int)(Main.player[Main.myPlayer].Center.X / 16f), (int)(Main.player[Main.myPlayer].Center.Y / 16f)].wall == WallID.LihzahrdBrickUnsafe);
            Mushrooms    = new BgmEntry(Bgm.VanillaBgmOf(29), BgmPriority.Biome, () => (Main.bgStyle == 9 && Main.player[Main.myPlayer].position.Y < Main.worldSurface * 16 + Main.screenHeight / 2) || Main.ugBack == 2);
            UgCorruption = new BgmEntry(Bgm.VanillaBgmOf(10), BgmPriority.Biome, () => Main.player[Main.myPlayer].ZoneCorrupt && IsUnderground());
            Corruption   = new BgmEntry(Bgm.VanillaBgmOf( 8), BgmPriority.Biome, () => Main.player[Main.myPlayer].ZoneCorrupt);
            UgCrimson    = new BgmEntry(Bgm.VanillaBgmOf(33), BgmPriority.Biome, () => Main.player[Main.myPlayer].ZoneCrimson && IsUnderground());
            Crimson      = new BgmEntry(Bgm.VanillaBgmOf(16), BgmPriority.Biome, () => Main.player[Main.myPlayer].ZoneCrimson);
            Dungeon      = new BgmEntry(Bgm.VanillaBgmOf(23), BgmPriority.Biome, () => Main.player[Main.myPlayer].ZoneDungeon);
            Meteor       = new BgmEntry(Bgm.VanillaBgmOf( 2), BgmPriority.Biome, () => Main.player[Main.myPlayer].ZoneMeteor);
            Jungle       = new BgmEntry(Bgm.VanillaBgmOf( 7), BgmPriority.Biome, () => Main.player[Main.myPlayer].ZoneJungle);
            Snow         = new BgmEntry(Bgm.VanillaBgmOf(20), BgmPriority.Biome, () => Main.player[Main.myPlayer].ZoneSnow && IsUnderground());
            Ice          = new BgmEntry(Bgm.VanillaBgmOf(14), BgmPriority.Biome, () => Main.player[Main.myPlayer].ZoneSnow);

            UgHallow    = new BgmEntry(Bgm.VanillaBgmOf(11), BgmPriority.Environment, () => IsUnderground() && Main.player[Main.myPlayer].ZoneHoly);
            UgDesert    = new BgmEntry(Bgm.VanillaBgmOf(21), BgmPriority.Environment, () => IsUnderground() && Main.sandTiles > 2200);
            Underground = new BgmEntry(new AltSupportingBgm(Bgm.VanillaBgmOf(4), Bgm.VanillaBgmOf(31), SwitchMode.Alternate), BgmPriority.Environment, IsUnderground);
            BloodMoon   = new BgmEntry(Bgm.VanillaBgmOf( 2), BgmPriority.Environment, () => Main.bloodMoon);
            Rain        = new BgmEntry(Bgm.VanillaBgmOf(19), BgmPriority.Environment, () => Main.cloudAlpha > 0f && !Main.gameMenu);
            Night       = new BgmEntry(Bgm.VanillaBgmOf( 3), BgmPriority.Environment, () => !Main.dayTime);
            Hallow      = new BgmEntry(Bgm.VanillaBgmOf( 9), BgmPriority.Environment, () => Main.player[Main.myPlayer].ZoneHoly);
            Ocean       = new BgmEntry(Bgm.VanillaBgmOf(22), BgmPriority.Environment, IsInOcean);
            Desert      = new BgmEntry(Bgm.VanillaBgmOf(21), BgmPriority.Environment, () => Main.sandTiles > 2200);
            Day         = new BgmEntry(new AltSupportingBgm(Bgm.VanillaBgmOf(1), Bgm.VanillaBgmOf(18), SwitchMode.Random), BgmPriority.Environment, () => Main.dayTime);

            Ambient = new BgmEntry(Bgm.VanillaBgmOf(28), BgmPriority.Ambient, () => Main.cloudAlpha > 0f && Main.player[Main.myPlayer].position.Y < Main.worldSurface * 16 + Main.screenHeight / 2 && !Main.player[Main.myPlayer].ZoneSnow);

            PopulateDict();
        }
コード例 #5
0
ファイル: Bgm.cs プロジェクト: TerrariaPrismTeam/Prism
        internal static void Update(Main _)
        {
            if (Main.musicVolume <= 0f || Main.dedServ)
                return;

            if (current != null)
                if (HandleInactiveWindow(Entries.Values))
                    return;

            ScanForVanillaBossMusics();
            justScanned = true;

            var newEntry = Entries.Select(e => e.Value).Where(e =>
                    e.Priority == BgmPriority.Title == Main.gameMenu &&
                    e.Priority != BgmPriority.Ambient &&
                    e.ShouldPlay() // do not call ShouldPlay for ambient BGMs, those are managed in UpdateAmbientEntry
                ).OrderByDescending(e =>
                    e.Priority
                ).FirstOrDefault();

            if (newEntry.Priority < BgmPriority.Boss && bossMusicId != BossBgms.None)
                if (bossMusicId == BossBgms.Custom)
                    newEntry = bossMusic_custom.Resolve();

            Main.engine.Update();

            HookManager.GameBehaviour.UpdateMusic(ref newEntry);

            float moonLordSpawnFade = GetMoonLordSpawnFade(newEntry);

            foreach (var e in Entries.Values)
            {
                if (e.Priority == BgmPriority.Ambient)
                    UpdateAmbientEntry(newEntry, e);
                else if (e.Music == newEntry.Music)
                    UpdateCurrentEntry(e);
                else
                    UpdateOtherEntry(newEntry, e);

                var m = e.Music;
                if (m.State == SoundState.Playing)
                {
                    var nv = e.fade * Main.musicVolume * (e.Priority == BgmPriority.Ambient ? 1f : moonLordSpawnFade);

            #pragma warning disable RECS0018
                    if (nv != m.Volume) // getting volume is way faster than setting using the XACT and XAudio APIs
            #pragma warning restore RECS0018
                        m.Volume = nv;
                }
            }

            current = newEntry;

            justScanned = false;
        }
コード例 #6
0
ファイル: Bgm.cs プロジェクト: TerrariaPrismTeam/Prism
        static void UpdateOtherEntry(BgmEntry current, BgmEntry e)
        {
            var m = e.Music;

            if (m.State != SoundState.Playing)
            {
                e.fade = 0f;
                return;
            }

            if (e.fade > 0.25f)
                e.fade -= fade_delta;
            else //if (current == null)
                e.fade = 0f;

            if (e.fade <= 0f)
                m.Stop();
        }
コード例 #7
0
ファイル: Bgm.cs プロジェクト: TerrariaPrismTeam/Prism
        static void UpdateCurrentEntry(BgmEntry e)
        {
            var m = e.Music;

            // play if not already
            if (m.State != SoundState.Playing)
                m.Play();
            else // fade in if needed
                e.fade = MathHelper.Clamp(e.fade + fade_delta, 0f, 1f);
        }
コード例 #8
0
ファイル: Bgm.cs プロジェクト: TerrariaPrismTeam/Prism
        static void UpdateAmbientEntry(BgmEntry current, BgmEntry e)
        {
            var m = e.Music;

            if (e.ShouldPlay())
            {
                // stop if playing & volume is zero
                if (Main.ambientVolume <= 0f)
                {
                    if (m.State == SoundState.Playing)
                        m.Stop();
                }
                // play if not already
                else if (m.State != SoundState.Playing)
                    m.Play();
                else if (m.State == SoundState.Paused)
                    m.Play();
                // fade in if needed
                else
                    e.fade = MathHelper.Clamp(e.fade + fade_delta, 0f, 1f);
            }
            else if (m.State == SoundState.Playing)
            {
                // fade out if needed
                if (current != null && current.fade > 0.25f)
                    e.fade -= fade_delta;
                // stop playing if nothing is
                else if (current == null)
                    e.fade = 0f;

                if (e.fade <= 0f)
                    m.Stop();
            }
            else
                e.fade = 0f;
        }
コード例 #9
0
ファイル: Bgm.cs プロジェクト: TerrariaPrismTeam/Prism
        static float GetMoonLordSpawnFade(BgmEntry current)
        {
            float ret = 1f;
            if (NPC.MoonLordCountdown > 0)
            {
                ret = NPC.MoonLordCountdown / 3600f;
                ret *= ret; // fade out exponentially

                if (NPC.MoonLordCountdown > 720)
                    ret = MathHelper.Lerp(0f, 1f, ret);
                else // mute completely for the last 12 seconds
                {
                    ret = 0f;
                    current = null;
                }

                // just spawned -> fade back in
                if (NPC.MoonLordCountdown == 1 && current != null /*&& curMusic < MusicAmt*/)
                    current.fade = 0f;
            }

            return ret;
        }
コード例 #10
0
        private Dictionary <string, BgmEntry> GetBgmEntriesFromStateManager()
        {
            //Load BGM_PROPERTY
            var daoBinBgmProperty     = _state.LoadResource <BinBgmProperty>(Constants.GameResources.PRC_BGM_PROPERTY_PATH);
            var daoBinPropertyEntries = daoBinBgmProperty.Entries;

            //Load UI_BGM_DB / UI_GAMETITLE_DB
            var paramBgmDatabase       = _state.LoadResource <PrcUiBgmDatabase>(Constants.GameResources.PRC_UI_BGM_DB_PATH);
            var paramGameTitleDbRoot   = _state.LoadResource <PrcUiGameTitleDatabase>(Constants.GameResources.PRC_UI_GAMETITLE_DB_PATH).DbRootEntries;
            var paramBgmDbRoot         = paramBgmDatabase.DbRootEntries;
            var paramBgmStreamSet      = paramBgmDatabase.StreamSetEntries;
            var paramBgmAssignedInfo   = paramBgmDatabase.AssignedInfoEntries;
            var paramBgmStreamProperty = paramBgmDatabase.StreamPropertyEntries;
            var paramBgmPlaylists      = paramBgmDatabase.PlaylistEntries.ToDictionary(p => p.Id.StringValue, p => p.Values);

            //Load MSBT
            var daoMsbtBgms  = GetBgmDatabases();
            var daoMsbtTitle = GetGameTitleDatabases();

            var output = new Dictionary <string, BgmEntry>();

            foreach (var daoBinPropertyKeyValue in daoBinPropertyEntries)
            {
                var toneId = daoBinPropertyKeyValue.Key;
                var keyRef = GetToneIdKeyReferences(toneId);

                //Very few songs are currently not in the db - therefore not supported for now.
                if (!paramBgmDbRoot.ContainsKey(keyRef.DbRootKey))
                {
                    continue;
                }

                var dbRootEntry         = paramBgmDbRoot[keyRef.DbRootKey];
                var setStreamEntry      = paramBgmStreamSet[keyRef.StreamSetKey];
                var assignedInfoEntry   = paramBgmAssignedInfo[keyRef.AssignedInfoKey];
                var streamPropertyEntry = paramBgmStreamProperty[keyRef.StreamPropertyKey];
                var gameTitleEntry      = paramGameTitleDbRoot[dbRootEntry.UiGameTitleId.StringValue];
                var bgmProperty         = daoBinPropertyEntries[toneId];

                var newBgmEntry = new BgmEntry()
                {
                    ToneId    = toneId,
                    GameTitle = new GameTitleEntry()
                    {
                        GameTitleId = dbRootEntry.UiGameTitleId.StringValue,
                        NameId      = dbRootEntry.NameId,
                        SeriesId    = gameTitleEntry.UiSeriesId.StringValue,
                        Title       = new Dictionary <string, string>()
                    },
                    RecordType     = dbRootEntry.RecordType.StringValue,
                    AudioCuePoints = new AudioCuePoints()
                    {
                        LoopEndMs       = bgmProperty.LoopEndMs,
                        LoopEndSample   = bgmProperty.LoopEndSample,
                        LoopStartMs     = bgmProperty.LoopStartMs,
                        LoopStartSample = bgmProperty.LoopStartSample,
                        TotalSamples    = bgmProperty.TotalSamples,
                        TotalTimeMs     = bgmProperty.TotalTimeMs
                    },
                    FileName  = _toneIdKeyReferences.ContainsKey(toneId) ? _toneIdKeyReferences[toneId].FileName : null,
                    Playlists = paramBgmPlaylists.Where(p => p.Value.Any(p => p.UiBgmId.HexValue == dbRootEntry.UiBgmId.HexValue)).Select(p => new PlaylistEntry()
                    {
                        Id = p.Key
                    }).ToList(),
                    IsDlc           = dbRootEntry.IsDlc,
                    IsPatch         = dbRootEntry.IsPatch,
                    SpecialCategory = ToSpecialCategory(setStreamEntry),
                    Title           = new Dictionary <string, string>(),
                    Author          = new Dictionary <string, string>(),
                    Copyright       = new Dictionary <string, string>()
                };

                var nameId         = dbRootEntry.NameId;
                var gameTitleId    = gameTitleEntry.NameId;
                var gameTitleLabel = string.Format(Constants.InternalIds.MSBT_GAME_TITLE, gameTitleId);
                var titleLabel     = string.Format(Constants.InternalIds.MSBT_BGM_TITLE, nameId);
                var authorLabel    = string.Format(Constants.InternalIds.MSBT_BGM_AUTHOR, nameId);
                var copyrightLabel = string.Format(Constants.InternalIds.MSBT_BGM_COPYRIGHT, nameId);
                foreach (var msbtDb in daoMsbtBgms)
                {
                    var entries = msbtDb.Value.Entries;
                    if (entries.ContainsKey(titleLabel))
                    {
                        newBgmEntry.Title.Add(msbtDb.Key, entries[titleLabel]);
                    }
                    if (entries.ContainsKey(authorLabel))
                    {
                        newBgmEntry.Author.Add(msbtDb.Key, entries[authorLabel]);
                    }
                    if (entries.ContainsKey(copyrightLabel))
                    {
                        newBgmEntry.Copyright.Add(msbtDb.Key, entries[copyrightLabel]);
                    }
                }
                foreach (var msbtDb in daoMsbtTitle)
                {
                    var entries = msbtDb.Value.Entries;
                    if (entries.ContainsKey(gameTitleLabel))
                    {
                        newBgmEntry.GameTitle.Title.Add(msbtDb.Key, entries[gameTitleLabel]);
                    }
                }

                output.Add(toneId, newBgmEntry);
            }

            return(output);
        }
コード例 #11
0
        private void UpdateBgmEntryInStateManager(BgmToneKeyReferences keyRefs, BgmEntry bgmEntry)
        {
            _logger.LogInformation("Updating Bgm Entry to State Service: {ToneId}", keyRefs.ToneId);

            var paramBgmDatabase           = _state.LoadResource <PrcUiBgmDatabase>(Constants.GameResources.PRC_UI_BGM_DB_PATH);
            var paramGameTitleDatabaseRoot = _state.LoadResource <PrcUiGameTitleDatabase>(Constants.GameResources.PRC_UI_GAMETITLE_DB_PATH).DbRootEntries;
            var binBgmPropertyEntries      = _state.LoadResource <BinBgmProperty>(Constants.GameResources.PRC_BGM_PROPERTY_PATH).Entries;

            var defaultLocale   = _config.Value.Sm5shMusic.DefaultLocale;
            var coreSeriesGames = paramGameTitleDatabaseRoot.Values.Select(p => p.UiSeriesId.StringValue).Distinct(); //Not handling series addition right now.

            var toneId = keyRefs.ToneId;

            if (!paramBgmDatabase.DbRootEntries.ContainsKey(keyRefs.DbRootKey))
            {
                throw new Exception($"BGM ID {keyRefs.DbRootKey} does not exist in the DBRoot");
            }

            //BGM PRC
            var dbRootEntry         = paramBgmDatabase.DbRootEntries[keyRefs.DbRootKey];
            var setStreamEntry      = paramBgmDatabase.StreamSetEntries[keyRefs.StreamSetKey];
            var assignedInfoEntry   = paramBgmDatabase.AssignedInfoEntries[keyRefs.AssignedInfoKey];
            var streamPropertyEntry = paramBgmDatabase.StreamPropertyEntries[keyRefs.StreamPropertyKey];

            //DB Root
            dbRootEntry.UiGameTitleId = new PrcHash40(bgmEntry.GameTitle.GameTitleId);
            dbRootEntry.RecordType    = new PrcHash40(bgmEntry.RecordType);
            dbRootEntry.IsPatch       = bgmEntry.IsPatch;
            dbRootEntry.IsDlc         = bgmEntry.IsDlc;
            //Stream Set
            setStreamEntry = FromSpecialCategory(setStreamEntry, bgmEntry?.SpecialCategory);

            //GameTitle PRC
            if (!paramGameTitleDatabaseRoot.ContainsKey(bgmEntry.GameTitle.GameTitleId))
            {
                string seriesId = bgmEntry.GameTitle.SeriesId;
                if (!coreSeriesGames.Contains(seriesId))
                {
                    seriesId = Constants.InternalIds.GAME_SERIES_ID_DEFAULT;
                }
                paramGameTitleDatabaseRoot.Add(bgmEntry.GameTitle.GameTitleId, new PrcGameTitleDbRootEntry()
                {
                    NameId        = bgmEntry.GameTitle.NameId,
                    Release       = paramGameTitleDatabaseRoot.Values.OrderByDescending(p => p.Release).First().Release + 1,
                    UiGameTitleId = new PrcHash40(bgmEntry.GameTitle.GameTitleId),
                    UiSeriesId    = new PrcHash40(seriesId)
                });
            }

            //Bin Property
            binBgmPropertyEntries[toneId].TotalSamples    = bgmEntry.AudioCuePoints.TotalSamples;
            binBgmPropertyEntries[toneId].LoopEndMs       = bgmEntry.AudioCuePoints.LoopEndMs;
            binBgmPropertyEntries[toneId].LoopEndSample   = bgmEntry.AudioCuePoints.LoopEndSample;
            binBgmPropertyEntries[toneId].LoopStartMs     = bgmEntry.AudioCuePoints.LoopStartMs;
            binBgmPropertyEntries[toneId].LoopStartSample = bgmEntry.AudioCuePoints.LoopStartSample;
            binBgmPropertyEntries[toneId].TotalTimeMs     = bgmEntry.AudioCuePoints.TotalTimeMs;
            binBgmPropertyEntries[toneId].NameId          = toneId;

            //Playlists
            if (bgmEntry.Playlists != null)
            {
                foreach (var playlistId in bgmEntry.Playlists)
                {
                    var paramBgmPlaylist = paramBgmDatabase.PlaylistEntries.FirstOrDefault(p => p.Id.StringValue == playlistId.Id)?.Values;
                    if (paramBgmPlaylist == null)
                    {
                        paramBgmPlaylist = new List <PrcBgmPlaylistEntry>();
                        paramBgmDatabase.PlaylistEntries.Add(new PcrFilterStruct <PrcBgmPlaylistEntry>()
                        {
                            Id     = new PrcHash40(playlistId.Id),
                            Values = paramBgmPlaylist
                        });
                    }

                    var newPlaylistEntry = new PrcBgmPlaylistEntry()
                    {
                        UiBgmId = new PrcHash40(dbRootEntry.UiBgmId.StringValue)
                    };
                    newPlaylistEntry.SetOrder((short)paramBgmPlaylist.Count);
                    newPlaylistEntry.SetIncidence(500);
                    paramBgmPlaylist.Add(newPlaylistEntry);
                }
            }

            //MSBT
            var nameId         = dbRootEntry.NameId;
            var gameTitleEntry = paramGameTitleDatabaseRoot[dbRootEntry.UiGameTitleId.StringValue];
            var gameTitleId    = gameTitleEntry.NameId;
            var gameTitleLabel = string.Format(Constants.InternalIds.MSBT_GAME_TITLE, gameTitleId);
            var titleLabel     = string.Format(Constants.InternalIds.MSBT_BGM_TITLE, nameId);
            var authorLabel    = string.Format(Constants.InternalIds.MSBT_BGM_AUTHOR, nameId);
            var copyrightLabel = string.Format(Constants.InternalIds.MSBT_BGM_COPYRIGHT, nameId);

            foreach (var msbtDb in GetBgmDatabases())
            {
                var entries = msbtDb.Value.Entries;

                if (bgmEntry.Title != null && bgmEntry.Title.ContainsKey(msbtDb.Key) && !string.IsNullOrEmpty(bgmEntry.Title[msbtDb.Key]))
                {
                    entries[titleLabel] = bgmEntry.Title[msbtDb.Key];
                }
                else if (bgmEntry.Title != null && bgmEntry.Title.ContainsKey(defaultLocale) && !string.IsNullOrEmpty(bgmEntry.Title[msbtDb.Key]))
                {
                    entries[titleLabel] = bgmEntry.Title[defaultLocale];
                }
                else
                {
                    entries[titleLabel] = "MISSING";
                }

                if (bgmEntry.Author != null)
                {
                    if (bgmEntry.Author.ContainsKey(msbtDb.Key) && !string.IsNullOrEmpty(bgmEntry.Author[msbtDb.Key]))
                    {
                        entries[authorLabel] = bgmEntry.Author[msbtDb.Key];
                    }
                    else if (bgmEntry.Author.ContainsKey(defaultLocale) && !string.IsNullOrEmpty(bgmEntry.Author[msbtDb.Key]))
                    {
                        entries[authorLabel] = bgmEntry.Author[defaultLocale];
                    }
                }

                if (bgmEntry.Copyright != null)
                {
                    if (bgmEntry.Copyright.ContainsKey(msbtDb.Key) && !string.IsNullOrEmpty(bgmEntry.Copyright[msbtDb.Key]))
                    {
                        entries[copyrightLabel] = bgmEntry.Copyright[msbtDb.Key];
                    }
                    else if (bgmEntry.Copyright.ContainsKey(defaultLocale) && !string.IsNullOrEmpty(bgmEntry.Copyright[msbtDb.Key]))
                    {
                        entries[copyrightLabel] = bgmEntry.Copyright[defaultLocale];
                    }
                }
            }
            foreach (var msbtDb in GetGameTitleDatabases())
            {
                var entries = msbtDb.Value.Entries;
                if (bgmEntry.GameTitle.Title.ContainsKey(msbtDb.Key))
                {
                    entries[gameTitleLabel] = bgmEntry.GameTitle.Title[msbtDb.Key];
                }
                else if (bgmEntry.GameTitle.Title.ContainsKey(defaultLocale))
                {
                    entries[gameTitleLabel] = bgmEntry.GameTitle.Title[defaultLocale];
                }
                else
                {
                    entries[gameTitleLabel] = "MISSING";
                }
            }
        }