Previous 15994 Revisions Next

r1049 Saturday 29th September, 2007 at 00:26:54 UTC by R. Belmont
[SDLMESS] Sync with SDLMAME 0.119u1 and fix MESS breakage introduced in that release.
[ROOT]makefile.sdl
[src/osd/sdl]input.c sdlsync.c sdltime.c sdlwork.c sound.c

src/osd/sdl/sound.c
r1048r1049
366366   attenuation = _attenuation;
367367}
368368
369
370
371369//============================================================
372//   osd_get_mastervolume
373//============================================================
374
375static int osd_get_mastervolume(void)
376{
377   return attenuation;
378}
379
380
381
382//============================================================
383//   osd_sound_enable
384//============================================================
385
386static void osd_sound_enable(int enable_it)
387{
388   snd_enabled = enable_it;
389}
390
391//============================================================
392370//   sdl_callback
393371//============================================================
394372void sdl_callback(void *userdata, Uint8 *stream, int len)
src/osd/sdl/input.c
r1048r1049
160160
161161// deivce list management
162162static void device_list_reset_devices(device_info *devlist_head);
163static int device_list_count(device_info *devlist_head);
164163static void device_list_free_devices(device_info *devlist_head);
165164
166165// generic device management
r1048r1049
172171static INT32 generic_axis_get_state(void *device_internal, void *item_internal);
173172static device_info *generic_device_find_index(device_info *devlist_head, int index);
174173
175// Win32-specific input code
176static void sdl_init(running_machine *machine);
177static void sdl_exit(running_machine *machine);
178static void sdl_keyboard_poll(device_info *devinfo);
179static void sdl_lightgun_poll(device_info *devinfo);
180
181static const char *default_button_name(int which);
182static const char *default_pov_name(int which);
183
184
185
186174//============================================================
187175//  KEYBOARD/JOYSTICK LIST
188176//============================================================
r1048r1049
708696   return index;
709697}
710698
699#ifdef MESS
711700static int lookup_mame_code(const char *scode)
712701{
713702   int index;
r1048r1049
717706   else
718707      return -1;
719708}
709#endif
720710
721711//============================================================
722712//  sdlinput_init
r1048r1049
12521242}
12531243
12541244//============================================================
1255//  device_list_count
1256//============================================================
1257
1258static int device_list_count(device_info *devlist_head)
1259{
1260   device_info *curdev;
1261   int count = 0;
1262   
1263   for (curdev = devlist_head; curdev != NULL; curdev = curdev->next)
1264      count++;
1265   return count;
1266}
1267
1268
1269//============================================================
12701245//  generic_device_alloc
12711246//============================================================
12721247
r1048r1049
14031378   // return the current state
14041379   return *axisdata;
14051380}
1406
1407
1408//============================================================
1409//  sdl_init
1410//============================================================
1411
1412static void sdl_init(running_machine *machine)
1413{
1414}
1415
1416
1417//============================================================
1418//  sdl_exit
1419//============================================================
1420
1421static void sdl_exit(running_machine *machine)
1422{
1423}
1424
1425
1426//============================================================
1427//  sdl_keyboard_poll
1428//============================================================
1429
1430static void sdl_keyboard_poll(device_info *devinfo)
1431{
1432#if 0
1433   int keynum;
1434
1435   // reset the keyboard state and then repopulate
1436   memset(devinfo->keyboard.state, 0, sizeof(devinfo->keyboard.state));
1437   
1438   // iterate over keys
1439   for (keynum = 0; keynum < ARRAY_LENGTH(sdl_key_trans_table); keynum++)
1440   {
1441      int vk = sdl_key_trans_table[keynum][VIRTUAL_KEY];
1442      if (vk != 0 && (GetAsyncKeyState(vk) & 0x8000) != 0)
1443      {
1444         int dik = sdl_key_trans_table[keynum][SDL_KEY];
1445         
1446         // conver the VK code to a scancode (DIK code)
1447         if (dik != 0)
1448            devinfo->keyboard.state[dik] = 0x80;
1449           
1450         // set this flag so that we continue to use win32 until all keys are up
1451         keyboard_sdl_reported_key_down = TRUE;
1452      }
1453   }
1454#endif
1455}
1456
1457
1458//============================================================
1459//  sdl_lightgun_poll
1460//============================================================
1461
1462static void sdl_lightgun_poll(device_info *devinfo)
1463{
1464#if 0
1465   INT32 xpos = 0, ypos = 0;
1466   POINT mousepos;
1467   
1468   // if we are using the shared axis hack, the data is updated via Windows messages only
1469   if (lightgun_shared_axis_mode)
1470      return;
1471   
1472   // get the cursor position and transform into final results
1473   GetCursorPos(&mousepos);
1474   if (sdl_window_list != NULL)
1475   {
1476      RECT client_rect;
1477
1478      // get the position relative to the window     
1479      GetClientRect(sdl_window_list->hwnd, &client_rect);
1480      ScreenToClient(sdl_window_list->hwnd, &mousepos);
1481     
1482      // convert to absolute coordinates
1483      xpos = normalize_absolute_axis(mousepos.x, client_rect.left, client_rect.right);
1484      ypos = normalize_absolute_axis(mousepos.y, client_rect.top, client_rect.bottom);
1485   }
1486   
1487   // update the X/Y positions
1488   devinfo->mouse.state.lX = xpos;
1489   devinfo->mouse.state.lY = ypos;
1490#endif
1491}
1492
1493//============================================================
1494//  default_button_name
1495//============================================================
1496
1497static const char *default_button_name(int which)
1498{
1499   static char buffer[20];
1500   snprintf(buffer, sizeof(buffer)-1, "B%d", which);
1501   return buffer;
1502}
1503
1504
1505//============================================================
1506//  default_pov_name
1507//============================================================
1508
1509static const char *default_pov_name(int which)
1510{
1511   static char buffer[20];
1512   snprintf(buffer, strlen(buffer)-1, "POV%d", which);
1513   return buffer;
1514}
src/osd/sdl/sdltime.c
r1048r1049
3838//============================================================
3939
4040static osd_ticks_t init_cycle_counter(void);
41#ifdef SDLMAME_UNIX
41#if defined(SDLMAME_UNIX) && !defined(SDLMAME_DARWIN)
4242static osd_ticks_t time_cycle_counter(void);
4343#endif
4444#if defined(SDLMAME_WIN32) || defined(SDLMAME_OS2)
r1048r1049
314314//============================================================
315315//  time_cycle_counter
316316//============================================================
317#ifdef SDLMAME_UNIX
317#if defined(SDLMAME_UNIX) && !defined(SDLMAME_DARWIN)
318318static osd_ticks_t time_cycle_counter(void)
319319{
320320   return SDL_GetTicks();
src/osd/sdl/sdlsync.c
r1048r1049
1515#endif
1616#endif
1717
18#include <SDL/SDL.h>
18#ifdef SDLMAME_MACOSX
19#include "SDL/SDL.h"
20#else
21#include "SDL.h"
22#endif
1923
2024#ifdef SDLMAME_WIN32
2125#define WIN32_LEAN_AND_MEAN
r1048r1049
114118{
115119   hidden_mutex_t *mutex = (hidden_mutex_t *) lock;
116120
121   pthread_mutex_unlock(&mutex->id);
117122   pthread_mutex_destroy(&mutex->id);
118123   free(mutex);
119124}
src/osd/sdl/sdlwork.c
r1048r1049
434434
435435   // free all the mutexes and conditions
436436   pthread_cond_destroy(&queue->statecond);
437   pthread_mutex_unlock(&queue->statelock);
437438   pthread_mutex_destroy(&queue->statelock);
438439
439440   // free the critical section
441   pthread_mutex_unlock(&queue->critsect);
440442   pthread_mutex_destroy(&queue->critsect);
441443
442444   // free all items in the free list
r1048r1049
447449      if (!(item->flags & WORK_ITEM_FLAG_AUTO_RELEASE))
448450      {
449451         pthread_cond_destroy(&item->statecond);
452         pthread_mutex_unlock(&item->statelock);
450453         pthread_mutex_destroy(&item->statelock);
451454      }
452455      free(item);
r1048r1049
458461      osd_work_item *item = (osd_work_item *)queue->list;
459462      queue->list = item->next;
460463      pthread_cond_destroy(&item->statecond);
464      pthread_mutex_unlock(&item->statelock);
461465      pthread_mutex_destroy(&item->statelock);
462466      free(item);
463467   }
r1048r1049
590594
591595   // release the mutexes and conditions
592596   pthread_cond_destroy(&item->statecond);
597   pthread_mutex_unlock(&item->statelock);
593598   pthread_mutex_destroy(&item->statelock);
594599
595600   // add us to the free list on our queue
makefile.sdl
r1048r1049
333333endif
334334
335335# add a basic set of warnings
336
336337CFLAGS += \
337338   -Wall \
338339   -Wpointer-arith \
r1048r1049
344345   -Wwrite-strings \
345346   -Wno-unused-function \
346347
348# ^^^^ do not turn off Wno-unused-function, MESS compile will fail due to mame/drivers/cps1.c
349
347350# this warning is not supported on the os2 compilers
348351ifneq ($(TARGETOS),os2)
349352CFLAGS += -Wdeclaration-after-statement

Previous 15994 Revisions Next


© 1998-2018 The MESS Team