- this is the patch from Hartmut Birr <hartmut.birr@tesionmail.de>
dated 2002-02-26.
This commit is contained in:
parent
221f2ebb63
commit
f9d5807034
@ -1,14 +1,14 @@
|
||||
----------------------------------------------------------------------
|
||||
Patch name: win32-console.patch
|
||||
Author: Hartmut Birr <hartmut.birr@tesionmail.de>
|
||||
Date:
|
||||
Date:
|
||||
|
||||
Detailed description:
|
||||
Add support for text modes with 8x8 characters on win32 gui.
|
||||
This is usefull for ROS (50 lines console).
|
||||
|
||||
Apply patch to:
|
||||
bochs-1.2.1
|
||||
bochs-1.3
|
||||
Instructions:
|
||||
To patch, go to main bochs directory.
|
||||
Type "patch -p1 < THIS_PATCH_FILE".
|
||||
@ -16,21 +16,21 @@ Instructions:
|
||||
Index: gui/win32.cc
|
||||
===================================================================
|
||||
RCS file: /cvsroot/bochs/bochs/gui/win32.cc,v
|
||||
retrieving revision 1.18
|
||||
diff -u -r1.18 win32.cc
|
||||
--- gui/win32.cc 2001/11/12 18:33:28 1.18
|
||||
+++ gui/win32.cc 2001/11/12 18:39:42
|
||||
retrieving revision 1.22
|
||||
diff -u -r1.22 win32.cc
|
||||
--- gui/win32.cc 21 Dec 2001 19:33:18 -0000 1.22
|
||||
+++ gui/win32.cc 27 Feb 2002 00:07:55 -0000
|
||||
@@ -116,6 +116,9 @@
|
||||
static unsigned prev_block_cursor_y = 0;
|
||||
static HBITMAP vgafont[256];
|
||||
static unsigned x_edge=0, y_edge=0, y_caption=0;
|
||||
+static yChar = 16;
|
||||
+static int yChar = 16;
|
||||
+static HFONT hFont[2];
|
||||
+static int FontId = 2;
|
||||
|
||||
static char szAppName[] = "Bochs for Windows";
|
||||
static char szWindowName[] = "Bochs for Windows - Display";
|
||||
@@ -140,10 +143,12 @@
|
||||
@@ -140,8 +143,11 @@
|
||||
void create_vga_font(void);
|
||||
static unsigned char reverse_bitorder(unsigned char);
|
||||
void DrawBitmap (HDC, HBITMAP, int, int, DWORD, unsigned char cColor);
|
||||
@ -40,11 +40,9 @@ diff -u -r1.18 win32.cc
|
||||
+void InitFont(void);
|
||||
+void DestroyFont(void);
|
||||
|
||||
-
|
||||
/* Macro to convert WM_ button state to BX button state */
|
||||
|
||||
#ifdef __MINGW32__
|
||||
@@ -281,7 +286,7 @@
|
||||
/* Macro to convert WM_ button state to BX button state */
|
||||
@@ -281,7 +287,7 @@
|
||||
|
||||
bx_headerbar_y = headerbar_y;
|
||||
dimension_x = 640;
|
||||
@ -53,17 +51,31 @@ diff -u -r1.18 win32.cc
|
||||
stretched_x = dimension_x;
|
||||
stretched_y = dimension_y;
|
||||
stretch_factor = 1;
|
||||
@@ -371,6 +376,9 @@
|
||||
@@ -362,8 +368,8 @@
|
||||
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
- stretched_x + x_edge * 2,
|
||||
- stretched_y + y_edge * 2 + y_caption,
|
||||
+ /*stretched_x*/dimension_x + x_edge * 2,
|
||||
+ /*stretched_y*/dimension_y + y_edge * 2 + y_caption,
|
||||
NULL,
|
||||
NULL,
|
||||
stInfo.hInstance,
|
||||
@@ -371,6 +377,8 @@
|
||||
|
||||
if (stInfo.hwnd) {
|
||||
ShowWindow (stInfo.hwnd, SW_SHOW);
|
||||
+ SetWindowPos (stInfo.hwnd, NULL, 0, 0, stretched_x + x_edge * 2,
|
||||
+ 480 + y_edge * 2 + y_caption, SWP_NOMOVE|SWP_NOZORDER);
|
||||
+
|
||||
UpdateWindow (stInfo.hwnd);
|
||||
|
||||
ShowCursor(!mouseCaptureMode);
|
||||
@@ -408,6 +416,7 @@
|
||||
@@ -405,9 +413,11 @@
|
||||
PAINTSTRUCT ps;
|
||||
RECT wndRect;
|
||||
POINT ptCursorPos;
|
||||
+ static int keydown = 0;
|
||||
|
||||
switch (iMsg) {
|
||||
case WM_CREATE:
|
||||
@ -71,7 +83,7 @@ diff -u -r1.18 win32.cc
|
||||
SetTimer (hwnd, 1, 330, NULL);
|
||||
bx_options.Omouse_enabled->set (mouseCaptureMode);
|
||||
if (mouseCaptureMode)
|
||||
@@ -477,6 +486,7 @@
|
||||
@@ -477,6 +487,7 @@
|
||||
case WM_DESTROY:
|
||||
KillTimer (hwnd, 1);
|
||||
stInfo.UIinited = FALSE;
|
||||
@ -79,7 +91,48 @@ diff -u -r1.18 win32.cc
|
||||
|
||||
PostQuitMessage (0);
|
||||
return 0;
|
||||
@@ -692,12 +702,21 @@
|
||||
@@ -501,13 +512,17 @@
|
||||
enq_key_event(HIWORD (lParam) & 0x01FF, BX_KEY_PRESSED);
|
||||
LeaveCriticalSection(&stInfo.keyCS);
|
||||
}
|
||||
+ keydown = 1;
|
||||
return 0;
|
||||
|
||||
case WM_KEYUP:
|
||||
case WM_SYSKEYUP:
|
||||
+ if (keydown)
|
||||
+ {
|
||||
EnterCriticalSection(&stInfo.keyCS);
|
||||
enq_key_event(HIWORD (lParam) & 0x01FF, BX_KEY_RELEASED);
|
||||
LeaveCriticalSection(&stInfo.keyCS);
|
||||
+ }
|
||||
return 0;
|
||||
|
||||
case WM_CHAR:
|
||||
@@ -521,7 +536,7 @@
|
||||
}
|
||||
|
||||
|
||||
-void enq_key_event(Bit32u key, Bit32u press_release) {
|
||||
+void enq_key_event(Bit32u key, Bit32u press_release) {
|
||||
if (((tail+1) % SCANCODE_BUFSIZE) == head) {
|
||||
BX_ERROR(( "enq_scancode: buffer full"));
|
||||
return;
|
||||
@@ -690,23 +705,30 @@
|
||||
Bit8u cursor_start, cursor_end;
|
||||
unsigned nchars;
|
||||
|
||||
- cursor_start = cursor_state >> 8;
|
||||
- cursor_end = cursor_state & 0xff;
|
||||
+ cursor_start = (cursor_state >> 8) & 0x1f;
|
||||
+ cursor_end = cursor_state & 0x1f;
|
||||
|
||||
if (!stInfo.UIinited) return;
|
||||
-
|
||||
+
|
||||
EnterCriticalSection(&stInfo.drawCS);
|
||||
|
||||
hdc = GetDC(stInfo.hwnd);
|
||||
|
||||
// Number of characters on screen, variable number of rows
|
||||
nchars = 80*nrows;
|
||||
@ -89,59 +142,60 @@ diff -u -r1.18 win32.cc
|
||||
cChar = new_text[(prev_block_cursor_y*80 + prev_block_cursor_x)*2];
|
||||
- DrawBitmap(hdc, vgafont[cChar], prev_block_cursor_x*8,
|
||||
- prev_block_cursor_y*16 + bx_headerbar_y, SRCCOPY,
|
||||
+ if(yChar<16)
|
||||
+ {
|
||||
- new_text[((prev_block_cursor_y*80 + prev_block_cursor_x)*2)+1]);
|
||||
+ if(yChar<16) {
|
||||
+ DrawChar(hdc, cChar, prev_block_cursor_x*8,
|
||||
+ prev_block_cursor_y*yChar + bx_headerbar_y,
|
||||
+ new_text[((prev_block_cursor_y*80 + prev_block_cursor_x)*2)+1]);
|
||||
+ prev_block_cursor_y*yChar + bx_headerbar_y,
|
||||
+ new_text[((prev_block_cursor_y*80 + prev_block_cursor_x)*2)+1]);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ else {
|
||||
+ DrawBitmap(hdc, vgafont[cChar], prev_block_cursor_x*8,
|
||||
+ prev_block_cursor_y*16 + bx_headerbar_y, SRCCOPY,
|
||||
new_text[((prev_block_cursor_y*80 + prev_block_cursor_x)*2)+1]);
|
||||
+ prev_block_cursor_y*16 + bx_headerbar_y, SRCCOPY,
|
||||
+ new_text[((prev_block_cursor_y*80 + prev_block_cursor_x)*2)+1]);
|
||||
+ }
|
||||
}
|
||||
|
||||
for (i=0; i<nchars*2; i+=2) {
|
||||
@@ -709,7 +728,14 @@
|
||||
@@ -718,9 +740,16 @@
|
||||
x = (i/2) % 80;
|
||||
y = (i/2) / 80;
|
||||
|
||||
- DrawBitmap(hdc, vgafont[cChar], x*8, y*16 + bx_headerbar_y, SRCCOPY, new_text[i+1]);
|
||||
+ if(yChar<16)
|
||||
+ {
|
||||
+ DrawChar(hdc, cChar, x*8, y*yChar + bx_headerbar_y, new_text[i+1]);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ DrawBitmap(hdc, vgafont[cChar], x*8, y*16 + bx_headerbar_y, SRCCOPY, new_text[i+1]);
|
||||
+ }
|
||||
DrawBitmap(hdc, vgafont[cChar], x*8, y*16 + bx_headerbar_y, SRCCOPY, new_text[i+1]);
|
||||
}
|
||||
}
|
||||
+ }
|
||||
|
||||
@@ -722,8 +748,15 @@
|
||||
prev_block_cursor_x = cursor_x;
|
||||
prev_block_cursor_y = cursor_y;
|
||||
@@ -731,9 +760,16 @@
|
||||
//reverse background and foreground colors
|
||||
char cAttr = new_text[((cursor_y*80 + cursor_x)*2)+1];
|
||||
cAttr = ((cAttr>>4)&0xf)+((cAttr&0xf)<<4);
|
||||
- DrawBitmap(hdc, vgafont[cChar], cursor_x*8, cursor_y*16 + bx_headerbar_y,
|
||||
+ if (yChar<16)
|
||||
+ {
|
||||
+ DrawChar(hdc, cChar, cursor_x*8, cursor_y*yChar + bx_headerbar_y, cAttr);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ DrawBitmap(hdc, vgafont[cChar], cursor_x*8, cursor_y*16 + bx_headerbar_y,
|
||||
DrawBitmap(hdc, vgafont[cChar], cursor_x*8, cursor_y*16 + bx_headerbar_y,
|
||||
SRCCOPY, cAttr);
|
||||
+ }
|
||||
}
|
||||
+ }
|
||||
|
||||
ReleaseDC(stInfo.hwnd, hdc);
|
||||
@@ -811,7 +844,22 @@
|
||||
|
||||
@@ -820,7 +856,23 @@
|
||||
stretched_y *= 2;
|
||||
stretch_factor *= 2;
|
||||
}
|
||||
-
|
||||
+
|
||||
+ FontId = 2; // 16
|
||||
+ yChar = 16;
|
||||
+ if (y > 480)
|
||||
@ -161,10 +215,89 @@ diff -u -r1.18 win32.cc
|
||||
SetWindowPos(stInfo.hwnd, HWND_TOP, 0, 0, stretched_x + x_edge * 2,
|
||||
stretched_y+ y_edge * 2 + y_caption,
|
||||
SWP_NOMOVE | SWP_NOZORDER);
|
||||
@@ -1120,6 +1168,105 @@
|
||||
@@ -921,12 +973,12 @@
|
||||
HGDIOBJ oldObj;
|
||||
|
||||
if (!headerbar_changed || !stInfo.UIinited) return;
|
||||
-
|
||||
+
|
||||
EnterCriticalSection(&stInfo.drawCS);
|
||||
-
|
||||
+
|
||||
oldObj = SelectObject(MemoryDC, MemoryBitmap);
|
||||
PatBlt (MemoryDC, 0, 0, dimension_x, bx_headerbar_y, BLACKNESS);
|
||||
-
|
||||
+
|
||||
for (unsigned i=0; i<bx_headerbar_entries; i++) {
|
||||
if (bx_headerbar_entry[i].alignment == BX_GRAVITY_LEFT)
|
||||
xorigin = bx_headerbar_entry[i].xorigin;
|
||||
@@ -1001,12 +1053,12 @@
|
||||
|
||||
unsigned char reverse_bitorder(unsigned char b) {
|
||||
unsigned char ret=0;
|
||||
-
|
||||
+
|
||||
for (unsigned i=0; i<8; i++) {
|
||||
ret |= (b & 0x01) << (7-i);
|
||||
b >>= 1;
|
||||
}
|
||||
-
|
||||
+
|
||||
return(ret);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1040,29 +1092,29 @@
|
||||
// BitBlt(MemoryDC, xStart, yStart, ptSize.x, ptSize.y, hdcMem, ptOrg.x,
|
||||
// ptOrg.y, dwRop);
|
||||
//Colors taken from Ralf Browns interrupt list.
|
||||
-//(0=black, 1=blue, 2=red, 3=purple, 4=green, 5=cyan, 6=yellow, 7=white)
|
||||
+//(0=black, 1=blue, 2=red, 3=purple, 4=green, 5=cyan, 6=yellow, 7=white)
|
||||
//The highest background bit usually means blinking characters. No idea
|
||||
//how to implement that so for now it's just implemented as color.
|
||||
//Note: it is also possible to program the VGA controller to have the
|
||||
//high bit for the foreground color enable blinking characters.
|
||||
|
||||
const COLORREF crPal[16] = {
|
||||
- RGB(0 ,0 ,0 ), //0 black
|
||||
- RGB(0 ,0 ,0xA8 ), //1 dark blue
|
||||
- RGB(0 ,0xA8 ,0 ), //2 dark green
|
||||
- RGB(0 ,0xA8 ,0xA8 ), //3 dark cyan
|
||||
- RGB(0xA8 ,0 ,0 ), //4 dark red
|
||||
- RGB(0xA8 ,0 ,0xA8 ), //5 dark magenta
|
||||
- RGB(0xA8 ,0x54 ,0 ), //6 brown
|
||||
- RGB(0xA8 ,0xA8 ,0xA8 ), //7 light gray
|
||||
- RGB(0x54 ,0x54 ,0x54 ), //8 dark gray
|
||||
- RGB(0x54 ,0x54 ,0xFC ), //9 light blue
|
||||
- RGB(0x54 ,0xFC ,0x54 ), //10 green
|
||||
- RGB(0x54 ,0xFC ,0xFC ), //11 cyan
|
||||
- RGB(0xFC ,0x54 ,0x54 ), //12 light red
|
||||
- RGB(0xFC ,0x54 ,0xFC ), //13 magenta
|
||||
- RGB(0xFC ,0xFC ,0x54 ), //14 yellow
|
||||
- RGB(0xFC ,0xFC ,0xFC ) //15 white
|
||||
+ RGB(0 ,0 ,0 ), //0 black
|
||||
+ RGB(0 ,0 ,0xA8 ), //1 dark blue
|
||||
+ RGB(0 ,0xA8 ,0 ), //2 dark green
|
||||
+ RGB(0 ,0xA8 ,0xA8 ), //3 dark cyan
|
||||
+ RGB(0xA8 ,0 ,0 ), //4 dark red
|
||||
+ RGB(0xA8 ,0 ,0xA8 ), //5 dark magenta
|
||||
+ RGB(0xA8 ,0x54 ,0 ), //6 brown
|
||||
+ RGB(0xA8 ,0xA8 ,0xA8 ), //7 light gray
|
||||
+ RGB(0x54 ,0x54 ,0x54 ), //8 dark gray
|
||||
+ RGB(0x54 ,0x54 ,0xFC ), //9 light blue
|
||||
+ RGB(0x54 ,0xFC ,0x54 ), //10 green
|
||||
+ RGB(0x54 ,0xFC ,0xFC ), //11 cyan
|
||||
+ RGB(0xFC ,0x54 ,0x54 ), //12 light red
|
||||
+ RGB(0xFC ,0x54 ,0xFC ), //13 magenta
|
||||
+ RGB(0xFC ,0xFC ,0x54 ), //14 yellow
|
||||
+ RGB(0xFC ,0xFC ,0xFC ) //15 white
|
||||
};
|
||||
|
||||
COLORREF crFore = SetTextColor(MemoryDC, crPal[(cColor>>4)&0xf]);
|
||||
@@ -1134,4 +1186,103 @@
|
||||
void
|
||||
bx_gui_c::mouse_enabled_changed_specific (Boolean val)
|
||||
{
|
||||
+}
|
||||
+
|
||||
+void DrawChar (HDC hdc, unsigned char c, int xStart, int yStart,
|
||||
+ unsigned char cColor) {
|
||||
@ -263,7 +396,4 @@ diff -u -r1.18 win32.cc
|
||||
+ {
|
||||
+ DeleteObject(hFont[i]);
|
||||
+ }
|
||||
+}
|
||||
|
||||
void
|
||||
bx_gui_c::mouse_enabled_changed_specific (Boolean val)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user