2012-04-21 21:13:50 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2014-01-01 00:50:59 +00:00
|
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
2011-12-24 12:46:12 +00:00
|
|
|
*
|
2012-04-21 21:13:50 +00:00
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
2011-12-24 12:46:12 +00:00
|
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
2012-04-21 21:13:50 +00:00
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
2011-12-24 12:46:12 +00:00
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
2012-04-21 21:31:57 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
2011-12-24 12:46:12 +00:00
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2014-05-04 09:47:55 +00:00
|
|
|
#include "ffemu.h"
|
|
|
|
#include <string.h>
|
2011-12-25 11:47:47 +00:00
|
|
|
|
2014-03-31 22:09:18 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "../config.h"
|
|
|
|
#endif
|
|
|
|
|
2014-05-04 09:47:55 +00:00
|
|
|
static const ffemu_backend_t *ffemu_backends[] = {
|
|
|
|
#ifdef HAVE_FFMPEG
|
|
|
|
&ffemu_ffmpeg,
|
2012-09-02 21:49:30 +00:00
|
|
|
#endif
|
2014-05-04 09:47:55 +00:00
|
|
|
NULL,
|
2011-12-25 15:11:48 +00:00
|
|
|
};
|
2011-01-03 16:51:17 +00:00
|
|
|
|
2014-05-04 09:47:55 +00:00
|
|
|
const ffemu_backend_t *ffemu_find_backend(const char *ident)
|
2012-11-28 14:38:43 +00:00
|
|
|
{
|
2013-10-22 19:26:33 +00:00
|
|
|
unsigned i;
|
2014-05-04 09:47:55 +00:00
|
|
|
for (i = 0; ffemu_backends[i]; i++)
|
2012-11-23 21:46:21 +00:00
|
|
|
{
|
2014-05-04 09:47:55 +00:00
|
|
|
if (!strcmp(ffemu_backends[i]->ident, ident))
|
|
|
|
return ffemu_backends[i];
|
2012-11-26 16:37:31 +00:00
|
|
|
}
|
2012-11-23 21:46:21 +00:00
|
|
|
|
2011-01-03 16:51:17 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-05-04 09:47:55 +00:00
|
|
|
bool ffemu_init_first(const ffemu_backend_t **backend, void **data, const struct ffemu_params *params)
|
2011-01-03 16:51:17 +00:00
|
|
|
{
|
2014-05-04 09:47:55 +00:00
|
|
|
unsigned i;
|
|
|
|
for (i = 0; ffemu_backends[i]; i++)
|
2011-06-14 19:35:31 +00:00
|
|
|
{
|
2014-05-04 09:47:55 +00:00
|
|
|
void *handle = ffemu_backends[i]->init(params);
|
|
|
|
if (handle)
|
2011-06-14 19:35:31 +00:00
|
|
|
{
|
2014-05-04 09:47:55 +00:00
|
|
|
*backend = ffemu_backends[i];
|
|
|
|
*data = handle;
|
|
|
|
return true;
|
2011-06-14 19:35:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-04 09:47:55 +00:00
|
|
|
return false;
|
2011-06-14 19:35:31 +00:00
|
|
|
}
|
2011-10-06 18:31:39 +00:00
|
|
|
|