示例#1
0
        public static int Import(List <string> args)
        {
            if (args.Count < 3)
            {
                Console.WriteLine("Usage: bscr Database GracesJapanese");
                return(-1);
            }

            string InFile         = args[0];
            string OutDatabase    = args[1];
            string GracesJapanese = args[2];

            HyoutaTools.LastRanker.bscr bscrFile = new HyoutaTools.LastRanker.bscr(System.IO.File.ReadAllBytes(InFile));
            GraceNoteUtil.GenerateEmptyDatabase(OutDatabase);

            List <GraceNoteDatabaseEntry> Entries = new List <GraceNoteDatabaseEntry>(bscrFile.Strings.Count);

            foreach (HyoutaTools.LastRanker.bscrString e in bscrFile.Strings)
            {
                int status = 0;
                if (e.String.StartsWith("func") || e.String.StartsWith("■") || e.String.Trim() == "")
                {
                    status = -1;
                }

                GraceNoteDatabaseEntry gn = new GraceNoteDatabaseEntry(e.String, e.String, "", status, (int)e.Position, "", 0);
                Entries.Add(gn);
            }

            GraceNoteDatabaseEntry.InsertSQL(Entries.ToArray(), "Data Source=" + OutDatabase, "Data Source=" + GracesJapanese);

            return(0);
        }
示例#2
0
        public static int Execute(List <string> args)
        {
            if (args.Count != 4)
            {
                Console.WriteLine("Usage: btlpack_GraceNote btlpackexFile NewDBFile GracesJapanese StartOfTextpointersInHex");
                return(-1);
            }

            String Filename            = args[0];
            String NewDB               = args[1];
            String GracesDB            = args[2];
            int    TextPointersAddress = Int32.Parse(args[3], System.Globalization.NumberStyles.AllowHexSpecifier);

            byte[] btlpack = System.IO.File.ReadAllBytes(Filename);
            byte[] PointerDifferenceBytes = { btlpack[0x27], btlpack[0x26], btlpack[0x25], btlpack[0x24] };
            int    PointerDifference      = BitConverter.ToInt32(PointerDifferenceBytes, 0);

            PointerDifference -= 0x400;


            ScenarioString[] AllStrings = FindAllStrings(btlpack, TextPointersAddress, PointerDifference);
            GraceNoteUtil.GenerateEmptyDatabase(NewDB);

            List <GraceNoteDatabaseEntry> Entries = new List <GraceNoteDatabaseEntry>(AllStrings.Length);

            foreach (ScenarioString str in AllStrings)
            {
                GraceNoteDatabaseEntry gn = new GraceNoteDatabaseEntry(str.Jpn, str.Eng, "", str.Eng == str.Jpn ? 1 : 0, str.Pointer, "", 0);
                Entries.Add(gn);
            }
            GraceNoteDatabaseEntry.InsertSQL(Entries.ToArray(), "Data Source=" + NewDB, "Data Source=" + GracesDB);

            return(0);
        }
示例#3
0
        public static int Execute(List <string> args)
        {
            string string_dic     = args[0];
            string databasename   = args[1];
            string gracesjapanese = args[2];

            TSSFile TSS;

            try {
                TSS = new TSSFile(System.IO.File.ReadAllBytes(string_dic));
            } catch (System.IO.FileNotFoundException) {
                Console.WriteLine("Could not open STRING_DIC.SO, exiting.");
                return(-1);
            }


            List <GraceNoteDatabaseEntry> entries = new List <GraceNoteDatabaseEntry>();

            foreach (TSSEntry e in TSS.Entries)
            {
                GraceNoteDatabaseEntry g = new GraceNoteDatabaseEntry(e.StringJpn, e.StringEng);
                entries.Add(g);
            }

            GraceNoteUtil.GenerateEmptyDatabase(databasename);
            GraceNoteDatabaseEntry.InsertSQL(entries.ToArray(), "Data Source=" + databasename, "Data Source=" + gracesjapanese);


            return(0);
        }
示例#4
0
        public static int Import(List <string> args)
        {
            if (args.Count < 3)
            {
                Console.WriteLine("Usage: sscr Database GracesJapanese");
                return(-1);
            }

            string InFile         = args[0];
            string OutDatabase    = args[1];
            string GracesJapanese = args[2];
            SSCR   SscrFile       = new SSCR(System.IO.File.ReadAllBytes(InFile));

            GraceNoteUtil.GenerateEmptyDatabase(OutDatabase);

            List <GraceNoteDatabaseEntry> Entries = new List <GraceNoteDatabaseEntry>(SscrFile.Names.Count + SscrFile.SystemTerms.Count + SscrFile.Somethings.Count);

            foreach (var x in SscrFile.Names)
            {
                Entries.Add(new GraceNoteDatabaseEntry(x.Name, x.Name, "", 0, 1, x.Id, (int)x.Unknown));
            }
            foreach (var x in SscrFile.SystemTerms)
            {
                Entries.Add(new GraceNoteDatabaseEntry(x.Term, x.Term, "", 0, 2, "", (int)x.Unknown));
            }
            foreach (var x in SscrFile.Somethings)
            {
                Entries.Add(new GraceNoteDatabaseEntry(x.Text, x.Text, "", 0, 3, x.Id, (int)x.Unknown4));
            }

            GraceNoteDatabaseEntry.InsertSQL(Entries.ToArray(), "Data Source=" + OutDatabase, "Data Source=" + GracesJapanese);

            return(0);
        }
示例#5
0
        public static int Execute(List <string> args)
        {
            if (args.Count != 3)
            {
                Console.WriteLine("Usage: XilliaScript_GraceNote XilliaScriptFile NewDBFile GracesJapanese");
                return(-1);
            }
            String Filename = args[0];
            String NewDB    = args[1];
            String GracesDB = args[2];

            SDB XSF = new SDB(Filename);

            GraceNoteUtil.GenerateEmptyDatabase(NewDB);
            if (!System.IO.File.Exists(GracesDB))
            {
                GraceNoteUtil.GenerateEmptyGracesJapanese(GracesDB);
            }

            List <GraceNoteDatabaseEntry> Entries = new List <GraceNoteDatabaseEntry>(XSF.TextList.Count);

            foreach (SDBEntry entry in XSF.TextList)
            {
                GraceNoteDatabaseEntry gn = new GraceNoteDatabaseEntry(entry.Text, entry.Text, "", 0, (int)entry.PointerText, entry.IDString, (int)entry.PointerIDString);
                Entries.Add(gn);
            }

            GraceNoteDatabaseEntry.InsertSQL(Entries.ToArray(), "Data Source=" + NewDB, "Data Source=" + GracesDB);

            return(0);
        }
示例#6
0
        public static int Execute(List <string> args)
        {
            if (args.Count != 3)
            {
                Console.WriteLine("Usage: VVoicesGenerate VOBTLdir VVoices.db GracesJapanese.db");
                return(-1);
            }

            String VOBTLDir = args[0];
            String VoiceDB  = args[1];
            String GracesDB = args[2];

            String[] VOBTLFiles = System.IO.Directory.GetFiles(VOBTLDir);

            List <GraceNoteDatabaseEntry> Entries = new List <GraceNoteDatabaseEntry>();

            foreach (String VOBTL in VOBTLFiles)
            {
                String VOBTLcut = VOBTL.Substring(VOBTL.LastIndexOfAny(new char[] { '/', '\\' }) + 1);
                if (VOBTLcut.Contains('.'))
                {
                    VOBTLcut = VOBTLcut.Remove(VOBTLcut.LastIndexOf('.'));
                }
                String s = "\t(" + VOBTLcut + ')';
                Entries.Add(new GraceNoteDatabaseEntry(s, s, "", 0, 0, "", 0));
            }

            GraceNoteDatabaseEntry.InsertSQL(Entries.ToArray(), "Data Source=" + VoiceDB, "Data Source=" + GracesDB);

            return(0);
        }
示例#7
0
        public static int Import(List <string> args)
        {
            if (args.Count < 3)
            {
                Console.WriteLine("Usage: scr Database GracesJapanese");
                return(-1);
            }

            string InFile         = args[0];
            string OutDatabase    = args[1];
            string GracesJapanese = args[2];
            var    bscrFile       = new HyoutaTools.Narisokonai.scr(System.IO.File.ReadAllBytes(InFile));

            GraceNoteUtil.GenerateEmptyDatabase(OutDatabase);
            if (!System.IO.File.Exists(GracesJapanese))
            {
                GraceNoteUtil.GenerateEmptyGracesJapanese(GracesJapanese);
            }

            List <GraceNoteDatabaseEntry> Entries = new List <GraceNoteDatabaseEntry>();

            foreach (var sec in bscrFile.Sections)
            {
                if (sec.Elements == null)
                {
                    continue;                                         // dummy section
                }
                GraceNoteDatabaseEntry gn;

                foreach (var e in sec.Elements)
                {
                    switch (e.Type)
                    {
                    case HyoutaTools.Narisokonai.scrElement.scrElementType.Code:
                        StringBuilder sb = new StringBuilder();
                        for (int i = 0; i < e.Code.Length; ++i)
                        {
                            sb.Append('<').Append(e.Code[i].ToString("X2")).Append("> ");
                        }
                        gn = new GraceNoteDatabaseEntry(sb.ToString(), sb.ToString(), "", -1, (int)sec.Location, e.Type.ToString(), sec.PointerIndex);
                        break;

                    case HyoutaTools.Narisokonai.scrElement.scrElementType.Text:
                        gn = new GraceNoteDatabaseEntry(e.Text, e.Text, "", 0, (int)sec.Location, e.Type.ToString(), sec.PointerIndex);
                        break;

                    default:
                        throw new Exception("scrImport: Unknown Element Type!");
                    }
                    Entries.Add(gn);
                }
            }

            GraceNoteDatabaseEntry.InsertSQL(Entries.ToArray(), "Data Source=" + OutDatabase, "Data Source=" + GracesJapanese);

            return(0);
        }
示例#8
0
        public static int Import(String Filename, String NewDB, String GracesDB)
        {
            LIN lin;

            try {
                lin = new LIN(Filename);
            } catch (Exception ex) {
                Console.WriteLine(ex.Message);
                Console.WriteLine("Failed loading text file!");
                return(-1);
            }

            Console.WriteLine("Importing...");
            GraceNoteUtil.GenerateEmptyDatabase(NewDB);

            List <GraceNoteDatabaseEntry> Entries = new List <GraceNoteDatabaseEntry>();

            string TextToInsert = "";

            foreach (ScriptEntry s in lin.ScriptData)
            {
                if (s.Type == 0x02)
                {
                    Entries.Add(new GraceNoteDatabaseEntry(TextToInsert, TextToInsert, "", -1, 1, "[Game Code]", 0));
                    Entries.Add(new GraceNoteDatabaseEntry(s.Text, s.Text, "", 0, 2, s.IdentifyString, 0));
                    TextToInsert = "";
                    continue;
                }
                TextToInsert = TextToInsert + s.FormatForGraceNote() + '\n';
            }
            if (TextToInsert != null)
            {
                Entries.Add(new GraceNoteDatabaseEntry(TextToInsert, TextToInsert, "", -1, 1, "[Game Code]", 0));
            }
            if (lin.UnreferencedText != null)
            {
                foreach (KeyValuePair <int, string> u in lin.UnreferencedText)
                {
                    Entries.Add(new GraceNoteDatabaseEntry(u.Value, u.Value, "", 0, 3, "[Unreferenced Text]", u.Key));
                }
            }
            GraceNoteDatabaseEntry.InsertSQL(Entries.ToArray(), "Data Source=" + NewDB, "Data Source=" + GracesDB);

            Console.WriteLine("Successfully imported entries!");
            return(0);
        }
示例#9
0
        public static int Execute(List <string> args)
        {
            if (args.Count != 3)
            {
                Console.WriteLine("Usage: TO8CHTX_GraceNote ChatFilename NewDBFilename GracesJapanese");
                return(-1);
            }

            String Filename = args[0];
            String NewDB    = args[1];
            String GracesDB = args[2];

            ChatFile c = new ChatFile(System.IO.File.ReadAllBytes(Filename));

            GraceNoteUtil.GenerateEmptyDatabase(NewDB);

            List <GraceNoteDatabaseEntry> Entries = new List <GraceNoteDatabaseEntry>(c.Lines.Length * 2);

            foreach (ChatFileLine Line in c.Lines)
            {
                String EnglishText;
                int    EnglishStatus;
                if (Line.SENG == "Dummy" || Line.SENG == "")
                {
                    EnglishText   = Line.SJPN;
                    EnglishStatus = 0;
                }
                else
                {
                    EnglishText   = Line.SENG;
                    EnglishStatus = 1;
                }

                Entries.Add(new GraceNoteDatabaseEntry(Line.SName, Line.SName, "", 1, Line.Location, "", 0));
                Entries.Add(new GraceNoteDatabaseEntry(Line.SJPN, EnglishText, "", EnglishStatus, Line.Location + 4, "", 0));
            }

            GraceNoteDatabaseEntry.InsertSQL(Entries.ToArray(), "Data Source=" + NewDB, "Data Source=" + GracesDB);
            return(0);
        }
示例#10
0
        public static int Execute(List <string> args)
        {
            if (args.Count != 3)
            {
                Console.WriteLine("Usage: menu.pak NewDBFile GracesJapanese");
                return(-1);
            }

            String Filename = args[0];
            String NewDB    = args[1];
            String GracesDB = args[2];

            PakText DRMF;

            try {
                DRMF = new PakText(Filename);
            } catch (Exception ex) {
                Console.WriteLine(ex.Message);
                Console.WriteLine("Failed loading menu file!");
                return(-1);
            }
            Console.WriteLine("Found " + DRMF.TextList.Count + " entries, importing...");
            GraceNoteUtil.GenerateEmptyDatabase(NewDB);

            List <GraceNoteDatabaseEntry> Entries = new List <GraceNoteDatabaseEntry>(DRMF.TextList.Count);

            foreach (PakTextEntry entry in DRMF.TextList)
            {
                GraceNoteDatabaseEntry gn = new GraceNoteDatabaseEntry(entry.Text, entry.Text, "", 0, entry.OffsetLocation, "", 0);
                Entries.Add(gn);
            }
            GraceNoteDatabaseEntry.InsertSQL(Entries.ToArray(), "Data Source=" + NewDB, "Data Source=" + GracesDB);

            Console.WriteLine("Successfully imported entries!");

            //byte[] newfile = DRMF.CreateFile();
            //System.IO.File.WriteAllBytes(Filename + ".new", newfile);

            return(0);
        }
示例#11
0
        public static bool Import(String filename, String newDb, String gracesJapanese)
        {
            BlazeUnionScriptFile          scriptfile = new BlazeUnionScriptFile(filename);
            List <GraceNoteDatabaseEntry> entries    = new List <GraceNoteDatabaseEntry>();

            GraceNoteUtil.GenerateEmptyDatabase(newDb);
            if (!System.IO.File.Exists(gracesJapanese))
            {
                GraceNoteUtil.GenerateEmptyGracesJapanese(gracesJapanese);
            }

            foreach (var section in scriptfile.Sections)
            {
                foreach (var kvp in section.Strings)
                {
                    entries.Add(new GraceNoteDatabaseEntry(kvp.Value, PointerRef: (int)kvp.Key));
                }
            }

            GraceNoteDatabaseEntry.InsertSQL(entries.ToArray(), "Data Source=" + newDb, "Data Source=" + gracesJapanese);

            return(true);
        }
示例#12
0
        public static int Execute(List <string> args)
        {
            if (args.Count != 4)
            {
                Console.WriteLine("Usage: TropSFM_GraceNote TROP.SFM TROPCONF.SFM NewDBFile GracesJapanese");
                return(-1);
            }

            String Filename         = args[0];
            String FilenameTropConf = args[1];
            String NewDB            = args[2];
            String GracesDB         = args[3];

            TrophyConfNode TROPSFM = TrophyConfNode.ReadTropSfmWithTropConf(Filename, FilenameTropConf);

            GraceNoteUtil.GenerateEmptyDatabase(NewDB);

            List <GraceNoteDatabaseEntry> Entries = new List <GraceNoteDatabaseEntry>(TROPSFM.Trophies.Values.Count * 2);

            foreach (TrophyNode Trophy in TROPSFM.Trophies.Values)
            {
                string Ident = "<ID: " + Trophy.ID + "> "
                               + "<Hidden: " + Trophy.Hidden.ToString() + "> "
                               + "<TType: " + Trophy.TType + "> "
                               + "<PID: " + Trophy.PID + ">";
                Entries.Add(new GraceNoteDatabaseEntry(Trophy.Name, Trophy.Name, "", 0, 0, Ident, 0));
                Entries.Add(new GraceNoteDatabaseEntry(Trophy.Detail, Trophy.Detail, "", 0, 1, Ident, 0));
            }

            GraceNoteDatabaseEntry.InsertSQL(Entries.ToArray(), "Data Source=" + NewDB, "Data Source=" + GracesDB);

            //System.IO.File.WriteAllBytes(@"C:\TROPHY\newTrophyConf.trp", Encoding.UTF8.GetBytes(TROPSFM.ExportTropSFM(true)));
            //System.IO.File.WriteAllBytes(@"C:\TROPHY\newTrophy.trp", Encoding.UTF8.GetBytes(TROPSFM.ExportTropSFM(false)));

            return(0);
        }
示例#13
0
        public static int Execute(List <string> args)
        {
            if (args.Count != 4)
            {
                Console.WriteLine("Usage: LuxPainEvt_GraceNote event.evt NewDBFile GracesJapanese event.jp.evt");
                return(-1);
            }
            String Filename         = args[0];
            String NewDB            = args[1];
            String GracesDB         = args[2];
            String JapaneseFilename = args[3];

            LuxPainEvt Evt;
            LuxPainEvt EvtJp;

            try {
                Evt   = new LuxPainEvt(Filename);
                EvtJp = new LuxPainEvt(JapaneseFilename);
            } catch (Exception ex) {
                Console.WriteLine(ex.Message);
                Console.WriteLine("Failed loading text file!");
                return(-1);
            }
            Evt.FormatTextForEditing();
            EvtJp.FormatTextForEditing();

            if (Evt.TextEntries.Count != EvtJp.TextEntries.Count)
            {
                Console.WriteLine("Entry count over languages doesn't match, padding...");

                while (Evt.TextEntries.Count < EvtJp.TextEntries.Count)
                {
                    LuxPainEvtText t = new LuxPainEvtText();
                    t.OffsetLocation = 0x7FFFFFFF;
                    t.Text           = "[Entry does not exist in this language, this is just for completion's sake.]";
                    Evt.TextEntries.Add(t);
                }

                while (Evt.TextEntries.Count > EvtJp.TextEntries.Count)
                {
                    LuxPainEvtText t = new LuxPainEvtText();
                    t.OffsetLocation = 0x7FFFFFFF;
                    t.Text           = "[Entry does not exist in this language, this is just for completion's sake.]";
                    EvtJp.TextEntries.Add(t);
                }

                if (Evt.TextEntries.Count != EvtJp.TextEntries.Count)
                {
                    throw new Exception("this shouldn't happen!");
                }
            }

            Console.WriteLine("Found " + Evt.TextEntries.Count + " entries, importing...");
            GraceNoteUtil.GenerateEmptyDatabase(NewDB);

            List <GraceNoteDatabaseEntry> Entries = new List <GraceNoteDatabaseEntry>(Evt.TextEntries.Count);

            for (int i = 0; i < Evt.TextEntries.Count; ++i)
            {
                // fetch GracesJapanese ID or generate new & insert new text
                String EnPlusJp           = Evt.TextEntries[i].Text + "\n\n" + EvtJp.TextEntries[i].Text;
                GraceNoteDatabaseEntry gn =
                    new GraceNoteDatabaseEntry(EnPlusJp, Evt.TextEntries[i].Text, "", 0, (int)Evt.TextEntries[i].OffsetLocation, "", 0);
                Entries.Add(gn);
            }
            GraceNoteDatabaseEntry.InsertSQL(Entries.ToArray(), "Data Source=" + NewDB, "Data Source=" + GracesDB);
            Console.WriteLine("Successfully imported entries!");

            return(0);
        }