From 07a5dca98e9fbe846122f968fbde48dafb8c40fc Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 3 Feb 2013 22:10:06 -0800 Subject: [PATCH] Expand out some savestate code saving non-pod. --- Core/Dialog/PSPMsgDialog.cpp | 2 +- Core/HLE/sceKernel.h | 1 + Core/HLE/sceKernelAlarm.cpp | 4 +++- Core/HLE/sceKernelInterrupt.cpp | 17 ++++++++++++++++- Core/HLE/sceKernelInterrupt.h | 6 +++++- Core/HLE/sceKernelThread.cpp | 1 + Core/Util/BlockAllocator.cpp | 18 +++++++++++++++++- Core/Util/BlockAllocator.h | 1 + 8 files changed, 45 insertions(+), 5 deletions(-) diff --git a/Core/Dialog/PSPMsgDialog.cpp b/Core/Dialog/PSPMsgDialog.cpp index 13182e8e8c..d6d58c8db8 100644 --- a/Core/Dialog/PSPMsgDialog.cpp +++ b/Core/Dialog/PSPMsgDialog.cpp @@ -247,7 +247,7 @@ void PSPMsgDialog::DoState(PointerWrap &p) p.Do(flag); p.Do(messageDialog); p.Do(messageDialogAddr); - p.Do(msgText); + p.DoArray(msgText, sizeof(msgText)); p.Do(yesnoChoice); p.Do(okButtonImg); p.Do(cancelButtonImg); diff --git a/Core/HLE/sceKernel.h b/Core/HLE/sceKernel.h index 0185fd1e2c..17911153d9 100644 --- a/Core/HLE/sceKernel.h +++ b/Core/HLE/sceKernel.h @@ -18,6 +18,7 @@ #pragma once #include "../../Globals.h" +#include "Common.h" #include #include diff --git a/Core/HLE/sceKernelAlarm.cpp b/Core/HLE/sceKernelAlarm.cpp index eea167eff4..1d84ee5523 100644 --- a/Core/HLE/sceKernelAlarm.cpp +++ b/Core/HLE/sceKernelAlarm.cpp @@ -19,7 +19,9 @@ #include "sceKernelAlarm.h" #include "sceKernelInterrupt.h" #include "HLE.h" -#include "../../Core/CoreTiming.h" +#include "Core/CoreTiming.h" +#include "ChunkFile.h" +#include const int NATIVEALARM_SIZE = 20; diff --git a/Core/HLE/sceKernelInterrupt.cpp b/Core/HLE/sceKernelInterrupt.cpp index 21880ad98f..21d3476c7e 100644 --- a/Core/HLE/sceKernelInterrupt.cpp +++ b/Core/HLE/sceKernelInterrupt.cpp @@ -21,6 +21,7 @@ #include "HLE.h" #include "../MIPS/MIPS.h" +#include "ChunkFile.h" #include "sceKernel.h" #include "sceKernelThread.h" @@ -198,6 +199,14 @@ void IntrHandler::DoState(PointerWrap &p) { p.Do(intrNumber); p.Do(subIntrHandlers); + p.DoMarker("IntrHandler"); +} + +void PendingInterrupt::DoState(PointerWrap &p) +{ + p.Do(intr); + p.Do(subintr); + p.DoMarker("PendingInterrupt"); } void __InterruptsInit() @@ -221,7 +230,13 @@ void __InterruptsDoState(PointerWrap &p) intState.DoState(p); PendingInterrupt pi(0, 0); - p.Do(pendingInterrupts, pi); + + u32 list_size = (u32)pendingInterrupts.size(); + p.Do(list_size); + pendingInterrupts.resize(list_size, pi); + for (auto it = pendingInterrupts.begin(), end = pendingInterrupts.end(); it != end; ++it) + it->DoState(p); + p.Do(interruptsEnabled); p.Do(inInterrupt); p.DoMarker("sceKernelInterrupt"); diff --git a/Core/HLE/sceKernelInterrupt.h b/Core/HLE/sceKernelInterrupt.h index 3327dd6162..b1e27ab125 100644 --- a/Core/HLE/sceKernelInterrupt.h +++ b/Core/HLE/sceKernelInterrupt.h @@ -17,7 +17,9 @@ #pragma once -#include "../../Common/ChunkFile.h" +#include + +class PointerWrap; enum PSPInterrupt { PSP_GPIO_INTR = 4, @@ -81,6 +83,8 @@ struct PendingInterrupt { PendingInterrupt(int intr_, int subintr_) : intr(intr_), subintr(subintr_) {} + void DoState(PointerWrap &p); + int intr; int subintr; }; diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index 928e0ab840..23ec4e6b26 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -27,6 +27,7 @@ #include "../MIPS/MIPS.h" #include "../../Core/CoreTiming.h" #include "../../Core/MemMap.h" +#include "ChunkFile.h" #include "sceAudio.h" #include "sceKernel.h" diff --git a/Core/Util/BlockAllocator.cpp b/Core/Util/BlockAllocator.cpp index c98c747d34..a7e03930e0 100644 --- a/Core/Util/BlockAllocator.cpp +++ b/Core/Util/BlockAllocator.cpp @@ -326,9 +326,25 @@ u32 BlockAllocator::GetTotalFreeBytes() void BlockAllocator::DoState(PointerWrap &p) { Block b(0, 0, false); - p.Do(blocks, b); + + u32 list_size = (u32)blocks.size(); + p.Do(list_size); + blocks.resize(list_size, b); + + for (auto it = blocks.begin(), end = blocks.end(); it != end; ++it) + it->DoState(p); + p.Do(rangeStart_); p.Do(rangeSize_); p.Do(grain_); p.DoMarker("BlockAllocator"); } + +void BlockAllocator::Block::DoState(PointerWrap &p) +{ + p.Do(start); + p.Do(size); + p.Do(taken); + p.DoArray(tag, sizeof(tag)); + p.DoMarker("Block"); +} diff --git a/Core/Util/BlockAllocator.h b/Core/Util/BlockAllocator.h index 0fd8abe351..98cb3e1cd2 100644 --- a/Core/Util/BlockAllocator.h +++ b/Core/Util/BlockAllocator.h @@ -63,6 +63,7 @@ private: strncpy(tag, "---", 32); tag[31] = 0; } + void DoState(PointerWrap &p); u32 start; u32 size; bool taken;