InputSprocket to HID Manager

⌘-R in Chief
Posts: 1,261
Joined: 2002.05
Post: #1
In converting this top secret game of mine, I need to convert the use of InputSprocket to the HID Manager. (Or some plain code which does the same thing. Only keyboard support is _really_ required, but HID would be the best thing.)

Has anyone here done any InputSprocket to HID work or as used both and would be able to provide me with some assistance via email? I would very much appreciate it, and if all goes well (it seems to be going great so far!) the Mac community will have an old classic back in their hands! I haven't used either and I can't even find some decent documentation on HID.
Quote this message in a reply
⌘-R in Chief
Posts: 1,261
Joined: 2002.05
Post: #2
Alright, well never mind on the ISp -> HID help, because there was another version of the code that just used GetKeys so I didnt need to change a thing!
Quote this message in a reply
isgoed
Unregistered
 
Post: #3
FreakSoftware Wrote:Alright, well never mind on the ISp -> HID help, because there was another version of the code that just used GetKeys so I didnt need to change a thing!

Would you share this information with us. It's nice for the other people who visit this thread afterwards.
Quote this message in a reply
isgoed
Unregistered
 
Post: #4
isgoed Wrote:Would you share this information with us. It's nice for the other people who visit this thread afterwards.

See this is how it works:

http://www.zsculpt.com/website/appsutils...izard.html

In order to let google find this much more easier inputSprocket OSX OR "OS X"

edit: Amelio framework seems to do the same http://www.macupdate.com/info.php/id/13203
edit 2: only it can't be found any more. Not even on http://legacy.newdoom.com/
edit 3: hidwizard does not seem that great actually. It requires an installer; it is not MachO (It's that CFM-stuff you know) and it is closed source. Seems like I need to write my own code based on apples's HID.
Quote this message in a reply
Moderator
Posts: 522
Joined: 2002.04
Post: #5
isgoed Wrote:edit: Amelio framework seems to do the same http://www.macupdate.com/info.php/id/13203

Unfortunately the Amelio framework seems utterly broken at the moment. It relied on a static url that is no longer hosted at iDevGames (which can be changed or the functionaility removed without too much of a hassle). Additionally, preferences don't work correctly in Carbon, and your configuration for your game never gets saved.

It'd be wonderful to see someone (maybe me) work on Amelio. Now that I'm more used to OS X development I might be able to fix it if I get a chance.

I contacted the author of it about 8 months ago about figuring out why things weren't working but unfortunately couldn't come up with any answers. I'm sure it wasn't me screwing something up, because the example that came with Amelio didn't work even.

-Jon

p.s. I wasted a lot of time poking at Amelio. Good idea, needs work.
Quote this message in a reply
⌘-R in Chief
Posts: 1,261
Joined: 2002.05
Post: #6
isgoed Wrote:Would you share this information with us. It's nice for the other people who visit this thread afterwards.

No, I can't. But either way, the GetKeys code didn't make the transition from ISp to HID easy, it gave me an avenue to ignore both entirely.
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #7
If anyone's interested, I've got a C++ class hierarchy that (needing a little cleanup, though) correctly handles InputSprocket and HID, with fallbacks to GetKeys completely transparently. Sound off, and I'll pack it up for you.
Quote this message in a reply
isgoed
Unregistered
 
Post: #8
Fenris Wrote:If anyone's interested, I've got a C++ class hierarchy that (needing a little cleanup, though) correctly handles InputSprocket and HID, with fallbacks to GetKeys completely transparently. Sound off, and I'll pack it up for you.

Yeah, I am interested. That's why I started scanning these forums in the first place. Maybe you can post your code on the internet? I am specifically interested in having a nice user configuration interface and secondly to have dual mouse input (split screen game). Anyway, I sent you an email.
Quote this message in a reply
Moderator
Posts: 522
Joined: 2002.04
Post: #9
Fenris Wrote:If anyone's interested, I've got a C++ class hierarchy that (needing a little cleanup, though) correctly handles InputSprocket and HID, with fallbacks to GetKeys completely transparently. Sound off, and I'll pack it up for you.

That sounds awesome! Such a thing would be good for many many mac game devs and would at the very minimum benifit Inkubator quite a bit. (When it gets back in gear after uDG!)

If it wouldn't be too much of a pain, that'd be awesome if you released that.

-Jon
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #10
Fenris Wrote:If anyone's interested, I've got a C++ class hierarchy that (needing a little cleanup, though) correctly handles InputSprocket and HID, with fallbacks to GetKeys completely transparently. Sound off, and I'll pack it up for you.

I'd really like to see this too. Thanks!

Alex Diener
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #11
I looked at the code, and it is something of a mess. I'll do my very best to clean it up during the weekend. In the meantime, check out the HID Utilities sample code from Apple - that's where I learned it all. Look at the examples, and you'll be up and running with HID in no-time. Smile

Anyways, the code is up at http://www.rusted.se/hidstuff.zip

I know there are bugs in it, it doesn't work perfectly with all gamepads (which is a bit odd) but at least it's a starting point. There's a lot of hardcoded stuff, and it is not compileable. (Because of omitted source)

The source includes the following:
InputController.cpp/h - the classes for handling an input controller. You create a pointer of type BaseInputController (which is a singleton, by the way) and set it to point to an object of the type you want (GetKeys, Events, HID or ISp) - check out the header.
HIDDevice.cpp/h is just the stuff that encapsulates a HID device, of course.
HIDDialog.cpp/h is a configuration dialog in Carbon. It is written on top of the stuff in BaseDialog.cpp/h, which is a quite nifty way of doing Carbon dialogs, by the way. I've gotta run, but check it out! And do ask questions. Smile
Quote this message in a reply
isgoed
Unregistered
 
Post: #12
Fenris Wrote:I looked at the code, and it is something of a mess. I'll do my very best to clean it up during the weekend. In the meantime, check out the HID Utilities sample code from Apple - that's where I learned it all. Look at the examples, and you'll be up and running with HID in no-time. Smile

Anyways, the code is up at http://www.rusted.se/hidstuff.zip
Yeah I downloaded your code. It looks good. I still see that it is not usable yet. You don't provide the nib-file for the dialog and looking at the code I's say you were making a first person shooter since I found some hard coded controlls defined.

And the code you made is actually a wrapper for Inputsprocket so only usable on OS9 right? But this doesn't matter, since HID and getkeys combo will probably be better. I always found inputsprocket the hardest to configure (and drawsprocket the one that just wouldn't listen). Your code at least seems easier to use.

Anyway, I am coding in C myself. Is there any way to use C and C++ code side by side, without renaming al my c-files to cpp-files? (Compiling in C still provides faster code).
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #13
Quote:You don't provide the nib-file for the dialog and looking at the code I's say you were making a first person shooter since I found some hard coded controlls defined.
Oops. Forgot about the nib. I'll provide it when I get the time. Smile

Quote:And the code you made is actually a wrapper for Inputsprocket so only usable on OS9 right? But this doesn't matter, since HID and getkeys combo will probably be better.
Not really true. There are four complete classes in there (plus the base class) - one for GetKeys, one for Carbon Events, one for HID and one for InputSprocket. The InputSprocket class will not be compiled in if __MACH__ is defined, and HID won't be if it isn't. Thus, you'll have to build one version of the code for CFM and one for Mach-O, but that's mandatory anyway.

As for C and C++, yes, sure. Just put them into the same project. However, the file in which you use the classes must be a .cpp file.

I'll be back during the weekend.
Quote this message in a reply
isgoed
Unregistered
 
Post: #14
Fenris Wrote:Oops. Forgot about the nib. I'll provide it when I get the time. Smile
iDevGames went offline in the last week. Could you put that nib online? I would apreciate it. thanks.
Quote this message in a reply
⌘-R in Chief
Posts: 1,261
Joined: 2002.05
Post: #15
Finder always says the zip file is corrupted...
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  How to write a custom memory manager Malarkey 3 3,735 Oct 27, 2005 09:52 AM
Last Post: aqua_scummm
  Do you use HID Manager in your games? Andrew 10 4,996 Aug 14, 2005 01:00 PM
Last Post: wadesworld
  Bundles with Carbon File Manager... BinarySpike 2 3,271 Apr 25, 2005 03:36 PM
Last Post: BinarySpike