|
Post by laddspencer on Jun 26, 2008 2:26:35 GMT 1
Yep, pretty much the exact same code as you: void hidInterruptCallback(BtLibSocketEventType* sEvent, UInt32 refCon) { ...
if (sEvent->event == btLibSocketEventConnectedOutbound) { // Set LED pattern. UInt8 ledBuffer[] = {0x52, 0x11,0x90}; BtLibSocketSend(gBtLibRefNum, _controlSocket, (UInt8*)&ledBuffer, sizeof(ledBuffer)); // Set report mode to 0x31: core buttons + acceleration UInt8 modeBuffer[] = {0x52, 0x12, 0x00, 0x31}; BtLibSocketSend(gBtLibRefNum, _controlSocket, (UInt8*)&modeBuffer, sizeof(modeBuffer)); return; } }
Also, if you're interested in a struct like Icefire mentioned, I've got a few I've been using: struct WiiCoreButtons { union { struct { UInt8 reserved5 : 1; UInt8 reserved4 : 1; UInt8 reserved3 : 1; UInt8 plus : 1; UInt8 up : 1; UInt8 down : 1; UInt8 right : 1; UInt8 left : 1; } bits; UInt8 byte; } high;
union { struct { UInt8 home : 1; UInt8 reserved2 : 1; UInt8 reserved1 : 1; UInt8 minus : 1; UInt8 A : 1; UInt8 B : 1; UInt8 one : 1; UInt8 two : 1; } bits;
UInt8 byte; } low; };
struct WiiAccelerometer { UInt8 x; UInt8 y; UInt8 z; };
...assuming data is a pointer to an HID packet: WiiCoreButtons* buttons = (WiiCoreButtons*)(data + 2); WiiAccelerometer* accel = (WiiAccelerometer*)(data + 4);
|
|
|
Post by metaview on Jun 26, 2008 8:34:14 GMT 1
strange... I can not switch the data mode. I even wait for the SendComplete event from the LED setting before I send the command. It results: ErrPending, then ErrNone but it still reports 0x30. Weird. Also BtLibTest seems to crash on Treo 680 but not on TX when launched a second time, weird too.
About LJP: Don't know what I changed but now it stops working (it hangs) after some seconds if I enable Wiimote (might be because of too much event processing calls?)
|
|
|
Wiimote
Jun 26, 2008 15:54:00 GMT 1
Post by laddspencer on Jun 26, 2008 15:54:00 GMT 1
I'm not sure what the problem is. I've run into a few issues myself: - Sometimes the btLib gets into a bad state and it won't connect; I need to reset the palm.
- Sometimes I close the sockets but the Wiimote doesn't disconnect or turn off; I need to hold the power button on the Wiimote to force a disconnect.
- Printing accelerometer data overloads btLibTest (dozens of messages per second); I print one out of every ten packets and even then it's a lot.
|
|
|
Wiimote
Jun 26, 2008 18:36:05 GMT 1
Post by metaview on Jun 26, 2008 18:36:05 GMT 1
www.metaviewsoft.de/BtLibTester.zip that's my test. I can't get it to report accelerometer data. Maybe one of you could check it and tell me if it works for you. laddspencer: could you send me an example which prints acc. data? Maybe my wiimote is defect? Regards Henk
|
|
|
Wiimote
Jun 30, 2008 20:07:30 GMT 1
Post by aron1138 on Jun 30, 2008 20:07:30 GMT 1
I have a wiimote so I will test this when I get the chance. Keep up the good Work
|
|
|
Wiimote
Jun 30, 2008 21:32:53 GMT 1
Post by aron1138 on Jun 30, 2008 21:32:53 GMT 1
I don't really see the point unless it somehow slows down performance. You will just be configuring this like any other controller it's not just wiimote [ ] you set up ABXYLR up down etc in the input menu. So if you don't set an accelerometer movement as a button it won't do anything. (uh, I think)
|
|
|
Post by aron1138 on Jul 2, 2008 18:53:20 GMT 1
:/ yeah, but what I was thinking was if you don't assign the accelerometer as a control then it won't do anything.
|
|
|
Post by icefire on Jul 2, 2008 21:38:38 GMT 1
The events are still sent. however, your right that it could be an option.
|
|
|
Post by metaview on Jul 5, 2008 12:24:28 GMT 1
Any results about me test app?
|
|
|
Post by icefire on Jul 5, 2008 17:20:39 GMT 1
No Accelerometer for me
|
|
|
Post by metaview on Jul 5, 2008 19:43:18 GMT 1
ok, thank you. Then it seems to be my fault.
|
|
|
Wiimote
Jul 13, 2008 21:40:20 GMT 1
Post by luckyluke on Jul 13, 2008 21:40:20 GMT 1
Hi everybody, put out your Wiimote if you own one! I´m very happy and glad that I am able to present you a new version of LJP which can be controled with a Wiimote. First a little bit about me. You can skip it if you´re not interested in it. Well, I´m 18, live in Munich, Germany and I´ve written More Heap Hack (Some of you might know it) and some other stuff for Palm. I found LJP some years ago (when it was around RC2). I used it sometimes to play especially old Gameboy games, looked into this forum regularly and was very thankful for the hard work several people spent into this great project. Then few weeks ago I saw the Wiimote thread by laddspencer and got very excited. I read that a Yahm hack would be needed. Since developing MHH I know how to create Yahm hacks. So I contacted Metaview over ICQ and asked him some questions. He told me that the Wiimote stuff would slow things down. I suggested to move the Bluetooth callbacks from the 68k part to the ARM part and started researches about it. After one or two days I finished some working test code. Metaview then supported me much so that I was able to compile LJP and could start with ARMing the Bluetooth callbacks. Special thanks to Metaview! Though I had a problem = no Wiimote. Then Friday a week ago I finally decided to order one. It arrived at Monday. :-) I worked hard until Wednesday to solve several problems with Bluetooth in ARM. Unfortunately a speed improvment wasn´t there since the handlers aren´t called often. The expensive point is the still needed event loop. We have to live with that but all in all I think the speed is alright even in SNES. Wednesday the Wiimote stuff was still very unstable. I made it the last days much more stable and added use of the accelerometer. Before you all get to much excited I have to point out that this Wiimote stuff is beta stuff. Known issues are: - Crashes may still occur. - The buttons of the device choose form are black. (most left button is 'Ok', the middle button 'Cancel' and the most right 'Search again' if avaible) - Cancel the choose of a bluetooth device often leads to hang up. - Still much debug messages. (no blocking ones; Ignore them) - My joystick (use of accel.) function isn´t very well worked out yet. (I´ll add a calibration function but hadn´t the time for that yet. Also use of the accelerometer data has to be improved.) - The functions of the core buttons are hard coded. (You can´t map the Wiimote buttons; It isn´t really a problem I think.) I played some hours with this LJP version on my Palm GSM Centro SNES and Gameboy games with only one crash in a SNES game where I can´t really say that it was caused by the wiimote stuff. But you should save regularly! NES was just started one time with Wiimote connected. Wondersan (or how it´s called) hasn´t the Wiimote support since I didn´t got the module compiled. All WS lovers, please don´t kill me. Now finally here is the download link: lukas-grundmann.de1.cc/Stuff/LJP_1_2_wiimote.zipI hope that it will work for you and if Have fun! .... The YAHM hack is in work. The GUI is finished. I can already remap KeyCurrentState to KeyCurrentState, keydown event to keydown event and KeyCurrentState code to keydown event. The Wiimote stuff isn´t implemented yet. I hope that I´ll have soon some time and especially the mood to finish it. greetings Lukas
|
|
|
Post by icefire on Jul 14, 2008 0:13:06 GMT 1
luckyluke: NICE! Trying right now! If you want for the YAHM side of things, I quickly hacked up a 68k side WiiCurrentState(), don't know if it would help BTW, love your apps (especially MHH). Any news on the ARM to 68k to ARM resource converter?
|
|
|
Wiimote
Jul 14, 2008 15:23:58 GMT 1
Post by luckyluke on Jul 14, 2008 15:23:58 GMT 1
Awesome! Works Perfectly on my Zodiac!!! . . . almost. . . The only thing with it is a/: The device buttons still work, and I assume that this must slow it down somewhat. and b/: The buttons in the in-game menu are shaded out, I'll post a pic. if I can later. Happy to hear that overall it seems to work. I can add a function that disables the device buttons but it shouldn´t bring a significant speed improvement. The buttons in the in-game menu are shaded out? I´ve really no idea why this happens. It isn´t like this on my Centro. Maybe Metaview has an idea. I thought this crashes was fixed. Use as Joystick: The accelerometer isn´t used then this checkbox is disabled and it is used when the checkbox is selected. Doesn´t it work on Zire 72? On Zodiac? :-) Include a topic "Don´t ask for Roms in the Forum" It´s planned. The "joystick" function needs much improvements. It depends on my free time and as said on my mood how fast I´ll improve it. icefire: What is your WiiCurrentState doing? About Turmfalke (the converter): lukas-grundmann.de1.cc/Turmfalke/
|
|
|
Wiimote
Jul 14, 2008 17:44:14 GMT 1
Post by yussef on Jul 14, 2008 17:44:14 GMT 1
the wiimote function is great, no problems on a palm TX, just the bluetooth connection buttons that are black (Ok, Cancel), but who cares? the response time is perfect, and the games are perfectly playable with the wiimote the only thing almost everyone would ask is keymapping, but in a temporary solution, a hardcoded configuration for holding the wiimote horizontaly would be nice
just out of curiosity, will you release the source code?
|
|
|
Wiimote
Jul 14, 2008 17:49:29 GMT 1
Post by metaview on Jul 14, 2008 17:49:29 GMT 1
the buttons are black, because the UI-colors are defined in this way...
|
|
|
Wiimote
Jul 14, 2008 19:04:35 GMT 1
Post by luckyluke on Jul 14, 2008 19:04:35 GMT 1
the wiimote function is great, no problems on a palm TX, just the bluetooth connection buttons that are black (Ok, Cancel), but who cares? the response time is perfect, and the games are perfectly playable with the wiimote the only thing almost everyone would ask is keymapping, but in a temporary solution, a hardcoded configuration for holding the wiimote horizontaly would be nice just out of curiosity, will you release the source code? Well I´ll ask Metaview how to change the UI colors. I´m happy to hear that it works fine for you. I found that with holding the wiimote vertically it was similiar to a joystick. But I also understand if you don´t like it. Yes, the source code of the wiimote stuff in LJP will of course be published. But for now I don´t see the need.
|
|
|
Wiimote
Jul 14, 2008 19:33:46 GMT 1
Post by icefire on Jul 14, 2008 19:33:46 GMT 1
luckyluke: the WiiCurrentState is a function that is like KeyCurrentState. I made a sort of 68k wii library, but haven't gotten to finish the fake event part. BTW, while you have LJP compiling, mind making a version without the "stack use 10%", "unzip ok" messages and such?
|
|
borka
New Member
Posts: 6
|
Post by borka on Jul 15, 2008 8:50:08 GMT 1
luckyluke: Wow, super! Only seeing your work I understood that this _is_ the choice for LJP on Palm My 3 cents - about the keymapping. 1) I think that the horizontal position of the mote is better, because you can simultaneously work with d-pad (one hand) and 1-2 buttons (another hand). This is very useful in action games, even in action-rpg like zelda on snes, since you should move and hit/block simultaneously. Using mote a-b buttons, I think, is less convenient. For example, for nes, gb: horizontal position, d-pad to the right, 1-2 buttons: a/b, +/- - start/select for snes: horizontal position, d-pad to the right, 1-2 buttons: a/b, +/-: x/y (!!!), a/b: start/select Does it make sense? 2) Talking about mapping... what are current mappings, especially for snes? (x/y, select?) 3) Is it possible to turn off leds on the mote? It is brighter than the palm screen. And they really distract one's attention
|
|
|
Wiimote
Jul 15, 2008 17:48:26 GMT 1
Post by icefire on Jul 15, 2008 17:48:26 GMT 1
For me the wiimote keeps flashing the lights (but works). This should be easy to add, from what i know of the Wiimote code....
|
|
|
Wiimote
Jul 15, 2008 23:08:03 GMT 1
Post by luckyluke on Jul 15, 2008 23:08:03 GMT 1
Thank you all for your good feedback! :-) At the moment I´m working on the function to map the core buttons of the wiimote. I would say that the GUI for this is more than 50% ready. Then I´ll add settings to improve the use of the accelerometer. A quick fix of the UI color unfortunately failed but though I think Metaview or I can fix it. But it isn´t important enough in the moment. borka: 1) I completly understand your point! I´ll try to solve it as fast as possible. But everyone already worked on the LJP Launcher can only agree that it isn´t very easy source code, I think. I´m sure that I´ll be able to work in it easier with the time. But now at the beginning it´s sometimes confusing for me. 2) I´m sorry. But you´ve to try it out since I don´t understand the code at this point. It´s a routine I just taken from Metaviews early stuff which translates the wiimote button presses to virtual codes handled by the modules. I´ve not enough knowledge about this system. 3) It should be possible. icefire: I can add an option to disable the debug messages but I personally like them. I´ll obtain the wiimote codes in my YAHM hack in ARM. So 68k stuff isn´t very useful directly but maybe it inspires me. If you want please send the code to me. The LED don´t stop flashing? This isn´t well. Is the accelerometer used if you choose it in the configs?
|
|
|
Post by icefire on Jul 16, 2008 3:39:02 GMT 1
Same for me with accelerometer and box on the zodiac....
|
|
borka
New Member
Posts: 6
|
Post by borka on Jul 16, 2008 7:40:43 GMT 1
luckylukeIt is good, waiting for your update - yesterday about an hour playing zelda on snes with wiimote BTW, is it possible to use a nunchuck now? Especially its analog joystick and two extra buttons - it will come handy. If you need press/motion codes or like - may be some little program I can run and record them?
|
|
|
Post by metaview on Jul 16, 2008 7:54:27 GMT 1
The keymapping is the same for all systems:
Key on emulator: KEY_QUICKLOAD, KEY_QUICKSAVE, KEY_B, KEY_A, KEY_SELECT, 0, 0, KEY_START, KEY_LEFT, KEY_RIGHT, KEY_DOWN, KEY_UP, KEY_TURBO, 0, 0, 0;
Key on Wiimote: '2', '1', 'B', 'A','-', 0xFFFF, 0xFFFF,'h', 'l', 'r','d', 'u', '+',0xFFFF, 0xFFFF, 0xFFFF
I don't have my Wiimote right here but I guess 'h' is 'home'. Example: A on Wiimote maps to KEY_A on emulator.
About the LED flashing on Zod:
We might need to check if a btLibSocketEventSendComplete comes back and see what sEvent->status tells us. If there was an error, we should send it again. If it was successfully, we should then send the desired input config. BT is quite different between different devices therefore one should carefully folow the docs and not assume success or certain timings.
|
|
borka
New Member
Posts: 6
|
Post by borka on Jul 16, 2008 8:57:13 GMT 1
metaviewAnd what about X/Y keys on the emulator? They are very important too... BTW, can I help in mapping nunchuck keys? (It is an addon for the wiimote with analog stick, 2 buttons and another accelerometer).
|
|
|
Wiimote
Jul 16, 2008 12:00:31 GMT 1
Post by metaview on Jul 16, 2008 12:00:31 GMT 1
Where do you want to map the XY keys? The Wiimote doesn't has enough keys. Use the device keys for these.
|
|
borka
New Member
Posts: 6
|
Wiimote
Jul 16, 2008 14:17:50 GMT 1
Post by borka on Jul 16, 2008 14:17:50 GMT 1
metaviewI wrote this some posts above: for example - horizontal movement - d-pad (say, KEY_UP - l, KEY_DOWN - r, KEY_LEFT - d, KEY_RIGHT - u - horizontal position) - KEY_A - 2, KEY_B - 1 - KEY_X +, KEY_Y - - KEY_START A, KEY_SELECT B Because, quicksave/load, trubo are not needed on the joystick during the gameplay. And they should be on the device (IMHO). Strange d-pad assignment is due to the fact, that holding mote horizontally allows easier access to the action buttons - a/b/x/y. For example, in (legendary) zelda on snes, one use a for action, b for the sword, and y for the equipped item (say, boomerang). And they are used almost simultaneously (and while moving).
|
|
|
Wiimote
Jul 16, 2008 18:59:41 GMT 1
Post by luckyluke on Jul 16, 2008 18:59:41 GMT 1
Maping of the Core Buttons basically works now. :-) Unfortunately something is broken in SNES. Some codes the Wiimote handlers throw out aren´t interpreted right by the SNES module. I´ll look if I can fix it. Since it works normally for the hardware key code I´ll look what are the difference to mine.
In GB everything works as it should.
[EDIT:] Well, it seems to work now. The above bug was found. :-)
|
|
|
Wiimote
Jul 16, 2008 23:54:44 GMT 1
Post by icefire on Jul 16, 2008 23:54:44 GMT 1
Can't wait . PM me if you need more testing on zodiac (or do you have one?)
|
|
borka
New Member
Posts: 6
|
Post by borka on Aug 5, 2008 13:49:07 GMT 1
By any chance, is there a new build with the wiimote configuration?
|
|