* AcessOS 1\r
* Video BIOS Extensions (Vesa) Driver\r
*/\r
-#define DEBUG 1\r
+#define DEBUG 0\r
#define VERSION 0x100\r
\r
#include <acess.h>\r
#include <vm8086.h>\r
#include "common.h"\r
#include <timers.h>\r
+#include <limits.h>\r
\r
// === CONSTANTS ===\r
#define USE_BIOS 1\r
int giVesaCurrentMode = 0;\r
tVesa_Mode gVesa_BootMode = {0x03, 80*8, 25*16, 80*8*2, 12, FLAG_POPULATED, 80*25*2, 0xB8000};\r
tVesa_Mode *gVesa_Modes;\r
-tVesa_Mode *gpVesaCurMode;\r
+tVesa_Mode *gpVesaCurMode = &gVesa_BootMode;\r
int giVesaModeCount = 0;\r
int gbVesaModesChecked;\r
// --- Framebuffer ---\r
\r
int VBE_int_MatchModes(tVideo_IOCtl_Mode *ReqMode, tVesa_Mode *ThisMode)\r
{\r
+ if( ThisMode->bpp == 0 ) {\r
+ Log_Warning("VBE", "VESA mode %x (%ix%i) has 0bpp",\r
+ ThisMode->code, ThisMode->width, ThisMode->height);\r
+ return INT_MAX;\r
+ }\r
LOG("Matching %ix%i %ibpp", ThisMode->width, ThisMode->height, ThisMode->bpp);\r
if(ThisMode->width == ReqMode->width && ThisMode->height == ReqMode->height)\r
{\r
\r
void Vesa_int_ShowCursor(void)\r
{\r
- if( gpVesaCurMode->flags & FLAG_LFB )\r
+ if( gpVesaCurMode && gpVesaCurMode->flags & FLAG_LFB )\r
{\r
gbVesa_CursorVisible = (giVesaCursorX >= 0);\r
if(gVesa_BufInfo.BufferFormat == VIDEO_BUFFMT_TEXT)\r
if( gVesa_BufInfo.BufferFormat != VIDEO_BUFFMT_TEXT )\r
return ;\r
\r
- if( gpVesaCurMode->flags & FLAG_LFB )\r
+ if( gpVesaCurMode && gpVesaCurMode->flags & FLAG_LFB )\r
{\r
if( gbVesa_CursorVisible )\r
DrvUtil_Video_RemoveCursor(&gVesa_BufInfo);\r