Example #1
0
        public VariablePoolId sceKernelCreateVpl(string Name, HleMemoryManager.Partitions PartitionId, VplAttribute Attribute, int Size, void *Options)
        {
            var VariablePool = new VariablePool()
            {
                Info = new SceKernelVplInfo()
                {
                    Attribute = Attribute,
                    FreeSize  = Size,
                }
            };

            /*
             * if (Attribute.HasFlag(VplAttribute.PSP_VPL_ATTR_ADDR_HIGH))
             * {
             *      HleState.MemoryManager.GetPartition(PartitionId).Allocate(Size)
             * } else {
             * }
             */
            VariablePool.Init();

            return(VariablePoolList.Create(VariablePool));

            /*
             * throw(new NotImplementedException());
             * const PSP_VPL_ATTR_MASK      = 0x41FF;  // Anything outside this mask is an illegal attr.
             * const PSP_VPL_ATTR_ADDR_HIGH = 0x4000;  // Create the vpl in high memory.
             * const PSP_VPL_ATTR_EXT       = 0x8000;  // Extend the vpl memory area (exact purpose is unknown).
             * //new MemorySegment
             * logWarning("sceKernelCreateVpl('%s', %d, %d, %d)", name, part, attr, size);
             * VariablePool variablePool;
             * if (attr & PSP_VPL_ATTR_ADDR_HIGH) {
             *      variablePool = new VariablePool(hleEmulatorState.moduleManager.get!SysMemUserForUser()._allocateMemorySegmentHigh(part, dupStr(name), size));
             * } else {
             *      variablePool = new VariablePool(hleEmulatorState.moduleManager.get!SysMemUserForUser()._allocateMemorySegmentLow(part, dupStr(name), size));
             * }
             * logWarning("%s", variablePool);
             * return uniqueIdFactory.add(variablePool);
             */
        }
        public VariablePoolId sceKernelCreateVpl(string Name, HleMemoryManager.Partitions PartitionId, VplAttribute Attribute, int Size, void* Options)
        {
            var VariablePool = new VariablePool()
            {
                Info = new SceKernelVplInfo()
                {
                    Attribute = Attribute,
                    FreeSize = Size,
                }
            };

            /*
            if (Attribute.HasFlag(VplAttribute.PSP_VPL_ATTR_ADDR_HIGH))
            {
                HleState.MemoryManager.GetPartition(PartitionId).Allocate(Size)
            } else {
            }
            */
            VariablePool.Init();

            return VariablePoolList.Create(VariablePool);

            /*
            throw(new NotImplementedException());
            const PSP_VPL_ATTR_MASK      = 0x41FF;  // Anything outside this mask is an illegal attr.
            const PSP_VPL_ATTR_ADDR_HIGH = 0x4000;  // Create the vpl in high memory.
            const PSP_VPL_ATTR_EXT       = 0x8000;  // Extend the vpl memory area (exact purpose is unknown).
            //new MemorySegment
            logWarning("sceKernelCreateVpl('%s', %d, %d, %d)", name, part, attr, size);
            VariablePool variablePool;
            if (attr & PSP_VPL_ATTR_ADDR_HIGH) {
                variablePool = new VariablePool(hleEmulatorState.moduleManager.get!SysMemUserForUser()._allocateMemorySegmentHigh(part, dupStr(name), size));
            } else {
                variablePool = new VariablePool(hleEmulatorState.moduleManager.get!SysMemUserForUser()._allocateMemorySegmentLow(part, dupStr(name), size));
            }
            logWarning("%s", variablePool);
            return uniqueIdFactory.add(variablePool);
            */
        }