mirror of
https://github.com/libretro/RetroArch
synced 2025-03-23 19:21:03 +00:00
(RARCH_CONSOLE) Create more helper functions for RARCH_CONSOLE
This commit is contained in:
parent
463b43724c
commit
83ae89dc4c
@ -295,3 +295,76 @@ void rarch_settings_create_menu_item_label(char * str, unsigned setting, size_t
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void rarch_settings_set_default (void)
|
||||
{
|
||||
// g_settings
|
||||
g_settings.rewind_enable = false;
|
||||
strlcpy(g_settings.cheat_database, default_paths.port_dir, sizeof(g_settings.cheat_database));
|
||||
|
||||
#if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL)
|
||||
strlcpy(g_settings.video.cg_shader_path, default_paths.shader_file, sizeof(g_settings.video.cg_shader_path));
|
||||
strlcpy(g_settings.video.second_pass_shader, default_paths.shader_file, sizeof(g_settings.video.second_pass_shader));
|
||||
g_settings.video.second_pass_smooth = true;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FBO
|
||||
g_settings.video.fbo_scale_x = 2.0f;
|
||||
g_settings.video.fbo_scale_y = 2.0f;
|
||||
#endif
|
||||
|
||||
g_settings.video.render_to_texture = true;
|
||||
g_settings.video.smooth = true;
|
||||
g_settings.video.vsync = true;
|
||||
|
||||
strlcpy(g_settings.system_directory, default_paths.system_dir, sizeof(g_settings.system_directory));
|
||||
|
||||
g_settings.video.msg_pos_x = 0.05f;
|
||||
g_settings.video.msg_pos_y = 0.90f;
|
||||
g_settings.video.aspect_ratio = -1.0f;
|
||||
|
||||
rarch_input_set_controls_default();
|
||||
|
||||
// g_console
|
||||
g_console.block_config_read = true;
|
||||
g_console.frame_advance_enable = false;
|
||||
g_console.emulator_initialized = 0;
|
||||
g_console.screenshots_enable = true;
|
||||
g_console.throttle_enable = true;
|
||||
g_console.initialize_rarch_enable = false;
|
||||
g_console.triple_buffering_enable = true;
|
||||
g_console.default_savestate_dir_enable = false;
|
||||
g_console.default_sram_dir_enable = false;
|
||||
|
||||
#ifdef HAVE_FBO
|
||||
g_console.fbo_enabled = true;
|
||||
#else
|
||||
g_console.fbo_enabled = false;
|
||||
#endif
|
||||
|
||||
g_console.mode_switch = MODE_MENU;
|
||||
g_console.screen_orientation = ORIENTATION_NORMAL;
|
||||
g_console.current_resolution_id = 0;
|
||||
strlcpy(g_console.default_rom_startup_dir, default_paths.filesystem_root_dir, sizeof(g_console.default_rom_startup_dir));
|
||||
strlcpy(g_console.default_savestate_dir, default_paths.savestate_dir, sizeof(g_console.default_savestate_dir));
|
||||
strlcpy(g_console.default_sram_dir, default_paths.sram_dir, sizeof(g_console.default_sram_dir));
|
||||
g_console.aspect_ratio_index = 0;
|
||||
g_console.menu_font_size = 1.0f;
|
||||
g_console.overscan_enable = false;
|
||||
g_console.overscan_amount = 0.0f;
|
||||
g_console.sound_mode = SOUND_MODE_NORMAL;
|
||||
g_console.viewports.custom_vp.width = 0;
|
||||
g_console.viewports.custom_vp.height = 0;
|
||||
g_console.viewports.custom_vp.x = 0;
|
||||
g_console.viewports.custom_vp.y = 0;
|
||||
g_console.custom_bgm_enable = true;
|
||||
g_console.info_msg_enable = true;
|
||||
#ifdef _XBOX360
|
||||
g_console.color_format = 0;
|
||||
#endif
|
||||
|
||||
// g_extern
|
||||
g_extern.state_slot = 0;
|
||||
g_extern.audio_data.mute = 0;
|
||||
g_extern.verbose = true;
|
||||
}
|
||||
|
@ -105,6 +105,7 @@ enum
|
||||
void rarch_settings_change(unsigned setting);
|
||||
void rarch_settings_default(unsigned setting);
|
||||
void rarch_settings_msg(unsigned setting, unsigned delay);
|
||||
void rarch_settings_set_default (void);
|
||||
|
||||
void rarch_settings_create_menu_item_label(char * str, unsigned setting, size_t size);
|
||||
void rarch_settings_create_menu_item_label_w(wchar_t *strwbuf, unsigned setting, size_t size);
|
||||
|
@ -139,3 +139,16 @@ void rarch_manage_libretro_set_first_file(char *first_file, size_t size_of_first
|
||||
end:
|
||||
dir_list_free(dir_list);
|
||||
}
|
||||
|
||||
void rarch_configure_libretro(const char *path_prefix, const char * extension)
|
||||
{
|
||||
char full_path[1024];
|
||||
snprintf(full_path, sizeof(full_path), "%sCORE%s", path_prefix, extension);
|
||||
|
||||
bool find_libretro_file = rarch_configure_libretro_core(full_path, path_prefix, path_prefix,
|
||||
default_paths.config_file, extension);
|
||||
|
||||
rarch_settings_set_default();
|
||||
rarch_config_load(default_paths.config_file, path_prefix, extension, find_libretro_file);
|
||||
init_libretro_sym();
|
||||
}
|
||||
|
@ -30,5 +30,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 char *path_prefix, const char * extension);
|
||||
|
||||
#endif
|
||||
|
@ -142,6 +142,8 @@ typedef struct
|
||||
char cgp_dir[PATH_MAX];
|
||||
char config_file[PATH_MAX];
|
||||
char core_dir[PATH_MAX];
|
||||
char executable_extension[PATH_MAX];
|
||||
char filesystem_root_dir[PATH_MAX];
|
||||
char input_presets_dir[PATH_MAX];
|
||||
#ifdef HAVE_MULTIMAN
|
||||
char multiman_self_file[PATH_MAX];
|
||||
|
@ -66,62 +66,6 @@ SYS_PROCESS_PARAM(1001, 0x200000)
|
||||
|
||||
#undef main
|
||||
|
||||
static void set_default_settings(void)
|
||||
{
|
||||
// g_settings
|
||||
strlcpy(g_settings.cheat_database, default_paths.port_dir, sizeof(g_settings.cheat_database));
|
||||
g_settings.rewind_enable = false;
|
||||
strlcpy(g_settings.video.cg_shader_path, default_paths.shader_file, sizeof(g_settings.video.cg_shader_path));
|
||||
g_settings.video.fbo_scale_x = 2.0f;
|
||||
g_settings.video.fbo_scale_y = 2.0f;
|
||||
g_settings.video.render_to_texture = true;
|
||||
strlcpy(g_settings.video.second_pass_shader, default_paths.shader_file, sizeof(g_settings.video.second_pass_shader));
|
||||
g_settings.video.second_pass_smooth = true;
|
||||
g_settings.video.smooth = true;
|
||||
g_settings.video.vsync = true;
|
||||
strlcpy(g_settings.cheat_database, default_paths.port_dir, sizeof(g_settings.cheat_database));
|
||||
strlcpy(g_settings.system_directory, default_paths.system_dir, sizeof(g_settings.system_directory));
|
||||
g_settings.video.msg_pos_x = 0.05f;
|
||||
g_settings.video.msg_pos_y = 0.90f;
|
||||
g_settings.video.aspect_ratio = -1.0f;
|
||||
|
||||
rarch_input_set_controls_default();
|
||||
|
||||
// g_console
|
||||
g_console.block_config_read = true;
|
||||
g_console.frame_advance_enable = false;
|
||||
g_console.emulator_initialized = 0;
|
||||
g_console.screenshots_enable = true;
|
||||
g_console.throttle_enable = true;
|
||||
g_console.initialize_rarch_enable = false;
|
||||
g_console.triple_buffering_enable = true;
|
||||
g_console.default_savestate_dir_enable = false;
|
||||
g_console.default_sram_dir_enable = false;
|
||||
g_console.fbo_enabled = true;
|
||||
g_console.mode_switch = MODE_MENU;
|
||||
g_console.screen_orientation = ORIENTATION_NORMAL;
|
||||
g_console.current_resolution_id = 0;
|
||||
strlcpy(g_console.default_rom_startup_dir, "/", sizeof(g_console.default_rom_startup_dir));
|
||||
strlcpy(g_console.default_savestate_dir, default_paths.savestate_dir, sizeof(g_console.default_savestate_dir));
|
||||
strlcpy(g_console.default_sram_dir, default_paths.sram_dir, sizeof(g_console.default_sram_dir));
|
||||
g_console.aspect_ratio_index = 0;
|
||||
g_console.menu_font_size = 1.0f;
|
||||
g_console.overscan_enable = false;
|
||||
g_console.overscan_amount = 0.0f;
|
||||
g_console.sound_mode = SOUND_MODE_NORMAL;
|
||||
g_console.viewports.custom_vp.width = 0;
|
||||
g_console.viewports.custom_vp.height = 0;
|
||||
g_console.viewports.custom_vp.x = 0;
|
||||
g_console.viewports.custom_vp.y = 0;
|
||||
g_console.custom_bgm_enable = true;
|
||||
g_console.info_msg_enable = true;
|
||||
|
||||
// g_extern
|
||||
g_extern.state_slot = 0;
|
||||
g_extern.audio_data.mute = 0;
|
||||
g_extern.verbose = true;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SYSUTILS
|
||||
static void callback_sysutil_exit(uint64_t status, uint64_t param, void *userdata)
|
||||
{
|
||||
@ -244,7 +188,9 @@ static void get_environment_settings(int argc, char *argv[])
|
||||
}
|
||||
|
||||
snprintf(default_paths.core_dir, sizeof(default_paths.core_dir), "%s/cores", default_paths.port_dir);
|
||||
snprintf(default_paths.executable_extension, sizeof(default_paths.executable_extension), ".SELF");
|
||||
snprintf(default_paths.savestate_dir, sizeof(default_paths.savestate_dir), "%s/savestates", default_paths.core_dir);
|
||||
snprintf(default_paths.filesystem_root_dir, sizeof(default_paths.filesystem_root_dir), "/");
|
||||
snprintf(default_paths.sram_dir, sizeof(default_paths.sram_dir), "%s/sram", default_paths.core_dir);
|
||||
|
||||
snprintf(default_paths.system_dir, sizeof(default_paths.system_dir), "%s/system", default_paths.core_dir);
|
||||
@ -295,16 +241,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
config_set_defaults();
|
||||
|
||||
char full_path[1024], tmp_path[1024];
|
||||
snprintf(full_path, sizeof(full_path), "%s/CORE.SELF", default_paths.core_dir);
|
||||
char tmp_path[PATH_MAX];
|
||||
snprintf(tmp_path, sizeof(tmp_path), "%s/", default_paths.core_dir);
|
||||
|
||||
bool find_libretro_file = rarch_configure_libretro_core(full_path, tmp_path, default_paths.core_dir,
|
||||
default_paths.config_file, ".SELF");
|
||||
|
||||
set_default_settings();
|
||||
rarch_config_load(default_paths.config_file, default_paths.core_dir, ".SELF", find_libretro_file);
|
||||
init_libretro_sym();
|
||||
rarch_configure_libretro(tmp_path, default_paths.executable_extension);
|
||||
|
||||
#if(CELL_SDK_VERSION > 0x340000)
|
||||
if (g_console.screenshots_enable)
|
||||
|
@ -47,50 +47,6 @@ int rarch_main(int argc, char *argv[]);
|
||||
|
||||
#undef main
|
||||
|
||||
static void set_default_settings (void)
|
||||
{
|
||||
//g_settings
|
||||
g_settings.rewind_enable = false;
|
||||
#ifdef _XBOX360
|
||||
strlcpy(g_settings.video.cg_shader_path, default_paths.shader_file, sizeof(g_settings.video.cg_shader_path));
|
||||
strlcpy(g_settings.video.second_pass_shader, default_paths.shader_file, sizeof(g_settings.video.second_pass_shader));
|
||||
#endif
|
||||
g_settings.video.fbo_scale_x = 2.0f;
|
||||
g_settings.video.fbo_scale_y = 2.0f;
|
||||
g_settings.video.render_to_texture = true;
|
||||
g_settings.video.second_pass_smooth = true;
|
||||
g_settings.video.smooth = true;
|
||||
g_settings.video.vsync = true;
|
||||
strlcpy(g_settings.cheat_database, "game:", sizeof(g_settings.cheat_database));
|
||||
g_settings.video.aspect_ratio = -1.0f;
|
||||
|
||||
rarch_input_set_controls_default();
|
||||
|
||||
//g_console
|
||||
g_console.block_config_read = true;
|
||||
g_console.frame_advance_enable = false;
|
||||
g_console.emulator_initialized = 0;
|
||||
g_console.gamma_correction_enable = true;
|
||||
g_console.initialize_rarch_enable = false;
|
||||
g_console.fbo_enabled = true;
|
||||
g_console.mode_switch = MODE_MENU;
|
||||
g_console.screen_orientation = ORIENTATION_NORMAL;
|
||||
g_console.throttle_enable = true;
|
||||
g_console.aspect_ratio_index = 0;
|
||||
strlcpy(g_console.default_rom_startup_dir, "game:", sizeof(g_console.default_rom_startup_dir));
|
||||
g_console.viewports.custom_vp.width = 0;
|
||||
g_console.viewports.custom_vp.height = 0;
|
||||
g_console.viewports.custom_vp.x = 0;
|
||||
g_console.viewports.custom_vp.y = 0;
|
||||
g_console.color_format = 0;
|
||||
g_console.info_msg_enable = true;
|
||||
|
||||
//g_extern
|
||||
g_extern.state_slot = 0;
|
||||
g_extern.audio_data.mute = 0;
|
||||
g_extern.verbose = true;
|
||||
}
|
||||
|
||||
static void get_environment_settings (void)
|
||||
{
|
||||
HRESULT ret;
|
||||
@ -147,27 +103,17 @@ static void get_environment_settings (void)
|
||||
/* FIXME: Hardcoded */
|
||||
strlcpy(default_paths.config_file, "D:\\retroarch.cfg", sizeof(default_paths.config_file));
|
||||
strlcpy(g_settings.system_directory, "D:\\system\\", sizeof(g_settings.system_directory));
|
||||
strlcpy(default_paths.filesystem_root_dir, "D:\\", sizeof(default_paths.filesystem_root_dir));
|
||||
strlcpy(default_paths.executable_extension, ".xbe", sizeof(default_paths.executable_extension));
|
||||
#else
|
||||
strlcpy(default_paths.filesystem_root_dir, "game:\\", sizeof(default_paths.filesystem_root_dir));
|
||||
strlcpy(default_paths.shader_file, "game:\\media\\shaders\\stock.cg", sizeof(default_paths.shader_file));
|
||||
strlcpy(default_paths.config_file, "game:\\retroarch.cfg", sizeof(default_paths.config_file));
|
||||
strlcpy(g_settings.system_directory, "game:\\system\\", sizeof(g_settings.system_directory));
|
||||
strlcpy(default_paths.executable_extension, ".xex", sizeof(default_paths.executable_extension));
|
||||
#endif
|
||||
}
|
||||
|
||||
static void configure_libretro(const char *path_prefix, const char * extension)
|
||||
{
|
||||
char full_path[1024];
|
||||
snprintf(full_path, sizeof(full_path), "%sCORE%s", path_prefix, extension);
|
||||
|
||||
bool find_libretro_file = rarch_configure_libretro_core(full_path, path_prefix, path_prefix,
|
||||
default_paths.config_file, extension);
|
||||
|
||||
set_default_settings();
|
||||
rarch_config_load(default_paths.config_file, path_prefix, extension, find_libretro_file);
|
||||
init_libretro_sym();
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
rarch_main_clear_state();
|
||||
@ -175,11 +121,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
config_set_defaults();
|
||||
|
||||
#ifdef _XBOX1
|
||||
configure_libretro("D:\\", ".xbe");
|
||||
#else
|
||||
configure_libretro("game:\\", ".xex");
|
||||
#endif
|
||||
rarch_configure_libretro(default_paths.filesystem_root_dir, default_paths.executable_extension);
|
||||
|
||||
#if defined(HAVE_D3D8) || defined(HAVE_D3D9)
|
||||
video_xdk_d3d.start();
|
||||
|
Loading…
x
Reference in New Issue
Block a user