Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package qrustyquake for openSUSE:Factory checked in at 2026-11-21 21:46:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/qrustyquake (Old) and /work/SRC/openSUSE:Factory/.qrustyquake.new.1340718 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "qrustyquake" Sat Nov 21 21:46:21 2026 rev:2 rq:1399462 version:1.0.1 Changes: -------- --- /work/SRC/openSUSE:Factory/qrustyquake/qrustyquake.changes 2026-11-19 16:58:13.671699821 +0100 +++ /work/SRC/openSUSE:Factory/.qrustyquake.new.1340718/qrustyquake.changes 2026-11-21 21:47:42.677440477 +0100 @@ -1,0 +2,6 @@ +Fri Nov 20 15:17:23 UTC 2026 - Michael Pujos <[email protected]> + +- Update to 1.0.1 + - fix a UI width scaling performance issue + +------------------------------------------------------------------- Old: ---- qrustyquake-1.0.0.tar.gz New: ---- qrustyquake-1.0.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ qrustyquake.spec ++++++ --- /var/tmp/diff_new_pack.q1fItF/_old 2026-11-21 21:47:43.649481222 +0100 +++ /var/tmp/diff_new_pack.q1fItF/_new 2026-11-21 21:47:43.653481390 +0100 @@ -17,7 +17,7 @@ Name: qrustyquake -Version: 1.0.0 +Version: 1.0.1 Release: 0 Summary: Quake using software rendering with modern maps and mods support License: GPL-3.0-or-later ++++++ qrustyquake-1.0.0.tar.gz -> qrustyquake-1.0.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/.github/workflows/main.yml new/qrustyquake-1.0.1/.github/workflows/main.yml --- old/qrustyquake-1.0.0/.github/workflows/main.yml 2026-11-18 15:54:27.000000000 +0100 +++ new/qrustyquake-1.0.1/.github/workflows/main.yml 2026-11-20 15:33:33.000000000 +0100 @@ -25,6 +25,39 @@ path: build/Release/qrustyquake.exe if-no-files-found: error + windows-xp: + runs-on: ubuntu-latest + # -mcrtdll needs MinGW GCC 14; Ubuntu 24.04 ships 13 + container: debian:trixie + + steps: + - name: Install MinGW-w64 + run: > + apt-get update && apt-get install -y --no-install-recommends + gcc-mingw-w64-i686 g++-mingw-w64-i686 cmake make git + ca-certificates + + - name: Checkout + uses: actions/checkout@v4 + + - name: Configure + run: > + cmake -B bxp -DCMAKE_TOOLCHAIN_FILE=cmake/winxp-i686-mingw.cmake + -DCMAKE_BUILD_TYPE=Release -DQRUSTYQUAKE_VENDOR_SDL=ON + + - name: Build + run: cmake --build bxp --parallel $(nproc) + + - name: Upload artifact + uses: actions/upload-artifact@v7 + with: + name: qrustyquake-windows-xp + path: | + bxp/qrustyquake.exe + bxp/SDL3.dll + bxp/SDL3_mixer.dll + if-no-files-found: error + linux-appimage: runs-on: ubuntu-latest @@ -42,3 +75,64 @@ name: qrustyquake-linux path: AppImage/qrustyquake*.AppImage if-no-files-found: error + + linux-appimage-aarch64: + runs-on: ubuntu-24.04-arm + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Build AppImage + working-directory: AppImage + run: ./build.sh linux/arm64 + + - name: Upload artifact + uses: actions/upload-artifact@v7 + with: + name: qrustyquake-linux-aarch64 + path: AppImage/qrustyquake*.AppImage + if-no-files-found: error + + dos: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install libfl2 + run: sudo apt-get update && sudo apt-get install -y libfl2 + + - name: Build + run: sh dos/build-dos.sh + + - name: Upload artifact + uses: actions/upload-artifact@v7 + with: + name: qrustyquake-dos + path: dos/build/dist/ + if-no-files-found: error + + android: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install NDK and CMake + run: > + $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager + "ndk;28.2.13676358" "cmake;3.31.6" + + - name: Build + working-directory: android + run: JAVA_HOME=$JAVA_HOME_17_X64 ./gradlew assembleRelease + + - name: Upload artifact + uses: actions/upload-artifact@v7 + with: + name: qrustyquake-android + path: android/build/outputs/apk/release/qrustyquake-release.apk + if-no-files-found: error diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/CMakeLists.txt new/qrustyquake-1.0.1/CMakeLists.txt --- old/qrustyquake-1.0.0/CMakeLists.txt 2026-11-18 15:54:27.000000000 +0100 +++ new/qrustyquake-1.0.1/CMakeLists.txt 2026-11-20 15:33:33.000000000 +0100 @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.22) -project(qrustyquake LANGUAGES C HOMEPAGE_URL "https://github.com/cyanbun96/qrustyquake/" VERSION 1.0.0) +project(qrustyquake LANGUAGES C HOMEPAGE_URL "https://github.com/cyanbun96/qrustyquake/" VERSION 1.0.1) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) find_package(Math) @@ -61,7 +61,11 @@ file(GLOB QRUSTYQUAKE_HEADERS CONFIGURE_DEPENDS "${PROJECT_SOURCE_DIR}/src/*.h") file(GLOB QRUSTYQUAKE_SOURCES CONFIGURE_DEPENDS "${PROJECT_SOURCE_DIR}/src/*.c") -add_executable(qrustyquake) +if(ANDROID) # loaded by SDLActivity, see android/ + add_library(qrustyquake SHARED) +else() + add_executable(qrustyquake) +endif() if(EMSCRIPTEN) if(CMAKE_BUILD_TYPE STREQUAL "Release") @@ -69,7 +73,14 @@ target_link_options(qrustyquake PRIVATE -O3) endif() target_link_options(qrustyquake PRIVATE -sALLOW_MEMORY_GROWTH=1 -sINITIAL_MEMORY=1gb -sSTACK_SIZE=10mb -sASYNCIFY) + # 16K modes take ~3 GiB, past the 2 GiB default + target_link_options(qrustyquake PRIVATE -sMAXIMUM_MEMORY=4gb) target_link_options(qrustyquake PRIVATE --preload-file id1) + # the link packs id1, so a changed file there has to relink + file(GLOB_RECURSE QRUSTYQUAKE_PRELOAD CONFIGURE_DEPENDS + "${PROJECT_BINARY_DIR}/id1/*") + set_property(TARGET qrustyquake APPEND PROPERTY + LINK_DEPENDS ${QRUSTYQUAKE_PRELOAD}) if(CMAKE_BUILD_TYPE STREQUAL "Debug") target_compile_options(qrustyquake PRIVATE -gsource-map) endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/README.md new/qrustyquake-1.0.1/README.md --- old/qrustyquake-1.0.0/README.md 2026-11-18 15:54:27.000000000 +0100 +++ new/qrustyquake-1.0.1/README.md 2026-11-20 15:33:33.000000000 +0100 @@ -172,7 +172,7 @@ # System requirements -Windows (v1.0.0): +Windows (v1.0.1): - Windows XP or higher @@ -180,7 +180,7 @@ - If it can run modern Windows, it can run QrustyQuake -Linux AppImage (v1.0.0): +Linux AppImage (v1.0.1): - Ubuntu 22.04, Debian 12, Fedora 36, RHEL/Rocky/Alma 9 or anything newer @@ -204,15 +204,15 @@ # Building -Linux: cd src && make +Linux: cd src && make -j$(nproc) -Windows and BSDs: cmake -B build -DCMAKE_BUILD_TYPE=Release && cd build && cmake --build . +Windows and BSDs: cmake -B build -DCMAKE_BUILD_TYPE=Release && cd build && cmake --build . --parallel Linux release AppImage is built with AppImage/build.sh Use Build_SteamOS.sh for Steam Deck -Build requirements (v1.0.0): +Build requirements (v1.0.1): - A C99 compiler. GCC 5 or newer works with the Makefile as is @@ -230,61 +230,26 @@ # Successful builds -x86_64 unless specified otherwise. +| Platform | CPU | Tested on | Version | Notes | +|:--|:--|:--|:-:|:--| +| **Arch Linux** | x86_64 | Hardware | 1.0.1 | The main platform this port is developed on, so the most likely to work. Built with GCC, Clang and TinyCC | +| **Ubuntu 14.04** | x86_64 | Docker | 1.0.1 | The oldest distro tested. GCC 4.8, with SDL3 and SDL3_mixer built from source using CMake from cmake.org. See [Building](#building) for the GCC 4.8 make command and the SDL option it needs | +| **Linux AppImage** | x86_64 | Docker | 1.0.1 | Starts on Ubuntu 22.04, Debian 12, Fedora 36, Rocky 9 and newer. See [System requirements](#system-requirements) | +| **Linux AppImage** | AArch64 | QEMU (Debian 12) | 1.0.1 | Plays with sound in an emulated VM, too slow there to judge speed. Not tried on real ARM hardware yet | +| **Ubuntu** | RISC-V | MangoPi MQ Pro | 0.8.1 | `timedemo demo1` at 320x200 with all graphics layers set to 0 gets 17 fps | +| **SteamOS** | x86_64 | Steam Deck | 0.8.2 | [`Build_SteamOS.sh`](Build_SteamOS.sh) script by Pup Luka | +| **FreeBSD** | x86_64 | Hardware | 1.0.1 | Seemingly perfect | +| **OpenBSD** | x86_64 | Hardware | 1.0.1 | Seemingly perfect | +| **HaikuOS** | x86_64 | Hardware | 1.0.1 | Seemingly perfect. SDL3_mixer has no Haiku package, so build it from source | +| **macOS** | x86_64 | Hardware | 0.6.2 | 14.6.1: CMake build with SDL3 from Homebrew, without SDL3_mixer. 15.7.2: Makefile build with SDL3 from Homebrew, mixer not tested | +| **Windows** | x86_64 | Hardware, VirtualBox | 1.0.1 | Also runs under Wine | +| **Windows XP** | i686 | VirtualBox | 1.0.1 | Ran with 64 MB of RAM. Cross-built with MinGW, see [`cmake/README-winxp.md`](cmake/README-winxp.md) | +| **DOS** | x86 | FreeDOS (QEMU), DOSBox | 1.0.1 | Built with DJGPP by [`dos/build-dos.sh`](dos/build-dos.sh). `timedemo` against QUAKE.EXE 1.06: 920 vs 680 fps in FreeDOS, 95 vs 112 in DOSBox. In DOSBox, sound stutters below about 25 fps and 1024 or 1280 wide modes stay black | +| **Android APK** | AArch64 | Redmi 9 (LineageOS 20) | 1.0.1 | No touch controls, play with a keyboard (Bluetooth works). The game data goes in `qrustyquake/id1` in the phone's storage. `timedemo demo1` gets 233 fps at 320x240 | +| **Android Termux** | AArch64 | Hardware | 1.0.1 | Ran through X11 with touch controls. *Unpleasant*. The Windows build runs through Winlator: set "DX Wrapper" to "CNC DDraw" if you get a "No outputs found" error | +| **Web (Emscripten)** | WebAssembly | Browsers | 1.0.1 | Dark magic performed by Erysdren, please don't ask me about it. CMakeLists updated by Pup Luka (since commit 5b68511) | -VM is VirtualBox unless specified otherwise. - -- Arch Linux [HW] v1.0.0 - - - The main platform that this port is developed on. The most likely one to work - - - Tested with gcc, clang, and tcc - -- Ubuntu 14.04 [Docker] v1.0.0 - - - The oldest tested distro. GCC 4.8, with SDL3 and SDL3_mixer built from source using CMake from cmake.org - - - See "Build requirements" for the GCC 4.8 make command and the SDL option it needs - -- FreeBSD [HW] v1.0.0 - - - Seemingly perfect - -- OpenBSD [HW] v1.0.0 - - - Seemingly perfect - -- Ubuntu [HW, MangoPi MQ Pro, RISC-V] v0.8.1 - - - "timedemo demo1" at 320x200 with all graphics layers set to 0 gets 17 FPS - -- HaikuOS [HW] v1.0.0 - - - Seemingly perfect - -- Android [HW, Termux, AARCH64, clang] v1.0.0 - - - Ran through X11 with touch controls. *unpleasant* - - - Windows build runs through Winlator. Set "DX Wrapper" to "CNC DDraw" if you get "No outputs found" error. - -- macOS [HW] v0.6.2 - - - Built without SDL3_mixer, with cmake and SDL3 from brew, on 14.6.1 - - - Compiles with Makefile and SDL3 from brew on MacOS 15.7.2 (mixer not tested) - -- Emscripten [Browsers with WebAssembly] v1.0.0 - - - Dark magic performed by Erysdren, please don't ask me about it - - - Updated CMakeLists by Pup Luka (since commit 5b68511) - -- SteamOS [Steam Deck] v0.8.2 - - - Build_SteamOS.sh script by Pup Luka - -- Windows [VM, HW] v1.0.0 +GitHub Actions builds Windows, both Linux AppImages, DOS and the Android APK on every push. # Credits diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/android/.gitignore new/qrustyquake-1.0.1/android/.gitignore --- old/qrustyquake-1.0.0/android/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/qrustyquake-1.0.1/android/.gitignore 2026-11-20 15:33:33.000000000 +0100 @@ -0,0 +1,4 @@ +.gradle/ +.cxx/ +build/ +local.properties diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/android/AndroidManifest.xml new/qrustyquake-1.0.1/android/AndroidManifest.xml --- old/qrustyquake-1.0.0/android/AndroidManifest.xml 1970-01-01 01:00:00.000000000 +0100 +++ new/qrustyquake-1.0.1/android/AndroidManifest.xml 2026-11-20 15:33:33.000000000 +0100 @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android"> + <uses-feature android:glEsVersion="0x00020000" /> + <uses-feature android:name="android.hardware.touchscreen" + android:required="false" /> + <uses-permission android:name="android.permission.INTERNET" /> + <!-- the game data is read from shared storage with plain fopen --> + <uses-permission + android:name="android.permission.MANAGE_EXTERNAL_STORAGE" /> + <uses-permission + android:name="android.permission.WRITE_EXTERNAL_STORAGE" + android:maxSdkVersion="29" /> + <application android:label="QrustyQuake" + android:icon="@drawable/ic_launcher" + android:theme="@android:style/Theme.NoTitleBar.Fullscreen" + android:appCategory="game" + android:requestLegacyExternalStorage="true" + android:enableOnBackInvokedCallback="false" + android:hardwareAccelerated="true"> + <meta-data android:name="SDL_ENV.SDL_ORIENTATIONS" + android:value="LandscapeLeft LandscapeRight" /> + <!-- the back button is Escape, not the end of the game --> + <meta-data android:name="SDL_ENV.SDL_ANDROID_TRAP_BACK_BUTTON" + android:value="1" /> + <activity android:name=".QrustyQuakeActivity" + android:alwaysRetainTaskState="true" + android:launchMode="singleInstance" + android:configChanges="layoutDirection|locale|grammaticalGender|fontScale|fontWeightAdjustment|orientation|uiMode|screenLayout|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation" + android:preferMinimalPostProcessing="true" + android:exported="true"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category + android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> +</manifest> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/android/build.gradle new/qrustyquake-1.0.1/android/build.gradle --- old/qrustyquake-1.0.0/android/build.gradle 1970-01-01 01:00:00.000000000 +0100 +++ new/qrustyquake-1.0.1/android/build.gradle 2026-11-20 15:33:33.000000000 +0100 @@ -0,0 +1,70 @@ +// Android APK. Needs JDK 17, the Android SDK (ANDROID_HOME or a +// local.properties with sdk.dir) and the NDK and CMake versions below. +// ./gradlew assembleRelease +// adb install build/outputs/apk/release/qrustyquake-release.apk +// The release build is signed with the debug key so it installs as it is, +// the debug build has unoptimized native code and is too slow to play. +// The game data goes in the qrustyquake folder of the shared storage, and +// the app asks for "All files access" on its first start. +plugins { + id 'com.android.application' version '8.7.3' +} + +def cmake = file('../CMakeLists.txt').text +def qqver = (cmake =~ /VERSION (\d+)\.(\d+)\.(\d+)\)/)[0] + +// SDL's Android packages carry its Java half with the .so it belongs to, +// prefab hands the libraries to the find_package calls in CMakeLists.txt +def sdlaar(String repo, String lib, String ver, String sha256) +{ + def aar = file("build/sdl/${lib}-${ver}.aar") + if(aar.exists()) return aar + def zip = file("build/sdl/${lib}-devel-${ver}-android.zip") + zip.parentFile.mkdirs() + ant.get(src: "https://github.com/libsdl-org/${repo}/releases/" + + "download/release-${ver}/${zip.name}", dest: zip) + def sum = java.security.MessageDigest.getInstance('SHA-256') + .digest(zip.bytes).encodeHex().toString() + if(sum != sha256) + throw new GradleException("${zip.name}: bad checksum ${sum}") + copy { from zipTree(zip); include aar.name; into aar.parentFile } + zip.delete() + return aar +} + +android { + namespace 'io.github.cyanbun96.qrustyquake' + compileSdk 35 + ndkVersion '28.2.13676358' + defaultConfig { + applicationId 'io.github.cyanbun96.qrustyquake' + minSdk 21 + targetSdk 35 + versionName "${qqver[1]}.${qqver[2]}.${qqver[3]}" + versionCode qqver[1].toInteger() * 10000 + + qqver[2].toInteger() * 100 + qqver[3].toInteger() + ndk.abiFilters 'arm64-v8a' + } + sourceSets.main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = ['java'] + res.srcDirs = ['res'] + } + buildFeatures.prefab true + externalNativeBuild.cmake { + path '../CMakeLists.txt' + version '3.31.6' + } + buildTypes.release { + signingConfig signingConfigs.debug + externalNativeBuild.cmake.arguments '-DCMAKE_BUILD_TYPE=Release' + } + lint.abortOnError false +} + +dependencies { + implementation files(sdlaar('SDL', 'SDL3', '3.4.8', + 'c4c23cec585cb99ea626625dc06b421933dd78733b3841628d86be1c13ab16c6'), + sdlaar('SDL_mixer', 'SDL3_mixer', '3.2.2', + 'bc9684da3d36eb6df7c5f645493dcdaa847822b8613aefadc889e1f8614427f3')) +} Binary files old/qrustyquake-1.0.0/android/gradle/wrapper/gradle-wrapper.jar and new/qrustyquake-1.0.1/android/gradle/wrapper/gradle-wrapper.jar differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/android/gradle/wrapper/gradle-wrapper.properties new/qrustyquake-1.0.1/android/gradle/wrapper/gradle-wrapper.properties --- old/qrustyquake-1.0.0/android/gradle/wrapper/gradle-wrapper.properties 1970-01-01 01:00:00.000000000 +0100 +++ new/qrustyquake-1.0.1/android/gradle/wrapper/gradle-wrapper.properties 2026-11-20 15:33:33.000000000 +0100 @@ -0,0 +1,6 @@ +#Thu Nov 11 18:20:34 PST 2021 +distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/android/gradlew new/qrustyquake-1.0.1/android/gradlew --- old/qrustyquake-1.0.0/android/gradlew 1970-01-01 01:00:00.000000000 +0100 +++ new/qrustyquake-1.0.1/android/gradlew 2026-11-20 15:33:33.000000000 +0100 @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|grep -E -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|grep -E -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/android/gradlew.bat new/qrustyquake-1.0.1/android/gradlew.bat --- old/qrustyquake-1.0.0/android/gradlew.bat 1970-01-01 01:00:00.000000000 +0100 +++ new/qrustyquake-1.0.1/android/gradlew.bat 2026-11-20 15:33:33.000000000 +0100 @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/android/java/io/github/cyanbun96/qrustyquake/QrustyQuakeActivity.java new/qrustyquake-1.0.1/android/java/io/github/cyanbun96/qrustyquake/QrustyQuakeActivity.java --- old/qrustyquake-1.0.0/android/java/io/github/cyanbun96/qrustyquake/QrustyQuakeActivity.java 1970-01-01 01:00:00.000000000 +0100 +++ new/qrustyquake-1.0.1/android/java/io/github/cyanbun96/qrustyquake/QrustyQuakeActivity.java 2026-11-20 15:33:33.000000000 +0100 @@ -0,0 +1,64 @@ +package io.github.cyanbun96.qrustyquake; + +import android.Manifest; +import android.content.ActivityNotFoundException; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.net.Uri; +import android.os.Build; +import android.os.Bundle; +import android.os.Environment; +import android.provider.Settings; +import android.view.InputDevice; +import android.view.KeyEvent; +import java.io.File; +import org.libsdl.app.SDLActivity; + +public class QrustyQuakeActivity extends SDLActivity { + // in shared storage, where file managers and USB transfers reach it + private static final File basedir = new File( + Environment.getExternalStorageDirectory(), "qrustyquake"); + + @Override + protected void onCreate(Bundle state) + { // SDL starts the game once this window has focus, after the grant + super.onCreate(state); + if(Build.VERSION.SDK_INT >= 30){ + if(Environment.isExternalStorageManager()) return; + try{ startActivity(new Intent(Settings + .ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION, + Uri.parse("package:" + getPackageName()))); + }catch(ActivityNotFoundException e){} + }else if(Build.VERSION.SDK_INT >= 23 && checkSelfPermission( + Manifest.permission.WRITE_EXTERNAL_STORAGE) + != PackageManager.PERMISSION_GRANTED) + requestPermissions(new String[]{ + Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0); + } + + @Override + public boolean dispatchKeyEvent(KeyEvent event) + { // SDL takes a keyboard that also has a joystick part (the AULA F75) + // for a gamepad, and its arrows, D-pad keycodes, for gamepad buttons + InputDevice dev = event.getDevice(); + int k = event.getKeyCode(); + if(mBrokenLibraries || dev == null || dev.getKeyboardType() + != InputDevice.KEYBOARD_TYPE_ALPHABETIC + || k < KeyEvent.KEYCODE_DPAD_UP || k > KeyEvent.KEYCODE_DPAD_RIGHT) + return super.dispatchKeyEvent(event); + if(event.getAction() == KeyEvent.ACTION_DOWN) onNativeKeyDown(k); + else if(event.getAction() == KeyEvent.ACTION_UP) onNativeKeyUp(k); + return true; + } + + @Override + protected String[] getLibraries() + { return new String[]{ "SDL3", "SDL3_mixer", "qrustyquake" }; } + + @Override + protected String[] getArguments() + { + new File(basedir, "id1").mkdirs(); // shows where the paks go + return new String[]{ "-basedir", basedir.getPath() }; + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/android/res/drawable/ic_launcher.xml new/qrustyquake-1.0.1/android/res/drawable/ic_launcher.xml --- old/qrustyquake-1.0.0/android/res/drawable/ic_launcher.xml 1970-01-01 01:00:00.000000000 +0100 +++ new/qrustyquake-1.0.1/android/res/drawable/ic_launcher.xml 2026-11-20 15:33:33.000000000 +0100 @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- the 32x32 icon scaled up without smoothing --> +<bitmap xmlns:android="http://schemas.android.com/apk/res/android" + android:src="@drawable/qqicon" + android:filter="false" /> Binary files old/qrustyquake-1.0.0/android/res/drawable-nodpi/qqicon.png and new/qrustyquake-1.0.1/android/res/drawable-nodpi/qqicon.png differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/android/settings.gradle new/qrustyquake-1.0.1/android/settings.gradle --- old/qrustyquake-1.0.0/android/settings.gradle 1970-01-01 01:00:00.000000000 +0100 +++ new/qrustyquake-1.0.1/android/settings.gradle 2026-11-20 15:33:33.000000000 +0100 @@ -0,0 +1,14 @@ +pluginManagement { + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} +dependencyResolutionManagement { + repositories { + google() + mavenCentral() + } +} +rootProject.name = 'qrustyquake' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/cmake/README-winxp.md new/qrustyquake-1.0.1/cmake/README-winxp.md --- old/qrustyquake-1.0.0/cmake/README-winxp.md 2026-11-18 15:54:27.000000000 +0100 +++ new/qrustyquake-1.0.1/cmake/README-winxp.md 2026-11-20 15:33:33.000000000 +0100 @@ -2,12 +2,14 @@ `winxp-i686-mingw.cmake` cross-compiles a 32-bit build that runs on Windows XP, using MinGW-w64 on Linux. Tested on Arch Linux (MinGW-w64 GCC 16.2, -mingw-w64-crt 14) with Windows XP Professional SP3 in VirtualBox. +mingw-w64-crt 14) and Debian 13 (GCC 14.2, the GitHub Actions build) with +Windows XP Professional SP3 in VirtualBox. ## Requirements -- MinGW-w64 for i686 with both gcc and g++, GCC 13 or newer - (`i686-w64-mingw32-gcc --version`). On Arch: `mingw-w64-gcc`. +- MinGW-w64 for i686 with both gcc and g++, GCC 14 or newer + (`i686-w64-mingw32-gcc --version`); GCC 13 has no `-mcrtdll`. On Arch: + `mingw-w64-gcc`. On Debian 13: `gcc-mingw-w64-i686 g++-mingw-w64-i686`. - CMake 3.22 or newer. - git and network access: SDL3 and SDL3_mixer are cloned from GitHub during configure. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/cmake/winxp-i686-mingw.cmake new/qrustyquake-1.0.1/cmake/winxp-i686-mingw.cmake --- old/qrustyquake-1.0.0/cmake/winxp-i686-mingw.cmake 2026-11-18 15:54:27.000000000 +0100 +++ new/qrustyquake-1.0.1/cmake/winxp-i686-mingw.cmake 2026-11-20 15:33:33.000000000 +0100 @@ -1,4 +1,4 @@ -# 32-bit Windows XP cross build with MinGW-w64, GCC 13+ for -mcrtdll: +# 32-bit Windows XP cross build with MinGW-w64, GCC 14+ for -mcrtdll: # cmake -B bxp -DCMAKE_TOOLCHAIN_FILE=cmake/winxp-i686-mingw.cmake \ # -DCMAKE_BUILD_TYPE=Release -DQRUSTYQUAKE_VENDOR_SDL=ON set(CMAKE_SYSTEM_NAME Windows) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/dos/build-dos.sh new/qrustyquake-1.0.1/dos/build-dos.sh --- old/qrustyquake-1.0.0/dos/build-dos.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/qrustyquake-1.0.1/dos/build-dos.sh 2026-11-20 15:33:33.000000000 +0100 @@ -0,0 +1,177 @@ +#!/bin/sh +# Reproducible MS-DOS build of Qrusty Quake +# +# usage: sh build-dos.sh [commit, default HEAD] [work directory, default +# build next to this script] +# +# Builds a commit of the git checkout this script is in; commits from +# before the DOS support stop with an error. Fetches the rest at pinned +# versions and checks them, and leaves the game in <work>/dist, where it +# replaces only its own files, so an ID1 put there stays. Rerunning reuses +# the downloads in <work>/downloads, and two runs for the same commit give +# a byte-identical QRUSTYQ.EXE. +# +# Host: Linux x86_64 (the DJGPP below is a Linux build) with git, curl, +# tar, bzip2, unzip, cmake 3.22 or newer, make and sha256sum, and flex's +# libfl.so.2, which DJGPP's ar loads (package libfl2 on Debian and Ubuntu). +# +# The same steps by hand: +# +# 1. DJGPP cross compiler, GCC 12.2.0 from build-djgpp v3.4: +# https://github.com/andrewwutw/build-djgpp/releases/download/v3.4/ +# djgpp-linux64-gcc1220.tar.bz2, sha256 +# 8464f17017d6ab1b2bb2df4ed82357b5bf692e6e2b7fee37e315638f3d505f00 +# Unpack it and put djgpp/bin on PATH. +# 2. CWSDPMI r7, the DPMI host DJGPP programs load at startup: +# https://www.delorie.com/pub/djgpp/current/v2misc/csdpmi7b.zip, sha256 +# deacda0488e1cdd7c4a9f32fab45662b34c0ed6b2d7d4d13bc07041b62004a8c +# Its terms (CWSDPMI.DOC) ask whoever passes it on without its source +# to tell users they have the right to the source and where it is, +# which CWSDPMI.TXT does: +# https://www.delorie.com/pub/djgpp/current/v2misc/csdpmi7s.zip +# 3. The Qrusty Quake source at that commit (git archive). Its DOS code is +# all behind SDL_PLATFORM_DOS: it turns off the render threads (SDL's +# DOS threads are cooperative) and networking (DJGPP has no sockets, so +# single player only), stands in for fenv.h, fmin and fmax with the x87 +# control word and inline functions, makes the first hunk segment 24 MB +# (DOSBox crashed when CWSDPMI swapped the usual 384 MB request), +# includes SDL_main.h, whose DOS main locks memory for SDL's interrupt +# handlers and enables the near pointers its video driver needs, and +# prints a fatal error a second time, after SDL's switch back to text +# mode has cleared the screen. +# 4. SDL at commit fff6448f523f01e705d771a9f0ae782982b71482 of main (no +# release had the DOS port yet), and the SDL_mixer release the commit's +# CMakeLists.txt names in QRUSTYQUAKE_SDL3_MIXER_VERSION, tag +# release-<version>, without its submodules. +# 5. Configure and build from the source: +# CFLAGS=-DSDL_DISABLE_SSE cmake -B build \ +# -DCMAKE_TOOLCHAIN_FILE=<SDL>/build-scripts/i586-pc-msdosdjgpp.cmake \ +# -DCMAKE_BUILD_TYPE=Release -DQRUSTYQUAKE_VENDOR_SDL=ON \ +# -DFETCHCONTENT_FULLY_DISCONNECTED=ON \ +# -DFETCHCONTENT_SOURCE_DIR_SDL3=<SDL> \ +# -DFETCHCONTENT_SOURCE_DIR_SDL3_MIXER=<SDL_mixer> \ +# -DBUILD_SHARED_LIBS=OFF -DSDL_SHARED=OFF -DSDL_STATIC=ON \ +# -DCMAKE_POSITION_INDEPENDENT_CODE=OFF +# cmake --build build +# Without SDL_DISABLE_SSE, SDL_mixer refuses to start on CPUs without +# SSE, which is every DOS-era one and DOSBox's. SDL_mixer also turns on +# position independent code for every target by default; DJGPP warns +# that it ignores -fPIC, yet SDL_mixer.c still compiles differently, so +# the script has it off. For identical builds the script also sets +# SOURCE_DATE_EPOCH to the commit time (the exe prints its build time) +# and maps the work directory out of file names with -ffile-prefix-map. +# 6. Rename build/qrustyquake.exe to QRUSTYQ.EXE, since plain DOS has 8.3 +# file names, and put CWSDPMI.EXE next to it. The script also adds +# CWSDPMI.DOC, CWSDPMI.TXT and LICENSE.TXT. +# +# Tested with 1.0.0 and these DOS changes on an i5-12600KF, with the +# shareware ID1, timedemo demo1, against the original QUAKE.EXE 1.06. In +# DOSBox 0.74-3, Quake ran at 112 fps and this build at 95. In FreeDOS 1.4 +# under QEMU with KVM (JEMMEX, 128 MB, Sound Blaster 16), Quake ran at +# 680 fps and this build at 920. Sound and music worked in both. +# +# Known problems in DOSBox, which will not be fixed: +# - Sound and music get choppy below about 22 fps. SDL's DOS Sound Blaster +# driver queues only about 45 ms of audio and refills it when the game +# yields to it, once a frame, so a real machine that slow has it too. +# - Modes 1024 and 1280 pixels wide give a black screen while the game +# runs on; 640 and 800 wide work. The cause is unknown. +set -eu + +SDL_URL=https://github.com/libsdl-org/SDL.git +SDL_COMMIT=fff6448f523f01e705d771a9f0ae782982b71482 +MIX_URL=https://github.com/libsdl-org/SDL_mixer.git +DJGPP_TAR=djgpp-linux64-gcc1220.tar.bz2 +DJGPP_URL=https://github.com/andrewwutw/build-djgpp/releases/download/v3.4 +DJGPP_SHA=8464f17017d6ab1b2bb2df4ed82357b5bf692e6e2b7fee37e315638f3d505f00 +CWS_URL=https://www.delorie.com/pub/djgpp/current/v2misc/csdpmi7b.zip +CWS_SHA=deacda0488e1cdd7c4a9f32fab45662b34c0ed6b2d7d4d13bc07041b62004a8c +CWS_SRC=https://www.delorie.com/pub/djgpp/current/v2misc/csdpmi7s.zip + +die() { echo "build-dos.sh: $*" >&2; exit 1; } +for c in git curl tar bzip2 unzip cmake make sha256sum; do + command -v $c >/dev/null || die "needs $c" +done +[ "$(uname -s) $(uname -m)" = "Linux x86_64" ] || + die "needs a Linux x86_64 host for the DJGPP toolchain" +here=$(cd "$(dirname "$0")" && pwd) +repo=$(git -C "$here" rev-parse --show-toplevel 2>/dev/null) || + die "$here is not in a git checkout" +ref=${1:-HEAD} +commit=$(git -C "$repo" rev-parse -q --verify "$ref^{commit}") || + die "no commit $ref in $repo" +git -C "$repo" show "$commit:src/sys_sdl.c" | grep -q SDL_PLATFORM_DOS || + die "$ref has no DOS support" +mixver=$(git -C "$repo" show "$commit:CMakeLists.txt" | sed -n \ + 's/.*QRUSTYQUAKE_SDL3_MIXER_VERSION "\([0-9.]*\)".*/\1/p' | head -1) +[ -n "$mixver" ] || die "no SDL_mixer version in $ref's CMakeLists.txt" +work=${2:-$here/build} +mkdir -p "$work/downloads" +work=$(cd "$work" && pwd) +case $work in *[[:space:]]*) die "the work directory path has spaces";; esac +dl=$work/downloads + +download() { # url sha256 file + if [ ! -f "$3" ]; then + echo "downloading $1" + curl -fsSL -o "$3.part" "$1" + mv "$3.part" "$3" + fi + echo "$2 $3" | sha256sum -c --quiet - || die "$3: wrong checksum" +} +checkout() { # url ref dir [commit it must be] + [ -d "$3/.git" ] || git init -q "$3" + echo "fetching $1 $2" + git -C "$3" fetch -q --depth 1 "$1" "$2" + git -C "$3" checkout -q --force FETCH_HEAD + git -C "$3" clean -q -fdx + [ -z "${4-}" ] || [ "$(git -C "$3" rev-parse HEAD)" = "$4" ] || + die "$1 $2 is not $4" +} + +download "$DJGPP_URL/$DJGPP_TAR" $DJGPP_SHA "$dl/$DJGPP_TAR" +download "$CWS_URL" $CWS_SHA "$dl/csdpmi7b.zip" +rm -rf "$work/djgpp" "$work/cwsdpmi" "$work/qrustyquake" +tar -xjf "$dl/$DJGPP_TAR" -C "$work" +"$work/djgpp/bin/i586-pc-msdosdjgpp-ar" --version >/dev/null 2>&1 || + die "DJGPP's ar does not run, is libfl.so.2 (flex) missing?" +unzip -q "$dl/csdpmi7b.zip" bin/CWSDPMI.EXE bin/cwsdpmi.doc \ + -d "$work/cwsdpmi" +echo "taking $commit from $repo" +mkdir "$work/qrustyquake" +git -C "$repo" archive "$commit" | tar -x -C "$work/qrustyquake" +checkout $SDL_URL $SDL_COMMIT "$work/SDL" $SDL_COMMIT +checkout $MIX_URL refs/tags/release-$mixver "$work/SDL_mixer" + +PATH=$work/djgpp/bin:$PATH +SOURCE_DATE_EPOCH=$(git -C "$repo" log -1 --format=%ct "$commit") +CFLAGS="-DSDL_DISABLE_SSE -ffile-prefix-map=$work=/qq-dos" +export PATH SOURCE_DATE_EPOCH CFLAGS +tc=$work/SDL/build-scripts/i586-pc-msdosdjgpp.cmake +rm -rf "$work/build" +cmake -S "$work/qrustyquake" -B "$work/build" -G "Unix Makefiles" \ + -DCMAKE_TOOLCHAIN_FILE="$tc" \ + -DCMAKE_BUILD_TYPE=Release -DQRUSTYQUAKE_VENDOR_SDL=ON \ + -DFETCHCONTENT_FULLY_DISCONNECTED=ON \ + -DFETCHCONTENT_SOURCE_DIR_SDL3="$work/SDL" \ + -DFETCHCONTENT_SOURCE_DIR_SDL3_MIXER="$work/SDL_mixer" \ + -DBUILD_SHARED_LIBS=OFF -DSDL_SHARED=OFF -DSDL_STATIC=ON \ + -DCMAKE_POSITION_INDEPENDENT_CODE=OFF >/dev/null +cmake --build "$work/build" --parallel "$(getconf _NPROCESSORS_ONLN)" + +d=$work/dist +mkdir -p "$d" +cp "$work/build/qrustyquake.exe" "$d/QRUSTYQ.EXE" +cp "$work/cwsdpmi/bin/CWSDPMI.EXE" "$d/CWSDPMI.EXE" +sed 's/\r*$/\r/' "$work/cwsdpmi/bin/cwsdpmi.doc" > "$d/CWSDPMI.DOC" +sed 's/$/\r/' > "$d/CWSDPMI.TXT" <<EOF +CWSDPMI.EXE is CWSDPMI r7, unmodified, Copyright (C) 1995-2010 Charles W +Sandmann; see CWSDPMI.DOC. You have the right to receive the source code +and binary updates for CWSDPMI. Its source: +$CWS_SRC +EOF +sed 's/\r*$/\r/' "$work/qrustyquake/LICENSE" > "$d/LICENSE.TXT" +echo +echo "done: $d" +echo "commit $commit" +(cd "$d" && sha256sum QRUSTYQ.EXE) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/src/d_surf.c new/qrustyquake-1.0.1/src/d_surf.c --- old/qrustyquake-1.0.0/src/d_surf.c 2026-11-18 15:54:27.000000000 +0100 +++ new/qrustyquake-1.0.1/src/d_surf.c 2026-11-20 15:33:33.000000000 +0100 @@ -85,8 +85,8 @@ D_FlushCaches(0); R_ThreadsSync(); d_pzbuffer = realloc(d_pzbuffer, chunk); - memset(d_pzbuffer, 0, chunk); if(d_pzbuffer == NULL) Sys_Error("Not enough memory for surf cache\n"); + memset(d_pzbuffer, 0, chunk); u8 *cache = (u8*)d_pzbuffer+vid.width*vid.height*sizeof(*d_pzbuffer); D_InitCaches(cache, cachesize); // the frame being drawn tests its alias models against the new one diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/src/defines.h new/qrustyquake-1.0.1/src/defines.h --- old/qrustyquake-1.0.0/src/defines.h 2026-11-18 15:54:27.000000000 +0100 +++ new/qrustyquake-1.0.1/src/defines.h 2026-11-20 15:33:33.000000000 +0100 @@ -8,7 +8,9 @@ #else #define Q_SIL static inline __attribute__((always_inline)) #define Q_NOINLINE __attribute__((noinline)) -#ifdef __TINYC__ // no thread local storage, so no render threads (r_thread.c) +// tcc has no thread local storage and DOS has no preemptive threads, so no +// render threads there (r_thread.c) +#if defined(__TINYC__) || defined(SDL_PLATFORM_DOS) #define Q_TLS #define Q_NOTHREADS #else @@ -430,7 +432,7 @@ #define ALIAS_Z_CLIP_PLANE 5 #define LIT_LUT_RES 64 #define QUANT(x) (((x) * (LIT_LUT_RES - 1)) / 255) -#define VERSION 1.00 // quakedef.h +#define VERSION 1.01 // quakedef.h #define GAMENAME "id1" #define CMDLINE_LENGTH 256 #define CACHE_SIZE 32 // used to align key data structures @@ -519,13 +521,8 @@ #define CLIP_RIGHT 2 #define CLIP_BOTTOM 4 #define CLIP_TOP 8 // r_showtris -#ifdef __EMSCRIPTEN__ -#define MAXHEIGHT 600 // erysdren -#define MAXWIDTH 800 -#else #define MAXHEIGHT 8640 // CyanBun96: 16k resolution. futureproofing. #define MAXWIDTH 15360 -#endif #define SIN_BUFFER_SIZE (((MAXHEIGHT>MAXWIDTH)?MAXHEIGHT:MAXWIDTH)+128) #define MAXSPANS 32768 // CyanBun96: expanding limits #define ALIAS_LEFT_CLIP 0x0001 // flags in finalvert_t.flags diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/src/in_sdl.c new/qrustyquake-1.0.1/src/in_sdl.c --- old/qrustyquake-1.0.0/src/in_sdl.c 2026-11-18 15:54:27.000000000 +0100 +++ new/qrustyquake-1.0.1/src/in_sdl.c 2026-11-20 15:33:33.000000000 +0100 @@ -110,6 +110,9 @@ case SDLK_F11: sym = K_F11; break; case SDLK_F12: sym = K_F12; break; case SDLK_PAUSE: sym = K_PAUSE; break; +#ifdef SDL_PLATFORM_ANDROID + case SDLK_AC_BACK: sym = K_ESCAPE; break; +#endif // CyanBun96: vim-like keybinds that work in menus case SDLK_H: sym = vimmode ? K_LEFTARROW : 'h'; break; case SDLK_J: sym = vimmode ? K_DOWNARROW : 'j'; break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/src/menu.c new/qrustyquake-1.0.1/src/menu.c --- old/qrustyquake-1.0.0/src/menu.c 2026-11-18 15:54:27.000000000 +0100 +++ new/qrustyquake-1.0.1/src/menu.c 2026-11-20 15:33:33.000000000 +0100 @@ -2247,12 +2247,10 @@ }else if(display_cursor == 13 && newwinmode == 1 && moden && VID_SizeOK(mode->w, mode->h)){ VID_SetMode(-1, mode->w, mode->h, newwinmode); - if(!aspectr_lock.value)Cvar_SetValue("aspectr", 0); }else if(display_cursor == 14 && VID_SizeOK( atoi(customwidthstr), atoi(customheightstr))){ VID_SetMode(-1, atoi(customwidthstr), atoi(customheightstr), newwinmode); - if(!aspectr_lock.value)Cvar_SetValue("aspectr", 0); } break; case K_UPARROW: @@ -3353,7 +3351,6 @@ case K_ENTER: S_LocalSound("misc/menu1.wav"); VID_SetMode(vid_line, 0, 0, 0); - if(!aspectr_lock.value)Cvar_SetValue("aspectr", 0); break; case 'T': case 't': diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/src/net_bsd.c new/qrustyquake-1.0.1/src/net_bsd.c --- old/qrustyquake-1.0.0/src/net_bsd.c 2026-11-18 15:54:27.000000000 +0100 +++ new/qrustyquake-1.0.1/src/net_bsd.c 2026-11-20 15:33:33.000000000 +0100 @@ -5,13 +5,16 @@ Loop_Connect, Loop_CheckNewConnections, Loop_GetMessage, Loop_SendMessage, Loop_SendUnreliableMessage, Loop_CanSendMessage, Loop_Close, Loop_Shutdown }, +#ifndef SDL_PLATFORM_DOS // DJGPP has no sockets, so single player only { 0, Datagram_Init, Datagram_Listen, Datagram_SearchForHosts, Datagram_Connect, Datagram_CheckNewConnections, Datagram_GetMessage, Datagram_SendMessage, Datagram_SendUnreliableMessage, Datagram_CanSendMessage, Datagram_Close, Datagram_Shutdown } +#endif }; const s32 net_numdrivers = Q_COUNTOF(net_drivers); +#ifndef SDL_PLATFORM_DOS net_landriver_t net_landrivers[] = { { 0, 0, UDP_Init, UDP_Shutdown, UDP_Listen, UDP_OpenSocket, UDP_CloseSocket, UDP_Connect, UDP_CheckNewConnections, UDP_Read, @@ -19,3 +22,4 @@ UDP_GetNameFromAddr, UDP_GetAddrFromName, UDP_AddrCompare, UDP_GetSocketPort, UDP_SetSocketPort } }; const s32 net_numlandrivers = Q_COUNTOF(net_landrivers); +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/src/net_dgrm.c new/qrustyquake-1.0.1/src/net_dgrm.c --- old/qrustyquake-1.0.0/src/net_dgrm.c 2026-11-18 15:54:27.000000000 +0100 +++ new/qrustyquake-1.0.1/src/net_dgrm.c 2026-11-20 15:33:33.000000000 +0100 @@ -2,6 +2,7 @@ // Copyright(C) 2010-2014 QuakeSpasm developers // GPLv3 See LICENSE for details. #include "quakedef.h" +#ifndef SDL_PLATFORM_DOS // no sockets in DJGPP, see net_bsd.c #define sfunc net_landrivers[sock->landriver] // readability macros #define dfunc net_landrivers[net_landriverlevel] @@ -1096,3 +1097,4 @@ } #undef sfunc #undef dfunc +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/src/net_udp.c new/qrustyquake-1.0.1/src/net_udp.c --- old/qrustyquake-1.0.0/src/net_udp.c 2026-11-18 15:54:27.000000000 +0100 +++ new/qrustyquake-1.0.1/src/net_udp.c 2026-11-20 15:33:33.000000000 +0100 @@ -4,6 +4,7 @@ // GPLv3 See LICENSE for details. #include "quakedef.h" +#ifndef SDL_PLATFORM_DOS // no sockets in DJGPP, see net_bsd.c #ifdef SDL_PLATFORM_WINDOWS const c8 *__WSAE_StrError(s32 errcode) @@ -343,3 +344,4 @@ ((struct sockaddr_in *)addr)->sin_port = htons((u16)port); return 0; } +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/src/r_main.c new/qrustyquake-1.0.1/src/r_main.c --- old/qrustyquake-1.0.0/src/r_main.c 2026-11-18 15:54:27.000000000 +0100 +++ new/qrustyquake-1.0.1/src/r_main.c 2026-11-20 15:33:33.000000000 +0100 @@ -1,6 +1,8 @@ // Copyright(C) 1996-1997 Id Software, Inc. GPLv3 See LICENSE for details. #include "quakedef.h" +#ifndef SDL_PLATFORM_DOS // DJGPP has none, sysincludes.h stands in for it #include <fenv.h> +#endif #ifndef FE_TOWARDZERO // not every target can change it #define FE_TOWARDZERO FE_TONEAREST diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/src/r_thread.c new/qrustyquake-1.0.1/src/r_thread.c --- old/qrustyquake-1.0.0/src/r_thread.c 2026-11-18 15:54:27.000000000 +0100 +++ new/qrustyquake-1.0.1/src/r_thread.c 2026-11-20 15:33:33.000000000 +0100 @@ -12,7 +12,9 @@ #include <sched.h> #endif #include "quakedef.h" +#ifndef SDL_PLATFORM_DOS // DJGPP has none, sysincludes.h stands in for it #include <fenv.h> +#endif #define R_BANDSPERWORKER 4 #define R_STACKSIZE (4 << 20) // D_PolysetDraw keeps a span per screen row diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/src/sys_sdl.c new/qrustyquake-1.0.1/src/sys_sdl.c --- old/qrustyquake-1.0.0/src/sys_sdl.c 2026-11-18 15:54:27.000000000 +0100 +++ new/qrustyquake-1.0.1/src/sys_sdl.c 2026-11-20 15:33:33.000000000 +0100 @@ -1,5 +1,19 @@ #include "quakedef.h" static FILE *sys_handles[MAX_HANDLES]; +#ifdef SDL_PLATFORM_ANDROID +#include <SDL3/SDL_main.h> // main becomes SDL_main, run by SDLActivity +static jmp_buf sys_exitjmp; // Android wants main to return, not exit() +static s32 sys_exitcode; +static SDL_ThreadID sys_mainthread; +static void Sys_Exit(s32 code) +{ + if(SDL_GetCurrentThreadID() != sys_mainthread) exit(code); + sys_exitcode = code; + longjmp(sys_exitjmp, 1); +} +#else +#define Sys_Exit exit +#endif void Sys_Printf(const c8 *fmt, ...) { @@ -10,13 +24,21 @@ vsnprintf(qtext, sizeof(qtext), fmt, argptr); va_end(argptr); UTF8_FromQuake(u8text, sizeof(u8text), qtext); +#ifdef SDL_PLATFORM_ANDROID + SDL_Log("%s", u8text); // to logcat, stdout goes nowhere +#else printf("%s", u8text); +#endif } void Sys_Quit() { CDAudio_Stop(); - if(!exitstyle.value){ + bool endscreen = !exitstyle.value; +#ifdef SDL_PLATFORM_ANDROID // in the background or being closed, unseen + if(SDL_GetWindowFlags(window) & SDL_WINDOW_MINIMIZED) endscreen = 0; +#endif + if(endscreen){ u16 *screen; // erysdren(it/its) if(registered.value)screen=(u16*)COM_LoadHunkFile("end2.bin",0); else screen = (u16*)COM_LoadHunkFile("end1.bin", 0); @@ -27,7 +49,7 @@ #ifdef __EMSCRIPTEN__ emscripten_cancel_main_loop(); #else - exit(0); + Sys_Exit(0); #endif } @@ -42,10 +64,13 @@ fprintf(stderr, "Error: %s\n", str); SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "QrustyQuake", str, 0); Host_Shutdown(); +#ifdef SDL_PLATFORM_DOS // again, as going back to text mode cleared the screen + fprintf(stderr, "Error: %s\n", str); +#endif #ifdef __EMSCRIPTEN__ emscripten_cancel_main_loop(); #else - exit(1); + Sys_Exit(1); #endif } @@ -160,9 +185,16 @@ } #endif +#ifdef SDL_PLATFORM_DOS // SDL's main runs this one, after locking memory for +#include <SDL3/SDL_main.h> // its interrupt handlers and enabling near pointers +#endif int main(int c, char **v) { // the identifier names the window to the desktop (Wayland app_id, X11 // class), the same as AppImage/qrustyquake.desktop, whatever the binary +#ifdef SDL_PLATFORM_ANDROID + sys_mainthread = SDL_GetCurrentThreadID(); + if(setjmp(sys_exitjmp)) return sys_exitcode; +#endif c8 version[16]; snprintf(version, sizeof(version), "%.2f", VERSION); SDL_SetAppMetadata("QrustyQuake", version, "qrustyquake"); @@ -173,7 +205,11 @@ host_parms.argv = (c8**)v; COM_InitArgv(host_parms.argc, (c8**)host_parms.argv); // the first hunk segment, as in Ironwail; more are added when it fills +#ifdef SDL_PLATFORM_DOS // CWSDPMI backs a big one with its swap file, and + host_parms.memsize = 24*1024*1024; // DOSBox died on 162 MB of that +#else host_parms.memsize = 384*1024*1024; +#endif if(COM_CheckParm("-heapsize")){ s32 t = COM_CheckParm("-heapsize") + 1; if(t < c) host_parms.memsize = q_max(atoi(v[t]), 1024) * 1024; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/src/sysincludes.h new/qrustyquake-1.0.1/src/sysincludes.h --- old/qrustyquake-1.0.0/src/sysincludes.h 2026-11-18 15:54:27.000000000 +0100 +++ new/qrustyquake-1.0.1/src/sysincludes.h 2026-11-20 15:33:33.000000000 +0100 @@ -18,10 +18,12 @@ #include <unistd.h> #include <sys/param.h> #include <sys/ioctl.h> +#ifndef SDL_PLATFORM_DOS // DJGPP has no sockets, loopback only (net_bsd.c) #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> +#endif #else // SDL_PLATFORM_WINDOWS #define WIN32_LEAN_AND_MEAN #ifndef _USE_WINSOCK2 @@ -32,6 +34,17 @@ #include <direct.h> #include <io.h> #endif +#ifdef SDL_PLATFORM_DOS // DJGPP has no fenv.h; the rounding r_main.c and +#define FE_TONEAREST RC_NEAR // r_thread.c set is the x87 control word's +#define FE_TOWARDZERO RC_CHOP +typedef unsigned int fenv_t; +#define fesetround(r) _control87((r), MCW_RC) +#define fegetenv(e) (*(e) = _control87(0, 0)) +#define fesetenv(e) _control87(*(e), 0xffff) +// nor C99 fmin and fmax (model.c) +static inline double fmin(double a, double b){return b!=b || a<b ? a : b;} +static inline double fmax(double a, double b){return b!=b || a>b ? a : b;} +#endif #include <SDL3/SDL.h> #ifdef AVAIL_SDL3MIXER #include <SDL3_mixer/SDL_mixer.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qrustyquake-1.0.0/src/vid_sdl.c new/qrustyquake-1.0.1/src/vid_sdl.c --- old/qrustyquake-1.0.0/src/vid_sdl.c 2026-11-18 15:54:27.000000000 +0100 +++ new/qrustyquake-1.0.1/src/vid_sdl.c 2026-11-20 15:33:33.000000000 +0100 @@ -18,6 +18,16 @@ static SDL_Palette *idxpals[3]; // top and ui, the world uses sdlpals[0] static u8 idxrows[3][MAXHEIGHT]; // overlay rows the textures hold drawings in static bool idxany[3]; // anything drawn in the overlay textures +// scr_uixscale and scr_uiyscale stretch the ui and sbar layers here, SDL's +// scaled blits of colour-keyed 8-bit surfaces go through its slow generic loop +static struct { + u32 x0, x1, y0, y1; // the part of the screen the layers cover + u16 x[MAXWIDTH], y[MAXHEIGHT]; // the source column and row of each +} vid_str; +static u8 *uiscaledpixels; // the stretched ui layer +static u8 uiscaledrows[MAXHEIGHT]; // its rows that hold a drawing +static u8 sbarmap[256]; // the sbar palette's indices in the world palette +static bool sbarmapok; static s32 renderscale; static s32 scalemode; // what a mode test from the video menu returns to @@ -84,6 +94,7 @@ colors[i].b); } SDL_SetPaletteColors(sdlpals[l], colors, 0, 256); + if(l == 0 || l == 3) sbarmapok = false; if(l == 1 || l == 2){ if(!idxpals[l] && !(idxpals[l] = SDL_CreatePalette(256))) return; @@ -94,10 +105,17 @@ void VID_SetWindowed() { +#ifdef SDL_PLATFORM_ANDROID // the window is the whole screen either way, + SDL_SetWindowFullscreenMode(window, 0); // but this hides the bars + SDL_SetWindowFullscreen(window, 1); + return; +#endif SDL_SetWindowFullscreen(window, 0); +#ifndef __EMSCRIPTEN__ // the page's CSS sizes the canvas, a set size stretches SDL_SetWindowSize(window,vid.width*renderscale,vid.height*renderscale); SDL_SetWindowPosition(window, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED); +#endif } void VID_SetFullscreen(s32 w, s32 h) @@ -286,6 +304,17 @@ aspectr.value = 1.333333; realwidth.value = vid.width*renderscale; realheight.value = (s32)(vid.width / aspectr.value + 0.5) * renderscale; +#ifdef SDL_PLATFORM_DOS // the window is a VESA mode, and a config from another + SDL_DisplayMode m; // machine can ask for more than the card has + if(!SDL_GetClosestFullscreenDisplayMode(SDL_GetPrimaryDisplay(), + realwidth.value, realheight.value, 0, 0, &m)){ + Con_Printf("No video mode for %dx%d, using 320x240\n", + (s32)realwidth.value, (s32)realheight.value); + realwidth.value = vid.width = 320; + realheight.value = vid.height = 240; + renderscale = 1; + } +#endif // the size is in points, with high pixel density the window has as // many pixels as the screen gives it, and the picture is scaled by us window = SDL_CreateWindow("QrustyQuake", realwidth.value, @@ -395,11 +424,18 @@ Sbar_CalcPos(); } +static struct { // the composite of the frame, see VID_CompositeRuns + u32 *pixels; + s32 pitch, rs1; + const u8 *ui; // screenui's pixels or the stretched copy + u8 rows[MAXHEIGHT]; // which layers each row has +} vid_comp; + Q_SIL void VID_CompositeRows(u32 *d, s32 pitch, s32 rs, s32 ui, s32 top, u32 y0, u32 y1) { // world, ui and top layers to window_format in one pass, rs x rs nearest const u8 *w = (u8 *)screen->pixels + y0 * vid.width; - const u8 *u = (u8 *)screenui->pixels + y0 * vid.width; + const u8 *u = vid_comp.ui + y0 * vid.width; const u8 *t = (u8 *)screentop->pixels + y0 * vid.width; const u32 *wl = pallut[0], *tl = pallut[1], *ul = pallut[2]; u32 width = vid.width; // a local, the u32 stores could change vid @@ -436,12 +472,6 @@ return e; } -static struct { // the composite of the frame, see VID_CompositeRuns - u32 *pixels; - s32 pitch, rs1; - u8 rows[MAXHEIGHT]; // which layers each row has -} vid_comp; - static void VID_CompositeRuns(u32 y0, u32 y1) { for(u32 y = y0, e; y < y1; y = e){ @@ -464,16 +494,83 @@ R_ThreadsHelp(); } -static void VID_UploadOverlay(s32 l, bool used) +static void VID_StretchMaps(const SDL_Rect *r) +{ // SDL's nearest stepping, from the middle of each pixel + vid_str.x0 = vid_str.x1 = vid_str.y0 = vid_str.y1 = 0; + if(r->w <= 0 || r->h <= 0) return; + vid_str.x0 = q_max(r->x, 0); + vid_str.x1 = q_min(r->x + r->w, (s32)vid.width); + vid_str.y0 = q_max(r->y, 0); + vid_str.y1 = q_min(r->y + r->h, (s32)vid.height); + u32 inc = (vid.width << 16) / r->w; + for(u32 x = vid_str.x0; x < vid_str.x1; ++x) + vid_str.x[x] = (inc / 2 + (u32)((s32)x - r->x) * inc) >> 16; + inc = (vid.height << 16) / r->h; + for(u32 y = vid_str.y0; y < vid_str.y1; ++y) + vid_str.y[y] = (inc / 2 + (u32)((s32)y - r->y) * inc) >> 16; +} + +static void VID_SbarMap() +{ // as SDL maps 8-bit blits: the same index if the colours match, else nearest + const SDL_Color *s = sdlpals[3]->colors, *w = sdlpals[0]->colors; + bool same = !memcmp(s, w, 256 * sizeof(SDL_Color)); + for(s32 i = 0; i < 256; ++i){ + sbarmap[i] = i; + for(u32 j = 0, best = ~0u; !same && j < 256 && best; ++j){ + s32 r = w[j].r - s[i].r, g = w[j].g - s[i].g, + b = w[j].b - s[i].b; + u32 d = r * r + g * g + b * b; + if(d < best){ best = d; sbarmap[i] = j; } + } + } + sbarmapok = true; +} + +static void VID_StretchSbar() +{ // keyed onto the world, the rows from drawn source rows only + if(!sbarmapok) VID_SbarMap(); + const u8 *s = screensbar->pixels; + for(u32 y = vid_str.y0; y < vid_str.y1; ++y){ + if(!drawnrows[3][vid_str.y[y]]) continue; + const u8 *sr = s + vid_str.y[y] * vid.width; + u8 *d = (u8 *)screen->pixels + y * vid.width; + for(u32 x = vid_str.x0; x < vid_str.x1; ++x){ + u8 c = sr[vid_str.x[x]]; + if(c != 255) d[x] = sbarmap[c]; + } + } +} + +static void VID_StretchUI() +{ // a layer of the screen's size for the paths that take the layers as is + const u8 *s = screenui->pixels; + for(u32 y = 0; y < vid.height; ++y){ + u8 *d = uiscaledpixels + y * vid.width; + if(y < vid_str.y0 || y >= vid_str.y1 + || !drawnrows[2][vid_str.y[y]]){ + if(uiscaledrows[y]) memset(d, 255, vid.width); + uiscaledrows[y] = 0; + continue; + } + const u8 *sr = s + vid_str.y[y] * vid.width; + memset(d, 255, vid_str.x0); + for(u32 x = vid_str.x0; x < vid_str.x1; ++x) + d[x] = sr[vid_str.x[x]]; + memset(d + vid_str.x1, 255, vid.width - vid_str.x1); + uiscaledrows[y] = 1; + } +} + +static void VID_UploadOverlay(s32 l, const u8 *pixels, const u8 *drawn, + bool used) { // the rows drawn in now and the ones still holding an older drawing u8 rows[MAXHEIGHT]; idxany[l] = false; for(u32 y = 0; y < vid.height; ++y){ - rows[y] = (used && drawnrows[l][y]) || idxrows[l][y]; - idxrows[l][y] = used && drawnrows[l][y]; + rows[y] = (used && drawn[y]) || idxrows[l][y]; + idxrows[l][y] = used && drawn[y]; idxany[l] |= idxrows[l][y]; } - const u8 *pixels = scrbuffs[l]->pixels; for(u32 y = 0, e; y < vid.height; y = e){ e = VID_RowRun(rows, y); SDL_Rect r = {0, y, vid.width, e - y}; @@ -510,9 +607,9 @@ scRect2.x = ((s32)vid.width*renderscale - scRect2.w) / 2; scRect2.y = ((s32)vid.height*renderscale - scRect2.h) / 2; u8 *sbrows = drawnrows[3]; - if(blitscreensbar && (scRect.w != blitRect.w || scRect.h != blitRect.h)) - SDL_BlitSurfaceScaled(screensbar, &blitRect, screen, - &scRect, SDL_SCALEMODE_NEAREST); // 8-bit to 8-bit + bool scaled = scRect.w != blitRect.w || scRect.h != blitRect.h; + if(scaled) VID_StretchMaps(&scRect); + if(blitscreensbar && scaled) VID_StretchSbar(); else if(blitscreensbar) // unscaled, the other rows are clear for(u32 y = 0, e; y < vid.height; y = e){ e = VID_RowRun(sbrows, y); @@ -524,28 +621,34 @@ // nearest sampling and alpha 0 or 1 make the GPU's layering exact, // screenshots need the converted pixels bool indexed = idxtex[0] && renderscale == 1 && !scrshot_name[0] - && scalemode == SDL_SCALEMODE_NEAREST - && (!blitscreenui || (scRect2.w==dst.w && scRect2.h==dst.h)); + && scalemode == SDL_SCALEMODE_NEAREST; + bool composite = SDL_BYTESPERPIXEL(window_format) == 4 + && (renderscale == 1 || scalemode != SDL_SCALEMODE_LINEAR); + vid_comp.ui = screenui->pixels; + const u8 *uirows = drawnrows[2]; + if(blitscreenui && scaled && (indexed || composite)){ + VID_StretchUI(); + vid_comp.ui = uiscaledpixels; + uirows = uiscaledrows; + } if(indexed){ SDL_UpdateTexture(idxtex[0], NULL, screen->pixels, vid.width); - VID_UploadOverlay(1, blitscreentop); - VID_UploadOverlay(2, blitscreenui); + VID_UploadOverlay(1, screentop->pixels, drawnrows[1], + blitscreentop); + VID_UploadOverlay(2, vid_comp.ui, uirows, blitscreenui); }else if(SDL_LockTexture(texture,0, &argbbuffer->pixels, &argbbuffer->pitch)){ - if(SDL_BYTESPERPIXEL(window_format) == 4 - && (renderscale == 1 || scalemode != SDL_SCALEMODE_LINEAR) - && (!blitscreenui || (scRect2.w==dst.w && scRect2.h==dst.h))) - { // rows without overlays on them take the plain world loop + if(composite){ // rows without overlays take the plain loop u8 *rows = vid_comp.rows; for(u32 y = 0; y < vid.height; ++y) - rows[y] = (blitscreenui && drawnrows[2][y]) * 2 + rows[y] = (blitscreenui && uirows[y]) * 2 + (blitscreentop && drawnrows[1][y]); vid_comp.pixels = argbbuffer->pixels; vid_comp.pitch = argbbuffer->pitch / 4; vid_comp.rs1 = renderscale == 1; VID_CompositeFrame(); } - else{ // linear filtering or a scaled UI layer + else{ // linear filtering at a render scale, or not 32-bit SDL_BlitSurfaceScaled(screen, &blitRect, argbbuffer, &dst, scalemode); if(blitscreenui) @@ -617,13 +720,17 @@ toppixels = realloc(toppixels, area); uipixels = realloc(uipixels, area); sbarpixels = realloc(sbarpixels, area); + uiscaledpixels = realloc(uiscaledpixels, area); free(r_warpbuffer); // calloc doesn't touch it until it's used r_warpbuffer = calloc(area, 1); - if(!screenpixels||!toppixels||!uipixels||!sbarpixels||!r_warpbuffer) + if(!screenpixels||!toppixels||!uipixels||!sbarpixels||!uiscaledpixels + ||!r_warpbuffer) Sys_Error("Not enough memory for video mode"); D_AllocCutoutBuf(area); memset(toppixels, 255, area); // 255 is transparent in the overlays memset(uipixels, 255, area); + memset(uiscaledpixels, 255, area); + memset(uiscaledrows, 0, sizeof(uiscaledrows)); memset(sbarpixels, 255, area); memset(drawnrows, 0, sizeof(drawnrows)); screen->pixels = vid.buffer = screenpixels; @@ -640,6 +747,7 @@ R_ThreadsIdle(); // the bands are cut for the old size if(modenum == vid_modenum && (!custw || !custh)) return; + u32 oldw = vid.width, oldh = vid.height; if(custw && custh){ vid.width = custw; vid.height = custh; @@ -696,6 +804,8 @@ else VID_SetBorderless(); } realwidth.value = 0; + if(!aspectr_lock.value && (vid.width != oldw || vid.height != oldh)) + aspectr.value = 0; // follow the new shape VID_CalcScreenDimensions(0); Cvar_SetROM("vid_mode", va("%d", vid_modenum)); if(vid_testingmode) return; // the config keeps the mode to return to
