First post, by Greenchili
I've been tinkering around with dosxbox (version of dosbox for the xbox) and I ran into this weird little issue where if you "r"eload a save game and then attempt to 's'ave back to the same slot it gives a file error. Almost like it is leaving the file open so that "save" attempt fails. The 's'aves work on any slot that has not been loaded. Upon exiting and reloading the game, for example, a save to a slot will work as long as a load from the same slot is not done.
So I traced through the code and I discovered that Crystal Caves does an Open twice when 'r'eloading a save game. It closes the second file opened but leaves the first file open. Thus the cause of the issue. Looking through the dosbox code there is a section that "flushes" the buffer when an open is done on a file that has already been opened. So it is capable of detecting multiple opens on the same file.
Trying Crystal Caves on my Windows XP machine however produced a different result. The problem never happens.
So now comes the question... Bear with me my memory from DOS days is fuzzy.
I presume that DOS allowed multiple opens on the same file.. limited, of course, by the number set in config.sys with the FILES= command.
Apparently opening a file for read does not conflict with opening the same file under a different handle as read/write.
The fact that it works properly while running dosbox under WIndows XP makes me conclude that Windows XP feels the same way. Maybe in this case it is allowing it because the file is being accessed by the same app "dosbox". Whereas if I had the same file opened by another program it would fail?
So basically I'm just trying to figure out the best way to handle this particular situation in the dosxbox build. Apparently having a file open for read and then attempting to open another file handle as read/write is a big no no. But I'm unfamiliar with how dos programs/games typically behave in regards to opening multiple file so I dont wanna potentially screw some other game/program up.
Thoughts, comments?