Improve compatibility of internal mouse driver with respect to video mode changes and hiding the pointer, and handle font reloading as a kind of mode change. Also fix unlocked mouse pointer to recognize the full range of tweaked/fontloaded text modes.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3914
This commit is contained in:
parent
ba3110ca07
commit
b293cfa044
4 changed files with 26 additions and 20 deletions
|
@ -36,6 +36,7 @@ void Mouse_ButtonPressed(Bit8u button);
|
|||
void Mouse_ButtonReleased(Bit8u button);
|
||||
|
||||
void Mouse_AutoLock(bool enable);
|
||||
void Mouse_NewVideoMode(void);
|
||||
void Mouse_BeforeNewVideoMode(bool setmode);
|
||||
void Mouse_AfterNewVideoMode(bool setmode);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "regs.h"
|
||||
#include "inout.h"
|
||||
#include "int10.h"
|
||||
#include "mouse.h"
|
||||
#include "setup.h"
|
||||
|
||||
Int10Data int10;
|
||||
|
@ -50,7 +51,9 @@ static Bitu INT10_Handler(void) {
|
|||
|
||||
switch (reg_ah) {
|
||||
case 0x00: /* Set VideoMode */
|
||||
INT10_SetVideoMode(reg_al);
|
||||
Mouse_BeforeNewVideoMode(true);
|
||||
INT10_SetVideoMode(reg_al);
|
||||
Mouse_AfterNewVideoMode(true);
|
||||
break;
|
||||
case 0x01: /* Set TextMode Cursor Shape */
|
||||
INT10_SetCursorShape(reg_ch,reg_cl);
|
||||
|
@ -202,6 +205,7 @@ static Bitu INT10_Handler(void) {
|
|||
case 0x11: /* Character generator functions */
|
||||
if (!IS_EGAVGA_ARCH)
|
||||
break;
|
||||
if ((reg_al&0xf0)==0x10) Mouse_BeforeNewVideoMode(false);
|
||||
switch (reg_al) {
|
||||
/* Textmode calls */
|
||||
case 0x00: /* Load user font */
|
||||
|
@ -311,6 +315,7 @@ graphics_chars:
|
|||
LOG(LOG_INT10,LOG_ERROR)("Function 11:Unsupported character generator call %2X",reg_al);
|
||||
break;
|
||||
}
|
||||
if ((reg_al&0xf0)==0x10) Mouse_AfterNewVideoMode(false);
|
||||
break;
|
||||
case 0x12: /* alternate function select */
|
||||
if (!IS_EGAVGA_ARCH)
|
||||
|
@ -536,8 +541,10 @@ graphics_chars:
|
|||
reg_ah=VESA_GetSVGAModeInformation(reg_cx,SegValue(es),reg_di);
|
||||
break;
|
||||
case 0x02: /* Set videomode */
|
||||
reg_al=0x4f;
|
||||
reg_ah=VESA_SetSVGAMode(reg_bx);
|
||||
Mouse_BeforeNewVideoMode(true);
|
||||
reg_al=0x4f;
|
||||
reg_ah=VESA_SetSVGAMode(reg_bx);
|
||||
Mouse_AfterNewVideoMode(true);
|
||||
break;
|
||||
case 0x03: /* Get videomode */
|
||||
reg_al=0x4f;
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "mem.h"
|
||||
#include "inout.h"
|
||||
#include "int10.h"
|
||||
#include "mouse.h"
|
||||
#include "vga.h"
|
||||
|
||||
#define _EGA_HALF_CLOCK 0x0001
|
||||
|
@ -447,8 +446,6 @@ static void FinishSetMode(bool clearmem) {
|
|||
case 14:RealSetVec(0x43,int10.rom.font_14);break;
|
||||
case 16:RealSetVec(0x43,int10.rom.font_16);break;
|
||||
}
|
||||
/* Tell mouse resolution change */
|
||||
Mouse_NewVideoMode();
|
||||
}
|
||||
|
||||
bool INT10_SetVideoMode_OTHER(Bit16u mode,bool clearmem) {
|
||||
|
|
|
@ -465,8 +465,8 @@ void Mouse_CursorMoved(float xrel,float yrel,float x,float y,bool emulate) {
|
|||
mouse.y += dy;
|
||||
} else {
|
||||
if (CurMode->type == M_TEXT) {
|
||||
mouse.x = x*CurMode->swidth;
|
||||
mouse.y = y*CurMode->sheight * 8 / CurMode->cheight;
|
||||
mouse.x = x*real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8;
|
||||
mouse.y = y*(real_readb(BIOSMEM_SEG,BIOSMEM_NB_ROWS)+1)*8;
|
||||
} else if ((mouse.max_x < 2048) || (mouse.max_y < 2048) || (mouse.max_x != mouse.max_y)) {
|
||||
if ((mouse.max_x > 0) && (mouse.max_y > 0)) {
|
||||
mouse.x = x*mouse.max_x;
|
||||
|
@ -590,12 +590,20 @@ static void Mouse_ResetHardware(void){
|
|||
PIC_SetIRQMask(MOUSE_IRQ,false);
|
||||
}
|
||||
|
||||
void Mouse_BeforeNewVideoMode(bool setmode) {
|
||||
if (CurMode->type!=M_TEXT) RestoreCursorBackground();
|
||||
else RestoreCursorBackgroundText();
|
||||
mouse.hidden = 1;
|
||||
mouse.oldhidden = 1;
|
||||
mouse.background = false;
|
||||
}
|
||||
|
||||
//Does way to much. Many things should be moved to mouse reset one day
|
||||
void Mouse_NewVideoMode(void) {
|
||||
void Mouse_AfterNewVideoMode(bool setmode) {
|
||||
mouse.inhibit_draw = false;
|
||||
/* Get the correct resolution from the current video mode */
|
||||
Bit8u mode = mem_readb(BIOS_VIDEO_MODE);
|
||||
if(mode == mouse.mode) {LOG(LOG_MOUSE,LOG_NORMAL)("New video is the same as the old"); /*return;*/}
|
||||
if (setmode && mode == mouse.mode) LOG(LOG_MOUSE,LOG_NORMAL)("New video mode is the same as the old");
|
||||
mouse.gran_x = (Bit16s)0xffff;
|
||||
mouse.gran_y = (Bit16s)0xffff;
|
||||
switch (mode) {
|
||||
|
@ -637,7 +645,6 @@ void Mouse_NewVideoMode(void) {
|
|||
return;
|
||||
}
|
||||
mouse.mode = mode;
|
||||
mouse.hidden = 1;
|
||||
mouse.max_x = 639;
|
||||
mouse.min_x = 0;
|
||||
mouse.min_y = 0;
|
||||
|
@ -648,7 +655,6 @@ void Mouse_NewVideoMode(void) {
|
|||
|
||||
mouse.hotx = 0;
|
||||
mouse.hoty = 0;
|
||||
mouse.background = false;
|
||||
mouse.screenMask = defaultScreenMask;
|
||||
mouse.cursorMask = defaultCursorMask;
|
||||
mouse.textAndMask= defaultTextAndMask;
|
||||
|
@ -662,7 +668,6 @@ void Mouse_NewVideoMode(void) {
|
|||
mouse.updateRegion_y[1] = 1;
|
||||
mouse.cursorType = 0;
|
||||
mouse.enabled=true;
|
||||
mouse.oldhidden=1;
|
||||
|
||||
oldmouseX = static_cast<Bit16s>(mouse.x);
|
||||
oldmouseY = static_cast<Bit16s>(mouse.y);
|
||||
|
@ -672,12 +677,8 @@ void Mouse_NewVideoMode(void) {
|
|||
|
||||
//Much too empty, Mouse_NewVideoMode contains stuff that should be in here
|
||||
static void Mouse_Reset(void) {
|
||||
/* Remove drawn mouse Legends of Valor */
|
||||
if (CurMode->type!=M_TEXT) RestoreCursorBackground();
|
||||
else RestoreCursorBackgroundText();
|
||||
mouse.hidden = 1;
|
||||
|
||||
Mouse_NewVideoMode();
|
||||
Mouse_BeforeNewVideoMode(false);
|
||||
Mouse_AfterNewVideoMode(false);
|
||||
Mouse_SetMickeyPixelRate(8,16);
|
||||
|
||||
mouse.mickey_x = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue