Example #1
0
        //Makes Object Entry
        public mldObjectEntry makeObjEntry(byte[] arr, int cursor, bool endian)
        {
            byte[] b = new byte[4];
            for (int i = 0; i <= 3; i++)
            {
                b[i] = arr[i + cursor];
            }

            if (endian)
            {
                Array.Reverse(b);
            }
            cursor = BitConverter.ToInt32(b, 0);

            mldObjectEntry objEntry = new mldObjectEntry();

            for (int i = 0; i <= 3; i++)
            {
                b[i] = arr[i + cursor];
            }

            if (endian)
            {
                Array.Reverse(b);
            }
            objEntry.Object = BitConverter.ToInt32(b, 0) + cursor;

            for (int i = 0; i <= 3; i++)
            {
                b[i] = arr[i + cursor + 4];
            }

            if (endian)
            {
                Array.Reverse(b);
            }
            objEntry.Motion = BitConverter.ToInt32(b, 0) + cursor;

            for (int i = 0; i <= 3; i++)
            {
                b[i] = arr[i + cursor + 8];
            }

            if (endian)
            {
                Array.Reverse(b);
            }
            objEntry.TexList = BitConverter.ToInt32(b, 0) + cursor;

            return(objEntry);
        }
Example #2
0
        //Makes Object Master - probably will need to change this when I learn where the total is stored, and how to process each different entry
        public mldObjectMaster makeObjMaster(byte[] arr, int cursor, bool endian)
        {
            //Not entirely sure where the entry total is located/how to get it, so this may not be accurate
            mldObjectMaster objMaster = new mldObjectMaster();

            byte[] b = new byte[4];
            for (int i = 0; i <= 3; i++)
            {
                b[i] = arr[i + cursor];
            }

            if (endian)
            {
                Array.Reverse(b);
            }
            cursor = BitConverter.ToInt32(b, 0);

            /*for (int i = 0; i <= 3; i++)
             * {
             *  b[i] = arr[i + cursor];
             * }
             *
             * if (endian)
             *  Array.Reverse(b);
             * objMaster.objEntryTotal = BitConverter.ToInt32(b, 0);*/
            objMaster.objEntryTotal = 1;

            mldObjectEntry[] entryArr = new mldObjectEntry[objMaster.objEntryTotal];
            for (int i = 0; i < objMaster.objEntryTotal; i++)
            {
                cursor     += 4;
                entryArr[i] = makeObjEntry(arr, cursor, endian);
            }
            objMaster.objEntry = new mldObjectEntry[objMaster.objEntryTotal];

            return(objMaster);
        }