cen64: fix build with gcc14

- add patch from unmerged upstream PR (only `bus/controller.c`,
other changes are already applied in master):
https://github.com/n64dev/cen64/pull/191/commits/f13bdf94c00a9da3b152ed9fe20001e240215b96
fixes error from gcc14:
`error: initialization of ... from incompatible pointer type`

- add patch from unmerged upstream PR:
https://github.com/n64dev/cen64/pull/237
fixes errors from gcc14:
`error: passing argument 1 of 'cen64_thread_setname' makes pointer from integer without a cast [-Wint-conversion]`
`error: passing argument 1 of 'cen64_thread_setname' makes integer from pointer without a cast [-Wint-conversion]`

ghpzin d42f9fd6 dff2c1e3

+167
+22
pkgs/by-name/ce/cen64/cast-mi_regs-callbacks.patch
···
··· 1 + From f13bdf94c00a9da3b152ed9fe20001e240215b96 Mon Sep 17 00:00:00 2001 2 + From: James Lambert <lambertjamesd@gmail.com> 3 + Date: Tue, 9 Feb 2021 11:49:51 -0700 4 + Subject: [PATCH] Cast mi_regs callbacks 5 + 6 + --- 7 + bus/controller.c | 2 +- 8 + 1 files changed, 1 insertions(+), 1 deletions(-) 9 + 10 + diff --git a/bus/controller.c b/bus/controller.c 11 + index 1f0cdfccf..24b3df260 100644 12 + --- a/bus/controller.c 13 + +++ b/bus/controller.c 14 + @@ -44,7 +44,7 @@ int bus_init(struct bus_controller *bus, int dd_present) { 15 + static const struct bus_controller_mapping mappings[NUM_MAPPINGS] = { 16 + {read_ai_regs, write_ai_regs, AI_REGS_BASE_ADDRESS, AI_REGS_ADDRESS_LEN}, 17 + {read_dp_regs, write_dp_regs, DP_REGS_BASE_ADDRESS, DP_REGS_ADDRESS_LEN}, 18 + - {read_mi_regs, write_mi_regs, MI_REGS_BASE_ADDRESS, MI_REGS_ADDRESS_LEN}, 19 + + {(memory_rd_function)read_mi_regs, (memory_wr_function)write_mi_regs, MI_REGS_BASE_ADDRESS, MI_REGS_ADDRESS_LEN}, 20 + {read_pi_regs, write_pi_regs, PI_REGS_BASE_ADDRESS, PI_REGS_ADDRESS_LEN}, 21 + {read_ri_regs, write_ri_regs, RI_REGS_BASE_ADDRESS, RI_REGS_ADDRESS_LEN}, 22 + {read_si_regs, write_si_regs, SI_REGS_BASE_ADDRESS, SI_REGS_ADDRESS_LEN},
+137
pkgs/by-name/ce/cen64/fix-thread-arg-type-for-pthread_setname_np.patch
···
··· 1 + From 41ad58ab1953835313ad2b89686931b08b5b47e8 Mon Sep 17 00:00:00 2001 2 + From: ghpzin <ghpzin@gmail.com> 3 + Date: Tue, 25 Mar 2025 15:26:07 +0300 4 + Subject: [PATCH] Fix thread arg type for pthread_setname_np 5 + 6 + - change `thread` arg type to `cen64_thread` instead of `cen64_thread *` 7 + (`pthread_t` instead of `pthread_t *`) according to definition of 8 + `pthread_setname_np` from `<pthread.h>`: 9 + `int pthread_setname_np(pthread_t thread, const char *name);` 10 + fixes gcc14 errors: 11 + ``` 12 + /build/source/cen64.c:475:24: error: passing argument 1 of 'cen64_thread_setname' makes pointer from integer without a cast [-Wint-conversion] 13 + 475 | cen64_thread_setname(thread, "device"); 14 + | ^~~~~~ 15 + | | 16 + | cen64_thread {aka long unsigned int} 17 + In file included from /build/source/device/device.h:26, 18 + from /build/source/cen64.c:15: 19 + /build/source/os/posix/thread.h:59:54: note: expected 'cen64_thread *' {aka 'long unsigned int *'} but argument is of type 'cen64_thread' {aka 'lo> 20 + 59 | static inline int cen64_thread_setname(cen64_thread *t, const char *name) { 21 + | ~~~~~~~~~~~~~~^ 22 + ``` 23 + 24 + - add cast to `cen64_thread` from NULL where `cen64_thread` is called 25 + with it, fixes gcc14 errors: 26 + ``` 27 + /build/source/gdb/gdb.c:82:24: error: passing argument 1 of 'cen64_thread_setname' makes integer from pointer without a cast [-Wint-conversion] 28 + 82 | cen64_thread_setname(NULL, "gdb"); 29 + | ^~~~ 30 + | | 31 + | void * 32 + /build/source/os/posix/thread.h:59:53: note: expected 'cen64_thread' {aka 'long unsigned int'} but argument is of type 'void *' 33 + 59 | static inline int cen64_thread_setname(cen64_thread t, const char *name) { 34 + | ~~~~~~~~~~~~~^ 35 + ``` 36 + --- 37 + cen64.c | 2 +- 38 + device/device.c | 4 ++-- 39 + gdb/gdb.c | 4 ++-- 40 + os/posix/thread.h | 6 +++--- 41 + os/winapi/thread.h | 2 +- 42 + 5 files changed, 9 insertions(+), 9 deletions(-) 43 + 44 + diff --git a/cen64.c b/cen64.c 45 + index 51014a4..ca6bda1 100644 46 + --- a/cen64.c 47 + +++ b/cen64.c 48 + @@ -483,7 +483,7 @@ int run_device(struct cen64_device *device, bool no_video) { 49 + } 50 + 51 + CEN64_THREAD_RETURN_TYPE run_device_thread(void *opaque) { 52 + - cen64_thread_setname(NULL, "device"); 53 + + cen64_thread_setname((cen64_thread)NULL, "device"); 54 + struct cen64_device *device = (struct cen64_device *) opaque; 55 + 56 + device_run(device); 57 + diff --git a/device/device.c b/device/device.c 58 + index cd5a046..c915846 100644 59 + --- a/device/device.c 60 + +++ b/device/device.c 61 + @@ -224,7 +224,7 @@ CEN64_THREAD_RETURN_TYPE run_rcp_thread(void *opaque) { 62 + } 63 + 64 + CEN64_THREAD_RETURN_TYPE run_vr4300_thread(void *opaque) { 65 + - cen64_thread_setname(NULL, "vr4300"); 66 + + cen64_thread_setname((cen64_thread)NULL, "vr4300"); 67 + struct cen64_device *device = (struct cen64_device *) opaque; 68 + 69 + while (likely(device->running)) { 70 + @@ -351,4 +351,4 @@ int device_debug_spin(struct cen64_device *device) { 71 + 72 + cen64_cold void device_connect_debugger(struct cen64_device *device, void* break_handler_data, vr4300_debug_break_handler break_handler) { 73 + vr4300_connect_debugger(device->vr4300, break_handler_data, break_handler); 74 + -} 75 + \ No newline at end of file 76 + +} 77 + diff --git a/gdb/gdb.c b/gdb/gdb.c 78 + index 021784d..0e8d188 100644 79 + --- a/gdb/gdb.c 80 + +++ b/gdb/gdb.c 81 + @@ -79,7 +79,7 @@ bool gdb_parse_packet(const char* input, int len, const char** command_start, co 82 + } 83 + 84 + CEN64_THREAD_RETURN_TYPE gdb_thread(void *opaque) { 85 + - cen64_thread_setname(NULL, "gdb"); 86 + + cen64_thread_setname((cen64_thread)NULL, "gdb"); 87 + struct gdb *gdb = (struct gdb *) opaque; 88 + 89 + cen64_mutex_lock(&gdb->client_mutex); 90 + @@ -257,4 +257,4 @@ cen64_cold void gdb_destroy(struct gdb* gdb) { 91 + 92 + gdb->device = NULL; 93 + free(gdb); 94 + -} 95 + \ No newline at end of file 96 + +} 97 + diff --git a/os/posix/thread.h b/os/posix/thread.h 98 + index 2a261c6..e8e6144 100644 99 + --- a/os/posix/thread.h 100 + +++ b/os/posix/thread.h 101 + @@ -45,9 +45,9 @@ static inline int cen64_thread_join(cen64_thread *t) { 102 + #ifdef __APPLE__ 103 + int pthread_setname_np(const char*); 104 + #elif __NETBSD__ 105 + -int pthread_setname_np(cen64_thread*, const char*, const char*); 106 + +int pthread_setname_np(cen64_thread, const char*, const char*); 107 + #else 108 + -int pthread_setname_np(cen64_thread*, const char*); 109 + +int pthread_setname_np(cen64_thread, const char*); 110 + #endif 111 + 112 + // Sets the name of the thread to a specific value 113 + @@ -56,7 +56,7 @@ int pthread_setname_np(cen64_thread*, const char*); 114 + // If you call it at the wrong time or your OS doesn't support custom thread names 115 + // the return value will be non-zero. 116 + // If cen64_thread is not set the name of the current thread will be changed. 117 + -static inline int cen64_thread_setname(cen64_thread *t, const char *name) { 118 + +static inline int cen64_thread_setname(cen64_thread t, const char *name) { 119 + #ifdef __APPLE__ 120 + if (t == NULL) 121 + return pthread_setname_np(name); 122 + diff --git a/os/winapi/thread.h b/os/winapi/thread.h 123 + index d7c162a..128d935 100644 124 + --- a/os/winapi/thread.h 125 + +++ b/os/winapi/thread.h 126 + @@ -57,7 +57,7 @@ static inline int cen64_thread_join(cen64_thread *t) { 127 + // 128 + // Windows isn't supported for the moment. 129 + // 130 + -static inline int cen64_thread_setname(cen64_thread *t, const char *name) { 131 + +static inline int cen64_thread_setname(cen64_thread t, const char *name) { 132 + return ENOSYS; 133 + } 134 + 135 + -- 136 + 2.48.1 137 +
+8
pkgs/by-name/ce/cen64/package.nix
··· 20 sha256 = "sha256-vFk29KESATcEY0eRNbS+mHLD9T1phJiG1fqjOlI19/w="; 21 }; 22 23 nativeBuildInputs = [ cmake ]; 24 buildInputs = [ 25 libGL
··· 20 sha256 = "sha256-vFk29KESATcEY0eRNbS+mHLD9T1phJiG1fqjOlI19/w="; 21 }; 22 23 + patches = [ 24 + # fix build with gcc14: 25 + # https://github.com/n64dev/cen64/pull/191/commits/f13bdf94c00a9da3b152ed9fe20001e240215b96 26 + ./cast-mi_regs-callbacks.patch 27 + # https://github.com/n64dev/cen64/pull/237 28 + ./fix-thread-arg-type-for-pthread_setname_np.patch 29 + ]; 30 + 31 nativeBuildInputs = [ cmake ]; 32 buildInputs = [ 33 libGL