mirror of
https://github.com/libretro/RetroArch
synced 2025-03-20 10:20:51 +00:00
RARCH_LOG_BUFFER - doesn't need early return
This commit is contained in:
parent
77f48c8c8e
commit
2fbcc99b24
@ -101,11 +101,12 @@ static void *ds4_pad_init(void *data, uint32_t slot, hid_driver_t *driver)
|
||||
|
||||
static void ds4_packet_handler(void *data, uint8_t *packet, uint16_t size)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
ds4_instance_t *instance = (ds4_instance_t *)data;
|
||||
if (!instance)
|
||||
return;
|
||||
|
||||
RARCH_LOG_BUFFER(packet, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ds4_set_rumble(void *data, enum retro_rumble_effect effect, uint16_t strength) { }
|
||||
|
@ -146,11 +146,12 @@ static void hid_null_get_buttons(void *data, input_bits_t *state) { }
|
||||
*/
|
||||
static void hid_null_packet_handler(void *data, uint8_t *packet, uint16_t size)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
hid_null_instance_t *instance = (hid_null_instance_t *)data;
|
||||
if (!instance)
|
||||
return;
|
||||
|
||||
RARCH_LOG_BUFFER(packet, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
147
verbosity.c
147
verbosity.c
@ -214,108 +214,106 @@ void retro_main_log_file_deinit(void)
|
||||
void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap)
|
||||
{
|
||||
verbosity_state_t *g_verbosity = &main_verbosity_st;
|
||||
const char *tag_v = tag ? tag : FILE_PATH_LOG_INFO;
|
||||
|
||||
{
|
||||
const char *tag_v = tag ? tag : FILE_PATH_LOG_INFO;
|
||||
#if TARGET_OS_IPHONE
|
||||
#if TARGET_IPHONE_SIMULATOR
|
||||
vprintf(fmt, ap);
|
||||
vprintf(fmt, ap);
|
||||
#else
|
||||
static aslclient asl_client;
|
||||
static int asl_initialized = 0;
|
||||
if (!asl_initialized)
|
||||
{
|
||||
asl_client = asl_open(
|
||||
FILE_PATH_PROGRAM_NAME,
|
||||
"com.apple.console",
|
||||
ASL_OPT_STDERR | ASL_OPT_NO_DELAY);
|
||||
asl_initialized = 1;
|
||||
}
|
||||
aslmsg msg = asl_new(ASL_TYPE_MSG);
|
||||
asl_set(msg, ASL_KEY_READ_UID, "-1");
|
||||
if (tag)
|
||||
asl_log(asl_client, msg, ASL_LEVEL_NOTICE, "%s", tag);
|
||||
asl_vlog(asl_client, msg, ASL_LEVEL_NOTICE, fmt, ap);
|
||||
asl_free(msg);
|
||||
static aslclient asl_client;
|
||||
static int asl_initialized = 0;
|
||||
if (!asl_initialized)
|
||||
{
|
||||
asl_client = asl_open(
|
||||
FILE_PATH_PROGRAM_NAME,
|
||||
"com.apple.console",
|
||||
ASL_OPT_STDERR | ASL_OPT_NO_DELAY);
|
||||
asl_initialized = 1;
|
||||
}
|
||||
aslmsg msg = asl_new(ASL_TYPE_MSG);
|
||||
asl_set(msg, ASL_KEY_READ_UID, "-1");
|
||||
if (tag)
|
||||
asl_log(asl_client, msg, ASL_LEVEL_NOTICE, "%s", tag);
|
||||
asl_vlog(asl_client, msg, ASL_LEVEL_NOTICE, fmt, ap);
|
||||
asl_free(msg);
|
||||
#endif
|
||||
#elif defined(_XBOX1)
|
||||
/* FIXME: Using arbitrary string as fmt argument is unsafe. */
|
||||
char msg_new[256];
|
||||
char buffer[256];
|
||||
/* FIXME: Using arbitrary string as fmt argument is unsafe. */
|
||||
char msg_new[256];
|
||||
char buffer[256];
|
||||
|
||||
msg_new[0] = buffer[0] = '\0';
|
||||
snprintf(msg_new, sizeof(msg_new), "%s: %s %s",
|
||||
FILE_PATH_PROGRAM_NAME, tag_v, fmt);
|
||||
wvsprintf(buffer, msg_new, ap);
|
||||
OutputDebugStringA(buffer);
|
||||
msg_new[0] = buffer[0] = '\0';
|
||||
snprintf(msg_new, sizeof(msg_new), "%s: %s %s",
|
||||
FILE_PATH_PROGRAM_NAME, tag_v, fmt);
|
||||
wvsprintf(buffer, msg_new, ap);
|
||||
OutputDebugStringA(buffer);
|
||||
#elif defined(ANDROID)
|
||||
int prio = ANDROID_LOG_INFO;
|
||||
if (tag)
|
||||
{
|
||||
if (string_is_equal(FILE_PATH_LOG_WARN, tag))
|
||||
prio = ANDROID_LOG_WARN;
|
||||
else if (string_is_equal(FILE_PATH_LOG_ERROR, tag))
|
||||
prio = ANDROID_LOG_ERROR;
|
||||
}
|
||||
int prio = ANDROID_LOG_INFO;
|
||||
if (tag)
|
||||
{
|
||||
if (string_is_equal(FILE_PATH_LOG_WARN, tag))
|
||||
prio = ANDROID_LOG_WARN;
|
||||
else if (string_is_equal(FILE_PATH_LOG_ERROR, tag))
|
||||
prio = ANDROID_LOG_ERROR;
|
||||
}
|
||||
|
||||
if (g_verbosity->initialized)
|
||||
{
|
||||
vfprintf(g_verbosity->fp, fmt, ap);
|
||||
fflush(g_verbosity->fp);
|
||||
}
|
||||
else
|
||||
__android_log_vprint(prio, FILE_PATH_PROGRAM_NAME, fmt, ap);
|
||||
if (g_verbosity->initialized)
|
||||
{
|
||||
vfprintf(g_verbosity->fp, fmt, ap);
|
||||
fflush(g_verbosity->fp);
|
||||
}
|
||||
else
|
||||
__android_log_vprint(prio, FILE_PATH_PROGRAM_NAME, fmt, ap);
|
||||
#else
|
||||
FILE *fp = (FILE*)g_verbosity->fp;
|
||||
FILE *fp = (FILE*)g_verbosity->fp;
|
||||
#if defined(HAVE_QT) || defined(__WINRT__)
|
||||
char buffer[256];
|
||||
buffer[0] = '\0';
|
||||
char buffer[256];
|
||||
buffer[0] = '\0';
|
||||
|
||||
/* Ensure null termination and line break in error case */
|
||||
if (vsnprintf(buffer, sizeof(buffer), fmt, ap) < 0)
|
||||
/* Ensure null termination and line break in error case */
|
||||
if (vsnprintf(buffer, sizeof(buffer), fmt, ap) < 0)
|
||||
{
|
||||
int end;
|
||||
buffer[sizeof(buffer) - 1] = '\0';
|
||||
end = strlen(buffer) - 1;
|
||||
if (end >= 0)
|
||||
buffer[end] = '\n';
|
||||
else
|
||||
{
|
||||
int end;
|
||||
buffer[sizeof(buffer) - 1] = '\0';
|
||||
end = strlen(buffer) - 1;
|
||||
if (end >= 0)
|
||||
buffer[end] = '\n';
|
||||
else
|
||||
{
|
||||
buffer[0] = '\n';
|
||||
buffer[1] = '\0';
|
||||
}
|
||||
buffer[0] = '\n';
|
||||
buffer[1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if (fp)
|
||||
{
|
||||
fprintf(fp, "%s %s", tag_v, buffer);
|
||||
fflush(fp);
|
||||
}
|
||||
if (fp)
|
||||
{
|
||||
fprintf(fp, "%s %s", tag_v, buffer);
|
||||
fflush(fp);
|
||||
}
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
ui_companion_driver_log_msg(buffer);
|
||||
ui_companion_driver_log_msg(buffer);
|
||||
#endif
|
||||
|
||||
#if defined(__WINRT__)
|
||||
OutputDebugStringA(buffer);
|
||||
OutputDebugStringA(buffer);
|
||||
#endif
|
||||
#else
|
||||
#if defined(HAVE_LIBNX)
|
||||
mutexLock(&g_verbosity->mtx);
|
||||
mutexLock(&g_verbosity->mtx);
|
||||
#endif
|
||||
if (fp)
|
||||
{
|
||||
fprintf(fp, "%s ", tag_v);
|
||||
vfprintf(fp, fmt, ap);
|
||||
fflush(fp);
|
||||
}
|
||||
if (fp)
|
||||
{
|
||||
fprintf(fp, "%s ", tag_v);
|
||||
vfprintf(fp, fmt, ap);
|
||||
fflush(fp);
|
||||
}
|
||||
#if defined(HAVE_LIBNX)
|
||||
mutexUnlock(&g_verbosity->mtx);
|
||||
mutexUnlock(&g_verbosity->mtx);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void RARCH_LOG_BUFFER(uint8_t *data, size_t size)
|
||||
@ -324,9 +322,6 @@ void RARCH_LOG_BUFFER(uint8_t *data, size_t size)
|
||||
int padding = size % 16;
|
||||
uint8_t buf[16] = {0};
|
||||
|
||||
if (verbosity_log_level > 1)
|
||||
return;
|
||||
|
||||
RARCH_LOG("== %d-byte buffer ==================\n", (int)size);
|
||||
|
||||
for (i = 0, offset = 0; i < size; i++)
|
||||
|
Loading…
x
Reference in New Issue
Block a user