Rescan content on each file-first for all drives?

Developer's Forum, for discussion of bugs, code, and other developmental aspects of DOSBox.

Rescan content on each file-first for all drives?

Postby emendelson » 2018-1-22 @ 12:28

I'm working on a project (relevant for games) that sets up Windows 3.11 automatically, and I'm using my own DOSBox build (made with the help of many experts here). Because I want to be able to change and add files to the file system from the host Windows system, and have Windows 3.11 automatically see the changes, I added a line to drive_local.cpp that forces a refresh on every findfirst, like this:

Code: Select all
bool localDrive::FindFirst(char * _dir,DOS_DTA & dta,bool fcb_findfirst) {
   char tempDir[CROSS_LEN];
   strcpy(tempDir,basedir);
   strcat(tempDir,_dir);
   CROSS_FILENAME(tempDir);

   //force empty cache - this line added
   EmptyCache(); //rescan floppie-content on each findfirst
   
   for (unsigned int i=0;i<strlen(tempDir);i++) tempDir[i]=toupper(tempDir[i]);
   if (allocation.mediaid==0xF0 ) {
      EmptyCache(); //rescan floppie-content on each findfirst
   }


This method is probably very stupid, but it's the best I could think of. It has the odd side-effect of making drive A: invisible in the Windows 3.11 File Manager. You can run programs from a mounted drive A:, but you can't see the drive or the files in File Manager.

Is there a way to force a rescan of mounted drives on every findfirst, without this weird effect in the Windows 3.11 file manager? I'll be grateful for any advice, and I hope this system will be useful for gamers. It's already in pretty good shape, as described in another tread:

https://www.vogons.org/viewtopic.php?t=57756

EDIT: I know that I can get DOSBox to rescan on every findfirst by adding "-t floppy" to every mount command, but I'm trying to make this internal, so that a user doesn't need to think about it. Also, that change makes every drive report 1.4MB available, which is too little for installers.
emendelson
Oldbie
 
Posts: 744
Joined: 2010-2-14 @ 02:00

Re: Rescan content on each file-first for all drives?

Postby emendelson » 2018-1-22 @ 16:48

I guess the obvious answer to my question is:

Code: Select all
   if ((allocation.mediaid==0xF0 ) || (allocation.mediaid==0xF8)) {   


I'm a little slow to see these things... Anyway, I hope this is right.
emendelson
Oldbie
 
Posts: 744
Joined: 2010-2-14 @ 02:00


Return to DOSBox Development

Who is online

Users browsing this forum: No registered users and 1 guest