mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-15 06:50:32 +00:00
(PS3) Split up more code in retroarch_console.c
This commit is contained in:
parent
2ab5f84e5c
commit
bfb933d98d
@ -21,7 +21,13 @@
|
||||
/*============================================================
|
||||
CONSOLE EXTENSIONS
|
||||
============================================================ */
|
||||
#include "../retroarch_rom_ext.c"
|
||||
#include "../retroarch_console.c"
|
||||
|
||||
#ifdef HAVE_CONFIGFILE
|
||||
#include "../retroarch_config.c"
|
||||
#endif
|
||||
|
||||
#include "../retroarch_console_input.c"
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
|
@ -65,7 +65,7 @@ static bool rarch_manage_libretro_install(char *libretro_core_installed, size_t
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool rarch_configure_libretro_core(const char *full_path, const char *tmp_path,
|
||||
static bool rarch_configure_libretro_core(const char *full_path, const char *tmp_path,
|
||||
const char *libretro_path, const char *config_path, const char *extension)
|
||||
{
|
||||
bool libretro_core_was_installed = false;
|
||||
|
@ -29,8 +29,6 @@ enum
|
||||
};
|
||||
|
||||
void rarch_manage_libretro_set_first_file(char *first_file, size_t size_of_first_file, const char *libretro_path, const char * exe_ext);
|
||||
bool rarch_configure_libretro_core(const char *full_path, const char *tmp_path,
|
||||
const char *libretro_path, const char *config_path, const char *extension);
|
||||
void rarch_configure_libretro(const input_driver_t *input, const char *path_prefix, const char * extension);
|
||||
|
||||
#endif
|
||||
|
188
console/retroarch_config.c
Normal file
188
console/retroarch_config.c
Normal file
@ -0,0 +1,188 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2012 - 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 <stdio.h>
|
||||
|
||||
#include "retroarch_config.h"
|
||||
|
||||
#include "../conf/config_file.h"
|
||||
#include "../conf/config_file_macros.h"
|
||||
|
||||
void rarch_config_create_default(const char * conf_name)
|
||||
{
|
||||
FILE * f;
|
||||
RARCH_WARN("Config file \"%s\" doesn't exist. Creating...\n", conf_name);
|
||||
f = fopen(conf_name, "w");
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void rarch_config_load(const char * conf_name, const char * libretro_dir_path, const char * exe_ext, bool find_libretro_path)
|
||||
{
|
||||
if(!path_file_exists(conf_name))
|
||||
rarch_config_create_default(conf_name);
|
||||
else
|
||||
{
|
||||
config_file_t * conf = config_file_new(conf_name);
|
||||
|
||||
// g_settings
|
||||
|
||||
#ifdef HAVE_LIBRETRO_MANAGEMENT
|
||||
if(find_libretro_path)
|
||||
{
|
||||
CONFIG_GET_STRING(libretro, "libretro_path");
|
||||
|
||||
if(strcmp(g_settings.libretro, "") == 0)
|
||||
{
|
||||
char first_file[PATH_MAX];
|
||||
rarch_manage_libretro_set_first_file(first_file, sizeof(first_file), libretro_dir_path, exe_ext);
|
||||
if(first_file != NULL)
|
||||
strlcpy(g_settings.libretro, first_file, sizeof(g_settings.libretro));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
CONFIG_GET_STRING(system_directory, "system_directory");
|
||||
CONFIG_GET_STRING(cheat_database, "cheat_database");
|
||||
CONFIG_GET_BOOL(rewind_enable, "rewind_enable");
|
||||
CONFIG_GET_STRING(video.cg_shader_path, "video_cg_shader");
|
||||
#ifdef HAVE_FBO
|
||||
CONFIG_GET_STRING(video.second_pass_shader, "video_second_pass_shader");
|
||||
CONFIG_GET_FLOAT(video.fbo_scale_x, "video_fbo_scale_x");
|
||||
CONFIG_GET_FLOAT(video.fbo_scale_y, "video_fbo_scale_y");
|
||||
CONFIG_GET_BOOL(video.render_to_texture, "video_render_to_texture");
|
||||
CONFIG_GET_BOOL(video.second_pass_smooth, "video_second_pass_smooth");
|
||||
#endif
|
||||
#ifdef _XBOX360
|
||||
CONFIG_GET_BOOL_CONSOLE(gamma_correction_enable, "gamma_correction_enable");
|
||||
CONFIG_GET_INT_CONSOLE(color_format, "color_format");
|
||||
#endif
|
||||
CONFIG_GET_BOOL(video.smooth, "video_smooth");
|
||||
CONFIG_GET_BOOL(video.vsync, "video_vsync");
|
||||
CONFIG_GET_FLOAT(video.aspect_ratio, "video_aspect_ratio");
|
||||
CONFIG_GET_STRING(audio.device, "audio_device");
|
||||
|
||||
for (unsigned i = 0; i < 7; i++)
|
||||
{
|
||||
char cfg[64];
|
||||
snprintf(cfg, sizeof(cfg), "input_dpad_emulation_p%u", i + 1);
|
||||
CONFIG_GET_INT(input.dpad_emulation[i], cfg);
|
||||
}
|
||||
|
||||
// g_console
|
||||
|
||||
#ifdef HAVE_FBO
|
||||
CONFIG_GET_BOOL_CONSOLE(fbo_enabled, "fbo_enabled");
|
||||
#endif
|
||||
#ifdef __CELLOS_LV2__
|
||||
CONFIG_GET_BOOL_CONSOLE(custom_bgm_enable, "custom_bgm_enable");
|
||||
#endif
|
||||
CONFIG_GET_BOOL_CONSOLE(overscan_enable, "overscan_enable");
|
||||
CONFIG_GET_BOOL_CONSOLE(screenshots_enable, "screenshots_enable");
|
||||
CONFIG_GET_BOOL_CONSOLE(throttle_enable, "throttle_enable");
|
||||
CONFIG_GET_BOOL_CONSOLE(triple_buffering_enable, "triple_buffering_enable");
|
||||
CONFIG_GET_BOOL_CONSOLE(info_msg_enable, "info_msg_enable");
|
||||
CONFIG_GET_INT_CONSOLE(aspect_ratio_index, "aspect_ratio_index");
|
||||
CONFIG_GET_INT_CONSOLE(current_resolution_id, "current_resolution_id");
|
||||
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.x, "custom_viewport_x");
|
||||
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.y, "custom_viewport_y");
|
||||
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.width, "custom_viewport_width");
|
||||
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.height, "custom_viewport_height");
|
||||
CONFIG_GET_INT_CONSOLE(screen_orientation, "screen_orientation");
|
||||
CONFIG_GET_INT_CONSOLE(sound_mode, "sound_mode");
|
||||
CONFIG_GET_STRING_CONSOLE(default_rom_startup_dir, "default_rom_startup_dir");
|
||||
CONFIG_GET_FLOAT_CONSOLE(menu_font_size, "menu_font_size");
|
||||
CONFIG_GET_FLOAT_CONSOLE(overscan_amount, "overscan_amount");
|
||||
|
||||
// g_extern
|
||||
CONFIG_GET_INT_EXTERN(state_slot, "state_slot");
|
||||
CONFIG_GET_INT_EXTERN(audio_data.mute, "audio_mute");
|
||||
}
|
||||
}
|
||||
|
||||
void rarch_config_save(const char * conf_name)
|
||||
{
|
||||
if(!path_file_exists(conf_name))
|
||||
rarch_config_create_default(conf_name);
|
||||
else
|
||||
{
|
||||
config_file_t * conf = config_file_new(conf_name);
|
||||
|
||||
if(conf == NULL)
|
||||
conf = config_file_new(NULL);
|
||||
|
||||
// g_settings
|
||||
config_set_string(conf, "libretro_path", g_settings.libretro);
|
||||
#ifdef HAVE_XML
|
||||
config_set_string(conf, "cheat_database_path", g_settings.cheat_database);
|
||||
#endif
|
||||
config_set_bool(conf, "rewind_enable", g_settings.rewind_enable);
|
||||
config_set_string(conf, "video_cg_shader", g_settings.video.cg_shader_path);
|
||||
config_set_float(conf, "video_aspect_ratio", g_settings.video.aspect_ratio);
|
||||
#ifdef HAVE_FBO
|
||||
config_set_float(conf, "video_fbo_scale_x", g_settings.video.fbo_scale_x);
|
||||
config_set_float(conf, "video_fbo_scale_y", g_settings.video.fbo_scale_y);
|
||||
config_set_string(conf, "video_second_pass_shader", g_settings.video.second_pass_shader);
|
||||
config_set_bool(conf, "video_render_to_texture", g_settings.video.render_to_texture);
|
||||
config_set_bool(conf, "video_second_pass_smooth", g_settings.video.second_pass_smooth);
|
||||
#endif
|
||||
config_set_bool(conf, "video_smooth", g_settings.video.smooth);
|
||||
config_set_bool(conf, "video_vsync", g_settings.video.vsync);
|
||||
config_set_string(conf, "audio_device", g_settings.audio.device);
|
||||
|
||||
for (unsigned i = 0; i < 7; i++)
|
||||
{
|
||||
char cfg[64];
|
||||
snprintf(cfg, sizeof(cfg), "input_dpad_emulation_p%u", i + 1);
|
||||
config_set_int(conf, cfg, g_settings.input.dpad_emulation[i]);
|
||||
}
|
||||
|
||||
#ifdef RARCH_CONSOLE
|
||||
config_set_bool(conf, "fbo_enabled", g_console.fbo_enabled);
|
||||
#ifdef __CELLOS_LV2__
|
||||
config_set_bool(conf, "custom_bgm_enable", g_console.custom_bgm_enable);
|
||||
#endif
|
||||
config_set_bool(conf, "overscan_enable", g_console.overscan_enable);
|
||||
config_set_bool(conf, "screenshots_enable", g_console.screenshots_enable);
|
||||
#ifdef _XBOX
|
||||
config_set_bool(conf, "gamma_correction_enable", g_console.gamma_correction_enable);
|
||||
config_set_int(conf, "color_format", g_console.color_format);
|
||||
#endif
|
||||
config_set_bool(conf, "throttle_enable", g_console.throttle_enable);
|
||||
config_set_bool(conf, "triple_buffering_enable", g_console.triple_buffering_enable);
|
||||
config_set_bool(conf, "info_msg_enable", g_console.info_msg_enable);
|
||||
config_set_int(conf, "sound_mode", g_console.sound_mode);
|
||||
config_set_int(conf, "aspect_ratio_index", g_console.aspect_ratio_index);
|
||||
config_set_int(conf, "current_resolution_id", g_console.current_resolution_id);
|
||||
config_set_int(conf, "custom_viewport_width", g_console.viewports.custom_vp.width);
|
||||
config_set_int(conf, "custom_viewport_height", g_console.viewports.custom_vp.height);
|
||||
config_set_int(conf, "custom_viewport_x", g_console.viewports.custom_vp.x);
|
||||
config_set_int(conf, "custom_viewport_y", g_console.viewports.custom_vp.y);
|
||||
config_set_int(conf, "screen_orientation", g_console.screen_orientation);
|
||||
config_set_string(conf, "default_rom_startup_dir", g_console.default_rom_startup_dir);
|
||||
config_set_float(conf, "menu_font_size", g_console.menu_font_size);
|
||||
config_set_float(conf, "overscan_amount", g_console.overscan_amount);
|
||||
#endif
|
||||
|
||||
// g_extern
|
||||
config_set_int(conf, "state_slot", g_extern.state_slot);
|
||||
config_set_int(conf, "audio_mute", g_extern.audio_data.mute);
|
||||
|
||||
if (!config_file_write(conf, conf_name))
|
||||
RARCH_ERR("Failed to write config file to \"%s\". Check permissions.\n", conf_name);
|
||||
|
||||
free(conf);
|
||||
}
|
||||
}
|
31
console/retroarch_config.h
Normal file
31
console/retroarch_config.h
Normal file
@ -0,0 +1,31 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2012 - 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/>.
|
||||
*/
|
||||
|
||||
#ifndef _RARCH_CONSOLE_CONFIG_H
|
||||
#define _RARCH_CONSOLE_CONFIG_H
|
||||
|
||||
enum
|
||||
{
|
||||
CONFIG_FILE,
|
||||
SHADER_PRESET_FILE,
|
||||
INPUT_PRESET_FILE
|
||||
};
|
||||
|
||||
void rarch_config_create_default(const char * conf_name);
|
||||
void rarch_config_load(const char * conf_name, const char * libretro_dir_path, const char * exe_ext, bool find_libretro_path);
|
||||
void rarch_config_save(const char * conf_name);
|
||||
|
||||
#endif
|
@ -18,7 +18,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "../boolean.h"
|
||||
#include "../compat/strl.h"
|
||||
#include "../libretro.h"
|
||||
@ -27,79 +26,14 @@
|
||||
#include "retroarch_console.h"
|
||||
#include "../file.h"
|
||||
|
||||
#ifdef HAVE_CONFIGFILE
|
||||
#include "../conf/config_file.h"
|
||||
#include "../conf/config_file_macros.h"
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "../compat/posix_string.h"
|
||||
#endif
|
||||
|
||||
#define MAX_ARGS 32
|
||||
|
||||
/*============================================================
|
||||
ROM EXTENSIONS
|
||||
============================================================ */
|
||||
|
||||
default_paths_t default_paths;
|
||||
|
||||
void rarch_console_load_game(const char *path)
|
||||
{
|
||||
snprintf(g_console.rom_path, sizeof(g_console.rom_path), path);
|
||||
rarch_settings_change(S_START_RARCH);
|
||||
}
|
||||
|
||||
const char *rarch_console_get_rom_ext(void)
|
||||
{
|
||||
const char *retval = NULL;
|
||||
|
||||
struct retro_system_info info;
|
||||
#ifdef ANDROID
|
||||
pretro_get_system_info(&info);
|
||||
#else
|
||||
retro_get_system_info(&info);
|
||||
#endif
|
||||
|
||||
if (info.valid_extensions)
|
||||
retval = info.valid_extensions;
|
||||
else
|
||||
retval = "ZIP|zip";
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void rarch_console_name_from_id(char *name, size_t size)
|
||||
{
|
||||
if (size == 0)
|
||||
return;
|
||||
|
||||
struct retro_system_info info;
|
||||
#ifdef ANDROID
|
||||
pretro_get_system_info(&info);
|
||||
#else
|
||||
retro_get_system_info(&info);
|
||||
#endif
|
||||
const char *id = info.library_name ? info.library_name : "Unknown";
|
||||
|
||||
if (!id || strlen(id) >= size)
|
||||
{
|
||||
name[0] = '\0';
|
||||
return;
|
||||
}
|
||||
|
||||
name[strlen(id)] = '\0';
|
||||
|
||||
for (size_t i = 0; id[i] != '\0'; i++)
|
||||
{
|
||||
char c = id[i];
|
||||
if (isspace(c) || isblank(c))
|
||||
name[i] = '_';
|
||||
else
|
||||
name[i] = tolower(c);
|
||||
}
|
||||
}
|
||||
|
||||
/*============================================================
|
||||
VIDEO EXTENSIONS
|
||||
============================================================ */
|
||||
@ -374,175 +308,3 @@ const char * rarch_convert_wchar_to_const_char(const wchar_t * wstr)
|
||||
wcstombs(str, wstr, sizeof(str));
|
||||
return str;
|
||||
}
|
||||
|
||||
/*============================================================
|
||||
CONFIG
|
||||
============================================================ */
|
||||
|
||||
#ifdef HAVE_CONFIGFILE
|
||||
void rarch_config_create_default(const char * conf_name)
|
||||
{
|
||||
FILE * f;
|
||||
RARCH_WARN("Config file \"%s\" doesn't exist. Creating...\n", conf_name);
|
||||
f = fopen(conf_name, "w");
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void rarch_config_load(const char * conf_name, const char * libretro_dir_path, const char * exe_ext, bool find_libretro_path)
|
||||
{
|
||||
if(!path_file_exists(conf_name))
|
||||
rarch_config_create_default(conf_name);
|
||||
else
|
||||
{
|
||||
config_file_t * conf = config_file_new(conf_name);
|
||||
|
||||
// g_settings
|
||||
|
||||
#ifdef HAVE_LIBRETRO_MANAGEMENT
|
||||
if(find_libretro_path)
|
||||
{
|
||||
CONFIG_GET_STRING(libretro, "libretro_path");
|
||||
|
||||
if(strcmp(g_settings.libretro, "") == 0)
|
||||
{
|
||||
char first_file[PATH_MAX];
|
||||
rarch_manage_libretro_set_first_file(first_file, sizeof(first_file), libretro_dir_path, exe_ext);
|
||||
if(first_file != NULL)
|
||||
strlcpy(g_settings.libretro, first_file, sizeof(g_settings.libretro));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
CONFIG_GET_STRING(system_directory, "system_directory");
|
||||
CONFIG_GET_STRING(cheat_database, "cheat_database");
|
||||
CONFIG_GET_BOOL(rewind_enable, "rewind_enable");
|
||||
CONFIG_GET_STRING(video.cg_shader_path, "video_cg_shader");
|
||||
#ifdef HAVE_FBO
|
||||
CONFIG_GET_STRING(video.second_pass_shader, "video_second_pass_shader");
|
||||
CONFIG_GET_FLOAT(video.fbo_scale_x, "video_fbo_scale_x");
|
||||
CONFIG_GET_FLOAT(video.fbo_scale_y, "video_fbo_scale_y");
|
||||
CONFIG_GET_BOOL(video.render_to_texture, "video_render_to_texture");
|
||||
CONFIG_GET_BOOL(video.second_pass_smooth, "video_second_pass_smooth");
|
||||
#endif
|
||||
#ifdef _XBOX360
|
||||
CONFIG_GET_BOOL_CONSOLE(gamma_correction_enable, "gamma_correction_enable");
|
||||
CONFIG_GET_INT_CONSOLE(color_format, "color_format");
|
||||
#endif
|
||||
CONFIG_GET_BOOL(video.smooth, "video_smooth");
|
||||
CONFIG_GET_BOOL(video.vsync, "video_vsync");
|
||||
CONFIG_GET_FLOAT(video.aspect_ratio, "video_aspect_ratio");
|
||||
CONFIG_GET_STRING(audio.device, "audio_device");
|
||||
|
||||
for (unsigned i = 0; i < 7; i++)
|
||||
{
|
||||
char cfg[64];
|
||||
snprintf(cfg, sizeof(cfg), "input_dpad_emulation_p%u", i + 1);
|
||||
CONFIG_GET_INT(input.dpad_emulation[i], cfg);
|
||||
}
|
||||
|
||||
// g_console
|
||||
|
||||
#ifdef HAVE_FBO
|
||||
CONFIG_GET_BOOL_CONSOLE(fbo_enabled, "fbo_enabled");
|
||||
#endif
|
||||
#ifdef __CELLOS_LV2__
|
||||
CONFIG_GET_BOOL_CONSOLE(custom_bgm_enable, "custom_bgm_enable");
|
||||
#endif
|
||||
CONFIG_GET_BOOL_CONSOLE(overscan_enable, "overscan_enable");
|
||||
CONFIG_GET_BOOL_CONSOLE(screenshots_enable, "screenshots_enable");
|
||||
CONFIG_GET_BOOL_CONSOLE(throttle_enable, "throttle_enable");
|
||||
CONFIG_GET_BOOL_CONSOLE(triple_buffering_enable, "triple_buffering_enable");
|
||||
CONFIG_GET_BOOL_CONSOLE(info_msg_enable, "info_msg_enable");
|
||||
CONFIG_GET_INT_CONSOLE(aspect_ratio_index, "aspect_ratio_index");
|
||||
CONFIG_GET_INT_CONSOLE(current_resolution_id, "current_resolution_id");
|
||||
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.x, "custom_viewport_x");
|
||||
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.y, "custom_viewport_y");
|
||||
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.width, "custom_viewport_width");
|
||||
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.height, "custom_viewport_height");
|
||||
CONFIG_GET_INT_CONSOLE(screen_orientation, "screen_orientation");
|
||||
CONFIG_GET_INT_CONSOLE(sound_mode, "sound_mode");
|
||||
CONFIG_GET_STRING_CONSOLE(default_rom_startup_dir, "default_rom_startup_dir");
|
||||
CONFIG_GET_FLOAT_CONSOLE(menu_font_size, "menu_font_size");
|
||||
CONFIG_GET_FLOAT_CONSOLE(overscan_amount, "overscan_amount");
|
||||
|
||||
// g_extern
|
||||
CONFIG_GET_INT_EXTERN(state_slot, "state_slot");
|
||||
CONFIG_GET_INT_EXTERN(audio_data.mute, "audio_mute");
|
||||
}
|
||||
}
|
||||
|
||||
void rarch_config_save(const char * conf_name)
|
||||
{
|
||||
if(!path_file_exists(conf_name))
|
||||
rarch_config_create_default(conf_name);
|
||||
else
|
||||
{
|
||||
config_file_t * conf = config_file_new(conf_name);
|
||||
|
||||
if(conf == NULL)
|
||||
conf = config_file_new(NULL);
|
||||
|
||||
// g_settings
|
||||
config_set_string(conf, "libretro_path", g_settings.libretro);
|
||||
#ifdef HAVE_XML
|
||||
config_set_string(conf, "cheat_database_path", g_settings.cheat_database);
|
||||
#endif
|
||||
config_set_bool(conf, "rewind_enable", g_settings.rewind_enable);
|
||||
config_set_string(conf, "video_cg_shader", g_settings.video.cg_shader_path);
|
||||
config_set_float(conf, "video_aspect_ratio", g_settings.video.aspect_ratio);
|
||||
#ifdef HAVE_FBO
|
||||
config_set_float(conf, "video_fbo_scale_x", g_settings.video.fbo_scale_x);
|
||||
config_set_float(conf, "video_fbo_scale_y", g_settings.video.fbo_scale_y);
|
||||
config_set_string(conf, "video_second_pass_shader", g_settings.video.second_pass_shader);
|
||||
config_set_bool(conf, "video_render_to_texture", g_settings.video.render_to_texture);
|
||||
config_set_bool(conf, "video_second_pass_smooth", g_settings.video.second_pass_smooth);
|
||||
#endif
|
||||
config_set_bool(conf, "video_smooth", g_settings.video.smooth);
|
||||
config_set_bool(conf, "video_vsync", g_settings.video.vsync);
|
||||
config_set_string(conf, "audio_device", g_settings.audio.device);
|
||||
|
||||
for (unsigned i = 0; i < 7; i++)
|
||||
{
|
||||
char cfg[64];
|
||||
snprintf(cfg, sizeof(cfg), "input_dpad_emulation_p%u", i + 1);
|
||||
config_set_int(conf, cfg, g_settings.input.dpad_emulation[i]);
|
||||
}
|
||||
|
||||
#ifdef RARCH_CONSOLE
|
||||
config_set_bool(conf, "fbo_enabled", g_console.fbo_enabled);
|
||||
#ifdef __CELLOS_LV2__
|
||||
config_set_bool(conf, "custom_bgm_enable", g_console.custom_bgm_enable);
|
||||
#endif
|
||||
config_set_bool(conf, "overscan_enable", g_console.overscan_enable);
|
||||
config_set_bool(conf, "screenshots_enable", g_console.screenshots_enable);
|
||||
#ifdef _XBOX
|
||||
config_set_bool(conf, "gamma_correction_enable", g_console.gamma_correction_enable);
|
||||
config_set_int(conf, "color_format", g_console.color_format);
|
||||
#endif
|
||||
config_set_bool(conf, "throttle_enable", g_console.throttle_enable);
|
||||
config_set_bool(conf, "triple_buffering_enable", g_console.triple_buffering_enable);
|
||||
config_set_bool(conf, "info_msg_enable", g_console.info_msg_enable);
|
||||
config_set_int(conf, "sound_mode", g_console.sound_mode);
|
||||
config_set_int(conf, "aspect_ratio_index", g_console.aspect_ratio_index);
|
||||
config_set_int(conf, "current_resolution_id", g_console.current_resolution_id);
|
||||
config_set_int(conf, "custom_viewport_width", g_console.viewports.custom_vp.width);
|
||||
config_set_int(conf, "custom_viewport_height", g_console.viewports.custom_vp.height);
|
||||
config_set_int(conf, "custom_viewport_x", g_console.viewports.custom_vp.x);
|
||||
config_set_int(conf, "custom_viewport_y", g_console.viewports.custom_vp.y);
|
||||
config_set_int(conf, "screen_orientation", g_console.screen_orientation);
|
||||
config_set_string(conf, "default_rom_startup_dir", g_console.default_rom_startup_dir);
|
||||
config_set_float(conf, "menu_font_size", g_console.menu_font_size);
|
||||
config_set_float(conf, "overscan_amount", g_console.overscan_amount);
|
||||
#endif
|
||||
|
||||
// g_extern
|
||||
config_set_int(conf, "state_slot", g_extern.state_slot);
|
||||
config_set_int(conf, "audio_mute", g_extern.audio_data.mute);
|
||||
|
||||
if (!config_file_write(conf, conf_name))
|
||||
RARCH_ERR("Failed to write config file to \"%s\". Check permissions.\n", conf_name);
|
||||
|
||||
free(conf);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -114,12 +114,6 @@ extern struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END];
|
||||
extern void rarch_set_auto_viewport(unsigned width, unsigned height);
|
||||
extern void rarch_load_shader(unsigned slot, const char *path);
|
||||
|
||||
#include "retroarch_console_input.h"
|
||||
|
||||
/*============================================================
|
||||
SOUND
|
||||
============================================================ */
|
||||
|
||||
enum
|
||||
{
|
||||
SOUND_MODE_NORMAL,
|
||||
@ -131,9 +125,6 @@ enum
|
||||
#endif
|
||||
};
|
||||
|
||||
/*============================================================
|
||||
ROM EXTENSIONS
|
||||
============================================================ */
|
||||
typedef struct
|
||||
{
|
||||
char menu_border_file[PATH_MAX];
|
||||
@ -164,15 +155,6 @@ typedef struct
|
||||
|
||||
extern default_paths_t default_paths;
|
||||
|
||||
void rarch_console_load_game(const char *path);
|
||||
|
||||
// Get rom extensions for current library.
|
||||
// Returns NULL if library doesn't have any preferences in particular.
|
||||
const char *rarch_console_get_rom_ext(void);
|
||||
|
||||
// Transforms a library id to a name suitable as a pathname.
|
||||
void rarch_console_name_from_id(char *name, size_t size);
|
||||
|
||||
/*============================================================
|
||||
RetroArch
|
||||
============================================================ */
|
||||
@ -230,13 +212,9 @@ const char * rarch_convert_wchar_to_const_char(const wchar_t * wstr);
|
||||
|
||||
enum
|
||||
{
|
||||
CONFIG_FILE,
|
||||
SHADER_PRESET_FILE,
|
||||
INPUT_PRESET_FILE
|
||||
MODE_EMULATION = 0,
|
||||
MODE_MENU,
|
||||
MODE_EXIT
|
||||
};
|
||||
|
||||
void rarch_config_create_default(const char * conf_name);
|
||||
void rarch_config_load(const char * conf_name, const char * libretro_dir_path, const char * exe_ext, bool find_libretro_path);
|
||||
void rarch_config_save(const char * conf_name);
|
||||
|
||||
#endif
|
||||
|
@ -27,13 +27,6 @@ enum keybind_set_id
|
||||
KEYBIND_DEFAULT
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
MODE_EMULATION = 0,
|
||||
MODE_MENU,
|
||||
MODE_EXIT
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
DPAD_EMULATION_NONE = 0,
|
||||
|
80
console/retroarch_rom_ext.c
Normal file
80
console/retroarch_rom_ext.c
Normal file
@ -0,0 +1,80 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2012 - 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 <stdint.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "../general.h"
|
||||
|
||||
#include "console_settings.h"
|
||||
|
||||
#include "retroarch_rom_ext.h"
|
||||
|
||||
void rarch_console_load_game(const char *path)
|
||||
{
|
||||
snprintf(g_console.rom_path, sizeof(g_console.rom_path), path);
|
||||
rarch_settings_change(S_START_RARCH);
|
||||
}
|
||||
|
||||
const char *rarch_console_get_rom_ext(void)
|
||||
{
|
||||
const char *retval = NULL;
|
||||
|
||||
struct retro_system_info info;
|
||||
#ifdef ANDROID
|
||||
pretro_get_system_info(&info);
|
||||
#else
|
||||
retro_get_system_info(&info);
|
||||
#endif
|
||||
|
||||
if (info.valid_extensions)
|
||||
retval = info.valid_extensions;
|
||||
else
|
||||
retval = "ZIP|zip";
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void rarch_console_name_from_id(char *name, size_t size)
|
||||
{
|
||||
if (size == 0)
|
||||
return;
|
||||
|
||||
struct retro_system_info info;
|
||||
#ifdef ANDROID
|
||||
pretro_get_system_info(&info);
|
||||
#else
|
||||
retro_get_system_info(&info);
|
||||
#endif
|
||||
const char *id = info.library_name ? info.library_name : "Unknown";
|
||||
|
||||
if (!id || strlen(id) >= size)
|
||||
{
|
||||
name[0] = '\0';
|
||||
return;
|
||||
}
|
||||
|
||||
name[strlen(id)] = '\0';
|
||||
|
||||
for (size_t i = 0; id[i] != '\0'; i++)
|
||||
{
|
||||
char c = id[i];
|
||||
if (isspace(c) || isblank(c))
|
||||
name[i] = '_';
|
||||
else
|
||||
name[i] = tolower(c);
|
||||
}
|
||||
}
|
29
console/retroarch_rom_ext.h
Normal file
29
console/retroarch_rom_ext.h
Normal file
@ -0,0 +1,29 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2012 - 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/>.
|
||||
*/
|
||||
|
||||
#ifndef RARCH_ROM_EXT_H__
|
||||
#define RARCH_ROM_EXT_H__
|
||||
|
||||
void rarch_console_load_game(const char *path);
|
||||
|
||||
// Get rom extensions for current library.
|
||||
// Returns NULL if library doesn't have any preferences in particular.
|
||||
const char *rarch_console_get_rom_ext(void);
|
||||
|
||||
// Transforms a library id to a name suitable as a pathname.
|
||||
void rarch_console_name_from_id(char *name, size_t size);
|
||||
|
||||
#endif
|
@ -46,6 +46,8 @@
|
||||
#include "../../gfx/gl_common.h"
|
||||
|
||||
#include "../../console/retroarch_console.h"
|
||||
#include "../../console/retroarch_console_input.h"
|
||||
#include "../../console/retroarch_config.h"
|
||||
#include "../../conf/config_file.h"
|
||||
#include "../../conf/config_file_macros.h"
|
||||
#include "../../general.h"
|
||||
|
@ -27,6 +27,9 @@
|
||||
#include "../../console/fileio/file_browser.h"
|
||||
|
||||
#include "../../console/retroarch_console.h"
|
||||
#include "../../console/retroarch_rom_ext.h"
|
||||
#include "../../console/retroarch_console_input.h"
|
||||
#include "../../console/retroarch_config.h"
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#include "../../console/retroarch_rzlib.h"
|
||||
|
@ -38,6 +38,7 @@
|
||||
#endif
|
||||
|
||||
#include "../../console/retroarch_console.h"
|
||||
#include "../../console/retroarch_config.h"
|
||||
#include "../../conf/config_file.h"
|
||||
#include "../../conf/config_file_macros.h"
|
||||
#include "../../file.h"
|
||||
|
Loading…
Reference in New Issue
Block a user