From 3bf2e5ab375a0e453b64b03296c1bfaa115ee95d Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 11 Jun 2024 10:36:01 +0200 Subject: [PATCH] lightrec: Set program name to /proc/self/exe on Linux On Linux, /proc/self/exe is a virtual link to the ELF program being executed. Use this instead of hardcoding "retroarch.exe". This is used when compiling Lightrec with disassembler support. Signed-off-by: Paul Cercueil --- libpcsxcore/lightrec/plugin.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libpcsxcore/lightrec/plugin.c b/libpcsxcore/lightrec/plugin.c index 200ce816..7f500fd2 100644 --- a/libpcsxcore/lightrec/plugin.c +++ b/libpcsxcore/lightrec/plugin.c @@ -53,6 +53,14 @@ # define unlikely(x) (x) #endif +#ifndef LIGHTREC_PROG_NAME +# ifdef __linux__ +# define LIGHTREC_PROG_NAME "/proc/self/exe" +# else +# define LIGHTREC_PROG_NAME "retroarch.exe" +# endif +#endif + psxRegisters psxRegs; Rcnt rcnts[4]; @@ -60,8 +68,6 @@ void* code_buffer; static struct lightrec_state *lightrec_state; -static char *name = "retroarch.exe"; - static bool use_lightrec_interpreter; static bool use_pcsx_interpreter; static bool block_stepping; @@ -458,7 +464,7 @@ static int lightrec_plugin_init(void) use_lightrec_interpreter = !!getenv("LIGHTREC_INTERPRETER"); - lightrec_state = lightrec_init(name, + lightrec_state = lightrec_init(LIGHTREC_PROG_NAME, lightrec_map, ARRAY_SIZE(lightrec_map), &lightrec_ops); -- 2.39.2