Page 1 of 1

Mac patch for easier distribution. Where should I send it?

Posted: Wed Dec 30, 2009 2:45 am
by stevejohnson
The Mac distribution setup sucks, as described in this thread. So I decided to contribute a patch. I don't know SDL or Lua at all, and barely any Cocoa, but I get the ideas behind all of them and I want Löve to be as effective as possible on OS X because I like the project.

Someone suggested that love.app should simply check its own love.app/Contents/Resources folder for .love files and run the first one it finds, and even provided a code sample for how that might be done. It turned out to be a little more complicated than that, but not much more after I figured out what was going on. Basically, if löve decides that it's been launched from the Finder, then it does what it normally does upon drag-and-drop or a file open from the Finder: it rewrites gArgv to use that file and blocks gArgv from being rewritten again. It finds the file using Cocoa's resource-finding routines (given in the code sample, which I have since lost.) Then it releases memory properly, and execution continues as normal.

You'll have to update Info.plist as normal. That's just a Mac thing. I might write you guys an Automator script or something to do that more easily. It's really not difficult.

At any rate, the process for distribution with this patch is about 5 steps shorter. Just drop a .love in to love.app/Contents/Resources, rename love.app, and tweak Info.plist to show the correct name in the menu. Bam. Done.

I couldn't figure out where to clone or check out from, so I ended up using this Mercurial repository, which appears to be up to date.

Now I don't know how to submit the patch, so here's the Mercurial patch, and here's the text of the addition (It's just one 34-line chunk in SDLMain.m, just copy and paste it in, or throw it in a function, whatever). What is the proper channel for this? The site could benefit from a "how to contribute" page.

If you're a "normal person" here, then you can use the version I built locally. Download it here. I have NO IDEA if it works for anyone else, and I didn't pay much attention to the build process. (While we're here, could one of you devs tell me how to unmount this damn disk image?)

ANYWAYS

Hi, I'm Steve. Here's my web site. I like to write games and Mac software. I usually use Python and pyglet to do that, and I like them very much. But Lua intrigues me, so I've been checking out löve periodically, and you seem like my kind of folks. Keep it up.

Re: Mac patch for easier distribution. Where should I send it?

Posted: Wed Dec 30, 2009 6:11 am
by bmelts
Okay, I tested this patch out and by all accounts, this is awesome and so much better than my original hack. Paging rude to this thread so it can be okayed for 0.6.1!

Re: Mac patch for easier distribution. Where should I send it?

Posted: Wed Dec 30, 2009 7:30 am
by stevejohnson
I totally just helped anjo figure out how to get löve to accept cmd-Q, cmd-H, and cmd-M keyboard shortcuts. So we're gonna have that too. It was a one-line fix. Zing!

(Yeah, I'm easily excitable.)

Re: Mac patch for easier distribution. Where should I send it?

Posted: Wed Dec 30, 2009 1:29 pm
by appleide
OMG you're one of the writers of escortwing!! I love that game! I was even on the forums there for a bit, a long time ago.
Now we have keyboard shortcuts! Yes!
Welcome to love! :)

Re: Mac patch for easier distribution. Where should I send it?

Posted: Wed Dec 30, 2009 9:31 pm
by Jasoco
This sounds like the greatest idea ever. Easy distribution for Mac versions of the games. I'm all for it.

Re: Mac patch for easier distribution. Where should I send it?

Posted: Wed Dec 30, 2009 10:00 pm
by stevejohnson
I just finished writing an app which makes distribution even simpler. You drag a folder or a .love file to it, it asks you for an app name, and the finished .app is created next to the input file/folder.

But I can't put it up until the next maintenance release goes out, because it requires the patch in the first post.

Re: Mac patch for easier distribution. Where should I send it?

Posted: Thu Dec 31, 2009 5:05 pm
by rude
Sorry for not responding, have been away for a while. Will apply this and try to provide builds tomorrow.