Exemple #1
0
        // TODO: Try to get rid of this static function
        // (needed in order for file to read root chunks without having a parent chunk)
        public static Chunk ReadChunk(SRFile file, Chunk parent)
        {
            ulong offset = file.Position;
            uint  size   = file.ReadU32LE();
            TwoCC fourCC = file.ReadTwoCC();

            if (!fourCC.IsValid)
            {
                return(new UnknownChunk(file, parent, offset, (uint)(parent.Offset + parent.Size - offset)));
            }

            return(new SCUMM3Chunk(file, parent, fourCC.Name, offset, size));
        }
Exemple #2
0
        private bool CheckChildren()
        {
            file.Position = Offset + spec.ChildOffset;
            uint size = file.ReadU32LE();

            if (size >= Offset + Size)
            {
                return(false);
            }
            TwoCC twoCC = file.ReadTwoCC();

            if (!twoCC.IsValid)
            {
                return(false);
            }
            return(true);
        }
Exemple #3
0
        private bool CheckFormat(SCUMM3File file)
        {
            foreach (byte enc in ENCRYPTION_VALUES)
            {
                file.Encryption = enc;

                file.Position = 0;
                uint  size  = file.ReadU32LE();
                TwoCC twoCC = file.ReadTwoCC();

                if (twoCC.IsValid && size <= file.Size)
                {
                    file.FileVersion = SCUMMUtils.DetermineSCUMMVersion(file);
                    return(true);
                }
            }
            return(false);
        }