mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-05-09 20:01:19 +08:00
Add int33 mickey threshold option to fix ultima underworld
This commit is contained in:
parent
ff350a308a
commit
4d27f7a193
@ -4759,6 +4759,13 @@ void DOSBOX_SetupConfigSections(void) {
|
||||
"spec: <number> position adjust, can be positive or negative\n"
|
||||
" max-excess if game sets maximum larger than int33 max x/y, adjust the position forward by the difference");
|
||||
|
||||
Pint = secprop->Add_int("int33 mickey threshold",Property::Changeable::WhenIdle,1);
|
||||
Pint->Set_help("The smallest amount of mouse motion that will be reported to the guest. Motion below this amount is buffered until the threshold is met.\n"
|
||||
"Some DOS programs do not properly respond to small mouse movements causing effects like a sluggish cursor or cursor drift.\n"
|
||||
"Increase this option to the smallest value that achieves natural feeling motion.\n"
|
||||
"- Ultima Underworld: Use 2");
|
||||
Pint->SetMinMax(1,16);
|
||||
|
||||
Pint = secprop->Add_int("mouse report rate",Property::Changeable::WhenIdle,0);
|
||||
Pint->Set_help("Mouse reporting rate, or 0 for auto. This affects how often mouse events are reported to the guest through the mouse interrupt.\n"
|
||||
"Some games including CyClone need a lower reporting rate to function correctly. Auto mode allows the guest to change the report rate through the PS/2 mouse emulation.\n"
|
||||
|
@ -50,6 +50,7 @@
|
||||
static bool adjust_x_max_excess = false,adjust_y_max_excess = false;
|
||||
static unsigned int assume_max_x = 0,assume_max_y = 0;
|
||||
static int adjust_x = 0,adjust_y = 0;
|
||||
static int mickey_threshold = 0;
|
||||
|
||||
#define VMWARE_PORT 0x5658u // communication port
|
||||
#define VMWARE_PORTHB 0x5659u // communication port, high bandwidth
|
||||
@ -210,7 +211,8 @@ static struct {
|
||||
float add_x,add_y;
|
||||
int16_t min_x,max_x,min_y,max_y;
|
||||
int16_t max_screen_x,max_screen_y;
|
||||
float mickey_x,mickey_y;
|
||||
int32_t mickey_x,mickey_y;
|
||||
float mickey_accum_x, mickey_accum_y;
|
||||
float x,y;
|
||||
float ps2x,ps2y;
|
||||
button_event event_queue[QUEUE_SIZE];
|
||||
@ -840,12 +842,22 @@ void Mouse_CursorMoved(float xrel,float yrel,float x,float y,bool emulate) {
|
||||
/* PC-98 mouse */
|
||||
if (IS_PC98_ARCH) pc98_mouse_movement_apply(xrel,yrel);
|
||||
|
||||
mouse.mickey_x += (dx * mouse.mickeysPerPixel_x);
|
||||
mouse.mickey_y += (dy * mouse.mickeysPerPixel_y);
|
||||
if (mouse.mickey_x >= 32768.0) mouse.mickey_x -= 65536.0;
|
||||
else if (mouse.mickey_x <= -32769.0) mouse.mickey_x += 65536.0;
|
||||
if (mouse.mickey_y >= 32768.0) mouse.mickey_y -= 65536.0;
|
||||
else if (mouse.mickey_y <= -32769.0) mouse.mickey_y += 65536.0;
|
||||
mouse.mickey_accum_x += (dx * mouse.mickeysPerPixel_x);
|
||||
mouse.mickey_accum_y += (dy * mouse.mickeysPerPixel_y);
|
||||
|
||||
if (fabs(mouse.mickey_accum_x) >= mickey_threshold) {
|
||||
mouse.mickey_x += truncf(mouse.mickey_accum_x);
|
||||
mouse.mickey_accum_x -= truncf(mouse.mickey_accum_x);
|
||||
}
|
||||
if (fabs(mouse.mickey_accum_y) >= mickey_threshold) {
|
||||
mouse.mickey_y += truncf(mouse.mickey_accum_y);
|
||||
mouse.mickey_accum_y -= truncf(mouse.mickey_accum_y);
|
||||
}
|
||||
|
||||
if (mouse.mickey_x >= 32768) mouse.mickey_x -= 65536;
|
||||
else if (mouse.mickey_x <= -32769) mouse.mickey_x += 65536;
|
||||
if (mouse.mickey_y >= 32768) mouse.mickey_y -= 65536;
|
||||
else if (mouse.mickey_y <= -32769) mouse.mickey_y += 65536;
|
||||
}
|
||||
|
||||
if (emulate) {
|
||||
@ -1501,6 +1513,8 @@ static void Mouse_Reset(void) {
|
||||
|
||||
mouse.mickey_x = 0;
|
||||
mouse.mickey_y = 0;
|
||||
mouse.mickey_accum_x = 0;
|
||||
mouse.mickey_accum_y = 0;
|
||||
|
||||
mouse.buttons = 0;
|
||||
|
||||
@ -2350,6 +2364,8 @@ void MOUSE_Startup(Section *sec) {
|
||||
user_mouse_report_rate=section->Get_int("mouse report rate");
|
||||
UpdateMouseReportRate();
|
||||
|
||||
mickey_threshold = section->Get_int("int33 mickey threshold");
|
||||
|
||||
assume_max_x=section->Get_int("int33 max x");
|
||||
assume_max_y=section->Get_int("int33 max y");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user