mirror of
https://github.com/libretro/RetroArch
synced 2024-07-05 09:48:42 +00:00
Combine copy_load_info.c into retroarch.c
This commit is contained in:
parent
cc3b44f7ba
commit
e53d4987b4
|
@ -275,8 +275,7 @@ endif
|
||||||
|
|
||||||
ifeq ($(HAVE_RUNAHEAD), 1)
|
ifeq ($(HAVE_RUNAHEAD), 1)
|
||||||
DEFINES += -DHAVE_RUNAHEAD
|
DEFINES += -DHAVE_RUNAHEAD
|
||||||
OBJ += runahead/copy_load_info.o \
|
OBJ += runahead/mem_util.o \
|
||||||
runahead/mem_util.o \
|
|
||||||
runahead/mylist.o
|
runahead/mylist.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
4
core.h
4
core.h
|
@ -216,10 +216,6 @@ bool core_has_set_input_descriptor(void);
|
||||||
|
|
||||||
void core_uninit_symbols(void);
|
void core_uninit_symbols(void);
|
||||||
|
|
||||||
bool core_is_symbols_inited(void);
|
|
||||||
|
|
||||||
bool core_is_inited(void);
|
|
||||||
|
|
||||||
void core_free_retro_game_info(struct retro_game_info *dest);
|
void core_free_retro_game_info(struct retro_game_info *dest);
|
||||||
|
|
||||||
RETRO_END_DECLS
|
RETRO_END_DECLS
|
||||||
|
|
|
@ -1373,7 +1373,6 @@ MENU
|
||||||
|
|
||||||
#ifdef HAVE_RUNAHEAD
|
#ifdef HAVE_RUNAHEAD
|
||||||
#include "../runahead/mem_util.c"
|
#include "../runahead/mem_util.c"
|
||||||
#include "../runahead/copy_load_info.c"
|
|
||||||
#include "../runahead/mylist.c"
|
#include "../runahead/mylist.c"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
96
retroarch.c
96
retroarch.c
|
@ -186,7 +186,6 @@
|
||||||
#include "retroarch.h"
|
#include "retroarch.h"
|
||||||
|
|
||||||
#ifdef HAVE_RUNAHEAD
|
#ifdef HAVE_RUNAHEAD
|
||||||
#include "runahead/copy_load_info.h"
|
|
||||||
#include "runahead/mylist.h"
|
#include "runahead/mylist.h"
|
||||||
#include "runahead/mem_util.h"
|
#include "runahead/mem_util.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -1613,8 +1612,8 @@ static bool secondary_core_create(void);
|
||||||
static int16_t input_state_get_last(unsigned port,
|
static int16_t input_state_get_last(unsigned port,
|
||||||
unsigned device, unsigned index, unsigned id);
|
unsigned device, unsigned index, unsigned id);
|
||||||
|
|
||||||
extern retro_ctx_load_content_info_t *load_content_info;
|
retro_ctx_load_content_info_t *load_content_info;
|
||||||
extern enum rarch_core_type last_core_type;
|
enum rarch_core_type last_core_type;
|
||||||
|
|
||||||
/* RUNAHEAD - SECONDARY CORE GLOBAL VARIABLES */
|
/* RUNAHEAD - SECONDARY CORE GLOBAL VARIABLES */
|
||||||
static int port_map[16];
|
static int port_map[16];
|
||||||
|
@ -4355,7 +4354,7 @@ static bool init_libretro_symbols(enum rarch_core_type type, struct retro_core_t
|
||||||
#ifdef HAVE_RUNAHEAD
|
#ifdef HAVE_RUNAHEAD
|
||||||
/* remember last core type created, so creating a
|
/* remember last core type created, so creating a
|
||||||
* secondary core will know what core type to use. */
|
* secondary core will know what core type to use. */
|
||||||
set_last_core_type(type);
|
last_core_type = type;
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -4399,6 +4398,85 @@ static void uninit_libretro_symbols(struct retro_core_t *current_core)
|
||||||
#if defined(HAVE_RUNAHEAD)
|
#if defined(HAVE_RUNAHEAD)
|
||||||
/* RUNAHEAD - SECONDARY CORE */
|
/* RUNAHEAD - SECONDARY CORE */
|
||||||
#if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)
|
#if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)
|
||||||
|
static struct retro_game_info* clone_retro_game_info(const
|
||||||
|
struct retro_game_info *src)
|
||||||
|
{
|
||||||
|
void *data = NULL;
|
||||||
|
struct retro_game_info *dest = NULL;
|
||||||
|
|
||||||
|
if (!src)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
dest = (struct retro_game_info*)calloc(1,
|
||||||
|
sizeof(struct retro_game_info));
|
||||||
|
if (!dest)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
dest->data = NULL;
|
||||||
|
dest->path = strcpy_alloc(src->path);
|
||||||
|
|
||||||
|
if (src->size && src->data)
|
||||||
|
{
|
||||||
|
data = malloc(src->size);
|
||||||
|
|
||||||
|
if (data)
|
||||||
|
{
|
||||||
|
memcpy(data, src->data, src->size);
|
||||||
|
dest->data = data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dest->size = src->size;
|
||||||
|
dest->meta = strcpy_alloc(src->meta);
|
||||||
|
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void free_retro_ctx_load_content_info(struct
|
||||||
|
retro_ctx_load_content_info *dest)
|
||||||
|
{
|
||||||
|
if (!dest)
|
||||||
|
return;
|
||||||
|
|
||||||
|
core_free_retro_game_info(dest->info);
|
||||||
|
string_list_free((struct string_list*)dest->content);
|
||||||
|
if (dest->info)
|
||||||
|
free(dest->info);
|
||||||
|
|
||||||
|
dest->info = NULL;
|
||||||
|
dest->content = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct retro_ctx_load_content_info
|
||||||
|
*clone_retro_ctx_load_content_info(
|
||||||
|
const struct retro_ctx_load_content_info *src)
|
||||||
|
{
|
||||||
|
struct retro_ctx_load_content_info *dest = NULL;
|
||||||
|
if (!src || src->special != NULL)
|
||||||
|
return NULL; /* refuse to deal with the Special field */
|
||||||
|
|
||||||
|
dest = (struct retro_ctx_load_content_info*)
|
||||||
|
calloc(1, sizeof(*dest));
|
||||||
|
|
||||||
|
if (!dest)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
dest->info = clone_retro_game_info(src->info);
|
||||||
|
dest->content = NULL;
|
||||||
|
dest->special = NULL;
|
||||||
|
|
||||||
|
if (src->content)
|
||||||
|
dest->content = string_list_clone(src->content);
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void set_load_content_info(const retro_ctx_load_content_info_t *ctx)
|
||||||
|
{
|
||||||
|
free_retro_ctx_load_content_info(load_content_info);
|
||||||
|
free(load_content_info);
|
||||||
|
load_content_info = clone_retro_ctx_load_content_info(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
static void secondary_core_destroy(void)
|
static void secondary_core_destroy(void)
|
||||||
{
|
{
|
||||||
if (!secondary_module)
|
if (!secondary_module)
|
||||||
|
@ -22339,16 +22417,6 @@ bool core_has_set_input_descriptor(void)
|
||||||
return current_core.has_set_input_descriptors;
|
return current_core.has_set_input_descriptors;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool core_is_inited(void)
|
|
||||||
{
|
|
||||||
return current_core.inited;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_is_symbols_inited(void)
|
|
||||||
{
|
|
||||||
return current_core.symbols_inited;
|
|
||||||
}
|
|
||||||
|
|
||||||
void core_free_retro_game_info(struct retro_game_info *dest)
|
void core_free_retro_game_info(struct retro_game_info *dest)
|
||||||
{
|
{
|
||||||
if (!dest)
|
if (!dest)
|
||||||
|
|
|
@ -1,96 +0,0 @@
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <libretro.h>
|
|
||||||
#include <lists/string_list.h>
|
|
||||||
|
|
||||||
#include "../core.h"
|
|
||||||
#include "mem_util.h"
|
|
||||||
#include "copy_load_info.h"
|
|
||||||
|
|
||||||
retro_ctx_load_content_info_t *load_content_info;
|
|
||||||
enum rarch_core_type last_core_type;
|
|
||||||
|
|
||||||
static struct retro_game_info* clone_retro_game_info(const
|
|
||||||
struct retro_game_info *src)
|
|
||||||
{
|
|
||||||
void *data = NULL;
|
|
||||||
struct retro_game_info *dest = NULL;
|
|
||||||
|
|
||||||
if (!src)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
dest = (struct retro_game_info*)calloc(1,
|
|
||||||
sizeof(struct retro_game_info));
|
|
||||||
if (!dest)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
dest->data = NULL;
|
|
||||||
dest->path = strcpy_alloc(src->path);
|
|
||||||
|
|
||||||
if (src->size && src->data)
|
|
||||||
{
|
|
||||||
data = malloc(src->size);
|
|
||||||
|
|
||||||
if (data)
|
|
||||||
{
|
|
||||||
memcpy(data, src->data, src->size);
|
|
||||||
dest->data = data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dest->size = src->size;
|
|
||||||
dest->meta = strcpy_alloc(src->meta);
|
|
||||||
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void free_retro_ctx_load_content_info(struct
|
|
||||||
retro_ctx_load_content_info *dest)
|
|
||||||
{
|
|
||||||
if (!dest)
|
|
||||||
return;
|
|
||||||
|
|
||||||
core_free_retro_game_info(dest->info);
|
|
||||||
string_list_free((struct string_list*)dest->content);
|
|
||||||
if (dest->info)
|
|
||||||
free(dest->info);
|
|
||||||
|
|
||||||
dest->info = NULL;
|
|
||||||
dest->content = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct retro_ctx_load_content_info
|
|
||||||
*clone_retro_ctx_load_content_info(
|
|
||||||
const struct retro_ctx_load_content_info *src)
|
|
||||||
{
|
|
||||||
struct retro_ctx_load_content_info *dest = NULL;
|
|
||||||
if (!src || src->special != NULL)
|
|
||||||
return NULL; /* refuse to deal with the Special field */
|
|
||||||
|
|
||||||
dest = (struct retro_ctx_load_content_info*)
|
|
||||||
calloc(1, sizeof(*dest));
|
|
||||||
|
|
||||||
if (!dest)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
dest->info = clone_retro_game_info(src->info);
|
|
||||||
dest->content = NULL;
|
|
||||||
dest->special = NULL;
|
|
||||||
|
|
||||||
if (src->content)
|
|
||||||
dest->content = string_list_clone(src->content);
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_load_content_info(const retro_ctx_load_content_info_t *ctx)
|
|
||||||
{
|
|
||||||
free_retro_ctx_load_content_info(load_content_info);
|
|
||||||
free(load_content_info);
|
|
||||||
load_content_info = clone_retro_ctx_load_content_info(ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_last_core_type(enum rarch_core_type type)
|
|
||||||
{
|
|
||||||
last_core_type = type;
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
#ifndef __COPY_LOAD_INFO_H__
|
|
||||||
#define __COPY_LOAD_INFO_H__
|
|
||||||
|
|
||||||
#include <boolean.h>
|
|
||||||
#include <libretro.h>
|
|
||||||
|
|
||||||
#include <retro_common_api.h>
|
|
||||||
|
|
||||||
#include "../core.h"
|
|
||||||
|
|
||||||
RETRO_BEGIN_DECLS
|
|
||||||
|
|
||||||
void set_load_content_info(const retro_ctx_load_content_info_t *ctx);
|
|
||||||
|
|
||||||
void set_last_core_type(enum rarch_core_type type);
|
|
||||||
|
|
||||||
RETRO_END_DECLS
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue
Block a user