Add logging

This commit is contained in:
twinaphex 2014-04-20 16:32:46 +02:00
parent 71297e298b
commit 648ffbc440
2 changed files with 15 additions and 19 deletions

View File

@ -9,7 +9,7 @@
#include "libretro.h"
static MDFNGI *game;
static retro_log_printf_t log_cb;
retro_log_printf_t log_cb;
static retro_video_refresh_t video_cb;
static retro_audio_sample_t audio_cb;
static retro_audio_sample_batch_t audio_batch_cb;
@ -430,7 +430,7 @@ void retro_init()
check_system_specs();
}
void retro_reset()
void retro_reset(void)
{
game->DoSimpleCommand(MDFN_MSC_RESET);
}
@ -875,10 +875,8 @@ void retro_unload_game()
game->CloseGame();
if (game->name)
{
free(game->name);
game->name = 0;
}
MDFNMP_Kill();

View File

@ -5,6 +5,10 @@
#include "mednafen/general.h"
#include "mednafen/mednafen-driver.h"
#include "libretro.h"
extern retro_log_printf_t log_cb;
#if defined(__CELLOS_LV2__)
#include <sys/timer.h>
#include <ppu_intrinsics.h>
@ -23,8 +27,6 @@
#include <iostream>
//#define LIBRETRO_DEBUG
// Stubs
extern std::string retro_base_directory;
@ -62,6 +64,8 @@ std::string MDFN_MakeFName(MakeFName_Type type, int id1, const char *cd1)
std::string(cd1);
break;
case MDFNMKF_FIRMWARE:
case MDFNMKF_AUX:
case MDFNMKF_PALETTE:
ret = retro_base_directory + slash + std::string(cd1);
#ifdef _WIN32
sanitize_path(ret); // Because Windows path handling is mongoloid.
@ -77,18 +81,14 @@ std::string MDFN_MakeFName(MakeFName_Type type, int id1, const char *cd1)
void MDFND_DispMessage(unsigned char *str)
{
#ifdef LIBRETRO_DEBUG
if(str != NULL)
fprintf(stderr, "DISPMSG: %s\n", str);
#endif
if (log_cb)
log_cb(RETRO_LOG_INFO, "%s\n", str);
}
void MDFND_Message(const char *str)
{
#ifdef LIBRETRO_DEBUG
if(str != NULL)
fprintf(stderr, "MSG: %s\n", str);
#endif
if (log_cb)
log_cb(RETRO_LOG_INFO, "%s\n", str);
}
void MDFND_MidSync(const EmulateSpecStruct *)
@ -96,10 +96,8 @@ void MDFND_MidSync(const EmulateSpecStruct *)
void MDFND_PrintError(const char* err)
{
#ifdef LIBRETRO_DEBUG
if(err != NULL)
fprintf(stderr, "ERR: %s\n", err);
#endif
if (log_cb)
log_cb(RETRO_LOG_ERROR, "%s\n", err);
}
void MDFND_Sleep(unsigned int time)