diff --git a/src/conio/bitmap_con.c b/src/conio/bitmap_con.c index 5554e29c68a20e0029426777578744e9a1d51a01..41fc86d600dca4ba31e4c392fbaf08e19c82c7f6 100644 --- a/src/conio/bitmap_con.c +++ b/src/conio/bitmap_con.c @@ -184,8 +184,17 @@ int bitmap_init_mode(int mode, int *width, int *height) cio_textinfo.attribute=7; cio_textinfo.normattr=7; cio_textinfo.currmode=mode; - cio_textinfo.screenheight=vstat.rows; - cio_textinfo.screenwidth=vstat.cols; + + if (vstat.rows > 0xff) + cio_textinfo.screenheight = 0xff; + else + cio_textinfo.screenheight = vstat.rows; + + if (vstat.cols > 0xff) + cio_textinfo.screenwidth = 0xff; + else + cio_textinfo.screenwidth = vstat.cols; + cio_textinfo.curx=1; cio_textinfo.cury=1; cio_textinfo.winleft=1; diff --git a/src/conio/win32cio.c b/src/conio/win32cio.c index 6db868aba8ad877a8c988524594afcb71abe1581..052faf51bd2b9fe400d9d731016438210e5af302 100644 --- a/src/conio/win32cio.c +++ b/src/conio/win32cio.c @@ -548,8 +548,17 @@ int win32_initciolib(long inmode) } else { /* Switch to closest mode to current screen size */ - cio_textinfo.screenwidth=sbuff.srWindow.Right-sbuff.srWindow.Left+1; - cio_textinfo.screenheight=sbuff.srWindow.Bottom-sbuff.srWindow.Top+1; + unsigned screenwidth = sbuff.srWindow.Right - sbuff.srWindow.Left + 1; + unsigned screenheight = sbuff.srWindow.Bottom - sbuff.srWindow.Top + 1; + if (screenwidth > 0xff) + cio_textinfo.screenwidth = 0xff; + else + cio_textinfo.screenwidth = screenwidth; + if (screenheight > 0xff) + cio_textinfo.screenheight = 0xff; + else + cio_textinfo.screenheight = screenheight; + if(cio_textinfo.screenwidth>=132) { if(cio_textinfo.screenheight<25) win32_textmode(VESA_132X21); @@ -644,7 +653,7 @@ void win32_textmode(int mode) if ((h=GetStdHandle(STD_OUTPUT_HANDLE)) == INVALID_HANDLE_VALUE) return; if (!SetConsoleScreenBufferSize(h,sz)) - return; + return; // Note: This fails and returns here with large windows (e.g. width > 255) if (!SetConsoleWindowInfo(h,TRUE,&rc)) return; sz.X=vparams[modeidx].cols;