diff --git a/src/cpu/core_full/ea_lookup.h b/src/cpu/core_full/ea_lookup.h index 05353bf..2bd3a3a 100644 --- a/src/cpu/core_full/ea_lookup.h +++ b/src/cpu/core_full/ea_lookup.h @@ -17,8 +17,8 @@ */ { - EAPoint seg_base; - Bit16u off; + EAPoint seg_base = 0; + Bit16u off = 0; switch ((inst.rm_mod<<3)|inst.rm_eai) { case 0x00: off=reg_bx+reg_si; @@ -145,8 +145,8 @@ }; static Bit32u SIBZero=0; static Bit32u * SIBIndex[8]= { ®_eax,®_ecx,®_edx,®_ebx,&SIBZero,®_ebp,®_esi,®_edi }; - EAPoint seg_base; - Bit32u off; + EAPoint seg_base = 0; + Bit32u off = 0; switch ((inst.rm_mod<<3)|inst.rm_eai) { case 0x00: off=reg_eax; diff --git a/src/cpu/core_full/string.h b/src/cpu/core_full/string.h index e276735..4176f9e 100644 --- a/src/cpu/core_full/string.h +++ b/src/cpu/core_full/string.h @@ -20,7 +20,7 @@ EAPoint si_base,di_base; Bitu si_index,di_index; Bitu add_mask; - Bitu count,count_left; + Bitu count,count_left = 0; Bits add_index; if (inst.prefix & PREFIX_SEG) si_base=inst.seg.base; diff --git a/src/cpu/core_normal/string.h b/src/cpu/core_normal/string.h index 6a33233..206367b 100644 --- a/src/cpu/core_normal/string.h +++ b/src/cpu/core_normal/string.h @@ -32,7 +32,7 @@ static void DoString(STRING_OP type) { PhysPt si_base,di_base; Bitu si_index,di_index; Bitu add_mask; - Bitu count,count_left; + Bitu count,count_left = 0; Bits add_index; si_base=BaseDS; diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp index ab0e5d6..baa463e 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp @@ -1976,8 +1976,9 @@ int main(int argc, char* argv[]) { /* Parse configuration files */ std::string config_file,config_path; + Cross::GetPlatformConfigDir(config_path); - + //First parse -userconf if(control->cmdline->FindExist("-userconf",true)){ config_file.clear(); @@ -2052,16 +2053,8 @@ int main(int argc, char* argv[]) { MAPPER_Init(); if (control->cmdline->FindExist("-startmapper")) MAPPER_RunInternal(); #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"); + Cross::GetPlatformConfigDir(config_path); + MountDOSBoxDir('C', config_path.c_str()); #endif /* Start up main machine */ control->StartUp(); diff --git a/src/misc/cross.cpp b/src/misc/cross.cpp index a1fdc3c..88a3aae 100644 --- a/src/misc/cross.cpp +++ b/src/misc/cross.cpp @@ -66,7 +66,7 @@ void Cross::GetPlatformConfigDir(std::string& in) { in = "~/Library/Preferences"; ResolveHomedir(in); #elif defined(HW_RVL) - in = "sd:/DOSBox"; + in = std::string(appDrive) + "/DOSBox"; #else in = "~/.dosbox"; ResolveHomedir(in); @@ -97,7 +97,7 @@ void Cross::CreatePlatformConfigDir(std::string& in) { ResolveHomedir(in); //Don't create it. Assume it exists #elif defined(HW_RVL) - in = "sd:/DOSBox"; + in = std::string(appDrive) + "/DOSBox"; CreateDir(in); #else in = "~/.dosbox"; diff --git a/src/platform/wii/wiihardware.cpp b/src/platform/wii/wiihardware.cpp index 47d3ed3..665966e 100644 --- a/src/platform/wii/wiihardware.cpp +++ b/src/platform/wii/wiihardware.cpp @@ -33,7 +33,8 @@ extern void WII_VideoStop(); void MAPPER_CheckEvent(SDL_Event * event); void HomeMenu(); -char appPath[1024]; +char appDrive[MAX_APP_DRIVE_LEN]; +char appPath[MAX_APP_PATH_LEN]; char dosboxCommand[1024] = { 0 }; static lwp_t keythread = LWP_THREAD_NULL; static char shiftkey[130]; @@ -221,17 +222,16 @@ void CreateAppPath(char origpath[]) if (loc != NULL) *loc = 0; // strip file name - int pos = 0; + strncpy(appPath, path, MAX_APP_PATH_LEN); + appPath[MAX_APP_PATH_LEN - 1] = 0; + + loc = strchr(path,'/'); + if (loc != NULL) + *loc = 0; // strip path + + strncpy(appDrive, path, MAX_APP_DRIVE_LEN); + appDrive[MAX_APP_DRIVE_LEN - 1] = 0; - // replace fat:/ with sd:/ - if(strncmp(path, "fat:/", 5) == 0) - { - pos++; - path[1] = 's'; - path[2] = 'd'; - } - strncpy(appPath, &path[pos], MAXPATHLEN); - appPath[MAXPATHLEN-1] = 0; free(path); } diff --git a/src/platform/wii/wiihardware.h b/src/platform/wii/wiihardware.h index c2c88d6..c734964 100644 --- a/src/platform/wii/wiihardware.h +++ b/src/platform/wii/wiihardware.h @@ -7,12 +7,16 @@ #define WIIHARDWARE_H #include +#define MAX_APP_DRIVE_LEN 16 +#define MAX_APP_PATH_LEN 128 + void WiiInit(); void WiiMenu(); void CreateAppPath(char origpath[]); void WiiFinished(); -extern char appPath[1024]; +extern char appDrive[MAX_APP_DRIVE_LEN]; +extern char appPath[MAX_APP_PATH_LEN]; extern char dosboxCommand[1024]; #endif