1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-04 10:03:36 +00:00

Have android LOG function use __android_log_vprint

This commit is contained in:
Logan McNaughton 2016-11-29 11:36:27 -08:00 committed by Sergey Lipskiy
parent 4ef15e7e2d
commit 4706bb5231
4 changed files with 14 additions and 15 deletions

View File

@ -1,5 +1,3 @@
#ifndef ANDROID
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include "Log.h" #include "Log.h"
@ -21,7 +19,7 @@ void LOG(u16 type, const char * format, ...) {
char cbuf[bufSize]; char cbuf[bufSize];
wcstombs(cbuf, logPath, bufSize); wcstombs(cbuf, logPath, bufSize);
FILE *dumpFile = fopen(cbuf, "a+"); FILE *dumpFile = fopen(cbuf, "a+");
#endif #endif //OS_WINDOWS
if (dumpFile == nullptr) if (dumpFile == nullptr)
return; return;
@ -45,5 +43,3 @@ void debugPrint(const char * format, ...) {
va_end(va); va_end(va);
} }
#endif #endif
#endif // ANDROID

View File

@ -11,21 +11,11 @@
#define LOG_LEVEL LOG_WARNING #define LOG_LEVEL LOG_WARNING
#if LOG_LEVEL > 0 #if LOG_LEVEL > 0
#ifdef ANDROID
#include <android/log.h>
#define LOG(A, ...) \
if (A <= LOG_LEVEL) \
{ \
__android_log_print(ANDROID_LOG_DEBUG, "GLideN64", __VA_ARGS__); \
}
#else // ANDROID
#include "Types.h" #include "Types.h"
void LOG(u16 type, const char * format, ...); void LOG(u16 type, const char * format, ...);
#endif // ANDROID
#else #else
#define LOG(A, ...) #define LOG(A, ...)

12
src/Log_android.cpp Normal file
View File

@ -0,0 +1,12 @@
#include "Log.h"
#include <android/log.h>
void LOG(u16 type, const char * format, ...) {
if (type > LOG_LEVEL)
return;
va_list va;
va_start(va, format);
__android_log_vprint(ANDROID_LOG_DEBUG, "GLideN64", format, va);
va_end(va);
}

View File

@ -50,6 +50,7 @@ MY_LOCAL_SRC_FILES := \
$(SRCDIR)/L3D.cpp \ $(SRCDIR)/L3D.cpp \
$(SRCDIR)/L3DEX2.cpp \ $(SRCDIR)/L3DEX2.cpp \
$(SRCDIR)/L3DEX.cpp \ $(SRCDIR)/L3DEX.cpp \
$(SRCDIR)/Log_android.cpp \
$(SRCDIR)/MupenPlusPluginAPI.cpp \ $(SRCDIR)/MupenPlusPluginAPI.cpp \
$(SRCDIR)/N64.cpp \ $(SRCDIR)/N64.cpp \
$(SRCDIR)/OpenGL.cpp \ $(SRCDIR)/OpenGL.cpp \