Пример #1
0
        public virtual int sceKernelCreateVpl(PspString name, int partitionid, int attr, int size, TPointer option)
        {
            if (name.Null)
            {
                // PSP is returning this error is case of a NULL name
                return(SceKernelErrors.ERROR_KERNEL_ERROR);
            }

            if (option.NotNull)
            {
                int optionSize = option.getValue32();
                Console.WriteLine(string.Format("sceKernelCreateVpl option at {0}, size={1:D}", option, optionSize));
            }

            int memType = PSP_SMEM_Low;

            if ((attr & PSP_VPL_ATTR_ADDR_HIGH) == PSP_VPL_ATTR_ADDR_HIGH)
            {
                memType = PSP_SMEM_High;
            }

            if ((attr & ~PSP_VPL_ATTR_MASK) != 0)
            {
                Console.WriteLine("sceKernelCreateVpl bad attr value 0x" + attr.ToString("x"));
                return(ERROR_KERNEL_ILLEGAL_ATTR);
            }
            if (size == 0)
            {
                return(ERROR_KERNEL_ILLEGAL_MEMSIZE);
            }
            if (size < 0)
            {
                return(ERROR_KERNEL_NO_MEMORY);
            }

            SceKernelVplInfo info = SceKernelVplInfo.tryCreateVpl(name.String, partitionid, attr, size, memType);

            if (info == null)
            {
                return(ERROR_KERNEL_NO_MEMORY);
            }

            //if (log.DebugEnabled)
            {
                Console.WriteLine(string.Format("sceKernelCreateVpl returning {0}", info));
            }
            vplMap[info.uid] = info;

            return(info.uid);
        }