It is currently 26 Apr 2024, 13:57
   
Text Size

Shandalar - Feature Requests

Allow keyboard control in cardpicker (pending)

 

Since I keep trying to use it, even though I know it doesn't work.

Cursor keys to navigate, at a minimum. Being able to start typing the name of a card and go directly to it would be nice, too. So would mousewheel support.
Last edited by Korath on 10 Jun 2015, 08:08, edited 1 time in total.
Reason: deployed

Comments

Posted by Korath » 07 Jun 2015, 20:56

Keypresses, at least during the cardpicker (and likely everything during adventure mode), get encoded and put into a queue in dword_5A7520[]. sub_41D192() pops a value off that, returning 0 if there isn't one to get.

The encoding is done in sub_41CF20(), and is a bit mysterious. It looks to be a manual (and limited) translation of the raw scancode into ascii; it annoyingly throws away the already-translated VK code. Some values:
Code: Select all
key       ascii     vk        return value        w/shift             w/ctrl or ctrl+shift
left      -         0x25      0x00004b00          0x00004b34          0x00007300
up        -         0x26      0x00004800          0x00004838          0x00008d00
right     -         0x27      0x00004d00          0x00004b36          0x00007400
down      -         0x28      0x00005000          0x00005032          0x00009100

kp8 (w/ or w/o numlock)       0x00004838          0x00004838          0x00008d00
8         0x38/0x2a same      0x00000938          0x0000092a          (nothing)

return    -         0x0d      0x00001c0d          0x00001c0d          0x00001c0a
kpenter   -                   0x00001c0d          0x00001c0d          0x00001c0a
space     -         0x20      0x00003920          0x00003920          (nothing)

a         0x61/0x41 same      0x00001e61          0x00001e41          0x00001e01
s         0x73/0x53 same      0x00001f73          0x00001f53          0x00001f13
d         0x64/0x44 same      0x00002064          0x00002044          0x00002004
Byte 0 of that return value is clearly the ascii value, if it exists, and I suspect that byte 1 is the raw scancode.

sub_4CE61A() translates the actual messages, so that's where to put in mousewheel handling.

Posted by Korath » 08 Jun 2015, 20:29

commit 72cd35df2ae592fd12d0ae83137a271bc30c4ad1
Author: Korath <dgk@Dirge.none>
Date: Mon Jun 8 16:28:25 2015 -0400

[Shandalar] #611: cursor keys move in cardpicker; enter/space selects

Posted by Korath » 18 Jun 2015, 04:50

commit 0c1545ef749502f122257ecb45deb10407f3be4b
Author: Korath <dgk@Dirge.none>
Date: Thu Jun 18 00:44:15 2015 -0400

[Shandalar] #611: suppress built-in keyboard handling in cardpicker

sub_5003B7(), called from shandalar_cardpicker() if TENTATIVE_trading (which
probably doesn't mean that) is nonzero (as well as elsewhere), also inspects
and pops the keypress queue. It doesn't seem to do anything useful with it
that I can tell, at least not in the context of the cardpicker (just moves the
mouse pointer to the Done button?), and races cursor-key handling.

So I've removed the call entirely. No ill effects seen so far; in particular,
confirmation whether to pick/trade for/buy the selected card, which isn't done
directly in shandalar_cardpicker() and which already supported the keyboard,
still works.

Posted by Korath » 29 Jun 2017, 02:06

1656980, 98dd81a. Only thing left do is mousewheel.
Last edited by Korath on 29 Jun 2017, 02:17, edited 1 time in total.

Ticket details

  • Ticket ID: 611
  • Project: Shandalar
  • Status: Pending
  • Component: (unknown)
  • Project version: Loremaster's Tower
  • Priority: Normal
  • Assigned to: Korath
  • Reported by: Korath
  • Reporter's tickets: List all tickets
  • Reported on: 07 Jun 2015, 19:58
  • Last visited by Korath » 29 Jun 2017, 02:17.
 

Login Form