Exemple #1
0
/* FS: Q2 needs it badly -- See http://www.delorie.com/djgpp/doc/libc/libc_380.html for more information

   ATTENTION FORKERS
   DO NOT REMOVE THE SLEEP OR WARNING!
   THIS IS SERIOUS, NO LFN AND SOME SKIN NAMES GET TRUNCATED
   WEIRD SHIT HAPPENS
   DON'T SEND ME BUG REPORTS FROM A SESSION WITH NO LFN DRIVER LOADED!
*/
static void Sys_DetectLFN (void)
{
	if(skiplfncheck)
		return;
	if(!(_get_volume_info(NULL, 0, 0, NULL) & _FILESYS_LFN_SUPPORTED))
	{
		printf("WARNING: Long file name support not detected!  Grab a copy of DOSLFN!\n");
		sleep(2);
		printf("Continuing to load Quake II. . .\n");
	}
}
Exemple #2
0
/* get bitmap of valid drives */
unsigned long ossgetdisks(void)
{
    unsigned long mask;
    unsigned long ret;
    int drive;

    /* iterate over drives A: to Z: and test each one for validity */
    for (drive = 'A', mask = 1, ret = 0 ; drive <= 'Z' ; ++drive, mask <<= 1)
    {
        char dname[3];

        /* build a filename string for the drive, like "X:" */
        dname[0] = drive;
        dname[1] = ':';
        dname[2] = '\0';
        {
#  ifdef DJGPP
            int max_file_len;
            int max_path_len;
            char fstype[64];

            /* 
             *   check the file system type on the drive to see if the drive
             *   is valid 
             */
            if ((_get_volume_info(dname, &max_file_len, &max_path_len,
                                  fstype) & _FILESYS_UNKNOWN) == 0)
            {
                /* 
                 *   it's not unknown, so it must be valid - include it in
                 *   the result vector 
                 */
                ret |= mask;
            }

#  else /* DJGPP */
            char fcb[44];

            /*          
             *   Ask DOS to parse the drive letter filename (via int 0x21,
             *   function 0x290E).  DOS will give us an error indication if
             *   the drive is invalid.  
             */
            asm {
                push ds
                    push es
                    push bp
                    push si
                    push di

                    mov  si, ss
                    mov  ds, si
                    push ds
                    pop  es
                    lea  si, dname
                    lea  di, fcb
                    mov  ax, 0x290E  // parse filename
                    int  0x21
                    cmp  al, 0xFF
                    je   bad_drive
            }

            /* if we got this far, the drive is good */
            ret |= mask;

bad_drive:
            asm {
                pop  di
                    pop  si
                    pop  bp
                    pop  es
                    pop  ds
            }
#  endif
        }
    }

    return ret;
}