From 38092e01bae08202547f23d4e1208ee19f3b2c0d Mon Sep 17 00:00:00 2001 From: Al-Azif Date: Tue, 14 Dec 2021 21:12:26 -0800 Subject: [PATCH] Static log library, readd logging to all sources --- Makefile | 5 +- external/{libLog_stub.h => libLog.h} | 78 --------------------------- libs/libLog.a | Bin 0 -> 12952 bytes sce_module/libLog.prx | Bin 61952 -> 0 bytes src/controller.cpp | 6 ++- src/graphics.cpp | 23 ++++---- src/main.cpp | 33 +++--------- 7 files changed, 28 insertions(+), 117 deletions(-) rename external/{libLog_stub.h => libLog.h} (54%) create mode 100644 libs/libLog.a delete mode 100644 sce_module/libLog.prx diff --git a/Makefile b/Makefile index 7fa3f27..2dc51ca 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,12 @@ # Package metadata TITLE := PS4 Vibe -VERSION := 1.00 +VERSION := 1.02 TITLE_ID := AZIF00001 CONTENT_ID := IV0000-AZIF00001_00-PS4VIBE000000000 # Libraries linked into the ELF LIBS := -lc -lkernel -lc++ -lSceSystemService -lSceSysmodule -lSceVideoOut -lSceUserService -lScePad -lSceFreeType +LIBS += -Llibs -lLog # Directorys to include INCLUDES := -Iinclude -Iexternal @@ -89,4 +90,4 @@ $(ODIR): .PHONY: clean clean: - rm -rf $(CONTENT_ID).pkg pkg.gp4 sce_sys/param.sfo eboot.bin $(ODIR) + rm -rf *.pkg pkg.gp4 sce_sys/param.sfo eboot.bin $(ODIR) diff --git a/external/libLog_stub.h b/external/libLog.h similarity index 54% rename from external/libLog_stub.h rename to external/libLog.h index fa22a98..1cabb28 100644 --- a/external/libLog_stub.h +++ b/external/libLog.h @@ -7,8 +7,6 @@ #define LIBLOG_H #ifdef __cplusplus -// TODO: C++ stream bindings includes here - extern "C" { #endif @@ -18,9 +16,7 @@ extern "C" { #include #include -#ifndef __LIBLOG_PC__ #include -#endif enum LogLevels { LL_None, @@ -40,75 +36,6 @@ enum PrintTypes { PT_File, }; -#ifndef __LIBLOG_PC__ -void (*_logPrint)(enum LogLevels p_LogLevel, enum PrintTypes p_PrintType, bool p_Meta, const char *p_File, int p_Line, const char *p_Format, ...) = NULL; -void (*_logPrintHex)(enum LogLevels p_LogLevel, enum PrintTypes p_PrintType, bool p_Meta, const char *p_File, int p_Line, const void *p_Pointer, int p_Length) = NULL; -void (*_logPrintBin)(enum LogLevels p_LogLevel, enum PrintTypes p_PrintType, const char *p_Input, uint16_t p_Port, const void *p_Pointer, int p_Length) = NULL; - -bool (*logSocketOpen)(const char *p_IpAddress, uint16_t p_Port) = NULL; -bool (*logSocketClose)() = NULL; -bool (*logSocketIsOpen)() = NULL; - -const char *(*logSocketGetIpAddress)() = NULL; -uint16_t (*logSocketGetPort)() = NULL; - -bool (*logFileOpen)(const char *p_Path) = NULL; -bool (*logFileClose)() = NULL; -const char *(*logFileGetFilename)() = NULL; - -void (*logSetLogLevel)(enum LogLevels p_LogLevel) = NULL; -enum LogLevels (*logGetLogLevel)() = NULL; - -void (*logPrintSetLogLevel)(enum LogLevels p_LogLevel) = NULL; -enum LogLevels (*logPrintGetLogLevel)() = NULL; - -void (*logKernelSetLogLevel)(enum LogLevels p_LogLevel) = NULL; -enum LogLevels (*logKernelGetLogLevel)() = NULL; - -void (*logFileSetLogLevel)(enum LogLevels p_LogLevel) = NULL; -enum LogLevels (*logFileGetLogLevel)() = NULL; - -void (*logSocketSetLogLevel)(enum LogLevels p_LogLevel) = NULL; -enum LogLevels (*logSocketGetLogLevel)() = NULL; - -int32_t logInitalize(int handle) { - if (sceKernelDlsym(handle, "_logPrint", (void **)&_logPrint) != 0 || - sceKernelDlsym(handle, "_logPrintHex", (void **)&_logPrintHex) != 0 || - sceKernelDlsym(handle, "_logPrintBin", (void **)&_logPrintBin) != 0 || - - sceKernelDlsym(handle, "logSocketOpen", (void **)&logSocketOpen) != 0 || - sceKernelDlsym(handle, "logSocketClose", (void **)&logSocketClose) != 0 || - sceKernelDlsym(handle, "logSocketIsOpen", (void **)&logSocketIsOpen) != 0 || - - sceKernelDlsym(handle, "logSocketGetIpAddress", (void **)&logSocketGetIpAddress) != 0 || - sceKernelDlsym(handle, "logSocketGetPort", (void **)&logSocketGetPort) != 0 || - - sceKernelDlsym(handle, "logFileOpen", (void **)&logFileOpen) != 0 || - sceKernelDlsym(handle, "logFileClose", (void **)&logFileClose) != 0 || - sceKernelDlsym(handle, "logFileGetFilename", (void **)&logFileGetFilename) != 0 || - - sceKernelDlsym(handle, "logSetLogLevel", (void **)&logSetLogLevel) != 0 || - sceKernelDlsym(handle, "logGetLogLevel", (void **)&logGetLogLevel) != 0 || - - sceKernelDlsym(handle, "logPrintSetLogLevel", (void **)&logPrintSetLogLevel) != 0 || - sceKernelDlsym(handle, "logPrintGetLogLevel", (void **)&logPrintGetLogLevel) != 0 || - - sceKernelDlsym(handle, "logKernelSetLogLevel", (void **)&logKernelSetLogLevel) != 0 || - sceKernelDlsym(handle, "logKernelGetLogLevel", (void **)&logKernelGetLogLevel) != 0 || - - sceKernelDlsym(handle, "logFileSetLogLevel", (void **)&logFileSetLogLevel) != 0 || - sceKernelDlsym(handle, "logFileGetLogLevel", (void **)&logFileGetLogLevel) != 0 || - - sceKernelDlsym(handle, "logSocketSetLogLevel", (void **)&logSocketSetLogLevel) != 0 || - sceKernelDlsym(handle, "logSocketGetLogLevel", (void **)&logSocketGetLogLevel) != 0) { - return -1; - } - - return 0; -} - -#else - void _logPrint(enum LogLevels p_LogLevel, enum PrintTypes p_PrintType, bool p_Meta, const char *p_File, int p_Line, const char *p_Format, ...); void _logPrintHex(enum LogLevels p_LogLevel, enum PrintTypes p_PrintType, bool p_Meta, const char *p_File, int p_Line, const void *p_Pointer, int p_Length); void _logPrintBin(enum LogLevels p_LogLevel, enum PrintTypes p_PrintType, const char *p_Input, uint16_t p_Port, const void *p_Pointer, int p_Length); @@ -139,8 +66,6 @@ enum LogLevels logFileGetLogLevel(); void logSocketSetLogLevel(enum LogLevels p_LogLevel); enum LogLevels logSocketGetLogLevel(); -#endif - #define logPrint(p_LogLevel, ...) _logPrint(p_LogLevel, PT_Print, true, __FILE__, __LINE__, __VA_ARGS__) #define logPrintUnformatted(p_LogLevel, ...) _logPrint(p_LogLevel, PT_Print, false, __FILE__, __LINE__, __VA_ARGS__) #define logPrintHexdump(p_LogLevel, p_Pointer, p_Length) _logPrintHex(p_LogLevel, PT_Print, true, __FILE__, __LINE__, p_Pointer, p_Length) @@ -166,9 +91,6 @@ enum LogLevels logSocketGetLogLevel(); #ifdef __cplusplus } - -// TODO: C++ stream bindings here - #endif #endif diff --git a/libs/libLog.a b/libs/libLog.a new file mode 100644 index 0000000000000000000000000000000000000000..ee54c25f2871a1dd298a9b0bcad629d4b6cbaba2 GIT binary patch literal 12952 zcmc&)eRNdEb)Q`c5Hi^(QevwHCyQBOk-~ac2rR&swekwyHY-~VI3@=$T2?ENk+jP0 z3W2{Oypo;QwLop%9QU+MXyev@v?t}%uA!|YbbdO4Tl_zh3Xs+iHlSwOj}> zR|xmppWWjJ69O-8>`ZQMNp*B*M4{B!(LGTy6Whh+jVn7k6Vc@6XkuHU6RKZHq`DKG z3IIhUxjWXCfM%+-BtdKWM+S*cybXoRf!Cm(v7B2J3s}E1l`k<=;r3tlbbbayRVL*#wfd{5lT#>)2q@0g+ACl z1ThnS0GkV_+K~dt&ai<dIX0^HVTp4gSTd$ec4@1^ZL)Hh@m4T5=gRx-1*AFblf+u~$GJndqN9KR! z+bi>Dd?PadN8d4-Kkqvw^A~*=Aa5SLXbk+RTL^RTq%mMYA(Z{3#CYPH2<4^#g~&nS zb68m6G9KFucqD$v9FmBcD?PZZ+IZ}b0F7EI($(!HZGr{WB;Y()rT$wra1tdT_P3vs4bs=K?Vm~6G`|=rIB|O!(h1o-1G%^ZCMlC?2@e7gs zVd}+)6TP?t2qMewcZJiNb0lyBzvF$-vPkP-2}fPyFwV>+69GZPP!tJtB+de&wLv^K_hPLo8CTn zG}8r<*3mu|_EieEvF{@(xgAF0M&OVYD9mAd2DR?yW zuNBZNTO!u^@f#?<%v``6yqGDAG8g6M&O;dU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4lN`5c z@Z}t@*5I`qS2XyyIquQmB^+buYUxSPHK!FAq?*Wqr7x}(OgNyf)MT6UTUa@I#vEFJ8F4m=JaKVF^msoE%=UK!N zxXN)nlT}brV!^YEc?jZ162=$v#i=nQ8 zS^{+~)SIAMpyIo<6lxjNa;OzhE1|A~YJ-|tz;_$!M|o1*!1eRo2*%QW@pm-%p!!Lk zq=7T4PjUTLuD9|evR*SD=E(f<pad = scePadOpen(this->userID, 0, 0, NULL); if (this->pad < 0) { - // DEBUGLOG << "[DEBUG] [ERROR] Failed to open pad!"; + logKernel(LL_Error, "%s", "Failed to open pad!"); return false; } diff --git a/src/graphics.cpp b/src/graphics.cpp index bf7e00a..cd4c823 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -1,14 +1,16 @@ // OpenOrbis Toolchain, https://github.com/OpenOrbis/OpenOrbis-PS4-Toolchain +#include "graphics.h" + +#include "libLog.h" + +#include + #include #include #include #include -#include - -#include "graphics.h" - Scene2D::Scene2D(int w, int h, int pixelDepth) { this->width = w; this->height = h; @@ -24,7 +26,7 @@ bool Scene2D::Init(size_t memSize, int numFrameBuffers) { this->videoMem = NULL; if (this->video < 0) { - // DEBUGLOG << "Failed to open a video out handle: " << std::string(strerror(errno)); + logKernel(LL_Error, "Failed to open a video out handle: %s", std::string(strerror(errno)).c_str()); return false; } @@ -33,7 +35,8 @@ bool Scene2D::Init(size_t memSize, int numFrameBuffers) { rc = sceSysmoduleLoadModule(0x009A); if (rc < 0) { - // DEBUGLOG << "Failed to load freetype: " << std::string(strerror(errno)); + logKernel(LL_Error, "Failed to load freetype: %s", std::string(strerror(errno)).c_str()); + return false; } @@ -41,23 +44,23 @@ bool Scene2D::Init(size_t memSize, int numFrameBuffers) { rc = FT_Init_FreeType(&this->ftLib); if (rc != 0) { - // DEBUGLOG << "Failed to initialize freetype: " << std::string(strerror(errno)); + logKernel(LL_Error, "Failed to initialize freetype: %s", std::string(strerror(errno)).c_str()); return false; } #endif if (!initFlipQueue()) { - // DEBUGLOG << "Failed to initialize flip queue: " << std::string(strerror(errno)); + logKernel(LL_Error, "Failed to initialize flip queue: %s", std::string(strerror(errno)).c_str()); return false; } if (!allocateVideoMem(memSize, 0x200000)) { - // DEBUGLOG << "Failed to allocate video memory: " << std::string(strerror(errno)); + logKernel(LL_Error, "Failed to allocate video memory: %s", std::string(strerror(errno)).c_str()); return false; } if (!allocateFrameBuffers(numFrameBuffers)) { - // DEBUGLOG << "Failed to allocate frame buffers: " << std::string(strerror(errno)); + logKernel(LL_Error, "Failed to allocate frame buffers: %s", std::string(strerror(errno)).c_str()); return false; } diff --git a/src/main.cpp b/src/main.cpp index 03b519b..0abb0b4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,21 +3,19 @@ // License: GPL-3.0 -#include -#include +#include "controller.h" +#include "graphics.h" + +#include "libLog.h" +#include "notifi.h" #include #include #include #include -#include "controller.h" -#include "graphics.h" -#include "libLog_stub.h" -#include "notifi.h" - -// Handle for libLog -int g_LibLogHandle = -1; +#include +#include // Dimensions for the 2D scene #define FRAME_WIDTH 1920 @@ -49,15 +47,11 @@ void terminate() { g_Controller->SetVibration(&g_Vibra); g_Controller->ResetLightBar(); - - if (g_LibLogHandle >= 0) { - sceKernelStopUnloadModule(g_LibLogHandle, 0, 0, 0, NULL, NULL); - } } // This function will display p_Message, then "cleanly" close the application void fail(const char *p_Message) { - printf("%s", p_Message); // Flawfinder: ignore + logKernel(LL_Fatal, "%s", p_Message); notifi(NULL, "%s", p_Message); terminate(); sceSystemServiceLoadExec("exit", NULL); @@ -65,17 +59,6 @@ void fail(const char *p_Message) { // Initalize void initialize() { - if ((g_LibLogHandle = sceKernelLoadStartModule("/app0/sce_module/libLog.prx", 0, 0, 0, NULL, NULL)) < 0) { - fail("Failed to start the libLog library"); - } - - if (logInitalize(g_LibLogHandle) != 0) { - fail("Failed to initialize the libLog library's functions"); - } - - // We know the logging is initalized here so we can use it after this point - logKernel(LL_Info, "%s", "libLog.prx Initialized"); - g_Vibra.lgMotor = 0; g_Vibra.smMotor = 0;