(PS3) Take out setting callback - was crashing the PS3 port

This commit is contained in:
TwinAphex51224 2012-01-29 23:11:47 +01:00
parent 16faee9ae2
commit f89060e7ff
3 changed files with 394 additions and 402 deletions

View File

@ -377,11 +377,6 @@ struct global
void config_load(void);
void config_set_defaults(void);
// Callback to be called after config_set_defaults is run
// for platform specific stuff.
typedef void (*config_default_cb_t)(void);
void config_set_defaults_cb(config_default_cb_t cb);
#ifdef HAVE_CONFIGFILE
bool config_load_file(const char *path);
#endif

View File

@ -32,7 +32,6 @@
#include "ps3_video_psgl.h"
#include "../conf/config_file.h"
#include "../conf/config_file_macros.h"
#include "../general.h"
#include "shared.h"
@ -40,8 +39,34 @@
#include "menu.h"
#define MAX_PATH_LENGTH 1024
#define EMULATOR_CONTENT_DIR "SSNE10000"
#define init_setting_uint(charstring, setting, defaultvalue) \
if(!(config_get_uint(currentconfig, charstring, &setting))) \
setting = defaultvalue;
#define init_setting_int(charstring, setting, defaultvalue) \
if(!(config_get_int(currentconfig, charstring, &setting))) \
setting = defaultvalue;
#define init_setting_float(charstring, setting, defaultvalue) \
if(!(config_get_float(currentconfig, charstring, &setting))) \
setting = defaultvalue;
#define init_setting_bool(charstring, setting, defaultvalue) \
if(!(config_get_bool(currentconfig, charstring, &setting))) \
setting = defaultvalue;
#define init_setting_bool(charstring, setting, defaultvalue) \
if(!(config_get_bool(currentconfig, charstring, &setting))) \
setting = defaultvalue;
#define init_setting_char(charstring, setting, defaultvalue) \
if(!(config_get_array(currentconfig, charstring, setting, sizeof(setting)))) \
strncpy(setting,defaultvalue, sizeof(setting));
uint32_t g_emulator_initialized = 0;
char special_action_msg[256]; /* message which should be overlaid on top of the screen*/
@ -91,22 +116,6 @@ static bool file_exists(const char * filename)
return false;
}
static void default_settings(void)
{
g_settings.video.smooth = 1;
g_settings.video.second_pass_smooth = 1;
strlcpy(g_settings.video.cg_shader_path, DEFAULT_SHADER_FILE, sizeof(g_settings.video.cg_shader_path));
strlcpy(g_settings.video.second_pass_shader, DEFAULT_SHADER_FILE, sizeof(g_settings.video.second_pass_shader));
g_settings.video.fbo_scale_x = 2.0f;
g_settings.video.fbo_scale_y = 2.0f;
g_settings.video.render_to_texture = 1;
g_settings.video.vsync = 1;
g_extern.state_slot = 0;
g_console.screenshots_enable = 0;
strlcpy(g_settings.cheat_database, usrDirPath, sizeof(g_settings.cheat_database));
g_settings.rewind_enable = false;
}
static void init_settings(void)
{
if(!file_exists(SYS_CONFIG_FILE))
@ -116,22 +125,20 @@ static void init_settings(void)
fclose(f);
}
config_file_t * conf = config_file_new(SYS_CONFIG_FILE);
config_file_t * currentconfig = config_file_new(SYS_CONFIG_FILE);
CONFIG_GET_BOOL(video.smooth, "video_smooth");
CONFIG_GET_BOOL(video.second_pass_smooth, "video_second_pass_smooth");
CONFIG_GET_STRING(video.cg_shader_path, "video_cg_shader");
CONFIG_GET_STRING(video.second_pass_shader, "video_second_pass_shader");
CONFIG_GET_DOUBLE(video.fbo_scale_x, "video_fbo_scale_x");
CONFIG_GET_DOUBLE(video.fbo_scale_y, "video_fbo_scale_y");
CONFIG_GET_BOOL(video.render_to_texture, "video_render_to_texture");
CONFIG_GET_BOOL(video.vsync, "video_vsync");
CONFIG_GET_INT_EXTERN(state_slot, "state_slot");
CONFIG_GET_INT_CONSOLE(screenshots_enable, "screenshots_enabled");
CONFIG_GET_STRING(cheat_database, "cheat_database_path");
CONFIG_GET_BOOL(rewind_enable, "rewind_enable");
config_file_free(conf);
init_setting_bool("video_smooth", g_settings.video.smooth, 1);
init_setting_bool("video_second_pass_smooth", g_settings.video.second_pass_smooth, 1);
init_setting_char("video_cg_shader", g_settings.video.cg_shader_path, DEFAULT_SHADER_FILE);
init_setting_char("video_second_pass_shader", g_settings.video.second_pass_shader, DEFAULT_SHADER_FILE);
init_setting_float("video_fbo_scale_x", g_settings.video.fbo_scale_x, 2.0f);
init_setting_float("video_fbo_scale_y", g_settings.video.fbo_scale_y, 2.0f);
init_setting_bool("video_render_to_texture", g_settings.video.render_to_texture, 1);
init_setting_bool("video_vsync", g_settings.video.vsync, 1);
init_setting_uint("state_slot", g_extern.state_slot, 0);
init_setting_uint("screenshots_enabled", g_console.screenshots_enable, 0);
init_setting_char("cheat_database_path", g_settings.cheat_database, usrDirPath);
init_setting_bool("rewind_enable", g_settings.rewind_enable, false);
}
static void get_path_settings(bool multiman_support)
@ -496,7 +503,6 @@ int main(int argc, char *argv[])
g_console.block_config_read = true;
g_extern.verbose = true;
config_set_defaults_cb(default_settings);
config_set_defaults();
SSNES_LOG("Registering Callback\n");

View File

@ -36,12 +36,6 @@ struct global g_extern;
struct console_settings g_console;
#endif
static config_default_cb_t g_default_cb;
void config_set_defaults_cb(config_default_cb_t cb)
{
g_default_cb = cb;
}
#ifdef HAVE_CONFIGFILE
static void read_keybinds(config_file_t *conf);
#endif
@ -225,9 +219,6 @@ void config_set_defaults(void)
g_settings.input.netplay_client_swap_input = netplay_client_swap_input;
for (int i = 0; i < MAX_PLAYERS; i++)
g_settings.input.joypad_map[i] = i;
if (g_default_cb)
g_default_cb();
}
#ifdef HAVE_CONFIGFILE