diff --git a/bochs/gui/gui.cc b/bochs/gui/gui.cc index 1c7887c91..be4262b3d 100644 --- a/bochs/gui/gui.cc +++ b/bochs/gui/gui.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: gui.cc,v 1.45 2002-08-26 15:31:20 bdenney Exp $ +// $Id: gui.cc,v 1.46 2002-09-08 07:56:09 vruppert Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002 MandrakeSoft S.A. @@ -340,7 +340,6 @@ bx_gui_c::snapshot_handler(void) { char *text_snapshot; Bit32u len; - int flag; if (make_text_snapshot (&text_snapshot, &len) < 0) { BX_ERROR(( "snapshot button failed, mode not implemented")); return; @@ -480,4 +479,11 @@ bx_gui_c::init_signal_handlers () signal (sig, bx_signal_handler); } #endif +} + + void +bx_gui_c::set_text_charmap(Bit8u *fbuffer) +{ + memcpy(& BX_GUI_THIS vga_charmap, fbuffer, 0x2000); + BX_GUI_THIS charmap_changed = 1; } diff --git a/bochs/gui/gui.h b/bochs/gui/gui.h index 08998ce88..36053a5aa 100644 --- a/bochs/gui/gui.h +++ b/bochs/gui/gui.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: gui.h,v 1.28 2002-08-09 06:16:43 vruppert Exp $ +// $Id: gui.h,v 1.29 2002-09-08 07:56:09 vruppert Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002 MandrakeSoft S.A. @@ -48,6 +48,7 @@ public: static void show_headerbar(void); static int get_clipboard_text(Bit8u **bytes, Bit32s *nbytes); static int set_clipboard_text(char *snapshot, Bit32u len); + static void set_text_charmap(Bit8u *fbuffer); // The following function(s) are defined already, and your // GUI code calls them @@ -100,6 +101,9 @@ private: unsigned config_bmap_id, config_hbar_id; unsigned mouse_bmap_id, nomouse_bmap_id, mouse_hbar_id; unsigned user_bmap_id, user_hbar_id; + + unsigned char vga_charmap[0x2000]; + Boolean charmap_changed; }; diff --git a/bochs/gui/sdl.cc b/bochs/gui/sdl.cc index 5361de789..9fb30c6dd 100644 --- a/bochs/gui/sdl.cc +++ b/bochs/gui/sdl.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: sdl.cc,v 1.18 2002-04-20 07:19:35 vruppert Exp $ +// $Id: sdl.cc,v 1.19 2002-09-08 07:56:09 vruppert Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002 MandrakeSoft S.A. @@ -82,7 +82,6 @@ static unsigned bx_bitmap_right_xorigin = 0; // pixels from right int textres_x, textres_y; int fontwidth = 8, fontheight = 16; unsigned tilewidth, tileheight; -unsigned char *font = &sdl_font8x16[0][0]; unsigned char menufont[256][8]; Uint32 palette[256]; Uint32 headerbar_fg, headerbar_bg; @@ -197,7 +196,6 @@ void bx_gui_c::specific_init( unsigned header_bar_y) { int i,j; - Uint32 color, *buf; th->put("SDL"); @@ -205,6 +203,10 @@ void bx_gui_c::specific_init( tileheight = y_tilesize; headerbar_height = header_bar_y; + for(i=0;i<256;i++) + for(j=0;j<16;j++) + bx_gui.vga_charmap[i*32+j] = sdl_font8x16[i][j]; + for(i=0;i<256;i++) for(j=0;j<8;j++) menufont[i][j] = sdl_font8x8[i][j]; @@ -247,8 +249,6 @@ void bx_gui_c::text_update( Bit16u cursor_state, unsigned rows) { - char *oldText = (char *)old_text; - char *newText = (char *)new_text; unsigned char font_row, *pfont_row; unsigned long x,y; int hchars,fontrows,fontpixels; @@ -299,7 +299,7 @@ void bx_gui_c::text_update( // Display this one char fontrows = fontheight; - pfont_row = &font[(new_text[0]*fontheight)]; + pfont_row = &bx_gui.vga_charmap[(new_text[0] << 5)]; buf_char = buf; do { @@ -473,10 +473,6 @@ void bx_gui_c::handle_events(void) // Windows/Fullscreen toggle-check if( sdl_event.key.keysym.sym == SDLK_SCROLLOCK ) { - Uint32 *buf, *buf_row; - Uint32 *buf2, *buf_row2; - Uint32 disp, disp2; - int rows, cols; // SDL_WM_ToggleFullScreen( sdl_screen ); sdl_fullscreen_toggle = ~sdl_fullscreen_toggle; if( sdl_fullscreen_toggle == 0 ) @@ -594,30 +590,10 @@ void bx_gui_c::dimension_update( if( fheight > 0 ) { - if( fheight == 8 ) - { - if( font != &sdl_font8x8[0][0] ) - { - bx_gui.clear_screen(); - font = &sdl_font8x8[0][0]; - fontheight = 8; - fontwidth = 8; - } - } - else - { - if( fheight != 16 ) - { - y = y * 16 / fheight; - } - if( font != &sdl_font8x16[0][0] ) - { - bx_gui.clear_screen(); - font = &sdl_font8x16[0][0]; - fontheight = 16; - fontwidth = 8; - } - } + if (bx_gui.charmap_changed) bx_gui.clear_screen(); + bx_gui.charmap_changed = 0; + fontheight = fheight; + fontwidth = 8; } if( (x == res_x) && (y == res_y )) return; diff --git a/bochs/iodev/vga.cc b/bochs/iodev/vga.cc index 54122e3f8..bd302d30f 100644 --- a/bochs/iodev/vga.cc +++ b/bochs/iodev/vga.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: vga.cc,v 1.38 2002-08-27 19:54:46 bdenney Exp $ +// $Id: vga.cc,v 1.39 2002-09-08 07:56:10 vruppert Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002 MandrakeSoft S.A. @@ -938,7 +938,12 @@ BX_VGA_THIS s.sequencer.bit1 = (value >> 1) & 0x01; if (charmap1 > 3) charmap1 = (charmap1 & 3) + 4; charmap2 = (value & 0x2C) >> 2; if (charmap2 > 3) charmap2 = (charmap2 & 3) + 4; - BX_INFO(("char map select: #1=%d / #2=%d (unused)", charmap1, charmap2)); + if (BX_VGA_THIS s.CRTC.reg[0x09] > 0) { + bx_gui.set_text_charmap( + & BX_VGA_THIS s.vga_memory[0x20000 + (charmap1 << 13)]); + } + if (charmap2 != charmap1) + BX_INFO(("char map select: #2=%d (unused)", charmap2)); break; case 4: /* sequencer: memory mode register */ BX_VGA_THIS s.sequencer.extended_mem = (value >> 1) & 0x01; @@ -2264,6 +2269,7 @@ bx_vga_c::vbe_read(Bit32u address, unsigned io_len) } } BX_PANIC(("VBE_read shouldn't reach this")); + return 0; /* keep compiler happy */ } void