1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-03-03 01:57:54 +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
parent f198204bca
commit 2092a74869

View File

@@ -289,7 +289,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\
@@ -312,6 +321,8 @@ int main(int argc, char *argv[])
extern int TIMER_INTERVAL;
extern fd_set LispReadFds;
int 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.");
@@ -437,7 +448,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
@@ -518,7 +553,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);