linux: add --nojoy=1 to skip joystick initialization (for folks with laptops that have accelerometers for joysticks)

This commit is contained in:
zeromus 2009-12-13 21:42:55 +00:00
parent c10af35f4d
commit 4f997b7dba
5 changed files with 17 additions and 10 deletions

View File

@ -1,8 +1,4 @@
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright (C) 2009 CrazyMax
/* Copyright (C) 2009 CrazyMax
Copyright (C) 2009 DeSmuME team
This file is part of DeSmuME

View File

@ -1,8 +1,4 @@
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright (C) 2009 CrazyMax
/* Copyright (C) 2009 CrazyMax
Copyright (C) 2009 DeSmuME team
This file is part of DeSmuME

View File

@ -31,6 +31,7 @@
#include "NDSSystem.h"
int scanline_filter_a = 2, scanline_filter_b = 4;
int _commandline_linux_nojoy = 0;
CommandLine::CommandLine()
: is_cflash_configured(false)
@ -77,6 +78,9 @@ void CommandLine::loadCommonOptions()
{ "num-cores", 0, 0, G_OPTION_ARG_INT, &_num_cores, "Override numcores detection and use this many", "NUM_CORES"},
{ "scanline-filter-a", 0, 0, G_OPTION_ARG_INT, &scanline_filter_a, "Intensity of fadeout for scanlines filter (edge) (default 2)", "SCANLINE_FILTER_A"},
{ "scanline-filter-b", 0, 0, G_OPTION_ARG_INT, &scanline_filter_b, "Intensity of fadeout for scanlines filter (corner) (default 4)", "SCANLINE_FILTER_B"},
#ifndef _MSC_VER
{ "nojoy", 0, 0, G_OPTION_ARG_INT, &_commandline_linux_nojoy, "Disables joystick support", "NOJOY"},
#endif
#ifdef GDB_STUB
{ "arm9gdb", 0, 0, G_OPTION_ARG_INT, &arm9_gdb_port, "Enable the ARM9 GDB stub on the given port", "PORT_NUM"},
{ "arm7gdb", 0, 0, G_OPTION_ARG_INT, &arm7_gdb_port, "Enable the ARM7 GDB stub on the given port", "PORT_NUM"},
@ -108,6 +112,7 @@ bool CommandLine::parse(int argc,char **argv)
if(_bios_arm9) { CommonSettings.UseExtBIOS = true; strcpy(CommonSettings.ARM9BIOS,_bios_arm9); }
if(_bios_arm7) { CommonSettings.UseExtBIOS = true; strcpy(CommonSettings.ARM7BIOS,_bios_arm7); }
if(_bios_swi) CommonSettings.SWIFromBIOS = true;
if(_bios_swi) CommonSettings.SWIFromBIOS = true;
if (argc == 2)
nds_file = argv[1];

View File

@ -28,6 +28,9 @@
typedef struct _GOptionContext GOptionContext;
typedef struct _GError GError;
//hacky commandline options that i didnt want to route through commonoptions
extern int _commandline_linux_nojoy;
//this class will also eventually try to take over the responsibility of using the args that it handles
//for example: preparing the emulator run by loading the rom, savestate, and/or movie in the correct pattern.
//it should also populate CommonSettings with its initial values

View File

@ -23,6 +23,7 @@
#include "ctrlssdl.h"
#include "saves.h"
#include "SPU.h"
#include "commandline.h"
u16 keyboard_cfg[NB_KEYS];
u16 joypad_cfg[NB_KEYS];
@ -90,6 +91,12 @@ BOOL init_joy( void) {
int i;
BOOL joy_init_good = TRUE;
//user asked for no joystick
if(_commandline_linux_nojoy) {
printf("skipping joystick init\n");
return TRUE;
}
set_joy_keys(default_joypad_cfg);
if(SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)