Mercurial > hg > forks > pwpunix
annotate pwplib/setup.c @ 59:25861c440f15
Possibly fix a bug in argument handling.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 09 Jul 2011 11:48:52 +0300 |
parents | 85671798fdb3 |
children |
rev | line source |
---|---|
0 | 1 #include "config.h" |
2 #include "pwplib.h" | |
3 | |
50
e2b6a35bcb0c
Remove usage of malloc.h; Other misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
4 #define MAX_DESTRUCTORS 16 |
0 | 5 |
6 /******************** random stuff *************************/ | |
7 | |
8 void pwplib_dummy(){} | |
9 #define pwp_dummy pwplib_dummy | |
10 | |
11 void pwplib_dump_rast_plain() | |
12 { | |
13 TEMPMALL(u8,tmp,pwplib.videobuf.width*pwplib.videobuf.height*2); | |
14 u8 | |
15 *d=tmp, | |
16 *parentbuf=pwplib.videobuf.d, | |
17 *s=parentbuf; | |
18 | |
19 int i=pwplib.videobuf.width*pwplib.videobuf.height; | |
20 | |
21 for(;i;i--) | |
22 { | |
23 #ifdef DRIVE_WIN32 | |
24 d[0]=176; | |
25 #else | |
26 d[0]='%'; | |
27 #endif | |
28 d[1]=*s++; | |
29 d+=2; | |
30 } | |
31 | |
32 pwplib.videobuf.d=tmp; | |
33 pwplib.dump_attr(); | |
34 pwplib.videobuf.d=parentbuf; | |
35 | |
36 TEMPFREE(tmp); | |
37 } | |
38 | |
39 /********************* timer (unix) ************************/ | |
40 | |
41 #define TIMERHZ 72 | |
42 int pwp_timer_nrt() | |
43 { | |
44 static int lastctr=0,framectr=0; | |
45 | |
46 if(pwplib.setup[SETUP_BPS]) | |
47 { | |
48 pwplib.timer_counter++; /* kludge */ | |
49 return (pwplib.timer_counter*TIMERHZ)/(pwplib.setup[SETUP_BPS]>>3); | |
50 } | |
51 else | |
52 { | |
53 if(pwplib.timer_counter!=lastctr) | |
54 { | |
55 framectr++; | |
56 lastctr=pwplib.timer_counter; | |
57 } | |
58 else | |
59 pwplib.timer_counter++; | |
60 return (framectr*TIMERHZ)/pwplib.setup[SETUP_FPS]; | |
61 } | |
62 } | |
63 | |
64 int pwplib_timer() | |
65 { | |
66 static int base=-1;int v; | |
67 v=pwplib.timerfunc(); | |
68 if(base==-1)base=v; | |
69 return v-base; | |
70 } | |
71 | |
72 /********************* destructors, signals etc **********/ | |
73 | |
50
e2b6a35bcb0c
Remove usage of malloc.h; Other misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
74 void(*pwp_destr[MAX_DESTRUCTORS + 1])(); |
0 | 75 |
17
c60e531d19cd
Some misc. cleanups and minor warning removals.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
76 void pwplib_regdestr(void(*func)()) |
0 | 77 { |
50
e2b6a35bcb0c
Remove usage of malloc.h; Other misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
78 static int curr = 0; |
e2b6a35bcb0c
Remove usage of malloc.h; Other misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
79 if (curr < MAX_DESTRUCTORS) { |
e2b6a35bcb0c
Remove usage of malloc.h; Other misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
80 pwp_destr[curr++] = func; |
e2b6a35bcb0c
Remove usage of malloc.h; Other misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
81 pwp_destr[curr] = NULL; |
e2b6a35bcb0c
Remove usage of malloc.h; Other misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
82 } else { |
e2b6a35bcb0c
Remove usage of malloc.h; Other misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
83 pwpwrite("* FATAL! tried to register %d destructors where %d is max.\n", curr, MAX_DESTRUCTORS); |
e2b6a35bcb0c
Remove usage of malloc.h; Other misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
84 exit(1); |
e2b6a35bcb0c
Remove usage of malloc.h; Other misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
85 } |
0 | 86 } |
87 | |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
88 void pwplib_shutdown(void) |
0 | 89 { |
50
e2b6a35bcb0c
Remove usage of malloc.h; Other misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
90 int i = 0; |
0 | 91 while(pwp_destr[i]!=NULL) |
92 pwp_destr[i++](); | |
93 } | |
94 | |
95 /******************** initialization *********************/ | |
96 | |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
97 int pwplib_init_common(void) |
0 | 98 { |
99 /*** base stuff ***/ | |
100 | |
101 pwplib.sound= | |
102 pwplib.loopflush= | |
103 pwplib.player= | |
104 pwplib.dump_attr= | |
105 pwplib.dump_rast= | |
106 pwplib.prep_attr= | |
107 pwplib.prep_rast= | |
50
e2b6a35bcb0c
Remove usage of malloc.h; Other misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
108 pwplib_dummy; |
0 | 109 |
110 pwp_destr[0]=NULL; | |
50
e2b6a35bcb0c
Remove usage of malloc.h; Other misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
111 |
e2b6a35bcb0c
Remove usage of malloc.h; Other misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
112 return 1; |
0 | 113 } |
114 | |
115 /***********************************************/ | |
116 | |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
117 static void rmarg(int *argc, char *argv[], int n) |
0 | 118 { |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
119 while (n < *argc) |
0 | 120 { |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
121 argv[n] = argv[n + 1]; |
0 | 122 n++; |
123 } | |
124 (*argc)--; | |
125 } | |
126 | |
127 /*********************************************************************/ | |
128 | |
129 #define ARGC pwplib.argc | |
130 #define ARGV pwplib.argv | |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
131 static void getopts(pwp_optab *opts, const int nopts) |
0 | 132 { |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
133 int i; |
0 | 134 |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
135 for (i = 0; i < nopts; i++) |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
136 *(opts[i].var) = opts[i].dflt; |
0 | 137 |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
138 for (i = 0; i < ARGC;) |
0 | 139 { |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
140 int opt, match = 0, wh = -1, lev = 0; |
0 | 141 |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
142 for (opt = 0; opt < nopts; opt++) |
0 | 143 { |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
144 char *s1 = opts[opt].name; |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
145 char *s0 = ARGV[i]; |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
146 int ngl = 0, m = 0; |
0 | 147 |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
148 while (*s0) |
0 | 149 { |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
150 if (*s0=='-') |
0 | 151 ngl=0; |
152 else | |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
153 if (*s0=='+') |
0 | 154 ngl=1; |
155 else | |
156 { | |
157 m++; | |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
158 if (*s0=='\0' || *s1=='\0')break; |
0 | 159 else |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
160 if ((*s0|32) != *s1) |
0 | 161 { |
162 m=0; | |
163 break; | |
164 } | |
165 s1++; | |
166 } | |
167 s0++; | |
168 } | |
169 | |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
170 if (m > match) |
0 | 171 { |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
172 match = m; |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
173 lev = ngl; |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
174 wh = opt; |
0 | 175 } |
176 } | |
177 | |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
178 if (wh >= 0) |
0 | 179 { |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
180 rmarg(&ARGC, ARGV, i); |
0 | 181 |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
182 switch (opts[wh].type) |
0 | 183 { |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
184 case OPT_BIN: |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
185 *((int*)(opts[wh].var)) = lev; |
0 | 186 break; |
187 | |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
188 case OPT_NOT: |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
189 *((int*)(opts[wh].var)) = 1 - lev; |
0 | 190 break; |
191 | |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
192 case OPT_ONE: |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
193 *((int*)(opts[wh].var))=1; |
0 | 194 |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
195 case OPT_INT: |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
196 if (ARGV[i] != NULL) |
0 | 197 { |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
198 *((int*)(opts[wh].var)) = atoi(ARGV[i]); |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
199 rmarg(&ARGC, ARGV, i); |
0 | 200 } |
201 break; | |
202 | |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
203 case OPT_STRING: |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
204 if (ARGV[i] != NULL) |
0 | 205 { |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
206 *((char**)(opts[wh].var)) = strdup(ARGV[i]); |
59
25861c440f15
Possibly fix a bug in argument handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
54
diff
changeset
|
207 rmarg(&ARGC, ARGV, 1); |
0 | 208 } |
209 break; | |
210 } | |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
211 } else |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
212 i++; |
0 | 213 } |
214 } | |
215 #undef ARGC | |
216 #undef ARGV | |
217 | |
218 /************************************/ | |
219 | |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
220 static pwp_optab main_options[] = { |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
221 /* stuph */ |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
222 { "help", OPT_ONE, (void*)0, (void*)&pwplib.setup[SETUP_WANTHELP] }, |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
223 { "shutup", OPT_ONE, (void*)0, (void*)&pwplib.setup[SETUP_SHUTUP] }, |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
224 { "infodelay", OPT_INT, (void*)100, (void*)&pwplib.set.infodelay }, |
0 | 225 |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
226 /* general */ |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
227 { "nosound", OPT_ONE, (void*)0, (void*)&pwplib.setup[SETUP_NOSOUND] }, |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
228 { "novideo", OPT_ONE, (void*)0, (void*)&pwplib.setup[SETUP_NOVIDEO] }, |
0 | 229 |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
230 /* video */ |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
231 { "term", OPT_STRING, (void*)NULL, (void*)&pwplib.set.term }, |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
232 { "lang", OPT_STRING, (void*)NULL, (void*)&pwplib.set.lang }, |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
233 { "tty", OPT_BIN, (void*)0, (void*)&pwplib.setup[SETUP_TTY] }, /* obsolete? */ |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
234 { "pvp", OPT_BIN, (void*)0, (void*)&pwplib.setup[SETUP_PVP] }, |
0 | 235 |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
236 /* size */ |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
237 { "height", OPT_INT, (void*)0, (void*)&pwplib.setup[SETUP_USERHEIGHT] }, |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
238 { "width", OPT_INT, (void*)0, (void*)&pwplib.setup[SETUP_USERWIDTH] }, |
0 | 239 |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
240 /* conversion */ |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
241 { "trans", OPT_INT, (void*)-1, (void*)&pwplib.setup[SETUP_TRANS] }, |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
242 { "colors", OPT_INT, (void*)-1, (void*)&pwplib.setup[SETUP_COLORS] }, |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
243 { "raster", OPT_INT, (void*)-1, (void*)&pwplib.setup[SETUP_RASTER] }, |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
244 { "halve", OPT_BIN, (void*)1, (void*)&pwplib.setup[SETUP_HALVE] }, |
0 | 245 |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
246 /* tty-etc stuff */ |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
247 { "fps", OPT_INT, (void*)0, (void*)&pwplib.setup[SETUP_FPS] }, |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
248 { "bps", OPT_INT, (void*)0, (void*)&pwplib.setup[SETUP_BPS] }, |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
249 { "minfps", OPT_INT, (void*)0, (void*)&pwplib.setup[SETUP_MINFPS] }, |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
250 { "maxfps", OPT_INT, (void*)256, (void*)&pwplib.setup[SETUP_MAXFPS] }, |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
251 { "lossy", OPT_BIN, (void*)0, (void*)&pwplib.setup[SETUP_LOSSY] }, |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
252 { "fdelay", OPT_INT, (void*)0, (void*)&pwplib.set.framedelay }, |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
253 { "fbytes", OPT_INT, (void*)500, (void*)&pwplib.set.framebytes }, |
0 | 254 |
255 /* audio options */ | |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
256 { "audev", OPT_STRING, (void*)NULL, (void*)&pwplib.set.audev }, |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
257 { "volume", OPT_INT, (void*)32, (void*)&pwplib.setup[SETUP_VOLUME] }, |
0 | 258 |
21
f0869ef0f2d9
Add commandline settings for fullscreen and changing horiz/vert resolution of SDL output. Also hide the mouse cursor.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
259 #if (defined(DRIVE_SDL)) |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
260 /* Graphical output related */ |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
261 { "fs", OPT_ONE, (void*)0, (void*)&pwplib.setup[SETUP_FULLSCREEN] }, |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
262 { "xres", OPT_INT, (void*)640, (void*)&pwplib.setup[SETUP_XRES] }, |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
263 { "yres", OPT_INT, (void*)480, (void*)&pwplib.setup[SETUP_YRES] }, |
21
f0869ef0f2d9
Add commandline settings for fullscreen and changing horiz/vert resolution of SDL output. Also hide the mouse cursor.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
264 #endif |
f0869ef0f2d9
Add commandline settings for fullscreen and changing horiz/vert resolution of SDL output. Also hide the mouse cursor.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
265 |
0 | 266 }; |
267 | |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
268 |
50
e2b6a35bcb0c
Remove usage of malloc.h; Other misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
269 void pwplib_printhelp(void) |
0 | 270 { |
271 printf( | |
272 "usage: %s [options] where options include:\n\n" | |
273 | |
274 " help this text\n" | |
275 | |
276 "\n" | |
277 | |
278 " shutup be quiet - only output the essentials\n" | |
279 " term s set terminal type to s (e.g. xterm-color, vt100, ansi)\n" | |
280 " lang s set locale/language to s (e.g. en, fi)\n" | |
281 " pvp output in pwp video phormat (stdout)\n" | |
282 | |
283 "\n" | |
284 | |
285 " nosound no sound\n" | |
286 " novideo no video output\n" | |
287 | |
288 "\n" | |
289 | |
290 " height x set buffer height (default = fullwindow)\n" | |
291 " width x set buffer width (default = fullwindow)\n" | |
292 | |
293 "\n" | |
294 | |
295 " volume v set soft volume to v (numeric, default 32)\n" | |
296 " colors x color configuration: 0=16x16, 1=8fg 2=8bg, 3=8x8\n" | |
297 " 8=monochrome, 9=vtattributes\n" | |
298 " trans n charset: 1=ibm, 2=ascii, 3=ascii-pure\n" | |
299 " raster n raster rendering mode: 0==fg+bg 1=fgonly 2=mono\n" | |
300 " ascii pure ascii: no colors, no attributes\n" | |
301 " nohalve always use one character cell to represent a pixel\n" | |
302 | |
303 "\n" | |
304 | |
305 " fbytes n bytes/frame threshold (optimize frame if exceeded)\n" | |
306 " fdelay n delay after each frame (milliseconds)\n" | |
307 | |
308 "\n" | |
309 | |
310 " bps n non-rt: fix to n bits per second, no delay\n" | |
311 " fps n non-rt: fix to n frames per second, no delay\n" | |
21
f0869ef0f2d9
Add commandline settings for fullscreen and changing horiz/vert resolution of SDL output. Also hide the mouse cursor.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
312 |
f0869ef0f2d9
Add commandline settings for fullscreen and changing horiz/vert resolution of SDL output. Also hide the mouse cursor.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
313 "\n" |
f0869ef0f2d9
Add commandline settings for fullscreen and changing horiz/vert resolution of SDL output. Also hide the mouse cursor.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
314 |
f0869ef0f2d9
Add commandline settings for fullscreen and changing horiz/vert resolution of SDL output. Also hide the mouse cursor.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
315 #if (defined(DRIVE_SDL)) |
f0869ef0f2d9
Add commandline settings for fullscreen and changing horiz/vert resolution of SDL output. Also hide the mouse cursor.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
316 " fs full screen mode (SDL)\n" |
f0869ef0f2d9
Add commandline settings for fullscreen and changing horiz/vert resolution of SDL output. Also hide the mouse cursor.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
317 " xres x graphical x resolution (640)\n" |
f0869ef0f2d9
Add commandline settings for fullscreen and changing horiz/vert resolution of SDL output. Also hide the mouse cursor.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
318 " yres x graphical y resolution (480)\n" |
f0869ef0f2d9
Add commandline settings for fullscreen and changing horiz/vert resolution of SDL output. Also hide the mouse cursor.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
319 |
f0869ef0f2d9
Add commandline settings for fullscreen and changing horiz/vert resolution of SDL output. Also hide the mouse cursor.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
320 "\n" |
f0869ef0f2d9
Add commandline settings for fullscreen and changing horiz/vert resolution of SDL output. Also hide the mouse cursor.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
321 #endif |
f0869ef0f2d9
Add commandline settings for fullscreen and changing horiz/vert resolution of SDL output. Also hide the mouse cursor.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
322 , |
f0869ef0f2d9
Add commandline settings for fullscreen and changing horiz/vert resolution of SDL output. Also hide the mouse cursor.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
323 pwplib.argv[0]); |
0 | 324 } |
325 | |
326 void pwplib_getopts() | |
327 { | |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
328 getopts(main_options, sizeof(main_options) / sizeof(main_options[0])); |
0 | 329 |
54
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
330 if (pwplib.set.lang == NULL) |
85671798fdb3
Various code cleanups, cosmetics, warning fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
331 pwplib.set.lang = pwp_get_locale(); |
0 | 332 } |
333 |