dol loading directory now checked for conf file, and mounted as C (if NOT apps/dosbox-wii/). update readme

This commit is contained in:
dborth 2009-05-14 08:53:12 +00:00
parent 17f70bcecb
commit 70c08ab644
8 changed files with 107 additions and 59 deletions

View File

@ -19,7 +19,8 @@ TARGET := dosbox_gc
TARGETDIR := executables
BUILD := build_gc
SOURCES := src src/cpu src/debug src/dos src/fpu src/gui \
src/hardware src/hardware/serialport src/ints src/libs src/misc src/platform/wii src/shell
src/hardware src/hardware/serialport src/ints src/libs \
src/misc src/platform/wii src/shell
INCLUDES := include src/platform/wii
#---------------------------------------------------------------------------------

View File

@ -19,7 +19,8 @@ TARGET := dosbox_wii
TARGETDIR := executables
BUILD := build_wii
SOURCES := src src/cpu src/debug src/dos src/fpu src/gui \
src/hardware src/hardware/serialport src/ints src/libs src/misc src/platform/wii src/shell
src/hardware src/hardware/serialport src/ints src/libs \
src/misc src/platform/wii src/shell
INCLUDES := include src/platform/wii
#---------------------------------------------------------------------------------
@ -35,7 +36,7 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--cref
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with
#---------------------------------------------------------------------------------
LIBS := -lSDL -lfat -lwiiuse -lbte -logc
LIBS := -lSDL -lfat -lwiiuse -lbte -logc -lwiikeyboard
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing

14
README
View File

@ -1,4 +1,5 @@
DOSBox v0.72.01 (Wii port)
http://code.google.com/p/dosbox-wii/
====
WII:
@ -20,15 +21,16 @@ Gamecube Controller can also be used as a joystick.
HOME will exit back to the homebrew channel, as will the RESET
button on the console.
The C: drive will automatically be mounted to sd:/DOSBox/
The C: drive will automatically be mounted to sd:/DOSBox/ if loaded
from apps/dosbox-wii/. Otherwise, the directory the dol is loaded
from will be mounted as C, and sd:/DOSBox as D (if present).
The Z: driver is a virtual drive that is part of DOSBox.
Other drives can be mounted using the MOUNT command.
sd: means the SD card, usb: means a USB drive,
carda: and cardb: mean the Gamecube memory cards.
The Wii's DVD drive, and shared folders on the network, can't be
mounted yet in this version.
Prefix sd: for an SD card, and usb: for a USB drive.
The Wii's DVD drive and network folders can't be mounted at this time.
The configuration is loaded from sd:/DOSBox/dosbox.conf
The configuration is loaded from the directory the dol is located in
(if present) and sd:/DOSBox/dosbox.conf otherwise
This file will be created automatically after you start DOSBox.
Please edit it with a text editor to choose settings appropriate
for each game.

View File

@ -52,7 +52,7 @@ 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) {
int MountDOSBoxDir(char DriveLetter, const char *path) {
DOS_Drive * newdrive;
Bit16u sizes[4];
Bit8u mediaid;
@ -74,7 +74,7 @@ void MountDOSBoxDir(char DriveLetter, const char *path) {
}
number[index]=0;
sizes[count++]=atoi(number);
// get the drive letter
char drive=toupper(DriveLetter);
std::string temp_line = path;
@ -88,12 +88,12 @@ void MountDOSBoxDir(char DriveLetter, const char *path) {
}
if(failed) {
printf(MSG_Get("PROGRAM_MOUNT_ERROR_1"),temp_line.c_str());
return;
return 0;
}
/* 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;
return 0;
}
if (temp_line[temp_line.size()-1]!=CROSS_FILESPLIT) temp_line+=CROSS_FILESPLIT;
Bit8u bit8size=(Bit8u) sizes[1];
@ -101,9 +101,11 @@ void MountDOSBoxDir(char DriveLetter, const char *path) {
if (Drives[drive-'A']) {
printf(MSG_Get("PROGRAM_MOUNT_ALREADY_MOUNTED"),drive,Drives[drive-'A']->GetInfo());
if (newdrive) delete newdrive;
return;
return 0;
}
if (!newdrive) E_Exit("DOS:Can't create drive");
if (!newdrive)
return 0;
Drives[drive-'A']=newdrive;
/* Set the correct media byte in the table */
mem_writeb(Real2Phys(dos.tables.mediaid)+(drive-'A')*2,newdrive->GetMediaByte());
@ -113,7 +115,7 @@ void MountDOSBoxDir(char DriveLetter, const char *path) {
* This way every drive except cdroms should get a label.*/
label = drive; label+="_DRIVE";
newdrive->dirCache.SetLabel(label.c_str(),false,true);
return;
return 1;
}
@ -140,7 +142,7 @@ public:
return;
}
/* In secure mode don't allow people to change mount points.
/* In secure mode don't allow people to change mount points.
* Neither mount nor unmount */
if(control->SecureMode()) {
WriteOut(MSG_Get("PROGRAM_CONFIG_SECURE_DISALLOW"));
@ -155,7 +157,7 @@ public:
switch (DriveManager::UnmountDrive(i_drive)) {
case 0:
Drives[i_drive] = 0;
if(i_drive == DOS_GetDefaultDrive())
if(i_drive == DOS_GetDefaultDrive())
DOS_SetDrive(toupper('Z') - 'A');
WriteOut(MSG_Get("PROGRAM_MOUNT_UMOUNT_SUCCES"),umount[0]);
break;
@ -171,7 +173,7 @@ public:
}
return;
}
// Show list of cdroms
if (cmd->FindExist("-cd",false)) {
int num = SDL_CDNumDrives();
@ -216,7 +218,7 @@ public:
}
str_size=teststr;
}
cmd->FindString("-size",str_size,true);
char number[20];const char * scan=str_size.c_str();
Bitu index=0;Bitu count=0;
@ -229,7 +231,7 @@ public:
scan++;
}
number[index]=0;sizes[count++]=atoi(number);
// get the drive letter
cmd->FindCommand(1,temp_line);
if ((temp_line.size() > 2) || ((temp_line.size()>1) && (temp_line[1]!=':'))) goto showusage;
@ -352,8 +354,8 @@ public:
} else {
/* Give a warning when mount c:\ or the / */
#if defined (WIN32) || defined(OS2)
if( (temp_line == "c:\\") || (temp_line == "C:\\") ||
(temp_line == "c:/") || (temp_line == "C:/") )
if( (temp_line == "c:\\") || (temp_line == "C:\\") ||
(temp_line == "c:/") || (temp_line == "C:/") )
WriteOut(MSG_Get("PROGRAM_MOUNT_WARNING_WIN"));
#else
if(temp_line == "/") WriteOut(MSG_Get("PROGRAM_MOUNT_WARNING_OTHER"));
@ -379,7 +381,7 @@ public:
/* 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.*/
else if(type == "dir") {
else if(type == "dir") {
label = drive; label += "_DRIVE";
newdrive->dirCache.SetLabel(label.c_str(),iscdrom,true);
} else if(type == "floppy") {
@ -448,7 +450,7 @@ public:
if (!reg_bl) {
WriteOut(MSG_Get("PROGRAM_MEM_EXTEND"),reg_dx);
}
}
}
/* Test for and show free EMS */
Bit16u handle;
char emm[9] = { 'E','M','M','X','X','X','X','0',0 };
@ -471,7 +473,7 @@ extern Bit32u floppytype;
class BOOT : public Program {
private:
FILE *getFSFile_mounted(char const* filename, Bit32u *ksize, Bit32u *bsize, Bit8u *error) {
//if return NULL then put in error the errormessage code if an error was requested
bool tryload = (*error)?true:false;
@ -483,7 +485,7 @@ private:
localDrive* ldp=0;
if (!DOS_MakeName(const_cast<char*>(filename),fullname,&drive)) return NULL;
try {
try {
ldp=dynamic_cast<localDrive*>(Drives[drive]);
if(!ldp) return NULL;
@ -517,7 +519,7 @@ private:
return NULL;
}
}
FILE *getFSFile(char const * filename, Bit32u *ksize, Bit32u *bsize,bool tryload=false) {
Bit8u error = tryload?1:0;
FILE* tmpfile = getFSFile_mounted(filename,ksize,bsize,&error);
@ -566,11 +568,11 @@ private:
}
public:
void Run(void) {
//Hack To allow long commandlines
ChangeToLongCmd();
/* In secure mode don't allow people to boot stuff.
/* In secure mode don't allow people to boot stuff.
* They might try to corrupt the data on it */
if(control->SecureMode()) {
WriteOut(MSG_Get("PROGRAM_CONFIG_SECURE_DISALLOW"));
@ -579,7 +581,7 @@ public:
FILE *usefile_1=NULL;
FILE *usefile_2=NULL;
Bitu i=0;
Bitu i=0;
Bit32u floppysize;
Bit32u rombytesize_1=0;
Bit32u rombytesize_2=0;
@ -798,7 +800,7 @@ public:
/* boot cartridge (int18) */
SegSet16(cs,RealSeg(new_int18));
reg_ip = RealOff(new_int18);
}
}
} else {
if (cfound_at>0) {
/* run cartridge setup */
@ -853,7 +855,7 @@ public:
localDrive* ldp=0;
if (!DOS_MakeName((char *)temp_line.c_str(),fullname,&drive)) return;
try {
try {
ldp=dynamic_cast<localDrive*>(Drives[drive]);
if(!ldp) return;
@ -904,7 +906,7 @@ public:
void Run(void);
};
void LOADFIX::Run(void)
void LOADFIX::Run(void)
{
Bit16u commandNr = 1;
Bit16u kb = 64;
@ -946,15 +948,15 @@ void LOADFIX::Run(void)
break;
strcat(args,temp_line.c_str());
strcat(args," ");
} while (ok);
} while (ok);
// Use shell to start program
DOS_Shell shell;
shell.Execute(filename,args);
DOS_FreeMemory(segment);
DOS_FreeMemory(segment);
WriteOut(MSG_Get("PROGRAM_LOADFIX_DEALLOC"),kb);
}
} else {
WriteOut(MSG_Get("PROGRAM_LOADFIX_ERROR"),kb);
WriteOut(MSG_Get("PROGRAM_LOADFIX_ERROR"),kb);
}
}
@ -969,7 +971,7 @@ public:
void Run(void);
};
void RESCAN::Run(void)
void RESCAN::Run(void)
{
// Get current drive
Bit8u drive = DOS_GetDefaultDrive();
@ -993,7 +995,7 @@ public:
WriteOut(MSG_Get("PROGRAM_INTRO_MOUNT_WII"));
#elif (WIN32)
WriteOut(MSG_Get("PROGRAM_INTRO_MOUNT_WINDOWS"));
#else
#else
WriteOut(MSG_Get("PROGRAM_INTRO_MOUNT_OTHER"));
#endif
WriteOut(MSG_Get("PROGRAM_INTRO_MOUNT_END"));
@ -1036,7 +1038,7 @@ public:
void Run(void) {
//Hack To allow long commandlines
ChangeToLongCmd();
/* In secure mode don't allow people to change imgmount points.
/* In secure mode don't allow people to change imgmount points.
* Neither mount nor unmount */
if(control->SecureMode()) {
WriteOut(MSG_Get("PROGRAM_CONFIG_SECURE_DISALLOW"));
@ -1057,7 +1059,7 @@ public:
switch (DriveManager::UnmountDrive(i_drive)) {
case 0:
Drives[i_drive] = 0;
if (i_drive == DOS_GetDefaultDrive())
if (i_drive == DOS_GetDefaultDrive())
DOS_SetDrive(toupper('Z') - 'A');
WriteOut(MSG_Get("PROGRAM_MOUNT_UMOUNT_SUCCES"),umount[0]);
break;
@ -1084,17 +1086,17 @@ public:
if (type=="floppy" || type=="hdd" || type=="iso") {
Bit16u sizes[4];
bool imgsizedetect=false;
std::string str_size;
mediaid=0xF8;
if (type=="floppy") {
mediaid=0xF0;
mediaid=0xF0;
} else if (type=="iso") {
str_size="650,127,16513,1700";
mediaid=0xF8;
mediaid=0xF8;
fstype = "iso";
}
}
cmd->FindString("-size",str_size,true);
if ((type=="hdd") && (str_size.size()==0)) {
imgsizedetect=true;
@ -1102,7 +1104,7 @@ public:
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);
@ -1112,7 +1114,7 @@ public:
}
number[index]=0;sizes[count++]=atoi(number);
}
if(fstype=="fat" || fstype=="iso") {
// get the drive letter
if (!cmd->FindCommand(1,temp_line) || (temp_line.size() > 2) || ((temp_line.size()>1) && (temp_line[1]!=':'))) {
@ -1139,10 +1141,10 @@ public:
WriteOut_NoParsing(MSG_Get("PROGRAM_IMGMOUNT_FORMAT_UNSUPPORTED"));
return;
}
// find all file parameters, assuming that all option parameters have been removed
while(cmd->FindCommand((unsigned int)(paths.size() + 2), temp_line) && temp_line.size()) {
struct stat test;
if (stat(temp_line.c_str(),&test)) {
//See if it works if the ~ are written out
@ -1185,7 +1187,7 @@ public:
}
if (paths.size() == 0) {
WriteOut(MSG_Get("PROGRAM_IMGMOUNT_SPECIFY_FILE"));
return;
return;
}
if (paths.size() == 1)
temp_line = paths[0];
@ -1251,7 +1253,7 @@ public:
}
if (!newdrive) {WriteOut(MSG_Get("PROGRAM_IMGMOUNT_CANT_CREATE"));return;}
Drives[drive-'A']=newdrive;
// Set the correct media byte in the table
// Set the correct media byte in the table
mem_writeb(Real2Phys(dos.tables.mediaid)+(drive-'A')*2,mediaid);
WriteOut(MSG_Get("PROGRAM_MOUNT_STATUS_2"),drive,temp_line.c_str());
if(((fatDrive *)newdrive)->loadedDisk->hardDrive) {
@ -1306,10 +1308,10 @@ public:
DriveManager::AppendDisk(drive - 'A', isoDisks[ct]);
}
DriveManager::InitializeDrive(drive - 'A');
// Set the correct media byte in the table
// Set the correct media byte in the table
mem_writeb(Real2Phys(dos.tables.mediaid) + (drive - 'A') * 2, mediaid);
// Print status message (success)
WriteOut(MSG_Get("MSCDEX_SUCCESS"));
std::string tmp(paths[0]);
@ -1317,7 +1319,7 @@ public:
tmp += "; " + paths[i];
}
WriteOut(MSG_Get("PROGRAM_MOUNT_STATUS_2"), drive, tmp.c_str());
} else if (fstype=="none") {
if(imageDiskList[drive-'0'] != NULL) delete imageDiskList[drive-'0'];
imageDiskList[drive-'0'] = newImage;
@ -1420,7 +1422,7 @@ void DOS_SetupPrograms(void) {
MSG_Add("PROGRAM_MOUNT_USAGE","Usage \033[34;1mMOUNT Drive-Letter Local-Directory\033[0m\nSo a MOUNT d usb:/windows mounts windows directory on USB as the d: drive\n");
#else
MSG_Add("PROGRAM_MOUNT_USAGE","Usage \033[34;1mMOUNT Drive-Letter Local-Directory\033[0m\nSo a MOUNT c c:\\windows mounts windows directory as the c: drive in DOSBox\n");
#endif
#endif
MSG_Add("PROGRAM_MOUNT_UMOUNT_NOT_MOUNTED","Drive %c isn't mounted.\n");
MSG_Add("PROGRAM_MOUNT_UMOUNT_SUCCES","Drive %c has succesfully been removed.\n");
MSG_Add("PROGRAM_MOUNT_UMOUNT_NO_VIRTUAL","Virtual Drives can not be unMOUNTed.\n");

View File

@ -1490,13 +1490,15 @@ static void printconfiglocation() {
exit(0);
}
void MountDOSBoxDir(char DriveLetter, const char *path);
int MountDOSBoxDir(char DriveLetter, const char *path);
//extern void UI_Init(void);
int main(int argc, char* argv[]) {
try {
#ifdef HW_RVL
WiiInit();
if(argc > 0 && argv[0] != NULL)
CreateAppPath(argv[0]);
#endif
CommandLine com_line(argc,argv);
Config myconf(&com_line);
@ -1617,7 +1619,13 @@ int main(int argc, char* argv[]) {
if (control->ParseConfigFile(config_file.c_str())) parsed_anyconfigfile = true;
//if none found => parse localdir conf
#ifdef HW_RVL
char wiiconf[1024];
sprintf(wiiconf, "%s/dosbox.conf", appPath);
config_file.assign(wiiconf);
#else
config_file = "dosbox.conf";
#endif
if (!parsed_anyconfigfile && control->ParseConfigFile(config_file.c_str())) parsed_anyconfigfile = true;
//if none found => parse userlevel conf
@ -1665,7 +1673,16 @@ int main(int argc, char* argv[]) {
MAPPER_Init();
if (control->cmdline->FindExist("-startmapper")) MAPPER_Run(false);
#ifdef HW_RVL
MountDOSBoxDir('C', "sd:/DOSBox");
bool cMounted = false;
// mount the current directory as C, if not loading from apps/dosbox-wii
if(strlen(appPath) > 0 && strcmp(appPath, "apps/dosbox-wii") != 0)
if(MountDOSBoxDir('C', appPath))
cMounted = true;
if(cMounted)
MountDOSBoxDir('D', "sd:/DOSBox");
else
MountDOSBoxDir('C', "sd:/DOSBox");
#endif
/* Start up main machine */
control->StartUp();

View File

@ -52,7 +52,6 @@ void Cross::GetPlatformConfigDir(std::string& in) {
ResolveHomedir(in);
#elif defined(HW_RVL)
in = "sd:/DOSBox";
ResolveHomedir(in);
#else
in = "~/.dosbox";
ResolveHomedir(in);

View File

@ -10,8 +10,31 @@
#include <fat.h>
#include "wiihardware.h"
char appPath[1024];
void WiiInit() {
fatInitDefault();
appPath[0] = 0;
}
void CreateAppPath(char origpath[])
{
char path[1024];
strncpy(path, origpath, 1024); // make a copy
char * loc;
int pos = -1;
loc = strrchr(path,'/');
if (loc != NULL)
*loc = 0; // strip file name
loc = strchr(path,'/'); // looking for / from fat:/
if (loc != NULL)
pos = loc - path + 1;
if(pos >= 0 && pos < 1024)
sprintf(appPath, &(path[pos]));
}
bool WiiMessagePause(const char *s) {

View File

@ -3,7 +3,10 @@
#include <wiiuse/wpad.h>
void WiiInit();
void CreateAppPath(char origpath[]);
void WiiFinished();
bool WiiMessagePause(const char *s);
extern char appPath[1024];
#endif