示例#1
0
        public static DLCSong ConvertDLCSong(DataArray songDta, GameArchives.IDirectory songRoot)
        {
            var path          = songDta.Array("song").Array("name").String(1);
            var hopoThreshold = songDta.Array("song").Array("hopo_threshold")?.Int(1) ?? 170;
            var shortname     = path.Split('/').Last();
            var midPath       = shortname + ".mid";
            var artPath       = $"gen/{shortname}_keep.png_xbox";
            var miloPath      = $"gen/{shortname}.milo_xbox";
            var songId        = songDta.Array("song_id").Node(1);
            var name          = songDta.Array("name").String(1);
            var artist        = songDta.Array("artist").String(1);
            var mid           = MidiCS.MidiFileReader.FromBytes(songRoot.GetFileAtPath(midPath).GetBytes());

            // TODO: Catch possible conversion exceptions? i.e. Unsupported milo version
            var milo     = MiloFile.ReadFromStream(songRoot.GetFileAtPath(miloPath).GetStream());
            var songData = SongDataConverter.ToSongData(songDta);

            Texture.Texture artwork = null;
            if (songData.AlbumArt)
            {
                artwork = Texture.TextureConverter.MiloPngToTexture(songRoot.GetFileAtPath(artPath).GetStream());
            }
            return(new DLCSong
            {
                SongData = songData,
                Lipsync = LipsyncConverter.FromMilo(milo),
                Mogg = songRoot.GetFile(shortname + ".mogg"),
                MoggDta = MakeMoggDta(songDta),
                MoggSong = DTX.FromDtaString($"(mogg_path \"{shortname}.mogg\")\r\n(midi_path \"{shortname}.rbmid\")\r\n"),
                RBMidi = RBMidConverter.ToRBMid(mid, hopoThreshold),
                Artwork = artwork,
                RBSong = MakeRBSong(songDta)
            });
        }
示例#2
0
        public static List <SongData.SongData> GetSongMetadatas(GameArchives.IDirectory dlcRoot)
        {
            var metas = new List <SongData.SongData>();
            var dta   = DTX.FromPlainTextBytes(dlcRoot.GetFile("songs.dta").GetBytes());

            for (int i = 0; i < dta.Count; i++)
            {
                metas.Add(SongDataConverter.ToSongData(dta.Array(i)));
            }
            return(metas);
        }
示例#3
0
        /// <summary>
        /// Converts an RB3 DLC songs folder into RB4 DLC songs
        /// </summary>
        /// <param name="dlcRoot"></param>
        /// <returns></returns>
        public static List <DLCSong> ConvertDLCPackage(GameArchives.IDirectory dlcRoot, Action <string> warner = null)
        {
            var       dlcSongs = new List <DLCSong>();
            var       dta      = DTX.FromPlainTextBytes(dlcRoot.GetFile("songs.dta").GetBytes());
            DataArray arr;

            for (int i = 0; i < dta.Count; i++)
            {
                arr = dta.Array(i);
                dlcSongs.Add(ConvertDLCSong(arr, dlcRoot.GetDirectory(arr.Array("song").Array("name").String(1).Split('/').Last()), warner));
            }
            return(dlcSongs);
        }