diff --git a/libretro.cpp b/libretro.cpp index 1ec3bc8..c212f1b 100644 --- a/libretro.cpp +++ b/libretro.cpp @@ -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; - } + game->name = 0; MDFNMP_Kill(); diff --git a/stubs.cpp b/stubs.cpp index 228d0f2..d7e59ed 100644 --- a/stubs.cpp +++ b/stubs.cpp @@ -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 #include @@ -23,8 +27,6 @@ #include -//#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)