src/osd/sdl/debugwin.c
| r2912 | r2913 | |
| 9 | 9 | // |
| 10 | 10 | //============================================================ |
| 11 | 11 | |
| 12 | | #ifndef SDLMAME_WIN32 |
| 12 | #if !defined(SDLMAME_WIN32) && !defined(SDLMAME_NO_X11) |
| 13 | 13 | |
| 14 | 14 | #include <gdk/gdkkeysyms.h> |
| 15 | 15 | #include <gtk/gtk.h> |
| r2912 | r2913 | |
| 115 | 115 | // memory_determine_combo_items |
| 116 | 116 | //============================================================ |
| 117 | 117 | |
| 118 | | static void memory_determine_combo_items(void) |
| 118 | static void memory_determine_combo_items(running_machine *machine) |
| 119 | 119 | { |
| 120 | 120 | memorycombo_item **tail = &memorycombo; |
| 121 | 121 | UINT32 cpunum, spacenum; |
| r2912 | r2913 | |
| 143 | 143 | // then add all the memory regions |
| 144 | 144 | for (rgnnum = 0; rgnnum < MAX_MEMORY_REGIONS; rgnnum++) |
| 145 | 145 | { |
| 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); |
| 148 | 148 | if (base != NULL && type > REGION_INVALID && (type - REGION_INVALID) < ARRAY_LENGTH(memory_region_names)) |
| 149 | 149 | { |
| 150 | 150 | memorycombo_item *ci = malloc_or_die(sizeof(*ci)); |
| 151 | | UINT32 flags = memory_region_flags(Machine, rgnnum); |
| 151 | UINT32 flags = memory_region_flags(machine, rgnnum); |
| 152 | 152 | UINT8 width, little_endian; |
| 153 | 153 | memset(ci, 0, sizeof(*ci)); |
| 154 | 154 | ci->base = base; |
| 155 | | ci->length = memory_region_length(rgnnum); |
| 155 | ci->length = memory_region_length(machine, rgnnum); |
| 156 | 156 | width = 1 << (flags & ROMREGION_WIDTHMASK); |
| 157 | 157 | little_endian = ((flags & ROMREGION_ENDIANMASK) == ROMREGION_LE); |
| 158 | 158 | if (type >= REGION_CPU1 && type <= REGION_CPU8) |
| r2912 | r2913 | |
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | | static void debugmain_set_cpunum(int cpunum) |
| 371 | static void debugmain_set_cpunum(running_machine *machine, int cpunum) |
| 372 | 372 | { |
| 373 | 373 | if(cpunum != dmain->cpu) { |
| 374 | 374 | char title[256]; |
| r2912 | r2913 | |
| 379 | 379 | debug_view_set_property_UINT32(dmain->registers, DVP_REGS_CPUNUM, cpunum); |
| 380 | 380 | |
| 381 | 381 | // 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)); |
| 383 | 383 | gtk_window_set_title(GTK_WINDOW(dmain->win), title); |
| 384 | 384 | debugmain_update_checks(dmain); |
| 385 | 385 | } |
| r2912 | r2913 | |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | // update the views in the console to reflect the current CPU |
| 401 | | debugmain_set_cpunum(cpu_getactivecpu()); |
| 401 | debugmain_set_cpunum(Machine, cpu_getactivecpu()); |
| 402 | 402 | |
| 403 | 403 | debugwin_show(1); |
| 404 | 404 | gtk_main_iteration(); |
| r2912 | r2913 | |
| 512 | 512 | free(mem); |
| 513 | 513 | } |
| 514 | 514 | |
| 515 | | static void memorywin_new(void) |
| 515 | static void memorywin_new(running_machine *machine) |
| 516 | 516 | { |
| 517 | 517 | memorywin_i *mem; |
| 518 | 518 | int item, cursel, curcpu = cpu_getactivecpu(); |
| r2912 | r2913 | |
| 541 | 541 | |
| 542 | 542 | // populate the combobox |
| 543 | 543 | if (!memorycombo) |
| 544 | | memory_determine_combo_items(); |
| 544 | memory_determine_combo_items(machine); |
| 545 | 545 | item = 0; |
| 546 | 546 | cursel = 0; |
| 547 | 547 | for (ci = memorycombo; ci; ci = ci->next) |
| r2912 | r2913 | |
| 759 | 759 | |
| 760 | 760 | void on_new_mem_activate(GtkMenuItem *item, gpointer user_data) |
| 761 | 761 | { |
| 762 | | memorywin_new(); |
| 762 | memorywin_new(Machine); |
| 763 | 763 | } |
| 764 | 764 | |
| 765 | 765 | void on_new_disasm_activate(GtkMenuItem *item, gpointer user_data) |
src/osd/sdl/testkeys.c
| r2912 | r2913 | |
| 28 | 28 | const char *name; |
| 29 | 29 | }; |
| 30 | 30 | |
| 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 | |
| 38 | static 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 |
| 31 | 62 | #define KE(x) { SDLK_ ## x, "SDLK_" #x }, |
| 32 | 63 | #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) |
| 33 | 64 | |
| r2912 | r2913 | |
| 42 | 73 | KE8(c, d, e, f, g, h, i, j ) |
| 43 | 74 | KE8(k, l, m, n, o, p, q, r ) |
| 44 | 75 | 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 |
| 49 | 76 | KE8(DELETE, WORLD_0, WORLD_1, WORLD_2, WORLD_3, WORLD_4, WORLD_5, WORLD_6 ) |
| 50 | 77 | KE8(WORLD_7, WORLD_8, WORLD_9, WORLD_10, WORLD_11, WORLD_12, WORLD_13, WORLD_14 ) |
| 51 | 78 | KE8(WORLD_15, WORLD_16, WORLD_17, WORLD_18, WORLD_19, WORLD_20, WORLD_21, WORLD_22 ) |
| r2912 | r2913 | |
| 59 | 86 | KE8(WORLD_79, WORLD_80, WORLD_81, WORLD_82, WORLD_83, WORLD_84, WORLD_85, WORLD_86 ) |
| 60 | 87 | KE8(WORLD_87, WORLD_88, WORLD_89, WORLD_90, WORLD_91, WORLD_92, WORLD_93, WORLD_94 ) |
| 61 | 88 | KE8(WORLD_95, KP0, KP1, KP2, KP3, KP4, KP5, KP6 ) |
| 62 | | #endif |
| 63 | 89 | KE8(KP7, KP8, KP9, KP_PERIOD, KP_DIVIDE, KP_MULTIPLY,KP_MINUS, KP_PLUS ) |
| 64 | 90 | KE8(KP_ENTER, KP_EQUALS, UP, DOWN, RIGHT, LEFT, INSERT, HOME ) |
| 65 | 91 | KE8(END, PAGEUP, PAGEDOWN, F1, F2, F3, F4, F5 ) |
| r2912 | r2913 | |
| 71 | 97 | KE(LAST) |
| 72 | 98 | {-1, ""} |
| 73 | 99 | }; |
| 100 | #endif |
| 74 | 101 | |
| 75 | 102 | static const char * lookup_key_name(const key_lookup_table *kt, int kc) |
| 76 | 103 | { |
| r2912 | r2913 | |
| 114 | 141 | memset(buf, 0, 19); |
| 115 | 142 | utf8_from_uchar(buf, sizeof(buf), event.key.keysym.unicode); |
| 116 | 143 | 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); |
| 121 | 152 | } |
| 122 | 153 | break; |
| 123 | 154 | } |