Ejemplo n.º 1
0
        public static void ConsToGp4(string conPath, string buildDir, bool eu, string id, string desc)
        {
            var songs = new List <DLCSong>();

            foreach (var conFilename in Directory.EnumerateFiles(conPath))
            {
                var         file = GameArchives.Util.LocalFile(conFilename);
                var         stfs = STFSPackage.IsSTFS(file);
                STFSPackage conFile;
                if (stfs != GameArchives.PackageTestResult.YES ||
                    null == (conFile = STFSPackage.OpenFile(file)) ||
                    conFile.Type != STFSType.CON)
                {
                    Console.WriteLine($"Skipping \"{conFilename}\": not a CON file");
                    continue;
                }
                songs.AddRange(ConvertDLCPackage(conFile.RootDirectory.GetDirectory("songs")));
            }

            if (songs.Count > 1)
            {
                if ((id?.Length ?? 0) < 16)
                {
                    throw new Exception("You must provide a 16 char ID if you are building a custom package with multiple songs");
                }
            }
            var pkgId = eu ? $"EP8802-CUSA02901_00-{id}" : $"UP8802-CUSA02084_00-{id}";

            DLCSongsToGP4(songs, pkgId, desc ?? "", buildDir, eu);
        }
Ejemplo n.º 2
0
        public static void ConsToGp4(string conPath, string buildDir, bool eu, string id, string desc)
        {
            var songs = new List <DLCSong>();

            foreach (var conFilename in Directory.EnumerateFiles(conPath))
            {
                var         file = GameArchives.Util.LocalFile(conFilename);
                var         stfs = STFSPackage.IsSTFS(file);
                STFSPackage conFile;
                if (stfs != GameArchives.PackageTestResult.YES ||
                    null == (conFile = STFSPackage.OpenFile(file)) ||
                    conFile.Type != STFSType.CON)
                {
                    Console.WriteLine($"Skipping \"{conFilename}\": not a CON file");
                    continue;
                }
                songs.AddRange(ConvertDLCPackage(conFile.RootDirectory.GetDirectory("songs")));
            }

            var identifier = id ?? GenId(songs.Select(s => s.SongData).ToList());
            var pkgId      = eu ? $"EP8802-CUSA02901_00-{identifier}" : $"UP8802-CUSA02084_00-{identifier}";
            var pkgDesc    = desc ?? GenDesc(songs.Select(s => s.SongData).ToList());

            DLCSongsToGP4(songs, pkgId, pkgDesc, buildDir, eu);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Does the whole process of converting a CON to a GP4 project
        /// </summary>
        /// <param name="conPath">Path to CON file</param>
        /// <param name="buildDir">Output directory for project and files</param>
        /// <param name="eu">If true then an SCEE project is made (otherwise, SCEA)</param>
        public static void ConToGp4(string conPath, string buildDir, bool eu = false, string id = null, string desc = null)
        {
            // Phase 1: Reading from CON
            var con = STFSPackage.OpenFile(GameArchives.Util.LocalFile(conPath));

            if (con.Type != STFSType.CON)
            {
                Console.WriteLine("Error: given file was not a CON file");
                return;
            }
            var songs = ConvertDLCPackage(con.RootDirectory.GetDirectory("songs"));

            if (songs.Count > 1)
            {
                if ((id?.Length ?? 0) < 16)
                {
                    throw new Exception("You must provide a 16 char ID if you are building a custom package with multiple songs");
                }
            }
            var identifier = id ?? GenId(songs[0]);
            var pkgId      = eu ? $"EP8802-CUSA02901_00-{identifier}" : $"UP8802-CUSA02084_00-{identifier}";
            var pkgDesc    = $"Custom: \"{songs[0].SongData.Name} - {songs[0].SongData.Artist}\"";

            DLCSongsToGP4(songs, pkgId, desc ?? pkgDesc, buildDir, eu);
        }
Ejemplo n.º 4
0
 private void buildButton_Click(object sender, EventArgs e)
 {
     using (var sfd = new SaveFileDialog()
     {
         FileName = contentIdTextBox.Text + ".pkg"
     })
     {
         if (sfd.ShowDialog() == DialogResult.OK)
         {
             Action <string> log = x => logBox.AppendText(x + Environment.NewLine);
             log("Converting DLC files...");
             var cons  = listBox1.Items.OfType <string>().Select(f => STFSPackage.OpenFile(GameArchives.Util.LocalFile(f))).ToList();
             var songs = new List <LibForge.DLCSong>();
             foreach (var con in cons)
             {
                 songs.AddRange(PkgCreator.ConvertDLCPackage(
                                    con.RootDirectory.GetDirectory("songs"),
                                    volumeAdjustCheckBox.Checked,
                                    s => log($"Warning ({con.FileName}): " + s)));
             }
             log("Building PKG...");
             PkgCreator.BuildPkg(songs, contentIdTextBox.Text, descriptionBox.Text, euCheckBox.Checked, sfd.FileName, log);
             foreach (var con in cons)
             {
                 con.Dispose();
             }
         }
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Does the whole process of converting a CON to a GP4 project
        /// </summary>
        /// <param name="conPath">Path to CON file</param>
        /// <param name="buildDir">Output directory for project and files</param>
        /// <param name="eu">If true then an SCEE project is made (otherwise, SCEA)</param>
        public static void ConToGp4(string conPath, string buildDir, bool eu = false, string id = null, string desc = null)
        {
            // Phase 1: Reading from CON
            var con = STFSPackage.OpenFile(GameArchives.Util.LocalFile(conPath));

            if (con.Type != STFSType.CON)
            {
                Console.WriteLine("Error: given file was not a CON file");
                return;
            }
            var songs = ConvertDLCPackage(con.RootDirectory.GetDirectory("songs"));

            if (songs.Count > 1)
            {
                if ((id?.Length ?? 0) < 16)
                {
                    throw new Exception("You must provide a 16 char ID if you are building a custom package with multiple songs");
                }
            }
            var shortname = songs[0].SongData.Shortname;
            var pkgName   = new Regex("[^a-zA-Z0-9]").Replace(shortname, "")
                            .ToUpper().Substring(0, Math.Min(shortname.Length, 10)).PadRight(10, 'X');
            string pkgNum     = (songs[0].SongData.SongId % 10000).ToString().PadLeft(4, '0');
            var    identifier = id ?? ("RB" + pkgName + pkgNum);
            var    pkgId      = eu ? $"EP8802-CUSA02901_00-{identifier}" : $"UP8802-CUSA02084_00-{identifier}";
            var    pkgDesc    = $"Custom: \"{songs[0].SongData.Name} - {songs[0].SongData.Artist}\"";

            DLCSongsToGP4(songs, pkgId, desc ?? pkgDesc, buildDir);
        }
Ejemplo n.º 6
0
        private bool LoadCon(string filename)
        {
            con = STFSPackage.OpenFile(GameArchives.Util.LocalFile(filename));
            if (con.Type != STFSType.CON)
            {
                MessageBox.Show("Error: given file was not a CON file");
                return(false);
            }
            var songs = PkgCreator.ConvertDLCPackage(con.RootDirectory.GetDirectory("songs"));

            idBox.Text          = PkgCreator.GenId(songs[0]);
            descriptionBox.Text = $"Custom: \"{songs[0].SongData.Name} - {songs[0].SongData.Artist}\"";
            groupBox2.Enabled   = true;
            return(true);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Does the whole process of converting a CON to a GP4 project
        /// </summary>
        /// <param name="conPath">Path to CON file</param>
        /// <param name="buildDir">Output directory for project and files</param>
        /// <param name="eu">If true then an SCEE project is made (otherwise, SCEA)</param>
        public static void ConToGp4(string conPath, string buildDir, bool eu = false, string id = null, string desc = null)
        {
            // Phase 1: Reading from CON
            var con = STFSPackage.OpenFile(GameArchives.Util.LocalFile(conPath));

            if (con.Type != STFSType.CON)
            {
                Console.WriteLine("Error: given file was not a CON file");
                return;
            }
            var songs      = ConvertDLCPackage(con.RootDirectory.GetDirectory("songs"));
            var identifier = id ?? GenId(songs.Select(s => s.SongData).ToList());
            var pkgId      = eu ? $"EP8802-CUSA02901_00-{identifier}" : $"UP8802-CUSA02084_00-{identifier}";
            var pkgDesc    = GenDesc(songs.Select(s => s.SongData).ToList());

            DLCSongsToGP4(songs, pkgId, desc ?? pkgDesc, buildDir, eu);
        }
Ejemplo n.º 8
0
 private bool LoadCon(string filename)
 {
     using (var con = STFSPackage.OpenFile(GameArchives.Util.LocalFile(filename)))
     {
         if (con.Type != STFSType.CON)
         {
             throw new Exception($"File is not a CON file.");
         }
         var datas = PkgCreator.GetSongMetadatas(con.RootDirectory.GetDirectory("songs"));
         if (datas.Count > 0)
         {
             dtas[filename] = datas;
             listBox1.Items.Add(filename);
         }
     }
     return(true);
 }