Exemplo n.º 1
0
        private static double ParseFloat(BinaryReaderExt d, GXAnimDataFormat Format, float Scale)
        {
            d.BigEndian = false;
            switch (Format)
            {
            case GXAnimDataFormat.HSD_A_FRAC_FLOAT:
                return(d.ReadSingle());

            case GXAnimDataFormat.HSD_A_FRAC_S16:
                return(d.ReadInt16() / (double)Scale);

            case GXAnimDataFormat.HSD_A_FRAC_U16:
                return(d.ReadUInt16() / (double)Scale);

            case GXAnimDataFormat.HSD_A_FRAC_S8:
                return(d.ReadSByte() / (double)Scale);

            case GXAnimDataFormat.HSD_A_FRAC_U8:
                return(d.ReadByte() / (double)Scale);

            default:
                return(0);
            }
        }
Exemplo n.º 2
0
        private static void ParseDebugLine(BinaryReaderExt r)
        {
            // read header
            var debug_line_header = new ELF_Debug_Line()
            {
                length                 = r.ReadUInt32(),
                version                = r.ReadUInt16(),
                header_length          = r.ReadUInt32(),
                min_instruction_length = r.ReadByte(),
                default_is_stmt        = r.ReadByte(),
                line_base              = r.ReadSByte(),
                line_range             = r.ReadByte(),
                opcode_base            = r.ReadByte(),
                std_opcode_lengths     = new byte[12]
            };

            for (int k = 0; k < 12; k++)
            {
                debug_line_header.std_opcode_lengths[k] = r.ReadByte();
            }

            // read directories
            while (r.PeekChar() != 0)
            {
                Debug.WriteLine(r.ReadString());
            }
            r.Skip(1);

            // read files
            while (r.PeekChar() != 0)
            {
                Debug.WriteLine(r.ReadString() + " " + r.ReadByte() + " " + r.ReadByte() + " " + r.ReadByte());
            }

            r.PrintPosition();

            int  address        = 0;
            int  op_index       = 0;
            int  file           = 1;
            int  line           = 1;
            int  column         = 0;
            bool is_stmt        = debug_line_header.default_is_stmt != 0;
            bool basic_block    = false;
            bool end_sequence   = false;
            bool prologue_end   = false;
            bool epilogue_begin = false;
            int  isa            = 0;
            int  dicriminator   = 0;

            var op_code_start = r.Position;

            while (true)
            {
                var op = r.ReadByte();

                switch (op)
                {
                case 0:
                    // extended byte
                    ReadLEB123(r);
                    break;
                }
            }
        }