mirror of
https://github.com/libretro/RetroArch
synced 2025-02-16 03:40:12 +00:00
Combine system.c and runloop.c
This commit is contained in:
parent
50af69bec6
commit
fd7e4db9aa
@ -110,7 +110,6 @@ OBJ += frontend/frontend.o \
|
|||||||
libretro_version_1.o \
|
libretro_version_1.o \
|
||||||
retroarch.o \
|
retroarch.o \
|
||||||
input/input_keyboard.o \
|
input/input_keyboard.o \
|
||||||
system.o \
|
|
||||||
command_event.o \
|
command_event.o \
|
||||||
msg_hash.o \
|
msg_hash.o \
|
||||||
intl/msg_hash_de.o \
|
intl/msg_hash_de.o \
|
||||||
|
@ -547,8 +547,7 @@ void uninit_libretro_sym(void)
|
|||||||
core.retro_get_memory_data = NULL;
|
core.retro_get_memory_data = NULL;
|
||||||
core.retro_get_memory_size = NULL;
|
core.retro_get_memory_size = NULL;
|
||||||
|
|
||||||
rarch_system_info_free();
|
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_FREE, NULL);
|
||||||
|
|
||||||
camera_driver_ctl(RARCH_CAMERA_CTL_UNSET_ACTIVE, NULL);
|
camera_driver_ctl(RARCH_CAMERA_CTL_UNSET_ACTIVE, NULL);
|
||||||
location_driver_ctl(RARCH_LOCATION_CTL_UNSET_ACTIVE, NULL);
|
location_driver_ctl(RARCH_LOCATION_CTL_UNSET_ACTIVE, NULL);
|
||||||
|
|
||||||
|
@ -703,7 +703,6 @@ RETROARCH
|
|||||||
#include "../libretro_version_1.c"
|
#include "../libretro_version_1.c"
|
||||||
#include "../retroarch.c"
|
#include "../retroarch.c"
|
||||||
#include "../runloop.c"
|
#include "../runloop.c"
|
||||||
#include "../system.c"
|
|
||||||
#include "../tasks/tasks.c"
|
#include "../tasks/tasks.c"
|
||||||
|
|
||||||
#include "../msg_hash.c"
|
#include "../msg_hash.c"
|
||||||
|
@ -1230,7 +1230,7 @@ int rarch_main_init(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
init_libretro_sym(global->inited.core.type);
|
init_libretro_sym(global->inited.core.type);
|
||||||
rarch_system_info_init();
|
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_INIT, NULL);
|
||||||
|
|
||||||
init_drivers_pre();
|
init_drivers_pre();
|
||||||
|
|
||||||
|
67
runloop.c
67
runloop.c
@ -64,6 +64,18 @@
|
|||||||
|
|
||||||
#include "verbosity.h"
|
#include "verbosity.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_ZLIB
|
||||||
|
#define DEFAULT_EXT "zip"
|
||||||
|
#else
|
||||||
|
#define DEFAULT_EXT ""
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static rarch_system_info_t *g_system;
|
||||||
|
|
||||||
|
#ifdef HAVE_MENU
|
||||||
|
struct retro_system_info g_system_menu;
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct event_cmd_state
|
typedef struct event_cmd_state
|
||||||
{
|
{
|
||||||
retro_input_t state[3];
|
retro_input_t state[3];
|
||||||
@ -81,6 +93,18 @@ global_t *global_get_ptr(void)
|
|||||||
return &g_extern;
|
return &g_extern;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static rarch_system_info_t *rarch_system_info_new(void)
|
||||||
|
{
|
||||||
|
return (rarch_system_info_t*)calloc(1, sizeof(rarch_system_info_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
rarch_system_info_t *rarch_system_info_get_ptr(void)
|
||||||
|
{
|
||||||
|
if (!g_system)
|
||||||
|
g_system = rarch_system_info_new();
|
||||||
|
return g_system;
|
||||||
|
}
|
||||||
|
|
||||||
const char *rarch_main_msg_queue_pull(void)
|
const char *rarch_main_msg_queue_pull(void)
|
||||||
{
|
{
|
||||||
const char *ret = NULL;
|
const char *ret = NULL;
|
||||||
@ -414,9 +438,52 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
|
|||||||
static slock_t *runloop_msg_queue_lock = NULL;
|
static slock_t *runloop_msg_queue_lock = NULL;
|
||||||
#endif
|
#endif
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
|
case RUNLOOP_CTL_SYSTEM_INFO_INIT:
|
||||||
|
core.retro_get_system_info(&system->info);
|
||||||
|
|
||||||
|
if (!system->info.library_name)
|
||||||
|
system->info.library_name = msg_hash_to_str(MSG_UNKNOWN);
|
||||||
|
if (!system->info.library_version)
|
||||||
|
system->info.library_version = "v0";
|
||||||
|
|
||||||
|
#ifndef RARCH_CONSOLE
|
||||||
|
strlcpy(system->title_buf,
|
||||||
|
msg_hash_to_str(MSG_PROGRAM), sizeof(system->title_buf));
|
||||||
|
strlcat(system->title_buf, " : ", sizeof(system->title_buf));
|
||||||
|
#endif
|
||||||
|
strlcat(system->title_buf, system->info.library_name, sizeof(system->title_buf));
|
||||||
|
strlcat(system->title_buf, " ", sizeof(system->title_buf));
|
||||||
|
strlcat(system->title_buf, system->info.library_version, sizeof(system->title_buf));
|
||||||
|
strlcpy(system->valid_extensions, system->info.valid_extensions ?
|
||||||
|
system->info.valid_extensions : DEFAULT_EXT,
|
||||||
|
sizeof(system->valid_extensions));
|
||||||
|
system->block_extract = system->info.block_extract;
|
||||||
|
break;
|
||||||
|
case RUNLOOP_CTL_SYSTEM_INFO_FREE:
|
||||||
|
if (!g_system)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (g_system->core_options)
|
||||||
|
{
|
||||||
|
core_option_flush(g_system->core_options);
|
||||||
|
core_option_free(g_system->core_options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* No longer valid. */
|
||||||
|
if (g_system->special)
|
||||||
|
free(g_system->special);
|
||||||
|
g_system->special = NULL;
|
||||||
|
if (g_system->ports)
|
||||||
|
free(g_system->ports);
|
||||||
|
g_system->ports = NULL;
|
||||||
|
|
||||||
|
free(g_system);
|
||||||
|
g_system = NULL;
|
||||||
|
break;
|
||||||
case RUNLOOP_CTL_IS_FRAME_COUNT_END:
|
case RUNLOOP_CTL_IS_FRAME_COUNT_END:
|
||||||
{
|
{
|
||||||
uint64_t *frame_count = NULL;
|
uint64_t *frame_count = NULL;
|
||||||
|
@ -85,6 +85,8 @@ enum runloop_ctl_state
|
|||||||
RUNLOOP_CTL_MSG_QUEUE_LOCK,
|
RUNLOOP_CTL_MSG_QUEUE_LOCK,
|
||||||
RUNLOOP_CTL_MSG_QUEUE_UNLOCK,
|
RUNLOOP_CTL_MSG_QUEUE_UNLOCK,
|
||||||
RUNLOOP_CTL_MSG_QUEUE_FREE,
|
RUNLOOP_CTL_MSG_QUEUE_FREE,
|
||||||
|
RUNLOOP_CTL_SYSTEM_INFO_INIT,
|
||||||
|
RUNLOOP_CTL_SYSTEM_INFO_FREE,
|
||||||
RUNLOOP_CTL_PREPARE_DUMMY
|
RUNLOOP_CTL_PREPARE_DUMMY
|
||||||
};
|
};
|
||||||
|
|
||||||
|
92
system.c
92
system.c
@ -1,92 +0,0 @@
|
|||||||
/* RetroArch - A frontend for libretro.
|
|
||||||
* Copyright (C) 2011-2015 - Daniel De Matteis
|
|
||||||
*
|
|
||||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
||||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE. See the GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <compat/strl.h>
|
|
||||||
|
|
||||||
#include "system.h"
|
|
||||||
#include "dynamic.h"
|
|
||||||
#include "msg_hash.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_ZLIB
|
|
||||||
#define DEFAULT_EXT "zip"
|
|
||||||
#else
|
|
||||||
#define DEFAULT_EXT ""
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static rarch_system_info_t *g_system;
|
|
||||||
|
|
||||||
#ifdef HAVE_MENU
|
|
||||||
struct retro_system_info g_system_menu;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static rarch_system_info_t *rarch_system_info_new(void)
|
|
||||||
{
|
|
||||||
return (rarch_system_info_t*)calloc(1, sizeof(rarch_system_info_t));
|
|
||||||
}
|
|
||||||
|
|
||||||
rarch_system_info_t *rarch_system_info_get_ptr(void)
|
|
||||||
{
|
|
||||||
if (!g_system)
|
|
||||||
g_system = rarch_system_info_new();
|
|
||||||
return g_system;
|
|
||||||
}
|
|
||||||
|
|
||||||
void rarch_system_info_free(void)
|
|
||||||
{
|
|
||||||
if (!g_system)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (g_system->core_options)
|
|
||||||
{
|
|
||||||
core_option_flush(g_system->core_options);
|
|
||||||
core_option_free(g_system->core_options);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* No longer valid. */
|
|
||||||
if (g_system->special)
|
|
||||||
free(g_system->special);
|
|
||||||
g_system->special = NULL;
|
|
||||||
if (g_system->ports)
|
|
||||||
free(g_system->ports);
|
|
||||||
g_system->ports = NULL;
|
|
||||||
|
|
||||||
free(g_system);
|
|
||||||
g_system = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void rarch_system_info_init(void)
|
|
||||||
{
|
|
||||||
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
|
||||||
|
|
||||||
core.retro_get_system_info(&system->info);
|
|
||||||
|
|
||||||
if (!system->info.library_name)
|
|
||||||
system->info.library_name = msg_hash_to_str(MSG_UNKNOWN);
|
|
||||||
if (!system->info.library_version)
|
|
||||||
system->info.library_version = "v0";
|
|
||||||
|
|
||||||
#ifndef RARCH_CONSOLE
|
|
||||||
strlcpy(system->title_buf,
|
|
||||||
msg_hash_to_str(MSG_PROGRAM), sizeof(system->title_buf));
|
|
||||||
strlcat(system->title_buf, " : ", sizeof(system->title_buf));
|
|
||||||
#endif
|
|
||||||
strlcat(system->title_buf, system->info.library_name, sizeof(system->title_buf));
|
|
||||||
strlcat(system->title_buf, " ", sizeof(system->title_buf));
|
|
||||||
strlcat(system->title_buf, system->info.library_version, sizeof(system->title_buf));
|
|
||||||
strlcpy(system->valid_extensions, system->info.valid_extensions ?
|
|
||||||
system->info.valid_extensions : DEFAULT_EXT,
|
|
||||||
sizeof(system->valid_extensions));
|
|
||||||
system->block_extract = system->info.block_extract;
|
|
||||||
}
|
|
4
system.h
4
system.h
@ -69,10 +69,6 @@ extern struct retro_system_info g_system_menu;
|
|||||||
|
|
||||||
rarch_system_info_t *rarch_system_info_get_ptr(void);
|
rarch_system_info_t *rarch_system_info_get_ptr(void);
|
||||||
|
|
||||||
void rarch_system_info_free(void);
|
|
||||||
|
|
||||||
void rarch_system_info_init(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user