From b77f64f31e3b788d8e98b371711d6cc5ee538862 Mon Sep 17 00:00:00 2001 From: Peter Date: Thu, 21 Oct 2021 18:18:28 +0200 Subject: [PATCH] Add command line parameters -sc WxH and -pixelscale n for SDL. --- src/main.c | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 89afeb4..5556382 100644 --- a/src/main.c +++ b/src/main.c @@ -276,7 +276,16 @@ const char *helpstring = -bw The Medley screen borderwidth\n\ -g[eometry] ] The Medley screen geometry\n\ -sc[reen] x] The Medley screen geometry\n"; -#else /* not DOS, not XWINDOW */ +#elif SDL +const char *helpstring = + "\n\ + either setenv LDESRCESYSOUT or do:\n\ + medley [] []\n\ + -info Print general info about the system\n\ + -help Print this message\n\ + -pixelscale The amount of pixels to show for one Medley screen pixel.\n\ + -sc[reen] x] The Medley screen geometry\n"; +#else /* not DOS, not XWINDOW, not SDL */ const char *helpstring = "\n\ either setenv LDESRCESYSOUT or do:\n\ @@ -315,6 +324,9 @@ int main(int argc, char *argv[]) extern int TIMER_INTERVAL; extern fd_set LispReadFds; long tmpint; + int width = 1024, height = 768; + int pixelscale = 1; + #ifdef MAIKO_ENABLE_FOREIGN_FUNCTION_INTERFACE if (dld_find_executable(argv[0]) == 0) { perror("Name of executable not found."); @@ -442,7 +454,31 @@ int main(int argc, char *argv[]) } #endif /* DOS */ - +#ifdef SDL + else if ((strcmp(argv[i], "-sc") == 0) || (strcmp(argv[i], "-SC") == 0)) { + if (argc > ++i) { + int read = sscanf(argv[i], "%dx%d", &width, &height); + if(read != 2) { + fprintf(stderr, "Could not parse -sc argument %s\n", argv[i]); + exit(1); + } + } else { + fprintf(stderr, "Missing argument after -m\n"); + exit(1); + } + } else if ((strcmp(argv[i], "-pixelscale") == 0) || (strcmp(argv[i], "-PIXELSCALE") == 0)) { + if (argc > ++i) { + int read = sscanf(argv[i], "%d", &pixelscale); + if(read != 1) { + fprintf(stderr, "Could not parse -pixelscale argument %s\n", argv[i]); + exit(1); + } + } else { + fprintf(stderr, "Missing argument after -m\n"); + exit(1); + } + } +#endif /* SDL */ /* Can only do this under SUNOs, for now */ else if (!strcmp(argv[i], "-E")) { /**** ethernet info ****/ #ifdef MAIKO_ENABLE_ETHERNET @@ -601,7 +637,7 @@ int main(int argc, char *argv[]) make_dsp_instance(currentdsp, 0, 0, 0, 1); /* All defaults the first time */ #endif /* DOS || XWINDOW */ #if defined(SDL) - init_SDL(1888, 1110, 1); + init_SDL(width, height, pixelscale); #endif /* SDL */ /* Load sysout to VM space and returns real sysout_size(not 0) */ sysout_size = sysout_loader(sysout_name, sysout_size);