mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Psmf: Cleanup finishThread save state handling.
This commit is contained in:
parent
5fec5c90d8
commit
ad274d5b72
3 changed files with 22 additions and 4 deletions
|
@ -49,8 +49,10 @@ HLEHelperThread::HLEHelperThread(const char *threadName, const char *module, con
|
|||
}
|
||||
|
||||
HLEHelperThread::~HLEHelperThread() {
|
||||
__KernelDeleteThread(id_, SCE_KERNEL_ERROR_THREAD_TERMINATED, "helper deleted");
|
||||
kernelMemory.Free(entry_);
|
||||
if (id_)
|
||||
__KernelDeleteThread(id_, SCE_KERNEL_ERROR_THREAD_TERMINATED, "helper deleted");
|
||||
if (entry_)
|
||||
kernelMemory.Free(entry_);
|
||||
}
|
||||
|
||||
void HLEHelperThread::AllocEntry(u32 size) {
|
||||
|
@ -84,3 +86,8 @@ void HLEHelperThread::Terminate() {
|
|||
bool HLEHelperThread::Stopped() {
|
||||
return KernelIsThreadDormant(id_);
|
||||
}
|
||||
|
||||
void HLEHelperThread::Forget() {
|
||||
id_ = 0;
|
||||
entry_ = 0;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,9 @@ public:
|
|||
void Terminate();
|
||||
bool Stopped();
|
||||
|
||||
// For savestates.
|
||||
void Forget();
|
||||
|
||||
private:
|
||||
void AllocEntry(u32 size);
|
||||
void Create(const char *threadName, u32 prio, int stacksize);
|
||||
|
|
|
@ -543,15 +543,23 @@ void PsmfPlayer::DoState(PointerWrap &p) {
|
|||
}
|
||||
p.Do(psmfPlayerAvcAu);
|
||||
if (s >= 7) {
|
||||
bool hasFinishThread = finishThread != NULL;
|
||||
bool hasFinishThread = finishThread != nullptr;
|
||||
p.Do(hasFinishThread);
|
||||
if (hasFinishThread) {
|
||||
p.Do(finishThread);
|
||||
} else {
|
||||
if (finishThread)
|
||||
finishThread->Forget();
|
||||
delete finishThread;
|
||||
finishThread = nullptr;
|
||||
}
|
||||
} else if (s >= 6) {
|
||||
p.Do(finishThread);
|
||||
} else {
|
||||
finishThread = NULL;
|
||||
if (finishThread)
|
||||
finishThread->Forget();
|
||||
delete finishThread;
|
||||
finishThread = nullptr;
|
||||
}
|
||||
|
||||
if (s >= 8) {
|
||||
|
|
Loading…
Add table
Reference in a new issue