Skip to content

Commit d18178c

Browse files
committed
Kludge for allowing some missing key repeats
Some key combinations weren't repeated when they should've been (when caps lock is on).
1 parent 7d12cfe commit d18178c

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

release/keybindings.txt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,13 @@
2424
shift+F12 - Toggle Amiga panning (100% stereo separation)
2525
ctrl+F12 - Toggle CIA/VBLANK timing for tempo/speed effect (Fxx)
2626
alt+1/2/3/4 - Increase Multi ordering (when in idle, not play/edit/rec.)
27+
home - Go to row 0
28+
end - Go to row 63
29+
page up - Go 16 rows up
30+
page down - Go 16 rows down
31+
ctrl+del - Delete note+sample from pattern data
2732
-------------------------------------------------
28-
33+
(US keyboard layout)
2934
High note keys: 2 3 5 6 7 9 0 =
3035
Q W E R T Y U I O P [ ]
3136

@@ -35,6 +40,13 @@
3540
F1 - Choose low octave (from C-1 to G-3)
3641
F2 - Choose high octave (from C-2 to B-3)
3742

43+
up - Go one row up
44+
shift+up - Go one row up (faster)
45+
alt+up - Go one row up (fastest)
46+
down - Go one row down
47+
shift+down - Go one row down (faster)
48+
alt+down - Go one row down (fastest)
49+
3850
shift+F3 - Cut channel to buffer
3951
shift+F4 - Copy channel to buffer
4052
shift+F5 - Paste channel buffer to channel
@@ -85,7 +97,7 @@
8597
right ctrl (cmd on Mac) - Play Pattern
8698
right shift - Record
8799

88-
caps lock - Toggle Keyrepeat on/off (will use the OS settings for repeat/delay)
100+
caps lock - Toggle Keyrepeat on/off (will use the OS settings for key repeat speed)
89101

90102
del - Delete note under cursor
91103
alt+del - Delete command only

src/pt2_header.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "pt2_unicode.h"
1515
#include "pt2_palette.h"
1616

17-
#define PROG_VER_STR "1.47"
17+
#define PROG_VER_STR "1.48"
1818

1919
#ifdef _WIN32
2020
#define DIR_DELIMITER '\\'
@@ -36,7 +36,7 @@
3636
*/
3737
#define VBLANK_HZ 60
3838

39-
/* Scopes are clocked at 64Hz instead of 60Hz to prevent the small +/- Hz
39+
/* Scopes are clocked at 64Hz instead of 60Hz to prevent the small +/- Hz
4040
** interference from monitors not being exactly 60Hz (and unstable non-vsync mode).
4141
** Sadly, the scopes might mildly flicker from this in some cases.
4242
*/
@@ -75,6 +75,7 @@
7575

7676
#define FILTERS_BASE_FREQ (PAULA_PAL_CLK / 214.0)
7777

78+
// Amount of video frames. 14 (PT on Amiga) -> 17 (converted from 49.92Hz to 60Hz)
7879
#define KEYB_REPEAT_DELAY 17
7980

8081
// .MOD types

src/pt2_keyboard.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,21 @@ void keyDownHandler(SDL_Scancode scancode, SDL_Keycode keycode)
341341
return;
342342
}
343343

344+
// kludge: allow certain specific key combos to be repeated with the ctrl key
345+
const bool nonRepeatAltKeys = keyb.leftAltPressed && scancode != SDL_SCANCODE_DELETE && scancode != SDL_SCANCODE_RETURN
346+
&& scancode != SDL_SCANCODE_BACKSPACE && scancode != SDL_SCANCODE_BACKSLASH
347+
&& scancode != SDL_SCANCODE_EQUALS && scancode != SDL_SCANCODE_MINUS
348+
&& scancode < SDL_SCANCODE_1 && scancode > SDL_SCANCODE_0;
349+
350+
// kludge: allow certain specific key combos to be repeated with the alt key
351+
const bool nonRepeatCtrlKeys = keyb.leftCtrlPressed && scancode != SDL_SCANCODE_DELETE && scancode != SDL_SCANCODE_RETURN
352+
&& scancode != SDL_SCANCODE_BACKSPACE;
353+
344354
// these keys should not allow to be repeated in keyrepeat mode (caps lock)
345-
const bool illegalKeys = keyb.leftAltPressed || keyb.leftAmigaPressed || keyb.leftCtrlPressed
355+
const bool nonRepeatKeys = keyb.leftAmigaPressed || nonRepeatAltKeys || nonRepeatCtrlKeys
346356
|| scancode == SDL_SCANCODE_LEFT || scancode == SDL_SCANCODE_RIGHT
347357
|| scancode == SDL_SCANCODE_UP || scancode == SDL_SCANCODE_DOWN;
348-
if (editor.repeatKeyFlag && keyb.repeatKey && scancode == keyb.lastRepKey && illegalKeys)
358+
if (editor.repeatKeyFlag && keyb.repeatKey && scancode == keyb.lastRepKey && nonRepeatKeys)
349359
return;
350360

351361
if (scancode == SDL_SCANCODE_KP_PLUS)

0 commit comments

Comments
 (0)