From c3aca8dc4410e506f0287d0f1ae2ac2e9bf8df93 Mon Sep 17 00:00:00 2001 From: ripsaw8080 Date: Thu, 11 Oct 2018 14:58:18 +0000 Subject: [PATCH] When searching CD-ROM directory entries, strip trailing period of extension-less filenames after stripping file version number and separator. Fixes disc check in Air Power. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4167 --- src/dos/dos_mscdex.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/dos/dos_mscdex.cpp b/src/dos/dos_mscdex.cpp index 73fbabd3..a6d1b9c3 100644 --- a/src/dos/dos_mscdex.cpp +++ b/src/dos/dos_mscdex.cpp @@ -722,23 +722,18 @@ bool CMscdex::GetDirectoryEntry(Bit16u drive, bool copyFlag, PhysPt pathname, Ph } nameLength = mem_readb(defBuffer+index+32); MEM_StrCopy(defBuffer+index+33,entryName,nameLength); + // strip separator and file version number + char* separator = strchr(entryName,';'); + if (separator) *separator = 0; + // strip trailing period + size_t entrylen = strlen(entryName); + if (entrylen>0 && entryName[entrylen-1]=='.') entryName[entrylen-1] = 0; + if (strcmp(entryName,useName)==0) { //LOG(LOG_MISC,LOG_ERROR)("MSCDEX: Get DirEntry : Found : %s",useName); foundName = true; break; } - /* Xcom Apocalipse searches for MUSIC. and expects to find MUSIC;1 - * All Files on the CDROM are of the kind blah;1 - */ - char* longername = strchr(entryName,';'); - if(longername) { - *longername = 0; - if (strcmp(entryName,useName)==0) { - //LOG(LOG_MISC,LOG_ERROR)("MSCDEX: Get DirEntry : Found : %s",useName); - foundName = true; - break; - } - } index += entryLength; } while (index+33<=2048);