Closed bkacjios closed 3 years ago
Thanks so much for this! I'll likely leave the safe shutdown option in place, just in case it is helpful for other reasons, but it's very nice to have a backup like this in case someone does a reset or ungraceful shutdown!
I haven't had any save corruption since enabling this, so I think it's working. You do have to close the emulator for the save to actually write though. It may be worth setting autosave_interval to something other than zero so saves can write to the disk on occasion.
So, I was looking into the filesystem syncing issues, and I think I came up with a better solution that will allow people to hard shutdown without any worry at all.
First of all, I decided to do some investigating on the USB port of the device. The system is running an ADB daemon, which allows you to login to a shell via
adb shell
.I checked the mounted drives, and low-and-behold, the SD card was mounted without
sync
/dev/block/vold/179:1 on /mnt/extsd type vfat (rw,dirsync,nosuid,nodev,relatime,uid=1000,gid=1023,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
This pull request renames the
gmenu2x
binary togmenu2x-bin
and makesgmenu2x
a bash script that will remount the SD card with thesync
flag set and then, after it's done, it will launch the menu. This should cause any and all writes to be written to the card as soon as they happen, so you should be able to shutdown while the game is running and keep your saves!Since the binary file is now a bash script, git doesn't want to display the changes properly, but you can view the script and what it does here. https://github.com/bkacjios/s30-add-on-pack/blob/main/bin/gmenu2x
I tested it by logging into the shell after a fresh boot, and the flag seems to be setting properly.
/dev/block/vold/179:1 on /mnt/extsd type vfat (rw,sync,dirsync,nosuid,nodev,relatime,uid=1000,gid=1023,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)