2019-02-07 21:22:58 +00:00
|
|
|
#include <stdarg.h>
|
2012-06-03 15:48:14 +00:00
|
|
|
#include "mednafen/mednafen.h"
|
2019-02-03 19:33:14 +00:00
|
|
|
#include "mednafen/mednafen-endian.h"
|
2012-11-29 22:21:44 +00:00
|
|
|
#include "mednafen/mempatcher.h"
|
2012-06-03 15:48:14 +00:00
|
|
|
#include "mednafen/git.h"
|
|
|
|
#include "mednafen/general.h"
|
2019-02-07 11:25:08 +00:00
|
|
|
#include <libretro.h>
|
|
|
|
#include <streams/file_stream.h>
|
2019-05-27 00:34:16 +00:00
|
|
|
#include <algorithm>
|
2019-12-24 05:57:24 +00:00
|
|
|
#include "mednafen/lynx/system.h"
|
2019-12-25 06:50:46 +00:00
|
|
|
#include "libretro_core_options.h"
|
2012-06-03 15:48:14 +00:00
|
|
|
|
2019-07-30 02:58:08 +00:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
#include <compat/msvc.h>
|
|
|
|
#endif
|
|
|
|
|
2014-04-21 22:25:50 +00:00
|
|
|
struct retro_perf_callback perf_cb;
|
|
|
|
retro_get_cpu_features_t perf_get_cpu_features_cb = NULL;
|
2014-04-20 14:32:46 +00:00
|
|
|
retro_log_printf_t log_cb;
|
2012-06-03 15:48:14 +00:00
|
|
|
static retro_video_refresh_t video_cb;
|
|
|
|
static retro_audio_sample_t audio_cb;
|
|
|
|
static retro_audio_sample_batch_t audio_batch_cb;
|
|
|
|
static retro_environment_t environ_cb;
|
|
|
|
static retro_input_poll_t input_poll_cb;
|
|
|
|
static retro_input_state_t input_state_cb;
|
|
|
|
|
2013-02-25 19:39:39 +00:00
|
|
|
static bool overscan;
|
2012-11-16 14:12:25 +00:00
|
|
|
static double last_sound_rate;
|
|
|
|
static MDFN_PixelFormat last_pixel_format;
|
|
|
|
|
2019-12-25 06:50:46 +00:00
|
|
|
static bool auto_rotate;
|
2019-02-02 05:58:26 +00:00
|
|
|
static unsigned rot_screen;
|
2019-12-25 06:50:46 +00:00
|
|
|
static unsigned rot_screen_last_frame;
|
2019-02-02 05:58:26 +00:00
|
|
|
static unsigned select_pressed_last_frame;
|
|
|
|
|
2012-06-03 15:48:14 +00:00
|
|
|
static MDFN_Surface *surf;
|
|
|
|
|
2012-06-15 23:00:17 +00:00
|
|
|
static bool failed_init;
|
2012-06-03 15:48:14 +00:00
|
|
|
|
2014-01-20 23:19:08 +00:00
|
|
|
static void hookup_ports(bool force);
|
|
|
|
|
|
|
|
static bool initial_ports_hookup = false;
|
|
|
|
|
2012-10-13 13:31:49 +00:00
|
|
|
std::string retro_base_directory;
|
|
|
|
std::string retro_base_name;
|
2014-02-07 07:16:01 +00:00
|
|
|
std::string retro_save_directory;
|
2012-10-13 13:31:49 +00:00
|
|
|
|
2019-12-25 08:27:24 +00:00
|
|
|
static bool libretro_supports_input_bitmasks;
|
2020-10-16 07:29:24 +00:00
|
|
|
static int system_color_depth = 16;
|
2019-12-25 08:27:24 +00:00
|
|
|
|
2020-09-19 02:15:35 +00:00
|
|
|
extern MDFNGI EmulatedLynx;
|
|
|
|
MDFNGI *MDFNGameInfo = &EmulatedLynx;
|
|
|
|
|
2013-04-27 14:40:24 +00:00
|
|
|
static void set_basename(const char *path)
|
|
|
|
{
|
|
|
|
const char *base = strrchr(path, '/');
|
|
|
|
if (!base)
|
|
|
|
base = strrchr(path, '\\');
|
|
|
|
|
|
|
|
if (base)
|
|
|
|
retro_base_name = base + 1;
|
|
|
|
else
|
|
|
|
retro_base_name = path;
|
|
|
|
|
|
|
|
retro_base_name = retro_base_name.substr(0, retro_base_name.find_last_of('.'));
|
|
|
|
}
|
|
|
|
|
2013-12-18 20:42:11 +00:00
|
|
|
#define MEDNAFEN_CORE_NAME_MODULE "lynx"
|
2019-02-03 18:31:40 +00:00
|
|
|
#define MEDNAFEN_CORE_NAME "Beetle Lynx"
|
2019-12-25 07:15:33 +00:00
|
|
|
#define MEDNAFEN_CORE_VERSION "v1.24.0"
|
2019-12-25 20:45:59 +00:00
|
|
|
#define MEDNAFEN_CORE_EXTENSIONS "lnx|o"
|
2019-02-02 04:37:11 +00:00
|
|
|
#define MEDNAFEN_CORE_TIMING_FPS 75.0
|
2013-12-18 20:42:11 +00:00
|
|
|
#define MEDNAFEN_CORE_GEOMETRY_BASE_W 160
|
|
|
|
#define MEDNAFEN_CORE_GEOMETRY_BASE_H 102
|
|
|
|
#define MEDNAFEN_CORE_GEOMETRY_MAX_W 160
|
|
|
|
#define MEDNAFEN_CORE_GEOMETRY_MAX_H 102
|
2017-02-12 00:09:18 +00:00
|
|
|
#define MEDNAFEN_CORE_GEOMETRY_ASPECT_RATIO (80.0 / 51.0)
|
2013-12-18 20:42:11 +00:00
|
|
|
#define FB_WIDTH 160
|
|
|
|
#define FB_HEIGHT 102
|
2013-10-01 12:28:59 +00:00
|
|
|
|
|
|
|
#define FB_MAX_HEIGHT FB_HEIGHT
|
|
|
|
|
2012-10-20 21:56:43 +00:00
|
|
|
const char *mednafen_core_str = MEDNAFEN_CORE_NAME;
|
2012-10-20 21:32:28 +00:00
|
|
|
|
|
|
|
static void check_system_specs(void)
|
|
|
|
{
|
2012-10-22 12:34:14 +00:00
|
|
|
unsigned level = 0;
|
|
|
|
environ_cb(RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL, &level);
|
2012-10-20 21:32:28 +00:00
|
|
|
}
|
|
|
|
|
2014-04-21 22:25:50 +00:00
|
|
|
void retro_init(void)
|
2012-06-03 15:48:14 +00:00
|
|
|
{
|
2014-01-02 01:50:09 +00:00
|
|
|
struct retro_log_callback log;
|
|
|
|
if (environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log))
|
|
|
|
log_cb = log.log;
|
2019-12-25 06:50:46 +00:00
|
|
|
else
|
2014-01-02 01:50:09 +00:00
|
|
|
log_cb = NULL;
|
|
|
|
|
2012-06-11 23:03:09 +00:00
|
|
|
const char *dir = NULL;
|
2012-06-15 23:00:17 +00:00
|
|
|
|
2012-06-11 23:03:09 +00:00
|
|
|
if (environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &dir) && dir)
|
|
|
|
{
|
2012-10-13 13:31:49 +00:00
|
|
|
retro_base_directory = dir;
|
2012-11-10 01:20:13 +00:00
|
|
|
// Make sure that we don't have any lingering slashes, etc, as they break Windows.
|
2012-11-10 11:59:05 +00:00
|
|
|
size_t last = retro_base_directory.find_last_not_of("/\\");
|
|
|
|
if (last != std::string::npos)
|
|
|
|
last++;
|
|
|
|
|
|
|
|
retro_base_directory = retro_base_directory.substr(0, last);
|
2012-06-11 23:03:09 +00:00
|
|
|
}
|
2012-06-15 23:00:17 +00:00
|
|
|
else
|
2012-06-11 23:03:09 +00:00
|
|
|
{
|
2013-12-17 01:24:08 +00:00
|
|
|
/* TODO: Add proper fallback */
|
|
|
|
if (log_cb)
|
|
|
|
log_cb(RETRO_LOG_WARN, "System directory is not defined. Fallback on using same dir as ROM for system directory later ...\n");
|
2012-06-15 23:00:17 +00:00
|
|
|
failed_init = true;
|
2012-06-11 23:03:09 +00:00
|
|
|
}
|
2019-12-25 06:50:46 +00:00
|
|
|
|
2014-02-07 07:07:58 +00:00
|
|
|
if (environ_cb(RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY, &dir) && dir)
|
|
|
|
{
|
2014-02-07 22:34:14 +00:00
|
|
|
// If save directory is defined use it, otherwise use system directory
|
2016-04-29 17:38:39 +00:00
|
|
|
//retro_save_directory = *dir ? dir : retro_base_directory;
|
|
|
|
retro_save_directory = dir;
|
2014-02-07 07:07:58 +00:00
|
|
|
// Make sure that we don't have any lingering slashes, etc, as they break Windows.
|
|
|
|
size_t last = retro_save_directory.find_last_not_of("/\\");
|
|
|
|
if (last != std::string::npos)
|
|
|
|
last++;
|
|
|
|
|
2019-12-25 06:50:46 +00:00
|
|
|
retro_save_directory = retro_save_directory.substr(0, last);
|
2014-02-07 07:07:58 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* TODO: Add proper fallback */
|
|
|
|
if (log_cb)
|
2014-02-07 22:34:14 +00:00
|
|
|
log_cb(RETRO_LOG_WARN, "Save directory is not defined. Fallback on using SYSTEM directory ...\n");
|
2014-02-07 07:07:58 +00:00
|
|
|
retro_save_directory = retro_base_directory;
|
2019-12-25 06:50:46 +00:00
|
|
|
}
|
2012-06-09 22:46:41 +00:00
|
|
|
|
2014-04-21 22:25:50 +00:00
|
|
|
if (environ_cb(RETRO_ENVIRONMENT_GET_PERF_INTERFACE, &perf_cb))
|
|
|
|
perf_get_cpu_features_cb = perf_cb.get_cpu_features;
|
|
|
|
else
|
|
|
|
perf_get_cpu_features_cb = NULL;
|
|
|
|
|
2012-10-20 21:32:28 +00:00
|
|
|
check_system_specs();
|
2019-12-25 06:50:46 +00:00
|
|
|
|
|
|
|
libretro_set_core_options(environ_cb);
|
2019-12-25 08:27:24 +00:00
|
|
|
|
|
|
|
if (environ_cb(RETRO_ENVIRONMENT_GET_INPUT_BITMASKS, NULL))
|
|
|
|
libretro_supports_input_bitmasks = true;
|
2012-06-03 15:48:14 +00:00
|
|
|
}
|
|
|
|
|
2014-04-20 14:32:46 +00:00
|
|
|
void retro_reset(void)
|
2012-06-03 15:48:14 +00:00
|
|
|
{
|
2016-08-09 06:21:32 +00:00
|
|
|
DoSimpleCommand(MDFN_MSC_RESET);
|
2012-06-03 15:48:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool retro_load_game_special(unsigned, const struct retro_game_info *, size_t)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-05-24 15:26:57 +00:00
|
|
|
static void set_volume (uint32_t *ptr, unsigned number)
|
|
|
|
{
|
|
|
|
switch(number)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
*ptr = number;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-09 02:05:18 +00:00
|
|
|
static void check_variables(void)
|
|
|
|
{
|
|
|
|
struct retro_variable var = {0};
|
2019-12-25 06:50:46 +00:00
|
|
|
|
2019-12-25 21:14:07 +00:00
|
|
|
var.key = "lynx_rot_screen";
|
2019-12-25 06:50:46 +00:00
|
|
|
var.value = NULL;
|
|
|
|
|
|
|
|
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
|
|
|
|
if (strcmp(var.value, "disabled") == 0)
|
|
|
|
auto_rotate = false;
|
|
|
|
else
|
|
|
|
auto_rotate = true;
|
|
|
|
rot_screen = 0;
|
|
|
|
}
|
2013-04-09 02:05:18 +00:00
|
|
|
}
|
|
|
|
|
2013-12-18 20:42:11 +00:00
|
|
|
#define MAX_PLAYERS 1
|
|
|
|
#define MAX_BUTTONS 9
|
2019-02-09 01:29:17 +00:00
|
|
|
static uint8_t input_buf[2];
|
2013-04-09 03:23:42 +00:00
|
|
|
|
2020-09-19 02:15:35 +00:00
|
|
|
static bool MDFNI_LoadGame(const uint8_t *data, size_t size)
|
|
|
|
{
|
|
|
|
if (!data || !size)
|
|
|
|
{
|
|
|
|
MDFN_indent(-2);
|
|
|
|
MDFNGameInfo = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
MDFNFILE *GameFile = file_open_mem(data, size);
|
|
|
|
|
|
|
|
if (!GameFile)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
MDFNGameInfo = &EmulatedLynx;
|
|
|
|
|
|
|
|
MDFN_indent(1);
|
|
|
|
|
|
|
|
MDFN_printf(_("Using module: lynx\n\n"));
|
|
|
|
MDFN_indent(1);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Load per-game settings
|
|
|
|
//
|
|
|
|
// Maybe we should make a "pgcfg" subdir, and automatically load all files in it?
|
|
|
|
// End load per-game settings
|
|
|
|
//
|
|
|
|
|
|
|
|
Load(GameFile);
|
|
|
|
|
|
|
|
MDFN_LoadGameCheats(NULL);
|
|
|
|
MDFNMP_InstallReadPatches();
|
|
|
|
|
|
|
|
MDFN_indent(-2);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-10-16 07:29:24 +00:00
|
|
|
static bool init_pix_format(void)
|
|
|
|
{
|
|
|
|
struct retro_variable var = { "lynx_pix_format", NULL };
|
|
|
|
bool ret = true;
|
|
|
|
|
|
|
|
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
|
|
|
|
{
|
|
|
|
system_color_depth = atoi(var.value);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (system_color_depth == 32)
|
|
|
|
{
|
|
|
|
enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_XRGB8888;
|
|
|
|
if (!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt))
|
|
|
|
{
|
|
|
|
if (log_cb)
|
|
|
|
log_cb(RETRO_LOG_ERROR, "Pixel format XRGB8888 not supported by platform.\n");
|
|
|
|
ret = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ret || system_color_depth == 16)
|
|
|
|
{
|
|
|
|
enum retro_pixel_format rgb565 = RETRO_PIXEL_FORMAT_RGB565;
|
|
|
|
if (environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &rgb565))
|
|
|
|
{
|
|
|
|
log_cb(RETRO_LOG_INFO, "Frontend supports RGB565 - will use that instead of XRGB1555.\n");
|
|
|
|
system_color_depth = 16;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = false;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2020-09-19 02:15:35 +00:00
|
|
|
|
2012-06-03 15:48:14 +00:00
|
|
|
bool retro_load_game(const struct retro_game_info *info)
|
|
|
|
{
|
2017-01-24 14:45:01 +00:00
|
|
|
if (!info || failed_init)
|
2012-06-15 23:00:17 +00:00
|
|
|
return false;
|
|
|
|
|
2019-02-09 01:25:00 +00:00
|
|
|
struct retro_input_descriptor desc[] = {
|
|
|
|
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT, "D-Pad Left" },
|
|
|
|
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP, "D-Pad Up" },
|
|
|
|
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN, "D-Pad Down" },
|
|
|
|
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT, "D-Pad Right" },
|
|
|
|
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B, "A" },
|
|
|
|
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A, "B" },
|
|
|
|
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L, "Opt 1" },
|
|
|
|
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R, "Opt 2" },
|
|
|
|
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START, "Option" },
|
|
|
|
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT, "Rotate Screen and D-Pad" },
|
|
|
|
{ 0 },
|
|
|
|
};
|
|
|
|
|
|
|
|
environ_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, desc);
|
|
|
|
|
2013-02-25 19:39:39 +00:00
|
|
|
overscan = false;
|
|
|
|
environ_cb(RETRO_ENVIRONMENT_GET_OVERSCAN, &overscan);
|
|
|
|
|
2020-10-16 07:29:24 +00:00
|
|
|
if (!init_pix_format())
|
|
|
|
log_cb(RETRO_LOG_ERROR, "Unable to initialize pixel format. Aborting.\n");
|
|
|
|
|
2020-09-19 02:15:35 +00:00
|
|
|
if (!MDFNI_LoadGame((const uint8_t *)info->data, info->size))
|
2012-09-23 09:52:47 +00:00
|
|
|
return false;
|
|
|
|
|
2020-10-16 07:29:24 +00:00
|
|
|
surf = (MDFN_Surface*)calloc(1, sizeof(*surf));
|
|
|
|
|
|
|
|
if (!surf)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
surf->width = FB_WIDTH;
|
|
|
|
surf->height = FB_HEIGHT;
|
|
|
|
surf->pitch = FB_WIDTH;
|
|
|
|
surf->bpp = system_color_depth;
|
|
|
|
|
|
|
|
if (system_color_depth == 32)
|
|
|
|
{
|
|
|
|
surf->pixels = (uint32_t*)calloc(4, FB_WIDTH * FB_HEIGHT);
|
|
|
|
|
|
|
|
if (!surf->pixels)
|
|
|
|
{
|
|
|
|
free(surf);
|
|
|
|
surf = NULL;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (system_color_depth == 16)
|
|
|
|
{
|
|
|
|
surf->pixels16 = (uint16_t*)calloc(2, FB_WIDTH * FB_HEIGHT);
|
|
|
|
|
|
|
|
if (!surf->pixels16)
|
|
|
|
{
|
|
|
|
free(surf);
|
|
|
|
surf = NULL;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return false;
|
2019-12-25 06:50:46 +00:00
|
|
|
|
2020-10-16 07:29:24 +00:00
|
|
|
lynxie->DisplaySetAttributes(surf->bpp);
|
2012-10-13 13:31:49 +00:00
|
|
|
|
2019-12-24 05:57:24 +00:00
|
|
|
SetInput(0, "gamepad", (uint8_t*)&input_buf);
|
2013-04-09 03:23:42 +00:00
|
|
|
|
2019-12-25 06:50:46 +00:00
|
|
|
auto_rotate = false;
|
2019-02-02 05:58:26 +00:00
|
|
|
rot_screen = 0;
|
|
|
|
select_pressed_last_frame = 0;
|
2019-12-25 06:50:46 +00:00
|
|
|
rot_screen_last_frame = 0;
|
2019-02-02 05:58:26 +00:00
|
|
|
|
2013-09-17 00:03:54 +00:00
|
|
|
check_variables();
|
|
|
|
|
2020-09-28 20:16:05 +00:00
|
|
|
return true;
|
2012-06-03 15:48:14 +00:00
|
|
|
}
|
|
|
|
|
2020-09-19 02:15:35 +00:00
|
|
|
static void MDFNI_CloseGame(void)
|
|
|
|
{
|
|
|
|
if(!MDFNGameInfo)
|
|
|
|
return;
|
|
|
|
|
|
|
|
MDFN_FlushGameCheats(0);
|
|
|
|
|
|
|
|
CloseGame();
|
|
|
|
|
|
|
|
MDFNMP_Kill();
|
|
|
|
|
|
|
|
MDFNGameInfo = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void retro_unload_game(void)
|
2012-06-03 15:48:14 +00:00
|
|
|
{
|
2014-04-20 19:44:56 +00:00
|
|
|
MDFNI_CloseGame();
|
2012-06-03 15:48:14 +00:00
|
|
|
}
|
|
|
|
|
2012-10-20 21:32:28 +00:00
|
|
|
static void update_input(void)
|
2012-06-03 16:58:46 +00:00
|
|
|
{
|
2019-02-02 05:58:26 +00:00
|
|
|
static unsigned map[4][9] = {
|
|
|
|
{
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_A,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_B,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_L,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_R,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_LEFT,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_RIGHT,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_UP,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_DOWN,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_START
|
|
|
|
},
|
|
|
|
{
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_A,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_B,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_L,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_R,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_DOWN,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_UP,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_LEFT,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_RIGHT,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_START
|
|
|
|
},
|
|
|
|
{
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_A,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_B,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_L,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_R,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_RIGHT,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_LEFT,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_DOWN,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_UP,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_START
|
|
|
|
},
|
|
|
|
{
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_A,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_B,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_L,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_R,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_UP,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_DOWN,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_RIGHT,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_LEFT,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_START
|
|
|
|
},
|
2013-12-18 20:42:11 +00:00
|
|
|
};
|
|
|
|
|
2019-12-25 06:50:46 +00:00
|
|
|
unsigned select_button = 0;
|
2019-02-09 01:29:17 +00:00
|
|
|
uint16_t input_state = 0;
|
2019-12-25 08:27:24 +00:00
|
|
|
|
|
|
|
if (libretro_supports_input_bitmasks)
|
|
|
|
{
|
|
|
|
int16_t ret = input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_MASK);
|
|
|
|
for (unsigned i = 0; i < MAX_BUTTONS; i++)
|
|
|
|
input_state |= ret & (1 << map[rot_screen][i]) ? (1 << i) : 0;
|
|
|
|
select_button = ret & (1 << RETRO_DEVICE_ID_JOYPAD_SELECT);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (unsigned i = 0; i < MAX_BUTTONS; i++)
|
|
|
|
input_state |= input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, map[rot_screen][i]) ? (1 << i) : 0;
|
|
|
|
select_button = input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT);
|
|
|
|
}
|
2019-02-09 01:29:17 +00:00
|
|
|
|
|
|
|
// Input data must be little endian.
|
|
|
|
input_buf[0] = (input_state >> 0) & 0xff;
|
|
|
|
input_buf[1] = (input_state >> 8) & 0xff;
|
2019-02-02 05:58:26 +00:00
|
|
|
|
2019-12-25 06:50:46 +00:00
|
|
|
if (auto_rotate)
|
2019-02-02 05:58:26 +00:00
|
|
|
{
|
2019-12-25 06:50:46 +00:00
|
|
|
switch (lynxie->CartGetRotate())
|
|
|
|
{
|
|
|
|
case CART_ROTATE_RIGHT: rot_screen = 3; break;
|
|
|
|
case CART_ROTATE_LEFT: rot_screen = 1; break;
|
|
|
|
default: rot_screen = 0; break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!auto_rotate && (select_button && !select_pressed_last_frame))
|
2019-02-02 05:58:26 +00:00
|
|
|
rot_screen++;
|
2019-12-25 06:50:46 +00:00
|
|
|
|
|
|
|
if (rot_screen != rot_screen_last_frame)
|
|
|
|
{
|
2019-02-02 05:58:26 +00:00
|
|
|
if (rot_screen > 3)
|
|
|
|
rot_screen = 0;
|
2019-12-25 06:50:46 +00:00
|
|
|
rot_screen_last_frame = rot_screen;
|
2019-02-02 05:58:26 +00:00
|
|
|
|
|
|
|
const float aspect[2] = { (80.0 / 51.0), (51.0 / 80.0) };
|
2019-12-25 08:27:24 +00:00
|
|
|
const unsigned rot_angle[4] = { 0, 1, 2, 3 };
|
2019-02-02 05:58:26 +00:00
|
|
|
struct retro_game_geometry new_geom = { FB_WIDTH, FB_HEIGHT, FB_WIDTH, FB_HEIGHT, aspect[rot_screen & 1] };
|
|
|
|
environ_cb(RETRO_ENVIRONMENT_SET_GEOMETRY, (void*)&new_geom);
|
|
|
|
environ_cb(RETRO_ENVIRONMENT_SET_ROTATION, (void*)&rot_angle[rot_screen]);
|
|
|
|
}
|
|
|
|
|
|
|
|
select_pressed_last_frame = select_button;
|
2019-12-25 06:50:46 +00:00
|
|
|
rot_screen_last_frame = rot_screen;
|
2012-06-03 15:48:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void retro_run()
|
|
|
|
{
|
|
|
|
input_poll_cb();
|
|
|
|
|
2012-06-03 16:58:46 +00:00
|
|
|
update_input();
|
|
|
|
|
2012-06-03 15:48:14 +00:00
|
|
|
static int16_t sound_buf[0x10000];
|
2013-10-01 12:28:59 +00:00
|
|
|
static MDFN_Rect rects[FB_MAX_HEIGHT];
|
2012-06-16 13:07:18 +00:00
|
|
|
rects[0].w = ~0;
|
2012-06-03 15:48:14 +00:00
|
|
|
|
2012-07-25 01:17:14 +00:00
|
|
|
EmulateSpecStruct spec = {0};
|
2012-06-03 15:48:14 +00:00
|
|
|
spec.surface = surf;
|
|
|
|
spec.SoundRate = 44100;
|
|
|
|
spec.SoundBuf = sound_buf;
|
|
|
|
spec.LineWidths = rects;
|
|
|
|
spec.SoundBufMaxSize = sizeof(sound_buf) / 2;
|
|
|
|
spec.SoundVolume = 1.0;
|
|
|
|
spec.soundmultiplier = 1.0;
|
2012-11-16 14:12:25 +00:00
|
|
|
spec.SoundBufSize = 0;
|
|
|
|
spec.VideoFormatChanged = false;
|
|
|
|
spec.SoundFormatChanged = false;
|
|
|
|
|
2013-01-19 09:22:57 +00:00
|
|
|
if (spec.SoundRate != last_sound_rate)
|
2012-11-16 14:12:25 +00:00
|
|
|
{
|
|
|
|
spec.SoundFormatChanged = true;
|
|
|
|
last_sound_rate = spec.SoundRate;
|
|
|
|
}
|
|
|
|
|
2016-08-09 06:21:32 +00:00
|
|
|
Emulate(&spec);
|
2012-11-16 14:12:25 +00:00
|
|
|
|
2016-08-09 06:21:32 +00:00
|
|
|
int16 *const SoundBuf = spec.SoundBuf + spec.SoundBufSizeALMS * 2;
|
2012-11-16 14:12:25 +00:00
|
|
|
int32 SoundBufSize = spec.SoundBufSize - spec.SoundBufSizeALMS;
|
|
|
|
const int32 SoundBufMaxSize = spec.SoundBufMaxSize - spec.SoundBufSizeALMS;
|
2012-06-03 15:48:14 +00:00
|
|
|
|
2012-11-16 14:12:25 +00:00
|
|
|
spec.SoundBufSize = spec.SoundBufSizeALMS + SoundBufSize;
|
2012-06-03 15:48:14 +00:00
|
|
|
|
2012-11-21 01:27:23 +00:00
|
|
|
unsigned width = spec.DisplayRect.w;
|
|
|
|
unsigned height = spec.DisplayRect.h;
|
2012-10-20 21:56:43 +00:00
|
|
|
|
2020-10-16 07:29:24 +00:00
|
|
|
if (surf->bpp == 32)
|
|
|
|
{
|
|
|
|
const uint32_t *pix = surf->pixels;
|
|
|
|
video_cb(pix, width, height, FB_WIDTH << 2);
|
|
|
|
}
|
|
|
|
else if (surf->bpp == 16)
|
|
|
|
{
|
|
|
|
const uint16_t *pix = surf->pixels16;
|
|
|
|
video_cb(pix, width, height, FB_WIDTH << 1);
|
|
|
|
}
|
2012-06-03 15:48:14 +00:00
|
|
|
|
|
|
|
audio_batch_cb(spec.SoundBuf, spec.SoundBufSize);
|
2013-04-09 02:05:18 +00:00
|
|
|
|
|
|
|
bool updated = false;
|
|
|
|
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
|
|
|
|
check_variables();
|
2012-06-03 15:48:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void retro_get_system_info(struct retro_system_info *info)
|
|
|
|
{
|
|
|
|
memset(info, 0, sizeof(*info));
|
2012-10-20 21:32:28 +00:00
|
|
|
info->library_name = MEDNAFEN_CORE_NAME;
|
2016-12-09 23:18:22 +00:00
|
|
|
#ifndef GIT_VERSION
|
|
|
|
#define GIT_VERSION ""
|
|
|
|
#endif
|
|
|
|
info->library_version = MEDNAFEN_CORE_VERSION GIT_VERSION;
|
2019-02-02 07:52:04 +00:00
|
|
|
info->need_fullpath = false;
|
2012-10-20 21:56:43 +00:00
|
|
|
info->valid_extensions = MEDNAFEN_CORE_EXTENSIONS;
|
2012-10-20 23:47:02 +00:00
|
|
|
info->block_extract = false;
|
2012-06-03 15:48:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void retro_get_system_av_info(struct retro_system_av_info *info)
|
|
|
|
{
|
|
|
|
memset(info, 0, sizeof(*info));
|
2013-10-01 12:28:59 +00:00
|
|
|
info->timing.fps = MEDNAFEN_CORE_TIMING_FPS;
|
2019-02-02 04:37:11 +00:00
|
|
|
info->timing.sample_rate = 44100.0;
|
2012-10-20 21:56:43 +00:00
|
|
|
info->geometry.base_width = MEDNAFEN_CORE_GEOMETRY_BASE_W;
|
|
|
|
info->geometry.base_height = MEDNAFEN_CORE_GEOMETRY_BASE_H;
|
|
|
|
info->geometry.max_width = MEDNAFEN_CORE_GEOMETRY_MAX_W;
|
|
|
|
info->geometry.max_height = MEDNAFEN_CORE_GEOMETRY_MAX_H;
|
|
|
|
info->geometry.aspect_ratio = MEDNAFEN_CORE_GEOMETRY_ASPECT_RATIO;
|
2012-06-03 15:48:14 +00:00
|
|
|
}
|
|
|
|
|
2012-09-20 19:38:19 +00:00
|
|
|
void retro_deinit()
|
|
|
|
{
|
|
|
|
delete surf;
|
|
|
|
surf = NULL;
|
|
|
|
|
2019-12-25 08:27:24 +00:00
|
|
|
libretro_supports_input_bitmasks = false;
|
2012-09-20 19:38:19 +00:00
|
|
|
}
|
|
|
|
|
2012-06-03 15:48:14 +00:00
|
|
|
unsigned retro_get_region(void)
|
|
|
|
{
|
2013-10-01 12:28:59 +00:00
|
|
|
return RETRO_REGION_NTSC; // FIXME: Regions for other cores.
|
2012-06-03 15:48:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned retro_api_version(void)
|
|
|
|
{
|
|
|
|
return RETRO_API_VERSION;
|
|
|
|
}
|
|
|
|
|
2012-07-25 01:17:14 +00:00
|
|
|
void retro_set_controller_port_device(unsigned in_port, unsigned device)
|
|
|
|
{
|
|
|
|
}
|
2012-06-03 15:48:14 +00:00
|
|
|
|
|
|
|
void retro_set_environment(retro_environment_t cb)
|
|
|
|
{
|
|
|
|
environ_cb = cb;
|
2013-04-09 02:05:18 +00:00
|
|
|
|
2019-02-07 11:25:08 +00:00
|
|
|
struct retro_vfs_interface_info vfs_iface_info = {
|
|
|
|
1,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
if (environ_cb(RETRO_ENVIRONMENT_GET_VFS_INTERFACE, &vfs_iface_info))
|
|
|
|
filestream_vfs_init(&vfs_iface_info);
|
2012-06-03 15:48:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void retro_set_audio_sample(retro_audio_sample_t cb)
|
|
|
|
{
|
|
|
|
audio_cb = cb;
|
|
|
|
}
|
|
|
|
|
|
|
|
void retro_set_audio_sample_batch(retro_audio_sample_batch_t cb)
|
|
|
|
{
|
|
|
|
audio_batch_cb = cb;
|
|
|
|
}
|
|
|
|
|
|
|
|
void retro_set_input_poll(retro_input_poll_t cb)
|
|
|
|
{
|
|
|
|
input_poll_cb = cb;
|
|
|
|
}
|
|
|
|
|
|
|
|
void retro_set_input_state(retro_input_state_t cb)
|
|
|
|
{
|
|
|
|
input_state_cb = cb;
|
|
|
|
}
|
|
|
|
|
|
|
|
void retro_set_video_refresh(retro_video_refresh_t cb)
|
|
|
|
{
|
|
|
|
video_cb = cb;
|
|
|
|
}
|
|
|
|
|
2012-10-20 23:47:02 +00:00
|
|
|
static size_t serialize_size;
|
|
|
|
|
2012-06-03 15:48:14 +00:00
|
|
|
size_t retro_serialize_size(void)
|
|
|
|
{
|
2012-10-21 01:46:12 +00:00
|
|
|
StateMem st;
|
2017-12-17 17:27:04 +00:00
|
|
|
|
|
|
|
st.data = NULL;
|
|
|
|
st.loc = 0;
|
|
|
|
st.len = 0;
|
|
|
|
st.malloced = 0;
|
|
|
|
st.initial_malloc = 0;
|
2012-10-21 01:46:12 +00:00
|
|
|
|
2012-11-14 00:41:02 +00:00
|
|
|
if (!MDFNSS_SaveSM(&st, 0, 0, NULL, NULL, NULL))
|
2012-10-21 01:46:12 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
free(st.data);
|
2017-12-17 17:27:04 +00:00
|
|
|
|
2012-10-21 01:46:12 +00:00
|
|
|
return serialize_size = st.len;
|
2012-06-03 15:48:14 +00:00
|
|
|
}
|
|
|
|
|
2012-10-21 01:46:12 +00:00
|
|
|
bool retro_serialize(void *data, size_t size)
|
2012-06-03 15:48:14 +00:00
|
|
|
{
|
2012-10-21 01:46:12 +00:00
|
|
|
StateMem st;
|
2017-12-17 17:27:04 +00:00
|
|
|
bool ret = false;
|
|
|
|
uint8_t *_dat = (uint8_t*)malloc(size);
|
|
|
|
|
|
|
|
if (!_dat)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
/* Mednafen can realloc the buffer so we need to ensure this is safe. */
|
|
|
|
st.data = _dat;
|
|
|
|
st.loc = 0;
|
|
|
|
st.len = 0;
|
|
|
|
st.malloced = size;
|
|
|
|
st.initial_malloc = 0;
|
|
|
|
|
|
|
|
ret = MDFNSS_SaveSM(&st, 0, 0, NULL, NULL, NULL);
|
|
|
|
|
|
|
|
memcpy(data, st.data, size);
|
|
|
|
free(st.data);
|
2012-10-21 01:46:12 +00:00
|
|
|
|
2017-12-17 17:27:04 +00:00
|
|
|
return ret;
|
2012-06-03 15:48:14 +00:00
|
|
|
}
|
|
|
|
|
2012-10-21 01:46:12 +00:00
|
|
|
bool retro_unserialize(const void *data, size_t size)
|
2012-06-03 15:48:14 +00:00
|
|
|
{
|
2012-10-21 01:46:12 +00:00
|
|
|
StateMem st;
|
|
|
|
memset(&st, 0, sizeof(st));
|
|
|
|
st.data = (uint8_t*)data;
|
|
|
|
st.len = size;
|
|
|
|
|
2012-11-14 00:41:02 +00:00
|
|
|
return MDFNSS_LoadSM(&st, 0, 0);
|
2012-06-03 15:48:14 +00:00
|
|
|
}
|
|
|
|
|
2017-10-21 18:36:20 +00:00
|
|
|
void *retro_get_memory_data(unsigned type)
|
2012-06-03 15:48:14 +00:00
|
|
|
{
|
2017-10-21 18:36:20 +00:00
|
|
|
if (lynxie && type == RETRO_MEMORY_SYSTEM_RAM)
|
|
|
|
return lynxie->GetRamPointer();
|
2012-06-03 15:48:14 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2017-10-21 18:36:20 +00:00
|
|
|
size_t retro_get_memory_size(unsigned type)
|
2012-06-03 15:48:14 +00:00
|
|
|
{
|
2017-10-21 18:36:20 +00:00
|
|
|
if (type == RETRO_MEMORY_SYSTEM_RAM)
|
|
|
|
return 1024 * 64;
|
2012-06-03 15:48:14 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void retro_cheat_reset(void)
|
|
|
|
{}
|
|
|
|
|
|
|
|
void retro_cheat_set(unsigned, bool, const char *)
|
|
|
|
{}
|
2014-06-21 01:36:12 +00:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
static void sanitize_path(std::string &path)
|
|
|
|
{
|
|
|
|
size_t size = path.size();
|
|
|
|
for (size_t i = 0; i < size; i++)
|
|
|
|
if (path[i] == '/')
|
|
|
|
path[i] = '\\';
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Use a simpler approach to make sure that things go right for libretro.
|
|
|
|
std::string MDFN_MakeFName(MakeFName_Type type, int id1, const char *cd1)
|
|
|
|
{
|
|
|
|
char slash;
|
|
|
|
#ifdef _WIN32
|
|
|
|
slash = '\\';
|
|
|
|
#else
|
|
|
|
slash = '/';
|
|
|
|
#endif
|
|
|
|
std::string ret;
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case MDFNMKF_SAV:
|
|
|
|
ret = retro_save_directory +slash + retro_base_name +
|
2015-07-29 15:56:18 +00:00
|
|
|
std::string(".") + std::string(cd1);
|
2014-06-21 01:36:12 +00:00
|
|
|
break;
|
|
|
|
case MDFNMKF_FIRMWARE:
|
|
|
|
ret = retro_base_directory + slash + std::string(cd1);
|
|
|
|
#ifdef _WIN32
|
|
|
|
sanitize_path(ret); // Because Windows path handling is mongoloid.
|
|
|
|
#endif
|
|
|
|
break;
|
2019-12-25 06:50:46 +00:00
|
|
|
default:
|
2014-06-21 01:36:12 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (log_cb)
|
|
|
|
log_cb(RETRO_LOG_INFO, "MDFN_MakeFName: %s\n", ret.c_str());
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MDFND_DispMessage(unsigned char *str)
|
|
|
|
{
|
|
|
|
if (log_cb)
|
2019-02-04 01:08:09 +00:00
|
|
|
log_cb(RETRO_LOG_INFO, "%s", str);
|
2014-06-21 01:36:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MDFND_MidSync(const EmulateSpecStruct *)
|
|
|
|
{}
|
|
|
|
|
|
|
|
void MDFN_MidLineUpdate(EmulateSpecStruct *espec, int y)
|
|
|
|
{
|
|
|
|
//MDFND_MidLineUpdate(espec, y);
|
|
|
|
}
|
|
|
|
|
2016-08-09 06:21:32 +00:00
|
|
|
/* forward declarations */
|
|
|
|
extern void MDFND_DispMessage(unsigned char *str);
|
|
|
|
|
|
|
|
static int curindent = 0;
|
|
|
|
|
|
|
|
void MDFN_indent(int indent)
|
|
|
|
{
|
|
|
|
curindent += indent;
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint8 lastchar = 0;
|
|
|
|
|
|
|
|
void MDFN_printf(const char *format, ...)
|
|
|
|
{
|
|
|
|
char *format_temp;
|
|
|
|
char *temp;
|
|
|
|
unsigned int x, newlen;
|
|
|
|
|
|
|
|
va_list ap;
|
|
|
|
va_start(ap,format);
|
|
|
|
|
|
|
|
|
|
|
|
// First, determine how large our format_temp buffer needs to be.
|
|
|
|
uint8 lastchar_backup = lastchar; // Save lastchar!
|
|
|
|
for(newlen=x=0;x<strlen(format);x++)
|
|
|
|
{
|
|
|
|
if(lastchar == '\n' && format[x] != '\n')
|
|
|
|
{
|
|
|
|
int y;
|
|
|
|
for(y=0;y<curindent;y++)
|
|
|
|
newlen++;
|
|
|
|
}
|
|
|
|
newlen++;
|
|
|
|
lastchar = format[x];
|
|
|
|
}
|
|
|
|
|
|
|
|
format_temp = (char *)malloc(newlen + 1); // Length + NULL character, duh
|
|
|
|
|
|
|
|
// Now, construct our format_temp string
|
|
|
|
lastchar = lastchar_backup; // Restore lastchar
|
|
|
|
for(newlen=x=0;x<strlen(format);x++)
|
|
|
|
{
|
|
|
|
if(lastchar == '\n' && format[x] != '\n')
|
|
|
|
{
|
|
|
|
int y;
|
|
|
|
for(y=0;y<curindent;y++)
|
|
|
|
format_temp[newlen++] = ' ';
|
|
|
|
}
|
|
|
|
format_temp[newlen++] = format[x];
|
|
|
|
lastchar = format[x];
|
|
|
|
}
|
|
|
|
|
|
|
|
format_temp[newlen] = 0;
|
|
|
|
|
|
|
|
temp = new char[4096];
|
|
|
|
vsnprintf(temp, 4096, format_temp, ap);
|
|
|
|
free(format_temp);
|
|
|
|
|
2020-09-19 02:10:54 +00:00
|
|
|
if (log_cb)
|
|
|
|
log_cb(RETRO_LOG_INFO, "%s", temp);
|
2019-02-03 18:25:56 +00:00
|
|
|
delete[] temp;
|
2016-08-09 06:21:32 +00:00
|
|
|
|
|
|
|
va_end(ap);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MDFN_PrintError(const char *format, ...)
|
|
|
|
{
|
|
|
|
char *temp;
|
|
|
|
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
va_start(ap, format);
|
|
|
|
|
|
|
|
temp = new char[4096];
|
|
|
|
vsnprintf(temp, 4096, format, ap);
|
2020-09-19 02:10:54 +00:00
|
|
|
if (log_cb)
|
|
|
|
log_cb(RETRO_LOG_ERROR, "%s\n", temp);
|
2019-02-03 18:25:56 +00:00
|
|
|
delete[] temp;
|
2016-08-09 06:21:32 +00:00
|
|
|
|
|
|
|
va_end(ap);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MDFN_DebugPrintReal(const char *file, const int line, const char *format, ...)
|
|
|
|
{
|
|
|
|
char *temp;
|
|
|
|
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
va_start(ap, format);
|
|
|
|
|
|
|
|
temp = new char[4096];
|
|
|
|
vsnprintf(temp, 4096, format, ap);
|
|
|
|
fprintf(stderr, "%s:%d %s\n", file, line, temp);
|
2019-02-03 18:25:56 +00:00
|
|
|
delete[] temp;
|
2016-08-09 06:21:32 +00:00
|
|
|
|
|
|
|
va_end(ap);
|
|
|
|
}
|