shithub: psxe

Download patch

ref: 8e8f78856e7ffbcc43e81fad624f6ea540e1e34f
parent: e5fbfaf2922430eca3b8abfde6fe3c76876f9385
author: Lycoder <aurealinbox@gmail.com>
date: Tue Jun 13 18:40:35 EDT 2023

Allow excluding CPU trace calls

--- a/build-win.bat
+++ b/build-win.bat
@@ -16,5 +16,6 @@
     -DOS_INFO="%OS_INFO%"^
     -DREP_VERSION="%VERSION_TAG%"^
     -DREP_COMMIT_HASH="%COMMIT_HASH%"^
-    -g -DLOG_USE_COLOR -lSDL2 -lSDL2main^
-    -Ofast -Wno-overflow -Wall -pedantic
\ No newline at end of file
+    -DLOG_USE_COLOR -lSDL2 -lSDL2main^
+    -Ofast -Wno-overflow -Wall -pedantic^
+    -ffast-math
\ No newline at end of file
--- a/build-win.ps1
+++ b/build-win.ps1
@@ -12,4 +12,5 @@
     -o "bin\psxe.exe" `
     -L"`"$($SDL2_DIR)\lib`"" `
     -m64 -lSDL2main -lSDL2 -Wno-overflow `
-    -g -Ofast -Wall -pedantic -DLOG_USE_COLOR
\ No newline at end of file
+    -Wall -pedantic -DLOG_USE_COLOR `
+    -ffast-math
\ No newline at end of file
--- a/psx/cpu.c
+++ b/psx/cpu.c
@@ -139,6 +139,7 @@
 #define IMM16 (cpu->buf[1] & 0xffff)
 #define IMM16S ((int32_t)((int16_t)IMM16))
 
+#ifdef CPU_TRACE
 #define TRACE_M(m) \
     log_trace("%08x: %-7s $%s, %+i($%s)", cpu->pc-8, m, g_mips_cc_register_names[T], IMM16S, g_mips_cc_register_names[S])
 
@@ -180,6 +181,22 @@
 
 #define TRACE_N(m) \
     log_trace("%08x: %-7s", cpu->pc-8, m);
+#else
+#define TRACE_M(m)
+#define TRACE_I16S(m)
+#define TRACE_I16D(m)
+#define TRACE_I5D(m)
+#define TRACE_I26(m)
+#define TRACE_RT(m)
+#define TRACE_C0M(m)
+#define TRACE_B(m)
+#define TRACE_RS(m)
+#define TRACE_MTF(m)
+#define TRACE_RD(m)
+#define TRACE_MD(m)
+#define TRACE_I20(m)
+#define TRACE_N(m)
+#endif
 
 #define DO_PENDING_LOAD \
     cpu->r[cpu->load_d] = cpu->load_v; \
--