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" #include "libretro.h"
static MDFNGI *game; 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_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;
@ -430,7 +430,7 @@ void retro_init()
check_system_specs(); check_system_specs();
} }
void retro_reset() void retro_reset(void)
{ {
game->DoSimpleCommand(MDFN_MSC_RESET); game->DoSimpleCommand(MDFN_MSC_RESET);
} }
@ -875,10 +875,8 @@ void retro_unload_game()
game->CloseGame(); game->CloseGame();
if (game->name) if (game->name)
{
free(game->name); free(game->name);
game->name=0; game->name = 0;
}
MDFNMP_Kill(); MDFNMP_Kill();

View File

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