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;
@ -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;
}

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,6 +1673,15 @@ int main(int argc, char* argv[]) {
MAPPER_Init();
if (control->cmdline->FindExist("-startmapper")) MAPPER_Run(false);
#ifdef HW_RVL
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 */

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