JoyWIP v0.0

Announce (tech) demos or games releases

Moderator: Mask of Destiny

KanedaFr
Administrateur
Posts: 1139
Joined: Tue Aug 29, 2006 10:56 am
Contact:

JoyWIP v0.0

Post by KanedaFr » Wed May 09, 2012 10:20 pm

Hi all,

1 year ago, I put on hold this this Multitap - IO Sample redux demo.
It was a projet to add support for a lot of input device on SGDK.

I was unable to valid support on real genny (again this SMD problem) and never finished gun support.
I received my pink justifier but failed to find a cheap menacer.

Actually, it (should) supports
3 buttons
6 buttons
mouse
EAWay
Team Player (standard and extra mode)
it should also be able to identify a menacer

Code is based on Charles' doc, Chilly Willy's posts, Multitap - IO Sample analysis and (a lot of) games disassembling


Since it's now wanted features, I think some of you could try it and tell if it works or not.

If yes, Stef will be able to add this on a next version of sgdk, perhaps including this demo source code as sample

http://gendev.spritesmind.net/files/md/joyWIP_00.zip

thanks for feedback

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Thu May 10, 2012 8:32 am

Thanks Kaneda for your post, indeed it's time to add more controllers support to SGDK since a lot of people want it ;)
As i told you Chilly Willy send me a complete package containing these additions but i wanted to make the code a bit more "SGDK compliant". Chilly Willy's code use a lot assembly and i really want to avoid it when this is possible :) SGDK sources should be easy to maintain and easy to understand so people can learn from it.
Also this is an occasion to discuss about the structure, mouse support requires fetch of X/Y analog position.
I will read and analyze both code and see how to get the best of them ;)
Of course i will report my progress, interrogation... here.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Fri May 11, 2012 4:00 am

Well, I tried it on my Model 2 Genesis with a Team Player and a few different controllers...

One 6 button pad works fine in either port. Two 6 buttons pads don't work at the same time - the second pad shows garbage.

One six button pad and one mouse - the pad works fine, but the mouse doesn't work at all - it is identified, but returns nothing.

Team Player doesn't work as multi-tap - regardless of the combination of controllers hooked to the TP, all ports show random controller types and garbage for inputs.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Fri May 11, 2012 8:56 am

Thanks Chilly Willy for the test.
As you have the different peripherals i guess the code you sent me was tested and functional :)
I think I'll use a mix of the 2 codes for SGDK.
I hope to find sometime to do that soon, so i will probably post some piece of code and maybe questions here.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Fri May 11, 2012 4:37 pm

Stef wrote:Thanks Chilly Willy for the test.
As you have the different peripherals i guess the code you sent me was tested and functional :)
Actually, the TP code wasn't. :lol: I've tested all my other controller code, both in emulators and real hardware.

I've been meaning to work on the TP support, but never got around to it. I was thinking of working on that this weekend after seeing this demo.
I think I'll use a mix of the 2 codes for SGDK.
I hope to find sometime to do that soon, so i will probably post some piece of code and maybe questions here.


I was thinking that while I worked out any issues with TP support, I'd go ahead and switch over to C and make those changes to my controller support that you suggested.

KanedaFr
Administrateur
Posts: 1139
Joined: Tue Aug 29, 2006 10:56 am
Contact:

Post by KanedaFr » Fri May 11, 2012 5:32 pm

sh.....

I worked so much on this code.... :(
They way I did it was the only one working on Fusion so perhaps it's not a cool one...

From what I learnt, read TL then TH wasn't working everytimes (especially for the TeamPlay).
I found reading TH then TL worked better...but it seems not on real hw :(

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sat May 12, 2012 3:34 am

KanedaFr wrote:sh.....

I worked so much on this code.... :(
They way I did it was the only one working on Fusion so perhaps it's not a cool one...

From what I learnt, read TL then TH wasn't working everytimes (especially for the TeamPlay).
I found reading TH then TL worked better...but it seems not on real hw :(
Yeah, emulators don't give you a feel for real hardware. I test my controller code on Gens/GS, Fusion, and three different Genesis consoles (a Model 2, a CDX, and a Nomad).

Gens doesn't emulate the mouse at all that I can see... it has 3 and 6 button pads, along with the multitaps, but no mouse. While Fusion has a mouse setting, I've never gotten it to work with anything - neither games nor homebrew. All my mouse testing is therefore on real hardware.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sat May 12, 2012 6:52 am

Okay! Here's something to try - this is an update to sgdk (current version) that gives support for 3 button, 6 button, mouse, and the Sega Tap (Team Play). You can have up to 8 controllers with any controller at any of the positions. I've tested this on real hardware with just pads, just a mouse, a pad and a mouse, a tap (in both ports), and a pad and a tap. I've put controllers in all the tap ports and tried it in both Genesis ports. Everything seems fine.

This also works in Fusion! I get a working mouse... but only when the mouse is enabled at port 2 and without a tap... Fusion doesn't seem to support the mouse through the tap. This also works with Gens.

The controller code is in C now. It's not quite as efficient as assembly, but it's certainly easier to see what's going on! I think I did a decent job of commenting the code, as well. The 3 and 6 button pads use a common subroutine for reading the ports, and the mouse and tap use a common subroutine for reading the ports.

I've added two new functions:

JOY_readJoypadX(joy)
JOY_readJoypadY(joy)

These read the x and y axes of the selected joypad... of course, only a mouse currently affects the x and y axes - everything else will just always return 0. The mouse handling also sets UDLR so that the mouse can be used with the regular JOY_readJoypad() function like a pad. It will look just like a 3 button pad unless you read the x and y axes.

http://www.mediafire.com/?07601wmpv6d4883

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sat May 12, 2012 8:48 pm

I managed to get Lethal Enforcers I and II along with both the blue and red guns off ebay, so when they come in, I'll add Justifier support to my joy code.
:D

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Sun May 13, 2012 5:52 pm

Thanks a ton for your work Chilly Willy :)
You indeed made all modifications i wanted to do to the previous code, so far it looks very good =)
I would like to see Kaneda's code too but for sure the next SGDK version will have far better controllers support, thanks you guys :)

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sun May 13, 2012 7:04 pm

One thing I was considering - do we want to add optional support for other kinds of controllers? For example, I could easily add code that would allow you to use 2 button SMS pads, or the SMS trackball controller. This wouldn't be automatic like the current controllers, but something you'd activate by calling JOY_setSupport(port, JOY_SUPPORT_PAD2) or JOY_setSupport(port, JOY_SUPPORT_TRACKBALL).

I'm sure there are probably other controllers that could have support added in a similar manner, but would it be worth it? I don't think any emulators would support this, but I could see someone using an SMS trackball on a real Genesis if a game supported it. By the way, the SMS trackball is read in a manner VERY similar to the 6 button controller.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Mon May 14, 2012 8:25 am

As you said, does it worth it ? If it can be done "for free" or almost why not.. but if it requires coding and testing time we should not worry about these controllers, emulators probably don't support them in genesis mode and even for game i don't see the point of using SMS gamepad instead of traditional 3 buttons genesis one, the trackball indeed could be useful :)

KanedaFr
Administrateur
Posts: 1139
Joined: Tue Aug 29, 2006 10:56 am
Contact:

Post by KanedaFr » Mon May 14, 2012 10:37 pm

Stef asked for it so here the source of my joyWIP (not working)

http://gendev.spritesmind.net/files/md/ ... 00_src.zip

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Mon May 14, 2012 10:39 pm

Yeah, the two button is pretty much a waste, but the trackball could be very useful since the only thing close is the mouse. While a trackball game can be played with a mouse, I've heard nothing but complaints from folks when a trackball is replaced by a mouse. I guess I'll work on that after the Justifier support. I'm already working on the code... I can test/debug it when the guns come in sometime this week.

KanedaFr
Administrateur
Posts: 1139
Joined: Tue Aug 29, 2006 10:56 am
Contact:

Post by KanedaFr » Wed May 16, 2012 9:02 am

when you say trackball, do you mean the mouse with reverted Y ?
I know the Y is different from US/EUR & JAP.....

Post Reply