Restore product-specific installer and bundle metadata

This commit is contained in:
Christian Daniel Jensen 2026-11-03 19:05:58 -07:00
parent 2b325ed4fe
commit 34080de539

View file

@ -105,9 +105,9 @@ Var SentryOutput
!define MUI_HEADERIMAGE !define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "${NSIS_SOURCE_PATH}\cmake\headerimage.bmp" !define MUI_HEADERIMAGE_BITMAP "${NSIS_SOURCE_PATH}\cmake\headerimage.bmp"
!define MUI_HEADERIMAGE_UNBITMAP "${NSIS_SOURCE_PATH}\cmake\headerimage.bmp" !define MUI_HEADERIMAGE_UNBITMAP "${NSIS_SOURCE_PATH}\cmake\headerimage.bmp"
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of Cockatrice.$\r$\n$\r$\nClick Next to continue." !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of Continuumatrice.$\r$\n$\r$\nClick Next to continue."
!define MUI_FINISHPAGE_RUN "$INSTDIR/cockatrice.exe" !define MUI_FINISHPAGE_RUN "$INSTDIR/continuumatrice.exe"
!define MUI_FINISHPAGE_RUN_TEXT "Run 'Cockatrice' now" !define MUI_FINISHPAGE_RUN_TEXT "Run 'Continuumatrice' now"
!define MUI_ICON "${NSIS_SOURCE_PATH}\cockatrice\resources\appicon.ico" !define MUI_ICON "${NSIS_SOURCE_PATH}\cockatrice\resources\appicon.ico"
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfReinstall !define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfReinstall
@ -141,7 +141,7 @@ Page Custom PortableModePageCreate PortableModePageLeave
; user's machine can be diagnosed after the fact. Kept in $TEMP rather than in ; user's machine can be diagnosed after the fact. Kept in $TEMP rather than in
; $INSTDIR because the previous version's uninstaller removes the whole install ; $INSTDIR because the previous version's uninstaller removes the whole install
; directory part-way through an upgrade. Read it back with: ; directory part-way through an upgrade. Read it back with:
; notepad %TEMP%\Cockatrice-installer.log ; notepad %TEMP%\Continuumatrice-installer.log
!macro CockLog text !macro CockLog text
Push "${text}" Push "${text}"
Call CockLogWrite Call CockLogWrite
@ -206,7 +206,7 @@ FunctionEnd
Function .onInit Function .onInit
StrCpy $InstallLogPath "$TEMP\Cockatrice-installer.log" StrCpy $InstallLogPath "$TEMP\Continuumatrice-installer.log"
; No backup has been taken yet; RestoreUserDataAfterUninstall must be a no-op ; No backup has been taken yet; RestoreUserDataAfterUninstall must be a no-op
; until BackupUserDataBeforeUninstall sets this after actually copying something. ; until BackupUserDataBeforeUninstall sets this after actually copying something.
StrCpy $DataBackupDir "" StrCpy $DataBackupDir ""
@ -232,22 +232,22 @@ FileClose $LogHandle
${If} ${NSIS_IS_64_BIT} == 1 #NSIS 64bit ${If} ${NSIS_IS_64_BIT} == 1 #NSIS 64bit
${IfNot} ${RunningX64} ${IfNot} ${RunningX64}
MessageBox MB_OK|MB_ICONSTOP "This version of Cockatrice requires a 64-bit Windows system." MessageBox MB_OK|MB_ICONSTOP "This version of Continuumatrice requires a 64-bit Windows system."
Abort Abort
${EndIf} ${EndIf}
StrCpy $NormalDestDir "$ProgramFiles64\Cockatrice" StrCpy $NormalDestDir "$ProgramFiles64\Continuumatrice"
SetRegView 64 SetRegView 64
${Else} #NSIS 32bit ${Else} #NSIS 32bit
${If} ${RunningX64} ${If} ${RunningX64}
MessageBox MB_OK|MB_ICONEXCLAMATION \ MessageBox MB_OK|MB_ICONEXCLAMATION \
"You are about to install a 32-bit version of Cockatrice on a 64-bit Windows system.$\n\ "You are about to install a 32-bit version of Continuumatrice on a 64-bit Windows system.$\n\
We advise you to use the correct 64-bit installer instead to get around potential issues.$\n$\n\ We advise you to use the correct 64-bit installer instead to get around potential issues.$\n$\n\
Download from our webpage: https://cockatrice.github.io" Download from our webpage: https://github.com/Continuum-Universes-Studio/Continuumatrice"
${EndIf} ${EndIf}
StrCpy $NormalDestDir "$ProgramFiles\Cockatrice" StrCpy $NormalDestDir "$ProgramFiles\Continuumatrice"
${EndIf} ${EndIf}
StrCpy $PortableDestDir "$Desktop\CockatricePortable" StrCpy $PortableDestDir "$Desktop\ContinuumatricePortable"
${GetParameters} $9 ${GetParameters} $9
@ -337,7 +337,7 @@ ${EndIf}
; Then make sure no *other* application instance is still running (and holding ; Then make sure no *other* application instance is still running (and holding
; file locks) before the previous version is uninstalled. The probe names them ; file locks) before the previous version is uninstalled. The probe names them
; and the user is asked to close them; nothing is force-stopped without that ; and the user is asked to close them; nothing is force-stopped without that
; answer, because Cockatrice may hold an unsaved deck and Oracle writes the card ; answer, because Continuumatrice may hold an unsaved deck and Oracle writes the card
; database in place. On /R the old version is about to be removed, so an answer ; database in place. On /R the old version is about to be removed, so an answer
; the probe cannot give cancels the upgrade before it starts rather than after it. ; the probe cannot give cancels the upgrade before it starts rather than after it.
; Only needed this early for /R, where AutoUninstallIfNeeded runs below; for ; Only needed this early for /R, where AutoUninstallIfNeeded runs below; for
@ -365,7 +365,7 @@ ${EndIf}
; The uninstaller logs to its own file: the installer truncates its log on every run, so ; The uninstaller logs to its own file: the installer truncates its log on every run, so
; sharing one would mean either side erasing the other's account of a failed upgrade. ; sharing one would mean either side erasing the other's account of a failed upgrade.
StrCpy $InstallLogPath "$TEMP\Cockatrice-uninstaller.log" StrCpy $InstallLogPath "$TEMP\Continuumatrice-uninstaller.log"
FileOpen $LogHandle "$InstallLogPath" w FileOpen $LogHandle "$InstallLogPath" w
FileClose $LogHandle FileClose $LogHandle
!insertmacro CockLogUn "==================================================================" !insertmacro CockLogUn "=================================================================="
@ -380,7 +380,7 @@ Function RequireAdmin
UserInfo::GetAccountType UserInfo::GetAccountType
Pop $8 Pop $8
${If} $8 != "admin" ${If} $8 != "admin"
MessageBox MB_ICONSTOP "You need administrator rights to install Cockatrice" MessageBox MB_ICONSTOP "You need administrator rights to install Continuumatrice"
SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
Abort Abort
${EndIf} ${EndIf}
@ -471,7 +471,7 @@ SetShellVarContext all
; ;
; --- 32-bit uninstall --- ; --- 32-bit uninstall ---
SetRegView 32 SetRegView 32
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "QuietUninstallString" ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Continuumatrice" "QuietUninstallString"
; On the /R path the updater passes /D=<appDir>, so $INSTDIR already is the old ; On the /R path the updater passes /D=<appDir>, so $INSTDIR already is the old
; install dir. Publish it for the backup/restore pair below. ; install dir. Publish it for the backup/restore pair below.
@ -491,7 +491,7 @@ done32:
; --- 64-bit uninstall --- ; --- 64-bit uninstall ---
${If} ${RunningX64} ${If} ${RunningX64}
SetRegView 64 SetRegView 64
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "QuietUninstallString" ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Continuumatrice" "QuietUninstallString"
StrCpy $OldInstallDir $INSTDIR StrCpy $OldInstallDir $INSTDIR
!insertmacro CockLog "uninstall (64-bit): '$R0 _?=$OldInstallDir'" !insertmacro CockLog "uninstall (64-bit): '$R0 _?=$OldInstallDir'"
@ -516,7 +516,7 @@ FunctionEnd
; that did not get a usable _?= copies itself to %TEMP%, starts that copy and exits, so ; that did not get a usable _?= copies itself to %TEMP%, starts that copy and exits, so
; ExecWait returns at once while the copy keeps deleting - and it finishes after this ; ExecWait returns at once while the copy keeps deleting - and it finishes after this
; window has closed, removing the version that was just installed. Waiting for ; window has closed, removing the version that was just installed. Waiting for
; cockatrice.exe to disappear covers both cases, and stops with a message instead of ; continuumatrice.exe to disappear covers both cases, and stops with a message instead of
; ;
; When the payload is still there after the wait, $OldUninstallExit decides: a non-zero ; When the payload is still there after the wait, $OldUninstallExit decides: a non-zero
; code means the uninstaller was cancelled or failed, and the install aborts saying so. ; code means the uninstaller was cancelled or failed, and the install aborts saying so.
@ -552,10 +552,10 @@ ${OrIf} $OldUninstallExit == "launch-failed"
${EndIf} ${EndIf}
StrCpy $R2 0 StrCpy $R2 0
old_uninstall_wait: old_uninstall_wait:
IfFileExists "$OldInstallDir\cockatrice.exe" 0 old_uninstall_gone IfFileExists "$OldInstallDir\continuumatrice.exe" 0 old_uninstall_gone
IntOp $R2 $R2 + 1 IntOp $R2 $R2 + 1
${If} $R2 > 60 ${If} $R2 > 60
!insertmacro CockLog "old uninstall: $OldInstallDir still holds cockatrice.exe after 30 s (uninstaller exit=$OldUninstallExit)" !insertmacro CockLog "old uninstall: $OldInstallDir still holds continuumatrice.exe after 30 s (uninstaller exit=$OldUninstallExit)"
; The uninstaller's own account of what it skipped or why it stopped lives in its ; The uninstaller's own account of what it skipped or why it stopped lives in its
; separate log; copy it here so the report sent from AbortInstall carries it. ; separate log; copy it here so the report sent from AbortInstall carries it.
Call AppendUninstallerLog Call AppendUninstallerLog
@ -574,7 +574,7 @@ ${If} $R2 > 60
; them, which NSIS Delete passes over silently. Free them and remove what is left. ; them, which NSIS Delete passes over silently. Free them and remove what is left.
Call RemoveOldPayloadLeftovers Call RemoveOldPayloadLeftovers
; The removal reports success only when every payload executable is gone and the ; The removal reports success only when every payload executable is gone and the
; DLL/Plugins purge came back clean; cockatrice.exe alone would hide a locked ; DLL/Plugins purge came back clean; continuumatrice.exe alone would hide a locked
; oracle.exe or a stale DLL the new payload is about to be written over. ; oracle.exe or a stale DLL the new payload is about to be written over.
${If} $OldPayloadRemoved != "1" ${If} $OldPayloadRemoved != "1"
StrCpy $AbortReason \ StrCpy $AbortReason \
@ -594,7 +594,7 @@ old_uninstall_gone:
${If} $R2 > 0 ${If} $R2 > 0
; ExecWait returned while the old payload was still there: that uninstaller ; ExecWait returned while the old payload was still there: that uninstaller
; copied itself to %TEMP%, and the copy is still working through its file list. ; copied itself to %TEMP%, and the copy is still working through its file list.
; cockatrice.exe is gone before the rest of it, so let the copy settle before ; continuumatrice.exe is gone before the rest of it, so let the copy settle before
; the sections below start writing files it would otherwise remove. ; the sections below start writing files it would otherwise remove.
Sleep 1000 Sleep 1000
!insertmacro CockLog "old uninstall: ExecWait returned early, settled 1 s after $R2 * 500 ms" !insertmacro CockLog "old uninstall: ExecWait returned early, settled 1 s after $R2 * 500 ms"
@ -622,20 +622,20 @@ Function RemoveOldPayloadLeftovers
StrCpy $INSTDIR $OldInstallDir StrCpy $INSTDIR $OldInstallDir
StrCpy $R2 0 StrCpy $R2 0
rop_loop: rop_loop:
SetFileAttributes "$INSTDIR\cockatrice.exe" NORMAL SetFileAttributes "$INSTDIR\continuumatrice.exe" NORMAL
SetFileAttributes "$INSTDIR\oracle.exe" NORMAL SetFileAttributes "$INSTDIR\continuumatrice-legacy-oracle.exe" NORMAL
SetFileAttributes "$INSTDIR\servatrice.exe" NORMAL SetFileAttributes "$INSTDIR\continuum-servatrice.exe" NORMAL
Delete "$INSTDIR\cockatrice.exe" Delete "$INSTDIR\continuumatrice.exe"
Delete "$INSTDIR\oracle.exe" Delete "$INSTDIR\continuumatrice-legacy-oracle.exe"
Delete "$INSTDIR\servatrice.exe" Delete "$INSTDIR\continuum-servatrice.exe"
Delete "$INSTDIR\qt.conf" Delete "$INSTDIR\qt.conf"
Call RetryDllPurge Call RetryDllPurge
; $R0 is RetryDllPurge's verdict (1 = a DLL or the Plugins directory survived). ; $R0 is RetryDllPurge's verdict (1 = a DLL or the Plugins directory survived).
; Every payload executable has to be gone as well: a locked oracle.exe or ; Every payload executable has to be gone as well: a locked oracle.exe or
; servatrice.exe is just as fatal to the install that follows as cockatrice.exe. ; servatrice.exe is just as fatal to the install that follows as continuumatrice.exe.
IfFileExists "$INSTDIR\cockatrice.exe" rop_retry IfFileExists "$INSTDIR\continuumatrice.exe" rop_retry
IfFileExists "$INSTDIR\oracle.exe" rop_retry IfFileExists "$INSTDIR\continuumatrice-legacy-oracle.exe" rop_retry
IfFileExists "$INSTDIR\servatrice.exe" rop_retry IfFileExists "$INSTDIR\continuum-servatrice.exe" rop_retry
${If} $R0 == 0 ${If} $R0 == 0
Goto rop_done Goto rop_done
${EndIf} ${EndIf}
@ -664,15 +664,15 @@ Function RemoveOldPayloadLeftovers
Pop $INSTDIR Pop $INSTDIR
FunctionEnd FunctionEnd
; Copies the old uninstaller's log ($TEMP\Cockatrice-uninstaller.log) into this ; Copies the old uninstaller's log ($TEMP\Continuumatrice-uninstaller.log) into this
; installer's log, so the report AbortInstall sends shows what the uninstaller did. ; installer's log, so the report AbortInstall sends shows what the uninstaller did.
; Uninstallers older than this log simply have no file; that is logged too. ; Uninstallers older than this log simply have no file; that is logged too.
Function AppendUninstallerLog Function AppendUninstallerLog
ClearErrors ClearErrors
FileOpen $UninstLogHandle "$TEMP\Cockatrice-uninstaller.log" r FileOpen $UninstLogHandle "$TEMP\Continuumatrice-uninstaller.log" r
${If} ${Errors} ${If} ${Errors}
${OrIf} $UninstLogHandle == "" ${OrIf} $UninstLogHandle == ""
!insertmacro CockLog "uninstaller log: not found at $TEMP\Cockatrice-uninstaller.log" !insertmacro CockLog "uninstaller log: not found at $TEMP\Continuumatrice-uninstaller.log"
Return Return
${EndIf} ${EndIf}
!insertmacro CockLog "uninstaller log begin ----------------------------------------" !insertmacro CockLog "uninstaller log begin ----------------------------------------"
@ -712,7 +712,7 @@ FunctionEnd
; (warnAboutDataPathsInProgramDir), which only exists after the first launch of ; (warnAboutDataPathsInProgramDir), which only exists after the first launch of
; the new client. ; the new client.
; ;
; The 32-bit and 64-bit uninstall blocks below share $TEMP\CockatriceDataBackup. ; The 32-bit and 64-bit uninstall blocks below share $TEMP\ContinuumatriceDataBackup.
; When both are registered with different InstallLocations, backing up the second ; When both are registered with different InstallLocations, backing up the second
; directory into the first one's backup would restore the first dir's files into ; directory into the first one's backup would restore the first dir's files into
; the second one. BackupUserDataBeforeUninstall therefore starts over when ; the second one. BackupUserDataBeforeUninstall therefore starts over when
@ -744,7 +744,7 @@ ${EndIf}
; installer run - $DataBackupDir is empty until the first backup of this run, ; installer run - $DataBackupDir is empty until the first backup of this run,
; so the second call in sequence (32-bit then 64-bit uninstall) still merges. ; so the second call in sequence (32-bit then 64-bit uninstall) still merges.
${If} $DataBackupDir == "" ${If} $DataBackupDir == ""
RMDir /r "$TEMP\CockatriceDataBackup" RMDir /r "$TEMP\ContinuumatriceDataBackup"
${EndIf} ${EndIf}
; The 32-bit and 64-bit uninstall blocks share one backup dir. When the second ; The 32-bit and 64-bit uninstall blocks share one backup dir. When the second
; block points at a different directory, merging would restore the first dir's ; block points at a different directory, merging would restore the first dir's
@ -756,7 +756,7 @@ ${If} $DataBackupDir != ""
${AndIf} $DataBackupForDir != "" ${AndIf} $DataBackupForDir != ""
${AndIf} $OldInstallDir != $DataBackupForDir ${AndIf} $OldInstallDir != $DataBackupForDir
!insertmacro CockLog "pre-uninstall backup: old dir changed ($DataBackupForDir -> $OldInstallDir), starting a fresh backup" !insertmacro CockLog "pre-uninstall backup: old dir changed ($DataBackupForDir -> $OldInstallDir), starting a fresh backup"
RMDir /r "$TEMP\CockatriceDataBackup" RMDir /r "$TEMP\ContinuumatriceDataBackup"
StrCpy $DataBackupDir "" StrCpy $DataBackupDir ""
StrCpy $DataBackupDone "" StrCpy $DataBackupDone ""
StrCpy $LooseDecksBackupDone "" StrCpy $LooseDecksBackupDone ""
@ -764,7 +764,7 @@ ${AndIf} $OldInstallDir != $DataBackupForDir
${EndIf} ${EndIf}
${If} ${FileExists} "$OldInstallDir\portable.dat" ${If} ${FileExists} "$OldInstallDir\portable.dat"
${AndIf} ${FileExists} "$OldInstallDir\data" ${AndIf} ${FileExists} "$OldInstallDir\data"
StrCpy $DataBackupDir "$TEMP\CockatriceDataBackup" StrCpy $DataBackupDir "$TEMP\ContinuumatriceDataBackup"
StrCpy $DataBackupDone "1" StrCpy $DataBackupDone "1"
!insertmacro CockLog "pre-uninstall backup: copying $OldInstallDir\data (downloaded pics excluded)" !insertmacro CockLog "pre-uninstall backup: copying $OldInstallDir\data (downloaded pics excluded)"
DetailPrint "Backing up portable user data before removing previous version..." DetailPrint "Backing up portable user data before removing previous version..."
@ -805,7 +805,7 @@ ${OrIf} ${FileExists} "$OldInstallDir\*.dec"
${OrIf} ${FileExists} "$OldInstallDir\*.dek" ${OrIf} ${FileExists} "$OldInstallDir\*.dek"
${OrIf} ${FileExists} "$OldInstallDir\*.mwDeck" ${OrIf} ${FileExists} "$OldInstallDir\*.mwDeck"
${If} $DataBackupDir == "" ${If} $DataBackupDir == ""
StrCpy $DataBackupDir "$TEMP\CockatriceDataBackup" StrCpy $DataBackupDir "$TEMP\ContinuumatriceDataBackup"
${EndIf} ${EndIf}
StrCpy $LooseDecksBackupDone "1" StrCpy $LooseDecksBackupDone "1"
!insertmacro CockLog "pre-uninstall backup: copying loose deck files" !insertmacro CockLog "pre-uninstall backup: copying loose deck files"
@ -839,7 +839,7 @@ backup_subdirs_loop:
${EndIf} ${EndIf}
${If} ${FileExists} "$OldInstallDir\$DataBackupFindName\*.*" ${If} ${FileExists} "$OldInstallDir\$DataBackupFindName\*.*"
${If} $DataBackupDir == "" ${If} $DataBackupDir == ""
StrCpy $DataBackupDir "$TEMP\CockatriceDataBackup" StrCpy $DataBackupDir "$TEMP\ContinuumatriceDataBackup"
${EndIf} ${EndIf}
StrCpy $InstallSubdirsBackupDone "1" StrCpy $InstallSubdirsBackupDone "1"
!insertmacro CockLog "pre-uninstall backup: copying subdir $OldInstallDir\$DataBackupFindName" !insertmacro CockLog "pre-uninstall backup: copying subdir $OldInstallDir\$DataBackupFindName"
@ -922,7 +922,7 @@ ${AndIf} $LooseDeckNoticeShown != "1"
${If} $LooseDecksBackupDone == "1" ${If} $LooseDecksBackupDone == "1"
${OrIf} $InstallSubdirsBackupDone == "1" ${OrIf} $InstallSubdirsBackupDone == "1"
StrCpy $LooseDeckNoticeShown "1" StrCpy $LooseDeckNoticeShown "1"
MessageBox MB_OK|MB_ICONINFORMATION "Your decks or data folders were stored inside the Cockatrice install folder ($OldInstallDir), which the previous version's uninstaller deletes.$\n$\nThey have been restored from a backup to that folder (loose deck files ending in .txt are not backed up - move those manually). If you install to a different folder, they are moved there automatically. Please move them out of the install folder afterwards (Settings -> General -> Paths) so a future uninstall cannot delete them again." MessageBox MB_OK|MB_ICONINFORMATION "Your decks or data folders were stored inside the Continuumatrice install folder ($OldInstallDir), which the previous version's uninstaller deletes.$\n$\nThey have been restored from a backup to that folder (loose deck files ending in .txt are not backed up - move those manually). If you install to a different folder, they are moved there automatically. Please move them out of the install folder afterwards (Settings -> General -> Paths) so a future uninstall cannot delete them again."
${EndIf} ${EndIf}
${EndIf} ${EndIf}
done: done:
@ -989,7 +989,7 @@ done:
FunctionEnd FunctionEnd
; --- Running instance handling --- ; --- Running instance handling ---
; Cockatrice, Oracle and Servatrice must not be running while files are ; Continuumatrice, Oracle and Servatrice must not be running while files are
; replaced or deleted. A still-running process holds locks on its .exe and ; replaced or deleted. A still-running process holds locks on its .exe and
; Qt runtime DLLs, so a silent upgrade could otherwise end up with a mix of ; Qt runtime DLLs, so a silent upgrade could otherwise end up with a mix of
; old and new Qt DLLs next to the new executable, failing with ; old and new Qt DLLs next to the new executable, failing with
@ -1030,7 +1030,7 @@ FunctionEnd
; the image lookup matches on the directory a process runs from, so it does not ; the image lookup matches on the directory a process runs from, so it does not
; widen that set. ; widen that set.
; ;
; Nothing is force-stopped without the user asking for it: Cockatrice may be holding ; Nothing is force-stopped without the user asking for it: Continuumatrice may be holding
; an unsaved deck or showing a "really leave this game?" confirmation, Oracle writes ; an unsaved deck or showing a "really leave this game?" confirmation, Oracle writes
; the card database in place and can be killed mid-write, and Servatrice may be serving ; the card database in place and can be killed mid-write, and Servatrice may be serving
; a game. A close is a request, made automatically because that is what the user started ; a game. A close is a request, made automatically because that is what the user started
@ -1050,14 +1050,14 @@ FunctionEnd
; What the user does instead when they say no: the prompt's other answer stops the run, so they ; What the user does instead when they say no: the prompt's other answer stops the run, so they
; are told how to get past the same wall next time. Also used by the abort dialogs, which is ; are told how to get past the same wall next time. Also used by the abort dialogs, which is
; where the answer to "why did it stop" ends up. ; where the answer to "why did it stop" ends up.
!define AFTER_CLOSING_GUIDANCE "Answer the confirmation Cockatrice may be showing - open it from the notification area if it is hidden there - and use Task Manager for a program that would not end." !define AFTER_CLOSING_GUIDANCE "Answer the confirmation Continuumatrice may be showing - open it from the notification area if it is hidden there - and use Task Manager for a program that would not end."
; The escape hatch for a user who would rather not force-close anything: the same release, ; The escape hatch for a user who would rather not force-close anything: the same release,
; downloaded and run by hand once Cockatrice is closed. Every abort dialog shows this and ; downloaded and run by hand once Continuumatrice is closed. Every abort dialog shows this and
; offers to open the page, so an update that cannot free the files still leaves the user a ; offers to open the page, so an update that cannot free the files still leaves the user a
; way forward that does not end in Task Manager. ; way forward that does not end in Task Manager.
!define LATEST_RELEASE_URL "https://github.com/Cockatrice/Cockatrice/releases/latest" !define LATEST_RELEASE_URL "https://github.com/Continuum-Universes-Studio/Continuumatrice/releases/latest"
!define MANUAL_UPDATE_GUIDANCE "To update safely instead, close Cockatrice and download the latest installer from:$\r$\n${LATEST_RELEASE_URL}$\r$\nThen run it manually." !define MANUAL_UPDATE_GUIDANCE "To update safely instead, close Continuumatrice and download the latest installer from:$\r$\n${LATEST_RELEASE_URL}$\r$\nThen run it manually."
; usage: set the variable named by the second argument to the probe's listing, then call ; usage: set the variable named by the second argument to the probe's listing, then call
; this. Sets $GuardPrompt to the question the guard and the recovery path ask. ; this. Sets $GuardPrompt to the question the guard and the recovery path ask.
@ -1082,7 +1082,7 @@ FunctionEnd
; @param cancelWord what No gives up, "installation" or "uninstallation" ; @param cancelWord what No gives up, "installation" or "uninstallation"
!macro CockEndPrompt header listing cancelWord !macro CockEndPrompt header listing cancelWord
StrCpy $GuardPrompt "${header}$\r$\n$\r$\n${listing}" StrCpy $GuardPrompt "${header}$\r$\n$\r$\n${listing}"
StrCpy $GuardPrompt "$GuardPrompt$\r$\n$\r$\nChoose Yes to force close the Cockatrice, Oracle and Servatrice programs listed above. ${END_COST}$\r$\n$\r$\nChoose No to cancel the ${cancelWord}. ${AFTER_CLOSING_GUIDANCE}" StrCpy $GuardPrompt "$GuardPrompt$\r$\n$\r$\nChoose Yes to force close the Continuumatrice, Oracle and Servatrice programs listed above. ${END_COST}$\r$\n$\r$\nChoose No to cancel the ${cancelWord}. ${AFTER_CLOSING_GUIDANCE}"
!macroend !macroend
; usage: like CockEndPrompt, for a MB_YESNOCANCEL question whose No checks again. ; usage: like CockEndPrompt, for a MB_YESNOCANCEL question whose No checks again.
@ -1104,7 +1104,7 @@ FunctionEnd
; @param cancelWord what Cancel gives up, "installation" or "uninstallation" ; @param cancelWord what Cancel gives up, "installation" or "uninstallation"
!macro CockEndRecheckPrompt header listing cancelWord !macro CockEndRecheckPrompt header listing cancelWord
StrCpy $GuardPrompt "${header}$\r$\n$\r$\n${listing}" StrCpy $GuardPrompt "${header}$\r$\n$\r$\n${listing}"
StrCpy $GuardPrompt "$GuardPrompt$\r$\n$\r$\nChoose Yes to force close the Cockatrice, Oracle and Servatrice programs listed above. ${END_COST}$\r$\n$\r$\nChoose No to close them yourself, then check again - answer the confirmation Cockatrice may be showing, and open it from the notification area if it is hidden there.$\r$\n$\r$\nChoose Cancel to abort the ${cancelWord}." StrCpy $GuardPrompt "$GuardPrompt$\r$\n$\r$\nChoose Yes to force close the Continuumatrice, Oracle and Servatrice programs listed above. ${END_COST}$\r$\n$\r$\nChoose No to close them yourself, then check again - answer the confirmation Continuumatrice may be showing, and open it from the notification area if it is hidden there.$\r$\n$\r$\nChoose Cancel to abort the ${cancelWord}."
!macroend !macroend
; Emitted once for the installer and once for the uninstaller: the uninstaller ; Emitted once for the installer and once for the uninstaller: the uninstaller
@ -1140,19 +1140,19 @@ Function ${prefix}RunHolderProbe
FunctionEnd FunctionEnd
; usage: set $GuardDir to the directory being replaced, then call this. Asks the running ; usage: set $GuardDir to the directory being replaced, then call this. Asks the running
; Cockatrice to close, and waits for it to exit. ; Continuumatrice to close, and waits for it to exit.
; ;
; The set is what the probe names: the processes holding a file of the version being ; The set is what the probe names: the processes holding a file of the version being
; replaced, plus the payload programs running from the directory itself. The probe ; replaced, plus the payload programs running from the directory itself. The probe
; closes that set by pid, which is why nothing here has to match an executable path. Only ; closes that set by pid, which is why nothing here has to match an executable path. Only
; cockatrice.exe is asked: Oracle writes the card database in place and Servatrice has no ; continuumatrice.exe is asked: Oracle writes the card database in place and Servatrice has no
; window to ask, so both are left alone here and only ended by the explicit answer. ; window to ask, so both are left alone here and only ended by the explicit answer.
; ;
; Each instance is asked to close over the local socket it listens on, which is the same ; Each instance is asked to close over the local socket it listens on, which is the same
; request as clicking its close button and reaches one whose window is hidden in the ; request as clicking its close button and reaches one whose window is hidden in the
; notification area or is sitting on its own confirmation. A client from before that socket ; notification area or is sitting on its own confirmation. A client from before that socket
; is asked with WM_CLOSE on its own window instead, and a visible window is brought forward ; is asked with WM_CLOSE on its own window instead, and a visible window is brought forward
; first. Either way the close is answered, not obeyed - Cockatrice asks before it quits while ; first. Either way the close is answered, not obeyed - Continuumatrice asks before it quits while
; a card database update is running, a game is open or a deck is unsaved - and that question ; a card database update is running, a game is open or a deck is unsaved - and that question
; is only useful if it is in front of the installer instead of behind it. ; is only useful if it is in front of the installer instead of behind it.
; ;
@ -1176,11 +1176,11 @@ Function ${prefix}CloseHolders
; Call un. functions, so the macro's two lines are spelled with the prefix here. ; Call un. functions, so the macro's two lines are spelled with the prefix here.
Push "close-holders: probe exit=$R3 [$R4]" Push "close-holders: probe exit=$R3 [$R4]"
Call ${prefix}CockLogWrite Call ${prefix}CockLogWrite
DetailPrint "Closing Cockatrice: $R4" DetailPrint "Closing Continuumatrice: $R4"
FunctionEnd FunctionEnd
; usage: set $GuardDir to the directory being replaced, then call this. Ends the running ; usage: set $GuardDir to the directory being replaced, then call this. Ends the running
; Cockatrice, Oracle and Servatrice instances the probe names. ; Continuumatrice, Oracle and Servatrice instances the probe names.
; ;
; This is the only place anything is stopped without being asked to stop, so it is only ; This is the only place anything is stopped without being asked to stop, so it is only
; reached after the user picked it from a prompt that says what it costs: a client that is ; reached after the user picked it from a prompt that says what it costs: a client that is
@ -1198,7 +1198,7 @@ Function ${prefix}EndHolders
Pop $R4 Pop $R4
Push "end-holders: probe exit=$R3 [$R4]" Push "end-holders: probe exit=$R3 [$R4]"
Call ${prefix}CockLogWrite Call ${prefix}CockLogWrite
DetailPrint "Ending Cockatrice, Oracle and Servatrice: $R4" DetailPrint "Ending Continuumatrice, Oracle and Servatrice: $R4"
FunctionEnd FunctionEnd
!macroend !macroend
@ -1207,7 +1207,7 @@ FunctionEnd
; usage: set $GuardDir to the directory to guard, then call this. ; usage: set $GuardDir to the directory to guard, then call this.
; ;
; Asks Cockatrice to close once, then asks one question with one answer that can free the ; Asks Continuumatrice to close once, then asks one question with one answer that can free the
; payload. The automatic close is the same request clicking the window's close button makes, ; payload. The automatic close is the same request clicking the window's close button makes,
; so the common case - the client was still shutting down - never turns into a question. The ; so the common case - the client was still shutting down - never turns into a question. The
; prompt is what remains when the close cannot reach everything: Oracle writes the card ; prompt is what remains when the close cannot reach everything: Oracle writes the card
@ -1232,7 +1232,7 @@ Function GuardAppsNotRunning
Call RunHolderProbe Call RunHolderProbe
${If} $GuardExit == "0" ${If} $GuardExit == "0"
!insertmacro CockLog "guard: nothing is holding the payload" !insertmacro CockLog "guard: nothing is holding the payload"
DetailPrint "No running Cockatrice, Oracle or Servatrice instance was found." DetailPrint "No running Continuumatrice, Oracle or Servatrice instance was found."
Return Return
${EndIf} ${EndIf}
${If} $GuardExit == "1" ${If} $GuardExit == "1"
@ -1258,7 +1258,7 @@ Function GuardAppsNotRunning
; update from the official download page. Without the middle answer a user who did ; update from the official download page. Without the middle answer a user who did
; not want anything killed had no way forward but to abandon the update. ; not want anything killed had no way forward but to abandon the update.
guard_ask: guard_ask:
!insertmacro CockEndRecheckPrompt "Cockatrice, Oracle or Servatrice is still using files of the installation:" $GuardOutput "installation" !insertmacro CockEndRecheckPrompt "Continuumatrice, Oracle or Servatrice is still using files of the installation:" $GuardOutput "installation"
MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION|MB_DEFBUTTON2 "$GuardPrompt" IDYES guard_end IDNO guard_recheck MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION|MB_DEFBUTTON2 "$GuardPrompt" IDYES guard_end IDNO guard_recheck
Goto guard_cancel Goto guard_cancel
guard_recheck: guard_recheck:
@ -1272,7 +1272,7 @@ Function GuardAppsNotRunning
guard_cancel: guard_cancel:
!insertmacro CockLog "guard: cancelled by user after $GuardRecheckCount recheck(s)" !insertmacro CockLog "guard: cancelled by user after $GuardRecheckCount recheck(s)"
StrCpy $AbortReason \ StrCpy $AbortReason \
"The installation was cancelled because Cockatrice, Oracle or Servatrice is still running and holding files of the previous version.$\r$\n$\r$\n${AFTER_CLOSING_GUIDANCE}$\r$\n$\r$\nClose them and run the installer again." "The installation was cancelled because Continuumatrice, Oracle or Servatrice is still running and holding files of the previous version.$\r$\n$\r$\n${AFTER_CLOSING_GUIDANCE}$\r$\n$\r$\nClose them and run the installer again."
; RemoveOldPayloadLeftovers runs with the pre-uninstall backup already taken; ; RemoveOldPayloadLeftovers runs with the pre-uninstall backup already taken;
; restoring here keeps this abort from stranding the only copy in %TEMP%. ; restoring here keeps this abort from stranding the only copy in %TEMP%.
Call RestoreUserDataAfterUninstall Call RestoreUserDataAfterUninstall
@ -1296,7 +1296,7 @@ Function GuardAppsNotRunning
"The installation was cancelled because these programs still hold files of the previous version and could not be ended:$\r$\n$\r$\n$GuardOutput$\r$\n$\r$\n${AFTER_CLOSING_GUIDANCE}$\r$\n$\r$\nClose them and run the installer again." "The installation was cancelled because these programs still hold files of the previous version and could not be ended:$\r$\n$\r$\n$GuardOutput$\r$\n$\r$\n${AFTER_CLOSING_GUIDANCE}$\r$\n$\r$\nClose them and run the installer again."
${Else} ${Else}
StrCpy $AbortReason \ StrCpy $AbortReason \
"The installation was cancelled because, after ending Cockatrice, Oracle and Servatrice, the installer could not check whether they still hold files of the previous version.$\r$\n$\r$\nThe check reported: $GuardOutput$\r$\n$\r$\nClose them and run the installer again." "The installation was cancelled because, after ending Continuumatrice, Oracle and Servatrice, the installer could not check whether they still hold files of the previous version.$\r$\n$\r$\nThe check reported: $GuardOutput$\r$\n$\r$\nClose them and run the installer again."
${EndIf} ${EndIf}
Call RestoreUserDataAfterUninstall Call RestoreUserDataAfterUninstall
Call AbortInstall Call AbortInstall
@ -1314,15 +1314,15 @@ Function GuardAppsNotRunning
; installs anyway, Abort cancels instead of writing a payload next to files ; installs anyway, Abort cancels instead of writing a payload next to files
; the guard could not rule out. ; the guard could not rule out.
!insertmacro CockLog "guard: the holder probe could not answer ($GuardExit): $GuardOutput" !insertmacro CockLog "guard: the holder probe could not answer ($GuardExit): $GuardOutput"
DetailPrint "Could not confirm whether Cockatrice is still running: $GuardOutput" DetailPrint "Could not confirm whether Continuumatrice is still running: $GuardOutput"
MessageBox MB_ABORTRETRYIGNORE|MB_ICONEXCLAMATION|MB_DEFBUTTON1 \ MessageBox MB_ABORTRETRYIGNORE|MB_ICONEXCLAMATION|MB_DEFBUTTON1 \
"This installer could not confirm whether Cockatrice, Oracle or Servatrice is still running.$\r$\n$\r$\nThe check reported: $GuardOutput$\r$\n$\r$\nClose them, then choose Retry to check again. Choose Ignore to install anyway, or Abort to cancel the installation." \ "This installer could not confirm whether Continuumatrice, Oracle or Servatrice is still running.$\r$\n$\r$\nThe check reported: $GuardOutput$\r$\n$\r$\nClose them, then choose Retry to check again. Choose Ignore to install anyway, or Abort to cancel the installation." \
IDRETRY guard_check IDABORT guard_unknown_abort IDRETRY guard_check IDABORT guard_unknown_abort
!insertmacro CockLog "guard: continuing without an answer from the probe" !insertmacro CockLog "guard: continuing without an answer from the probe"
Return Return
guard_unknown_abort: guard_unknown_abort:
StrCpy $AbortReason \ StrCpy $AbortReason \
"The installation was cancelled because it could not confirm whether Cockatrice, Oracle or Servatrice is still running.$\r$\n$\r$\nThe check reported: $GuardOutput$\r$\n$\r$\nPlease close them and run the installer again." "The installation was cancelled because it could not confirm whether Continuumatrice, Oracle or Servatrice is still running.$\r$\n$\r$\nThe check reported: $GuardOutput$\r$\n$\r$\nPlease close them and run the installer again."
; Same reason as the cancel path above: this abort can be reached from the ; Same reason as the cancel path above: this abort can be reached from the
; leftover-removal guard, after the backup was taken. ; leftover-removal guard, after the backup was taken.
Call RestoreUserDataAfterUninstall Call RestoreUserDataAfterUninstall
@ -1391,7 +1391,7 @@ Function AbortInstall
; forge extra lines into the artifact we send. ; forge extra lines into the artifact we send.
!insertmacro CockLog "sentry send: result=$SentryResult output=$SentryOutput" !insertmacro CockLog "sentry send: result=$SentryResult output=$SentryOutput"
${If} $SentryResult == "0" ${If} $SentryResult == "0"
MessageBox MB_OK|MB_ICONINFORMATION "The installer log was sent. Thank you for helping improve Cockatrice!" MessageBox MB_OK|MB_ICONINFORMATION "The installer log was sent. Thank you for helping improve Continuumatrice!"
${Else} ${Else}
MessageBox MB_OK|MB_ICONEXCLAMATION "The installer log could not be sent. You can still share it manually; it was written to:$\r$\n$InstallLogPath" MessageBox MB_OK|MB_ICONEXCLAMATION "The installer log could not be sent. You can still share it manually; it was written to:$\r$\n$InstallLogPath"
${EndIf} ${EndIf}
@ -1425,7 +1425,7 @@ Function CloseLauncher
Pop $R4 Pop $R4
Push "close-launcher: probe exit=$R3 [$R4]" Push "close-launcher: probe exit=$R3 [$R4]"
Call CockLogWrite Call CockLogWrite
DetailPrint "Closing Cockatrice: $R4" DetailPrint "Closing Continuumatrice: $R4"
FunctionEnd FunctionEnd
; Waits for the application that launched this installer to exit, using the /PID= ; Waits for the application that launched this installer to exit, using the /PID=
@ -1479,7 +1479,7 @@ Function WaitForLauncherToExit
; under a second, so at ten seconds it is either flushing a card database or - far ; under a second, so at ten seconds it is either flushing a card database or - far
; more often - sitting on its own "quit anyway?" confirmation with nobody looking at ; more often - sitting on its own "quit anyway?" confirmation with nobody looking at
; it. Silence for a minute is what makes that read as a hung installer. The full ; it. Silence for a minute is what makes that read as a hung installer. The full
; grace is spent after the first question, so a user who answers Cockatrice's ; grace is spent after the first question, so a user who answers Continuumatrice's
; confirmation is not asked again while they do it. ; confirmation is not asked again while they do it.
StrCpy $WaitSlice 10000 StrCpy $WaitSlice 10000
wait_launcher_open: wait_launcher_open:
@ -1570,11 +1570,11 @@ Function WaitForLauncherToExit
; exists to prevent. Yes ends the launcher, Cancel cancels, and No keeps waiting: ; exists to prevent. Yes ends the launcher, Cancel cancels, and No keeps waiting:
; the close and the bring-forward just happened above. ; the close and the bring-forward just happened above.
MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION|MB_DEFBUTTON2 \ MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION|MB_DEFBUTTON2 \
"Cockatrice has not finished closing, so the installation is paused rather than replace files it is still using.$\r$\n$\r$\nIt may be waiting for you to answer its own question about an unsaved deck, an open game or a card database update.$\r$\n$\r$\nChoose Yes to end it now - an unsaved deck, a running game or an unwritten setting is lost.$\r$\n$\r$\nChoose No to keep waiting, or Cancel to cancel the installation." \ "Continuumatrice has not finished closing, so the installation is paused rather than replace files it is still using.$\r$\n$\r$\nIt may be waiting for you to answer its own question about an unsaved deck, an open game or a card database update.$\r$\n$\r$\nChoose Yes to end it now - an unsaved deck, a running game or an unwritten setting is lost.$\r$\n$\r$\nChoose No to keep waiting, or Cancel to cancel the installation." \
IDYES wait_launcher_end IDNO wait_launcher_retry IDYES wait_launcher_end IDNO wait_launcher_retry
!insertmacro CockLog "wait-launcher: cancelled by user" !insertmacro CockLog "wait-launcher: cancelled by user"
StrCpy $AbortReason \ StrCpy $AbortReason \
"The application that started this update has not exited yet, so the installation was cancelled rather than replace files it is still using.$\r$\n$\r$\nPlease close Cockatrice and run the installer again." "The application that started this update has not exited yet, so the installation was cancelled rather than replace files it is still using.$\r$\n$\r$\nPlease close Continuumatrice and run the installer again."
Call AbortInstall Call AbortInstall
; Only reached through Yes or No: AbortInstall does not return. ; Only reached through Yes or No: AbortInstall does not return.
wait_launcher_end: wait_launcher_end:
@ -1618,7 +1618,7 @@ Function EnsureOldInstallNotRunning
; the directory the old install lives in. Every uninstaller shipped before ; the directory the old install lives in. Every uninstaller shipped before
; this change had no running instance guard of its own, so the old one would ; this change had no running instance guard of its own, so the old one would
; delete files while an instance of the application is still holding them. ; delete files while an instance of the application is still holding them.
ReadRegStr $R3 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "InstallLocation" ReadRegStr $R3 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Continuumatrice" "InstallLocation"
${If} $R3 == "" ${If} $R3 == ""
; no usable record of where the old install is; $INSTDIR is the default ; no usable record of where the old install is; $INSTDIR is the default
; install directory at this point, which is where it usually is anyway ; install directory at this point, which is where it usually is anyway
@ -1629,19 +1629,19 @@ Function EnsureOldInstallNotRunning
Call GuardAppsNotRunning Call GuardAppsNotRunning
FunctionEnd FunctionEnd
; Sets $R0 to 1 if $INSTDIR looks like an existing Cockatrice install. Used to ; Sets $R0 to 1 if $INSTDIR looks like an existing Continuumatrice install. Used to
; guard the stale-runtime-DLL purge so a first-time install into a pre-existing ; guard the stale-runtime-DLL purge so a first-time install into a pre-existing
; directory with an unrelated "Plugins" folder is never touched, while an ; directory with an unrelated "Plugins" folder is never touched, while an
; install that only ever held e.g. servatrice.exe is still purged. ; install that only ever held e.g. servatrice.exe is still purged.
Function IsExistingCockatriceInstall Function IsExistingContinuumatriceInstall
StrCpy $R0 0 StrCpy $R0 0
${If} ${FileExists} "$INSTDIR\cockatrice.exe" ${If} ${FileExists} "$INSTDIR\continuumatrice.exe"
StrCpy $R0 1 StrCpy $R0 1
${EndIf} ${EndIf}
${If} ${FileExists} "$INSTDIR\oracle.exe" ${If} ${FileExists} "$INSTDIR\continuumatrice-legacy-oracle.exe"
StrCpy $R0 1 StrCpy $R0 1
${EndIf} ${EndIf}
${If} ${FileExists} "$INSTDIR\servatrice.exe" ${If} ${FileExists} "$INSTDIR\continuum-servatrice.exe"
StrCpy $R0 1 StrCpy $R0 1
${EndIf} ${EndIf}
${If} ${FileExists} "$INSTDIR\uninstall.exe" ${If} ${FileExists} "$INSTDIR\uninstall.exe"
@ -1652,7 +1652,7 @@ Function IsExistingCockatriceInstall
; executables and uninstall.exe but silently skipped the DLLs its running ; executables and uninstall.exe but silently skipped the DLLs its running
; instance had locked - which is exactly the broken install the purge is ; instance had locked - which is exactly the broken install the purge is
; meant to heal, and without these markers none of the files above would be ; meant to heal, and without these markers none of the files above would be
; there to prove that it is one. Every Qt module Cockatrice links is part of ; there to prove that it is one. Every Qt module Continuumatrice links is part of
; the payload, so match them all: probing only Qt6Core.dll would miss a ; the payload, so match them all: probing only Qt6Core.dll would miss a
; directory where that one file happened to be deletable and the others ; directory where that one file happened to be deletable and the others
; were not. Qt6*.dll rather than *.dll on purpose: this function decides ; were not. Qt6*.dll rather than *.dll on purpose: this function decides
@ -2028,7 +2028,7 @@ Function RecoverFromHolders
; One question, the same one the guard asks and with the same two answers. No retry loop: ; One question, the same one the guard asks and with the same two answers. No retry loop:
; the purge has already been tried after the close, so the only thing that can still free ; the purge has already been tried after the close, so the only thing that can still free
; the files is ending them, and the caller's abort names whatever survives that. ; the files is ending them, and the caller's abort names whatever survives that.
!insertmacro CockEndPrompt "Files of the previous version of Cockatrice are still in use by:" $HolderOutput "installation" !insertmacro CockEndPrompt "Files of the previous version of Continuumatrice are still in use by:" $HolderOutput "installation"
MessageBox MB_YESNO|MB_ICONEXCLAMATION|MB_DEFBUTTON2 "$GuardPrompt" IDYES rfh_end MessageBox MB_YESNO|MB_ICONEXCLAMATION|MB_DEFBUTTON2 "$GuardPrompt" IDYES rfh_end
!insertmacro CockLog "recover-holders: cancelled by user" !insertmacro CockLog "recover-holders: cancelled by user"
Return Return
@ -2084,14 +2084,14 @@ Function un.GuardAppsNotRunning
; Same question and the same three answers as the installer's guard: force close, ; Same question and the same three answers as the installer's guard: force close,
; close by hand and check again, or abort. CockEndRecheckPrompt words it, so the two ; close by hand and check again, or abort. CockEndRecheckPrompt words it, so the two
; copies promise the same thing. ; copies promise the same thing.
!insertmacro CockEndRecheckPrompt "Cockatrice, Oracle or Servatrice is still using files of the installation:" $GuardOutput "uninstallation" !insertmacro CockEndRecheckPrompt "Continuumatrice, Oracle or Servatrice is still using files of the installation:" $GuardOutput "uninstallation"
MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION|MB_DEFBUTTON2 "$GuardPrompt" IDYES un_guard_end IDNO un_guard_recheck MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION|MB_DEFBUTTON2 "$GuardPrompt" IDYES un_guard_end IDNO un_guard_recheck
!insertmacro CockLogUn "uninst-guard: cancelled by user after $GuardRecheckCount recheck(s)" !insertmacro CockLogUn "uninst-guard: cancelled by user after $GuardRecheckCount recheck(s)"
; The installer's Cancel lands in AbortInstall, which explains what to do next. The ; The installer's Cancel lands in AbortInstall, which explains what to do next. The
; uninstaller has no such dialog, so say the same thing here: a bare Abort would ; uninstaller has no such dialog, so say the same thing here: a bare Abort would
; close the window and leave the user with no reason and no next step. ; close the window and leave the user with no reason and no next step.
MessageBox MB_OK|MB_ICONEXCLAMATION \ MessageBox MB_OK|MB_ICONEXCLAMATION \
"The uninstallation was cancelled because Cockatrice, Oracle or Servatrice is still running and holding files of the installation.$\r$\n$\r$\n${AFTER_CLOSING_GUIDANCE}$\r$\n$\r$\nClose them and run the uninstaller again." "The uninstallation was cancelled because Continuumatrice, Oracle or Servatrice is still running and holding files of the installation.$\r$\n$\r$\n${AFTER_CLOSING_GUIDANCE}$\r$\n$\r$\nClose them and run the uninstaller again."
SetErrorLevel 1 SetErrorLevel 1
Abort Abort
un_guard_recheck: un_guard_recheck:
@ -2122,9 +2122,9 @@ Function un.GuardAppsNotRunning
; uninstall that hits a Restart Manager that was busy, or a payload program the user has ; uninstall that hits a Restart Manager that was busy, or a payload program the user has
; not closed yet, can simply be retried. ; not closed yet, can simply be retried.
!insertmacro CockLogUn "uninst-guard: the holder probe could not answer ($GuardExit): $GuardOutput" !insertmacro CockLogUn "uninst-guard: the holder probe could not answer ($GuardExit): $GuardOutput"
DetailPrint "Could not confirm whether Cockatrice is still running: $GuardOutput" DetailPrint "Could not confirm whether Continuumatrice is still running: $GuardOutput"
MessageBox MB_ABORTRETRYIGNORE|MB_ICONEXCLAMATION|MB_DEFBUTTON1 \ MessageBox MB_ABORTRETRYIGNORE|MB_ICONEXCLAMATION|MB_DEFBUTTON1 \
"This uninstaller could not confirm whether Cockatrice, Oracle or Servatrice is still running.$\r$\n$\r$\nThe check reported: $GuardOutput$\r$\n$\r$\nClose them, then choose Retry to check again. Choose Ignore to uninstall anyway, or Abort to cancel the uninstallation." \ "This uninstaller could not confirm whether Continuumatrice, Oracle or Servatrice is still running.$\r$\n$\r$\nThe check reported: $GuardOutput$\r$\n$\r$\nClose them, then choose Retry to check again. Choose Ignore to uninstall anyway, or Abort to cancel the uninstallation." \
IDRETRY un_guard_check IDABORT un_guard_unknown_abort IDRETRY un_guard_check IDABORT un_guard_unknown_abort
!insertmacro CockLogUn "uninst-guard: continuing without an answer from the probe" !insertmacro CockLogUn "uninst-guard: continuing without an answer from the probe"
Return Return
@ -2141,7 +2141,7 @@ ${If} $ReinstallMode = 1
${EndIf} ${EndIf}
Call SetModeDestinationFromInstdir ; If the user clicks BACK on the directory page we will remember their mode specific directory Call SetModeDestinationFromInstdir ; If the user clicks BACK on the directory page we will remember their mode specific directory
!insertmacro MUI_HEADER_TEXT "Install Mode" "Choose how you want to install Cockatrice." !insertmacro MUI_HEADER_TEXT "Install Mode" "Choose how you want to install Continuumatrice."
nsDialogs::Create 1018 nsDialogs::Create 1018
Pop $0 Pop $0
${NSD_CreateLabel} 0 10u 100% 24u "Select install mode:" ${NSD_CreateLabel} 0 10u 100% 24u "Select install mode:"
@ -2182,11 +2182,11 @@ ${If} $PortableMode = 0
# uninstall 32bit version # uninstall 32bit version
SetRegView 32 SetRegView 32
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "UninstallString" ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Continuumatrice" "UninstallString"
StrCmp $R0 "" done32 StrCmp $R0 "" done32
${If} $ReinstallMode = 0 ${If} $ReinstallMode = 0
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "A previous version of Cockatrice must be uninstalled before installing the new one." IDOK uninst32 MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "A previous version of Continuumatrice must be uninstalled before installing the new one." IDOK uninst32
; Abort would only skip this page and install over the old version anyway; ; Abort would only skip this page and install over the old version anyway;
; the message said the old one must go first, so Cancel means cancel. ; the message said the old one must go first, so Cancel means cancel.
!insertmacro CockLog "componentsPagePre: cancelled at the previous-version prompt" !insertmacro CockLog "componentsPagePre: cancelled at the previous-version prompt"
@ -2213,7 +2213,7 @@ ${If} $PortableMode = 0
; the user clicks Next on it, the new version is installed, and the uninstaller ; the user clicks Next on it, the new version is installed, and the uninstaller
; removes everything once this window closes. /S leaves no window to be behind, ; removes everything once this window closes. /S leaves no window to be behind,
; so ExecWait is waiting for something that cannot outlive it. ; so ExecWait is waiting for something that cannot outlive it.
ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "QuietUninstallString" ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Continuumatrice" "QuietUninstallString"
${If} $R1 == "" ${If} $R1 == ""
StrCpy $OldUninstallString "$OldUninstallString /S" StrCpy $OldUninstallString "$OldUninstallString /S"
${Else} ${Else}
@ -2233,11 +2233,11 @@ ${If} $PortableMode = 0
${If} ${NSIS_IS_64_BIT} == 1 ${If} ${NSIS_IS_64_BIT} == 1
SetRegView 64 SetRegView 64
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "UninstallString" ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Continuumatrice" "UninstallString"
StrCmp $R0 "" done64 StrCmp $R0 "" done64
${If} $ReinstallMode = 0 ${If} $ReinstallMode = 0
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "A previous version of Cockatrice must be uninstalled before installing the new one." IDOK uninst64 MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "A previous version of Continuumatrice must be uninstalled before installing the new one." IDOK uninst64
!insertmacro CockLog "componentsPagePre: cancelled at the previous-version prompt" !insertmacro CockLog "componentsPagePre: cancelled at the previous-version prompt"
Quit Quit
${Else} ${Else}
@ -2249,7 +2249,7 @@ ${If} $PortableMode = 0
Call EnsureOldInstallNotRunning Call EnsureOldInstallNotRunning
StrCpy $OldInstallDir $GuardDir StrCpy $OldInstallDir $GuardDir
; Silent, for the reason given in the 32-bit branch above. ; Silent, for the reason given in the 32-bit branch above.
ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "QuietUninstallString" ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Continuumatrice" "QuietUninstallString"
${If} $R1 == "" ${If} $R1 == ""
StrCpy $OldUninstallString "$OldUninstallString /S" StrCpy $OldUninstallString "$OldUninstallString /S"
${Else} ${Else}
@ -2287,7 +2287,7 @@ SetOutPath "$INSTDIR"
; "abseil_dll.dll is either not designed to run on Windows or it contains an ; "abseil_dll.dll is either not designed to run on Windows or it contains an
; error" for the protobuf ones. So the check has to come before the first ; error" for the protobuf ones. So the check has to come before the first
; Delete/RMDir and not after it: an interactive install into an existing portable ; Delete/RMDir and not after it: an interactive install into an existing portable
; directory with cockatrice.exe still running would otherwise delete the old ; directory with continuumatrice.exe still running would otherwise delete the old
; files under its feet. ; files under its feet.
; ;
; It is skipped on the /R path: .onInit already ran it before ; It is skipped on the /R path: .onInit already ran it before
@ -2301,20 +2301,20 @@ ${If} $ReinstallMode = 0
${EndIf} ${EndIf}
; Measured before either purge block, because it has to describe the directory as ; Measured before either purge block, because it has to describe the directory as
; it arrived here and not what a purge left of it: IsExistingCockatriceInstall ; it arrived here and not what a purge left of it: IsExistingContinuumatriceInstall
; looks for cockatrice.exe, oracle.exe, servatrice.exe, uninstall.exe, Qt6*.dll ; looks for continuumatrice.exe, oracle.exe, servatrice.exe, uninstall.exe, Qt6*.dll
; and qt.conf, and the portable purge below deletes exactly those. Taken after ; and qt.conf, and the portable purge below deletes exactly those. Taken after
; that purge it answered "not an install" as soon as the only survivor was a file ; that purge it answered "not an install" as soon as the only survivor was a file
; it does not look for - a locked abseil_dll.dll or libssl-3-x64.dll, say - and ; it does not look for - a locked abseil_dll.dll or libssl-3-x64.dll, say - and
; the abort further down was then skipped for the very directory the purge had ; the abort further down was then skipped for the very directory the purge had
; just failed in. ; just failed in.
; Remembered because the stale-runtime check below must only ever fire for a ; Remembered because the stale-runtime check below must only ever fire for a
; directory this installer recognised as a Cockatrice install. Scanning for ; directory this installer recognised as a Continuumatrice install. Scanning for
; leftovers in an unrelated directory (a first-time install into a folder that ; leftovers in an unrelated directory (a first-time install into a folder that
; happens to hold some Qt5 DLLs, say) would otherwise turn those files into an ; happens to hold some Qt5 DLLs, say) would otherwise turn those files into an
; abort reason even though the payload is about to overwrite nothing of theirs. ; abort reason even though the payload is about to overwrite nothing of theirs.
Call IsExistingCockatriceInstall Call IsExistingContinuumatriceInstall
!insertmacro CockLog "section: IsExistingCockatriceInstall=$R0" !insertmacro CockLog "section: IsExistingContinuumatriceInstall=$R0"
StrCpy $IsUpgrade $R0 StrCpy $IsUpgrade $R0
${If} $PortableMode = 1 ${If} $PortableMode = 1
@ -2332,9 +2332,9 @@ ${AndIf} ${FileExists} "$INSTDIR\portable.dat"
RMDir /r "$INSTDIR\plugins" RMDir /r "$INSTDIR\plugins"
RMDir /r "$INSTDIR\translations" RMDir /r "$INSTDIR\translations"
Delete "$INSTDIR\uninstall.exe" Delete "$INSTDIR\uninstall.exe"
Delete "$INSTDIR\cockatrice.exe" Delete "$INSTDIR\continuumatrice.exe"
Delete "$INSTDIR\oracle.exe" Delete "$INSTDIR\continuumatrice-legacy-oracle.exe"
Delete "$INSTDIR\servatrice.exe" Delete "$INSTDIR\continuum-servatrice.exe"
; Every top-level DLL, not a list of expected ones. The payload is written ; Every top-level DLL, not a list of expected ones. The payload is written
; after this block, so a DLL the new build still needs is put straight back; ; after this block, so a DLL the new build still needs is put straight back;
; what this has to guarantee is that nothing from the previous build is left ; what this has to guarantee is that nothing from the previous build is left
@ -2348,8 +2348,8 @@ ${AndIf} ${FileExists} "$INSTDIR\portable.dat"
StrCpy $DllPurgeRan 1 StrCpy $DllPurgeRan 1
Delete "$INSTDIR\qt.conf" Delete "$INSTDIR\qt.conf"
Delete "$INSTDIR\qdebug.txt" Delete "$INSTDIR\qdebug.txt"
Delete "$INSTDIR\servatrice.sql" Delete "$INSTDIR\continuum-servatrice.sql"
Delete "$INSTDIR\servatrice.ini.example" Delete "$INSTDIR\continuum-servatrice.ini.example"
RMDir "$INSTDIR" RMDir "$INSTDIR"
!insertmacro CockLogListing "after-portable-purge" "*.dll" !insertmacro CockLogListing "after-portable-purge" "*.dll"
${EndIf} ${EndIf}
@ -2427,7 +2427,7 @@ ${If} $StaleRuntimeAfterPurge = 1
Call LogStaleRuntimeDiagnostics Call LogStaleRuntimeDiagnostics
${If} $HolderFound = 1 ${If} $HolderFound = 1
; On /R the previous version is already uninstalled at this point, so an abort ; On /R the previous version is already uninstalled at this point, so an abort
; leaves the user with no working Cockatrice. It closes once, then offers to end ; leaves the user with no working Continuumatrice. It closes once, then offers to end
; what is left; this updates $StaleRuntimeAfterPurge with the verdict after that ; what is left; this updates $StaleRuntimeAfterPurge with the verdict after that
; close, or after the end when the user asked for one. ; close, or after the end when the user asked for one.
Call RecoverFromHolders Call RecoverFromHolders
@ -2452,7 +2452,7 @@ ${If} $StaleRuntimeAfterPurge = 1
; so "most likely still running" is no longer a fair guess and would send the user ; so "most likely still running" is no longer a fair guess and would send the user
; to close programs that are already closed. ; to close programs that are already closed.
StrCpy $AbortReason \ StrCpy $AbortReason \
"The installation could not remove all files of a previous version of Cockatrice, and was cancelled rather than leave a mismatched installation behind." "The installation could not remove all files of a previous version of Continuumatrice, and was cancelled rather than leave a mismatched installation behind."
${If} $HolderFound = 1 ${If} $HolderFound = 1
StrCpy $AbortReason "$AbortReason$\r$\n$\r$\nStill using the install directory:$\r$\n$HolderOutput$\r$\n$\r$\nClose them and run the installer again." StrCpy $AbortReason "$AbortReason$\r$\n$\r$\nStill using the install directory:$\r$\n$HolderOutput$\r$\n$\r$\nClose them and run the installer again."
${ElseIf} $HolderExit == "0" ${ElseIf} $HolderExit == "0"
@ -2461,7 +2461,7 @@ ${If} $StaleRuntimeAfterPurge = 1
; The check itself failed, so "no running program was found" would be a claim this ; The check itself failed, so "no running program was found" would be a claim this
; installer cannot make. Name the failure instead, and leave the per-file codes to ; installer cannot make. Name the failure instead, and leave the per-file codes to
; the log, where they already are. ; the log, where they already are.
StrCpy $AbortReason "$AbortReason$\r$\n$\r$\nThe check for a running program could not be completed: $HolderOutput$\r$\n$\r$\nClose Cockatrice, Oracle and Servatrice and run the installer again; the installer log records what Windows reported for each file." StrCpy $AbortReason "$AbortReason$\r$\n$\r$\nThe check for a running program could not be completed: $HolderOutput$\r$\n$\r$\nClose Continuumatrice, Oracle and Servatrice and run the installer again; the installer log records what Windows reported for each file."
${EndIf} ${EndIf}
; "Run the installer again" is not enough on an in-app update: the old version ; "Run the installer again" is not enough on an in-app update: the old version
; was uninstalled before the purge, so point at the installer that was downloaded. ; was uninstalled before the purge, so point at the installer that was downloaded.
@ -2494,39 +2494,37 @@ ${If} $PortableMode = 0
; dumps on user machines that nothing consumes. ; dumps on user machines that nothing consumes.
; https://learn.microsoft.com/en-us/windows/win32/wer/collecting-user-mode-dumps ; https://learn.microsoft.com/en-us/windows/win32/wer/collecting-user-mode-dumps
; Older installers did register cockatrice.exe above (and the removed ; Older installers did register continuumatrice.exe above (and the removed
; MiniDumpWithFullMemory writer filled that folder), and that key survives this ; MiniDumpWithFullMemory writer filled that folder), and that key survives this
; install, so WER would keep writing full dumps. Remove it, and clear the ; install, so WER would keep writing full dumps. Remove it, and clear the
; legacy dumps nothing consumes anymore. $LOCALAPPDATA resolves per shell context: ; legacy dumps nothing consumes anymore. $LOCALAPPDATA resolves per shell context:
; under "all" it points at ProgramData, so switch to "current" for the per-user ; under "all" it points at ProgramData, so switch to "current" for the per-user
; dumps folder and back afterwards; the registry delete works in either context. ; dumps folder and back afterwards; the registry delete works in either context.
DeleteRegKey HKLM "Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\cockatrice.exe" DeleteRegKey HKLM "Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\continuumatrice.exe"
SetShellVarContext current SetShellVarContext current
RMDir /r "$LOCALAPPDATA\CrashDumps\Cockatrice" RMDir /r "$LOCALAPPDATA\CrashDumps\Continuumatrice"
SetShellVarContext all SetShellVarContext all
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "DisplayIcon" "$INSTDIR\cockatrice.exe" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Continuumatrice" "DisplayIcon" "$INSTDIR\continuumatrice.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "DisplayName" "Cockatrice" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Continuumatrice" "DisplayName" "Continuumatrice"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "DisplayVersion" "@CPACK_PACKAGE_VERSION_MAJOR@.@CPACK_PACKAGE_VERSION_MINOR@.@CPACK_PACKAGE_VERSION_PATCH@" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Continuumatrice" "DisplayVersion" "@CPACK_PACKAGE_VERSION_MAJOR@.@CPACK_PACKAGE_VERSION_MINOR@.@CPACK_PACKAGE_VERSION_PATCH@"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "EstimatedSize" "$0" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Continuumatrice" "EstimatedSize" "$0"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "InstallLocation" "$INSTDIR" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Continuumatrice" "InstallLocation" "$INSTDIR"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "NoModify" "1" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Continuumatrice" "NoModify" "1"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "NoRepair" "1" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Continuumatrice" "NoRepair" "1"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "Publisher" "Cockatrice team" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Continuumatrice" "Publisher" "Continuum Universes Studio"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Continuumatrice" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Continuumatrice" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "VersionMajor" "@CPACK_PACKAGE_VERSION_MAJOR@" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Continuumatrice" "VersionMajor" "@CPACK_PACKAGE_VERSION_MAJOR@"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "VersionMinor" "@CPACK_PACKAGE_VERSION_MINOR@" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Continuumatrice" "VersionMinor" "@CPACK_PACKAGE_VERSION_MINOR@"
; --- Register .cod file type --- ; Continuumatrice deliberately does not register .cod, which belongs to
WriteRegStr HKCR ".cod" "" "Cockatrice" ; an independent Cockatrice MTG installation.
WriteRegStr HKCR "Cockatrice" "" "Cockatrice Deck File"
WriteRegStr HKCR "Cockatrice\shell\open\command" "" '"$INSTDIR\cockatrice.exe" "%1"'
; --- Register custom URI protocol --- ; --- Register custom URI protocol ---
WriteRegStr HKCR "cockatrice" "" "URL: Cockatrice Protocol" WriteRegStr HKCR "continuumatrice" "" "URL: Continuumatrice Protocol"
WriteRegStr HKCR "cockatrice" "URL Protocol" "" WriteRegStr HKCR "continuumatrice" "URL Protocol" ""
WriteRegStr HKCR "cockatrice\shell\open\command" "" '"$INSTDIR\cockatrice.exe" "%1"' WriteRegStr HKCR "continuumatrice\shell\open\command" "" '"$INSTDIR\continuumatrice.exe" "%1"'
IfFileExists "$INSTDIR\vc_redist.x86.exe" VcRedist86Exists PastVcRedist86Check IfFileExists "$INSTDIR\vc_redist.x86.exe" VcRedist86Exists PastVcRedist86Check
VcRedist86Exists: VcRedist86Exists:
@ -2552,8 +2550,8 @@ ${Else}
${EndIf} ${EndIf}
${If} $ReinstallMode = 1 ${If} $ReinstallMode = 1
IfFileExists "$INSTDIR\cockatrice.exe" 0 +2 IfFileExists "$INSTDIR\continuumatrice.exe" 0 +2
Exec '"$INSTDIR\cockatrice.exe"' Exec '"$INSTDIR\continuumatrice.exe"'
${EndIf} ${EndIf}
!insertmacro CockLog "section: application install complete" !insertmacro CockLog "section: application install complete"
@ -2562,10 +2560,8 @@ SectionEnd
Section "Start menu item" SecStartMenu Section "Start menu item" SecStartMenu
${If} $PortableMode = 0 ${If} $PortableMode = 0
SetShellVarContext all SetShellVarContext all
createDirectory "$SMPROGRAMS\Cockatrice" createDirectory "$SMPROGRAMS\Continuumatrice"
createShortCut "$SMPROGRAMS\Cockatrice\Cockatrice.lnk" "$INSTDIR\cockatrice.exe" createShortCut "$SMPROGRAMS\Continuumatrice\Continuumatrice.lnk" "$INSTDIR\continuumatrice.exe"
createShortCut "$SMPROGRAMS\Cockatrice\Oracle.lnk" "$INSTDIR\oracle.exe"
createShortCut "$SMPROGRAMS\Cockatrice\Servatrice.lnk" "$INSTDIR\servatrice.exe"
${EndIf} ${EndIf}
SectionEnd SectionEnd
@ -2600,48 +2596,41 @@ Section "un.Application" UnSecApplication
; Succeeds only when no foreign files remain. ; Succeeds only when no foreign files remain.
RMDir "$INSTDIR" RMDir "$INSTDIR"
RMDir /r "$SMPROGRAMS\Cockatrice" RMDir /r "$SMPROGRAMS\Continuumatrice"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Continuumatrice"
; Leftover WER LocalDumps key from pre-Sentry installers (see the installer note ; Leftover WER LocalDumps key from pre-Sentry installers (see the installer note
; above): removing it here covers machines that uninstall without reinstalling. ; above): removing it here covers machines that uninstall without reinstalling.
; The legacy full-memory dumps go with it; nothing consumes them anymore. Same shell ; The legacy full-memory dumps go with it; nothing consumes them anymore. Same shell
; context note as the installer: the per-user dumps folder needs "current". ; context note as the installer: the per-user dumps folder needs "current".
DeleteRegKey HKLM "Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\cockatrice.exe" DeleteRegKey HKLM "Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\continuumatrice.exe"
SetShellVarContext current SetShellVarContext current
RMDir /r "$LOCALAPPDATA\CrashDumps\Cockatrice" RMDir /r "$LOCALAPPDATA\CrashDumps\Continuumatrice"
SetShellVarContext all SetShellVarContext all
; Only remove the file/protocol associations if we registered them (i.e. the ; Remove only the Continuumatrice URI scheme. Never touch MTG .cod.
; install was not portable) and .cod is still owned by Cockatrice, so we don't
; clobber a .cod association installed by another application.
${If} $R1 == 0 ${If} $R1 == 0
ReadRegStr $0 HKCR ".cod" "" DeleteRegKey HKCR "continuumatrice"
${If} $0 == "Cockatrice"
DeleteRegKey HKCR ".cod"
DeleteRegKey HKCR "Cockatrice"
DeleteRegKey HKCR "cockatrice"
${EndIf}
${EndIf} ${EndIf}
SectionEnd SectionEnd
; unselected because it is /o ; unselected because it is /o
Section /o "un.Configurations, decks, cards, pics" UnSecConfiguration Section /o "un.Configurations, decks, cards, pics" UnSecConfiguration
SetShellVarContext current SetShellVarContext current
DeleteRegKey HKCU "Software\Cockatrice" DeleteRegKey HKCU "Software\Continuumatrice"
RMDir /r "$LOCALAPPDATA\Cockatrice" RMDir /r "$LOCALAPPDATA\Continuumatrice"
SectionEnd SectionEnd
LangString DESC_SecApplication ${LANG_ENGLISH} "Cockatrice program files" LangString DESC_SecApplication ${LANG_ENGLISH} "Continuumatrice program files"
LangString DESC_SecStartMenu ${LANG_ENGLISH} "Create start menu items for Cockatrice and Oracle." LangString DESC_SecStartMenu ${LANG_ENGLISH} "Create start menu items for Continuumatrice and Oracle."
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecApplication} $(DESC_SecApplication) !insertmacro MUI_DESCRIPTION_TEXT ${SecApplication} $(DESC_SecApplication)
!insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} $(DESC_SecStartMenu) !insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} $(DESC_SecStartMenu)
!insertmacro MUI_FUNCTION_DESCRIPTION_END !insertmacro MUI_FUNCTION_DESCRIPTION_END
LangString DESC_UnSecApplication ${LANG_ENGLISH} "Cockatrice program files and start menu items" LangString DESC_UnSecApplication ${LANG_ENGLISH} "Continuumatrice program files and start menu items"
LangString DESC_UnSecConfiguration ${LANG_ENGLISH} "Configurations, decks, card database, pictures" LangString DESC_UnSecConfiguration ${LANG_ENGLISH} "Configurations, decks, card database, pictures"
!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${UnSecApplication} $(DESC_UnSecApplication) !insertmacro MUI_DESCRIPTION_TEXT ${UnSecApplication} $(DESC_UnSecApplication)