コード例 #1
0
        private Dictionary <ulong, string> generateLyrics()
        {
            VocalsConverter converter = new VocalsConverter();

            return(converter.lyricTable);
        }
コード例 #2
0
        private byte[] generateVocals()
        {
            VocalsConverter converter = new VocalsConverter();
            List <MID2RIF.VocalsConverter.VoxNote> notes = converter.notes;

            List <byte> outByte = new List <byte>();

            outByte.Add(0x00);
            outByte.Add(0x00);
            outByte.Add(0x00);
            outByte.Add(0x08);

            outByte.Add(0x00);
            outByte.Add(0x00);
            outByte.Add(0x00);
            outByte.Add(0x20);

            int numEntries = notes.Count;

            byte[] numEntries_byte = BitConverter.GetBytes(numEntries).Reverse().ToArray();
            outByte.Add(numEntries_byte[0]);
            outByte.Add(numEntries_byte[1]);
            outByte.Add(numEntries_byte[2]);
            outByte.Add(numEntries_byte[3]);

            outByte.Add(0x00);
            outByte.Add(0x00);
            outByte.Add(0x00);
            outByte.Add(0x04);

            foreach (MID2RIF.VocalsConverter.VoxNote note in notes)
            {
                byte[] start = BitConverter.GetBytes((float)note.start).Reverse().ToArray();
                for (int i = 0; i < start.Length; i++)
                {
                    outByte.Add(start[i]);
                }

                byte[] end = BitConverter.GetBytes((float)note.end).Reverse().ToArray();
                for (int i = 0; i < end.Length; i++)
                {
                    outByte.Add(end[i]);
                }

                outByte.Add(0x00);
                outByte.Add(0x00);
                outByte.Add(note.pitch);
                outByte.Add(note.unknownValue);

                outByte.Add(0x00);
                outByte.Add(0x00);
                outByte.Add(0x00);
                outByte.Add(0x00);

                byte[] key = BitConverter.GetBytes((ulong)note.key).Reverse().ToArray();
                for (int i = 0; i < key.Length; i++)
                {
                    outByte.Add(key[i]);
                }


                outByte.Add(0x00);
                outByte.Add(0x00);
                outByte.Add(0x00);
                outByte.Add(note.noteType);

                outByte.Add(0x00);
                outByte.Add(0x00);
                outByte.Add(0x00);
                outByte.Add(0x00);
            }

            return(outByte.ToArray());
        }
コード例 #3
0
        /// <summary>
        /// Deals with all forms of string tables
        /// </summary>
        /// <param name="section">Section to analyze</param>
        public void stblHelper(byte[] section)
        {
            // Get the index key
            int   index = 0;
            ulong indexKey;

            byte[] indexKey_byte = new byte[8];

            int i = index;

            for (; index < i + 8; index++)
            {
                indexKey_byte[index - i] = section[index];
            }

            indexKey = BitConverter.ToUInt64(indexKey_byte.Reverse().ToArray(), 0);

            // Get the folder key
            ulong folderKey;

            byte[] folderKey_byte = new byte[8];

            i = index;
            for (; index < i + 8; index++)
            {
                folderKey_byte[index - i] = section[index];
            }

            folderKey = BitConverter.ToUInt64(folderKey_byte.Reverse().ToArray(), 0);

            // Get the language identifier
            long language;

            byte[] stblIdentifier = new byte[8];

            i = index;
            for (; index < i + 8; index++)
            {
                stblIdentifier[index - i] = section[index];
            }

            language = BitConverter.ToInt64(stblIdentifier.Reverse().ToArray(), 0);

            // Skip zeroed data
            index += 8;

            // Get the count of entries
            int countEntries;

            byte[] countEntries_byte = new byte[4];
            i = index;

            for (; index < i + 4; index++)
            {
                countEntries_byte[index - i] = section[index];
            }

            countEntries = BitConverter.ToInt32(countEntries_byte.Reverse().ToArray(), 0);

            // Skip over data that is always 12
            index += 4;

            // Get the size of the string table
            int tableSize;

            byte[] tableSize_byte = new byte[4];
            i = index;

            for (; index < i + 4; index++)
            {
                tableSize_byte[index - i] = section[index];
            }

            tableSize = BitConverter.ToInt32(tableSize_byte.Reverse().ToArray(), 0);

            // Get the size of data leading up to the table
            int sizeKeys;

            byte[] sizeKeys_byte = new byte[4];
            i = index;

            for (; index < i + 4; index++)
            {
                sizeKeys_byte[index - i] = section[index];
            }

            sizeKeys = BitConverter.ToInt32(sizeKeys_byte.Reverse().ToArray(), 0);
            StringTable tempTable = new StringTable();

            tempTable.stringTable = parser.generateDictionary(section, index, countEntries);
            if (tempTable.stringTable.ContainsValue("whoo!#"))
            {
                tempTable.stringTable          = generateLyrics();
                tempTable.folderKey            = folderKey;
                tempTable.indexKey             = indexKey;
                tempTable.languageIdentifier   = language;
                tempTable.sizeLeadingUpToTable = (tempTable.stringTable.Count * 16) + 4;
                VocalsConverter converter = new VocalsConverter();
                tempTable.sizeTable  = converter.size;
                tempTable.numEntries = tempTable.stringTable.Count;
            }
            else
            {
                tempTable.folderKey            = folderKey;
                tempTable.indexKey             = indexKey;
                tempTable.languageIdentifier   = language;
                tempTable.sizeTable            = tableSize;
                tempTable.sizeLeadingUpToTable = sizeKeys;
                tempTable.numEntries           = tempTable.stringTable.Count;
            }

            list_stringtable.Add(tempTable);
        }