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); } diff --git a/Core/HLE/sceKernelMemory.cpp b/Core/HLE/sceKernelMemory.cpp index d5c3970771..a584cd697d 100644 --- a/Core/HLE/sceKernelMemory.cpp +++ b/Core/HLE/sceKernelMemory.cpp @@ -1331,7 +1331,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) {} diff --git a/Core/HW/SasAudio.cpp b/Core/HW/SasAudio.cpp index c58f25816a..cac4baf4ad 100644 --- a/Core/HW/SasAudio.cpp +++ b/Core/HW/SasAudio.cpp @@ -505,6 +505,7 @@ void SasVoice::DoState(PointerWrap &p) p.Do(vagSize); p.Do(pcmAddr); p.Do(pcmSize); + p.Do(pcmIndex); p.Do(sampleRate); p.Do(sampleFrac);