Previous 15994 Revisions Next

r3235 Friday 12th September, 2008 at 03:30:23 UTC by R. Belmont
[SDLMESS] Sync with SDLMAME 0.127u3.
[src/osd/sdl]debugosx.c debugwin.c drawogl.c input.c output.c sdl.mak texcopy.c

src/osd/sdl/drawogl.c
r3234r3235
269269        G = clip(( 298 * Y - 298 * 16 - 100 * Cb + 100 * 128 - 208 * Cr + 208 * 128 + 128) >> 8)
270270        B = clip(( 298 * Y - 298 * 16 + 516 * Cb - 516 * 128                        + 128) >> 8)
271271    */
272   int r, g, b, common;
272   //int r, g, b, common;
273   unsigned int r, g, b, common;
273274
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);
278279
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;
285283
286   return MAKE_RGB(r, g, b);
284   /* MAME_RGB does upper clamping */
285
286   return MAKE_RGB(r >> 8, g >> 8, b >> 8);
287287}
288288
289289
src/osd/sdl/output.c
r3234r3235
2929
3030#define SDLMAME_OUTPUT   "/tmp/sdlmame_out"
3131
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
3246//============================================================
3347//  TYPEDEFS
3448//============================================================
r3234r3235
4761static void notifier_callback(const char *outname, INT32 value, void *param);
4862
4963//============================================================
64//  osd_get_pid
65//============================================================
66
67PID_CAST osd_getpid(void)
68{
69   return (PID_CAST) getpid();
70}
71
72//============================================================
5073//  sdloutput_init
5174//============================================================
5275
r3234r3235
6891      output = fdopen(fildes, "w");
6992     
7093      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);
7295      fflush(output);
7396   }
7497   
r3234r3235
84107{
85108   if (output != NULL)
86109   {
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);
88111      fflush(output);
89112      fclose(output);
90113      output = NULL;
r3234r3235
100123{
101124   if (output != NULL)
102125   {
103      fprintf(output, "OUT %d %s %d\n", getpid(), outname, value);
126      fprintf(output, "OUT " PID_FMT " %s %d\n", osd_getpid(), outname, value);
104127      fflush(output);
105128   }
106129}
src/osd/sdl/sdl.mak
r3234r3235
294294
295295CFLAGS += `sdl-config --cflags`
296296LIBS += `sdl-config --libs`
297
298# to avoid name clash of '_brk'
299$(OBJ)/emu/cpu/h6280/6280dasm.o : CDEFS += -D__STRICT_ANSI__
297300endif # OS2
298301
299302TOOLS += \
src/osd/sdl/texcopy.c
r3234r3235
7474         *dst++ = ycc_to_rgb(srcpix0 >> 8, cb, cr);
7575         *dst++ = ycc_to_rgb(srcpix1 >> 8, cb, cr);
7676      }
77      break;
7877     
7978      // always fill non-wrapping textures with an extra pixel on the right
8079      #if 0
r3234r3235
8483   }
8584}
8685
86#define CLSH(x)      (((int) x < 0) ? 0 : x >> 8)
87
8788static void texcopy_yuv16_paletted(texture_info *texture, const render_texinfo *texsource)
8889{
8990   int x, y;
r3234r3235
107108         UINT16 srcpix1 = *src++;
108109         UINT8 cb = srcpix0 & 0xff;
109110         UINT8 cr = srcpix1 & 0xff;
110   
111         
112#if 0   
111113         *dst++ = ycc_to_rgb(texsource->palette[0x000 + (srcpix0 >> 8)], cb, cr);
112114         *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
113128      }
114      break;
115129     
116130      // always fill non-wrapping textures with an extra pixel on the right
117131      #if 0
r3234r3235
120134      #endif
121135   }
122136}
137#undef CLSH
138
123139#endif
124140
125141#else // recursive include
src/osd/sdl/input.c
r3234r3235
684684         {
685685            sprintf(tempname, "NC%d", stick);
686686            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);
688688         }
689689      }
690690      else
691691      {
692692         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);
694694      }
695695     
696696
r3234r3235
926926   // SDL 1.2 only has 1 keyboard (1.3+ will have multiple, this must be revisited then)
927927   // add it now
928928   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);
930930
931931   // populate it
932932   for (keynum = 0; sdl_key_trans_table[keynum].mame_key >= 0; keynum++)
r3234r3235
945945
946946   // SDL 1.2 has only 1 mouse - 1.3+ will also change that, so revisit this then
947947   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);
949949
950950   mouse_enabled = options_get_bool(mame_options(), OPTION_MOUSE);
951951   
r3234r3235
11311131         devinfo = generic_device_find_index(joystick_list, joy_logical[event.jhat.which]);
11321132         if (devinfo)
11331133         {
1134            // FIXME: change == to x & y != 0
1135            if (event.jhat.value == SDL_HAT_UP)
1134            if (event.jhat.value & SDL_HAT_UP)
11361135            {
11371136               devinfo->joystick.hatsU[event.jhat.hat] = 0x80;
11381137            }
r3234r3235
11401139            {
11411140               devinfo->joystick.hatsU[event.jhat.hat] = 0;
11421141            }
1143            if (event.jhat.value == SDL_HAT_DOWN)
1142            if (event.jhat.value & SDL_HAT_DOWN)
11441143            {
11451144               devinfo->joystick.hatsD[event.jhat.hat] = 0x80;
11461145            }
r3234r3235
11481147            {
11491148               devinfo->joystick.hatsD[event.jhat.hat] = 0;
11501149            }
1151            if (event.jhat.value == SDL_HAT_LEFT)
1150            if (event.jhat.value & SDL_HAT_LEFT)
11521151            {
11531152               devinfo->joystick.hatsL[event.jhat.hat] = 0x80;
11541153            }
r3234r3235
11561155            {
11571156               devinfo->joystick.hatsL[event.jhat.hat] = 0;
11581157            }
1159            if (event.jhat.value == SDL_HAT_RIGHT)
1158            if (event.jhat.value & SDL_HAT_RIGHT)
11601159            {
11611160               devinfo->joystick.hatsR[event.jhat.hat] = 0x80;
11621161            }
r3234r3235
11891188           
11901189            if (window != NULL && window->xy_to_render_target(window, event.button.x,event.button.y, &cx, &cy) )
11911190            {
1192               ui_input_push_mouse_click_event(machine, window->target, cx, cy);
1191               ui_input_push_mouse_down_event(machine, window->target, cx, cy);
11931192               // FIXME Parameter ?
11941193               if ((click-last_click < 250)
11951194                     && (cx >= last_x - 4 && cx <= last_x  + 4)
r3234r3235
12101209      case SDL_MOUSEBUTTONUP:
12111210         devinfo = mouse_list;
12121211         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         }
12131223         break;
12141224      case SDL_MOUSEMOTION:
12151225         devinfo = mouse_list;
src/osd/sdl/debugwin.c
r3234r3235
406406   if(!str[0])
407407      debug_cpu_single_step(1);
408408   else
409      debug_console_execute_command(str, 1);
409      debug_console_execute_command(Machine, str, 1);
410410}
411411
412412static void debugmain_destroy(GtkObject *obj, gpointer user_data)
src/osd/sdl/debugosx.c
r3234r3235
29322932         {
29332933            active_address = debug_view_get_property_UINT32(info->view[0].view, DVP_DASM_ACTIVE_ADDRESS);
29342934            sprintf(command, "go %X", active_address);
2935            debug_console_execute_command(command, 1);
2935            debug_console_execute_command(Machine, command, 1);
29362936         }
29372937         return 1;
29382938
r3234r3235
29662966               sprintf(command, "bpset %X", BYTE2ADDR(active_address, cpuinfo, ADDRESS_SPACE_PROGRAM));
29672967            else
29682968               sprintf(command, "bpclear %X", bp_num);
2969            debug_console_execute_command(command, 1);
2969            debug_console_execute_command(Machine, command, 1);
29702970         }
29712971         return 1;
29722972   }
r3234r3235
30263026            {
30273027               active_address = debug_view_get_property_UINT32(info->view[0].view, DVP_DASM_ACTIVE_ADDRESS);
30283028               sprintf(command, "go %X", active_address);
3029               debug_console_execute_command(command, 1);
3029               debug_console_execute_command(Machine, command, 1);
30303030            }
30313031            return 1;
30323032         
r3234r3235
30603060                  sprintf(command, "bpset %X", BYTE2ADDR(active_address, cpuinfo, ADDRESS_SPACE_PROGRAM));
30613061               else
30623062                  sprintf(command, "bpclear %X", bp_num);
3063               debug_console_execute_command(command, 1);
3063               debug_console_execute_command(Machine, command, 1);
30643064            }
30653065            return 1;
30663066      }
r3234r3235
33803380
33813381   // otherwise, just process the command
33823382   else
3383      debug_console_execute_command(string, 1);
3383      debug_console_execute_command(Machine, string, 1);
33843384
33853385   // clear the edit text box
33863386   SetControlData(info->editwnd, kControlEntireControl, kControlEditTextTextTag, 0, &buffer);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team