Previous 15994 Revisions Next

r1636 Tuesday 29th January, 2008 at 21:50:20 UTC by R. Belmont
[SDLMESS] Sync with SDLMAME u8.
[src/osd/sdl]debugwin.c drawsdl.c input.c keybled.c osdsdl.h scale2x.c sdl.mak sdlfile.c sdlmain.c sdlmisc.c sound.c video.c window.c window.h

src/osd/sdl/sdlmisc.c
r1635r1636
5959#include "driver.h"
6060#include "window.h"
6161#include "options.h"
62#include "osdsdl.h"
6263
6364#ifdef HAVE_GETTIMEOFDAY
6465/* Standard UNIX clock() is based on CPU time, not real time.
r1635r1636
104105{
105106   const char *text[2];
106107   int i, j, cols, width[2], done = 0;
107   char *e_cols = getenv("COLUMNS");
108   char *e_cols = getenv(SDLENV_COLUMNS);
108109
109   cols = e_cols? atoi(e_cols):80;
110   cols = (e_cols != NULL) ? atoi(e_cols):80;
110111   if ( cols < 6 ) cols = 6;  /* minimum must be 6 */
111112   cols--;
112113
src/osd/sdl/sdl.mak
r1635r1636
8080endif   # SYMBOLS
8181
8282# add an ARCH define
83DEFS += "-DSDLMAME_ARCH=$(ARCH)"
83DEFS += "-DSDLMAME_ARCH=$(ARCHOPTS)"
8484
8585# add SDLMAME TARGETOS definitions
8686ifeq ($(TARGETOS),linux)
r1635r1636
245245ifeq ($(TARGETOS),macosx)
246246OSDCOREOBJS += $(SDLOBJ)/osxutils.o
247247OSDOBJS += $(SDLOBJ)/SDLMain_tmpl.o
248
249ifndef MACOSX_USE_LIBSDL
250# Compile using framework (compile using libSDL is the exception)
248251LIBS += -framework SDL -framework Cocoa -framework OpenGL -lpthread
252else
253# Compile using installed libSDL (Fink or MacPorts):
254#
255# Remove the "/SDL" component from the include path so that we can compile
256# files (header files are #include "SDL/something.h", so the extra "/SDL"
257# causes a significant problem)
258CFLAGS += `sdl-config --cflags | sed 's:/SDL::'` -DNO_SDL_GLEXT
259# Remove libSDLmain, as its symbols conflict with SDLMain_tmpl.m
260LIBS += `sdl-config --libs | sed 's/-lSDLmain//'` -lpthread
261endif
249262
250263SDLMAIN = $(SDLOBJ)/SDLMain_tmpl.o
251264
src/osd/sdl/sound.c
r1635r1636
2525#include "window.h"
2626#include "video.h"
2727#include "osdsdl.h"
28//#include "deprecat.h"
2829
2930//============================================================
3031//   DEBUGGING
r1635r1636
9091void sdl_init_audio(running_machine *machine)
9192{
9293#if LOG_SOUND
93   sound_log = fopen("sound.log", "w");
94   sound_log = fopen(SDL_SOUND_LOG, "w");
9495#endif
9596
9697   // skip if sound disabled
97   if (Machine->sample_rate != 0)
98   if (machine->sample_rate != 0)
9899   {
99100      // attempt to initialize SDL
100101      if (sdl_init(machine))
r1635r1636
484485   }
485486
486487   // compute the buffer sizes
487   stream_buffer_size = Machine->sample_rate * 2 * sizeof(INT16) * audio_latency / MAX_AUDIO_LATENCY;
488   stream_buffer_size = machine->sample_rate * 2 * sizeof(INT16) * audio_latency / MAX_AUDIO_LATENCY;
488489   stream_buffer_size = (stream_buffer_size / 1024) * 1024;
489490   if (stream_buffer_size < 1024)
490491      stream_buffer_size = 1024;
src/osd/sdl/input.c
r1635r1636
2222#include "osdepend.h"
2323#include "driver.h"
2424#include "ui.h"
25//#include "deprecat.h"
2526
2627// MAMEOS headers
2728#include "window.h"
r1635r1636
11791180         
11801181         // LCTRL-F8 to decrease prescaling effect #
11811182         case IPT_OSD_8:
1182            if (getenv("SDLMAME_UNSUPPORTED")) {
1183            if (sdl_use_unsupported()) {
11831184               idef->token = "DECREASE_EFFECT";
11841185               idef->name = "Decrease Effect";
11851186               input_seq_set_2(&idef->defaultseq, KEYCODE_F8, KEYCODE_LCONTROL);
r1635r1636
11871188            break;
11881189         // add a Not lcrtl condition to frameskip decrease
11891190         case IPT_UI_FRAMESKIP_DEC:
1190            if (getenv("SDLMAME_UNSUPPORTED"))
1191            if (sdl_use_unsupported())
11911192               input_seq_set_3(&idef->defaultseq, KEYCODE_F8, SEQCODE_NOT, KEYCODE_LCONTROL);
11921193            break;
11931194         
11941195         // LCTRL-F9 to increase prescaling effect #
11951196         case IPT_OSD_9:
1196            if (getenv("SDLMAME_UNSUPPORTED")) {
1197            if (sdl_use_unsupported()) {
11971198               idef->token = "INCREASE_EFFECT";
11981199               idef->name = "Increase Effect";
11991200               input_seq_set_2(&idef->defaultseq, KEYCODE_F9, KEYCODE_LCONTROL);
r1635r1636
12011202            break;
12021203         // add a Not lcrtl condition to frameskip increase
12031204         case IPT_UI_FRAMESKIP_INC:
1204            if (getenv("SDLMAME_UNSUPPORTED"))
1205            if (sdl_use_unsupported())
12051206               input_seq_set_3(&idef->defaultseq, KEYCODE_F9, SEQCODE_NOT, KEYCODE_LCONTROL);
12061207            break;
12071208         
src/osd/sdl/drawsdl.c
r1635r1636
16451645        case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
16461646            mame_printf_error("GL FBO: incomplete,missing read buffer\n");
16471647            return -1;
1648#ifdef GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT
16481649        case GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT:
16491650            mame_printf_error("GL FBO: incomplete, duplicate attachment\n");
16501651            return -1;
1652#endif
16511653        case 0:
16521654            mame_printf_error("GL FBO: incomplete, implementation fault\n");
16531655            return -1;
src/osd/sdl/scale2x.c
r1635r1636
6868
6969void scale2x_yuv16(texture_info *texture, const render_texinfo *texsource)
7070{
71   mame_printf_error("ERROR: Scale2X not supported for YUV textures\n");
72   mame_schedule_exit(Machine);
71   fatalerror("ERROR: Scale2X not supported for YUV textures\n");
7372}
7473
7574void scale2x_yuv16_paletted(texture_info *texture, const render_texinfo *texsource)
7675{
77   mame_printf_error("ERROR: Scale2X not supported for YUV textures\n");
78   mame_schedule_exit(Machine);
76   fatalerror("ERROR: Scale2X not supported for YUV textures\n");
7977}
src/osd/sdl/debugwin.c
r1635r1636
1919#include "debug-cb.h"
2020
2121#include "dview.h"
22#include "deprecat.h"
2223
2324typedef struct hentry {
2425   struct hentry *h;
src/osd/sdl/video.c
r1635r1636
102102
103103static void check_osd_inputs(void);
104104
105static void extract_video_config(void);
106static void load_effect_overlay(const char *filename);
105static void extract_video_config(running_machine *machine);
106static void load_effect_overlay(running_machine *machine, const char *filename);
107107static float get_aspect(const char *name, int report_error);
108108static void get_resolution(const char *name, sdl_window_config *config, int report_error);
109109
r1635r1636
144144   int index, tc;
145145
146146   // extract data from the options
147   extract_video_config();
147   extract_video_config(machine);
148148   
149149   // ensure we get called on the way out
150150   add_exit_callback(machine, video_exit);
r1635r1636
155155   // we need the beam width in a float, contrary to what the core does.
156156   video_config.beamwidth = options_get_float(mame_options(), OPTION_BEAM);
157157
158   if (Machine->drv->video_attributes & VIDEO_TYPE_VECTOR)
158   if (machine->drv->video_attributes & VIDEO_TYPE_VECTOR)
159159   {
160160      video_config.isvector = 1;
161161   }
r1635r1636
174174   for (index = 0; index < video_config.numscreens; index++)
175175   {
176176      video_config.window[index].totalColors = tc;
177      if (sdlwindow_video_window_create(index, pick_monitor(index), &video_config.window[index]))
177      if (sdlwindow_video_window_create(machine, index, pick_monitor(index), &video_config.window[index]))
178178         goto error;
179179   }
180180
r1635r1636
293293         SDL_VideoDriverName(monitor->monitor_device, sizeof(monitor->monitor_device)-1);
294294         if (first_call==0)
295295         {
296            char *dimstr = getenv("SDLMAME_DESKTOPDIM");
296            char *dimstr = getenv(SDLENV_DESKTOPDIM);
297297            const SDL_VideoInfo *sdl_vi;
298298           
299299            sdl_vi = SDL_GetVideoInfo();
r1635r1636
307307            first_call=1;
308308            if ((cw==0) || (ch==0))
309309            {
310               if (dimstr)
310               if (dimstr != NULL)
311311               {
312312                  sscanf(dimstr, "%dx%d", &cw, &ch);
313313               }
r1635r1636
602602//  extract_video_config
603603//============================================================
604604
605static void extract_video_config(void)
605static void extract_video_config(running_machine *machine)
606606{
607607   const char *stemp;
608608
r1635r1636
625625#endif
626626   stemp = options_get_string(mame_options(), SDLOPTION_EFFECT);
627627   if (stemp != NULL && strcmp(stemp, "none") != 0)
628      load_effect_overlay(stemp);
628      load_effect_overlay(machine, stemp);
629629
630630   // per-window options: extract the data
631631   get_resolution(SDLOPTION_RESOLUTION("0"), &video_config.window[0], TRUE);
r1635r1636
639639
640640   // d3d options: extract the data
641641   stemp = options_get_string(mame_options(), SDLOPTION_VIDEO);
642   if (strcmp(stemp, "opengl") == 0)
642   if (strcmp(stemp, SDLOPTVAL_OPENGL) == 0)
643643      video_config.mode = VIDEO_MODE_OPENGL;
644   else if (strcmp(stemp, "opengl16") == 0)
644   else if (strcmp(stemp, SDLOPTVAL_OPENGL16) == 0)
645645   {
646646       video_config.mode = VIDEO_MODE_OPENGL;
647647       video_config.prefer16bpp_tex = 1;
648648   }
649   else if (strcmp(stemp, "soft") == 0)
649   else if (strcmp(stemp, SDLOPTVAL_SOFT) == 0)
650650      video_config.mode = VIDEO_MODE_SOFT;
651   else if (strcmp(stemp, "none") == 0)
651   else if (strcmp(stemp, SDLOPTVAL_NONE) == 0)
652652   {
653653      video_config.mode = VIDEO_MODE_SOFT;
654654      video_config.novideo = 1;
r1635r1636
692692         snprintf(buffer, 18, SDLOPTION_SHADER_MAME("%d"), i); buffer[17]=0;
693693
694694         stemp = options_get_string(mame_options(), buffer);
695         if (stemp && strcmp(stemp, "none") != 0 && strlen(stemp)>0)
695         if (stemp && strcmp(stemp, SDLOPTVAL_NONE) != 0 && strlen(stemp)>0)
696696         {
697697            video_config.glsl_shader_mamebm[i] = (char *) malloc(strlen(stemp)+1);
698698            strcpy(video_config.glsl_shader_mamebm[i], stemp);
r1635r1636
709709         snprintf(buffer, 20, SDLOPTION_SHADER_SCREEN("%d"), i); buffer[19]=0;
710710
711711         stemp = options_get_string(mame_options(), buffer);
712         if (stemp && strcmp(stemp, "none") != 0 && strlen(stemp)>0)
712         if (stemp && strcmp(stemp, SDLOPTVAL_NONE) != 0 && strlen(stemp)>0)
713713         {
714714            video_config.glsl_shader_scrn[i] = (char *) malloc(strlen(stemp)+1);
715715            strcpy(video_config.glsl_shader_scrn[i], stemp);
r1635r1636
748748      video_config.glsl_vid_attributes = 0;
749749   }
750750
751   if (getenv("SDLMAME_UNSUPPORTED"))
751   if (sdl_use_unsupported())
752752      video_config.prescale_effect = options_get_int(mame_options(), SDLOPTION_PRESCALE_EFFECT);
753753   else
754754      video_config.prescale_effect = 0;
r1635r1636
764764
765765   // yuv settings ...
766766   stemp = options_get_string(mame_options(), SDLOPTION_YUVMODE);
767   if (strcmp(stemp, "none") == 0)
767   if (strcmp(stemp, SDLOPTVAL_NONE) == 0)
768768      video_config.yuv_mode = VIDEO_YUV_MODE_NONE;
769   else if (strcmp(stemp, "yv12") == 0)
769   else if (strcmp(stemp, SDLOPTVAL_YV12) == 0)
770770      video_config.yuv_mode = VIDEO_YUV_MODE_YV12;
771   else if (strcmp(stemp, "yv12x2") == 0)
771   else if (strcmp(stemp, SDLOPTVAL_YV12x2) == 0)
772772      video_config.yuv_mode = VIDEO_YUV_MODE_YV12X2;
773   else if (strcmp(stemp, "yuy2") == 0)
773   else if (strcmp(stemp, SDLOPTVAL_YUY2) == 0)
774774      video_config.yuv_mode = VIDEO_YUV_MODE_YUY2;
775   else if (strcmp(stemp, "yuy2x2") == 0)
775   else if (strcmp(stemp, SDLOPTVAL_YUY2x2) == 0)
776776      video_config.yuv_mode = VIDEO_YUV_MODE_YUY2X2;
777777   else
778778   {
r1635r1636
791791//  load_effect_overlay
792792//============================================================
793793
794static void load_effect_overlay(const char *filename)
794static void load_effect_overlay(running_machine *machine, const char *filename)
795795{
796796   char *tempstr = malloc_or_die(strlen(filename) + 5);
797797   int scrnum;
r1635r1636
815815
816816   // set the overlay on all screens
817817   for (scrnum = 0; scrnum < MAX_SCREENS; scrnum++)
818      if (Machine->drv->screen[scrnum].tag != NULL)
818      if (machine->drv->screen[scrnum].tag != NULL)
819819         render_container_set_overlay(render_container_get_screen(scrnum), effect_bitmap);
820820
821821   free(tempstr);
r1635r1636
832832   const char *data = options_get_string(mame_options(), name);
833833   int num = 0, den = 1;
834834
835   if (strcmp(data, "auto") == 0)
835   if (strcmp(data, SDLOPTVAL_AUTO) == 0)
836836   {
837      if (strcmp(defdata, "auto") == 0)
837      if (strcmp(defdata,SDLOPTVAL_AUTO) == 0)
838838         return 0;
839839      data = defdata;
840840   }
r1635r1636
854854   const char *data = options_get_string(mame_options(), name);
855855
856856   config->width = config->height = config->depth = config->refresh = 0;
857   if (strcmp(data, "auto") == 0)
857   if (strcmp(data, SDLOPTVAL_AUTO) == 0)
858858   {
859859      return;
860860   }
src/osd/sdl/window.c
r1635r1636
133133static void get_min_bounds(sdl_window_info *window, int *window_width, int *window_height, int constrain);
134134
135135static void *complete_create_wt(void *param, int threadid);
136static void set_starting_view(int index, sdl_window_info *window, const char *view);
136static void set_starting_view(running_machine *machine, int index, sdl_window_info *window, const char *view);
137137
138138//============================================================
139139//  clear the worker_param structure, inline - faster than memset
r1635r1636
690690//  (main thread)
691691//============================================================
692692
693int sdlwindow_video_window_create(int index, sdl_monitor_info *monitor, const sdl_window_config *config)
693int sdlwindow_video_window_create(running_machine *machine, int index, sdl_monitor_info *monitor, const sdl_window_config *config)
694694{
695695   sdl_window_info *window;
696696   worker_param *wp = malloc(sizeof(worker_param));
r1635r1636
731731
732732   // set the specific view               
733733   sprintf(option, SDLOPTION_VIEW("%d"), index);
734   set_starting_view(index, window, options_get_string(mame_options(), option));
734   set_starting_view(machine, index, window, options_get_string(mame_options(), option));
735735
736736   // make the window title
737737   if (video_config.numscreens == 1)
738      sprintf(window->title, APPNAME ": %s [%s]", Machine->gamedrv->description, Machine->gamedrv->name);
738      sprintf(window->title, APPNAME ": %s [%s]", machine->gamedrv->description, machine->gamedrv->name);
739739   else
740      sprintf(window->title, APPNAME ": %s [%s] - Screen %d", Machine->gamedrv->description, Machine->gamedrv->name, index);
740      sprintf(window->title, APPNAME ": %s [%s] - Screen %d", machine->gamedrv->description, machine->gamedrv->name, index);
741741
742742   wp->window = window;
743743   if (multithreading_enabled)
r1635r1636
985985//  (main thread)
986986//============================================================
987987
988static void set_starting_view(int index, sdl_window_info *window, const char *view)
988static void set_starting_view(running_machine *machine, int index, sdl_window_info *window, const char *view)
989989{
990990   int viewindex = -1;
991991
r1635r1636
993993
994994   // NULL is the same as auto
995995   if (view == NULL)
996      view = "auto";
996      view = SDLOPTVAL_AUTO;
997997
998998   // auto view just selects the nth view
999   if (strcmp(view, "auto") != 0)
999
1000   if (strcmp(view, SDLOPTVAL_AUTO) != 0)
10001001   {
10011002      // scan for a matching view name
10021003      for (viewindex = 0; ; viewindex++)
r1635r1636
10201021      int scrcount;
10211022
10221023      // count the number of screens
1023      for (scrcount = 0; Machine->drv->screen[scrcount].tag != NULL; scrcount++) ;
1024      for (scrcount = 0; machine->drv->screen[scrcount].tag != NULL; scrcount++) ;
10241025
10251026      // if we have enough screens to be one per monitor, assign in order
10261027      if (video_config.numscreens >= scrcount)
r1635r1636
11621163       *   SDL_VIDEO_GL_DRIVER
11631164       */
11641165      const char *e;
1165      e=getenv("SDLMAME_GL_LIB");
1166
1167      e=getenv(SDLENV_GL_LIB);
1168     
11661169#ifdef SDLMAME_MACOSX
11671170      /* Vas Crabb: Default GL-lib for MACOSX */
11681171      if (!e)
r1635r1636
13371340
13381341      sdl->glsl_vid_attributes = video_config.glsl_vid_attributes;
13391342
1340      if (getenv("SDLMAME_VMWARE"))
1343      if (getenv(SDLENV_VMWARE) != NULL)
13411344      {
13421345         sdl->usetexturerect = 1;
13431346         sdl->texpoweroftwo = 1;
src/osd/sdl/window.h
r1635r1636
197197int sdlwindow_init(running_machine *machine);
198198
199199// creation/deletion of windows
200int sdlwindow_video_window_create(int index, sdl_monitor_info *monitor, const sdl_window_config *config);
200int sdlwindow_video_window_create(running_machine *machine, int index, sdl_monitor_info *monitor, const sdl_window_config *config);
201201
202202void sdlwindow_update_cursor_state(void);
203203void sdlwindow_video_window_update(sdl_window_info *window);
src/osd/sdl/keybled.c
r1635r1636
1717   if ( SDL_GetWMInfo(&info) && (info.subsystem == SDL_SYSWM_X11) )
1818   {
1919      /* GRR leds 1 and 2 are swapped in X */
20      output_set_notifier("led0", led_change_notify, (void *)2);
21      output_set_notifier("led1", led_change_notify, (void *)1);
22      output_set_notifier("led2", led_change_notify, (void *)3);
20      output_set_notifier(SDL_LED(0), led_change_notify, (void *)2);
21      output_set_notifier(SDL_LED(1), led_change_notify, (void *)1);
22      output_set_notifier(SDL_LED(2), led_change_notify, (void *)3);
2323   }
2424   #endif
2525}
src/osd/sdl/sdlfile.c
r1635r1636
156156      envstr[i] = '\0';
157157
158158      envval = getenv(&envstr[1]);
159      if (envval)
159      if (envval != NULL)
160160      {
161161         j = strlen(envval) + strlen(tmpstr) + 1;
162162         free(tmpstr);
r1635r1636
250250
251251file_error osd_read(osd_file *file, void *buffer, UINT64 offset, UINT32 count, UINT32 *actual)
252252{
253   UINT32 result;
253   ssize_t result;
254254
255255#if defined(SDLMAME_DARWIN) || defined(SDLMAME_FREEBSD)
256256   result = pread(file->handle, buffer, count, offset);
257   if (!result)
257   if (result < 0)
258258#elif defined(SDLMAME_WIN32) || defined(SDLMAME_NO64BITIO) || defined(SDLMAME_OS2)
259259   lseek(file->handle, (UINT32)offset&0xffffffff, SEEK_SET);
260260   result = read(file->handle, buffer, count);
261   if (!result)
261   if (result < 0)
262262#elif defined(SDLMAME_UNIX)
263263   result = pread64(file->handle, buffer, count, offset);
264   if (!result)
264   if (result < 0)
265265#else
266266#error Unknown SDL SUBARCH!
267267#endif
r1635r1636
441441
442442//============================================================
443443//   osd_copyfile
444//  FIXME: this will not work with blanks in filename ...
444445//============================================================
445446
446447file_error osd_copyfile(const char *destfile, const char *srcfile)
src/osd/sdl/sdlmain.c
r1635r1636
7979#ifdef MESS
8080   { "inipath",                              "$HOME/.mess;.;ini",     0,     "path to ini files" },
8181#else
82   { "inipath",                              "$HOME/.mame;.;ini",     0,     "path to ini files" },
82   { SDLOPTION_INIPATH,                     "$HOME/.mame;.;ini",     0,     "path to ini files" },
8383#endif // MESS
8484#endif // INI_PATH
8585#endif // MACOSX
r1635r1636
8787
8888   // debugging options
8989   { NULL,                                   NULL,       OPTION_HEADER,     "DEBUGGING OPTIONS" },
90   { "oslog",                                "0",        OPTION_BOOLEAN,    "output error.log data to the system debugger" },
90   { SDLOPTION_OSLOG,                        "0",        OPTION_BOOLEAN,    "output error.log data to the system debugger" },
9191
9292   // performance options
9393   { NULL,                                   NULL,       OPTION_HEADER,     "PERFORMANCE OPTIONS" },
r1635r1636
9696
9797   // video options
9898   { NULL,                                   NULL,       OPTION_HEADER,     "VIDEO OPTIONS" },
99   { SDLOPTION_VIDEO,                        "soft",     0,                 "video output method: soft or opengl" },
99   { SDLOPTION_VIDEO,                   SDLOPTVAL_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" },
102102   { SDLOPTION_KEEPASPECT ";ka",             "1",        OPTION_BOOLEAN,    "constrain to the proper aspect ratio" },
103103   { SDLOPTION_UNEVENSTRETCH ";ues",         "1",        OPTION_BOOLEAN,    "allow non-integer stretch factors" },
104   { SDLOPTION_EFFECT,                       "none",     0,                 "name of a PNG file to use for visual effects, or 'none'" },
104   { SDLOPTION_EFFECT,                  SDLOPTVAL_NONE,  0,                 "name of a PNG file to use for visual effects, or 'none'" },
105105   { SDLOPTION_CENTERH,                      "1",        OPTION_BOOLEAN,    "center horizontally within the view area" },
106106   { SDLOPTION_CENTERV,                      "1",        OPTION_BOOLEAN,    "center vertically within the view area" },
107107   #if (SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) >= 1210)
108108   { SDLOPTION_WAITVSYNC,                    "0",        OPTION_BOOLEAN,    "enable waiting for the start of VBLANK before flipping screens; reduces tearing effects" },
109109   #endif
110   { SDLOPTION_YUVMODE ";ym",                "none",     0,                 "YUV mode: none, yv12, yuy2, yv12x2, yuy2x2 (-video soft only)" },
110   { SDLOPTION_YUVMODE ";ym",           SDLOPTVAL_NONE,  0,                 "YUV mode: none, yv12, yuy2, yv12x2, yuy2x2 (-video soft only)" },
111111
112112   // OpenGL specific options
113113   { NULL,                                   NULL,   OPTION_HEADER,  "OpenGL-SPECIFIC OPTIONS" },
r1635r1636
118118   { SDLOPTION_GL_VBO,                       "1",    OPTION_BOOLEAN, "enable OpenGL VBO,  if available (default on)" },
119119   { SDLOPTION_GL_PBO,                       "1",    OPTION_BOOLEAN, "enable OpenGL PBO,  if available (default on)" },
120120   { SDLOPTION_GL_GLSL,                      "0",    OPTION_BOOLEAN, "enable OpenGL GLSL, if available (default off)" },
121    { SDLOPTION_GLSL_FILTER,              "1",       0,          "enable OpenGL GLSL filtering instead of FF filtering 0-plain, 1-bilinear (default)" },
122    { SDLOPTION_SHADER_MAME("0"),           "none",      0,          "custom OpenGL GLSL shader set mame bitmap 0" },
123    { SDLOPTION_SHADER_MAME("1"),           "none",      0,          "custom OpenGL GLSL shader set mame bitmap 1" },
124    { SDLOPTION_SHADER_MAME("2"),           "none",      0,          "custom OpenGL GLSL shader set mame bitmap 2" },
125    { SDLOPTION_SHADER_MAME("3"),           "none",      0,          "custom OpenGL GLSL shader set mame bitmap 3" },
126    { SDLOPTION_SHADER_MAME("4"),           "none",      0,          "custom OpenGL GLSL shader set mame bitmap 4" },
127    { SDLOPTION_SHADER_MAME("5"),           "none",      0,          "custom OpenGL GLSL shader set mame bitmap 5" },
128    { SDLOPTION_SHADER_MAME("6"),           "none",      0,          "custom OpenGL GLSL shader set mame bitmap 6" },
129    { SDLOPTION_SHADER_MAME("7"),           "none",      0,          "custom OpenGL GLSL shader set mame bitmap 7" },
130    { SDLOPTION_SHADER_MAME("8"),           "none",      0,          "custom OpenGL GLSL shader set mame bitmap 8" },
131    { SDLOPTION_SHADER_MAME("9"),           "none",      0,          "custom OpenGL GLSL shader set mame bitmap 9" },
132    { SDLOPTION_SHADER_SCREEN("0"),          "none",      0,          "custom OpenGL GLSL shader screen bitmap 0" },
133    { SDLOPTION_SHADER_SCREEN("1"),          "none",      0,          "custom OpenGL GLSL shader screen bitmap 1" },
134    { SDLOPTION_SHADER_SCREEN("2"),          "none",      0,          "custom OpenGL GLSL shader screen bitmap 2" },
135    { SDLOPTION_SHADER_SCREEN("3"),          "none",      0,          "custom OpenGL GLSL shader screen bitmap 3" },
136    { SDLOPTION_SHADER_SCREEN("4"),          "none",      0,          "custom OpenGL GLSL shader screen bitmap 4" },
137    { SDLOPTION_SHADER_SCREEN("5"),          "none",      0,          "custom OpenGL GLSL shader screen bitmap 5" },
138    { SDLOPTION_SHADER_SCREEN("6"),          "none",      0,          "custom OpenGL GLSL shader screen bitmap 6" },
139    { SDLOPTION_SHADER_SCREEN("7"),          "none",      0,          "custom OpenGL GLSL shader screen bitmap 7" },
140    { SDLOPTION_SHADER_SCREEN("8"),          "none",      0,          "custom OpenGL GLSL shader screen bitmap 8" },
141    { SDLOPTION_SHADER_SCREEN("9"),          "none",      0,          "custom OpenGL GLSL shader screen bitmap 9" },
142    { SDLOPTION_GL_GLSL_VID_ATTR,          "1",    OPTION_BOOLEAN, "enable OpenGL GLSL handling of brightness and contrast. Better RGB game performance for free. (default)" },
121    { SDLOPTION_GLSL_FILTER,              "1",    0,              "enable OpenGL GLSL filtering instead of FF filtering 0-plain, 1-bilinear (default)" },
122    { SDLOPTION_SHADER_MAME("0"),    SDLOPTVAL_NONE,  0,              "custom OpenGL GLSL shader set mame bitmap 0" },
123    { SDLOPTION_SHADER_MAME("1"),    SDLOPTVAL_NONE,  0,              "custom OpenGL GLSL shader set mame bitmap 1" },
124    { SDLOPTION_SHADER_MAME("2"),    SDLOPTVAL_NONE,  0,              "custom OpenGL GLSL shader set mame bitmap 2" },
125    { SDLOPTION_SHADER_MAME("3"),    SDLOPTVAL_NONE,  0,              "custom OpenGL GLSL shader set mame bitmap 3" },
126    { SDLOPTION_SHADER_MAME("4"),    SDLOPTVAL_NONE,  0,              "custom OpenGL GLSL shader set mame bitmap 4" },
127    { SDLOPTION_SHADER_MAME("5"),    SDLOPTVAL_NONE,  0,              "custom OpenGL GLSL shader set mame bitmap 5" },
128    { SDLOPTION_SHADER_MAME("6"),    SDLOPTVAL_NONE,  0,              "custom OpenGL GLSL shader set mame bitmap 6" },
129    { SDLOPTION_SHADER_MAME("7"),    SDLOPTVAL_NONE,  0,              "custom OpenGL GLSL shader set mame bitmap 7" },
130    { SDLOPTION_SHADER_MAME("8"),    SDLOPTVAL_NONE,  0,              "custom OpenGL GLSL shader set mame bitmap 8" },
131    { SDLOPTION_SHADER_MAME("9"),    SDLOPTVAL_NONE,  0,              "custom OpenGL GLSL shader set mame bitmap 9" },
132    { SDLOPTION_SHADER_SCREEN("0"),  SDLOPTVAL_NONE,  0,              "custom OpenGL GLSL shader screen bitmap 0" },
133    { SDLOPTION_SHADER_SCREEN("1"),  SDLOPTVAL_NONE,  0,              "custom OpenGL GLSL shader screen bitmap 1" },
134    { SDLOPTION_SHADER_SCREEN("2"),  SDLOPTVAL_NONE,  0,              "custom OpenGL GLSL shader screen bitmap 2" },
135    { SDLOPTION_SHADER_SCREEN("3"),  SDLOPTVAL_NONE,  0,              "custom OpenGL GLSL shader screen bitmap 3" },
136    { SDLOPTION_SHADER_SCREEN("4"),  SDLOPTVAL_NONE,  0,              "custom OpenGL GLSL shader screen bitmap 4" },
137    { SDLOPTION_SHADER_SCREEN("5"),  SDLOPTVAL_NONE,  0,              "custom OpenGL GLSL shader screen bitmap 5" },
138    { SDLOPTION_SHADER_SCREEN("6"),  SDLOPTVAL_NONE,  0,              "custom OpenGL GLSL shader screen bitmap 6" },
139    { SDLOPTION_SHADER_SCREEN("7"),  SDLOPTVAL_NONE,  0,              "custom OpenGL GLSL shader screen bitmap 7" },
140    { SDLOPTION_SHADER_SCREEN("8"),  SDLOPTVAL_NONE,  0,              "custom OpenGL GLSL shader screen bitmap 8" },
141    { SDLOPTION_SHADER_SCREEN("9"),  SDLOPTVAL_NONE,  0,              "custom OpenGL GLSL shader screen bitmap 9" },
142    { SDLOPTION_GL_GLSL_VID_ATTR,          "1",    OPTION_BOOLEAN,  "enable OpenGL GLSL handling of brightness and contrast. Better RGB game performance for free. (default)" },
143143
144144   // per-window options
145   { NULL,                                   NULL,       OPTION_HEADER,     "PER-WINDOW VIDEO OPTIONS" },
146   { SDLOPTION_SCREEN(""),                   "auto",     0,                 "explicit name of the first screen; 'auto' here will try to make a best guess" },
147   { SDLOPTION_ASPECT("") ";screen_aspect",  "auto",     0,                 "aspect ratio for all screens; 'auto' here will try to make a best guess" },
148   { SDLOPTION_RESOLUTION("") ";r",          "auto",     0,                 "preferred resolution for all screens; format is <width>x<height>[@<refreshrate>] or 'auto'" },
149   { SDLOPTION_VIEW(""),                     "auto",     0,                 "preferred view for all screens" },
145   { NULL,                                   NULL, OPTION_HEADER,    "PER-WINDOW VIDEO OPTIONS" },
146   { SDLOPTION_SCREEN(""),                   SDLOPTVAL_AUTO,   0,    "explicit name of the first screen; 'auto' here will try to make a best guess" },
147   { SDLOPTION_ASPECT("") ";screen_aspect",  SDLOPTVAL_AUTO,   0,    "aspect ratio for all screens; 'auto' here will try to make a best guess" },
148   { SDLOPTION_RESOLUTION("") ";r",          SDLOPTVAL_AUTO,   0,    "preferred resolution for all screens; format is <width>x<height>[@<refreshrate>] or 'auto'" },
149   { SDLOPTION_VIEW(""),                     SDLOPTVAL_AUTO,   0,    "preferred view for all screens" },
150150
151   { SDLOPTION_SCREEN("0"),                  "auto",     0,                 "explicit name of the first screen; 'auto' here will try to make a best guess" },
152   { SDLOPTION_ASPECT("0"),                  "auto",     0,                 "aspect ratio of the first screen; 'auto' here will try to make a best guess" },
153   { SDLOPTION_RESOLUTION("0") ";r0",        "auto",     0,                 "preferred resolution of the first screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
154   { SDLOPTION_VIEW("0"),                    "auto",     0,                 "preferred view for the first screen" },
151   { SDLOPTION_SCREEN("0"),                  SDLOPTVAL_AUTO,   0,    "explicit name of the first screen; 'auto' here will try to make a best guess" },
152   { SDLOPTION_ASPECT("0"),                  SDLOPTVAL_AUTO,   0,    "aspect ratio of the first screen; 'auto' here will try to make a best guess" },
153   { SDLOPTION_RESOLUTION("0") ";r0",        SDLOPTVAL_AUTO,   0,    "preferred resolution of the first screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
154   { SDLOPTION_VIEW("0"),                    SDLOPTVAL_AUTO,   0,    "preferred view for the first screen" },
155155
156   { SDLOPTION_SCREEN("1"),                  "auto",     0,                 "explicit name of the second screen; 'auto' here will try to make a best guess" },
157   { SDLOPTION_ASPECT("1"),                  "auto",     0,                 "aspect ratio of the second screen; 'auto' here will try to make a best guess" },
158   { SDLOPTION_RESOLUTION("1") ";r1",        "auto",     0,                 "preferred resolution of the second screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
159   { SDLOPTION_VIEW("1"),                    "auto",     0,                 "preferred view for the second screen" },
156   { SDLOPTION_SCREEN("1"),                  SDLOPTVAL_AUTO,   0,    "explicit name of the second screen; 'auto' here will try to make a best guess" },
157   { SDLOPTION_ASPECT("1"),                  SDLOPTVAL_AUTO,   0,    "aspect ratio of the second screen; 'auto' here will try to make a best guess" },
158   { SDLOPTION_RESOLUTION("1") ";r1",        SDLOPTVAL_AUTO,   0,    "preferred resolution of the second screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
159   { SDLOPTION_VIEW("1"),                    SDLOPTVAL_AUTO,   0,    "preferred view for the second screen" },
160160
161   { SDLOPTION_SCREEN("2"),                  "auto",     0,                 "explicit name of the third screen; 'auto' here will try to make a best guess" },
162   { SDLOPTION_ASPECT("2"),                  "auto",     0,                 "aspect ratio of the third screen; 'auto' here will try to make a best guess" },
163   { SDLOPTION_RESOLUTION("2") ";r2",        "auto",     0,                 "preferred resolution of the third screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
164   { SDLOPTION_VIEW("2"),                    "auto",     0,                 "preferred view for the third screen" },
161   { SDLOPTION_SCREEN("2"),                  SDLOPTVAL_AUTO,   0,    "explicit name of the third screen; 'auto' here will try to make a best guess" },
162   { SDLOPTION_ASPECT("2"),                  SDLOPTVAL_AUTO,   0,    "aspect ratio of the third screen; 'auto' here will try to make a best guess" },
163   { SDLOPTION_RESOLUTION("2") ";r2",        SDLOPTVAL_AUTO,   0,    "preferred resolution of the third screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
164   { SDLOPTION_VIEW("2"),                    SDLOPTVAL_AUTO,   0,    "preferred view for the third screen" },
165165
166   { SDLOPTION_SCREEN("3"),                  "auto",     0,                 "explicit name of the fourth screen; 'auto' here will try to make a best guess" },
167   { SDLOPTION_ASPECT("3"),                  "auto",     0,                 "aspect ratio of the fourth screen; 'auto' here will try to make a best guess" },
168   { SDLOPTION_RESOLUTION("3") ";r3",        "auto",     0,                 "preferred resolution of the fourth screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
169   { SDLOPTION_VIEW("3"),                    "auto",     0,                 "preferred view for the fourth screen" },
166   { SDLOPTION_SCREEN("3"),                  SDLOPTVAL_AUTO,   0,    "explicit name of the fourth screen; 'auto' here will try to make a best guess" },
167   { SDLOPTION_ASPECT("3"),                  SDLOPTVAL_AUTO,   0,    "aspect ratio of the fourth screen; 'auto' here will try to make a best guess" },
168   { SDLOPTION_RESOLUTION("3") ";r3",        SDLOPTVAL_AUTO,   0,    "preferred resolution of the fourth screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
169   { SDLOPTION_VIEW("3"),                    SDLOPTVAL_AUTO,   0,    "preferred view for the fourth screen" },
170170
171171   // full screen options
172   { NULL,                                   NULL,       OPTION_HEADER,     "FULL SCREEN OPTIONS" },
173   { SDLOPTION_SWITCHRES,                   "0",        OPTION_BOOLEAN,    "enable resolution switching" },
172   { NULL,                                   NULL,  OPTION_HEADER,     "FULL SCREEN OPTIONS" },
173   { SDLOPTION_SWITCHRES,                    "0",   OPTION_BOOLEAN,    "enable resolution switching" },
174174   #ifdef SDLMAME_X11
175175   { SDLOPTION_USEALLHEADS,                "0",     OPTION_BOOLEAN,    "split full screen image across monitors" },
176176   #endif
177177
178178   // sound options
179   { NULL,                                   NULL,       OPTION_HEADER,     "SOUND OPTIONS" },
180   { SDLOPTION_AUDIO_LATENCY,                "3",        0,                 "set audio latency (increase to reduce glitches, decrease for responsiveness)" },
179   { NULL,                                   NULL,  OPTION_HEADER,     "SOUND OPTIONS" },
180   { SDLOPTION_AUDIO_LATENCY,                "3",   0,                 "set audio latency (increase to reduce glitches, decrease for responsiveness)" },
181181
182182   // keyboard mapping
183   { NULL,                                 NULL,       OPTION_HEADER,     "SDL KEYBOARD MAPPING" },
184   { SDLOPTION_KEYMAP,                      "0",         OPTION_BOOLEAN,    "enable keymap" },
185   { SDLOPTION_KEYMAP_FILE,                 "keymap.dat", 0,               "keymap filename" },
183   { NULL,                                 NULL,  OPTION_HEADER,     "SDL KEYBOARD MAPPING" },
184   { SDLOPTION_KEYMAP,                      "0",    OPTION_BOOLEAN,    "enable keymap" },
185   { SDLOPTION_KEYMAP_FILE,                 "keymap.dat", 0,           "keymap filename" },
186186#ifdef MESS
187187#ifdef SDLMAME_MACOSX   // work around for SDL 1.2.11 on Mac - 1.2.12 should not require this
188188   { SDLOPTION_UIMODEKEY,         "DELETE", 0,                  "Key to toggle MESS keyboard mode" },
r1635r1636
192192#endif   // MESS
193193
194194   // joystick mapping
195   { NULL,                                NULL,        OPTION_HEADER,     "SDL JOYSTICK MAPPING" },
196   { SDLOPTION_JOYMAP,                      "0",         OPTION_BOOLEAN,    "enable physical to logical joystick mapping" },
197   { SDLOPTION_JOYMAP_FILE,                "joymap.dat", 0,               "joymap filename" },
198   { SDLOPTION_SIXAXIS,         "0",   OPTION_BOOLEAN, "Use special handling for PS3 Sixaxis controllers" },
195   { NULL,                                NULL,   OPTION_HEADER,     "SDL JOYSTICK MAPPING" },
196   { SDLOPTION_JOYMAP,                      "0",    OPTION_BOOLEAN,    "enable physical to logical joystick mapping" },
197   { SDLOPTION_JOYMAP_FILE,                "joymap.dat", 0,            "joymap filename" },
198   { SDLOPTION_SIXAXIS,                 "0",    OPTION_BOOLEAN,    "Use special handling for PS3 Sixaxis controllers" },
199199   { NULL }
200200};
201201
r1635r1636
303303         char buf[130];
304304         if (XMatchVisualInfo(display, DefaultScreen(display), 24, TrueColor, &vi)) {
305305            snprintf(buf, sizeof(buf), "0x%lx", vi.visualid);
306            setenv("SDL_VIDEO_X11_VISUALID", buf, 0);
306            setenv(SDLENV_IDENTIFIER, buf, 0);
307307         }
308308      }
309309      if (display)
r1635r1636
434434      fflush(stdout);
435435      exit(-1);
436436   }
437   
438   if (getenv("SDLMAME_UNSUPPORTED"))
437   if (sdl_use_unsupported())
439438      led_init();
440439
441440   #ifdef MESS
r1635r1636
445444   sdlinput_init(machine);
446445   sdl_init_audio(machine);
447446
448   if (options_get_bool(mame_options(), "oslog"))
447   if (options_get_bool(mame_options(), SDLOPTION_OSLOG))
449448      add_logerror_callback(machine, output_oslog);
450449
451450   #ifdef MESS
src/osd/sdl/osdsdl.h
r1635r1636
5050//   Defines
5151//============================================================
5252
53#define SDLOPTION_INIPATH            "inipath"
5354#define SDLOPTION_AUDIO_LATENCY         "audio_latency"
5455#define SDLOPTION_SCREEN(x)            "screen" x
5556#define SDLOPTION_ASPECT(x)            "aspect" x
r1635r1636
7778#define SDLOPTION_JOYMAP            "remapjoys"
7879#define SDLOPTION_JOYMAP_FILE         "remapjoyfile"
7980#define SDLOPTION_UIMODEKEY            "uimodekey"
80#define SDLOPTION_SIXAXIS         "sixaxis"
81#define SDLOPTION_SIXAXIS            "sixaxis"
82#define SDLOPTION_OSLOG               "oslog"
8183
8284#define SDLOPTION_SHADER_MAME(x)      "glsl_shader_mame" x
8385#define SDLOPTION_SHADER_SCREEN(x)      "glsl_shader_screen" x
r1635r1636
8991#define SDLOPTION_GL_FORCEPOW2TEXTURE   "gl_forcepow2texture"
9092#define SDLOPTION_GL_GLSL_VID_ATTR      "gl_glsl_vid_attr"
9193
94#define SDLOPTVAL_NONE               "none"
95#define SDLOPTVAL_AUTO               "auto"
96
97#define SDLOPTVAL_OPENGL            "opengl"
98#define SDLOPTVAL_OPENGL16            "opengl16"
99#define SDLOPTVAL_SOFT               "soft"
100
101#define SDLOPTVAL_YV12               "yv12"
102#define SDLOPTVAL_YV12x2            "yv12x2"
103#define SDLOPTVAL_YUY2               "yuy2"
104#define SDLOPTVAL_YUY2x2            "yuy2x2"
105
106#define SDL_LED(x)                  "led" #x
107
108#define SDLENV_IDENTIFIER            "SDL_VIDEO_X11_VISUALID"
109#define SDLENV_COLUMNS               "COLUMNS"
110#define SDLENV_DESKTOPDIM            "SDLMAME_DESKTOPDIM"
111#define SDLENV_GL_LIB               "SDLMAME_GL_LIB"
112#define SDLENV_VMWARE               "SDLMAME_VMWARE"
113
114#define sdl_use_unsupported()         (getenv("SDLMAME_UNSUPPORTED") != NULL)
115
116#define SDL_SOUND_LOG               "sound.log"
117
92118//============================================================
93119//   sound.c
94120//============================================================

Previous 15994 Revisions Next


© 1998-2018 The MESS Team