openitg/openitg — pull request #15 by DataBeaver (2012-06-26 12:47:59+00:00)
Title: Dynamic memory card support

This branch adds support for adding or removing memory cards without backing out of the song selection. It's controllable by a config option, which is disabled by default. When enabled, profiles are saved after each song to avoid losing any data if the card is pulled out.

To prevent freezing the game, profiles are saved in a thread. An icon with a red bang on top of the card is displayed as long as the card is mounted. There's no mutex, but I _think_ it's safe, unless the user somehow manages to play an entire song while the profile is still saving.

I'm also abusing the card locking logic in MemoryCardManager a bit. When dynamic cards are enabled, the flag no longer locks the cards but instead tells that the MemoryCardManager should load the profile when a new card is inserted. The mounting thread is paused while playing, so new cards won't be detected, but I'm uncertain of what will happen if a card is yanked and replaced with another mid-song.