X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=share%2Fconfig.c;h=7c112d0d80a24e054a55390154b12b9a18df456d;hb=1745b6a90dfd9e626e5c40d20c6aa595ec41d888;hp=7daf030feab6bc98594d591b735ba3727936db76;hpb=439fb86ade20801cfa04deb3763108b3e2f505f1;p=neverball diff --git a/share/config.c b/share/config.c index 7daf030..7c112d0 100644 --- a/share/config.c +++ b/share/config.c @@ -117,6 +117,7 @@ void config_init(void) config_set_s(CONFIG_PLAYER, DEFAULT_PLAYER); config_set_s(CONFIG_BALL, DEFAULT_BALL); config_set_s(CONFIG_WIIMOTE_ADDR, DEFAULT_WIIMOTE_ADDR); + config_set_s(CONFIG_REPLAY_NAME, DEFAULT_REPLAY_NAME); config_set_d(CONFIG_CHEAT, DEFAULT_CHEAT); config_set_d(CONFIG_STATS, DEFAULT_STATS); config_set_d(CONFIG_UNIFORM, DEFAULT_UNIFORM); @@ -313,6 +314,8 @@ void config_load(void) config_set_s(CONFIG_BALL, val); else if (strcmp(key, "wiimote_addr") == 0) config_set_s(CONFIG_WIIMOTE_ADDR, val); + else if (strcmp(key, "replay_name") == 0) + config_set_s(CONFIG_REPLAY_NAME, val); else if (strcmp(key, "cheat") == 0) config_set_d(CONFIG_CHEAT, atoi(val)); @@ -454,6 +457,8 @@ void config_save(void) fprintf(fp, "ball_file %s\n", option_s[CONFIG_BALL]); if (strlen(option_s[CONFIG_WIIMOTE_ADDR]) > 0) fprintf(fp, "wiimote_addr %s\n", option_s[CONFIG_WIIMOTE_ADDR]); + if (strlen(option_s[CONFIG_REPLAY_NAME]) > 0) + fprintf(fp, "replay_name %s\n", option_s[CONFIG_REPLAY_NAME]); fprintf(fp, "stats %d\n", option_d[CONFIG_STATS]); fprintf(fp, "uniform %d\n", option_d[CONFIG_UNIFORM]); @@ -496,11 +501,13 @@ int config_mode(int f, int w, int h) int stencil = config_get_d(CONFIG_REFLECTION) ? 1 : 0; int buffers = config_get_d(CONFIG_MULTISAMPLE) ? 1 : 0; int samples = config_get_d(CONFIG_MULTISAMPLE); + int vsync = config_get_d(CONFIG_VSYNC) ? 1 : 0; SDL_GL_SetAttribute(SDL_GL_STEREO, stereo); SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, stencil); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, buffers); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, samples); + SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, vsync); /* Try to set the currently specified mode. */ @@ -527,8 +534,13 @@ int config_mode(int f, int w, int h) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDepthFunc(GL_LEQUAL); - if (config_get_d(CONFIG_VSYNC)) - sync_init(); + /* + * Mac OS X might still need this, because apparently SDL doesn't do + * SDL_GL_SWAP_CONTROL on OS X. TODO: investigate. + */ +#if 0 + if (vsync) sync_init(); +#endif /* If GL supports multisample, and SDL got a multisample buffer... */