mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-27 04:08:37 +01:00
Save state of a bunch of small modules.
This commit is contained in:
1 parent
1768365c13
commit
cd1d4367bf
17 files changed
+161
-30
No files matched your search
@@ -284,6 +284,30 @@ void __CtrlInit()
|
||||
memcpy(&ctrlBufs[i], &ctrlCurrent, sizeof(_ctrl_data));
|
||||
}
|
||||
|
||||
void __CtrlDoState(PointerWrap &p)
|
||||
{
|
||||
p.Do(analogEnabled);
|
||||
p.Do(ctrlLatchBufs);
|
||||
p.Do(ctrlOldButtons);
|
||||
|
||||
p.DoVoid(ctrlBufs, sizeof(ctrlBufs));
|
||||
p.Do(ctrlCurrent);
|
||||
p.Do(ctrlBuf);
|
||||
p.Do(ctrlBufRead);
|
||||
p.Do(latch);
|
||||
|
||||
p.Do(ctrlIdleReset);
|
||||
p.Do(ctrlIdleBack);
|
||||
|
||||
p.Do(ctrlCycle);
|
||||
|
||||
p.Do(waitingThreads);
|
||||
|
||||
p.Do(ctrlTimer);
|
||||
CoreTiming::RestoreRegisterEvent(ctrlTimer, "CtrlSampleTimer", __CtrlTimerUpdate);
|
||||
p.DoMarker("sceCtrl");
|
||||
}
|
||||
|
||||
void __CtrlShutdown()
|
||||
{
|
||||
waitingThreads.clear();
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../Common/ChunkFile.h"
|
||||
|
||||
void Register_sceCtrl();
|
||||
|
||||
#define CTRL_SQUARE 0x8000
|
||||
@@ -33,6 +35,7 @@ void Register_sceCtrl();
|
||||
#define CTRL_RTRIGGER 0x0200
|
||||
|
||||
void __CtrlInit();
|
||||
void __CtrlDoState(PointerWrap &p);
|
||||
void __CtrlShutdown();
|
||||
|
||||
void __CtrlButtonDown(u32 buttonBit);
|
||||
|
||||
+23
-12
@@ -12,19 +12,19 @@ typedef u32 FontLibraryHandle;
|
||||
typedef u32 FontHandle;
|
||||
|
||||
typedef struct {
|
||||
u32* userDataAddr;
|
||||
u32 numFonts;
|
||||
u32* cacheDataAddr;
|
||||
u32 userDataAddr;
|
||||
u32 numFonts;
|
||||
u32 cacheDataAddr;
|
||||
|
||||
// Driver callbacks.
|
||||
void *(*allocFuncAddr)(void *, u32);
|
||||
void (*freeFuncAddr )(void *, void *);
|
||||
u32* openFuncAddr;
|
||||
u32* closeFuncAddr;
|
||||
u32* readFuncAddr;
|
||||
u32* seekFuncAddr;
|
||||
u32* errorFuncAddr;
|
||||
u32* ioFinishFuncAddr;
|
||||
u32 allocFuncAddr;
|
||||
u32 freeFuncAddr;
|
||||
u32 openFuncAddr;
|
||||
u32 closeFuncAddr;
|
||||
u32 readFuncAddr;
|
||||
u32 seekFuncAddr;
|
||||
u32 errorFuncAddr;
|
||||
u32 ioFinishFuncAddr;
|
||||
} FontNewLibParams;
|
||||
|
||||
typedef enum {
|
||||
@@ -138,11 +138,22 @@ typedef struct {
|
||||
u16 bufHeight;
|
||||
u16 bytesPerLine;
|
||||
u16 pad;
|
||||
void *buffer;
|
||||
u32 bufferPtr;
|
||||
} GlyphImage;
|
||||
|
||||
FontNewLibParams fontLib;
|
||||
|
||||
void __FontInit()
|
||||
{
|
||||
memset(&fontLib, 0, sizeof(fontLib));
|
||||
}
|
||||
|
||||
void __FontDoState(PointerWrap &p)
|
||||
{
|
||||
p.Do(fontLib);
|
||||
p.DoMarker("sceFont");
|
||||
}
|
||||
|
||||
u32 sceFontNewLib(u32 FontNewLibParamsPtr, u32 errorCodePtr)
|
||||
{
|
||||
ERROR_LOG(HLE, "sceFontNewLib %x, %x", FontNewLibParamsPtr, errorCodePtr);
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../Common/ChunkFile.h"
|
||||
|
||||
void Register_sceFont();
|
||||
|
||||
void __FontInit();
|
||||
void __FontDoState(PointerWrap &p);
|
||||
@@ -44,6 +44,14 @@ void __ImposeInit()
|
||||
umdPopup = 0;
|
||||
}
|
||||
|
||||
void __ImposeDoState(PointerWrap &p)
|
||||
{
|
||||
p.Do(language);
|
||||
p.Do(buttonValue);
|
||||
p.Do(umdPopup);
|
||||
p.DoMarker("sceImpose");
|
||||
}
|
||||
|
||||
u32 sceImposeGetBatteryIconStatus(u32 chargingPtr, u32 iconStatusPtr)
|
||||
{
|
||||
DEBUG_LOG(HLE, "sceImposeGetBatteryIconStatus(%08x, %08x)", chargingPtr, iconStatusPtr);
|
||||
|
||||
@@ -17,5 +17,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../Common/ChunkFile.h"
|
||||
|
||||
void Register_sceImpose();
|
||||
void __ImposeInit();
|
||||
void __ImposeDoState(PointerWrap &p);
|
||||
+12
-1
@@ -34,6 +34,7 @@
|
||||
#include "sceAudio.h"
|
||||
#include "sceCtrl.h"
|
||||
#include "sceDisplay.h"
|
||||
#include "sceFont.h"
|
||||
#include "sceGe.h"
|
||||
#include "sceIo.h"
|
||||
#include "sceKernel.h"
|
||||
@@ -98,6 +99,7 @@ void __KernelInit()
|
||||
__SslInit();
|
||||
__ImposeInit();
|
||||
__UsbInit();
|
||||
__FontInit();
|
||||
|
||||
// "Internal" PSP libraries
|
||||
__PPGeInit();
|
||||
@@ -152,8 +154,17 @@ void __KernelDoState(PointerWrap &p)
|
||||
__KernelModuleDoState(p);
|
||||
__KernelMutexDoState(p);
|
||||
__KernelSemaDoState(p);
|
||||
|
||||
// TODO: non-kernel modules
|
||||
// TODO: PPGe
|
||||
__CtrlDoState(p);
|
||||
__FontDoState(p);
|
||||
__ImposeDoState(p);
|
||||
__PowerDoState(p);
|
||||
__SslDoState(p);
|
||||
__UmdDoState(p);
|
||||
__UsbDoState(p);
|
||||
|
||||
__PPGeDoState(p);
|
||||
|
||||
__InterruptsDoStateLate(p);
|
||||
__KernelThreadingDoStateLate(p);
|
||||
|
||||
@@ -33,6 +33,12 @@ void __PowerInit() {
|
||||
volatileMemLocked = false;
|
||||
}
|
||||
|
||||
void __PowerDoState(PointerWrap &p) {
|
||||
p.DoArray(powerCbSlots, ARRAY_SIZE(powerCbSlots));
|
||||
p.Do(volatileMemLocked);
|
||||
p.DoMarker("scePower");
|
||||
}
|
||||
|
||||
int scePowerGetBatteryLifePercent() {
|
||||
DEBUG_LOG(HLE, "100=scePowerGetBatteryLifePercent");
|
||||
return 100;
|
||||
|
||||
@@ -17,7 +17,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../Common/ChunkFile.h"
|
||||
|
||||
void __PowerInit();
|
||||
void __PowerDoState(PointerWrap &p);
|
||||
|
||||
void Register_scePower();
|
||||
void Register_sceSuspendForUser();
|
||||
@@ -35,6 +35,14 @@ void __SslInit()
|
||||
currentMemSize = 0;
|
||||
}
|
||||
|
||||
void __SslDoState(PointerWrap &p)
|
||||
{
|
||||
p.Do(isSslInit);
|
||||
p.Do(maxMemSize);
|
||||
p.Do(currentMemSize);
|
||||
p.DoMarker("sceSsl");
|
||||
}
|
||||
|
||||
int sceSslInit(int heapSize)
|
||||
{
|
||||
DEBUG_LOG(HLE, "sceSslInit %d", heapSize);
|
||||
|
||||
+4
-1
@@ -17,6 +17,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../Common/ChunkFile.h"
|
||||
|
||||
void Register_sceSsl();
|
||||
|
||||
void __SslInit();
|
||||
void __SslInit();
|
||||
void __SslDoState(PointerWrap &p);
|
||||
+17
-6
@@ -31,11 +31,11 @@ const int PSP_ERROR_UMD_INVALID_PARAM = 0x80010016;
|
||||
#define UMD_READABLE 0x20
|
||||
|
||||
|
||||
u8 umdActivated = 1;
|
||||
u32 umdStatus = 0;
|
||||
u32 umdErrorStat = 0;
|
||||
static int driveCBId= -1;
|
||||
int umdStatTimer = 0;
|
||||
static u8 umdActivated = 1;
|
||||
static u32 umdStatus = 0;
|
||||
static u32 umdErrorStat = 0;
|
||||
static int driveCBId = -1;
|
||||
static int umdStatTimer = 0;
|
||||
|
||||
|
||||
#define PSP_UMD_TYPE_GAME 0x10
|
||||
@@ -51,13 +51,24 @@ void __UmdStatTimeout(u64 userdata, int cyclesLate);
|
||||
|
||||
void __UmdInit()
|
||||
{
|
||||
umdStatTimer = CoreTiming::RegisterEvent("UmdTimeout", &__UmdStatTimeout);
|
||||
umdStatTimer = CoreTiming::RegisterEvent("UmdTimeout", __UmdStatTimeout);
|
||||
umdActivated = 1;
|
||||
umdStatus = 0;
|
||||
umdErrorStat = 0;
|
||||
driveCBId = -1;
|
||||
}
|
||||
|
||||
void __UmdDoState(PointerWrap &p)
|
||||
{
|
||||
p.Do(umdActivated);
|
||||
p.Do(umdStatus);
|
||||
p.Do(umdErrorStat);
|
||||
p.Do(driveCBId);
|
||||
p.Do(umdStatTimer);
|
||||
CoreTiming::RestoreRegisterEvent(umdStatTimer, "UmdTimeout", __UmdStatTimeout);
|
||||
p.DoMarker("sceUmd");
|
||||
}
|
||||
|
||||
u8 __KernelUmdGetState()
|
||||
{
|
||||
u8 state = UMD_PRESENT;
|
||||
|
||||
@@ -27,5 +27,6 @@ enum pspUmdState {
|
||||
};
|
||||
|
||||
void __UmdInit();
|
||||
void __UmdDoState(PointerWrap &p);
|
||||
|
||||
void Register_sceUmdUser();
|
||||
@@ -27,6 +27,12 @@ void __UsbInit()
|
||||
usbActivated = false;
|
||||
}
|
||||
|
||||
void __UsbDoState(PointerWrap &p)
|
||||
{
|
||||
p.Do(usbActivated);
|
||||
p.DoMarker("sceUsb");
|
||||
}
|
||||
|
||||
u32 sceUsbActivate() {
|
||||
ERROR_LOG(HLE, "UNIMPL sceUsbActivate");
|
||||
usbActivated = true;
|
||||
|
||||
@@ -20,3 +20,4 @@
|
||||
void Register_sceUsb();
|
||||
|
||||
void __UsbInit();
|
||||
void __UsbDoState(PointerWrap &p);
|
||||
+33
-10
@@ -39,21 +39,21 @@ struct PPGeVertex {
|
||||
s16 x, y; u16 z;
|
||||
};
|
||||
|
||||
u32 savedContextPtr;
|
||||
u32 savedContextSize = 512 * 4;
|
||||
static u32 savedContextPtr;
|
||||
static u32 savedContextSize = 512 * 4;
|
||||
|
||||
// Display list writer
|
||||
u32 dlPtr;
|
||||
u32 dlWritePtr;
|
||||
u32 dlSize = 0x10000; // should be enough for a frame of gui...
|
||||
static u32 dlPtr;
|
||||
static u32 dlWritePtr;
|
||||
static u32 dlSize = 0x10000; // should be enough for a frame of gui...
|
||||
|
||||
u32 dataPtr;
|
||||
u32 dataWritePtr;
|
||||
u32 dataSize = 0x10000; // should be enough for a frame of gui...
|
||||
static u32 dataPtr;
|
||||
static u32 dataWritePtr;
|
||||
static u32 dataSize = 0x10000; // should be enough for a frame of gui...
|
||||
|
||||
// Vertex collector
|
||||
u32 vertexStart;
|
||||
u32 vertexCount;
|
||||
static u32 vertexStart;
|
||||
static u32 vertexCount;
|
||||
|
||||
//only 0xFFFFFF of data is used
|
||||
static void WriteCmd(u8 cmd, u32 data) {
|
||||
@@ -141,6 +141,29 @@ void __PPGeInit()
|
||||
dlPtr, dataPtr, atlasPtr, atlasSize, savedContextPtr);
|
||||
}
|
||||
|
||||
void __PPGeDoState(PointerWrap &p)
|
||||
{
|
||||
p.Do(atlasPtr);
|
||||
p.Do(atlasWidth);
|
||||
p.Do(atlasHeight);
|
||||
|
||||
p.Do(savedContextPtr);
|
||||
p.Do(savedContextSize);
|
||||
|
||||
p.Do(dlPtr);
|
||||
p.Do(dlWritePtr);
|
||||
p.Do(dlSize);
|
||||
|
||||
p.Do(dataPtr);
|
||||
p.Do(dataWritePtr);
|
||||
p.Do(dataSize);
|
||||
|
||||
p.Do(vertexStart);
|
||||
p.Do(vertexCount);
|
||||
|
||||
p.DoMarker("PPGeDraw");
|
||||
}
|
||||
|
||||
void __PPGeShutdown()
|
||||
{
|
||||
if (atlasPtr)
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../Globals.h"
|
||||
#include "../../Common/ChunkFile.h"
|
||||
#include "ppge_atlas.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -29,6 +30,9 @@
|
||||
// space for the display list. The PSP must be inited.
|
||||
void __PPGeInit();
|
||||
|
||||
// Saves to and restores from savestates (kernel RAM pointers, etc.)
|
||||
void __PPGeDoState(PointerWrap &p);
|
||||
|
||||
// Just frees up the allocated kernel memory.
|
||||
void __PPGeShutdown();
|
||||
|
||||
|
||||
Reference in new issue
Block a user