frontend: sync workaround for caanoo
authornotaz <notasas@gmail.com>
Mon, 27 Feb 2012 00:12:48 +0000 (02:12 +0200)
committernotaz <notasas@gmail.com>
Mon, 27 Feb 2012 23:46:14 +0000 (01:46 +0200)
trying to deal with "save corruption", no idea if this helps
as this never happens for me.

frontend/320240/caanoo.gpe
frontend/main.c

index 95a43d5..9d6154a 100755 (executable)
@@ -2,10 +2,22 @@
 
 # Wiz's timings are already good, apply this for Caanoo
 if [ -e /dev/accel ]; then
 
 # Wiz's timings are already good, apply this for Caanoo
 if [ -e /dev/accel ]; then
-./pollux_set "ram_timings=3,9,4,1,1,1,1"
+  ./pollux_set "ram_timings=3,9,4,1,1,1,1"
+fi
+
+# the sync mount causes problems when writing saves,
+# probably due to many write calls, so have to get rid of it
+if grep mmcblk /proc/mounts | grep -q '\<sync\>'; then
+  oldmount=`grep mmcblk /proc/mounts | grep '\<sync\>' | awk '{print $4}'`
+  mount /dev/mmcblk0p1 /mnt/sd/ -o remount,dirsync,noatime
 fi
 
 ./pcsx "$@"
 fi
 
 ./pcsx "$@"
+sync
+
+if [ -n "$oldmount" ]; then
+  mount /dev/mmcblk0p1 /mnt/sd/ -o remount,$oldmount
+fi
 
 cd /usr/gp2x
 exec ./gp2xmenu
 
 cd /usr/gp2x
 exec ./gp2xmenu
index 0dd488e..a305312 100644 (file)
@@ -531,6 +531,9 @@ int emu_save_state(int slot)
                return ret;
 
        ret = SaveState(fname);
                return ret;
 
        ret = SaveState(fname);
+#ifndef __ARM_ARCH_7A__ /* XXX */
+       sync();
+#endif
        printf("* %s \"%s\" [%d]\n", ret == 0 ? "saved" : "failed to save", fname, slot);
        return ret;
 }
        printf("* %s \"%s\" [%d]\n", ret == 0 ? "saved" : "failed to save", fname, slot);
        return ret;
 }