mirror of
https://github.com/Pecusx/libretro-atari800.git
synced 2026-05-20 22:33:22 +02:00
Use log_cb instead of printing directly
This commit is contained in:
+1
-1
@@ -53,7 +53,7 @@ int pre_main(const char *argv)
|
|||||||
for (i = 0; i < PARAMCOUNT; i++)
|
for (i = 0; i < PARAMCOUNT; i++)
|
||||||
{
|
{
|
||||||
xargv_cmd[i] = (char*)(XARGV[i]);
|
xargv_cmd[i] = (char*)(XARGV[i]);
|
||||||
LOGI("%2d %s\n",i,XARGV[i]);
|
log_cb(RETRO_LOG_INFO, "%2d %s\n",i,XARGV[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
skel_main(PARAMCOUNT,( char **)xargv_cmd);
|
skel_main(PARAMCOUNT,( char **)xargv_cmd);
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
#if defined(__ANDROID__) || defined(ANDROID)
|
|
||||||
#include <android/log.h>
|
|
||||||
#define LOG_TAG "RetroArch.atari800"
|
|
||||||
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
|
|
||||||
#else
|
|
||||||
#define LOGI printf
|
|
||||||
#endif
|
|
||||||
+29
-14
@@ -1,3 +1,5 @@
|
|||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "libretro.h"
|
#include "libretro.h"
|
||||||
|
|
||||||
#include "libretro-core.h"
|
#include "libretro-core.h"
|
||||||
@@ -11,6 +13,10 @@
|
|||||||
cothread_t mainThread;
|
cothread_t mainThread;
|
||||||
cothread_t emuThread;
|
cothread_t emuThread;
|
||||||
|
|
||||||
|
static void fallback_log(enum retro_log_level level, const char *fmt, ...);
|
||||||
|
|
||||||
|
retro_log_printf_t log_cb = fallback_log;
|
||||||
|
|
||||||
int CROP_WIDTH;
|
int CROP_WIDTH;
|
||||||
int CROP_HEIGHT;
|
int CROP_HEIGHT;
|
||||||
int VIRTUAL_WIDTH;
|
int VIRTUAL_WIDTH;
|
||||||
@@ -59,7 +65,18 @@ static retro_video_refresh_t video_cb;
|
|||||||
static retro_audio_sample_t audio_cb;
|
static retro_audio_sample_t audio_cb;
|
||||||
static retro_audio_sample_batch_t audio_batch_cb;
|
static retro_audio_sample_batch_t audio_batch_cb;
|
||||||
static retro_environment_t environ_cb;
|
static retro_environment_t environ_cb;
|
||||||
retro_log_printf_t log_cb;
|
|
||||||
|
|
||||||
|
static void fallback_log(enum retro_log_level level, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list va;
|
||||||
|
|
||||||
|
(void)level;
|
||||||
|
|
||||||
|
va_start(va, fmt);
|
||||||
|
vfprintf(stderr, fmt, va);
|
||||||
|
va_end(va);
|
||||||
|
}
|
||||||
|
|
||||||
void retro_set_environment(retro_environment_t cb)
|
void retro_set_environment(retro_environment_t cb)
|
||||||
{
|
{
|
||||||
@@ -360,11 +377,11 @@ static void update_variables(void)
|
|||||||
|
|
||||||
static void retro_wrap_emulator()
|
static void retro_wrap_emulator()
|
||||||
{
|
{
|
||||||
LOGI("WRAP EMU THD\n");
|
log_cb(RETRO_LOG_INFO, "WRAP EMU THD\n");
|
||||||
pre_main(RPATH);
|
pre_main(RPATH);
|
||||||
|
|
||||||
|
|
||||||
LOGI("EXIT EMU THD\n");
|
log_cb(RETRO_LOG_INFO, "EXIT EMU THD\n");
|
||||||
pauseg=-1;
|
pauseg=-1;
|
||||||
|
|
||||||
//environ_cb(RETRO_ENVIRONMENT_SHUTDOWN, 0);
|
//environ_cb(RETRO_ENVIRONMENT_SHUTDOWN, 0);
|
||||||
@@ -375,7 +392,7 @@ LOGI("EXIT EMU THD\n");
|
|||||||
// Dead emulator, but libco says not to return
|
// Dead emulator, but libco says not to return
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
LOGI("Running a dead emulator.");
|
log_cb(RETRO_LOG_INFO, "Running a dead emulator.");
|
||||||
co_switch(mainThread);
|
co_switch(mainThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,7 +425,7 @@ void Emu_uninit(){
|
|||||||
|
|
||||||
void retro_shutdown_core(void)
|
void retro_shutdown_core(void)
|
||||||
{
|
{
|
||||||
LOGI("SHUTDOWN\n");
|
log_cb(RETRO_LOG_INFO, "SHUTDOWN\n");
|
||||||
|
|
||||||
texture_uninit();
|
texture_uninit();
|
||||||
environ_cb(RETRO_ENVIRONMENT_SHUTDOWN, NULL);
|
environ_cb(RETRO_ENVIRONMENT_SHUTDOWN, NULL);
|
||||||
@@ -453,8 +470,6 @@ void retro_init(void)
|
|||||||
|
|
||||||
if (environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log))
|
if (environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log))
|
||||||
log_cb = log.log;
|
log_cb = log.log;
|
||||||
else
|
|
||||||
log_cb = NULL;
|
|
||||||
|
|
||||||
const char *system_dir = NULL;
|
const char *system_dir = NULL;
|
||||||
|
|
||||||
@@ -490,9 +505,9 @@ void retro_init(void)
|
|||||||
|
|
||||||
sprintf(retro_system_data_directory, "%s/data\0",RETRO_DIR);
|
sprintf(retro_system_data_directory, "%s/data\0",RETRO_DIR);
|
||||||
|
|
||||||
LOGI("Retro SYSTEM_DIRECTORY %s\n",retro_system_directory);
|
log_cb(RETRO_LOG_INFO, "Retro SYSTEM_DIRECTORY %s\n",retro_system_directory);
|
||||||
LOGI("Retro SAVE_DIRECTORY %s\n",retro_save_directory);
|
log_cb(RETRO_LOG_INFO, "Retro SAVE_DIRECTORY %s\n",retro_save_directory);
|
||||||
LOGI("Retro CONTENT_DIRECTORY %s\n",retro_content_directory);
|
log_cb(RETRO_LOG_INFO, "Retro CONTENT_DIRECTORY %s\n",retro_content_directory);
|
||||||
|
|
||||||
#ifndef RENDER16B
|
#ifndef RENDER16B
|
||||||
enum retro_pixel_format fmt =RETRO_PIXEL_FORMAT_XRGB8888;
|
enum retro_pixel_format fmt =RETRO_PIXEL_FORMAT_XRGB8888;
|
||||||
@@ -503,7 +518,7 @@ void retro_init(void)
|
|||||||
if (!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt))
|
if (!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "PIXEL FORMAT is not supported.\n");
|
fprintf(stderr, "PIXEL FORMAT is not supported.\n");
|
||||||
LOGI("PIXEL FORMAT is not supported.\n");
|
log_cb(RETRO_LOG_INFO, "PIXEL FORMAT is not supported.\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -540,17 +555,17 @@ void retro_deinit(void)
|
|||||||
|
|
||||||
|
|
||||||
co_switch(emuThread);
|
co_switch(emuThread);
|
||||||
LOGI("exit emu\n");
|
log_cb(RETRO_LOG_INFO, "exit emu\n");
|
||||||
// main_exit();
|
// main_exit();
|
||||||
co_switch(mainThread);
|
co_switch(mainThread);
|
||||||
LOGI("exit main\n");
|
log_cb(RETRO_LOG_INFO, "exit main\n");
|
||||||
if(emuThread)
|
if(emuThread)
|
||||||
{
|
{
|
||||||
co_delete(emuThread);
|
co_delete(emuThread);
|
||||||
emuThread = 0;
|
emuThread = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGI("Retro DeInit\n");
|
log_cb(RETRO_LOG_INFO, "Retro DeInit\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned retro_api_version(void)
|
unsigned retro_api_version(void)
|
||||||
|
|||||||
@@ -41,14 +41,6 @@ extern char Key_Sate2[512];
|
|||||||
|
|
||||||
extern int pauseg;
|
extern int pauseg;
|
||||||
|
|
||||||
#if defined(__ANDROID__) || defined(ANDROID)
|
|
||||||
#include <android/log.h>
|
|
||||||
#define LOG_TAG "RetroArch.Atari800"
|
|
||||||
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
|
|
||||||
#else
|
|
||||||
#define LOGI printf
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define NPLGN 12
|
#define NPLGN 12
|
||||||
#define NLIGN 5
|
#define NLIGN 5
|
||||||
#define NLETT 5
|
#define NLETT 5
|
||||||
|
|||||||
Reference in New Issue
Block a user