| View previous topic :: View next topic |
| Author |
Message |
rooski Master Cheater
Reputation: 0
Joined: 31 Oct 2007 Posts: 340 Location: Siberia
|
Posted: Mon May 10, 2010 6:28 pm Post subject: Snes |
|
|
does anyone know of an snes emulator that does not use direct input? or of a way to send keystrokes to a direct input game so the character will actually move , ive been having lots of trouble with this and have had no luck .
my problem with direct input seems to be that the key down isnt being recognized/sent , but key up is , so if im playing mario and i keep sending the run key and i run right , mario will only walk , but if i myself press the runkey and run right then he runs until the key is sent by my program , then he starts just walking , telling me that a key up was sent successfully.
using this code to send
| Code: | void Key ( int vk , BOOL bExtended)
{
KEYBDINPUT kb={0};
INPUT Input={0};
// generate down
if ( bExtended )
kb.dwFlags = KEYEVENTF_EXTENDEDKEY;
kb.wVk = vk;
Input.type = INPUT_KEYBOARD;
Input.ki = kb;
SendInput(1,&Input,sizeof(Input));
// generate up
ZeroMemory(&kb,sizeof(KEYBDINPUT));
ZeroMemory(&Input,sizeof(INPUT));
kb.dwFlags = KEYEVENTF_KEYUP;
if ( bExtended )
kb.dwFlags |= KEYEVENTF_EXTENDEDKEY;
kb.wVk = vk;
Input.type = INPUT_KEYBOARD;
Input.ki = kb;
SendInput(1,&Input,sizeof(Input));
} |
_________________
clawtheclouds.com |
|
| Back to top |
|
 |
rooski Master Cheater
Reputation: 0
Joined: 31 Oct 2007 Posts: 340 Location: Siberia
|
|
| Back to top |
|
 |
False Prophet Expert Cheater
Reputation: -1
Joined: 28 May 2006 Posts: 121
|
Posted: Sun May 16, 2010 4:28 am Post subject: |
|
|
SendInput is such a hassle, though. Thanks for this, the read was great.
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sun May 16, 2010 5:53 pm Post subject: |
|
|
Why call SendInput multiple times? Just feed it your array of input and do it in one shot.
Nicer looking, easier in general
|
|
| Back to top |
|
 |
rooski Master Cheater
Reputation: 0
Joined: 31 Oct 2007 Posts: 340 Location: Siberia
|
Posted: Sun May 16, 2010 10:26 pm Post subject: |
|
|
| slovach wrote: | Why call SendInput multiple times? Just feed it your array of input and do it in one shot.
Nicer looking, easier in general |
if you needed a delay between keys .
anyways,
anyone do any programming with genetic algorithms , because i need some help/advice setting up the gene structure for one.
_________________
clawtheclouds.com |
|
| Back to top |
|
 |
|