dsda-doom: update to 0.29.3.

Remove the 'affinity hack' patch, which reverted its removal from 0.24.2
upstream. Not entirely sure why the patch was added since it wasn't explained
in the commit or the PR. The 'affinity hack' was added to older versions of
prboom to limit execution to a single core since fluidsynth can be CPU
intensive.
This commit is contained in:
oreo639 2025-07-30 03:56:12 -07:00 committed by oreo639
parent a81ac917d8
commit ffa90c9a8c
2 changed files with 4 additions and 168 deletions

View file

@ -1,165 +0,0 @@
diff --git a/prboom2/CMakeLists.txt b/prboom2/CMakeLists.txt
index d317ddec..c86f76b0 100644
--- a/prboom2/CMakeLists.txt
+++ b/prboom2/CMakeLists.txt
@@ -53,6 +53,15 @@ endif()
check_symbol_exists(getopt "unistd.h" HAVE_GETOPT)
check_symbol_exists(mmap "sys/mman.h" HAVE_MMAP)
check_symbol_exists(CreateFileMapping "windows.h" HAVE_CREATE_FILE_MAPPING)
+if(NOT WIN32)
+ set(CMAKE_REQUIRED_DEFINITIONS_PREV ${CMAKE_REQUIRED_DEFINITIONS})
+ set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE)
+ check_symbol_exists(sched_setaffinity "sched.h" HAVE_SCHED_SETAFFINITY)
+ set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS_PREV})
+ if(HAVE_SCHED_SETAFFINITY)
+ add_definitions(-D_GNU_SOURCE)
+ endif()
+endif()
check_symbol_exists(strsignal "string.h" HAVE_STRSIGNAL)
check_symbol_exists(mkstemp "stdlib.h" HAVE_MKSTEMP)
diff --git a/prboom2/cmake/config.h.cin b/prboom2/cmake/config.h.cin
index f92f3d88..2ad70033 100644
--- a/prboom2/cmake/config.h.cin
+++ b/prboom2/cmake/config.h.cin
@@ -11,6 +11,7 @@
#cmakedefine HAVE_GETOPT
#cmakedefine HAVE_MMAP
#cmakedefine HAVE_CREATE_FILE_MAPPING
+#cmakedefine HAVE_SCHED_SETAFFINITY
#cmakedefine HAVE_STRSIGNAL
#cmakedefine HAVE_MKSTEMP
diff --git a/prboom2/src/SDL/i_main.c b/prboom2/src/SDL/i_main.c
index 7537c53f..670f3dbd 100644
--- a/prboom2/src/SDL/i_main.c
+++ b/prboom2/src/SDL/i_main.c
@@ -45,6 +45,9 @@
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
+typedef BOOL (WINAPI *SetAffinityFunc)(HANDLE hProcess, DWORD mask);
+#else
+#include <sched.h>
#endif
#include <errno.h>
@@ -373,6 +376,83 @@ static void I_Quit (void)
uid_t stored_euid = -1;
#endif
+//
+// Ability to use only the allowed CPUs
+//
+
+static void I_SetAffinityMask(void)
+{
+ // This was only set for the sdl music backend,
+ // but now the backend changes based on the music type.
+ // Not sure what the consequences are for this...
+ process_affinity_mask = 1;
+
+ // Set the process affinity mask so that all threads
+ // run on the same processor. This is a workaround for a bug in
+ // SDL_mixer that causes occasional crashes.
+ if (process_affinity_mask)
+ {
+ const char *errbuf = NULL;
+#ifdef _WIN32
+ HMODULE kernel32_dll;
+ SetAffinityFunc SetAffinity = NULL;
+ int ok = false;
+
+ // Find the kernel interface DLL.
+ kernel32_dll = LoadLibrary("kernel32.dll");
+
+ if (kernel32_dll)
+ {
+ // Find the SetProcessAffinityMask function.
+ SetAffinity = (SetAffinityFunc)GetProcAddress(kernel32_dll, "SetProcessAffinityMask");
+
+ // If the function was not found, we are on an old (Win9x) system
+ // that doesn't have this function. That's no problem, because
+ // those systems don't support SMP anyway.
+
+ if (SetAffinity)
+ {
+ ok = SetAffinity(GetCurrentProcess(), process_affinity_mask);
+ }
+ }
+
+ if (!ok)
+ {
+ errbuf = WINError();
+ }
+#elif defined(HAVE_SCHED_SETAFFINITY)
+ // POSIX version:
+ int i;
+ {
+ cpu_set_t set;
+
+ CPU_ZERO(&set);
+
+ for(i = 0; i < 16; i++)
+ {
+ CPU_SET((process_affinity_mask>>i)&1, &set);
+ }
+
+ if (sched_setaffinity(getpid(), sizeof(set), &set) == -1)
+ {
+ errbuf = strerror(errno);
+ }
+ }
+#else
+ return;
+#endif
+
+ if (errbuf == NULL)
+ {
+ lprintf(LO_INFO, "I_SetAffinityMask: manual affinity mask is %d\n", process_affinity_mask);
+ }
+ else
+ {
+ lprintf(LO_ERROR, "I_SetAffinityMask: failed to set process affinity mask (%s)\n", errbuf);
+ }
+ }
+}
+
//
// Sets the priority class for the prboom-plus process
//
@@ -482,6 +562,9 @@ int main(int argc, char **argv)
signal(SIGABRT, I_SignalHandler);
#endif
+ // Ability to use only the allowed CPUs
+ I_SetAffinityMask();
+
// Priority class for the prboom-plus process
I_SetProcessPriority();
diff --git a/prboom2/src/SDL/i_video.c b/prboom2/src/SDL/i_video.c
index 5a564a5a..9b68aee7 100644
--- a/prboom2/src/SDL/i_video.c
+++ b/prboom2/src/SDL/i_video.c
@@ -895,6 +895,7 @@ static void I_ClosestResolution (int *width, int *height)
}
}
+int process_affinity_mask;
int process_priority;
// e6y
diff --git a/prboom2/src/i_video.h b/prboom2/src/i_video.h
index 46f0fb71..c39a197e 100644
--- a/prboom2/src/i_video.h
+++ b/prboom2/src/i_video.h
@@ -109,6 +109,8 @@ void I_UpdateRenderSize(void); // Handle potential
extern int renderW; // resolution scaling
extern int renderH; // - DTIED
+// Set the process affinity mask so that all threads
+extern int process_affinity_mask;
// Priority class for the prboom-plus process
extern int process_priority;
// Use vanilla keybaord mapping

View file

@ -1,17 +1,18 @@
# Template file for 'dsda-doom'
pkgname=dsda-doom
version=0.24.3
version=0.29.3
revision=1
build_wrksrc=prboom2
build_style=cmake
makedepends="pcre-devel fluidsynth-devel libmad-devel SDL2_mixer-devel
SDL2_image-devel portmidi-devel dumb-devel libvorbis-devel"
SDL2_image-devel portmidi-devel dumb-devel libvorbis-devel libzip-devel"
short_desc="Fork of prboom+ with extra tooling for demo recording and playback"
maintainer="Gene <elkaufman5@gmail.com>"
license="GPL-2.0-or-later"
homepage="https://github.com/kraflab/dsda-doom"
changelog="https://raw.githubusercontent.com/kraflab/dsda-doom/refs/heads/master/patch_notes/v0.29.md"
distfiles="${homepage}/archive/refs/tags/v${version}.tar.gz"
checksum=d4cfc82eea029068329d6b6a2dcbe0b316b31a60af12e6dc5ad3e1d2c359d913
checksum=9b9218d26055d2e2a3b830913cfe52f56b2a6dd4a16720634f0bc5dbe560fb84
nocross=yes
post_install() {