src/osd/sdl/drawogl.c
| r3234 | r3235 | |
| 269 | 269 | G = clip(( 298 * Y - 298 * 16 - 100 * Cb + 100 * 128 - 208 * Cr + 208 * 128 + 128) >> 8) |
| 270 | 270 | B = clip(( 298 * Y - 298 * 16 + 516 * Cb - 516 * 128 + 128) >> 8) |
| 271 | 271 | */ |
| 272 | | int r, g, b, common; |
| 272 | //int r, g, b, common; |
| 273 | unsigned int r, g, b, common; |
| 273 | 274 | |
| 274 | | common = 298 * y - 298 * 16; |
| 275 | | r = (common + 409 * cr - 409 * 128 + 128) >> 8; |
| 276 | | g = (common - 100 * cb + 100 * 128 - 208 * cr + 208 * 128 + 128) >> 8; |
| 277 | | b = (common + 516 * cb - 516 * 128 + 128) >> 8; |
| 275 | common = 298 * y - 56992; |
| 276 | r = (common + 409 * cr); |
| 277 | g = (common - 100 * cb - 208 * cr + 91776); |
| 278 | b = (common + 516 * cb - 13696); |
| 278 | 279 | |
| 279 | | if (r < 0) r = 0; |
| 280 | | else if (r > 255) r = 255; |
| 281 | | if (g < 0) g = 0; |
| 282 | | else if (g > 255) g = 255; |
| 283 | | if (b < 0) b = 0; |
| 284 | | else if (b > 255) b = 255; |
| 280 | if ((int) r < 0) r = 0; |
| 281 | if ((int) g < 0) g = 0; |
| 282 | if ((int) b < 0) b = 0; |
| 285 | 283 | |
| 286 | | return MAKE_RGB(r, g, b); |
| 284 | /* MAME_RGB does upper clamping */ |
| 285 | |
| 286 | return MAKE_RGB(r >> 8, g >> 8, b >> 8); |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | |
src/osd/sdl/output.c
| r3234 | r3235 | |
| 29 | 29 | |
| 30 | 30 | #define SDLMAME_OUTPUT "/tmp/sdlmame_out" |
| 31 | 31 | |
| 32 | /* |
| 33 | * Using long/int should be sufficient on all |
| 34 | * architectures. |
| 35 | */ |
| 36 | |
| 37 | |
| 38 | #ifdef PTR64 |
| 39 | #define PID_FMT "%ld" |
| 40 | #define PID_CAST long |
| 41 | #else |
| 42 | #define PID_FMT "%d" |
| 43 | #define PID_CAST int |
| 44 | #endif |
| 45 | |
| 32 | 46 | //============================================================ |
| 33 | 47 | // TYPEDEFS |
| 34 | 48 | //============================================================ |
| r3234 | r3235 | |
| 47 | 61 | static void notifier_callback(const char *outname, INT32 value, void *param); |
| 48 | 62 | |
| 49 | 63 | //============================================================ |
| 64 | // osd_get_pid |
| 65 | //============================================================ |
| 66 | |
| 67 | PID_CAST osd_getpid(void) |
| 68 | { |
| 69 | return (PID_CAST) getpid(); |
| 70 | } |
| 71 | |
| 72 | //============================================================ |
| 50 | 73 | // sdloutput_init |
| 51 | 74 | //============================================================ |
| 52 | 75 | |
| r3234 | r3235 | |
| 68 | 91 | output = fdopen(fildes, "w"); |
| 69 | 92 | |
| 70 | 93 | mame_printf_verbose("ouput: opened output notifier file %s\n", SDLMAME_OUTPUT); |
| 71 | | fprintf(output, "MAME %d START %s\n", getpid(), machine->gamedrv->name); |
| 94 | fprintf(output, "MAME " PID_FMT " START %s\n", osd_getpid(), machine->gamedrv->name); |
| 72 | 95 | fflush(output); |
| 73 | 96 | } |
| 74 | 97 | |
| r3234 | r3235 | |
| 84 | 107 | { |
| 85 | 108 | if (output != NULL) |
| 86 | 109 | { |
| 87 | | fprintf(output, "MAME %d STOP %s\n", getpid(), machine->gamedrv->name); |
| 110 | fprintf(output, "MAME " PID_FMT " STOP %s\n", osd_getpid(), machine->gamedrv->name); |
| 88 | 111 | fflush(output); |
| 89 | 112 | fclose(output); |
| 90 | 113 | output = NULL; |
| r3234 | r3235 | |
| 100 | 123 | { |
| 101 | 124 | if (output != NULL) |
| 102 | 125 | { |
| 103 | | fprintf(output, "OUT %d %s %d\n", getpid(), outname, value); |
| 126 | fprintf(output, "OUT " PID_FMT " %s %d\n", osd_getpid(), outname, value); |
| 104 | 127 | fflush(output); |
| 105 | 128 | } |
| 106 | 129 | } |
src/osd/sdl/texcopy.c
| r3234 | r3235 | |
| 74 | 74 | *dst++ = ycc_to_rgb(srcpix0 >> 8, cb, cr); |
| 75 | 75 | *dst++ = ycc_to_rgb(srcpix1 >> 8, cb, cr); |
| 76 | 76 | } |
| 77 | | break; |
| 78 | 77 | |
| 79 | 78 | // always fill non-wrapping textures with an extra pixel on the right |
| 80 | 79 | #if 0 |
| r3234 | r3235 | |
| 84 | 83 | } |
| 85 | 84 | } |
| 86 | 85 | |
| 86 | #define CLSH(x) (((int) x < 0) ? 0 : x >> 8) |
| 87 | |
| 87 | 88 | static void texcopy_yuv16_paletted(texture_info *texture, const render_texinfo *texsource) |
| 88 | 89 | { |
| 89 | 90 | int x, y; |
| r3234 | r3235 | |
| 107 | 108 | UINT16 srcpix1 = *src++; |
| 108 | 109 | UINT8 cb = srcpix0 & 0xff; |
| 109 | 110 | UINT8 cr = srcpix1 & 0xff; |
| 110 | | |
| 111 | |
| 112 | #if 0 |
| 111 | 113 | *dst++ = ycc_to_rgb(texsource->palette[0x000 + (srcpix0 >> 8)], cb, cr); |
| 112 | 114 | *dst++ = ycc_to_rgb(texsource->palette[0x000 + (srcpix1 >> 8)], cb, cr); |
| 115 | #else |
| 116 | unsigned int r1, r2, g1, g2, b1, b2; |
| 117 | unsigned int y1 = texsource->palette[(srcpix0 >> 8)] * 298; |
| 118 | unsigned int y2 = texsource->palette[(srcpix1 >> 8)] * 298; |
| 119 | |
| 120 | r1 = r2 = 409 * cr - 56992; |
| 121 | g1 = g2 = - 100 * cb - 208 * cr + 34784; |
| 122 | b1 = b2 = + 516 * cb - 70688; |
| 123 | r1 += y1; g1 += y1; b1 += y1; |
| 124 | r2 += y2; g2 += y2; b2 += y2; |
| 125 | *dst++ = MAKE_RGB(CLSH(r1), CLSH(g1), CLSH(b1)); |
| 126 | *dst++ = MAKE_RGB(CLSH(r2), CLSH(g2), CLSH(b2)); |
| 127 | #endif |
| 113 | 128 | } |
| 114 | | break; |
| 115 | 129 | |
| 116 | 130 | // always fill non-wrapping textures with an extra pixel on the right |
| 117 | 131 | #if 0 |
| r3234 | r3235 | |
| 120 | 134 | #endif |
| 121 | 135 | } |
| 122 | 136 | } |
| 137 | #undef CLSH |
| 138 | |
| 123 | 139 | #endif |
| 124 | 140 | |
| 125 | 141 | #else // recursive include |
src/osd/sdl/input.c
| r3234 | r3235 | |
| 684 | 684 | { |
| 685 | 685 | sprintf(tempname, "NC%d", stick); |
| 686 | 686 | devinfo = generic_device_alloc(&joystick_list, tempname); |
| 687 | | devinfo->device = input_device_add(DEVICE_CLASS_JOYSTICK, devinfo->name, devinfo); |
| 687 | devinfo->device = input_device_add(machine, DEVICE_CLASS_JOYSTICK, devinfo->name, devinfo); |
| 688 | 688 | } |
| 689 | 689 | } |
| 690 | 690 | else |
| 691 | 691 | { |
| 692 | 692 | devinfo = generic_device_alloc(&joystick_list, joy_map[stick].name); |
| 693 | | devinfo->device = input_device_add(DEVICE_CLASS_JOYSTICK, devinfo->name, devinfo); |
| 693 | devinfo->device = input_device_add(machine, DEVICE_CLASS_JOYSTICK, devinfo->name, devinfo); |
| 694 | 694 | } |
| 695 | 695 | |
| 696 | 696 | |
| r3234 | r3235 | |
| 926 | 926 | // SDL 1.2 only has 1 keyboard (1.3+ will have multiple, this must be revisited then) |
| 927 | 927 | // add it now |
| 928 | 928 | devinfo = generic_device_alloc(&keyboard_list, "System keyboard"); |
| 929 | | devinfo->device = input_device_add(DEVICE_CLASS_KEYBOARD, devinfo->name, devinfo); |
| 929 | devinfo->device = input_device_add(machine, DEVICE_CLASS_KEYBOARD, devinfo->name, devinfo); |
| 930 | 930 | |
| 931 | 931 | // populate it |
| 932 | 932 | for (keynum = 0; sdl_key_trans_table[keynum].mame_key >= 0; keynum++) |
| r3234 | r3235 | |
| 945 | 945 | |
| 946 | 946 | // SDL 1.2 has only 1 mouse - 1.3+ will also change that, so revisit this then |
| 947 | 947 | devinfo = generic_device_alloc(&mouse_list, "System mouse"); |
| 948 | | devinfo->device = input_device_add(DEVICE_CLASS_MOUSE, devinfo->name, devinfo); |
| 948 | devinfo->device = input_device_add(machine, DEVICE_CLASS_MOUSE, devinfo->name, devinfo); |
| 949 | 949 | |
| 950 | 950 | mouse_enabled = options_get_bool(mame_options(), OPTION_MOUSE); |
| 951 | 951 | |
| r3234 | r3235 | |
| 1131 | 1131 | devinfo = generic_device_find_index(joystick_list, joy_logical[event.jhat.which]); |
| 1132 | 1132 | if (devinfo) |
| 1133 | 1133 | { |
| 1134 | | // FIXME: change == to x & y != 0 |
| 1135 | | if (event.jhat.value == SDL_HAT_UP) |
| 1134 | if (event.jhat.value & SDL_HAT_UP) |
| 1136 | 1135 | { |
| 1137 | 1136 | devinfo->joystick.hatsU[event.jhat.hat] = 0x80; |
| 1138 | 1137 | } |
| r3234 | r3235 | |
| 1140 | 1139 | { |
| 1141 | 1140 | devinfo->joystick.hatsU[event.jhat.hat] = 0; |
| 1142 | 1141 | } |
| 1143 | | if (event.jhat.value == SDL_HAT_DOWN) |
| 1142 | if (event.jhat.value & SDL_HAT_DOWN) |
| 1144 | 1143 | { |
| 1145 | 1144 | devinfo->joystick.hatsD[event.jhat.hat] = 0x80; |
| 1146 | 1145 | } |
| r3234 | r3235 | |
| 1148 | 1147 | { |
| 1149 | 1148 | devinfo->joystick.hatsD[event.jhat.hat] = 0; |
| 1150 | 1149 | } |
| 1151 | | if (event.jhat.value == SDL_HAT_LEFT) |
| 1150 | if (event.jhat.value & SDL_HAT_LEFT) |
| 1152 | 1151 | { |
| 1153 | 1152 | devinfo->joystick.hatsL[event.jhat.hat] = 0x80; |
| 1154 | 1153 | } |
| r3234 | r3235 | |
| 1156 | 1155 | { |
| 1157 | 1156 | devinfo->joystick.hatsL[event.jhat.hat] = 0; |
| 1158 | 1157 | } |
| 1159 | | if (event.jhat.value == SDL_HAT_RIGHT) |
| 1158 | if (event.jhat.value & SDL_HAT_RIGHT) |
| 1160 | 1159 | { |
| 1161 | 1160 | devinfo->joystick.hatsR[event.jhat.hat] = 0x80; |
| 1162 | 1161 | } |
| r3234 | r3235 | |
| 1189 | 1188 | |
| 1190 | 1189 | if (window != NULL && window->xy_to_render_target(window, event.button.x,event.button.y, &cx, &cy) ) |
| 1191 | 1190 | { |
| 1192 | | ui_input_push_mouse_click_event(machine, window->target, cx, cy); |
| 1191 | ui_input_push_mouse_down_event(machine, window->target, cx, cy); |
| 1193 | 1192 | // FIXME Parameter ? |
| 1194 | 1193 | if ((click-last_click < 250) |
| 1195 | 1194 | && (cx >= last_x - 4 && cx <= last_x + 4) |
| r3234 | r3235 | |
| 1210 | 1209 | case SDL_MOUSEBUTTONUP: |
| 1211 | 1210 | devinfo = mouse_list; |
| 1212 | 1211 | devinfo->mouse.buttons[event.button.button-1] = 0; |
| 1212 | |
| 1213 | if (event.button.button == 1) |
| 1214 | { |
| 1215 | int cx, cy; |
| 1216 | sdl_window_info *window = GET_WINDOW(&event.button); |
| 1217 | |
| 1218 | if (window != NULL && window->xy_to_render_target(window, event.button.x,event.button.y, &cx, &cy) ) |
| 1219 | { |
| 1220 | ui_input_push_mouse_up_event(machine, window->target, cx, cy); |
| 1221 | } |
| 1222 | } |
| 1213 | 1223 | break; |
| 1214 | 1224 | case SDL_MOUSEMOTION: |
| 1215 | 1225 | devinfo = mouse_list; |
src/osd/sdl/debugosx.c
| r3234 | r3235 | |
| 2932 | 2932 | { |
| 2933 | 2933 | active_address = debug_view_get_property_UINT32(info->view[0].view, DVP_DASM_ACTIVE_ADDRESS); |
| 2934 | 2934 | sprintf(command, "go %X", active_address); |
| 2935 | | debug_console_execute_command(command, 1); |
| 2935 | debug_console_execute_command(Machine, command, 1); |
| 2936 | 2936 | } |
| 2937 | 2937 | return 1; |
| 2938 | 2938 | |
| r3234 | r3235 | |
| 2966 | 2966 | sprintf(command, "bpset %X", BYTE2ADDR(active_address, cpuinfo, ADDRESS_SPACE_PROGRAM)); |
| 2967 | 2967 | else |
| 2968 | 2968 | sprintf(command, "bpclear %X", bp_num); |
| 2969 | | debug_console_execute_command(command, 1); |
| 2969 | debug_console_execute_command(Machine, command, 1); |
| 2970 | 2970 | } |
| 2971 | 2971 | return 1; |
| 2972 | 2972 | } |
| r3234 | r3235 | |
| 3026 | 3026 | { |
| 3027 | 3027 | active_address = debug_view_get_property_UINT32(info->view[0].view, DVP_DASM_ACTIVE_ADDRESS); |
| 3028 | 3028 | sprintf(command, "go %X", active_address); |
| 3029 | | debug_console_execute_command(command, 1); |
| 3029 | debug_console_execute_command(Machine, command, 1); |
| 3030 | 3030 | } |
| 3031 | 3031 | return 1; |
| 3032 | 3032 | |
| r3234 | r3235 | |
| 3060 | 3060 | sprintf(command, "bpset %X", BYTE2ADDR(active_address, cpuinfo, ADDRESS_SPACE_PROGRAM)); |
| 3061 | 3061 | else |
| 3062 | 3062 | sprintf(command, "bpclear %X", bp_num); |
| 3063 | | debug_console_execute_command(command, 1); |
| 3063 | debug_console_execute_command(Machine, command, 1); |
| 3064 | 3064 | } |
| 3065 | 3065 | return 1; |
| 3066 | 3066 | } |
| r3234 | r3235 | |
| 3380 | 3380 | |
| 3381 | 3381 | // otherwise, just process the command |
| 3382 | 3382 | else |
| 3383 | | debug_console_execute_command(string, 1); |
| 3383 | debug_console_execute_command(Machine, string, 1); |
| 3384 | 3384 | |
| 3385 | 3385 | // clear the edit text box |
| 3386 | 3386 | SetControlData(info->editwnd, kControlEntireControl, kControlEditTextTextTag, 0, &buffer); |