예제 #1
0
        private void ScrambleBB(sbyte[] buf, int size, int seed, int cbc, int kirk_code)
        {
            // Set CBC mode.
            buf[0] = 0;
            buf[1] = 0;
            buf[2] = 0;
            buf[3] = (sbyte)cbc;

            // Set unkown parameters to 0.
            buf[4] = 0;
            buf[5] = 0;
            buf[6] = 0;
            buf[7] = 0;

            buf[8]  = 0;
            buf[9]  = 0;
            buf[10] = 0;
            buf[11] = 0;

            // Set the the key seed to seed.
            buf[12] = 0;
            buf[13] = 0;
            buf[14] = 0;
            buf[15] = (sbyte)seed;

            // Set the the data size to size.
            buf[16] = unchecked ((sbyte)((size >> 24) & 0xFF));
            buf[17] = unchecked ((sbyte)((size >> 16) & 0xFF));
            buf[18] = unchecked ((sbyte)((size >> 8) & 0xFF));
            buf[19] = unchecked ((sbyte)(size & 0xFF));

            ByteBuffer bBuf = ByteBuffer.wrap(buf);

            kirk.hleUtilsBufferCopyWithRange(bBuf, size, bBuf, size, kirk_code);
        }
예제 #2
0
		private void ScrambleSD(sbyte[] buf, int size, int seed, int cbc, int kirk_code)
		{
			// Set CBC mode.
			buf[0] = 0;
			buf[1] = 0;
			buf[2] = 0;
			buf[3] = (sbyte) cbc;

			// Set unkown parameters to 0.
			buf[4] = 0;
			buf[5] = 0;
			buf[6] = 0;
			buf[7] = 0;

			buf[8] = 0;
			buf[9] = 0;
			buf[10] = 0;
			buf[11] = 0;

			// Set the the key seed to seed.
			buf[12] = 0;
			buf[13] = 0;
			buf[14] = 0;
			buf[15] = (sbyte) seed;

			// Set the the data size to size.
			buf[16] = unchecked((sbyte)((size >> 24) & 0xFF));
			buf[17] = unchecked((sbyte)((size >> 16) & 0xFF));
			buf[18] = unchecked((sbyte)((size >> 8) & 0xFF));
			buf[19] = unchecked((sbyte)(size & 0xFF));

			// Ignore PSP_KIRK_CMD_ENCRYPT_FUSE and PSP_KIRK_CMD_DECRYPT_FUSE. 
			if (kirk_code == KIRK.PSP_KIRK_CMD_ENCRYPT_FUSE || kirk_code == KIRK.PSP_KIRK_CMD_DECRYPT_FUSE)
			{
				return;
			}

			ByteBuffer bBuf = ByteBuffer.wrap(buf);
			kirk.hleUtilsBufferCopyWithRange(bBuf, size, bBuf, size, kirk_code);
		}