hint-less mode updated for SVP, state load callback, etc
[picodrive.git] / Pico / Area.c
index 1764669..0ec25ec 100644 (file)
@@ -28,6 +28,8 @@ areaeof   *areaEof   = (areaeof *) 0;
 areaseek  *areaSeek  = (areaseek *) 0;\r
 areaclose *areaClose = (areaclose *) 0;\r
 \r
+void (*PicoLoadStateHook)(void) = NULL;\r
+\r
 \r
 // Scan one variable and callback\r
 static int ScanVar(void *data,int len,char *name,void *PmovFile,int PmovAction)\r
@@ -174,10 +176,14 @@ int PmovState(int PmovAction, void *PmovFile)
   int minimum=0;\r
   unsigned char head[32];\r
 \r
-  if (PicoMCD & 1)\r
+  if ((PicoMCD & 1) || carthw_chunks != NULL)\r
   {\r
     if (PmovAction&1) return PicoCdSaveState(PmovFile);\r
-    if (PmovAction&2) return PicoCdLoadState(PmovFile);\r
+    if (PmovAction&2) {\r
+      int ret = PicoCdLoadState(PmovFile);\r
+      if (PicoLoadStateHook) PicoLoadStateHook();\r
+      return ret;\r
+    }\r
   }\r
 \r
   memset(head,0,sizeof(head));\r
@@ -197,6 +203,8 @@ int PmovState(int PmovAction, void *PmovFile)
   // Scan memory areas:\r
   PicoAreaScan(PmovAction, *(unsigned int *)(head+0x8), PmovFile);\r
 \r
+  if ((PmovAction&2) && PicoLoadStateHook) PicoLoadStateHook();\r
+\r
   return 0;\r
 }\r
 \r