shithub: pt2-clone

Download patch

ref: d18178cfb5744c5a2285209ec5542d786c3eec56
parent: 7d12cfe365ae8c4ef3ee6aaf41e963e1d5d63fb2
author: Olav Sørensen <olav.sorensen@live.no>
date: Tue May 17 09:28:26 EDT 2022

Kludge for allowing some missing key repeats

Some key combinations weren't repeated when they should've been (when caps lock is on).

--- a/release/keybindings.txt
+++ b/release/keybindings.txt
@@ -24,8 +24,13 @@
    shift+F12   - Toggle Amiga panning (100% stereo separation)
    ctrl+F12    - Toggle CIA/VBLANK timing for tempo/speed effect (Fxx)
    alt+1/2/3/4 - Increase Multi ordering (when in idle, not play/edit/rec.)
+   home        - Go to row 0
+   end         - Go to row 63
+   page up     - Go 16 rows up
+   page down   - Go 16 rows down
+   ctrl+del    - Delete note+sample from pattern data
  -------------------------------------------------
- 
+                  (US keyboard layout)
  High note keys:  2 3   5 6 7   9 0   =
                  Q W E R T Y U I O P [ ]
                    
@@ -35,6 +40,13 @@
  F1 - Choose low octave (from C-1 to G-3)
  F2 - Choose high octave (from C-2 to B-3)
 
+ up         - Go one row up
+ shift+up   - Go one row up (faster) 
+ alt+up     - Go one row up (fastest) 
+ down       - Go one row down
+ shift+down - Go one row down (faster) 
+ alt+down   - Go one row down (fastest) 
+ 
  shift+F3 - Cut channel to buffer
  shift+F4 - Copy channel to buffer
  shift+F5 - Paste channel buffer to channel
@@ -85,7 +97,7 @@
  right ctrl (cmd on Mac) - Play Pattern
              right shift - Record
         
- caps lock - Toggle Keyrepeat on/off (will use the OS settings for repeat/delay)
+ caps lock - Toggle Keyrepeat on/off (will use the OS settings for key repeat speed)
 
       del - Delete note under cursor
   alt+del - Delete command only 
--- a/src/pt2_header.h
+++ b/src/pt2_header.h
@@ -14,7 +14,7 @@
 #include "pt2_unicode.h"
 #include "pt2_palette.h"
 
-#define PROG_VER_STR "1.47"
+#define PROG_VER_STR "1.48"
 
 #ifdef _WIN32
 #define DIR_DELIMITER '\\'
@@ -36,7 +36,7 @@
 */
 #define VBLANK_HZ 60
 
-/* Scopes are clocked at 64Hz instead of 60Hz to prevent the small +/- Hz 
+/* Scopes are clocked at 64Hz instead of 60Hz to prevent the small +/- Hz
 ** interference from monitors not being exactly 60Hz (and unstable non-vsync mode).
 ** Sadly, the scopes might mildly flicker from this in some cases.
 */
@@ -75,6 +75,7 @@
 
 #define FILTERS_BASE_FREQ (PAULA_PAL_CLK / 214.0)
 
+// Amount of video frames. 14 (PT on Amiga) -> 17 (converted from 49.92Hz to 60Hz)
 #define KEYB_REPEAT_DELAY 17
 
 // .MOD types
--- a/src/pt2_keyboard.c
+++ b/src/pt2_keyboard.c
@@ -341,11 +341,21 @@
 		return;
 	}
 
+	// kludge: allow certain specific key combos to be repeated with the ctrl key
+	const bool nonRepeatAltKeys = keyb.leftAltPressed && scancode != SDL_SCANCODE_DELETE    && scancode != SDL_SCANCODE_RETURN
+	                                                  && scancode != SDL_SCANCODE_BACKSPACE && scancode != SDL_SCANCODE_BACKSLASH
+	                                                  && scancode != SDL_SCANCODE_EQUALS    && scancode != SDL_SCANCODE_MINUS
+	                                                  && scancode <  SDL_SCANCODE_1         && scancode >  SDL_SCANCODE_0;
+
+	// kludge: allow certain specific key combos to be repeated with the alt key
+	const bool nonRepeatCtrlKeys = keyb.leftCtrlPressed && scancode != SDL_SCANCODE_DELETE && scancode != SDL_SCANCODE_RETURN
+	                                                    && scancode != SDL_SCANCODE_BACKSPACE;
+
 	// these keys should not allow to be repeated in keyrepeat mode (caps lock)
-	const bool illegalKeys = keyb.leftAltPressed || keyb.leftAmigaPressed || keyb.leftCtrlPressed
+	const bool nonRepeatKeys = keyb.leftAmigaPressed || nonRepeatAltKeys || nonRepeatCtrlKeys
 		|| scancode == SDL_SCANCODE_LEFT || scancode == SDL_SCANCODE_RIGHT
 		|| scancode == SDL_SCANCODE_UP   || scancode == SDL_SCANCODE_DOWN;
-	if (editor.repeatKeyFlag && keyb.repeatKey && scancode == keyb.lastRepKey && illegalKeys)
+	if (editor.repeatKeyFlag && keyb.repeatKey && scancode == keyb.lastRepKey && nonRepeatKeys)
 		return;
 
 	if (scancode == SDL_SCANCODE_KP_PLUS)