diff --git a/include/dos_inc.h b/include/dos_inc.h index d5805e3b..8d733600 100644 --- a/include/dos_inc.h +++ b/include/dos_inc.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_inc.h,v 1.39 2004-04-03 19:19:29 canadacow Exp $ */ +/* $Id: dos_inc.h,v 1.40 2004-04-13 12:08:43 qbix79 Exp $ */ #ifndef DOS_H_ #define DOS_H_ @@ -428,9 +428,9 @@ private: #endif struct sDTA { Bit8u sdrive; /* The Drive the search is taking place */ - Bit8u sattr; /* The Attributes that need to be found */ Bit8u sname[8]; /* The Search pattern for the filename */ Bit8u sext[3]; /* The Search pattern for the extenstion */ + Bit8u sattr; /* The Attributes that need to be found */ Bit16u dirID; /* custom: dir-search ID for multiple searches at the same time */ Bit8u fill[6]; Bit8u attr; @@ -477,8 +477,11 @@ private: Bit16u date; Bit16u time; /* Reserved Block should be 8 bytes */ + Bit8u sft_entries; + Bit8u share_attributes; + Bit8u extra_info; Bit8u file_handle; - Bit8u reserved[7]; + Bit8u reserved[4]; /* end */ Bit8u cur_rec; /* Current record in current block */ Bit32u rndm; /* Current relative record number */ diff --git a/include/dos_system.h b/include/dos_system.h index 0ef54455..6eb0b4d6 100644 --- a/include/dos_system.h +++ b/include/dos_system.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_system.h,v 1.21 2004-03-04 19:49:14 qbix79 Exp $ */ +/* $Id: dos_system.h,v 1.22 2004-04-13 12:08:43 qbix79 Exp $ */ #ifndef DOSSYSTEM_H_ #define DOSSYSTEM_H_ @@ -86,8 +86,8 @@ public: Bit8u fhandle; }; -#define MAX_OPENDIRS 16 - +#define MAX_OPENDIRS 2048 +//Can be high as it's only storage (16 bit variable) class DOS_Drive_Cache { public: DOS_Drive_Cache (void); @@ -105,7 +105,7 @@ public: char* GetExpandName (const char* path); bool GetShortName (const char* fullname, char* shortname); - bool FindFirst (char* path, Bitu dtaAddress, Bitu& id); + bool FindFirst (char* path, Bitu& id); bool FindNext (Bitu id, char* &result); void CacheOut (const char* path, bool ignoreLastDir = false); @@ -120,21 +120,19 @@ public: public: CFileInfo(void) { orgname[0] = shortname[0] = 0; - nextEntry = shortNr = compareCount = 0; + nextEntry = shortNr = 0; isDir = false; } ~CFileInfo(void) { for (Bit32u i=0; i fileList; std::vector longNameList; @@ -143,18 +141,18 @@ public: private: bool RemoveTrailingDot (char* shortname); - Bits GetLongName (CFileInfo* info, char* shortname); + Bits GetLongName (CFileInfo* info, char* shortname); void CreateShortName (CFileInfo* dir, CFileInfo* info); Bit16u CreateShortNameID (CFileInfo* dir, const char* name); - int CompareShortname (const char* compareName, const char* shortName); - bool SetResult (CFileInfo* dir, char * &result, Bit16u entryNr); - bool IsCachedIn (CFileInfo* dir); - CFileInfo* FindDirInfo (const char* path, char* expandedPath); + int CompareShortname (const char* compareName, const char* shortName); + bool SetResult (CFileInfo* dir, char * &result, Bit16u entryNr); + bool IsCachedIn (CFileInfo* dir); + CFileInfo* FindDirInfo (const char* path, char* expandedPath); bool RemoveSpaces (char* str); - bool OpenDir (CFileInfo* dir, const char* path, Bit16u& id); - void CreateEntry (CFileInfo* dir, const char* name); - Bit16u GetFreeID (CFileInfo* dir); - void Clear (void); + bool OpenDir (CFileInfo* dir, const char* path, Bit16u& id); + void CreateEntry (CFileInfo* dir, const char* name); + Bit16u GetFreeID (CFileInfo* dir); + void Clear (void); CFileInfo* dirBase; char dirPath [CROSS_LEN]; @@ -170,6 +168,7 @@ private: char dirSearchName [MAX_OPENDIRS]; bool free [MAX_OPENDIRS]; CFileInfo* dirFindFirst [MAX_OPENDIRS]; + Bitu nextFreeFindFirst; char label [CROSS_LEN]; }; diff --git a/src/dos/drive_cache.cpp b/src/dos/drive_cache.cpp index 848827ec..e977c90f 100644 --- a/src/dos/drive_cache.cpp +++ b/src/dos/drive_cache.cpp @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: drive_cache.cpp,v 1.33 2004-03-03 12:40:59 qbix79 Exp $ */ +/* $Id: drive_cache.cpp,v 1.34 2004-04-13 12:08:43 qbix79 Exp $ */ #include "drives.h" #include "dos_inc.h" @@ -62,20 +62,22 @@ bool SortByDirNameRev(DOS_Drive_Cache::CFileInfo* const &a, DOS_Drive_Cache::CFi DOS_Drive_Cache::DOS_Drive_Cache(void) { - dirBase = new CFileInfo; - save_dir = 0; - srchNr = 0; - label[0] = 0; + dirBase = new CFileInfo; + save_dir = 0; + srchNr = 0; + label[0] = 0; + nextFreeFindFirst = 0; for (Bit32u i=0; ishortname,"~"); strcat(info->shortname,buffer); - // Create compare Count -// info->compareCount = tocopy; // Add (and cut) Extension, if available if (pos) { // Step to last extension... @@ -635,35 +636,29 @@ bool DOS_Drive_Cache::SetResult(CFileInfo* dir, char* &result, Bit16u entryNr) }; // FindFirst / FindNext -bool DOS_Drive_Cache::FindFirst(char* path, Bitu dtaAddress, Bitu& id) +bool DOS_Drive_Cache::FindFirst(char* path, Bitu& id) { Bit16u dirID; - Bitu dirFindFirstID = 0xffff; + Bitu dirFindFirstID = this->nextFreeFindFirst++; //increase it for the next search // Cache directory in if (!OpenDir(path,dirID)) return false; - // Seacrh if dta was already used before - for (Bitu n=0; ncompareCount == dtaAddress) { - // Reuse old dta - dirFindFirstID = n; break; - } - } else if (dirFindFirstID==0xffff) { - dirFindFirstID = n; - } - } - if (dirFindFirstID==0xffff) { + + if (dirFindFirstID == MAX_OPENDIRS) { // no free slot found... - LOG(LOG_MISC,LOG_ERROR)("DIRCACHE: FindFirst/Next failure : All slots full."); - // always use first then + LOG(LOG_MISC,LOG_ERROR)("DIRCACHE: FindFirst/Next: All slots full. Resetting"); + // Clear the internal list then. dirFindFirstID = 0; + this->nextFreeFindFirst = 1; //the next free one after this search + for(Bitu n=0; n nextEntry = 0; - dirFindFirst[dirFindFirstID]-> compareCount = dtaAddress; // Copy entries to use with FindNext for (Bitu i=0; ifileList.size(); i++) { diff --git a/src/dos/drive_local.cpp b/src/dos/drive_local.cpp index c395c7ae..8d54929a 100644 --- a/src/dos/drive_local.cpp +++ b/src/dos/drive_local.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: drive_local.cpp,v 1.46 2004-04-03 19:23:06 canadacow Exp $ */ +/* $Id: drive_local.cpp,v 1.47 2004-04-13 12:08:43 qbix79 Exp $ */ #include #include @@ -142,7 +142,7 @@ bool localDrive::FindFirst(char * _dir,DOS_DTA & dta) { if (tempDir[strlen(tempDir)-1]!=CROSS_FILESPLIT) strcat(tempDir,end); Bitu id; - if (!dirCache.FindFirst(tempDir,(Bitu)dos.dta,id)) + if (!dirCache.FindFirst(tempDir,id)) { DOS_SetError(DOSERR_PATH_NOT_FOUND); return false;