X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=vrtris;a=blobdiff_plain;f=src%2Fopt.c;h=fb4b341223527241f61ddaf71f16b042878e6ffb;hp=33d7dfbeaca18fdc897c8db7ea6c59806f019af6;hb=96757b3e8d4c7ad71ebcae67c40c5fed14c471ce;hpb=6ad6cf2cb2e82d8dcc1535a031a38eb991d2b396 diff --git a/src/opt.c b/src/opt.c index 33d7dfb..fb4b341 100644 --- a/src/opt.c +++ b/src/opt.c @@ -9,7 +9,9 @@ struct options def_opt = { 1024, 768, 0, "game" }; enum { OPTCFG_SIZE, +#ifdef BUILD_VR OPTCFG_VR, +#endif OPTCFG_FULLSCREEN, OPTCFG_WINDOWED, OPTCFG_SCREEN, @@ -19,7 +21,9 @@ enum { static struct optcfg_option options[] = { // short, long, id, desc {'s', "size", OPTCFG_SIZE, "window size (WxH)"}, +#ifdef BUILD_VR {0, "vr", OPTCFG_VR, "enable VR mode"}, +#endif {'f', "fullscreen", OPTCFG_FULLSCREEN, "run in fullscreen mode"}, {'w', "windowed", OPTCFG_WINDOWED, "run in windowed mode"}, {0, "screen", OPTCFG_SCREEN, "select starting screen"}, @@ -38,6 +42,11 @@ int init_options(int argc, char **argv, const char *cfgfile) /* default options */ opt = def_opt; + if(!(opt.start_scr = malloc(strlen(def_opt.start_scr) + 1))) { + perror("failed to allocate memory"); + return -1; + } + strcpy(opt.start_scr, def_opt.start_scr); argv0 = argv[0]; @@ -79,6 +88,7 @@ static int opt_handler(struct optcfg *oc, int optid, void *cls) } break; +#ifdef BUILD_VR case OPTCFG_VR: if(is_enabled(oc)) { opt.flags |= OPT_VR; @@ -86,6 +96,7 @@ static int opt_handler(struct optcfg *oc, int optid, void *cls) opt.flags &= ~OPT_VR; } break; +#endif case OPTCFG_FULLSCREEN: if(is_enabled(oc)) {