1
0
Fork 0

Emulate a trailing dot on volume labels of 8 characters when on a cdrom drive. mscdex weirdness. Fixes Fifa96 cdrom detection.

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3033
This commit is contained in:
Peter Veenstra 2007-11-01 12:15:34 +00:00
parent 1b2e2b541e
commit ac66214dab
7 changed files with 51 additions and 77 deletions

View file

@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: drives.cpp,v 1.12 2007-11-01 12:15:34 qbix79 Exp $ */
#include "dosbox.h"
#include "dos_system.h"
#include "drives.h"
@ -73,6 +75,34 @@ checkext:
return true;
}
void Set_Label(char const * const input, char * const output, bool cdrom) {
Bitu togo = 8;
Bitu vnamePos = 0;
Bitu labelPos = 0;
bool point = false;
//spacepadding the filenamepart to include spaces after the terminating zero is more closely to the specs. (not doing this now)
// HELLO\0' '' '
while (togo > 0) {
if (input[vnamePos]==0) break;
if (!point && (input[vnamePos]=='.')) { togo=4; point=true; }
output[labelPos] = toupper(input[vnamePos]);
labelPos++; vnamePos++;
togo--;
if ((togo==0) && !point) {
if (input[vnamePos]=='.') vnamePos++;
output[labelPos]='.'; labelPos++; point=true; togo=3;
}
};
output[labelPos]=0;
//Remove trailing dot. except when on cdrom and filename is exactly 8 (9 including the dot) letters. MSCDEX feature/bug (fifa96 cdrom detection)
if((labelPos > 0) && (output[labelPos-1] == '.') && !(cdrom && labelPos ==9))
output[labelPos-1] = 0;
}
DOS_Drive::DOS_Drive() {