コード例 #1
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            loader.CheckSignature(_signature);
            Name   = loader.LoadString();
            Path   = loader.LoadString();
            _flags = loader.ReadUInt16();
            ushort numUserData = loader.ReadUInt16();

            FrameCount = loader.ReadInt32();
            ushort numAnim  = loader.ReadUInt16();
            ushort numCurve = loader.ReadUInt16();

            BakedSize    = loader.ReadUInt32();
            BindModel    = loader.Load <Model>();
            BindIndices  = loader.LoadCustom(() => loader.ReadUInt16s(numAnim));
            Names        = loader.LoadCustom(() => loader.LoadStrings(numAnim)); // Offset to name list.
            Curves       = loader.LoadList <AnimCurve>(numCurve);
            BaseDataList = loader.LoadCustom(() =>
            {
                bool[] baseData = new bool[numAnim];
                int i           = 0;
                while (i < numAnim)
                {
                    byte b = loader.ReadByte();
                    for (int j = 0; j < 8 && i < numAnim; j++)
                    {
                        baseData[i++] = b.GetBit(j);
                    }
                }
                return(baseData);
            });
            UserData = loader.LoadDict <UserData>();
        }
コード例 #2
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            loader.CheckSignature(_signature);
            if (loader.IsSwitch)
            {
                Switch.LightAnimParser.Read((Switch.Core.ResFileSwitchLoader)loader, this);
            }
            else
            {
                Flags = loader.ReadEnum <LightAnimFlags>(true);
                ushort numUserData = loader.ReadUInt16();
                FrameCount = loader.ReadInt32();
                byte numCurve = loader.ReadByte();
                LightTypeIndex        = loader.ReadSByte();
                DistanceAttnFuncIndex = loader.ReadSByte();
                AngleAttnFuncIndex    = loader.ReadSByte();
                BakedSize             = loader.ReadUInt32();
                Name                 = loader.LoadString();
                LightTypeName        = loader.LoadString();
                DistanceAttnFuncName = loader.LoadString();
                AngleAttnFuncName    = loader.LoadString();
                Curves               = loader.LoadList <AnimCurve>(numCurve);
                BaseData             = loader.LoadCustom(() => new LightAnimData(loader, AnimatedFields));
                UserData             = loader.LoadDict <UserData>();
            }
        }
コード例 #3
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            ShaderArchiveName = loader.LoadString();
            ShadingModelName  = loader.LoadString();

            if (loader.IsSwitch)
            {
                AttribAssigns  = loader.LoadDictValues <ResString>();
                SamplerAssigns = loader.LoadDictValues <ResString>();
                ShaderOptions  = loader.LoadDictValues <ResString>();
                Revision       = loader.ReadUInt32();
                byte   numAttribAssign  = loader.ReadByte();
                byte   numSamplerAssign = loader.ReadByte();
                ushort numShaderOption  = loader.ReadUInt16();
            }
            else
            {
                Revision = loader.ReadUInt32();
                byte   numAttribAssign  = loader.ReadByte();
                byte   numSamplerAssign = loader.ReadByte();
                ushort numShaderOption  = loader.ReadUInt16();
                AttribAssigns  = loader.LoadDict <ResString>();
                SamplerAssigns = loader.LoadDict <ResString>();
                ShaderOptions  = loader.LoadDict <ResString>();
            }
        }
コード例 #4
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            loader.CheckSignature(_signature);
            if (loader.IsSwitch)
            {
                Switch.ModelParser.Read((Switch.Core.ResFileSwitchLoader)loader, this);
            }
            else
            {
                Name     = loader.LoadString();
                Path     = loader.LoadString();
                Skeleton = loader.Load <Skeleton>();
                uint ofsVertexBufferList = loader.ReadOffset();
                Shapes    = loader.LoadDict <Shape>();
                Materials = loader.LoadDict <Material>();
                UserData  = loader.LoadDict <UserData>();
                ushort numVertexBuffer  = loader.ReadUInt16();
                ushort numShape         = loader.ReadUInt16();
                ushort numMaterial      = loader.ReadUInt16();
                ushort numUserData      = loader.ReadUInt16();
                uint   totalVertexCount = loader.ReadUInt32();

                if (loader.ResFile.Version >= 0x03030000)
                {
                    uint userPointer = loader.ReadUInt32();
                }

                VertexBuffers = loader.LoadList <VertexBuffer>(numVertexBuffer, ofsVertexBufferList);
            }
        }
コード例 #5
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            loader.CheckSignature(_signature);
            if (loader.IsSwitch)
            {
                Switch.VisibilityAnimParser.Read((Switch.Core.ResFileSwitchLoader)loader, this);
            }
            else
            {
                Name   = loader.LoadString();
                Path   = loader.LoadString();
                _flags = loader.ReadUInt16();
                ushort numAnim  = 0;
                ushort numCurve = 0;
                if (loader.ResFile.Version >= 0x03040000)
                {
                    ushort numUserData = loader.ReadUInt16();
                    FrameCount = loader.ReadInt32();
                    numAnim    = loader.ReadUInt16();
                    numCurve   = loader.ReadUInt16();
                    BakedSize  = loader.ReadUInt32();
                }
                else
                {
                    FrameCount = loader.ReadInt16();
                    numAnim    = loader.ReadUInt16();
                    numCurve   = loader.ReadUInt16();
                    ushort numUserData = loader.ReadUInt16();
                    BakedSize = loader.ReadUInt32();
                    int padding2 = loader.ReadInt16();
                }
                BindModel     = loader.Load <Model>();
                BindIndices   = loader.LoadCustom(() => loader.ReadUInt16s(numAnim));
                Names         = loader.LoadCustom(() => loader.LoadStrings(numAnim)); // Offset to name list.
                Curves        = loader.LoadList <AnimCurve>(numCurve);
                baseDataBytes = new List <byte>();
                BaseDataList  = loader.LoadCustom(() =>
                {
                    bool[] baseData = new bool[numAnim];
                    int i           = 0;
                    while (i < numAnim)
                    {
                        byte b = loader.ReadByte();
                        baseDataBytes.Add(b);
                        for (int j = 0; j < 8 && i < numAnim; j++)
                        {
                            baseData[i] = b.GetBit(j);
                        }
                        i++;
                    }
                    return(baseData);
                });
                UserData = loader.LoadDict <UserData>();
            }
        }
コード例 #6
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            if (loader.IsSwitch)
            {
                Name = loader.LoadString();
                long   DataOffset = loader.ReadOffset();
                ushort count      = loader.ReadUInt16();
                Type = loader.ReadEnum <RenderInfoType>(true);
                loader.Seek(5);

                switch (Type)
                {
                case RenderInfoType.Int32:
                    _value = loader.LoadCustom(() => loader.ReadInt32s(count), (uint)DataOffset);
                    break;

                case RenderInfoType.Single:
                    _value = loader.LoadCustom(() => loader.ReadSingles(count), (uint)DataOffset);
                    break;

                case RenderInfoType.String:
                    if (DataOffset == 0)     //Some games have empty data offset and no strings
                    {
                        _value = new string[0];
                    }
                    else
                    {
                        _value = loader.LoadCustom(() => loader.LoadStrings(count), (uint)DataOffset);
                    }
                    break;
                }
            }
            else
            {
                ushort count = loader.ReadUInt16();
                Type = loader.ReadEnum <RenderInfoType>(true);
                loader.Seek(1);
                Name = loader.LoadString();
                switch (Type)
                {
                case RenderInfoType.Int32:
                    _value = loader.ReadInt32s(count);
                    break;

                case RenderInfoType.Single:
                    _value = loader.ReadSingles(count);
                    break;

                case RenderInfoType.String:
                    _value = loader.LoadStrings(count);
                    break;
                }
            }
        }
コード例 #7
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            loader.CheckSignature(_signature);
            Name = loader.LoadString();
            Path = loader.LoadString();
            ushort numUserData   = loader.ReadUInt16();
            ushort numCameraAnim = loader.ReadUInt16();
            ushort numLightAnim  = loader.ReadUInt16();
            ushort numFogAnim    = loader.ReadUInt16();

            CameraAnims = loader.LoadDict <CameraAnim>();
            LightAnims  = loader.LoadDict <LightAnim>();
            FogAnims    = loader.LoadDict <FogAnim>();
            UserData    = loader.LoadDict <UserData>();
        }
コード例 #8
0
        void IResData.Load(ResFileLoader loader)
        {
            if (loader.ResFile.Version >= 0x02040000)
            {
                loader.CheckSignature(_signature);
                Name  = loader.LoadString();
                Path  = loader.LoadString();
                Flags = loader.ReadEnum <ShaderParamAnimFlags>(true);

                ushort numMatAnim = 0;
                if (loader.ResFile.Version >= 0x03040000)
                {
                    FrameCount = loader.ReadInt32();
                    numMatAnim = loader.ReadUInt16();
                    ushort numUserData  = loader.ReadUInt16();
                    int    numParamAnim = loader.ReadInt32();
                    int    numCurve     = loader.ReadInt32();
                    BakedSize = loader.ReadUInt32();
                }
                else
                {
                    FrameCount = loader.ReadUInt16();
                    numMatAnim = loader.ReadUInt16();
                    unk        = loader.ReadUInt32();
                    int numCurve = loader.ReadInt32();
                    BakedSize = loader.ReadUInt32();
                    int padding2 = loader.ReadInt32();
                }
                BindModel           = loader.Load <Model>();
                BindIndices         = loader.LoadCustom(() => loader.ReadUInt16s(numMatAnim));
                ShaderParamMatAnims = loader.LoadList <ShaderParamMatAnim>(numMatAnim);
                UserData            = loader.LoadDict <UserData>();
            }
            else
            {
                Flags      = loader.ReadEnum <ShaderParamAnimFlags>(true);
                FrameCount = loader.ReadInt16();
                ushort numMatAnim  = loader.ReadUInt16();
                ushort numUserData = loader.ReadUInt16();
                ushort unk         = loader.ReadUInt16();
                BakedSize           = loader.ReadUInt32();
                Name                = loader.LoadString();
                Path                = loader.LoadString();
                BindModel           = loader.Load <Model>();
                BindIndices         = loader.LoadCustom(() => loader.ReadUInt16s(numMatAnim));
                ShaderParamMatAnims = loader.LoadList <ShaderParamMatAnim>(numMatAnim);
            }
        }
コード例 #9
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            Name = loader.LoadString();
            ushort count = loader.ReadUInt16();

            Type = loader.ReadEnum <UserDataType>(true);
            loader.Seek(1);
            switch (Type)
            {
            case UserDataType.Int32:
                _value = loader.ReadInt32s(count);
                break;

            case UserDataType.Single:
                _value = loader.ReadSingles(count);
                break;

            case UserDataType.String:
                _value = loader.LoadStrings(count, Encoding.ASCII);
                break;

            case UserDataType.WString:
                _value = loader.LoadStrings(count, Encoding.Unicode);
                break;

            case UserDataType.Byte:
                _value = loader.ReadBytes(count);
                break;
            }
        }
コード例 #10
0
        // TODO: Methods to retrieve the strongly-typed shader param value.

        // ---- METHODS ------------C:\Users\Nathan\Documents\GitHub\NintenTools.Bfres-master\NintenTools.Bfres\src\Syroot.NintenTools.Bfres\ExternalFile\------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            Type = loader.ReadEnum <ShaderParamType>(true);
            byte sizData = loader.ReadByte();

            if (sizData != (byte)DataSize && sizData > DataSize)
            {
                UsePadding    = true;
                PaddingLength = sizData - (byte)DataSize;
            }

            DataOffset = loader.ReadUInt16();
            offset     = loader.ReadInt32(); // Uniform variable offset.
            if (loader.ResFile.Version >= 0x03040000)
            {
                callbackPointer = loader.ReadUInt32();
                DependedIndex   = loader.ReadUInt16();
                DependIndex     = loader.ReadUInt16();
            }
            else if (loader.ResFile.Version >= 0x03030000 &&
                     loader.ResFile.Version < 0x03040000)
            {
                callbackPointer = loader.ReadUInt32();
                DependedIndex   = loader.ReadUInt16();
                DependIndex     = loader.ReadUInt16();
                uint FMATOffset = loader.ReadUInt32(); //Why does this have this????
            }
            Name = loader.LoadString();
        }
コード例 #11
0
        // TODO: Methods to access ShaderParam variable values.

        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            loader.CheckSignature(_signature);
            Name  = loader.LoadString();
            Flags = loader.ReadEnum <MaterialFlags>(true);
            ushort idx                    = loader.ReadUInt16();
            ushort numRenderInfo          = loader.ReadUInt16();
            byte   numSampler             = loader.ReadByte();
            byte   numTextureRef          = loader.ReadByte();
            ushort numShaderParam         = loader.ReadUInt16();
            ushort numShaderParamVolatile = loader.ReadUInt16();
            ushort sizParamSource         = loader.ReadUInt16();
            ushort sizParamRaw            = loader.ReadUInt16();
            ushort numUserData            = loader.ReadUInt16();

            RenderInfos  = loader.LoadDict <RenderInfo>();
            RenderState  = loader.Load <RenderState>();
            ShaderAssign = loader.Load <ShaderAssign>();
            TextureRefs  = loader.LoadList <TextureRef>(numTextureRef);
            uint ofsSamplerList = loader.ReadOffset(); // Only use dict.

            Samplers = loader.LoadDict <Sampler>();
            uint ofsShaderParamList = loader.ReadOffset(); // Only use dict.

            ShaderParams    = loader.LoadDict <ShaderParam>();
            ShaderParamData = loader.LoadCustom(() => loader.ReadBytes(sizParamSource));
            UserData        = loader.LoadDict <UserData>();
            VolatileFlags   = loader.LoadCustom(() => loader.ReadBytes((int)Math.Ceiling(numShaderParam / 8f)));
            uint userPointer = loader.ReadUInt32();
        }
コード例 #12
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            CurveIndex   = loader.ReadSByte();
            SubBindIndex = loader.ReadSByte();
            loader.Seek(2);
            Name = loader.LoadString();
        }
コード例 #13
0
        public static void Load(ResFileLoader loader, ResFile resFile)
        {
            loader.CheckSignature("FRES");
            resFile.Version = loader.ReadUInt32();
            resFile.SetVersionInfo(resFile.Version);
            resFile.ByteOrder = loader.ReadByteOrder();
            ushort sizHeader = loader.ReadUInt16();
            uint   sizFile   = loader.ReadUInt32();

            resFile.Alignment = loader.ReadUInt32();
            resFile.Name      = loader.LoadString();
            uint sizStringPool = loader.ReadUInt32();
            uint ofsStringPool = loader.ReadOffset();

            resFile.Models = loader.LoadDict <Model>();
            var textures = loader.LoadDict <Texture>();

            resFile.SkeletalAnims       = loader.LoadDict <SkeletalAnim>();
            resFile.ShaderParamAnims    = loader.LoadDict <MaterialAnim>();
            resFile.ColorAnims          = loader.LoadDict <MaterialAnim>();
            resFile.TexSrtAnims         = loader.LoadDict <MaterialAnim>();
            resFile.TexPatternAnims     = loader.LoadDict <MaterialAnim>();
            resFile.BoneVisibilityAnims = loader.LoadDict <VisibilityAnim>();
            loader.LoadDict <VisibilityAnim>();
            resFile.ShapeAnims = loader.LoadDict <ShapeAnim>();

            resFile.Textures = new ResDict <TextureShared>();
            foreach (var tex in textures)
            {
                resFile.Textures.Add(tex.Key, tex.Value);
            }

            if (loader.ResFile.Version >= 0x02040000)
            {
                resFile.SceneAnims    = loader.LoadDict <SceneAnim>();
                resFile.ExternalFiles = loader.LoadDict <ExternalFile>();
                ushort numModel              = loader.ReadUInt16();
                ushort numTexture            = loader.ReadUInt16();
                ushort numSkeletalAnim       = loader.ReadUInt16();
                ushort numShaderParamAnim    = loader.ReadUInt16();
                ushort numColorAnim          = loader.ReadUInt16();
                ushort numTexSrtAnim         = loader.ReadUInt16();
                ushort numTexPatternAnim     = loader.ReadUInt16();
                ushort numBoneVisibilityAnim = loader.ReadUInt16();
                ushort numMatVisibilityAnim  = loader.ReadUInt16();
                ushort numShapeAnim          = loader.ReadUInt16();
                ushort numSceneAnim          = loader.ReadUInt16();
                ushort numExternalFile       = loader.ReadUInt16();
                uint   userPointer           = loader.ReadUInt32();
            }
            else //Note very old versions have no counts and is mostly unkown atm
            {
                uint userPointer  = loader.ReadUInt32();
                uint userPointer2 = loader.ReadUInt32();

                resFile.SceneAnims    = loader.LoadDict <SceneAnim>();
                resFile.ExternalFiles = loader.LoadDict <ExternalFile>();
            }
        }
コード例 #14
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            loader.CheckSignature(_signature);
            Name       = loader.LoadString();
            Path       = loader.LoadString();
            _flags     = loader.ReadUInt32();
            FrameCount = loader.ReadInt32();
            ushort numBoneAnim = loader.ReadUInt16();
            ushort numUserData = loader.ReadUInt16();
            int    numCurve    = loader.ReadInt32();

            BakedSize    = loader.ReadUInt32();
            BoneAnims    = loader.LoadList <BoneAnim>(numBoneAnim);
            BindSkeleton = loader.Load <Skeleton>();
            BindIndices  = loader.LoadCustom(() => loader.ReadUInt16s(numBoneAnim));
            UserData     = loader.LoadDict <UserData>();
        }
コード例 #15
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            if (loader.IsSwitch)
            {
                Name         = loader.LoadString();
                CurveIndex   = loader.ReadSByte();
                SubBindIndex = loader.ReadSByte();
                loader.Seek(6);
            }
            else
            {
                CurveIndex   = loader.ReadSByte();
                SubBindIndex = loader.ReadSByte();
                loader.Seek(2);
                Name = loader.LoadString();
            }
        }
コード例 #16
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            Name        = loader.LoadString();
            BufferIndex = loader.ReadByte();
            loader.Seek(1);
            Offset = loader.ReadUInt16();
            Format = loader.ReadEnum <GX2AttribFormat>(true);
        }
コード例 #17
0
        void IResData.Load(ResFileLoader loader)
        {
            loader.CheckSignature(_signature);
            Flags      = loader.ReadEnum <FogAnimFlags>(true);
            FrameCount = loader.ReadInt32();
            byte numCurve = loader.ReadByte();

            DistanceAttnFuncIndex = loader.ReadSByte();
            ushort numUserData = loader.ReadUInt16();

            BakedSize            = loader.ReadUInt32();
            Name                 = loader.LoadString();
            DistanceAttnFuncName = loader.LoadString();
            Curves               = loader.LoadList <AnimCurve>(numCurve);
            BaseData             = loader.LoadCustom(() => new FogAnimData(loader));
            UserData             = loader.LoadDict <UserData>();
        }
コード例 #18
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            if (loader.ResFile.Version >= 0x02040000)
            {
                loader.CheckSignature(_signature);
                Name   = loader.LoadString();
                Path   = loader.LoadString();
                _flags = loader.ReadUInt32();

                if (loader.ResFile.Version >= 0x03040000)
                {
                    FrameCount  = loader.ReadInt32();
                    numBoneAnim = loader.ReadUInt16();
                    ushort numUserData = loader.ReadUInt16();
                    int    numCurve    = loader.ReadInt32();
                    BakedSize = loader.ReadUInt32();
                }
                else
                {
                    FrameCount  = loader.ReadUInt16();
                    numBoneAnim = loader.ReadUInt16();
                    ushort numUserData = loader.ReadUInt16();
                    ushort numCurve    = loader.ReadUInt16();
                    BakedSize = loader.ReadUInt32();
                    loader.Seek(4); //padding
                }

                BoneAnims    = loader.LoadList <BoneAnim>(numBoneAnim).ToList();
                BindSkeleton = loader.Load <Skeleton>();
                BindIndices  = loader.LoadCustom(() => loader.ReadUInt16s(numBoneAnim));
                UserData     = loader.LoadDict <UserData>();
            }
            else
            {
                _flags      = loader.ReadUInt32();
                FrameCount  = loader.ReadUInt16();
                numBoneAnim = loader.ReadUInt16();
                ushort numUserData = loader.ReadUInt16();
                ushort numCurve    = loader.ReadUInt16();
                Name         = loader.LoadString();
                Path         = loader.LoadString();
                BoneAnims    = loader.LoadList <BoneAnim>(numBoneAnim).ToList();
                BindSkeleton = loader.Load <Skeleton>();
                BindIndices  = loader.LoadCustom(() => loader.ReadUInt16s(numBoneAnim));
            }
        }
コード例 #19
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            if (loader.IsSwitch)
            {
                Name          = loader.LoadString();
                CurveIndex    = loader.ReadInt16();
                BeginConstant = loader.ReadUInt16();
                SubBindIndex  = loader.ReadSByte();
                loader.Seek(3); //padding
            }
            else
            {
                CurveIndex   = loader.ReadSByte();
                SubBindIndex = loader.ReadSByte();
                loader.Seek(2);
                Name = loader.LoadString();
            }
        }
コード例 #20
0
 private Node ReadNode(ResFileLoader loader)
 {
     return(new Node()
     {
         Reference = loader.ReadUInt32(),
         IdxLeft = loader.ReadUInt16(),
         IdxRight = loader.ReadUInt16(),
         Key = loader.LoadString(),
     });
 }
コード例 #21
0
ファイル: Bone.cs プロジェクト: shukenmg/BfresLibrary
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            if (loader.IsSwitch)
            {
                Name     = loader.LoadString();
                UserData = loader.LoadDictValues <UserData>();
                if (loader.ResFile.VersionMajor2 == 8 || loader.ResFile.VersionMajor2 == 9)
                {
                    loader.Seek(16);
                }

                ushort idx = loader.ReadUInt16();
                ParentIndex       = loader.ReadInt16();
                SmoothMatrixIndex = loader.ReadInt16();
                RigidMatrixIndex  = loader.ReadInt16();
                BillboardIndex    = loader.ReadInt16();
                ushort numUserData = loader.ReadUInt16();
                _flags   = loader.ReadUInt32();
                Scale    = loader.ReadVector3F();
                Rotation = loader.ReadVector4F();
                Position = loader.ReadVector3F();
            }
            else
            {
                Name = loader.LoadString();
                ushort idx = loader.ReadUInt16();
                ParentIndex       = loader.ReadInt16();
                SmoothMatrixIndex = loader.ReadInt16();
                RigidMatrixIndex  = loader.ReadInt16();
                BillboardIndex    = loader.ReadInt16();
                ushort numUserData = loader.ReadUInt16();
                _flags   = loader.ReadUInt32();
                Scale    = loader.ReadVector3F();
                Rotation = loader.ReadVector4F();
                Position = loader.ReadVector3F();
                UserData = loader.LoadDict <UserData>();

                if (loader.ResFile.Version < 0x03040000)
                {
                    InverseMatrix = loader.ReadMatrix3x4();
                }
            }
        }
コード例 #22
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            TexSampler = new TexSampler(loader.ReadUInt32s(3));
            uint handle = loader.ReadUInt32();

            Name = loader.LoadString();
            byte idx = loader.ReadByte();

            loader.Seek(3);
        }
コード例 #23
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            BeginCurve      = loader.ReadUInt16();
            FloatCurveCount = loader.ReadUInt16();
            IntCurveCount   = loader.ReadUInt16();
            BeginConstant   = loader.ReadUInt16();
            ConstantCount   = loader.ReadUInt16();
            SubBindIndex    = loader.ReadUInt16();
            Name            = loader.LoadString();
        }
コード例 #24
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            loader.CheckSignature(_signature);
            if (loader.IsSwitch)
            {
                Switch.ShapeAnimParser.Read((Switch.Core.ResFileSwitchLoader)loader, this);
            }
            else
            {
                Name  = loader.LoadString();
                Path  = loader.LoadString();
                Flags = loader.ReadEnum <ShapeAnimFlags>(true);

                ushort numUserData;
                ushort numVertexShapeAnim;
                ushort numKeyShapeAnim;
                ushort numCurve;
                if (loader.ResFile.Version >= 0x03040000)
                {
                    numUserData        = loader.ReadUInt16();
                    FrameCount         = loader.ReadInt32();
                    numVertexShapeAnim = loader.ReadUInt16();
                    numKeyShapeAnim    = loader.ReadUInt16();
                    numCurve           = loader.ReadUInt16();
                    loader.Seek(2);
                    BakedSize = loader.ReadUInt32();
                }
                else
                {
                    FrameCount         = loader.ReadUInt16();
                    numVertexShapeAnim = loader.ReadUInt16();
                    numKeyShapeAnim    = loader.ReadUInt16();
                    numUserData        = loader.ReadUInt16();
                    numCurve           = loader.ReadUInt16();
                    BakedSize          = loader.ReadUInt32();
                }

                BindModel        = loader.Load <Model>();
                BindIndices      = loader.LoadCustom(() => loader.ReadUInt16s(numVertexShapeAnim));
                VertexShapeAnims = loader.LoadList <VertexShapeAnim>(numVertexShapeAnim);
                UserData         = loader.LoadDict <UserData>();
            }
        }
コード例 #25
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            loader.CheckSignature(_signature);
            Dim      = loader.ReadEnum <GX2SurfaceDim>(true);
            Width    = loader.ReadUInt32();
            Height   = loader.ReadUInt32();
            Depth    = loader.ReadUInt32();
            MipCount = loader.ReadUInt32();
            Format   = loader.ReadEnum <GX2SurfaceFormat>(true);
            AAMode   = loader.ReadEnum <GX2AAMode>(true);
            Use      = loader.ReadEnum <GX2SurfaceUse>(true);
            uint sizData      = loader.ReadUInt32();
            uint imagePointer = loader.ReadUInt32();
            uint sizMipData   = loader.ReadUInt32();
            uint mipPointer   = loader.ReadUInt32();

            TileMode       = loader.ReadEnum <GX2TileMode>(true);
            Swizzle        = loader.ReadUInt32();
            Alignment      = loader.ReadUInt32();
            Pitch          = loader.ReadUInt32();
            MipOffsets     = loader.ReadUInt32s(13);
            ViewMipFirst   = loader.ReadUInt32();
            ViewMipCount   = loader.ReadUInt32();
            ViewSliceFirst = loader.ReadUInt32();
            ViewSliceCount = loader.ReadUInt32();
            CompSelR       = loader.ReadEnum <GX2CompSel>(true);
            CompSelG       = loader.ReadEnum <GX2CompSel>(true);
            CompSelB       = loader.ReadEnum <GX2CompSel>(true);
            CompSelA       = loader.ReadEnum <GX2CompSel>(true);
            Regs           = loader.ReadUInt32s(5);
            uint handle = loader.ReadUInt32();

            ArrayLength = loader.ReadUInt32(); // Possibly just a byte.
            Name        = loader.LoadString();
            Path        = loader.LoadString();
            Data        = loader.LoadCustom(() => loader.ReadBytes((int)sizData));
            MipData     = loader.LoadCustom(() => loader.ReadBytes((int)sizMipData));
            UserData    = loader.LoadDict <UserData>();
            ushort numUserData = loader.ReadUInt16();

            loader.Seek(2);
        }
コード例 #26
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            if (loader.IsSwitch)
            {
                Name = loader.LoadString();
                uint   CurveOffset             = loader.ReadOffset();
                uint   BaseDataOffset          = loader.ReadOffset();
                uint   KeyShapeAnimInfosOffset = loader.ReadOffset();
                ushort numCurve        = loader.ReadUInt16();
                ushort numKeyShapeAnim = loader.ReadUInt16();
                BeginCurve        = loader.ReadInt32();
                BeginKeyShapeAnim = loader.ReadInt32();
                loader.Seek(4); //Padding

                KeyShapeAnimInfos = loader.LoadList <KeyShapeAnimInfo>(numKeyShapeAnim, KeyShapeAnimInfosOffset);
                Curves            = loader.LoadList <AnimCurve>(numCurve, CurveOffset);
                BaseDataList      = loader.LoadCustom(() => loader.ReadSingles(numKeyShapeAnim - 1), BaseDataOffset); // Without base shape.
            }
            else
            {
                ushort numCurve;
                ushort numKeyShapeAnim;
                if (loader.ResFile.Version >= 0x03040000)
                {
                    numCurve        = loader.ReadUInt16();
                    numKeyShapeAnim = loader.ReadUInt16();
                }
                else
                {
                    numCurve        = loader.ReadByte();
                    numKeyShapeAnim = loader.ReadByte();
                    unk             = loader.ReadUInt16();
                }

                BeginCurve        = loader.ReadInt32();
                BeginKeyShapeAnim = loader.ReadInt32();
                Name = loader.LoadString();
                KeyShapeAnimInfos = loader.LoadList <KeyShapeAnimInfo>(numKeyShapeAnim);
                Curves            = loader.LoadList <AnimCurve>(numCurve);
                BaseDataList      = loader.LoadCustom(() => loader.ReadSingles(numKeyShapeAnim - 1)); // Without base shape.
            }
        }
コード例 #27
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            loader.CheckSignature(_signature);
            Name     = loader.LoadString();
            Path     = loader.LoadString();
            Skeleton = loader.Load <Skeleton>();
            uint ofsVertexBufferList = loader.ReadOffset();

            Shapes    = loader.LoadDict <Shape>();
            Materials = loader.LoadDict <Material>();
            UserData  = loader.LoadDict <UserData>();
            ushort numVertexBuffer  = loader.ReadUInt16();
            ushort numShape         = loader.ReadUInt16();
            ushort numMaterial      = loader.ReadUInt16();
            ushort numUserData      = loader.ReadUInt16();
            uint   totalVertexCount = loader.ReadUInt32();
            uint   userPointer      = loader.ReadUInt32();

            VertexBuffers = loader.LoadList <VertexBuffer>(numVertexBuffer, ofsVertexBufferList);
        }
コード例 #28
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            loader.CheckSignature(_signature);
            Name  = loader.LoadString();
            Path  = loader.LoadString();
            Flags = loader.ReadEnum <ShapeAnimFlags>(true);
            ushort numUserData = loader.ReadUInt16();

            FrameCount = loader.ReadInt32();
            ushort numVertexShapeAnim = loader.ReadUInt16();
            ushort numKeyShapeAnim    = loader.ReadUInt16();
            ushort numCurve           = loader.ReadUInt16();

            loader.Seek(2);
            BakedSize        = loader.ReadUInt32();
            BindModel        = loader.Load <Model>();
            BindIndices      = loader.LoadCustom(() => loader.ReadUInt16s(numVertexShapeAnim));
            VertexShapeAnims = loader.LoadList <VertexShapeAnim>(numVertexShapeAnim);
            UserData         = loader.LoadDict <UserData>();
        }
コード例 #29
0
ファイル: ResString.cs プロジェクト: shukenmg/BfresLibrary
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            if (loader.IsSwitch)
            {
                String = loader.LoadString(Encoding ?? loader.Encoding);
            }
            else
            {
                String = loader.ReadString(BinaryStringFormat.ZeroTerminated, Encoding ?? loader.Encoding);
            }
        }
コード例 #30
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            loader.CheckSignature(_signature);
            Name  = loader.LoadString();
            Path  = loader.LoadString();
            Flags = loader.ReadEnum <TexPatternAnimFlags>(true);
            ushort numUserData = loader.ReadUInt16();

            FrameCount = loader.ReadInt32();
            ushort numTextureRef = loader.ReadUInt16();
            ushort numMatAnim    = loader.ReadUInt16();
            int    numPatAnim    = loader.ReadInt32();
            int    numCurve      = loader.ReadInt32();

            BakedSize          = loader.ReadUInt32();
            BindModel          = loader.Load <Model>();
            BindIndices        = loader.LoadCustom(() => loader.ReadUInt16s(numMatAnim));
            TexPatternMatAnims = loader.LoadList <TexPatternMatAnim>(numMatAnim);
            TextureRefs        = loader.LoadDict <TextureRef>();
            UserData           = loader.LoadDict <UserData>();
        }