2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2011-02-25 01:05:47 +03:00
|
|
|
// $Id$
|
2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2021-01-23 15:06:11 +03:00
|
|
|
// Copyright (C) 2002-2021 The Bochs Project
|
2001-04-10 05:04:59 +04:00
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
2009-02-08 12:05:52 +03:00
|
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2001-04-10 05:04:59 +04:00
|
|
|
|
2021-01-30 22:40:18 +03:00
|
|
|
#ifndef BX_GUI_H
|
|
|
|
#define BX_GUI_H
|
|
|
|
|
|
|
|
#include "gui/siminterface.h"
|
|
|
|
|
2017-01-14 16:10:20 +03:00
|
|
|
// header bar and status bar stuff
|
|
|
|
#define BX_HEADER_BAR_Y 32
|
|
|
|
|
|
|
|
#define BX_MAX_PIXMAPS 17
|
|
|
|
#define BX_MAX_HEADERBAR_ENTRIES 12
|
|
|
|
|
|
|
|
// align pixmaps towards left or right side of header bar
|
|
|
|
#define BX_GRAVITY_LEFT 10
|
|
|
|
#define BX_GRAVITY_RIGHT 11
|
|
|
|
|
2004-02-07 17:34:35 +03:00
|
|
|
#define BX_MAX_STATUSITEMS 10
|
|
|
|
|
2017-01-14 16:10:20 +03:00
|
|
|
// gui dialog capabilities
|
2006-06-07 23:40:15 +04:00
|
|
|
#define BX_GUI_DLG_FLOPPY 0x01
|
|
|
|
#define BX_GUI_DLG_CDROM 0x02
|
|
|
|
#define BX_GUI_DLG_SNAPSHOT 0x04
|
|
|
|
#define BX_GUI_DLG_RUNTIME 0x08
|
|
|
|
#define BX_GUI_DLG_USER 0x10
|
|
|
|
#define BX_GUI_DLG_SAVE_RESTORE 0x20
|
|
|
|
#define BX_GUI_DLG_ALL 0x3F
|
2005-11-12 19:09:55 +03:00
|
|
|
|
2010-05-18 19:33:41 +04:00
|
|
|
// text mode blink feature
|
2008-01-29 00:52:09 +03:00
|
|
|
#define BX_TEXT_BLINK_MODE 0x01
|
|
|
|
#define BX_TEXT_BLINK_TOGGLE 0x02
|
|
|
|
#define BX_TEXT_BLINK_STATE 0x04
|
|
|
|
|
2020-07-30 23:04:31 +03:00
|
|
|
// modifier keys
|
|
|
|
#define BX_MOD_KEY_SHIFT 0x01
|
|
|
|
#define BX_MOD_KEY_CTRL 0x02
|
|
|
|
#define BX_MOD_KEY_ALT 0x04
|
|
|
|
#define BX_MOD_KEY_CAPS 0x08
|
|
|
|
|
2010-05-18 19:33:41 +04:00
|
|
|
// mouse capture toggle feature
|
2010-05-16 13:01:36 +04:00
|
|
|
#define BX_MT_KEY_CTRL 0x01
|
|
|
|
#define BX_MT_KEY_ALT 0x02
|
|
|
|
#define BX_MT_KEY_F10 0x04
|
2010-05-18 19:33:41 +04:00
|
|
|
#define BX_MT_KEY_F12 0x08
|
|
|
|
#define BX_MT_MBUTTON 0x10
|
|
|
|
#define BX_MT_LBUTTON 0x20
|
|
|
|
#define BX_MT_RBUTTON 0x40
|
2010-05-16 13:01:36 +04:00
|
|
|
|
2011-08-01 22:21:25 +04:00
|
|
|
#define BX_GUI_MT_CTRL_MB (BX_MT_KEY_CTRL | BX_MT_MBUTTON)
|
|
|
|
#define BX_GUI_MT_CTRL_LRB (BX_MT_KEY_CTRL | BX_MT_LBUTTON | BX_MT_RBUTTON)
|
|
|
|
#define BX_GUI_MT_CTRL_F10 (BX_MT_KEY_CTRL | BX_MT_KEY_F10)
|
|
|
|
#define BX_GUI_MT_F12 (BX_MT_KEY_F12)
|
|
|
|
#define BX_GUI_MT_CTRL_ALT (BX_MT_KEY_CTRL | BX_MT_KEY_ALT)
|
|
|
|
|
2003-05-18 14:44:26 +04:00
|
|
|
typedef struct {
|
2004-04-09 19:04:54 +04:00
|
|
|
Bit16u start_address;
|
|
|
|
Bit8u cs_start;
|
|
|
|
Bit8u cs_end;
|
|
|
|
Bit16u line_offset;
|
|
|
|
Bit16u line_compare;
|
|
|
|
Bit8u h_panning;
|
|
|
|
Bit8u v_panning;
|
2021-01-30 21:32:52 +03:00
|
|
|
bool line_graphics;
|
|
|
|
bool split_hpanning;
|
2008-01-29 00:52:09 +03:00
|
|
|
Bit8u blink_flags;
|
2012-01-22 16:22:03 +04:00
|
|
|
Bit8u actl_palette[16];
|
2003-05-18 14:44:26 +04:00
|
|
|
} bx_vga_tminfo_t;
|
2003-05-07 23:15:47 +04:00
|
|
|
|
2004-08-15 23:27:15 +04:00
|
|
|
typedef struct {
|
|
|
|
Bit16u bpp, pitch;
|
|
|
|
Bit8u red_shift, green_shift, blue_shift;
|
|
|
|
Bit8u is_indexed, is_little_endian;
|
|
|
|
unsigned long red_mask, green_mask, blue_mask;
|
2021-01-30 21:32:52 +03:00
|
|
|
bool snapshot_mode;
|
2004-08-15 23:27:15 +04:00
|
|
|
} bx_svga_tileinfo_t;
|
|
|
|
|
2003-05-07 23:15:47 +04:00
|
|
|
|
2017-01-28 03:22:28 +03:00
|
|
|
BOCHSAPI_MSVCONLY Bit8u reverse_bitorder(Bit8u);
|
2017-01-03 23:59:59 +03:00
|
|
|
|
2002-10-25 01:07:56 +04:00
|
|
|
BOCHSAPI extern class bx_gui_c *bx_gui;
|
2001-04-10 05:04:59 +04:00
|
|
|
|
2005-04-29 23:06:24 +04:00
|
|
|
#if BX_SUPPORT_X86_64
|
|
|
|
#define BOCHS_WINDOW_NAME "Bochs x86-64 emulator, http://bochs.sourceforge.net/"
|
|
|
|
#else
|
|
|
|
#define BOCHS_WINDOW_NAME "Bochs x86 emulator, http://bochs.sourceforge.net/"
|
|
|
|
#endif
|
2002-10-25 01:07:56 +04:00
|
|
|
|
|
|
|
// The bx_gui_c class provides data and behavior that is common to
|
|
|
|
// all guis. Each gui implementation will override the abstract methods.
|
|
|
|
class BOCHSAPI bx_gui_c : public logfunctions {
|
2001-04-10 05:04:59 +04:00
|
|
|
public:
|
merge in BRANCH-io-cleanup.
To see the commit logs for this use either cvsweb or
cvs update -r BRANCH-io-cleanup and then 'cvs log' the various files.
In general this provides a generic interface for logging.
logfunctions:: is a class that is inherited by some classes, and also
. allocated as a standalone global called 'genlog'. All logging uses
. one of the ::info(), ::error(), ::ldebug(), ::panic() methods of this
. class through 'BX_INFO(), BX_ERROR(), BX_DEBUG(), BX_PANIC()' macros
. respectively.
.
. An example usage:
. BX_INFO(("Hello, World!\n"));
iofunctions:: is a class that is allocated once by default, and assigned
as the iofunction of each logfunctions instance. It is this class that
maintains the file descriptor and other output related code, at this
point using vfprintf(). At some future point, someone may choose to
write a gui 'console' for bochs to which messages would be redirected
simply by assigning a different iofunction class to the various logfunctions
objects.
More cleanup is coming, but this works for now. If you want to see alot
of debugging output, in main.cc, change onoff[LOGLEV_DEBUG]=0 to =1.
Comments, bugs, flames, to me: todd@fries.net
2001-05-15 18:49:57 +04:00
|
|
|
bx_gui_c (void);
|
2002-10-25 01:07:56 +04:00
|
|
|
virtual ~bx_gui_c ();
|
|
|
|
// Define the following functions in the module for your particular GUI
|
2011-07-11 21:36:10 +04:00
|
|
|
// (x.cc, win32.cc, ...)
|
2012-03-03 16:41:24 +04:00
|
|
|
virtual void specific_init(int argc, char **argv, unsigned header_bar_y) = 0;
|
2002-10-25 01:07:56 +04:00
|
|
|
virtual void text_update(Bit8u *old_text, Bit8u *new_text,
|
2001-04-10 05:04:59 +04:00
|
|
|
unsigned long cursor_x, unsigned long cursor_y,
|
2012-01-22 16:22:03 +04:00
|
|
|
bx_vga_tminfo_t *tm_info) = 0;
|
2012-10-15 23:43:06 +04:00
|
|
|
virtual void graphics_tile_update(Bit8u *tile, unsigned x, unsigned y) = 0;
|
2002-10-25 01:07:56 +04:00
|
|
|
virtual void handle_events(void) = 0;
|
|
|
|
virtual void flush(void) = 0;
|
|
|
|
virtual void clear_screen(void) = 0;
|
2021-01-30 21:32:52 +03:00
|
|
|
virtual bool palette_change(Bit8u index, Bit8u red, Bit8u green, Bit8u blue) = 0;
|
2003-06-28 12:04:31 +04:00
|
|
|
virtual void dimension_update(unsigned x, unsigned y, unsigned fheight=0, unsigned fwidth=0, unsigned bpp=8) = 0;
|
2002-10-25 01:07:56 +04:00
|
|
|
virtual unsigned create_bitmap(const unsigned char *bmap, unsigned xdim, unsigned ydim) = 0;
|
|
|
|
virtual unsigned headerbar_bitmap(unsigned bmap_id, unsigned alignment, void (*f)(void)) = 0;
|
|
|
|
virtual void replace_bitmap(unsigned hbar_id, unsigned bmap_id) = 0;
|
|
|
|
virtual void show_headerbar(void) = 0;
|
|
|
|
virtual int get_clipboard_text(Bit8u **bytes, Bit32s *nbytes) = 0;
|
|
|
|
virtual int set_clipboard_text(char *snapshot, Bit32u len) = 0;
|
2021-01-30 21:32:52 +03:00
|
|
|
virtual void mouse_enabled_changed_specific (bool val) = 0;
|
2017-01-15 14:44:43 +03:00
|
|
|
virtual void exit(void) = 0;
|
|
|
|
// new graphics API methods (compatibility mode in gui.cc)
|
|
|
|
virtual bx_svga_tileinfo_t *graphics_tile_info(bx_svga_tileinfo_t *info);
|
|
|
|
virtual Bit8u *graphics_tile_get(unsigned x, unsigned y, unsigned *w, unsigned *h);
|
|
|
|
virtual void graphics_tile_update_in_place(unsigned x, unsigned y, unsigned w, unsigned h);
|
2020-11-15 12:55:38 +03:00
|
|
|
// new text update API
|
2021-01-30 21:32:52 +03:00
|
|
|
virtual void set_font(bool lg) {}
|
2020-11-15 12:55:38 +03:00
|
|
|
virtual void draw_char(Bit8u ch, Bit8u fc, Bit8u bc, Bit16u xc, Bit16u yc,
|
|
|
|
Bit8u fw, Bit8u fh, Bit8u fx, Bit8u fy,
|
2021-01-30 21:32:52 +03:00
|
|
|
bool gfxcharw9, Bit8u cs, Bit8u ce, bool curs) {}
|
2017-01-15 14:44:43 +03:00
|
|
|
// optional gui methods (stubs or default code in gui.cc)
|
2021-01-30 21:32:52 +03:00
|
|
|
virtual void statusbar_setitem_specific(int element, bool active, bool w) {}
|
2006-01-25 20:37:22 +03:00
|
|
|
virtual void set_tooltip(unsigned hbar_id, const char *tip) {}
|
2002-12-06 22:34:32 +03:00
|
|
|
// set_display_mode() changes the mode between the configuration interface
|
|
|
|
// and the simulation. This is primarily intended for display libraries
|
2020-11-25 10:56:32 +03:00
|
|
|
// which have a full-screen mode such as SDL or term. The display mode is
|
|
|
|
// set to DISP_MODE_CONFIG before displaying any configuration menus,
|
2002-12-06 22:34:32 +03:00
|
|
|
// for panics that requires user input, when entering the debugger, etc. It
|
|
|
|
// is set to DISP_MODE_SIM when the Bochs simulation resumes. The
|
|
|
|
// enum is defined in gui/siminterface.h.
|
|
|
|
virtual void set_display_mode (disp_mode_t newmode) { /* default=no action*/ }
|
2002-10-25 01:07:56 +04:00
|
|
|
// These are only needed for the term gui. For all other guis they will
|
|
|
|
// have no effect.
|
|
|
|
// returns 32-bit bitmask in which 1 means the GUI should handle that signal
|
|
|
|
virtual Bit32u get_sighandler_mask () {return 0;}
|
|
|
|
// called when registered signal arrives
|
|
|
|
virtual void sighandler (int sig) {}
|
2002-10-28 02:33:13 +03:00
|
|
|
#if BX_USE_IDLE_HACK
|
|
|
|
// this is called from the CPU model when the HLT instruction is executed.
|
|
|
|
virtual void sim_is_idle(void) {}
|
|
|
|
#endif
|
2005-10-13 20:22:21 +04:00
|
|
|
virtual void show_ips(Bit32u ips_count);
|
2004-02-02 02:48:57 +03:00
|
|
|
virtual void beep_on(float frequency);
|
|
|
|
virtual void beep_off();
|
2004-02-22 16:03:02 +03:00
|
|
|
virtual void get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp);
|
2021-01-30 21:32:52 +03:00
|
|
|
virtual void set_mouse_mode_absxy(bool mode) {}
|
2017-01-14 00:37:06 +03:00
|
|
|
#if BX_USE_GUI_CONSOLE
|
2021-01-30 21:32:52 +03:00
|
|
|
virtual void set_console_edit_mode(bool mode) {}
|
2017-01-14 00:37:06 +03:00
|
|
|
#endif
|
2001-04-10 05:04:59 +04:00
|
|
|
|
|
|
|
// The following function(s) are defined already, and your
|
|
|
|
// GUI code calls them
|
|
|
|
static void key_event(Bit32u key);
|
2002-10-25 01:07:56 +04:00
|
|
|
static void set_text_charmap(Bit8u *fbuffer);
|
|
|
|
static void set_text_charbyte(Bit16u address, Bit8u data);
|
2006-01-25 20:37:22 +03:00
|
|
|
static Bit8u get_mouse_headerbar_id();
|
2001-04-10 05:04:59 +04:00
|
|
|
|
2012-01-21 16:15:10 +04:00
|
|
|
void init(int argc, char **argv, unsigned max_xres, unsigned max_yres,
|
|
|
|
unsigned x_tilesize, unsigned y_tilesize);
|
2006-09-18 00:37:28 +04:00
|
|
|
void cleanup(void);
|
2020-11-15 12:55:38 +03:00
|
|
|
void draw_char_common(Bit8u ch, Bit8u fc, Bit8u bc, Bit16u xc, Bit16u yc,
|
|
|
|
Bit8u fw, Bit8u fh, Bit8u fx, Bit8u fy,
|
2021-01-30 21:32:52 +03:00
|
|
|
bool gfxcharw9, Bit8u cs, Bit8u ce, bool curs);
|
2020-10-16 20:25:50 +03:00
|
|
|
void text_update_common(Bit8u *old_text, Bit8u *new_text,
|
2020-10-17 00:41:02 +03:00
|
|
|
Bit16u cursor_address, bx_vga_tminfo_t *tm_info);
|
2012-10-15 23:43:06 +04:00
|
|
|
void graphics_tile_update_common(Bit8u *tile, unsigned x, unsigned y);
|
2012-10-25 19:53:04 +04:00
|
|
|
bx_svga_tileinfo_t *graphics_tile_info_common(bx_svga_tileinfo_t *info);
|
|
|
|
Bit8u* get_snapshot_buffer(void) {return snapshot_buffer;}
|
2021-01-30 21:32:52 +03:00
|
|
|
bool palette_change_common(Bit8u index, Bit8u red, Bit8u green, Bit8u blue);
|
2006-09-18 00:37:28 +04:00
|
|
|
void update_drive_status_buttons(void);
|
2021-01-30 21:32:52 +03:00
|
|
|
static void mouse_enabled_changed(bool val);
|
|
|
|
int register_statusitem(const char *text, bool auto_off=0);
|
2015-07-13 19:56:06 +03:00
|
|
|
void unregister_statusitem(int id);
|
2021-01-30 21:32:52 +03:00
|
|
|
void statusbar_setitem(int element, bool active, bool w=0);
|
2006-09-18 00:37:28 +04:00
|
|
|
static void init_signal_handlers();
|
2008-09-26 15:05:07 +04:00
|
|
|
static void toggle_mouse_enable(void);
|
2021-01-30 21:32:52 +03:00
|
|
|
bool mouse_toggle_check(Bit32u key, bool pressed);
|
2010-05-16 13:01:36 +04:00
|
|
|
const char* get_toggle_info(void);
|
2020-07-30 23:04:31 +03:00
|
|
|
Bit8u get_modifier_keys(void);
|
2021-01-30 21:32:52 +03:00
|
|
|
Bit8u set_modifier_keys(Bit8u modifier, bool pressed);
|
|
|
|
bool parse_user_shortcut(const char *val);
|
2012-06-24 13:14:43 +04:00
|
|
|
#if BX_DEBUGGER && BX_DEBUGGER_GUI
|
|
|
|
void init_debug_dialog(void);
|
2013-02-13 01:08:35 +04:00
|
|
|
void close_debug_dialog(void);
|
2012-06-24 13:14:43 +04:00
|
|
|
#endif
|
2017-01-13 18:57:36 +03:00
|
|
|
#if BX_USE_GUI_CONSOLE
|
2021-01-30 21:32:52 +03:00
|
|
|
bool has_gui_console(void) {return console.present;}
|
|
|
|
bool console_running(void) {return console.running;}
|
|
|
|
void console_refresh(bool force);
|
2017-01-01 20:45:06 +03:00
|
|
|
void console_key_enq(Bit8u key);
|
|
|
|
int bx_printf(const char *s);
|
|
|
|
char* bx_gets(char *s, int size);
|
2017-01-02 22:11:23 +03:00
|
|
|
#else
|
2021-01-30 21:32:52 +03:00
|
|
|
bool has_gui_console(void) {return 0;}
|
|
|
|
bool console_running(void) {return 0;}
|
|
|
|
void console_refresh(bool force) {}
|
2017-01-02 22:11:23 +03:00
|
|
|
void console_key_enq(Bit8u key) {}
|
2017-01-01 20:45:06 +03:00
|
|
|
#endif
|
2021-01-30 21:32:52 +03:00
|
|
|
bool has_command_mode(void) {return command_mode.present;}
|
|
|
|
bool command_mode_active(void) {return command_mode.active;}
|
|
|
|
void set_command_mode(bool active);
|
|
|
|
void set_fullscreen_mode(bool active) {fullscreen_mode = active;}
|
2020-08-24 18:31:14 +03:00
|
|
|
// marklog handler without button, called in gui command mode
|
|
|
|
static void marklog_handler(void);
|
2001-04-10 05:04:59 +04:00
|
|
|
|
2002-10-25 01:07:56 +04:00
|
|
|
protected:
|
2001-04-10 05:04:59 +04:00
|
|
|
// And these are defined and used privately in gui.cc
|
2017-01-14 16:10:20 +03:00
|
|
|
// header bar button handlers
|
2001-04-10 05:04:59 +04:00
|
|
|
static void floppyA_handler(void);
|
|
|
|
static void floppyB_handler(void);
|
2011-06-13 13:32:39 +04:00
|
|
|
static void cdrom1_handler(void);
|
2001-04-10 05:04:59 +04:00
|
|
|
static void reset_handler(void);
|
|
|
|
static void power_handler(void);
|
2002-03-11 18:04:58 +03:00
|
|
|
static void copy_handler(void);
|
|
|
|
static void paste_handler(void);
|
2001-04-10 05:04:59 +04:00
|
|
|
static void snapshot_handler(void);
|
2001-11-10 01:17:33 +03:00
|
|
|
static void config_handler(void);
|
2002-08-09 10:16:43 +04:00
|
|
|
static void userbutton_handler(void);
|
2006-06-07 02:11:09 +04:00
|
|
|
static void save_restore_handler(void);
|
2017-01-14 16:10:20 +03:00
|
|
|
// process clicks on the "classic" Bochs headerbar
|
|
|
|
void headerbar_click(int x);
|
2012-10-15 23:43:06 +04:00
|
|
|
// snapshot helper functions
|
2012-10-14 22:29:44 +04:00
|
|
|
static void make_text_snapshot(char **snapshot, Bit32u *length);
|
2021-01-30 21:32:52 +03:00
|
|
|
static Bit32u set_snapshot_mode(bool mode);
|
2012-10-14 22:29:44 +04:00
|
|
|
// status bar LED timer
|
2011-12-28 15:51:42 +04:00
|
|
|
static void led_timer_handler(void *);
|
|
|
|
void led_timer(void);
|
2017-01-13 18:57:36 +03:00
|
|
|
#if BX_USE_GUI_CONSOLE
|
2017-01-01 20:45:06 +03:00
|
|
|
void console_init(void);
|
|
|
|
void console_cleanup(void);
|
2017-01-02 22:11:23 +03:00
|
|
|
#else
|
|
|
|
void console_cleanup(void) {}
|
2017-01-01 20:45:06 +03:00
|
|
|
#endif
|
2011-12-28 15:51:42 +04:00
|
|
|
|
2012-10-14 22:29:44 +04:00
|
|
|
// header bar buttons
|
2021-01-30 21:32:52 +03:00
|
|
|
bool floppyA_status;
|
|
|
|
bool floppyB_status;
|
|
|
|
bool cdrom1_status;
|
2001-04-10 05:04:59 +04:00
|
|
|
unsigned floppyA_bmap_id, floppyA_eject_bmap_id, floppyA_hbar_id;
|
|
|
|
unsigned floppyB_bmap_id, floppyB_eject_bmap_id, floppyB_hbar_id;
|
2011-06-13 13:32:39 +04:00
|
|
|
unsigned cdrom1_bmap_id, cdrom1_eject_bmap_id, cdrom1_hbar_id;
|
2001-04-10 05:04:59 +04:00
|
|
|
unsigned power_bmap_id, power_hbar_id;
|
|
|
|
unsigned reset_bmap_id, reset_hbar_id;
|
2002-03-11 18:04:58 +03:00
|
|
|
unsigned copy_bmap_id, copy_hbar_id;
|
|
|
|
unsigned paste_bmap_id, paste_hbar_id;
|
2001-04-10 05:04:59 +04:00
|
|
|
unsigned snapshot_bmap_id, snapshot_hbar_id;
|
2001-11-10 01:17:33 +03:00
|
|
|
unsigned config_bmap_id, config_hbar_id;
|
2001-04-10 05:04:59 +04:00
|
|
|
unsigned mouse_bmap_id, nomouse_bmap_id, mouse_hbar_id;
|
2002-08-09 10:16:43 +04:00
|
|
|
unsigned user_bmap_id, user_hbar_id;
|
2006-06-07 02:11:09 +04:00
|
|
|
unsigned save_restore_bmap_id, save_restore_hbar_id;
|
2017-01-14 16:10:20 +03:00
|
|
|
// the "classic" Bochs headerbar
|
|
|
|
unsigned bx_headerbar_entries;
|
|
|
|
struct {
|
|
|
|
unsigned bmap_id;
|
|
|
|
unsigned xdim;
|
|
|
|
unsigned ydim;
|
|
|
|
unsigned xorigin;
|
|
|
|
unsigned alignment;
|
|
|
|
void (*f)(void);
|
|
|
|
} bx_headerbar_entry[BX_MAX_HEADERBAR_ENTRIES];
|
2012-10-14 22:29:44 +04:00
|
|
|
// text charmap
|
2020-11-16 18:39:35 +03:00
|
|
|
Bit8u vga_charmap[0x2000];
|
2021-01-30 21:32:52 +03:00
|
|
|
bool charmap_updated;
|
|
|
|
bool char_changed[256];
|
2012-10-14 22:29:44 +04:00
|
|
|
// status bar items
|
2004-02-07 17:34:35 +03:00
|
|
|
unsigned statusitem_count;
|
2011-12-28 15:51:42 +04:00
|
|
|
int led_timer_index;
|
|
|
|
struct {
|
2021-01-30 21:32:52 +03:00
|
|
|
bool in_use;
|
2011-12-28 15:51:42 +04:00
|
|
|
char text[8];
|
2021-01-30 21:32:52 +03:00
|
|
|
bool active;
|
|
|
|
bool mode; // read/write
|
|
|
|
bool auto_off;
|
2011-12-28 15:51:42 +04:00
|
|
|
Bit8u counter;
|
|
|
|
} statusitem[BX_MAX_STATUSITEMS];
|
2012-10-14 22:29:44 +04:00
|
|
|
// display mode
|
2002-12-06 22:34:32 +03:00
|
|
|
disp_mode_t disp_mode;
|
2012-10-14 22:29:44 +04:00
|
|
|
// new graphics API (with compatibility mode)
|
2021-01-30 21:32:52 +03:00
|
|
|
bool new_gfx_api;
|
2004-08-15 23:27:15 +04:00
|
|
|
Bit16u host_xres;
|
|
|
|
Bit16u host_yres;
|
|
|
|
Bit16u host_pitch;
|
|
|
|
Bit8u host_bpp;
|
2012-10-14 22:29:44 +04:00
|
|
|
Bit8u *framebuffer;
|
2020-11-15 12:55:38 +03:00
|
|
|
// new text update API
|
2021-01-30 21:32:52 +03:00
|
|
|
bool new_text_api;
|
2020-11-15 12:55:38 +03:00
|
|
|
Bit16u cursor_address;
|
|
|
|
bx_vga_tminfo_t tm_info;
|
2012-10-14 22:29:44 +04:00
|
|
|
// maximum guest display size and tile size
|
2012-01-22 13:08:59 +04:00
|
|
|
unsigned max_xres;
|
|
|
|
unsigned max_yres;
|
2012-01-21 16:15:10 +04:00
|
|
|
unsigned x_tilesize;
|
|
|
|
unsigned y_tilesize;
|
2012-10-14 22:29:44 +04:00
|
|
|
// current guest display settings
|
2021-01-30 21:32:52 +03:00
|
|
|
bool guest_textmode;
|
2020-11-22 12:02:38 +03:00
|
|
|
Bit8u guest_fwidth;
|
|
|
|
Bit8u guest_fheight;
|
2020-11-16 18:39:35 +03:00
|
|
|
Bit16u guest_xres;
|
|
|
|
Bit16u guest_yres;
|
|
|
|
Bit8u guest_bpp;
|
2012-10-15 23:43:06 +04:00
|
|
|
// graphics snapshot
|
2021-01-30 21:32:52 +03:00
|
|
|
bool snapshot_mode;
|
2012-10-15 23:43:06 +04:00
|
|
|
Bit8u *snapshot_buffer;
|
2012-10-14 22:29:44 +04:00
|
|
|
struct {
|
|
|
|
Bit8u blue;
|
2012-10-15 23:43:06 +04:00
|
|
|
Bit8u green;
|
|
|
|
Bit8u red;
|
2012-10-14 22:29:44 +04:00
|
|
|
Bit8u reserved;
|
|
|
|
} palette[256];
|
2020-07-30 23:04:31 +03:00
|
|
|
// modifier keys
|
|
|
|
Bit8u keymodstate;
|
2012-10-14 22:29:44 +04:00
|
|
|
// mouse toggle setup
|
2010-05-16 13:01:36 +04:00
|
|
|
Bit8u toggle_method;
|
|
|
|
Bit32u toggle_keystate;
|
|
|
|
char mouse_toggle_text[20];
|
2014-07-08 18:30:27 +04:00
|
|
|
// userbutton shortcut
|
|
|
|
Bit32u user_shortcut[4];
|
|
|
|
int user_shortcut_len;
|
2021-01-30 21:32:52 +03:00
|
|
|
bool user_shortcut_error;
|
2012-10-14 22:29:44 +04:00
|
|
|
// gui dialog capabilities
|
|
|
|
Bit32u dialog_caps;
|
2017-01-13 18:57:36 +03:00
|
|
|
#if BX_USE_GUI_CONSOLE
|
2017-01-01 20:45:06 +03:00
|
|
|
struct {
|
2021-01-30 21:32:52 +03:00
|
|
|
bool present;
|
|
|
|
bool running;
|
2017-01-01 20:45:06 +03:00
|
|
|
Bit8u *screen;
|
|
|
|
Bit8u *oldscreen;
|
2020-11-22 12:02:38 +03:00
|
|
|
Bit8u saved_fwidth;
|
|
|
|
Bit8u saved_fheight;
|
2020-11-16 18:39:35 +03:00
|
|
|
Bit16u saved_xres;
|
|
|
|
Bit16u saved_yres;
|
|
|
|
Bit8u saved_bpp;
|
2017-03-03 15:43:20 +03:00
|
|
|
Bit8u saved_palette[32];
|
2020-11-16 18:39:35 +03:00
|
|
|
Bit8u saved_charmap[0x2000];
|
2017-01-01 20:45:06 +03:00
|
|
|
unsigned cursor_x;
|
|
|
|
unsigned cursor_y;
|
2020-11-15 12:55:38 +03:00
|
|
|
Bit16u cursor_addr;
|
2017-01-01 20:45:06 +03:00
|
|
|
bx_vga_tminfo_t tminfo;
|
|
|
|
Bit8u keys[16];
|
|
|
|
Bit8u n_keys;
|
|
|
|
} console;
|
|
|
|
#endif
|
2020-07-15 19:26:46 +03:00
|
|
|
// command mode
|
|
|
|
struct {
|
2021-01-30 21:32:52 +03:00
|
|
|
bool present;
|
|
|
|
bool active;
|
2020-07-15 19:26:46 +03:00
|
|
|
} command_mode;
|
2021-01-30 21:32:52 +03:00
|
|
|
bool fullscreen_mode;
|
2020-08-21 22:12:37 +03:00
|
|
|
Bit32u marker_count;
|
2005-10-21 22:00:17 +04:00
|
|
|
};
|
2001-04-10 05:04:59 +04:00
|
|
|
|
|
|
|
|
2002-10-25 01:07:56 +04:00
|
|
|
// Add this macro in the class declaration of each GUI, to define all the
|
|
|
|
// required virtual methods. Example:
|
2008-02-06 01:57:43 +03:00
|
|
|
//
|
2002-10-25 01:07:56 +04:00
|
|
|
// class bx_rfb_gui_c : public bx_gui_c {
|
|
|
|
// public:
|
|
|
|
// bx_rfb_gui_c (void) {}
|
|
|
|
// DECLARE_GUI_VIRTUAL_METHODS()
|
|
|
|
// };
|
|
|
|
// Then, each method must be defined later in the file.
|
2004-08-15 23:27:15 +04:00
|
|
|
#define DECLARE_GUI_VIRTUAL_METHODS() \
|
2004-02-02 02:48:57 +03:00
|
|
|
virtual void specific_init(int argc, char **argv, \
|
2012-03-03 16:41:24 +04:00
|
|
|
unsigned header_bar_y); \
|
2004-02-02 02:48:57 +03:00
|
|
|
virtual void text_update(Bit8u *old_text, Bit8u *new_text, \
|
2008-01-26 03:00:31 +03:00
|
|
|
unsigned long cursor_x, unsigned long cursor_y, \
|
2012-03-03 16:41:24 +04:00
|
|
|
bx_vga_tminfo_t *tm_info); \
|
2012-10-15 23:43:06 +04:00
|
|
|
virtual void graphics_tile_update(Bit8u *tile, unsigned x, unsigned y); \
|
2004-02-02 02:48:57 +03:00
|
|
|
virtual void handle_events(void); \
|
|
|
|
virtual void flush(void); \
|
|
|
|
virtual void clear_screen(void); \
|
2021-01-30 21:32:52 +03:00
|
|
|
virtual bool palette_change(Bit8u index, Bit8u red, Bit8u green, Bit8u blue); \
|
2004-02-02 02:48:57 +03:00
|
|
|
virtual void dimension_update(unsigned x, unsigned y, unsigned fheight=0, \
|
2012-03-03 16:41:24 +04:00
|
|
|
unsigned fwidth=0, unsigned bpp=8); \
|
2004-02-02 02:48:57 +03:00
|
|
|
virtual unsigned create_bitmap(const unsigned char *bmap, \
|
2012-03-03 16:41:24 +04:00
|
|
|
unsigned xdim, unsigned ydim); \
|
2004-02-02 02:48:57 +03:00
|
|
|
virtual unsigned headerbar_bitmap(unsigned bmap_id, unsigned alignment, \
|
2012-03-03 16:41:24 +04:00
|
|
|
void (*f)(void)); \
|
2004-02-02 02:48:57 +03:00
|
|
|
virtual void replace_bitmap(unsigned hbar_id, unsigned bmap_id); \
|
|
|
|
virtual void show_headerbar(void); \
|
|
|
|
virtual int get_clipboard_text(Bit8u **bytes, Bit32s *nbytes); \
|
|
|
|
virtual int set_clipboard_text(char *snapshot, Bit32u len); \
|
2021-01-30 21:32:52 +03:00
|
|
|
virtual void mouse_enabled_changed_specific(bool val); \
|
2004-02-02 02:48:57 +03:00
|
|
|
virtual void exit(void); \
|
|
|
|
/* end of DECLARE_GUI_VIRTUAL_METHODS */
|
2002-10-25 01:07:56 +04:00
|
|
|
|
2004-08-15 23:27:15 +04:00
|
|
|
#define DECLARE_GUI_NEW_VIRTUAL_METHODS() \
|
|
|
|
virtual bx_svga_tileinfo_t *graphics_tile_info(bx_svga_tileinfo_t *info); \
|
|
|
|
virtual Bit8u *graphics_tile_get(unsigned x, unsigned y, \
|
2012-03-03 16:41:24 +04:00
|
|
|
unsigned *w, unsigned *h); \
|
2004-08-15 23:27:15 +04:00
|
|
|
virtual void graphics_tile_update_in_place(unsigned x, unsigned y, \
|
|
|
|
unsigned w, unsigned h);
|
|
|
|
/* end of DECLARE_GUI_NEW_VIRTUAL_METHODS */
|
|
|
|
|
2001-04-10 05:04:59 +04:00
|
|
|
#define BX_KEY_PRESSED 0x00000000
|
|
|
|
#define BX_KEY_RELEASED 0x80000000
|
|
|
|
|
2001-12-14 20:56:37 +03:00
|
|
|
#define BX_KEY_UNHANDLED 0x10000000
|
|
|
|
|
2019-12-26 19:14:31 +03:00
|
|
|
enum {
|
|
|
|
BX_KEY_CTRL_L,
|
|
|
|
BX_KEY_SHIFT_L,
|
|
|
|
|
|
|
|
BX_KEY_F1,
|
|
|
|
BX_KEY_F2,
|
|
|
|
BX_KEY_F3,
|
|
|
|
BX_KEY_F4,
|
|
|
|
BX_KEY_F5,
|
|
|
|
BX_KEY_F6,
|
|
|
|
BX_KEY_F7,
|
|
|
|
BX_KEY_F8,
|
|
|
|
BX_KEY_F9,
|
|
|
|
BX_KEY_F10,
|
|
|
|
BX_KEY_F11,
|
|
|
|
BX_KEY_F12,
|
|
|
|
|
|
|
|
BX_KEY_CTRL_R,
|
|
|
|
BX_KEY_SHIFT_R,
|
|
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
|
|
|
BX_KEY_INT_BACK,
|
|
|
|
BX_KEY_INT_FORWARD,
|
|
|
|
BX_KEY_INT_STOP,
|
|
|
|
BX_KEY_INT_MAIL,
|
|
|
|
BX_KEY_INT_SEARCH,
|
|
|
|
BX_KEY_INT_FAV,
|
|
|
|
BX_KEY_INT_HOME,
|
|
|
|
|
|
|
|
BX_KEY_POWER_MYCOMP,
|
|
|
|
BX_KEY_POWER_CALC,
|
|
|
|
BX_KEY_POWER_SLEEP,
|
|
|
|
BX_KEY_POWER_POWER,
|
|
|
|
BX_KEY_POWER_WAKE,
|
|
|
|
|
|
|
|
BX_KEY_NBKEYS
|
|
|
|
};
|
|
|
|
// If you add BX_KEYs, don't forget this:
|
|
|
|
// - the last entry must be BX_KEY_NBKEYS
|
|
|
|
// - upate the scancodes table in the file iodev/scancodes.cc
|
|
|
|
// - update the bx_key_symbol table in the file gui/keymap.cc
|
2002-10-25 01:07:56 +04:00
|
|
|
|
|
|
|
|
|
|
|
/////////////// GUI plugin support
|
|
|
|
|
|
|
|
// Define macro to supply gui plugin code. This macro is called once in GUI to
|
|
|
|
// supply the plugin initialization methods. Since it is nearly identical for
|
|
|
|
// each gui module, the macro is easier to maintain than pasting the same code
|
|
|
|
// in each one.
|
|
|
|
//
|
|
|
|
// Each gui should declare a class pointer called "theGui" which is derived
|
|
|
|
// from bx_gui_c, before calling this macro. For example, the SDL port
|
|
|
|
// says:
|
|
|
|
// static bx_sdl_gui_c *theGui;
|
|
|
|
|
2021-01-23 15:06:11 +03:00
|
|
|
#define IMPLEMENT_GUI_PLUGIN_CODE(gui_name) \
|
2021-01-24 22:47:04 +03:00
|
|
|
PLUGIN_ENTRY_FOR_GUI_MODULE(gui_name) \
|
|
|
|
{ \
|
2021-02-07 19:16:06 +03:00
|
|
|
if (mode == PLUGIN_INIT) { \
|
2021-01-23 15:06:11 +03:00
|
|
|
genlog->info("installing %s module as the Bochs GUI", #gui_name); \
|
|
|
|
theGui = new bx_##gui_name##_gui_c (); \
|
|
|
|
bx_gui = theGui; \
|
2021-02-07 19:16:06 +03:00
|
|
|
} else if (mode == PLUGIN_PROBE) { \
|
|
|
|
return (int)PLUGTYPE_GUI; \
|
2021-01-23 15:06:11 +03:00
|
|
|
} \
|
|
|
|
return(0); /* Success */ \
|
|
|
|
}
|
2021-01-30 22:40:18 +03:00
|
|
|
|
|
|
|
#endif
|