OpenMSX question: How to bind keys...

Page 1/5
| 2 | 3 | 4 | 5

By NYYRIKKI

Enlighted (5396)

NYYRIKKI's picture

08-01-2015, 13:56

Hello,

I have a problem... It all started from the #¤%! annoying, useless reverse feature, that made my life miserable... I found that I can prevent openMSX from constantly destroying my work by writing "reverse stop". (I need to click between Catapult and main window, when I make 2mm inaccurate mouse click going to main window and hit any key on other hand my work keeps disappearing to bit heaven time after time) How ever there are still keys "Page up" and "Page down" that are related to this feature...

What I would like to do is to assign "Page down" to BASIC warmboot (=CTRL+SHIFT+GRAPH+CODE) as I can't repeat this combination on my PC keyboard. (Actually it is not fault of keyboard, but openMSX. In BlueMSX same keys work fine.) "Page up" I would like to bind to STOP-key to make it compatible with BlueMSX keyboard mapping. (I'm constantly hitting wrong keys when I test different emulators.)

Can anyone help me? I've been experimenting with bind-command, but so far I've not found the correct format...

Login or register to post comments

By Manuel

Ascended (15815)

Manuel's picture

08-01-2015, 14:21

If you don't like the reverse feature, just disable it:
- F10
- set auto_enable_reverse off
- F10
See http://openmsx.sourceforge.net/manual/commands.html#auto_ena...

If you have a mouse plugged into the MSX, it is easy to loose your work when you have reverse enabled. If you move the "MSX" mouse after having reversed, openMSX will detect this as new input and will overwrite the old history with it. But if you don't have a mouse plugged in, you could just let history be replayed until where you were and nothing is lost (don't hit a keyboard key then, as this will cause new input, overwriting the old history...)
Anyway, just disable it, if it doesn't help you. (This will also make the 'step back' functionality of the debugger stop working, of course...)

As the manual explains, the generic syntax of the bind command is bind {event} {command}, see http://openmsx.sourceforge.net/manual/commands.html#bind

event is typically a host keyboard event, or the short version: just a host key name (e.g. PAGEUP). Command will be a command to be executed. Currently, openMSX doesn't have a way to map the Host to MSX keyboard mapping (so you cannot change the mapping of the STOP key for instance). So, I see no other way than using a keymatrixdown command for the command-parameter of your bind command. See http://openmsx.sourceforge.net/manual/commands.html#keymatrix

So, to operate the STOP key via the PAGEUP key, you get something like

bind PAGEUP "keymatrixdown 7 0x08"
bind PAGEUP,release "keymatrixup 7 0x08"

(all untested, but the idea should be clear).

We should investigate why you can't press CTRL+SHIFT+GRAPH+CODE, by the way. On PC keyboard that should be LCTRL-LSHIFT-LALT-RALT I think... I'd have to try later whether that works for me.

Something similar for page down should be done, if necessary you can combine commands with a ; so like this:

bind PAGEDOWN "keymatrixdown 1 0x23; keymatrix 4 0x56"
bind PAGEDOWN,release "keymatrixdown 1 0x23; keymatrix 4 0x56"

(You'll have to look up the right rows and bits yourself...)

By NYYRIKKI

Enlighted (5396)

NYYRIKKI's picture

08-01-2015, 16:03

Manuel wrote:

Anyway, just disable it, if it doesn't help you. (This will also make the 'step back' functionality of the debugger stop working, of course...)

Actually I think I could take a look at the tcl scripts folder to just disable the progress bar that is causing my problem. If that would not be visible I could not accidentally reverse half an hour while trying to activate the openMSX window. Smile

BTW thank you very much for your tips! I managed to solve my STOP-key problem with following commands:

bind Pageup "keymatrixdown 7 16"
bind Pageup,release "keymatrixup 7 16"
bind Pageup+CTRL "keymatrixdown 6 2 ; keymatrixdown 7 16"
bind Pageup+CTRL,release "keymatrixup 6 2 ; keymatrixup 7 16"

For CTRL+SHIFT+GRAPH+CODE problem this kind of binding was not fast enough to respond, so I needed to do another kind of binding to make sure MSX returns to text mode after break:

bind pagedown {keymatrixdown 6 23 ; after time .03 "keymatrixup 6 23"}
Quote:

We should investigate why you can't press CTRL+SHIFT+GRAPH+CODE, by the way. On PC keyboard that should be LCTRL-LSHIFT-LALT-RALT I think... I'd have to try later whether that works for me.

Yes, I really don't know... I tried also changing KANA to RCTRL (set kbd_code_kana_host_key RCTRL) but it didn't work... How ever it didn't move the KANA-key but duplicate it... On openMSX default on my "RALT"-key (aka AltGr in Finnish keyboard) there is mapped CTRL+KANA

By NYYRIKKI

Enlighted (5396)

NYYRIKKI's picture

08-01-2015, 16:21

Ah... Original problem solved with command: disable_reversebar

By Manuel

Ascended (15815)

Manuel's picture

08-01-2015, 16:27

If you want to auto enable reverse without the reverse bar, use the 'on' option for the auto_enable_reverse setting. Default is 'gui', which means 'on with reverse bar'.

'reverse stop' and 'disable_reversebar' are not settings, but single time commands. So they are not remembered. You need that auto_enable_reverse setting to make things persistent.

About not fast enough to respond is weird: in MSX time, keymatrixdown should be infinite. MSX time is stopped until the commands are all executed and then the MSX will find the bits in the keymatrix different.

Are you sure you tried this:

bind PAGEDOWN "keymatrixdown 6 23"
bind PAGEDOWN,release "keymatrixup 6 23"

So, the keys will be pressed in the MSX as long as you have PAGEDOWN pressed down.

By flyguille

Prophet (3029)

flyguille's picture

08-01-2015, 16:31

oh, the reverse feature sometimes destroyed too my works, but I hit Pg. Up accidentally, and then appear the fatality message box, "disk has changed... bla bla bla".

By Manuel

Ascended (15815)

Manuel's picture

08-01-2015, 16:38

flyguille wrote:

oh, the reverse feature sometimes destroyed too my works, but I hit Pg. Up accidentally, and then appear the fatality message box, "disk has changed... bla bla bla".

Your work has not been destroyed then, but the disk image needs to be reinserted, because it had changed since the last time the state was replayed. (openMSX doesn't implement copy-on-write for the reverse feature, so things will go wrong if the writable media is different than before... so in a scenario where you write something to disk and reverse to before the writing, the writing will not be undone and openMSX will warn you that the disk has changed and for safety reasons will be made read-only.

Also here: if it doesn't help you: unbind PAGEUP etc.

By NYYRIKKI

Enlighted (5396)

NYYRIKKI's picture

08-01-2015, 16:55

Manuel wrote:

If you want to auto enable reverse without the reverse bar, use the 'on' option for the auto_enable_reverse setting. Default is 'gui', which means 'on with reverse bar'.

Yet again good info, thanks!

BTW I found a way to temporarily move the reversebar to bottom of the screen where you don't accidentally click it:
disable_reversebar; osd configure osd_icons -y 0 ;enable_reversebar; osd configure osd_icons -y 212

Quote:

Are you sure you tried this:

bind PAGEDOWN "keymatrixdown 6 23"
bind PAGEDOWN,release "keymatrixup 6 23"

Yes, that is what I tried first, but I will always get too long keydown perioid no matter how fast I hit the PC keyboard. Sad

By NYYRIKKI

Enlighted (5396)

NYYRIKKI's picture

08-01-2015, 17:40

Manuel wrote:

About not fast enough to respond is weird: in MSX time, keymatrixdown should be infinite.

Ah, here is the problem... My problem is not "long enough", my problem is "short enough". I have years of practice on MSX keyboard to make just short enough break. Smile On openMSX (using suggested method)... even if I would shoot my PC keyboard with air rifle I would get too long key press causing all kind of unwanted actions... Like Kana turned on or not exiting graphics mode (and then I need to write "screen 0' " blindly.)

By mars2000you

Enlighted (5515)

mars2000you's picture

08-01-2015, 18:00

I don't know if it will help NYYRIKKI, but maybe changing the keyboard mapping mode can make a difference.

By default, openMSX works in CHARACTER mode, that uses the mapping of the PC keyboard and tries to find the eventual missing keys corresponding to the emulated MSX keyboard.

I really prefer the KEY mode that uses the MSX BIOS to remap the PC keys according to the original MSX keyboard layout. This is the only mode supported by blueMSX and when you want to use openMSX, it's one of the first things to change.

By NYYRIKKI

Enlighted (5396)

NYYRIKKI's picture

08-01-2015, 19:20

Yes, I forgot to mention that, but I use KEY-mode. Actually it is only mode that I can use... If I use CHARACTER mode and emulate ie. MSX tR I can practically use only about half of the characters. (You know... there are not many Ä, Ö or Å or similar in Japanese keyboard -> Impossible to use -> Stupid default from my point of view... If I some day start to use Russian MSX computers, then I will probably appreciate this option as even half working keyboard is better than not being able to type at all... How ever I can then search it & switch it on when I needed it. (Ah the newer ending talk about defaults...)

Anyway... Although I don't fully agree with everything that openMSX team selects as defaults, I'm slowly getting in to using this emulator and we are taking here some really important steps. From inside it is a masterpiece. ie. the "dir as disk" works so well that I would really like to see my self using it also for development. I'm getting frustrated to the endless "Compile -> Eject -> file to DSK -> mount -> try -> repeat"-pattern or splitting files to multiple storage devices. OpenMSX is also MUCH more accurate than anything else out there. These tiny things like not very nice keyboard mapping, different control window and "destroy your work with one click" just keep pushing me away. (Not that I had to remove some shortcuts from BlueMSX as well to save me from my self... Backspace and F12 are just a bit too close when you hit them hundreds of times. Smile ) I've learned already that practically everything in openMSX is doable, because the user interface is actually programming language... Unfortunately that is the same reason that makes it really difficult to get into solving even these kind of basic problems... It is frustrating when you want to do something for MSX, but after a while you realize it is time to go to sleep and you just used two hours fighting with emulator and none with your code.

Generally I think OpenMSX team is doing wonderful job and I appreciate it very much.

Page 1/5
| 2 | 3 | 4 | 5