1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-22 02:15:28 +00:00

Add command line parameters -sc WxH and -pixelscale n for SDL.

This commit is contained in:
Peter 2021-10-21 18:18:28 +02:00 committed by Nick Briggs
parent 8038a959c5
commit b77f64f31e

View File

@ -276,7 +276,16 @@ const char *helpstring =
-bw <pixels> The Medley screen borderwidth\n\
-g[eometry] <geom>] The Medley screen geometry\n\
-sc[reen] <w>x<h>] The Medley screen geometry\n";
#else /* not DOS, not XWINDOW */
#elif SDL
const char *helpstring =
"\n\
either setenv LDESRCESYSOUT or do:\n\
medley [<sysout-name>] [<options>]\n\
-info Print general info about the system\n\
-help Print this message\n\
-pixelscale <n> The amount of pixels to show for one Medley screen pixel.\n\
-sc[reen] <w>x<h>] 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);