|
-
Aug 2nd, 2001, 12:20 PM
#1
Thread Starter
Lively Member
Time now for a stupid question.
I've been trying to write a SNES pad driver in Visual Basic. As you are probably aware, Visual Basic is slow. Yes, my driver program works, but if there is anything using any remote amount of processing power (like, I don't know, the game I'm trying to use it in?) the thing slows down to the point where control is impossible.
Now, my program wouldn't be too bad if it just had to watch the parallel port (where my hotwired SNES pad is) for input - But you have to manually poll the stupid thing several times a second (a real SNES does 60, one poll for each frame drawn on the screen). This is great, except my polling gets slowed down considerably by whatever other programs are running.
Winding around to my question: I'm thinking about rewriting my program in C++. This will be the first useful program I've ever written in C. Thus, can this be done in C? Will I have to do something fancy with threads and whatnot to get the polling speed I need? I'm not going to go for the full 60 hz. polling. Maybe 30 would be nice. Does anyone have any comments? Suggestions? Polite notifications that this idea is impossible and cannot be done, C or no C?
~Zero the Inestimable
-
Aug 2nd, 2001, 12:23 PM
#2
Well, considering that C/C++ is oh, 50+ times as fast as VB, of course it is possible.
Z.
-
Aug 2nd, 2001, 01:45 PM
#3
About 2 years ago, I did some experiments and C++ proved to be several hunderd times faster
-
Aug 2nd, 2001, 01:57 PM
#4
Well, that fits in the range of "50+" =P.
Z.
-
Aug 4th, 2001, 02:11 AM
#5
Monday Morning Lunatic
Threads would be a good idea. Your primary thread (the one running main or WinMain) spawns off a worker thread that runs at 30Hz (use a multimedia timer) and calls a callback function when that happens.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 4th, 2001, 01:39 PM
#6
Thread Starter
Lively Member
Stupid question, round two:
Alright then. Now, does anyone know off the top of their heads a good way to simulate key presses (real key presses, not that pansy VB SendKeys kind of thing) in C++?
~Zero the Inestimable
-
Aug 4th, 2001, 01:59 PM
#7
transcendental analytic
keybd_event
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 4th, 2001, 03:07 PM
#8
What do you consider "real" keypressing. SendKeys is "real" keypressing.
The equivilent in C++ could be sending the WM_KEYDOWN message, the keybd_event() function (as kedaman mentioned), and the SetKeyboardState() function.
-
Aug 4th, 2001, 03:34 PM
#9
transcendental analytic
keybd_event is closest related The thing about Sendkeys is that it's hard to send specific keycodes, it's more ascii-related and you can't control states either. Shortly, it sucks.
with keybd_event you can set the up/down and Lock/unlock state on any key specifically. SetKeyboardState does this for all keys simulateously, so unless you really need to do a reset or something you need to use it in conjunction with GetKeyboardState, so not usefull for most cases. WM_KEYDOWN's and WM_KEYUP's need target window handle explicitely. Usefull if you need to send keys to a specific window without switching focus.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 5th, 2001, 05:48 AM
#10
Frenzied Member
This sounds intresting, using the snes pad, i have one lol, but it sounds freakishly fun what ur doing, u have turned ur snes pad plug into one that works on a pc right ?
-
Aug 5th, 2001, 12:44 PM
#11
Frenzied Member
Ok, but then for the application (sos if there is one in the zip, ent opened it yet). ???
-
Aug 6th, 2001, 05:22 AM
#12
Thread Starter
Lively Member
...
I haven't finished the app yet, y'see. The Zip just has a word document with some diagrams and stuff that tell you how to convert the controller.
You can the SNES controller in ZSNES and a few other emulators without a driver app, though.
~Zero the Inestimable
-
Aug 6th, 2001, 12:44 PM
#13
Frenzied Member
ok, my bro is going to do it with his snes pad, he also has a turbo pad, any work on that perhaps ???? have u done ???
Im getting the bits this Thursday and then im gonna work on it we already have emulators going
Last edited by PsyVision; Aug 6th, 2001 at 12:49 PM.
-
Aug 6th, 2001, 02:27 PM
#14
Thread Starter
Lively Member
...
It will work with any SNES controller. Even that bazooka thing, even though nothing supports it...
I have used normal, arcade style, and turbo controllers with no problems.
~Zero the Inestimable
-
Aug 7th, 2001, 12:05 AM
#15
Frenzied Member
Yeah, we have the bazooka light gun, the arcade style pad, the orignal pad and the competition pro pad And three games for the bazooka thing (plus ofcourse other ones )
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|