Moving imgmount to dos_programs
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1939
This commit is contained in:
parent
4812b35a82
commit
e269c3d2ed
2 changed files with 230 additions and 221 deletions
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: dos_programs.cpp,v 1.26 2004-08-04 09:12:53 qbix79 Exp $ */
|
||||
/* $Id: dos_programs.cpp,v 1.27 2004-09-05 14:23:04 qbix79 Exp $ */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -34,7 +34,6 @@
|
|||
|
||||
|
||||
void MSCDEX_SetCDInterface(int intNr, int forceCD);
|
||||
void IMGMOUNT_ProgramStart(Program * * make);
|
||||
|
||||
class MOUNT : public Program {
|
||||
public:
|
||||
|
@ -125,7 +124,7 @@ public:
|
|||
return;
|
||||
}
|
||||
if (temp_line[temp_line.size()-1]!=CROSS_FILESPLIT) temp_line+=CROSS_FILESPLIT;
|
||||
Bit8u bit8size=(Bit8u) sizes[1];
|
||||
Bit8u bit8size=(Bit8u) sizes[1];
|
||||
if (type=="cdrom") {
|
||||
int num = -1;
|
||||
cmd->FindInt("-usecd",num,true);
|
||||
|
@ -225,13 +224,13 @@ private:
|
|||
ldp=(localDrive*)Drives[drive];
|
||||
tmpfile = ldp->GetSystemFilePtr(fullname, "r");
|
||||
if(tmpfile == NULL) {
|
||||
WriteOut("Bootdisk file does not exist. Failing.\n");
|
||||
WriteOut(MSG_Get("PROGRAM_BOOT_NOT_EXIST"));
|
||||
return NULL;
|
||||
}
|
||||
fclose(tmpfile);
|
||||
tmpfile = ldp->GetSystemFilePtr(fullname, "rb+");
|
||||
if(tmpfile == NULL) {
|
||||
WriteOut("Cannot open bootdisk file. Failing.\n");
|
||||
WriteOut(MSG_Get("PROGRAM_BOOT_NOT_OPEN"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -242,15 +241,7 @@ private:
|
|||
}
|
||||
|
||||
void printError(void) {
|
||||
WriteOut("This command boots DosBox from either a floppy or hard disk image.\n\n");
|
||||
WriteOut("For this command, one can specify a succession of floppy disks swappable\n");
|
||||
WriteOut("by pressing Ctrl-F4, and -l specifies the mounted drive to boot from. If\n");
|
||||
WriteOut("no drive letter is specified, this defaults to booting from the A drive.\n");
|
||||
WriteOut("The only bootable drive letters are A, C, and D. For booting from a hard\n");
|
||||
WriteOut("drive (C or D), the image should have already been mounted using the\n");
|
||||
WriteOut("IMGMOUNT command.\n\n");
|
||||
WriteOut("The syntax of this command is:\n\n");
|
||||
WriteOut("BOOT [diskimg1.img diskimg2.img] [-l driveletter]\n");
|
||||
WriteOut(MSG_Get("PROGRAM_BOOT_PRINT_ERROR"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -288,14 +279,14 @@ public:
|
|||
continue;
|
||||
}
|
||||
|
||||
WriteOut("Opening image file: %s\n", temp_line.c_str());
|
||||
WriteOut(MSG_Get("PROGRAM_BOOT_IMAGE_OPEN"), temp_line.c_str());
|
||||
usefile = getFSFile((Bit8u *)temp_line.c_str(), &floppysize, &rombytesize);
|
||||
if(usefile != NULL) {
|
||||
if(diskSwap[i] != NULL) delete diskSwap[i];
|
||||
diskSwap[i] = new imageDisk(usefile, (Bit8u *)temp_line.c_str(), floppysize, false);
|
||||
|
||||
} else {
|
||||
WriteOut("Cannot open %s", temp_line.c_str());
|
||||
WriteOut(MSG_Get("PROGRAM_BOOT_IMAGE_NOT_OPEN"), temp_line.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -308,11 +299,11 @@ public:
|
|||
swapInDisks();
|
||||
|
||||
if(imageDiskList[drive-65]==NULL) {
|
||||
WriteOut("Unable to boot off of drive %c", drive);
|
||||
WriteOut(MSG_Get("PROGRAM_BOOT_UNABLE"), drive);
|
||||
return;
|
||||
}
|
||||
|
||||
WriteOut("Booting from drive %c...\n", drive);
|
||||
WriteOut(MSG_Get("PROGRAM_BOOT_BOOT"),"Booting from drive %c...\n", drive);
|
||||
|
||||
bootSector bootarea;
|
||||
imageDiskList[drive-65]->Read_Sector(0,0,1,(Bit8u *)&bootarea);
|
||||
|
@ -450,21 +441,214 @@ static void INTRO_ProgramStart(Program * * make) {
|
|||
*make=new INTRO;
|
||||
}
|
||||
|
||||
class IMGMOUNT : public Program {
|
||||
public:
|
||||
void Run(void)
|
||||
{
|
||||
DOS_Drive * newdrive;
|
||||
imageDisk * newImage;
|
||||
Bit32u imagesize;
|
||||
char drive;
|
||||
std::string label;
|
||||
|
||||
std::string type="hdd";
|
||||
std::string fstype="fat";
|
||||
cmd->FindString("-t",type,true);
|
||||
cmd->FindString("-fs",fstype,true);
|
||||
Bit8u mediaid;
|
||||
if (type=="floppy" || type=="hdd" || type=="iso") {
|
||||
Bit16u sizes[4];
|
||||
|
||||
std::string str_size;
|
||||
mediaid=0xF8;
|
||||
|
||||
if (type=="floppy") {
|
||||
mediaid=0xF0;
|
||||
} else if (type=="cdrom" || type=="iso") {
|
||||
str_size="650,127,16513,1700";
|
||||
mediaid=0xF8;
|
||||
fstype = "iso";
|
||||
}
|
||||
cmd->FindString("-size",str_size,true);
|
||||
if ((type=="hdd") && (str_size.size()==0)) {
|
||||
WriteOut("Must specify drive geometry for hard drives:\n");
|
||||
WriteOut("bytes_per_sector, sectors_per_cylinder, heads_per_cylinder, cylinder_count\n");
|
||||
return;
|
||||
}
|
||||
char number[20];
|
||||
const char * scan=str_size.c_str();
|
||||
Bitu index=0;Bitu count=0;
|
||||
|
||||
while (*scan) {
|
||||
if (*scan==',') {
|
||||
number[index]=0;sizes[count++]=atoi(number);
|
||||
index=0;
|
||||
} else number[index++]=*scan;
|
||||
scan++;
|
||||
}
|
||||
number[index]=0;sizes[count++]=atoi(number);
|
||||
|
||||
if(fstype=="fat" || fstype=="iso") {
|
||||
// get the drive letter
|
||||
cmd->FindCommand(1,temp_line);
|
||||
if ((temp_line.size() > 2) || ((temp_line.size()>1) && (temp_line[1]!=':'))) {
|
||||
WriteOut("Must specify drive letter to mount image at.\n");
|
||||
return;
|
||||
}
|
||||
drive=toupper(temp_line[0]);
|
||||
if (!isalpha(drive)) {
|
||||
WriteOut("Must specify drive letter to mount image at.\n");
|
||||
return;
|
||||
}
|
||||
} else if (fstype=="none") {
|
||||
cmd->FindCommand(1,temp_line);
|
||||
if ((temp_line.size() > 1) || (!isdigit(temp_line[0]))) {
|
||||
WriteOut("Must specify drive number (0 or 3) to mount image at (0,1=fda,fdb;2,3=hda,hdb)\n");
|
||||
return;
|
||||
}
|
||||
drive=temp_line[0]-'0';
|
||||
if(drive>3) {
|
||||
WriteOut("Must specify drive number (0 or 3) to mount image at (0,1=fda,fdb;2,3=hda,hdb)\n");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
WriteOut("Format \"%s\" is unsupported. Specify \"fat\" or \"none\".\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cmd->FindCommand(2,temp_line)) {
|
||||
WriteOut("Must specify file image to mount\n");
|
||||
return;
|
||||
}
|
||||
if (!temp_line.size()) {
|
||||
WriteOut("Must specify file image to mount\n");
|
||||
return;
|
||||
}
|
||||
struct stat test;
|
||||
if (stat(temp_line.c_str(),&test)) {
|
||||
// convert dosbox filename to system filename
|
||||
char fullname[CROSS_LEN];
|
||||
char tmp[CROSS_LEN];
|
||||
strncpy(tmp, temp_line.c_str(), CROSS_LEN);
|
||||
|
||||
Bit8u drive;
|
||||
if (!DOS_MakeName(tmp, fullname, &drive)) {
|
||||
WriteOut("Image file not found\n");
|
||||
return;
|
||||
}
|
||||
|
||||
localDrive *ldp = (localDrive*)Drives[drive];
|
||||
ldp->GetSystemFilename(tmp, fullname);
|
||||
temp_line = tmp;
|
||||
|
||||
if (stat(temp_line.c_str(),&test)) {
|
||||
WriteOut("Image file not found\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((test.st_mode & S_IFDIR)) {
|
||||
WriteOut("To mount directories, use the MOUNT command, not the IMGMOUNT command\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if(fstype=="fat") {
|
||||
newdrive=new fatDrive(temp_line.c_str(),sizes[0],sizes[1],sizes[2],sizes[3],0);
|
||||
} else if (fstype=="iso") {
|
||||
int error;
|
||||
newdrive = new isoDrive(drive, temp_line.c_str(), mediaid, error);
|
||||
switch (error) {
|
||||
case 0 : WriteOut(MSG_Get("MSCDEX_SUCCESS")); break;
|
||||
case 1 : WriteOut(MSG_Get("MSCDEX_ERROR_MULTIPLE_CDROMS")); break;
|
||||
case 2 : WriteOut(MSG_Get("MSCDEX_ERROR_NOT_SUPPORTED")); break;
|
||||
case 3 : WriteOut(MSG_Get("MSCDEX_ERROR_PATH")); break;
|
||||
case 4 : WriteOut(MSG_Get("MSCDEX_TOO_MANY_DRIVES")); break;
|
||||
case 5 : WriteOut(MSG_Get("MSCDEX_LIMITED_SUPPORT")); break;
|
||||
default : WriteOut(MSG_Get("MSCDEX_UNKNOWN_ERROR")); break;
|
||||
};
|
||||
if (error) {
|
||||
delete newdrive;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
FILE *newDisk = fopen(temp_line.c_str(), "rb+");
|
||||
fseek(newDisk,0L, SEEK_END);
|
||||
imagesize = (ftell(newDisk) / 1024);
|
||||
|
||||
newImage = new imageDisk(newDisk, (Bit8u *)temp_line.c_str(), imagesize, (imagesize > 2880));
|
||||
if(imagesize>2880) newImage->Set_Geometry(sizes[2],sizes[3],sizes[1],sizes[0]);
|
||||
}
|
||||
}
|
||||
if(fstype=="fat") {
|
||||
if (Drives[drive-'A']) {
|
||||
WriteOut("Drive already mounted at that letter\n");
|
||||
if (newdrive) delete newdrive;
|
||||
return;
|
||||
}
|
||||
if (!newdrive) WriteOut("Can't create drive from file\n");
|
||||
Drives[drive-'A']=newdrive;
|
||||
// Set the correct media byte in the table
|
||||
mem_writeb(Real2Phys(dos.tables.mediaid)+drive-'A',mediaid);
|
||||
WriteOut("Drive %c mounted as %s\n",drive,temp_line.c_str());
|
||||
if(((fatDrive *)newdrive)->loadedDisk->hardDrive) {
|
||||
if(imageDiskList[2] == NULL) {
|
||||
imageDiskList[2] = ((fatDrive *)newdrive)->loadedDisk;
|
||||
updateDPT();
|
||||
return;
|
||||
}
|
||||
if(imageDiskList[3] == NULL) {
|
||||
imageDiskList[3] = ((fatDrive *)newdrive)->loadedDisk;
|
||||
updateDPT();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(!((fatDrive *)newdrive)->loadedDisk->hardDrive) {
|
||||
imageDiskList[0] = ((fatDrive *)newdrive)->loadedDisk;
|
||||
}
|
||||
} else if (fstype=="iso") {
|
||||
if (Drives[drive-'A']) {
|
||||
WriteOut("Drive already mounted at that letter\n");
|
||||
if (newdrive) delete newdrive;
|
||||
return;
|
||||
}
|
||||
if (!newdrive) WriteOut("Can't create drive from file\n");
|
||||
Drives[drive-'A']=newdrive;
|
||||
// Set the correct media byte in the table
|
||||
mem_writeb(Real2Phys(dos.tables.mediaid)+drive-'A',mediaid);
|
||||
WriteOut("Drive %c mounted as %s\n",drive,temp_line.c_str());
|
||||
} else if (fstype=="none") {
|
||||
if(imageDiskList[drive] != NULL) delete imageDiskList[drive];
|
||||
imageDiskList[drive] = newImage;
|
||||
updateDPT();
|
||||
WriteOut("Drive number %d mounted as %s\n",drive,temp_line.c_str());
|
||||
}
|
||||
|
||||
// check if volume label is given
|
||||
//if (cmd->FindString("-label",label,true)) newdrive->dirCache.SetLabel(label.c_str());
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
void IMGMOUNT_ProgramStart(Program * * make) {
|
||||
*make=new IMGMOUNT;
|
||||
}
|
||||
|
||||
|
||||
void DOS_SetupPrograms(void) {
|
||||
/*Add Messages */
|
||||
/*Add Messages */
|
||||
|
||||
MSG_Add("PROGRAM_MOUNT_CDROMS_FOUND","CDROMs found: %d\n");
|
||||
MSG_Add("PROGRAM_MOUNT_STATUS_2","Drive %c is mounted as %s\n");
|
||||
MSG_Add("PROGRAM_MOUNT_STATUS_1","Current mounted drives are:\n");
|
||||
MSG_Add("PROGRAM_MOUNT_ERROR_1","Directory %s doesn't exist.\n");
|
||||
MSG_Add("PROGRAM_MOUNT_ERROR_2","%s isn't a directory\n");
|
||||
MSG_Add("PROGRAM_MOUNT_ERROR_1","Directory %s doesn't exist.\n");
|
||||
MSG_Add("PROGRAM_MOUNT_ERROR_2","%s isn't a directory\n");
|
||||
MSG_Add("PROGRAM_MOUNT_ILL_TYPE","Illegal type %s\n");
|
||||
MSG_Add("PROGRAM_MOUNT_ALLREADY_MOUNTED","Drive %c already mounted with %s\n");
|
||||
MSG_Add("PROGRAM_MOUNT_USAGE","Usage MOUNT Drive-Letter Local-Directory\nSo a MOUNT c c:\\windows mounts windows directory as the c: drive in DOSBox\n");
|
||||
MSG_Add("PROGRAM_MOUNT_ALLREADY_MOUNTED","Drive %c already mounted with %s\n");
|
||||
MSG_Add("PROGRAM_MOUNT_USAGE","Usage MOUNT Drive-Letter Local-Directory\nSo a MOUNT c c:\\windows mounts windows directory as the c: drive in DOSBox\n");
|
||||
|
||||
MSG_Add("PROGRAM_MEM_CONVEN","%10d Kb free conventional memory\n");
|
||||
MSG_Add("PROGRAM_MEM_EXTEND","%10d Kb free extended memory\n");
|
||||
MSG_Add("PROGRAM_MEM_EXPAND","%10d Kb free expanded memory\n");
|
||||
MSG_Add("PROGRAM_MEM_CONVEN","%10d Kb free conventional memory\n");
|
||||
MSG_Add("PROGRAM_MEM_EXTEND","%10d Kb free extended memory\n");
|
||||
MSG_Add("PROGRAM_MEM_EXPAND","%10d Kb free expanded memory\n");
|
||||
|
||||
MSG_Add("PROGRAM_LOADFIX_ALLOC","%d kb allocated.\n");
|
||||
MSG_Add("PROGRAM_LOADFIX_DEALLOC","%d kb freed.\n");
|
||||
|
@ -504,7 +688,24 @@ void DOS_SetupPrograms(void) {
|
|||
"[43;30mDOSBox will stop/exit without a warning if an error occured![0m\n"
|
||||
);
|
||||
|
||||
/*regular setup*/
|
||||
MSG_Add("PROGRAM_BOOT_NOT_EXIST","Bootdisk file does not exist. Failing.\n");
|
||||
MSG_Add("PROGRAM_BOOT_NOT_OPEN","Cannot open bootdisk file. Failing.\n");
|
||||
MSG_Add("PROGRAM_BOOT_PRINT_ERROR","This command boots DosBox from either a floppy or hard disk image.\n\n"
|
||||
"For this command, one can specify a succession of floppy disks swappable\n"
|
||||
"by pressing Ctrl-F4, and -l specifies the mounted drive to boot from. If\n"
|
||||
"no drive letter is specified, this defaults to booting from the A drive.\n"
|
||||
"The only bootable drive letters are A, C, and D. For booting from a hard\n"
|
||||
"drive (C or D), the image should have already been mounted using the\n"
|
||||
"IMGMOUNT command.\n\n"
|
||||
"The syntax of this command is:\n\n"
|
||||
"BOOT [diskimg1.img diskimg2.img] [-l driveletter]\n"
|
||||
);
|
||||
MSG_Add("PROGRAM_BOOT_UNABLE","Unable to boot off of drive %c");
|
||||
MSG_Add("PROGRAM_BOOT_IMAGE_OPEN","Opening image file: %s\n");
|
||||
MSG_Add("PROGRAM_BOOT_IMAGE_NOT_OPEN","Cannot open %s");
|
||||
MSG_Add("PROGRAM_BOOT_BOOT","Booting from drive %c...\n");
|
||||
|
||||
/*regular setup*/
|
||||
PROGRAMS_MakeFile("MOUNT.COM",MOUNT_ProgramStart);
|
||||
PROGRAMS_MakeFile("MEM.COM",MEM_ProgramStart);
|
||||
PROGRAMS_MakeFile("LOADFIX.COM",LOADFIX_ProgramStart);
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: drive_fat.cpp,v 1.5 2004-09-05 14:23:04 qbix79 Exp $ */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -1123,197 +1125,3 @@ bool fatDrive::TestDir(char *dir) {
|
|||
return getDirClustNum(dir, &dummyClust, false);
|
||||
}
|
||||
|
||||
|
||||
class IMGMOUNT : public Program {
|
||||
public:
|
||||
void Run(void)
|
||||
{
|
||||
DOS_Drive * newdrive;
|
||||
imageDisk * newImage;
|
||||
Bit32u imagesize;
|
||||
char drive;
|
||||
std::string label;
|
||||
|
||||
std::string type="hdd";
|
||||
std::string fstype="fat";
|
||||
cmd->FindString("-t",type,true);
|
||||
cmd->FindString("-fs",fstype,true);
|
||||
Bit8u mediaid;
|
||||
if (type=="floppy" || type=="hdd" || type=="iso") {
|
||||
Bit16u sizes[4];
|
||||
|
||||
std::string str_size;
|
||||
mediaid=0xF8;
|
||||
|
||||
if (type=="floppy") {
|
||||
mediaid=0xF0;
|
||||
} else if (type=="cdrom" || type=="iso") {
|
||||
str_size="650,127,16513,1700";
|
||||
mediaid=0xF8;
|
||||
fstype = "iso";
|
||||
}
|
||||
cmd->FindString("-size",str_size,true);
|
||||
if ((type=="hdd") && (str_size.size()==0)) {
|
||||
WriteOut("Must specify drive geometry for hard drives:\n");
|
||||
WriteOut("bytes_per_sector, sectors_per_cylinder, heads_per_cylinder, cylinder_count\n");
|
||||
return;
|
||||
}
|
||||
char number[20];
|
||||
const char * scan=str_size.c_str();
|
||||
Bitu index=0;Bitu count=0;
|
||||
|
||||
while (*scan) {
|
||||
if (*scan==',') {
|
||||
number[index]=0;sizes[count++]=atoi(number);
|
||||
index=0;
|
||||
} else number[index++]=*scan;
|
||||
scan++;
|
||||
}
|
||||
number[index]=0;sizes[count++]=atoi(number);
|
||||
|
||||
if(fstype=="fat" || fstype=="iso") {
|
||||
// get the drive letter
|
||||
cmd->FindCommand(1,temp_line);
|
||||
if ((temp_line.size() > 2) || ((temp_line.size()>1) && (temp_line[1]!=':'))) {
|
||||
WriteOut("Must specify drive letter to mount image at.\n");
|
||||
return;
|
||||
}
|
||||
drive=toupper(temp_line[0]);
|
||||
if (!isalpha(drive)) {
|
||||
WriteOut("Must specify drive letter to mount image at.\n");
|
||||
return;
|
||||
}
|
||||
} else if (fstype=="none") {
|
||||
cmd->FindCommand(1,temp_line);
|
||||
if ((temp_line.size() > 1) || (!isdigit(temp_line[0]))) {
|
||||
WriteOut("Must specify drive number (0 or 3) to mount image at (0,1=fda,fdb;2,3=hda,hdb)\n");
|
||||
return;
|
||||
}
|
||||
drive=temp_line[0]-'0';
|
||||
if(drive>3) {
|
||||
WriteOut("Must specify drive number (0 or 3) to mount image at (0,1=fda,fdb;2,3=hda,hdb)\n");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
WriteOut("Format \"%s\" is unsupported. Specify \"fat\" or \"none\".\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cmd->FindCommand(2,temp_line)) {
|
||||
WriteOut("Must specify file image to mount\n");
|
||||
return;
|
||||
}
|
||||
if (!temp_line.size()) {
|
||||
WriteOut("Must specify file image to mount\n");
|
||||
return;
|
||||
}
|
||||
struct stat test;
|
||||
if (stat(temp_line.c_str(),&test)) {
|
||||
// convert dosbox filename to system filename
|
||||
char fullname[CROSS_LEN];
|
||||
char tmp[CROSS_LEN];
|
||||
strncpy(tmp, temp_line.c_str(), CROSS_LEN);
|
||||
|
||||
Bit8u drive;
|
||||
if (!DOS_MakeName(tmp, fullname, &drive)) {
|
||||
WriteOut("Image file not found\n");
|
||||
return;
|
||||
}
|
||||
|
||||
localDrive *ldp = (localDrive*)Drives[drive];
|
||||
ldp->GetSystemFilename(tmp, fullname);
|
||||
temp_line = tmp;
|
||||
|
||||
if (stat(temp_line.c_str(),&test)) {
|
||||
WriteOut("Image file not found\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((test.st_mode & S_IFDIR)) {
|
||||
WriteOut("To mount directories, use the MOUNT command, not the IMGMOUNT command\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if(fstype=="fat") {
|
||||
newdrive=new fatDrive(temp_line.c_str(),sizes[0],sizes[1],sizes[2],sizes[3],0);
|
||||
} else if (fstype=="iso") {
|
||||
int error;
|
||||
newdrive = new isoDrive(drive, temp_line.c_str(), mediaid, error);
|
||||
switch (error) {
|
||||
case 0 : WriteOut(MSG_Get("MSCDEX_SUCCESS")); break;
|
||||
case 1 : WriteOut(MSG_Get("MSCDEX_ERROR_MULTIPLE_CDROMS")); break;
|
||||
case 2 : WriteOut(MSG_Get("MSCDEX_ERROR_NOT_SUPPORTED")); break;
|
||||
case 3 : WriteOut(MSG_Get("MSCDEX_ERROR_PATH")); break;
|
||||
case 4 : WriteOut(MSG_Get("MSCDEX_TOO_MANY_DRIVES")); break;
|
||||
case 5 : WriteOut(MSG_Get("MSCDEX_LIMITED_SUPPORT")); break;
|
||||
default : WriteOut(MSG_Get("MSCDEX_UNKNOWN_ERROR")); break;
|
||||
};
|
||||
if (error) {
|
||||
delete newdrive;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
FILE *newDisk = fopen(temp_line.c_str(), "rb+");
|
||||
fseek(newDisk,0L, SEEK_END);
|
||||
imagesize = (ftell(newDisk) / 1024);
|
||||
|
||||
newImage = new imageDisk(newDisk, (Bit8u *)temp_line.c_str(), imagesize, (imagesize > 2880));
|
||||
if(imagesize>2880) newImage->Set_Geometry(sizes[2],sizes[3],sizes[1],sizes[0]);
|
||||
}
|
||||
}
|
||||
if(fstype=="fat") {
|
||||
if (Drives[drive-'A']) {
|
||||
WriteOut("Drive already mounted at that letter\n");
|
||||
if (newdrive) delete newdrive;
|
||||
return;
|
||||
}
|
||||
if (!newdrive) WriteOut("Can't create drive from file\n");
|
||||
Drives[drive-'A']=newdrive;
|
||||
// Set the correct media byte in the table
|
||||
mem_writeb(Real2Phys(dos.tables.mediaid)+drive-'A',mediaid);
|
||||
WriteOut("Drive %c mounted as %s\n",drive,temp_line.c_str());
|
||||
if(((fatDrive *)newdrive)->loadedDisk->hardDrive) {
|
||||
if(imageDiskList[2] == NULL) {
|
||||
imageDiskList[2] = ((fatDrive *)newdrive)->loadedDisk;
|
||||
updateDPT();
|
||||
return;
|
||||
}
|
||||
if(imageDiskList[3] == NULL) {
|
||||
imageDiskList[3] = ((fatDrive *)newdrive)->loadedDisk;
|
||||
updateDPT();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(!((fatDrive *)newdrive)->loadedDisk->hardDrive) {
|
||||
imageDiskList[0] = ((fatDrive *)newdrive)->loadedDisk;
|
||||
}
|
||||
} else if (fstype=="iso") {
|
||||
if (Drives[drive-'A']) {
|
||||
WriteOut("Drive already mounted at that letter\n");
|
||||
if (newdrive) delete newdrive;
|
||||
return;
|
||||
}
|
||||
if (!newdrive) WriteOut("Can't create drive from file\n");
|
||||
Drives[drive-'A']=newdrive;
|
||||
// Set the correct media byte in the table
|
||||
mem_writeb(Real2Phys(dos.tables.mediaid)+drive-'A',mediaid);
|
||||
WriteOut("Drive %c mounted as %s\n",drive,temp_line.c_str());
|
||||
} else if (fstype=="none") {
|
||||
if(imageDiskList[drive] != NULL) delete imageDiskList[drive];
|
||||
imageDiskList[drive] = newImage;
|
||||
updateDPT();
|
||||
WriteOut("Drive number %d mounted as %s\n",drive,temp_line.c_str());
|
||||
}
|
||||
|
||||
// check if volume label is given
|
||||
//if (cmd->FindString("-label",label,true)) newdrive->dirCache.SetLabel(label.c_str());
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
void IMGMOUNT_ProgramStart(Program * * make) {
|
||||
*make=new IMGMOUNT;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue