• Login
  • Register
  • Dolphin Forums
  • Home
  • FAQ
  • Download
  • Wiki
  • Code


Dolphin, the GameCube and Wii emulator - Forums › Dolphin Site › Dolphin Patches (Archive) v
1 2 3 4 5 ... 7 Next »

[PATCH] Instant GC MemCard Directory Persists
View New Posts | View Today's Posts

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Modes
[PATCH] Instant GC MemCard Directory Persists
12-01-2014, 03:40 AM
#1
nano351 Offline
Junior Member
**
Posts: 21
Threads: 3
Joined: Jul 2013
So I've recently been using Dolphin for in-home streaming and have loved it. It has run beautifully for the games I wanted to play.

There has been one issue however, when using a directory for GC memcard it will only persist the saves to the file system upon a normal closing of the application (or quitting of the game). However, while using in-home streaming I use the steam big picture in-game interface to exit the game. The way this works (at least on Linux) is that it kills the process abruptly and thus the save data is lost.

This patch I wrote forces the save file to be persisted to disk every time a write occurs to solve this problem.

I haven't tested it too extensively but it seems to work fine for Super Smash Bros Melee and Mario Party 4. I haven't noticed any performance hit on my system, but I would expect there to be slowdowns in some instances on systems running on slow storage.


Attached Files
.patch   gcFolderInstantPersist.patch (Size: 7.04 KB / Downloads: 670)
Find
12-01-2014, 04:51 AM
#2
JMC47 Offline
Content Producer
*******
Content Creators (Moderators)
Posts: 6,543
Threads: 29
Joined: Feb 2013
I think this is a good thing to add; when Dolphin crashes, I've lost save data too. PM LPFaint99; he'll probably comment on it.
Find
12-01-2014, 11:02 AM (This post was last modified: 12-01-2014, 11:07 AM by LPFaint99.)
#3
LPFaint99 Offline
Developer
**********
Developers (Some Administrators and Super Moderators)
Posts: 531
Threads: 4
Joined: Mar 2009
looks like it will do the right thing, the biggest issue with it is it flushes after every write (128 bytes iirc) which is 64 writes per block,
which seems ok because most saves are small, but at the same time, the whole save is rewritten to disk, so it would be better at this point to memory map the files and write to them directly.
so say an average save is 10 blocks the whole save is written to disc 640 times.

Ideally though, the flush only occurs after writing has completed, or at the very least, after each block, even checking every 15 seconds like raw memorycard would be good


it should be noted that originally flushing the memcard directory was handled by the exi_memorycard class changed by https://github.com/dolphin-emu/dolphin/commit/bd7f856424b14e19ff9cc87066b728bb49de678c
Find
12-02-2014, 01:43 AM
#4
nano351 Offline
Junior Member
**
Posts: 21
Threads: 3
Joined: Jul 2013
(12-01-2014, 11:02 AM)LPFaint99 Wrote: looks like it will do the right thing, the biggest issue with it is it flushes after every write (128 bytes iirc) which is 64 writes per block,
which seems ok because most saves are small, but at the same time, the whole save is rewritten to disk, so it would be better at this point to memory map the files and write to them directly.
so say an average save is 10 blocks the whole save is written to disc 640 times.

Ideally though, the flush only occurs after writing has completed, or at the very least, after each block, even checking every 15 seconds like raw memorycard would be good


it should be noted that originally flushing the memcard directory was handled by the exi_memorycard class changed by https://github.com/dolphin-emu/dolphin/commit/bd7f856424b14e19ff9cc87066b728bb49de678c

It seems to me that memory mapping the files would be preferable. Like you said this fixes the save file being rewritten way too many times. It also ensures the writes happen as soon as they happen in game which is much more user-friendly so that you know when the game stops saying "saving" you know it's saved and the process can be safely killed. Rather than, if you have the polling thread you have to wait 15 seconds (or whatever the interval is) after it stops saying "saving" to know the changes have been persisted to the filesystem.

Although, perhaps a configuration option would be useful to allow people to choose between memory mapped and polling for instances where memory mapped saves might be the bottleneck.
Find
« Next Oldest | Next Newest »


  • View a Printable Version
  • Subscribe to this thread
Forum Jump:


Users browsing this thread: 1 Guest(s)



Powered By MyBB | Theme by Fragma

Linear Mode
Threaded Mode