From 78ec4927d4b395e18b54bb6e08189799ef3fa21e Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 12 Oct 2023 02:07:43 +0200 Subject: [PATCH 01/16] Added more parameters, including to clear CMOS, and removed -O / --debugcfg that was not used at all. --- src/86box.c | 150 +++++++++++++++++++++++++++----------- src/include/86box/86box.h | 1 - 2 files changed, 106 insertions(+), 45 deletions(-) diff --git a/src/86box.c b/src/86box.c index 9d41bd344..320eda721 100644 --- a/src/86box.c +++ b/src/86box.c @@ -123,7 +123,6 @@ int tracing_on = 0; /* Commandline options. */ int dump_on_exit = 0; /* (O) dump regs on exit */ -int do_dump_config = 0; /* (O) dump config on load */ int start_in_fullscreen = 0; /* (O) start in fullscreen */ #ifdef _WIN32 int force_debug = 0; /* (O) force debug output */ @@ -141,10 +140,14 @@ char rom_path[1024] = { '\0' }; /* (O) full path to ROMs */ rom_path_t rom_paths = { "", NULL }; /* (O) full paths to ROMs */ char log_path[1024] = { '\0' }; /* (O) full path of logfile */ char vm_name[1024] = { '\0' }; /* (O) display name of the VM */ +int do_nothing = 0; +int dump_missing = 0; #ifdef USE_INSTRUMENT -uint8_t instru_enabled = 0; -uint64_t instru_run_ms = 0; +uint8_t instru_enabled = 0; +uint64_t instru_run_ms = 0; #endif +int clear_cmos = 0; +int clear_flash = 0; /* Configuration values. */ int window_remember; @@ -398,6 +401,31 @@ pc_log(const char *fmt, ...) # define pc_log(fmt, ...) #endif +static void +delete_nvr_file(uint8_t flash) +{ + char *fn = NULL; + int c; + + /* Set up the NVR file's name. */ + c = strlen(machine_get_internal_name()) + 5; + fn = (char *) malloc(c + 1); + + if (fn == NULL) + fatal("Error allocating memory for the removal of the %s file\n", + flash ? "BIOS flash" : "CMOS"); + + if (flash) + sprintf(fn, "%s.bin", machine_get_internal_name()); + else + sprintf(fn, "%s.nvr", machine_get_internal_name()); + + remove(nvr_path(fn)); + + free(fn); + fn = NULL; +} + /* * Perform initial startup of the PC. * @@ -479,34 +507,39 @@ usage: printf("\nUsage: 86box [options] [cfg-file]\n\n"); printf("Valid options are:\n\n"); - printf("-? or --help - show this information\n"); - printf("-C or --config path - set 'path' to be config file\n"); + printf("-? or --help - show this information\n"); + printf("-B or --clearflash - clears the BIOS flash file\n"); + printf("-C or --config path - set 'path' to be config file\n"); #ifdef _WIN32 - printf("-D or --debug - force debug output logging\n"); + printf("-D or --debug - force debug output logging\n"); #endif #if 0 - printf("-E or --nographic - forces the old behavior\n"); + printf("-E or --nographic - forces the old behavior\n"); #endif - printf("-F or --fullscreen - start in fullscreen mode\n"); - printf("-G or --lang langid - start with specified language (e.g. en-US, or system)\n"); + printf("-F or --fullscreen - start in fullscreen mode\n"); + printf("-G or --lang langid - start with specified language (e.g. en-US, or system)\n"); #ifdef _WIN32 - printf("-H or --hwnd id,hwnd - sends back the main dialog's hwnd\n"); + printf("-H or --hwnd id,hwnd - sends back the main dialog's hwnd\n"); #endif - printf("-I or --image d:path - load 'path' as floppy image on drive d\n"); - printf("-L or --logfile path - set 'path' to be the logfile\n"); - printf("-N or --noconfirm - do not ask for confirmation on quit\n"); - printf("-O or --dumpcfg - dump config file after loading\n"); - printf("-P or --vmpath path - set 'path' to be root for vm\n"); - printf("-R or --rompath path - set 'path' to be ROM path\n"); - printf("-S or --settings - show only the settings dialog\n"); - printf("-V or --vmname name - overrides the name of the running VM\n"); - printf("-Z or --lastvmpath - the last parameter is VM path rather than config\n"); + printf("-I or --image d:path - load 'path' as floppy image on drive d\n"); +#ifdef USE_INSTRUMENT + printf("-J or --instrument name - set 'name' to be the profiling instrument\n"); +#endif + printf("-L or --logfile path - set 'path' to be the logfile\n"); + printf("-M or --dumpmissing - dump missing machines and video cards\n"); + printf("-N or --noconfirm - do not ask for confirmation on quit\n"); + printf("-P or --vmpath path - set 'path' to be root for vm\n"); + printf("-Q or --clearnvr - clears the CMOS file\n"); + printf("-R or --rompath path - set 'path' to be ROM path\n"); + printf("-S or --settings - show only the settings dialog\n"); + printf("-V or --vmname name - overrides the name of the running VM\n"); + printf("-X or --clearboth - clears the CMOS and BIOS flash files\n"); + printf("-Y or --donothing - do not show any UI or run the emulation\n"); + printf("-Z or --lastvmpath - the last parameter is VM path rather than config\n"); printf("\nA config file can be specified. If none is, the default file will be used.\n"); return 0; } else if (!strcasecmp(argv[c], "--lastvmpath") || !strcasecmp(argv[c], "-Z")) { lvmp = 1; - } else if (!strcasecmp(argv[c], "--dumpcfg") || !strcasecmp(argv[c], "-O")) { - do_dump_config = 1; #ifdef _WIN32 } else if (!strcasecmp(argv[c], "--debug") || !strcasecmp(argv[c], "-D")) { force_debug = 1; @@ -569,6 +602,17 @@ usage: settings_only = 1; } else if (!strcasecmp(argv[c], "--noconfirm") || !strcasecmp(argv[c], "-N")) { confirm_exit_cmdl = 0; + } else if (!strcasecmp(argv[c], "--dumpmissing") || !strcasecmp(argv[c], "-M")) { + dump_missing = 1; + } else if (!strcasecmp(argv[c], "--donothing") || !strcasecmp(argv[c], "-Y")) { + do_nothing = 1; + } else if (!strcasecmp(argv[c], "--clearflash") || !strcasecmp(argv[c], "-B")) { + clear_flash = 1; + } else if (!strcasecmp(argv[c], "--clearnvr") || !strcasecmp(argv[c], "-Q")) { + clear_cmos = 1; + } else if (!strcasecmp(argv[c], "--clearboth") || !strcasecmp(argv[c], "-X")) { + clear_cmos = 1; + clear_flash = 1; #ifdef _WIN32 } else if (!strcasecmp(argv[c], "--hwnd") || !strcasecmp(argv[c], "-H")) { @@ -578,9 +622,8 @@ usage: uid = (uint32_t *) &unique_id; shwnd = (uint32_t *) &source_hwnd; sscanf(argv[++c], "%08X%08X,%08X%08X", uid + 1, uid, shwnd + 1, shwnd); - } else if (!strcasecmp(argv[c], "--lang") || !strcasecmp(argv[c], "-G")) { - #endif + } else if (!strcasecmp(argv[c], "--lang") || !strcasecmp(argv[c], "-G")) { // This function is currently unimplemented for *nix but has placeholders. lang_init = plat_language_code(argv[++c]); @@ -590,13 +633,13 @@ usage: // The return value of 0 only means that the code is invalid, // not related to that translation is exists or not for the // selected language. - } else if (!strcasecmp(argv[c], "--test")) { + } else if (!strcasecmp(argv[c], "--test") || !strcasecmp(argv[c], "-T")) { /* some (undocumented) test function here.. */ /* .. and then exit. */ return 0; #ifdef USE_INSTRUMENT - } else if (!strcasecmp(argv[c], "--instrument")) { + } else if (!strcasecmp(argv[c], "--instrument") || !strcasecmp(argv[c], "-J")) { if ((c + 1) == argc) goto usage; instru_enabled = 1; @@ -779,6 +822,18 @@ usage: /* Load the configuration file. */ config_load(); + /* Clear the CMOS and/or BIOS flash file, if we were started with + the relevant parameter(s). */ + if (clear_cmos) { + delete_nvr_file(0); + clear_cmos = 0; + } + + if (clear_flash) { + delete_nvr_file(1); + clear_flash = 0; + } + for (uint8_t i = 0; i < FDD_NUM; i++) { if (fn[i] != NULL) { if (strlen(fn[i]) <= 511) @@ -826,27 +881,29 @@ pc_init_modules(void) wchar_t temp[512]; char tempc[512]; -#ifdef PRINT_MISSING_MACHINES_AND_VIDEO_CARDS - c = m = 0; - while (machine_get_internal_name_ex(c) != NULL) { - m = machine_available(c); - if (!m) - pclog("Missing machine: %s\n", machine_getname_ex(c)); - c++; - } + if (dump_missing) { + dump_missing = 0; - c = m = 0; - while (video_get_internal_name(c) != NULL) { - memset(tempc, 0, sizeof(tempc)); - device_get_name(video_card_getdevice(c), 0, tempc); - if ((c > 1) && !(tempc[0])) - break; - m = video_card_available(c); - if (!m) - pclog("Missing video card: %s\n", tempc); - c++; + c = m = 0; + while (machine_get_internal_name_ex(c) != NULL) { + m = machine_available(c); + if (!m) + pclog("Missing machine: %s\n", machine_getname_ex(c)); + c++; + } + + c = m = 0; + while (video_get_internal_name(c) != NULL) { + memset(tempc, 0, sizeof(tempc)); + device_get_name(video_card_getdevice(c), 0, tempc); + if ((c > 1) && !(tempc[0])) + break; + m = video_card_available(c); + if (!m) + pclog("Missing video card: %s\n", tempc); + c++; + } } -#endif pc_log("Scanning for ROM images:\n"); c = m = 0; @@ -945,6 +1002,11 @@ pc_init_modules(void) machine_status_init(); + if (do_nothing) { + do_nothing = 0; + exit(-1); + } + return 1; } diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index 471c0616d..62a57344e 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -78,7 +78,6 @@ extern "C" { extern uint32_t lang_sys; /* (-) system language code */ extern int dump_on_exit; /* (O) dump regs on exit*/ -extern int do_dump_config; /* (O) dump cfg after load */ extern int start_in_fullscreen; /* (O) start in fullscreen */ #ifdef _WIN32 extern int force_debug; /* (O) force debug output */ From 90d9a5b858ff299779143de55ce4eed9536fedc1 Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 12 Oct 2023 04:52:53 +0200 Subject: [PATCH 02/16] Moved the mouse uncapture key combination to variables for future reconfigurability. --- src/device/keyboard.c | 26 ++++++++++++++++++-------- src/include/86box/86box.h | 16 +++++++++++----- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/device/keyboard.c b/src/device/keyboard.c index 15eb06035..ade4b17e4 100644 --- a/src/device/keyboard.c +++ b/src/device/keyboard.c @@ -29,6 +29,21 @@ #include "cpu.h" int keyboard_scan; + +#ifdef _WIN32 +/* Windows: F8+F12 */ +uint16_t key_prefix_1 = 0x042; /* F8 */ +uint16_t key_prefix_2 = 0x000; /* Invalid */ +uint16_t key_uncapture_1 = 0x058; /* F12 */ +uint16_t key_uncapture_2 = 0x000; /* Invalid */ +#else +/* WxWidgets cannot do two regular keys.. CTRL+END */ +uint16_t key_prefix_1 = 0x01d; /* Left Ctrl */ +uint16_t key_prefix_2 = 0x11d; /* Right Ctrl */ +uint16_t key_uncapture_1 = 0x04f; /* Numpad End */ +uint16_t key_uncapture_2 = 0x14f; /* End */ +#endif + void (*keyboard_send)(uint16_t val); static int recv_key[512]; /* keyboard input buffer */ @@ -350,15 +365,10 @@ keyboard_isfsexit_up(void) return (!recv_key[0x01d] && !recv_key[0x11d] && !recv_key[0x038] && !recv_key[0x138] && !recv_key[0x051] && !recv_key[0x151]); } -/* Do we have F8-F12 in the keyboard buffer? */ +/* Do we have the mouse uncapture combination in the keyboard buffer? */ int keyboard_ismsexit(void) { -#ifdef _WIN32 - /* Windows: F8+F12 */ - return (recv_key[0x042] && recv_key[0x058]); -#else - /* WxWidgets cannot do two regular keys.. CTRL+END */ - return ((recv_key[0x01D] || recv_key[0x11D]) && (recv_key[0x04F] || recv_key[0x14F])); -#endif + return ((recv_key[key_prefix_1] || recv_key[key_prefix_2]) && + (recv_key[key_uncapture_1] || recv_key[key_uncapture_2])); } diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index 62a57344e..9c83843b5 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -146,13 +146,19 @@ extern int enable_discord; /* (C) enable Discord integration */ extern int fixed_size_x; extern int fixed_size_y; -extern double mouse_sensitivity; /* (C) Mouse sensitivity scale */ +extern double mouse_sensitivity; /* (C) Mouse sensitivity scale */ #ifdef _Atomic -extern _Atomic double mouse_x_error; /* Mouse error accumulator - Y */ -extern _Atomic double mouse_y_error; /* Mouse error accumulator - Y */ +extern _Atomic double mouse_x_error; /* Mouse error accumulator - Y */ +extern _Atomic double mouse_y_error; /* Mouse error accumulator - Y */ #endif -extern int pit_mode; /* (C) force setting PIT mode */ -extern int fm_driver; /* (C) select FM sound driver */ +extern int pit_mode; /* (C) force setting PIT mode */ +extern int fm_driver; /* (C) select FM sound driver */ + +/* Keyboard variables for future key combination redefinition. */ +extern uint16_t key_prefix_1; +extern uint16_t key_prefix_2; +extern uint16_t key_uncapture_1; +extern uint16_t key_uncapture_2; extern char exe_path[2048]; /* path (dir) of executable */ extern char usr_path[1024]; /* path (dir) of user data */ From e13e854944c6046f39d03cf8c38a4e27254fbcc3 Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 12 Oct 2023 05:08:11 +0200 Subject: [PATCH 03/16] Added support for a second prefix. --- src/device/keyboard.c | 21 +++++++++++++++------ src/include/86box/86box.h | 6 ++++-- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/device/keyboard.c b/src/device/keyboard.c index ade4b17e4..5f9986d7b 100644 --- a/src/device/keyboard.c +++ b/src/device/keyboard.c @@ -32,14 +32,18 @@ int keyboard_scan; #ifdef _WIN32 /* Windows: F8+F12 */ -uint16_t key_prefix_1 = 0x042; /* F8 */ -uint16_t key_prefix_2 = 0x000; /* Invalid */ +uint16_t key_prefix_1_1 = 0x042; /* F8 */ +uint16_t key_prefix_1_2 = 0x000; /* Invalid */ +uint16_t key_prefix_2_1 = 0x000; /* Invalid */ +uint16_t key_prefix_2_2 = 0x000; /* Invalid */ uint16_t key_uncapture_1 = 0x058; /* F12 */ uint16_t key_uncapture_2 = 0x000; /* Invalid */ #else /* WxWidgets cannot do two regular keys.. CTRL+END */ -uint16_t key_prefix_1 = 0x01d; /* Left Ctrl */ -uint16_t key_prefix_2 = 0x11d; /* Right Ctrl */ +uint16_t key_prefix_1_1 = 0x01d; /* Left Ctrl */ +uint16_t key_prefix_1_2 = 0x11d; /* Right Ctrl */ +uint16_t key_prefix_2_1 = 0x000; /* Invalid */ +uint16_t key_prefix_2_2 = 0x000; /* Invalid */ uint16_t key_uncapture_1 = 0x04f; /* Numpad End */ uint16_t key_uncapture_2 = 0x14f; /* End */ #endif @@ -369,6 +373,11 @@ keyboard_isfsexit_up(void) int keyboard_ismsexit(void) { - return ((recv_key[key_prefix_1] || recv_key[key_prefix_2]) && - (recv_key[key_uncapture_1] || recv_key[key_uncapture_2])); + if ((key_prefix_2_1 != 0x000) || (key_prefix_2_2 != 0x000)) + return ((recv_key[key_prefix_1_1] || recv_key[key_prefix_1_2]) && + (recv_key[key_prefix_2_1] || recv_key[key_prefix_2_2]) && + (recv_key[key_uncapture_1] || recv_key[key_uncapture_2])); + else + return ((recv_key[key_prefix_1_1] || recv_key[key_prefix_1_2]) && + (recv_key[key_uncapture_1] || recv_key[key_uncapture_2])); } diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index 9c83843b5..e0ff0e1d9 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -155,8 +155,10 @@ extern int pit_mode; /* (C) force setting PIT mode */ extern int fm_driver; /* (C) select FM sound driver */ /* Keyboard variables for future key combination redefinition. */ -extern uint16_t key_prefix_1; -extern uint16_t key_prefix_2; +extern uint16_t key_prefix_1_1; +extern uint16_t key_prefix_1_2; +extern uint16_t key_prefix_2_1; +extern uint16_t key_prefix_2_2; extern uint16_t key_uncapture_1; extern uint16_t key_uncapture_2; From 15104475a193257a5f79c2e59047be80367dc773 Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 12 Oct 2023 05:16:37 +0200 Subject: [PATCH 04/16] Added --keycodes / -K to allow redefining the mouse uncapture key combination. --- src/86box.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/86box.c b/src/86box.c index 320eda721..7ff4ff4c7 100644 --- a/src/86box.c +++ b/src/86box.c @@ -525,6 +525,7 @@ usage: #ifdef USE_INSTRUMENT printf("-J or --instrument name - set 'name' to be the profiling instrument\n"); #endif + printf("-K or --keycodes codes - set 'codes' to be the uncapture combination\n"); printf("-L or --logfile path - set 'path' to be the logfile\n"); printf("-M or --dumpmissing - dump missing machines and video cards\n"); printf("-N or --noconfirm - do not ask for confirmation on quit\n"); @@ -610,6 +611,13 @@ usage: clear_flash = 1; } else if (!strcasecmp(argv[c], "--clearnvr") || !strcasecmp(argv[c], "-Q")) { clear_cmos = 1; + } else if (!strcasecmp(argv[c], "--keycodes") || !strcasecmp(argv[c], "-K")) { + if ((c + 1) == argc) + goto usage; + + sscanf(argv[++c], "%03hX,%03hX,%03hX,%03hX,%03hX,%03hX", + &key_prefix_1_1, &key_prefix_1_2, &key_prefix_2_1, &key_prefix_2_2, + &key_uncapture_1, &key_uncapture_2); } else if (!strcasecmp(argv[c], "--clearboth") || !strcasecmp(argv[c], "-X")) { clear_cmos = 1; clear_flash = 1; From be4d1600245df995df677696a0a7f74108887b5e Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 13 Oct 2023 06:00:38 +0200 Subject: [PATCH 05/16] Fixed the state of the 486 DX2 WB CPU's used by the PC 330. --- src/cpu/cpu.c | 5 ++++- src/cpu/cpu_table.c | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 0f12cf773..848826264 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -1920,7 +1920,10 @@ cpu_CPUID(void) EDX = 0x49656e69; ECX = 0x6c65746e; } else if (EAX == 1) { - EAX = CPUID; + if ((CPUID == 0x0436) && (cr0 & (1 << 29))) + EAX = 0x0470; + else + EAX = CPUID; EBX = ECX = 0; EDX = CPUID_FPU | CPUID_VME; } else diff --git a/src/cpu/cpu_table.c b/src/cpu/cpu_table.c index cec3c4874..194089f72 100644 --- a/src/cpu/cpu_table.c +++ b/src/cpu/cpu_table.c @@ -439,13 +439,13 @@ const cpu_family_t cpu_families[] = { {"", 0} } }, { - .package = CPU_PKG_SOCKET3_PC330, + .package = CPU_PKG_SOCKET1 | CPU_PKG_SOCKET3_PC330, .manufacturer = "Intel", - .name = "i486DX2", + .name = "i486DX2 WB", .internal_name = "i486dx2_pc330", .cpus = (const CPU[]) { - {"50", CPU_i486DX_SLENH, fpus_internal, 50000000, 2, 5000, 0x470, 0x470, 0, CPU_SUPPORTS_DYNAREC, 8, 8,6,6, 6}, - {"66", CPU_i486DX_SLENH, fpus_internal, 66666666, 2, 5000, 0x470, 0x470, 0, CPU_SUPPORTS_DYNAREC, 12,12,6,6, 8}, + {"50", CPU_i486DX_SLENH, fpus_internal, 50000000, 2, 5000, 0x436, 0x436, 0, CPU_SUPPORTS_DYNAREC, 8, 8,6,6, 6}, + {"66", CPU_i486DX_SLENH, fpus_internal, 66666666, 2, 5000, 0x436, 0x436, 0, CPU_SUPPORTS_DYNAREC, 12,12,6,6, 8}, {"", 0} } }, { From 35ea25914fdb137079d44a7f09e82ea6afe85213 Mon Sep 17 00:00:00 2001 From: Alexander Babikov <2708460+lemondrops@users.noreply.github.com> Date: Fri, 13 Oct 2023 15:47:01 +0500 Subject: [PATCH 06/16] Point feature requests to discussions and machine requests to a dedicated issue --- .github/ISSUE_TEMPLATE/config.yml | 7 +++++-- .github/ISSUE_TEMPLATE/feature_request.md | 20 -------------------- 2 files changed, 5 insertions(+), 22 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index cc1ec7f8e..c03c50764 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,5 +1,8 @@ blank_issues_enabled: false contact_links: - - name: Question + - name: Machine Request + url: https://github.com/86Box/86Box/issues/3577#issue-comment-box + about: Please submit machine addition requests under this tracking issue. + - name: Feature Request or Question url: https://github.com/86Box/86Box/discussions - about: Please ask and answer questions here. + about: Please submit feature requests and ask questions here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 4fe86d5ec..000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: feature -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. From 5471b6eec70dd0ca22ae8ee8cb23c46677b01925 Mon Sep 17 00:00:00 2001 From: Alexander Babikov <2708460+lemondrops@users.noreply.github.com> Date: Fri, 13 Oct 2023 15:47:37 +0500 Subject: [PATCH 07/16] Mark most fields in the bug report form as mandatory --- .github/ISSUE_TEMPLATE/bug_report.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 95905f6aa..cdbc0a56f 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -12,26 +12,36 @@ body: label: What happened? description: Also tell us, what did you expect to happen? placeholder: Tell us what you see! + validations: + required: true - type: textarea attributes: label: Configuration file description: Please copy and paste your machine configuration file (`86box.cfg`). This will be automatically formatted into code, so no need for backticks. render: ini + validations: + required: true - type: input attributes: label: Operating system description: What is your host operating system? placeholder: e.g. Windows 10 + validations: + required: true - type: input attributes: label: CPU description: What is your host CPU? placeholder: e.g. AMD Ryzen 5 5600G + validations: + required: true - type: input attributes: label: 86Box version description: What version of 86Box are you running? (Saying "Latest from Jenkins" is not helpful.) placeholder: e.g. v4.0 build 5000 + validations: + required: true - type: dropdown attributes: label: Build architecture @@ -44,6 +54,8 @@ body: - macOS - Universal (Intel and Apple Silicon) - Windows - x64 (64-bit) - Windows - x86 (32-bit) + validations: + required: true - type: checkboxes attributes: label: Build type @@ -60,6 +72,8 @@ body: - Manager auto-update - I built 86Box myself (please tell us more about your build configuration) - I got 86Box from a third party repository (please tell us where) + validations: + required: true - type: textarea attributes: label: Additional context From ecf5d4e65214b929399ee0b141c550b11716c267 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 13 Oct 2023 13:10:05 -0400 Subject: [PATCH 08/16] Fix win32 mingw makefile builds --- src/win/Makefile.mingw | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/win/Makefile.mingw b/src/win/Makefile.mingw index 7cb5ec3a7..e02b9c25c 100644 --- a/src/win/Makefile.mingw +++ b/src/win/Makefile.mingw @@ -571,8 +571,6 @@ MAINOBJ := 86box.o config.o log.o random.o timer.o io.o acpi.o apm.o dma.o ddma. MEMOBJ := catalyst_flash.o i2c_eeprom.o intel_flash.o mem.o mmu_2386.o rom.o row.o \ smram.o spd.o sst_flash.o -CPU808XOBJ := queue.o - CPUOBJ := $(DYNARECOBJ) \ $(CGTOBJ) \ cpu.o cpu_table.o fpu.o x86.o \ @@ -801,7 +799,7 @@ ifeq ($(RTMIDI), y) SNDOBJ += midi_rtmidi.o endif -OBJ := $(MAINOBJ) $(CPU808XOBJ) $(CPUOBJ) $(CHIPSETOBJ) $(MCHOBJ) $(DEVOBJ) $(MEMOBJ) \ +OBJ := $(MAINOBJ) $(CPUOBJ) $(CHIPSETOBJ) $(MCHOBJ) $(DEVOBJ) $(MEMOBJ) \ $(FDDOBJ) $(GAMEOBJ) $(CDROMOBJ) $(ZIPOBJ) $(MOOBJ) $(HDDOBJ) $(MINIVHDOBJ) \ $(NETOBJ) $(PRINTOBJ) $(SCSIOBJ) $(SIOOBJ) $(SNDOBJ) $(VIDOBJ) $(VOODOOOBJ) \ $(PLATOBJ) $(UIOBJ) $(FSYNTHOBJ) $(MUNTOBJ) $(DEVBROBJ) $(MINITRACEOBJ) $(THREADOBJ) From dc44e37f62ac484b9aa12a8f28265122341cc242 Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 13 Oct 2023 23:03:37 +0200 Subject: [PATCH 09/16] Fixed the warnings reported by lemondrops. --- src/86box.c | 49 +++++++++++++++++++++++++++++---------------- src/video/vid_xga.c | 5 ----- 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/src/86box.c b/src/86box.c index 7ff4ff4c7..1afdc101d 100644 --- a/src/86box.c +++ b/src/86box.c @@ -142,12 +142,13 @@ char log_path[1024] = { '\0' }; /* (O) full path of logfile */ char vm_name[1024] = { '\0' }; /* (O) display name of the VM */ int do_nothing = 0; int dump_missing = 0; +int clear_cmos = 0; #ifdef USE_INSTRUMENT uint8_t instru_enabled = 0; uint64_t instru_run_ms = 0; #endif -int clear_cmos = 0; int clear_flash = 0; +int auto_paused = 0; /* Configuration values. */ int window_remember; @@ -155,7 +156,8 @@ int vid_resize; /* (C) allow r int invert_display = 0; /* (C) invert the display */ int suppress_overscan = 0; /* (C) suppress overscans */ int scale = 0; /* (C) screen scale factor */ -int dpi_scale = 0; /* (C) DPI scaling of the emulated screen */ +int dpi_scale = 0; /* (C) DPI scaling of the emulated + screen */ int vid_api = 0; /* (C) video renderer */ int vid_cga_contrast = 0; /* (C) video */ int video_fullscreen = 0; /* (C) video */ @@ -167,7 +169,8 @@ int video_filter_method = 1; /* (C) video * int video_vsync = 0; /* (C) video */ int video_framerate = -1; /* (C) video */ char video_shader[512] = { '\0' }; /* (C) video */ -bool serial_passthrough_enabled[SERIAL_MAX] = { 0, 0, 0, 0 }; /* (C) activation and kind of pass-through for serial ports */ +bool serial_passthrough_enabled[SERIAL_MAX] = { 0, 0, 0, 0 }; /* (C) activation and kind of + pass-through for serial ports */ int bugger_enabled = 0; /* (C) enable ISAbugger */ int postcard_enabled = 0; /* (C) enable POST card */ int isamem_type[ISAMEM_MAX] = { 0, 0, 0, 0 }; /* (C) enable ISA mem cards */ @@ -178,7 +181,8 @@ int sound_is_float = 1; /* (C) sound u int voodoo_enabled = 0; /* (C) video option */ int ibm8514_standalone_enabled = 0; /* (C) video option */ int xga_standalone_enabled = 0; /* (C) video option */ -uint32_t mem_size = 0; /* (C) memory size (Installed on system board)*/ +uint32_t mem_size = 0; /* (C) memory size (Installed on + system board)*/ uint32_t isa_mem_size = 0; /* (C) memory size (ISA Memory Cards) */ int cpu_use_dynarec = 0; /* (C) cpu uses/needs Dyna */ int cpu = 0; /* (C) cpu type */ @@ -191,8 +195,12 @@ int confirm_save = 1; /* (C) enable int enable_discord = 0; /* (C) enable Discord integration */ int pit_mode = -1; /* (C) force setting PIT mode */ int fm_driver = 0; /* (C) select FM sound driver */ -int open_dir_usr_path = 0; /* default file open dialog directory of usr_path */ -int video_fullscreen_scale_maximized = 0; /* (C) Whether fullscreen scaling settings also apply when maximized. */ +int open_dir_usr_path = 0; /* (C) default file open dialog directory + of usr_path */ +int video_fullscreen_scale_maximized = 0; /* (C) Whether fullscreen scaling settings + also apply when maximized. */ +int do_auto_pause = 0; /* (C) Auto-pause the emulator on focus + loss */ /* Statistics. */ extern int mmuflush; @@ -444,6 +452,7 @@ pc_init(int argc, char *argv[]) char *fn[FDD_NUM] = { NULL }; char drive = 0; char *temp2 = NULL; + char *what; const struct tm *info; time_t now; int c; @@ -508,7 +517,6 @@ usage: printf("\nUsage: 86box [options] [cfg-file]\n\n"); printf("Valid options are:\n\n"); printf("-? or --help - show this information\n"); - printf("-B or --clearflash - clears the BIOS flash file\n"); printf("-C or --config path - set 'path' to be config file\n"); #ifdef _WIN32 printf("-D or --debug - force debug output logging\n"); @@ -527,14 +535,13 @@ usage: #endif printf("-K or --keycodes codes - set 'codes' to be the uncapture combination\n"); printf("-L or --logfile path - set 'path' to be the logfile\n"); - printf("-M or --dumpmissing - dump missing machines and video cards\n"); + printf("-M or --missing - dump missing machines and video cards\n"); printf("-N or --noconfirm - do not ask for confirmation on quit\n"); printf("-P or --vmpath path - set 'path' to be root for vm\n"); - printf("-Q or --clearnvr - clears the CMOS file\n"); printf("-R or --rompath path - set 'path' to be ROM path\n"); printf("-S or --settings - show only the settings dialog\n"); printf("-V or --vmname name - overrides the name of the running VM\n"); - printf("-X or --clearboth - clears the CMOS and BIOS flash files\n"); + printf("-X or --clear what - clears the 'what' (cmos/flash/both)\n"); printf("-Y or --donothing - do not show any UI or run the emulation\n"); printf("-Z or --lastvmpath - the last parameter is VM path rather than config\n"); printf("\nA config file can be specified. If none is, the default file will be used.\n"); @@ -603,14 +610,10 @@ usage: settings_only = 1; } else if (!strcasecmp(argv[c], "--noconfirm") || !strcasecmp(argv[c], "-N")) { confirm_exit_cmdl = 0; - } else if (!strcasecmp(argv[c], "--dumpmissing") || !strcasecmp(argv[c], "-M")) { + } else if (!strcasecmp(argv[c], "--missing") || !strcasecmp(argv[c], "-M")) { dump_missing = 1; } else if (!strcasecmp(argv[c], "--donothing") || !strcasecmp(argv[c], "-Y")) { do_nothing = 1; - } else if (!strcasecmp(argv[c], "--clearflash") || !strcasecmp(argv[c], "-B")) { - clear_flash = 1; - } else if (!strcasecmp(argv[c], "--clearnvr") || !strcasecmp(argv[c], "-Q")) { - clear_cmos = 1; } else if (!strcasecmp(argv[c], "--keycodes") || !strcasecmp(argv[c], "-K")) { if ((c + 1) == argc) goto usage; @@ -619,8 +622,20 @@ usage: &key_prefix_1_1, &key_prefix_1_2, &key_prefix_2_1, &key_prefix_2_2, &key_uncapture_1, &key_uncapture_2); } else if (!strcasecmp(argv[c], "--clearboth") || !strcasecmp(argv[c], "-X")) { - clear_cmos = 1; - clear_flash = 1; + if ((c + 1) == argc) + goto usage; + + what = argv[++c]; + + if (!strcasecmp(what, "cmos")) + clear_cmos = 1; + else if (!strcasecmp(what, "flash")) + clear_flash = 1; + else if (!strcasecmp(what, "both")) { + clear_cmos = 1; + clear_flash = 1; + } else + goto usage; #ifdef _WIN32 } else if (!strcasecmp(argv[c], "--hwnd") || !strcasecmp(argv[c], "-H")) { diff --git a/src/video/vid_xga.c b/src/video/vid_xga.c index 21bde90fe..58b4413a2 100644 --- a/src/video/vid_xga.c +++ b/src/video/vid_xga.c @@ -1500,8 +1500,6 @@ xga_bitblt(svga_t *svga) int mix = 0; int xdir; int ydir; - int x = 0; - int y = 0; if (xga->accel.octant & 0x02) { ydir = -1; @@ -1704,10 +1702,8 @@ xga_bitblt(svga_t *svga) xga->accel.px = ((xga->accel.px + 1) & patwidth) | (xga->accel.px & ~patwidth); xga->accel.dx++; xga->accel.x--; - x++; if (xga->accel.x < 0) { area_state = 0; - x = 0; xga->accel.y--; xga->accel.x = xga->accel.blt_width & 0xfff; @@ -1720,7 +1716,6 @@ xga_bitblt(svga_t *svga) xga->accel.sy = ((xga->accel.sy + ydir) & srcheight) | (xga->accel.sy & ~srcheight); xga->accel.py += ydir; xga->accel.dy += ydir; - y++; if (xga->accel.y < 0) { xga->accel.dst_map_x = xga->accel.dx; From 7ec58da46f2686e216fca9071c9426f5f58274f7 Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 13 Oct 2023 23:30:31 +0200 Subject: [PATCH 10/16] Config clean-ups, auto-pause, 4:3 integer scale, and more parameters. --- src/config.c | 507 ++++++++++------------------------- src/cpu/808x.c | 3 +- src/include/86box/86box.h | 2 + src/include/86box/video.h | 3 +- src/qt/languages/ca-ES.po | 7 +- src/qt/languages/cs-CZ.po | 6 + src/qt/languages/de-DE.po | 5 + src/qt/languages/en-GB.po | 5 + src/qt/languages/en-US.po | 5 + src/qt/languages/es-ES.po | 5 + src/qt/languages/fi-FI.po | 5 + src/qt/languages/fr-FR.po | 6 + src/qt/languages/hr-HR.po | 5 + src/qt/languages/hu-HU.po | 5 + src/qt/languages/it-IT.po | 5 + src/qt/languages/ja-JP.po | 5 + src/qt/languages/ko-KR.po | 5 + src/qt/languages/pl-PL.po | 5 + src/qt/languages/pt-BR.po | 5 + src/qt/languages/pt-PT.po | 5 + src/qt/languages/ru-RU.po | 5 + src/qt/languages/sk-SK.po | 6 + src/qt/languages/sl-SI.po | 5 + src/qt/languages/tr-TR.po | 5 + src/qt/languages/uk-UA.po | 5 + src/qt/languages/zh-CN.po | 6 + src/qt/languages/zh-TW.po | 5 + src/qt/qt_mainwindow.cpp | 40 ++- src/qt/qt_mainwindow.hpp | 2 + src/qt/qt_mainwindow.ui | 23 +- src/qt/qt_renderercommon.cpp | 7 +- 31 files changed, 340 insertions(+), 368 deletions(-) diff --git a/src/config.c b/src/config.c index 957489a18..0bad73574 100644 --- a/src/config.c +++ b/src/config.c @@ -84,11 +84,6 @@ static int cw; static int ch; static ini_t config; -/* TODO: Backwards compatibility, get rid of this when enough time has passed. */ -static int backwards_compat = 0; -static int backwards_compat2 = 0; - -#define ENABLE_CONFIG_LOG 1 #ifdef ENABLE_CONFIG_LOG int config_do_log = ENABLE_CONFIG_LOG; @@ -145,14 +140,9 @@ load_general(void) update_icons = ini_section_get_int(cat, "update_icons", 1); window_remember = ini_section_get_int(cat, "window_remember", 0); - if (window_remember || (vid_resize & 2)) { - if (!window_remember) - ini_section_delete_var(cat, "window_remember"); - } else { - ini_section_delete_var(cat, "window_remember"); + if (!window_remember && !(vid_resize & 2)) window_w = window_h = window_x = window_y = 0; - } if (vid_resize & 2) { p = ini_section_get_string(cat, "window_fixed_res", NULL); @@ -213,41 +203,37 @@ load_general(void) if (p == NULL) p = "0, 0, 0, 0"; sscanf(p, "%i, %i, %i, %i", &cw, &ch, &cx, &cy); - } else { + } else cw = ch = cx = cy = 0; - ini_section_delete_var(cat, "window_remember"); - } ini_section_delete_var(cat, "window_coordinates"); + + do_auto_pause = ini_section_get_int(cat, "do_auto_pause", 0); } /* Load monitor section. */ static void load_monitor(int monitor_index) { - ini_section_t cat; - char name[512]; - char temp[512]; - const char *p = NULL; + ini_section_t cat; + char name[512]; + char temp[512]; + const char * p = NULL; + monitor_settings_t *ms = &monitor_settings[monitor_index]; sprintf(name, "Monitor #%i", monitor_index + 1); sprintf(temp, "%i, %i, %i, %i", cx, cy, cw, ch); cat = ini_find_section(config, name); - p = ini_section_get_string(cat, "window_coordinates", NULL); - - if (p == NULL) - p = temp; + p = ini_section_get_string(cat, "window_coordinates", temp); if (window_remember) { - sscanf(p, "%i, %i, %i, %i", - &monitor_settings[monitor_index].mon_window_x, &monitor_settings[monitor_index].mon_window_y, - &monitor_settings[monitor_index].mon_window_w, &monitor_settings[monitor_index].mon_window_h); - monitor_settings[monitor_index].mon_window_maximized = !!ini_section_get_int(cat, "window_maximized", 0); - } else { - monitor_settings[monitor_index].mon_window_maximized = 0; - } + sscanf(p, "%i, %i, %i, %i", &ms->mon_window_x, &ms->mon_window_y, + &ms->mon_window_w, &ms->mon_window_h); + ms->mon_window_maximized = !!ini_section_get_int(cat, "window_maximized", 0); + } else + ms->mon_window_maximized = 0; } /* Load "Machine" section. */ @@ -465,22 +451,27 @@ load_machine(void) c = 0; i = 256; while (cpu_f->cpus[cpu].cpu_type) { - if (cpu_is_eligible(cpu_f, cpu, machine)) { /* skip ineligible CPUs */ - if ((cpu_f->cpus[cpu].rspeed == speed) && (cpu_f->cpus[cpu].multi == multi)) /* exact speed/multiplier match */ + if (cpu_is_eligible(cpu_f, cpu, machine)) { + /* Skip ineligible CPUs. */ + if ((cpu_f->cpus[cpu].rspeed == speed) && (cpu_f->cpus[cpu].multi == multi)) + /* Exact speed/multiplier match. */ break; - else if ((cpu_f->cpus[cpu].rspeed >= speed) && (i == 256)) /* closest speed match */ + else if ((cpu_f->cpus[cpu].rspeed >= speed) && (i == 256)) + /* Closest speed match. */ i = cpu; c = cpu; /* store fastest eligible CPU */ } cpu++; } - if (!cpu_f->cpus[cpu].cpu_type) /* if no exact match was found, use closest matching faster CPU, or fastest eligible CPU */ + if (!cpu_f->cpus[cpu].cpu_type) + /* if no exact match was found, use closest matching faster CPU or fastest eligible CPU. */ cpu = MIN(i, c); - } else { /* default */ - /* Find first eligible family. */ + } else { + /* Default, find first eligible family. */ c = 0; while (!cpu_family_is_eligible(&cpu_families[c], machine)) { - if (cpu_families[c++].package == 0) { /* end of list */ + if (cpu_families[c++].package == 0) { + /* End of list. */ fatal("No eligible CPU families for the selected machine\n"); return; } @@ -490,7 +481,8 @@ load_machine(void) /* Find first eligible CPU in that family. */ cpu = 0; while (!cpu_is_eligible(cpu_f, cpu, machine)) { - if (cpu_f->cpus[cpu++].cpu_type == 0) { /* end of list */ + if (cpu_f->cpus[cpu++].cpu_type == 0) { + /* End of list. */ cpu = 0; break; } @@ -527,10 +519,6 @@ load_machine(void) time_sync = !!ini_section_get_int(cat, "enable_sync", 1); pit_mode = ini_section_get_int(cat, "pit_mode", -1); - - /* Remove this after a while.. */ - ini_section_delete_var(cat, "nvr_path"); - ini_section_delete_var(cat, "enable_sync"); } /* Load "Video" section. */ @@ -556,7 +544,8 @@ load_video(void) } free_p = 1; } - if (!strcmp(p, "virge375_vbe20_pci")) /* migrate renamed cards */ + if (!strcmp(p, "virge375_vbe20_pci")) + /* Migrate renamed cards */ gfxcard[0] = video_get_video_from_internal_name("virge385_pci"); else gfxcard[0] = video_get_video_from_internal_name(p); @@ -564,9 +553,11 @@ load_video(void) free(p); } - if (((gfxcard[0] == VID_INTERNAL) && machine_has_flags(machine, MACHINE_VIDEO_8514A)) || video_card_get_flags(gfxcard[0]) == VIDEO_FLAG_TYPE_8514) + if (((gfxcard[0] == VID_INTERNAL) && machine_has_flags(machine, MACHINE_VIDEO_8514A)) || + video_card_get_flags(gfxcard[0]) == VIDEO_FLAG_TYPE_8514) ini_section_delete_var(cat, "8514a"); - if (((gfxcard[0] == VID_INTERNAL) && machine_has_flags(machine, MACHINE_VIDEO_XGA)) || video_card_get_flags(gfxcard[0]) == VIDEO_FLAG_TYPE_XGA) + if (((gfxcard[0] == VID_INTERNAL) && machine_has_flags(machine, MACHINE_VIDEO_XGA)) || + video_card_get_flags(gfxcard[0]) == VIDEO_FLAG_TYPE_XGA) ini_section_delete_var(cat, "xga"); voodoo_enabled = !!ini_section_get_int(cat, "voodoo", 0); @@ -601,7 +592,8 @@ load_input_devices(void) p = ini_section_get_string(cat, "joystick_type", NULL); if (p != NULL) { - if (!strcmp(p, "standard_2button")) /* migrate renamed types */ + if (!strcmp(p, "standard_2button")) + /* Migrate renamed types */ joystick_type = joystick_get_from_internal_name("2axis_2button"); else if (!strcmp(p, "standard_4button")) joystick_type = joystick_get_from_internal_name("2axis_4button"); @@ -616,7 +608,8 @@ load_input_devices(void) if (!joystick_type) { /* Try to read an integer for backwards compatibility with old configs */ - if (!strcmp(p, "0")) /* workaround for ini_section_get_int returning 0 on non-integer data */ + if (!strcmp(p, "0")) + /* Workaround for ini_section_get_int returning 0 on non-integer data */ joystick_type = joystick_get_from_internal_name("2axis_2button"); else { c = ini_section_get_int(cat, "joystick_type", 8); @@ -668,7 +661,8 @@ load_input_devices(void) sprintf(temp, "joystick_%i_pov_%i", c, d); p = ini_section_get_string(cat, temp, "0, 0"); joystick_state[c].pov_mapping[d][0] = joystick_state[c].pov_mapping[d][1] = 0; - sscanf(p, "%i, %i", &joystick_state[c].pov_mapping[d][0], &joystick_state[c].pov_mapping[d][1]); + sscanf(p, "%i, %i", &joystick_state[c].pov_mapping[d][0], + &joystick_state[c].pov_mapping[d][1]); } } } @@ -775,50 +769,46 @@ load_sound(void) static void load_network(void) { - ini_section_t cat = ini_find_section(config, "Network"); - char *p; - char temp[512]; - uint16_t c = 0; - uint16_t min = 0; + ini_section_t cat = ini_find_section(config, "Network"); + char * p; + char temp[512]; + uint16_t c = 0; + uint16_t min = 0; + netcard_conf_t *nc = &net_cards_conf[c]; /* Handle legacy configuration which supported only one NIC */ p = ini_section_get_string(cat, "net_card", NULL); if (p != NULL) { - net_cards_conf[c].device_num = network_card_get_from_internal_name(p); + nc->device_num = network_card_get_from_internal_name(p); p = ini_section_get_string(cat, "net_type", NULL); if (p != NULL) { if (!strcmp(p, "pcap") || !strcmp(p, "1")) - net_cards_conf[c].net_type = NET_TYPE_PCAP; + nc->net_type = NET_TYPE_PCAP; else if (!strcmp(p, "slirp") || !strcmp(p, "2")) - net_cards_conf[c].net_type = NET_TYPE_SLIRP; + nc->net_type = NET_TYPE_SLIRP; else if (!strcmp(p, "vde") || !strcmp(p, "2")) - net_cards_conf[c].net_type = NET_TYPE_VDE; + nc->net_type = NET_TYPE_VDE; else - net_cards_conf[c].net_type = NET_TYPE_NONE; - } else { - net_cards_conf[c].net_type = NET_TYPE_NONE; - } + nc->net_type = NET_TYPE_NONE; + } else + nc->net_type = NET_TYPE_NONE; p = ini_section_get_string(cat, "net_host_device", NULL); if (p != NULL) { - if (net_cards_conf[c].net_type == NET_TYPE_PCAP) { + if (nc->net_type == NET_TYPE_PCAP) { if ((network_dev_to_id(p) == -1) || (network_ndev == 1)) { - if (network_ndev == 1) { + if (network_ndev == 1) ui_msgbox_header(MBX_ERROR, (wchar_t *) IDS_2095, (wchar_t *) IDS_2130); - } else if (network_dev_to_id(p) == -1) { + else if (network_dev_to_id(p) == -1) ui_msgbox_header(MBX_ERROR, (wchar_t *) IDS_2096, (wchar_t *) IDS_2130); - } - strcpy(net_cards_conf[c].host_dev_name, "none"); - } else { - strncpy(net_cards_conf[c].host_dev_name, p, sizeof(net_cards_conf[c].host_dev_name) - 1); - } - } else { - strncpy(net_cards_conf[c].host_dev_name, p, sizeof(net_cards_conf[c].host_dev_name) - 1); - } - } else { - strcpy(net_cards_conf[c].host_dev_name, "none"); - } + strcpy(nc->host_dev_name, "none"); + } else + strncpy(nc->host_dev_name, p, sizeof(nc->host_dev_name) - 1); + } else + strncpy(nc->host_dev_name, p, sizeof(nc->host_dev_name) - 1); + } else + strcpy(nc->host_dev_name, "none"); min++; } @@ -828,54 +818,50 @@ load_network(void) ini_section_delete_var(cat, "net_host_device"); for (c = min; c < NET_CARD_MAX; c++) { + nc = &net_cards_conf[c]; sprintf(temp, "net_%02i_card", c + 1); p = ini_section_get_string(cat, temp, NULL); - if (p != NULL) { - net_cards_conf[c].device_num = network_card_get_from_internal_name(p); - } else { - net_cards_conf[c].device_num = 0; - } + if (p != NULL) + nc->device_num = network_card_get_from_internal_name(p); + else + nc->device_num = 0; sprintf(temp, "net_%02i_net_type", c + 1); p = ini_section_get_string(cat, temp, NULL); if (p != NULL) { - if (!strcmp(p, "pcap") || !strcmp(p, "1")) { - net_cards_conf[c].net_type = NET_TYPE_PCAP; - } else if (!strcmp(p, "slirp") || !strcmp(p, "2")) { - net_cards_conf[c].net_type = NET_TYPE_SLIRP; - } else if (!strcmp(p, "vde") || !strcmp(p, "2")) { - net_cards_conf[c].net_type = NET_TYPE_VDE; - } else { - net_cards_conf[c].net_type = NET_TYPE_NONE; - } - } else { - net_cards_conf[c].net_type = NET_TYPE_NONE; - } + if (!strcmp(p, "pcap") || !strcmp(p, "1")) + nc->net_type = NET_TYPE_PCAP; + else if (!strcmp(p, "slirp") || !strcmp(p, "2")) + nc->net_type = NET_TYPE_SLIRP; + else if (!strcmp(p, "vde") || !strcmp(p, "2")) + nc->net_type = NET_TYPE_VDE; + else + nc->net_type = NET_TYPE_NONE; + } else + nc->net_type = NET_TYPE_NONE; sprintf(temp, "net_%02i_host_device", c + 1); p = ini_section_get_string(cat, temp, NULL); if (p != NULL) { - if (net_cards_conf[c].net_type == NET_TYPE_PCAP) { + if (nc->net_type == NET_TYPE_PCAP) { if ((network_dev_to_id(p) == -1) || (network_ndev == 1)) { - if (network_ndev == 1) { + if (network_ndev == 1) ui_msgbox_header(MBX_ERROR, (wchar_t *) IDS_2095, (wchar_t *) IDS_2130); - } else if (network_dev_to_id(p) == -1) { + else if (network_dev_to_id(p) == -1) ui_msgbox_header(MBX_ERROR, (wchar_t *) IDS_2096, (wchar_t *) IDS_2130); - } - strcpy(net_cards_conf[c].host_dev_name, "none"); - } else { - strncpy(net_cards_conf[c].host_dev_name, p, sizeof(net_cards_conf[c].host_dev_name) - 1); - } - } else { - strncpy(net_cards_conf[c].host_dev_name, p, sizeof(net_cards_conf[c].host_dev_name) - 1); - } - } else { - strcpy(net_cards_conf[c].host_dev_name, "none"); - } + strcpy(nc->host_dev_name, "none"); + } else + strncpy(nc->host_dev_name, p, sizeof(nc->host_dev_name) - 1); + } else + strncpy(nc->host_dev_name, p, sizeof(nc->host_dev_name) - 1); + } else + strcpy(nc->host_dev_name, "none"); sprintf(temp, "net_%02i_link", c + 1); - net_cards_conf[c].link_state = ini_section_get_int(cat, temp, - (NET_LINK_10_HD | NET_LINK_10_FD | NET_LINK_100_HD | NET_LINK_100_FD | NET_LINK_1000_HD | NET_LINK_1000_FD)); + nc->link_state = ini_section_get_int(cat, temp, + (NET_LINK_10_HD | NET_LINK_10_FD | + NET_LINK_100_HD | NET_LINK_100_FD | + NET_LINK_1000_HD | NET_LINK_1000_FD)); } } @@ -931,17 +917,6 @@ load_storage_controllers(void) int min = 0; int free_p = 0; - /* TODO: Backwards compatibility, get rid of this when enough time has passed. */ - backwards_compat2 = (cat == NULL); - - /* TODO: Backwards compatibility, get rid of this when enough time has passed. */ - p = ini_section_get_string(cat, "scsicard", NULL); - if (p != NULL) { - scsi_card_current[0] = scsi_card_get_from_internal_name(p); - min++; - } - ini_section_delete_var(cat, "scsi_card"); - for (c = min; c < SCSI_BUS_MAX; c++) { sprintf(temp, "scsicard_%d", c + 1); @@ -1238,62 +1213,6 @@ load_hard_disks(void) } } -/* TODO: Backwards compatibility, get rid of this when enough time has passed. */ -/* Load "Floppy Drives" section. */ -static void -load_floppy_drives(void) -{ - ini_section_t cat = ini_find_section(config, "Floppy drives"); - char temp[512]; - char *p; - - if (!backwards_compat) - return; - - for (uint8_t c = 0; c < FDD_NUM; c++) { - sprintf(temp, "fdd_%02i_type", c + 1); - p = ini_section_get_string(cat, temp, (c < 2) ? "525_2dd" : "none"); - fdd_set_type(c, fdd_get_from_internal_name(p)); - if (fdd_get_type(c) > 13) - fdd_set_type(c, 13); - ini_section_delete_var(cat, temp); - - sprintf(temp, "fdd_%02i_fn", c + 1); - p = ini_section_get_string(cat, temp, ""); - ini_section_delete_var(cat, temp); - - if (!strcmp(p, usr_path)) - p[0] = 0x00; - - if (p[0] != 0x00) { - if (path_abs(p)) { - if (strlen(p) > 511) - fatal("load_floppy_drives(): strlen(p) > 511 (floppyfns[%i])\n", c); - else - strncpy(floppyfns[c], p, 511); - } else - path_append_filename(floppyfns[c], usr_path, p); - path_normalize(floppyfns[c]); - } - -#if defined(ENABLE_CONFIG_LOG) && (ENABLE_CONFIG_LOG == 2) - if (*p != '\0') - config_log("Floppy%d: %ls\n", c, floppyfns[c]); -#endif - sprintf(temp, "fdd_%02i_writeprot", c + 1); - ui_writeprot[c] = !!ini_section_get_int(cat, temp, 0); - ini_section_delete_var(cat, temp); - sprintf(temp, "fdd_%02i_turbo", c + 1); - fdd_set_turbo(c, !!ini_section_get_int(cat, temp, 0)); - ini_section_delete_var(cat, temp); - sprintf(temp, "fdd_%02i_check_bpb", c + 1); - fdd_set_check_bpb(c, !!ini_section_get_int(cat, temp, 1)); - ini_section_delete_var(cat, temp); - } - - ini_delete_section_if_empty(config, cat); -} - /* Load "Floppy and CD-ROM Drives" section. */ static void load_floppy_and_cdrom_drives(void) @@ -1308,9 +1227,6 @@ load_floppy_and_cdrom_drives(void) int c; int d = 0; - /* TODO: Backwards compatibility, get rid of this when enough time has passed. */ - backwards_compat = (cat == NULL); - memset(temp, 0x00, sizeof(temp)); for (c = 0; c < FDD_NUM; c++) { sprintf(temp, "fdd_%02i_type", c + 1); @@ -1543,85 +1459,6 @@ load_other_removable_devices(void) unsigned int board = 0; unsigned int dev = 0; int c; - int d = 0; - - /* TODO: Backwards compatibility, get rid of this when enough time has passed. */ - if (backwards_compat) { - memset(temp, 0x00, sizeof(temp)); - for (c = 0; c < CDROM_NUM; c++) { - sprintf(temp, "cdrom_%02i_host_drive", c + 1); - cdrom[c].host_drive = ini_section_get_int(cat, temp, 0); - cdrom[c].prev_host_drive = cdrom[c].host_drive; - ini_section_delete_var(cat, temp); - - sprintf(temp, "cdrom_%02i_parameters", c + 1); - p = ini_section_get_string(cat, temp, NULL); - if (p != NULL) - sscanf(p, "%01u, %s", &d, s); - else - sscanf("0, none", "%01u, %s", &d, s); - cdrom[c].sound_on = d; - cdrom[c].bus_type = hdd_string_to_bus(s, 1); - ini_section_delete_var(cat, temp); - - sprintf(temp, "cdrom_%02i_speed", c + 1); - cdrom[c].speed = ini_section_get_int(cat, temp, 8); - ini_section_delete_var(cat, temp); - - /* Default values, needed for proper operation of the Settings dialog. */ - cdrom[c].ide_channel = cdrom[c].scsi_device_id = c + 2; - ini_section_delete_var(cat, temp); - - if (cdrom[c].bus_type == CDROM_BUS_ATAPI) { - sprintf(temp, "cdrom_%02i_ide_channel", c + 1); - sprintf(tmp2, "%01u:%01u", (c + 2) >> 1, (c + 2) & 1); - p = ini_section_get_string(cat, temp, tmp2); - sscanf(p, "%01u:%01u", &board, &dev); - board &= 3; - dev &= 1; - cdrom[c].ide_channel = (board << 1) + dev; - - if (cdrom[c].ide_channel > 7) - cdrom[c].ide_channel = 7; - - ini_section_delete_var(cat, temp); - } else if (cdrom[c].bus_type == CDROM_BUS_SCSI) { - sprintf(temp, "cdrom_%02i_scsi_id", c + 1); - cdrom[c].scsi_device_id = ini_section_get_int(cat, temp, c + 2); - - if (cdrom[c].scsi_device_id > 15) - cdrom[c].scsi_device_id = 15; - - ini_section_delete_var(cat, temp); - } - - sprintf(temp, "cdrom_%02i_image_path", c + 1); - p = ini_section_get_string(cat, temp, ""); - ini_section_delete_var(cat, temp); - - if (!strcmp(p, usr_path)) - p[0] = 0x00; - - if (p[0] != 0x00) { - if (path_abs(p)) { - if (strlen(p) > 511) - fatal("load_other_removable_devices(): strlen(p) > 511 (cdrom[%i].image_path)\n", - c); - else - strncpy(cdrom[c].image_path, p, 511); - } else - path_append_filename(cdrom[c].image_path, usr_path, p); - path_normalize(cdrom[c].image_path); - } - - if (cdrom[c].host_drive && (cdrom[c].host_drive != 200)) - cdrom[c].host_drive = 0; - - if ((cdrom[c].host_drive == 0x200) && (strlen(cdrom[c].image_path) == 0)) - cdrom[c].host_drive = 0; - } - } - backwards_compat = 0; memset(temp, 0x00, sizeof(temp)); for (c = 0; c < ZIP_NUM; c++) { @@ -1863,59 +1700,6 @@ load_other_peripherals(void) ini_section_t cat = ini_find_section(config, "Other peripherals"); char *p; char temp[512]; - int free_p = 0; - - if (backwards_compat2) { - p = ini_section_get_string(cat, "scsicard", NULL); - if (p != NULL) - scsi_card_current[0] = scsi_card_get_from_internal_name(p); - else - scsi_card_current[0] = 0; - ini_section_delete_var(cat, "scsicard"); - - p = ini_section_get_string(cat, "fdc", NULL); - if (p != NULL) - fdc_type = fdc_card_get_from_internal_name(p); - else - fdc_type = FDC_INTERNAL; - ini_section_delete_var(cat, "fdc"); - - p = ini_section_get_string(cat, "hdc", NULL); - if (p == NULL) { - if (machine_has_flags(machine, MACHINE_HDC)) { - p = (char *) malloc((strlen("internal") + 1) * sizeof(char)); - strcpy(p, "internal"); - } else { - p = (char *) malloc((strlen("none") + 1) * sizeof(char)); - strcpy(p, "none"); - } - free_p = 1; - } - if (!strcmp(p, "mfm_xt")) - hdc_current = hdc_get_from_internal_name("st506_xt"); - else if (!strcmp(p, "mfm_xt_dtc5150x")) - hdc_current = hdc_get_from_internal_name("st506_xt_dtc5150x"); - else if (!strcmp(p, "mfm_at")) - hdc_current = hdc_get_from_internal_name("st506_at"); - else if (!strcmp(p, "vlb_isa")) - hdc_current = hdc_get_from_internal_name("ide_vlb"); - else if (!strcmp(p, "vlb_isa_2ch")) - hdc_current = hdc_get_from_internal_name("ide_vlb_2ch"); - else - hdc_current = hdc_get_from_internal_name(p); - ini_section_delete_var(cat, "hdc"); - - if (free_p) { - free(p); - p = NULL; - } - - ide_ter_enabled = !!ini_section_get_int(cat, "ide_ter", 0); - ini_section_delete_var(cat, "ide_ter"); - ide_qua_enabled = !!ini_section_get_int(cat, "ide_qua", 0); - ini_section_delete_var(cat, "ide_qua"); - } - backwards_compat2 = 0; bugger_enabled = !!ini_section_get_int(cat, "bugger_enabled", 0); postcard_enabled = !!ini_section_get_int(cat, "postcard_enabled", 0); @@ -1961,6 +1745,7 @@ config_load(void) scale = 1; machine = machine_get_machine_from_internal_name("ibmpc"); dpi_scale = 1; + do_auto_pause = 0; fpu_type = fpu_get_type(cpu_f, cpu, "none"); gfxcard[0] = video_get_video_from_internal_name("cga"); @@ -2009,9 +1794,9 @@ config_load(void) config_log("Config file not present or invalid!\n"); } else { - load_general(); /* General */ + load_general(); /* General */ for (i = 0; i < MONITORS_NUM; i++) - load_monitor(i); + load_monitor(i); /* Monitors */ load_machine(); /* Machine */ load_video(); /* Video */ load_input_devices(); /* Input devices */ @@ -2021,8 +1806,6 @@ config_load(void) load_storage_controllers(); /* Storage controllers */ load_hard_disks(); /* Hard disks */ load_floppy_and_cdrom_drives(); /* Floppy and CD-ROM drives */ - /* TODO: Backwards compatibility, get rid of this when enough time has passed. */ - load_floppy_drives(); /* Floppy drives */ load_other_removable_devices(); /* Other removable devices */ load_other_peripherals(); /* Other peripherals */ @@ -2115,12 +1898,9 @@ save_general(void) else ini_section_set_int(cat, "update_icons", update_icons); - if (window_remember || (vid_resize & 2)) { - if (window_remember) - ini_section_set_int(cat, "window_remember", window_remember); - else - ini_section_delete_var(cat, "window_remember"); - } else + if (window_remember) + ini_section_set_int(cat, "window_remember", window_remember); + else ini_section_delete_var(cat, "window_remember"); if (vid_resize & 2) { @@ -2204,6 +1984,11 @@ save_general(void) else ini_section_delete_var(cat, "video_gl_shader"); + if (do_auto_pause) + ini_section_set_int(cat, "do_auto_pause", do_auto_pause); + else + ini_section_delete_var(cat, "do_auto_pause"); + ini_delete_section_if_empty(config, cat); } @@ -2211,24 +1996,23 @@ save_general(void) static void save_monitor(int monitor_index) { - ini_section_t cat; - char name[sizeof("Monitor #") + 12] = { [0] = 0 }; - char temp[512]; + ini_section_t cat; + char name[sizeof("Monitor #") + 12] = { [0] = 0 }; + char temp[512]; + monitor_settings_t *ms = &monitor_settings[monitor_index]; snprintf(name, sizeof(name), "Monitor #%i", monitor_index + 1); cat = ini_find_or_create_section(config, name); if (window_remember) { - sprintf(temp, "%i, %i, %i, %i", - monitor_settings[monitor_index].mon_window_x, monitor_settings[monitor_index].mon_window_y, - monitor_settings[monitor_index].mon_window_w, monitor_settings[monitor_index].mon_window_h); + sprintf(temp, "%i, %i, %i, %i", ms->mon_window_x, ms->mon_window_y, + ms->mon_window_w, ms->mon_window_h); ini_section_set_string(cat, "window_coordinates", temp); - if (monitor_settings[monitor_index].mon_window_maximized != 0) { - ini_section_set_int(cat, "window_maximized", monitor_settings[monitor_index].mon_window_maximized); - } else { + if (ms->mon_window_maximized != 0) + ini_section_set_int(cat, "window_maximized", ms->mon_window_maximized); + else ini_section_delete_var(cat, "window_maximized"); - } } else { ini_section_delete_var(cat, "window_coordinates"); ini_section_delete_var(cat, "window_maximized"); @@ -2284,12 +2068,15 @@ save_machine(void) /* Match the family name, speed and multiplier. */ if (!strcmp(cpu_f->internal_name, legacy_table_entry->family)) { - if ((legacy_table_entry->rspeed == cpu_f->cpus[cpu].rspeed) && (legacy_table_entry->multi == cpu_f->cpus[cpu].multi)) { /* exact speed/multiplier match */ + if ((legacy_table_entry->rspeed == cpu_f->cpus[cpu].rspeed) && + (legacy_table_entry->multi == cpu_f->cpus[cpu].multi)) { + /* Exact speed/multiplier match. */ legacy_cpu = i; break; - } else if ((legacy_table_entry->rspeed >= cpu_f->cpus[cpu].rspeed) && (closest_legacy_cpu == -1)) { /* closest speed match */ + } else if ((legacy_table_entry->rspeed >= cpu_f->cpus[cpu].rspeed) && + (closest_legacy_cpu == -1)) + /* Closest speed match. */ closest_legacy_cpu = i; - } } i++; @@ -2322,7 +2109,8 @@ save_machine(void) else ini_section_set_string(cat, "fpu_type", fpu_get_internal_name(cpu_f, cpu, fpu_type)); - // Write the mem_size explicitly to the setttings in order to help managers to display it without having the actual machine table + /* Write the mem_size explicitly to the setttings in order to help managers + to display it without having the actual machine table. */ ini_section_delete_var(cat, "mem_size"); ini_section_set_int(cat, "mem_size", mem_size); @@ -2529,23 +2317,25 @@ save_sound(void) static void save_network(void) { - char temp[512]; - ini_section_t cat = ini_find_or_create_section(config, "Network"); + char temp[512]; + ini_section_t cat = ini_find_or_create_section(config, "Network"); + netcard_conf_t *nc; ini_section_delete_var(cat, "net_type"); ini_section_delete_var(cat, "net_host_device"); ini_section_delete_var(cat, "net_card"); for (uint8_t c = 0; c < NET_CARD_MAX; c++) { + nc = &net_cards_conf[c]; + sprintf(temp, "net_%02i_card", c + 1); - if (net_cards_conf[c].device_num == 0) { + if (nc->device_num == 0) ini_section_delete_var(cat, temp); - } else { - ini_section_set_string(cat, temp, network_card_get_internal_name(net_cards_conf[c].device_num)); - } + else + ini_section_set_string(cat, temp, network_card_get_internal_name(nc->device_num)); sprintf(temp, "net_%02i_net_type", c + 1); - switch(net_cards_conf[c].net_type) { + switch(nc->net_type) { case NET_TYPE_NONE: ini_section_delete_var(cat, temp); break; @@ -2564,21 +2354,21 @@ save_network(void) } sprintf(temp, "net_%02i_host_device", c + 1); - if (net_cards_conf[c].host_dev_name[0] != '\0') { - if (!strcmp(net_cards_conf[c].host_dev_name, "none")) + if (nc->host_dev_name[0] != '\0') { + if (!strcmp(nc->host_dev_name, "none")) ini_section_delete_var(cat, temp); else - ini_section_set_string(cat, temp, net_cards_conf[c].host_dev_name); + ini_section_set_string(cat, temp, nc->host_dev_name); } else ini_section_delete_var(cat, temp); sprintf(temp, "net_%02i_link", c + 1); - if (net_cards_conf[c].link_state == (NET_LINK_10_HD | NET_LINK_10_FD | - NET_LINK_100_HD | NET_LINK_100_FD | - NET_LINK_1000_HD | NET_LINK_1000_FD)) + if (nc->link_state == (NET_LINK_10_HD | NET_LINK_10_FD | + NET_LINK_100_HD | NET_LINK_100_FD | + NET_LINK_1000_HD | NET_LINK_1000_FD)) ini_section_delete_var(cat, temp); else - ini_section_set_int(cat, temp, net_cards_conf[c].link_state); + ini_section_set_int(cat, temp, nc->link_state); } ini_delete_section_if_empty(config, cat); @@ -2798,9 +2588,9 @@ save_hard_disks(void) ini_section_delete_var(cat, temp); sprintf(temp, "hdd_%02i_ide_channel", c + 1); - if (!hdd_is_valid(c) || (hdd[c].bus != HDD_BUS_IDE)) { + if (!hdd_is_valid(c) || (hdd[c].bus != HDD_BUS_IDE)) ini_section_delete_var(cat, temp); - } else { + else { sprintf(tmp2, "%01u:%01u", hdd[c].ide_channel >> 1, hdd[c].ide_channel & 1); ini_section_set_string(cat, temp, tmp2); } @@ -2917,26 +2707,23 @@ save_floppy_and_cdrom_drives(void) for (c = 0; c < CDROM_NUM; c++) { sprintf(temp, "cdrom_%02i_host_drive", c + 1); - if ((cdrom[c].bus_type == 0) || (cdrom[c].host_drive != 200)) { + if ((cdrom[c].bus_type == 0) || (cdrom[c].host_drive != 200)) ini_section_delete_var(cat, temp); - } else { + else ini_section_set_int(cat, temp, cdrom[c].host_drive); - } sprintf(temp, "cdrom_%02i_speed", c + 1); - if ((cdrom[c].bus_type == 0) || (cdrom[c].speed == 8)) { + if ((cdrom[c].bus_type == 0) || (cdrom[c].speed == 8)) ini_section_delete_var(cat, temp); - } else { + else ini_section_set_int(cat, temp, cdrom[c].speed); - } sprintf(temp, "cdrom_%02i_type", c + 1); - if ((cdrom[c].bus_type == 0) || (cdrom[c].bus_type == CDROM_BUS_MITSUMI)) { + if ((cdrom[c].bus_type == 0) || (cdrom[c].bus_type == CDROM_BUS_MITSUMI)) ini_section_delete_var(cat, temp); - } else { + else ini_section_set_string(cat, temp, cdrom_get_internal_name(cdrom_get_type(c))); - } sprintf(temp, "cdrom_%02i_parameters", c + 1); if (cdrom[c].bus_type == 0) @@ -3102,9 +2889,9 @@ save_other_removable_devices(void) void config_save(void) { - save_general(); /* General */ + save_general(); /* General */ for (uint8_t i = 0; i < MONITORS_NUM; i++) - save_monitor(i); + save_monitor(i); /* Monitors */ save_machine(); /* Machine */ save_video(); /* Video */ save_input_devices(); /* Input devices */ diff --git a/src/cpu/808x.c b/src/cpu/808x.c index f8209def6..d20fdb87a 100644 --- a/src/cpu/808x.c +++ b/src/cpu/808x.c @@ -2056,7 +2056,8 @@ farret(int far) } wait(2, 0); - load_cs(new_cs); + if (far) + load_cs(new_cs); set_ip(new_ip); } diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index e0ff0e1d9..a8f4ac7f2 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -146,6 +146,8 @@ extern int enable_discord; /* (C) enable Discord integration */ extern int fixed_size_x; extern int fixed_size_y; +extern int do_auto_pause; /* (C) Auto-pause the emulator on focus loss */ +extern int auto_paused; extern double mouse_sensitivity; /* (C) Mouse sensitivity scale */ #ifdef _Atomic extern _Atomic double mouse_x_error; /* Mouse error accumulator - Y */ diff --git a/src/include/86box/video.h b/src/include/86box/video.h index 1e3d9ea2a..a28faf335 100644 --- a/src/include/86box/video.h +++ b/src/include/86box/video.h @@ -42,7 +42,8 @@ enum { FULLSCR_SCALE_FULL = 0, FULLSCR_SCALE_43, FULLSCR_SCALE_KEEPRATIO, - FULLSCR_SCALE_INT + FULLSCR_SCALE_INT, + FULLSCR_SCALE_INT43 }; #ifdef __cplusplus diff --git a/src/qt/languages/ca-ES.po b/src/qt/languages/ca-ES.po index 1bbfc646d..371781b7a 100644 --- a/src/qt/languages/ca-ES.po +++ b/src/qt/languages/ca-ES.po @@ -122,7 +122,10 @@ msgid "&Square pixels (Keep ratio)" msgstr "&Píxels quadrats (Mant. aspecte)" msgid "&Integer scale" -msgstr "&Escalat valor sencer" +msgstr "&Escala de valor enter" + +msgid "4:&3 Integer scale" +msgstr "Escala de valor enter 4:&3" msgid "E&GA/(S)VGA settings" msgstr "&Ajustaments EGA/(S)VGA" @@ -1219,3 +1222,5 @@ msgstr "Lent" msgid "Fast" msgstr "Ràpid" +msgid "&Auto-pause on focus loss" +msgstr "&Pausa automàtica en la pèrdua del focus" diff --git a/src/qt/languages/cs-CZ.po b/src/qt/languages/cs-CZ.po index 00a29ecd1..d86f5b635 100644 --- a/src/qt/languages/cs-CZ.po +++ b/src/qt/languages/cs-CZ.po @@ -124,6 +124,9 @@ msgstr "&Zachovat poměr stran" msgid "&Integer scale" msgstr "&Celočíselné škálování" +msgid "4:&3 Integer scale" +msgstr "4:&3 Celočíselné škálování" + msgid "E&GA/(S)VGA settings" msgstr "Nastavení pro E&GA a (S)VGA" @@ -1218,3 +1221,6 @@ msgstr "Pomalý" msgid "Fast" msgstr "Rychlý" + +msgid "&Auto-pause on focus loss" +msgstr "&Automatická pauza při ztrátě zaměření okna" diff --git a/src/qt/languages/de-DE.po b/src/qt/languages/de-DE.po index ad1176dd1..9c985d871 100644 --- a/src/qt/languages/de-DE.po +++ b/src/qt/languages/de-DE.po @@ -124,6 +124,9 @@ msgstr "&Quadratische Pixel (Seitenverhältnis beibehalten)" msgid "&Integer scale" msgstr "&Integer-Skalierung" +msgid "4:&3 Integer scale" +msgstr "4:&3 Integer-Skalierung" + msgid "E&GA/(S)VGA settings" msgstr "E&GA/(S)VGA-Einstellungen" @@ -1219,3 +1222,5 @@ msgstr "Langsam" msgid "Fast" msgstr "Schnell" +msgid "&Auto-pause on focus loss" +msgstr "&Auto-Pause bei Fokusverlust" diff --git a/src/qt/languages/en-GB.po b/src/qt/languages/en-GB.po index 7d7be2d2d..4a6a58db6 100644 --- a/src/qt/languages/en-GB.po +++ b/src/qt/languages/en-GB.po @@ -124,6 +124,9 @@ msgstr "&Square pixels (Keep ratio)" msgid "&Integer scale" msgstr "&Integer scale" +msgid "4:&3 Integer scale" +msgstr "4:&3 Integer scale" + msgid "E&GA/(S)VGA settings" msgstr "E&GA/(S)VGA settings" @@ -1219,3 +1222,5 @@ msgstr "Slow" msgid "Fast" msgstr "Fast" +msgid "&Auto-pause on focus loss" +msgstr "&Auto-pause on focus loss" diff --git a/src/qt/languages/en-US.po b/src/qt/languages/en-US.po index bacec4cc0..ce7ceb149 100644 --- a/src/qt/languages/en-US.po +++ b/src/qt/languages/en-US.po @@ -124,6 +124,9 @@ msgstr "&Square pixels (Keep ratio)" msgid "&Integer scale" msgstr "&Integer scale" +msgid "4:&3 Integer scale" +msgstr "4:&3 Integer scale" + msgid "E&GA/(S)VGA settings" msgstr "E&GA/(S)VGA settings" @@ -1219,3 +1222,5 @@ msgstr "Slow" msgid "Fast" msgstr "Fast" +msgid "&Auto-pause on focus loss" +msgstr "&Auto-pause on focus loss" diff --git a/src/qt/languages/es-ES.po b/src/qt/languages/es-ES.po index d1abad9fc..d8d648691 100644 --- a/src/qt/languages/es-ES.po +++ b/src/qt/languages/es-ES.po @@ -124,6 +124,9 @@ msgstr "&Píxeles cuadrados (Mant. aspecto)" msgid "&Integer scale" msgstr "&Escalado valor entero" +msgid "4:&3 Integer scale" +msgstr "Escalado valor entero 4:&3" + msgid "E&GA/(S)VGA settings" msgstr "&Configuraciones EGA/(S)VGA" @@ -1219,3 +1222,5 @@ msgstr "Lenta" msgid "Fast" msgstr "Rápida" +msgid "&Auto-pause on focus loss" +msgstr "&Pausa automática al perder el foco" diff --git a/src/qt/languages/fi-FI.po b/src/qt/languages/fi-FI.po index 46472e653..217827f74 100644 --- a/src/qt/languages/fi-FI.po +++ b/src/qt/languages/fi-FI.po @@ -124,6 +124,9 @@ msgstr "&Tasasivuiset kuvapisteet (säilytä kuvasuhde)" msgid "&Integer scale" msgstr "&Kokonaislukuskaalaus" +msgid "4:&3 Integer scale" +msgstr "4:&3 Kokonaislukuskaalaus" + msgid "E&GA/(S)VGA settings" msgstr "&EGA/(S)VGA-asetukset" @@ -1219,3 +1222,5 @@ msgstr "Hidas" msgid "Fast" msgstr "Nopea" +msgid "&Auto-pause on focus loss" +msgstr "&Automaattinen tauko tarkennuksen hävitessä" diff --git a/src/qt/languages/fr-FR.po b/src/qt/languages/fr-FR.po index 837617da4..be66e5924 100644 --- a/src/qt/languages/fr-FR.po +++ b/src/qt/languages/fr-FR.po @@ -124,6 +124,9 @@ msgstr "pixels &Carrés(Keep ratio)" msgid "&Integer scale" msgstr "Echelle &Entière" +msgid "4:&3 Integer scale" +msgstr "Echelle Entière 4:&3" + msgid "E&GA/(S)VGA settings" msgstr "Réglages E&GA/(S)VGA" @@ -1219,3 +1222,6 @@ msgstr "Lent" msgid "Fast" msgstr "Rapide" +msgid "&Auto-pause on focus loss" +msgstr "&Pause automatique à perte de mise au point" + diff --git a/src/qt/languages/hr-HR.po b/src/qt/languages/hr-HR.po index 5f83669e6..b2aa40d28 100644 --- a/src/qt/languages/hr-HR.po +++ b/src/qt/languages/hr-HR.po @@ -124,6 +124,9 @@ msgstr "&Kvadratni pikseli (zadrži omjer)" msgid "&Integer scale" msgstr "&Cijelobrojno skaliranje" +msgid "4:&3 Integer scale" +msgstr "4:&3 Cijelobrojno skaliranje" + msgid "E&GA/(S)VGA settings" msgstr "E&GA/(S)VGA postavke" @@ -1219,3 +1222,5 @@ msgstr "Spori" msgid "Fast" msgstr "Brzi" +msgid "&Auto-pause on focus loss" +msgstr "&Automatska pauza pri gubitku fokusa" diff --git a/src/qt/languages/hu-HU.po b/src/qt/languages/hu-HU.po index eaa229fb2..352a64749 100644 --- a/src/qt/languages/hu-HU.po +++ b/src/qt/languages/hu-HU.po @@ -124,6 +124,9 @@ msgstr "&Négyzetes képpontok (aránytartás)" msgid "&Integer scale" msgstr "&Egész tényezős nagyítás" +msgid "4:&3 Integer scale" +msgstr "4:&3 Egész tényezős nagyítás" + msgid "E&GA/(S)VGA settings" msgstr "E&GA/(S)VGA beállítások" @@ -1219,3 +1222,5 @@ msgstr "Lassú" msgid "Fast" msgstr "Gyors" +msgid "&Auto-pause on focus loss" +msgstr "&Automatikus szünet fókuszvesztéskor" diff --git a/src/qt/languages/it-IT.po b/src/qt/languages/it-IT.po index 4c9ce36e2..df71d148b 100644 --- a/src/qt/languages/it-IT.po +++ b/src/qt/languages/it-IT.po @@ -124,6 +124,9 @@ msgstr "&Pixel quadrati (mantiene l'aspetto)" msgid "&Integer scale" msgstr "&Scala intera" +msgid "4:&3 Integer scale" +msgstr "Scala intera 4:&3" + msgid "E&GA/(S)VGA settings" msgstr "Impostazioni E&GA/(S)VGA" @@ -1219,3 +1222,5 @@ msgstr "Lenta" msgid "Fast" msgstr "Veloce" +msgid "&Auto-pause on focus loss" +msgstr "&Pausa automatica alla perdita della messa a fuoco" diff --git a/src/qt/languages/ja-JP.po b/src/qt/languages/ja-JP.po index c6518f841..613496fd9 100644 --- a/src/qt/languages/ja-JP.po +++ b/src/qt/languages/ja-JP.po @@ -124,6 +124,9 @@ msgstr "正方形ピクセル(アスペクト比を維持)(&S)" msgid "&Integer scale" msgstr "整数倍(&I)" +msgid "4:&3 Integer scale" +msgstr "4:3 整数倍(&3)" + msgid "E&GA/(S)VGA settings" msgstr "E&GA/(S)VGAの設定" @@ -1219,3 +1222,5 @@ msgstr "遅い" msgid "Fast" msgstr "速い" +msgid "&Auto-pause on focus loss" +msgstr "フォーカスが外れると自動ポーズ(&A)" diff --git a/src/qt/languages/ko-KR.po b/src/qt/languages/ko-KR.po index e5f55c276..ac4476ca8 100644 --- a/src/qt/languages/ko-KR.po +++ b/src/qt/languages/ko-KR.po @@ -124,6 +124,9 @@ msgstr "정사각형 픽셀 (비율 유지)(&S)" msgid "&Integer scale" msgstr "정수배 확대(&I)" +msgid "4:&3 Integer scale" +msgstr "4:3 정수배 확대(&3)" + msgid "E&GA/(S)VGA settings" msgstr "E&GA/(S)VGA 설정" @@ -1219,3 +1222,5 @@ msgstr "느린" msgid "Fast" msgstr "빠른" +msgid "&Auto-pause on focus loss" +msgstr "집중력 저하 시 자동 일시 중지(&A)" diff --git a/src/qt/languages/pl-PL.po b/src/qt/languages/pl-PL.po index 37945a0f3..b24e338f4 100644 --- a/src/qt/languages/pl-PL.po +++ b/src/qt/languages/pl-PL.po @@ -124,6 +124,9 @@ msgstr "&Kwadratowe piksele (Zachowaj proporcje)" msgid "&Integer scale" msgstr "&Skalowanie całkowite" +msgid "4:&3 Integer scale" +msgstr "Skalowanie całkowite 4:&3" + msgid "E&GA/(S)VGA settings" msgstr "Ustawienia E&GA/(S)VGA" @@ -1219,3 +1222,5 @@ msgstr "Powolny" msgid "Fast" msgstr "Szybki" +msgid "&Auto-pause on focus loss" +msgstr "&Automatyczna pauza po utracie fokusu" diff --git a/src/qt/languages/pt-BR.po b/src/qt/languages/pt-BR.po index a78655a74..0db661b4f 100644 --- a/src/qt/languages/pt-BR.po +++ b/src/qt/languages/pt-BR.po @@ -124,6 +124,9 @@ msgstr "Pixel&s quadrados (manter proporção)" msgid "&Integer scale" msgstr "&Redimensionamento com valores inteiros" +msgid "4:&3 Integer scale" +msgstr "Redimensionamento com valores inteiros 4:&3" + msgid "E&GA/(S)VGA settings" msgstr "Configurações E&GA/(S)VGA" @@ -1219,3 +1222,5 @@ msgstr "Lento" msgid "Fast" msgstr "Rápido" +msgid "&Auto-pause on focus loss" +msgstr "Pausa &automática ao perder o foco" diff --git a/src/qt/languages/pt-PT.po b/src/qt/languages/pt-PT.po index 99f59e8b3..8f080e423 100644 --- a/src/qt/languages/pt-PT.po +++ b/src/qt/languages/pt-PT.po @@ -124,6 +124,9 @@ msgstr "Pixels &quadrados (Manter rácio)" msgid "&Integer scale" msgstr "Escala &inteira" +msgid "4:&3 Integer scale" +msgstr "Escala inteira 4:&3" + msgid "E&GA/(S)VGA settings" msgstr "Definições E&GA/(S)VGA" @@ -1219,3 +1222,5 @@ msgstr "Lento" msgid "Fast" msgstr "Rápido" +msgid "&Auto-pause on focus loss" +msgstr "Pausa &automática na perda de focagem" diff --git a/src/qt/languages/ru-RU.po b/src/qt/languages/ru-RU.po index d4b5126fa..b0bcc0e1e 100644 --- a/src/qt/languages/ru-RU.po +++ b/src/qt/languages/ru-RU.po @@ -124,6 +124,9 @@ msgstr "&Квадратные пиксели (сохранить соотнош msgid "&Integer scale" msgstr "&Целочисленное масштабирование" +msgid "4:&3 Integer scale" +msgstr "4:&3 Целочисленное масштабирование" + msgid "E&GA/(S)VGA settings" msgstr "Настройки E&GA/(S)VGA" @@ -1219,3 +1222,5 @@ msgstr "Медленный" msgid "Fast" msgstr "Быстрый" +msgid "&Auto-pause on focus loss" +msgstr "&Автопауза при потере фокуса" diff --git a/src/qt/languages/sk-SK.po b/src/qt/languages/sk-SK.po index c2821aade..a8f60b861 100644 --- a/src/qt/languages/sk-SK.po +++ b/src/qt/languages/sk-SK.po @@ -124,6 +124,9 @@ msgstr "&Zachovať pomer strán" msgid "&Integer scale" msgstr "&Celočíselné škálovanie" +msgid "4:&3 Integer scale" +msgstr "4:&3 Celočíselné škálovanie" + msgid "E&GA/(S)VGA settings" msgstr "Nastavenia pre E&GA a (S)VGA" @@ -1218,3 +1221,6 @@ msgstr "Pomalý" msgid "Fast" msgstr "Rýchly" + +msgid "&Auto-pause on focus loss" +msgstr "&Automatická pauza pri strate fokusu okna" diff --git a/src/qt/languages/sl-SI.po b/src/qt/languages/sl-SI.po index 5e468c8e1..98a51d863 100644 --- a/src/qt/languages/sl-SI.po +++ b/src/qt/languages/sl-SI.po @@ -124,6 +124,9 @@ msgstr "&Kvadratni piksli (ohrani razmerje)" msgid "&Integer scale" msgstr "&Celoštevilsko raztezanje" +msgid "4:&3 Integer scale" +msgstr "Celoštevilsko raztezanje 4:&3" + msgid "E&GA/(S)VGA settings" msgstr "Nastavitve E&GA/(S)VGA" @@ -1219,3 +1222,5 @@ msgstr "Počasni" msgid "Fast" msgstr "Hitri" +msgid "&Auto-pause on focus loss" +msgstr "&Samodejni premor ob izgubi fokusa" diff --git a/src/qt/languages/tr-TR.po b/src/qt/languages/tr-TR.po index 8263f3c2d..0d6875eb8 100644 --- a/src/qt/languages/tr-TR.po +++ b/src/qt/languages/tr-TR.po @@ -124,6 +124,9 @@ msgstr "&Kare piksel (ölçeği koru)" msgid "&Integer scale" msgstr "Tam &sayı ölçeklemesi" +msgid "4:&3 Integer scale" +msgstr "4:&3 Tam sayı ölçeklemesi" + msgid "E&GA/(S)VGA settings" msgstr "EGA/&(S)VGA ayarları" @@ -1219,3 +1222,5 @@ msgstr "Yavaş" msgid "Fast" msgstr "Hızlı" +msgid "&Auto-pause on focus loss" +msgstr "&Odak kaybında otomatik duraklatma" diff --git a/src/qt/languages/uk-UA.po b/src/qt/languages/uk-UA.po index 254e0c284..6f8ecac52 100644 --- a/src/qt/languages/uk-UA.po +++ b/src/qt/languages/uk-UA.po @@ -124,6 +124,9 @@ msgstr "&Квадратні пікселі (зберегти відношенн msgid "&Integer scale" msgstr "&Цілісночисленне масштабування" +msgid "4:&3 Integer scale" +msgstr "Цілісночисленне масштабування 4:&3" + msgid "E&GA/(S)VGA settings" msgstr "Налаштування E&GA/(S)VGA" @@ -1219,3 +1222,5 @@ msgstr "Повільний" msgid "Fast" msgstr "Швидкий" +msgid "&Auto-pause on focus loss" +msgstr "&Автопауза при втраті фокусу" diff --git a/src/qt/languages/zh-CN.po b/src/qt/languages/zh-CN.po index b6d9e5c97..0c12fa76a 100644 --- a/src/qt/languages/zh-CN.po +++ b/src/qt/languages/zh-CN.po @@ -124,6 +124,9 @@ msgstr "保持比例(&S)" msgid "&Integer scale" msgstr "整数比例(&I)" +msgid "4:&3 Integer scale" +msgstr "4:3 整数比例(&3)" + msgid "E&GA/(S)VGA settings" msgstr "EGA/(S)VGA 设置(&G)" @@ -1219,3 +1222,6 @@ msgstr "慢" msgid "Fast" msgstr "快" +msgid "&Auto-pause on focus loss" +msgstr "&失焦自动暂停" + diff --git a/src/qt/languages/zh-TW.po b/src/qt/languages/zh-TW.po index d10b45628..c840230bd 100644 --- a/src/qt/languages/zh-TW.po +++ b/src/qt/languages/zh-TW.po @@ -124,6 +124,9 @@ msgstr "保持比例(&S)" msgid "&Integer scale" msgstr "整數比例(&I)" +msgid "4:&3 Integer scale" +msgstr "4:3 整數比例(&3)" + msgid "E&GA/(S)VGA settings" msgstr "EGA/(S)VGA 設定(&G)" @@ -1219,3 +1222,5 @@ msgstr "慢" msgid "Fast" msgstr "快" +msgid "&Auto-pause on focus loss" +msgstr "&失去焦點時自動暫停" diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 62a79c30d..427b47598 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -211,7 +211,11 @@ MainWindow::MainWindow(QWidget *parent) connect(this, &MainWindow::hardResetCompleted, this, [this]() { ui->actionMCA_devices->setVisible(machine_has_bus(machine, MACHINE_BUS_MCA)); QApplication::setOverrideCursor(Qt::ArrowCursor); +#ifdef USE_WACOM ui->menuTablet_tool->menuAction()->setVisible(mouse_mode >= 1); +#else + ui->menuTablet_tool->menuAction()->setVisible(false); +#endif }); connect(this, &MainWindow::showMessageForNonQtThread, this, &MainWindow::showMessage_, Qt::BlockingQueuedConnection); @@ -268,8 +272,20 @@ MainWindow::MainWindow(QWidget *parent) }); connect(qApp, &QGuiApplication::applicationStateChanged, [this](Qt::ApplicationState state) { - if (mouse_capture && state != Qt::ApplicationState::ApplicationActive) - emit setMouseCapture(false); + if (state == Qt::ApplicationState::ApplicationActive) { + if (auto_paused) { + plat_pause(0); + auto_paused = 0; + } + } else { + if (mouse_capture) + emit setMouseCapture(false); + + if (do_auto_pause && !dopause) { + auto_paused = 1; + plat_pause(1); + } + } }); connect(this, &MainWindow::resizeContents, this, [this](int w, int h) { @@ -530,6 +546,9 @@ MainWindow::MainWindow(QWidget *parent) case FULLSCR_SCALE_INT: ui->actionFullScreen_int->setChecked(true); break; + case FULLSCR_SCALE_INT43: + ui->actionFullScreen_int43->setChecked(true); + break; } actGroup = new QActionGroup(this); actGroup->addAction(ui->actionFullScreen_stretch); @@ -583,6 +602,9 @@ MainWindow::MainWindow(QWidget *parent) if (vid_cga_contrast > 0) { ui->actionChange_contrast_for_monochrome_display->setChecked(true); } + if (do_auto_pause > 0) { + ui->actionAuto_pause->setChecked(true); + } #ifdef Q_OS_MACOS ui->actionCtrl_Alt_Del->setShortcutVisibleInContextMenu(true); @@ -1559,6 +1581,13 @@ MainWindow::on_actionFullScreen_int_triggered() update_fullscreen_scale_checkboxes(ui, ui->actionFullScreen_int); } +void +MainWindow::on_actionFullScreen_int43_triggered() +{ + video_fullscreen_scale = FULLSCR_SCALE_INT43; + update_fullscreen_scale_checkboxes(ui, ui->actionFullScreen_int43); +} + static void update_greyscale_checkboxes(Ui::MainWindow *ui, QAction *selected, int value) { @@ -1709,6 +1738,13 @@ MainWindow::on_actionForce_4_3_display_ratio_triggered() video_toggle_option(ui->actionForce_4_3_display_ratio, &force_43); } +void +MainWindow::on_actionAuto_pause_triggered() +{ + do_auto_pause ^= 1; + ui->actionAuto_pause->setChecked(do_auto_pause > 0 ? true : false); +} + void MainWindow::on_actionRemember_size_and_position_triggered() { diff --git a/src/qt/qt_mainwindow.hpp b/src/qt/qt_mainwindow.hpp index 7e4032a31..0de3f8656 100644 --- a/src/qt/qt_mainwindow.hpp +++ b/src/qt/qt_mainwindow.hpp @@ -69,6 +69,7 @@ private slots: void on_actionFullscreen_triggered(); void on_actionSettings_triggered(); void on_actionExit_triggered(); + void on_actionAuto_pause_triggered(); void on_actionPause_triggered(); void on_actionCtrl_Alt_Del_triggered(); void on_actionCtrl_Alt_Esc_triggered(); @@ -90,6 +91,7 @@ private slots: void on_actionLinear_triggered(); void on_actionNearest_triggered(); void on_actionFullScreen_int_triggered(); + void on_actionFullScreen_int43_triggered(); void on_actionFullScreen_keepRatio_triggered(); void on_actionFullScreen_43_triggered(); void on_actionFullScreen_stretch_triggered(); diff --git a/src/qt/qt_mainwindow.ui b/src/qt/qt_mainwindow.ui index 882122cac..0580b18e1 100644 --- a/src/qt/qt_mainwindow.ui +++ b/src/qt/qt_mainwindow.ui @@ -68,17 +68,19 @@ + + + + - - @@ -148,6 +150,7 @@ + @@ -263,6 +266,14 @@ + + + true + + + &Auto-pause on focus loss + + true @@ -586,6 +597,14 @@ &Integer scale + + + true + + + 4:&3 Integer scale + + true diff --git a/src/qt/qt_renderercommon.cpp b/src/qt/qt_renderercommon.cpp index 6685eede5..723211266 100644 --- a/src/qt/qt_renderercommon.cpp +++ b/src/qt/qt_renderercommon.cpp @@ -76,7 +76,12 @@ RendererCommon::onResize(int width, int height) switch (video_fullscreen_scale) { case FULLSCR_SCALE_INT: - gsr = gw / gh; + case FULLSCR_SCALE_INT43: + if (video_fullscreen_scale == FULLSCR_SCALE_INT43) + gsr = 4.0 / 3.0; + else + gsr = gw / gh; + if (gsr <= hsr) { dw = hh * gsr; dh = hh; From d909b86fd516c892aa21a56524829b634a58760f Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 13 Oct 2023 23:51:50 +0200 Subject: [PATCH 11/16] More config.c clean-ups. --- src/config.c | 190 ++------------------------------------------------- 1 file changed, 5 insertions(+), 185 deletions(-) diff --git a/src/config.c b/src/config.c index 0bad73574..d6430053c 100644 --- a/src/config.c +++ b/src/config.c @@ -242,204 +242,28 @@ load_machine(void) { ini_section_t cat = ini_find_section(config, "Machine"); const char *p; - const char *migrate_from = NULL; int c; int i; - int j; int speed; - int legacy_mfg; - int legacy_cpu; double multi; p = ini_section_get_string(cat, "machine", NULL); - if (p != NULL) { - migrate_from = p; - if (!strcmp(p, "8500ttc")) /* migrate typo... */ - machine = machine_get_machine_from_internal_name("8600ttc"); - else if (!strcmp(p, "eagle_pcspirit")) /* ...legacy names... */ - machine = machine_get_machine_from_internal_name("pcspirit"); - else if (!strcmp(p, "multitech_pc700")) - machine = machine_get_machine_from_internal_name("pc700"); - else if (!strcmp(p, "ncr_pc4i")) - machine = machine_get_machine_from_internal_name("pc4i"); - else if (!strcmp(p, "olivetti_m19")) - machine = machine_get_machine_from_internal_name("m19"); - else if (!strcmp(p, "open_xt")) - machine = machine_get_machine_from_internal_name("openxt"); - else if (!strcmp(p, "open_at")) - machine = machine_get_machine_from_internal_name("openat"); - else if (!strcmp(p, "philips_p3105")) - machine = machine_get_machine_from_internal_name("p3105"); - else if (!strcmp(p, "philips_p3120")) - machine = machine_get_machine_from_internal_name("p3120"); - else if (!strcmp(p, "olivetti_m24")) - machine = machine_get_machine_from_internal_name("m24"); - else if (!strcmp(p, "olivetti_m240")) - machine = machine_get_machine_from_internal_name("m240"); - else if (!strcmp(p, "ncr_pc8")) - machine = machine_get_machine_from_internal_name("pc8"); - else if (!strcmp(p, "olivetti_m290")) - machine = machine_get_machine_from_internal_name("m290"); - else if (!strcmp(p, "ncr_3302")) - machine = machine_get_machine_from_internal_name("3302"); - else if (!strcmp(p, "ncr_pc916sx")) - machine = machine_get_machine_from_internal_name("pc916sx"); - else if (!strcmp(p, "cbm_sl386sx16")) - machine = machine_get_machine_from_internal_name("cmdsl386sx16"); - else if (!strcmp(p, "cbm_sl386sx25")) - machine = machine_get_machine_from_internal_name("cmdsl386sx25"); - else if (!strcmp(p, "mr586")) - machine = machine_get_machine_from_internal_name("p54tp4xe_mr"); - else if (!strcmp(p, "pcv240")) - machine = machine_get_machine_from_internal_name("pcv90"); - else if (!strcmp(p, "v60n")) - machine = machine_get_machine_from_internal_name("acerv60n"); - else if (!strcmp(p, "tsunamiatx")) - machine = machine_get_machine_from_internal_name("s1846"); - else if (!strcmp(p, "trinity371")) - machine = machine_get_machine_from_internal_name("s1857"); - else if (!strcmp(p, "63a")) - machine = machine_get_machine_from_internal_name("63a1"); - else if (!strcmp(p, "4sa2")) - machine = machine_get_machine_from_internal_name("4saw2"); - else if (!strcmp(p, "award386dx")) /* ...merged machines... */ - machine = machine_get_machine_from_internal_name("award495"); - else if (!strcmp(p, "ami386dx")) - machine = machine_get_machine_from_internal_name("ami495"); - else if (!strcmp(p, "mr386dx")) - machine = machine_get_machine_from_internal_name("mr495"); - else if (!strcmp(p, "award486")) - machine = machine_get_machine_from_internal_name("award495"); - else if (!strcmp(p, "ami486")) - machine = machine_get_machine_from_internal_name("ami495"); - else if (!strcmp(p, "mr486")) - machine = machine_get_machine_from_internal_name("mr495"); - else if (!strcmp(p, "ibmps1_2121_isa")) - machine = machine_get_machine_from_internal_name("ibmps1_2121"); - else if (!strcmp(p, "fw6400gx_s1")) - machine = machine_get_machine_from_internal_name("fw6400gx"); - else if (!strcmp(p, "p54vl")) - machine = machine_get_machine_from_internal_name("p5vl"); - else if (!strcmp(p, "chariot")) - machine = machine_get_machine_from_internal_name("fmb"); - else if (!strcmp(p, "president")) { /* ...and removed machines */ - machine = machine_get_machine_from_internal_name("mb500n"); - migrate_from = NULL; - } else if (!strcmp(p, "j656vxd")) { - machine = machine_get_machine_from_internal_name("p55va"); - migrate_from = NULL; - } else { - machine = machine_get_machine_from_internal_name(p); - migrate_from = NULL; - } - } else + if (p != NULL) + machine = machine_get_machine_from_internal_name(p); + else machine = 0; - /* This is for backwards compatibility. */ - p = ini_section_get_string(cat, "model", NULL); - if (p != NULL) { - migrate_from = p; - if (!strcmp(p, "p55r2p4")) /* migrate typo */ - machine = machine_get_machine_from_internal_name("p55t2p4"); - else { - machine = machine_get_machine_from_internal_name(p); - migrate_from = NULL; - } - ini_section_delete_var(cat, "model"); - } if (machine >= machine_count()) machine = machine_count() - 1; - /* Copy NVR files when migrating a machine to a new internal name. */ - if (migrate_from) { - char old_fn[256]; - strcpy(old_fn, migrate_from); - strcat(old_fn, "."); - c = strlen(old_fn); - char new_fn[256]; - strcpy(new_fn, machines[machine].internal_name); - strcat(new_fn, "."); - i = strlen(new_fn); - - /* Iterate through NVR files. */ - DIR *dirp = opendir(nvr_path(".")); - if (dirp) { - struct dirent *entry; - while ((entry = readdir(dirp))) { - /* Check if this file corresponds to the old name. */ - if (strncmp(entry->d_name, old_fn, c)) - continue; - - /* Add extension to the new name. */ - strcpy(&new_fn[i], &entry->d_name[c]); - - /* Only copy if a file with the new name doesn't already exist. */ - FILE *g = nvr_fopen(new_fn, "rb"); - if (!g) { - FILE *f = nvr_fopen(entry->d_name, "rb"); - g = nvr_fopen(new_fn, "wb"); - - uint8_t buf[4096]; - while ((j = fread(buf, 1, sizeof(buf), f))) - fwrite(buf, 1, j, g); - - fclose(f); - } - fclose(g); - } - } - } - cpu_override = ini_section_get_int(cat, "cpu_override", 0); cpu_f = NULL; p = ini_section_get_string(cat, "cpu_family", NULL); if (p) { - if (!strcmp(p, "enh_am486dx2")) /* migrate modified names */ - cpu_f = cpu_get_family("am486dx2_slenh"); - else if (!strcmp(p, "enh_am486dx4")) - cpu_f = cpu_get_family("am486dx4_slenh"); - else - cpu_f = cpu_get_family(p); + cpu_f = cpu_get_family(p); if (cpu_f && !cpu_family_is_eligible(cpu_f, machine)) /* only honor eligible families */ cpu_f = NULL; - } else { - /* Backwards compatibility with the previous CPU model system. */ - legacy_mfg = ini_section_get_int(cat, "cpu_manufacturer", 0); - legacy_cpu = ini_section_get_int(cat, "cpu", 0); - - /* Check if either legacy ID is present, and if they are within bounds. */ - if (((legacy_mfg > 0) || (legacy_cpu > 0)) && (legacy_mfg >= 0) && (legacy_mfg < 4) && (legacy_cpu >= 0)) { - /* Look for a machine entry on the legacy table. */ - p = machine_get_internal_name(); - c = 0; - while (cpu_legacy_table[c].machine) { - if (!strcmp(p, cpu_legacy_table[c].machine)) - break; - c++; - } - if (cpu_legacy_table[c].machine) { - /* Determine the amount of CPU entries on the table. */ - i = -1; - while (cpu_legacy_table[c].tables[legacy_mfg][++i].family) - ; - - /* If the CPU ID is out of bounds, reset to the last known ID. */ - if (legacy_cpu >= i) - legacy_cpu = i - 1; - - const cpu_legacy_table_t *legacy_table_entry = &cpu_legacy_table[c].tables[legacy_mfg][legacy_cpu]; - - /* Check if the referenced family exists. */ - cpu_f = cpu_get_family(legacy_table_entry->family); - if (cpu_f) { - /* Save the new values. */ - ini_section_set_string(cat, "cpu_family", legacy_table_entry->family); - ini_section_set_int(cat, "cpu_speed", legacy_table_entry->rspeed); - ini_section_set_double(cat, "cpu_multi", legacy_table_entry->multi); - } - } - } } if (cpu_f) { @@ -544,11 +368,7 @@ load_video(void) } free_p = 1; } - if (!strcmp(p, "virge375_vbe20_pci")) - /* Migrate renamed cards */ - gfxcard[0] = video_get_video_from_internal_name("virge385_pci"); - else - gfxcard[0] = video_get_video_from_internal_name(p); + gfxcard[0] = video_get_video_from_internal_name(p); if (free_p) free(p); } From f6a5229a98883947816859dd393558b399b5d8ac Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 13 Oct 2023 15:34:00 -0400 Subject: [PATCH 12/16] Future support for higher clocked CPU's --- src/86box.c | 4 +- src/config.c | 2 +- src/cpu/386.c | 10 ++--- src/cpu/386_dynarec.c | 28 +++++++------- src/cpu/808x.c | 2 +- src/cpu/cpu.c | 2 +- src/cpu/cpu.h | 18 ++++----- src/gdbstub.c | 4 +- src/include/86box/ini.h | 16 ++++++++ src/include/86box/pit.h | 2 +- src/ini.c | 76 +++++++++++++++++++++++++++++++++++++ src/machine/m_xt_olivetti.c | 2 +- src/pit.c | 4 +- 13 files changed, 131 insertions(+), 39 deletions(-) diff --git a/src/86box.c b/src/86box.c index 1afdc101d..ab1dc8881 100644 --- a/src/86box.c +++ b/src/86box.c @@ -882,7 +882,7 @@ pc_speed_changed(void) if (cpu_s->cpu_type >= CPU_286) pit_set_clock(cpu_s->rspeed); else - pit_set_clock(14318184.0); + pit_set_clock((uint32_t) 14318184.0); } void @@ -1368,7 +1368,7 @@ pc_run(void) /* Run a block of code. */ startblit(); - cpu_exec(cpu_s->rspeed / 100); + cpu_exec((int32_t) cpu_s->rspeed / 100); #ifdef USE_GDBSTUB /* avoid a KBC FIFO overflow when CPU emulation is stalled */ if (gdbstub_step == GDBSTUB_EXEC) { #endif diff --git a/src/config.c b/src/config.c index d6430053c..d9885fea2 100644 --- a/src/config.c +++ b/src/config.c @@ -1857,7 +1857,7 @@ save_machine(void) ini_section_set_string(cat, "machine", p); ini_section_set_string(cat, "cpu_family", cpu_f->internal_name); - ini_section_set_int(cat, "cpu_speed", cpu_f->cpus[cpu].rspeed); + ini_section_set_uint(cat, "cpu_speed", cpu_f->cpus[cpu].rspeed); ini_section_set_double(cat, "cpu_multi", cpu_f->cpus[cpu].multi); if (cpu_override) ini_section_set_int(cat, "cpu_override", cpu_override); diff --git a/src/cpu/386.c b/src/cpu/386.c index e84981893..f89a8dc96 100644 --- a/src/cpu/386.c +++ b/src/cpu/386.c @@ -219,16 +219,16 @@ fetch_ea_16_long(uint32_t rmdat) #include "386_ops.h" void -exec386_2386(int cycs) +exec386_2386(int32_t cycs) { int ol; int vector; int tempi; - int cycdiff; - int oldcyc; - int cycle_period; - int ins_cycles; + int32_t cycdiff; + int32_t oldcyc; + int32_t cycle_period; + int32_t ins_cycles; uint32_t addr; cycles += cycs; diff --git a/src/cpu/386_dynarec.c b/src/cpu/386_dynarec.c index f53b216de..e4caa8a1b 100644 --- a/src/cpu/386_dynarec.c +++ b/src/cpu/386_dynarec.c @@ -226,12 +226,12 @@ fetch_ea_16_long(uint32_t rmdat) #define CACHE_ON() (!(cr0 & (1 << 30)) && !(cpu_state.flags & T_FLAG)) #ifdef USE_DYNAREC -int cycles_main = 0; -static int cycles_old = 0; +int32_t cycles_main = 0; +static int32_t cycles_old = 0; static uint64_t tsc_old = 0; # ifdef USE_ACYCS -int acycs = 0; +int32_t acycs = 0; # endif void @@ -676,24 +676,24 @@ exec386_dynarec_dyn(void) } void -exec386_dynarec(int cycs) +exec386_dynarec(int32_t cycs) { int vector; int tempi; - int cycdiff; - int oldcyc; - int oldcyc2; + int32_t cycdiff; + int32_t oldcyc; + int32_t oldcyc2; uint64_t oldtsc; uint64_t delta; - int cyc_period = cycs / 2000; /*5us*/ + int32_t cyc_period = cycs / 2000; /*5us*/ # ifdef USE_ACYCS acycs = 0; # endif cycles_main += cycs; while (cycles_main > 0) { - int cycles_start; + int32_t cycles_start; cycles += cyc_period; cycles_start = cycles; @@ -799,14 +799,14 @@ exec386_dynarec(int cycs) #endif void -exec386(int cycs) +exec386(int32_t cycs) { int vector; int tempi; - int cycdiff; - int oldcyc; - int cycle_period; - int ins_cycles; + int32_t cycdiff; + int32_t oldcyc; + int32_t cycle_period; + int32_t ins_cycles; uint32_t addr; cycles += cycs; diff --git a/src/cpu/808x.c b/src/cpu/808x.c index d20fdb87a..a24d1f07f 100644 --- a/src/cpu/808x.c +++ b/src/cpu/808x.c @@ -2063,7 +2063,7 @@ farret(int far) /* Executes instructions up to the specified number of cycles. */ void -execx86(int cycs) +execx86(int32_t cycs) { uint8_t temp = 0; uint8_t temp2; diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 848826264..1ea8b2dde 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -258,7 +258,7 @@ CPU *cpu_s; uint8_t do_translate = 0; uint8_t do_translate2 = 0; -void (*cpu_exec)(int cycs); +void (*cpu_exec)(int32_t cycs); static uint8_t ccr0; static uint8_t ccr1; diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 66ccc05c9..9bdcca84c 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -143,7 +143,7 @@ typedef struct cpu_t { const char *name; uint64_t cpu_type; const FPU *fpus; - int rspeed; + uint32_t rspeed; double multi; uint16_t voltage; uint32_t edx_reset; @@ -166,9 +166,9 @@ typedef struct { } cpu_family_t; typedef struct { - const char *family; - const int rspeed; - const double multi; + const char *family; + const uint32_t rspeed; + const double multi; } cpu_legacy_table_t; typedef struct { @@ -739,13 +739,13 @@ extern void codegen_block_end(void); extern void codegen_reset(void); extern void cpu_set_edx(void); extern int divl(uint32_t val); -extern void execx86(int cycs); +extern void execx86(int32_t cycs); extern void enter_smm(int in_hlt); extern void enter_smm_check(int in_hlt); extern void leave_smm(void); -extern void exec386_2386(int cycs); -extern void exec386(int cycs); -extern void exec386_dynarec(int cycs); +extern void exec386_2386(int32_t cycs); +extern void exec386(int32_t cycs); +extern void exec386_dynarec(int32_t cycs); extern int idivl(int32_t val); extern void resetmcr(void); extern void resetx86(void); @@ -814,7 +814,7 @@ extern int prefetch_prefixes; extern uint8_t use_custom_nmi_vector; extern uint32_t custom_nmi_vector; -extern void (*cpu_exec)(int cycs); +extern void (*cpu_exec)(int32_t cycs); extern uint8_t do_translate; extern uint8_t do_translate2; diff --git a/src/gdbstub.c b/src/gdbstub.c index d41f4bbc5..703637422 100644 --- a/src/gdbstub.c +++ b/src/gdbstub.c @@ -343,7 +343,7 @@ static gdbstub_client_t *first_client = NULL; static gdbstub_client_t *last_client = NULL; static mutex_t *client_list_mutex; -static void (*cpu_exec_shadow)(int cycs); +static void (*cpu_exec_shadow)(int32_t cycs); static gdbstub_breakpoint_t *first_swbreak = NULL; static gdbstub_breakpoint_t *first_hwbreak = NULL; static gdbstub_breakpoint_t *first_rwatch = NULL; @@ -1373,7 +1373,7 @@ end: } static void -gdbstub_cpu_exec(int cycs) +gdbstub_cpu_exec(int32_t cycs) { /* Flag that we're now in the debugger context to avoid triggering watchpoints. */ in_gdbstub = 1; diff --git a/src/include/86box/ini.h b/src/include/86box/ini.h index 866787352..d52620f69 100644 --- a/src/include/86box/ini.h +++ b/src/include/86box/ini.h @@ -37,6 +37,10 @@ extern void ini_close(ini_t ini); extern void ini_section_delete_var(ini_section_t section, const char *name); extern int ini_section_get_int(ini_section_t section, const char *name, int def); +extern uint32_t ini_section_get_uint(ini_section_t section, const char *name, uint32_t def); +#if 0 +extern float ini_section_get_float(ini_section_t section, const char *name, float def); +#endif extern double ini_section_get_double(ini_section_t section, const char *name, double def); extern int ini_section_get_hex16(ini_section_t section, const char *name, int def); extern int ini_section_get_hex20(ini_section_t section, const char *name, int def); @@ -44,6 +48,10 @@ extern int ini_section_get_mac(ini_section_t section, const char *name, int extern char *ini_section_get_string(ini_section_t section, const char *name, char *def); extern wchar_t *ini_section_get_wstring(ini_section_t section, const char *name, wchar_t *def); extern void ini_section_set_int(ini_section_t section, const char *name, int val); +extern void ini_section_set_uint(ini_section_t section, const char *name, uint32_t val); +#if 0 +extern void ini_section_set_float(ini_section_t section, const char *name, float val); +#endif extern void ini_section_set_double(ini_section_t section, const char *name, double val); extern void ini_section_set_hex16(ini_section_t section, const char *name, int val); extern void ini_section_set_hex20(ini_section_t section, const char *name, int val); @@ -54,6 +62,10 @@ extern void ini_section_set_wstring(ini_section_t section, const char *name, #define ini_delete_var(ini, head, name) ini_section_delete_var(ini_find_section(ini, head), name) #define ini_get_int(ini, head, name, def) ini_section_get_int(ini_find_section(ini, head), name, def) +#define ini_get_uint(ini, head, name, def) ini_section_get_uint(ini_find_section(ini, head), name, def) +#if 0 +#define ini_get_float(ini, head, name, def) ini_section_get_float(ini_find_section(ini, head), name, def) +#endif #define ini_get_double(ini, head, name, def) ini_section_get_double(ini_find_section(ini, head), name, def) #define ini_get_hex16(ini, head, name, def) ini_section_get_hex16(ini_find_section(ini, head), name, def) #define ini_get_hex20(ini, head, name, def) ini_section_get_hex20(ini_find_section(ini, head), name, def) @@ -62,6 +74,10 @@ extern void ini_section_set_wstring(ini_section_t section, const char *name, #define ini_get_wstring(ini, head, name, def) ini_section_get_wstring(ini_find_section(ini, head), name, def) #define ini_set_int(ini, head, name, val) ini_section_set_int(ini_find_or_create_section(ini, head), name, val) +#define ini_set_uint(ini, head, name, val) ini_section_set_uint(ini_find_or_create_section(ini, head), name, val) +#if 0 +#define ini_set_float(ini, head, name, val) ini_section_set_float(ini_find_or_create_section(ini, head), name, val) +#endif #define ini_set_double(ini, head, name, val) ini_section_set_double(ini_find_or_create_section(ini, head), name, val) #define ini_set_hex16(ini, head, name, val) ini_section_set_hex16(ini_find_or_create_section(ini, head), name, val) #define ini_set_hex20(ini, head, name, val) ini_section_set_hex20(ini_find_or_create_section(ini, head), name, val) diff --git a/src/include/86box/pit.h b/src/include/86box/pit.h index bb6c26969..af9142625 100644 --- a/src/include/86box/pit.h +++ b/src/include/86box/pit.h @@ -128,7 +128,7 @@ extern void pit_speaker_timer(int new_out, int old_out); extern void pit_nmi_timer_ps2(int new_out, int old_out); -extern void pit_set_clock(int clock); +extern void pit_set_clock(uint32_t clock); extern void pit_handler(int set, uint16_t base, int size, void *priv); #ifdef EMU_DEVICE_H diff --git a/src/ini.c b/src/ini.c index 35c7504eb..a792d356b 100644 --- a/src/ini.c +++ b/src/ini.c @@ -560,6 +560,46 @@ ini_section_get_int(ini_section_t self, const char *name, int def) return value; } +uint32_t +ini_section_get_uint(ini_section_t self, const char *name, uint32_t def) +{ + section_t *section = (section_t *) self; + const entry_t *entry; + uint32_t value; + + if (section == NULL) + return def; + + entry = find_entry(section, name); + if (entry == NULL) + return def; + + sscanf(entry->data, "%u", &value); + + return value; +} + +#if 0 +float +ini_section_get_float(ini_section_t self, const char *name, float def) +{ + section_t *section = (section_t *) self; + const entry_t *entry; + float value; + + if (section == NULL) + return def; + + entry = find_entry(section, name); + if (entry == NULL) + return def; + + sscanf(entry->data, "%g", &value); + + return value; +} +#endif + double ini_section_get_double(ini_section_t self, const char *name, double def) { @@ -687,6 +727,42 @@ ini_section_set_int(ini_section_t self, const char *name, int val) mbstowcs(ent->wdata, ent->data, 512); } +void +ini_section_set_uint(ini_section_t self, const char *name, uint32_t val) +{ + section_t *section = (section_t *) self; + entry_t *ent; + + if (section == NULL) + return; + + ent = find_entry(section, name); + if (ent == NULL) + ent = create_entry(section, name); + + sprintf(ent->data, "%i", val); + mbstowcs(ent->wdata, ent->data, 512); +} + +#if 0 +void +ini_section_set_float(ini_section_t self, const char *name, float val) +{ + section_t *section = (section_t *) self; + entry_t *ent; + + if (section == NULL) + return; + + ent = find_entry(section, name); + if (ent == NULL) + ent = create_entry(section, name); + + sprintf(ent->data, "%g", val); + mbstowcs(ent->wdata, ent->data, 512); +} +#endif + void ini_section_set_double(ini_section_t self, const char *name, double val) { diff --git a/src/machine/m_xt_olivetti.c b/src/machine/m_xt_olivetti.c index e5afae885..58134dfc9 100644 --- a/src/machine/m_xt_olivetti.c +++ b/src/machine/m_xt_olivetti.c @@ -1943,7 +1943,7 @@ machine_xt_m19_init(const machine_t *model) device_add(&keyboard_xt_olivetti_device); - pit_set_clock(14318184.0); + pit_set_clock((uint32_t) 14318184.0); return ret; } diff --git a/src/pit.c b/src/pit.c index 1c7a44bd7..fc65839a3 100644 --- a/src/pit.c +++ b/src/pit.c @@ -1000,11 +1000,11 @@ pit_ps2_init(int type) } void -pit_set_clock(int clock) +pit_set_clock(uint32_t clock) { /* Set default CPU/crystal clock and xt_cpu_multi. */ if (cpu_s->cpu_type >= CPU_286) { - int remainder = (clock % 100000000); + uint32_t remainder = (clock % 100000000); if (remainder == 66666666) cpuclock = (double) (clock - remainder) + (200000000.0 / 3.0); else if (remainder == 33333333) From e657ecc8dda28c02d72c68d436d2880fdb01eb55 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 14 Oct 2023 00:02:31 +0200 Subject: [PATCH 13/16] And another config.c clean-up. --- src/config.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/config.c b/src/config.c index d6430053c..cc8e73ca4 100644 --- a/src/config.c +++ b/src/config.c @@ -412,19 +412,7 @@ load_input_devices(void) p = ini_section_get_string(cat, "joystick_type", NULL); if (p != NULL) { - if (!strcmp(p, "standard_2button")) - /* Migrate renamed types */ - joystick_type = joystick_get_from_internal_name("2axis_2button"); - else if (!strcmp(p, "standard_4button")) - joystick_type = joystick_get_from_internal_name("2axis_4button"); - else if (!strcmp(p, "standard_6button")) - joystick_type = joystick_get_from_internal_name("2axis_6button"); - else if (!strcmp(p, "standard_8button")) - joystick_type = joystick_get_from_internal_name("2axis_8button"); - else if (!strcmp(p, "ch_flighstick_pro")) /* fix typo */ - joystick_type = joystick_get_from_internal_name("ch_flightstick_pro"); - else - joystick_type = joystick_get_from_internal_name(p); + joystick_type = joystick_get_from_internal_name(p); if (!joystick_type) { /* Try to read an integer for backwards compatibility with old configs */ From a753cd16dc1d9eb2c4abe5f07446a78b293afc3f Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 13 Oct 2023 14:17:02 -0400 Subject: [PATCH 14/16] Additional lint --- src/include/86box/mem.h | 4 ++-- src/nvr_at.c | 4 ++-- src/qt/qt_renderercommon.cpp | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/include/86box/mem.h b/src/include/86box/mem.h index c94d8cbbd..69a2b5de8 100644 --- a/src/include/86box/mem.h +++ b/src/include/86box/mem.h @@ -447,8 +447,8 @@ extern void mem_close(void); extern void mem_reset(void); extern void mem_remap_top(int kb); -extern mem_mapping_t *read_mapping[MEM_MAPPINGS_NO]; -extern mem_mapping_t *write_mapping[MEM_MAPPINGS_NO]; +extern mem_mapping_t *read_mapping[MEM_MAPPINGS_NO]; +extern mem_mapping_t *write_mapping[MEM_MAPPINGS_NO]; #ifdef EMU_CPU_H static __inline uint32_t diff --git a/src/nvr_at.c b/src/nvr_at.c index e4009262e..581eccf71 100644 --- a/src/nvr_at.c +++ b/src/nvr_at.c @@ -332,7 +332,7 @@ static void time_get(nvr_t *nvr, struct tm *tm) { const local_t *local = (local_t *) nvr->data; - int8_t temp; + int8_t temp; if (nvr->regs[RTC_REGB] & REGB_DM) { /* NVR is in Binary data mode. */ @@ -370,7 +370,7 @@ static void time_set(nvr_t *nvr, struct tm *tm) { const local_t *local = (local_t *) nvr->data; - int year = (tm->tm_year + 1900); + int year = (tm->tm_year + 1900); if (nvr->regs[RTC_REGB] & REGB_DM) { /* NVR is in Binary data mode. */ diff --git a/src/qt/qt_renderercommon.cpp b/src/qt/qt_renderercommon.cpp index 723211266..1eef4863c 100644 --- a/src/qt/qt_renderercommon.cpp +++ b/src/qt/qt_renderercommon.cpp @@ -143,5 +143,4 @@ RendererCommon::eventDelegate(QEvent *event, bool &result) result = QApplication::sendEvent(parentWidget, event); return true; } - return false; } From ba3c68390cef4b6b01c0bb260b30a9938044785c Mon Sep 17 00:00:00 2001 From: Alexander Babikov <2708460+lemondrops@users.noreply.github.com> Date: Sat, 14 Oct 2023 03:16:42 +0500 Subject: [PATCH 15/16] Remove the C/C++ standard flags from the toolchain files --- cmake/flags-gcc.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/flags-gcc.cmake b/cmake/flags-gcc.cmake index 9e84ac16b..885353b87 100644 --- a/cmake/flags-gcc.cmake +++ b/cmake/flags-gcc.cmake @@ -14,8 +14,8 @@ # # Define our flags -string(APPEND CMAKE_C_FLAGS_INIT " -std=c99 -fomit-frame-pointer -Wall -fno-strict-aliasing -Werror=implicit-int -Werror=implicit-function-declaration -Werror=int-conversion -Werror=strict-prototypes -Werror=old-style-definition") -string(APPEND CMAKE_CXX_FLAGS_INIT " -std=c++11 -fomit-frame-pointer -Wall -fno-strict-aliasing") +string(APPEND CMAKE_C_FLAGS_INIT " -fomit-frame-pointer -Wall -fno-strict-aliasing -Werror=implicit-int -Werror=implicit-function-declaration -Werror=int-conversion -Werror=strict-prototypes -Werror=old-style-definition") +string(APPEND CMAKE_CXX_FLAGS_INIT " -fomit-frame-pointer -Wall -fno-strict-aliasing") string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -g0 -O3") string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -g0 -O3") string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " -ggdb -Og") From 531bb611465c79742c255f6367daee6028852bc2 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 14 Oct 2023 00:27:33 +0200 Subject: [PATCH 16/16] Fxied the last warnings. --- src/config.c | 8 ++++---- src/video/vid_xga.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/config.c b/src/config.c index cc8e73ca4..d95e06f1f 100644 --- a/src/config.c +++ b/src/config.c @@ -1094,7 +1094,7 @@ load_floppy_and_cdrom_drives(void) ini_section_delete_var(cat, temp); } for (int i = 0; i < MAX_PREV_IMAGES; i++) { - fdd_image_history[c][i] = (char *) calloc(MAX_IMAGE_PATH_LEN + 1, sizeof(char)); + fdd_image_history[c][i] = (char *) calloc((MAX_IMAGE_PATH_LEN + 1) << 1, sizeof(char)); sprintf(temp, "fdd_%02i_image_history_%02i", c + 1, i + 1); p = ini_section_get_string(cat, temp, NULL); if (p) { @@ -1210,7 +1210,7 @@ load_floppy_and_cdrom_drives(void) cdrom[c].host_drive = 0; for (int i = 0; i < MAX_PREV_IMAGES; i++) { - cdrom[c].image_history[i] = (char *) calloc(MAX_IMAGE_PATH_LEN + 1, sizeof(char)); + cdrom[c].image_history[i] = (char *) calloc((MAX_IMAGE_PATH_LEN + 1) << 1, sizeof(char)); sprintf(temp, "cdrom_%02i_image_history_%02i", c + 1, i + 1); p = ini_section_get_string(cat, temp, NULL); if (p) { @@ -1343,7 +1343,7 @@ load_other_removable_devices(void) } for (int i = 0; i < MAX_PREV_IMAGES; i++) { - zip_drives[c].image_history[i] = (char *) calloc(MAX_IMAGE_PATH_LEN + 1, sizeof(char)); + zip_drives[c].image_history[i] = (char *) calloc((MAX_IMAGE_PATH_LEN + 1) << 1, sizeof(char)); sprintf(temp, "zip_%02i_image_history_%02i", c + 1, i + 1); p = ini_section_get_string(cat, temp, NULL); if (p) { @@ -1459,7 +1459,7 @@ load_other_removable_devices(void) } for (int i = 0; i < MAX_PREV_IMAGES; i++) { - mo_drives[c].image_history[i] = (char *) calloc(MAX_IMAGE_PATH_LEN + 1, sizeof(char)); + mo_drives[c].image_history[i] = (char *) calloc((MAX_IMAGE_PATH_LEN + 1) << 1, sizeof(char)); sprintf(temp, "mo_%02i_image_history_%02i", c + 1, i + 1); p = ini_section_get_string(cat, temp, NULL); if (p) { diff --git a/src/video/vid_xga.c b/src/video/vid_xga.c index 58b4413a2..f53ba9bb4 100644 --- a/src/video/vid_xga.c +++ b/src/video/vid_xga.c @@ -3364,7 +3364,7 @@ xga_init(const device_t *info) rom = malloc(xga->bios_rom.sz); memset(rom, 0xff, xga->bios_rom.sz); - (void) fread(rom, xga->bios_rom.sz, 1, fp); + (void) !fread(rom, xga->bios_rom.sz, 1, fp); (void) fclose(fp); xga->bios_rom.rom = rom;