add optional close warning and file associations for Windows installer

This commit is contained in:
Wengier 2020-08-16 20:42:01 -04:00
parent a41a6c5491
commit a66edff7fe
9 changed files with 225 additions and 108 deletions

View File

@ -15,6 +15,11 @@ set mgbinpath=%rootdir%\..
cls
if not exist %rootdir%\dosbox-x.reference.conf (
echo Couldn't find %rootdir%\dosbox-x.reference.conf
goto error
)
if not exist %isspath%\date.exe (
echo Couldn't find %isspath%\date.exe
goto error
@ -83,30 +88,30 @@ if exist %isspath%\Win64_builds\nul rd %isspath%\Win64_builds /s /q
%isspath%\7za.exe e -y -o%isspath%\Win64_builds\mingw-lowend %m64zip% "mingw-build\mingw-lowend\dosbox-x.exe"
%isspath%\7za.exe e -y -o%isspath%\Win64_builds\mingw-sdl2 %m64zip% "mingw-build\mingw-sdl2\dosbox-x.exe"
%isspath%\7za.exe e -y -o%isspath%\Win64_builds\mingw-sdldraw %m64zip% "mingw-build\mingw-sdldraw\dosbox-x.exe"
if exist %rootdir%\dosbox-x.reference.conf (
copy /y %rootdir%\dosbox-x.reference.conf %isspath%\Win32_builds\x86_Release
copy /y %rootdir%\dosbox-x.reference.conf %isspath%\Win32_builds\x86_Release_SDL2
copy /y %rootdir%\dosbox-x.reference.conf %isspath%\Win32_builds\ARM_Release
copy /y %rootdir%\dosbox-x.reference.conf %isspath%\Win32_builds\ARM_Release_SDL2
copy /y %rootdir%\dosbox-x.reference.conf %isspath%\Win64_builds\x64_Release
copy /y %rootdir%\dosbox-x.reference.conf %isspath%\Win64_builds\x64_Release_SDL2
copy /y %rootdir%\dosbox-x.reference.conf %isspath%\Win64_builds\ARM64_Release
copy /y %rootdir%\dosbox-x.reference.conf %isspath%\Win64_builds\ARM64_Release_SDL2
copy /y %rootdir%\dosbox-x.reference.conf %isspath%\Win32_builds\mingw
copy /y %rootdir%\dosbox-x.reference.conf %isspath%\Win32_builds\mingw-lowend
copy /y %rootdir%\dosbox-x.reference.conf %isspath%\Win32_builds\mingw-sdl2
copy /y %rootdir%\dosbox-x.reference.conf %isspath%\Win32_builds\mingw-sdldraw
copy /y %rootdir%\dosbox-x.reference.conf %isspath%\Win64_builds\mingw
copy /y %rootdir%\dosbox-x.reference.conf %isspath%\Win64_builds\mingw-lowend
copy /y %rootdir%\dosbox-x.reference.conf %isspath%\Win64_builds\mingw-sdl2
copy /y %rootdir%\dosbox-x.reference.conf %isspath%\Win64_builds\mingw-sdldraw
)
copy /y %rootdir%\dosbox-x.reference.conf %isspath%\dosbox-x.reference.conf >nul
if exist %isspath%\unix2dos.exe %isspath%\unix2dos.exe -n %rootdir%\dosbox-x.reference.conf %isspath%\dosbox-x.reference.conf
copy /y %isspath%\dosbox-x.reference.conf %isspath%\Win32_builds\x86_Release
copy /y %isspath%\dosbox-x.reference.conf %isspath%\Win32_builds\x86_Release_SDL2
copy /y %isspath%\dosbox-x.reference.conf %isspath%\Win32_builds\ARM_Release
copy /y %isspath%\dosbox-x.reference.conf %isspath%\Win32_builds\ARM_Release_SDL2
copy /y %isspath%\dosbox-x.reference.conf %isspath%\Win64_builds\x64_Release
copy /y %isspath%\dosbox-x.reference.conf %isspath%\Win64_builds\x64_Release_SDL2
copy /y %isspath%\dosbox-x.reference.conf %isspath%\Win64_builds\ARM64_Release
copy /y %isspath%\dosbox-x.reference.conf %isspath%\Win64_builds\ARM64_Release_SDL2
copy /y %isspath%\dosbox-x.reference.conf %isspath%\Win32_builds\mingw
copy /y %isspath%\dosbox-x.reference.conf %isspath%\Win32_builds\mingw-lowend
copy /y %isspath%\dosbox-x.reference.conf %isspath%\Win32_builds\mingw-sdl2
copy /y %isspath%\dosbox-x.reference.conf %isspath%\Win32_builds\mingw-sdldraw
copy /y %isspath%\dosbox-x.reference.conf %isspath%\Win64_builds\mingw
copy /y %isspath%\dosbox-x.reference.conf %isspath%\Win64_builds\mingw-lowend
copy /y %isspath%\dosbox-x.reference.conf %isspath%\Win64_builds\mingw-sdl2
copy /y %isspath%\dosbox-x.reference.conf %isspath%\Win64_builds\mingw-sdldraw
echo.
echo ***************************************
echo * Building DOSBox-X installers ... *
echo ***************************************
del %isspath%\DOSBox-X-setup*.exe
if exist %isspath%\DOSBox-X-setup*.exe del %isspath%\DOSBox-X-setup*.exe
%isspath%\ISCC.exe %isspath%\DOSBox-X-setup.iss
if exist %isspath%\DOSBox-X-setup.exe (
echo Copying to %vsbinpath%\DOSBox-X-setup-%datestr%.exe ..

View File

@ -1372,6 +1372,11 @@ void DOSBOX_SetupConfigSections(void) {
"If it is not set, Windows Vista/7/8/10 and higher may upscale the DOSBox-X window\n"
"on higher resolution monitors which is probably not what you want.");
Pstring = secprop->Add_string("quit warning",Property::Changeable::OnlyAtStart,"auto");
Pstring->Set_values(truefalseautoopt);
Pstring->Set_help("Set this option to indicate whether DOSBox-X should show a warning message when quitting.\n"
"If set to auto (default), DOSBox-X will warn only if at least one file is still open.");
Pbool = secprop->Add_bool("keyboard hook", Property::Changeable::Always, false);
Pbool->Set_help("Use keyboard hook (currently only on Windows) to catch special keys and synchronize the keyboard LEDs with the host");

View File

@ -69,7 +69,7 @@ extern uint32_t GFX_Bmask;
extern unsigned char GFX_Bshift;
extern std::string saveloaderr;
extern bool dos_kernel_disabled, confres;
extern bool dos_kernel_disabled, confres, quit_confirm;
extern Bitu currentWindowWidth, currentWindowHeight;
extern bool MSG_Write(const char *);
@ -1471,6 +1471,31 @@ public:
}
};
class ShowQuitWarning : public GUI::ToplevelWindow {
protected:
GUI::Input *name;
public:
ShowQuitWarning(GUI::Screen *parent, int x, int y, const char *title) :
ToplevelWindow(parent, x, y, strcmp(title, "quit1")?430:330, strcmp(title, "quit1")?180:150, "Quit DOSBox-X warning") {
bool forcequit=strcmp(title, "quit1");
new GUI::Label(this, forcequit?20:40, 20, forcequit?"It may be unsafe to quit from DOSBox-X right now":"This will quit from DOSBox-X.");
if (forcequit) new GUI::Label(this, forcequit?20:40, 50, "because one or more files are currently open.");
new GUI::Label(this, forcequit?20:40, forcequit?80:50, forcequit?"Are you sure to quit anyway now?":"Are you sure?");
(new GUI::Button(this, forcequit?140:90, forcequit?110:80, "Yes", 70))->addActionHandler(this);
(new GUI::Button(this, forcequit?230:180, forcequit?110:80, "No", 70))->addActionHandler(this);
}
void actionExecuted(GUI::ActionEventSource *b, const GUI::String &arg) {
(void)b;//UNUSED
if (arg == "Yes")
quit_confirm=true;
if (arg == "No")
quit_confirm=false;
close();
if (shortcut) running = false;
}
};
class ConfigurationWindow : public GUI::ToplevelWindow {
public:
GUI::Button *saveButton, *closeButton;
@ -1812,6 +1837,14 @@ static void UI_Select(GUI::ScreenSDL *screen, int select) {
auto *np7 = new ShowLoadWarning(screen, 150, 120, "Are you sure to remove the state in this slot?");
np7->raise();
} break;
case 28: {
auto *np8 = new ShowQuitWarning(screen, 150, 120, "quit1");
np8->raise();
} break;
case 29: {
auto *np8 = new ShowQuitWarning(screen, 120, 100, "quit2");
np8->raise();
} break;
default:
break;
}

View File

@ -1078,12 +1078,42 @@ void GFX_SetTitle(Bit32s cycles,Bits frameskip,Bits timing,bool paused){
#endif
}
bool warn_on_mem_write = false;
bool warn_on_mem_write = false, quit_confirm = false;
void CPU_Snap_Back_To_Real_Mode();
void CPU_Snap_Back_To_Real_Mode(), MAPPER_ReleaseAllKeys();
bool CheckQuit(void) {
Section_prop *section = static_cast<Section_prop *>(control->GetSection("dosbox"));
std::string warn = section->Get_string("quit warning");
if (warn == "true") {
quit_confirm=false;
MAPPER_ReleaseAllKeys();
GFX_LosingFocus();
GUI_Shortcut(28);
MAPPER_ReleaseAllKeys();
GFX_LosingFocus();
bool ret=quit_confirm;
quit_confirm=false;
return ret;
} else if (warn == "false" || dos_kernel_disabled)
return true;
for (Bit8u handle = 0; handle < DOS_FILES; handle++)
if (Files[handle] && (Files[handle]->GetInformation()&0x8000) == 0) {
quit_confirm=false;
MAPPER_ReleaseAllKeys();
GFX_LosingFocus();
GUI_Shortcut(29);
MAPPER_ReleaseAllKeys();
GFX_LosingFocus();
bool ret=quit_confirm;
quit_confirm=false;
return ret;
}
return true;
}
static void KillSwitch(bool pressed) {
if (!pressed) return;
if (!CheckQuit()) return;
if (sdl.desktop.fullscreen) GFX_SwitchFullScreen();
#if 0 /* Re-enable this hack IF DOSBox-X continues to have problems page-faulting on kill switch */
CPU_Snap_Back_To_Real_Mode(); /* TEMPORARY HACK. There are portions of DOSBox that write to memory as if still running DOS. */
@ -1219,7 +1249,6 @@ void PauseDOSBoxLoop(Bitu /*unused*/) {
/* reflect in the menu that we're paused now */
mainMenu.get_item("mapper_pause").check(true).refresh_item(mainMenu);
void MAPPER_ReleaseAllKeys(void);
MAPPER_ReleaseAllKeys();
GFX_SetTitle(-1,-1,-1,true);
@ -1329,7 +1358,6 @@ void PauseDOSBoxLoop(Bitu /*unused*/) {
void GFX_UpdateSDLCaptureState();
GFX_UpdateSDLCaptureState();
void MAPPER_ReleaseAllKeys(void);
MAPPER_ReleaseAllKeys();
// KEYBOARD_ClrBuffer();
@ -4529,7 +4557,7 @@ static void HandleMouseButton(SDL_MouseButtonEvent * button, SDL_MouseMotionEven
switch (event.type) {
case SDL_QUIT:
throw(0);
if (CheckQuit()) throw(0);
break;
case SDL_KEYUP:
if (event.key.keysym.sym == SDLK_ESCAPE) {
@ -5330,7 +5358,7 @@ void GFX_Events() {
switch (ev.type) {
case SDL_QUIT:
throw(0);
if (CheckQuit()) throw(0);
break; // a bit redundant at linux at least as the active events gets before the quit event.
case SDL_WINDOWEVENT: // wait until we get window focus back
if ((ev.window.event == SDL_WINDOWEVENT_FOCUS_LOST) || (ev.window.event == SDL_WINDOWEVENT_MINIMIZED) || (ev.window.event == SDL_WINDOWEVENT_FOCUS_GAINED) || (ev.window.event == SDL_WINDOWEVENT_RESTORED) || (ev.window.event == SDL_WINDOWEVENT_EXPOSED)) {
@ -5388,7 +5416,7 @@ void GFX_Events() {
break;
#endif
case SDL_QUIT:
throw(0);
if (CheckQuit()) throw(0);
break;
case SDL_MOUSEWHEEL:
if (wheel_key) {
@ -5643,7 +5671,7 @@ void GFX_Events() {
#endif
switch (ev.type) {
case SDL_QUIT: throw(0); break; // a bit redundant at linux at least as the active events gets before the quit event.
case SDL_QUIT: if (CheckQuit()) throw(0); break; // a bit redundant at linux at least as the active events gets before the quit event.
case SDL_ACTIVEEVENT: // wait until we get window focus back
if (ev.active.state & (SDL_APPINPUTFOCUS | SDL_APPACTIVE)) {
// We've got focus back, so unpause and break out of the loop
@ -5677,7 +5705,7 @@ void GFX_Events() {
HandleVideoResize(&event.resize);
break;
case SDL_QUIT:
throw(0);
if (CheckQuit()) throw(0);
break;
case SDL_VIDEOEXPOSE:
if (sdl.draw.callback && !glide.enabled) sdl.draw.callback( GFX_CallBackRedraw );
@ -6605,6 +6633,7 @@ bool DOSBOX_parse_argv() {
fprintf(stderr," -showrt Show emulation speed relative to realtime\n");
fprintf(stderr," -fullscreen Start in fullscreen\n");
fprintf(stderr," -savedir <path> Set save path\n");
fprintf(stderr," -defaultdir <path> Set the default working path\n");
#if defined(WIN32)
fprintf(stderr," -disable-numlock-check Disable NumLock check (Windows version only)\n");
#endif
@ -6727,6 +6756,12 @@ bool DOSBOX_parse_argv() {
else if (optname == "savedir") {
if (!control->cmdline->NextOptArgv(custom_savedir)) return false;
}
else if (optname == "defaultdir") {
if (control->cmdline->NextOptArgv(tmp)) {
struct stat st;
if (stat(tmp.c_str(), &st) == 0 && st.st_mode & S_IFDIR) chdir(tmp.c_str());
}
}
else if (optname == "userconf") {
control->opt_userconf = true;
}
@ -7140,14 +7175,12 @@ bool mixer_mute_menu_callback(DOSBoxMenu * const menu,DOSBoxMenu::item * const m
bool mixer_info_menu_callback(DOSBoxMenu * const menu,DOSBoxMenu::item * const menuitem) {
(void)menu;//UNUSED
(void)menuitem;//UNUSED
void MAPPER_ReleaseAllKeys(void);
MAPPER_ReleaseAllKeys();
GFX_LosingFocus();
GUI_Shortcut(20);
void MAPPER_ReleaseAllKeys(void);
MAPPER_ReleaseAllKeys();
GFX_LosingFocus();
@ -7210,14 +7243,12 @@ bool dos_ver_set_menu_callback(DOSBoxMenu * const menu,DOSBoxMenu::item * const
bool dos_ver_edit_menu_callback(DOSBoxMenu * const menu,DOSBoxMenu::item * const menuitem) {
(void)menu;//UNUSED
(void)menuitem;//UNUSED
void MAPPER_ReleaseAllKeys(void);
MAPPER_ReleaseAllKeys();
GFX_LosingFocus();
GUI_Shortcut(19);
void MAPPER_ReleaseAllKeys(void);
MAPPER_ReleaseAllKeys();
GFX_LosingFocus();
@ -8096,14 +8127,12 @@ bool sendkey_preset_menu_callback(DOSBoxMenu * const menu, DOSBoxMenu::item * co
}
void SetCyclesCount_mapper_shortcut_RunInternal(void) {
void MAPPER_ReleaseAllKeys(void);
MAPPER_ReleaseAllKeys();
GFX_LosingFocus();
GUI_Shortcut(16);
void MAPPER_ReleaseAllKeys(void);
MAPPER_ReleaseAllKeys();
GFX_LosingFocus();
@ -9746,7 +9775,6 @@ fresh_boot:
DispatchVMEvent(VM_EVENT_RESET);
/* force the mapper to let go of all keys so that the host key is not stuck (Issue #1320) */
void MAPPER_ReleaseAllKeys(void);
MAPPER_ReleaseAllKeys();
void MAPPER_LosingFocus(void);
MAPPER_LosingFocus();

View File

@ -44,6 +44,7 @@ extern bool enable_config_as_shell_commands;
extern bool dos_shell_running_program, addovl;
extern const char* RunningProgram;
extern Bit16u countryNo;
extern int enablelfn;
bool usecon = true;
Bit16u shell_psp = 0;
@ -650,6 +651,7 @@ void DOS_Shell::SyntaxError(void) {
WriteOut(MSG_Get("SHELL_SYNTAXERROR"));
}
bool filename_not_8x3(const char *n);
class AUTOEXEC:public Module_base {
private:
AutoexecObject autoexec[17];
@ -665,7 +667,7 @@ public:
/* The user may have given .BAT files to run on the command line */
if (!control->auto_bat_additional.empty()) {
std::string cmd;
std::string cmd = "@echo off\n";
for (unsigned int i=0;i<control->auto_bat_additional.size();i++) {
if (!strncmp(control->auto_bat_additional[i].c_str(), "@mount c: ", 10)) {
@ -688,12 +690,15 @@ public:
batname = control->auto_bat_additional[i].substr(pos+1);
cmd += "@mount c: \"" + batpath + "\" -q\n";
}
bool templfn=!uselfn&&filename_not_8x3(batname.c_str())&&(enablelfn==-1||enablelfn==-2);
cmd += "@c:\n";
cmd += "@cd \\\n";
if (templfn) cmd += "@config -set lfn=true\n";
cmd += "@CALL \"";
cmd += batname;
cmd += "\"\n";
cmd += "@mount -u c: -q\n";
if (templfn) cmd += "@config -set lfn=" + std::string(enablelfn==-1?"auto":"autostart") + "\n";
cmd += "@mount c: -q -u\n";
}
}

View File

@ -28,6 +28,7 @@ SetupIconFile=.\dosbox-x.ico
Compression=lzma
SolidCompression=yes
UsePreviousAppDir=yes
ChangesAssociations=yes
DisableStartupPrompt=yes
DisableWelcomePage=no
DisableDirPage=no
@ -47,7 +48,7 @@ InfoAfterClickLabel=You have now installed DOSBox-X. Please note that you can cu
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "contextmenu"; Description: "Add folder context menu for Windows Explorer"
Name: "contextmenu"; Description: "Add ""Open with DOSBox-X"" context menu for Windows Explorer"
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
@ -62,11 +63,9 @@ Name: "full"; Description: "Copy all builds to subdirectories"; Types: full
[Files]
Source: ".\readme.txt"; DestDir: "{app}"; DestName: "README.txt"; Flags: ignoreversion; Components: full compact
Source: ".\windows_explorer_context_menu_installer.bat"; DestDir: "{app}"; DestName: "windows_explorer_context_menu_installer.bat"; Flags: ignoreversion; Components: full compact
Source: ".\windows_explorer_context_menu_uninstaller.bat"; DestDir: "{app}"; DestName: "windows_explorer_context_menu_uninstaller.bat"; Flags: ignoreversion; Components: full compact
Source: ".\dosbox-x.reference.conf"; DestDir: "{app}"; Flags: ignoreversion; Components: full compact
Source: "..\CHANGELOG"; DestDir: "{app}"; DestName: "changelog.txt"; Flags: ignoreversion; Components: full compact
Source: "..\COPYING"; DestDir: "{app}"; DestName: "COPYING.txt"; Flags: ignoreversion; Components: full compact
Source: "..\dosbox-x.reference.conf"; DestDir: "{app}"; Flags: ignoreversion; Components: full compact
Source: "..\font\FREECG98.BMP"; DestDir: "{app}"; Flags: ignoreversion; Components: full compact
Source: "..\shaders\*"; DestDir: "{app}\shaders"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: full compact
Source: "Win32_builds\x86_Release\dosbox-x.exe"; DestDir: "{app}"; Flags: ignoreversion; Check: CheckDirName('Win32_builds\x86_Release'); Components: full compact
@ -87,6 +86,8 @@ Source: "Win64_builds\mingw-sdl2\dosbox-x.exe"; DestDir: "{app}"; Flags: ignorev
Source: "Win64_builds\mingw-sdldraw\dosbox-x.exe"; DestDir: "{app}"; Flags: ignoreversion; Check: CheckDirName('Win64_builds\mingw-sdldraw'); Components: full compact
Source: "Win32_builds\*"; DestDir: "{app}\Win32_builds"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: full
Source: "Win64_builds\*"; DestDir: "{app}\Win64_builds"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: IsWin64; Components: full
Source: ".\windows_explorer_context_menu_installer.bat"; DestDir: "{app}\scripts"; DestName: "windows_explorer_context_menu_installer.bat"; Flags: ignoreversion; Components: full compact
Source: ".\windows_explorer_context_menu_uninstaller.bat"; DestDir: "{app}\scripts"; DestName: "windows_explorer_context_menu_uninstaller.bat"; Flags: ignoreversion; Components: full compact
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
@ -96,14 +97,27 @@ Name: "{group}\View DOSBox-X README file"; Filename: "{app}\README.TXT"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
[Registry]
Root: HKCU; Subkey: "Software\Classes\Directory\shell\DOSBox-X"; ValueType: string; ValueName: ""; ValueData: "Open with DOSBox-X"; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletevalue
Root: HKCU; Subkey: "Software\Classes\Directory\shell\DOSBox-X"; ValueType: string; ValueName: "Icon"; ValueData: """{app}\dosbox-x.exe"",0"; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletevalue
Root: HKCU; Subkey: "Software\Classes\Directory\shell\DOSBox-X\command"; ValueType: string; ValueName: ""; ValueData: """{app}\dosbox-x.exe"" -defaultdir ""{app} "" ""%1"""; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletevalue
Root: HKCU; Subkey: "Software\Classes\Directory\Background\shell\DOSBox-X"; ValueType: string; ValueName: ""; ValueData: "Open with DOSBox-X"; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletevalue
Root: HKCU; Subkey: "Software\Classes\Directory\Background\shell\DOSBox-X"; ValueType: string; ValueName: "Icon"; ValueData: """{app}\dosbox-x.exe"",0"; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletevalue
Root: HKCU; Subkey: "Software\Classes\Directory\Background\shell\DOSBox-X\command"; ValueType: string; ValueName: ""; ValueData: """{app}\dosbox-x.exe"" -defaultdir ""{app} "" ""%1"""; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletevalue
Root: HKCU; Subkey: "Software\Classes\SystemFileAssociations\.exe\shell\Open with DOSBox-X"; ValueType: none; ValueName: ""; ValueData: ""; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletevalue
Root: HKCU; Subkey: "Software\Classes\SystemFileAssociations\.exe\shell\Open with DOSBox-X"; ValueType: string; ValueName: "Icon"; ValueData: """{app}\dosbox-x.exe"",0"; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletekey
Root: HKCU; Subkey: "Software\Classes\SystemFileAssociations\.exe\shell\Open with DOSBox-X\command"; ValueType: string; ValueName: ""; ValueData: """{app}\dosbox-x.exe"" -defaultdir ""{app} "" ""%1"""; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletekey
Root: HKCU; Subkey: "Software\Classes\SystemFileAssociations\.com\shell\Open with DOSBox-X"; ValueType: none; ValueName: ""; ValueData: ""; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletevalue
Root: HKCU; Subkey: "Software\Classes\SystemFileAssociations\.com\shell\Open with DOSBox-X"; ValueType: string; ValueName: "Icon"; ValueData: """{app}\dosbox-x.exe"",0"; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletekey
Root: HKCU; Subkey: "Software\Classes\SystemFileAssociations\.com\shell\Open with DOSBox-X\command"; ValueType: string; ValueName: ""; ValueData: """{app}\dosbox-x.exe"" -defaultdir ""{app} "" ""%1"""; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletekey
Root: HKCU; Subkey: "Software\Classes\SystemFileAssociations\.bat\shell\Open with DOSBox-X"; ValueType: none; ValueName: ""; ValueData: ""; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletevalue
Root: HKCU; Subkey: "Software\Classes\SystemFileAssociations\.bat\shell\Open with DOSBox-X"; ValueType: string; ValueName: "Icon"; ValueData: """{app}\dosbox-x.exe"",0"; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletekey
Root: HKCU; Subkey: "Software\Classes\SystemFileAssociations\.bat\shell\Open with DOSBox-X\command"; ValueType: string; ValueName: ""; ValueData: """{app}\dosbox-x.exe"" -defaultdir ""{app} "" ""%1"""; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletekey
[Run]
Filename: "{app}\windows_explorer_context_menu_installer.bat"; Check: IsTaskSelected('contextmenu'); Flags: runhidden
Filename: "{app}\readme.txt"; Description: "View README.txt"; Flags: waituntilterminated runascurrentuser postinstall shellexec skipifsilent
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
[UninstallRun]
Filename: "{app}\windows_explorer_context_menu_uninstaller.bat"; Flags: runhidden
[UninstallDelete]
Type: files; Name: "{app}\stderr.txt"
@ -258,14 +272,7 @@ var
begin
if (CurrentStep = ssPostInstall) then
begin
if FileExists(ExpandConstant('{app}\dosbox-x.reference.conf')) then
begin
LoadStringFromFile(ExpandConstant('{app}\dosbox-x.reference.conf'), line);
StringChangeEx(line, #13 + #10, #10, False);
StringChangeEx(line, #10, #13 + #10, False);
SaveStringToFile(ExpandConstant('{app}\dosbox-x.reference.conf'), line, False);
end
else
if not FileExists(ExpandConstant('{app}\dosbox-x.reference.conf')) then
begin
MsgBox('Cannot find the dosbox-x.reference.conf file.', mbError, MB_OK);
Exit;
@ -345,7 +352,7 @@ begin
if (CompareText(section, '4dos') = 0) or (CompareText(section, 'config') = 0) or (CompareText(section, 'autoexec') = 0) then
begin
if (Length(lineold)>0) or (FileLines.Count>0) then
FileLinesave.add(lineold);
FileLinesave.add(FileLinesold[k]);
if (Length(lineold)>0) then
FileLines.add(lineold);
end

Binary file not shown.

View File

@ -1,46 +1,74 @@
@echo off & cls & echo DOSBox-X context menu for Windows Explorer installer & echo.
call :initialize
<nul set/p="Searching DOSBox-X executable: "
where %DOSBOX_X_EXE% /q
if %ERRORLEVEL% NEQ 0 echo not found! & echo. & call :failed & exit /b 1
for /f "usebackq delims=" %%a in (`where %DOSBOX_X_EXE%`) do set DOSBOX_X_PATH=%%~a
echo found! & echo.
for %%a in (%HKCU_DIR_FRNT% %HKCU_DIR_BACK%) do (
reg add %%a /f /ve /d "Open with DOSBox-X" >nul 2>&1
if %ERRORLEVEL% NEQ 0 call :uninstall & exit /b 1
reg add %%a /f /v Icon /d "\"%DOSBOX_X_PATH%\",0" >nul 2>&1
if %ERRORLEVEL% NEQ 0 call :uninstall & exit /b 1
reg add %%a\command /f /ve /d "\"%DOSBOX_X_PATH%\" -c \"@mount c \\\"%%v\\\"\" -c \"@c:"" >nul 2>&1
if %ERRORLEVEL% NEQ 0 call :uninstall & exit /b 1
)
call :success & exit /b 1
:uninstall
echo Error during registration, cleaning up...
for %%a in (%HKCU_DIR_FRNT% %HKCU_DIR_BACK%) do reg delete /f %%a >nul 2>&1
call :failed & goto :eof
:failed
echo Installation failed!
call :cleanup & goto :eof
:success
echo Installation complete.
call :cleanup & goto :eof
:initialize
set DOSBOX_X_EXE=dosbox-x.exe
set DOSBOX_X_PATH=
set HKCU_DIR_FRNT=HKCU\Software\Classes\Directory\shell\DOSBox-X
set HKCU_DIR_BACK=HKCU\Software\Classes\Directory\Background\shell\DOSBox-X
goto :eof
:cleanup
set DOSBOX_X_EXE=
set DOSBOX_X_PATH=
set HKCU_DIR_FRNT=
set HKCU_DIR_BACK=
goto :eof
@echo off & cls & echo DOSBox-X context menu for Windows Explorer installer & echo.
call :initialize
set DOSBOX_X_DIR=
set DOSBOX_X_PATH=
<nul set/p="Searching DOSBox-X executable: "
ver >nul
if not exist %DOSBOX_X_EXE% if exist ..\%DOSBOX_X_EXE% (
pushd ..
where %DOSBOX_X_EXE% /q
if %ERRORLEVEL% EQU 0 for /f "usebackq delims=" %%a in (`where %DOSBOX_X_EXE%`) do set DOSBOX_X_PATH=%%~a
popd
)
if "%DOSBox-X_PATH%"=="" if not exist %DOSBOX_X_EXE% if exist C:\DOSBox-X\%DOSBOX_X_EXE% (
pushd C:\DOSBox-X
where %DOSBOX_X_EXE% /q
if %ERRORLEVEL% EQU 0 for /f "usebackq delims=" %%a in (`where %DOSBOX_X_EXE%`) do set DOSBOX_X_PATH=%%~a
popd
)
if "%DOSBOX_X_PATH%"=="" (
where %DOSBOX_X_EXE% /q
if %ERRORLEVEL% EQU 0 for /f "usebackq delims=" %%a in (`where %DOSBOX_X_EXE%`) do set DOSBOX_X_PATH=%%~a
)
if "%DOSBOX_X_PATH%"=="" echo not found! & echo. & call :failed & exit /b 1
echo found! & echo.
for %%a in (%DOSBOX_X_PATH%) do set DOSBOX_X_DIR=%%~dpa
for %%a in ("%HKCU_DIR_FRNT%" "%HKCU_DIR_BACK%") do (
reg add %%a /f /ve /d "Open with DOSBox-X" >nul 2>&1
if %ERRORLEVEL% NEQ 0 call :uninstall & exit /b 1
reg add %%a /f /v Icon /d "\"%DOSBOX_X_PATH%\",0" >nul 2>&1
if %ERRORLEVEL% NEQ 0 call :uninstall & exit /b 1
reg add %%a\command /f /ve /d "\"%DOSBOX_X_PATH%\" -defaultdir \"%DOSBOX_X_DIR% \" \"%%1\"" >nul 2>&1
if %ERRORLEVEL% NEQ 0 call :uninstall & exit /b 1
)
for %%a in ("%HKCU_EXE_OPEN%" "%HKCU_COM_OPEN%" "%HKCU_BAT_OPEN%") do (
reg add %%a /f /v Icon /d "\"%DOSBOX_X_PATH%\",0" >nul 2>&1
if %ERRORLEVEL% NEQ 0 call :uninstall & exit /b 1
reg add %%a\command /f /ve /d "\"%DOSBOX_X_PATH%\" -defaultdir \"%DOSBOX_X_DIR% \" \"%%1\"" >nul 2>&1
if %ERRORLEVEL% NEQ 0 call :uninstall & exit /b 1
)
call :success & exit /b 1
:uninstall
echo Error during registration, cleaning up...
for %%a in ("%HKCU_DIR_FRNT%" "%HKCU_DIR_BACK%" "%HKCU_EXE_OPEN%" "%HKCU_COM_OPEN%" "%HKCU_BAT_OPEN%") do reg delete /f %%a >nul 2>&1
call :failed & goto :eof
:failed
echo Installation failed!
call :cleanup & goto :eof
:success
echo Installation complete.
call :cleanup & goto :eof
:initialize
set DOSBOX_X_EXE=dosbox-x.exe
set HKCU_DIR_FRNT=HKCU\Software\Classes\Directory\shell\DOSBox-X
set HKCU_DIR_BACK=HKCU\Software\Classes\Directory\Background\shell\DOSBox-X
set HKCU_EXE_OPEN=HKCU\Software\Classes\SystemFileAssociations\.exe\shell\Open with DOSBox-X
set HKCU_COM_OPEN=HKCU\Software\Classes\SystemFileAssociations\.com\shell\Open with DOSBox-X
set HKCU_BAT_OPEN=HKCU\Software\Classes\SystemFileAssociations\.bat\shell\Open with DOSBox-X
goto :eof
:cleanup
set DOSBOX_X_EXE=
set DOSBOX_X_DIR=
set DOSBOX_X_PATH=
set HKCU_DIR_FRNT=
set HKCU_DIR_BACK=
set HKCU_EXE_OPEN=
set HKCU_COM_OPEN=
set HKCU_BAT_OPEN=
goto :eof

View File

@ -1,7 +1,13 @@
@echo off & cls & echo DOSBox-X context menu for Windows Explorer uninstaller & echo.
set HKCU_DIR_FRNT=HKCU\Software\Classes\Directory\shell\DOSBox-X
set HKCU_DIR_BACK=HKCU\Software\Classes\Directory\Background\shell\DOSBox-X
for %%a in (%HKCU_DIR_FRNT% %HKCU_DIR_BACK%) do reg delete %%a /f >nul 2>&1
set HKCU_DIR_FRNT=
set HKCU_DIR_BACK=
echo Uninstallation complete.
@echo off & cls & echo DOSBox-X context menu for Windows Explorer uninstaller & echo.
set HKCU_DIR_FRNT=HKCU\Software\Classes\Directory\shell\DOSBox-X
set HKCU_DIR_BACK=HKCU\Software\Classes\Directory\Background\shell\DOSBox-X
set HKCU_EXE_OPEN=HKCU\Software\Classes\SystemFileAssociations\.exe\shell\Open with DOSBox-X
set HKCU_COM_OPEN=HKCU\Software\Classes\SystemFileAssociations\.com\shell\Open with DOSBox-X
set HKCU_BAT_OPEN=HKCU\Software\Classes\SystemFileAssociations\.bat\shell\Open with DOSBox-X
for %%a in ("%HKCU_DIR_FRNT%" "%HKCU_DIR_BACK%" "%HKCU_EXE_OPEN%" "%HKCU_COM_OPEN%" "%HKCU_BAT_OPEN%") do reg delete %%a /f >nul 2>&1
set HKCU_DIR_FRNT=
set HKCU_DIR_BACK=
set HKCU_EXE_OPEN=
set HKCU_COM_OPEN=
set HKCU_BAT_OPEN=
echo Uninstallation complete.