Jump to content
Double Fine Action Forums
Sign in to follow this  
honeymaker

Gamepad does not work on Mac

Recommended Posts

Just started digging into The Cave. First impressions are really good: some gorgeous environments and animations. I also really like the idea of playing with three characters.

I prefer playing the game with a gamepad. I am using a Logitech Dual Action Controller. However, the game does not recognise this gamepad at all when playing on Mac OS X (Mountain Lion, 10.8.2). It does work with other games on that platform (e.g. Psychonauts, Portal 2). It seems that some other people are having this problem as well. Launching through Big Picture (which does recognise the device) did not help. Just tried it on Windows and here it worked perfectly fine. As I'd rather play on Mac I was wondering whether I could do something about it. Or is this a driver issue that is totally out of your control? Maybe this is a good excuse to by myself an XBOX 360 controller......

Share this post


Link to post
Share on other sites

I'll second this.

I just got my PDP Afterglow controller working on my Mac which also emulates a 360 controller. When I fire up Steam's Big Picture mode the controller work great! In Big Picture, Steam says that The Cave has 'full controller' support but when I start it I get no response. I tried pressing a bunch of buttons on the controller (I read somewhere that the controller will not 'possess' a character until you press a button on it, not move a thumbstick) but it doesn't respond to anything.

I'm happy to help debug this if you need some system logs or anything. To get this particular controller working on Mac I had to use the tattibogl Mac driver which maps XBox 360 controllers to standard IOKit HID controllers. I had to fix some things in the driver to make it work (the PDP Afterglow was not specifically supported) but the changes were minimal to get it working.

Anyways, I played through The Cave once on the Wii U and loved it! Now I'm trying it on the Mac. I really like the controls better with a console controller rather than the mouse+keyboard so I'd love to get this working.

Cheers!

Seth B

Share this post


Link to post
Share on other sites

Odd it's working just fine for me and I haven't had to go into Big Picture mode at all. I'm currently running The Cave on my Core 2 Duo iMac (with OS 10.8.2) and the tattiebogle.net 360 Driver.

I'm using a Wired 360 gamepad registered as Controller 1 and the only issue I've run into was that I had to restart Steam (close it completely and reopen it) before my controller registered in game. Since then it's been smooth sailing.

Share this post


Link to post
Share on other sites

I'm not sure if the game officially supports controllers on Mac. The game uses a component of DirectX called Xinput, for native xbox 360 input data which is obviously not on Mac OSX. There might be inconsistencies between the user experience.

Share this post


Link to post
Share on other sites

I bet it's because we are using 3rd party XBox 360 controllers. honeymaker has the Logitech controller and I have a PDP one. They speak the exact same protocol as a standard Microsoft brand controller (well, I'm sure mine does; the PDP Afterglow, not sure about the Logitech) but they identify themselves differently over USB (different vendor and product IDs). I'm guessing that whatever system DF is using on the Mac (I think I saw SDL mentioned somewhere) it only recognizes an exact Microsoft controller.

Perhaps there's someway to get them to spoof different USB IDs ...

Thanks for the extra info!!

Seth B.

Share this post


Link to post
Share on other sites

Hmmm, so they use SDL on mac (as stated in this discussion: http://www.doublefine.com/forums/viewthread/8442/). I threw together a small program that initializes SDL and queries all controllers. It finds my controller no problem.

My program is very similar to the example on this page: http://wiki.libsdl.org/moin.cgi/SDL_JoystickOpen

The only change is that it attempts to iterate over all joysticks and list them all (not just the first one).

Output looks like this:

Opened Joystick 0:

   Name: Afterglow Gamepad for Xbox 360

   Number of Axes: 6

   Number of Buttons: 15

   Number of Balls: 0

So SDL seems to find my controller and support it no problem. I guess there must be something else going on. I know almost nothing about SDL so perhaps there's another way to query for controllers. I'm using SDL 1.2.15 as provided by macports:

libsdl @1.2.15_2+x11 (active)

I think this is the end of what I can do. Hopefully something can be figured out here. Love any tips.

Seth B.

Update: Here's the code

// Quick test program to list SDL compatible joysticks that are detected.

// Based on sample code found here: http://wiki.libsdl.org/moin.cgi/SDL_JoystickOpen



/* You need XCode installed and/or the compiler command line tools.

* If you have SDL installed from macports (which I recommend) then compile from the terminal as:

*   g++ -I/opt/local/include/SDL/ -L/opt/local/lib/ -lSDL -lSDLmain -framework Foundation -framework AppKit -o ListSDLJoysticks ListSDLJoysticks.cpp

*/



#include 

#include 



extern C_LINKAGE int main(int argc, char *argv[])

{

   SDL_Joystick *joy;



   // Initialize the joystick subsystem

   SDL_InitSubSystem(SDL_INIT_JOYSTICK);

   int joyCount = SDL_NumJoysticks();



   if(joyCount == 0) printf("No SDL joysticks found.\n");

   else

   {

       for(int i=0; i
       {

           // Try to open joystick

           joy = SDL_JoystickOpen(i);

           if(joy != NULL)

           {

               printf("Opened Joystick %i:\n", i);

               printf("\tName: %s\n", SDL_JoystickName(i));

               printf("\tNumber of Axes: %d\n", SDL_JoystickNumAxes(joy));

               printf("\tNumber of Buttons: %d\n", SDL_JoystickNumButtons(joy));

               printf("\tNumber of Balls: %d\n", SDL_JoystickNumBalls(joy));

           }

             else printf("Failed to open Joystick %i\n", i);



           // Close if opened

           if(SDL_JoystickOpened(i)) SDL_JoystickClose(joy);



           printf("\n");

       }

   }



   fflush(stdout);

   return 0;

}

Share this post


Link to post
Share on other sites

Wow, this topic is going way over my head now. ;-) But I understand that they are using different systems for controller support on both platforms? That would indeed explain why mine does work on Windows.

Although it is not a really big problem for me, I hope there is some simple way to solve this. It would be nice to be able to do my second playthrough on OS X.

Share this post


Link to post
Share on other sites
Wow, this topic is going way over my head now. ;-)

Sorry :red:

I'm getting a bit carried away. I love to sink my teeth into a problem! :) Who knows if any of this will lead anywhere of be of use to anyone. It's mostly me thinking out loud.

Seth B

Share this post


Link to post
Share on other sites

Aha! I am a fool!

For some reason it never occurred to me to look inside the app bundle for the cave and see what frameworks/libraries or config files were there. Today, on a whim I did that and suddenly there were a plethora of new leads!!

- They are using SDL 2, not SDL 1.2. I had assumed without question that they would not be using 2.0 which is still in development, and that's what happens when you ASSume.

- The framework for their version of SDL is sitting right there inside the app bundle (as naturally it should be) so I can link right against it

- SDL 2 handles gamepads differently (it wraps the joystick interface with a gamepad specific API)

- There is a config file right in the app bundle for SDL gamepad input socket mappings which are controller specific (SDLGamepad.config). There even some comments at the start of this file that tells you how to add new ones (configure them in Steam's Big Picture then copy out the relevant line from steam's config.vdl file).

All of this is promising but I have no idea if it will prove fruitful. I do not have my gamepad with me right now so trying things will have to wait until I get home tonight. Still, we've picked up the scent again!

Seht B.

Share this post


Link to post
Share on other sites
Wow, this topic is going way over my head now. ;-)

Sorry :red:

I'm getting a bit carried away.

Never mind. :-) Just me freaking out over seeing the ugliness of code and config files. I would get my teeth into the issue just like you if I would have some technical expertise. Unfortunately I don't, but please let us know if you find something. I could always test it out.

Share this post


Link to post
Share on other sites

Bingo! I figured it out.

The problem seems to be that in SDL 2 the controller needs to be identified as a SDL_gamecontroller not just a joystick. Only a couple of controllers are built into SDL and double fine only added a couple others (a few common Logitech ones but not yours).

By a stroke of luck, Steam also uses SDL for its big picture mode and it will create a custom SDL_gamecontroller binding string for any joystick. We can grab that one and copy it into The Cave's config file and voila! It should work.

So, if your controller works in Steam's Big Picture mode but not in The Cave the following process should fix it. This is only for Mac (and also possibly Linux but the files will likely be in slightly different places, especially the one for The Cave).

Here's the basic steps:

1. Run Steam in 'Big Picture' mode and go into the settings

2. Configure your controller and name it when prompted (all buttons need to be properly assigned). Exit Steam.

3. Now you need to find the string labeled "SDL_GamepadBind" inside the following file (it's near the end):

~/Library/Application Support/Steam/config/config.vdf

4. Copy that string into the following file (just add it as a new line):

~/Library/Application Support/Steam/SteamApps/common/TheCave/Cave.app/Contents/Resources/Data/Config/SDLGamepad.config

5. Use the other strings in the SDLGamepad.config file to make sure you've copied the right thing. It should look very similar but be for your controller.

I wrote a bash script that will do this for you on a Mac (copySteamControllerToCave.sh). To use this script:

1. Visit the pastebin link above and click 'download' to save the script. Move it from the Downloads directory to your desktop

2. Check the name of the file it downloaded. If it added '.txt' to the end you need to rename it so it ends in '.sh'

3. In Spotlight (the little magnifying glass at the top right) search for 'Terminal' and launch it

4. Type in the following command and press enter:

bash ~/Desktop/copysteamcontrollertocave.sh

I have tested this script on all of one computer (mine) with one controller (also mine) so don't be suprised if it doesn't work right away. I'm happy to help figure it out so post a message if you have any problems.

Seth B.

Share this post


Link to post
Share on other sites

That totally did the trick. You are awesome! I only saw that you provided a script after manually changing it, so I don't know if that works for me. Looking forward to do my second playthrough on Mac. Thanks!

Share this post


Link to post
Share on other sites

Sweet! I'm glad this bore fruit.

One caution, if the cave get's updated (and particularly if you do an 'integrity check' of the local game cache, which is an option buried in the game properties) this file will get reverted back to the original settings. So, it will lose the line we just added.

That's where the script might come in handy. I set it up so that it will check to make sure the string isn't already in there before it adds it. So, you can safely run it as many times as you want and it should not add garbage to the config file ... unless you change the button binding in Steam. Don't do that. :-)

Seth B.

Share this post


Link to post
Share on other sites

So of course as soon as I said don't change your binding in steam I wanted to do exactly that myself. So I updated the script a bit to handle that situation.

Just wanted to note that. If you care to know what I changed, read on ...

Seth B.

If it sees exactly the same settings (same ID, name and bindings) it will just do nothing (because it doesn't need to do anything). Now it also checks if the same ID is in there (but possibly different name or bindings). If it see's that it will assume you have run the script before and look for the backup file (SDLGamepad.config.orig) which the script creates automatically. It checks to make sure the ID is not in the backup file either and then it will just restore that file and proceed like normal (put the new SDL config string in there).

Share this post


Link to post
Share on other sites

That's where the script might come in handy. I set it up so that it will check to make sure the string isn't already in there before it adds it. So, you can safely run it as many times as you want and it should not add garbage to the config

Nice!

I already had some issues with the bindings after copying over my save data from Windows. I understand how it works now, though, so I'll know where to look when the new patch goes up. Thanks again!

Share this post


Link to post
Share on other sites
Sign in to follow this  

×
×
  • Create New...