Пример #1
0
        public Gens(string GMVFile)
        {
            Filename = GMVFile;
            FillByteArrayFromFile(GMVFile, ref FileContents);

            Header               = new TASHeader();
            Header.Signature     = ReadChars(ref FileContents, Offsets[0], 16);
            Header.Version       = FileContents[Offsets[1]] - 55;
            Header.FrameCount    = Convert.ToInt32((FileContents.Length - HEADER_SIZE) / 3);
            Header.RerecordCount = Read32(ref FileContents, Offsets[2]);

            if (Header.Version > 9)
            {
                Options     = new TASOptions(true);
                Options.FPS = (1 & (FileContents[Offsets[5]] >> 7)) == 1 ? 50 : 60;
                Options.MovieStartFlag[0] = (1 & (FileContents[Offsets[5]] >> 6)) == 1 ? true : false;
                Options.MovieStartFlag[1] = (1 & (FileContents[Offsets[5]] >> 6)) == 0 ? true : false;
                Input = (1 & (FileContents[Offsets[5]] >> 5)) == 1 ? new TASInput(3, true) : new TASInput(2, true);
            }
            else
            {
                Input = new TASInput(2, true);
            }

            Extra = new TASExtra();
            try { Extra.Description = ReadCharsNullTerminated(ref FileContents, Offsets[6]); }
            catch { Extra.Description = ReadChars(ref FileContents, Offsets[6], Offsets[7] - Offsets[6]); }

            GMVSpecific = new FormatSpecific();
            GMVSpecific.Player1Config = ReadChars(ref FileContents, Offsets[3], 1);
            GMVSpecific.Player2Config = ReadChars(ref FileContents, Offsets[4], 1);

            getFrameInput(ref FileContents);
        }
Пример #2
0
        public Gens(string GMVFile)
        {
            Filename = GMVFile;
            FillByteArrayFromFile(GMVFile, ref FileContents);

            Header = new TASHeader();
            Header.Signature = ReadChars(ref FileContents, Offsets[0], 16);
            Header.Version = FileContents[Offsets[1]] - 55;
            Header.FrameCount = Convert.ToInt32((FileContents.Length - HEADER_SIZE) / 3);
            Header.RerecordCount = Read32(ref FileContents, Offsets[2]);

            if (Header.Version > 9)
            {
                Options = new TASOptions(true);
                Options.FPS = (1 & (FileContents[Offsets[5]] >> 7)) == 1 ? 50 : 60;
                Options.MovieStartFlag[0] = (1 & (FileContents[Offsets[5]] >> 6)) == 1 ? true : false;
                Options.MovieStartFlag[1] = (1 & (FileContents[Offsets[5]] >> 6)) == 0 ? true : false;
                Input = (1 & (FileContents[Offsets[5]] >> 5)) == 1 ? new TASInput(3, true) : new TASInput(2, true);
            }
            else
                Input = new TASInput(2, true);

            Extra = new TASExtra();
            try { Extra.Description = ReadCharsNullTerminated(ref FileContents, Offsets[6]); }
            catch { Extra.Description = ReadChars(ref FileContents, Offsets[6], Offsets[7] - Offsets[6]); }

            GMVSpecific = new FormatSpecific();
            GMVSpecific.Player1Config = ReadChars(ref FileContents, Offsets[3], 1);
            GMVSpecific.Player2Config = ReadChars(ref FileContents, Offsets[4], 1);

            getFrameInput(ref FileContents);
        }
Пример #3
0
        /// <summary>
        /// Create a fully instantiated M64 object from the passed file
        /// </summary>
        public Mupen64(string M64File)
        {
            Filename = M64File;
            FillByteArrayFromFile(M64File, ref FileContents);

            Header               = new TASHeader();
            Header.Signature     = ReadHEX(ref FileContents, Offsets[0], 4);
            Header.Version       = Read32(ref FileContents, Offsets[1]);
            Header.UID           = ConvertUNIXTime(Read32(ref FileContents, Offsets[2]));
            Header.FrameCount    = Read32(ref FileContents, Offsets[3]);
            Header.RerecordCount = Read32(ref FileContents, Offsets[4]);

            // Though ControllerInputs is stored in the header, it can be determined
            // mathematically, so we may as well do it once instead of twice ;)
            //ControllerInputs     = Read32(ref FileContents, Offsets[8]);
            ControllerInputs = Read32(ref FileContents, Offsets[8]);

            if (Header.Version >= 3)
            {
                //ControllerInputs = (FileContents.Length - 0x400) / BYTES_PER_FRAME;
                ControllerDataOffset = 0x400;
            }
            else
            {
                //ControllerInputs = (FileContents.Length - 0x200) / BYTES_PER_FRAME;
                ControllerDataOffset = 0x200;
            }

            Options = new TASOptions(true);
            Options.MovieStartFlag[0] = (FileContents[Offsets[9]] | FileContents[Offsets[9] + 1]) == 1 ? true : false;
            Options.MovieStartFlag[2] = (FileContents[Offsets[9]] | FileContents[Offsets[9] + 1]) == 2 ? true : false;
            Options.FPS = FileContents[Offsets[5]];

            Extra             = new TASExtra();
            Extra.ROM         = ReadChars(ref FileContents, Offsets[13], 64);
            Extra.CRC         = ReadHEXUnicode(ref FileContents, Offsets[14], 4);
            Extra.Country     = ReadChars(ref FileContents, Offsets[15], 2);
            Extra.Author      = ReadChars(ref FileContents, Offsets[21], 222);
            Extra.Description = ReadChars(ref FileContents, Offsets[22], 256);

            M64Specific             = new FormatSpecific(ReadBytes(ref FileContents, Offsets[11], 4));
            M64Specific.VideoPlugin = ReadChars(ref FileContents, Offsets[17], 64);
            M64Specific.AudioPlugin = ReadChars(ref FileContents, Offsets[18], 64);
            M64Specific.InputPlugin = ReadChars(ref FileContents, Offsets[19], 64);
            M64Specific.RSPPlugin   = ReadChars(ref FileContents, Offsets[20], 64);

            Input = new TASInput(4, false);
            for (int i = 0; i < 4; i++)
            {
                Input.Controllers[i] = M64Specific.Controller[i].Option[0];
            }

            getFrameInput(ref FileContents);
        }
Пример #4
0
        public PCSX(string PXMFile)
        {
            Filename = PXMFile;
            FillByteArrayFromFile(PXMFile, ref FileContents);
            if ((1 & (FileContents[Offsets[3]] >> 6)) == 1)
            {
                throw new System.Exception();    // this should be done better
            }
            ControllerDataOffset = Read32(ref FileContents, Offsets[14]);
            SaveStateOffset      = Read32(ref FileContents, Offsets[9]);

            Header               = new TASHeader();
            Header.Signature     = ReadHEX(ref FileContents, Offsets[0], 4);
            Header.Version       = Read32(ref FileContents, Offsets[1]);
            Header.FrameCount    = Read32(ref FileContents, Offsets[7]);
            Header.RerecordCount = Read32(ref FileContents, Offsets[8]);

            Options = new TASOptions(true);
            Options.MovieStartFlag[0]  = (1 & (FileContents[Offsets[3]] >> 1)) == 1 ? true : false;
            Options.MovieStartFlag[1]  = (1 & (FileContents[Offsets[3]] >> 1)) == 0 ? true : false;
            Options.MovieTimingFlag[0] = (1 & (FileContents[Offsets[3]] >> 2)) == 0 ? true : false;
            Options.MovieTimingFlag[1] = (1 & (FileContents[Offsets[3]] >> 2)) == 1 ? true : false;

            PXMSpecific = new FormatSpecific(FileContents[Offsets[5]], FileContents[Offsets[6]]);
            PXMSpecific.HasEmbeddedMemoryCards = (1 & (FileContents[Offsets[3]] >> 3)) == 1 ? true : false;
            PXMSpecific.HasEmbeddedCheatList   = (1 & (FileContents[Offsets[3]] >> 4)) == 1 ? true : false;
            PXMSpecific.UsesHacks             = (1 & (FileContents[Offsets[3]] >> 5)) == 1 ? true : false;
            PXMSpecific.IsTextFile            = (1 & (FileContents[Offsets[3]] >> 6)) == 1 ? true : false;
            PXMSpecific.P1MultitapToggle      = (1 & (FileContents[Offsets[3]] >> 7)) == 1 ? true : false;
            PXMSpecific.P2MultitapToggle      = (1 & (FileContents[Offsets[3]] >> 8)) == 1 ? true : false;
            PXMSpecific.EnabledAnalogHack     = (1 & (FileContents[Offsets[3]] >> 9)) == 1 ? true : false;
            PXMSpecific.EnabledParasiteEveFix = (1 & (FileContents[Offsets[3]] >> 10)) == 1 ? true : false;

            PXMSpecific.EmulatorVersion   = Read32(ref FileContents, Offsets[2]);
            PXMSpecific.MemoryCard1Offset = Read32(ref FileContents, Offsets[10]);
            PXMSpecific.MemoryCard2Offset = Read32(ref FileContents, Offsets[11]);
            PXMSpecific.CheatListOffset   = Read32(ref FileContents, Offsets[12]);
            PXMSpecific.CDRomIDOffset     = Read32(ref FileContents, Offsets[13]);

            PXMSpecific.CDRomCount = FileContents[PXMSpecific.CDRomIDOffset];

            Extra        = new TASExtra();
            Extra.ROM    = ReadChars(ref FileContents, PXMSpecific.CDRomIDOffset + 1, PXMSpecific.CDRomCount * 9);
            Extra.Author = ReadChars(ref FileContents, Offsets[16], Read32(ref FileContents, Offsets[15]));

            Input = new TASInput(3, true);

            getFrameInput(ref FileContents);
        }
Пример #5
0
        public VisualBoyAdvance(string VBMFile)
        {
            Filename = VBMFile;
            FillByteArrayFromFile(VBMFile, ref FileContents);

            SaveStateOffset      = Read32(ref FileContents, Offsets[17]);
            ControllerDataOffset = Read32(ref FileContents, Offsets[18]);

            Header               = new TASHeader();
            Header.Signature     = ReadHEX(ref FileContents, Offsets[0], 4);
            Header.Version       = Read32(ref FileContents, Offsets[1]);
            Header.UID           = ConvertUNIXTime(Read32(ref FileContents, Offsets[2]));
            Header.FrameCount    = Read32(ref FileContents, Offsets[3]);    // FIXME: unreliable
            Header.RerecordCount = Read32(ref FileContents, Offsets[4]);

            Options = new TASOptions(true);
            Options.MovieStartFlag[0] = ((1 & (FileContents[Offsets[5]] >> 0)) == 1) ? true : false;
            Options.MovieStartFlag[1] = ((1 & (FileContents[Offsets[5]] >> 1)) == 1) ? true : false;
            Options.MovieStartFlag[2] = (!Options.MovieStartFlag[0] && !Options.MovieStartFlag[1]) ? true : false;

            int activeControllers = 0;

            Input = new TASInput(4, false);
            for (int i = 0; i < 4; i++)
            {
                if ((1 & (FileContents[Offsets[6]] >> i)) == 1)
                {
                    Input.Controllers[i] = true;
                    activeControllers++;
                }
                else
                {
                    Input.Controllers[i] = false;
                }
            }
            // deduce the actual frame count from the file content
            Header.FrameCount = (FileContents.Length - ControllerDataOffset) / (activeControllers * 2);

            Extra             = new TASExtra();
            Extra.Author      = ReadChars(ref FileContents, HEADER_SIZE, 64);
            Extra.Description = ReadChars(ref FileContents, HEADER_SIZE + 64, 128);
            Extra.ROM         = ReadChars(ref FileContents, Offsets[12], 12);
            Extra.CRC         = Convert.ToString((int)Offsets[14]);

            VBMSpecific = new FormatSpecific(FileContents[Offsets[7]], FileContents[Offsets[8]]);
            VBMSpecific.MinorVersion = FileContents[Offsets[13]];

            getFrameInput(ref FileContents);
        }
Пример #6
0
        public SNES9x(string SMVFile)
        {
            Filename = SMVFile;
            FillByteArrayFromFile(SMVFile, ref FileContents);

            ControllerDataOffset = Read32(ref FileContents, Offsets[10]);
            SaveStateOffset      = Read32(ref FileContents, Offsets[9]);

            Header               = new TASHeader();
            Header.Signature     = ReadHEX(ref FileContents, Offsets[0], 4);
            Header.Version       = Read32(ref FileContents, Offsets[1]);
            Header.UID           = ConvertUNIXTime(Read32(ref FileContents, Offsets[2]));
            Header.FrameCount    = Read32(ref FileContents, Offsets[4]) + 1;    // including the 0th frame
            Header.RerecordCount = Read32(ref FileContents, Offsets[3]);

            Options = new TASOptions(true);
            Options.MovieStartFlag[0]  = (1 & (FileContents[Offsets[6]] >> 0)) == 0 ? true : false;
            Options.MovieStartFlag[1]  = (1 & (FileContents[Offsets[6]] >> 0)) == 1 ? true : false;
            Options.MovieTimingFlag[0] = (1 & (FileContents[Offsets[6]] >> 1)) == 0 ? true : false;
            Options.MovieTimingFlag[1] = (1 & (FileContents[Offsets[6]] >> 1)) == 1 ? true : false;

            SMVSpecific = new FormatSpecific(Header.Version, ref FileContents, ref Offsets);

            Extra = new TASExtra();
            if (SMVSpecific.HASROMINFO)
            {
                Extra.ROM = ReadChars(ref FileContents, 0x07 + SaveStateOffset - EXTRAROMINFO_SIZE, 23);
                Extra.CRC = ReadHEXUnicode(ref FileContents, 0x03 + SaveStateOffset - EXTRAROMINFO_SIZE, 4);
            }

            int MetaDataOffset = (Header.Version == 1 ? Offsets[11] : Offsets[16]);
            int MetaDataLength = (SaveStateOffset - MetaDataOffset) - (SMVSpecific.HASROMINFO ? EXTRAROMINFO_SIZE : 0);

            Extra.Author = ReadChars16(ref FileContents, MetaDataOffset, MetaDataLength);

            Input = new TASInput(5, false);
            for (int c = 0; c < 5; c++)
            {
                Input.Controllers[c] = ((1 & (FileContents[Offsets[5]] >> c)) == 1 ? true : false);
            }

            getFrameInput(ref FileContents);
        }
Пример #7
0
        public Famtasia(string FMVFile)
        {
            Filename = FMVFile;
            FillByteArrayFromFile(FMVFile, ref FileContents);

            Options = new TASOptions(true);
            Options.MovieStartFlag[0] = (1 & (FileContents[Offsets[1]]) >> 7) == 0 ? true : false;
            Options.MovieStartFlag[1] = (1 & (FileContents[Offsets[1]]) >> 7) == 1 ? true : false;

            Extra             = new TASExtra();
            Extra.Description = ReadChars(ref FileContents, Offsets[7], 64);

            Input = new TASInput(2, false);
            for (int i = 0; i < 2; i++)
            {
                if ((1 & (FileContents[Offsets[2]]) >> 7 - i) == 1)
                {
                    Input.Controllers[i] = true;
                    BytesPerFrame++;
                }
            }

            FMVSpecific = new FormatSpecific();
            if ((1 & (FileContents[Offsets[2]]) >> 5) == 1)
            {
                FMVSpecific.FDS = true;
                BytesPerFrame++;
            }
            else
            {
                FMVSpecific.FDS = false;
            }

            Header               = new TASHeader();
            Header.Signature     = ReadHEX(ref FileContents, Offsets[0], 4);
            Header.RerecordCount = Read32(ref FileContents, Offsets[4]);
            Header.EmulatorID    = ReadChars(ref FileContents, Offsets[6], 64);
            Header.FrameCount    = FileContents.Length - HEADER_SIZE / BytesPerFrame;

            getFrameInput(ref FileContents);
        }
Пример #8
0
        public Dega(string MMVFile)
        {
            Filename = MMVFile;
            FillByteArrayFromFile(MMVFile, ref FileContents);

            ControllerDataOffset = Read32(ref FileContents, Offsets[6]);
            SaveStateOffset      = Read32(ref FileContents, Offsets[5]);

            Header               = new TASHeader();
            Header.Signature     = ReadHEX(ref FileContents, Offsets[0], 4);
            Header.Version       = Read32(ref FileContents, Offsets[1]);
            Header.FrameCount    = Read32(ref FileContents, Offsets[2]);
            Header.RerecordCount = Read32(ref FileContents, Offsets[3]);

            Options = new TASOptions(true);
            Options.MovieStartFlag[0]  = FileContents[Offsets[4]] == 0 ? true : false;
            Options.MovieStartFlag[1]  = FileContents[Offsets[4]] != 0 ? true : false;
            Options.MovieTimingFlag[0] = (1 & (FileContents[Offsets[9]] >> 1)) == 0 ? true : false;
            Options.MovieTimingFlag[1] = (1 & (FileContents[Offsets[9]] >> 1)) == 1 ? true : false;

            Extra        = new TASExtra();
            Extra.Author = ReadChars(ref FileContents, Offsets[8], Offsets[9] - Offsets[8]);
            Extra.ROM    = ReadChars(ref FileContents, Offsets[10], Offsets[11] - Offsets[10]);
            Extra.CRC    = ReadHEX(ref FileContents, Offsets[11], 16);

            MMVSpecific          = new FormatSpecific();
            MMVSpecific.PackSize = Read32(ref FileContents, Offsets[7]);
            MMVSpecific.Japan    = (1 & (FileContents[Offsets[9]] >> 2)) == 1 ? true : false;
            MMVSpecific.GameGear = (1 & (FileContents[Offsets[9]] >> 3)) == 1 ? true : false;

            Input = new TASInput(2, true);
            if (MMVSpecific.GameGear)
            {
                Input.Controllers[1] = false;
            }

            getFrameInput(ref FileContents);
        }
Пример #9
0
        public Dega(string MMVFile)
        {
            Filename = MMVFile;
            FillByteArrayFromFile(MMVFile, ref FileContents);

            ControllerDataOffset = Read32(ref FileContents, Offsets[6]);
            SaveStateOffset = Read32(ref FileContents, Offsets[5]);

            Header = new TASHeader();
            Header.Signature     = ReadHEX(ref FileContents, Offsets[0], 4);
            Header.Version       = Read32(ref FileContents, Offsets[1]);
            Header.FrameCount    = Read32(ref FileContents, Offsets[2]);
            Header.RerecordCount = Read32(ref FileContents, Offsets[3]);

            Options = new TASOptions(true);
            Options.MovieStartFlag[0]  = FileContents[Offsets[4]] == 0 ? true : false;
            Options.MovieStartFlag[1]  = FileContents[Offsets[4]] != 0 ? true : false;
            Options.MovieTimingFlag[0] = (1 & (FileContents[Offsets[9]] >> 1)) == 0 ? true : false;
            Options.MovieTimingFlag[1] = (1 & (FileContents[Offsets[9]] >> 1)) == 1 ? true : false;

            Extra = new TASExtra();
            Extra.Author = ReadChars(ref FileContents, Offsets[8], Offsets[9] - Offsets[8]);
            Extra.ROM = ReadChars(ref FileContents, Offsets[10], Offsets[11] - Offsets[10]);
            Extra.CRC = ReadHEX(ref FileContents, Offsets[11], 16);

            MMVSpecific = new FormatSpecific();
            MMVSpecific.PackSize = Read32(ref FileContents, Offsets[7]);
            MMVSpecific.Japan = (1 & (FileContents[Offsets[9]] >> 2)) == 1 ? true : false;
            MMVSpecific.GameGear = (1 & (FileContents[Offsets[9]] >> 3)) == 1 ? true : false;

            Input = new TASInput(2, true);
            if (MMVSpecific.GameGear)
                Input.Controllers[1] = false;

            getFrameInput(ref FileContents);
        }
Пример #10
0
        public Famtasia(string FMVFile)
        {
            Filename = FMVFile;
            FillByteArrayFromFile(FMVFile, ref FileContents);

            Options = new TASOptions(true);
            Options.MovieStartFlag[0] = (1 & (FileContents[Offsets[1]]) >> 7) == 0 ? true : false;
            Options.MovieStartFlag[1] = (1 & (FileContents[Offsets[1]]) >> 7) == 1 ? true : false;

            Extra = new TASExtra();
            Extra.Description = ReadChars(ref FileContents, Offsets[7], 64);

            Input = new TASInput(2, false);
            for (int i = 0; i < 2; i++)
            {
                if ((1 & (FileContents[Offsets[2]]) >> 7 - i) == 1)
                {
                    Input.Controllers[i] = true;
                    BytesPerFrame++;
                }
            }

            FMVSpecific = new FormatSpecific();
            if ((1 & (FileContents[Offsets[2]]) >> 5) == 1)
            {
                FMVSpecific.FDS = true;
                BytesPerFrame++;
            }
            else
                FMVSpecific.FDS = false;

            Header = new TASHeader();
            Header.Signature     = ReadHEX(ref FileContents, Offsets[0], 4);
            Header.RerecordCount = Read32(ref FileContents, Offsets[4]);
            Header.EmulatorID    = ReadChars(ref FileContents, Offsets[6], 64);
            Header.FrameCount    = FileContents.Length - HEADER_SIZE / BytesPerFrame;

            getFrameInput(ref FileContents);
        }
Пример #11
0
        public PCSX(string PXMFile)
        {
            Filename = PXMFile;
            FillByteArrayFromFile(PXMFile, ref FileContents);
            if ((1 & (FileContents[Offsets[3]] >> 6)) == 1)
                throw new System.Exception();    // this should be done better

            ControllerDataOffset = Read32(ref FileContents, Offsets[14]);
            SaveStateOffset      = Read32(ref FileContents, Offsets[9]);

            Header = new TASHeader();
            Header.Signature     = ReadHEX(ref FileContents, Offsets[0], 4);
            Header.Version       = Read32(ref FileContents, Offsets[1]);
            Header.FrameCount    = Read32(ref FileContents, Offsets[7]);
            Header.RerecordCount = Read32(ref FileContents, Offsets[8]);

            Options = new TASOptions(true);
            Options.MovieStartFlag[0]  = (1 & (FileContents[Offsets[3]] >> 1)) == 1 ? true : false;
            Options.MovieStartFlag[1]  = (1 & (FileContents[Offsets[3]] >> 1)) == 0 ? true : false;
            Options.MovieTimingFlag[0] = (1 & (FileContents[Offsets[3]] >> 2)) == 0 ? true : false;
            Options.MovieTimingFlag[1] = (1 & (FileContents[Offsets[3]] >> 2)) == 1 ? true : false;

            PXMSpecific = new FormatSpecific(FileContents[Offsets[5]], FileContents[Offsets[6]]);
            PXMSpecific.HasEmbeddedMemoryCards = (1 & (FileContents[Offsets[3]] >> 3)) == 1 ? true : false;
            PXMSpecific.HasEmbeddedCheatList   = (1 & (FileContents[Offsets[3]] >> 4)) == 1 ? true : false;
            PXMSpecific.UsesHacks              = (1 & (FileContents[Offsets[3]] >> 5)) == 1 ? true : false;
            PXMSpecific.IsTextFile             = (1 & (FileContents[Offsets[3]] >> 6)) == 1 ? true : false;
            PXMSpecific.P1MultitapToggle       = (1 & (FileContents[Offsets[3]] >> 7)) == 1 ? true : false;
            PXMSpecific.P2MultitapToggle       = (1 & (FileContents[Offsets[3]] >> 8)) == 1 ? true : false;
            PXMSpecific.EnabledAnalogHack      = (1 & (FileContents[Offsets[3]] >> 9)) == 1 ? true : false;
            PXMSpecific.EnabledParasiteEveFix  = (1 & (FileContents[Offsets[3]] >> 10)) == 1 ? true : false;

            PXMSpecific.EmulatorVersion   = Read32(ref FileContents, Offsets[2]);
            PXMSpecific.MemoryCard1Offset = Read32(ref FileContents, Offsets[10]);
            PXMSpecific.MemoryCard2Offset = Read32(ref FileContents, Offsets[11]);
            PXMSpecific.CheatListOffset   = Read32(ref FileContents, Offsets[12]);
            PXMSpecific.CDRomIDOffset     = Read32(ref FileContents, Offsets[13]);

            PXMSpecific.CDRomCount       = FileContents[PXMSpecific.CDRomIDOffset];

            Extra = new TASExtra();
            Extra.ROM = ReadChars(ref FileContents, PXMSpecific.CDRomIDOffset + 1, PXMSpecific.CDRomCount * 9);
            Extra.Author = ReadChars(ref FileContents, Offsets[16], Read32(ref FileContents, Offsets[15]));

            Input = new TASInput(3, true);

            getFrameInput(ref FileContents);
        }
Пример #12
0
        public VisualBoyAdvance(string VBMFile)
        {
            Filename = VBMFile;
            FillByteArrayFromFile(VBMFile, ref FileContents);

            SaveStateOffset      = Read32(ref FileContents, Offsets[17]);
            ControllerDataOffset = Read32(ref FileContents, Offsets[18]);

            Header = new TASHeader();
            Header.Signature     = ReadHEX(ref FileContents, Offsets[0], 4);
            Header.Version       = Read32(ref FileContents, Offsets[1]);
            Header.UID           = ConvertUNIXTime(Read32(ref FileContents, Offsets[2]));
            Header.FrameCount    = Read32(ref FileContents, Offsets[3]);    // FIXME: unreliable
            Header.RerecordCount = Read32(ref FileContents, Offsets[4]);

            Options = new TASOptions(true);
            Options.MovieStartFlag[0] = ((1 & (FileContents[Offsets[5]] >> 0)) == 1) ? true : false;
            Options.MovieStartFlag[1] = ((1 & (FileContents[Offsets[5]] >> 1)) == 1) ? true : false;
            Options.MovieStartFlag[2] = (!Options.MovieStartFlag[0] && !Options.MovieStartFlag[1]) ? true : false;

            int activeControllers = 0;
            Input = new TASInput(4, false);
            for (int i = 0; i < 4; i++)
            {
                if ((1 & (FileContents[Offsets[6]] >> i)) == 1)
                {
                    Input.Controllers[i] = true;
                    activeControllers++;
                }
                else
                {
                    Input.Controllers[i] = false;
                }
            }
            // deduce the actual frame count from the file content
            Header.FrameCount = (FileContents.Length - ControllerDataOffset) / (activeControllers * 2);

            Extra = new TASExtra();
            Extra.Author      = ReadChars(ref FileContents, HEADER_SIZE, 64);
            Extra.Description = ReadChars(ref FileContents, HEADER_SIZE + 64, 128);
            Extra.ROM         = ReadChars(ref FileContents, Offsets[12], 12);
            Extra.CRC         = Convert.ToString((int)Offsets[14]);

            VBMSpecific = new FormatSpecific(FileContents[Offsets[7]], FileContents[Offsets[8]]);
            VBMSpecific.MinorVersion = FileContents[Offsets[13]];

            getFrameInput(ref FileContents);
        }
Пример #13
0
        public SNES9x(string SMVFile)
        {
            Filename = SMVFile;
            FillByteArrayFromFile(SMVFile, ref FileContents);

            ControllerDataOffset = Read32(ref FileContents, Offsets[10]);
            SaveStateOffset      = Read32(ref FileContents, Offsets[9]);

            Header = new TASHeader();
            Header.Signature     = ReadHEX(ref FileContents, Offsets[0], 4);
            Header.Version       = Read32(ref FileContents, Offsets[1]);
            Header.UID           = ConvertUNIXTime(Read32(ref FileContents, Offsets[2]));
            Header.FrameCount    = Read32(ref FileContents, Offsets[4]) + 1;    // including the 0th frame
            Header.RerecordCount = Read32(ref FileContents, Offsets[3]);

            Options = new TASOptions(true);
            Options.MovieStartFlag[0]  = (1 & (FileContents[Offsets[6]] >> 0)) == 0 ? true : false;
            Options.MovieStartFlag[1]  = (1 & (FileContents[Offsets[6]] >> 0)) == 1 ? true : false;
            Options.MovieTimingFlag[0] = (1 & (FileContents[Offsets[6]] >> 1)) == 0 ? true : false;
            Options.MovieTimingFlag[1] = (1 & (FileContents[Offsets[6]] >> 1)) == 1 ? true : false;

            SMVSpecific = new FormatSpecific(Header.Version, ref FileContents, ref Offsets);

            Extra = new TASExtra();
            if (SMVSpecific.HASROMINFO)
            {
                Extra.ROM = ReadChars(ref FileContents, 0x07 + SaveStateOffset - EXTRAROMINFO_SIZE, 23);
                Extra.CRC = ReadHEXUnicode(ref FileContents, 0x03 + SaveStateOffset - EXTRAROMINFO_SIZE, 4);
            }

            int MetaDataOffset = (Header.Version == 1 ? Offsets[11] : Offsets[16]);
            int MetaDataLength = (SaveStateOffset - MetaDataOffset) - (SMVSpecific.HASROMINFO ? EXTRAROMINFO_SIZE : 0);
            Extra.Author = ReadChars16(ref FileContents, MetaDataOffset, MetaDataLength);

            Input = new TASInput(5, false);
            for (int c = 0; c < 5; c++)
                Input.Controllers[c] = ((1 & (FileContents[Offsets[5]] >> c)) == 1 ? true : false);

            getFrameInput(ref FileContents);
        }
Пример #14
0
        /// <summary>
        /// Create a fully instantiated M64 object from the passed file
        /// </summary>        
        public Mupen64(string M64File)
        {
            Filename = M64File;
            FillByteArrayFromFile(M64File, ref FileContents);

            Header = new TASHeader();
            Header.Signature     = ReadHEX(ref FileContents, Offsets[0], 4);
            Header.Version       = Read32(ref FileContents, Offsets[1]);
            Header.UID           = ConvertUNIXTime(Read32(ref FileContents, Offsets[2]));
            Header.FrameCount    = Read32(ref FileContents, Offsets[3]);
            Header.RerecordCount = Read32(ref FileContents, Offsets[4]);

            // Though ControllerInputs is stored in the header, it can be determined
            // mathematically, so we may as well do it once instead of twice ;)
            //ControllerInputs     = Read32(ref FileContents, Offsets[8]);
            ControllerInputs = Read32(ref FileContents, Offsets[8]);

            if (Header.Version >= 3)
            {
                //ControllerInputs = (FileContents.Length - 0x400) / BYTES_PER_FRAME;
                ControllerDataOffset = 0x400;
            }
            else
            {
                //ControllerInputs = (FileContents.Length - 0x200) / BYTES_PER_FRAME;
                ControllerDataOffset = 0x200;
            }

            Options = new TASOptions(true);
            Options.MovieStartFlag[0] = (FileContents[Offsets[9]] | FileContents[Offsets[9] + 1]) == 1 ? true : false;
            Options.MovieStartFlag[2] = (FileContents[Offsets[9]] | FileContents[Offsets[9] + 1]) == 2 ? true : false;
            Options.FPS = FileContents[Offsets[5]];

            Extra = new TASExtra();
            Extra.ROM         = ReadChars(ref FileContents, Offsets[13], 64);
            Extra.CRC         = ReadHEXUnicode(ref FileContents, Offsets[14], 4);
            Extra.Country     = ReadChars(ref FileContents, Offsets[15], 2);
            Extra.Author      = ReadChars(ref FileContents, Offsets[21], 222);
            Extra.Description = ReadChars(ref FileContents, Offsets[22], 256);

            M64Specific = new FormatSpecific(ReadBytes(ref FileContents, Offsets[11], 4));
            M64Specific.VideoPlugin = ReadChars(ref FileContents, Offsets[17], 64);
            M64Specific.AudioPlugin = ReadChars(ref FileContents, Offsets[18], 64);
            M64Specific.InputPlugin = ReadChars(ref FileContents, Offsets[19], 64);
            M64Specific.RSPPlugin   = ReadChars(ref FileContents, Offsets[20], 64);

            Input = new TASInput(4, false);
            for (int i = 0; i < 4; i++)
                Input.Controllers[i] = M64Specific.Controller[i].Option[0];

            getFrameInput(ref FileContents);
        }