Skip to content

Commit dd69781

Browse files
committed
Add NSIS Windows installer
License, user-install only and cleanups, mention in README
1 parent 1ec8c71 commit dd69781

File tree

4 files changed

+207
-15
lines changed

4 files changed

+207
-15
lines changed

.github/workflows/build.yml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ jobs:
6767
- name: "cmake"
6868
run: |
6969
cmake -S . -B build ${{ env.BUILD_FLAGS }} -DCMAKE_BUILD_TYPE=${{ env.BUILD_MODE }} -DCMAKE_C_COMPILER=/usr/bin/clang-15 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-15 -G Ninja -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja
70-
70+
7171
- name: "Build Cemu"
7272
run: |
7373
cmake --build build
74-
74+
7575
- name: Prepare artifact
7676
run: mv bin/Cemu_release bin/Cemu
77-
77+
7878
- name: Upload artifact
7979
uses: actions/upload-artifact@v4
8080
with:
@@ -138,7 +138,7 @@ jobs:
138138
- name: "Bootstrap vcpkg"
139139
run: |
140140
./dependencies/vcpkg/bootstrap-vcpkg.bat
141-
141+
142142
- name: 'Setup NuGet Credentials for vcpkg'
143143
shell: 'bash'
144144
run: |
@@ -152,29 +152,41 @@ jobs:
152152
`./dependencies/vcpkg/vcpkg.exe fetch nuget | tail -n 1` \
153153
setapikey "${{ secrets.GITHUB_TOKEN }}" \
154154
-source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
155-
155+
156156
- name: "cmake"
157157
run: |
158158
mkdir -p build
159159
cd build
160160
echo "[INFO] BUILD_FLAGS: ${{ env.BUILD_FLAGS }}"
161161
echo "[INFO] BUILD_MODE: ${{ env.BUILD_MODE }}"
162162
cmake .. ${{ env.BUILD_FLAGS }} -DCMAKE_BUILD_TYPE=${{ env.BUILD_MODE }} -DVCPKG_INSTALL_OPTIONS="--clean-after-build"
163-
163+
164164
- name: "Build Cemu"
165165
run: |
166166
cd build
167167
cmake --build . --config ${{ env.BUILD_MODE }}
168168
169169
- name: Prepare artifact
170170
run: Rename-Item bin/Cemu_release.exe Cemu.exe
171-
171+
172+
- name: Build NSIS Installer
173+
shell: cmd
174+
run: |
175+
cd src\resource
176+
makensis /DPRODUCT_VERSION=${{ inputs.next_version_major }}.${{ inputs.next_version_minor }} installer.nsi
177+
172178
- name: Upload artifact
173179
uses: actions/upload-artifact@v4
174180
with:
175181
name: cemu-bin-windows-x64
176182
path: ./bin/Cemu.exe
177183

184+
- name: Upload NSIS Installer
185+
uses: actions/upload-artifact@v4
186+
with:
187+
name: cemu-installer-windows-x64
188+
path: ./src/resource/cemu-${{ inputs.next_version_major }}.${{ inputs.next_version_minor }}-windows-x64-installer.exe
189+
178190
build-macos:
179191
runs-on: macos-14
180192
strategy:
@@ -185,7 +197,7 @@ jobs:
185197
uses: actions/checkout@v4
186198
with:
187199
submodules: "recursive"
188-
200+
189201
- name: Setup release mode parameters
190202
run: |
191203
echo "BUILD_MODE=release" >> $GITHUB_ENV
@@ -197,7 +209,7 @@ jobs:
197209
run: |
198210
echo "[INFO] Version ${{ inputs.next_version_major }}.${{ inputs.next_version_minor }}"
199211
echo "BUILD_FLAGS=${{ env.BUILD_FLAGS }} -DEMULATOR_VERSION_MAJOR=${{ inputs.next_version_major }} -DEMULATOR_VERSION_MINOR=${{ inputs.next_version_minor }}" >> $GITHUB_ENV
200-
212+
201213
- name: "Install system dependencies"
202214
run: |
203215
brew update
@@ -218,7 +230,7 @@ jobs:
218230
- name: "Bootstrap vcpkg"
219231
run: |
220232
bash ./dependencies/vcpkg/bootstrap-vcpkg.sh
221-
233+
222234
- name: 'Setup NuGet Credentials for vcpkg'
223235
shell: 'bash'
224236
run: |
@@ -232,7 +244,7 @@ jobs:
232244
mono `./dependencies/vcpkg/vcpkg fetch nuget | tail -n 1` \
233245
setapikey "${{ secrets.GITHUB_TOKEN }}" \
234246
-source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
235-
247+
236248
- name: "cmake"
237249
run: |
238250
mkdir build
@@ -242,7 +254,7 @@ jobs:
242254
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} \
243255
-DMACOS_BUNDLE=ON \
244256
-G Ninja
245-
257+
246258
- name: "Build Cemu"
247259
run: |
248260
cmake --build build
@@ -258,7 +270,7 @@ jobs:
258270
hdiutil create ./bin/tmp.dmg -ov -volname "Cemu" -fs HFS+ -srcfolder "./bin/Cemu_app"
259271
hdiutil convert ./bin/tmp.dmg -format UDZO -o bin/Cemu.dmg
260272
rm bin/tmp.dmg
261-
273+
262274
- name: Upload artifact
263275
uses: actions/upload-artifact@v4
264276
with:

.github/workflows/deploy_release.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ jobs:
9393
name: cemu-bin-windows-x64
9494
path: cemu-bin-windows-x64
9595

96+
- uses: actions/download-artifact@v4
97+
with:
98+
name: cemu-installer-windows-x64
99+
path: cemu-installer-windows-x64
100+
96101
- uses: actions/download-artifact@v4
97102
with:
98103
pattern: cemu-bin-macos*
@@ -102,7 +107,7 @@ jobs:
102107
run: |
103108
mkdir upload
104109
sudo apt install zip
105-
110+
106111
- name: Set version dependent vars
107112
run: |
108113
echo "Version: ${{ needs.calculate-version.outputs.next_version }}"
@@ -120,6 +125,9 @@ jobs:
120125
zip -9 -r upload/cemu-${{ env.CEMU_VERSION }}-windows-x64.zip ${{ env.CEMU_FOLDER_NAME }}
121126
rm -r ./${{ env.CEMU_FOLDER_NAME }}
122127
128+
- name: Create release from windows-installer
129+
run: cp cemu-installer-windows-x64/cemu-${{ env.CEMU_VERSION }}-windows-x64-installer.exe upload/cemu-${{ env.CEMU_VERSION }}-windows-x64-installer.exe
130+
123131
- name: Create appimage
124132
run: |
125133
VERSION=${{ env.CEMU_VERSION }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Cemu is currently only available for 64-bit Windows, Linux & macOS devices.
2626

2727
You can download the latest Cemu releases for Windows, Linux and Mac from the [GitHub Releases](https://github.com/cemu-project/Cemu/releases/). For Linux you can also find Cemu on [flathub](https://flathub.org/apps/info.cemu.Cemu).
2828

29-
On Windows Cemu is currently only available in a portable format so no installation is required besides extracting it in a safe place.
29+
On Windows, Cemu is available both as an installer and in a portable format, where no installation is required besides extracting it in a safe place.
3030

3131
The native macOS build is currently purely experimental and should not be considered stable or ready for issue-free gameplay. There are also known issues with degraded performance due to the use of MoltenVK and Rosetta for ARM Macs. We appreciate your patience while we improve Cemu for macOS.
3232

src/resource/installer.nsi

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
; Copyright Dolphin Emulator Project / Azahar Emulator Project / Team Cemu
2+
; Licensed under MPL 2.0 with permission from authors
3+
4+
; Usage:
5+
; get the latest nsis: https://nsis.sourceforge.io/Download
6+
; probably also want vscode extension: https://marketplace.visualstudio.com/items?itemName=idleberg.nsis
7+
8+
; Require /DPRODUCT_VERSION for makensis.
9+
!ifndef PRODUCT_VERSION
10+
!error "PRODUCT_VERSION must be defined"
11+
!endif
12+
13+
ManifestDPIAware true
14+
15+
!define PRODUCT_NAME "Cemu"
16+
!define PRODUCT_PUBLISHER "Team Cemu"
17+
!define PRODUCT_WEB_SITE "https://cemu.info/"
18+
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\${PRODUCT_NAME}.exe"
19+
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
20+
21+
!define BINARY_SOURCE_DIR "..\..\bin"
22+
23+
Name "${PRODUCT_NAME}"
24+
OutFile "cemu-${PRODUCT_VERSION}-windows-x64-installer.exe"
25+
SetCompressor /SOLID lzma
26+
InstallDir "$LOCALAPPDATA\Cemu"
27+
ShowInstDetails show
28+
ShowUnInstDetails show
29+
30+
!include "MUI2.nsh"
31+
; Custom page plugin
32+
!include "nsDialogs.nsh"
33+
34+
; MUI Settings
35+
!define MUI_ICON "logo_icon.ico"
36+
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
37+
38+
; License page
39+
!insertmacro MUI_PAGE_LICENSE "..\..\LICENSE.txt"
40+
; Desktop Shortcut page
41+
Page custom desktopShortcutPageCreate desktopShortcutPageLeave
42+
; Directory page
43+
!insertmacro MUI_PAGE_DIRECTORY
44+
; Instfiles page
45+
!insertmacro MUI_PAGE_INSTFILES
46+
; Finish page
47+
!define MUI_FINISHPAGE_RUN "$INSTDIR\Cemu.exe"
48+
!insertmacro MUI_PAGE_FINISH
49+
50+
; Uninstaller pages
51+
!insertmacro MUI_UNPAGE_INSTFILES
52+
53+
; Variables
54+
Var DesktopShortcutPageDialog
55+
Var DesktopShortcutCheckbox
56+
Var DesktopShortcut
57+
58+
; Language files
59+
!insertmacro MUI_LANGUAGE "English"
60+
!insertmacro MUI_LANGUAGE "SimpChinese"
61+
!insertmacro MUI_LANGUAGE "TradChinese"
62+
!insertmacro MUI_LANGUAGE "Danish"
63+
!insertmacro MUI_LANGUAGE "Dutch"
64+
!insertmacro MUI_LANGUAGE "French"
65+
!insertmacro MUI_LANGUAGE "German"
66+
!insertmacro MUI_LANGUAGE "Hungarian"
67+
!insertmacro MUI_LANGUAGE "Italian"
68+
!insertmacro MUI_LANGUAGE "Japanese"
69+
!insertmacro MUI_LANGUAGE "Korean"
70+
!insertmacro MUI_LANGUAGE "Lithuanian"
71+
!insertmacro MUI_LANGUAGE "Norwegian"
72+
!insertmacro MUI_LANGUAGE "Polish"
73+
!insertmacro MUI_LANGUAGE "PortugueseBR"
74+
!insertmacro MUI_LANGUAGE "Romanian"
75+
!insertmacro MUI_LANGUAGE "Russian"
76+
!insertmacro MUI_LANGUAGE "Spanish"
77+
!insertmacro MUI_LANGUAGE "Swedish"
78+
!insertmacro MUI_LANGUAGE "Turkish"
79+
!insertmacro MUI_LANGUAGE "Vietnamese"
80+
81+
; MUI end ------
82+
83+
Function .onInit
84+
StrCpy $DesktopShortcut 1
85+
86+
!insertmacro MUI_LANGDLL_DISPLAY
87+
FunctionEnd
88+
89+
Function desktopShortcutPageCreate
90+
!insertmacro MUI_HEADER_TEXT "Create Desktop Shortcut" "Would you like to create a desktop shortcut?"
91+
nsDialogs::Create 1018
92+
Pop $DesktopShortcutPageDialog
93+
${If} $DesktopShortcutPageDialog == error
94+
Abort
95+
${EndIf}
96+
97+
${NSD_CreateCheckbox} 0u 0u 100% 12u "Create a desktop shortcut"
98+
Pop $DesktopShortcutCheckbox
99+
${NSD_SetState} $DesktopShortcutCheckbox $DesktopShortcut
100+
101+
nsDialogs::Show
102+
FunctionEnd
103+
104+
Function desktopShortcutPageLeave
105+
${NSD_GetState} $DesktopShortcutCheckbox $DesktopShortcut
106+
FunctionEnd
107+
108+
Section "Base"
109+
ExecWait '"$INSTDIR\uninst.exe" /S _?=$INSTDIR'
110+
111+
SectionIn RO
112+
113+
SetOutPath "$INSTDIR"
114+
115+
; The binplaced build output will be included verbatim.
116+
File /r "${BINARY_SOURCE_DIR}\*"
117+
118+
; Create start menu and desktop shortcuts
119+
CreateShortCut "$SMPROGRAMS\$(^Name).lnk" "$INSTDIR\Cemu.exe"
120+
${If} $DesktopShortcut == 1
121+
CreateShortCut "$DESKTOP\$(^Name).lnk" "$INSTDIR\Cemu.exe"
122+
${EndIf}
123+
SectionEnd
124+
125+
!include "FileFunc.nsh"
126+
127+
Section -Post
128+
WriteUninstaller "$INSTDIR\uninst.exe"
129+
130+
WriteRegStr HKCU "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\Cemu.exe"
131+
132+
; Write metadata for add/remove programs applet
133+
WriteRegStr HKCU "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
134+
WriteRegStr HKCU "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
135+
WriteRegStr HKCU "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Cemu.exe"
136+
WriteRegStr HKCU "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
137+
WriteRegStr HKCU "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
138+
WriteRegStr HKCU "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR"
139+
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
140+
IntFmt $0 "0x%08X" $0
141+
WriteRegDWORD HKCU "${PRODUCT_UNINST_KEY}" "EstimatedSize" "$0"
142+
143+
WriteRegStr HKCU "Software\Classes\.wud" "" "$(^Name)"
144+
WriteRegStr HKCU "Software\Classes\.wux" "" "$(^Name)"
145+
WriteRegStr HKCU "Software\Classes\.wua" "" "$(^Name)"
146+
WriteRegStr HKCU "Software\Classes\$(^Name)\DefaultIcon" "" "$INSTDIR\Cemu.exe,0"
147+
WriteRegStr HKCU "Software\Classes\$(^Name)\Shell\open\command" "" '"$INSTDIR\Cemu.exe" %1'
148+
SectionEnd
149+
150+
Section Uninstall
151+
Delete "$DESKTOP\$(^Name).lnk"
152+
Delete "$SMPROGRAMS\$(^Name).lnk"
153+
154+
; Be a bit careful to not delete files a user may have put into the install directory
155+
Delete "$INSTDIR\Cemu.exe"
156+
Delete "$INSTDIR\uninst.exe"
157+
RMDir /r "$INSTDIR\gameProfiles"
158+
RMDir /r "$INSTDIR\resources"
159+
RMDir "$INSTDIR"
160+
161+
DeleteRegKey HKCU "Software\Classes\.wud"
162+
DeleteRegKey HKCU "Software\Classes\.wux"
163+
DeleteRegKey HKCU "Software\Classes\.wua"
164+
DeleteRegKey HKCU "Software\Classes\$(^Name)"
165+
166+
DeleteRegKey HKCU "Software\Classes\discord-460807638964371468"
167+
168+
DeleteRegKey HKCU "${PRODUCT_UNINST_KEY}"
169+
DeleteRegKey HKCU "${PRODUCT_DIR_REGKEY}"
170+
171+
SetAutoClose true
172+
SectionEnd

0 commit comments

Comments
 (0)