public int this[int i] { get { if (i >= operands.Count()) throw new IndexOutOfRangeException(); if ((_value & operands[i]._negBit) == 0) return (int)((_value >> operands[i]._shift) & operands[i]._bits); else return (int)((_value >> operands[i]._shift) & operands[i]._bits) - (int)operands[i]._negBit; } set { if (i >= operands.Count()) throw new IndexOutOfRangeException(); _value &= ~(operands[i]._bits << operands[i]._shift); if (value > 0) { _value |= (uint)((value & operands[i]._bits) << operands[i]._shift); _value &= ~(operands[i]._negBit); } else { _value |= (uint)(((value + operands[i]._negBit) & operands[i]._bits) << operands[i]._shift); _value |= (uint)operands[i]._negBit; } } }
public override bool OnInitialize() { _name = Header->_value; _value = new Bin32(Header->_unk1); _unk2 = Header->_unk2; return false; }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { return(Bin32.FromString(value.ToString())); }
public override bool OnInitialize() { base.OnInitialize(); if (_name == null) _name = "Extra Data" + _offsetID; flags = new Bin32(Header->_flags); return Count > 0; }
public LightChannelControl(uint ctrl) { _binary = new Bin32(ctrl); }
public override bool OnInitialize() { MDL0Material* header = Header; _initVersion = header->_pad != 0 && _replaced ? header->_pad : Model._version; if ((_name == null) && (header->_stringOffset != 0)) _name = header->ResourceString; XFCmds.Clear(); //Get XF Commands byte* pData = (byte*)header->DisplayLists(Model._version) + 0xE0; Top: if (*pData++ == 0x10) { XFData dat = new XFData(); int count = (ushort)*(bushort*)pData; pData += 2; dat.addr = (XFMemoryAddr)(ushort)*(bushort*)pData; pData += 2; dat.values = new List<uint>(); for (int i = 0; i < count + 1; i++) { dat.values.Add(*(buint*)pData); pData += 4; } XFCmds.Add(dat); goto Top; } _mdl0Offset = header->_mdl0Offset; _stringOffset = header->_stringOffset; _userDataOffset = header->UserDataOffset(_initVersion); _shaderOffset = header->_shaderOffset; _dlOffset = header->DisplayListOffset(_initVersion); _furDataOffset = header->FurDataOffset(_initVersion); _matRefOffset = header->_matRefOffset; _pad = header->_pad; _dataLen = header->_dataLen; _numTextures = header->_numTexGens; _numLights = header->_numLightChans; _usageFlags = new Bin32(header->_usageFlags); _indirectMethod1 = header->_indirectMethod1; _indirectMethod2 = header->_indirectMethod2; _indirectMethod3 = header->_indirectMethod3; _indirectMethod4 = header->_indirectMethod4; _normMapRefLight1 = header->_normMapRefLight1; _normMapRefLight2 = header->_normMapRefLight2; _normMapRefLight3 = header->_normMapRefLight3; _normMapRefLight4 = header->_normMapRefLight4; _ssc = header->_activeTEVStages; _clip = header->_numIndTexStages; _transp = header->_enableAlphaTest; _lSet = header->_lightSet; _fSet = header->_fogSet; _cull = (CullMode)(int)header->_cull; if ((-header->_mdl0Offset + (int)header->DisplayListOffset(_initVersion)) % 0x20 != 0) { Model._errors.Add("Material " + Index + " has an improper align offset."); SignalPropertyChange(); } mode = header->DisplayLists(_initVersion); _alphaFunc = mode->AlphaFunction; _zMode = mode->ZMode; _blendMode = mode->BlendMode; _constantAlpha = mode->ConstantAlpha; _tevColorBlock = *header->TevColorBlock(_initVersion); _tevKonstBlock = *header->TevKonstBlock(_initVersion); _indMtx = *header->IndMtxBlock(_initVersion); MDL0TexSRTData* TexMatrices = header->TexMatrices(_initVersion); _layerFlags = TexMatrices->_layerFlags; _texMtxFlags = TexMatrices->_mtxFlags; MDL0MaterialLighting* Light = header->Light(_initVersion); (_chan1 = Light->Channel1)._parent = this; (_chan2 = Light->Channel2)._parent = this; c1 = CReg2Color; c2 = CReg2Color; c3 = CReg2Color; k1 = KReg0Color; k2 = KReg1Color; k3 = KReg2Color; k3 = KReg3Color; clr1 = C1MaterialColor; clr2 = C2MaterialColor; amb1 = C1AmbientColor; amb2 = C2AmbientColor; (_userEntries = new UserDataCollection()).Read(header->UserData(_initVersion)); return true; }
public override void Parse(VoidPtr address) { v1 = new Bin32(*(buint*)address); v2 = new Bin32(*(buint*)(address + 4)); }
public override bool OnInitialize() { if ((_name == null) && (Header->_stringOffset != 0)) _name = Header->ResourceString; _indices = new List<short>(); for (int i = 0; i < Header->_numIndices; i++) _indices.Add((short)(Header->Indicies[i])); _flags = (uint)(int)Header->_flags; _indexCount = Header->_numIndices; _fixedFlags = Header->_fixedFlags; return Header->_flags > 0; }