Windows SDL 1.x: Add "restart DOS" menu command

This commit is contained in:
Jonathan Campbell
2018-02-26 19:58:51 -08:00
parent 1271f979e1
commit 77d824c576
4 changed files with 47 additions and 0 deletions

View File

@@ -714,6 +714,7 @@
#define ID_RESET_RESCALE 821 #define ID_RESET_RESCALE 821
#define ID_RESET 822 #define ID_RESET 822
#define ID_MTWAVE 823 #define ID_MTWAVE 823
#define ID_RESTART_DOS 824
#if defined(WIN32) #if defined(WIN32)
# define ID_WIN_SYSMENU_RESTOREMENU 0x0F00 # define ID_WIN_SYSMENU_RESTOREMENU 0x0F00

View File

@@ -943,6 +943,7 @@ int Reflect_Menu(void) {
name[0] = 0; name[0] = 0;
} }
EnableMenuItem(m_handle, ID_RESTART_DOS, dos_kernel_disabled ? MF_DISABLED : MF_ENABLED);
EnableMenuItem(m_handle, ID_CPU_ADVANCED, GFX_GetPreventFullscreen() ? MF_DISABLED : MF_ENABLED); EnableMenuItem(m_handle, ID_CPU_ADVANCED, GFX_GetPreventFullscreen() ? MF_DISABLED : MF_ENABLED);
EnableMenuItem(m_handle, ID_DOS_ADVANCED, GFX_GetPreventFullscreen() ? MF_DISABLED : MF_ENABLED); EnableMenuItem(m_handle, ID_DOS_ADVANCED, GFX_GetPreventFullscreen() ? MF_DISABLED : MF_ENABLED);
EnableMenuItem(m_handle, ID_MIDI_ADVANCED, GFX_GetPreventFullscreen() ? MF_DISABLED : MF_ENABLED); EnableMenuItem(m_handle, ID_MIDI_ADVANCED, GFX_GetPreventFullscreen() ? MF_DISABLED : MF_ENABLED);
@@ -1948,6 +1949,9 @@ void MSG_WM_COMMAND_handle(SDL_SysWMmsg &Message) {
case ID_WAVE: void CAPTURE_WaveEvent(bool pressed); CAPTURE_WaveEvent(true); break; case ID_WAVE: void CAPTURE_WaveEvent(bool pressed); CAPTURE_WaveEvent(true); break;
case ID_OPL: void OPL_SaveRawEvent(bool pressed); OPL_SaveRawEvent(true); break; case ID_OPL: void OPL_SaveRawEvent(bool pressed); OPL_SaveRawEvent(true); break;
case ID_MIDI: void CAPTURE_MidiEvent(bool pressed); CAPTURE_MidiEvent(true); break; case ID_MIDI: void CAPTURE_MidiEvent(bool pressed); CAPTURE_MidiEvent(true); break;
case ID_RESTART_DOS:
throw int(6);
break;
case ID_XMS: mem_conf("xms", 0); break; case ID_XMS: mem_conf("xms", 0); break;
case ID_EMS_TRUE: mem_conf("ems", 1); break; case ID_EMS_TRUE: mem_conf("ems", 1); break;
case ID_EMS_FALSE: mem_conf("ems", 2); break; case ID_EMS_FALSE: mem_conf("ems", 2); break;

View File

@@ -4983,6 +4983,11 @@ bool VM_Boot_DOSBox_Kernel() {
DispatchVMEvent(VM_EVENT_DOS_SURPRISE_REBOOT); // <- apparently we rebooted without any notification (such as jmp'ing to FFFF:0000) DispatchVMEvent(VM_EVENT_DOS_SURPRISE_REBOOT); // <- apparently we rebooted without any notification (such as jmp'ing to FFFF:0000)
dos_kernel_disabled = true; dos_kernel_disabled = true;
#if defined(WIN32) && !defined(C_SDL2)
int Reflect_Menu(void);
Reflect_Menu();
#endif
} }
if (dos_kernel_disabled) { if (dos_kernel_disabled) {
@@ -4993,6 +4998,11 @@ bool VM_Boot_DOSBox_Kernel() {
void DOS_Startup(Section* sec); void DOS_Startup(Section* sec);
DOS_Startup(NULL); DOS_Startup(NULL);
#if defined(WIN32) && !defined(C_SDL2)
int Reflect_Menu(void);
Reflect_Menu();
#endif
void update_pc98_function_row(bool enable); void update_pc98_function_row(bool enable);
void DRIVES_Startup(Section *s); void DRIVES_Startup(Section *s);
@@ -5496,6 +5506,11 @@ fresh_boot:
reboot_machine = false; reboot_machine = false;
dos_kernel_shutdown = false; dos_kernel_shutdown = false;
#if defined(WIN32) && !defined(C_SDL2)
int Reflect_Menu(void);
Reflect_Menu();
#endif
/* NTS: CPU reset handler, and BIOS init, has the instruction pointer poised to run through BIOS initialization, /* NTS: CPU reset handler, and BIOS init, has the instruction pointer poised to run through BIOS initialization,
* which will then "boot" into the DOSBox kernel, and then the shell, by calling VM_Boot_DOSBox_Kernel() */ * which will then "boot" into the DOSBox kernel, and then the shell, by calling VM_Boot_DOSBox_Kernel() */
/* FIXME: throwing int() is a stupid and nondescriptive way to signal shutdown/reset. */ /* FIXME: throwing int() is a stupid and nondescriptive way to signal shutdown/reset. */
@@ -5538,6 +5553,11 @@ fresh_boot:
throw; throw;
} }
#if defined(WIN32) && !defined(C_SDL2)
int Reflect_Menu(void);
Reflect_Menu();
#endif
if (dos_kernel_shutdown) { if (dos_kernel_shutdown) {
/* NTS: we take different paths depending on whether we're just shutting down DOS /* NTS: we take different paths depending on whether we're just shutting down DOS
* or doing a hard reboot. */ * or doing a hard reboot. */
@@ -5598,8 +5618,18 @@ fresh_boot:
DispatchVMEvent(VM_EVENT_DOS_EXIT_REBOOT_KERNEL); DispatchVMEvent(VM_EVENT_DOS_EXIT_REBOOT_KERNEL);
else else
DispatchVMEvent(VM_EVENT_DOS_EXIT_KERNEL); DispatchVMEvent(VM_EVENT_DOS_EXIT_KERNEL);
#if defined(WIN32) && !defined(C_SDL2)
int Reflect_Menu(void);
Reflect_Menu();
#endif
} }
#if defined(WIN32) && !defined(C_SDL2)
int Reflect_Menu(void);
Reflect_Menu();
#endif
if (run_machine) { if (run_machine) {
bool disable_a20 = static_cast<Section_prop *>(control->GetSection("dosbox"))->Get_bool("turn off a20 gate on boot"); bool disable_a20 = static_cast<Section_prop *>(control->GetSection("dosbox"))->Get_bool("turn off a20 gate on boot");
@@ -5619,6 +5649,11 @@ fresh_boot:
goto fresh_boot; goto fresh_boot;
} }
#if defined(WIN32) && !defined(C_SDL2)
int Reflect_Menu(void);
Reflect_Menu();
#endif
if (reboot_machine) { if (reboot_machine) {
LOG_MSG("Rebooting the system\n"); LOG_MSG("Rebooting the system\n");
@@ -5652,6 +5687,11 @@ fresh_boot:
goto fresh_boot; goto fresh_boot;
} }
#if defined(WIN32) && !defined(C_SDL2)
int Reflect_Menu(void);
Reflect_Menu();
#endif
/* and then shutdown */ /* and then shutdown */
GFX_ShutDown(); GFX_ShutDown();

View File

@@ -741,6 +741,8 @@ BEGIN
END END
END END
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Restart DOS" ID_RESTART_DOS
MENUITEM SEPARATOR
MENUITEM "Edit AUTOEXEC.BAT", ID_AUTOEXEC MENUITEM "Edit AUTOEXEC.BAT", ID_AUTOEXEC
MENUITEM "Advanced", ID_DOS_ADVANCED MENUITEM "Advanced", ID_DOS_ADVANCED
END END