mirror of
https://github.com/retro100/dosbox-wii.git
synced 2025-01-12 10:19:11 +01:00
Automatically mounts sd:/DOSBox as C:\
I only got one game to run so far, and that was Lemonade Stand: http://ascii.classicgaming.gamespy.com/download_files/lemonade/lemonade.html
This commit is contained in:
parent
502432d531
commit
ede7921e4c
@ -50,6 +50,73 @@ Bitu DEBUG_EnableDebugger(void);
|
|||||||
|
|
||||||
void MSCDEX_SetCDInterface(int intNr, int forceCD);
|
void MSCDEX_SetCDInterface(int intNr, int forceCD);
|
||||||
|
|
||||||
|
// Mounts a folder as a harddrive before starting the shell
|
||||||
|
// Designed for the Wii
|
||||||
|
void MountDOSBoxDir(char DriveLetter, const char *path) {
|
||||||
|
DOS_Drive * newdrive;
|
||||||
|
Bit16u sizes[4];
|
||||||
|
Bit8u mediaid;
|
||||||
|
std::string str_size;
|
||||||
|
std::string label;
|
||||||
|
str_size="512,127,16383,4031";
|
||||||
|
mediaid=0xF8; /* Hard Disk */
|
||||||
|
char number[20];
|
||||||
|
const char * scan=str_size.c_str();
|
||||||
|
Bitu index=0;Bitu count=0;
|
||||||
|
/* Parse the str_size string */
|
||||||
|
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);
|
||||||
|
|
||||||
|
// get the drive letter
|
||||||
|
char drive=toupper(DriveLetter);
|
||||||
|
std::string temp_line = path;
|
||||||
|
struct stat test;
|
||||||
|
bool failed = false;
|
||||||
|
if (stat(temp_line.c_str(),&test)) {
|
||||||
|
failed = true;
|
||||||
|
Cross::ResolveHomedir(temp_line);
|
||||||
|
//Try again after resolving ~
|
||||||
|
if(!stat(temp_line.c_str(),&test)) failed = false;
|
||||||
|
}
|
||||||
|
if(failed) {
|
||||||
|
printf(MSG_Get("PROGRAM_MOUNT_ERROR_1"),temp_line.c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/* Not a switch so a normal directory/file */
|
||||||
|
if (!(test.st_mode & S_IFDIR)) {
|
||||||
|
printf(MSG_Get("PROGRAM_MOUNT_ERROR_2"),temp_line.c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (temp_line[temp_line.size()-1]!=CROSS_FILESPLIT) temp_line+=CROSS_FILESPLIT;
|
||||||
|
Bit8u bit8size=(Bit8u) sizes[1];
|
||||||
|
newdrive=new localDrive(temp_line.c_str(),sizes[0],bit8size,sizes[2],sizes[3],mediaid);
|
||||||
|
if (Drives[drive-'A']) {
|
||||||
|
printf(MSG_Get("PROGRAM_MOUNT_ALREADY_MOUNTED"),drive,Drives[drive-'A']->GetInfo());
|
||||||
|
if (newdrive) delete newdrive;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!newdrive) E_Exit("DOS:Can't create drive");
|
||||||
|
Drives[drive-'A']=newdrive;
|
||||||
|
/* Set the correct media byte in the table */
|
||||||
|
mem_writeb(Real2Phys(dos.tables.mediaid)+(drive-'A')*2,newdrive->GetMediaByte());
|
||||||
|
printf(MSG_Get("PROGRAM_MOUNT_STATUS_2"),drive,newdrive->GetInfo());
|
||||||
|
/* For hard drives set the label to DRIVELETTER_Drive.
|
||||||
|
* For floppy drives set the label to DRIVELETTER_Floppy.
|
||||||
|
* This way every drive except cdroms should get a label.*/
|
||||||
|
label = drive; label+="_DRIVE";
|
||||||
|
newdrive->dirCache.SetLabel(label.c_str(),false,true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MOUNT : public Program {
|
class MOUNT : public Program {
|
||||||
public:
|
public:
|
||||||
|
@ -1463,6 +1463,7 @@ static void printconfiglocation() {
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MountDOSBoxDir(char DriveLetter, const char *path);
|
||||||
|
|
||||||
//extern void UI_Init(void);
|
//extern void UI_Init(void);
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
@ -1636,6 +1637,9 @@ int main(int argc, char* argv[]) {
|
|||||||
/* Init the keyMapper */
|
/* Init the keyMapper */
|
||||||
MAPPER_Init();
|
MAPPER_Init();
|
||||||
if (control->cmdline->FindExist("-startmapper")) MAPPER_Run(false);
|
if (control->cmdline->FindExist("-startmapper")) MAPPER_Run(false);
|
||||||
|
#ifdef HW_RVL
|
||||||
|
MountDOSBoxDir('C', "sd:/DOSBox");
|
||||||
|
#endif
|
||||||
/* Start up main machine */
|
/* Start up main machine */
|
||||||
control->StartUp();
|
control->StartUp();
|
||||||
/* Shutdown everything */
|
/* Shutdown everything */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user