From 7cffcd27739f18455ac34b664a918731265ff612 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 27 May 2013 23:48:31 -0700 Subject: [PATCH 1/3] Correct TLS object save stating. --- Core/HLE/sceKernelMemory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/HLE/sceKernelMemory.cpp b/Core/HLE/sceKernelMemory.cpp index af43bc7997..3ed2635e19 100644 --- a/Core/HLE/sceKernelMemory.cpp +++ b/Core/HLE/sceKernelMemory.cpp @@ -1326,7 +1326,7 @@ struct TLS : public KernelObject const char *GetName() {return ntls.name;} const char *GetTypeName() {return "TLS";} static u32 GetMissingErrorCode() { return PSP_ERROR_UNKNOWN_TLS_ID; } - int GetIDType() const { return SCE_KERNEL_TMID_Vpl; } + int GetIDType() const { return SCE_KERNEL_TMID_Tls; } TLS() : next(0) {} From 4e76d45bcab61513a1d805fa9c81aed7cfed0ea3 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 27 May 2013 23:49:46 -0700 Subject: [PATCH 2/3] Add pcmIndex to sas voice DoState(). Otherwise we can get crashes. --- Core/HW/SasAudio.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Core/HW/SasAudio.cpp b/Core/HW/SasAudio.cpp index 144507f7ce..d1761d8911 100644 --- a/Core/HW/SasAudio.cpp +++ b/Core/HW/SasAudio.cpp @@ -491,6 +491,7 @@ void SasVoice::DoState(PointerWrap &p) p.Do(vagSize); p.Do(pcmAddr); p.Do(pcmSize); + p.Do(pcmIndex); p.Do(sampleRate); p.Do(sampleFrac); From c9e931e36275e2028ac0eb57d86aff465d544a8f Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 27 May 2013 23:59:03 -0700 Subject: [PATCH 3/3] Save the state of the PGD info struct. Not touching any of its internals. --- Core/HLE/sceIo.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index e0964d31ec..acba7bed92 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -15,6 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include #include "Core/Config.h" #include "Core/System.h" #include "Core/Host.h" @@ -143,6 +144,7 @@ public: FileNode() : callbackID(0), callbackArg(0), asyncResult(0), hasAsyncResult(false), pendingAsyncResult(false), sectorBlockMode(false), closePending(false), npdrm(0), pgdInfo(NULL) {} ~FileNode() { pspFileSystem.CloseFile(handle); + pgd_close(pgdInfo); } const char *GetName() {return fullpath.c_str();} const char *GetTypeName() {return "OpenFile";} @@ -165,7 +167,19 @@ public: p.Do(info); p.Do(openMode); - // TODO: Savestate PGD files? + p.Do(npdrm); + p.Do(pgd_offset); + bool hasPGD = pgdInfo != NULL; + p.Do(hasPGD); + if (hasPGD) { + if (p.mode == p.MODE_READ) { + pgdInfo = (PGD_DESC*) malloc(sizeof(PGD_DESC)); + } + p.DoVoid(pgdInfo, sizeof(PGD_DESC)); + if (p.mode == p.MODE_READ) { + pgdInfo->block_buf = (u8 *)malloc(pgdInfo->block_size * 2); + } + } p.DoMarker("File"); } @@ -768,9 +782,6 @@ u32 sceIoClose(int id) { u32 error; DEBUG_LOG(HLE, "sceIoClose(%d)", id); FileNode *f = kernelObjects.Get(id, error); - if(f && f->npdrm){ - pgd_close(f->pgdInfo); - } // Timing is not accurate, aiming low for now. return hleDelayResult(kernelObjects.Destroy(id), "file closed", 100); }