clean up some includes
authornotaz <notasas@gmail.com>
Sat, 27 Dec 2025 01:20:54 +0000 (03:20 +0200)
committernotaz <notasas@gmail.com>
Fri, 2 Jan 2026 00:37:20 +0000 (02:37 +0200)
19 files changed:
Makefile
frontend/libretro.c
frontend/main.c
libpcsxcore/cdriso.c
libpcsxcore/cheat.c
libpcsxcore/debug.h
libpcsxcore/misc.c
libpcsxcore/new_dynarec/emu_if.c
libpcsxcore/new_dynarec/new_dynarec.c
libpcsxcore/plugins.c
libpcsxcore/ppf.c
libpcsxcore/psxbios.c
libpcsxcore/psxcommon.c
libpcsxcore/psxcommon.h
libpcsxcore/psxmem.c
libpcsxcore/r3000a.c
libpcsxcore/sio.c
libpcsxcore/system.h
plugins/dfsound/externals.h

index 543685c..179e22e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -17,6 +17,9 @@ ifneq ($(ASSERTS), 1)
 CFLAGS += -DNDEBUG
 endif
 endif
+ifeq ($(LOG_UNHANDLED), 1)
+CFLAGS += -DLOG_UNHANDLED
+endif
 ifndef NO_AUTODEPS
 AUTODEPFLAGS += -MMD -MP
 endif
index 19deffe..e3f60c3 100644 (file)
@@ -8,9 +8,12 @@
 #define _GNU_SOURCE 1 // strcasestr
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdarg.h>
 #include <stdint.h>
 #include <string.h>
 #include <strings.h>
+#include <time.h>
+#include <math.h>
 #include <assert.h>
 #ifdef __MACH__
 #include <unistd.h>
index 751c452..b3f7ec2 100644 (file)
@@ -437,14 +437,6 @@ int emu_core_preinit(void)
        // it may be redefined by -cfg on the command line
        strcpy(cfgfile_basename, "pcsx.cfg");
 
-#ifdef IOS
-       emuLog = fopen("/User/Documents/pcsxr.log", "w");
-       if (emuLog == NULL)
-               emuLog = fopen("pcsxr.log", "w");
-       if (emuLog == NULL)
-#endif
-       emuLog = stdout;
-
        log_wrong_cpu();
 
        SetIsoFile(NULL);
@@ -878,11 +870,6 @@ void SysClose() {
        ReleasePlugins();
 
        StopDebugger();
-
-       if (emuLog != NULL && emuLog != stdout && emuLog != stderr) {
-               fclose(emuLog);
-               emuLog = NULL;
-       }
 }
 
 #ifndef HAVE_LIBRETRO
@@ -892,9 +879,9 @@ void SysPrintf(const char *fmt, ...) {
        va_list list;
 
        va_start(list, fmt);
-       vfprintf(emuLog, fmt, list);
+       vfprintf(stdout, fmt, list);
        va_end(list);
-       fflush(emuLog);
+       //fflush(stdout);
 }
 
 #else
index a917b54..e63feb4 100644 (file)
@@ -24,6 +24,7 @@
 #include "cdriso.h"
 #include "ppf.h"
 
+#include <assert.h>
 #include <errno.h>
 #include <zlib.h>
 #ifdef HAVE_CHD
index 2727fd2..7b81737 100644 (file)
@@ -16,6 +16,8 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307 USA
  */
 
+#include <stdio.h>
+#include <assert.h>
 #include "psxcommon.h"
 #include "r3000a.h"
 #include "psxmem.h"
index 5c5336d..9fcc41a 100644 (file)
@@ -61,11 +61,6 @@ char* disR3000AF(u32 code, u32 pc);
 
 //#define CDRCMD_DEBUG
 
-#if defined (PSXCPU_LOG) || defined(PSXDMA_LOG) || defined(CDR_LOG) || defined(PSXHW_LOG) || \
-       defined(PSXBIOS_LOG) || defined(PSXMEM_LOG) || defined(GTE_LOG)    || defined(PAD_LOG)
-#define EMU_LOG __Log
-#endif
-
 #ifdef __cplusplus
 }
 #endif
index 33a4272..145b964 100644 (file)
@@ -22,6 +22,8 @@
 */
 
 #include <stddef.h>
+#include <stdio.h>
+#include <ctype.h>
 #include <errno.h>
 #include <assert.h>
 #include "misc.h"
@@ -584,9 +586,7 @@ int Load(const char *ExePath) {
                                                                goto fail_io;
                                                        section_address = SWAPu32(section_address);
                                                        section_size = SWAPu32(section_size);
-#ifdef EMU_LOG
-                                                       EMU_LOG("Loading %08X bytes from %08X to %08X\n", section_size, ftell(tmpFile), section_address);
-#endif
+                                                       //printf("Loading %08X bytes from %08X to %08X\n", section_size, ftell(tmpFile), section_address);
                                                        mem = PSXM(section_address);
                                                        if (mem != INVALID_PTR) {
                                                                fread_to_ram(mem, section_size, 1, tmpFile);
index d88e147..7880e02 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <stdio.h>
+#include <assert.h>
 
 #include "emu_if.h"
 #include "pcsxmem.h"
index 19df23a..1111588 100644 (file)
@@ -18,6 +18,7 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
+#include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h> //include for uint64_t
 #include <assert.h>
@@ -767,7 +768,7 @@ static attr_unused void check_for_block_changes(u_int start, u_int end)
       if (block->is_dirty)
         continue;
       if (memcmp(block->source, block->copy, block->len)) {
-        printf("bad block %08x-%08x %016llx %016llx @%08x\n",
+        SysPrintf("bad block %08x-%08x %016llx %016llx @%08x\n",
           block->start, block->start + block->len,
           *(long long *)block->source, *(long long *)block->copy, psxRegs.pc);
         fflush(stdout);
index 3cf1cf6..62c15b5 100644 (file)
@@ -21,6 +21,8 @@
 * Plugin library callback/access functions.
 */
 
+#include <stdio.h>
+#include <time.h>
 #include "plugins.h"
 #include "cdriso.h"
 #include "cdrom-async.h"
index 3dcf416..8e90c67 100644 (file)
@@ -19,6 +19,8 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307 USA
  */
 
+#include <stdio.h>
+#include <ctype.h>
 #include "psxcommon.h"
 #include "ppf.h"
 #include "misc.h"
index fc04e11..7dd9f9c 100644 (file)
@@ -30,6 +30,9 @@
 
 // TODO: implement all system calls, count the exact CPU cycles of system calls.
 
+#include <stdio.h>
+#include <stdarg.h>
+#include <assert.h>
 #include "psxbios.h"
 #include "psxhw.h"
 #include "gpu.h"
@@ -38,7 +41,6 @@
 #include "psxinterpreter.h"
 #include "psxevents.h"
 #include "cdrom.h"
-#include <stdarg.h>
 #include <zlib.h>
 
 #ifndef PSXBIOS_LOG
index ada81a8..dae5514 100644 (file)
 #include "ppf.h"
 
 PcsxConfig Config;
-boolean NetOpened = FALSE;
-
-int Log = 0;
-FILE *emuLog = NULL;
 
 int EmuInit() {
        return psxInit();
@@ -60,19 +56,3 @@ void EmuUpdate() {
                pl_frame_limit();
        }
 }
-
-void __Log(char *fmt, ...) {
-       va_list list;
-#ifdef LOG_STDOUT
-       char tmp[1024];
-#endif
-
-       va_start(list, fmt);
-#ifndef LOG_STDOUT
-       vfprintf(emuLog, fmt, list);
-#else
-       vsprintf(tmp, fmt, list);
-       SysPrintf(tmp);
-#endif
-       va_end(list);
-}
index 22574f8..7b59c22 100644 (file)
@@ -43,18 +43,13 @@ extern "C" {
 #endif
 
 // System includes
-#include <stdio.h>
+//#include <stdio.h>
 #include <string.h>
-#include <stdarg.h>
 #include <stdint.h>
 #include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include <ctype.h>
 #ifndef __SWITCH__
 #include <sys/types.h>
 #endif
-#include <assert.h>
 
 // Define types
 typedef int8_t s8;
@@ -107,11 +102,6 @@ typedef uint8_t boolean;
 
 #endif
 
-extern FILE *emuLog;
-extern int Log;
-
-void __Log(char *fmt, ...);
-
 // lots of timing depends on this and makes or breaks compatibility,
 // don't change unless you're going to retest hundreds of games
 #define CYCLE_MULT_DEFAULT 175
index 1330199..9b783cb 100644 (file)
@@ -23,6 +23,7 @@
 
 // TODO: Implement caches & cycle penalty.
 
+#include <stdio.h>
 #include "psxmem.h"
 #include "psxmem_map.h"
 #include "r3000a.h"
index cfd1ab0..3298b76 100644 (file)
@@ -53,8 +53,6 @@ int psxInit() {
        psxCpu = &psxInt;
 #endif
 
-       Log = 0;
-
        if (psxMemInit() == -1) return -1;
 
        return psxCpu->Init();
@@ -96,11 +94,6 @@ void psxReset() {
        }
        if (Config.HLE || introBypassed)
                psxBiosSetupBootState();
-
-#ifdef EMU_LOG
-       EMU_LOG("*BIOS END*\n");
-#endif
-       Log = 0;
 }
 
 void psxShutdown() {
index c28c055..5df9caf 100644 (file)
@@ -21,6 +21,7 @@
 * SIO functions.
 */
 
+#include <stdio.h>
 #include "misc.h"
 #include "psxcounters.h"
 #include "psxevents.h"
index 4e65911..54ac184 100644 (file)
@@ -44,8 +44,12 @@ void SysRunGui();                                            // Returns to the Gui
 void SysClose();                                               // Close mem and plugins
 
 // log if the game does something we don't handle (well)
-//#define log_unhandled printf
+#ifdef LOG_UNHANDLED
+#include <stdio.h>
+#define log_unhandled printf
+#else
 #define log_unhandled(...)
+#endif
 
 #ifdef __cplusplus
 }
index cf8b718..aa0ddde 100644 (file)
 // generic defines\r
 /////////////////////////////////////////////////////////\r
 \r
-//#define log_unhandled printf\r
+#ifdef LOG_UNHANDLED\r
+#define log_unhandled printf\r
+#else\r
 #define log_unhandled(...)\r
+#endif\r
 \r
 #ifdef __GNUC__\r
 #define noinline __attribute__((noinline))\r