diff options
author | Eduardo Casino <mail@eduardocasino.es> | 2022-06-15 21:56:57 +0200 |
---|---|---|
committer | Javier <dev.git@javispedro.com> | 2022-07-14 19:50:31 +0200 |
commit | fbe961e941cea7f1294818fe76b281c24d7100dd (patch) | |
tree | c56c6a5b102a7f38d17e5e9c290505ab6dba4c3f /mousmain.c | |
parent | 86dd74209fe70bcaff060a5a02eae45b0d750403 (diff) | |
download | vbados-fbe961e941cea7f1294818fe76b281c24d7100dd.tar.gz vbados-fbe961e941cea7f1294818fe76b281c24d7100dd.zip |
Localization support
Diffstat (limited to 'mousmain.c')
-rw-r--r-- | mousmain.c | 101 |
1 files changed, 53 insertions, 48 deletions
@@ -22,6 +22,7 @@ #include <string.h> #include <dos.h> +#include "kitten.h" #include "version.h" #include "dlog.h" #include "int33.h" @@ -32,25 +33,27 @@ #include "dostsr.h" #include "mousetsr.h" +nl_catd cat; + #if USE_WHEEL static void detect_wheel(LPTSRDATA data) { // 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"); + printf(kittengets(1, 0, "Wheel mouse found and enabled\n")); } } static int set_wheel(LPTSRDATA data, bool enable) { - printf("Setting wheel support to %s\n", enable ? "enabled" : "disabled"); + printf(kittengets(1, 1, "Setting wheel support to %s\n"), enable ? kittengets(1, 2, "enabled") : kittengets(1, 3, "disabled")); data->usewheel = enable; if (data->usewheel) { detect_wheel(data); if (!data->haswheel) { - fprintf(stderr, "Could not find PS/2 wheel mouse\n"); + fprintf(stderr, kittengets(3, 0, "Could not find PS/2 wheel mouse\n")); } } else { data->haswheel = false; @@ -62,24 +65,24 @@ static int set_wheel(LPTSRDATA data, bool enable) static int set_wheel_key(LPTSRDATA data, const char *keyname) { if (!data->usewheel || !data->haswheel) { - fprintf(stderr, "Wheel not detected or support not enabled\n"); + fprintf(stderr, kittengets(3, 1, "Wheel not detected or support not enabled\n")); return EXIT_FAILURE; } if (keyname) { if (stricmp(keyname, "updn") == 0) { data->wheel_up_key = 0x4800; data->wheel_down_key = 0x5000; - printf("Generate Up Arrow / Down Arrow key presses on wheel movement\n"); + printf(kittengets(1, 4, "Generate Up Arrow / Down Arrow key presses on wheel movement\n")); } else if (stricmp(keyname, "pageupdn") == 0) { data->wheel_up_key = 0x4900; data->wheel_down_key = 0x5100; - printf("Generate PageUp / PageDown key presses on wheel movement\n"); + printf(kittengets(1, 5, "Generate PageUp / PageDown key presses on wheel movement\n")); } else { - fprintf(stderr, "Unknown key '%s'\n", keyname); + fprintf(stderr, kittengets(3, 2, "Unknown key '%s'\n"), keyname); return EXIT_FAILURE; } } else { - printf("Disabling wheel keystroke generation\n"); + printf(kittengets(1, 6, "Disabling wheel keystroke generation\n")); data->wheel_up_key = 0; data->wheel_down_key = 0; } @@ -97,23 +100,23 @@ static int set_virtualbox_integration(LPTSRDATA data, bool enable) err = vbox_init_device(&data->vb); if (err) { - fprintf(stderr, "Cannot find VirtualBox PCI device, err=%d\n", err); + fprintf(stderr, kittengets(3, 3, "Cannot find VirtualBox PCI device, err=%d\n"), err); return err; } err = vbox_init_buffer(&data->vb, VBOX_BUFFER_SIZE); if (err) { - fprintf(stderr, "Cannot lock buffer used for VirtualBox communication, err=%d\n", err); + fprintf(stderr, kittengets(3, 4, "Cannot lock buffer used for VirtualBox communication, err=%d\n"), err); return err; } err = vbox_report_guest_info(&data->vb, VBOXOSTYPE_DOS); if (err) { - fprintf(stderr, "VirtualBox communication is not working, err=%d\n", err); + fprintf(stderr, kittengets(3, 5, "VirtualBox communication is not working, err=%d\n"), err); return err; } - printf("VirtualBox integration enabled\n"); + printf(kittengets(1, 7, "VirtualBox integration enabled\n")); data->vbavail = true; data->vbhaveabs = true; } else { @@ -122,11 +125,11 @@ static int set_virtualbox_integration(LPTSRDATA data, bool enable) vbox_release_buffer(&data->vb); - printf("Disabled VirtualBox integration\n"); + printf(kittengets(1, 8, "Disabled VirtualBox integration\n")); data->vbavail = false; data->vbhaveabs = false; } else { - printf("VirtualBox integration already disabled or not available\n"); + printf(kittengets(1, 9, "VirtualBox integration already disabled or not available\n")); } } @@ -135,7 +138,7 @@ static int set_virtualbox_integration(LPTSRDATA data, bool enable) static int set_virtualbox_host_cursor(LPTSRDATA data, bool enable) { - printf("Setting host cursor to %s\n", enable ? "enabled" : "disabled"); + printf(kittengets(1, 10, "Setting host cursor to %s\n"), enable ? kittengets(1, 2, "enabled") : kittengets(1, 3, "disabled")); data->vbwantcursor = enable; return 0; @@ -154,18 +157,18 @@ static int set_vmware_integration(LPTSRDATA data, bool enable) version = vmware_get_version(); if (version < 0) { - fprintf(stderr, "Could not detect VMware, err=%ld\n", version); + fprintf(stderr, kittengets(3, 6, "Could not detect VMware, err=%ld\n"), version); return -1; } - printf("Found VMware protocol version %ld\n", version); + printf(kittengets(1, 11, "Found VMware protocol version %ld\n"), version); vmware_abspointer_cmd(VMWARE_ABSPOINTER_CMD_ENABLE); status = vmware_abspointer_status(); if ((status & VMWARE_ABSPOINTER_STATUS_MASK_ERROR) == VMWARE_ABSPOINTER_STATUS_MASK_ERROR) { - fprintf(stderr, "VMware absolute pointer error, err=0x%lx\n", + fprintf(stderr, kittengets(3, 7, "VMware absolute pointer error, err=0x%lx\n"), status & VMWARE_ABSPOINTER_STATUS_MASK_ERROR); return -1; } @@ -174,7 +177,7 @@ static int set_vmware_integration(LPTSRDATA data, bool enable) // TSR part will enable the absolute mouse when reset - printf("VMware integration enabled\n"); + printf(kittengets(1, 12, "VMware integration enabled\n")); data->vmwavail = true; } else { if (data->vmwavail) { @@ -182,9 +185,9 @@ static int set_vmware_integration(LPTSRDATA data, bool enable) vmware_abspointer_cmd(VMWARE_ABSPOINTER_CMD_DISABLE); data->vmwavail = false; - printf("Disabled VMware integration\n"); + printf(kittengets(1, 13, "Disabled VMware integration\n")); } else { - printf("VMware integration already disabled or not available\n"); + printf(kittengets(1, 14, "VMware integration already disabled or not available\n")); } } @@ -210,7 +213,7 @@ static int set_integration(LPTSRDATA data, bool enable) if (!err) return 0; #endif - printf("Neither VirtualBox nor VMware integration available\n"); + printf(kittengets(1, 15, "Neither VirtualBox nor VMware integration available\n")); return err; } else { #if USE_VIRTUALBOX @@ -234,7 +237,7 @@ static int set_host_cursor(LPTSRDATA data, bool enable) return set_virtualbox_host_cursor(data, enable); } #endif - printf("VirtualBox integration not available\n"); + printf(kittengets(1, 16, "VirtualBox integration not available\n")); return -1; } @@ -247,7 +250,7 @@ static int configure_driver(LPTSRDATA data) // Check for PS/2 mouse BIOS availability if ((err = ps2m_init(PS2M_PACKET_SIZE_PLAIN))) { - fprintf(stderr, "Cannot init PS/2 mouse BIOS, err=%d\n", err); + fprintf(stderr, kittengets(3, 8, "Cannot init PS/2 mouse BIOS, err=%d\n"), err); // Can't do anything without PS/2 return err; } @@ -303,7 +306,7 @@ static __declspec(aborts) int install_driver(LPTSRDATA data, bool high) _dos_setvect(0x2f, data:>int2f_isr); #endif - printf("Driver installed\n"); + printf(kittengets(1, 17, "Driver installed\n")); // If we reallocated ourselves to UMB, // it's time to free our initial conventional memory allocation @@ -311,6 +314,7 @@ static __declspec(aborts) int install_driver(LPTSRDATA data, bool high) finish_reallocation(_psp, FP_SEG(data)); } + kittenclose(); _dos_keep(EXIT_SUCCESS, get_paragraphs(resident_size)); // Shouldn't reach this part @@ -324,7 +328,7 @@ static bool check_if_driver_uninstallable(LPTSRDATA data) // Compare the segment of the installed handler to see if its ours // or someone else's if (FP_SEG(cur_int33_handler) != FP_SEG(data)) { - fprintf(stderr, "INT33 has been hooked by someone else, cannot safely remove\n"); + fprintf(stderr, kittengets(3, 9, "INT33 has been hooked by someone else, cannot safely remove\n")); return false; } @@ -333,7 +337,7 @@ static bool check_if_driver_uninstallable(LPTSRDATA data) void (__interrupt __far *cur_int2f_handler)() = _dos_getvect(0x2f); if (FP_SEG(cur_int2f_handler) != FP_SEG(data)) { - fprintf(stderr, "INT2F has been hooked by someone else, cannot safely remove\n"); + fprintf(stderr, kittengets(3, 10, "INT2F has been hooked by someone else, cannot safely remove\n")); return false; } } @@ -366,55 +370,54 @@ static int uninstall_driver(LPTSRDATA data) // it is always 256 bytes (16 paragraphs) before the TSR segment dos_free(FP_SEG(data) - (DOS_PSP_SIZE/16)); - printf("Driver uninstalled\n"); + printf(kittengets(1, 18, "Driver uninstalled\n")); return 0; } static int driver_reset(void) { - printf("Reset mouse driver\n"); + printf(kittengets(1, 19, "Reset mouse driver\n")); return int33_reset() == 0xFFFF; } static int driver_not_found(void) { - fprintf(stderr, "Driver data not found (driver not installed?)\n"); + fprintf(stderr, kittengets(3, 11, "Driver data not found (driver not installed?)\n")); return EXIT_FAILURE; } static void print_help(void) { - printf("\n" - "Usage: \n" - " VBMOUSE <ACTION> <ARGS..>\n\n" - "Supported actions:\n" - " install install the driver (default)\n" - " low install in conventional memory (otherwise UMB)\n" - " uninstall uninstall the driver from memory\n" + puts(kittengets(0, 0, "\n" + "Usage: ")); + puts(kittengets(0, 1, " VBMOUSE <ACTION> <ARGS..>\n")); + puts(kittengets(0, 2, "Supported actions:")); + puts(kittengets(0, 3, " install install the driver (default)")); + puts(kittengets(0, 4, " low install in conventional memory (otherwise UMB)")); + puts(kittengets(0, 5, " uninstall uninstall the driver from memory")); #if USE_WHEEL - " wheel <ON|OFF> enable/disable wheel API support\n" - " wheelkey <KEY|OFF> emulate a specific keystroke on wheel scroll\n" - " supported keys: updn, pageupdn\n" + puts(kittengets(0, 6, " wheel <ON|OFF> enable/disable wheel API support")); + puts(kittengets(0, 7, " wheelkey <KEY|OFF> emulate a specific keystroke on wheel scroll")); + puts(kittengets(0, 8, " supported keys: updn, pageupdn")); #endif #if USE_INTEGRATION - " integ <ON|OFF> enable/disable virtualbox integration\n" - " hostcur <ON|OFF> enable/disable mouse cursor rendering in host\n" + puts(kittengets(0, 9, " integ <ON|OFF> enable/disable virtualbox integration")); + puts(kittengets(0, 10, " hostcur <ON|OFF> enable/disable mouse cursor rendering in host")); #endif - " reset reset mouse driver settings\n" - ); + puts(kittengets(0, 11, " reset reset mouse driver settings")); } static int invalid_arg(const char *s) { - fprintf(stderr, "Invalid argument '%s'\n", s); + fprintf(stderr, kittengets(3, 12, "Invalid argument '%s'\n"), s); print_help(); return EXIT_FAILURE; } static int arg_required(const char *s) { - fprintf(stderr, "Argument required for '%s'\n", s); + fprintf(stderr, kittengets(3, 13, "Argument required for '%s'\n"), s); print_help(); return EXIT_FAILURE; } @@ -446,7 +449,9 @@ int main(int argc, const char *argv[]) LPTSRDATA data = get_tsr_data(true); int err, argi = 1; - printf("\nVBMouse %x.%x (like MSMOUSE %x.%x)\n", VERSION_MAJOR, VERSION_MINOR, REPORTED_VERSION_MAJOR, REPORTED_VERSION_MINOR); + cat = kittenopen("vbmouse"); + + printf(kittengets(1, 20, "\nVBMouse %x.%x (like MSMOUSE %x.%x)\n"), VERSION_MAJOR, VERSION_MINOR, REPORTED_VERSION_MAJOR, REPORTED_VERSION_MINOR); if (argi >= argc || stricmp(argv[argi], "install") == 0) { bool high = true; @@ -463,7 +468,7 @@ int main(int argc, const char *argv[]) } if (data) { - printf("VBMouse already installed\n"); + printf(kittengets(1, 21, "VBMouse already installed\n")); print_help(); return EXIT_SUCCESS; } |