Please Help, Strange request.

Started by
12 comments, last by Sc4Freak 16 years ago
Ok, I have this idea that I really want to do. I do not know why, but I have this need to do it. I have made things much more complicated, so it is funny how things that should be simple, end up being the hardest to do. Anyways, my idea, or problem is as follows. I have a USB Controller adapter that allows you to use a Playstation 2 controller on a Windows PC via USB. It is called the Dual Super Joy Box, lol. The thing is, I would like to make a type of pass-threw controller application using a simple VB program. I want to plug in the PS2 controller to the PC, have the controls fed into a custom VB application, then shot back OUT threw another usb port to go back into a PS2/PS3. Currently, you can take a PS2 controller and this Dual Box USB adapter, and it allows you to use PS2 controllers on your PS3 just by plugging it in. So I want to make macros, turbo functions and other custom button presses threw the computer and have it shoot back out the controls into the Playstation in real time. If anyone could offer me any help or what type of direction to go in, I would appreciate it. I am mainly a Windows API programmer, so I have very little experience with controlling hardware with VB. Thanks for the help.
Advertisement
I would assume to do anything like that you would need a good understanding of assembly and c/c++.

I do not think its even remotely possible to do that with vb. You could maybe write a dll file in c/c++ which does stuff like that, then use that dll file in vb. But i lack the knowledge to help you with any of this.
The-Moon is right, this is not at all the kind of task VB was designed for. It's absolutely the wrong tool for the job, and any kind of hacks you would use to accomplish this would most certainly reflect this. If you're mainly using the Windows API with C and C++ like you say you are, get the Windows DDK and learn how to use it. But be careful: your driver will operate without most of the safety nets that are usually in place for application code. It's harder than it used to be, but these days it's still possible for a driver to corrupt memory so badly that Windows blue-screens.
Um yeah, the moon is not right.

I have had many many debates with people on the power of visual basic. While it might be harder to do some of the things, once you learn a function, you can save it in bas form. You can use it as often as you like, never forgetting what you learned on a subject.

I was told you could not use Visual Basic to make a real time Ram modifier in order to write cheat software and trainers for computer games, years ago in VB 3 pro. I did it and it only took a few days to figure out the calls.

I'll put it more simply,..
If you are in a Windows OS, then VB can do anything, if not MORE then C, C++ and C#. However it can do it in a rapid, solid manner.

I will also point out, that I make most of my money building "Point of Sale" systems. The largest one I ever took part in, was the building of Wal-Marts point of sale system that includes VERY indepth inventory control and automic shipping when low on an items inventory, as well as calculating the tax yearly, quartly, and really any other time.

Believe it or not, the entire thing was programmed with VB6.
However alot of the controls and DLLs were made in C++.

VB can do pretty much anything you want it to do inside of windows and Windows based OS's.

Besides, I have a concept of what I am asking, I am just not sure how to execute it.

VB would NOT be handling the controller or driver.

This is the path that I think would work,..

I know you can use joystick functions in VB.
So maybe mapping the controller to the default game controller will allow me to interact with it.

The only main problem is sending the signals back out through another USB port.

I don't want to come across as rude, but I often do on the internet, when I am not really trying to be.

If you know how to do this, or have seen anything remotely similar, please point me in the correct direction.

I will post my progress with source code so others can have it if they need to do the samething.

If you don't know, then you don't I guess.
But I am just seeking the right information on how to even begin sending signals OUT of a USB port from a default devices, without custom drivers.

It HAS to be possible either way.
If you cant do it in VB, but can in C, point me that way as well, I will do that if I have too, I just wanted it to be as simple and clean as possible.

Thanks for your time.
To do anything remotely like what you are suggesting, you'll have to write a USB driver. Good luck trying to get Microsoft to release a driver devkit for VB. Of course you'll need the hardware too. A steady hand, a soldering iron and a good knowledge of USB and PS2/PS3 controller protocols are needed.

Or to elaborate a bit: Your PSX controller to PC-USB adapter works only in that direction. There really is no way to make the PC to drive signals to the PlayStation using that hardware. If you really wish to do what you're trying to, there are descriptions of the PSX controller protocol on the internet (here's one: http://pinouts.ru/Game/playstation_9_pinout.shtml). You might be able to successfully connect your PSX to the LPT port on your PC and actually have the PC emulate a controller, but I really do not advice you try it, unless you know what you're doing. - On second though, the 500 kHz clock that you'd need to poll is too fast to easily handle under Windows. If you really, really wish to toy with this idea, you'd best install DOS.

[Edited by - SnotBob on April 1, 2008 6:06:44 AM]
Quote:Original post by The Cyndicate
If you are in a Windows OS, then VB can do anything, if not MORE then C, C++ and C#. However it can do it in a rapid, solid manner.

Huh, I really dont agree with that.

Anyway...
For a pre made driver to interact with a USB device in VB see
http://www.entechtaiwan.com/dev/rapid/index.shtm

If you dont want to use that drive then I suggest you look into these links
http://www.usbman.com/developer.htm usb developing site
http://www.intel.com/intelpress/usb/examples/VBOverview.htm
an intel book with usb/vb that you might be interested in.

To do what you want you really do need some custom hardware (see here for an idea of what's involved). In that link they use an HC11, but you should be able to get away with a PIC and a bit of support circuitry running on a breadboard. It will work like this:

* You'll communicate with the custom hardware via serial port, issuing the various commands using some arbitrarily chosen protocol (*forget* using USB, it's way too complicated for a hobby job like this)

* The PIC (which you'll obviously need to program yourself) will generate the appropriate signals that the PSX will understand.

The reason you need to do it this way is that unless you're writing a device driver you wont be able to get the timing granularity required to get a stable clock signal or to keep your other lines in sync with the clock line (and even then you'll probably have trouble). A PIC or micro-controller on the other-hand would be dedicated to the task and timing is typically done on a timer interrupt or by counting cycles, and the time taken can be calculated to within the accuracy of the oscillator driving your processor (ie. very accurately, external crystal oscillators are better than the internal RC oscillators, but the internal would easily be good enough for what you want).

As for using VB, those arguing against it are doing so purely from the point of view that you *cannot* write a device driver in VB. If you decide to do the custom hardware then you could use any language you like, serial comms are easy.

EDIT: Oh, and for setting up the hardware you'll first need to drop in to your local electronics store and get a PIC programmer (either pre-built or as a kit you can assemble yourself). This will allow you to load the executable onto the PIC. BTW, you won't be using VB to on the PIC, assembly and C are your only choices [evil]

EDIT2: Of course, if you're feeling really adventurous you could get a development board for something like a ATmega MCU and drop the PC completely. Have your board take the controller in and spit out the signals (with macros inserted) to the PSX, it could run off the VCC from the PSX. To change the macros, have a serial connection which you could plug into the PC and have a couple of commands for setting up the macros.

EDIT3: This looks like a nice little board for you: http://hubbard.engr.scu.edu/embedded/avr/boards/avrminiv4/quickstart.html

EDIT4: OK, so I lied about assembly and C being your only options on a PIC. Some (like the PICAXE) have a BASIC interpreter.

[Edited by - joanusdmentia on April 1, 2008 8:43:01 AM]
"Voilà! In view, a humble vaudevillian veteran, cast vicariously as both victim and villain by the vicissitudes of Fate. This visage, no mere veneer of vanity, is a vestige of the vox populi, now vacant, vanished. However, this valorous visitation of a bygone vexation stands vivified, and has vowed to vanquish these venal and virulent vermin vanguarding vice and vouchsafing the violently vicious and voracious violation of volition. The only verdict is vengeance; a vendetta held as a votive, not in vain, for the value and veracity of such shall one day vindicate the vigilant and the virtuous. Verily, this vichyssoise of verbiage veers most verbose, so let me simply add that it's my very good honor to meet you and you may call me V.".....V
Quote:Original post by joanusdmentiaAs for using VB, those arguing against it are doing so purely from the point of view that you *cannot* write a device driver in VB. If you decide to do the custom hardware then you could use any language you like, serial comms are easy.


I had no idea vb was able to make drivers... :
Ive always assumed that was a asm/c/c++ thing...

However i've been know to be wrong... :)

When nvida starts using vb to makes its drivers, ill believe you tho :D
Quote:Original post by The-Moon
Quote:Original post by joanusdmentiaAs for using VB, those arguing against it are doing so purely from the point of view that you *cannot* write a device driver in VB. If you decide to do the custom hardware then you could use any language you like, serial comms are easy.


I had no idea vb was able to make drivers... :
Ive always assumed that was a asm/c/c++ thing...

However i've been know to be wrong... :)

When nvida starts using vb to makes its drivers, ill believe you tho :D


You've misread. I was saying doing serial comms is easy in any language, not that you could write a device driver in any language.
"Voilà! In view, a humble vaudevillian veteran, cast vicariously as both victim and villain by the vicissitudes of Fate. This visage, no mere veneer of vanity, is a vestige of the vox populi, now vacant, vanished. However, this valorous visitation of a bygone vexation stands vivified, and has vowed to vanquish these venal and virulent vermin vanguarding vice and vouchsafing the violently vicious and voracious violation of volition. The only verdict is vengeance; a vendetta held as a votive, not in vain, for the value and veracity of such shall one day vindicate the vigilant and the virtuous. Verily, this vichyssoise of verbiage veers most verbose, so let me simply add that it's my very good honor to meet you and you may call me V.".....V
The-Moon was acknowledging the fact that doing what you want to do requires writing device drivers (unless you go with a custom hardware approach, like joanusdmentia suggested). And in that respect he was 100% right: if you want to write drivers you need to ditch VB. You're also missing the point when you say "VB can do anything C/C++" can do. The point is that just because you can do something with a certain tool, it doesn't mean it's actually the best tool for the job. Nothing at all about VB makes it suitable for writing the sort of low-level code that's required for device drivers (just like very little about C makes it suitable for the sort of RAD applications that VB was designed for).

This topic is closed to new replies.

Advertisement