diff --git a/.github/workflows/windows-installers.yml b/.github/workflows/windows-installers.yml index 74536a9f993..6b28d5dcc43 100644 --- a/.github/workflows/windows-installers.yml +++ b/.github/workflows/windows-installers.yml @@ -2,97 +2,368 @@ name: Windows installers on: push: + pull_request: workflow_dispatch: permissions: contents: read jobs: - build-dosbox-x-windows-installers: - if: startsWith(github.ref, 'refs/tags/') + Visual_Studio_CI_build: permissions: actions: write # for styfle/cancel-workflow-action to cancel/stop running workflows contents: write # for actions/checkout to fetch code and softprops/action-gh-release runs-on: windows-latest - env: - GH_TOKEN: ${{ github.token }} defaults: run: - shell: bash + shell: pwsh steps: - name: Cancel previous runs uses: styfle/cancel-workflow-action@0.11.0 with: access_token: ${{ github.token }} - uses: actions/checkout@v3 - - name: Wait for new DOSBox-X release + - uses: microsoft/setup-msbuild@v1.3 + - name: Prepare Visual Studio builds shell: bash run: | - # Wait long enough to make sure the new release has been created and the Windows binaries have been built. - #MINUTES_WAIT=0 - #MINUTES_WAIT=45 - MINUTES_WAIT=120 - for minutes in `seq $MINUTES_WAIT`; do - sleep 60 - echo "Waiting: $minutes of $MINUTES_WAIT minutes" - done - - name: Get DOSBox-X Windows builds + #ls -1 vs/dosbox-x.vcxproj vs/freetype/builds/windows/vc2010/freetype.vcxproj vs/libpdcurses/libpdcurses.vcxproj vs/libpng/projects/vstudio/libpng/libpng.vcxproj vs/libpng/projects/vstudio/libpng/libpng.vcxproj vs/sdl/VisualC/SDL/SDL.vcxproj vs/sdl/VisualC/SDLmain/SDLmain.vcxproj vs/sdl2/VisualC/SDL/SDL.vcxproj vs/sdl2/VisualC/SDLmain/SDLmain.vcxproj vs/sdlnet/VisualC/SDL_net_VS2008.vcxproj vs/sdlnet/VisualC/SDL_net_VS2008.vcxproj vs/zlib/zlib/zlib.vcxproj | xargs sed -b -i 's/v142/v141/g;s/>10.010.0.22000.0> $GITHUB_ENV + export shortsha=`git show --format='%h' --no-patch` + export copyrightyear=`git show -s --format=%at | xargs -I# date -d @# +'%Y'` + export updatestr=`git show -s --format=%at | xargs -I# date -d @# +'%b %d, %Y %I:%M:%S%P'` + echo '/* auto generated */' > include/build_timestamp.h + echo "#define UPDATED_STR \"${updatestr}\"" >> include/build_timestamp.h + echo "#define GIT_COMMIT_HASH \"${shortsha}\"" >> include/build_timestamp.h + echo "#define COPYRIGHT_END_YEAR \"${copyrightyear}\"" >> include/build_timestamp.h + cat include/build_timestamp.h + - name: Build Visual Studio x86 SDL1 + shell: pwsh + run: | + msbuild -m vs/dosbox-x.sln -t:dosbox-x:Rebuild -p:Configuration=Release -p:Platform=Win32 + if (-not(Test-Path -Path bin\Win32\Release\dosbox-x.exe -PathType Leaf)) {exit 1} + #contrib\windows\installer\PatchPE.exe bin\Win32\Release\dosbox-x.exe + - name: Build Visual Studio x86 SDL2 + shell: pwsh + run: | + msbuild -m vs/dosbox-x.sln -t:dosbox-x:Rebuild -p:Configuration="Release SDL2" -p:Platform=Win32 + if (-not(Test-Path -Path bin\Win32\"Release SDL2"\dosbox-x.exe -PathType Leaf)) {exit 1} + #contrib\windows\installer\PatchPE.exe bin\Win32\"Release SDL2"\dosbox-x.exe + - name: Build Visual Studio x64 SDL1 + shell: pwsh + run: | + msbuild -m vs/dosbox-x.sln -t:dosbox-x:Rebuild -p:Configuration=Release -p:Platform=x64 + if (-not(Test-Path -Path bin\x64\Release\dosbox-x.exe -PathType Leaf)) {exit 1} + #contrib\windows\installer\PatchPE.exe bin\x64\Release\dosbox-x.exe + - name: Build Visual Studio x64 SDL2 + shell: pwsh + run: | + msbuild -m vs/dosbox-x.sln -t:dosbox-x:Rebuild -p:Configuration="Release SDL2" -p:Platform=x64 + if (-not(Test-Path -Path bin\x64\"Release SDL2"\dosbox-x.exe -PathType Leaf)) {exit 1} + #contrib\windows\installer\PatchPE.exe bin\x64\"Release SDL2"\dosbox-x.exe + - name: Build Visual Studio ARM64 SDL1 + shell: pwsh + run: | + msbuild -m vs/dosbox-x.sln -t:dosbox-x:Rebuild -p:Configuration=Release -p:Platform=ARM64 -p:PostBuildEventUseInBuild=false + if (-not(Test-Path -Path bin\ARM64\Release\dosbox-x.exe -PathType Leaf)) {exit 1} + - name: Build Visual Studio ARM64 SDL2 + shell: pwsh + run: | + msbuild -m vs/dosbox-x.sln -t:dosbox-x:Rebuild -p:Configuration="Release SDL2" -p:Platform=ARM64 -p:PostBuildEventUseInBuild=false + if (-not(Test-Path -Path bin\ARM64\"Release SDL2"\dosbox-x.exe -PathType Leaf)) {exit 1} + - name: Build Visual Studio ARM32 SDL1 + shell: pwsh + run: | + msbuild -m vs/dosbox-x.sln -t:dosbox-x:Rebuild -p:Configuration=Release -p:Platform=ARM -p:PostBuildEventUseInBuild=false + if (-not(Test-Path -Path bin\ARM\Release\dosbox-x.exe -PathType Leaf)) {exit 1} + - name: Build Visual Studio ARM32 SDL2 + shell: pwsh + run: | + msbuild -m vs/dosbox-x.sln -t:dosbox-x:Rebuild -p:Configuration="Release SDL2" -p:Platform=ARM -p:PostBuildEventUseInBuild=false + if (-not(Test-Path -Path bin\ARM\"Release SDL2"\dosbox-x.exe -PathType Leaf)) {exit 1} + - name: Package Visual Studio x86/x64 builds shell: bash run: | - DOSBOX_X_RELEASE=`gh release list -L1 | grep -o "....-..-.." | head -n 1 | sed -e "s/-/./g"` - echo "DOSBOX_X_RELEASE=$DOSBOX_X_RELEASE" >> $GITHUB_ENV - RELEASE_DIR="release/windows" - mkdir -p $RELEASE_DIR - cd $RELEASE_DIR - # Wait until all required DOSBox-X builds are available. - DOSBOX_BUILDS_AVAILABLE=false - while [ $DOSBOX_BUILDS_AVAILABLE != true ]; do - gh release download --skip-existing -p 'dosbox-x-mingw-win*.zip' -p 'dosbox-x-vsbuild-*.zip' - # Rename the files so that the date in the file name matches the release date. - DOSBOX_X_RELEASE_COMPACT=`echo ${DOSBOX_X_RELEASE} | sed -e "s/\.//g"` - for file in `ls dosbox-x-*.zip`; do - filename_ok=`echo $file | sed -e "s/-[0-9]\{8\}/-$DOSBOX_X_RELEASE_COMPACT/"` - if [ $file != $filename_ok ]; then - mv $file $filename_ok - fi - done - # Check if all required DOSBox-X builds are available. - DOSBOX_BUILDS_AVAILABLE=true - if [ `ls dosbox-x-vsbuild-win32-*.zip 1>/dev/null 2>&1; echo $?` != 0 ]; then DOSBOX_BUILDS_AVAILABLE=false; fi - if [ `ls dosbox-x-vsbuild-win64-*.zip 1>/dev/null 2>&1; echo $?` != 0 ]; then DOSBOX_BUILDS_AVAILABLE=false; fi - if [ `ls dosbox-x-vsbuild-arm32-*.zip 1>/dev/null 2>&1; echo $?` != 0 ]; then DOSBOX_BUILDS_AVAILABLE=false; fi - if [ `ls dosbox-x-vsbuild-arm64-*.zip 1>/dev/null 2>&1; echo $?` != 0 ]; then DOSBOX_BUILDS_AVAILABLE=false; fi - if [ `ls dosbox-x-mingw-win32-*.zip 1>/dev/null 2>&1; echo $?` != 0 ]; then DOSBOX_BUILDS_AVAILABLE=false; fi - if [ `ls dosbox-x-mingw-win64-*.zip 1>/dev/null 2>&1; echo $?` != 0 ]; then DOSBOX_BUILDS_AVAILABLE=false; fi - if [ $DOSBOX_BUILDS_AVAILABLE == false ]; then - echo "Waiting for DOSBox-X Windows builds to be uploaded to the latest release." - sleep 10 - fi - done - - name: Update installer configuration + top=`pwd` + $top/bin/x64/Release/dosbox-x.exe -tests -set waitonerror=false -set logfile=tests.log || (echo Unit test completed: failure && exit 1) + $top/bin/x64/"Release SDL2"/dosbox-x.exe -tests -set waitonerror=false -set logfile=tests.log || (echo Unit test completed: failure && exit 1) + $top/bin/Win32/Release/dosbox-x.exe -tests -set waitonerror=false -set logfile=tests.log || (echo Unit test completed: failure && exit 1) + $top/bin/Win32/"Release SDL2"/dosbox-x.exe -tests -set waitonerror=false -set logfile=tests.log || (echo Unit test completed: failure && exit 1) + mkdir -p $top/package/drivez + mkdir -p $top/package/scripts + mkdir -p $top/package/shaders + mkdir -p $top/package/glshaders + mkdir -p $top/package/languages + mkdir -p $top/vs-bin + sed -e 's/^\(output[ ]*=[ ]*\)default$/\1ttf/;s/^\(windowposition[ ]*=\)[ ]*-/\1 /;s/^\(file access tries[ ]*=[ ]*\)0$/\13/;s/^\(printoutput[ ]*=[ ]*\)png$/\1printer/;s/\(drive data rate limit[ ]*=[ ]*\)-1$/\10/' $top/dosbox-x.reference.conf>$top/package/dosbox-x.conf + cp $top/bin/Win32/Release/dosbox-x.exe $top/package/dosbox-x_x86_SDL1.exe + cp $top/bin/Win32/Release/dosbox-x.exe $top/vs-bin/dosbox-x_x86_SDL1.exe + cp $top/bin/Win32/"Release SDL2"/dosbox-x.exe $top/package/dosbox-x_x86_SDL2.exe + cp $top/bin/Win32/"Release SDL2"/dosbox-x.exe $top/vs-bin/dosbox-x_x86_SDL2.exe + cp $top/bin/x64/Release/dosbox-x.exe $top/package/dosbox-x_x64_SDL1.exe + cp $top/bin/x64/Release/dosbox-x.exe $top/vs-bin/dosbox-x_x64_SDL1.exe + cp $top/bin/x64/"Release SDL2"/dosbox-x.exe $top/package/dosbox-x_x64_SDL2.exe + cp $top/bin/x64/"Release SDL2"/dosbox-x.exe $top/vs-bin/dosbox-x_x64_SDL2.exe + cp $top/CHANGELOG $top/package/CHANGELOG.txt + cp $top/dosbox-x.reference.conf $top/package/dosbox-x.reference.conf + cp $top/dosbox-x.reference.full.conf $top/package/dosbox-x.reference.full.conf + cp $top/contrib/windows/installer/readme.txt $top/package/README.txt + cp $top/contrib/windows/installer/inpoutx64.dll $top/package/inpoutx64.dll + cp $top/contrib/windows/installer/inpout32.dll $top/package/inpout32.dll + cp $top/contrib/fonts/FREECG98.BMP $top/package/FREECG98.BMP + cp $top/contrib/fonts/wqy_1?pt.bdf $top/package/ + cp $top/contrib/fonts/Nouveau_IBM.ttf $top/package/Nouveau_IBM.ttf + cp $top/contrib/fonts/SarasaGothicFixed.ttf $top/package/SarasaGothicFixed.ttf + cp $top/contrib/windows/installer/drivez_readme.txt $top/package/drivez/readme.txt + cp $top/contrib/windows/installer/windows_explorer_context_menu*.bat $top/package/scripts/ + cp $top/contrib/windows/shaders/* $top/package/shaders/ + cp $top/contrib/glshaders/* $top/package/glshaders/ + cp $top/contrib/translations/*/*.lng $top/package/languages/ + cp $top/COPYING $top/package/COPYING + cd $top/package/ + $top/vs/tool/zip.exe -r -9 "$top/dosbox-x-vsbuild-win-x86_x64-${{ env.timestamp }}.zip" "*" + cd $top + ls -lg + - name: Upload preview package(VS x86/x64) + uses: actions/upload-artifact@v3.1.2 + with: + name: dosbox-x-vsbuild-win-x86_x64-${{ env.timestamp }} + path: ${{ github.workspace }}/package/ + - name: Package Visual Studio ARM 32/64-bit builds shell: bash run: | - APP_VERSION=${{ env.DOSBOX_X_RELEASE }} - sed -i "s/^#define MyAppVersion.*/#define MyAppVersion \"$APP_VERSION\"/" contrib/windows/installer/DOSBox-X-setup.iss - - name: Build DOSBox-X Windows installers - shell: pwsh + top=`pwd` + rm $top/package/dosbox-x_*.exe + cp $top/bin/ARM/Release/dosbox-x.exe $top/package/dosbox-x_ARM_SDL1.exe + cp $top/bin/ARM/Release/dosbox-x.exe $top/vs-bin/dosbox-x_ARM_SDL1.exe + cp $top/bin/ARM/"Release SDL2"/dosbox-x.exe $top/package/dosbox-x_ARM_SDL2.exe + cp $top/bin/ARM/"Release SDL2"/dosbox-x.exe $top/vs-bin/dosbox-x_ARM_SDL2.exe + cp $top/bin/ARM64/Release/dosbox-x.exe $top/package/dosbox-x_ARM64_SDL1.exe + cp $top/bin/ARM64/Release/dosbox-x.exe $top/vs-bin/dosbox-x_ARM64_SDL1.exe + cp $top/bin/ARM64/"Release SDL2"/dosbox-x.exe $top/package/dosbox-x_ARM64_SDL2.exe + cp $top/bin/ARM64/"Release SDL2"/dosbox-x.exe $top/vs-bin/dosbox-x_ARM64_SDL2.exe + cd $top/package/ + $top/vs/tool/zip.exe -r -9 "$top/dosbox-x-vsbuild-ARM32_64-${{ env.timestamp }}.zip" "*" + cd $top + - name: Upload preview package(ARM 32/64-bit) + uses: actions/upload-artifact@v3.1.2 + with: + name: dosbox-x-vsbuild-ARM32_64-${{ env.timestamp }} + path: ${{ github.workspace }}/package/ + - name: Cache Visual Studio builds + uses: actions/cache/save@v3 + with: + path: ${{ github.workspace }}/vs-bin + key: vs-${{ github.sha }} + MinGW32_CI_build: + permissions: + actions: write # for styfle/cancel-workflow-action to cancel/stop running workflows + contents: write # for actions/checkout to fetch code and softprops/action-gh-release + runs-on: windows-latest + defaults: + run: + shell: msys2 {0} + steps: + - name: Cancel previous runs + uses: styfle/cancel-workflow-action@0.11.0 + with: + access_token: ${{ github.token }} + - uses: actions/checkout@v3 + - uses: msys2/setup-msys2@v2 + with: + msystem: MINGW32 + update: true + install: git mingw-w64-i686-toolchain mingw-w64-i686-libslirp mingw-w64-i686-libtool mingw-w64-i686-nasm autoconf automake + - name: Update build info + shell: bash + run: | + echo "timestamp=`git show -s --format=%at | xargs -I# date -d @# +%Y%m%d%H%M%S`" >> $GITHUB_ENV + export shortsha=`git show --format='%h' --no-patch` + export copyrightyear=`git show -s --format=%at | xargs -I# date -d @# +'%Y'` + export updatestr=`git show -s --format=%at | xargs -I# date -d @# +'%b %d, %Y %I:%M:%S%P'` + echo '/* auto generated */' > include/build_timestamp.h + echo "#define UPDATED_STR \"${updatestr}\"" >> include/build_timestamp.h + echo "#define GIT_COMMIT_HASH \"${shortsha}\"" >> include/build_timestamp.h + echo "#define COPYRIGHT_END_YEAR \"${copyrightyear}\"" >> include/build_timestamp.h + cat include/build_timestamp.h + - name: Build MinGW32 SDL1 + run: | + top=`pwd` + ln -s $top/build-scripts/mingw/lowend-bin/make.exe /usr/bin/make.exe + ./build-mingw + strip -s $top/src/dosbox-x.exe + mkdir -p $top/package/ + mkdir -p $top/mingw-x86-bin/ + cp $top/src/dosbox-x.exe $top/package/dosbox-x_MinGWx86_SDL1.exe + cp $top/src/dosbox-x.exe $top/mingw-x86-bin/dosbox-x_MinGWx86_SDL1.exe + - name: Build MinGW32 SDL2 run: | - $INSTALLER_DATE = echo ${{ env.DOSBOX_X_RELEASE }} | % { $_ -replace '\.', '' } - .\build_windows_installer.bat $INSTALLER_DATE - - name: Upload DOSBox-X Windows 32 bit installer - uses: actions/upload-artifact@v3 + top=`pwd` + ./build-mingw-sdl2 + strip -s $top/src/dosbox-x.exe + cp $top/src/dosbox-x.exe $top/package/dosbox-x_MinGWx86_SDL2.exe + cp $top/src/dosbox-x.exe $top/mingw-x86-bin/dosbox-x_MinGWx86_SDL2.exe + - name: Cache MinGW x86 builds + uses: actions/cache/save@v3 with: - name: dosbox-x-win32-${{ env.DOSBOX_X_RELEASE }}-setup.exe - path: release/windows/dosbox-x-win32-${{ env.DOSBOX_X_RELEASE }}-setup.exe - - name: Upload DOSBox-X Windows 64 bit installer - uses: actions/upload-artifact@v3 + path: ${{ github.workspace }}/mingw-x86-bin + key: mingw-x86-bin-${{ github.sha }} + MinGW64_CI_build: + permissions: + actions: write # for styfle/cancel-workflow-action to cancel/stop running workflows + contents: write # for actions/checkout to fetch code and softprops/action-gh-release + runs-on: windows-latest + defaults: + run: + shell: msys2 {0} + steps: + - name: Cancel previous runs + uses: styfle/cancel-workflow-action@0.11.0 with: - name: dosbox-x-win64-${{ env.DOSBOX_X_RELEASE }}-setup.exe - path: release/windows/dosbox-x-win64-${{ env.DOSBOX_X_RELEASE }}-setup.exe - - name: Upload release packages + access_token: ${{ github.token }} + - uses: actions/checkout@v3 + - uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: git mingw-w64-x86_64-toolchain mingw-w64-x86_64-libslirp mingw-w64-x86_64-libtool mingw-w64-x86_64-nasm autoconf automake + - name: Update build info + shell: bash + run: | + echo "timestamp=`git show -s --format=%at | xargs -I# date -d @# +%Y%m%d%H%M%S`" >> $GITHUB_ENV + export shortsha=`git show --format='%h' --no-patch` + export copyrightyear=`git show -s --format=%at | xargs -I# date -d @# +'%Y'` + export updatestr=`git show -s --format=%at | xargs -I# date -d @# +'%b %d, %Y %I:%M:%S%P'` + echo '/* auto generated */' > include/build_timestamp.h + echo "#define UPDATED_STR \"${updatestr}\"" >> include/build_timestamp.h + echo "#define GIT_COMMIT_HASH \"${shortsha}\"" >> include/build_timestamp.h + echo "#define COPYRIGHT_END_YEAR \"${copyrightyear}\"" >> include/build_timestamp.h + cat include/build_timestamp.h + - name: Build MinGW64 SDL1 + run: | + top=`pwd` + ln -s $top/build-scripts/mingw/lowend-bin/make.exe /usr/bin/make.exe + ./build-mingw + strip -s $top/src/dosbox-x.exe + mkdir -p $top/package/ + mkdir -p $top/mingw-x64-bin/ + cp $top/src/dosbox-x.exe $top/package/dosbox-x_MinGWx64_SDL1.exe + cp $top/src/dosbox-x.exe $top/mingw-x64-bin/dosbox-x_MinGWx64_SDL1.exe + - name: Build MinGW64 SDL2 + run: | + top=`pwd` + ./build-mingw-sdl2 + strip -s $top/src/dosbox-x.exe + cp $top/src/dosbox-x.exe $top/package/dosbox-x_MinGWx64_SDL2.exe + cp $top/src/dosbox-x.exe $top/mingw-x64-bin/dosbox-x_MinGWx64_SDL2.exe + - name: Cache MinGW x64 builds + uses: actions/cache/save@v3 + with: + path: ${{ github.workspace }}/mingw-x64-bin + key: mingw-x64-bin-${{ github.sha }} + Build_Windows_Installer: + permissions: + actions: write # for styfle/cancel-workflow-action to cancel/stop running workflows + contents: write # for actions/checkout to fetch code and softprops/action-gh-release + runs-on: windows-latest + needs: [MinGW32_CI_build, MinGW64_CI_build, Visual_Studio_CI_build] + env: + GH_TOKEN: ${{ github.token }} + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@v3 + - name: Restore MinGW x86 builds + uses: actions/cache/restore@v3 + with: + path: ${{ github.workspace }}/mingw-x86-bin + key: mingw-x86-bin-${{ github.sha }} + - name: Restore MinGW x64 builds + uses: actions/cache/restore@v3 + with: + path: ${{ github.workspace }}/mingw-x64-bin + key: mingw-x64-bin-${{ github.sha }} + - name: Restore Visual Studio builds + uses: actions/cache/restore@v3 + with: + path: ${{ github.workspace }}/vs-bin + key: vs-${{ github.sha }} + - name: Package MinGW builds + run: | + set +e + top=`pwd` + echo "timestamp=`git show -s --format=%at | xargs -I# date -d @# +%Y%m%d%H%M%S`" >> $GITHUB_ENV + mkdir -p $top/package/drivez + mkdir -p $top/package/scripts + mkdir -p $top/package/shaders + mkdir -p $top/package/glshaders + mkdir -p $top/package/languages + sed -e 's/^\(output[ ]*=[ ]*\)default$/\1ttf/;s/^\(windowposition[ ]*=\)[ ]*-/\1 /;s/^\(file access tries[ ]*=[ ]*\)0$/\13/;s/^\(printoutput[ ]*=[ ]*\)png$/\1printer/;s/\(drive data rate limit[ ]*=[ ]*\)-1$/\10/' $top/dosbox-x.reference.conf>$top/package/dosbox-x.conf + cp mingw-x86-bin/*.exe $top/package/ + cp mingw-x64-bin/*.exe $top/package/ + cp $top/CHANGELOG $top/package/CHANGELOG.txt + cp $top/dosbox-x.reference.conf $top/package/dosbox-x.reference.conf + cp $top/dosbox-x.reference.full.conf $top/package/dosbox-x.reference.full.conf + cp $top/contrib/windows/installer/readme.txt $top/package/README.txt + cp $top/contrib/windows/installer/inpoutx64.dll $top/package/inpoutx64.dll + cp $top/contrib/windows/installer/inpout32.dll $top/package/inpout32.dll + cp $top/contrib/fonts/FREECG98.BMP $top/package/FREECG98.BMP + cp $top/contrib/fonts/wqy_1?pt.bdf $top/package/ + cp $top/contrib/fonts/Nouveau_IBM.ttf $top/package/Nouveau_IBM.ttf + cp $top/contrib/fonts/SarasaGothicFixed.ttf $top/package/SarasaGothicFixed.ttf + cp $top/contrib/windows/installer/drivez_readme.txt $top/package/drivez/readme.txt + cp $top/contrib/windows/installer/windows_explorer_context_menu*.bat $top/package/scripts/ + cp $top/contrib/windows/shaders/* $top/package/shaders/ + cp $top/contrib/glshaders/* $top/package/glshaders/ + cp $top/contrib/translations/*/*.lng $top/package/languages/ + cp $top/COPYING $top/package/COPYING + cd $top/package/ + cd $top + - name: Upload preview package (MinGW) + uses: actions/upload-artifact@v3.1.2 + with: + name: dosbox-x-mingw-x86_x64-${{ env.timestamp }} + path: ${{ github.workspace }}/package/ + - name: Update release version + if: startsWith(github.ref, 'refs/tags/') + shell: bash + run: | + DOSBOX_X_RELEASE=`gh release list -L1 | grep -o "....-..-.." | head -n 1 | sed -e "s/-/./g"` + sed -i "s/^#define MyAppVersion.*/#define MyAppVersion \"$DOSBOX_X_RELEASE\"/" contrib/windows/installer/DOSBox-X-installer.iss + - name: Prepare files + shell: bash + run: | + set +e + cp dosbox-*.conf contrib/windows/installer/ + #ls -lg vs-bin + #ls -lg mingw-x64-bin + #ls -lg mingw-x86-bin + mkdir -p contrib/windows/installer/windows + cp vs-bin/*.exe contrib/windows/installer/windows/ + cp mingw-x86-bin/*.exe contrib/windows/installer/windows/ + cp mingw-x64-bin/*.exe contrib/windows/installer/windows/ + ls -lg contrib/windows/installer/windows + cd contrib/windows/installer/ + ISCC.exe ./DOSBox-X-installer.iss + - name: Upload preview installer + uses: actions/upload-artifact@v3.1.2 + with: + name: dosbox-x-windows-${{ env.timestamp }}-setup.exe + path: contrib/windows/installer/dosbox-x-windows*.exe + - name: Upload Windows build installer release version uses: softprops/action-gh-release@v1 if: startsWith(github.ref, 'refs/tags/') with: files: | - release/windows/dosbox-x-win32-${{ env.DOSBOX_X_RELEASE }}-setup.exe - release/windows/dosbox-x-win64-${{ env.DOSBOX_X_RELEASE }}-setup.exe - + contrib/windows/installer/dosbox-x-windows*.exe + - name: Clean cache + run: | + gh extension install actions/gh-actions-cache + ## need permission? disable the following lines if error occurs when deleting cache + set +e + gh actions-cache delete mingw-x86-bin-${{ github.sha }} --confirm + gh actions-cache delete mingw-x64-bin-${{ github.sha }} --confirm + gh actions-cache delete vs-${{ github.sha }} --confirm + gh actions-cache list + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG b/CHANGELOG index ec176603d73..1e7a7d0964f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -43,6 +43,10 @@ Next - Enhanced Dynamic and Differencing VHD support #4273 (maxpat78) - Imported IBM Music Feature Card support from DOSBox Staging. (Allofich) - Fix IMGMAKE large size image error on MinGW builds (maron2000) + - Set usescancodes=true when non-US keyboards are detected. (Linux / MacOS + builds) (maron2000) + - Fix day of week detection (INT 21h 0x2Ah). (maron2000) + - Refine KEYB and CHCP command (maron2000) 2023.05.01 - IMGMAKE will choose LBA partition types for 2GB or larger disk images, but the user can also use -chs and -lba options to override diff --git a/contrib/translations/zh/zh_TW.lng b/contrib/translations/zh/zh_TW.lng index c0b2ddf35b7..0e942fa0bde 100644 --- a/contrib/translations/zh/zh_TW.lng +++ b/contrib/translations/zh/zh_TW.lng @@ -306,7 +306,7 @@ DOSBox-X 命令列組態工具. 支援的選項有: -wc (或 -writeconf) 不加參數時: 寫入已載入的主組態檔案. -wc (或 -writeconf) 加檔名: 寫入設定目錄中的組態檔案. -wl (或 -writelang) 加檔名: 將目前的語言字串寫入檔案. --ln (或 -langname) 顯示 (不加參數時) 或指定語言名稱. +-ln (或 -langname) 顯示 (不加引數時) 或指定語言名稱. -wcp [檔名] 將組態檔案寫入程式目錄 (dosbox-x.conf 或指定檔名). -wcd 寫入設定目錄中的預設組態檔案. -all, -mod 與 -wc, -wcp, 或 -wcd 一起使用以寫入「所有的」或者修改過的組態選項. @@ -516,7 +516,7 @@ MOUSE [/?] [/U] [/V] -usecd [光碟機編號] 支援直接硬體模擬比如 CD 音訊播放. -ioctl 使用最低階的硬體存取 (與 -usecd 選項一起使用). -aspi 使用已安裝的 ASPI 層 (與 -usecd 選項一起使用). - -freesize [大小] 指定磁碟機中的剩餘磁碟空間 (單位: MB, 或軟碟: KB). + -freesize [大小] 指定磁碟機中的剩餘磁碟空間 MB 數 (軟式磁碟機為 KB 數). -nocachedir 啟用即時更新而不使用磁碟機快取. -z 磁碟機 將虛擬磁碟機 Z: 移動到另一個磁碟機代號. -o 將磁碟機報告為: local, remote. @@ -624,7 +624,7 @@ LOADFIX -f [-xms] [-ems] -xms 於延伸記憶體 (XMS) 配置用量而不是主記憶體 -ems 於擴充記憶體 (EMS) 配置用量而不是主記憶體 - -{記憶體用量} 指定要配置的記憶體用量 (單位: KB) + -{記憶體用量} 指定要配置的記憶體用量 KB 數 主記憶體預設為 64KB; XMS/EMS 記憶體預設為 1MB -a 自動配置足夠的用量佔滿主記憶體最低層 64KB 位址 -f (或 -d) 釋放先前配置的記憶體用量 @@ -901,6 +901,10 @@ leading colon write protect image = true :PROGRAM_BOOT_UNABLE 無法從磁碟機 %c 開機. +. +:PROGRAM_BOOT_IMAGE_MOUNTED +軟碟映像檔已掛載. + . :PROGRAM_BOOT_IMAGE_OPEN 正在開啟映像檔: %s @@ -919,6 +923,9 @@ leading colon write protect image = true :PROGRAM_BOOT_CART_NO_CMDS 找不到 PCjr cartridge commandos . +:PROGRAM_BOOT_BOOTING +從磁碟機開機 +. :PROGRAM_LOADROM_HELP 載入指定的影像 BIOS 或 IBM BASIC ROM 映像檔. @@ -999,14 +1006,11 @@ BIOSTEST 映像檔 無法載入指定的映像檔. 請檢查路徑是否正確以及映像檔是否可以存取. -. -:PROGRAM_IMGMOUNT_DYNAMIC_VHD_UNSUPPORTED -不支援動態 VHD 檔案. - . :PROGRAM_IMGMOUNT_INVALID_GEOMETRY 無法獲得映像檔中的磁碟機版面. -請使用參數 -size 每一磁區佔用的位元組數,磁區數,磁頭數,磁柱數 指定磁碟機版面. +請使用參數 -size 每個磁區的位元組數,每個磁柱的磁區數,每個磁柱的磁頭數,磁柱總數 +指定磁碟機版面. . :PROGRAM_IMGMOUNT_AUTODET_VALUES @@ -1084,7 +1088,7 @@ BIOSTEST 映像檔 -fs none 不檢測檔案系統 (提供磁碟機編號時自動假設). -reservecyl 數字 在 BIOS 中報告使用比實際更少的磁柱數目. -ide 控制器 指定 IDE 控制器 (1m, 1s, 2m, 2s) 以掛載磁碟機. - -size size|ss,s,h,c 指定大小 (單位: KB), 或磁區大小和 CHS 版面. + -size size|ss,s,h,c 指定大小 KB 數, 或磁區大小和 CHS 版面. -bootcd 光碟機代號 指定載入開機磁片映像所用的光碟機代號. -o partidx=數字 指定要掛載為磁碟機的硬碟分割區編號. -ro 以唯讀模式掛載映像檔 (或用 ':' 首碼表示唯讀). @@ -1115,18 +1119,18 @@ BIOSTEST 映像檔 . :PROGRAM_IMGMAKE_SYNTAX 建立軟碟或硬碟映像檔. -用法: IMGMAKE [檔案] [-t 類型] [[-size 大小] | [-chs 版面]] [-spc] [-nofs] +用法: IMGMAKE [檔案] [-t 類型] [[-size 容量大小] | [-chs 版面]] [-spc] [-nofs] [-bat] [-fat] [-fatcopies] [-rootdir] [-force] [-source 來源] [-retries 數字] 檔案: 要建立的映像檔 (如未指定將使用 IMGMAKE.IMG) - 路徑為主機系統路徑 -t: 映像檔類型. - 軟碟範本 (名稱為以 KB 為單位的軟碟大小或者 fd=fd_1440): + 軟碟範本 (列出名稱之數字為磁片的大小 KB 數, 或者 fd=fd_1440): fd_160 fd_180 fd_200 fd_320 fd_360 fd_400 fd_720 fd_1200 fd_1440 fd_2880 硬碟範本: hd_250: 250MB 映像檔, hd_520: 520MB 映像檔, hd_1gig: 1GB 映像檔 hd_2gig: 2GB 映像檔, hd_4gig: 4GB 映像檔, hd_8gig: 8GB 映像檔 hd_st251: 40MB 映像檔, hd_st225: 20MB 映像檔 (舊磁碟機版面) - 自訂硬碟映像檔: hd (需要 -size 或 -chs 選項) - -size: 自訂硬碟映像檔大小 (單位: MB). + 自訂的硬碟映像: hd vhd (需要 -size 或 -chs) + -size: 自訂硬碟映像的大小 MB 數 (vhd: 上限 2088960). -chs: CHS 磁碟版面: 磁柱(1-1023),磁頭(1-255),磁區(1-63). -nofs: 如果想建立空白映像檔請加入此參數. -force: 強制覆寫已存在的映像檔. @@ -1145,6 +1149,7 @@ BIOSTEST 映像檔 IMGMAKE -t fd - 建立 1.44MB 軟碟映像檔 IMGMAKE.IMG IMGMAKE -t fd_1440 -force - 強制建立軟碟映像檔 IMGMAKE.IMG IMGMAKE dos.img -t fd_2880 - 建立 2.88MB 軟碟映像檔 dos.img + IMGMAKE new.vhd -t vhd -size 520- 建立 520MB 動態擴充的 VHD 檔案 new.vhd IMGMAKE c:\disk.img -t hd -size 50 - 建立 50MB 硬碟映像檔 c:\disk.img IMGMAKE c:\disk.img -t hd_520 -nofs - 建立 520MB 空白硬碟映像檔 IMGMAKE c:\disk.img -t hd_2gig -fat 32 - 建立 2GB FAT32 硬碟映像檔 @@ -1182,6 +1187,10 @@ BIOSTEST 映像檔 無法讀取軟碟. +. +:PROGRAM_IMGMAKE_BADSIZE +錯誤的 -size 或 -chs 引數. + . :PROGRAM_KEYB_INFO 字碼頁 %i 已載入 @@ -1247,105 +1256,105 @@ BIOSTEST 映像檔 . :PROGRAM_VHDMAKE_WRITERR -Could not write to new VHD image "%s", aborting. +不能寫入到新的 VHD 映像檔 "%s", 中止程序. . :PROGRAM_VHDMAKE_REMOVEERR -Could not erase file "%s" +不能清除檔案 "%s" . :PROGRAM_VHDMAKE_RENAME -You'll have to manually rename the newly created VHD image. +您必須將新建立好的 VHD 映像檔手動改名. . :PROGRAM_VHDMAKE_SUCCESS -New VHD image succesfully created. You can mount it with IMGMOUNT. +新的 VHD 映像檔成功建立. 您可以使用 IMGMOUNT 來掛載. . :PROGRAM_VHDMAKE_ERROPEN -Error, could not open image file "%s". +錯誤, 不能開啟映像檔 "%s". . :PROGRAM_VHDMAKE_BADSIZE -Bad VHD size specified, aborting! +指定的 VHD 大小錯誤, 中止程序! . :PROGRAM_VHDMAKE_FNEEDED -A pre-existing VHD image can't be silently overwritten without -f option! +未使用 -f 選項, 先前存在的 VHD 映像檔不能無訊息覆寫! . :PROGRAM_VHDMAKE_BADPARENT -The parent VHD image "%s" can't be opened for linking, aborting! +父系 VHD 映像檔 "%s" 不能開啟並鏈結, 中止程序! . :PROGRAM_VHDMAKE_NOINFO -Couldn't query info for "%s". +不能查詢到 "%s" 的資訊. . :PROGRAM_VHDMAKE_BLOCKSTATS -with %d/%d blocks allocated. +已配置的區塊數 %d/%d. . :PROGRAM_VHDMAKE_INFO -VHD "%s" type is %s. -Its virtual size is %.02f MB +VHD "%s" 的類型是 %s. +此虛擬硬碟的大小是 %.02f MB . :PROGRAM_VHDMAKE_CANTMERGE -%s is not a Differencing disk, can't merge! +%s 不是差異磁碟, 不能合併! . :PROGRAM_VHDMAKE_MERGEREPORT -%d sectors in %d blocks from "%s" merged into "%s". +%d 個磁區於 %d 個區塊, 已從 "%s" 合併至 "%s". . :PROGRAM_VHDMAKE_MERGENODELETE -Couldn't remove snapshot "%s", you'll have to do it yourself! +不能移除快照 "%s", 你得必須自己動手移除! . :PROGRAM_VHDMAKE_MERGEOKDELETE -Snapshot VHD merged and deleted. +快照 VHD 已合併且已刪除. . :PROGRAM_VHDMAKE_MERGEFAILED -Failure while merging, aborted! +合併過程失敗, 中止程序! . :PROGRAM_VHDMAKE_MERGEWARNCORRUPTION -Parent "%s" contents could be corrupted! +父磁碟 "%s" 內容可能已毀損! . :PROGRAM_VHDMAKE_ABSPATH_WIN -Warning: an absolute path to parent limits portability to Windows. -Please prefer a path relative to differencing image file! +警告: 鏈結至父磁碟的絕對路徑在 Windows 上限制了檔案可攜性. +請優先選擇相對路徑給差異映像檔! . :PROGRAM_VHDMAKE_ABSPATH_UX -ERROR: an absolute path to parent inhibits portability. -Use a path relative to differencing image file! +錯誤: 鏈結至父磁碟的絕對路徑禁止了檔案可攜性. +要使用相對路徑給差異映像檔! . :PROGRAM_VHDMAKE_HELP -Creates Dynamic or Differencing VHD images, or converts raw images -into Fixed VHD. +建立動態擴充或差異的 VHD 映像檔, 或將原始映像轉成大小固定的 VHD. VHDMAKE [-f] new.vhd size[BKMGT] VHDMAKE -convert raw.hdd new.vhd VHDMAKE [-f] -link parent.vhd new.vhd VHDMAKE -merge delta.vhd VHDMAKE -info a.vhd - -c | -convert convert a raw hd image to Fixed VHD, renaming it to new.vhd - -l | -link create a new Differencing VHD new.vhd and link it to the - pre-existing parent image parent.vhd - -f | -force force overwriting a pre-existing image file - -i | -info show useful informations about a.vhd image - -m | -merge merge differencing delta.vhd to its parent - new.vhd name of the new Dynamic VHD image to create - size disk size (eventually with size unit, Bytes is implicit) -When converting a raw disk image to Fixed VHD, it has to be partitioned with -MBR scheme and formatted with FAT format. -When creating a Dynamic VHD, its size must range from 3 MB to 2040 GB. -The Dynamic VHD created is not partitioned nor formatted: to directly mount to -a drive letter with IMGMOUNT, please consider using IMGMAKE instead. -A merged snapshot VHD is automatically deleted if merge is successful. + -c | -convert 將原始硬碟映像檔轉成大小固定的 VHD, 並改名為 new.vhd + -l | -link 建立一個新的差異 VHD new.vhd, 並鏈結至先前存在的父系 + 映像檔 parent.vhd + -f | -force 強制覆寫先前存在的映像檔 + -i | -info 顯示關於 a.vhd 映像檔的實用資訊 + -m | -merge 將差異 delta.vhd 的變化合併到它的父磁碟 + new.vhd 建立新的動態擴充 VHD 映像檔名稱 + size 磁碟大小 (最後面加上大小單位, 位元組 B 隱含在裡面) +當轉換一個原始磁碟映像到大小固定的 VHD, 這個磁碟映像必須以 MBR 配置分割, +並且用 FAT 格式來格式化. +當建立一個動態擴充 VHD, 它的大小必須介在 3 MB 到 2040 GB. +已建立好的動態擴充 VHD 沒有經過分割也沒有格式化: 直接用 IMGMOUNT +掛載到一個磁碟機代號, 也請考慮改成用 IMGMAKE 製作. +如果合併作業成功, 會自動刪除已被合併的快照 VHD. + . :SHELL_CMD_TREE_ERROR 不存在子目錄 @@ -1999,16 +2008,16 @@ CALL [磁碟機:][路徑]檔名 [批次處理參數] . :SHELL_CMD_SUBST_HELP -將內部目錄指派給磁碟機. +將內部目錄指派到一個磁碟機. . :SHELL_CMD_SUBST_HELP_LONG SUBST [磁碟機1: [磁碟機2:]路徑] SUBST 磁碟機1: /D - 磁碟機1: 指定您想指派路徑給它的磁碟機. - [磁碟機2:]路徑 指定您想要指派, 且已掛載的本機磁碟機和路徑. - /D 刪除已掛載或代替的磁碟機. + 磁碟機1: 指定您想要把路徑指派到的磁碟機. + [磁碟機2:]路徑 指定您想要用來指派且已掛載的本機磁碟機和路徑. + /D 刪除已掛載或替代的磁碟機. 輸入不含參數的 SUBST 命令顯示已掛載的本機磁碟機清單. @@ -2141,11 +2150,11 @@ PROMPT [文字] 文字 指定新的命令提示字元. 提示字元可以由一般字元和以下特殊代碼組成: - $A & (& 符號) + $A & (and 符號) $B | (直線) $C ( (左括弧) $D 目前日期 - $E 跳脫字元代碼 (美國標準資訊交換碼 (ASCII) 編碼 27) + $E 跳脫字元代碼 (美國標準資訊交換碼 (ASCII) 內碼 27) $F ) (右括弧) $G > (大於符號) $H 退位字元 (清除前一個字元) @@ -2224,7 +2233,7 @@ COUNTRY [nnn] nnn 指定國家代碼. -特定國家/地區的資訊(例如日期和時間格式)將受到影響. +依國別設定的資訊(例如日期和時間格式)將受到影響. . :SHELL_CMD_CTTY_HELP @@ -2315,10 +2324,6 @@ To adjust the emulated CPU speed, use host+Plus and host+Minus[3 :SHELL_STARTUP_CGA_MONO 按 Ctrl+F7 鍵在單色間切換: 綠色、黃褐色、白色. 按 Ctrl+F8 鍵變更高對比度/亮度設定. -. -:PROGRAM_BOOT_IMAGE_MOUNTED -軟碟映像檔已掛載. - . :MENU:mapper_reset 重設虛擬機器 @@ -2858,7 +2863,7 @@ PC-98 選項 3dfx 模擬 . :MENU:3dfx_voodoo -內接式 Voodoo 卡 +內部巫毒卡 . :MENU:3dfx_glide Glide 直通 @@ -3241,6 +3246,9 @@ Turbo (快轉模式) :MENU:mapper_caprawopl 錄製 FM (OPL) 輸出 . +:MENU:mapper_capnetrf +記錄網路流量 +. :MENU:mapper_video 錄製影片到 AVI . @@ -3338,7 +3346,7 @@ Turbo (快轉模式) 奔騰 III . :MENU:cputype_experimental -實驗 CPU +實驗性 CPU . :MENU:debug_pageflip 頁面翻轉偵錯行 @@ -3383,7 +3391,7 @@ Turbo (快轉模式) 透過滑鼠中鍵 . :MENU:clipboard_arrows -透過方向鍵 (Home=開始選取, End=結束選取) +透過方向鍵 (Home=開始, End=結束) . :MENU:screen_to_clipboard 複製 DOS 畫面上的所有文字 @@ -3499,6 +3507,9 @@ Mapper "傳送特殊鍵": Ctrl+Alt+Del :MENU:pc98_use_uskb 使用美式鍵盤配置 . +:MAPPER:capnetrf +記錄網路流量 +. :MAPPER:caprawopl 錄製 FM/OPL 輸出 . diff --git a/contrib/windows/installer/DOSBox-X-installer.iss b/contrib/windows/installer/DOSBox-X-installer.iss new file mode 100644 index 00000000000..0ca5c0cdc0b --- /dev/null +++ b/contrib/windows/installer/DOSBox-X-installer.iss @@ -0,0 +1,1192 @@ +#define MyAppName "DOSBox-X" +#define MyAppVersion "2023.05.01" +#define MyAppBit "(32/64bit for Windows)" +#define MyAppPublisher "joncampbell123 [DOSBox-X Team]" +#define MyAppURL "https://dosbox-x.com/" +#define MyAppExeName "dosbox-x.exe" +#define MyAppBuildDate GetDateTimeString('yyyymmdd_hhnnss', '', '') + +[Setup] +; NOTE: The value of AppId uniquely identifies this application. +; Do not use the same AppId value in installers for other applications. +; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) +AppId={{63E5D76D-0092-415C-B97C-E0D2F4F6D2EC} +AppName={#MyAppName} +AppVersion={#MyAppVersion} {#MyAppBit} +;AppVerName={#MyAppName} {#MyAppVersion} +AppPublisher={#MyAppPublisher} +AppPublisherURL={#MyAppURL} +AppSupportURL={#MyAppURL} +AppUpdatesURL={#MyAppURL} +DefaultDirName={sd}\{#MyAppName} +DefaultGroupName={#MyAppName} +DisableProgramGroupPage=yes +InfoBeforeFile=setup_preamble.txt +InfoAfterFile=setup_epilogue.txt +OutputDir=.\ +OutputBaseFilename=dosbox-x-windows-{#MyAppVersion}-setup +SetupIconFile=..\..\icons\dosbox-x.ico +Compression=lzma +SolidCompression=yes +UsePreviousAppDir=yes +ChangesAssociations=yes +DisableStartupPrompt=yes +DisableWelcomePage=no +DisableDirPage=no +DisableReadyPage=no +ShowLanguageDialog=no +AlwaysShowDirOnReadyPage=yes +AlwaysShowGroupOnReadyPage=yes +ArchitecturesInstallIn64BitMode=x64 +PrivilegesRequired=admin +;PrivilegesRequiredOverridesAllowed=dialog +UninstallDisplayName={#MyAppName} {#MyAppVersion} {#MyAppBit} +UninstallDisplayIcon={app}\{#MyAppExeName} +WizardSmallImageFile=..\..\icons\dosbox-x.bmp +;MinVersion below 6.1 is not recommended, however set to 6.0 to support Vista +MinVersion=6.0 + +[Messages] +InfoBeforeLabel=Please read the general information about DOSBox-X below. +InfoAfterClickLabel=You have now installed DOSBox-X. Please note that you can customize DOSBox-X settings in dosbox-x.conf. Also, when in the DOSBox-X command line, you can type HELP for DOSBox-X help, or EXIT to close the DOSBox-X window. + +[Languages] +Name: "en"; MessagesFile: "compiler:Default.isl" +Name: "fr"; MessagesFile: "compiler:Default.isl" +Name: "ge"; MessagesFile: "compiler:Default.isl" +Name: "ja"; MessagesFile: "compiler:Default.isl" +Name: "ko"; MessagesFile: "compiler:Default.isl" +Name: "pt"; MessagesFile: "compiler:Default.isl" +Name: "sc"; MessagesFile: "compiler:Default.isl" +Name: "sp"; MessagesFile: "compiler:Default.isl" +Name: "tc"; MessagesFile: "compiler:Default.isl" +Name: "tr"; MessagesFile: "compiler:Default.isl" + +[LangOptions] +en.LanguageID=$0409 +fr.LanguageID=$040C +ge.LanguageID=$0407 +ja.LanguageID=$0411 +ko.LanguageID=$0412 +pt.LanguageID=$0416 +sc.LanguageID=$0804 +sp.LanguageID=$0C0A +tc.LanguageID=$0404 +tr.LanguageID=$041F + +[Tasks] +Name: "contextmenu"; Description: "Add ""Run/Open with DOSBox-X"" context menu for Windows Explorer" +Name: "commonoption"; Description: "Write common config options (instead of all) to the configuration file" +Name: "centerwindow"; Description: "Automatically center the window on the screen when DOSBox-X starts" +Name: "drivedelay"; Description: "Emulate the slowness of floppy drive and hard drive data transfers"; Flags: unchecked +Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}" +Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked + +[Types] +Name: "typical"; Description: "Typical installation" +Name: "full"; Description: "Full installation" +Name: "compact"; Description: "Compact installation" +Name: "custom"; Description: "Custom installation"; Flags: iscustom + +[Components] +Name: "compact"; Description: "Install core files"; Types: full typical compact custom; Flags: fixed +Name: "typical"; Description: "Include typical components (such as shaders)"; Types: full typical custom +Name: "full"; Description: "Copy all DOSBox-X builds to sub-directories"; Types: full + +[Files] +Source: ".\readme.txt"; DestDir: "{app}"; DestName: "README.txt"; Flags: ignoreversion; Components: full typical compact +Source: ".\dosbox-x.reference.conf"; DestDir: "{app}"; Flags: ignoreversion; Components: full typical compact +Source: ".\dosbox-x.reference.full.conf"; DestDir: "{app}"; Flags: ignoreversion; Components: full typical compact +Source: ".\dosbox-x.reference.setup.conf"; DestDir: "{app}"; Flags: ignoreversion; Components: full typical compact +Source: "..\..\..\CHANGELOG"; DestDir: "{app}"; DestName: "changelog.txt"; Flags: ignoreversion; Components: full typical compact +Source: "..\..\..\COPYING"; DestDir: "{app}"; DestName: "COPYING.txt"; Flags: ignoreversion; Components: full typical compact +Source: "..\..\fonts\FREECG98.BMP"; DestDir: "{app}"; Flags: ignoreversion; Components: full typical +Source: "..\..\fonts\wqy_1?pt.bdf"; DestDir: "{app}"; Flags: ignoreversion; Components: full typical +Source: "..\..\fonts\Nouveau_IBM.ttf"; DestDir: "{app}"; Flags: ignoreversion; Components: full typical compact +Source: "..\..\fonts\SarasaGothicFixed.ttf"; DestDir: "{app}"; Flags: ignoreversion; Components: full typical compact +Source: "..\..\translations\de\de_DE.lng"; DestDir: "{app}\languages"; Flags: ignoreversion; Components: full typical compact +Source: "..\..\translations\en\en_US.lng"; DestDir: "{app}\languages"; Flags: ignoreversion; Components: full typical compact +Source: "..\..\translations\es\es_ES.lng"; DestDir: "{app}\languages"; Flags: ignoreversion; Components: full typical compact +Source: "..\..\translations\fr\fr_FR.lng"; DestDir: "{app}\languages"; Flags: ignoreversion; Components: full typical compact +Source: "..\..\translations\ja\ja_JP.lng"; DestDir: "{app}\languages"; Flags: ignoreversion; Components: full typical compact +Source: "..\..\translations\ko\ko_KR.lng"; DestDir: "{app}\languages"; Flags: ignoreversion; Components: full typical compact +Source: "..\..\translations\tr\tr_TR.lng"; DestDir: "{app}\languages"; Flags: ignoreversion; Components: full typical compact +Source: "..\..\translations\zh\zh_CN.lng"; DestDir: "{app}\languages"; Flags: ignoreversion; Components: full typical compact +Source: "..\..\translations\zh\zh_TW.lng"; DestDir: "{app}\languages"; Flags: ignoreversion; Components: full typical compact +Source: "..\..\glshaders\*"; DestDir: "{app}\glshaders"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: full typical +Source: "..\shaders\*"; DestDir: "{app}\shaders"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: full typical +Source: ".\drivez_readme.txt"; DestDir: "{app}\drivez"; DestName: "README.TXT"; Flags: ignoreversion; Components: full typical +Source: ".\windows_explorer_context_menu_installer.bat"; DestDir: "{app}\scripts"; DestName: "windows_explorer_context_menu_installer.bat"; Flags: ignoreversion; Components: full typical +Source: ".\windows_explorer_context_menu_uninstaller.bat"; DestDir: "{app}\scripts"; DestName: "windows_explorer_context_menu_uninstaller.bat"; Flags: ignoreversion; Components: full typical +Source: ".\inpout32.dll"; DestDir: "{app}"; DestName: "inpout32.dll"; Flags: ignoreversion; Components: full typical +Source: ".\inpoutx64.dll"; DestDir: "{app}"; DestName: "inpoutx64.dll"; Flags: ignoreversion; Components: full typical +Source: ".\windows\dosbox-x_x64_SDL1.exe"; DestDir: "{app}"; DestName: "dosbox-x.exe"; Flags: ignoreversion; Check: InstallVersion(0); Components: full typical compact +Source: ".\windows\dosbox-x_x64_SDL2.exe"; DestDir: "{app}"; DestName: "dosbox-x.exe"; Flags: ignoreversion; Check: InstallVersion(1); Components: full typical compact +Source: ".\windows\dosbox-x_x86_SDL1.exe"; DestDir: "{app}"; DestName: "dosbox-x.exe"; Flags: ignoreversion; Check: InstallVersion(2); Components: full typical compact +Source: ".\windows\dosbox-x_x86_SDL2.exe"; DestDir: "{app}"; DestName: "dosbox-x.exe"; Flags: ignoreversion; Check: InstallVersion(3); Components: full typical compact +Source: ".\windows\dosbox-x_MinGWx64_SDL1.exe"; DestDir: "{app}"; DestName: "dosbox-x.exe"; Flags: ignoreversion; Check: InstallVersion(4); Components: full typical compact +Source: ".\windows\dosbox-x_MinGWx64_SDL2.exe"; DestDir: "{app}"; DestName: "dosbox-x.exe"; Flags: ignoreversion; Check: InstallVersion(5); Components: full typical compact +Source: ".\windows\dosbox-x_MinGWx86_SDL1.exe"; DestDir: "{app}"; DestName: "dosbox-x.exe"; Flags: ignoreversion; Check: InstallVersion(6); Components: full typical compact +Source: ".\windows\dosbox-x_MinGWx86_SDL2.exe"; DestDir: "{app}"; DestName: "dosbox-x.exe"; Flags: ignoreversion; Check: InstallVersion(7); Components: full typical compact +Source: ".\windows\dosbox-x_ARM64_SDL1.exe"; DestDir: "{app}"; DestName: "dosbox-x.exe"; Flags: ignoreversion; Check: InstallVersion(8); Components: full typical compact +Source: ".\windows\dosbox-x_ARM64_SDL2.exe"; DestDir: "{app}"; DestName: "dosbox-x.exe"; Flags: ignoreversion; Check: InstallVersion(9); Components: full typical compact +Source: ".\windows\dosbox-x_ARM_SDL1.exe"; DestDir: "{app}"; DestName: "dosbox-x.exe"; Flags: ignoreversion; Check: InstallVersion(10); Components: full typical compact +Source: ".\windows\dosbox-x_ARM_SDL2.exe"; DestDir: "{app}"; DestName: "dosbox-x.exe"; Flags: ignoreversion; Check: InstallVersion(11); Components: full typical compact +Source: ".\windows\dosbox-x_x64_SDL1.exe"; DestDir: "{app}"; Check: IsWin64; Flags: ignoreversion; Components: full +Source: ".\windows\dosbox-x_x64_SDL2.exe"; DestDir: "{app}"; Check: IsWin64; Flags: ignoreversion; Components: full +Source: ".\windows\dosbox-x_x86_SDL1.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: full +Source: ".\windows\dosbox-x_x86_SDL2.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: full +Source: ".\windows\dosbox-x_MinGWx64_SDL1.exe"; DestDir: "{app}"; Check: IsWin64; Flags: ignoreversion; Components: full +Source: ".\windows\dosbox-x_MinGWx64_SDL2.exe"; DestDir: "{app}"; Check: IsWin64; Flags: ignoreversion; Components: full +Source: ".\windows\dosbox-x_MinGWx86_SDL1.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: full +Source: ".\windows\dosbox-x_MinGWx86_SDL2.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: full +Source: ".\windows\dosbox-x_ARM64_SDL1.exe"; DestDir: "{app}"; Check: not (IsX86 or IsX64); Flags: ignoreversion; Components: full +Source: ".\windows\dosbox-x_ARM64_SDL2.exe"; DestDir: "{app}"; Check: not (IsX86 or IsX64); Flags: ignoreversion; Components: full +Source: ".\windows\dosbox-x_ARM_SDL1.exe"; DestDir: "{app}"; Check: not (IsX86 or IsX64); Flags: ignoreversion; Components: full +Source: ".\windows\dosbox-x_ARM_SDL2.exe"; DestDir: "{app}"; Check: not (IsX86 or IsX64); Flags: ignoreversion; Components: full + +; NOTE: Don't use "Flags: ignoreversion" on any shared system files + +[Icons] +Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" +Name: "{group}\View DOSBox-X README file"; Filename: "{app}\README.TXT" +Name: "{group}\View DOSBox-X Wiki guide"; Filename: "https://dosbox-x.com/wiki" +Name: "{group}\View or edit dosbox-x.conf"; Filename: "notepad.exe"; Parameters: "{app}\dosbox-x.conf" +Name: "{group}\Run DOSBox-X Configuration Tool"; Filename: "{app}\{#MyAppExeName}"; Parameters: "-startui" +Name: "{group}\Run DOSBox-X Mapper Editor"; Filename: "{app}\{#MyAppExeName}"; Parameters: "-startmapper" +Name: "{group}\All DOSBox-X builds\x64 Release SDL1"; Filename: "{app}\dosbox-x_x64_SDL1.exe"; WorkingDir: "{app}"; Check: IsWin64; Components: full +Name: "{group}\All DOSBox-X builds\x64 Release SDL2"; Filename: "{app}\dosbox-x_x64_SDL2.exe"; WorkingDir: "{app}"; Check: IsWin64; Components: full +Name: "{group}\All DOSBox-X builds\x86 Release SDL1"; Filename: "{app}\dosbox-x_x86_SDL1.exe"; WorkingDir: "{app}"; Components: full +Name: "{group}\All DOSBox-X builds\x86 Release SDL2"; Filename: "{app}\dosbox-x_x86_SDL2.exe"; WorkingDir: "{app}"; Components: full +Name: "{group}\All DOSBox-X builds\MinGW x64 Release SDL1"; Filename: "{app}\dosbox-x_MinGWx64_SDL1.exe"; WorkingDir: "{app}"; Check: IsWin64; Components: full +Name: "{group}\All DOSBox-X builds\MinGW x64 Release SDL2"; Filename: "{app}\dosbox-x_MinGWx64_SDL1.exe"; WorkingDir: "{app}"; Check: IsWin64; Components: full +Name: "{group}\All DOSBox-X builds\MinGW x86 Release SDL1"; Filename: "{app}\dosbox-x_MinGWx86_SDL1.exe"; WorkingDir: "{app}"; Components: full +Name: "{group}\All DOSBox-X builds\MinGW x86 Release SDL2"; Filename: "{app}\dosbox-x_MinGWx86_SDL2.exe"; WorkingDir: "{app}"; Components: full +Name: "{group}\All DOSBox-X builds\ARM64 Release SDL1"; Filename: "{app}\dosbox-x_ARM64_SDL1.exe"; WorkingDir: "{app}"; Check: not (IsX86 or IsX64); Components: full +Name: "{group}\All DOSBox-X builds\ARM64 Release SDL2"; Filename: "{app}\dosbox-x_ARM64_SDL2.exe"; WorkingDir: "{app}"; Check: not (IsX86 or IsX64); Components: full +Name: "{group}\All DOSBox-X builds\ARM Release SDL1"; Filename: "{app}\dosbox-x_ARM_SDL1.exe"; WorkingDir: "{app}"; Check: not (IsX86 or IsX64); Components: full +Name: "{group}\All DOSBox-X builds\ARM Release SDL2"; Filename: "{app}\dosbox-x_ARM_SDL2.exe"; WorkingDir: "{app}"; Check: not (IsX86 or IsX64); Components: full + +Name: "{code:GetDesktopFolder}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon +Name: "{commonappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon + +[InstallDelete] +Type: files; Name: "{group}\Run DOSBox-X Configuration UI.lnk" +Type: files; Name: "{group}\All DOSBox-X builds\x64 Release SDL1.lnk"; Components: typical compact +Type: files; Name: "{group}\All DOSBox-X builds\x64 Release SDL2.lnk"; Components: typical compact +Type: files; Name: "{group}\All DOSBox-X builds\x86 Release SDL1.lnk"; Components: typical compact +Type: files; Name: "{group}\All DOSBox-X builds\x86 Release SDL2.lnk"; Components: typical compact +Type: files; Name: "{group}\All DOSBox-X builds\MinGW x64 Release SDL1.lnk"; Components: typical compact +Type: files; Name: "{group}\All DOSBox-X builds\MinGW x64 Release SDL2.lnk"; Components: typical compact +Type: files; Name: "{group}\All DOSBox-X builds\MinGW x86 Release SDL1.lnk"; Components: typical compact +Type: files; Name: "{group}\All DOSBox-X builds\MinGW x86 Release SDL2.lnk"; Components: typical compact +Type: files; Name: "{group}\All DOSBox-X builds\ARM64 Release SDL1.lnk"; Components: typical compact +Type: files; Name: "{group}\All DOSBox-X builds\ARM64 Release SDL2.lnk"; Components: typical compact +Type: files; Name: "{group}\All DOSBox-X builds\ARM Release SDL1.lnk"; Components: typical compact +Type: files; Name: "{group}\All DOSBox-X builds\ARM Release SDL2.lnk"; Components: typical compact + + +[Registry] +Root: HKA; Subkey: "Software\DOSBox-X"; Flags: uninsdeletekeyifempty +Root: HKA; Subkey: "Software\DOSBox-X"; ValueType: string; ValueName: "Path"; ValueData: "{app}"; Flags: uninsdeletekey +Root: HKA; Subkey: "Software\DOSBox-X"; ValueType: string; ValueName: "Version"; ValueData: "{#MyAppVersion}"; Flags: uninsdeletekey +Root: HKA; Subkey: "Software\Classes\Directory\shell\DOSBox-X"; ValueType: string; ValueName: ""; ValueData: "Open with DOSBox-X"; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletevalue +Root: HKA; Subkey: "Software\Classes\Directory\shell\DOSBox-X"; ValueType: string; ValueName: "Icon"; ValueData: """{app}\dosbox-x.exe"",0"; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletekey +Root: HKA; Subkey: "Software\Classes\Directory\shell\DOSBox-X\command"; ValueType: string; ValueName: ""; ValueData: """{app}\dosbox-x.exe"" -prerun -defaultdir ""{app} "" ""%v """; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletekey +Root: HKA; Subkey: "Software\Classes\Directory\Background\shell\DOSBox-X"; ValueType: string; ValueName: ""; ValueData: "Open with DOSBox-X"; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletevalue +Root: HKA; Subkey: "Software\Classes\Directory\Background\shell\DOSBox-X"; ValueType: string; ValueName: "Icon"; ValueData: """{app}\dosbox-x.exe"",0"; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletekey +Root: HKA; Subkey: "Software\Classes\Directory\Background\shell\DOSBox-X\command"; ValueType: string; ValueName: ""; ValueData: """{app}\dosbox-x.exe"" -prerun -defaultdir ""{app} "" ""%v """; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletekey +Root: HKA; Subkey: "Software\Classes\SystemFileAssociations\.exe\shell\Run with DOSBox-X"; ValueType: none; ValueName: ""; ValueData: ""; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletevalue +Root: HKA; Subkey: "Software\Classes\SystemFileAssociations\.exe\shell\Run with DOSBox-X"; ValueType: string; ValueName: "Icon"; ValueData: """{app}\dosbox-x.exe"",0"; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletekey +Root: HKA; Subkey: "Software\Classes\SystemFileAssociations\.exe\shell\Run with DOSBox-X\command"; ValueType: string; ValueName: ""; ValueData: """{app}\dosbox-x.exe"" -fastlaunch -prerun -defaultdir ""{app} "" ""%1"""; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletekey +Root: HKA; Subkey: "Software\Classes\SystemFileAssociations\.com\shell\Run with DOSBox-X"; ValueType: none; ValueName: ""; ValueData: ""; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletevalue +Root: HKA; Subkey: "Software\Classes\SystemFileAssociations\.com\shell\Run with DOSBox-X"; ValueType: string; ValueName: "Icon"; ValueData: """{app}\dosbox-x.exe"",0"; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletekey +Root: HKA; Subkey: "Software\Classes\SystemFileAssociations\.com\shell\Run with DOSBox-X\command"; ValueType: string; ValueName: ""; ValueData: """{app}\dosbox-x.exe"" -fastlaunch -prerun -defaultdir ""{app} "" ""%1"""; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletekey +Root: HKA; Subkey: "Software\Classes\SystemFileAssociations\.bat\shell\Run with DOSBox-X"; ValueType: none; ValueName: ""; ValueData: ""; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletevalue +Root: HKA; Subkey: "Software\Classes\SystemFileAssociations\.bat\shell\Run with DOSBox-X"; ValueType: string; ValueName: "Icon"; ValueData: """{app}\dosbox-x.exe"",0"; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletekey +Root: HKA; Subkey: "Software\Classes\SystemFileAssociations\.bat\shell\Run with DOSBox-X\command"; ValueType: string; ValueName: ""; ValueData: """{app}\dosbox-x.exe"" -fastlaunch -prerun -defaultdir ""{app} "" ""%1"""; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletekey +Root: HKA; Subkey: "Software\Classes\SystemFileAssociations\.conf\shell\Open with DOSBox-X"; ValueType: none; ValueName: ""; ValueData: ""; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletevalue +Root: HKA; Subkey: "Software\Classes\SystemFileAssociations\.conf\shell\Open with DOSBox-X"; ValueType: string; ValueName: "Icon"; ValueData: """{app}\dosbox-x.exe"",0"; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletekey +Root: HKA; Subkey: "Software\Classes\SystemFileAssociations\.conf\shell\Open with DOSBox-X\command"; ValueType: string; ValueName: ""; ValueData: """{app}\dosbox-x.exe"" -conf ""%1"""; Check: IsTaskSelected('contextmenu'); Flags: uninsdeletekey +Root: HKA; Subkey: "Software\Classes\Directory\shell\DOSBox-X"; ValueType: none; Check: not IsTaskSelected('contextmenu'); Flags: deletekey +Root: HKA; Subkey: "Software\Classes\Directory\shell\DOSBox-X\command"; ValueType: none; Check: not IsTaskSelected('contextmenu'); Flags: deletekey +Root: HKA; Subkey: "Software\Classes\Directory\Background\shell\DOSBox-X"; ValueType: none; Check: not IsTaskSelected('contextmenu'); Flags: deletekey +Root: HKA; Subkey: "Software\Classes\Directory\Background\shell\DOSBox-X\command"; ValueType: none; Check: not IsTaskSelected('contextmenu'); Flags: deletekey +Root: HKA; Subkey: "Software\Classes\SystemFileAssociations\.exe\shell\Run with DOSBox-X"; ValueType: none; Check: not IsTaskSelected('contextmenu'); Flags: deletekey +Root: HKA; Subkey: "Software\Classes\SystemFileAssociations\.exe\shell\Run with DOSBox-X\command"; ValueType: none; Check: not IsTaskSelected('contextmenu'); Flags: deletekey +Root: HKA; Subkey: "Software\Classes\SystemFileAssociations\.com\shell\Run with DOSBox-X"; ValueType: none; Check: not IsTaskSelected('contextmenu'); Flags: deletekey +Root: HKA; Subkey: "Software\Classes\SystemFileAssociations\.com\shell\Run with DOSBox-X\command"; ValueType: none; Check: not IsTaskSelected('contextmenu'); Flags: deletekey +Root: HKA; Subkey: "Software\Classes\SystemFileAssociations\.bat\shell\Run with DOSBox-X"; ValueType: none; Check: not IsTaskSelected('contextmenu'); Flags: deletekey +Root: HKA; Subkey: "Software\Classes\SystemFileAssociations\.bat\shell\Run with DOSBox-X\command"; ValueType: none; Check: not IsTaskSelected('contextmenu'); Flags: deletekey +Root: HKA; Subkey: "Software\Classes\SystemFileAssociations\.conf\shell\Open with DOSBox-X"; ValueType: none; Check: not IsTaskSelected('contextmenu'); Flags: deletekey +Root: HKA; Subkey: "Software\Classes\SystemFileAssociations\.conf\shell\Open with DOSBox-X\command"; ValueType: none; Check: not IsTaskSelected('contextmenu'); Flags: deletekey + +[Run] +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 + +[UninstallDelete] +Type: files; Name: "{app}\stderr.txt" + +[Code] +var + msg, lang: string; + HelpButton: TNewButton; + PageCustom: TInputFileWizardPage; + PageBuild, PageLang, PageOutput, PageFont, PageVer: TInputOptionWizardPage; +function IsVerySilent(): Boolean; +var + k: Integer; +begin + Result := False; + for k := 1 to ParamCount do + if CompareText(ParamStr(k), '/verysilent') = 0 then + begin + Result := True; + Break; + end; +end; +function IsWindowsVersionOrNewer(Major, Minor: Integer): Boolean; +var + Version: TWindowsVersion; +begin + GetWindowsVersionEx(Version); + Result := (Version.Major > Major) or ((Version.Major = Major) and (Version.Minor >= Minor)); +end; +function Is32BitInstaller(): Boolean; +begin + if True then + begin + Result := True; + end + else + Result := False; +end; +procedure HelpButtonOnClick(Sender: TObject); +begin + MsgBox('The Setup pre-selects a Windows build for you according to your platform automatically, but you can change the default build to run if you encounter specific problem(s) with the pre-selected one.' #13#13 'For example, while the SDL1 version is the default version to run, the SDL2 version may be preferred over the SDL1 version for certain features such as improved keyboard and touchscreen support. Also, MinGW builds may work better with certain features (such as the Slirp backend for the NE2000 networking in standard MinGW builds) than Visual Studio builds even though they do not come with the debugger.' #13#13 'If you are not sure about which build to use, then you can just leave it unmodified and use the pre-selected one as the default build.', mbConfirmation, MB_OK); +end; +procedure CreateHelpButton(X: integer; Y: integer; W: integer; H: integer); +begin + HelpButton := TNewButton.Create(WizardForm); + HelpButton.Left := X; + HelpButton.Top := Y; + HelpButton.Width := W; + HelpButton.Height := H; + HelpButton.Caption := '&Help'; + HelpButton.OnClick := @HelpButtonOnClick; + HelpButton.Parent := WizardForm; +end; +procedure SetLanguage(); +var +i: Integer; +line, linetmp, section: String; +FileLines: TStringList; +begin + if FileExists(ExpandConstant('{app}\dosbox-x.conf')) and (PageLang.Values[1] or PageLang.Values[2] or PageLang.Values[3] or PageLang.Values[4] or PageLang.Values[5] or PageLang.Values[6] or PageLang.Values[7] or PageLang.Values[8] or PageLang.Values[9]) then + begin + FileLines := TStringList.Create; + FileLines.LoadFromFile(ExpandConstant('{app}\dosbox-x.conf')); + section := ''; + for i := 0 to FileLines.Count - 1 do + begin + line := Trim(FileLines[i]); + if (Length(line)>2) and (Copy(line, 1, 1) = '[') and (Copy(line, Length(line), 1) = ']') then + section := Copy(line, 2, Length(line)-2); + if (Length(line)>0) and (Copy(line, 1, 1) <> '#') and (Copy(line, 1, 1) <> '[') and (Pos('=', line) > 1) then + begin + linetmp := Trim(Copy(line, 1, Pos('=', line) - 1)); + if (CompareText(linetmp, 'language') = 0) and (CompareText(section, 'dosbox') = 0) then + begin + linetmp := Trim(Copy(line, 1, Pos('=', line))); + if (PageLang.Values[1]) and FileExists(ExpandConstant('{app}\languages\fr_FR.lng')) then + FileLines[i] := linetmp+' fr_FR'; + if (PageLang.Values[2]) and FileExists(ExpandConstant('{app}\languages\de_DE.lng')) then + FileLines[i] := linetmp+' de_DE'; + if (PageLang.Values[3]) and FileExists(ExpandConstant('{app}\languages\ja_JP.lng')) then + FileLines[i] := linetmp+' ja_JP'; + if (PageLang.Values[4]) and FileExists(ExpandConstant('{app}\languages\ko_KR.lng')) then + FileLines[i] := linetmp+' ko_KR'; + if (PageLang.Values[5]) and FileExists(ExpandConstant('{app}\languages\pt_BR.lng')) then + FileLines[i] := linetmp+' pt_BR'; + if (PageLang.Values[6]) and FileExists(ExpandConstant('{app}\languages\zh_CN.lng')) then + FileLines[i] := linetmp+' zh_CN'; + if (PageLang.Values[7]) and FileExists(ExpandConstant('{app}\languages\es_ES.lng')) then + FileLines[i] := linetmp+' es_ES'; + if (PageLang.Values[8]) and FileExists(ExpandConstant('{app}\languages\zh_TW.lng')) then + FileLines[i] := linetmp+' zh_TW'; + if (PageLang.Values[9]) and FileExists(ExpandConstant('{app}\languages\tr_TR.lng')) then + FileLines[i] := linetmp+' tr_TR'; + end; + if (CompareText(linetmp, 'keyboardlayout') = 0) and (CompareText(section, 'dos') = 0) then + begin + linetmp := Trim(Copy(line, 1, Pos('=', line))); + if (PageLang.Values[1]) then + FileLines[i] := linetmp+' fr'; + if (PageLang.Values[2]) then + FileLines[i] := linetmp+' de'; + if (PageLang.Values[3]) then + FileLines[i] := linetmp+' jp'; + if (PageLang.Values[4]) then + FileLines[i] := linetmp+' ko'; + if (PageLang.Values[5]) then + FileLines[i] := linetmp+' br'; + if (PageLang.Values[6]) then + FileLines[i] := linetmp+' cn'; + if (PageLang.Values[7]) then + FileLines[i] := linetmp+' sp'; + if (PageLang.Values[8]) then + FileLines[i] := linetmp+' tw'; + if (PageLang.Values[9]) then + FileLines[i] := linetmp+' tr'; + end; + if (CompareText(linetmp, 'country') = 0) and (CompareText(section, 'config') = 0) then + begin + linetmp := Trim(Copy(line, 1, Pos('=', line))); + if (PageLang.Values[1]) then + FileLines[i] := linetmp+' 33,859'; + if (PageLang.Values[2]) then + FileLines[i] := linetmp+' 49,850'; + if (PageLang.Values[3]) then + FileLines[i] := linetmp+' 81,932'; + if (PageLang.Values[4]) then + FileLines[i] := linetmp+' 82,949'; + if (PageLang.Values[5]) then + FileLines[i] := linetmp+' 55,860'; + if (PageLang.Values[6]) then + FileLines[i] := linetmp+' 86,936'; + if (PageLang.Values[7]) then + FileLines[i] := linetmp+' 34,858'; + if (PageLang.Values[8]) then + FileLines[i] := linetmp+' 886,950'; + if (PageLang.Values[9]) then + FileLines[i] := linetmp+' 90,857'; + break; + end + end + end; + FileLines.SaveToFile(ExpandConstant('{app}\dosbox-x.conf')); + end; +end; +procedure InitializeWizard(); +begin + msg:='Select the default build to run from the Windows Start Menu or the desktop. There are SDL1 and SDL2 builds, and while SDL1 builds are preselected, you may prefer SDL2 builds if for example you encounter some issues with a non-U.S. keyboard layout in SDL1 builds. Click the "Help" button below for more information.'; + PageBuild:=CreateInputOptionPage(wpSelectDir, 'DOSBox-X for Windows (32/64-bit)', 'Select the default DOSBox-X build to run', msg, True, False); + PageBuild.AddEx('Visual Studio build (64-bit)', 0, True); + PageBuild.AddEx('Visual Studio build (32-bit)', 0, True); + PageBuild.AddEx('MinGW build (64-bit)', 0, True); + PageBuild.AddEx('MinGW build (32-bit)', 0, True); + PageBuild.AddEx('ARM build (64-bit)', 0, True); + PageBuild.AddEx('ARM build (32-bit)', 0, True); + if not IsWin64 then + begin + PageBuild.CheckListBox.ItemEnabled[0] := False; + PageBuild.CheckListBox.ItemEnabled[2] := False; + PageBuild.Values[1] := True; + end + else + PageBuild.Values[0] := True; + if IsX86 or IsX64 then + begin + PageBuild.CheckListBox.ItemEnabled[4] := False; + PageBuild.CheckListBox.ItemEnabled[5] := False; + end + else + begin + PageBuild.Values[0] := False; + PageBuild.Values[1] := False; + PageBuild.CheckListBox.ItemEnabled[0] := False; + PageBuild.CheckListBox.ItemEnabled[1] := False; + PageBuild.CheckListBox.ItemEnabled[2] := False; + PageBuild.CheckListBox.ItemEnabled[3] := False; + PageBuild.Values[4] := True; + if not IsARM64 then + begin + PageBuild.CheckListBox.ItemEnabled[4] := False; + PageBuild.Values[4] := False; + PageBuild.Values[5] := True; + end + end; + PageBuild.CheckListBox.AddGroup('Check the following box to select the SDL2 build as the default DOSBox-X build.', '', 0, nil); + PageBuild.CheckListBox.AddCheckBox('Default to SDL2 build (instead of SDL1 build) ', '', 0, False, True, False, True, nil); + CreateHelpButton(ScaleX(20), WizardForm.CancelButton.Top, WizardForm.CancelButton.Width, WizardForm.CancelButton.Height); + msg:='DOSBox-X supports different video output systems for different purposes.' #13#13 'By default it uses the Direct3D output, but you may want to select the OpenGL pixel-perfect scaling output for improved image quality (not available if you had selected an ARM build). Also, if you use text-mode DOS applications and/or the DOS shell frequently you probably want to select the TrueType font (TTF) output to make the text screen look much better by using scalable TrueType fonts.' #13#13 'This setting can be later modified in the DOSBox-X''s configuration file (dosbox-x.conf), or from DOSBox-X''s Video menu.'; + PageOutput:=CreateInputOptionPage(PageBuild.ID, 'Video output for DOSBox-X', 'Specify the DOSBox-X video output system', msg, True, False); + PageOutput.Add('Default output (Direct3D)'); + PageOutput.Add('OpenGL with pixel-perfect scaling'); + PageOutput.Add('TrueType font (TTF) / Direct3D output'); + PageOutput.Values[2] := True; + msg:='DOSBox-X supports language files to display messages in different languages. The language for the user interface and internal DOS is English by default, but you can select a different language for its user interface and internal DOS. The language and code page settings can be later modified in the configuration file (dosbox-x.conf).'; + PageLang:=CreateInputOptionPage(PageOutput.ID, 'User interface and DOS language', 'Select the language for DOSBox-X''s user interface and internal DOS', msg, True, False); + PageLang.Add('Default (English)'); + PageLang.Add('French (Français)'); + PageLang.Add('German (Deutsch)'); + PageLang.Add('Japanese (日本語)'); + PageLang.Add('Korean (한국어)'); + PageLang.Add('Portuguese (português do Brasil)'); + PageLang.Add('Simplified Chinese (简体中文)'); + PageLang.Add('Spanish (Español)'); + PageLang.Add('Traditional Chinese (繁體/正體中文)'); + PageLang.Add('Turkish (Türkçe)'); + PageLang.Values[0] := True; + lang := ExpandConstant('{language}'); + if lang = 'fr' then + PageLang.Values[1] := True; + if lang = 'ge' then + PageLang.Values[2] := True; + if lang = 'ja' then + PageLang.Values[3] := True; + if lang = 'ko' then + PageLang.Values[4] := True; + if lang = 'pt' then + PageLang.Values[5] := True; + if lang = 'sc' then + PageLang.Values[6] := True; + if lang = 'sp' then + PageLang.Values[7] := True; + if lang = 'tc' then + PageLang.Values[8] := True; + if lang = 'tr' then + PageLang.Values[9] := True; + msg:='DOSBox-X allows you to select a TrueType font (or OpenType font) for the TrueType font (TTF) output. It has a builtin TTF font as the default font for the output, but you may want to select a different TTF (or TTC/OTF) font than the default one.' #13#13 'This setting can be later modified in the DOSBox-X''s configuration file (dosbox-x.conf).'; + PageFont:=CreateInputOptionPage(PageLang.ID, 'TrueType font', 'Select the font for the TrueType font output', msg, True, False); + PageFont.Add('Default TrueType font'); + PageFont.Add('Sarasa Gothic font'); + PageFont.Add('Consolas font'); + PageFont.Add('Courier New font'); + PageFont.Add('Nouveau IBM font'); + PageFont.Add('Custom TrueType font'); + if not FileExists(ExpandConstant('{fonts}\consola.ttf')) then + PageFont.CheckListBox.ItemEnabled[2] := False; + if not FileExists(ExpandConstant('{fonts}\cour.ttf')) then + PageFont.CheckListBox.ItemEnabled[3] := False; + PageFont.Values[0] := True; + PageCustom := CreateInputFilePage(PageFont.ID, 'TrueType font', 'Select a custom TrueType font', 'Please select where your custom TrueType font (or OpenType font) is located, then click "Next" to continue.'); + PageCustom.Add('&Location of your custom TrueType font (TTF/TTC/OTF):', 'TrueType font files|*.ttf;*.ttc;*.otf|All files|*.*','.ttf;.ttc;.otf'); + msg:='You can specify a default DOS version for DOSBox-X to report to itself and DOS programs. This can sometimes change the feature sets of DOSBox-X. For example, selecting 7.10 as the reported DOS version will enable support for Windows-style long filenames (LFN) and FAT32 disk images (>2GB disk images) by default.' #13#13 'If you are not sure about which DOS version to report, you can also leave this unselected, then a preset DOS version will be reported (usually 5.00).' #13#13 'This setting can be later modified in the DOSBox-X''s configuration file (dosbox-x.conf).'; + PageVer:=CreateInputOptionPage(PageCustom.ID, 'Reported DOS version', 'Specify the default DOS version to report', msg, True, False); + PageVer.Add('DOS version 3.30'); + PageVer.Add('DOS version 5.00 (reported by default)'); + PageVer.Add('DOS version 6.22'); + PageVer.Add('DOS version 7.10 (for LFN and FAT32 support)'); +end; +function ShouldSkipPage(PageID: Integer): Boolean; +var + i: Integer; + defcp: Boolean; + line, linetmp, section: String; + FileLines: TStringList; +begin + if (PageID = PageLang.ID) then + begin + if FileExists(ExpandConstant('{app}\dosbox-x.conf')) then + begin + if (ExpandConstant('{language}') = 'en') or (WizardSetupType(False) = 'compact') then + begin + Result := True; + exit; + end; + FileLines := TStringList.Create; + FileLines.LoadFromFile(ExpandConstant('{app}\dosbox-x.conf')); + section := ''; + defcp := False; + for i := 0 to FileLines.Count - 1 do + begin + line := Trim(FileLines[i]); + if (Length(line)>2) and (Copy(line, 1, 1) = '[') and (Copy(line, Length(line), 1) = ']') then + section := Copy(line, 2, Length(line)-2); + if (Length(line)>0) and (Copy(line, 1, 1) <> '#') and (Copy(line, 1, 1) <> '[') and (Pos('=', line) > 1) then + begin + linetmp := Trim(Copy(line, 1, Pos('=', line) - 1)); + if (CompareText(linetmp, 'country') = 0) and (CompareText(section, 'config') = 0) then + begin + linetmp := Trim(Copy(line, Pos('=', line) + 1, Length(line))); + if (CompareText(linetmp, '') = 0) then + defcp := True; + break; + end; + end; + end; + Result := not defcp; + end + else + Result := False; + end + else + Result := ((PageID = PageOutput.ID) or (PageID = PageFont.ID) or (PageID = PageCustom.ID) or (PageID = PageVer.ID)) and FileExists(ExpandConstant('{app}\dosbox-x.conf')) or ((PageID = PageFont.ID) and (not PageOutput.Values[2] or PageLang.Values[3] or PageLang.Values[4] or PageLang.Values[6] or PageLang.Values[8])) or ((PageID = PageCustom.ID) and (not PageOutput.Values[2] or not PageFont.Values[5])); +end; +function NextButtonClick(CurPageID: Integer): Boolean; +begin + Result := True; + if (CurPageID = PageCustom.ID) and (Length(PageCustom.Edits[0].Text) = 0) then + begin + MsgBox('Please select a custom TrueType font (or OpenType font) file.', mbError, MB_OK); + WizardForm.ActiveControl := PageCustom.Edits[0]; + Result := False; + end; +end; +procedure CurPageChanged(CurPageID: Integer); +begin + HelpButton.Visible := CurPageID = PageBuild.ID; + if (CurPageID=wpSelectDir) then + begin + if (IsAdminLoggedOn or IsPowerUserLoggedOn) and (WizardDirValue=ExpandConstant('{localappdata}\{#MyAppName}')) then + begin + WizardForm.DirEdit.Text:=ExpandConstant('{commonappdata}\{#MyAppName}'); + MsgBox('You had previously installed DOSBox-X in a standard user directory, but you are currently running as an administrator or privileged user.' #13#13 'The installer will automatically change the default install directory.', mbConfirmation, MB_OK); + end + else if not (IsAdminLoggedOn or IsPowerUserLoggedOn) and (WizardDirValue=ExpandConstant('{pf}\{#MyAppName}')) then + begin + WizardForm.DirEdit.Text:=ExpandConstant('{commonappdata}\{#MyAppName}'); + MsgBox('You had installed DOSBox-X in ' + ExpandConstant('{pf}\{#MyAppName}') + ' previously, but you are currently running as an unprivileged user.' #13#13 'The installer will automatically change the default install directory, or you might want to run the installer as an administrator instead.', mbConfirmation, MB_OK); + end + end + else if (CurPageID = wpReady) then + begin + Wizardform.ReadyMemo.Lines.Add(''); + Wizardform.ReadyMemo.Lines.Add('Default DOSBox-X build:'); + if (PageBuild.Values[0]) and (not PageBuild.Values[7]) then + msg:='Visual Studio build (64-bit) SDL1'; + if (PageBuild.Values[0]) and (PageBuild.Values[7]) then + msg:='Visual Studio build (64-bit) SDL2'; + if (PageBuild.Values[1]) and (not PageBuild.Values[7]) then + msg:='Visual Studio build (32-bit) SDL1'; + if (PageBuild.Values[1]) and (PageBuild.Values[7]) then + msg:='Visual Studio build (32-bit) SDL2'; + if (PageBuild.Values[2]) and (not PageBuild.Values[7]) then + msg:='MinGW build (64-bit) SDL1'; + if (PageBuild.Values[2]) and (PageBuild.Values[7]) then + msg:='MinGW build (64-bit) SDL2'; + if (PageBuild.Values[3]) and (not PageBuild.Values[7]) then + msg:='MinGW build (32-bit) SDL1'; + if (PageBuild.Values[3]) and (PageBuild.Values[7]) then + msg:='MinGW build (32-bit) SDL2'; + if (PageBuild.Values[4]) and (not PageBuild.Values[7]) then + msg:='ARM build (64-bit) SDL1'; + if (PageBuild.Values[4]) and (PageBuild.Values[7]) then + msg:='ARM build (64-bit) SDL2'; + if (PageBuild.Values[5]) and (not PageBuild.Values[7]) then + msg:='ARM build (32-bit) SDL1'; + if (PageBuild.Values[5]) and (PageBuild.Values[7]) then + msg:='ARM build (32-bit) SDL2'; + Wizardform.ReadyMemo.Lines.Add(' '+msg); + lang:=''; + if PageLang.Values[0] or PageLang.Values[1] or PageLang.Values[2] or PageLang.Values[3] or PageLang.Values[4] or PageLang.Values[5] or PageLang.Values[6] or PageLang.Values[7] or PageLang.Values[8] or PageLang.Values[9] then + begin + lang:='Default (English)'; + if (PageLang.Values[1]) then + lang:='French (Français)'; + if (PageLang.Values[2]) then + lang:='German (Deutsch)'; + if (PageLang.Values[3]) then + lang:='Japanese (日本語)'; + if (PageLang.Values[4]) then + lang:='Korean (한국어)'; + if (PageLang.Values[5]) then + lang:='Portuguese (português do Brasil)'; + if (PageLang.Values[6]) then + lang:='Simplified Chinese (简体中文)'; + if (PageLang.Values[7]) then + lang:='Spanish (Español)'; + if (PageLang.Values[8]) then + lang:='Traditional Chinese (繁體/正體中文)'; + if (PageLang.Values[9]) then + lang:='Turkish (Türkçe)'; + end; + if not FileExists(ExpandConstant('{app}\dosbox-x.conf')) then + begin + if PageOutput.Values[0] or PageOutput.Values[1] or PageOutput.Values[2] then + begin + Wizardform.ReadyMemo.Lines.Add(''); + Wizardform.ReadyMemo.Lines.Add('Video output for DOSBox-X:'); + msg:='Default output (Direct3D)'; + if (PageOutput.Values[1]) then + msg:='OpenGL with pixel-perfect scaling'; + if (PageOutput.Values[2]) then + msg:='TrueType font (TTF) / Direct3D output'; + Wizardform.ReadyMemo.Lines.Add(' '+msg); + end; + if Length(lang) > 0 then + begin + Wizardform.ReadyMemo.Lines.Add(''); + Wizardform.ReadyMemo.Lines.Add('User interface and DOS language:'); + Wizardform.ReadyMemo.Lines.Add(' '+lang); + end; + if PageFont.Values[0] or PageFont.Values[1] or PageFont.Values[2] or PageFont.Values[3] or PageFont.Values[4] or PageFont.Values[5] then + begin + Wizardform.ReadyMemo.Lines.Add(''); + Wizardform.ReadyMemo.Lines.Add('TrueType font:'); + msg:='Default TrueType font'; + if (PageFont.Values[1]) then + msg:='SarasaGothicFixed font'; + if (PageFont.Values[2]) then + msg:='Consolas font'; + if (PageFont.Values[3]) then + msg:='Courier New font'; + if (PageFont.Values[4]) then + msg:='Nouveau IBM font'; + if (PageFont.Values[5]) then + msg:='Custom TrueType font: ' + PageCustom.Values[0]; + Wizardform.ReadyMemo.Lines.Add(' '+msg); + end; + if PageVer.Values[0] or PageVer.Values[1] or PageVer.Values[2] or PageVer.Values[3] then + begin + Wizardform.ReadyMemo.Lines.Add(''); + Wizardform.ReadyMemo.Lines.Add('Reported DOS version:'); + msg:='Default'; + if (PageVer.Values[0]) then + msg:='3.30'; + if (PageVer.Values[1]) then + msg:='5.00'; + if (PageVer.Values[2]) then + msg:='6.22'; + if (PageVer.Values[3]) then + msg:='7.10'; + Wizardform.ReadyMemo.Lines.Add(' '+msg); + end + end + else if Length(lang) > 0 then + begin + Wizardform.ReadyMemo.Lines.Add(''); + Wizardform.ReadyMemo.Lines.Add('User interface and DOS language:'); + Wizardform.ReadyMemo.Lines.Add(' '+lang); + end + end +end; +procedure CurStepChanged(CurrentStep: TSetupStep); +var + i, j, k, adv, res: Integer; + tsection, vsection, addcp, dosvcn, dosvtw, dosvset, found1, found2, found3, found4, found5: Boolean; + refname, section, line, linetmp, lineold, linenew, SetupType: String; + FileLines, FileLinesold, FileLinesnew, FileLinesave: TStringList; +begin + if (CurrentStep = ssPostInstall) then + begin + refname:='{app}\dosbox-x.reference.full.conf'; + if FileExists(ExpandConstant('{app}\dosbox-x.conf')) then + begin + refname:='{app}\dosbox-x.reference.setup.conf'; + end + else if IsTaskSelected('commonoption') then + begin + refname:='{app}\dosbox-x.reference.conf'; + end; + if not FileExists(ExpandConstant(refname)) then + begin + MsgBox('Cannot find the ' + Copy(refname, 7, 33) + ' file.', mbError, MB_OK); + DeleteFile(ExpandConstant('{app}\dosbox-x.reference.setup.conf')); + Exit; + end; + refname:='{app}\dosbox-x.reference.full.conf'; + if IsTaskSelected('commonoption') then + refname:='{app}\dosbox-x.reference.conf'; + if FileExists(ExpandConstant(refname)) then + begin + FileLines := TStringList.Create; + FileLines.LoadFromFile(ExpandConstant(refname)); + section := ''; + found1 := False; + found2 := False; + for i := 0 to FileLines.Count - 1 do + begin + line := Trim(FileLines[i]); + if (Length(line)>2) and (Copy(line, 1, 1) = '[') and (Copy(line, Length(line), 1) = ']') then + section := Copy(line, 2, Length(line)-2); + if (Length(line)>0) and (Copy(line, 1, 1) <> '#') and (Copy(line, 1, 1) <> '[') and (Pos('=', line) > 1) then + begin + linetmp := Trim(Copy(line, 1, Pos('=', line) - 1)); + if (CompareText(linetmp, 'printoutput') = 0) and (CompareText(section, 'printer') = 0) then + begin + linetmp := Trim(Copy(line, 1, Pos('=', line))); + FileLines[i] := linetmp+' printer'; + found1 := True; + end; + if (CompareText(linetmp, 'file access tries') = 0) and (CompareText(section, 'dos') = 0) then + begin + linetmp := Trim(Copy(line, 1, Pos('=', line))); + FileLines[i] := linetmp+' 3'; + found2 := True; + end; + if IsTaskSelected('centerwindow') and (CompareText(linetmp, 'windowposition') = 0) and (CompareText(section, 'sdl') = 0) then + begin + linetmp := Trim(Copy(line, 1, Pos('=', line))); + FileLines[i] := linetmp+' '; + found3 := True; + end; + if not IsTaskSelected('drivedelay') and (CompareText(linetmp, 'hard drive data rate limit') = 0) and (CompareText(section, 'dos') = 0) then + begin + linetmp := Trim(Copy(line, 1, Pos('=', line))); + FileLines[i] := linetmp+' 0'; + found4 := True; + end; + if not IsTaskSelected('drivedelay') and (CompareText(linetmp, 'floppy drive data rate limit') = 0) and (CompareText(section, 'dos') = 0) then + begin + linetmp := Trim(Copy(line, 1, Pos('=', line))); + FileLines[i] := linetmp+' 0'; + found5 := True; + end; + if found1 and found2 and (found3 or not IsTaskSelected('centerwindow')) and ((found4 and found5) or IsTaskSelected('drivedelay')) then + break; + end + end; + FileLines.SaveToFile(ExpandConstant(refname)); + end; + if not FileExists(ExpandConstant('{app}\dosbox-x.conf')) then + begin + FileCopy(ExpandConstant(refname), ExpandConstant('{app}\dosbox-x.conf'), false); + if FileExists(ExpandConstant('{app}\dosbox-x.conf')) and (PageOutput.Values[1] or PageOutput.Values[2]) then + begin + FileLines := TStringList.Create; + FileLines.LoadFromFile(ExpandConstant('{app}\dosbox-x.conf')); + section := ''; + for i := 0 to FileLines.Count - 1 do + begin + line := Trim(FileLines[i]); + if (Length(line)>2) and (Copy(line, 1, 1) = '[') and (Copy(line, Length(line), 1) = ']') then + section := Copy(line, 2, Length(line)-2); + if (Length(line)>0) and (Copy(line, 1, 1) <> '#') and (Copy(line, 1, 1) <> '[') and (Pos('=', line) > 1) then + begin + linetmp := Trim(Copy(line, 1, Pos('=', line) - 1)); + if (CompareText(linetmp, 'output') = 0) and (CompareText(section, 'sdl') = 0) then + begin + linetmp := Trim(Copy(line, 1, Pos('=', line))); + if (PageOutput.Values[1]) then + FileLines[i] := linetmp+' openglpp'; + if (PageOutput.Values[2]) then + FileLines[i] := linetmp+' ttf'; + break; + end + end + end; + FileLines.SaveToFile(ExpandConstant('{app}\dosbox-x.conf')); + end; + SetupType := WizardSetupType(False); + if SetupType = 'compact' then + begin + if (not PageLang.Values[1]) and FileExists(ExpandConstant('{app}\languages\fr_FR.lng')) then + DeleteFile(ExpandConstant('{app}\languages\fr_FR.lng')); + if (not PageLang.Values[2]) and FileExists(ExpandConstant('{app}\languages\de_DE.lng')) then + DeleteFile(ExpandConstant('{app}\languages\de_DE.lng')); + if (not PageLang.Values[3]) and FileExists(ExpandConstant('{app}\languages\ja_JP.lng')) then + DeleteFile(ExpandConstant('{app}\languages\ja_JP.lng')); + if (not PageLang.Values[4]) and FileExists(ExpandConstant('{app}\languages\ko_KR.lng')) then + DeleteFile(ExpandConstant('{app}\languages\ko_KR.lng')); + if (not PageLang.Values[5]) and FileExists(ExpandConstant('{app}\languages\pt_BR.lng')) then + DeleteFile(ExpandConstant('{app}\languages\pt_BR.lng')); + if (not PageLang.Values[6]) and FileExists(ExpandConstant('{app}\languages\zh_CN.lng')) then + DeleteFile(ExpandConstant('{app}\languages\zh_CN.lng')); + if (not PageLang.Values[7]) and FileExists(ExpandConstant('{app}\languages\es_ES.lng')) then + DeleteFile(ExpandConstant('{app}\languages\es_ES.lng')); + if (not PageLang.Values[8]) and FileExists(ExpandConstant('{app}\languages\zh_TW.lng')) then + DeleteFile(ExpandConstant('{app}\languages\zh_TW.lng')); + if (not PageLang.Values[9]) and FileExists(ExpandConstant('{app}\languages\tr_TR.lng')) then + DeleteFile(ExpandConstant('{app}\languages\tr_TR.lng')); + if (not PageLang.Values[3]) and (not PageLang.Values[4]) and (not PageLang.Values[6]) and (not PageLang.Values[8]) and (not PageFont.Values[1]) then + begin + if FileExists(ExpandConstant('{app}\SarasaGothicFixed.ttf')) then + DeleteFile(ExpandConstant('{app}\SarasaGothicFixed.ttf')); + end; + if (not PageFont.Values[4]) then + begin + if FileExists(ExpandConstant('{app}\Nouveau_IBM.ttf')) then + DeleteFile(ExpandConstant('{app}\Nouveau_IBM.ttf')); + end; + end; + SetLanguage(); + if FileExists(ExpandConstant('{app}\dosbox-x.conf')) and (PageFont.Values[1] or PageFont.Values[2] or PageFont.Values[3] or PageFont.Values[4] or PageFont.Values[5]) then + begin + FileLines := TStringList.Create; + FileLines.LoadFromFile(ExpandConstant('{app}\dosbox-x.conf')); + section := ''; + for i := 0 to FileLines.Count - 1 do + begin + line := Trim(FileLines[i]); + if (Length(line)>2) and (Copy(line, 1, 1) = '[') and (Copy(line, Length(line), 1) = ']') then + section := Copy(line, 2, Length(line)-2); + if (Length(line)>0) and (Copy(line, 1, 1) <> '#') and (Copy(line, 1, 1) <> '[') and (Pos('=', line) > 1) then + begin + linetmp := Trim(Copy(line, 1, Pos('=', line) - 1)); + if (CompareText(linetmp, 'font') = 0) and (CompareText(section, 'ttf') = 0) then + begin + linetmp := Trim(Copy(line, 1, Pos('=', line))); + if (PageFont.Values[1]) then + FileLines[i] := linetmp+' SarasaGothicFixed'; + if (PageFont.Values[2]) then + FileLines[i] := linetmp+' Consola'; + if (PageFont.Values[3]) then + FileLines[i] := linetmp+' Cour'; + if (PageFont.Values[4]) then + FileLines[i] := linetmp+' Nouveau_IBM'; + if (PageFont.Values[5]) then + FileLines[i] := linetmp+' '+PageCustom.Values[0]; + break; + end + end + end; + FileLines.SaveToFile(ExpandConstant('{app}\dosbox-x.conf')); + end; + if FileExists(ExpandConstant('{app}\dosbox-x.conf')) and (PageVer.Values[0] or PageVer.Values[1] or PageVer.Values[2] or PageVer.Values[3]) then + begin + FileLines := TStringList.Create; + FileLines.LoadFromFile(ExpandConstant('{app}\dosbox-x.conf')); + section := ''; + for i := 0 to FileLines.Count - 1 do + begin + line := Trim(FileLines[i]); + if (Length(line)>2) and (Copy(line, 1, 1) = '[') and (Copy(line, Length(line), 1) = ']') then + section := Copy(line, 2, Length(line)-2); + if (Length(line)>0) and (Copy(line, 1, 1) <> '#') and (Copy(line, 1, 1) <> '[') and (Pos('=', line) > 1) then + begin + linetmp := Trim(Copy(line, 1, Pos('=', line) - 1)); + if (CompareText(linetmp, 'ver') = 0) and (CompareText(section, 'dos') = 0) then + begin + linetmp := Trim(Copy(line, 1, Pos('=', line))); + if (PageVer.Values[0]) then + FileLines[i] := linetmp+' 3.3'; + if (PageVer.Values[1]) then + FileLines[i] := linetmp+' 5.0'; + if (PageVer.Values[2]) then + FileLines[i] := linetmp+' 6.22'; + if (PageVer.Values[3]) then + FileLines[i] := linetmp+' 7.1'; + break; + end + end + end; + FileLines.SaveToFile(ExpandConstant('{app}\dosbox-x.conf')); + end + end + else if (CompareStr(GetSHA1OfFile(ExpandConstant('{app}\dosbox-x.conf')), GetSHA1OfFile(ExpandConstant(refname))) <> 0) or (CompareStr(GetMD5OfFile(ExpandConstant('{app}\dosbox-x.conf')), GetMD5OfFile(ExpandConstant(refname))) <> 0) then + begin + msg:='The configuration file dosbox-x.conf already exists in the destination. Do you want to keep your current settings?' #13#13 'If you choose "Yes", your current settings will be kept and the file dosbox-x.conf will be automatically upgraded to the latest version format (recommended).' #13#13 'If you choose "No", the dosbox-x.conf file will be reset to the new default configuration, and your old dosbox-x.conf file will be named dosbox-x.conf.old in the installation directory.' #13#13 'If you choose "Cancel", your current dosbox-x.conf file will be kept as is without any modifications.' #13 #13 'In any case, the new default configuration file will be named dosbox-x.reference.conf in the installation directory.'; + if IsVerySilent() then + begin + res := IDYES; + end + else + begin + res := MsgBox(msg, mbConfirmation, MB_YESNOCANCEL); + end; + if (res = IDNO) then + begin + FileCopy(ExpandConstant('{app}\dosbox-x.conf'), ExpandConstant('{app}\dosbox-x.conf.old'), false); + FileCopy(ExpandConstant(refname), ExpandConstant('{app}\dosbox-x.conf'), false); + end + else if (res = IDYES) then + begin + FileCopy(ExpandConstant('{app}\dosbox-x.conf'), ExpandConstant('{app}\dosbox-x.conf.old'), false); + FileLines := TStringList.Create; + FileLinesold := TStringList.Create; + FileLinesold.LoadFromFile(ExpandConstant('{app}\dosbox-x.conf.old')); + FileLinesnew := TStringList.Create; + FileLinesnew.LoadFromFile(ExpandConstant('{app}\dosbox-x.reference.setup.conf')); + FileLinesave := TStringList.Create; + section := ''; + tsection := False; + vsection := False; + dosvcn := False; + dosvtw := False; + dosvset := False; + addcp := True; + if not FileExists(ExpandConstant('{app}\SarasaGothicFixed.ttf')) then + dosvset:= True; + for j := 0 to FileLinesold.Count - 1 do + begin + lineold := Trim(FileLinesold[j]); + if (Length(lineold)>2) and (Copy(lineold, 1, 1) = '[') and (Copy(lineold, Length(lineold), 1) = ']') then + begin + section := Copy(lineold, 2, Length(lineold)-2); + if (CompareText(section, 'ttf') = 0) then + begin + tsection := True; + if (vsection and dosvset) then + break; + end + else if(CompareText(section, 'video') = 0) then + begin + vsection := True; + if (tsection and dosvset) then + break; + end + end + else if not dosvset and (CompareText(section, 'dosv') = 0) and (Length(lineold)>0) and (Copy(lineold, 1, 1) <> '#') then + begin + linetmp := Copy(lineold, 1, Pos('=', lineold) - 1); + if (CompareText(Trim(linetmp), 'dosv') = 0) then + begin + dosvset := True; + linetmp := Copy(lineold, Pos('=', lineold) + 1, Length(lineold)); + msg:='Your existing DOSBox-X is configured for the Chinese DOS/V mode. Do you want to change it to the Chinese TrueType font (TTF) mode for a general DOS emulation environment?'; + if ((CompareText(Trim(linetmp), 'cn') = 0) or (CompareText(Trim(linetmp), 'chs') = 0)) and (MsgBox(msg, mbConfirmation, MB_YESNO) = IDYES) then + begin + dosvcn := True; + addcp := False; + end + else if ((CompareText(Trim(linetmp), 'tw') = 0) or (CompareText(Trim(linetmp), 'cht') = 0)) and (MsgBox(msg, mbConfirmation, MB_YESNO) = IDYES) then + begin + dosvtw := True; + addcp := False; + end; + if (tsection and vsection) then + break; + end + end + end; + section := ''; + for i := 0 to FileLinesnew.Count - 1 do + begin + linenew := Trim(FileLinesnew[i]); + if (Length(linenew)>2) and (Copy(linenew, 1, 1) = '[') and (Copy(linenew, Length(linenew), 1) = ']') then + begin + FileLinesave.add(linenew); + section := Copy(linenew, 2, Length(linenew)-2); + for j := 0 to FileLinesold.Count - 1 do + begin + lineold := Trim(FileLinesold[j]); + if (Length(lineold)>2) and (Copy(lineold, 1, 1) = '[') and (Copy(lineold, Length(lineold), 1) = ']') and ((((CompareText(section, 'ttf') <> 0) or (tsection)) and (section = Copy(lineold, 2, Length(lineold)-2))) or ((not tsection) and (CompareText(section, 'ttf') = 0) and (CompareText(Copy(lineold, 2, Length(lineold)-2), 'render') = 0)) or (((CompareText(section, 'video') <> 0) or (vsection)) and (section = Copy(lineold, 2, Length(lineold)-2))) or ((not vsection) and (CompareText(section, 'video') = 0) and (CompareText(Copy(lineold, 2, Length(lineold)-2), 'dosbox') = 0))) then + begin + FileLines := TStringList.Create; + for k := j+1 to FileLinesold.Count - 1 do + begin + lineold := Trim(FileLinesold[k]); + if (Copy(lineold, 1, 4) = 'ttf.') and (CompareText(section, 'ttf') = 0) then + lineold := Copy(lineold, 5, Length(lineold)-4); + if (Length(lineold)>2) and (Copy(lineold, 1, 1) = '[') and (Copy(lineold, Length(lineold), 1) = ']') then + begin + break; + end; + 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 + begin + linetmp := Copy(FileLinesold[k], 1, Pos('=', FileLinesold[k]) - 1); + if (CompareText(section, 'config') = 0) and (CompareText(Trim(linetmp), 'country') = 0) and dosvcn then + begin + addcp := True; + FileLinesold[k] := linetmp + '= 86,936'; + end + else if (CompareText(section, 'config') = 0) and (CompareText(Trim(linetmp), 'country') = 0) and dosvtw then + begin + addcp := True; + FileLinesold[k] := linetmp + '= 886,950'; + end; + FileLinesave.add(FileLinesold[k]); + end; + if (Length(lineold)>0) then + begin + linetmp := Copy(lineold, 1, Pos('=', lineold) - 1); + if (CompareText(section, 'config') = 0) and (CompareText(Trim(linetmp), 'country') = 0) and dosvcn then + begin + lineold := linetmp + '= 86,936'; + end + else if (CompareText(section, 'config') = 0) and (CompareText(Trim(linetmp), 'country') = 0) and dosvtw then + begin + lineold := linetmp + '= 886,950'; + end; + FileLines.add(lineold); + end + end + else if (Length(lineold)>0) and (Copy(lineold, 1, 1) <> '#') then + FileLines.add(lineold); + end; + break; + end + end + end + else if (CompareText(section, '4dos') = 0) or (CompareText(section, 'config') = 0) or (CompareText(section, 'autoexec') = 0) then + begin + linetmp := Copy(FileLinesnew[i], 1, Pos('=', FileLinesnew[i]) - 1); + if (FileLines.Count=0) or (not addcp and (CompareText(section, 'config') = 0) and (CompareText(Trim(linetmp), 'country') = 0)) then + begin + if (CompareText(section, 'config') = 0) and (CompareText(Trim(linetmp), 'country') = 0) and dosvcn then + begin + addcp := True; + FileLinesnew[i] := linetmp + '= 86,936'; + end + else if (CompareText(section, 'config') = 0) and (CompareText(Trim(linetmp), 'country') = 0) and dosvtw then + begin + addcp := True; + FileLinesnew[i] := linetmp + '= 886,950'; + end; + FileLinesave.add(FileLinesnew[i]); + end; + continue; + end + else if (Length(linenew)=0) or ((Copy(linenew, 1, 1) = '#') and (Copy(linenew, 1, 14) <> '#DOSBOX-X-ADV:') and (Copy(linenew, 1, 18) <> '#DOSBOX-X-ADV-SEE:')) then + begin + FileLinesave.add(FileLinesnew[i]); + continue; + end + else if not IsTaskSelected('commonoption') and (Copy(linenew, 1, 15) = '#DOSBOX-X-ADV:#') then + begin + Delete(linenew, 1, 14); + FileLinesave.add(linenew); + continue; + end + else if IsTaskSelected('commonoption') and (Copy(linenew, 1, 19) = '#DOSBOX-X-ADV-SEE:#') then + begin + Delete(linenew, 1, 18); + FileLinesave.add(linenew); + continue; + end + else if (Copy(linenew, 1, 15) = '#DOSBOX-X-ADV:#') or (Copy(linenew, 1, 19) = '#DOSBOX-X-ADV-SEE:#') then + begin + continue; + end + else if (Length(section)>0) and (Length(linenew)>0) and (Pos('=', linenew) > 1) then + begin + adv := 0; + if (Copy(linenew, 1, 14) = '#DOSBOX-X-ADV:') then + begin + Delete(linenew, 1, 14); + adv := 1; + end; + res := 0; + linetmp := Copy(linenew, 1, Pos('=', linenew) - 1); + for j := 0 to FileLines.Count - 1 do + begin + lineold := Trim(FileLines[j]); + if (Length(lineold)>0) and (Pos('=', lineold) > 1) and (CompareText(Trim(linetmp), Trim(Copy(lineold, 1, Pos('=', lineold) - 1))) = 0) then + begin + res := 1; + if (CompareText(section, 'dos') = 0) and (CompareText(Trim(linetmp), 'file access tries') = 0) and (Trim(Copy(lineold, Pos('=', lineold) + 1, Length(lineold))) = '0') then + begin + FileLinesave.add(linetmp + '= 3'); + continue; + end; + if (CompareText(section, 'dos') = 0) and ((CompareText(Trim(linetmp), 'hard drive data rate limit') = 0) or (CompareText(Trim(linetmp), 'floppy drive data rate limit') = 0)) then + begin + if IsTaskSelected('drivedelay') and (Trim(Copy(lineold, Pos('=', lineold) + 1, Length(lineold))) = '0') then + begin + FileLinesave.add(linetmp + '= -1'); + continue; + end; + if not IsTaskSelected('drivedelay') and (Trim(Copy(lineold, Pos('=', lineold) + 1, Length(lineold))) = '-1') then + begin + FileLinesave.add(linetmp + '= 0'); + continue; + end; + end; + if (CompareText(section, 'sdl') = 0) and (CompareText(Trim(linetmp), 'windowposition') = 0) then + begin + if IsTaskSelected('centerwindow') and (Trim(Copy(lineold, Pos('=', lineold) + 1, Length(lineold))) = '-') then + begin + FileLinesave.add(linetmp + '= '); + continue; + end; + if not IsTaskSelected('centerwindow') and ((Trim(Copy(lineold, Pos('=', lineold) + 1, Length(lineold))) = '') or (Trim(Copy(lineold, Pos('=', lineold) + 1, Length(lineold))) = ',')) then + begin + FileLinesave.add(linetmp + '= -'); + continue; + end; + end; + if (CompareText(section, 'sdl') = 0) and (CompareText(Trim(linetmp), 'output') = 0) and (dosvcn or dosvtw) then + begin + FileLinesave.add(linetmp + '= ttf'); + continue; + end; + if (CompareText(section, 'dosbox') = 0) and (CompareText(Trim(linetmp), 'language') = 0) and (SetupType <> 'compact') and dosvcn then + begin + FileLinesave.add(linetmp + '= zh_CN'); + continue; + end; + if (CompareText(section, 'dosbox') = 0) and (CompareText(Trim(linetmp), 'language') = 0) and (SetupType <> 'compact') and dosvtw then + begin + FileLinesave.add(linetmp + '= zh_TW'); + continue; + end; + if (CompareText(section, 'dosv') = 0) and (CompareText(Trim(linetmp), 'dosv') = 0) and ((CompareText(Trim(Copy(lineold, Pos('=', lineold) + 1, Length(lineold))), 'cn') = 0) and dosvcn) or ((CompareText(Trim(Copy(lineold, Pos('=', lineold) + 1, Length(lineold))), 'tw') = 0) and dosvtw) then + begin + FileLinesave.add(linetmp + '= off'); + continue; + end; + if not ((adv = 1) and IsTaskSelected('commonoption') and ((Trim(Copy(lineold, Pos('=', lineold) + 1, Length(lineold))) = Trim(Copy(linenew, Pos('=', linenew) + 1, Length(linenew)))) or ((CompareText(Trim(linetmp), 'drive z hide files') = 0) and (Trim(Copy(lineold, Pos('=', lineold) + 1, Length(lineold))) = '/A20GATE.COM /DSXMENU.EXE /HEXMEM16.EXE /HEXMEM32.EXE /LOADROM.COM /NMITEST.COM /VESAMOED.COM /VFRCRATE.COM')))) then + FileLinesave.add(linetmp + '= ' + Trim(Copy(lineold, Pos('=', lineold) + 1, Length(lineold)))); + FileLines.Delete(j); + break; + end + end; + if (res = 0) and ((adv = 0) or not IsTaskSelected('commonoption')) then + begin + linetmp := Copy(linenew, 1, Pos('=', linenew) - 1); + if (CompareText(Trim(linetmp), 'output') = 0) and (dosvcn or dosvtw) then + linenew := linetmp + '= ttf'; + if (CompareText(Trim(linetmp), 'dosv') = 0) and (dosvcn or dosvtw) then + linenew := linetmp + '= off'; + if (CompareText(Trim(linetmp), 'language') = 0) and (SetupType <> 'compact') and dosvcn then + linenew := linetmp + '= zh_CN'; + if (CompareText(Trim(linetmp), 'language') = 0) and (SetupType <> 'compact') and dosvtw then + linenew := linetmp + '= zh_TW'; + if (CompareText(Trim(linetmp), 'country') = 0) and dosvcn then + linenew := linetmp + '= 86,936'; + if (CompareText(Trim(linetmp), 'country') = 0) and dosvtw then + linenew := linetmp + '= 886,950'; + if (CompareText(Trim(linetmp), 'file access tries') = 0) then + linenew := Copy(Trim(linenew), 1, Length(Trim(linenew)) - 1) + '3'; + if IsTaskSelected('centerwindow') and (CompareText(Trim(linetmp), 'windowposition') = 0) then + linenew := Copy(Trim(linenew), 1, Length(Trim(linenew)) - 2) + ''; + if not IsTaskSelected('drivedelay') and ((CompareText(Trim(linetmp), 'hard drive data rate limit') = 0) or (CompareText(Trim(linetmp), 'floppy drive data rate limit') = 0)) then + linenew := Copy(Trim(linenew), 1, Length(Trim(linenew)) - 2) + '0'; + FileLinesave.add(linenew); + end + end + end; + FileLinesave.SaveToFile(ExpandConstant('{app}\dosbox-x.conf')); + FileLinesold.free; + FileLinesnew.free; + DeleteFile(ExpandConstant('{app}\dosbox-x.conf.old')); + end; + SetLanguage(); + end; + DeleteFile(ExpandConstant('{app}\dosbox-x.reference.setup.conf')); + end +end; +procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); +begin + case CurUninstallStep of + usUninstall: + begin + if FileExists(ExpandConstant('{app}\dosbox-x.conf.old')) then + DeleteFile(ExpandConstant('{app}\dosbox-x.conf.old')); + msg:='Do you want to keep the configuration file dosbox-x.conf?'; + if FileExists(ExpandConstant('{app}\dosbox-x.conf')) and (IsVerySilent() or (MsgBox(msg, mbConfirmation, MB_YESNO) = IDNO)) then + DeleteFile(ExpandConstant('{app}\dosbox-x.conf')); + end + end; +end; +function GetDesktopFolder(Param: String): String; +begin + if (IsAdminLoggedOn or IsPowerUserLoggedOn) then + Result := ExpandConstant('{commondesktop}') + else + Result := ExpandConstant('{userdesktop}'); +end; +function InstallVersion(val: integer): Boolean; +begin + Result := False; + if (PageBuild.Values[0]) and (not PageBuild.Values[7]) and (val = 0) then + Result := True; + if (PageBuild.Values[0]) and (PageBuild.Values[7]) and (val = 1) then + Result := True; + if (PageBuild.Values[1]) and (not PageBuild.Values[7]) and (val = 2) then + Result := True; + if (PageBuild.Values[1]) and (PageBuild.Values[7]) and (val = 3) then + Result := True; + if (PageBuild.Values[2]) and (not PageBuild.Values[7]) and (val = 4) then + Result := True; + if (PageBuild.Values[2]) and (PageBuild.Values[7]) and (val = 5) then + Result := True; + if (PageBuild.Values[3]) and (not PageBuild.Values[7]) and (val = 6) then + Result := True; + if (PageBuild.Values[3]) and (PageBuild.Values[7]) and (val = 7) then + Result := True; + if (PageBuild.Values[4]) and (not PageBuild.Values[7]) and (val = 8) then + Result := True; + if (PageBuild.Values[4]) and (PageBuild.Values[7]) and (val = 9) then + Result := True; + if (PageBuild.Values[5]) and (not PageBuild.Values[7]) and (val = 10) then + Result := True; + if (PageBuild.Values[5]) and (PageBuild.Values[7]) and (val = 11) then + Result := True; + +end; diff --git a/include/keymap.h b/include/keymap.h index 47fae706e63..27b9efe55d7 100644 --- a/include/keymap.h +++ b/include/keymap.h @@ -10,7 +10,7 @@ enum { DKM_DEU, // German keyboard layout (one concerned user, in issue tracker) DKM_JPN_PC98, // Japanese PC98 keyboard layout (for PC-98 emulation) DKM_JPN, // Japanese keyboard layout (one concerned user, in issue tracker, with suggestion for mapping Ro) - + DKM_NON_US, // A non-US keyboard DKM_MAX }; diff --git a/src/dos/dos.cpp b/src/dos/dos.cpp index e6b3ccfcfac..76145a84147 100644 --- a/src/dos/dos.cpp +++ b/src/dos/dos.cpp @@ -1498,10 +1498,16 @@ static Bitu DOS_21Handler(void) { reg_dl = dos.date.day; // calculate day of week (we could of course read it from CMOS, but never mind) - unsigned int a = (14u - reg_dh) / 12u; - unsigned int y = reg_cl - a; - unsigned int m = reg_dh + 12u * a - 2u; - reg_al = (reg_dl + y + (y / 4u) - (y / 100u) + (y / 400u) + (31u * m) / 12u) % 7u; + /* Use Zeller's congruence */ + uint16_t year = reg_cx, month = reg_dh, day = reg_dl; + int8_t weekday; + if(month <= 2) { + year--; + month += 12; + } + weekday = (year + year / 4u - year / 100u + year / 400u + (13u * month + 8u) / 5u + day) % 7; + reg_al = weekday < 0 ? weekday + 7 : weekday; + /* Sunday=0, Monday=1, ... */ } break; case 0x2b: /* Set System Date */ diff --git a/src/dos/dos_programs.cpp b/src/dos/dos_programs.cpp index 182878dd1f2..88d1cad8c30 100644 --- a/src/dos/dos_programs.cpp +++ b/src/dos/dos_programs.cpp @@ -7741,6 +7741,8 @@ class TITLE : public Program { } }; +bool CodePageGuestToHostUTF8(char *d/*CROSS_LEN*/,const char *s/*CROSS_LEN*/); + void TITLE::Run() { // Hack To allow long commandlines @@ -7751,8 +7753,13 @@ void TITLE::Run() PrintUsage(); return; } - char *args=(char *)cmd->GetRawCmdline().c_str(); - dosbox_title=trim(args); + char *args=trim((char *)cmd->GetRawCmdline().c_str()); + char title[4096]; + if(CodePageGuestToHostUTF8(title, args)) { + dosbox_title=title; + } else { + dosbox_title=args; + } SetVal("dosbox", "title", dosbox_title); GFX_SetTitle(-1,-1,-1,false); } diff --git a/src/gui/sdl_mapper.cpp b/src/gui/sdl_mapper.cpp index dab133112d5..1f1ddebbf3a 100644 --- a/src/gui/sdl_mapper.cpp +++ b/src/gui/sdl_mapper.cpp @@ -67,6 +67,10 @@ #include +#if defined(MACOSX) +#include +#endif + #define BMOD_Mod1 0x0001 #define BMOD_Mod2 0x0002 #define BMOD_Mod3 0x0004 @@ -999,7 +1003,7 @@ static SDLKey sdlkey_map[MAX_SCANCODES] = { // Convert hardware scancode (XKB = SDLK_WORLD_14, //0x64 Henkan SDLK_WORLD_15, //0x65 Hiragana/Katakana SDLK_WORLD_13, //0x66 Muhenkan - Z,Z,Z,Z, //0x67-0x6a + Z,SDLK_KP_ENTER,SDLK_RCTRL,SDLK_KP_DIVIDE, //0x67-0x6a Z, //SDLK_PRINTSCREEN, //0x6b SDLK_RALT, //0x6c Z, //0x6d unknown @@ -1159,6 +1163,8 @@ static SDLKey sdlkey_map[MAX_SCANCODES] = { #undef Z +unsigned int Linux_GetKeyboardLayout(void); // defined in sdlmain_linux.cpp + #if !defined(C_SDL2) void setScanCode(Section_prop * section) { usescancodes = -1; @@ -1179,7 +1185,37 @@ void setScanCode(Section_prop * section) { LOG_MSG("SDL_mapper: non-US keyboard detected, set usescancodes=true"); } } -#endif // defined(WIN32) +#elif defined(__linux__) + else { + if(Linux_GetKeyboardLayout() == DKM_US) { /* Locale ID: en-us */ + usescancodes = 0; + LOG_MSG("SDL_mapper: US keyboard detected, set usescancodes=false"); + } + else { + usescancodes = 1; + LOG_MSG("SDL_mapper: non-US keyboard detected, set usescancodes=true"); + } + } +#elif defined(MACOSX) + else { + char layout[128]; + memset(layout, '\0', sizeof(layout)); + TISInputSourceRef source = TISCopyCurrentKeyboardInputSource(); + // get input source id - kTISPropertyInputSourceID + // get layout name - kTISPropertyLocalizedName + CFStringRef layoutID = CFStringRef(TISGetInputSourceProperty(source, kTISPropertyInputSourceID)); + CFStringGetCString(layoutID, layout, sizeof(layout), kCFStringEncodingUTF8); + //LOG_MSG("SDL_mapper: %s\n", layout); + if(!strcasecmp(layout, "com.apple.keylayout.US")) { /* US keyboard layout */ + usescancodes = 0; + LOG_MSG("SDL_mapper: US keyboard detected, set usescancodes=false"); + } + else { + usescancodes = 1; + LOG_MSG("SDL_mapper: non-US keyboard detected, set usescancodes=true"); + } + } +#endif //defined(MACOSX) } void loadScanCode(); const char* DOS_GetLoadedLayout(void); diff --git a/src/gui/sdlmain_linux.cpp b/src/gui/sdlmain_linux.cpp index b22e987a8ce..8e7b6cd08ff 100644 --- a/src/gui/sdlmain_linux.cpp +++ b/src/gui/sdlmain_linux.cpp @@ -240,7 +240,7 @@ void Linux_JPXKBFix(void) { } unsigned int Linux_GetKeyboardLayout(void) { - unsigned int ret = DKM_US; + unsigned int ret = DKM_NON_US; // a non-US keyboard SDL_SysWMinfo wminfo; memset(&wminfo,0,sizeof(wminfo));