cen64: 0-unstable-2023-05-29 -> 0.3-unstable-2025-10-24 (#459554)

This commit is contained in:
dish
2025-11-09 22:42:27 +00:00
committed by GitHub
2 changed files with 22 additions and 156 deletions
@@ -1,137 +0,0 @@
From 41ad58ab1953835313ad2b89686931b08b5b47e8 Mon Sep 17 00:00:00 2001
From: ghpzin <ghpzin@gmail.com>
Date: Tue, 25 Mar 2025 15:26:07 +0300
Subject: [PATCH] Fix thread arg type for pthread_setname_np
- change `thread` arg type to `cen64_thread` instead of `cen64_thread *`
(`pthread_t` instead of `pthread_t *`) according to definition of
`pthread_setname_np` from `<pthread.h>`:
`int pthread_setname_np(pthread_t thread, const char *name);`
fixes gcc14 errors:
```
/build/source/cen64.c:475:24: error: passing argument 1 of 'cen64_thread_setname' makes pointer from integer without a cast [-Wint-conversion]
475 | cen64_thread_setname(thread, "device");
| ^~~~~~
| |
| cen64_thread {aka long unsigned int}
In file included from /build/source/device/device.h:26,
from /build/source/cen64.c:15:
/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>
59 | static inline int cen64_thread_setname(cen64_thread *t, const char *name) {
| ~~~~~~~~~~~~~~^
```
- add cast to `cen64_thread` from NULL where `cen64_thread` is called
with it, fixes gcc14 errors:
```
/build/source/gdb/gdb.c:82:24: error: passing argument 1 of 'cen64_thread_setname' makes integer from pointer without a cast [-Wint-conversion]
82 | cen64_thread_setname(NULL, "gdb");
| ^~~~
| |
| void *
/build/source/os/posix/thread.h:59:53: note: expected 'cen64_thread' {aka 'long unsigned int'} but argument is of type 'void *'
59 | static inline int cen64_thread_setname(cen64_thread t, const char *name) {
| ~~~~~~~~~~~~~^
```
---
cen64.c | 2 +-
device/device.c | 4 ++--
gdb/gdb.c | 4 ++--
os/posix/thread.h | 6 +++---
os/winapi/thread.h | 2 +-
5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/cen64.c b/cen64.c
index 51014a4..ca6bda1 100644
--- a/cen64.c
+++ b/cen64.c
@@ -483,7 +483,7 @@ int run_device(struct cen64_device *device, bool no_video) {
}
CEN64_THREAD_RETURN_TYPE run_device_thread(void *opaque) {
- cen64_thread_setname(NULL, "device");
+ cen64_thread_setname((cen64_thread)NULL, "device");
struct cen64_device *device = (struct cen64_device *) opaque;
device_run(device);
diff --git a/device/device.c b/device/device.c
index cd5a046..c915846 100644
--- a/device/device.c
+++ b/device/device.c
@@ -224,7 +224,7 @@ CEN64_THREAD_RETURN_TYPE run_rcp_thread(void *opaque) {
}
CEN64_THREAD_RETURN_TYPE run_vr4300_thread(void *opaque) {
- cen64_thread_setname(NULL, "vr4300");
+ cen64_thread_setname((cen64_thread)NULL, "vr4300");
struct cen64_device *device = (struct cen64_device *) opaque;
while (likely(device->running)) {
@@ -351,4 +351,4 @@ int device_debug_spin(struct cen64_device *device) {
cen64_cold void device_connect_debugger(struct cen64_device *device, void* break_handler_data, vr4300_debug_break_handler break_handler) {
vr4300_connect_debugger(device->vr4300, break_handler_data, break_handler);
-}
\ No newline at end of file
+}
diff --git a/gdb/gdb.c b/gdb/gdb.c
index 021784d..0e8d188 100644
--- a/gdb/gdb.c
+++ b/gdb/gdb.c
@@ -79,7 +79,7 @@ bool gdb_parse_packet(const char* input, int len, const char** command_start, co
}
CEN64_THREAD_RETURN_TYPE gdb_thread(void *opaque) {
- cen64_thread_setname(NULL, "gdb");
+ cen64_thread_setname((cen64_thread)NULL, "gdb");
struct gdb *gdb = (struct gdb *) opaque;
cen64_mutex_lock(&gdb->client_mutex);
@@ -257,4 +257,4 @@ cen64_cold void gdb_destroy(struct gdb* gdb) {
gdb->device = NULL;
free(gdb);
-}
\ No newline at end of file
+}
diff --git a/os/posix/thread.h b/os/posix/thread.h
index 2a261c6..e8e6144 100644
--- a/os/posix/thread.h
+++ b/os/posix/thread.h
@@ -45,9 +45,9 @@ static inline int cen64_thread_join(cen64_thread *t) {
#ifdef __APPLE__
int pthread_setname_np(const char*);
#elif __NETBSD__
-int pthread_setname_np(cen64_thread*, const char*, const char*);
+int pthread_setname_np(cen64_thread, const char*, const char*);
#else
-int pthread_setname_np(cen64_thread*, const char*);
+int pthread_setname_np(cen64_thread, const char*);
#endif
// Sets the name of the thread to a specific value
@@ -56,7 +56,7 @@ int pthread_setname_np(cen64_thread*, const char*);
// If you call it at the wrong time or your OS doesn't support custom thread names
// the return value will be non-zero.
// If cen64_thread is not set the name of the current thread will be changed.
-static inline int cen64_thread_setname(cen64_thread *t, const char *name) {
+static inline int cen64_thread_setname(cen64_thread t, const char *name) {
#ifdef __APPLE__
if (t == NULL)
return pthread_setname_np(name);
diff --git a/os/winapi/thread.h b/os/winapi/thread.h
index d7c162a..128d935 100644
--- a/os/winapi/thread.h
+++ b/os/winapi/thread.h
@@ -57,7 +57,7 @@ static inline int cen64_thread_join(cen64_thread *t) {
//
// Windows isn't supported for the moment.
//
-static inline int cen64_thread_setname(cen64_thread *t, const char *name) {
+static inline int cen64_thread_setname(cen64_thread t, const char *name) {
return ENOSYS;
}
--
2.48.1
+22 -19
View File
@@ -1,53 +1,56 @@
{
lib,
cmake,
stdenv,
fetchFromGitHub,
cmake,
libGL,
libiconv,
libX11,
openal,
stdenv,
nix-update-script,
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "cen64";
version = "0-unstable-2023-05-29";
version = "0.3-unstable-2025-10-24";
src = fetchFromGitHub {
owner = "n64dev";
repo = "cen64";
rev = "1c1118462bd9d9b8ceb4c556a647718072477aab";
sha256 = "sha256-vFk29KESATcEY0eRNbS+mHLD9T1phJiG1fqjOlI19/w=";
rev = "e0641c8452a3ae8edcd2bf4e46794bb4eaafc076";
hash = "sha256-PpaD3hgksPD729LyFm7+ID8i+x3yZ0f+S11eSQyoB64=";
};
patches = [
# fix build with gcc14:
# https://github.com/n64dev/cen64/pull/191/commits/f13bdf94c00a9da3b152ed9fe20001e240215b96
./cast-mi_regs-callbacks.patch
# https://github.com/n64dev/cen64/pull/237
./fix-thread-arg-type-for-pthread_setname_np.patch
];
# fix build with gcc14:
# https://github.com/n64dev/cen64/pull/191/commits/f13bdf94c00a9da3b152ed9fe20001e240215b96
patches = [ ./cast-mi_regs-callbacks.patch ];
strictDeps = true;
nativeBuildInputs = [ cmake ];
buildInputs = [
libGL
libiconv
openal
libX11
openal
];
installPhase = ''
runHook preInstall
install -D {,$out/bin/}${pname}
install -D ${finalAttrs.meta.mainProgram} \
--target-directory=$out/bin
runHook postInstall
'';
meta = with lib; {
passthru.updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; };
meta = {
description = "Cycle-Accurate Nintendo 64 Emulator";
license = licenses.bsd3;
license = lib.licenses.bsd3;
homepage = "https://github.com/n64dev/cen64";
maintainers = [ maintainers._414owen ];
maintainers = with lib.maintainers; [ _414owen ];
platforms = [ "x86_64-linux" ];
mainProgram = "cen64";
};
}
})