Esempio n. 1
0
        public override bool AddSong(PlatformData data, SongData song, ProgressIndicator progress)
        {
            FormatData formatdata = new TemporaryFormatData(song, data);

            DirectoryNode dir = data.Session["rootdirnode"] as DirectoryNode;

            string        path     = song.Data.GetValue <string>("FolderLocation");
            DirectoryNode songdir  = dir.Navigate("Common/" + path) as DirectoryNode;
            DirectoryNode audiodir = dir.Navigate("Wii/" + path) as DirectoryNode;

            string mode       = "SinglePlayer";
            string difficulty = "Medium";

            path = mode + "/" + difficulty;

            //audiodir = audiodir.Navigate(path) as DirectoryNode;

            List <FileNode> audiofiles = new List <FileNode>();

            audiofiles.Add(audiodir.Find("AudioTrack_Main.fsb", SearchOption.AllDirectories) as FileNode);
            audiofiles.Add(audiodir.Find("AudioTrack_Main_P1.fsb", SearchOption.AllDirectories) as FileNode);
            audiofiles.Add(audiodir.Find("AudioTrack_Main_P2.fsb", SearchOption.AllDirectories) as FileNode);
            audiofiles.RemoveAll(f => f == null);

            List <FileNode> chartfiles = new List <FileNode>();

            chartfiles.Add(audiodir.Find("Markup_Main_P1_0.fsgmub", SearchOption.AllDirectories) as FileNode);
            chartfiles.Add(audiodir.Find("Markup_Main_P1_1.fsgmub", SearchOption.AllDirectories) as FileNode);
            chartfiles.Add(audiodir.Find("Markup_Main_P1_2.fsgmub", SearchOption.AllDirectories) as FileNode);
            chartfiles.Add(audiodir.Find("Markup_Main_P1_3.fsgmub", SearchOption.AllDirectories) as FileNode);
            chartfiles.Add(audiodir.Find("Markup_Main_P1_4.fsgmub", SearchOption.AllDirectories) as FileNode);
            chartfiles.Add(audiodir.Find("Markup_Main_P2.fsgmub", SearchOption.AllDirectories) as FileNode);
            chartfiles.Add(audiodir.Find("Markup_Main_P1.fsgmub", SearchOption.AllDirectories) as FileNode);
            chartfiles.RemoveAll(f => f == null);

            if (audiofiles.Count == 0 && chartfiles.Count == 0)
            {
                return(false);
            }

            if (audiofiles.Count > 0)
            {
                AudioFormatMp3.Instance.CreateFromFSB(formatdata, audiofiles.Select(a => a.Data).ToArray(), FreeStyleGamesMetadata.GetAudioFormat(song));
            }

            if (chartfiles.Count > 0)
            {
                ChartFormatFsgMub.Instance.Create(formatdata, chartfiles.Select(c => c.Data).ToArray());
            }

            return(true);
        }
Esempio n. 2
0
        public static void Transcode(FormatType type, FormatData data, IList <IFormat> targets, FormatData destination, ProgressIndicator progress)
        {
            foreach (IFormat format in targets)
            {
                if (format.HasFormat(data))
                {
                    Transfer(format, data, destination, progress);
                    return;
                }
            }

            IList <IFormat> formats = FindTranscodePath(data.GetFormats(type), targets);

            if (formats.Count == 0)
            {
                throw new UnsupportedTranscodeException("Could not find a supported transcode path.");
            }

            if (formats.Count == 1)
            {
                if (formats[0].CanTransfer(data))
                {
                    Transfer(formats[0], data, destination, progress);
                    return;
                }
                else
                {
                    formats.Add(formats[0]);
                }
            }

            FormatData tempdata = null;

            if (formats.Count > 2)
            {
                tempdata = new TemporaryFormatData();
            }

            progress.NewTask(formats.Count - 1);

            for (int i = 1; i < formats.Count; i++)
            {
                FormatData dest = i < formats.Count - 1 ? tempdata : destination;
                Transcode(formats[i - 1], data, formats[i], dest, progress);
                data = dest;
                progress.Progress();
            }

            progress.EndTask();
        }
Esempio n. 3
0
        public bool AddSongNew(PlatformData data, SongData song, ProgressIndicator progress)
        {
            FormatData formatdata = new TemporaryFormatData(song, data);

            DirectoryNode dir = data.Session["songdir"] as DirectoryNode;

            foreach (FileNode file in dir.Files)
            {
                formatdata.SetStream(file.Name, file.Data);
            }

            data.AddSong(formatdata);

            return(true);
        }
        public override bool AddSong(PlatformData data, SongData song, ProgressIndicator progress)
        {
            if (IterateBins)
            {
                return(PlatformRB2WiiDisc.Instance.AddSong(data, song, progress));
            }
            else
            {
                FormatData formatdata = new TemporaryFormatData(song, data);

                SongsDTA dta = HarmonixMetadata.GetSongsDTA(song);

                data.AddSong(formatdata);

                return(true);
            }
        }
Esempio n. 5
0
        public override bool AddSong(PlatformData data, SongData song, ProgressIndicator progress)
        {
            FormatData formatdata = new TemporaryFormatData(song, data);

            RBA rba = data.Session["rba"] as RBA;

            AudioFormat audio = HarmonixMetadata.GetAudioFormat(song);

            AudioFormatMogg.Instance.Create(formatdata, rba.Audio, audio);

            ChartFormatRB.Instance.Create(formatdata, rba.Chart, null, 0, rba.Weights, rba.Milo, ChartFormatRB.Milo3Version, false, false);

            //song.AlbumArt = XboxImage.Create(new EndianReader(albumfile.Data, Endianness.LittleEndian)).Bitmap;

            data.AddSong(formatdata);

            return(true);
        }
Esempio n. 6
0
        public override bool AddSong(PlatformData data, SongData song, ProgressIndicator progress)
        {
            int index = int.Parse(song.ID.Substring(3));
            //song.ID = "dlc" + ImportMap.GetShortName(song.Name);

            FormatData formatdata = new TemporaryFormatData(song, data);

            NeversoftMetadata.SaveSongItem(formatdata);

            DirectoryNode dir = data.Session["rootdir"] as DirectoryNode;

            FileNode binfile = dir.Navigate(Util.Pad(index.ToString(), 3) + ".bin") as FileNode;

            if (binfile == null)
            {
                return(false);
            }
            DlcBin bin = new DlcBin(binfile.Data);
            U8     u8  = new U8(bin.Data);

            FileNode chartpak = u8.Root.Find(song.ID + "_song.pak.ngc", SearchOption.AllDirectories) as FileNode;
            FileNode textpak  = u8.Root.Find(song.ID + "_text.pak.ngc", SearchOption.AllDirectories) as FileNode;

            FileNode audiofile = u8.Root.Find(song.ID + ".bik", SearchOption.AllDirectories) as FileNode;

            if (chartpak == null || textpak == null || audiofile == null)
            {
                return(false);
            }

            ChartFormatGH4.Instance.Create(formatdata, new Stream[] { chartpak.Data, textpak.Data }, PlatformGH5WiiDisc.ImportExpertPlus);

            if (audiofile != null)
            {
                AudioFormatBink.Instance.Create(formatdata, audiofile.Data, null, null);
            }

            data.AddSong(formatdata);

            chartpak.Data.Close();

            return(true);
        }
Esempio n. 7
0
        public override bool AddSong(PlatformData data, SongData song, ProgressIndicator progress)
        {
            FormatData formatdata = new TemporaryFormatData(song, data);

            NeversoftMetadata.SaveSongItem(formatdata);

            DirectoryNode dir = data.Session["rootdir"] as DirectoryNode;

            FileNode chartpak = dir.Navigate("songs/" + song.ID + ".pak.ngc", false, true) as FileNode;

            if (chartpak == null)
            {
                return(false);
            }

            if (data.Game == Game.GuitarHero5 || data.Game == Game.BandHero)
            {
                ChartFormatGH5.Instance.Create(formatdata, new Stream[] { chartpak.Data }, ImportExpertPlus);
            }
            else
            {
                ChartFormatGH4.Instance.Create(formatdata, new Stream[] { chartpak.Data }, ImportExpertPlus);
            }

            FileNode audiofile   = dir.Navigate("music/" + song.ID + ".bik", false, true) as FileNode;
            FileNode previewfile = dir.Navigate("music/" + song.ID + "_preview.bik", false, true) as FileNode;

            if (audiofile != null)
            {
                AudioFormatBink.Instance.Create(formatdata, audiofile.Data, previewfile == null ? null : previewfile.Data, null);
            }

            data.AddSong(formatdata);

            chartpak.Data.Close();

            return(true);
        }
Esempio n. 8
0
        public bool AddSongOld(PlatformData data, SongData song, ProgressIndicator progress)
        {
            FormatData formatdata = new TemporaryFormatData(song, data);

            formatdata.Song.Data.SetValue("RawkSD2Compatibility", true);
            formatdata.Song.Version = 0;

            DirectoryNode dir = data.Session["songdir"] as DirectoryNode;

            FileNode audiofile   = dir.Navigate("audio") as FileNode;
            FileNode albumfile   = dir.Navigate("album") as FileNode;
            FileNode weightsfile = dir.Navigate("weights") as FileNode;
            FileNode panfile     = dir.Navigate("pan") as FileNode;
            FileNode milofile    = dir.Navigate("milo") as FileNode;
            FileNode chartfile   = dir.Navigate("chart") as FileNode;
            FileNode previewfile = dir.Navigate("preview") as FileNode;

            if (audiofile != null)
            {
                AudioFormat audio = HarmonixMetadata.GetAudioFormat(song);
                AudioFormatRB2Mogg.Instance.Create(formatdata, audiofile.Data, previewfile.Data, null);
            }

            if (albumfile != null)
            {
                song.AlbumArt = WiiImage.Create(new EndianReader(albumfile.Data, Endianness.LittleEndian)).Bitmap;
            }

            if (chartfile != null)
            {
                ChartFormatRB.Instance.Create(formatdata, chartfile == null ? null : chartfile.Data, panfile == null ? null : panfile.Data, weightsfile == null ? null : weightsfile.Data, milofile == null ? null : milofile.Data, false, false, Game.RockBand2);
            }

            data.AddSong(formatdata);

            return(true);
        }
Esempio n. 9
0
        public override bool AddSong(PlatformData data, SongData song, ProgressIndicator progress)
        {
            DirectoryNode songdir = data.Session["songdir"] as DirectoryNode;

            SongsDTA dta = HarmonixMetadata.GetSongsDTA(song);

            if (dta == null)               // GH1's <addsong />
            {
                dta            = HarmonixMetadata.GetSongData(song);
                dta.Song.Cores = new List <int>()
                {
                    -1, -1, 1, 1
                };
                dta.Song.Vols = new List <float>()
                {
                    0, 0, 0, 0
                };
                dta.Song.Pans = new List <float>()
                {
                    -1, 1, -1, 1
                };
                dta.Song.Tracks.Find(t => t.Name == "guitar").Tracks.AddRange(new int[] { 2, 3 });
                HarmonixMetadata.SetSongsDTA(song, dta.ToDTB());
            }

            dta.Bank = "sfx/tambourine_bank.milo";

            DirectoryNode songnode = songdir.Navigate(song.ID) as DirectoryNode;

            FileNode chartfile = songnode.Find(song.ID + ".mid") as FileNode;

            if (chartfile == null)
            {
                return(false);
            }

            for (int coop = 0; coop < 2; coop++)
            {
                if (coop == 1)
                {
                    song       = new SongData(song);
                    song.ID   += "_coop";
                    song.Name += " [coop]";
                    if (dta.SongCoop != null)
                    {
                        dta.Song     = dta.SongCoop;
                        dta.SongCoop = null;
                    }
                    else
                    {
                        return(false);
                    }
                }
                HarmonixMetadata.SetSongsDTA(song, dta.ToDTB());
                FormatData formatdata = new TemporaryFormatData(song, data);

                FileNode songaudiofile = songnode.Find(song.ID + ".vgs") as FileNode;
                if (songaudiofile == null)
                {
                    songaudiofile = songnode.Find(song.ID + "_sp.vgs") as FileNode;
                }
                if (songaudiofile == null)
                {
                    return(false);
                }

                if (data.Game == Game.GuitarHero1)
                {
                    ChartFormatGH1.Instance.Create(formatdata, chartfile == null ? null : chartfile.Data);
                }
                else
                {
                    ChartFormatGH2.Instance.Create(formatdata, chartfile == null ? null : chartfile.Data, coop == 1);
                }

                AudioFormatVGS.Instance.Create(formatdata, songaudiofile.Data, null);

                data.AddSong(formatdata);
            }

            return(true);
        }
Esempio n. 10
0
        public override bool AddSong(PlatformData data, SongData song, ProgressIndicator progress)
        {
            FormatData formatdata = new TemporaryFormatData(song, data);

            DirectoryNode dir = data.Session["songdir"] as DirectoryNode;

            int         delay      = 0;
            bool        eighthhopo = false;
            int         hopofreq   = -1;
            AudioFormat format     = new AudioFormat();
            FileNode    songini    = dir.Navigate("song.ini", false, true) as FileNode;

            if (songini != null)
            {
                Ini ini = Ini.Create(songini.Data);
                songini.Data.Close();
                string value = ini.GetValue("song", "name"); if (value != null)
                {
                    song.Name = value;
                }
                value = ini.GetValue("song", "artist"); if (value != null)
                {
                    song.Artist = value;
                }
                value = ini.GetValue("song", "album"); if (value != null)
                {
                    song.Album = value;
                }
                value = ini.GetValue("song", "genre"); if (value != null)
                {
                    song.Genre = value;
                }
                value = ini.GetValue("song", "year"); if (value != null)
                {
                    song.Year = int.Parse(value);
                }
                value = ini.GetValue("song", "version"); if (value != null)
                {
                    song.Version = int.Parse(value);
                }
                value = ini.GetValue("song", "delay"); if (value != null)
                {
                    delay = int.Parse(value);
                }
                value = ini.GetValue("song", "eighthnote_hopo"); if (value != null)
                {
                    eighthhopo = string.Compare(value, "true", true) == 0 ? true : false;
                }
                value = ini.GetValue("song", "hopofreq"); if (value != null)
                {
                    hopofreq = int.Parse(value);
                }
                value = ini.GetValue("song", "tags"); if (value != null)
                {
                    song.Master = string.Compare(value, "cover", true) == 0 ? false : true;
                }
                value = ini.GetValue("song", "icon"); if (value != null)
                {
                    song.Game = GetGameFromIcon(value);
                }
                value = ini.GetValue("song", "diff_band"); if (value != null)
                {
                    song.Difficulty[Instrument.Ambient] = ImportMap.GetBaseRank(Instrument.Ambient, int.Parse(value));
                }
                value = ini.GetValue("song", "diff_bass"); if (value != null)
                {
                    song.Difficulty[Instrument.Bass] = ImportMap.GetBaseRank(Instrument.Bass, int.Parse(value));
                }
                value = ini.GetValue("song", "diff_drums"); if (value != null)
                {
                    song.Difficulty[Instrument.Drums] = ImportMap.GetBaseRank(Instrument.Drums, int.Parse(value));
                }
                value = ini.GetValue("song", "diff_guitar"); if (value != null)
                {
                    song.Difficulty[Instrument.Guitar] = ImportMap.GetBaseRank(Instrument.Guitar, int.Parse(value));
                }
            }

            format.InitialOffset = -delay;

            FileNode album = dir.Navigate("album.png", false, true) as FileNode;

            if (album != null)
            {
                song.AlbumArt = new Bitmap(album.Data);
            }

            FileNode  chartfile = dir.Navigate("notes.mid", false, true) as FileNode;
            NoteChart chart     = null;

            if (chartfile != null)
            {
                ChartFormatRB.Instance.Create(formatdata, chartfile.Data, null, 0, null, null, 0, false, true);
                chart = NoteChart.Create(Midi.Create(Mid.Create(chartfile.Data)));
                chartfile.Data.Close();
            }

            if (chart != null && eighthhopo)
            {
                song.HopoThreshold = chart.Division.TicksPerBeat / 2 + 10;
            }
            else if (hopofreq >= 0)
            {
                // TODO: This
            }

            List <Stream> streams = new List <Stream>();

            foreach (Node node in dir)
            {
                FileNode file = node as FileNode;
                if (file == null)
                {
                    continue;
                }
                string extension = Path.GetExtension(file.Name).ToLower();
                if (extension != ".ogg")
                {
                    continue;
                }

                string            name       = Path.GetFileNameWithoutExtension(file.Name);
                Instrument        instrument = Platform.InstrumentFromString(name);
                RawkAudio.Decoder decoder    = new RawkAudio.Decoder(file.Data, RawkAudio.Decoder.AudioFormat.VorbisOgg);
                for (int i = 0; i < decoder.Channels; i++)
                {
                    format.Mappings.Add(new AudioFormat.Mapping(0, 0, instrument));
                }
                decoder.Dispose();
                file.Data.Close();

                streams.Add(file.Data);
            }
            format.AutoBalance();

            if (streams.Count > 0)
            {
                AudioFormatOgg.Instance.Create(formatdata, streams.ToArray(), format);
            }
            else if (chartfile == null)
            {
                return(false);
            }

            data.AddSong(formatdata);

            return(true);
        }
Esempio n. 11
0
        public override FormatData CreateSong(PlatformData data, SongData song)
        {
            TemporaryFormatData formatdata = new TemporaryFormatData(song, data);

            return(formatdata);
        }
Esempio n. 12
0
        public override bool AddSong(PlatformData data, SongData song, ProgressIndicator progress)
        {
            string albumname = null;

            switch (song.ID)
            {
            case "dontholdback": albumname = "TheSleepingQuestionsAndAnswers"; break;

            case "minuscelsius": albumname = "BackyardBabiesStockholmSyndrome"; break;

            case "thrufireandflames": albumname = "DragonforceInhumanRampage"; break;

            case "fcpremix": albumname = "FallofTroyDoppelganger"; break;

            case "avalancha": albumname = "HeroesDelSilencioAvalancha"; break;

            case "takethislife": albumname = "InFlamesComeClarity"; break;

            case "ruby": albumname = "KaiserChiefsYoursTrulyAngry_Mob"; break;

            case "mycurse": albumname = "KillswitchEngageAsDaylightDies"; break;

            case "closer": albumname = "LacunaCoilKarmaCode"; break;

            case "metalheavylady": albumname = "LionsLions"; break;

            case "mauvaisgarcon": albumname = "NaastAntichambre"; break;

            case "generationrock": albumname = "RevolverheldRevolverheld"; break;

            case "prayeroftherefugee": albumname = "RiseAgainstTheSuffererAndTheWitness"; break;

            case "cantbesaved": albumname = "SensesFailStillSearching"; break;

            case "shebangsadrum": albumname = "StoneRosesStoneRoses"; break;

            case "radiosong": albumname = "SuperbusPopnGum"; break;

            case "bellyofashark": albumname = "TheGallowsOrchestraofWoles"; break;

            case "gothatfar": albumname = "BretMichealsBandGoThatFar"; break;

            case "impulse": albumname = "endlesssporadic"; break;

            case "thewayitends": albumname = "prototype_continuum_cover"; break;

            case "nothingformehere": albumname = "Dope_PosterCover_edsel"; break;

            case "inlove": albumname = "store_song_ScoutsStSebastian"; break;
            }
            if (albumname != null)
            {
                if (data.Session.ContainsKey("albumpak"))
                {
                    Pak      albumpak = data.Session["albumpak"] as Pak;
                    Pak.Node node     = albumpak.Nodes.Find(n => n.FilenamePakKey == QbKey.Create(albumname).Crc);
                    if (node != null)
                    {
                        song.AlbumArt = NgcImage.Create(new EndianReader(node.Data, Endianness.BigEndian)).Bitmap;
                    }
                }
            }

            DirectoryNode dir = data.Session["rootdir"] as DirectoryNode;
            Pak           qb  = data.Session["rootqb"] as Pak;

            FileNode chartpak = dir.Navigate("songs/" + song.ID + ".pak.ngc", false, true) as FileNode;

            if (chartpak == null)
            {
                return(false);
            }

            chartpak.Data.Position = 0;
            Pak      chartqb     = new Pak(new EndianReader(chartpak.Data, Endianness.BigEndian));
            FileNode sectionfile = chartqb.Root.Find(song.ID + ".mid_text.qb.ngc", SearchOption.AllDirectories, true) as FileNode;

            if (sectionfile == null)             // GHA stores it elsewhere
            {
                sectionfile = qb.Root.Find(song.ID + ".mid_text.qb.ngc", SearchOption.AllDirectories, true) as FileNode;
            }
            if (sectionfile == null)             // Last resort, check for it raw on the disc partition
            {
                sectionfile = dir.Find(song.ID + ".mid_text.qb.ngc", SearchOption.AllDirectories, true) as FileNode;
            }

            for (int coop = 0; coop < 2; coop++)
            {
                if (coop == 1)
                {
                    song       = new SongData(song);
                    song.ID   += "_coop";
                    song.Name += " [coop]";
                }
                FormatData formatdata = new TemporaryFormatData(song, data);

                FileNode datfile = dir.Navigate("music/" + song.ID + ".dat.ngc", false, true) as FileNode;
                FileNode wadfile = dir.Navigate("music/" + song.ID + ".wad.ngc", false, true) as FileNode;

                if (datfile == null || wadfile == null)
                {
                    continue;
                }

                AudioFormatGH3WiiFSB.Instance.Create(formatdata, datfile.Data, wadfile.Data);

                ChartFormatGH3.Instance.Create(formatdata, chartpak.Data, sectionfile.Data, coop == 1);

                data.AddSong(formatdata);
            }

            chartpak.Data.Close();

            return(true);
        }
Esempio n. 13
0
        public override bool AddSong(PlatformData data, SongData song, ProgressIndicator progress)
        {
            FormatData formatdata = new TemporaryFormatData(song, data);

            DirectoryNode songdir = data.Session["songdir"] as DirectoryNode;

            SongsDTA dta = HarmonixMetadata.GetSongsDTA(song);

            if (dta == null)               // LRB's <addsong />
            {
                dta            = HarmonixMetadata.GetSongData(song);
                dta.Song.Cores = new List <int>()
                {
                    -1, -1, -1, -1, -1, 1, 1, -1, -1
                };
                dta.Song.Vols = new List <float>()
                {
                    0, 0, 0, 0, 0, 0, 0, 0, 0
                };
                dta.Song.Pans = new List <float>()
                {
                    0, 0, -1, 1, 0, -1, 1, 0, 0
                };
                dta.Song.Tracks.Find(t => t.Name == "drum").Tracks.AddRange(new int[] { 0, 1, 2, 3 });
                dta.Song.Tracks.Find(t => t.Name == "bass").Tracks.AddRange(new int[] { 4 });
                dta.Song.Tracks.Find(t => t.Name == "guitar").Tracks.AddRange(new int[] { 5, 6 });
                dta.Song.Tracks.Find(t => t.Name == "vocals").Tracks.AddRange(new int[] { 7 });
                dta.Song.Name = "songs/" + song.ID + "/" + song.ID;
                HarmonixMetadata.SetSongsDTA(song, dta.ToDTB());
            }

            string dtaname = dta.Song.Name;

            if (dtaname.StartsWith("dlc"))
            {
                dtaname = dtaname.Split(new char[] { '/' }, 4)[3];
            }

            int    lastslash = dtaname.LastIndexOf('/');
            string basename  = dtaname.Substring(lastslash + 1);

            dtaname = dtaname.Substring(0, lastslash);
            DirectoryNode songnode = songdir.Navigate(dtaname) as DirectoryNode;

            if (songnode == null)
            {
                return(false);
            }

            FileNode    songaudiofile = songnode.Navigate(basename + ".bik", false, true) as FileNode;
            AudioFormat audio         = null;

            if (songaudiofile == null)
            {
                songaudiofile = songnode.Navigate(basename + ".mogg", false, true) as FileNode;
                if (songaudiofile == null)
                {
                    return(false);
                }
                if (HarmonixMetadata.IsRockBand1(data.Game))
                {
                    audio = HarmonixMetadata.GetAudioFormat(song);
                    audio.InitialOffset = 3000;
                }
                AudioFormatMogg.Instance.Create(formatdata, songaudiofile.Data, audio);
            }
            else
            {
                AudioFormatRB2Bink.Instance.Create(formatdata, songaudiofile.Data, null);
            }

            // TODO:	SongInfo
            // TODO:	Preview

            FileNode chartfile   = songnode.Find(basename + ".mid") as FileNode;
            FileNode panfile     = songnode.Find(basename + ".pan") as FileNode;
            FileNode weightsfile = songnode.Navigate("gen/" + basename + "_weights.bin") as FileNode;
            FileNode milofile    = songnode.Navigate("gen/" + basename + ".milo_wii") as FileNode;
            FileNode albumfile   = songnode.Navigate("gen/" + basename + "_keep.png_wii") as FileNode;

            if (chartfile == null)
            {
                return(false);
            }

            if (albumfile == null)
            {
                albumfile = songnode.Navigate("gen/" + basename + "_nomip_keep.bmp_wii") as FileNode;
            }

            if (albumfile != null)
            {
                song.AlbumArt = WiiImage.Create(new EndianReader(albumfile.Data, Endianness.LittleEndian)).Bitmap;
                albumfile.Data.Close();
            }

            ChartFormatRB.Instance.Create(formatdata, chartfile == null ? null : chartfile.Data, panfile == null ? null : panfile.Data, weightsfile == null ? null : weightsfile.Data, milofile == null ? null : milofile.Data, false, false, data.Game);

            data.AddSong(formatdata);

            return(true);
        }
Esempio n. 14
0
		public override PlatformData Create(string path, Game game, ProgressIndicator progress)
		{
			PlatformData data = new PlatformData(this, game);

			DirectoryNode maindir = DirectoryNode.FromPath(path, data.Cache, FileAccess.Read);

			char[] regions = new char[] { 'E', 'P' };

			DirectoryNode dir = maindir.Navigate("private/wii/data", false, true) as DirectoryNode;
			if (dir == null)
				dir = maindir;

			for (char letter = 'A'; letter <= 'Z'; letter++) {
				foreach (char region in regions) {
					DirectoryNode subdir = dir.Find("SZ" + letter + region, true) as DirectoryNode;
					if (subdir == null)
						continue;

					foreach (FileNode file in subdir.Files) {
						if (String.Compare(Path.GetExtension(file.Name), ".bin", true) != 0)
							continue;

						try {
							file.Data.Position = 0;
							DlcBin bin = new DlcBin(file.Data);
							U8 u8;
							try {
								u8 = new U8(bin.Data);
							} catch (FormatException) {
								file.Data.Close();
								continue;
							}
							FileNode songsdta = u8.Root.Find("songs.dta", SearchOption.AllDirectories) as FileNode;
							if (songsdta == null) {
								file.Data.Close();
								continue;
							}

							DTB.NodeTree dtb = DTA.Create(songsdta.Data);
							SongsDTA dta = SongsDTA.Create(dtb);
							file.Data.Close();
							
							SongData song = HarmonixMetadata.GetSongData(data, dtb);

							string contentbin = dta.Song.Name.Substring(9, 3); // Example, "dlc/sZAE/023/content/songs/simpleman/simpleman"

							FileNode contentfile = subdir.Find(contentbin + ".bin", true) as FileNode;
							if (contentfile == null)
								continue;

							FormatData formatdata = new TemporaryFormatData(song, data);

							Create(formatdata, file.Data, contentfile.Data);
							
							data.AddSong(formatdata);

							contentfile.Data.Close();
						} catch (FormatException) { } // Not a DLC bin we care about
					}
				}
			}

			return data;
		}