From 7a02e4f5de25d0cc1bd9100e67274c52ca5193ba Mon Sep 17 00:00:00 2001 From: sparky4 Date: Wed, 14 Oct 2015 17:11:07 -0500 Subject: [PATCH] made g4et old video mode a function~ --- src/lib/16_head.h | 2 +- src/lib/modex16.c | 22 +++++++++++++++++++--- src/lib/modex16.h | 1 + 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/lib/16_head.h b/src/lib/16_head.h index b7f550de..b613dc12 100755 --- a/src/lib/16_head.h +++ b/src/lib/16_head.h @@ -190,7 +190,7 @@ typedef struct typedef struct { - int old_mode; //old video mode before game! + long old_mode; //old video mode before game! byte *pee; // message for fps handle_t handle; //handles for file logging kurokku_t kurokku; //clock struct diff --git a/src/lib/modex16.c b/src/lib/modex16.c index ba033c9d..c56a9ddc 100755 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -51,9 +51,9 @@ void VGAmodeX(sword vq, global_game_variables_t *gv) break; case 1: // init the video // get old video mode - in.h.ah = 0xf; - int86(0x10, &in, &out); - gv->old_mode = out.h.al; + //in.h.ah = 0xf; + //int86(0x10, &in, &out); + gv->old_mode = vgaGetMode();//out.h.al; // enter mode modex__320x240_256__Enter(gv); break; @@ -78,6 +78,22 @@ vgaSetMode(byte mode) int86(VIDEO_INT, ®s, ®s); } +//--------------------------------------------------- +// +// Use the bios to get the current video mode +// + +long +vgaGetMode() +{ + union REGS rg; + + rg.h.ah = 0x0f; + int86(VIDEO_INT, &rg, &rg); + + return rg.h.al; +} + /* -========================= Entry Points ==========================- */ void modex__320x240_256__Enter(global_game_variables_t *gv) diff --git a/src/lib/modex16.h b/src/lib/modex16.h index 4936de39..d7d8e193 100755 --- a/src/lib/modex16.h +++ b/src/lib/modex16.h @@ -69,6 +69,7 @@ typedef union void VGAmodeX(sword vq, global_game_variables_t *gv); void modex__320x240_256__Enter(global_game_variables_t *gv); void modex__192x144_256__Enter(global_game_variables_t *gv); +long vgaGetMode(); void modexLeave(); void modexsetBaseXMode(void); page_t modexDefaultPage(); -- 2.39.5