From 232d8849a520858bb5f5c919427d141adcf6bdf6 Mon Sep 17 00:00:00 2001 From: dborth Date: Thu, 7 May 2009 04:58:47 +0000 Subject: [PATCH] add home button to exit, change defaults, remove press A requirement for startup/shutdown. --- src/dosbox.cpp | 46 +++++++++++++++--------------- src/gui/sdlmain.cpp | 13 +++++++-- src/platform/wii/wiihardware.cpp | 4 +-- src/shell/shell.cpp | 48 +++++++++++++++----------------- 4 files changed, 57 insertions(+), 54 deletions(-) diff --git a/src/dosbox.cpp b/src/dosbox.cpp index fe19fe5..212136d 100644 --- a/src/dosbox.cpp +++ b/src/dosbox.cpp @@ -84,7 +84,7 @@ void MPU401_Init(Section*); void PCSPEAKER_Init(Section*); void TANDYSOUND_Init(Section*); void DISNEY_Init(Section*); -void SERIAL_Init(Section*); +void SERIAL_Init(Section*); #if C_IPX @@ -179,9 +179,9 @@ increaseticks: if (ratioremoved < 1.0) { ratio = (Bit32s)((double)ratio * (1 - ratioremoved)); Bit64s cmax_scaled = (Bit64s)CPU_CycleMax * (Bit64s)ratio; - if (ratio <= 1024) + if (ratio <= 1024) new_cmax = (Bit32s)(cmax_scaled / (Bit64s)1024); - else + else new_cmax = (Bit32s)(1 + (CPU_CycleMax >> 1) + cmax_scaled / (Bit64s)2048); } } @@ -250,7 +250,7 @@ static void DOSBOX_UnlockSpeed( bool pressed ) { CPU_CycleMax /= 3; if (CPU_CycleMax<1000) CPU_CycleMax=1000; } - } else { + } else { ticksLocked = false; if (autoadjust) { autoadjust = false; @@ -277,7 +277,7 @@ static void DOSBOX_RealInit(Section * sec) { } std::string mtype(section->Get_string("machine")); - svgaCard = SVGA_None; + svgaCard = SVGA_None; machine = MCH_VGA; int10.vesa_nolfb = false; int10.vesa_oldvbe = false; @@ -338,10 +338,10 @@ void DOSBOX_Init(void) { Pstring = secprop->Add_path("captures",Property::Changeable::Always,"capture"); Pstring->Set_help("Directory where things like wave, midi, screenshot get captured."); -#if C_DEBUG +#if C_DEBUG LOG_StartUp(); #endif - + secprop->AddInitFunction(&IO_Init);//done secprop->AddInitFunction(&PAGING_Init);//done secprop->AddInitFunction(&MEM_Init);//done @@ -372,7 +372,7 @@ void DOSBOX_Init(void) { Pmulti->Set_help("Scaler used to enlarge/enhance low resolution modes. If 'forced' is appended,the scaler will be used even if the result might not be desired."); Pstring = Pmulti->GetSection()->Add_string("type",Property::Changeable::Always,"normal2x"); - const char *scalers[] = { + const char *scalers[] = { "none", "normal2x", "normal3x", #if RENDER_USE_ADVANCED_SCALERS>2 "advmame2x", "advmame3x", "advinterp2x", "advinterp3x", "hq2x", "hq3x", "2xsai", "super2xsai", "supereagle", @@ -418,7 +418,7 @@ void DOSBOX_Init(void) { Pstring->Set_values(cyclest); Pstring = Pmulti_remain->GetSection()->Add_string("parameters",Property::Changeable::Always,""); - + Pint = secprop->Add_int("cycleup",Property::Changeable::Always,500); Pint->SetMinMax(1,1000000); Pint->Set_help("Amount of cycles to increase/decrease with keycombo."); @@ -426,7 +426,7 @@ void DOSBOX_Init(void) { Pint = secprop->Add_int("cycledown",Property::Changeable::Always,20); Pint->SetMinMax(1,1000000); Pint->Set_help("Setting it lower than 100 will be a percentage."); - + #if C_FPU secprop->AddInitFunction(&FPU_Init); #endif @@ -438,7 +438,7 @@ void DOSBOX_Init(void) { Pbool = secprop->Add_bool("nosound",Property::Changeable::OnlyAtStart,false); Pbool->Set_help("Enable silent mode, sound is still emulated though."); - Pint = secprop->Add_int("rate",Property::Changeable::OnlyAtStart,22050); + Pint = secprop->Add_int("rate",Property::Changeable::OnlyAtStart,48000); Pint->Set_values(rates); Pint->Set_help("Mixer sample rate, setting any device's rate higher than this will probably lower their sound quality."); @@ -451,10 +451,10 @@ void DOSBOX_Init(void) { Pint = secprop->Add_int("prebuffer",Property::Changeable::OnlyAtStart,10); Pint->SetMinMax(0,100); Pint->Set_help("How many milliseconds of data to keep on top of the blocksize."); - + secprop=control->AddSection_prop("midi",&MIDI_Init,true);//done secprop->AddInitFunction(&MPU401_Init,true);//done - + const char* mputypes[] = { "intelligent", "uart", "none",0}; // FIXME: add some way to offer the actually available choices. const char *devices[] = { "default", "win32", "alsa", "oss", "coreaudio", "coremidi","none", 0}; @@ -474,7 +474,7 @@ void DOSBOX_Init(void) { #endif secprop=control->AddSection_prop("sblaster",&SBLASTER_Init,true);//done - + const char* sbtypes[] = { "sb1", "sb2", "sbpro1", "sbpro2", "sb16", "none", 0 }; Pstring = secprop->Add_string("sbtype",Property::Changeable::WhenIdle,"sb16"); Pstring->Set_values(sbtypes); @@ -509,16 +509,16 @@ void DOSBOX_Init(void) { Pstring->Set_values(oplemus); Pstring->Set_help("Provider for the OPL emulation. compat or old might provide better quality (see oplrate as well)."); - Pint = secprop->Add_int("oplrate",Property::Changeable::WhenIdle,22050); + Pint = secprop->Add_int("oplrate",Property::Changeable::WhenIdle,48000); Pint->Set_values(oplrates); Pint->Set_help("Sample rate of OPL music emulation. Use 49716 for highest quality (set the mixer rate accordingly)."); secprop=control->AddSection_prop("gus",&GUS_Init,true); //done - Pbool = secprop->Add_bool("gus",Property::Changeable::WhenIdle,false); + Pbool = secprop->Add_bool("gus",Property::Changeable::WhenIdle,false); Pbool->Set_help("Enable the Gravis Ultrasound emulation."); - Pint = secprop->Add_int("gusrate",Property::Changeable::WhenIdle,22050); + Pint = secprop->Add_int("gusrate",Property::Changeable::WhenIdle,48000); Pint->Set_values(rates); Pint->Set_help("Sample rate of Ultrasound emulation."); @@ -545,7 +545,7 @@ void DOSBOX_Init(void) { Pbool = secprop->Add_bool("pcspeaker",Property::Changeable::WhenIdle,true); Pbool->Set_help("Enable PC-Speaker emulation."); - Pint = secprop->Add_int("pcrate",Property::Changeable::WhenIdle,22050); + Pint = secprop->Add_int("pcrate",Property::Changeable::WhenIdle,48000); Pint->Set_values(rates); Pint->Set_help("Sample rate of the PC-Speaker sound generation."); @@ -554,13 +554,13 @@ void DOSBOX_Init(void) { Pstring = secprop->Add_string("tandy",Property::Changeable::WhenIdle,"auto"); Pstring->Set_values(tandys); Pstring->Set_help("Enable Tandy Sound System emulation. For 'auto', emulation is present only if machine is set to 'tandy'."); - - Pint = secprop->Add_int("tandyrate",Property::Changeable::WhenIdle,22050); + + Pint = secprop->Add_int("tandyrate",Property::Changeable::WhenIdle,48000); Pint->Set_values(rates); Pint->Set_help("Sample rate of the Tandy 3-Voice generation."); secprop->AddInitFunction(&DISNEY_Init,true);//done - + Pbool = secprop->Add_bool("disney",Property::Changeable::WhenIdle,true); Pbool->Set_help("Enable Disney Sound Source emulation. (Covox Voice Master and Speech Thing compatible)."); @@ -585,7 +585,7 @@ void DOSBOX_Init(void) { Pbool = secprop->Add_bool("autofire",Property::Changeable::WhenIdle,false); Pbool->Set_help("continuously fires as long as you keep the button pressed."); - + Pbool = secprop->Add_bool("swap34",Property::Changeable::WhenIdle,false); Pbool->Set_help("swap the 3rd and the 4th axis. can be useful for certain joysticks."); @@ -595,7 +595,7 @@ void DOSBOX_Init(void) { secprop=control->AddSection_prop("serial",&SERIAL_Init,true); const char* serials[] = { "dummy", "disabled", "modem", "nullmodem", "directserial",0 }; - + Pmulti_remain = secprop->Add_multiremain("serial1",Property::Changeable::WhenIdle," "); Pstring = Pmulti_remain->GetSection()->Add_string("type",Property::Changeable::WhenIdle,"dummy"); Pmulti_remain->SetValue("dummy"); diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp index 5153f5f..8f9990d 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp @@ -1225,6 +1225,15 @@ void GFX_LosingFocus(void) { } void GFX_Events() { + // check for home button + u32 btns; + for(int i=0; i<4; i++) + { + btns = WPAD_ButtonsHeld(i); + if((btns & WPAD_BUTTON_HOME) || (btns & WPAD_CLASSIC_BUTTON_HOME)) + throw(0); + } + SDL_Event event; #if defined (REDUCE_JOYSTICK_POLLING) static int poll_delay=0; @@ -1380,10 +1389,10 @@ void Config_Add_SDL() { Prop_int* Pint; Prop_multival* Pmulti; - Pbool = sdl_sec->Add_bool("fullscreen",Property::Changeable::Always,false); + Pbool = sdl_sec->Add_bool("fullscreen",Property::Changeable::Always,true); Pbool->Set_help("Start dosbox directly in fullscreen."); - Pbool = sdl_sec->Add_bool("fulldouble",Property::Changeable::Always,false); + Pbool = sdl_sec->Add_bool("fulldouble",Property::Changeable::Always,true); Pbool->Set_help("Use double buffering in fullscreen."); Pstring = sdl_sec->Add_string("fullresolution",Property::Changeable::Always,"original"); diff --git a/src/platform/wii/wiihardware.cpp b/src/platform/wii/wiihardware.cpp index a54cc1e..4e9eb60 100644 --- a/src/platform/wii/wiihardware.cpp +++ b/src/platform/wii/wiihardware.cpp @@ -29,7 +29,5 @@ bool WiiMessagePause(const char *s) { } void WiiFinished() { -#ifdef HW_RVL - if (WiiMessagePause("Press A to return to homebrew channel.\n")) exit(0); -#endif + } diff --git a/src/shell/shell.cpp b/src/shell/shell.cpp index 4e28366..d92f34d 100644 --- a/src/shell/shell.cpp +++ b/src/shell/shell.cpp @@ -22,7 +22,7 @@ #include #include #ifdef HW_RVL -#include +#include #endif #include "dosbox.h" #include "regs.h" @@ -35,7 +35,7 @@ Bitu call_shellstop; /* Larger scope so shell_del autoexec can use it to * remove things from the environment */ -Program * first_shell = 0; +Program * first_shell = 0; static Bitu shellstop_handler(void) { return CBRET_STOP; @@ -166,9 +166,9 @@ Bitu DOS_Shell::GetRedirection(char *s, char **ifn, char **ofn,bool * append) { while (*lr && *lr!=' ') lr++; //if it ends on a : => remove it. if((*ofn != lr) && (lr[-1] == ':')) lr[-1] = 0; - if(*lr && *(lr+1)) - *lr++=0; - else + if(*lr && *(lr+1)) + *lr++=0; + else *lr=0; *ofn=strdup(*ofn); continue; @@ -178,9 +178,9 @@ Bitu DOS_Shell::GetRedirection(char *s, char **ifn, char **ofn,bool * append) { *ifn=lr; while (*lr && *lr!=' ') lr++; if((*ifn != lr) && (lr[-1] == ':')) lr[-1] = 0; - if(*lr && *(lr+1)) - *lr++=0; - else + if(*lr && *(lr+1)) + *lr++=0; + else *lr=0; *ifn=strdup(*ifn); continue; @@ -192,7 +192,7 @@ Bitu DOS_Shell::GetRedirection(char *s, char **ifn, char **ofn,bool * append) { } *lw=0; return num; -} +} void DOS_Shell::ParseLine(char * line) { LOG(LOG_EXEC,LOG_ERROR)("Parsing command line: %s",line); @@ -201,7 +201,7 @@ void DOS_Shell::ParseLine(char * line) { line = trim(line); /* Do redirection and pipe checks */ - + char * in = 0; char * out = 0; @@ -211,12 +211,12 @@ void DOS_Shell::ParseLine(char * line) { bool append; bool normalstdin = false; /* wether stdin/out are open on start. */ bool normalstdout = false; /* Bug: Assumed is they are "con" */ - + num = GetRedirection(line,&in, &out,&append); if (num>1) LOG_MSG("SHELL:Multiple command on 1 line not supported"); if (in || out) { - normalstdin = (psp->GetFileHandle(0) != 0xff); - normalstdout = (psp->GetFileHandle(1) != 0xff); + normalstdin = (psp->GetFileHandle(0) != 0xff); + normalstdout = (psp->GetFileHandle(1) != 0xff); } if (in) { if(DOS_OpenFile(in,OPEN_READ,&dummy)) { //Test if file exists @@ -241,7 +241,7 @@ void DOS_Shell::ParseLine(char * line) { } else { status = DOS_OpenFileExtended(out,OPEN_READWRITE,DOS_ATTR_ARCHIVE,0x12,&dummy,&dummy2); } - + if(!status && normalstdout) DOS_OpenFile("con",OPEN_READWRITE,&dummy); //Read only file, open con again if(!normalstdin && !in) DOS_CloseFile(0); } @@ -267,7 +267,7 @@ void DOS_Shell::ParseLine(char * line) { void DOS_Shell::RunInternal(void) { char input_line[CMD_MAXLINE] = {0}; - while(bf && bf->ReadLine(input_line)) + while(bf && bf->ReadLine(input_line)) { if (echo) { if (input_line[0] != '@') { @@ -375,8 +375,8 @@ public: /* Check for first command being a directory or file */ char buffer[CROSS_LEN]; char cross_filesplit[2] = {CROSS_FILESPLIT , 0}; - /* Combining -securemode and no parameter leaves you with a lovely Z:\. */ - if ( !control->cmdline->FindCommand(1,line) ) { + /* Combining -securemode and no parameter leaves you with a lovely Z:\. */ + if ( !control->cmdline->FindCommand(1,line) ) { if ( secure ) autoexec[12].Install("z:\\config.com -securemode"); } else { struct stat test; @@ -387,13 +387,13 @@ public: strcat(buffer,line.c_str()); if (stat(buffer,&test)) goto nomount; } - if (test.st_mode & S_IFDIR) { + if (test.st_mode & S_IFDIR) { autoexec[12].Install(std::string("MOUNT C \"") + buffer + "\""); autoexec[13].Install("C:"); if(secure) autoexec[14].Install("z:\\config.com -securemode"); } else { char* name = strrchr(buffer,CROSS_FILESPLIT); - if (!name) { //Only a filename + if (!name) { //Only a filename line = buffer; getcwd(buffer,CROSS_LEN); strcat(buffer,cross_filesplit); @@ -623,7 +623,7 @@ void SHELL_Init() { envmcb.SetPSPSeg(psp_seg); // MCB of the command shell environment envmcb.SetSize(0x28); envmcb.SetType(0x4d); - + /* Setup environment */ PhysPt env_write=PhysMake(env_seg,0); MEM_BlockWrite(env_write,path_string,(Bitu)(strlen(path_string)+1)); @@ -638,7 +638,7 @@ void SHELL_Init() { DOS_PSP psp(psp_seg); psp.MakeNew(0); dos.psp(psp_seg); - + /* The start of the filetable in the psp must look like this: * 01 01 01 00 02 * In order to achieve this: First open 2 files. Close the first and @@ -660,7 +660,7 @@ void SHELL_Init() { tail.count=(Bit8u)strlen(init_line); strcpy(tail.buffer,init_line); MEM_BlockWrite(PhysMake(psp_seg,128),&tail,128); - + /* Setup internal DOS Variables */ dos.dta(RealMake(psp_seg,0x80)); dos.psp(psp_seg); @@ -668,10 +668,6 @@ void SHELL_Init() { SHELL_ProgramStart(&first_shell); -#ifdef HW_RVL - WiiMessagePause("Press A to continue (or Home to exit).\n"); -#endif - first_shell->Run(); delete first_shell; first_shell = 0;//Make clear that it shouldn't be used anymore