public void Init()
{
var Alignment = Options.Alignment;
if (Alignment == 0) Alignment = 4;
//if (Alignment == 0) Alignment = 0x1000;
if (Attributes != (FplAttributes)0)
{
Console.Error.WriteLine("FPL: Unhandled Attribute : {0}", Attributes);
//throw (new NotImplementedException());
}
if (BlockSize == 0)
{
throw (new SceKernelException(SceKernelErrors.ERROR_KERNEL_ILLEGAL_MEMSIZE));
}
var Partition = MemoryManager.GetPartition(PartitionId);
//var TEST_FIXED_ADDRESS = 0x08800000U;
//var TEST_FIXED_ADDRESS = 0x08865980U;
//var TEST_FIXED_ADDRESS = 0x088A0000U;
//this.MemoryPartition = Partition.Allocate(NumberOfBlocks * BlockSize, Hle.MemoryPartition.Anchor.Set, TEST_FIXED_ADDRESS, Alignment);
//Partition.Dump();
try
{
this.MemoryPartition = Partition.Allocate(
NumberOfBlocks * BlockSize,
Hle.MemoryPartition.Anchor.Low,
0,
Alignment,
"<Fpl>: " + Name
);
}
catch (MemoryPartitionNoMemoryException)
{
throw (new SceKernelException(SceKernelErrors.ERROR_KERNEL_NO_MEMORY));
}
//Console.Error.WriteLine("FixedPool.Init: 0x{0:X}", this.MemoryPartition.Low);
this.FreeBlocks = new List<uint>();
this.UsedBlocks = new List<uint>();
this.WaitItemList = new List<WaitItem>();
for (int n = 0; n < NumberOfBlocks; n++)
{
this.FreeBlocks.Add(GetAddressFromBlockIndex(n));
}
//Console.Error.WriteLine(this);
}