commit e3dea70

zzo38  ·  2022-11-17 03:13:19 +0000 UTC
parent 8ac1a54
Add joypad repeat option.
2 files changed,  +7, -2
M main.c
+3, -0
 1@@ -45,6 +45,9 @@
 2   Hide the system mouse cursor. (The Uxn program might still draw its own
 3   mouse cursor, which most do.)
 4 
 5+-j
 6+  Enable key repeat for joypad emulation.
 7+
 8 -n
 9   Disable GUI. This switch is required in order to read stdin; without it,
10   stdin cannot be read (although command-line arguments still work).
M main.c
+4, -2
 1@@ -153,6 +153,7 @@ static Uint8 use_utc=0;
 2 static Uint8 use_extension=0;
 3 static Uint8 hide_cursor=0;
 4 static Uint8 allow_write=0;
 5+static Uint8 joypad_repeat=0;
 6 static Uint8 zoom=1;
 7 static Sint16 default_width=512;
 8 static Sint16 default_height=320;
 9@@ -897,7 +898,7 @@ static int run_screen(void) {
10         }
11         if(paused) break;
12         if(i) {
13-          if(!(device[8].d[2]&i)) {
14+          if(joypad_repeat || !(device[8].d[2]&i)) {
15             device[8].d[2]|=i;
16             run(GET16(device[8].d));
17           }
18@@ -991,7 +992,7 @@ int main(int argc,char**argv) {
19   device[10].aux=&uxnfile0;
20   device[11].aux=&uxnfile1;
21   device[12].in=datetime_in;
22-  while((i=getopt(argc,argv,"+ABDFNQT:YZa:dh:inp:qt:w:xyz:"))>0) switch(i) {
23+  while((i=getopt(argc,argv,"+ABDFNQT:YZa:dh:ijnp:qt:w:xyz:"))>0) switch(i) {
24     case 'B': bicycle=1; device[0].in=default_in; break;
25     case 'D': scrflags|=SDL_DOUBLEBUF; break;
26     case 'F': scrflags|=SDL_FULLSCREEN; break;
27@@ -1004,6 +1005,7 @@ int main(int argc,char**argv) {
28     case 'd': use_debug=1; break;
29     case 'h': default_height=strtol(optarg,0,10); break;
30     case 'i': hide_cursor=1; break;
31+    case 'j': joypad_repeat=1; break;
32     case 'n': use_screen=0; break;
33     case 'p': palet=strtol(optarg,0,10)&7; break;
34     case 'q': use_console=0; break;