From f261ea968a638a1b3593ebe1310b18d88f3ee273 Mon Sep 17 00:00:00 2001 From: Gene Date: Fri, 23 Dec 2022 18:42:37 -0800 Subject: [PATCH] dsda-doom: update to 0.25.0 --- srcpkgs/dsda-doom/patches/affinity-hack.patch | 165 ------------------ srcpkgs/dsda-doom/template | 8 +- 2 files changed, 5 insertions(+), 168 deletions(-) delete mode 100644 srcpkgs/dsda-doom/patches/affinity-hack.patch diff --git a/srcpkgs/dsda-doom/patches/affinity-hack.patch b/srcpkgs/dsda-doom/patches/affinity-hack.patch deleted file mode 100644 index 2155ab116b82..000000000000 --- a/srcpkgs/dsda-doom/patches/affinity-hack.patch +++ /dev/null @@ -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 -+typedef BOOL (WINAPI *SetAffinityFunc)(HANDLE hProcess, DWORD mask); -+#else -+#include - #endif - - #include -@@ -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 diff --git a/srcpkgs/dsda-doom/template b/srcpkgs/dsda-doom/template index 51dcbbf26d34..9c935b5e633b 100644 --- a/srcpkgs/dsda-doom/template +++ b/srcpkgs/dsda-doom/template @@ -1,6 +1,6 @@ # Template file for 'dsda-doom' pkgname=dsda-doom -version=0.24.3 +version=0.25.0 revision=1 build_wrksrc=prboom2 build_style=cmake @@ -10,8 +10,10 @@ short_desc="Fork of prboom+ with extra tooling for demo recording and playback" maintainer="Gene " license="GPL-2.0-or-later" homepage="https://github.com/kraflab/dsda-doom" -distfiles="${homepage}/archive/refs/tags/v${version}.tar.gz" -checksum=d4cfc82eea029068329d6b6a2dcbe0b316b31a60af12e6dc5ad3e1d2c359d913 +changelog="https://raw.githubusercontent.com/kraflab/dsda-doom + /d91e3c38950e269b32cdb166e663097a7dc21e52/patch_notes/v0.25.md" +distfiles="https://github.com/kraflab/dsda-doom/archive/refs/tags/v${version}.tar.gz" +checksum=caad205a35a6339f3a73019b17818c214de4f3b7822fcc2350e7cae63a044b8b nocross=yes post_install() {