disable joystick input by default either command line or config file need to be used to enable it now, ability to choose joystick number to use also added
svn-id: r10518
This commit is contained in:
parent
13773455a4
commit
eecdf67c63
6 changed files with 38 additions and 21 deletions
4
TODO
4
TODO
|
@ -85,6 +85,7 @@ Broken Sword 2
|
||||||
* Enforce ScummVM code formatting guidelines.
|
* Enforce ScummVM code formatting guidelines.
|
||||||
* Encapsulate the code into sensible objects.
|
* Encapsulate the code into sensible objects.
|
||||||
* Enable the CD swapping code.
|
* Enable the CD swapping code.
|
||||||
|
* Support cutscenes in some kind of open video format.
|
||||||
|
|
||||||
SIMON
|
SIMON
|
||||||
=====
|
=====
|
||||||
|
@ -123,6 +124,3 @@ SDL backend
|
||||||
algorithm, this should solve many of the problems with some luck
|
algorithm, this should solve many of the problems with some luck
|
||||||
* OpenGL code: either fix it (see open bug tracker items and various hacks in the code),
|
* OpenGL code: either fix it (see open bug tracker items and various hacks in the code),
|
||||||
or remove it. Does anybody really need this???
|
or remove it. Does anybody really need this???
|
||||||
* Joystick code: either fix it, or remove it, or make it possible to turn it on/off.
|
|
||||||
It causes crashs and/or odd behaviour for many people with joysticks (and apparently
|
|
||||||
also in a few odd cases to people without joystick?! Not confirmed)
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
/* Factory functions. This means we don't have to include the headers for
|
/* Factory functions. This means we don't have to include the headers for
|
||||||
* all backends.
|
* all backends.
|
||||||
*/
|
*/
|
||||||
extern OSystem *OSystem_SDL_create(int gfx_driver, bool full_screen, bool aspect_ratio);
|
extern OSystem *OSystem_SDL_create(int gfx_driver, bool full_screen, bool aspect_ratio, int joystick_num);
|
||||||
extern OSystem *OSystem_NULL_create();
|
extern OSystem *OSystem_NULL_create();
|
||||||
extern OSystem *OSystem_MorphOS_create(int game_id, int gfx_driver, bool full_screen);
|
extern OSystem *OSystem_MorphOS_create(int game_id, int gfx_driver, bool full_screen);
|
||||||
extern OSystem *OSystem_Dreamcast_create();
|
extern OSystem *OSystem_Dreamcast_create();
|
||||||
|
|
|
@ -41,26 +41,32 @@
|
||||||
#define JOY_BUT_SPACE 4
|
#define JOY_BUT_SPACE 4
|
||||||
#define JOY_BUT_F5 5
|
#define JOY_BUT_F5 5
|
||||||
|
|
||||||
OSystem *OSystem_SDL_create(int gfx_mode, bool full_screen, bool aspect_ratio) {
|
OSystem *OSystem_SDL_create(int gfx_mode, bool full_screen, bool aspect_ratio, int joystick_num) {
|
||||||
return OSystem_SDL_Common::create(gfx_mode, full_screen, aspect_ratio);
|
return OSystem_SDL_Common::create(gfx_mode, full_screen, aspect_ratio, joystick_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
OSystem *OSystem_SDL_Common::create(int gfx_mode, bool full_screen, bool aspect_ratio) {
|
OSystem *OSystem_SDL_Common::create(int gfx_mode, bool full_screen, bool aspect_ratio, int joystick_num) {
|
||||||
OSystem_SDL_Common *syst = OSystem_SDL_Common::create_intern();
|
OSystem_SDL_Common *syst = OSystem_SDL_Common::create_intern();
|
||||||
|
|
||||||
syst->init_intern(gfx_mode, full_screen, aspect_ratio);
|
syst->init_intern(gfx_mode, full_screen, aspect_ratio, joystick_num);
|
||||||
|
|
||||||
return syst;
|
return syst;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_SDL_Common::init_intern(int gfx_mode, bool full_screen, bool aspect_ratio) {
|
void OSystem_SDL_Common::init_intern(int gfx_mode, bool full_screen, bool aspect_ratio, int joystick_num) {
|
||||||
|
|
||||||
_mode = gfx_mode;
|
_mode = gfx_mode;
|
||||||
_full_screen = full_screen;
|
_full_screen = full_screen;
|
||||||
_adjustAspectRatio = aspect_ratio;
|
_adjustAspectRatio = aspect_ratio;
|
||||||
_mode_flags = 0;
|
_mode_flags = 0;
|
||||||
|
uint32 sdlFlags;
|
||||||
|
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER | SDL_INIT_JOYSTICK) ==-1) {
|
sdlFlags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;
|
||||||
|
|
||||||
|
if (joystick_num > -1)
|
||||||
|
sdlFlags |= SDL_INIT_JOYSTICK;
|
||||||
|
|
||||||
|
if (SDL_Init(sdlFlags) ==-1) {
|
||||||
error("Could not initialize SDL: %s.\n", SDL_GetError());
|
error("Could not initialize SDL: %s.\n", SDL_GetError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,9 +83,9 @@ void OSystem_SDL_Common::init_intern(int gfx_mode, bool full_screen, bool aspect
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// enable joystick
|
// enable joystick
|
||||||
if (SDL_NumJoysticks() > 0) {
|
if (joystick_num > -1 && SDL_NumJoysticks() > 0) {
|
||||||
printf("Using joystick: %s\n", SDL_JoystickName(0));
|
printf("Using joystick: %s\n", SDL_JoystickName(0));
|
||||||
init_joystick();
|
init_joystick(joystick_num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ public:
|
||||||
virtual int16 RGBToColor(uint8 r, uint8 g, uint8 b);
|
virtual int16 RGBToColor(uint8 r, uint8 g, uint8 b);
|
||||||
virtual void colorToRGB(int16 color, uint8 &r, uint8 &g, uint8 &b);
|
virtual void colorToRGB(int16 color, uint8 &r, uint8 &g, uint8 &b);
|
||||||
|
|
||||||
static OSystem *create(int gfx_mode, bool full_screenm, bool aspect_ratio);
|
static OSystem *create(int gfx_mode, bool full_screenm, bool aspect_ratio, int joystick_num);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
OSystem_SDL_Common();
|
OSystem_SDL_Common();
|
||||||
|
@ -125,7 +125,7 @@ protected:
|
||||||
|
|
||||||
static OSystem_SDL_Common *create_intern();
|
static OSystem_SDL_Common *create_intern();
|
||||||
|
|
||||||
void init_intern(int gfx_mode, bool full_screen, bool aspect_ratio);
|
void init_intern(int gfx_mode, bool full_screen, bool aspect_ratio, int joystick_num);
|
||||||
|
|
||||||
// unseen game screen
|
// unseen game screen
|
||||||
SDL_Surface *_screen;
|
SDL_Surface *_screen;
|
||||||
|
@ -229,7 +229,7 @@ protected:
|
||||||
|
|
||||||
void setup_icon();
|
void setup_icon();
|
||||||
void kbd_mouse();
|
void kbd_mouse();
|
||||||
void init_joystick() { _joystick = SDL_JoystickOpen(0); }
|
void init_joystick(int joystick_num) { _joystick = SDL_JoystickOpen(joystick_num); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -54,7 +54,7 @@ static const char USAGE_STRING[] =
|
||||||
"\tscummvm [OPTIONS] [game]\n"
|
"\tscummvm [OPTIONS] [game]\n"
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
"\t-p<path> - Look for game in <path>\n"
|
"\t-p<path> - Look for game in <path>\n"
|
||||||
"\t-x[<num>] - Load this savegame (default: 0 - autosave)\n"
|
"\t-x[num] - Load this savegame (default: 0 - autosave)\n"
|
||||||
"\t-f - Full-screen mode (-F forces window mode.)\n"
|
"\t-f - Full-screen mode (-F forces window mode.)\n"
|
||||||
"\t-g<mode> - Graphics mode (normal,2x,3x,2xsai,super2xsai,\n"
|
"\t-g<mode> - Graphics mode (normal,2x,3x,2xsai,super2xsai,\n"
|
||||||
"\t supereagle,advmame2x,advmame3x,hq2x,hq3x,\n"
|
"\t supereagle,advmame2x,advmame3x,hq2x,hq3x,\n"
|
||||||
|
@ -64,6 +64,7 @@ static const char USAGE_STRING[] =
|
||||||
"\t gb,hb)\n"
|
"\t gb,hb)\n"
|
||||||
"\n"
|
"\n"
|
||||||
"\t-c<num> - Use cdrom <num> for cd audio\n"
|
"\t-c<num> - Use cdrom <num> for cd audio\n"
|
||||||
|
"\t-j[num] - Enable input with joystick (default: 0 - 1st joystick)\n"
|
||||||
"\t-m<num> - Set music volume to <num> (0-255)\n"
|
"\t-m<num> - Set music volume to <num> (0-255)\n"
|
||||||
"\t-o<num> - Set master volume to <num> (0-255)\n"
|
"\t-o<num> - Set master volume to <num> (0-255)\n"
|
||||||
"\t-s<num> - Set sfx volume to <num> (0-255)\n"
|
"\t-s<num> - Set sfx volume to <num> (0-255)\n"
|
||||||
|
@ -74,16 +75,16 @@ static const char USAGE_STRING[] =
|
||||||
"\n"
|
"\n"
|
||||||
"\t-l<file> - Load config file instead of default\n"
|
"\t-l<file> - Load config file instead of default\n"
|
||||||
#if defined(UNIX)
|
#if defined(UNIX)
|
||||||
"\t-w[<file>] - Write to config file [~/.scummvmrc]\n"
|
"\t-w[file] - Write to config file [~/.scummvmrc]\n"
|
||||||
#else
|
#else
|
||||||
"\t-w[<file>] - Write to config file [scummvm.ini]\n"
|
"\t-w[file] - Write to config file [scummvm.ini]\n"
|
||||||
#endif
|
#endif
|
||||||
"\t-v - Show version info and exit\n"
|
"\t-v - Show version info and exit\n"
|
||||||
"\t-h - Display this text and exit\n"
|
"\t-h - Display this text and exit\n"
|
||||||
"\t-z - Display list of games\n"
|
"\t-z - Display list of games\n"
|
||||||
"\n"
|
"\n"
|
||||||
"\t-b<num> - Pass number to the boot script (boot param)\n"
|
"\t-b<num> - Pass number to the boot script (boot param)\n"
|
||||||
"\t-d[<num>] - Enable debug output (debug level [1])\n"
|
"\t-d[num] - Enable debug output (debug level [1])\n"
|
||||||
"\t-u - Dump scripts\n"
|
"\t-u - Dump scripts\n"
|
||||||
"\n"
|
"\n"
|
||||||
"\t--platform= - Specify version of game (amiga,atari-st,macintosh)\n"
|
"\t--platform= - Specify version of game (amiga,atari-st,macintosh)\n"
|
||||||
|
@ -199,6 +200,7 @@ GameDetector::GameDetector() {
|
||||||
_native_mt32 = false;
|
_native_mt32 = false;
|
||||||
|
|
||||||
_cdrom = 0;
|
_cdrom = 0;
|
||||||
|
_joystick_num = 0;
|
||||||
_save_slot = 0;
|
_save_slot = 0;
|
||||||
|
|
||||||
_saveconfig = false;
|
_saveconfig = false;
|
||||||
|
@ -221,6 +223,8 @@ void GameDetector::updateconfig() {
|
||||||
|
|
||||||
_save_slot = g_config->getInt("save_slot", _save_slot);
|
_save_slot = g_config->getInt("save_slot", _save_slot);
|
||||||
|
|
||||||
|
_joystick_num = g_config->getInt("joystick_num", _joystick_num);
|
||||||
|
|
||||||
_cdrom = g_config->getInt("cdrom", _cdrom);
|
_cdrom = g_config->getInt("cdrom", _cdrom);
|
||||||
|
|
||||||
if ((val = g_config->get("music_driver")))
|
if ((val = g_config->get("music_driver")))
|
||||||
|
@ -325,6 +329,7 @@ void GameDetector::parseCommandLine(int argc, char **argv) {
|
||||||
char c;
|
char c;
|
||||||
bool long_option_value;
|
bool long_option_value;
|
||||||
_save_slot = -1;
|
_save_slot = -1;
|
||||||
|
_joystick_num = -1;
|
||||||
|
|
||||||
// Parse the arguments
|
// Parse the arguments
|
||||||
// into a transient "_COMMAND_LINE" config comain.
|
// into a transient "_COMMAND_LINE" config comain.
|
||||||
|
@ -375,7 +380,14 @@ void GameDetector::parseCommandLine(int argc, char **argv) {
|
||||||
g_config->set("gfx_mode", option, "scummvm");
|
g_config->set("gfx_mode", option, "scummvm");
|
||||||
break;
|
break;
|
||||||
// case 'h': reserved for help
|
// case 'h': reserved for help
|
||||||
// case 'j': reserved for joystick select
|
case 'j':
|
||||||
|
_joystick_num = 0;
|
||||||
|
HANDLE_OPT_OPTION();
|
||||||
|
if (option != NULL) {
|
||||||
|
_joystick_num = atoi(option);
|
||||||
|
g_config->setInt("joystick_num", _joystick_num);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
HANDLE_OPTION();
|
HANDLE_OPTION();
|
||||||
{
|
{
|
||||||
|
@ -738,7 +750,7 @@ OSystem *GameDetector::createSystem() {
|
||||||
return OSystem_PALMOS_create(_gfx_mode, _fullScreen);
|
return OSystem_PALMOS_create(_gfx_mode, _fullScreen);
|
||||||
#else
|
#else
|
||||||
/* SDL is the default driver for now */
|
/* SDL is the default driver for now */
|
||||||
return OSystem_SDL_create(_gfx_mode, _fullScreen, _aspectRatio);
|
return OSystem_SDL_create(_gfx_mode, _fullScreen, _aspectRatio, _joystick_num);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,6 +152,7 @@ public:
|
||||||
bool _native_mt32;
|
bool _native_mt32;
|
||||||
|
|
||||||
int _cdrom;
|
int _cdrom;
|
||||||
|
int _joystick_num;
|
||||||
int _save_slot;
|
int _save_slot;
|
||||||
|
|
||||||
bool _saveconfig;
|
bool _saveconfig;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue