diff --git a/src/config.c b/src/config.c index 9aead9a0f..252aab1d9 100644 --- a/src/config.c +++ b/src/config.c @@ -484,6 +484,9 @@ load_general(void) sound_gain = config_get_int(cat, "sound_gain", 0); + confirm_reset = config_get_int(cat, "confirm_reset", 1); + confirm_exit = config_get_int(cat, "confirm_exit", 1); + #ifdef USE_LANGUAGE /* * Currently, 86Box is English (US) only, but in the future @@ -1587,7 +1590,7 @@ save_general(void) else config_set_int(cat, "video_fullscreen_scale", video_fullscreen_scale); - if (video_fullscreen_first == 0) + if (video_fullscreen_first == 1) config_delete_var(cat, "video_fullscreen_first"); else config_set_int(cat, "video_fullscreen_first", video_fullscreen_first); @@ -1647,6 +1650,16 @@ save_general(void) else config_delete_var(cat, "sound_gain"); + if (confirm_reset != 1) + config_set_int(cat, "confirm_reset", confirm_reset); + else + config_delete_var(cat, "confirm_reset"); + + if (confirm_exit != 1) + config_set_int(cat, "confirm_exit", confirm_exit); + else + config_delete_var(cat, "confirm_exit"); + #ifdef USE_LANGUAGE if (plat_langid == 0x0409) config_delete_var(cat, "language"); diff --git a/src/cpu/386_ops.h b/src/cpu/386_ops.h index 2b6be6aa9..9ee76bbe9 100644 --- a/src/cpu/386_ops.h +++ b/src/cpu/386_ops.h @@ -214,7 +214,7 @@ static int opVPCEXT(uint32_t fetchdat) time_t now; struct tm *tm; - if (!is_vpc) + if (!is_vpc) /* only emulate this on Virtual PC machines */ return ILLEGAL(fetchdat); cpu_state.pc += 2; @@ -222,16 +222,19 @@ static int opVPCEXT(uint32_t fetchdat) b1 = fetchdat & 0xff; b2 = (fetchdat >> 8) & 0xff; + /* a lot of these opcodes (which?) return illegal instruction in user mode */ ILLEGAL_ON(CPL > 0); CLOCK_CYCLES(1); + /* 0f 3f 03 xx opcodes are mostly related to the host clock, so fetch it now */ if (b1 == 0x03) { (void)time(&now); tm = localtime(&now); } if ((b1 == 0x07) && (b2 == 0x0b)) { + /* 0f 3f 07 0b: unknown, EDX output depends on EAX input */ switch (EAX) { case 0x00000000: EDX = 0x00000003; @@ -254,46 +257,56 @@ static int opVPCEXT(uint32_t fetchdat) default: EDX = 0x00000000; - if (EAX > 0x00000012) + if (EAX > 0x00000012) /* unknown EAX values set zero flag */ cpu_state.flags &= ~(Z_FLAG); } } else if ((b1 == 0x03) && (b2 == 0x00)) { + /* 0f 3f 03 00: host time in BCD */ EDX = BCD8(tm->tm_hour); ECX = BCD8(tm->tm_min); EAX = BCD8(tm->tm_sec); } else if ((b1 == 0x03) && (b2 == 0x01)) { + /* 0f 3f 03 00: host date in BCD */ EDX = BCD8(tm->tm_year % 100); ECX = BCD8(tm->tm_mon + 1); EAX = BCD8(tm->tm_mday); - cent = (((tm->tm_year - (tm->tm_year % 100)) / 100) % 4); + cent = (((tm->tm_year - (tm->tm_year % 100)) / 100) % 4); /* Sunday = 0 */ EBX = ((tm->tm_mday + tm->tm_mon + (tm->tm_year % 100) + cent + 3) % 7); } else if ((b1 == 0x03) && (b2 == 0x03)) { + /* 0f 3f 03 03: host time in binary */ EDX = tm->tm_hour; ECX = tm->tm_min; EAX = tm->tm_sec; } else if ((b1 == 0x03) && (b2 == 0x04)) { + /* 0f 3f 03 04: host date in binary */ EDX = 1900 + tm->tm_year; ECX = tm->tm_mon + 1; EBX = tm->tm_mday; } else if ((b1 == 0x03) && (b2 == 0x05)) { + /* 0f 3f 03 05: unknown */ EBX = 0x0000000F; ECX = 0x0000000A; } else if ((b1 == 0x03) && (b2 == 0x06)) { - /* Some kind of timestamp. BX jumps around very quickly, CX not so much. */ + /* 0f 3f 03 06: some kind of timestamp. BX jumps around very quickly, CX not so much. */ EBX = 0x00000000; ECX = 0x00000000; } else if ((b1 == 0x03) && (b2 >= 0x07)) { + /* 0f 3f 03 07+: set zero flag */ cpu_state.flags &= ~(Z_FLAG); } else if ((b1 == 0x0a) && (b2 == 0x00)) { + /* 0f 3f 0a 00: memory size in KB */ EAX = mem_size; - } else if ((b1 == 0x11) && (b2 == 0x00)) + } else if ((b1 == 0x11) && (b2 == 0x00)) { + /* 0f 3f 11 00: unknown, set EAX to 0 */ EAX = 0x00000000; - else if ((b1 == 0x11) && (b2 == 0x01)) { + } else if ((b1 == 0x11) && (b2 == 0x01)) { + /* 0f 3f 11 00: unknown, set EAX to 0 and set zero flag */ EAX = 0x00000000; cpu_state.flags &= ~(Z_FLAG); - } else if ((b1 == 0x11) && (b2 == 0x02)) - ; /* Do nothing */ - else { + } else if ((b1 == 0x11) && (b2 == 0x02)) { + /* 0f 3f 11 02: unknown, no-op */ + } else { + /* other unknown opcodes: illegal instruction */ cpu_state.pc = cpu_state.oldpc; pclog("Illegal VPCEXT %08X (%02X %02X)\n", fetchdat, b1, b2); diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index 885f81011..b416221fb 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -66,7 +66,7 @@ extern int force_debug; /* (O) force debug output */ extern int video_fps; /* (O) render speed in fps */ #endif extern int settings_only; /* (O) show only the settings dialog */ -extern int no_quit_confirm; /* (O) do not ask for confirmation on quit */ +extern int confirm_exit_cmdl; /* (O) do not ask for confirmation on quit if set to 0 */ #ifdef _WIN32 extern uint64_t unique_id; extern uint64_t source_hwnd; @@ -109,6 +109,8 @@ extern int network_type; /* (C) net provider type */ extern int network_card; /* (C) net interface num */ extern char network_host[522]; /* (C) host network intf */ extern int hdd_format_type; /* (C) hard disk file format */ +extern int confirm_reset, /* (C) enable reset confirmation */ + confirm_exit; /* (C) enable exit confirmation */ #ifdef USE_DISCORD extern int enable_discord; /* (C) enable Discord integration */ #endif diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index ec839cfde..c46962e73 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -303,7 +303,7 @@ const machine_t machines[] = { { "[i430VX] Shuttle HOT-557", "430vx", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_i430vx_init, NULL }, { "[i430VX] Epox P55-VA", "p55va", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_p55va_init, NULL }, { "[i430VX] HP Brio 80xx", "brio80xx", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_brio80xx_init, NULL }, - { "[i430VX] Biostar MB-8500TVX-A", "8500tvxa", MACHINE_TYPE_SOCKET7, {{ "Intel", cpus_Pentium}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_8500tvxa_init, NULL }, + { "[i430VX] Biostar MB-8500TVX-A", "8500tvxa", MACHINE_TYPE_SOCKET7, {{"Intel", cpus_Pentium}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_8500tvxa_init, NULL }, { "[i430VX] Packard Bell PB680", "pb680", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_pb680_init, NULL }, /* 430TX */ @@ -353,8 +353,8 @@ const machine_t machines[] = { { "[i440BX] ABIT BF6", "bf6", MACHINE_TYPE_SLOT1, {{"Intel", cpus_PentiumII}, {"Intel/PGA370", cpus_Celeron},{"VIA", cpus_Cyrix3},{"", NULL},{"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 768, 8, 255, machine_at_bf6_init, NULL }, { "[i440BX] AOpen AX6BC", "ax6bc", MACHINE_TYPE_SLOT1, {{"Intel", cpus_PentiumII}, {"Intel/PGA370", cpus_Celeron},{"VIA", cpus_Cyrix3},{"", NULL},{"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 768, 8, 255, machine_at_ax6bc_init, NULL }, { "[i440BX] A-Trend ATC6310BXII", "atc6310bxii", MACHINE_TYPE_SLOT1, {{"Intel", cpus_PentiumII}, {"Intel/PGA370", cpus_Celeron},{"VIA", cpus_Cyrix3},{"", NULL},{"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 768, 8, 255, machine_at_atc6310bxii_init, NULL }, - { "[i440BX] Tyan Tsunami ATX", "tsunamiatx", MACHINE_TYPE_SLOT1, {{"Intel", cpus_PentiumII}, {"Intel/PGA370", cpus_Celeron},{"", NULL}, {"", NULL},{"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC | MACHINE_SOUND, 8, 1024, 8, 255, machine_at_tsunamiatx_init, at_tsunamiatx_get_device }, - { "[i440BX] SuperMicro Super P6SBA", "p6sba", MACHINE_TYPE_SLOT1, {{"Intel", cpus_PentiumII}, {"Intel/PGA370", cpus_Celeron},{"", NULL}, {"", NULL},{"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 768, 8, 255, machine_at_p6sba_init, NULL }, + { "[i440BX] Tyan Tsunami ATX", "tsunamiatx", MACHINE_TYPE_SLOT1, {{"Intel", cpus_PentiumII}, {"Intel/PGA370", cpus_Celeron},{"VIA", cpus_Cyrix3},{"", NULL},{"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC | MACHINE_SOUND, 8, 1024, 8, 255, machine_at_tsunamiatx_init, at_tsunamiatx_get_device }, + { "[i440BX] SuperMicro Super P6SBA", "p6sba", MACHINE_TYPE_SLOT1, {{"Intel", cpus_PentiumII}, {"Intel/PGA370", cpus_Celeron},{"VIA", cpus_Cyrix3},{"", NULL},{"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 768, 8, 255, machine_at_p6sba_init, NULL }, #if defined(DEV_BRANCH) && defined(USE_VIRTUALPC) { "[i440BX] Microsoft Virtual PC 2007", "vpc2007", MACHINE_TYPE_SLOT1, {{"Intel", cpus_PentiumIID}, {"Intel/PGA370", cpus_Celeron},{"", NULL}, {"", NULL},{"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 1024, 8, 255, machine_at_vpc2007_init, NULL }, #endif @@ -366,7 +366,7 @@ const machine_t machines[] = { /* PGA370 machines */ /* 440LX */ - { "[i440LX] SuperMicro Super 370SLM", "s370slm", MACHINE_TYPE_SOCKET370, {{"Intel", cpus_Celeron}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 768, 8, 255, machine_at_s370slm_init, NULL }, + { "[i440LX] SuperMicro Super 370SLM", "s370slm", MACHINE_TYPE_SOCKET370, {{"Intel", cpus_Celeron}, {"VIA", cpus_Cyrix3}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 768, 8, 255, machine_at_s370slm_init, NULL }, /* 440BX */ { "[i440BX] ASUS CUBX", "cubx", MACHINE_TYPE_SOCKET370, {{"Intel", cpus_Celeron}, {"VIA", cpus_Cyrix3}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 1024, 8, 255, machine_at_cubx_init, NULL }, diff --git a/src/pc.c b/src/pc.c index 2650e8e9f..488085301 100644 --- a/src/pc.c +++ b/src/pc.c @@ -101,7 +101,7 @@ int force_debug = 0; /* (O) force debug output */ int video_fps = RENDER_FPS; /* (O) render speed in fps */ #endif int settings_only = 0; /* (O) show only the settings dialog */ -int no_quit_confirm = 0; /* (O) do not ask for confirmation on quit */ +int confirm_exit_cmdl = 1; /* (O) do not ask for confirmation on quit if set to 0 */ #ifdef _WIN32 uint64_t unique_id = 0; uint64_t source_hwnd = 0; @@ -140,6 +140,8 @@ int cpu_manufacturer = 0, /* (C) cpu manufacturer */ cpu = 3, /* (C) cpu type */ fpu_type = 0; /* (C) fpu type */ int time_sync = 0; /* (C) enable time sync */ +int confirm_reset = 1, /* (C) enable reset confirmation */ + confirm_exit = 1; /* (C) enable exit confirmation */ #ifdef USE_DISCORD int enable_discord = 0; /* (C) enable Discord integration */ #endif @@ -396,7 +398,7 @@ usage: settings_only = 1; } else if (!wcscasecmp(argv[c], L"--noconfirm") || !wcscasecmp(argv[c], L"-N")) { - no_quit_confirm = 1; + confirm_exit_cmdl = 0; } else if (!wcscasecmp(argv[c], L"--crashdump") || !wcscasecmp(argv[c], L"-R")) { enable_crashdump = 1; diff --git a/src/sound/snd_opl.c b/src/sound/snd_opl.c index 488acdc35..bab1a8c3f 100644 --- a/src/sound/snd_opl.c +++ b/src/sound/snd_opl.c @@ -175,8 +175,6 @@ opl_write(opl_t *dev, uint16_t port, uint8_t val) if (!(dev->flags & FLAG_OPL3)) dev->port &= 0x00ff; - - return; } } diff --git a/src/sound/sound.c b/src/sound/sound.c index f6ade1f98..479314699 100644 --- a/src/sound/sound.c +++ b/src/sound/sound.c @@ -128,9 +128,6 @@ sound_log(const char *fmt, ...) int sound_card_available(int card) { - if ((card == SOUND_INTERNAL) && !(machines[machine].flags & MACHINE_SOUND)) - return 0; - if (sound_cards[card].device) return device_available(sound_cards[card].device); diff --git a/src/timer.c b/src/timer.c index 85264a62a..0920076d3 100644 --- a/src/timer.c +++ b/src/timer.c @@ -233,6 +233,8 @@ timer_advance_ex(pc_timer_t *timer, int start) } else { if (timer->period > 0.0) timer_do_period(timer, (uint64_t) (timer->period * ((double) TIMER_USEC)), start); + else + timer_disable(timer); timer->period = 0.0; timer->flags &= ~TIMER_SPLIT; } @@ -256,5 +258,8 @@ timer_on_auto(pc_timer_t *timer, double period) if (!timer_inited || (timer == NULL)) return; - timer_on(timer, period, (timer->period == 0.0)); + if (period > 0.0) + timer_on(timer, period, (timer->period == 0.0)); + else + timer_stop(timer); } diff --git a/src/win/win.c b/src/win/win.c index 6a2d685ea..9fe724dcd 100644 --- a/src/win/win.c +++ b/src/win/win.c @@ -790,8 +790,10 @@ plat_setfullscreen(int on) if (on && video_fullscreen) return; if (on && video_fullscreen_first) { - if (ui_msgbox_header(MBX_INFO | MBX_DONTASK, (wchar_t *) IDS_2134, (wchar_t *) IDS_2052) == 10) + if (ui_msgbox_header(MBX_INFO | MBX_DONTASK, (wchar_t *) IDS_2134, (wchar_t *) IDS_2052) == 10) { video_fullscreen_first = 0; + config_save(); + } } /* OK, claim the video. */ diff --git a/src/win/win_dialog.c b/src/win/win_dialog.c index bc8964f95..563920cc3 100644 --- a/src/win/win_dialog.c +++ b/src/win/win_dialog.c @@ -144,6 +144,7 @@ ui_msgbox_ex(int flags, void *header, void *message, void *btn1, void *btn2, voi else if (ret == IDCANCEL) ret = -1; else ret = 0; + /* 10 is added to the return value if "don't show again" is checked. */ if (checked) ret += 10; return(ret); diff --git a/src/win/win_settings.c b/src/win/win_settings.c index 32ebc3aee..961f2b255 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -1280,6 +1280,12 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) h = GetDlgItem(hdlg, IDC_COMBO_SOUND); c = d = 0; while (1) { + /* Skip "internal" if machine doesn't have it. */ + if ((c == 1) && !(machines[temp_machine].flags & MACHINE_SOUND)) { + c++; + continue; + } + s = sound_card_getname(c); if (!s[0]) diff --git a/src/win/win_ui.c b/src/win/win_ui.c index ff5f01875..edcf91385 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -315,9 +315,17 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case IDM_ACTION_HRESET: win_notify_dlg_open(); - i = ui_msgbox_ex(MBX_QUESTION_YN, (wchar_t *) IDS_2112, NULL, (wchar_t *) IDS_2137, (wchar_t *) IDS_2138, NULL); - if (i == 0) + if (confirm_reset) + i = ui_msgbox_ex(MBX_QUESTION_YN | MBX_DONTASK, (wchar_t *) IDS_2112, NULL, (wchar_t *) IDS_2137, (wchar_t *) IDS_2138, NULL); + else + i = 0; + if ((i % 10) == 0) { pc_reset_hard(); + if (i == 10) { + confirm_reset = 0; + config_save(); + } + } win_notify_dlg_closed(); break; @@ -327,11 +335,15 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case IDM_ACTION_EXIT: win_notify_dlg_open(); - if (no_quit_confirm) - i = 0; + if (confirm_exit && confirm_exit_cmdl) + i = ui_msgbox_ex(MBX_QUESTION_YN | MBX_DONTASK, (wchar_t *) IDS_2113, NULL, (wchar_t *) IDS_2119, (wchar_t *) IDS_2136, NULL); else - i = ui_msgbox_ex(MBX_QUESTION_YN, (wchar_t *) IDS_2113, NULL, (wchar_t *) IDS_2119, (wchar_t *) IDS_2136, NULL); - if (i == 0) { + i = 0; + if ((i % 10) == 0) { + if (i == 10) { + confirm_exit = 0; + config_save(); + } #ifndef NO_KEYBOARD_HOOK UnhookWindowsHookEx(hKeyboardHook); #endif @@ -701,11 +713,15 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_CLOSE: win_notify_dlg_open(); - if (no_quit_confirm) - i = 0; + if (confirm_exit && confirm_exit_cmdl) + i = ui_msgbox_ex(MBX_QUESTION_YN | MBX_DONTASK, (wchar_t *) IDS_2113, NULL, (wchar_t *) IDS_2119, (wchar_t *) IDS_2136, NULL); else - i = ui_msgbox_ex(MBX_QUESTION_YN, (wchar_t *) IDS_2113, NULL, (wchar_t *) IDS_2119, (wchar_t *) IDS_2136, NULL); - if (i == 0) { + i = 0; + if ((i % 10) == 0) { + if (i == 10) { + confirm_exit = 0; + config_save(); + } #ifndef NO_KEYBOARD_HOOK UnhookWindowsHookEx(hKeyboardHook); #endif @@ -744,9 +760,17 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if (manager_wm) break; win_notify_dlg_open(); - i = ui_msgbox_ex(MBX_QUESTION_YN, (wchar_t *) IDS_2112, NULL, (wchar_t *) IDS_2137, (wchar_t *) IDS_2138, NULL); - if (i == 0) + if (confirm_reset) + i = ui_msgbox_ex(MBX_QUESTION_YN | MBX_DONTASK, (wchar_t *) IDS_2112, NULL, (wchar_t *) IDS_2137, (wchar_t *) IDS_2138, NULL); + else + i = 0; + if ((i % 10) == 0) { pc_reset_hard(); + if (i == 10) { + confirm_reset = 0; + config_save(); + } + } win_notify_dlg_closed(); break; @@ -754,11 +778,15 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if (manager_wm) break; win_notify_dlg_open(); - if (no_quit_confirm) - i = 0; + if (confirm_exit && confirm_exit_cmdl) + i = ui_msgbox_ex(MBX_QUESTION_YN | MBX_DONTASK, (wchar_t *) IDS_2113, NULL, (wchar_t *) IDS_2119, (wchar_t *) IDS_2136, NULL); else - i = ui_msgbox_ex(MBX_QUESTION_YN, (wchar_t *) IDS_2113, NULL, (wchar_t *) IDS_2119, (wchar_t *) IDS_2136, NULL); - if (i == 0) { + i = 0; + if ((i % 10) == 0) { + if (i == 10) { + confirm_exit = 0; + config_save(); + } #ifndef NO_KEYBOARD_HOOK UnhookWindowsHookEx(hKeyboardHook); #endif