Some dos VGA error handling. Misc TRACE changes.

This commit is contained in:
Chris Morgan 2002-07-29 23:51:57 +00:00 committed by Alexandre Julliard
parent bad8b4ca49
commit 6ecade7c84
5 changed files with 62 additions and 41 deletions

View File

@ -769,7 +769,8 @@ static void scroll_window(int direction, char lines, char row1,
{ {
if (!lines) /* Actually, clear the window */ if (!lines) /* Actually, clear the window */
{ {
VGA_ClearText(row1, col1, row2, col2, attribute); if(!VGA_ClearText(row1, col1, row2, col2, attribute))
ERR("VGA_ClearText failed!\n");
} }
else if (direction == SCROLL_UP) else if (direction == SCROLL_UP)
{ {
@ -792,7 +793,7 @@ void WINAPI DOSVM_PutChar(BYTE ascii)
BIOSDATA *data = DOSMEM_BiosData(); BIOSDATA *data = DOSMEM_BiosData();
unsigned xpos, ypos; unsigned xpos, ypos;
TRACE("char: 0x%02x\n", ascii); TRACE("char: 0x%02x(%c)\n", ascii, ascii);
VGA_PutChar(ascii); VGA_PutChar(ascii);
VGA_GetCursorPos(&xpos, &ypos); VGA_GetCursorPos(&xpos, &ypos);

View File

@ -549,12 +549,17 @@ int VGA_SetAlphaMode(unsigned Xres,unsigned Yres)
return 0; return 0;
} }
void VGA_GetAlphaMode(unsigned*Xres,unsigned*Yres) BOOL VGA_GetAlphaMode(unsigned*Xres,unsigned*Yres)
{ {
CONSOLE_SCREEN_BUFFER_INFO info; CONSOLE_SCREEN_BUFFER_INFO info;
GetConsoleScreenBufferInfo(VGA_AlphaConsole(),&info); if(!GetConsoleScreenBufferInfo(VGA_AlphaConsole(),&info))
if (Xres) *Xres=info.dwSize.X; {
if (Yres) *Yres=info.dwSize.Y; return FALSE;
} else {
if (Xres) *Xres=info.dwSize.X;
if (Yres) *Yres=info.dwSize.Y;
return TRUE;
}
} }
void VGA_SetCursorShape(unsigned char start_options, unsigned char end) void VGA_SetCursorShape(unsigned char start_options, unsigned char end)
@ -697,7 +702,7 @@ void VGA_SetTextAttribute(BYTE attr)
SetConsoleTextAttribute(VGA_AlphaConsole(), attr); SetConsoleTextAttribute(VGA_AlphaConsole(), attr);
} }
void VGA_ClearText(unsigned row1, unsigned col1, BOOL VGA_ClearText(unsigned row1, unsigned col1,
unsigned row2, unsigned col2, unsigned row2, unsigned col2,
BYTE attr) BYTE attr)
{ {
@ -705,7 +710,15 @@ void VGA_ClearText(unsigned row1, unsigned col1,
COORD off; COORD off;
char *dat = VGA_AlphaBuffer(); char *dat = VGA_AlphaBuffer();
HANDLE con = VGA_AlphaConsole(); HANDLE con = VGA_AlphaConsole();
VGA_GetAlphaMode(&width, &height);
/* return if we fail to get the height and width of the window */
if(!VGA_GetAlphaMode(&width, &height))
{
ERR("failed\n");
return FALSE;
}
TRACE("dat = %p, width = %d, height = %d\n", dat, width, height);
EnterCriticalSection(&vga_lock); EnterCriticalSection(&vga_lock);
@ -723,6 +736,8 @@ void VGA_ClearText(unsigned row1, unsigned col1,
} }
LeaveCriticalSection(&vga_lock); LeaveCriticalSection(&vga_lock);
return TRUE;
} }
void VGA_ScrollUpText(unsigned row1, unsigned col1, void VGA_ScrollUpText(unsigned row1, unsigned col1,

View File

@ -39,14 +39,14 @@ void VGA_Unlock(void);
/* text mode */ /* text mode */
int VGA_SetAlphaMode(unsigned Xres,unsigned Yres); int VGA_SetAlphaMode(unsigned Xres,unsigned Yres);
void VGA_GetAlphaMode(unsigned*Xres,unsigned*Yres); BOOL VGA_GetAlphaMode(unsigned*Xres,unsigned*Yres);
void VGA_SetCursorShape(unsigned char start_options,unsigned char end); void VGA_SetCursorShape(unsigned char start_options,unsigned char end);
void VGA_SetCursorPos(unsigned X,unsigned Y); void VGA_SetCursorPos(unsigned X,unsigned Y);
void VGA_GetCursorPos(unsigned*X,unsigned*Y); void VGA_GetCursorPos(unsigned*X,unsigned*Y);
void VGA_WriteChars(unsigned X,unsigned Y,unsigned ch,int attr,int count); void VGA_WriteChars(unsigned X,unsigned Y,unsigned ch,int attr,int count);
void VGA_PutChar(BYTE ascii); void VGA_PutChar(BYTE ascii);
void VGA_SetTextAttribute(BYTE attr); void VGA_SetTextAttribute(BYTE attr);
void VGA_ClearText(unsigned row1, unsigned col1, BOOL VGA_ClearText(unsigned row1, unsigned col1,
unsigned row2, unsigned col2, unsigned row2, unsigned col2,
BYTE attr); BYTE attr);
void VGA_ScrollUpText(unsigned row1, unsigned col1, void VGA_ScrollUpText(unsigned row1, unsigned col1,

View File

@ -58,9 +58,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(wave); WINE_DEFAULT_DEBUG_CHANNEL(wave);
/* Allow 1% deviation for sample rates (some ES137x cards) */
#define NEAR_MATCH(rate1,rate2) (((100*((int)(rate1)-(int)(rate2)))/(rate1))==0)
#ifdef HAVE_ARTS #ifdef HAVE_ARTS
#include <artsc.h> #include <artsc.h>

View File

@ -758,13 +758,18 @@ BOOL WINAPI GetConsoleMode(HANDLE hcon, LPDWORD mode)
* RETURNS * RETURNS
* Success: TRUE * Success: TRUE
* Failure: FALSE * Failure: FALSE
*
* mode:
* ENABLE_PROCESSED_INPUT 0x01
* ENABLE_LINE_INPUT 0x02
* ENABLE_ECHO_INPUT 0x04
* ENABLE_WINDOW_INPUT 0x08
* ENABLE_MOUSE_INPUT 0x10
*/ */
BOOL WINAPI SetConsoleMode(HANDLE hcon, DWORD mode) BOOL WINAPI SetConsoleMode(HANDLE hcon, DWORD mode)
{ {
BOOL ret; BOOL ret;
TRACE("(%x,%lx)\n", hcon, mode);
SERVER_START_REQ(set_console_mode) SERVER_START_REQ(set_console_mode)
{ {
req->handle = hcon; req->handle = hcon;
@ -775,6 +780,9 @@ BOOL WINAPI SetConsoleMode(HANDLE hcon, DWORD mode)
/* FIXME: when resetting a console input to editline mode, I think we should /* FIXME: when resetting a console input to editline mode, I think we should
* empty the S_EditString buffer * empty the S_EditString buffer
*/ */
TRACE("(%x,%lx) retval == %d\n", hcon, mode, ret);
return ret; return ret;
} }