Emulator - get latest release here.

The Uzebox now have a fully functional emulator! Download and discuss it here.
User avatar
uze6666
Site Admin
Posts: 4449
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Emulator - get latest release here.

Post by uze6666 » Wed Apr 07, 2010 4:05 pm

Thanks Paul! I have a XBOX360 PC joystick, so I'll give a try to see how it works.

-Uze

User avatar
paul
Posts: 457
Joined: Sat May 02, 2009 8:41 am
Location: Brisbane, Australia

Re: Emulator - get latest release here.

Post by paul » Thu Apr 08, 2010 12:11 am

Found an old Thrustmaster Firestorm laying around. It seems to work fine with it, but I'd advise mapping the dpad instead of the analog sticks for now.

User avatar
nebososo
Posts: 188
Joined: Sun Oct 04, 2009 10:33 pm
Location: Curitiba, Paraná, Brazil
Contact:

Re: Emulator - get latest release here.

Post by nebososo » Thu Apr 08, 2010 3:19 am

paul wrote:Just letting people know that the latest svn code adds tentative support for joysticks. I only have access to this joystick which I'm using with original snes controllers on Windows XP SP3. I don't know of Linux drivers for this adapter, so I didn't test it on Linux.

In case your joystick represents actions differently than mine, you can re-map the joystick bindings by pressing 7 and following the instructions printed to the console. These changes will be saved on exit and will load from that point on. You can reset to the default settings by re-mapping accordingly or by deleting the "joystick-settings" file. There's currently support for two joysticks (one for each player) which will be the first two connected to your computer as detected by SDL.

Hopefully we can eventually support all of the most common joysticks/gamepads.
I appreciate your work, but I tried two different generic PS1 controller clones and neither of them worked. When I pressed 7 to remap, I found out I have to press Start before it tells me to press start (and then press it again for it to detect it) and after I press UP, it won't tell me press down (only after I have already pressed it) and then when I try use it, Up doesn't work and it auto presses down.
I couldn't test my PS2 controller clone as I either broke it or forgot to recompile the modules last time I upgraded the kernel.

PS: They work very well with everything else.

Linux 2.6.33.1 64 bit

Edit: I'll test it with wiimotes and cwiid tomorrow to see if I have any luck.

User avatar
paul
Posts: 457
Joined: Sat May 02, 2009 8:41 am
Location: Brisbane, Australia

Re: Emulator - get latest release here.

Post by paul » Thu Apr 08, 2010 3:43 am

@Nebososo: Do you get a P1 joystick found message?

Both of the gamepads I tried have a button press event followed by a button release event. For axis (dpad) movement they have a similar mechanism where releasing returns to center idle (that's why the analog sticks won't map well with the current code).

If I add a configuration mode where I can log your controller's input and have you post it here, it should be possible to re-write the mapping code to support more controllers.

User avatar
nebososo
Posts: 188
Joined: Sun Oct 04, 2009 10:33 pm
Location: Curitiba, Paraná, Brazil
Contact:

Re: Emulator - get latest release here.

Post by nebososo » Thu Apr 08, 2010 4:06 pm

paul wrote:@Nebososo: Do you get a P1 joystick found message?

Both of the gamepads I tried have a button press event followed by a button release event. For axis (dpad) movement they have a similar mechanism where releasing returns to center idle (that's why the analog sticks won't map well with the current code).

If I add a configuration mode where I can log your controller's input and have you post it here, it should be possible to re-write the mapping code to support more controllers.

Yes, I do get the message :).

I use them all the time on other SDL applications (such as zsnes and sdlmame) and their code might also help you ;) .

jstest(or something like that) shows the following behavior: Axis are represented with 16 bit, 0 when idle, when I press Left it goes to -3767 and when I press right it goes to 3767(or values between those when I try the analog). Buttons are bools, 1 when pressed (or held), 0 when not. And I believe that every joystick I tested worked the same way on Linux... wiimotes, xbox 360 controllers and other generic ones.

I'd be glad to help. Just post it here or put on the svn and I'll do it tonight when I get home.

User avatar
paul
Posts: 457
Joined: Sat May 02, 2009 8:41 am
Location: Brisbane, Australia

Re: Emulator - get latest release here.

Post by paul » Fri Apr 09, 2010 4:32 am

I think the problem lies in me ignoring hat events. Turns out the Thrustmaster has a switch to enable/disable the analog sticks. When they're enabled, the dpad registers hat events; otherwise it registers axis events. I wouldn't mind betting your ps2 controllers register them as hat events all the time. I'll check out the mame code to see how they manage the analog sticks.
When I pressed 7 to remap, I found out I have to press Start before it tells me to press start
Unsure what you mean by this. Pressing 7 should message you to press start immediately. Can you clarify?

User avatar
nebososo
Posts: 188
Joined: Sun Oct 04, 2009 10:33 pm
Location: Curitiba, Paraná, Brazil
Contact:

Re: Emulator - get latest release here.

Post by nebososo » Fri Apr 09, 2010 3:35 pm

paul wrote:I think the problem lies in me ignoring hat events. Turns out the Thrustmaster has a switch to enable/disable the analog sticks. When they're enabled, the dpad registers hat events; otherwise it registers axis events. I wouldn't mind betting your ps2 controllers register them as hat events all the time. I'll check out the mame code to see how they manage the analog sticks.

Unsure what you mean by this. Pressing 7 should message you to press start immediately. Can you clarify?

The ps2 controller's works just like the Thrustmaster, axis when analog is disabled and, when enabled, hat events. And the ones without analog stick register them as axis events all the time, also... There's one that doesn't use axis 0 and 1 for the d-pad, but 2 and 3 (don't know why).

OK... When I press 7 nothing happens, but when I press start on the controller (after pressing 7, not all the time) I get the "press start" message, then I have to press start again to start mapping.

PS: Make sure you check SDLMAME, as mame itself doesn't have an SDL port. And SDLMAME's website is pretty weird it's just an old blog post kept up to date, in case you get confused like I did.

User avatar
paul
Posts: 457
Joined: Sat May 02, 2009 8:41 am
Location: Brisbane, Australia

Re: Emulator - get latest release here.

Post by paul » Wed Apr 14, 2010 9:23 pm

The most recent commit should fix joystick support for most users. It's been tested and is working on:

Linux:
- Mayflash SNES Controller Adapter for PC USB
- Thrustmaster FireStorm Dual Power 2&3 Gamepad
- DragonRise USB Gamepad (ps2 adapter?)
- USB Gamepad (ps1 adapter?)

Windows:
- Mayflash SNES Controller Adapter for PC USB
- Thrustmaster FireStorm Dual Power 2&3 Gamepad
- Xbox360 controller for Windows

Linux issues:
Nebososo has had mixed success with his PS controllers in linux. After adding stream flushes to stdout I am not getting delayed console messages under Ubuntu 9.10, so I can't comment further on that issue.

See the makefile if your analog inputs aren't registering. I have introduced an artificial deadzone to prevent spurious movement on analog inputs. This is set to -DJOY_ANALOG_DEADZONE=8192. If for some strange reason your input lies fully within this deadzone, your analog sticks won't register. The only problem I have had with this is for a broken analog stick. We can add deadzone calibration to the mapping phase if this becomes an issue.
Last edited by paul on Sat Apr 17, 2010 4:34 am, edited 1 time in total.

User avatar
nebososo
Posts: 188
Joined: Sun Oct 04, 2009 10:33 pm
Location: Curitiba, Paraná, Brazil
Contact:

Re: Emulator - get latest release here.

Post by nebososo » Thu Apr 15, 2010 1:36 am

paul wrote: Nebososo has had mixed success with his PS controllers in linux. After adding stream flushes to stdout I am not getting delayed console messages under Ubuntu 9.10, so I can't comment further on that issue.
Awesome, paul. Not delaying anymore and I can now use all my gamepads, including the ps2 clone that wasn't working.
If you want to add to your list. The ps2 clone is a DragonRise USB Gamepad (even has its own kernel module) and the ps1 clones are just generic. 2 of them are detected as "USB Gamepad" and one of them is detected as "Generic USB Gamepad".

User avatar
D3thAdd3r
Posts: 2422
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Emulator - get latest release here.

Post by D3thAdd3r » Sat Apr 17, 2010 1:48 am

Sweet, this is will make the emulator actually practical for multiplayer! Very much needed, nicely done Paul. Any chance of an updated pre-built for us lazy types?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest