public void Create(FormatData data, Stream chart, Stream pan, Stream weights, Stream milo, bool expertplus, bool fixforquickplay, Game game) { int panversion = MiloVersion; int miloversion = Pan1Version; if (!HarmonixMetadata.IsRockBand1(game)) { panversion = PanVersion; } if (game == Game.RockBandGreenDay) { miloversion = Milo3Version; } Create(data, chart, pan, panversion, weights, milo, miloversion, expertplus, fixforquickplay); }
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); }