Mac OS X Version

Strictly for discussing ZSNES development and for submitting code. You can also join us on IRC at irc.freenode.net in #zsnes.
Please, no requests here.

Moderator: ZSNES Mods

Post Reply
Xenoveritas
New Member
Posts: 5
Joined: Wed Dec 30, 2009 5:31 pm
Location: Massachusetts
Contact:

Mac OS X Version

Post by Xenoveritas »

After an obnoxious amount of effort to shoehorn ZSNES into Xcode, I've managed to compile a Mac OS X version.

OK, so ZSNES has always had support for Mac OS X, but I've added a few changes that make it a "true" Mac OS X app. This is mostly adding configuration data to the ".app" bundle NextSTEP - I mean, Mac OS X - uses.

Sadly it did involve some mucking with the ZSNES code itself - mainly to change the main method (since I'm not using SDL's normal Mac OS X startup) but also due to a few other issues (such as memset/memcpy being too smart for their own good and bombing if they thought they'd overflow the buffer they're writing to).

I also had to add some code to ignore the "-psn_0_x" argument that Mac OS X passes to applications launched from Finder. (What's it for? No clue. And since PSN means "PlayStation Network" to Google, I haven't had any luck finding out.)

Next up there's some additional glue code to intercept the "open document" message Mac OS X sends. Unlike most other OSes, double clicking on a file registered to an application doesn't just invoke the application with the file as an argument - it sends a special message to the application instead. There's some other UI-related code changes (such as making the buttons in the About dialog work under Mac OS X).

In short, this isn't just "./configure && make && make install", there is some actual new stuff here.

Some screenshots:

Image
Image

I haven't really tested this to make sure it works, but if anyone wants to try it: ZSNES 1.51-3.dmg

My SVN repository is also online for the code: http://svn.xenoveritas.org/zsnes/trunk

This repository includes an embedded copy of SDL, which is missing any code not related to the Mac OS X port. Likewise, the Windows/DOS specific code for ZSNES is missing in that repository.
Last edited by Xenoveritas on Thu Jan 07, 2010 6:54 pm, edited 1 time in total.
sweener2001
Inmate
Posts: 1751
Joined: Mon Dec 06, 2004 7:47 am
Location: WA

Post by sweener2001 »

what differentiates your build from the build found here:
http://board.zsnes.com/phpBB2/viewtopic.php?t=7502

i'm just curious. if those authors are still active, you guys could collaborate
Image
Xenoveritas
New Member
Posts: 5
Joined: Wed Dec 30, 2009 5:31 pm
Location: Massachusetts
Contact:

Post by Xenoveritas »

Well, off the top of my head:
  • My build uses 1.51, the existing one appears to have never moved past 1.43.
  • My build associates ROM files with ZSNES, so they open in ZSNES, and you can drag and drop them onto ZSNES's dock tile. This involved skipping SDL's Mac OS X launch code and a very little bit of custom code.
  • My build includes SDL as an embedded framework, which means you don't need to install it separately.
  • My build has ZSNES place its configuration files in the "correct" Mac OS X location. Which is something that happened with the ZSNES code between 1.43 and 1.51, but... it's a difference.
  • My build includes the ZSNES documentation as a "help book" which makes it accessible via the Help menu.
  • My build is against Mac OS X 10.6, which means there's no hope that anyone can ever try and run it on Power PC. :)
Sadly, it appears the original authors of that Mac OS X build are no longer active.

And with ZSNES 2.0 right on the horizon, of course, it's unclear how much effort is worth putting into a Mac OS X version. ;)
doktor_kris
Lurker
Posts: 102
Joined: Sat Feb 25, 2006 7:47 pm
Contact:

Post by doktor_kris »

This version seems to work perfectly fine. Well done! :-)
sweener2001
Inmate
Posts: 1751
Joined: Mon Dec 06, 2004 7:47 am
Location: WA

Post by sweener2001 »

if i had a mac, then, i'd totally be all over this.

sounds like an awesome job. kudos
Image
Xenoveritas
New Member
Posts: 5
Joined: Wed Dec 30, 2009 5:31 pm
Location: Massachusetts
Contact:

Post by Xenoveritas »

I've bumped the version one to fix a bug I introduced while trying to fix a really weird problem where ALIGN32 is off-by-seven on Mac OS X.

Seriously: if you check the address of any symbol after an ALIGN32, it'll end in 0x7. I have no clue why.

Unfortunately, I never undid the results of my screwing around, and in the process, broke ALIGN32.

Bottom line: save state files created with the 1.51-2 Mac OS X version won't work in 1.51-3. (Although both will work in the Windows 1.51 version.)

I've updated the link in my original post, but here it is again: ZSNES 1.51-3.dmg

Also, starting with the next version, I'm going to fully steal the Debian versioning scheme and call it 1.51-macosx4.

PS. Screw Comcast for dropping my Internet connection multiple times while I tried to post this. Seriously, WTF?
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

Xenoveritas wrote:PS. Screw Comcast for dropping my Internet connection multiple times while I tried to post this. Seriously, WTF?


Shhh, they are thinking you're uploading torrents! :wink:
Continuing FF4 Research...
Wyatt

Post by Wyatt »

Cool, thanks for doing this. I didn't realise OSX was so weird about passing arguments to applications.

Unfortunately, this machine has 10.5 (no upgrade in sight) and, for some reason, Xcode is crap and segfaults, er go I can't build from the project files you've got (what, no ./configure? Toolchain works fine; I've verified that. ;) )

Could someone possibly do the lame-asses of the world a boon and make a build against 10.5? The dmg you posted tells me that it refuses to work because it's better than me or something.

Cheers.
Xenoveritas
New Member
Posts: 5
Joined: Wed Dec 30, 2009 5:31 pm
Location: Massachusetts
Contact:

Re: Mac OS X Version

Post by Xenoveritas »

Oof, I'm horrible at checking up on this.

Er, anyway, according to Xcode 3.2, it's an "XCode 3.1 compatible" project, so... uh...

In any case, I can't do a 10.5 compile because I don't have a 10.5 Mac to test on. (Well, that's not strictly true - I could always try on the old 10.5 PowerPC at work. Except for the "PowerPC" part. And the "misuse of company resources" part.)
Krade
Rookie
Posts: 31
Joined: Mon Feb 19, 2007 11:23 am

Re:

Post by Krade »

Xenoveritas wrote:Well, off the top of my head:
  • My build uses 1.51, the existing one appears to have never moved past 1.43.
  • My build associates ROM files with ZSNES, so they open in ZSNES, and you can drag and drop them onto ZSNES's dock tile. This involved skipping SDL's Mac OS X launch code and a very little bit of custom code.
  • My build includes SDL as an embedded framework, which means you don't need to install it separately.
  • My build has ZSNES place its configuration files in the "correct" Mac OS X location. Which is something that happened with the ZSNES code between 1.43 and 1.51, but... it's a difference.
  • My build includes the ZSNES documentation as a "help book" which makes it accessible via the Help menu.
  • My build is against Mac OS X 10.6, which means there's no hope that anyone can ever try and run it on Power PC. :)
Sadly, it appears the original authors of that Mac OS X build are no longer active.

And with ZSNES 2.0 right on the horizon, of course, it's unclear how much effort is worth putting into a Mac OS X version. ;)

Well, the latest build I posted is 1.51. It runs on Tiger and above. It also uses SDL as framework inside the .app. So that's points 1, 3 and 4 from your list.

I see your build also has a few bugs that only happen in OS X that were fixed after the 1.51 release (for example, you can't switch resolutions, I'm getting a white screen when I attempt to do that in your build), you might want to apply the diff I have here to 1.51 source. Good job working on better ZSNES OSX integration, though. Do you have a list/diff of files you changed (I suppose I could just run diff)?
PHoNyMiKe
Retrosexual
Posts: 1011
Joined: Wed Jul 28, 2004 2:09 am
Location: Rapture

Re: Mac OS X Version

Post by PHoNyMiKe »

that's the smoothest I've ever seen zsnes run. right off the bat there was an automatic .smc association, I just double clicked a properly backed up .smc file. the usb microsoft sidewinder worked great after setting the keys, I have usb overdrive and that may have made the controller work. I couldn't use the C button on the controller, so in usb overdrive I set the keyboard ~ to the C button, and then zsnes sped up using the C on the controller. I was doing HQ video filter but 2x wouldn't click. I tried changing the resolution to my other monitor, and it went white. I hit escape and it went back to the game with video displaying. sound had a sparatic buzzing sound when the music and sound effects hit the right tone like before or after going through a door in metroid 3 every so often, or right after zsnes loads the rom but before the rom starts. Mac OSX 10.6

it wouldn't save directly to png, so I had to convert it from a bmp. but it gave me a great chance to play some zsnes jam.
Image
Xenoveritas
New Member
Posts: 5
Joined: Wed Dec 30, 2009 5:31 pm
Location: Massachusetts
Contact:

Re: Re:

Post by Xenoveritas »

Krade wrote:Well, the latest build I posted is 1.51. It runs on Tiger and above. It also uses SDL as framework inside the .app. So that's points 1, 3 and 4 from your list.

I see your build also has a few bugs that only happen in OS X that were fixed after the 1.51 release (for example, you can't switch resolutions, I'm getting a white screen when I attempt to do that in your build), you might want to apply the diff I have here to 1.51 source. Good job working on better ZSNES OSX integration, though. Do you have a list/diff of files you changed (I suppose I could just run diff)?

The entire thing is in a GIT repository on my machine, so I should be able to create a diff, since I believe I started it based on the original source code.

Unfortunately, that includes the entire libSDL framework, so the patch file created is nearly 4MB. (Not to mention the parts that read "Binary files /dev/null and b/zsnes.icns differ".)

Anyway, the important parts are the contents of the macosx folder, which is where I've tried to place most of the code, and hopefully this patch file which I think contains the basic changes.

Associating ZSNES with ROM files is done via the info.plist file, and doesn't require any special code.
JailDesigner
New Member
Posts: 6
Joined: Wed Apr 06, 2005 11:57 am
Location: Spain

Re: Mac OS X Version

Post by JailDesigner »

Sorry if the post is too old, but i just found this OSX port and i just want to thank Xenoveritas for his work: THANKS A LOT!

I'm still waiting for the next version of THE BEST snes emu. Keep the good work. In fact, thanks to all the zsnes staff.
dtawater

Re: Mac OS X Version

Post by dtawater »

I've run into a bit of a problem with using ZSNES.
You see, I know nothing about computers. I just want to play SMW 3 on my mac... And sadly, I am unable lol. Anyone willing to help a poor, computer-knowledgeless soul?


Management edit: we sorta fucked up and deleted your account by mistake. No offense meant, lol. Feel free to register back. :3
badinsults
"Your thread will be crushed."
Posts: 1236
Joined: Wed Jul 28, 2004 1:49 am
Location: Not in Winnipeg
Contact:

Re: Mac OS X Version

Post by badinsults »

Learn how to use your computer?

If the binary in the first post doesn't work, I don't know what else to suggest.
<pagefault> i'd break up with my wife if she said FF8 was awesome
paulguy
Zealot
Posts: 1076
Joined: Sat Jul 02, 2005 2:01 am
Contact:

Re: Mac OS X Version

Post by paulguy »

Are you sure you don't mean SMB 3 (Super Mario Bros 3)? Which is an NES game; zsnes only plays SNES games. If you want to play the SNES version, try super mario all stars.
Maybe these people were born without that part of their brain that lets you try different things to see if they work better. --Retsupurae
Davirus849
New Member
Posts: 1
Joined: Wed Jun 20, 2012 4:05 pm

Re: Mac OS X Version

Post by Davirus849 »

Looks great, the effort is noticeable.

Yet, Im unable to run Star Fox, i have to say is the only rom I have tested, but the Emulator close as soon I load the rom. I can provide as much information as necessary.

Im running in an iMac 21.5-inch, Mid 2011 with Lion 10.7.4
grinvader
ZSNES Shake Shake Prinny
Posts: 5626
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Re: Mac OS X Version

Post by grinvader »

Check your ROM image first.
皆黙って俺について来い!!

Code: Select all

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)

Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
Post Reply