From 2c8382e60e6086df5b3835f009464a97b2a0cb4b Mon Sep 17 00:00:00 2001 From: IvanDSM Date: Sat, 16 May 2020 21:39:48 -0300 Subject: [PATCH] Add --help and --windowed CLI options. --- src/pc/cliopts.c | 17 +++++++++++++++-- src/pc/gfx/gfx_sdl2.c | 5 +++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/pc/cliopts.c b/src/pc/cliopts.c index 1e3b29c8..14497e30 100644 --- a/src/pc/cliopts.c +++ b/src/pc/cliopts.c @@ -23,7 +23,20 @@ void parse_cli_opts(int argc, char* argv[]) gCLIOpts.SkipIntro = 1; if (strcmp(argv[i], "--fullscreen") == 0) // Open game in fullscreen - gCLIOpts.FullScreen = 1; + gCLIOpts.FullScreen = 1; + + if (strcmp(argv[i], "--windowed") == 0) // Open game in windowed mode + gCLIOpts.FullScreen = 2; + + if (strcmp(argv[i], "--help") == 0) // Print help + { + printf("Super Mario 64 PC Port\n"); + printf("%-20s\tSkips the Peach and Castle intro when starting a new game.\n", "--skip-intro"); + printf("%-20s\tStarts the game in full screen mode.\n", "--fullscreen"); + printf("%-20s\tStarts the game in windowed mode.\n", "--windowed"); + printf("%-20s\tSaves the configuration file as CONFIGNAME.\n", "--configfile CONFIGNAME"); + exit(0); + } if (strncmp(argv[i], "--configfile", strlen("--configfile")) == 0) { @@ -36,7 +49,7 @@ void parse_cli_opts(int argc, char* argv[]) strncpy(gCLIOpts.ConfigFile, argv[i+1], strlen(argv[i+1])); } } - } + } } } } \ No newline at end of file diff --git a/src/pc/gfx/gfx_sdl2.c b/src/pc/gfx/gfx_sdl2.c index 57ff486d..2a0a54dd 100644 --- a/src/pc/gfx/gfx_sdl2.c +++ b/src/pc/gfx/gfx_sdl2.c @@ -114,9 +114,10 @@ static void gfx_sdl_init(void) { window_flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE; - if (gCLIOpts.FullScreen) { + if (gCLIOpts.FullScreen == 1) configFullscreen = true; - } + else if (gCLIOpts.FullScreen == 2) + configFullscreen = false; if (configFullscreen) { window_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;