Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mouse emulation not working. #42

Open
GoogleCodeExporter opened this issue Mar 13, 2015 · 3 comments
Open

Mouse emulation not working. #42

GoogleCodeExporter opened this issue Mar 13, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Download and install Aleph WOne application (Wii port of Aleph One engine) 
on Wii's SD card : http://code.google.com/p/aleph-wone/downloads/list
3. Download one of the game files from official web site and put them in the 
AlephOne folder at SD's root (I tried with Marathon 2 game files) : 
http://marathon.sourceforge.net/
4. Launch the game and wait to reach the main menu (do not care about broken 
music)
5. Try to move the mouse cursor using a Wiimote


What is the expected output? What do you see instead?

I expected the mouse to be emulated using Wiimote's IR sensor.
Instead nothing moves, the wiimote has no effect, but if I wire a real mouse to 
the Wii, it works.



Please provide any additional information below :

I'm in the process of porting Aleph One engine to the Wii using sdl-wii. I 
reached the point where you can launch the game and even play if you use real 
keyboard and mouse.
I now would like to add wiimote support as a pointing device.
Looking (quickly) at uae emulator and at the "Updates" page here, it seems 
nothing special should be done to achieve this, but I think I missed 
something...

Original issue reported on code.google.com by mathieu...@gmail.com on 30 Aug 2011 at 10:59

@GoogleCodeExporter
Copy link
Author

I was able to get the Wiimote to act like a mouse in SDL, although I'm only 
using it for positional information and not button states (I'm using the 
wiimote as a joystick for those).

Did you try any of the following:
- Add SDL_INIT_JOYSTICK to your SDL_Init() call?
- Call SDL_JoystickOpen(0)?
- If handling the mouse via events instead of polling, have you tried calling 
SDL_JoystickEventState(SDL_ENABLE)?

I'm doing all of those.

Original comment by benshadw...@gmail.com on 17 Sep 2011 at 3:02

@GoogleCodeExporter
Copy link
Author

I think that if you do not use SDL_JoystickEventState(SDL_ENABLE), you should 
use SDL_joystickUpdate to cyclically update the wiimote state.

The WPAD_ScanPads function, which updates the wiimote data (also IR), is called 
only by SDL_joystickUpdate or cyclically by the SDL event management after 
SDL_JoystickEventState(SDL_ENABLE) so you must use one of them to update IR 
data.

The function PumpEvents in SDL_wiievents.c, which pumps the SDL events and 
reads the keyboard, the real mouse and emulates a mouse with the wiimote, does 
not call WPAD_ScanPads (or better PAD_ReadPending(0, NULL)).  Therefore the IR 
position is not updated.

This could cause some problems in some SDL applications. 

I think this is the reason why in wii-uae the mouse emulation is jerky. 

Wii-uae does not use SDL_JoystickEventState(SDL_ENABLE) but instead uses 
SDL_joystickUpdate to read the Joystick status and therefore the emulated mouse 
can stop working if wii-uae does read the joysticks status.

I am trying to find the best solution to solve this problem.


Original comment by olimpier...@gmail.com on 1 Oct 2011 at 9:40

@GoogleCodeExporter
Copy link
Author

The game engine I'm porting (Aleph one) does call the following function :

void enter_joystick(void) {
    SDL_JoystickEventState(SDL_ENABLE);
    joystick = joystick ? joystick :
SDL_JoystickOpen(input_preferences->joystick_id);
    return;
}

I still did not check if joystick_id is 0 or not.
Since I have a lot of trouble debugging the application (no way for me to
use gdb with the wii, and the game does not start with Dolphin), I can only
start working on it when I know I have at least a couple of hours of free
time, what does not happen so often :( !

I started to implement a remote logger so that at least I can see what
happens, but I'll have to revamp it in order for it to be mergeable with
main project's trunk so it will not be in the near days. May be in a couple
of week or so...


Anyway, thanks for your help, it is very appreciated !
Mathieu

Original comment by mathieu...@gmail.com on 5 Oct 2011 at 8:27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant