mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Kernel: Load volatile memblocks from save states.
Otherwise they'd reset to userMemory.
This commit is contained in:
parent
8772c6e2f8
commit
ef5eecce56
1 changed files with 17 additions and 2 deletions
|
@ -529,6 +529,16 @@ static BlockAllocator *BlockAllocatorFromID(int id) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int BlockAllocatorToID(const BlockAllocator *alloc) {
|
||||||
|
if (alloc == &kernelMemory)
|
||||||
|
return 1;
|
||||||
|
if (alloc == &userMemory)
|
||||||
|
return 2;
|
||||||
|
if (alloc == &volatileMemory)
|
||||||
|
return 5;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
enum SceKernelFplAttr
|
enum SceKernelFplAttr
|
||||||
{
|
{
|
||||||
PSP_FPL_ATTR_FIFO = 0x0000,
|
PSP_FPL_ATTR_FIFO = 0x0000,
|
||||||
|
@ -989,18 +999,23 @@ public:
|
||||||
alloc->Free(address);
|
alloc->Free(address);
|
||||||
}
|
}
|
||||||
bool IsValid() {return address != (u32)-1;}
|
bool IsValid() {return address != (u32)-1;}
|
||||||
BlockAllocator *alloc;
|
|
||||||
|
|
||||||
void DoState(PointerWrap &p) override
|
void DoState(PointerWrap &p) override
|
||||||
{
|
{
|
||||||
auto s = p.Section("PMB", 1);
|
auto s = p.Section("PMB", 1, 2);
|
||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Do(p, address);
|
Do(p, address);
|
||||||
DoArray(p, name, sizeof(name));
|
DoArray(p, name, sizeof(name));
|
||||||
|
if (s >= 2) {
|
||||||
|
int allocType = BlockAllocatorToID(alloc);
|
||||||
|
Do(p, allocType);
|
||||||
|
alloc = BlockAllocatorFromID(allocType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BlockAllocator *alloc;
|
||||||
u32 address;
|
u32 address;
|
||||||
char name[32];
|
char name[32];
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue