Turn more functions into static

This commit is contained in:
twinaphex 2014-10-03 01:07:35 +02:00
parent 532938c5fa
commit 75271b7d10
3 changed files with 112 additions and 115 deletions

View File

@ -770,13 +770,9 @@ const char *config_get_default_menu(void);
#endif
#include "conf/config_file.h"
bool config_load_file(const char *path, bool set_defaults);
bool config_save_file(const char *path);
bool config_read_keybinds(const char *path);
void rarch_deinit_recording(void);
bool rarch_audio_flush(const int16_t *data, size_t samples);
void rarch_main_state_new(void);
void rarch_main_state_free(void);
@ -784,7 +780,6 @@ int rarch_main(int argc, char *argv[]);
bool rarch_replace_config(const char *path);
void rarch_main_init_wrap(const struct rarch_main_wrap *args,
int *argc, char **argv);
void rarch_deinit_gpu_recording(void);
int rarch_main_init(int argc, char *argv[]);
void rarch_main_set_state(unsigned action);
void rarch_main_command(unsigned action);
@ -795,8 +790,6 @@ bool rarch_check_fullscreen(bool pressed);
void rarch_disk_control_set_eject(bool state, bool log);
void rarch_disk_control_set_index(unsigned index);
void rarch_disk_control_append_image(const char *path);
bool rarch_set_rumble_state(unsigned port,
enum retro_rumble_effect effect, bool enable);
void rarch_playlist_push(content_playlist_t *playlist,
const char *path);

View File

@ -199,13 +199,30 @@ static void take_screenshot(void)
rarch_render_cached_frame();
}
void rarch_deinit_gpu_recording(void)
static void rarch_deinit_gpu_recording(void)
{
if (g_extern.record_gpu_buffer)
free(g_extern.record_gpu_buffer);
g_extern.record_gpu_buffer = NULL;
}
static void rarch_deinit_recording(void)
{
if (!driver.recording_data || !driver.recording)
return;
if (driver.recording->finalize)
driver.recording->finalize(driver.recording_data);
if (driver.recording->free)
driver.recording->free(driver.recording_data);
driver.recording_data = NULL;
driver.recording = NULL;
rarch_deinit_gpu_recording();
}
void rarch_recording_dump_frame(const void *data, unsigned width,
unsigned height, size_t pitch)
{
@ -392,22 +409,6 @@ static void init_recording(void)
}
}
void rarch_deinit_recording(void)
{
if (!driver.recording_data || !driver.recording)
return;
if (driver.recording->finalize)
driver.recording->finalize(driver.recording_data);
if (driver.recording->free)
driver.recording->free(driver.recording_data);
driver.recording_data = NULL;
driver.recording = NULL;
rarch_deinit_gpu_recording();
}
void rarch_render_cached_frame(void)
{

View File

@ -561,73 +561,6 @@ void config_set_defaults(void)
static void parse_config_file(void);
static void config_load_core_specific(void)
{
*g_extern.core_specific_config_path = '\0';
if (!*g_settings.libretro
#ifdef HAVE_DYNAMIC
|| g_extern.libretro_dummy
#endif
)
return;
#ifdef HAVE_MENU
if (*g_settings.menu_config_directory)
{
path_resolve_realpath(g_settings.menu_config_directory,
sizeof(g_settings.menu_config_directory));
strlcpy(g_extern.core_specific_config_path,
g_settings.menu_config_directory,
sizeof(g_extern.core_specific_config_path));
}
else
#endif
{
/* Use original config file's directory as a fallback. */
fill_pathname_basedir(g_extern.core_specific_config_path,
g_extern.config_path, sizeof(g_extern.core_specific_config_path));
}
fill_pathname_dir(g_extern.core_specific_config_path, g_settings.libretro,
".cfg", sizeof(g_extern.core_specific_config_path));
if (g_settings.core_specific_config)
{
char tmp[PATH_MAX];
strlcpy(tmp, g_settings.libretro, sizeof(tmp));
RARCH_LOG("Loading core-specific config from: %s.\n",
g_extern.core_specific_config_path);
if (!config_load_file(g_extern.core_specific_config_path, true))
RARCH_WARN("Core-specific config not found, reusing last config.\n");
/* Force some parameters which are implied when using core specific configs.
* Don't have the core config file overwrite the libretro path. */
strlcpy(g_settings.libretro, tmp, sizeof(g_settings.libretro));
/* This must be true for core specific configs. */
g_settings.core_specific_config = true;
}
}
void config_load(void)
{
/* Flush out per-core configs before loading a new config. */
if (*g_extern.core_specific_config_path &&
g_settings.config_save_on_exit && g_settings.core_specific_config)
config_save_file(g_extern.core_specific_config_path);
if (!g_extern.block_config_read)
{
config_set_defaults();
parse_config_file();
}
/* Per-core config handling. */
config_load_core_specific();
}
static config_file_t *open_default_config_file(void)
{
config_file_t *conf = NULL;
@ -821,30 +754,7 @@ static config_file_t *open_default_config_file(void)
static void config_read_keybinds_conf(config_file_t *conf);
static void parse_config_file(void)
{
bool ret;
if (*g_extern.config_path)
{
RARCH_LOG("Loading config from: %s.\n", g_extern.config_path);
ret = config_load_file(g_extern.config_path, false);
}
else
{
RARCH_LOG("Loading default config.\n");
ret = config_load_file(NULL, false);
if (*g_extern.config_path)
RARCH_LOG("Found default config: %s.\n", g_extern.config_path);
}
if (!ret)
{
RARCH_ERR("Couldn't find config at path: \"%s\"\n",
g_extern.config_path);
}
}
bool config_load_file(const char *path, bool set_defaults)
static bool config_load_file(const char *path, bool set_defaults)
{
unsigned i;
char *save, tmp_str[PATH_MAX];
@ -1243,6 +1153,99 @@ bool config_load_file(const char *path, bool set_defaults)
return true;
}
static void config_load_core_specific(void)
{
*g_extern.core_specific_config_path = '\0';
if (!*g_settings.libretro
#ifdef HAVE_DYNAMIC
|| g_extern.libretro_dummy
#endif
)
return;
#ifdef HAVE_MENU
if (*g_settings.menu_config_directory)
{
path_resolve_realpath(g_settings.menu_config_directory,
sizeof(g_settings.menu_config_directory));
strlcpy(g_extern.core_specific_config_path,
g_settings.menu_config_directory,
sizeof(g_extern.core_specific_config_path));
}
else
#endif
{
/* Use original config file's directory as a fallback. */
fill_pathname_basedir(g_extern.core_specific_config_path,
g_extern.config_path, sizeof(g_extern.core_specific_config_path));
}
fill_pathname_dir(g_extern.core_specific_config_path, g_settings.libretro,
".cfg", sizeof(g_extern.core_specific_config_path));
if (g_settings.core_specific_config)
{
char tmp[PATH_MAX];
strlcpy(tmp, g_settings.libretro, sizeof(tmp));
RARCH_LOG("Loading core-specific config from: %s.\n",
g_extern.core_specific_config_path);
if (!config_load_file(g_extern.core_specific_config_path, true))
RARCH_WARN("Core-specific config not found, reusing last config.\n");
/* Force some parameters which are implied when using core specific configs.
* Don't have the core config file overwrite the libretro path. */
strlcpy(g_settings.libretro, tmp, sizeof(g_settings.libretro));
/* This must be true for core specific configs. */
g_settings.core_specific_config = true;
}
}
void config_load(void)
{
/* Flush out per-core configs before loading a new config. */
if (*g_extern.core_specific_config_path &&
g_settings.config_save_on_exit && g_settings.core_specific_config)
config_save_file(g_extern.core_specific_config_path);
if (!g_extern.block_config_read)
{
config_set_defaults();
parse_config_file();
}
/* Per-core config handling. */
config_load_core_specific();
}
static void parse_config_file(void)
{
bool ret;
if (*g_extern.config_path)
{
RARCH_LOG("Loading config from: %s.\n", g_extern.config_path);
ret = config_load_file(g_extern.config_path, false);
}
else
{
RARCH_LOG("Loading default config.\n");
ret = config_load_file(NULL, false);
if (*g_extern.config_path)
RARCH_LOG("Found default config: %s.\n", g_extern.config_path);
}
if (!ret)
{
RARCH_ERR("Couldn't find config at path: \"%s\"\n",
g_extern.config_path);
}
}
static void read_keybinds_keyboard(config_file_t *conf, unsigned player,
unsigned index, struct retro_keybind *bind)
{