At present, it's almost impossible to have more than 10 memory cards without a PC. This PR fixes the issue where 2 digit (eg. "10.MCR") filenames are not created correctly, and also fixes the (unreported) issue where a file could not be created if one of the previous files were corrupted (eg. wrong-size).
Basically, this patch will attempt to brute force the creation of a file, until it finds a filename which does not exist. This may take a short while if you have thousands of cards, and may cause issues if exceeding the filename limit after 9999999999999999999999999999.MCR cards - so don't create more than 10 octillion cards.
I suspect this may be significantly faster than the previous method, although I have not tested speed.
At present, it's almost impossible to have more than 10 memory cards without a PC. This PR fixes the issue where 2 digit (eg. "10.MCR") filenames are not created correctly, and also fixes the (unreported) issue where a file could not be created if one of the previous files were corrupted (eg. wrong-size).
Basically, this patch will attempt to brute force the creation of a file, until it finds a filename which does not exist. This may take a short while if you have thousands of cards, and may cause issues if exceeding the filename limit after 9999999999999999999999999999.MCR cards - so don't create more than 10 octillion cards.
I suspect this may be significantly faster than the previous method, although I have not tested speed.
Fixes #40