commit 6b0e407
zzo38
·
2022-11-21 06:15:40 +0000 UTC
parent 188d239
Add option to disallow uxn program to change screen size.
2 files changed,
+12,
-2
M
main.c
+4,
-1
1@@ -16,6 +16,9 @@
2 -Q
3 Disable the mouse initially (it can still be enabled at run time).
4
5+-S
6+ Disallow the uxn program to change the screen size.
7+
8 -T year.month.day.hours.minutes.seconds.wday.yday.yday.isdst
9 Use a fixed value for the date/time, by numbers with dots in between. In
10 this case, it will read the same values from the date/time device each
11@@ -60,7 +63,7 @@
12 Disable standard I/O.
13
14 -s #
15- Define scroll size.
16+ Define scroll amount.
17
18 -t #
19 Set the frame rate, in milliseconds per frame.
M
main.c
+8,
-1
1@@ -157,6 +157,7 @@ static Uint8 allow_write=0;
2 static Uint8 joypad_repeat=0;
3 static Uint16 scroll_size=1;
4 static Uint8 zoom=1;
5+static Uint8 disallow_size_change=0;
6 static Sint16 default_width=512;
7 static Sint16 default_height=320;
8 static Uint32 scrflags=SDL_SWSURFACE;
9@@ -698,6 +699,11 @@ static void screen_out(Device*dev,Uint8 id) {
10 Uint16 x=GET16(dev->d+8);
11 Uint16 y=GET16(dev->d+10);
12 Uint8 z=dev->d[id];
13+ if(id<6 && disallow_size_change) {
14+ PUT16(dev->d+2,scr_w);
15+ PUT16(dev->d+4,scr_h);
16+ return;
17+ }
18 switch(id) {
19 case 2: case 3:
20 x=GET16(dev->d+2);
21@@ -1017,12 +1023,13 @@ int main(int argc,char**argv) {
22 device[10].aux=&uxnfile0;
23 device[11].aux=&uxnfile1;
24 device[12].in=datetime_in;
25- while((i=getopt(argc,argv,"+ABDFNQT:YZa:dh:ijnp:qs:t:w:xyz:"))>0) switch(i) {
26+ while((i=getopt(argc,argv,"+ABDFNQST:YZa:dh:ijnp:qs:t:w:xyz:"))>0) switch(i) {
27 case 'B': bicycle=1; device[0].in=default_in; break;
28 case 'D': scrflags|=SDL_DOUBLEBUF; break;
29 case 'F': scrflags|=SDL_FULLSCREEN; break;
30 case 'N': scrflags|=SDL_NOFRAME; break;
31 case 'Q': use_mouse=0; break;
32+ case 'S': disallow_size_change=1; break;
33 case 'T': device[12].in=default_in; set_datetime(optarg); break;
34 case 'Y': allow_write=1; device[10].out=device[11].out=files_out; device[10].in=device[11].in=files_in; break;
35 case 'Z': use_utc=1; break;