1 /////////////////////////////////////////////////////////////////////////
2 // $Id: gui.h 14131 2021-02-07 16:16:06Z vruppert $
3 /////////////////////////////////////////////////////////////////////////
4 //
5 //  Copyright (C) 2002-2021  The Bochs Project
6 //
7 //  This library is free software; you can redistribute it and/or
8 //  modify it under the terms of the GNU Lesser General Public
9 //  License as published by the Free Software Foundation; either
10 //  version 2 of the License, or (at your option) any later version.
11 //
12 //  This library is distributed in the hope that it will be useful,
13 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 //  Lesser General Public License for more details.
16 //
17 //  You should have received a copy of the GNU Lesser General Public
18 //  License along with this library; if not, write to the Free Software
19 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
20 
21 #ifndef BX_GUI_H
22 #define BX_GUI_H
23 
24 #include "gui/siminterface.h"
25 
26 // header bar and status bar stuff
27 #define BX_HEADER_BAR_Y 32
28 
29 #define BX_MAX_PIXMAPS 17
30 #define BX_MAX_HEADERBAR_ENTRIES 12
31 
32 // align pixmaps towards left or right side of header bar
33 #define BX_GRAVITY_LEFT 10
34 #define BX_GRAVITY_RIGHT 11
35 
36 #define BX_MAX_STATUSITEMS 10
37 
38 // gui dialog capabilities
39 #define BX_GUI_DLG_FLOPPY       0x01
40 #define BX_GUI_DLG_CDROM        0x02
41 #define BX_GUI_DLG_SNAPSHOT     0x04
42 #define BX_GUI_DLG_RUNTIME      0x08
43 #define BX_GUI_DLG_USER         0x10
44 #define BX_GUI_DLG_SAVE_RESTORE 0x20
45 #define BX_GUI_DLG_ALL          0x3F
46 
47 // text mode blink feature
48 #define BX_TEXT_BLINK_MODE      0x01
49 #define BX_TEXT_BLINK_TOGGLE    0x02
50 #define BX_TEXT_BLINK_STATE     0x04
51 
52 // modifier keys
53 #define BX_MOD_KEY_SHIFT        0x01
54 #define BX_MOD_KEY_CTRL         0x02
55 #define BX_MOD_KEY_ALT          0x04
56 #define BX_MOD_KEY_CAPS         0x08
57 
58 // mouse capture toggle feature
59 #define BX_MT_KEY_CTRL          0x01
60 #define BX_MT_KEY_ALT           0x02
61 #define BX_MT_KEY_F10           0x04
62 #define BX_MT_KEY_F12           0x08
63 #define BX_MT_MBUTTON           0x10
64 #define BX_MT_LBUTTON           0x20
65 #define BX_MT_RBUTTON           0x40
66 
67 #define BX_GUI_MT_CTRL_MB       (BX_MT_KEY_CTRL | BX_MT_MBUTTON)
68 #define BX_GUI_MT_CTRL_LRB      (BX_MT_KEY_CTRL | BX_MT_LBUTTON | BX_MT_RBUTTON)
69 #define BX_GUI_MT_CTRL_F10      (BX_MT_KEY_CTRL | BX_MT_KEY_F10)
70 #define BX_GUI_MT_F12           (BX_MT_KEY_F12)
71 #define BX_GUI_MT_CTRL_ALT      (BX_MT_KEY_CTRL | BX_MT_KEY_ALT)
72 
73 typedef struct {
74   Bit16u  start_address;
75   Bit8u   cs_start;
76   Bit8u   cs_end;
77   Bit16u  line_offset;
78   Bit16u  line_compare;
79   Bit8u   h_panning;
80   Bit8u   v_panning;
81   bool line_graphics;
82   bool split_hpanning;
83   Bit8u   blink_flags;
84   Bit8u   actl_palette[16];
85 } bx_vga_tminfo_t;
86 
87 typedef struct {
88   Bit16u bpp, pitch;
89   Bit8u red_shift, green_shift, blue_shift;
90   Bit8u is_indexed, is_little_endian;
91   unsigned long red_mask, green_mask, blue_mask;
92   bool snapshot_mode;
93 } bx_svga_tileinfo_t;
94 
95 
96 BOCHSAPI_MSVCONLY Bit8u reverse_bitorder(Bit8u);
97 
98 BOCHSAPI extern class bx_gui_c *bx_gui;
99 
100 #if BX_SUPPORT_X86_64
101   #define BOCHS_WINDOW_NAME "Bochs x86-64 emulator, http://bochs.sourceforge.net/"
102 #else
103   #define BOCHS_WINDOW_NAME "Bochs x86 emulator, http://bochs.sourceforge.net/"
104 #endif
105 
106 // The bx_gui_c class provides data and behavior that is common to
107 // all guis.  Each gui implementation will override the abstract methods.
108 class BOCHSAPI bx_gui_c : public logfunctions {
109 public:
110   bx_gui_c (void);
111   virtual ~bx_gui_c ();
112   // Define the following functions in the module for your particular GUI
113   // (x.cc, win32.cc, ...)
114   virtual void specific_init(int argc, char **argv, unsigned header_bar_y) = 0;
115   virtual void text_update(Bit8u *old_text, Bit8u *new_text,
116                           unsigned long cursor_x, unsigned long cursor_y,
117                           bx_vga_tminfo_t *tm_info) = 0;
118   virtual void graphics_tile_update(Bit8u *tile, unsigned x, unsigned y) = 0;
119   virtual void handle_events(void) = 0;
120   virtual void flush(void) = 0;
121   virtual void clear_screen(void) = 0;
122   virtual bool palette_change(Bit8u index, Bit8u red, Bit8u green, Bit8u blue) = 0;
123   virtual void dimension_update(unsigned x, unsigned y, unsigned fheight=0, unsigned fwidth=0, unsigned bpp=8) = 0;
124   virtual unsigned create_bitmap(const unsigned char *bmap, unsigned xdim, unsigned ydim) = 0;
125   virtual unsigned headerbar_bitmap(unsigned bmap_id, unsigned alignment, void (*f)(void)) = 0;
126   virtual void replace_bitmap(unsigned hbar_id, unsigned bmap_id) = 0;
127   virtual void show_headerbar(void) = 0;
128   virtual int get_clipboard_text(Bit8u **bytes, Bit32s *nbytes)  = 0;
129   virtual int set_clipboard_text(char *snapshot, Bit32u len) = 0;
130   virtual void mouse_enabled_changed_specific (bool val) = 0;
131   virtual void exit(void) = 0;
132   // new graphics API methods (compatibility mode in gui.cc)
133   virtual bx_svga_tileinfo_t *graphics_tile_info(bx_svga_tileinfo_t *info);
134   virtual Bit8u *graphics_tile_get(unsigned x, unsigned y, unsigned *w, unsigned *h);
135   virtual void graphics_tile_update_in_place(unsigned x, unsigned y, unsigned w, unsigned h);
136   // new text update API
set_font(bool lg)137   virtual void set_font(bool lg) {}
draw_char(Bit8u ch,Bit8u fc,Bit8u bc,Bit16u xc,Bit16u yc,Bit8u fw,Bit8u fh,Bit8u fx,Bit8u fy,bool gfxcharw9,Bit8u cs,Bit8u ce,bool curs)138   virtual void draw_char(Bit8u ch, Bit8u fc, Bit8u bc, Bit16u xc, Bit16u yc,
139                          Bit8u fw, Bit8u fh, Bit8u fx, Bit8u fy,
140                          bool gfxcharw9, Bit8u cs, Bit8u ce, bool curs) {}
141   // optional gui methods (stubs or default code in gui.cc)
statusbar_setitem_specific(int element,bool active,bool w)142   virtual void statusbar_setitem_specific(int element, bool active, bool w) {}
set_tooltip(unsigned hbar_id,const char * tip)143   virtual void set_tooltip(unsigned hbar_id, const char *tip) {}
144   // set_display_mode() changes the mode between the configuration interface
145   // and the simulation.  This is primarily intended for display libraries
146   // which have a full-screen mode such as SDL or term.  The display mode is
147   // set to DISP_MODE_CONFIG before displaying any configuration menus,
148   // for panics that requires user input, when entering the debugger, etc.  It
149   // is set to DISP_MODE_SIM when the Bochs simulation resumes.  The
150   // enum is defined in gui/siminterface.h.
set_display_mode(disp_mode_t newmode)151   virtual void set_display_mode (disp_mode_t newmode) { /* default=no action*/ }
152   // These are only needed for the term gui. For all other guis they will
153   // have no effect.
154   // returns 32-bit bitmask in which 1 means the GUI should handle that signal
get_sighandler_mask()155   virtual Bit32u get_sighandler_mask () {return 0;}
156   // called when registered signal arrives
sighandler(int sig)157   virtual void sighandler (int sig) {}
158 #if BX_USE_IDLE_HACK
159   // this is called from the CPU model when the HLT instruction is executed.
sim_is_idle(void)160   virtual void sim_is_idle(void) {}
161 #endif
162   virtual void show_ips(Bit32u ips_count);
163   virtual void beep_on(float frequency);
164   virtual void beep_off();
165   virtual void get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp);
set_mouse_mode_absxy(bool mode)166   virtual void set_mouse_mode_absxy(bool mode) {}
167 #if BX_USE_GUI_CONSOLE
set_console_edit_mode(bool mode)168   virtual void set_console_edit_mode(bool mode) {}
169 #endif
170 
171   // The following function(s) are defined already, and your
172   // GUI code calls them
173   static void key_event(Bit32u key);
174   static void set_text_charmap(Bit8u *fbuffer);
175   static void set_text_charbyte(Bit16u address, Bit8u data);
176   static Bit8u get_mouse_headerbar_id();
177 
178   void init(int argc, char **argv, unsigned max_xres, unsigned max_yres,
179             unsigned x_tilesize, unsigned y_tilesize);
180   void cleanup(void);
181   void draw_char_common(Bit8u ch, Bit8u fc, Bit8u bc, Bit16u xc, Bit16u yc,
182                         Bit8u fw, Bit8u fh, Bit8u fx, Bit8u fy,
183                         bool gfxcharw9, Bit8u cs, Bit8u ce, bool curs);
184   void text_update_common(Bit8u *old_text, Bit8u *new_text,
185                           Bit16u cursor_address, bx_vga_tminfo_t *tm_info);
186   void graphics_tile_update_common(Bit8u *tile, unsigned x, unsigned y);
187   bx_svga_tileinfo_t *graphics_tile_info_common(bx_svga_tileinfo_t *info);
get_snapshot_buffer(void)188   Bit8u* get_snapshot_buffer(void) {return snapshot_buffer;}
189   bool palette_change_common(Bit8u index, Bit8u red, Bit8u green, Bit8u blue);
190   void update_drive_status_buttons(void);
191   static void     mouse_enabled_changed(bool val);
192   int register_statusitem(const char *text, bool auto_off=0);
193   void unregister_statusitem(int id);
194   void statusbar_setitem(int element, bool active, bool w=0);
195   static void init_signal_handlers();
196   static void toggle_mouse_enable(void);
197   bool mouse_toggle_check(Bit32u key, bool pressed);
198   const char* get_toggle_info(void);
199   Bit8u get_modifier_keys(void);
200   Bit8u set_modifier_keys(Bit8u modifier, bool pressed);
201   bool parse_user_shortcut(const char *val);
202 #if BX_DEBUGGER && BX_DEBUGGER_GUI
203   void init_debug_dialog(void);
204   void close_debug_dialog(void);
205 #endif
206 #if BX_USE_GUI_CONSOLE
has_gui_console(void)207   bool has_gui_console(void) {return console.present;}
console_running(void)208   bool console_running(void) {return console.running;}
209   void console_refresh(bool force);
210   void console_key_enq(Bit8u key);
211   int bx_printf(const char *s);
212   char* bx_gets(char *s, int size);
213 #else
has_gui_console(void)214   bool has_gui_console(void) {return 0;}
console_running(void)215   bool console_running(void) {return 0;}
console_refresh(bool force)216   void console_refresh(bool force) {}
console_key_enq(Bit8u key)217   void console_key_enq(Bit8u key) {}
218 #endif
has_command_mode(void)219   bool has_command_mode(void) {return command_mode.present;}
command_mode_active(void)220   bool command_mode_active(void) {return command_mode.active;}
221   void set_command_mode(bool active);
set_fullscreen_mode(bool active)222   void set_fullscreen_mode(bool active) {fullscreen_mode = active;}
223   // marklog handler without button, called in gui command mode
224   static void marklog_handler(void);
225 
226 protected:
227   // And these are defined and used privately in gui.cc
228   // header bar button handlers
229   static void floppyA_handler(void);
230   static void floppyB_handler(void);
231   static void cdrom1_handler(void);
232   static void reset_handler(void);
233   static void power_handler(void);
234   static void copy_handler(void);
235   static void paste_handler(void);
236   static void snapshot_handler(void);
237   static void config_handler(void);
238   static void userbutton_handler(void);
239   static void save_restore_handler(void);
240   // process clicks on the "classic" Bochs headerbar
241   void headerbar_click(int x);
242   // snapshot helper functions
243   static void make_text_snapshot(char **snapshot, Bit32u *length);
244   static Bit32u set_snapshot_mode(bool mode);
245   // status bar LED timer
246   static void led_timer_handler(void *);
247   void led_timer(void);
248 #if BX_USE_GUI_CONSOLE
249   void console_init(void);
250   void console_cleanup(void);
251 #else
console_cleanup(void)252   void console_cleanup(void) {}
253 #endif
254 
255   // header bar buttons
256   bool floppyA_status;
257   bool floppyB_status;
258   bool cdrom1_status;
259   unsigned floppyA_bmap_id, floppyA_eject_bmap_id, floppyA_hbar_id;
260   unsigned floppyB_bmap_id, floppyB_eject_bmap_id, floppyB_hbar_id;
261   unsigned cdrom1_bmap_id, cdrom1_eject_bmap_id, cdrom1_hbar_id;
262   unsigned power_bmap_id,    power_hbar_id;
263   unsigned reset_bmap_id,    reset_hbar_id;
264   unsigned copy_bmap_id, copy_hbar_id;
265   unsigned paste_bmap_id, paste_hbar_id;
266   unsigned snapshot_bmap_id, snapshot_hbar_id;
267   unsigned config_bmap_id, config_hbar_id;
268   unsigned mouse_bmap_id, nomouse_bmap_id, mouse_hbar_id;
269   unsigned user_bmap_id, user_hbar_id;
270   unsigned save_restore_bmap_id, save_restore_hbar_id;
271   // the "classic" Bochs headerbar
272   unsigned bx_headerbar_entries;
273   struct {
274     unsigned bmap_id;
275     unsigned xdim;
276     unsigned ydim;
277     unsigned xorigin;
278     unsigned alignment;
279     void (*f)(void);
280   } bx_headerbar_entry[BX_MAX_HEADERBAR_ENTRIES];
281   // text charmap
282   Bit8u vga_charmap[0x2000];
283   bool charmap_updated;
284   bool char_changed[256];
285   // status bar items
286   unsigned statusitem_count;
287   int led_timer_index;
288   struct {
289     bool in_use;
290     char text[8];
291     bool active;
292     bool mode; // read/write
293     bool auto_off;
294     Bit8u counter;
295   } statusitem[BX_MAX_STATUSITEMS];
296   // display mode
297   disp_mode_t disp_mode;
298   // new graphics API (with compatibility mode)
299   bool new_gfx_api;
300   Bit16u host_xres;
301   Bit16u host_yres;
302   Bit16u host_pitch;
303   Bit8u host_bpp;
304   Bit8u *framebuffer;
305   // new text update API
306   bool new_text_api;
307   Bit16u cursor_address;
308   bx_vga_tminfo_t tm_info;
309   // maximum guest display size and tile size
310   unsigned max_xres;
311   unsigned max_yres;
312   unsigned x_tilesize;
313   unsigned y_tilesize;
314   // current guest display settings
315   bool guest_textmode;
316   Bit8u   guest_fwidth;
317   Bit8u   guest_fheight;
318   Bit16u  guest_xres;
319   Bit16u  guest_yres;
320   Bit8u   guest_bpp;
321   // graphics snapshot
322   bool snapshot_mode;
323   Bit8u *snapshot_buffer;
324   struct {
325     Bit8u blue;
326     Bit8u green;
327     Bit8u red;
328     Bit8u reserved;
329   } palette[256];
330   // modifier keys
331   Bit8u keymodstate;
332   // mouse toggle setup
333   Bit8u toggle_method;
334   Bit32u toggle_keystate;
335   char mouse_toggle_text[20];
336   // userbutton shortcut
337   Bit32u user_shortcut[4];
338   int user_shortcut_len;
339   bool user_shortcut_error;
340   // gui dialog capabilities
341   Bit32u dialog_caps;
342 #if BX_USE_GUI_CONSOLE
343   struct {
344     bool present;
345     bool running;
346     Bit8u *screen;
347     Bit8u *oldscreen;
348     Bit8u saved_fwidth;
349     Bit8u saved_fheight;
350     Bit16u saved_xres;
351     Bit16u saved_yres;
352     Bit8u  saved_bpp;
353     Bit8u saved_palette[32];
354     Bit8u saved_charmap[0x2000];
355     unsigned cursor_x;
356     unsigned cursor_y;
357     Bit16u cursor_addr;
358     bx_vga_tminfo_t tminfo;
359     Bit8u keys[16];
360     Bit8u n_keys;
361   } console;
362 #endif
363   // command mode
364   struct {
365     bool present;
366     bool active;
367   } command_mode;
368   bool fullscreen_mode;
369   Bit32u marker_count;
370 };
371 
372 
373 // Add this macro in the class declaration of each GUI, to define all the
374 // required virtual methods.  Example:
375 //
376 //    class bx_rfb_gui_c : public bx_gui_c {
377 //    public:
378 //      bx_rfb_gui_c (void) {}
379 //      DECLARE_GUI_VIRTUAL_METHODS()
380 //    };
381 // Then, each method must be defined later in the file.
382 #define DECLARE_GUI_VIRTUAL_METHODS()                                       \
383 virtual void specific_init(int argc, char **argv,                           \
384                            unsigned header_bar_y);                          \
385 virtual void text_update(Bit8u *old_text, Bit8u *new_text,                  \
386                   unsigned long cursor_x, unsigned long cursor_y,           \
387                   bx_vga_tminfo_t *tm_info);                                \
388 virtual void graphics_tile_update(Bit8u *tile, unsigned x, unsigned y);     \
389 virtual void handle_events(void);                                           \
390 virtual void flush(void);                                                   \
391 virtual void clear_screen(void);                                            \
392 virtual bool palette_change(Bit8u index, Bit8u red, Bit8u green, Bit8u blue); \
393 virtual void dimension_update(unsigned x, unsigned y, unsigned fheight=0,   \
394                           unsigned fwidth=0, unsigned bpp=8);               \
395 virtual unsigned create_bitmap(const unsigned char *bmap,                   \
396                                unsigned xdim, unsigned ydim);               \
397 virtual unsigned headerbar_bitmap(unsigned bmap_id, unsigned alignment,     \
398                                   void (*f)(void));                         \
399 virtual void replace_bitmap(unsigned hbar_id, unsigned bmap_id);            \
400 virtual void show_headerbar(void);                                          \
401 virtual int get_clipboard_text(Bit8u **bytes, Bit32s *nbytes);              \
402 virtual int set_clipboard_text(char *snapshot, Bit32u len);                 \
403 virtual void mouse_enabled_changed_specific(bool val);                  \
404 virtual void exit(void);                                                    \
405 /* end of DECLARE_GUI_VIRTUAL_METHODS */
406 
407 #define DECLARE_GUI_NEW_VIRTUAL_METHODS()                                   \
408 virtual bx_svga_tileinfo_t *graphics_tile_info(bx_svga_tileinfo_t *info);   \
409 virtual Bit8u *graphics_tile_get(unsigned x, unsigned y,                    \
410                              unsigned *w, unsigned *h);                     \
411 virtual void graphics_tile_update_in_place(unsigned x, unsigned y,          \
412                                        unsigned w, unsigned h);
413 /* end of DECLARE_GUI_NEW_VIRTUAL_METHODS */
414 
415 #define BX_KEY_PRESSED  0x00000000
416 #define BX_KEY_RELEASED 0x80000000
417 
418 #define BX_KEY_UNHANDLED 0x10000000
419 
420 enum {
421   BX_KEY_CTRL_L,
422   BX_KEY_SHIFT_L,
423 
424   BX_KEY_F1,
425   BX_KEY_F2,
426   BX_KEY_F3,
427   BX_KEY_F4,
428   BX_KEY_F5,
429   BX_KEY_F6,
430   BX_KEY_F7,
431   BX_KEY_F8,
432   BX_KEY_F9,
433   BX_KEY_F10,
434   BX_KEY_F11,
435   BX_KEY_F12,
436 
437   BX_KEY_CTRL_R,
438   BX_KEY_SHIFT_R,
439   BX_KEY_CAPS_LOCK,
440   BX_KEY_NUM_LOCK,
441   BX_KEY_ALT_L,
442   BX_KEY_ALT_R,
443 
444   BX_KEY_A,
445   BX_KEY_B,
446   BX_KEY_C,
447   BX_KEY_D,
448   BX_KEY_E,
449   BX_KEY_F,
450   BX_KEY_G,
451   BX_KEY_H,
452   BX_KEY_I,
453   BX_KEY_J,
454   BX_KEY_K,
455   BX_KEY_L,
456   BX_KEY_M,
457   BX_KEY_N,
458   BX_KEY_O,
459   BX_KEY_P,
460   BX_KEY_Q,
461   BX_KEY_R,
462   BX_KEY_S,
463   BX_KEY_T,
464   BX_KEY_U,
465   BX_KEY_V,
466   BX_KEY_W,
467   BX_KEY_X,
468   BX_KEY_Y,
469   BX_KEY_Z,
470 
471   BX_KEY_0,
472   BX_KEY_1,
473   BX_KEY_2,
474   BX_KEY_3,
475   BX_KEY_4,
476   BX_KEY_5,
477   BX_KEY_6,
478   BX_KEY_7,
479   BX_KEY_8,
480   BX_KEY_9,
481 
482   BX_KEY_ESC,
483 
484   BX_KEY_SPACE,
485   BX_KEY_SINGLE_QUOTE,
486   BX_KEY_COMMA,
487   BX_KEY_PERIOD,
488   BX_KEY_SLASH,
489 
490   BX_KEY_SEMICOLON,
491   BX_KEY_EQUALS,
492 
493   BX_KEY_LEFT_BRACKET,
494   BX_KEY_BACKSLASH,
495   BX_KEY_RIGHT_BRACKET,
496   BX_KEY_MINUS,
497   BX_KEY_GRAVE,
498 
499   BX_KEY_BACKSPACE,
500   BX_KEY_ENTER,
501   BX_KEY_TAB,
502 
503   BX_KEY_LEFT_BACKSLASH,
504   BX_KEY_PRINT,
505   BX_KEY_SCRL_LOCK,
506   BX_KEY_PAUSE,
507 
508   BX_KEY_INSERT,
509   BX_KEY_DELETE,
510   BX_KEY_HOME,
511   BX_KEY_END,
512   BX_KEY_PAGE_UP,
513   BX_KEY_PAGE_DOWN,
514 
515   BX_KEY_KP_ADD,
516   BX_KEY_KP_SUBTRACT,
517   BX_KEY_KP_END,
518   BX_KEY_KP_DOWN,
519   BX_KEY_KP_PAGE_DOWN,
520   BX_KEY_KP_LEFT,
521   BX_KEY_KP_RIGHT,
522   BX_KEY_KP_HOME,
523   BX_KEY_KP_UP,
524   BX_KEY_KP_PAGE_UP,
525   BX_KEY_KP_INSERT,
526   BX_KEY_KP_DELETE,
527   BX_KEY_KP_5,
528 
529   BX_KEY_UP,
530   BX_KEY_DOWN,
531   BX_KEY_LEFT,
532   BX_KEY_RIGHT,
533 
534   BX_KEY_KP_ENTER,
535   BX_KEY_KP_MULTIPLY,
536   BX_KEY_KP_DIVIDE,
537 
538   BX_KEY_WIN_L,
539   BX_KEY_WIN_R,
540   BX_KEY_MENU,
541 
542   BX_KEY_ALT_SYSREQ,
543   BX_KEY_CTRL_BREAK,
544 
545   BX_KEY_INT_BACK,
546   BX_KEY_INT_FORWARD,
547   BX_KEY_INT_STOP,
548   BX_KEY_INT_MAIL,
549   BX_KEY_INT_SEARCH,
550   BX_KEY_INT_FAV,
551   BX_KEY_INT_HOME,
552 
553   BX_KEY_POWER_MYCOMP,
554   BX_KEY_POWER_CALC,
555   BX_KEY_POWER_SLEEP,
556   BX_KEY_POWER_POWER,
557   BX_KEY_POWER_WAKE,
558 
559   BX_KEY_NBKEYS
560 };
561 // If you add BX_KEYs, don't forget this:
562 // - the last entry must be BX_KEY_NBKEYS
563 // - upate the scancodes table in the file iodev/scancodes.cc
564 // - update the bx_key_symbol table in the file gui/keymap.cc
565 
566 
567 /////////////// GUI plugin support
568 
569 // Define macro to supply gui plugin code.  This macro is called once in GUI to
570 // supply the plugin initialization methods.  Since it is nearly identical for
571 // each gui module, the macro is easier to maintain than pasting the same code
572 // in each one.
573 //
574 // Each gui should declare a class pointer called "theGui" which is derived
575 // from bx_gui_c, before calling this macro.  For example, the SDL port
576 // says:
577 //   static bx_sdl_gui_c *theGui;
578 
579 #define IMPLEMENT_GUI_PLUGIN_CODE(gui_name)                             \
580   PLUGIN_ENTRY_FOR_GUI_MODULE(gui_name)                                 \
581   {                                                                     \
582     if (mode == PLUGIN_INIT) {                                          \
583       genlog->info("installing %s module as the Bochs GUI", #gui_name); \
584       theGui = new bx_##gui_name##_gui_c ();                            \
585       bx_gui = theGui;                                                  \
586     } else if (mode == PLUGIN_PROBE) {                                  \
587       return (int)PLUGTYPE_GUI;                                         \
588     }                                                                   \
589     return(0); /* Success */                                            \
590   }
591 
592 #endif
593