Exemplo n.º 1
0
		/// <summary>
		/// calculates the complete disc hash for matching to a redump
		/// </summary>
		public uint Calculate_PSX_RedumpHash()
		{
			//a special CRC32 is used to help us match redump's DB
			SpecialCRC32 crc = new SpecialCRC32();
			byte[] buffer2352 = new byte[2352];

			var dsr = new DiscSectorReader(disc);
			dsr.Policy.DeterministicClearBuffer = false; //live dangerously

			//read all sectors for redump hash
			for (int i = 0; i < disc.Session1.LeadoutLBA; i++)
			{
				dsr.ReadLBA_2352(i, buffer2352, 0);
				crc.Add(buffer2352, 0, 2352);
			}

			return crc.Result;
		}
Exemplo n.º 2
0
        /// <summary>
        /// calculates the complete disc hash for matching to a redump
        /// </summary>
        public uint Calculate_PSX_RedumpHash()
        {
            //a special CRC32 is used to help us match redump's DB
            SpecialCRC32 crc = new SpecialCRC32();

            byte[] buffer2352 = new byte[2352];

            var dsr = new DiscSectorReader(disc);

            dsr.Policy.DeterministicClearBuffer = false;             //live dangerously

            //read all sectors for redump hash
            for (int i = 0; i < disc.Session1.LeadoutLBA; i++)
            {
                dsr.ReadLBA_2352(i, buffer2352, 0);
                crc.Add(buffer2352, 0, 2352);
            }

            return(crc.Result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// calculates the hash for quick PSX Disc identification
        /// </summary>
        public uint Calculate_PSX_BizIDHash()
        {
            //notes about the hash:
            //"Arc the Lad II (J) 1.0 and 1.1 conflict up to 25 sectors (so use 26)
            //Tekken 3 (Europe) (Alt) and Tekken 3 (Europe) conflict in track 2 and 3 unfortunately, not sure what to do about this yet
            //the TOC isn't needed!
            //but it will help detect dumps with mangled TOCs which are all too common
            //
            //a possibly special CRC32 is used to help us match redump's DB elsewhere

            SpecialCRC32 crc = new SpecialCRC32();

            byte[] buffer2352 = new byte[2352];

            var dsr = new DiscSectorReader(disc)
            {
                Policy = { DeterministicClearBuffer = false }                 // live dangerously
            };

            //hash the TOC
            crc.Add((int)disc.TOC.Session1Format);
            crc.Add(disc.TOC.FirstRecordedTrackNumber);
            crc.Add(disc.TOC.LastRecordedTrackNumber);
            for (int i = 1; i <= 100; i++)
            {
                //if (disc.TOC.TOCItems[i].Exists) Console.WriteLine("{0:X8} {1:X2} {2:X2} {3:X8}", crc.Current, (int)disc.TOC.TOCItems[i].Control, disc.TOC.TOCItems[i].Exists ? 1 : 0, disc.TOC.TOCItems[i].LBATimestamp.Sector); //a little debugging
                crc.Add((int)disc.TOC.TOCItems[i].Control);
                crc.Add(disc.TOC.TOCItems[i].Exists ? 1 : 0);
                crc.Add((int)disc.TOC.TOCItems[i].LBA);
            }

            //hash first 26 sectors
            for (int i = 0; i < 26; i++)
            {
                dsr.ReadLBA_2352(i, buffer2352, 0);
                crc.Add(buffer2352, 0, 2352);
            }

            return(crc.Result);
        }
Exemplo n.º 4
0
		/// <summary>
		/// calculates the hash for quick PSX Disc identification
		/// </summary>
		public uint Calculate_PSX_BizIDHash()
		{
			//notes about the hash:
			//"Arc the Lad II (J) 1.0 and 1.1 conflict up to 25 sectors (so use 26)
			//Tekken 3 (Europe) (Alt) and Tekken 3 (Europe) conflict in track 2 and 3 unfortunately, not sure what to do about this yet
			//the TOC isn't needed!
			//but it will help detect dumps with mangled TOCs which are all too common
			//
			//a possibly special CRC32 is used to help us match redump's DB elsewhere

			SpecialCRC32 crc = new SpecialCRC32();
			byte[] buffer2352 = new byte[2352];

			var dsr = new DiscSectorReader(disc);
			dsr.Policy.DeterministicClearBuffer = false; //live dangerously

			//hash the TOC
			crc.Add((int)disc.TOC.Session1Format);
			crc.Add(disc.TOC.FirstRecordedTrackNumber);
			crc.Add(disc.TOC.LastRecordedTrackNumber);
			for (int i = 1; i <= 100; i++)
			{
				//if (disc.TOC.TOCItems[i].Exists) Console.WriteLine("{0:X8} {1:X2} {2:X2} {3:X8}", crc.Current, (int)disc.TOC.TOCItems[i].Control, disc.TOC.TOCItems[i].Exists ? 1 : 0, disc.TOC.TOCItems[i].LBATimestamp.Sector); //a little debugging
				crc.Add((int)disc.TOC.TOCItems[i].Control);
				crc.Add(disc.TOC.TOCItems[i].Exists ? 1 : 0);
				crc.Add((int)disc.TOC.TOCItems[i].LBA);
			}

			//hash first 26 sectors
			for (int i = 0; i < 26; i++)
			{
				dsr.ReadLBA_2352(i, buffer2352, 0);
				crc.Add(buffer2352, 0, 2352);
			}

			return crc.Result;
		}