mirror of
https://github.com/retro100/dosbox-wii.git
synced 2024-11-05 01:45:11 +01:00
sync to dosbox svn
This commit is contained in:
parent
c44458a5d0
commit
b568b9835a
@ -26,6 +26,7 @@
|
||||
#pragma warning ( disable : 4290 )
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef CH_LIST
|
||||
#define CH_LIST
|
||||
@ -51,11 +52,11 @@ public:
|
||||
Hex():_hex(0) { };
|
||||
bool operator==(Hex const& other) {return _hex == other._hex;}
|
||||
operator int () const { return _hex; }
|
||||
|
||||
|
||||
};
|
||||
|
||||
class Value {
|
||||
/*
|
||||
/*
|
||||
* Multitype storage container that is aware of the currently stored type in it.
|
||||
* Value st = "hello";
|
||||
* Value in = 1;
|
||||
@ -71,7 +72,7 @@ private:
|
||||
public:
|
||||
class WrongType { }; // Conversion error class
|
||||
enum Etype { V_NONE, V_HEX, V_BOOL, V_INT, V_STRING, V_DOUBLE,V_CURRENT} type;
|
||||
|
||||
|
||||
/* Constructors */
|
||||
Value() :_string(0), type(V_NONE) { };
|
||||
Value(Hex in) :_hex(in), type(V_HEX) { };
|
||||
@ -83,7 +84,7 @@ public:
|
||||
Value(Value const& in):_string(0) {plaincopy(in);}
|
||||
~Value() { destroy();};
|
||||
Value(std::string const& in,Etype _t) :_string(0),type(V_NONE) {SetValue(in,_t);}
|
||||
|
||||
|
||||
/* Assigment operators */
|
||||
Value& operator= (Hex in) throw(WrongType) { return copy(Value(in));}
|
||||
Value& operator= (int in) throw(WrongType) { return copy(Value(in));}
|
||||
@ -131,7 +132,7 @@ public:
|
||||
virtual bool CheckValue(Value const& in, bool warn);
|
||||
//Set interval value to in or default if in is invalid. force always sets the value.
|
||||
void SetVal(Value const& in, bool forced,bool warn=true) {if(forced || CheckValue(in,warn)) value = in; else value = default_value;}
|
||||
virtual ~Property(){ }
|
||||
virtual ~Property(){ }
|
||||
virtual const std::vector<Value>& GetValues() const;
|
||||
Value::Etype Get_type(){return default_value.type;}
|
||||
|
||||
@ -146,12 +147,12 @@ protected:
|
||||
class Prop_int:public Property {
|
||||
public:
|
||||
Prop_int(std::string const& _propname,Changeable::Value when, int _value)
|
||||
:Property(_propname,when) {
|
||||
:Property(_propname,when) {
|
||||
default_value = value = _value;
|
||||
min = max = -1;
|
||||
}
|
||||
Prop_int(std::string const& _propname,Changeable::Value when, int _min,int _max,int _value)
|
||||
:Property(_propname,when) {
|
||||
:Property(_propname,when) {
|
||||
default_value = value = _value;
|
||||
min = _min;
|
||||
max = _max;
|
||||
@ -177,7 +178,7 @@ public:
|
||||
class Prop_bool:public Property {
|
||||
public:
|
||||
Prop_bool(std::string const& _propname, Changeable::Value when, bool _value)
|
||||
:Property(_propname,when) {
|
||||
:Property(_propname,when) {
|
||||
default_value = value = _value;
|
||||
}
|
||||
void SetValue(std::string const& in);
|
||||
@ -187,7 +188,7 @@ public:
|
||||
class Prop_string:public Property{
|
||||
public:
|
||||
Prop_string(std::string const& _propname, Changeable::Value when, char const * const _value)
|
||||
:Property(_propname,when) {
|
||||
:Property(_propname,when) {
|
||||
default_value = value = _value;
|
||||
}
|
||||
void SetValue(std::string const& in);
|
||||
@ -198,7 +199,7 @@ class Prop_path:public Prop_string{
|
||||
public:
|
||||
std::string realpath;
|
||||
Prop_path(std::string const& _propname, Changeable::Value when, char const * const _value)
|
||||
:Prop_string(_propname,when,_value) {
|
||||
:Prop_string(_propname,when,_value) {
|
||||
default_value = value = _value;
|
||||
realpath = _value;
|
||||
}
|
||||
@ -209,7 +210,7 @@ public:
|
||||
class Prop_hex:public Property {
|
||||
public:
|
||||
Prop_hex(std::string const& _propname, Changeable::Value when, Hex _value)
|
||||
:Property(_propname,when) {
|
||||
:Property(_propname,when) {
|
||||
default_value = value = _value;
|
||||
}
|
||||
void SetValue(std::string const& in);
|
||||
@ -263,7 +264,7 @@ public:
|
||||
Prop_path* Add_path(std::string const& _propname, Property::Changeable::Value when, char const * const _value=NULL);
|
||||
Prop_bool* Add_bool(std::string const& _propname, Property::Changeable::Value when, bool _value=false);
|
||||
Prop_hex* Add_hex(std::string const& _propname, Property::Changeable::Value when, Hex _value=0);
|
||||
// void Add_double(char const * const _propname, double _value=0.0);
|
||||
// void Add_double(char const * const _propname, double _value=0.0);
|
||||
Prop_multival *Add_multi(std::string const& _propname, Property::Changeable::Value when,std::string const& sep);
|
||||
Prop_multival_remain *Add_multiremain(std::string const& _propname, Property::Changeable::Value when,std::string const& sep);
|
||||
|
||||
@ -306,7 +307,7 @@ public:
|
||||
virtual void SetValue(std::string const& input);
|
||||
};
|
||||
|
||||
|
||||
|
||||
class Section_line: public Section{
|
||||
public:
|
||||
Section_line(std::string const& _sectionname):Section(_sectionname){}
|
||||
|
@ -16,7 +16,7 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: dosbox.cpp,v 1.148 2009/04/26 15:37:04 c2woody Exp $ */
|
||||
/* $Id: dosbox.cpp,v 1.149 2009/05/20 18:07:06 qbix79 Exp $ */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
@ -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
|
||||
@ -168,6 +168,7 @@ increaseticks:
|
||||
ticksAdded = ticksRemain;
|
||||
if (CPU_CycleAutoAdjust && !CPU_SkipCycleAutoAdjust) {
|
||||
if (ticksScheduled >= 250 || ticksDone >= 250 || (ticksAdded > 15 && ticksScheduled >= 5) ) {
|
||||
if(ticksDone < 1) ticksDone = 1; // Protect against div by zero
|
||||
/* ratio we are aiming for is around 90% usage*/
|
||||
Bit32s ratio = (ticksScheduled * (CPU_CyclePercUsed*90*1024/100/100)) / ticksDone;
|
||||
Bit32s new_cmax = CPU_CycleMax;
|
||||
@ -178,10 +179,14 @@ increaseticks:
|
||||
double ratioremoved = (double) CPU_IODelayRemoved / (double) cproc;
|
||||
if (ratioremoved < 1.0) {
|
||||
ratio = (Bit32s)((double)ratio * (1 - ratioremoved));
|
||||
/* Don't allow very high ratio which can cause us to lock as we don't scale down
|
||||
* for very low ratios. High ratio might result because of timing resolution */
|
||||
if (ticksScheduled >= 250 && ticksDone < 10 && ratio > 20480)
|
||||
ratio = 20480;
|
||||
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 +255,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 +282,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 +343,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 +377,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 +423,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 +431,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
|
||||
@ -455,10 +460,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};
|
||||
@ -478,7 +483,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);
|
||||
@ -519,7 +524,7 @@ void DOSBOX_Init(void) {
|
||||
|
||||
|
||||
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);
|
||||
@ -558,13 +563,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->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).");
|
||||
|
||||
@ -589,7 +594,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.");
|
||||
|
||||
@ -599,7 +604,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");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2002-2007 The DOSBox Team
|
||||
* Copyright (C) 2002-2009 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -16,7 +16,7 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: sdl_mapper.cpp,v 1.59 2009/05/14 18:01:25 qbix79 Exp $ */
|
||||
/* $Id: sdl_mapper.cpp,v 1.60 2009/06/01 10:25:51 qbix79 Exp $ */
|
||||
|
||||
#include <vector>
|
||||
#include <list>
|
||||
@ -2126,7 +2126,7 @@ void BIND_MappingEvents(void) {
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event)) {
|
||||
switch (event.type) {
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
/* Check the press */
|
||||
for (CButton_it but_it = buttons.begin();but_it!=buttons.end();but_it++) {
|
||||
if ((*but_it)->OnTop(event.button.x,event.button.y)) {
|
||||
@ -2272,7 +2272,10 @@ void MAPPER_Run(bool pressed) {
|
||||
return;
|
||||
KEYBOARD_ClrBuffer(); //Clear buffer
|
||||
GFX_LosingFocus(); //Release any keys pressed (buffer gets filled again).
|
||||
MAPPER_RunInternal();
|
||||
}
|
||||
|
||||
void MAPPER_RunInternal() {
|
||||
int cursor = SDL_ShowCursor(SDL_QUERY);
|
||||
SDL_ShowCursor(SDL_ENABLE);
|
||||
bool mousetoggle=false;
|
||||
|
@ -16,7 +16,7 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: sdlmain.cpp,v 1.150 2009/02/25 19:58:11 c2woody Exp $ */
|
||||
/* $Id: sdlmain.cpp,v 1.154 2009/06/01 10:25:51 qbix79 Exp $ */
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
@ -36,6 +36,7 @@
|
||||
#include <wiihardware.h>
|
||||
#endif
|
||||
|
||||
#include "cross.h"
|
||||
#include "SDL.h"
|
||||
|
||||
#include "dosbox.h"
|
||||
@ -151,6 +152,7 @@ enum PRIORITY_LEVELS {
|
||||
|
||||
|
||||
struct SDL_Block {
|
||||
bool inited;
|
||||
bool active; //If this isn't set don't draw
|
||||
bool updating;
|
||||
struct {
|
||||
@ -965,9 +967,30 @@ static void SetPriority(PRIORITY_LEVELS level) {
|
||||
}
|
||||
}
|
||||
|
||||
extern Bit8u int10_font_14[256 * 14];
|
||||
static void OutputString(Bitu x,Bitu y,const char * text,Bit32u color,Bit32u color2,SDL_Surface * output_surface) {
|
||||
Bit32u * draw=(Bit32u*)(((Bit8u *)output_surface->pixels)+((y)*output_surface->pitch))+x;
|
||||
while (*text) {
|
||||
Bit8u * font=&int10_font_14[(*text)*14];
|
||||
Bitu i,j;
|
||||
Bit32u * draw_line=draw;
|
||||
for (i=0;i<14;i++) {
|
||||
Bit8u map=*font++;
|
||||
for (j=0;j<8;j++) {
|
||||
if (map & 0x80) *((Bit32u*)(draw_line+j))=color; else *((Bit32u*)(draw_line+j))=color2;
|
||||
map<<=1;
|
||||
}
|
||||
draw_line+=output_surface->pitch/4;
|
||||
}
|
||||
text++;
|
||||
draw+=8;
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned char logo[32*32*4]= {
|
||||
#include "dosbox_logo.h"
|
||||
};
|
||||
#include "dosbox_splash.h"
|
||||
|
||||
//extern void UI_Run(bool);
|
||||
static void GUI_StartUp(Section * sec) {
|
||||
@ -1145,7 +1168,82 @@ static void GUI_StartUp(Section * sec) {
|
||||
LOG_MSG("SDL:You are running in 24 bpp mode, this will slow down things!");
|
||||
}
|
||||
GFX_Stop();
|
||||
/* Get some Event handlers */
|
||||
SDL_WM_SetCaption("DOSBox",VERSION);
|
||||
|
||||
/* The endian part is intentionally disabled as somehow it produces correct results without according to rhoenie*/
|
||||
//#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||
// Bit32u rmask = 0xff000000;
|
||||
// Bit32u gmask = 0x00ff0000;
|
||||
// Bit32u bmask = 0x0000ff00;
|
||||
//#else
|
||||
Bit32u rmask = 0x000000ff;
|
||||
Bit32u gmask = 0x0000ff00;
|
||||
Bit32u bmask = 0x00ff0000;
|
||||
//#endif
|
||||
|
||||
/* Please leave the Splash screen stuff in working order in DOSBox. We spend a lot of time making DOSBox. */
|
||||
/*
|
||||
SDL_Surface* splash_surf = SDL_CreateRGBSurface(SDL_SWSURFACE, 640, 400, 32, rmask, gmask, bmask, 0);
|
||||
if (splash_surf) {
|
||||
SDL_FillRect(splash_surf, NULL, SDL_MapRGB(splash_surf->format, 0, 0, 0));
|
||||
|
||||
Bit8u* tmpbufp = new Bit8u[640*400*3];
|
||||
GIMP_IMAGE_RUN_LENGTH_DECODE(tmpbufp,gimp_image.rle_pixel_data,640*400,3);
|
||||
for (Bitu y=0; y<400; y++) {
|
||||
|
||||
Bit8u* tmpbuf = tmpbufp + y*640*3;
|
||||
Bit32u * draw=(Bit32u*)(((Bit8u *)splash_surf->pixels)+((y)*splash_surf->pitch));
|
||||
for (Bitu x=0; x<640; x++) {
|
||||
//#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||
// *draw++ = tmpbuf[x*3+2]+tmpbuf[x*3+1]*0x100+tmpbuf[x*3+0]*0x10000+0x00000000;
|
||||
//#else
|
||||
*draw++ = tmpbuf[x*3+0]+tmpbuf[x*3+1]*0x100+tmpbuf[x*3+2]*0x10000+0x00000000;
|
||||
//#endif
|
||||
}
|
||||
}
|
||||
|
||||
bool exit_splash = false;
|
||||
|
||||
static Bitu max_splash_loop = 600;
|
||||
static Bitu splash_fade = 100;
|
||||
static bool use_fadeout = true;
|
||||
|
||||
for (Bit32u ct = 0,startticks = GetTicks();ct < max_splash_loop;ct = GetTicks()-startticks) {
|
||||
SDL_Event evt;
|
||||
while (SDL_PollEvent(&evt)) {
|
||||
if (evt.type == SDL_QUIT) {
|
||||
exit_splash = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (exit_splash) break;
|
||||
|
||||
if (ct<1) {
|
||||
SDL_FillRect(sdl.surface, NULL, SDL_MapRGB(sdl.surface->format, 0, 0, 0));
|
||||
SDL_SetAlpha(splash_surf, SDL_SRCALPHA,255);
|
||||
SDL_BlitSurface(splash_surf, NULL, sdl.surface, NULL);
|
||||
SDL_Flip(sdl.surface);
|
||||
} else if (ct>=max_splash_loop-splash_fade) {
|
||||
if (use_fadeout) {
|
||||
SDL_FillRect(sdl.surface, NULL, SDL_MapRGB(sdl.surface->format, 0, 0, 0));
|
||||
SDL_SetAlpha(splash_surf, SDL_SRCALPHA, (Bit8u)((max_splash_loop-1-ct)*255/(splash_fade-1)));
|
||||
SDL_BlitSurface(splash_surf, NULL, sdl.surface, NULL);
|
||||
SDL_Flip(sdl.surface);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (use_fadeout) {
|
||||
SDL_FillRect(sdl.surface, NULL, SDL_MapRGB(sdl.surface->format, 0, 0, 0));
|
||||
SDL_Flip(sdl.surface);
|
||||
}
|
||||
SDL_FreeSurface(splash_surf);
|
||||
delete [] tmpbufp;
|
||||
|
||||
}
|
||||
*/
|
||||
/* Get some Event handlers */
|
||||
MAPPER_AddHandler(KillSwitch,MK_f9,MMOD1,"shutdown","ShutDown");
|
||||
MAPPER_AddHandler(CaptureMouse,MK_f10,MMOD1,"capmouse","Cap Mouse");
|
||||
MAPPER_AddHandler(SwitchFullScreen,MK_return,MMOD2,"fullscr","Fullscreen");
|
||||
@ -1453,7 +1551,49 @@ void Config_Add_SDL() {
|
||||
Pbool->Set_help("Avoid usage of symkeys, might not work on all operating systems.");
|
||||
}
|
||||
|
||||
static void launcheditor(std::string const& edit) {
|
||||
static void show_warning(char const * const message) {
|
||||
bool textonly = true;
|
||||
#ifdef WIN32
|
||||
textonly = false;
|
||||
if ( !sdl.inited && SDL_Init(SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE) < 0 ) textonly = true;
|
||||
sdl.inited = true;
|
||||
#endif
|
||||
printf(message);
|
||||
if(textonly) return;
|
||||
if(!sdl.surface) sdl.surface = SDL_SetVideoMode(640,400,0,0);
|
||||
if(!sdl.surface) return;
|
||||
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||
Bit32u rmask = 0xff000000;
|
||||
Bit32u gmask = 0x00ff0000;
|
||||
Bit32u bmask = 0x0000ff00;
|
||||
#else
|
||||
Bit32u rmask = 0x000000ff;
|
||||
Bit32u gmask = 0x0000ff00;
|
||||
Bit32u bmask = 0x00ff0000;
|
||||
#endif
|
||||
SDL_Surface* splash_surf = SDL_CreateRGBSurface(SDL_SWSURFACE, 640, 400, 32, rmask, gmask, bmask, 0);
|
||||
if (!splash_surf) return;
|
||||
|
||||
int x = 120,y = 20;
|
||||
std::string m(message),m2;
|
||||
std::string::size_type a,b,c,d;
|
||||
|
||||
while(m.size()) { //Max 50 characters. break on space before or on a newline
|
||||
c = m.find('\n');
|
||||
d = m.rfind(' ',50);
|
||||
if(c>d) a=b=d; else a=b=c;
|
||||
if( a != std::string::npos) b++;
|
||||
m2 = m.substr(0,a); m.erase(0,b);
|
||||
OutputString(x,y,m2.c_str(),0xffffffff,0,splash_surf);
|
||||
y += 20;
|
||||
}
|
||||
|
||||
SDL_BlitSurface(splash_surf, NULL, sdl.surface, NULL);
|
||||
SDL_Flip(sdl.surface);
|
||||
SDL_Delay(10000);
|
||||
}
|
||||
|
||||
static void launcheditor() {
|
||||
std::string path,file;
|
||||
Cross::CreatePlatformConfigDir(path);
|
||||
Cross::GetPlatformConfigName(file);
|
||||
@ -1464,14 +1604,41 @@ static void launcheditor(std::string const& edit) {
|
||||
exit(1);
|
||||
}
|
||||
if(f) fclose(f);
|
||||
if(edit.empty()) {
|
||||
/* if(edit.empty()) {
|
||||
printf("no editor specified.\n");
|
||||
exit(1);
|
||||
}*/
|
||||
std::string edit;
|
||||
while(control->cmdline->FindString("-editconf",edit,true)) //Loop until one succeeds
|
||||
execlp(edit.c_str(),edit.c_str(),path.c_str(),(char*) 0);
|
||||
//if you get here the launching failed!
|
||||
printf("can't find editor(s) specified at the command line.\n");
|
||||
exit(1);
|
||||
}
|
||||
static void launchcaptures(std::string const& edit) {
|
||||
std::string path,file;
|
||||
Section* t = control->GetSection("dosbox");
|
||||
if(t) file = t->GetPropValue("captures");
|
||||
if(!t || file == NO_SUCH_PROPERTY) {
|
||||
printf("Config system messed up.\n");
|
||||
exit(1);
|
||||
}
|
||||
Cross::CreatePlatformConfigDir(path);
|
||||
path += file;
|
||||
Cross::CreateDir(path);
|
||||
struct stat cstat;
|
||||
if(stat(path.c_str(),&cstat) || (cstat.st_mode & S_IFDIR) == 0) {
|
||||
printf("%s doesn't exists or isn't a directory.\n",path.c_str());
|
||||
exit(1);
|
||||
}
|
||||
/* if(edit.empty()) {
|
||||
printf("no editor specified.\n");
|
||||
exit(1);
|
||||
}*/
|
||||
|
||||
execlp(edit.c_str(),edit.c_str(),path.c_str(),(char*) 0);
|
||||
//if you get here the launching failed!
|
||||
printf("can't find editor %s\n",edit.c_str());
|
||||
printf("can't find filemanager %s\n",edit.c_str());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -1480,6 +1647,7 @@ static void printconfiglocation() {
|
||||
Cross::CreatePlatformConfigDir(path);
|
||||
Cross::GetPlatformConfigName(file);
|
||||
path += file;
|
||||
|
||||
FILE* f = fopen(path.c_str(),"r");
|
||||
if(!f && !control->PrintConfig(path.c_str())) {
|
||||
printf("tried creating %s. but failed",path.c_str());
|
||||
@ -1490,6 +1658,23 @@ static void printconfiglocation() {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static void eraseconfigfile() {
|
||||
FILE* f = fopen("dosbox.conf","r");
|
||||
if(f) {
|
||||
fclose(f);
|
||||
//show_warning("Warning: dosbox.conf exists in current working directory.\nThis will override the configuration file at runtime.\n");
|
||||
}
|
||||
std::string path,file;
|
||||
Cross::GetPlatformConfigDir(path);
|
||||
Cross::GetPlatformConfigName(file);
|
||||
path += file;
|
||||
f = fopen(path.c_str(),"r");
|
||||
if(!f) exit(0);
|
||||
fclose(f);
|
||||
unlink(path.c_str());
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int MountDOSBoxDir(char DriveLetter, const char *path);
|
||||
|
||||
//extern void UI_Init(void);
|
||||
@ -1508,7 +1693,9 @@ int main(int argc, char* argv[]) {
|
||||
DOSBOX_Init();
|
||||
|
||||
std::string editor;
|
||||
if(control->cmdline->FindString("-editconf",editor,true)) launcheditor(editor);
|
||||
if(control->cmdline->FindString("-editconf",editor,false)) launcheditor();
|
||||
if(control->cmdline->FindString("-opencaptures",editor,true)) launchcaptures(editor);
|
||||
if(control->cmdline->FindExist("-eraseconf")) eraseconfigfile();
|
||||
|
||||
/* Can't disable the console with debugger enabled */
|
||||
#if defined(WIN32) && !(C_DEBUG)
|
||||
@ -1570,6 +1757,7 @@ int main(int argc, char* argv[]) {
|
||||
if ( SDL_Init( SDL_INIT_AUDIO|SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_CDROM
|
||||
|SDL_INIT_NOPARACHUTE
|
||||
) < 0 ) E_Exit("Can't init SDL %s",SDL_GetError());
|
||||
sdl.inited = true;
|
||||
|
||||
#ifndef DISABLE_JOYSTICK
|
||||
//Initialise Joystick seperately. This way we can warn when it fails instead
|
||||
@ -1671,7 +1859,7 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
/* Init the keyMapper */
|
||||
MAPPER_Init();
|
||||
if (control->cmdline->FindExist("-startmapper")) MAPPER_Run(false);
|
||||
if (control->cmdline->FindExist("-startmapper")) MAPPER_RunInternal();
|
||||
#ifdef HW_RVL
|
||||
bool cMounted = false;
|
||||
|
||||
@ -1719,7 +1907,7 @@ int main(int argc, char* argv[]) {
|
||||
#endif
|
||||
SDL_Quit();//Let's hope sdl will quit as well when it catches an exception
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
void GFX_GetSize(int &width, int &height, bool &fullscreen) {
|
||||
width = sdl.draw.width;
|
||||
|
Loading…
Reference in New Issue
Block a user