|
Post by laddspencer on Jun 5, 2008 13:04:17 GMT 1
Hey everyone. I stumbled upon this forum yesterday and I'm glad to see that there are a few people interested in using a Wiimote with LJP (or other Palm apps in general). I'd previously scoured the web to see if anyone has even attempted this but couldn't even find a page containing the words "Wii" and "Palm" together! A few months ago I picked up a Wiimote and downloaded the Garnet Developer Suite; I was determined to make this happen.
I don't know how far along anyone else is with this, but I can't find anything indicating that "hey, it works, here's the source"...so if it's been done, ignore this:
Two nights ago, I got it working. Right now it's primitive and I have to refactor it into a nice interface, but my 755p connects to the Wiimote, sets some of the blue LEDs on or off (they just keep blinking otherwise), and begins reporting button presses. It should be trivial to add accelerometer and IR camera support soon as well.
Note: I did see a post by metaview alluding to the fact that LJP won't work with a general bluetooth input driver, so I'm guessing I can't just generate fake keyboard events when a Wii button is pressed (I'm guessing LJP polls the hardware directly?). Regardless, this is a step closer!
|
|
|
Post by _Em on Jun 5, 2008 16:58:29 GMT 1
Good job! I'd suggest coordinating with Metaview as he's the resident input device guru (IIRC, that's what originally got him working on LJP). If you have all the details, he should be able to integrate the device into LJP without too much difficulty based on your data -- he added my IR keyboard anyway, as well as the BT gamepad.
|
|
|
Post by metaview on Jun 5, 2008 19:55:44 GMT 1
Wiimote: is it using serial BT? I guess we could then just poll the buttons? That's the way it works with the BT gamepad: in each frame check the gamepad for any button pressed.
|
|
|
Post by laddspencer on Jun 5, 2008 20:11:13 GMT 1
I'm using the btLibSocket*() functions: www.access-company.com/developers/documents/docs/palmos/PalmOSReference/BtLibRef_Sockets.html...it's pretty simple actually. You make an ACL connection first and get the bt address for the device. Then you create two sockets, one for each HID channel (control and interrupt channels) and connect to them in the proper order. After that, data starts flowing in (i.e. events are generated) when you press the Wiimote buttons. I'll be glad to provide you with anything else to help get it incorporated into LJP.
|
|
|
Post by metaview on Jun 5, 2008 20:28:16 GMT 1
Cool, where do you know about this HID-stuff? Do you have some example code? You get your BtLibSocketCallback called when ever something comes in? If this still works with the LJP-event loop running, we could define a shared memory block and set flags according to the pressed buttons.
|
|
|
Post by _Em on Jun 5, 2008 20:54:57 GMT 1
We could also possibly do the holy grail of supporting HID-generic in LJP
|
|
|
Post by samphex on Jun 5, 2008 22:01:50 GMT 1
Oh my GAWD. My dream has come true! Now I just gotta get a wiimote!
|
|
|
Post by countbuggula on Jun 5, 2008 22:13:11 GMT 1
I happen to actually own my own Wii!
<does a little happy dance>
This has been the best introductory thread I've ever seen here. To be honest, when I first started reading I thought it was another person showing up and asking if we could get wiimote support for LJP without actually searching and finding how often it's been asked before. laddspencer, I salute you. And welcome to the forums.
|
|
|
Post by samphex on Jun 5, 2008 23:38:46 GMT 1
laddspencer, I salute you. And welcome to the forums. I too. ;D
|
|
|
Post by laddspencer on Jun 6, 2008 0:26:14 GMT 1
Glad I'm getting such a good response to this, thanks everyone ;D ...where do you know about this HID-stuff? Do you have some example code? These have been my two main sources of information: I can give you my demo source. It's probably best if I clean it up first though; it's based on the Garnet example source (BtLibTest) and has about 2000 lines of junk code that should be stripped away. You get your BtLibSocketCallback called when ever something comes in? If this still works with the LJP-event loop running, we could define a shared memory block and set flags according to the pressed buttons. That's correct, the callback gives you a buffer containing the HID packet. It's fairly simple to parse. I was hoping LJP relied on keypress events, then I assumed I could just generate keypress events and the system would propagate them to you (LJP wouldn't need any modification). I'd rather do that than have tight coupling between our code (but if we need to use shared mem, so be it). We could also possibly do the holy grail of supporting HID-generic in LJP I'm all for that, but I will add that Wiimotes apparently don't follow the HID spec to the letter, so I imagine we'd have one HID driver for conforming devices, and some special code on the side for handling Wiimotes. I just made a video to demo this for you guys; let me know what you think: www.youtube.com/watch?v=98xa2EuDknw
|
|
|
Post by samphex on Jun 6, 2008 1:58:32 GMT 1
Wow. The video itself is making me excited.
I commented on it.
Here it is if you want to see it.
sjsamphex (48 seconds ago)
My god. You rock. You know this does not only have to be for ljp? It could even be for other games, like BOD or PALM MAME, or DOS Box....etc. etc.
|
|
|
Post by icefire on Jun 6, 2008 2:31:58 GMT 1
Now THIS is cool! I come back and my dreams are coming true!
|
|
natepless
Junior Member
SHAQ-FU BABY!!!!!!!!!!!!!!!!!!!!!!
Posts: 74
|
Post by natepless on Jun 6, 2008 5:14:13 GMT 1
Wow awesome, this is the most interesting thing ive heard all year, if you get this working yoru a god!!!
|
|
|
Post by vilmos on Jun 6, 2008 22:17:43 GMT 1
You ba$tard! I'm going to have to go back and do more PalmMame coding! ;D
Palm games generally don't use events at all for control as they arer mind bogglingly slow.
SharedMem is likely the way to go, just fill a struct and then flip to ARM and read it.
|
|
|
Post by icefire on Jun 7, 2008 0:38:32 GMT 1
You could also possibly write a YAHM hack and when you enter an app, it maps the wiimote buttons to hardware buttons (by patching KeyCurrentState?). Then Vilmos doesn't have to code ; but it would take a LOT more work if it is possible, and you would need a per-app config screen and such.
|
|
|
Post by metaview on Jun 7, 2008 8:07:45 GMT 1
Patching KeyCurrentstate would be a good idea. Who is goind to do it?
|
|
|
Post by samphex on Jun 7, 2008 13:08:59 GMT 1
Patching KeyCurrentstate would be a good idea. Who is goind to do it? Hmmm... If only we had ome certified pam software developers on this forums... ....(HINT!)
|
|
|
Post by Tinnus on Jun 7, 2008 15:38:37 GMT 1
I don't think patching KeyCurrentState is that good of an idea since it only returns a 32bit mask that has most of its bits reserved for something already... unless we don't care about "A" and "Home" trigerring the same bit for instance, which is a possibility since it's not very normal to play with the Wiimote PLUS device buttons ;D
|
|
|
Post by icefire on Jun 7, 2008 16:30:50 GMT 1
@coder12: If I finished compiling my first YAHM hack, you'd see quite a few coming out of me... Tinnus: I meant for other apps (not LJP), where the dev doesn't want to add in wiimote code (such as Vilmos : .
|
|
|
Post by laddspencer on Jun 8, 2008 22:08:09 GMT 1
For those of you with Wiimotes who would like to try the test app, I posted the latest version here: www.mediafire.com/?hmziaj1jyzgAs soon as it starts, push 1 & 2 on the Wiimote (or the red button next to the batteries) and select it from the list of devices on your Palm. It should connect and you should be able to see button events.
|
|
|
Post by icefire on Jun 8, 2008 22:14:20 GMT 1
Source?
|
|
|
Post by laddspencer on Jun 9, 2008 12:29:40 GMT 1
It is Wii specific, so it won't work with any other HID device right now. As I mentioned in a previous post, Nintendo has taken liberties with their implementation of HID. From WiiBrew: ...the Wiimote does not make use of the standard data types and HID descriptor, and only describes its report format length, leaving the actual contents undefined, which makes it useless with standard HID drivers. Metaview has the source; I assume he will patch it into the next LJP release.
|
|
|
Post by vilmos on Jun 9, 2008 15:26:24 GMT 1
I would like to see the source as well since PalmMAME goes about keyhandling in a completely opposite way from LJP so using the LJP code is usually painful.
Can you post a link, or email it to support at pocketdimension dot com
BTW: This looks like an excellent excuse to buy a Wii... ;D
|
|
|
Post by _Em on Jun 9, 2008 15:51:44 GMT 1
You could probably just pick up a wiimote on eBay
|
|
|
Post by icefire on Jun 9, 2008 16:34:37 GMT 1
Could you also email it to
|
|
|
Post by samphex on Jun 9, 2008 17:04:48 GMT 1
Wow, if the new version of LJP gets the Wiimote code + my Hi-res graphics + icefire's new beltbar skin this is going to be BIG!!! [edit]: I think that I know what I want for my birthday now! ;D It truly is going to be huge lmao... This stuff should also be in ljx.
|
|
|
Post by _Em on Jun 9, 2008 17:45:45 GMT 1
Heh... now somebody has to find a way to handle the wiimote's other input methods on a Palm
|
|
|
Post by vilmos on Jun 9, 2008 23:54:03 GMT 1
You could probably just pick up a wiimote on eBay I think you missed the point.
|
|
|
Post by icefire on Jun 10, 2008 1:06:01 GMT 1
BTW, i should send that skin soon, i keep forgetting and don't even know where it put it...probably (almost postive) like this : Desktop/stuff/old stuff/zodiac stuff/too many icons/not programs/skins and games/skins/by me/ljp/source/rsc/images/beltbar.bmp Seriously, I REALLY need to clean my desktop
|
|
|
Post by samphex on Jun 10, 2008 3:26:21 GMT 1
BTW, i should send that skin soon, i keep forgetting and don't even know where it put it...probably (almost postive) like this : Desktop/stuff/old stuff/zodiac stuff/too many icons/not programs/skins and games/skins/by me/ljp/source/rsc/images/beltbar.bmp Seriously, I REALLY need to clean my desktop Partition you hard drive with "C" and "media" All my stuff that aren't progrms or are just data goes in media. My media is chock full with data, images, and videos
|
|