CSPspEmu.Hle.Formats.EncryptedPrx.ExtraV2Mangle C# (CSharp) Method

ExtraV2Mangle() protected method

protected ExtraV2Mangle ( byte buffer1, byte codeExtra ) : void
buffer1 byte
codeExtra byte
return void
        protected void ExtraV2Mangle(byte* buffer1, byte codeExtra)
        {
            var g_dataTmp = new byte[20 + 0xA0];
            fixed (byte* buffer2 = g_dataTmp) // aligned
            {
                PointerUtils.Memcpy(buffer2 + 20, buffer1, 0xA0);
                var pl2 = (uint*)buffer2;
                pl2[0] = 5;
                pl2[1] = pl2[2] = 0;
                pl2[3] = codeExtra;
                pl2[4] = 0xA0;

                var ret = Kirk.hleUtilsBufferCopyWithRange(
                    buffer2,
                    20 + 0xA0,
                    buffer2,
                    20 + 0xA0,
                    Kirk.CommandEnum.PSP_KIRK_CMD_DECRYPT
                );

                if (ret != 0)
                {
                    throw (new Exception(String.Format("extra de-mangle returns {0}, ", ret)));
                }
                // copy result back
                PointerUtils.Memcpy(buffer1, buffer2, 0xA0);
            }
        }