Previous 15994 Revisions Next

r2913 Saturday 28th June, 2008 at 18:33:15 UTC by R. Belmont
[SDLMESS] Sync with SDLMAME 0.125u8.
[ROOT]makefile.sdl
[src/osd/sdl]debugwin.c sdl.mak sdlmain.c sdlmisc.c testkeys.c video.c window.c

src/osd/sdl/sdlmisc.c
r2912r2913
9999      DebugBreak();
100100   }
101101#elif defined(SDLMAME_UNIX)
102   #ifdef ENABLE_DEBUGGER
102   #ifdef MAME_DEBUG
103103   printf("MAME exception: %s\n", message);
104104   printf("Attempting to fall into debugger\n");
105105   kill(getpid(), SIGTRAP);
src/osd/sdl/sdl.mak
r2912r2913
44#
55#   SDL-specific makefile
66#
7#   Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team.
7#   Copyright (c) 1996-2008, Nicola Salmoria and the MAME Team.
88#   Visit http://mamedev.org for licensing and usage restrictions.
99#
1010#   SDLMAME by Olivier Galibert and R. Belmont
r2912r2913
219219endif
220220
221221# the new debugger relies on GTK+ in addition to the base SDLMAME needs
222ifdef DEBUGGER
223OSDOBJS += $(SDLOBJ)/debugwin.o $(SDLOBJ)/dview.o $(SDLOBJ)/debug-sup.o $(SDLOBJ)/debug-intf.o
222# Non-X11 builds can not use the debugger
223ifndef NO_X11
224OSDCOREOBJS += $(SDLOBJ)/debugwin.o $(SDLOBJ)/dview.o $(SDLOBJ)/debug-sup.o $(SDLOBJ)/debug-intf.o
224225CFLAGS += `pkg-config --cflags gtk+-2.0` `pkg-config --cflags gconf-2.0`
225226LIBS += `pkg-config --libs gtk+-2.0` `pkg-config --libs gconf-2.0`
226227CFLAGS += -DGTK_DISABLE_DEPRECATED
227endif # DEBUGGER
228else
229OSDCOREOBJS += $(SDLOBJ)/debugwin.o
230endif # NO_X11
228231
229232# make sure we can find X headers
230233CFLAGS += -I/usr/X11/include -I/usr/X11R6/include -I/usr/openwin/include
r2912r2913
269272SDLMAIN = $(SDLOBJ)/SDLMain_tmpl.o
270273
271274# the new debugger relies on GTK+ in addition to the base SDLMAME needs
272ifdef DEBUGGER
273275OSDOBJS += $(SDLOBJ)/debugosx.o
274276LIBS += -framework Carbon
275endif   # DEBUGGER
276277endif   # Mac OS X
277278
278279# OS2: add the necessary libraries
src/osd/sdl/debugwin.c
r2912r2913
99//
1010//============================================================
1111
12#ifndef SDLMAME_WIN32
12#if !defined(SDLMAME_WIN32) && !defined(SDLMAME_NO_X11)
1313
1414#include <gdk/gdkkeysyms.h>
1515#include <gtk/gtk.h>
r2912r2913
115115//  memory_determine_combo_items
116116//============================================================
117117
118static void memory_determine_combo_items(void)
118static void memory_determine_combo_items(running_machine *machine)
119119{
120120   memorycombo_item **tail = &memorycombo;
121121   UINT32 cpunum, spacenum;
r2912r2913
143143   // then add all the memory regions
144144   for (rgnnum = 0; rgnnum < MAX_MEMORY_REGIONS; rgnnum++)
145145   {
146      UINT8 *base = memory_region(rgnnum);
147      UINT32 type = memory_region_type(Machine, rgnnum);
146      UINT8 *base = memory_region(machine, rgnnum);
147      UINT32 type = memory_region_type(machine, rgnnum);
148148      if (base != NULL && type > REGION_INVALID && (type - REGION_INVALID) < ARRAY_LENGTH(memory_region_names))
149149      {
150150         memorycombo_item *ci = malloc_or_die(sizeof(*ci));
151         UINT32 flags = memory_region_flags(Machine, rgnnum);
151         UINT32 flags = memory_region_flags(machine, rgnnum);
152152         UINT8 width, little_endian;
153153         memset(ci, 0, sizeof(*ci));
154154         ci->base = base;
155         ci->length = memory_region_length(rgnnum);
155         ci->length = memory_region_length(machine, rgnnum);
156156         width = 1 << (flags & ROMREGION_WIDTHMASK);
157157         little_endian = ((flags & ROMREGION_ENDIANMASK) == ROMREGION_LE);
158158         if (type >= REGION_CPU1 && type <= REGION_CPU8)
r2912r2913
368368   }
369369}
370370
371static void debugmain_set_cpunum(int cpunum)
371static void debugmain_set_cpunum(running_machine *machine, int cpunum)
372372{
373373   if(cpunum != dmain->cpu) {
374374      char title[256];
r2912r2913
379379      debug_view_set_property_UINT32(dmain->registers, DVP_REGS_CPUNUM, cpunum);
380380
381381      // then update the caption
382      sprintf(title, "Debug: %s - CPU %d (%s)", Machine->gamedrv->name, cpunum, cpunum_name(cpunum));
382      sprintf(title, "Debug: %s - CPU %d (%s)", machine->gamedrv->name, cpunum, cpunum_name(cpunum));
383383      gtk_window_set_title(GTK_WINDOW(dmain->win), title);
384384      debugmain_update_checks(dmain);
385385   }
r2912r2913
398398   }
399399
400400   // update the views in the console to reflect the current CPU
401   debugmain_set_cpunum(cpu_getactivecpu());
401   debugmain_set_cpunum(Machine, cpu_getactivecpu());
402402
403403   debugwin_show(1);
404404   gtk_main_iteration();
r2912r2913
512512   free(mem);
513513}
514514
515static void memorywin_new(void)
515static void memorywin_new(running_machine *machine)
516516{
517517   memorywin_i *mem;
518518   int item, cursel, curcpu = cpu_getactivecpu();
r2912r2913
541541
542542   // populate the combobox
543543   if (!memorycombo)
544      memory_determine_combo_items();
544      memory_determine_combo_items(machine);
545545   item = 0;
546546   cursel = 0;
547547   for (ci = memorycombo; ci; ci = ci->next)
r2912r2913
759759
760760void on_new_mem_activate(GtkMenuItem *item, gpointer user_data)
761761{
762   memorywin_new();
762   memorywin_new(Machine);
763763}
764764
765765void on_new_disasm_activate(GtkMenuItem *item, gpointer user_data)
src/osd/sdl/video.c
r2912r2913
358358   sdlinput_poll(machine);
359359   check_osd_inputs(machine);
360360
361#ifdef ENABLE_DEBUGGER
362   debugwin_update_during_game();
363#endif
361   if (machine->debug_flags & DEBUG_FLAG_ENABLED)
362      debugwin_update_during_game();
364363}
365364
366365//============================================================
r2912r2913
578577   #endif
579578
580579
581#ifdef ENABLE_DEBUGGER
582   // if we are in debug mode, never go full screen
583580   if (options_get_bool(mame_options(), OPTION_DEBUG))
584581      video_config.windowed = TRUE;
585#endif
582
586583   stemp = options_get_string(mame_options(), SDLOPTION_EFFECT);
587584   if (stemp != NULL && strcmp(stemp, "none") != 0)
588585      load_effect_overlay(machine, stemp);
src/osd/sdl/window.c
r2912r2913
573573
574574   ASSERT_WINDOW_THREAD();
575575
576#ifdef ENABLE_DEBUGGER
577576   // if we are in debug mode, never go full screen
578577   if (options_get_bool(mame_options(), OPTION_DEBUG))
579578      return NULL;
580#endif
581579
582580   // If we are going fullscreen (leaving windowed) remember our windowed size
583581   if (!window->fullscreen)
r2912r2913
763761{
764762   // do not do mouse capture if the debugger's enabled to avoid
765763   // the possibility of losing control
766   #ifdef ENABLE_DEBUGGER
767764   if (!options_get_bool(mame_options(), OPTION_DEBUG))
768   #endif
769765   {
770766      if (video_config.windowed && !sdlinput_should_hide_mouse())
771767      {
src/osd/sdl/testkeys.c
r2912r2913
2828   const char *name;
2929};
3030
31#if (SDL_VERSION_ATLEAST(1,3,0))
32#define KE(x) { SDL_SCANCODE_ ## x, "SDL_SCANCODE_" #x },
33#define KE8(A, B, C, D, E, F, G, H) KE(A) KE(B) KE(C) KE(D) KE(E) KE(F) KE(G) KE(H)
34#define KE7(A, B, C, D, E, F, G) KE(A) KE(B) KE(C) KE(D) KE(E) KE(F) KE(G)
35#define KE5(A, B, C, D, E) KE(A) KE(B) KE(C) KE(D) KE(E)
36#define KE3(A, B, C) KE(A) KE(B) KE(C)
37
38static key_lookup_table sdl_lookup[] =
39{
40   KE7(UNKNOWN,   BACKSPACE,   TAB,      CLEAR,      RETURN,      PAUSE,      ESCAPE      )
41   KE(SPACE)
42   KE5(COMMA,      MINUS,      PERIOD,      SLASH,      0         )
43   KE8(1,         2,         3,            4,         5,         6,         7,         8         )
44   KE3(9,         SEMICOLON,      EQUALS)
45   KE5(LEFTBRACKET,BACKSLASH,   RIGHTBRACKET,   A,         B         )
46   KE8(C,         D,         E,            F,         G,         H,         I,         J         )
47   KE8(K,         L,         M,            N,         O,         P,         Q,         R         )
48   KE8(S,         T,         U,            V,         W,         X,         Y,         Z         )
49   KE8(DELETE,      KP_0,      KP_1,         KP_2,      KP_3,      KP_4,      KP_5,      KP_6      )
50   KE8(KP_7,      KP_8,      KP_9,         KP_PERIOD,   KP_DIVIDE,   KP_MULTIPLY,KP_MINUS,   KP_PLUS      )
51   KE8(KP_ENTER,   KP_EQUALS,   UP,            DOWN,      RIGHT,      LEFT,      INSERT,      HOME      )
52   KE8(END,      PAGEUP,      PAGEDOWN,      F1,         F2,         F3,         F4,         F5         )
53   KE8(F6,         F7,         F8,            F9,         F10,      F11,      F12,      F13         )
54   KE8(F14,      F15,      NUMLOCKCLEAR,   CAPSLOCK,   SCROLLLOCK,   RSHIFT,      LSHIFT,      RCTRL      )
55   KE5(LCTRL,      RALT,      LALT,         LGUI,      RGUI)
56   KE(PRINTSCREEN)
57   KE(MENU)
58   KE(UNDO)
59   {-1, ""}
60};
61#else
3162#define KE(x) { SDLK_ ## x, "SDLK_" #x },
3263#define KE8(A, B, C, D, E, F, G, H) KE(A) KE(B) KE(C) KE(D) KE(E) KE(F) KE(G) KE(H)
3364
r2912r2913
4273   KE8(c,         d,         e,            f,         g,         h,         i,         j         )
4374   KE8(k,         l,         m,            n,         o,         p,         q,         r         )
4475   KE8(s,         t,         u,            v,         w,         x,         y,         z         )
45//FIXME: SDL 1.3 Definitions are gone
46#if (SDL_VERSION_ATLEAST(1,3,0))
47   KE8(DELETE,      KP0,      KP1,         KP2,      KP3,      KP4,      KP5,      KP6         )
48#else
4976   KE8(DELETE,      WORLD_0,   WORLD_1,      WORLD_2,   WORLD_3,   WORLD_4,   WORLD_5,   WORLD_6      )
5077   KE8(WORLD_7,   WORLD_8,   WORLD_9,      WORLD_10,   WORLD_11,   WORLD_12,   WORLD_13,   WORLD_14   )
5178   KE8(WORLD_15,   WORLD_16,   WORLD_17,      WORLD_18,   WORLD_19,   WORLD_20,   WORLD_21,   WORLD_22   )
r2912r2913
5986   KE8(WORLD_79,   WORLD_80,   WORLD_81,      WORLD_82,   WORLD_83,   WORLD_84,   WORLD_85,   WORLD_86   )
6087   KE8(WORLD_87,   WORLD_88,   WORLD_89,      WORLD_90,   WORLD_91,   WORLD_92,   WORLD_93,   WORLD_94   )
6188   KE8(WORLD_95,   KP0,      KP1,         KP2,      KP3,      KP4,      KP5,      KP6         )
62#endif
6389   KE8(KP7,      KP8,      KP9,         KP_PERIOD,   KP_DIVIDE,   KP_MULTIPLY,KP_MINUS,   KP_PLUS      )
6490   KE8(KP_ENTER,   KP_EQUALS,   UP,            DOWN,      RIGHT,      LEFT,      INSERT,      HOME      )
6591   KE8(END,      PAGEUP,      PAGEDOWN,      F1,         F2,         F3,         F4,         F5         )
r2912r2913
7197   KE(LAST)     
7298   {-1, ""}
7399};
100#endif
74101
75102static const char * lookup_key_name(const key_lookup_table *kt, int kc)
76103{
r2912r2913
114141            memset(buf, 0, 19);
115142            utf8_from_uchar(buf, sizeof(buf), event.key.keysym.unicode);
116143            printf("ITEM_ID_XY %s 0x%x 0x%x %s \n",
117               lookup_key_name(sdl_lookup, event.key.keysym.sym),
118               (int) event.key.keysym.scancode,
119               (int) event.key.keysym.unicode,
120               buf);
144#if (SDL_VERSION_ATLEAST(1,3,0))
145                  lookup_key_name(sdl_lookup, event.key.keysym.scancode),
146#else
147                  lookup_key_name(sdl_lookup, event.key.keysym.sym),
148#endif
149                  (int) event.key.keysym.scancode,
150                  (int) event.key.keysym.unicode,
151                  buf);
121152         }
122153         break;
123154      }
src/osd/sdl/sdlmain.c
r2912r2913
1717#include "osdepend.h"
1818#include "mame.h"
1919#include "clifront.h"
20#include "emuopts.h"
2021
2122// OSD headers
2223#include "video.h"
r2912r2913
390391   MACRO_VERBOSE(PTR64);
391392   MACRO_VERBOSE(MAME_DEBUG);
392393   MACRO_VERBOSE(NDEBUG);
393   MACRO_VERBOSE(ENABLE_DEBUGGER);
394394   MACRO_VERBOSE(VODOO_DRC);
395395   mame_printf_verbose("\n");
396396   mame_printf_verbose("SDL/OpenGL defines: ");
r2912r2913
430430   add_exit_callback(machine, osd_exit);
431431
432432   defines_verbose();
433
434#ifdef SDLMAME_NO_X11
435   if (options_get_bool(mame_options(), OPTION_DEBUG))
436   {
437      osd_exit(machine);
438      ShowError("sdlmame", "-debug not supported on X11-less build\n\n");
439      exit(-1);     
440   }
441#endif
433442   
434443   if (sdlvideo_init(machine))
435444   {
makefile.sdl
r2912r2913
4747CROSS_BUILD_OSD = $(OSD)
4848endif
4949
50
51
5052#-------------------------------------------------
5153# specify OS target, which further differentiates
5254# the underlying OS; supported values are:
r2912r2913
9597# for details
9698#-------------------------------------------------
9799
98# uncomment next line to enable the debugger
99# DEBUGGER = 1
100
101100# uncomment next line to build a debug version
102101# DEBUG = 1
103102
r2912r2913
157156# sanity check the configuration
158157#-------------------------------------------------
159158
160# disable DRC cores for 64-bit builds
161ifdef PTR64
162X86_PPC_DRC =
163endif
164
165159# specify a default optimization level if none explicitly stated
166160ifndef OPTIMIZE
167161ifndef SYMBOLS
r2912r2913
211205# form the name of the executable
212206#-------------------------------------------------
213207
214# debugger builds just get the 'd' suffix and nothing more
215ifdef DEBUGGER
208# debug builds just get the 'd' suffix and nothing more
209ifdef DEBUG
216210DEBUGSUFFIX = d
217211endif
218212
r2912r2913
271265DEFS += -DPTR64
272266endif
273267
274# define ENABLE_DEBUGGER if we are a debugger-enabled build
275ifdef DEBUGGER
276DEFS += -DENABLE_DEBUGGER
277endif
278
279268# define MAME_DEBUG if we are a debugging build
280269ifdef DEBUG
281270DEFS += -DMAME_DEBUG

Previous 15994 Revisions Next


© 1998-2018 The MESS Team