aboutsummaryrefslogtreecommitdiff
path: root/dosmain.c
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2022-04-03 00:03:15 +0200
committerJavier <dev.git@javispedro.com>2022-04-03 00:03:15 +0200
commit7d93442564b57c2d292df7f823c2115d3e0b8c12 (patch)
tree6a7e31e172ced11dde78f1b0a1f38fa2ab252697 /dosmain.c
parent3ca7b6c9cc23e118968b49a79f2b64fe4a3b73b3 (diff)
downloadvbados-7d93442564b57c2d292df7f823c2115d3e0b8c12.tar.gz
vbados-7d93442564b57c2d292df7f823c2115d3e0b8c12.zip
complete wheel support
Diffstat (limited to 'dosmain.c')
-rw-r--r--dosmain.c43
1 files changed, 34 insertions, 9 deletions
diff --git a/dosmain.c b/dosmain.c
index ee6389c..c35975e 100644
--- a/dosmain.c
+++ b/dosmain.c
@@ -28,6 +28,24 @@
#include "vbox.h"
#include "dostsr.h"
+static int set_wheel(LPTSRDATA data, bool enable)
+{
+ printf("Setting wheel support to %s\n", enable ? "enabled" : "disabled");
+ data->usewheel = enable;
+
+ if (data->usewheel) {
+ // Do a quick check for a mouse wheel here.
+ // The TSR will do its own check when it is reset anyway
+ if (data->haswheel = ps2m_detect_wheel()) {
+ printf("Wheel mouse found and enabled\n");
+ }
+ } else {
+ data->haswheel = false;
+ }
+
+ return 0;
+}
+
#if USE_VIRTUALBOX
static int set_integration(LPTSRDATA data, bool enable)
{
@@ -99,15 +117,7 @@ static int configure_driver(LPTSRDATA data)
}
// Let's utilize the wheel by default
- data->usewheel = true;
-
- if (data->usewheel) {
- // Do a quick check for a mouse wheel here.
- // The TSR will do its own check when it is reset anyway
- if (data->haswheel = ps2m_detect_wheel()) {
- printf("Wheel mouse found and enabled\n");
- }
- }
+ set_wheel(data, true);
#if USE_VIRTUALBOX
// Assume initially that we want integration and host cursor
@@ -232,6 +242,7 @@ static void print_help(void)
"Supported actions:\n"
"\tinstall install the driver (default)\n"
"\tuninstall uninstall the driver from memory\n"
+ "\twheel <ON|OFF> enable/disable wheel API support\n"
#if USE_VIRTUALBOX
"\tinteg <ON|OFF> enable/disable virtualbox integration\n"
"\thostcur <ON|OFF> enable/disable mouse cursor rendering in host\n"
@@ -289,6 +300,17 @@ int main(int argc, const char *argv[])
return EXIT_FAILURE;
}
return uninstall_driver(data);
+ } else if (stricmp(argv[argi], "wheel") == 0) {
+ bool enable = true;
+
+ if (!data) return driver_not_found();
+
+ argi++;
+ if (argi < argc) {
+ if (is_false(argv[argi])) enable = false;
+ }
+
+ return set_wheel(data, enable);
#if USE_VIRTUALBOX
} else if (stricmp(argv[argi], "integ") == 0) {
bool enable = true;
@@ -311,6 +333,9 @@ int main(int argc, const char *argv[])
if (is_false(argv[argi])) enable = false;
}
+ // Reset before changing this to ensure the cursor is not drawn
+ int33_reset();
+
return set_host_cursor(data, enable);
#endif
} else if (stricmp(argv[argi], "reset") == 0) {