Oolite Bulletins Forum Index Oolite Bulletins
For information and discussion about Oolite.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Gamepad support, building with SDK 10.5
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Oolite Bulletins Forum Index -> Oolite-Mac
View previous topic :: View next topic  

What OS X version are you running Oolite on?
OS X 10.4
28%
 28%  [ 2 ]
OS X 10.5
71%
 71%  [ 5 ]
Total Votes : 7

Author Message
maik
---- E L I T E ----
---- E L I T E ----


Joined: 10 Mar 2010
Posts: 294
Location: Rheingau, Germany (rich agricultural, feudal, tech level 6)

PostPosted: Sun Mar 28, 2010 10:04 am    Post subject: Gamepad support, building with SDK 10.5 Reply with quote

I'm trying to hack gamepad support into Oolite using the HIDManager classes that are available as of OS X 10.5. For that I set the base SDK to 10.5 but now I receive a lot of errors complaining about
- conflicting types for uint64
- static declarations of class_getInstanceSize follow non-static declarations
- instance_size being deprecated

Does someone have experience with targeting 10.5 and already solved these issues?

Cheers,
-Maik
Back to top
View user's profile Send private message
Cmdr James
Commodore
Commodore


Joined: 05 Jun 2007
Posts: 1114

PostPosted: Sun Mar 28, 2010 10:11 am    Post subject: Reply with quote

I had similar problems, and so I always target an earlier version. I suspect that the problem is that snow leopard has 64bit ints, but I am not certain.
Back to top
View user's profile Send private message AIM Address
maik
---- E L I T E ----
---- E L I T E ----


Joined: 10 Mar 2010
Posts: 294
Location: Rheingau, Germany (rich agricultural, feudal, tech level 6)

PostPosted: Sun Mar 28, 2010 10:31 am    Post subject: Reply with quote

Only Snow Leopard (10.6) or Leopard (10.5) as well? I'm targeting the latter.
Back to top
View user's profile Send private message
maik
---- E L I T E ----
---- E L I T E ----


Joined: 10 Mar 2010
Posts: 294
Location: Rheingau, Germany (rich agricultural, feudal, tech level 6)

PostPosted: Sun Mar 28, 2010 5:43 pm    Post subject: Reply with quote

OK, I solved the build problems targeting 10.5.

I also fleshed out the JoystickHandler class in the Mac-specific folder to the point where I can play using my XBOX360 gamepad--great fun :)

My modifications are against the current trunk revision. Current button and axis mappings are hard coded, unfortunately I didn't manage to bring up the joystick mapping configuration view.

What is the preferred way of submitting a patch set so that others can play around with it? As I have no experience in multi-platform development there might be compile problems somewhere else now although I have been careful, so I'd very much like feedback on this.

Cheers,
-Maik
Back to top
View user's profile Send private message
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral


Joined: 28 Feb 2007
Posts: 2294

PostPosted: Mon Mar 29, 2010 8:30 am    Post subject: Reply with quote

maik wrote:
What is the preferred way of submitting a patch set so that others can play around with it? As I have no experience in multi-platform development there might be compile problems somewhere else now although I have been careful, so I'd very much like feedback on this.


You can email it to me (check email button below for details) and I can forward it as required. You can also put it up on pastebin and give us the link. There is no preferred way, just whatever suits you best. If it is a short patch, you could even consider posting it here.
Back to top
View user's profile Send private message
maik
---- E L I T E ----
---- E L I T E ----


Joined: 10 Mar 2010
Posts: 294
Location: Rheingau, Germany (rich agricultural, feudal, tech level 6)

PostPosted: Mon Mar 29, 2010 9:40 am    Post subject: Reply with quote

OK, here are the pastebin links:

The new JoystickHandler replaces the existing skeleton in Source/Mac-specific in the XCode project. It depends on the HIDManager that has been introduced with OS X 10.5 Leopard:

JoystcikHandler.h: http://pastebin.com/8pX7AmKu
JoystickHandler.m: http://pastebin.com/9tBhepCS

To allow targeting the Leopard SDK, three definitions have to be changed. Anyone with non-Leopard systems please report if they break anything:

In Universe.m (around line 198), and in Entity.m (around line 49) add the highlighted lines from http://pastebin.com/5CVs8RKB (line numbers based on SVN revision 3083).

In deps/Cross-platform-deps/SpiderMonkey/js/src/jsotypes.h (around line 69) add the highlighted lines from http://pastebin.com/CW6jjDBW (line number based on SVN revision 3083).

In the build configuration for Oolite, change all occurrences of SDK 10.4 to SDK 10.5 and add the IOKit framework as a linked library.

These modifications allow you to compile for OS X 10.5.

What do you get:
- A Joystick handler that has hardcoded values for using an Xbox 360 gamepad with Oolite.

Additional software you need if you want to use this particular gamepad:
- the Xbox 360 Controller Driver from http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller

Bugs:
- When I run Oolite by starting it from within Xcode, everything works fine. When I run it directly from the Finder, the first gamepad action crashes Oolite. Am investigating but happy for any help.

Irks/Annoyances:
- I have not been able to make the joystick configuration option appear in the game options so far. Does someone else know what I have to do here?
- I created a rather large dead zone for the gamepad (using 0.15 instead of 0.05) which works well, but I have not found a good setting (for sensitivity? somewhere else?) yet which allows me to make very small adjustments to perfectly target these pixel-sized pirates. It's not bad as it stands but improvement would be nice.

Comments, questions, suggestions, and further bug reports are highly welcome.

Cheers,
-Maik
Back to top
View user's profile Send private message
maik
---- E L I T E ----
---- E L I T E ----


Joined: 10 Mar 2010
Posts: 294
Location: Rheingau, Germany (rich agricultural, feudal, tech level 6)

PostPosted: Wed Mar 31, 2010 11:03 am    Post subject: Reply with quote

Quote:
A Joystick handler that has hardcoded values for using an Xbox 360 gamepad with Oolite.


Note that other gamepads should work fine as well and won't require the Xbox360 driver, maybe the button mappings will be messed up as I only tested with the Xbox360 gamepad.

Quote:
I have not been able to make the joystick configuration option appear in the game options so far. Does someone else know what I have to do here?


The config option does show up now, I missed one #ifdef and had to include the mapper entity files in the Oolite target. However, the config screen is very tightly linked to SDL joystick handling. It registers callbacks using methods that aren't even defined in JoystickHandler.h. I hope I will be able to keep the changes somewhat contained and in the end really get a config screen...
Back to top
View user's profile Send private message
Ahruman
Supreme Grand Admiral
Supreme Grand Admiral


Joined: 02 Apr 2005
Posts: 5677
Location: Sweden

PostPosted: Fri Apr 02, 2010 3:22 pm    Post subject: Reply with quote

I’ve started a branch for this:
Code:
svn checkout svn://svn.berlios.de/oolite-linux/branches/mac-joystick

It puts the joystick code in a loadable bundle, so the game continues to work with 10.4 (without joystick support). It also matches joysticks as well as game pads.

Todo:
  • Obviously, it needs to be configurable, and able to match saved configurations to the right device.
  • Currently it’s possible to freeze the game completely by wiggling the stick fast. This is because the input events are dispatched on the main event loop and swamp it, so timers don’t fire. This can be fixed by using a separate thread.
If you want to work on this, and have a BerliOS account, I’ll give you checkin access.

Edit: Redefining OOLITE_HAVE_JOYSTICK to 1 in OOCocoa.h in the branch will now attempt to compile in stick config screen support, but generate a bunch missing method errors. It’s likely the interface between PlayerEntityStickMapping and JoystickHandler needs to be made more abstract to deal with conceptual differences between SDL and IOKit.
_________________
E-mail: ahruman@oolite.org
Twitter: Oolite
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
maik
---- E L I T E ----
---- E L I T E ----


Joined: 10 Mar 2010
Posts: 294
Location: Rheingau, Germany (rich agricultural, feudal, tech level 6)

PostPosted: Tue Apr 06, 2010 9:23 am    Post subject: Reply with quote

Cool, thanks. I just created an account on Berlios: maikschulz
Back to top
View user's profile Send private message
Ahruman
Supreme Grand Admiral
Supreme Grand Admiral


Joined: 02 Apr 2005
Posts: 5677
Location: Sweden

PostPosted: Wed Apr 07, 2010 7:57 pm    Post subject: Reply with quote

OK, you should now be able to commit if you check out over svn+ssh as per http://developer.berlios.de/svn/?group_id=3577.
_________________
E-mail: ahruman@oolite.org
Twitter: Oolite
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
mark_au
Poor
Poor


Joined: 25 Oct 2007
Posts: 7

PostPosted: Thu Apr 22, 2010 10:08 am    Post subject: Reply with quote

Awesome news on a much needed feature. I have been hanging out to play oolite again. I haven't bothered since i migrated to mac due to the lack of configurable joystick support. Ive tried controller mate but with little success
good work guys
_________________
Mark W
Unix - where commands look like line noise
Back to top
View user's profile Send private message
RobFord75
Harmless
Harmless


Joined: 28 Jul 2010
Posts: 1

PostPosted: Wed Jul 28, 2010 10:20 pm    Post subject: Reply with quote

Hello All

First post here, I did play Oolite for a little a couple of years ago, but being a console gamer at heart, using a joypad would be fantastic.

I have recently found out that the playstation 3 controller is natively supported by Snow Leopard, and was really hoping it would be possible to use this over bluetooth.

Is there anymore recent news on the progression of the joypad support for mac?

I am a bit illiterate when it comes to any sort of coding or building from source.

I look forward to some good news from this.

Cheers


Rob
Back to top
View user's profile Send private message
maik
---- E L I T E ----
---- E L I T E ----


Joined: 10 Mar 2010
Posts: 294
Location: Rheingau, Germany (rich agricultural, feudal, tech level 6)

PostPosted: Thu Jul 29, 2010 6:12 am    Post subject: Reply with quote

Not for the moment, I'm afraid.

I have included the missing bits and pieces in the OS X part of the source to make everything compile but then real life in the form of a new job got in the way. It's not forgotten though!
Back to top
View user's profile Send private message
webbasan
Mostly Harmless
Mostly Harmless


Joined: 07 Aug 2010
Posts: 3
Location: Mundito Rosinante - a small world at the border of the city.

PostPosted: Sat Aug 07, 2010 9:49 pm    Post subject: Reply with quote

Hello,

I'm just wondering: I was also searching for the current state of joystick support in Oolite on the Mac and how it might be done.

I found an old posting of Aegidian, which suggests that he did came to some resolution (www_idevgames_com/forum/showthread.php?s=&threadid=5373) -- what happened with that stuff? Did it ever make it into any release version?

I found other pointers, which suggested to use DDHidLib www_dribin_org/dave/blog/archives/2007/03/19/ddhidlib_10/ (Download here: code_google_com/p/ddribin/downloads/list, the link in the blog points to an older version).

I compiled that stuff and successfully tried the provided test application with my Logitech Rumblepad 2 (no "rumble" though, i'm looking for information on that. It seems that there is some Linux code available which could be harvested...)

It would be nice to know if the test application is also able to read the Xbox pad -- the author of the Xbox contoller driver mentions something on his page (tattiebogle_net/index.php/ProjectRoot/Xbox360Controller/UsbInfo) which I don't quite understand: Does he suggest that this device does not send proper HID-device codes and so a generic driver can't be used with this device?

I would prefer a more generic approach for the joystick support, if possible. As far as I understand, it's quite complicated to use that HID API directly and the newer API is only available since 10.5. If I got it right this DDHidLib is supposed to make it easier and does support 10.4.

P.S.: Ok, I tried to override the "SPAM"-protection, but I suppose that everybody is able to recreate the original URLs? Wink
Back to top
View user's profile Send private message
Commander McLane
Intergalactic Spam Assassin
Intergalactic Spam Assassin


Joined: 14 Dec 2006
Posts: 4945
Location: a Hacker Outpost in a very remote area

PostPosted: Sun Aug 08, 2010 12:00 pm    Post subject: Reply with quote

Hi, webbasan, and welcome to the boards, and of course to this great game! Very Happy

Although I'm a Mac user, I have always played Elite in all its incarnations only with keyboard, so I'm afraid I can't help you, as far as joystick support is concerned. Just wanted to be the first to say hello.

But I am sure that somebody on these boards, which have the reputation of being the friendliest this side of Riedquat, will be able to help you.
_________________
All you ever wanted to know--and more.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Oolite Bulletins Forum Index -> Oolite-Mac All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group