Skip to content

Commit

Permalink
Fix installer. Lower thread priority. Dynamically load DPIaware.
Browse files Browse the repository at this point in the history
  • Loading branch information
gcp committed Sep 29, 2016
1 parent d2e59d1 commit e328e62
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 12 deletions.
12 changes: 11 additions & 1 deletion App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ bool IsWindowsVistaOrHigher() {
return osvi.dwMajorVersion >= 6;
}

typedef BOOL (WINAPI *SetProcDPICall)(void);

IMPLEMENT_APP(MyApp);

bool MyApp::OnInit()
Expand All @@ -20,7 +22,15 @@ bool MyApp::OnInit()
bool dpiScale = wxConfig::Get()->Read(wxT("dpiscaleEnabled"), (long)0);
if (!dpiScale) {
if (IsWindowsVistaOrHigher()) {
SetProcessDPIAware();
HINSTANCE dllHandle = LoadLibrary(wxT("user32.dll"));
if (dllHandle) {
SetProcDPICall procDPI = (SetProcDPICall)GetProcAddress(
dllHandle, "SetProcessDPIAware");
if (procDPI) {
procDPI();
}
FreeLibrary(dllHandle);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions MainFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ void MainFrame::startEngine() {
if (m_engineThread->Create(1024 * 1024) != wxTHREAD_NO_ERROR) {
wxLogDebug("Error starting engine");
} else {
m_engineThread->SetPriority(wxPRIORITY_MIN);
// lock the board
if (!m_pondering && !m_analyzing) {
m_panelBoard->lockState();
Expand Down
34 changes: 23 additions & 11 deletions installer/Leela.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@

!if "${NSIS_PACKEDVERSION}" >= 0x3000000
Unicode true
ManifestDPIAware true
!endif

!searchparse "ver: ${VERSION}.0.0.0." "ver: " V1 . V2 . V3 . V4 .
!searchparse "ver: ${VERSION}...." "ver: " V1 . V2 . V3 . V4 .

!if "${V4}" != ""
!define VERSIONNAME "${VERSION}"
!else if "${V3}" != ""
!define VERSIONNAME "${V1}.${V2}.${V3}"
!else
!define VERSIONNAME "${V1}.${V2}"
!endif

;
; General options
Expand All @@ -27,17 +34,22 @@ Unicode true
ShowUninstDetails hide
ShowInstDetails hide
RequestExecutionLevel user
ManifestDPIAware true

!if "${V4}" != ""
OutFile "setupLeela${V1}${V2}${V3}${V4}.exe"
!else if "${V3}" != ""
OutFile "setupLeela${V1}${V2}${V3}.exe"
!else
OutFile "setupLeela${V1}${V2}.exe"
!endif


!include "MUI.nsh"
!include "MUI2.nsh"
!include "Sections.nsh"

;
; File info options
;
!searchparse "ver: ${VERSION}.0.0.0." "ver: " V1 . V2 . V3 . V4 .
VIProductVersion "${V1}.${V2}.${V3}.${V4}"
VIAddVersionKey "FileDescription" "Leela installer"
VIAddVersionKey "ProductName" "Leela"
Expand Down Expand Up @@ -123,9 +135,9 @@ Section "Leela" leela
File "bin\${LEELABIN}"
File "bin\libgcc_s_dw2-1.dll"
File "bin\libopenblas.dll"
File "license.rtf"
;File "bin\libgfortran-3.dll"
;File "bin\libquadmath-0.dll"
File "license.rtf"

;create desktop shortcut
CreateShortCut "$DESKTOP\Leela.lnk" "$INSTDIR\${LEELABIN}" ""
Expand Down Expand Up @@ -174,7 +186,7 @@ Section "-common" common
;create start menu shortcuts
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Leela Homepage.lnk" "$INSTDIR\Leela Homepage.url" \
"" "" 0 SW_SHOWNORMAL \
"" "https://sjeng.org/leela"
"" "https://www.sjeng.org/leela"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_END

Expand All @@ -200,9 +212,9 @@ Section "-common" common
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Leela" \
"NoRepair" 1
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Leela" \
"HelpLink" "http://www.sjeng.org"
"HelpLink" "https://www.sjeng.org"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Leela" \
"URLInfoAbout" "http://www.sjeng.org"
"URLInfoAbout" "https://www.sjeng.org"
SectionEnd

Function .onInit
Expand Down Expand Up @@ -234,11 +246,11 @@ Section "Uninstall"
Delete "$INSTDIR\${LEELAOCL}"
Delete "$INSTDIR\libgcc_s_dw2-1.dll"
Delete "$INSTDIR\libopenblas.dll"
;;Delete "$INSTDIR\libgfortran-3.dll"
;;Delete "$INSTDIR\libquadmath-0.dll"
;Delete "$INSTDIR\libgfortran-3.dll"
;Delete "$INSTDIR\libquadmath-0.dll"
Delete "$INSTDIR\OpenCL.dll"
Delete "$INSTDIR\Leela Homepage.url"
Delete "$INSTDIR\license.rtf"
Delete "$INSTDIR\license.rtf"
Delete "$INSTDIR\Uninstall.exe"

;Remove the installation directory
Expand Down

0 comments on commit e328e62

Please sign in to comment.