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 TARGETDIR := executables
BUILD := build_gc BUILD := build_gc
SOURCES := src src/cpu src/debug src/dos src/fpu src/gui \ 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 INCLUDES := include src/platform/wii
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------

View File

@ -19,7 +19,8 @@ TARGET := dosbox_wii
TARGETDIR := executables TARGETDIR := executables
BUILD := build_wii BUILD := build_wii
SOURCES := src src/cpu src/debug src/dos src/fpu src/gui \ 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 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 # 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 # 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) DOSBox v0.72.01 (Wii port)
http://code.google.com/p/dosbox-wii/
==== ====
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 HOME will exit back to the homebrew channel, as will the RESET
button on the console. 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. The Z: driver is a virtual drive that is part of DOSBox.
Other drives can be mounted using the MOUNT command. Other drives can be mounted using the MOUNT command.
sd: means the SD card, usb: means a USB drive, Prefix sd: for an SD card, and usb: for a USB drive.
carda: and cardb: mean the Gamecube memory cards. The Wii's DVD drive and network folders can't be mounted at this time.
The Wii's DVD drive, and shared folders on the network, can't be
mounted yet in this version.
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. This file will be created automatically after you start DOSBox.
Please edit it with a text editor to choose settings appropriate Please edit it with a text editor to choose settings appropriate
for each game. 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 // Mounts a folder as a harddrive before starting the shell
// Designed for the Wii // Designed for the Wii
void MountDOSBoxDir(char DriveLetter, const char *path) { int MountDOSBoxDir(char DriveLetter, const char *path) {
DOS_Drive * newdrive; DOS_Drive * newdrive;
Bit16u sizes[4]; Bit16u sizes[4];
Bit8u mediaid; Bit8u mediaid;
@ -88,12 +88,12 @@ void MountDOSBoxDir(char DriveLetter, const char *path) {
} }
if(failed) { if(failed) {
printf(MSG_Get("PROGRAM_MOUNT_ERROR_1"),temp_line.c_str()); printf(MSG_Get("PROGRAM_MOUNT_ERROR_1"),temp_line.c_str());
return; return 0;
} }
/* Not a switch so a normal directory/file */ /* Not a switch so a normal directory/file */
if (!(test.st_mode & S_IFDIR)) { if (!(test.st_mode & S_IFDIR)) {
printf(MSG_Get("PROGRAM_MOUNT_ERROR_2"),temp_line.c_str()); 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; if (temp_line[temp_line.size()-1]!=CROSS_FILESPLIT) temp_line+=CROSS_FILESPLIT;
Bit8u bit8size=(Bit8u) sizes[1]; Bit8u bit8size=(Bit8u) sizes[1];
@ -101,9 +101,11 @@ void MountDOSBoxDir(char DriveLetter, const char *path) {
if (Drives[drive-'A']) { if (Drives[drive-'A']) {
printf(MSG_Get("PROGRAM_MOUNT_ALREADY_MOUNTED"),drive,Drives[drive-'A']->GetInfo()); printf(MSG_Get("PROGRAM_MOUNT_ALREADY_MOUNTED"),drive,Drives[drive-'A']->GetInfo());
if (newdrive) delete newdrive; if (newdrive) delete newdrive;
return; return 0;
} }
if (!newdrive) E_Exit("DOS:Can't create drive"); if (!newdrive)
return 0;
Drives[drive-'A']=newdrive; 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,newdrive->GetMediaByte()); 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.*/ * This way every drive except cdroms should get a label.*/
label = drive; label+="_DRIVE"; label = drive; label+="_DRIVE";
newdrive->dirCache.SetLabel(label.c_str(),false,true); newdrive->dirCache.SetLabel(label.c_str(),false,true);
return; return 1;
} }

View File

@ -1490,13 +1490,15 @@ static void printconfiglocation() {
exit(0); exit(0);
} }
void MountDOSBoxDir(char DriveLetter, const char *path); int 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[]) {
try { try {
#ifdef HW_RVL #ifdef HW_RVL
WiiInit(); WiiInit();
if(argc > 0 && argv[0] != NULL)
CreateAppPath(argv[0]);
#endif #endif
CommandLine com_line(argc,argv); CommandLine com_line(argc,argv);
Config myconf(&com_line); 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 (control->ParseConfigFile(config_file.c_str())) parsed_anyconfigfile = true;
//if none found => parse localdir conf //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"; config_file = "dosbox.conf";
#endif
if (!parsed_anyconfigfile && control->ParseConfigFile(config_file.c_str())) parsed_anyconfigfile = true; if (!parsed_anyconfigfile && control->ParseConfigFile(config_file.c_str())) parsed_anyconfigfile = true;
//if none found => parse userlevel conf //if none found => parse userlevel conf
@ -1665,7 +1673,16 @@ int main(int argc, char* argv[]) {
MAPPER_Init(); MAPPER_Init();
if (control->cmdline->FindExist("-startmapper")) MAPPER_Run(false); if (control->cmdline->FindExist("-startmapper")) MAPPER_Run(false);
#ifdef HW_RVL #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 #endif
/* Start up main machine */ /* Start up main machine */
control->StartUp(); control->StartUp();

View File

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

View File

@ -10,8 +10,31 @@
#include <fat.h> #include <fat.h>
#include "wiihardware.h" #include "wiihardware.h"
char appPath[1024];
void WiiInit() { void WiiInit() {
fatInitDefault(); 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) { bool WiiMessagePause(const char *s) {

View File

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