(Android) Android does not redirect stderr to the logger - so we

need to wrap all stderr fprintfs - this will help for Xbox 1 too
which also doesn't redirect stderr
This commit is contained in:
twinaphex 2012-10-16 13:57:35 +02:00
parent 2f26f8e76f
commit 608d3718a3
4 changed files with 63 additions and 12 deletions

View File

@ -149,9 +149,9 @@ static void find_audio_driver(void)
}
}
RARCH_ERR("Couldn't find any audio driver named \"%s\"\n", g_settings.audio.driver);
fprintf(stderr, "Available audio drivers are:\n");
RARCH_LOG_OUTPUT("Available audio drivers are:\n");
for (size_t i = 0; i < sizeof(audio_drivers) / sizeof(audio_driver_t*); i++)
fprintf(stderr, "\t%s\n", audio_drivers[i]->ident);
RARCH_LOG_OUTPUT("\t%s\n", audio_drivers[i]->ident);
rarch_fail(1, "find_audio_driver()");
}
@ -167,9 +167,9 @@ static void find_video_driver(void)
}
}
RARCH_ERR("Couldn't find any video driver named \"%s\"\n", g_settings.video.driver);
fprintf(stderr, "Available video drivers are:\n");
RARCH_LOG_OUTPUT("Available video drivers are:\n");
for (size_t i = 0; i < sizeof(video_drivers) / sizeof(video_driver_t*); i++)
fprintf(stderr, "\t%s\n", video_drivers[i]->ident);
RARCH_LOG_OUTPUT("\t%s\n", video_drivers[i]->ident);
rarch_fail(1, "find_video_driver()");
}
@ -185,9 +185,9 @@ static void find_input_driver(void)
}
}
RARCH_ERR("Couldn't find any input driver named \"%s\"\n", g_settings.input.driver);
fprintf(stderr, "Available input drivers are:\n");
RARCH_LOG_OUTPUT("Available input drivers are:\n");
for (size_t i = 0; i < sizeof(input_drivers) / sizeof(input_driver_t*); i++)
fprintf(stderr, "\t%s\n", input_drivers[i]->ident);
RARCH_LOG_OUTPUT("\t%s\n", input_drivers[i]->ident);
rarch_fail(1, "find_input_driver()");
}

View File

@ -172,7 +172,7 @@ static void take_screenshot(void)
static void readjust_audio_input_rate(void)
{
int avail = audio_write_avail_func();
//fprintf(stderr, "Audio buffer is %u%% full\n",
//RARCH_LOG_OUTPUT("Audio buffer is %u%% full\n",
// (unsigned)(100 - (avail * 100) / g_extern.audio_data.driver_buffer_size));
int half_size = g_extern.audio_data.driver_buffer_size / 2;
@ -183,7 +183,7 @@ static void readjust_audio_input_rate(void)
g_extern.audio_data.src_ratio = g_extern.audio_data.orig_src_ratio * adjust;
//fprintf(stderr, "New rate: %lf, Orig rate: %lf\n",
//RARCH_LOG_OUTPUT("New rate: %lf, Orig rate: %lf\n",
// g_extern.audio_data.src_ratio, g_extern.audio_data.orig_src_ratio);
}
@ -2508,9 +2508,9 @@ int rarch_main_init(int argc, char *argv[])
if (g_extern.verbose)
{
fprintf(stderr, "=== Build =======================================");
RARCH_LOG_OUTPUT("=== Build =======================================");
print_compiler(stderr);
fprintf(stderr, "=================================================\n");
RARCH_LOG_OUTPUT("=================================================\n");
}
config_load();

View File

@ -44,6 +44,25 @@
#endif
#endif
#ifndef RARCH_LOG_OUTPUT
#if defined(ANDROID)
#define RARCH_LOG_OUTPUT(...) __android_log_print(ANDROID_LOG_INFO,"stderr: ",__VA_ARGS__)
#elif defined(IS_SALAMANDER)
#define RARCH_LOG_OUTPUT(...) do { \
fprintf(stderr, "stderr: " __VA_ARGS__); \
fflush(stderr); \
} while (0)
#else
#define RARCH_LOG_OUTPUT(...) do { \
if (g_extern.verbose) \
{ \
fprintf(stderr, "stderr: " __VA_ARGS__); \
fflush(stderr); \
} \
} while (0)
#endif
#endif
#ifndef RARCH_ERR
#if defined(ANDROID)
#define RARCH_ERR(...) __android_log_print(ANDROID_LOG_INFO, "RetroArch [ERROR] :: ",__VA_ARGS__)
@ -60,6 +79,22 @@
#endif
#endif
#ifndef RARCH_ERR_OUTPUT
#if defined(ANDROID)
#define RARCH_ERR_OUTPUT(...) __android_log_print(ANDROID_LOG_INFO, "stderr [ERROR] :: ",__VA_ARGS__)
#elif defined(IS_SALAMANDER)
#define RARCH_ERR_OUTPUT(...) do { \
fprintf(stderr, "stderr [ERROR] :: " __VA_ARGS__); \
fflush(stderr); \
} while (0)
#else
#define RARCH_ERR_OUTPUT(...) do { \
fprintf(stderr, "stderr [ERROR] :: " __VA_ARGS__); \
fflush(stderr); \
} while (0)
#endif
#endif
#ifndef RARCH_WARN
#if defined(ANDROID)
#define RARCH_WARN(...) __android_log_print(ANDROID_LOG_INFO, "RetroArch [WARN] :: ",__VA_ARGS__)
@ -75,6 +110,22 @@
} while (0)
#endif
#endif
#ifndef RARCH_WARN
#if defined(ANDROID)
#define RARCH_WARN_OUTPUT(...) __android_log_print(ANDROID_LOG_INFO, "stderr [WARN] :: ",__VA_ARGS__)
#elif defined(IS_SALAMANDER)
#define RARCH_WARN_OUTPUT(...) do { \
fprintf(stderr, "stderr [WARN] :: " __VA_ARGS__); \
fflush(stderr); \
} while (0)
#else
#define RARCH_WARN_OUTPUT(...) do { \
fprintf(stderr, "stderr [WARN] :: " __VA_ARGS__); \
fflush(stderr); \
} while (0)
#endif
#endif
#endif
#endif

View File

@ -357,9 +357,9 @@ bool config_load_file(const char *path)
if (g_extern.verbose)
{
fprintf(stderr, "=== Config ===\n");
RARCH_LOG_OUTPUT("=== Config ===\n");
config_file_dump_all(conf, stderr);
fprintf(stderr, "=== Config end ===\n");
RARCH_LOG_OUTPUT("=== Config end ===\n");
}
char tmp_str[PATH_MAX];