Welcome, Guest. Please login or register.

Author Topic: Simulate key press, help need.  (Read 7384 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline motorollin

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Simulate key press, help need.
« on: May 29, 2006, 02:25:36 PM »
This would only work of the game uses input.device...

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollin

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Simulate key press, help need.
« Reply #1 on: May 29, 2006, 08:26:21 PM »
If joystick movements don't generate an interrupt, then how do you check for them?

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollin

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Simulate key press, help need.
« Reply #2 on: May 29, 2006, 08:51:17 PM »
So WHDLoad must already be doing this with the keyboard, right? That's how it detects the quit key. Couldn't code be added to poll the keyboard registers, and remap to keyboard events? Which joysticks are checked and which keys the map to could be specified in the tooltypes of the game.

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollin

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Simulate key press, help need.
« Reply #3 on: May 29, 2006, 09:04:48 PM »
I suppose you would have to insert code in to the game to make it check the joystick every frame, and then generate a keyboard interrupt. But as you said, that means re-writing the game.

I less elegant but easier solution may be to use hardware. Maybe something which connects to the keyboard interface but has joystick inputs. The hardware would translate the joystick input in to keyboard events. A passthrough would ensure you can still connect your keyboard.

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollin

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Simulate key press, help need.
« Reply #4 on: May 29, 2006, 09:49:47 PM »
@Tricky
Of course, you would need some way of changing the mappings for different games. Maybe the interface would wait for an unusual key combination (maybe all of the F keys simultaneously), at which point it would enter a programming mode. You would then press the keys on the keyboard (in a set order) which you want to map to up/down/left/right/fire.

You could even have software which has presets for different games, so you just select the game you want from a list, and the software simulates pressing all of the F keys to put the interface in to programming mode, then simulates pressing the correct keys for that game. The application should be controllable by the command line so it can be included in a script when launching the game.

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollin

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Simulate key press, help need.
« Reply #5 on: May 29, 2006, 10:05:24 PM »
Quote
Tricky wrote:
@motorollin
I don't think you can send signals right back to the keyboard itself.  I suspect it only gets back as far as the CIA chip.  To add that sort of functionality, you're going to have to start soldering things direct to your motherboard... not a nice concept.

Good point... simulating a keypress wouldn't be the same as pressing the key (which could be detected by the device).

Quote
Tricky wrote:
But if you're wiring a couple extra joystick ports on it, of course you could also wire in a special "program" switch.  When that switch is on, if you press a joystick control and a key simultaneously it would assign it.

That would work, but you couldn't automate it through software. Maybe the device could connect to the parallel port and receive its mappings that way.

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10