From f01663550ce7ec2fdf0ac3715b98aadd9b336a3f Mon Sep 17 00:00:00 2001 From: TwinAphex51224 Date: Mon, 27 Feb 2012 20:07:24 +0100 Subject: [PATCH] Added logging features - set HAVE_LOGGING to enable --- Makefile.ps3 | 14 ++++++++++---- general.h | 2 +- logger_override.h | 32 ++++++++++++++++++++++++++++++++ ps3/main.c | 8 ++++++++ 4 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 logger_override.h diff --git a/Makefile.ps3 b/Makefile.ps3 index 90df8dafda..68ea7efa37 100644 --- a/Makefile.ps3 +++ b/Makefile.ps3 @@ -11,6 +11,7 @@ DEBUG = 0 DOWNLOAD_SHADERS = 1 STRIPPING_ENABLE = 0 HAVE_SSNES_GL = 0 +HAVE_LOGGER = 0 CONTENT_ID_FULL = UP0001-SSNE10000_00-0000000000000001 CONTENT_ID = SSNE10000 @@ -25,7 +26,7 @@ EBOOT_PATH = ps3/pkg/USRDIR/EBOOT.BIN CORE_PATH = ps3/pkg/USRDIR/cores/CORE.SELF LDDIRS = -L. -L$(CELL_SDK)/target/ppu/lib/PSGL/RSX/ultra-opt -INCDIRS = -I. -Icommon +INCDIRS = -I. -Ips3 -Icommon MAKE_SELF = make_self_npdrm @@ -71,7 +72,7 @@ else GL_LIBS := -L$(CELL_SDK)/target/ppu/lib/PSGL/RSX/ultra-opt -lPSGL -lPSGLcgc endif -PPU_LDLIBS = -ldbgfont $(GL_LIBS) -lcgc -lgcm_cmd -lgcm_sys_stub -lsnes -lresc_stub -lm -lio_stub -lfs_stub -lsysutil_stub -lsysutil_game_stub -lsysutil_screenshot_stub -lsysutil_np_stub -lpngdec_stub -ljpgdec_stub -lsysmodule_stub -laudio_stub -lnet_stub -lpthread +PPU_LDLIBS = -ldbgfont $(GL_LIBS) -lcgc -lgcm_cmd -lgcm_sys_stub -lsnes -lresc_stub -lm -lio_stub -lfs_stub -lsysutil_stub -lsysutil_game_stub -lsysutil_screenshot_stub -lsysutil_np_stub -lpngdec_stub -ljpgdec_stub -lsysmodule_stub -laudio_stub -lnet_stub -lnetctl_stub -lpthread DEFINES += -DSSNES_CONSOLE -DHAVE_OPENGL=1 -DHAVE_CG=1 -DHAVE_FBO=1 -D__CELLOS_LV2__ -DHAVE_CONFIGFILE=1 -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DPACKAGE_VERSION=\"$(SSNES_VERSION)\" -DHAVE_SCREENSHOTS_BUILTIN=1 -Dmain=ssnes_main @@ -81,8 +82,13 @@ else PPU_OPTIMIZE_LV := -O3 -g endif -PPU_CFLAGS = $(PPU_OPTIMIZE_LV) $(DEFINES) -PPU_CXXFLAGS = $(PPU_OPTIMIZE_LV) $(DEFINES) +PPU_CFLAGS = $(PPU_OPTIMIZE_LV) $(INCDIRS) $(DEFINES) +PPU_CXXFLAGS = $(PPU_OPTIMIZE_LV) $(INCDIRS) $(DEFINES) + +ifeq ($(HAVE_LOGGER), 1) +PPU_CFLAGS += -DHAVE_LOGGER +PPU_SRCS += ps3/cellframework2/fileio/logger.c +endif EXIST_EBOOT_WILDCARD := $(wildcard $(EBOOT_PATH)) EXIST_CORE_WILDCARD := $(wildcard $(CORE_PATH)) diff --git a/general.h b/general.h index e57c68226a..2e59493795 100644 --- a/general.h +++ b/general.h @@ -439,7 +439,7 @@ extern struct console_settings g_console; ///////// #if defined(SSNES_CONSOLE) && defined(HAVE_LOGGER) -#include +#include "logger_override.h" #else #define SSNES_LOG(...) do { \ if (g_extern.verbose) \ diff --git a/logger_override.h b/logger_override.h new file mode 100644 index 0000000000..f968d89ddd --- /dev/null +++ b/logger_override.h @@ -0,0 +1,32 @@ +/* SSNES - A Super Nintendo Entertainment System (SNES) Emulator frontend for libsnes. + * Copyright (C) 2010-2012 - Hans-Kristian Arntzen + * Copyright (C) 2011-2012 - Daniel De Matteis + * + * Some code herein may be based on code found in BSNES. + * + * SSNES is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * SSNES is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with SSNES. + * If not, see . + */ + +#ifndef __SSNES_LOGGER_OVERRIDE_H +#define __SSNES_LOGGER_OVERRIDE_H + +#ifdef __CELLOS_LV2__ + +#include "ps3/cellframework2/fileio/logger.h" + +#define SSNES_LOG(...) do{ if (g_extern.verbose) net_send("SSNES: " __VA_ARGS__); }while(0) +#define SSNES_ERR(...) do{ net_send("SSNES [ERROR] :: " __VA_ARGS__); }while(0) +#define SSNES_WARN(...) do{ net_send("SSNES [WARN] :: " __VA_ARGS__); }while(0) + +#endif + +#endif diff --git a/ps3/main.c b/ps3/main.c index 921ffcc800..0f12240756 100644 --- a/ps3/main.c +++ b/ps3/main.c @@ -521,6 +521,10 @@ int main(int argc, char *argv[]) sys_net_initialize_network(); +#ifdef HAVE_LOGGER + logger_init(); +#endif + sceNpInit(NP_POOL_SIZE, np_pool); get_environment_settings(argc); @@ -590,6 +594,10 @@ begin_shutdown: cell_pad_input_deinit(); ps3_video_deinit(); +#ifdef HAVE_LOGGER + logger_shutdown(); +#endif + if(g_console.screenshots_enable) cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT); cellSysmoduleUnloadModule(CELL_SYSMODULE_JPGDEC);