From e7b2ddbedf7d872404db419fc151e7fcc6c23981 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Sat, 7 Aug 2010 18:46:48 +0000 Subject: [PATCH] Fix long standing weirdness with LBA: Copying of speech files failed. Don't cut off the next level if we stay in the same (large) directory. Thanks ripsaw Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3634 --- src/dos/dos_mscdex.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/dos/dos_mscdex.cpp b/src/dos/dos_mscdex.cpp index b0f011f6..94239878 100644 --- a/src/dos/dos_mscdex.cpp +++ b/src/dos/dos_mscdex.cpp @@ -678,6 +678,7 @@ bool CMscdex::GetDirectoryEntry(Bit16u drive, bool copyFlag, PhysPt pathname, Ph char entryName[256]; bool foundComplete = false; bool foundName; + bool nextPart = true; char* useName = 0; Bitu entryLength,nameLength; // clear error @@ -708,14 +709,15 @@ bool CMscdex::GetDirectoryEntry(Bit16u drive, bool copyFlag, PhysPt pathname, Ph if (!ReadSectors(GetSubUnit(drive),false,dirEntrySector,1,defBuffer)) return false; // Get string part foundName = false; - if (searchPos) { - useName = searchPos; - searchPos = strchr(searchPos,'\\'); + if (nextPart) { + if (searchPos) { + useName = searchPos; + searchPos = strchr(searchPos,'\\'); + } + if (searchPos) { *searchPos = 0; searchPos++; } + else foundComplete = true; } - if (searchPos) { *searchPos = 0; searchPos++; } - else foundComplete = true; - do { entryLength = mem_readb(defBuffer+index); if (entryLength==0) break; @@ -772,10 +774,12 @@ bool CMscdex::GetDirectoryEntry(Bit16u drive, bool copyFlag, PhysPt pathname, Ph // change directory dirEntrySector = mem_readd(defBuffer+index+2); dirSize = mem_readd(defBuffer+index+10); + nextPart = true; } else { // continue search in next sector dirSize -= 2048; dirEntrySector++; + nextPart = false; } }; error = 2; // file not found