Exemplo n.º 1
0
 public BRESHeader(int size, int numSections)
 {
     _tag = Tag;
     _endian = 0xFEFF;
     _version = 0;
     _fileSize = (uint)size;
     _rootOffset = 0x10;
     _numSections = (ushort)numSections;
 }
        public I4Entry(int index, int step, float tangent)
        {
            tangent *= 32.0f;
            if (tangent < 0)
                tangent -= 0.5f;
            else
                tangent += 0.5f;

            _data = (uint)((index << 24) | ((step & 0xFFF) << 12) | (((int)tangent).Clamp(-2048, 2047) & 0xFFF));
        }
Exemplo n.º 3
0
        public PLT0v1(int length, WiiPaletteFormat format)
        {
            _bresEntry._tag = Tag;
            _bresEntry._size = (length * 2) + Size;
            _bresEntry._version = 1;
            _bresEntry._bresOffset = 0;

            _headerLen = 0x40;
            _stringOffset = 0;
            _pixelFormat = (uint)format;
            _numEntries = (short)length;
            _pad = 0;
            _origPathOffset = 0;
        }
 public bool this[int index]
 {
     get { return((_data >> index & 1) != 0); }
     set
     {
         if (value)
         {
             _data |= (uint)(1 << index);
         }
         else
         {
             _data &= ~(uint)(1 << index);
         }
     }
 }
Exemplo n.º 5
0
 public REFTImageHeader(ushort width, ushort height, byte format, byte pltFormat, ushort colors, uint imgSize, byte lod)
 {
     _unknown = 0;
     _width = width;
     _height = height;
     _imagelen = imgSize;
     _format = format;
     _pltFormat = pltFormat;
     _colorCount = colors;
     _pltSize = (uint)colors * 2;
     _mipmap = lod;
     _min_filt = 0;
     _mag_filt = 0;
     _reserved = 0;
     _lod_bias = 0;
 }
        //public uint this[int shift, int mask]
        //{
        //    get { return (uint)(data >> shift & mask); }
        //    set { data = (uint)((data & ~(mask << shift)) | ((value & mask) << shift)); }
        //}

        public uint this[int shift, int bitCount]
        {
            get
            {
                int mask = 0;
                for (int i = 0; i < bitCount; i++)
                {
                    mask |= 1 << i;
                }
                return((uint)((_data >> shift) & mask));
            }
            set
            {
                int mask = 0;
                for (int i = 0; i < bitCount; i++)
                {
                    mask |= 1 << i;
                }
                _data = (uint)((_data & ~(mask << shift)) | ((value & mask) << shift));
            }
        }
Exemplo n.º 7
0
 bool GetValue(string v, out buint value)
 {
     string s = (v.StartsWith("0x") ? v.Substring(2, Math.Min(v.Length - 2, 8)) : v.Substring(0, Math.Min(v.Length, 8)));
     uint t;
     if (uint.TryParse(s, System.Globalization.NumberStyles.HexNumber, null, out t))
     {
         value = t;
         return true;
     }
     value = 0;
     return false;
 }
Exemplo n.º 8
0
 public XFVertexSpecs(int colors, int textures, XFNormalFormat normalFormat)
 {
     _data = (((uint)textures & 0xF) << 4) | (((uint)normalFormat & 3) << 2) | ((uint)colors & 3);
 }
Exemplo n.º 9
0
 public void SetHasUVs(int index, bool exists)
 {
     _data = _data & ~((uint)0x2000 << index) | ((uint)(exists ? 0x2000 : 0) << index);
 }
Exemplo n.º 10
0
 public void SetHasTexMatrix(int index, bool exists)
 {
     _data = _data & ~((uint)2 << index) | ((uint)(exists ? 2 : 0) << index);
 }
Exemplo n.º 11
0
 public void SetHasColor(int index, bool exists)
 {
     _data = _data & ~((uint)0x800 << index) | ((uint)(exists ? 0x800 : 0) << index);
 }
Exemplo n.º 12
0
        public void Set(uint id, string str)
        {
            uint len = (uint)str.Length;
            int i = 0;
            sbyte* dPtr = (sbyte*)(Address + 8);
            char* sPtr;

            _id = id;
            _stringLength = len;

            fixed (char* s = str)
            {
                sPtr = s;
                while (i++ < len)
                    *dPtr++ = (sbyte)*sPtr++;
            }

            //Trailing zero
            *dPtr++ = 0;

            //Padding
            while ((i++ & 3) != 0)
                *dPtr++ = 0;
        }
Exemplo n.º 13
0
 public Bin32(uint val)
 {
     _data = val;
 }
Exemplo n.º 14
0
 public MDL0Props(int version, int vertices, int faces, int nodes, int scalingRule, int texMtxMode, bool needsNrmArr, bool needsTexArr, bool enableExtents, byte envMtxMode, Vector3 min, Vector3 max)
 {
     _headerLen = 0x40;
     if (version == 9 || version == 8)
         _mdl0Offset = -64;
     else
         _mdl0Offset = -76;
     _scalingRule = scalingRule;
     _texMatrixMode = texMtxMode;
     _numVertices = vertices;
     _numFaces = faces;
     _origPathOffset = 0;
     _numNodes = nodes;
     _needNrmMtxArray = (byte)(needsNrmArr ? 1 : 0);
     _needTexMtxArray = (byte)(needsTexArr ? 1 : 0);
     _enableExtents = (byte)(enableExtents ? 1 : 0);
     _envMtxMode = envMtxMode;
     _dataOffset = 0x40;
     _minExtents = min;
     _maxExtents = max;
 }
Exemplo n.º 15
0
 public void SetHasTexMatrix(int index, bool value)
 {
     _lo = _lo & ~(uint)(1 << (index + 1)) | ((uint)(value ? 1 : 0) << (index + 1));
 }
Exemplo n.º 16
0
 public void SetColorFormat(int index, XFDataFormat format)
 {
     _lo = _lo & ~((uint)3 << (index * 2 + 13)) | ((uint)format << (index * 2 + 13));
 }