Previous 15994 Revisions Next

r934 Friday 7th September, 2007 at 03:33:01 UTC by R. Belmont
[SDLMESS] Fix for 32-bit DRC, joypads w/high # of axes/buttons, and general cleanup.
[src/osd/sdl]input.c osdsdl.h sdlmain.c sdlmisc.c

src/osd/sdl/sdlmisc.c
r933r934
166166
167167void *osd_alloc_executable(size_t size)
168168{
169#ifdef SDLMAME_LINUX
170   return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_SHARED, 0, getpagesize());
171#elif defined(SDLMAME_DARWIN)
169#if defined(SDLMAME_DARWIN)
172170   return (void *)malloc(size);
173171#elif defined(SDLMAME_UNIX)
174   return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, 0, getpagesize());
172   return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, 0, 0);
175173#elif defined(SDLMAME_WIN32)
176174   return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
177175#elif defined(SDLMAME_OS2)
src/osd/sdl/input.c
r933r934
626626      // loop over all axes
627627      for (axis = 0; axis < SDL_JoystickNumAxes(joy); axis++)
628628      {
629         sprintf(tempname, "J%d A%d %s", stick + 1, axis, joy_name);
630         input_device_item_add(devinfo->device, tempname, &devinfo->joystick.axes[axis], ITEM_ID_XAXIS + axis, generic_axis_get_state);
629         if (axis < 6)
630         {
631            sprintf(tempname, "J%d A%d %s", stick + 1, axis, joy_name);
632            input_device_item_add(devinfo->device, tempname, &devinfo->joystick.axes[axis], ITEM_ID_XAXIS + axis, generic_axis_get_state);
633         }
634         else
635         {
636            sprintf(tempname, "J%d A%d %s", stick + 1, axis, joy_name);
637            input_device_item_add(devinfo->device, tempname, &devinfo->joystick.axes[axis], ITEM_ID_OTHER_AXIS_ABSOLUTE, generic_axis_get_state);
638         }
631639      }
632640
633641      // loop over all buttons
634642      for (button = 0; button < SDL_JoystickNumButtons(joy); button++)
635643      {
636         sprintf(tempname, "J%d button %d", stick + 1, button);
637         input_device_item_add(devinfo->device, tempname, &devinfo->joystick.buttons[button], ITEM_ID_BUTTON1 + button, generic_button_get_state);
644         if (button < 16)
645         {
646            sprintf(tempname, "J%d button %d", stick + 1, button);
647            input_device_item_add(devinfo->device, tempname, &devinfo->joystick.buttons[button], ITEM_ID_BUTTON1 + button, generic_button_get_state);
648         }
649         else
650         {
651            sprintf(tempname, "J%d button %d", stick + 1, button);
652            input_device_item_add(devinfo->device, tempname, &devinfo->joystick.buttons[button], ITEM_ID_OTHER_SWITCH, generic_button_get_state);
653         }
638654      }
639655
640656      // loop over all hats
r933r934
647663         sprintf(tempname, "J%d hat %d Left", stick + 1, hat);
648664         input_device_item_add(devinfo->device, tempname, &devinfo->joystick.hatsL[hat], ITEM_ID_OTHER_SWITCH, generic_button_get_state);
649665         sprintf(tempname, "J%d hat %d Right", stick + 1, hat);
650         input_device_item_add(devinfo->device, tempname, &devinfo->joystick.hatsR[hat], ITEM_ID_OTHER_SWITCH, generic_button_get_state);
666             input_device_item_add(devinfo->device, tempname, &devinfo->joystick.hatsR[hat], ITEM_ID_OTHER_SWITCH, generic_button_get_state);
651667      }
652668   }
653669   mame_printf_verbose("Joystick: End initialization\n");
r933r934
959975         devinfo->keyboard.state[event.key.keysym.sym-SDLK_FIRST] = 0;
960976         break;
961977      case SDL_JOYAXISMOTION:
978         printf("joy %d axis %d to %d\n", event.jaxis.which, event.jaxis.axis, event.jaxis.value);
962979         devinfo = generic_device_find_index(joystick_list, event.jaxis.which);
963980         if (devinfo)
964981         {
src/osd/sdl/sdlmain.c
r933r934
9999   { SDLOPTION_VIDEO,                        "soft",     0,                 "video output method: soft or opengl" },
100100   { SDLOPTION_NUMSCREENS,                   "1",        0,                 "number of screens to create; SDLMAME only supports 1 at this time" },
101101   { SDLOPTION_WINDOW ";w",                  "0",        OPTION_BOOLEAN,    "enable window mode; otherwise, full screen mode is assumed" },
102   // not used
103   { "maximize;max",                         "1",        OPTION_BOOLEAN,    "default to maximized windows; otherwise, windows will be minimized" },
104102   { SDLOPTION_KEEPASPECT ";ka",             "1",        OPTION_BOOLEAN,    "constrain to the proper aspect ratio" },
105103   { SDLOPTION_UNEVENSTRETCH ";ues",         "1",        OPTION_BOOLEAN,    "allow non-integer stretch factors" },
106104   { SDLOPTION_EFFECT,                       "none",     0,                 "name of a PNG file to use for visual effects, or 'none'" },
r933r934
181179   { NULL,                                   NULL,       OPTION_HEADER,     "SOUND OPTIONS" },
182180   { SDLOPTION_AUDIO_LATENCY,                "3",        0,                 "set audio latency (increase to reduce glitches, decrease for responsiveness)" },
183181
184   // input options
185   { NULL,                                   NULL,        OPTION_HEADER,     "INPUT DEVICE OPTIONS" },
186   { SDLOPTION_MOUSE,                        "0",        OPTION_BOOLEAN,    "enable mouse input" },
187   { SDLOPTION_JOYSTICK ";joy",              "0",        OPTION_BOOLEAN,    "enable joystick input" },
188   { SDLOPTION_STEADYKEY ";steady",          "0",        OPTION_BOOLEAN,    "enable steadykey support" },
189   { SDLOPTION_A2D_DEADZONE ";a2d",          "0.3",      0,                 "minimal analog value for digital input" },
190
191#ifdef MESS
192   { "mouse_device",                         "mouse",    0,                 "enable (keyboard|mouse|joystick) if a mouse control is present" },
193#endif
194
195182   // keyboard mapping
196183   { NULL,                                 NULL,       OPTION_HEADER,     "SDL KEYBOARD MAPPING" },
197184   { SDLOPTION_KEYMAP,                      "0",         OPTION_BOOLEAN,    "enable keymap" },
src/osd/sdl/osdsdl.h
r933r934
7777#define SDLOPTION_JOYMAP            "remapjoys"
7878#define SDLOPTION_JOYMAP_FILE         "remapjoyfile"
7979#define SDLOPTION_UIMODEKEY            "uimodekey"
80#define SDLOPTION_MOUSE               "mouse"
81#define SDLOPTION_JOYSTICK            "joystick"
82#define SDLOPTION_STEADYKEY            "steadykey"
83#define SDLOPTION_A2D_DEADZONE         "a2d_deadzone"
8480
8581#define SDLOPTION_SHADER_MAME(x)      "glsl_shader_mame" x
8682#define SDLOPTION_SHADER_SCREEN(x)      "glsl_shader_screen" x

Previous 15994 Revisions Next


© 1998-2018 The MESS Team