src/osd/sdl/input.c
| r844 | r845 | |
| 338 | 338 | KE8(c, d, e, f, g, h, i, j ) |
| 339 | 339 | KE8(k, l, m, n, o, p, q, r ) |
| 340 | 340 | KE8(s, t, u, v, w, x, y, z ) |
| 341 | | { SDLK_DELETE, "SDLK_DELETE" }, KE(WORLD_0) KE(WORLD_1) KE(WORLD_2) KE(WORLD_3) KE(WORLD_4) KE(WORLD_5) KE(WORLD_6) |
| 342 | | KE8(WORLD_7, WORLD_8, WORLD_9, WORLD_10, WORLD_11, WORLD_12, WORLD_13, WORLD_14 ) |
| 343 | | KE8(WORLD_15, WORLD_16, WORLD_17, WORLD_18, WORLD_19, WORLD_20, WORLD_21, WORLD_22 ) |
| 344 | | KE8(WORLD_23, WORLD_24, WORLD_25, WORLD_26, WORLD_27, WORLD_28, WORLD_29, WORLD_30 ) |
| 345 | | KE8(WORLD_31, WORLD_32, WORLD_33, WORLD_34, WORLD_35, WORLD_36, WORLD_37, WORLD_38 ) |
| 346 | | KE8(WORLD_39, WORLD_40, WORLD_41, WORLD_42, WORLD_43, WORLD_44, WORLD_45, WORLD_46 ) |
| 347 | | KE8(WORLD_47, WORLD_48, WORLD_49, WORLD_50, WORLD_51, WORLD_52, WORLD_53, WORLD_54 ) |
| 348 | | KE8(WORLD_55, WORLD_56, WORLD_57, WORLD_58, WORLD_59, WORLD_60, WORLD_61, WORLD_62 ) |
| 349 | | KE8(WORLD_63, WORLD_64, WORLD_65, WORLD_66, WORLD_67, WORLD_68, WORLD_69, WORLD_70 ) |
| 350 | | KE8(WORLD_71, WORLD_72, WORLD_73, WORLD_74, WORLD_75, WORLD_76, WORLD_77, WORLD_78 ) |
| 351 | | KE8(WORLD_79, WORLD_80, WORLD_81, WORLD_82, WORLD_83, WORLD_84, WORLD_85, WORLD_86 ) |
| 352 | | KE8(WORLD_87, WORLD_88, WORLD_89, WORLD_90, WORLD_91, WORLD_92, WORLD_93, WORLD_94 ) |
| 353 | | KE8(WORLD_95, KP0, KP1, KP2, KP3, KP4, KP5, KP6 ) |
| 354 | | KE8(KP7, KP8, KP9, KP_PERIOD, KP_DIVIDE, KP_MULTIPLY,KP_MINUS, KP_PLUS ) |
| 355 | | KE8(KP_ENTER, KP_EQUALS, UP, DOWN, RIGHT, LEFT, INSERT, HOME ) |
| 356 | | KE8(END, PAGEUP, PAGEDOWN, F1, F2, F3, F4, F5 ) |
| 357 | | KE8(F6, F7, F8, F9, F10, F11, F12, F13 ) |
| 358 | | KE8(F14, F15, NUMLOCK, CAPSLOCK, SCROLLOCK, RSHIFT, LSHIFT, RCTRL ) |
| 359 | | KE8(LCTRL, RALT, LALT, RMETA, LMETA, LSUPER, RSUPER, MODE ) |
| 360 | | KE8(COMPOSE, HELP, PRINT, SYSREQ, BREAK, MENU, POWER, EURO ) |
| 361 | | KE(UNDO) |
| 341 | { SDLK_DELETE, "SDLK_DELETE" }, |
| 342 | //FIXME:Proper check for version |
| 343 | #if (SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) < 1300) |
| 344 | KE8(WORLD_0, WORLD_1, WORLD_2, WORLD_3, WORLD_4, WORLD_5, WORLD_6, WORLD_7 ) |
| 345 | KE8(WORLD_8, WORLD_9, WORLD_10, WORLD_11, WORLD_12, WORLD_13, WORLD_14, WORLD_15 ) |
| 346 | KE8(WORLD_16, WORLD_17, WORLD_18, WORLD_19, WORLD_20, WORLD_21, WORLD_22, WORLD_23 ) |
| 347 | KE8(WORLD_24, WORLD_25, WORLD_26, WORLD_27, WORLD_28, WORLD_29, WORLD_30, WORLD_31 ) |
| 348 | KE8(WORLD_32, WORLD_33, WORLD_34, WORLD_35, WORLD_36, WORLD_37, WORLD_38, WORLD_39 ) |
| 349 | KE8(WORLD_40, WORLD_41, WORLD_42, WORLD_43, WORLD_44, WORLD_45, WORLD_46, WORLD_47 ) |
| 350 | KE8(WORLD_48, WORLD_49, WORLD_50, WORLD_51, WORLD_52, WORLD_53, WORLD_54, WORLD_55 ) |
| 351 | KE8(WORLD_56, WORLD_57, WORLD_58, WORLD_59, WORLD_60, WORLD_61, WORLD_62, WORLD_63 ) |
| 352 | KE8(WORLD_64, WORLD_65, WORLD_66, WORLD_67, WORLD_68, WORLD_69, WORLD_70, WORLD_71 ) |
| 353 | KE8(WORLD_72, WORLD_73, WORLD_74, WORLD_75, WORLD_76, WORLD_77, WORLD_78, WORLD_79 ) |
| 354 | KE8(WORLD_80, WORLD_81, WORLD_82, WORLD_83, WORLD_84, WORLD_85, WORLD_86, WORLD_87 ) |
| 355 | KE8(WORLD_88, WORLD_89, WORLD_90, WORLD_91, WORLD_92, WORLD_93, WORLD_94, WORLD_95 ) |
| 356 | #endif |
| 357 | KE8(KP0, KP1, KP2, KP3, KP4, KP5, KP6, KP7 ) |
| 358 | KE8(KP8, KP9, KP_PERIOD, KP_DIVIDE, KP_MULTIPLY,KP_MINUS, KP_PLUS, KP_ENTER ) |
| 359 | KE8(UP, DOWN, RIGHT, LEFT, INSERT, HOME, KP_EQUALS, END ) |
| 360 | KE8(PAGEUP, PAGEDOWN, F1, F2, F3, F4, F5, F6 ) |
| 361 | KE8(F7, F8, F9, F10, F11, F12, F13, F14 ) |
| 362 | KE8(F15, NUMLOCK, CAPSLOCK, SCROLLOCK, RSHIFT, LSHIFT, RCTRL, LCTRL ) |
| 363 | KE8(RALT, LALT, RMETA, LMETA, LSUPER, RSUPER, MODE, COMPOSE ) |
| 364 | KE8(HELP, PRINT, SYSREQ, BREAK, MENU, POWER, EURO, UNDO ) |
| 362 | 365 | KE(LAST) |
| 363 | 366 | {-1, ""} |
| 364 | 367 | }; |
src/osd/sdl/video.c
| r844 | r845 | |
| 145 | 145 | |
| 146 | 146 | // extract data from the options |
| 147 | 147 | extract_video_config(); |
| 148 | | |
| 149 | | #ifndef NO_OPENGL |
| 150 | | #ifdef USE_DISPATCH_GL |
| 151 | | /* |
| 152 | | * directfb and and x11 use this env var |
| 153 | | */ |
| 154 | | gl_dispatch = auto_malloc(sizeof(osd_gl_dispatch)); |
| 155 | | if (video_config.mode == VIDEO_MODE_OPENGL) |
| 156 | | { |
| 157 | | const char *e; |
| 158 | | //e=getenv("SDL_VIDEO_GL_DRIVER"); |
| 159 | | e=getenv("SDLMAME_GL_LIB"); |
| 160 | | #ifdef SDLMAME_MACOSX |
| 161 | | /* Vas Crabb: Default GL-lib for MACOSX */ |
| 162 | | if (!e) |
| 163 | | e = "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"; |
| 164 | | #endif |
| 165 | | if (SDL_GL_LoadLibrary(e) != 0) // Load library (default for e==NULL |
| 166 | | { |
| 167 | | fatalerror("Unable to load default library: %s\n", e); |
| 168 | | } |
| 169 | | mame_printf_verbose("Loaded opengl shared library: %s\n", e ? e : "<default>"); |
| 170 | | } |
| 171 | | #endif |
| 172 | | #endif |
| 173 | 148 | |
| 174 | 149 | // ensure we get called on the way out |
| 175 | 150 | add_exit_callback(machine, video_exit); |
| r844 | r845 | |
| 321 | 296 | char *dimstr = getenv("SDLMAME_DESKTOPDIM"); |
| 322 | 297 | const SDL_VideoInfo *sdl_vi; |
| 323 | 298 | |
| 324 | | #if 0 |
| 325 | | // Code disabled since directfb may support *software* opengl |
| 326 | | // Unfortunately there is no way to tell wheter the driver |
| 327 | | // supports opengl at all. Added code to video.c to check |
| 328 | | // whether actually opengl was activated during setvideomode |
| 329 | | if ( (video_config.mode == VIDEO_MODE_OPENGL) && |
| 330 | | (/*!strcmp(monitor->mo nitor_device,"directfb")*/ 0 |
| 331 | | || !strcmp(monitor->monitor_device,"fbcon") ) ) |
| 332 | | { |
| 333 | | mame_printf_warning("WARNING: OpenGL not supported for driver <%s>\n",monitor->monitor_device); |
| 334 | | mame_printf_warning(" Falling back to soft mode\n"); |
| 335 | | video_config.mode = VIDEO_MODE_SOFT; |
| 336 | | } |
| 337 | | #endif |
| 338 | | |
| 339 | 299 | sdl_vi = SDL_GetVideoInfo(); |
| 340 | 300 | #if (SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) >= 1210) |
| 301 | //FIXME: File a bug for SDL 1.3 |
| 302 | #if (SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) < 1300) |
| 341 | 303 | cw = sdl_vi->current_w; |
| 342 | 304 | ch = sdl_vi->current_h; |
| 343 | 305 | #endif |
| 306 | #endif |
| 344 | 307 | first_call=1; |
| 345 | 308 | if ((cw==0) || (ch==0)) |
| 346 | 309 | { |
| r844 | r845 | |
| 551 | 514 | |
| 552 | 515 | // get the screen option |
| 553 | 516 | #if SDL_MULTIMON || defined(SDLMAME_WIN32) |
| 554 | | sprintf(option, SDLOPTION_FMT_SCREEN, index); |
| 517 | sprintf(option, SDLOPTION_SCREEN("%d"), index); |
| 555 | 518 | scrname = options_get_string(mame_options(), option); |
| 556 | 519 | #endif |
| 557 | 520 | |
| 558 | 521 | // get the aspect ratio |
| 559 | | sprintf(option, SDLOPTION_FMT_ASPECT, index); |
| 522 | sprintf(option, SDLOPTION_ASPECT("%d"), index); |
| 560 | 523 | aspect = get_aspect(option, TRUE); |
| 561 | 524 | |
| 562 | 525 | // look for a match in the name first |
| r844 | r845 | |
| 665 | 628 | load_effect_overlay(stemp); |
| 666 | 629 | |
| 667 | 630 | // per-window options: extract the data |
| 668 | | get_resolution("resolution0", &video_config.window[0], TRUE); |
| 669 | | get_resolution("resolution1", &video_config.window[1], TRUE); |
| 670 | | get_resolution("resolution2", &video_config.window[2], TRUE); |
| 671 | | get_resolution("resolution3", &video_config.window[3], TRUE); |
| 631 | get_resolution(SDLOPTION_RESOLUTION("0"), &video_config.window[0], TRUE); |
| 632 | get_resolution(SDLOPTION_RESOLUTION("1"), &video_config.window[1], TRUE); |
| 633 | get_resolution(SDLOPTION_RESOLUTION("2"), &video_config.window[2], TRUE); |
| 634 | get_resolution(SDLOPTION_RESOLUTION("3"), &video_config.window[3], TRUE); |
| 672 | 635 | |
| 673 | 636 | // default to working video please |
| 674 | 637 | video_config.novideo = 0; |
| r844 | r845 | |
| 710 | 673 | video_config.prescale = 1; |
| 711 | 674 | } |
| 712 | 675 | |
| 713 | | video_config.forcepow2texture = options_get_bool(mame_options(), "gl_forcepow2texture")==1; |
| 714 | | video_config.allowtexturerect = options_get_bool(mame_options(), "gl_notexturerect")==0; |
| 715 | | video_config.vbo = options_get_bool(mame_options(), "gl_vbo"); |
| 716 | | video_config.pbo = options_get_bool(mame_options(), "gl_pbo"); |
| 717 | | video_config.glsl = options_get_bool(mame_options(), "gl_glsl"); |
| 676 | video_config.forcepow2texture = options_get_bool(mame_options(), SDLOPTION_GL_FORCEPOW2TEXTURE)==1; |
| 677 | video_config.allowtexturerect = options_get_bool(mame_options(), SDLOPTION_GL_NOTEXTURERECT)==0; |
| 678 | video_config.vbo = options_get_bool(mame_options(), SDLOPTION_GL_VBO); |
| 679 | video_config.pbo = options_get_bool(mame_options(), SDLOPTION_GL_PBO); |
| 680 | video_config.glsl = options_get_bool(mame_options(), SDLOPTION_GL_GLSL); |
| 718 | 681 | if ( video_config.glsl ) |
| 719 | 682 | { |
| 720 | 683 | int i; |
| 721 | 684 | static char buffer[20]; // gl_glsl_filter[0..9]? |
| 722 | 685 | |
| 723 | | video_config.glsl_filter = options_get_int (mame_options(), "gl_glsl_filter"); |
| 686 | video_config.glsl_filter = options_get_int (mame_options(), SDLOPTION_GLSL_FILTER); |
| 724 | 687 | |
| 725 | 688 | video_config.glsl_shader_mamebm_num=0; |
| 726 | 689 | |
| 727 | 690 | for(i=0; i<GLSL_SHADER_MAX; i++) |
| 728 | 691 | { |
| 729 | | snprintf(buffer, 18, "glsl_shader_mame%d", i); buffer[17]=0; |
| 692 | snprintf(buffer, 18, SDLOPTION_SHADER_MAME("%d"), i); buffer[17]=0; |
| 730 | 693 | |
| 731 | 694 | stemp = options_get_string(mame_options(), buffer); |
| 732 | 695 | if (stemp && strcmp(stemp, "none") != 0 && strlen(stemp)>0) |
| r844 | r845 | |
| 743 | 706 | |
| 744 | 707 | for(i=0; i<GLSL_SHADER_MAX; i++) |
| 745 | 708 | { |
| 746 | | snprintf(buffer, 20, "glsl_shader_screen%d", i); buffer[19]=0; |
| 709 | snprintf(buffer, 20, SDLOPTION_SHADER_SCREEN("%d"), i); buffer[19]=0; |
| 747 | 710 | |
| 748 | 711 | stemp = options_get_string(mame_options(), buffer); |
| 749 | 712 | if (stemp && strcmp(stemp, "none") != 0 && strlen(stemp)>0) |
| r844 | r845 | |
| 756 | 719 | } |
| 757 | 720 | } |
| 758 | 721 | |
| 759 | | video_config.glsl_vid_attributes = options_get_int (mame_options(), "gl_glsl_vid_attr"); |
| 722 | video_config.glsl_vid_attributes = options_get_int (mame_options(), SDLOPTION_GL_GLSL_VID_ATTR); |
| 760 | 723 | { |
| 761 | 724 | // Disable feature: glsl_vid_attributes, as long we have the gamma calculation |
| 762 | 725 | // disabled within the direct shaders .. -> too slow. |
| r844 | r845 | |
| 865 | 828 | |
| 866 | 829 | static float get_aspect(const char *name, int report_error) |
| 867 | 830 | { |
| 868 | | const char *defdata = options_get_string(mame_options(), SDLOPTION_ASPECT); |
| 831 | const char *defdata = options_get_string(mame_options(), SDLOPTION_ASPECT("")); |
| 869 | 832 | const char *data = options_get_string(mame_options(), name); |
| 870 | 833 | int num = 0, den = 1; |
| 871 | 834 | |
src/osd/sdl/window.c
| r844 | r845 | |
| 87 | 87 | static osd_work_queue *work_queue; |
| 88 | 88 | static int main_threadid; |
| 89 | 89 | static int window_threadid; |
| 90 | static int dll_loaded; |
| 90 | 91 | |
| 92 | |
| 91 | 93 | static UINT32 last_update_time; |
| 92 | 94 | |
| 93 | 95 | static const char *yuv_mode_names[] = { "none", "yv12", "yv12x2", "yuy2", "yuy2x2" }; |
| r844 | r845 | |
| 108 | 110 | const render_primitive_list *list; |
| 109 | 111 | int resize_new_width; |
| 110 | 112 | int resize_new_height; |
| 113 | int times; |
| 111 | 114 | }; |
| 112 | 115 | |
| 113 | 116 | |
| r844 | r845 | |
| 129 | 132 | static void *complete_create_wt(void *param); |
| 130 | 133 | static void set_starting_view(int index, sdl_window_info *window, const char *view); |
| 131 | 134 | |
| 132 | | /* in drawsdl.c */ |
| 133 | | void yuv_lookup_init(sdl_window_info *window); |
| 134 | | |
| 135 | 135 | //============================================================ |
| 136 | 136 | // clear the worker_param structure, inline - faster than memset |
| 137 | 137 | //============================================================ |
| r844 | r845 | |
| 142 | 142 | wp->list=NULL; |
| 143 | 143 | wp->resize_new_width=0; |
| 144 | 144 | wp->resize_new_height=0; |
| 145 | wp->times=0; |
| 145 | 146 | } |
| 146 | 147 | |
| 147 | 148 | //============================================================ |
| r844 | r845 | |
| 242 | 243 | |
| 243 | 244 | // set up the window list |
| 244 | 245 | last_window_ptr = &sdl_window_list; |
| 246 | dll_loaded = 0; |
| 245 | 247 | return 0; |
| 246 | 248 | } |
| 247 | 249 | |
| r844 | r845 | |
| 285 | 287 | { |
| 286 | 288 | ASSERT_MAIN_THREAD(); |
| 287 | 289 | |
| 288 | | // if we're multithreaded, clean up the window thread |
| 289 | | if (multithreading_enabled) |
| 290 | | { |
| 291 | | sdlwindow_sync(); |
| 292 | | } |
| 293 | | |
| 294 | 290 | // free all the windows |
| 295 | 291 | while (sdl_window_list != NULL) |
| 296 | 292 | { |
| r844 | r845 | |
| 298 | 294 | sdl_window_list = temp->next; |
| 299 | 295 | sdlwindow_video_window_destroy(temp); |
| 300 | 296 | } |
| 297 | |
| 298 | // if we're multithreaded, clean up the window thread |
| 299 | if (multithreading_enabled) |
| 300 | { |
| 301 | sdlwindow_sync(); |
| 302 | } |
| 301 | 303 | |
| 302 | 304 | // kill the drawers |
| 303 | 305 | (*draw.exit)(); |
| r844 | r845 | |
| 382 | 384 | #if USE_OPENGL |
| 383 | 385 | drawsdl_destroy_all_textures(window); |
| 384 | 386 | #endif |
| 387 | #if (SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) < 1300) |
| 385 | 388 | SDL_FreeSurface(window->sdlsurf); |
| 389 | #endif |
| 390 | //printf("SetVideoMode %d %d\n", wp->resize_new_width, wp->resize_new_height); |
| 386 | 391 | if (video_config.yuv_mode == VIDEO_YUV_MODE_NONE) |
| 387 | 392 | window->sdlsurf = SDL_SetVideoMode(wp->resize_new_width, wp->resize_new_height, 0, SDL_SWSURFACE | |
| 388 | 393 | SDL_DOUBLEBUF | SDL_ANYFORMAT | window->extra_flags); |
| r844 | r845 | |
| 419 | 424 | } |
| 420 | 425 | |
| 421 | 426 | //============================================================ |
| 427 | // sdlwindow_clear_surface |
| 428 | // (window thread) |
| 429 | //============================================================ |
| 430 | |
| 431 | static void *sdlwindow_clear_surface_wt(void *param) |
| 432 | { |
| 433 | sdl_window_info *window = sdl_window_list; |
| 434 | worker_param *wp = (worker_param *) param; |
| 435 | int i; |
| 436 | |
| 437 | ASSERT_WINDOW_THREAD(); |
| 438 | |
| 439 | for (i=0;i < wp->times; i++) |
| 440 | { |
| 441 | if (SDL_MUSTLOCK(window->sdlsurf)) SDL_LockSurface(window->sdlsurf); |
| 442 | |
| 443 | memset(window->sdlsurf->pixels, 0, window->sdlsurf->h * window->sdlsurf->pitch); |
| 444 | if (SDL_MUSTLOCK(window->sdlsurf)) SDL_UnlockSurface(window->sdlsurf); |
| 445 | |
| 446 | SDL_Flip(window->sdlsurf); |
| 447 | } |
| 448 | |
| 449 | free(wp); |
| 450 | return NULL; |
| 451 | } |
| 452 | |
| 453 | void sdlwindow_clear_surface(sdl_window_info *window, int times) |
| 454 | { |
| 455 | worker_param wp; |
| 456 | |
| 457 | ASSERT_MAIN_THREAD(); |
| 458 | |
| 459 | clear_worker_param(&wp); |
| 460 | wp.window = window; |
| 461 | wp.times = times; |
| 462 | |
| 463 | execute_async_wait(&sdlwindow_clear_surface_wt, &wp); |
| 464 | } |
| 465 | |
| 466 | //============================================================ |
| 422 | 467 | // sdlwindow_toggle_full_screen |
| 423 | 468 | // (main thread) |
| 424 | 469 | //============================================================ |
| r844 | r845 | |
| 687 | 732 | goto error; |
| 688 | 733 | |
| 689 | 734 | // set the specific view |
| 690 | | sprintf(option, "view%d", index); |
| 735 | sprintf(option, SDLOPTION_VIEW("%d"), index); |
| 691 | 736 | set_starting_view(index, window, options_get_string(mame_options(), option)); |
| 692 | 737 | |
| 693 | 738 | // make the window title |
| r844 | r845 | |
| 734 | 779 | |
| 735 | 780 | if (window->sdlsurf) |
| 736 | 781 | { |
| 782 | #if (SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) < 1300) |
| 783 | // Will be done by SDL on next call to SetVideoMode |
| 737 | 784 | SDL_FreeSurface(window->sdlsurf); |
| 785 | #endif |
| 738 | 786 | window->sdlsurf = NULL; |
| 739 | 787 | } |
| 740 | 788 | |
| r844 | r845 | |
| 1094 | 1142 | SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); |
| 1095 | 1143 | |
| 1096 | 1144 | #if (SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) >= 1210) |
| 1145 | #if (SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) < 1300) |
| 1097 | 1146 | if (options_get_bool(mame_options(), SDLOPTION_WAITVSYNC)) |
| 1098 | 1147 | { |
| 1099 | 1148 | SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1); |
| r844 | r845 | |
| 1103 | 1152 | SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 0); |
| 1104 | 1153 | } |
| 1105 | 1154 | #endif |
| 1155 | #endif |
| 1106 | 1156 | } |
| 1107 | 1157 | |
| 1158 | #ifndef NO_OPENGL |
| 1159 | #ifdef USE_DISPATCH_GL |
| 1160 | if (window->opengl && !dll_loaded) |
| 1161 | { |
| 1162 | /* |
| 1163 | * directfb and and x11 use this env var |
| 1164 | * SDL_VIDEO_GL_DRIVER |
| 1165 | */ |
| 1166 | const char *e; |
| 1167 | e=getenv("SDLMAME_GL_LIB"); |
| 1168 | #ifdef SDLMAME_MACOSX |
| 1169 | /* Vas Crabb: Default GL-lib for MACOSX */ |
| 1170 | if (!e) |
| 1171 | e = "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"; |
| 1172 | #endif |
| 1173 | if (SDL_GL_LoadLibrary(e) != 0) // Load library (default for e==NULL |
| 1174 | { |
| 1175 | fatalerror("Unable to load default library: %s\n", e); |
| 1176 | } |
| 1177 | mame_printf_verbose("Loaded opengl shared library: %s\n", e ? e : "<default>"); |
| 1178 | gl_dispatch = auto_malloc(sizeof(osd_gl_dispatch)); |
| 1179 | dll_loaded=1; |
| 1180 | } |
| 1181 | #endif |
| 1182 | #endif |
| 1108 | 1183 | // create the SDL surface (which creates the window in windowed mode) |
| 1109 | 1184 | if (video_config.yuv_mode == VIDEO_YUV_MODE_NONE) |
| 1110 | 1185 | window->sdlsurf = SDL_SetVideoMode(tempwidth, tempheight, |
| r844 | r845 | |
| 1283 | 1358 | #endif |
| 1284 | 1359 | if (video_config.yuv_mode != VIDEO_YUV_MODE_NONE) |
| 1285 | 1360 | { |
| 1286 | | yuv_lookup_init(window); |
| 1361 | drawsdl_yuv_init(window); |
| 1287 | 1362 | yuv_overlay_init(window); |
| 1288 | 1363 | } |
| 1289 | 1364 | |
src/osd/sdl/sdlmain.c
| r844 | r845 | |
| 92 | 92 | // performance options |
| 93 | 93 | { NULL, NULL, OPTION_HEADER, "PERFORMANCE OPTIONS" }, |
| 94 | 94 | { SDLOPTION_MULTITHREADING ";mt", "0", OPTION_BOOLEAN, "enable multithreading; this enables rendering and blitting on a separate thread" }, |
| 95 | | { "sdlvideofps", "0", OPTION_BOOLEAN, "show sdl video performance" }, |
| 95 | { SDLOPTION_SDLVIDEOFPS, "0", OPTION_BOOLEAN, "show sdl video performance" }, |
| 96 | 96 | |
| 97 | 97 | // video options |
| 98 | 98 | { NULL, NULL, OPTION_HEADER, "VIDEO OPTIONS" }, |
| r844 | r845 | |
| 113 | 113 | |
| 114 | 114 | // OpenGL specific options |
| 115 | 115 | { NULL, NULL, OPTION_HEADER, "OpenGL-SPECIFIC OPTIONS" }, |
| 116 | | { "filter;glfilter;flt", "1", OPTION_BOOLEAN, "enable bilinear filtering on screen output" }, |
| 117 | | { "prescale", "1", 0, "scale screen rendering by this amount in software" }, |
| 118 | | { "gl_forcepow2texture", "0", OPTION_BOOLEAN, "force power of two textures (default no)" }, |
| 119 | | { "gl_notexturerect", "0", OPTION_BOOLEAN, "don't use OpenGL GL_ARB_texture_rectangle (default on)" }, |
| 120 | | { "gl_vbo", "1", OPTION_BOOLEAN, "enable OpenGL VBO, if available (default on)" }, |
| 121 | | { "gl_pbo", "1", OPTION_BOOLEAN, "enable OpenGL PBO, if available (default on)" }, |
| 122 | | { "gl_glsl", "0", OPTION_BOOLEAN, "enable OpenGL GLSL, if available (default off)" }, |
| 123 | | { "gl_glsl_filter", "1", 0, "enable OpenGL GLSL filtering instead of FF filtering 0-plain, 1-bilinear (default)" }, |
| 124 | | { "glsl_shader_mame0", "none", 0, "custom OpenGL GLSL shader set mame bitmap 0" }, |
| 125 | | { "glsl_shader_mame1", "none", 0, "custom OpenGL GLSL shader set mame bitmap 1" }, |
| 126 | | { "glsl_shader_mame2", "none", 0, "custom OpenGL GLSL shader set mame bitmap 2" }, |
| 127 | | { "glsl_shader_mame3", "none", 0, "custom OpenGL GLSL shader set mame bitmap 3" }, |
| 128 | | { "glsl_shader_mame4", "none", 0, "custom OpenGL GLSL shader set mame bitmap 4" }, |
| 129 | | { "glsl_shader_mame5", "none", 0, "custom OpenGL GLSL shader set mame bitmap 5" }, |
| 130 | | { "glsl_shader_mame6", "none", 0, "custom OpenGL GLSL shader set mame bitmap 6" }, |
| 131 | | { "glsl_shader_mame7", "none", 0, "custom OpenGL GLSL shader set mame bitmap 7" }, |
| 132 | | { "glsl_shader_mame8", "none", 0, "custom OpenGL GLSL shader set mame bitmap 8" }, |
| 133 | | { "glsl_shader_mame9", "none", 0, "custom OpenGL GLSL shader set mame bitmap 9" }, |
| 134 | | { "glsl_shader_screen0", "none", 0, "custom OpenGL GLSL shader screen bitmap 0" }, |
| 135 | | { "glsl_shader_screen1", "none", 0, "custom OpenGL GLSL shader screen bitmap 1" }, |
| 136 | | { "glsl_shader_screen2", "none", 0, "custom OpenGL GLSL shader screen bitmap 2" }, |
| 137 | | { "glsl_shader_screen3", "none", 0, "custom OpenGL GLSL shader screen bitmap 3" }, |
| 138 | | { "glsl_shader_screen4", "none", 0, "custom OpenGL GLSL shader screen bitmap 4" }, |
| 139 | | { "glsl_shader_screen5", "none", 0, "custom OpenGL GLSL shader screen bitmap 5" }, |
| 140 | | { "glsl_shader_screen6", "none", 0, "custom OpenGL GLSL shader screen bitmap 6" }, |
| 141 | | { "glsl_shader_screen7", "none", 0, "custom OpenGL GLSL shader screen bitmap 7" }, |
| 142 | | { "glsl_shader_screen8", "none", 0, "custom OpenGL GLSL shader screen bitmap 8" }, |
| 143 | | { "glsl_shader_screen9", "none", 0, "custom OpenGL GLSL shader screen bitmap 9" }, |
| 144 | | { "gl_glsl_vid_attr", "1", OPTION_BOOLEAN, "enable OpenGL GLSL handling of brightness and contrast. Better RGB game performance for free. (default)" }, |
| 116 | { SDLOPTION_FILTER ";glfilter;flt", "1", OPTION_BOOLEAN, "enable bilinear filtering on screen output" }, |
| 117 | { SDLOPTION_PRESCALE, "1", 0, "scale screen rendering by this amount in software" }, |
| 118 | { SDLOPTION_GL_FORCEPOW2TEXTURE, "0", OPTION_BOOLEAN, "force power of two textures (default no)" }, |
| 119 | { SDLOPTION_GL_NOTEXTURERECT, "0", OPTION_BOOLEAN, "don't use OpenGL GL_ARB_texture_rectangle (default on)" }, |
| 120 | { SDLOPTION_GL_VBO, "1", OPTION_BOOLEAN, "enable OpenGL VBO, if available (default on)" }, |
| 121 | { SDLOPTION_GL_PBO, "1", OPTION_BOOLEAN, "enable OpenGL PBO, if available (default on)" }, |
| 122 | { SDLOPTION_GL_GLSL, "0", OPTION_BOOLEAN, "enable OpenGL GLSL, if available (default off)" }, |
| 123 | { SDLOPTION_GLSL_FILTER, "1", 0, "enable OpenGL GLSL filtering instead of FF filtering 0-plain, 1-bilinear (default)" }, |
| 124 | { SDLOPTION_SHADER_MAME("0"), "none", 0, "custom OpenGL GLSL shader set mame bitmap 0" }, |
| 125 | { SDLOPTION_SHADER_MAME("1"), "none", 0, "custom OpenGL GLSL shader set mame bitmap 1" }, |
| 126 | { SDLOPTION_SHADER_MAME("2"), "none", 0, "custom OpenGL GLSL shader set mame bitmap 2" }, |
| 127 | { SDLOPTION_SHADER_MAME("3"), "none", 0, "custom OpenGL GLSL shader set mame bitmap 3" }, |
| 128 | { SDLOPTION_SHADER_MAME("4"), "none", 0, "custom OpenGL GLSL shader set mame bitmap 4" }, |
| 129 | { SDLOPTION_SHADER_MAME("5"), "none", 0, "custom OpenGL GLSL shader set mame bitmap 5" }, |
| 130 | { SDLOPTION_SHADER_MAME("6"), "none", 0, "custom OpenGL GLSL shader set mame bitmap 6" }, |
| 131 | { SDLOPTION_SHADER_MAME("7"), "none", 0, "custom OpenGL GLSL shader set mame bitmap 7" }, |
| 132 | { SDLOPTION_SHADER_MAME("8"), "none", 0, "custom OpenGL GLSL shader set mame bitmap 8" }, |
| 133 | { SDLOPTION_SHADER_MAME("9"), "none", 0, "custom OpenGL GLSL shader set mame bitmap 9" }, |
| 134 | { SDLOPTION_SHADER_SCREEN("0"), "none", 0, "custom OpenGL GLSL shader screen bitmap 0" }, |
| 135 | { SDLOPTION_SHADER_SCREEN("1"), "none", 0, "custom OpenGL GLSL shader screen bitmap 1" }, |
| 136 | { SDLOPTION_SHADER_SCREEN("2"), "none", 0, "custom OpenGL GLSL shader screen bitmap 2" }, |
| 137 | { SDLOPTION_SHADER_SCREEN("3"), "none", 0, "custom OpenGL GLSL shader screen bitmap 3" }, |
| 138 | { SDLOPTION_SHADER_SCREEN("4"), "none", 0, "custom OpenGL GLSL shader screen bitmap 4" }, |
| 139 | { SDLOPTION_SHADER_SCREEN("5"), "none", 0, "custom OpenGL GLSL shader screen bitmap 5" }, |
| 140 | { SDLOPTION_SHADER_SCREEN("6"), "none", 0, "custom OpenGL GLSL shader screen bitmap 6" }, |
| 141 | { SDLOPTION_SHADER_SCREEN("7"), "none", 0, "custom OpenGL GLSL shader screen bitmap 7" }, |
| 142 | { SDLOPTION_SHADER_SCREEN("8"), "none", 0, "custom OpenGL GLSL shader screen bitmap 8" }, |
| 143 | { SDLOPTION_SHADER_SCREEN("9"), "none", 0, "custom OpenGL GLSL shader screen bitmap 9" }, |
| 144 | { SDLOPTION_GL_GLSL_VID_ATTR, "1", OPTION_BOOLEAN, "enable OpenGL GLSL handling of brightness and contrast. Better RGB game performance for free. (default)" }, |
| 145 | 145 | |
| 146 | 146 | // per-window options |
| 147 | 147 | { NULL, NULL, OPTION_HEADER, "PER-WINDOW VIDEO OPTIONS" }, |
| 148 | | { "screen", "auto", 0, "explicit name of the first screen; 'auto' here will try to make a best guess" }, |
| 149 | | { SDLOPTION_ASPECT ";screen_aspect", "auto", 0, "aspect ratio for all screens; 'auto' here will try to make a best guess" }, |
| 150 | | { "resolution;r", "auto", 0, "preferred resolution for all screens; format is <width>x<height>[@<refreshrate>] or 'auto'" }, |
| 151 | | { "view", "auto", 0, "preferred view for all screens" }, |
| 148 | { SDLOPTION_SCREEN(""), "auto", 0, "explicit name of the first screen; 'auto' here will try to make a best guess" }, |
| 149 | { SDLOPTION_ASPECT("") ";screen_aspect", "auto", 0, "aspect ratio for all screens; 'auto' here will try to make a best guess" }, |
| 150 | { SDLOPTION_RESOLUTION("") ";r", "auto", 0, "preferred resolution for all screens; format is <width>x<height>[@<refreshrate>] or 'auto'" }, |
| 151 | { SDLOPTION_VIEW(""), "auto", 0, "preferred view for all screens" }, |
| 152 | 152 | |
| 153 | | { "screen0", "auto", 0, "explicit name of the first screen; 'auto' here will try to make a best guess" }, |
| 154 | | { "aspect0", "auto", 0, "aspect ratio of the first screen; 'auto' here will try to make a best guess" }, |
| 155 | | { "resolution0;r0", "auto", 0, "preferred resolution of the first screen; format is <width>x<height>[@<refreshrate>] or 'auto'" }, |
| 156 | | { "view0", "auto", 0, "preferred view for the first screen" }, |
| 153 | { SDLOPTION_SCREEN("0"), "auto", 0, "explicit name of the first screen; 'auto' here will try to make a best guess" }, |
| 154 | { SDLOPTION_ASPECT("0"), "auto", 0, "aspect ratio of the first screen; 'auto' here will try to make a best guess" }, |
| 155 | { SDLOPTION_RESOLUTION("0") ";r0", "auto", 0, "preferred resolution of the first screen; format is <width>x<height>[@<refreshrate>] or 'auto'" }, |
| 156 | { SDLOPTION_VIEW("0"), "auto", 0, "preferred view for the first screen" }, |
| 157 | 157 | |
| 158 | | { "screen1", "auto", 0, "explicit name of the second screen; 'auto' here will try to make a best guess" }, |
| 159 | | { "aspect1", "auto", 0, "aspect ratio of the second screen; 'auto' here will try to make a best guess" }, |
| 160 | | { "resolution1;r1", "auto", 0, "preferred resolution of the second screen; format is <width>x<height>[@<refreshrate>] or 'auto'" }, |
| 161 | | { "view1", "auto", 0, "preferred view for the second screen" }, |
| 158 | { SDLOPTION_SCREEN("1"), "auto", 0, "explicit name of the second screen; 'auto' here will try to make a best guess" }, |
| 159 | { SDLOPTION_ASPECT("1"), "auto", 0, "aspect ratio of the second screen; 'auto' here will try to make a best guess" }, |
| 160 | { SDLOPTION_RESOLUTION("1") ";r1", "auto", 0, "preferred resolution of the second screen; format is <width>x<height>[@<refreshrate>] or 'auto'" }, |
| 161 | { SDLOPTION_VIEW("1"), "auto", 0, "preferred view for the second screen" }, |
| 162 | 162 | |
| 163 | | { "screen2", "auto", 0, "explicit name of the third screen; 'auto' here will try to make a best guess" }, |
| 164 | | { "aspect2", "auto", 0, "aspect ratio of the third screen; 'auto' here will try to make a best guess" }, |
| 165 | | { "resolution2;r2", "auto", 0, "preferred resolution of the third screen; format is <width>x<height>[@<refreshrate>] or 'auto'" }, |
| 166 | | { "view2", "auto", 0, "preferred view for the third screen" }, |
| 163 | { SDLOPTION_SCREEN("2"), "auto", 0, "explicit name of the third screen; 'auto' here will try to make a best guess" }, |
| 164 | { SDLOPTION_ASPECT("2"), "auto", 0, "aspect ratio of the third screen; 'auto' here will try to make a best guess" }, |
| 165 | { SDLOPTION_RESOLUTION("2") ";r2", "auto", 0, "preferred resolution of the third screen; format is <width>x<height>[@<refreshrate>] or 'auto'" }, |
| 166 | { SDLOPTION_VIEW("2"), "auto", 0, "preferred view for the third screen" }, |
| 167 | 167 | |
| 168 | | { "screen3", "auto", 0, "explicit name of the fourth screen; 'auto' here will try to make a best guess" }, |
| 169 | | { "aspect3", "auto", 0, "aspect ratio of the fourth screen; 'auto' here will try to make a best guess" }, |
| 170 | | { "resolution3;r3", "auto", 0, "preferred resolution of the fourth screen; format is <width>x<height>[@<refreshrate>] or 'auto'" }, |
| 171 | | { "view3", "auto", 0, "preferred view for the fourth screen" }, |
| 168 | { SDLOPTION_SCREEN("3"), "auto", 0, "explicit name of the fourth screen; 'auto' here will try to make a best guess" }, |
| 169 | { SDLOPTION_ASPECT("3"), "auto", 0, "aspect ratio of the fourth screen; 'auto' here will try to make a best guess" }, |
| 170 | { SDLOPTION_RESOLUTION("3") ";r3", "auto", 0, "preferred resolution of the fourth screen; format is <width>x<height>[@<refreshrate>] or 'auto'" }, |
| 171 | { SDLOPTION_VIEW("3"), "auto", 0, "preferred view for the fourth screen" }, |
| 172 | 172 | |
| 173 | 173 | // full screen options |
| 174 | 174 | { NULL, NULL, OPTION_HEADER, "FULL SCREEN OPTIONS" }, |
| r844 | r845 | |
| 187 | 187 | { SDLOPTION_JOYSTICK ";joy", "0", OPTION_BOOLEAN, "enable joystick input" }, |
| 188 | 188 | { SDLOPTION_STEADYKEY ";steady", "0", OPTION_BOOLEAN, "enable steadykey support" }, |
| 189 | 189 | { SDLOPTION_A2D_DEADZONE ";a2d", "0.3", 0, "minimal analog value for digital input" }, |
| 190 | | { "digital", "none", 0, "mark certain joysticks or axes as digital (none|all|j<N>*|j<N>a<M>[,...])" }, |
| 191 | 190 | |
| 192 | | { NULL, NULL, OPTION_HEADER, "AUTOMATIC DEVICE SELECTION OPTIONS" }, |
| 193 | | { "paddle_device;paddle", "keyboard", 0, "enable (keyboard|mouse|joystick) if a paddle control is present" }, |
| 194 | | { "adstick_device;adstick", "keyboard", 0, "enable (keyboard|mouse|joystick) if an analog joystick control is present" }, |
| 195 | | { "pedal_device;pedal", "keyboard", 0, "enable (keyboard|mouse|joystick) if a pedal control is present" }, |
| 196 | | { "dial_device;dial", "keyboard", 0, "enable (keyboard|mouse|joystick) if a dial control is present" }, |
| 197 | | { "trackball_device;trackball", "keyboard", 0, "enable (keyboard|mouse|joystick) if a trackball control is present" }, |
| 198 | | { "lightgun_device", "keyboard", 0, "enable (keyboard|mouse|joystick) if a lightgun control is present" }, |
| 199 | | { "positional_device", "keyboard", 0, "enable (keyboard|mouse|joystick) if a positional control is present" }, |
| 200 | 191 | #ifdef MESS |
| 201 | 192 | { "mouse_device", "mouse", 0, "enable (keyboard|mouse|joystick) if a mouse control is present" }, |
| 202 | 193 | #endif |