Author Topic: AGS v3.2.1 Engine Mac OS X/SDL Port  (Read 25299 times)

AGS v3.2.1 Engine Mac OS X/SDL Port
« on: 08 Apr 2012, 15:10 »
Update:

What is it?  A port of AGS v3.2.1's engine to Mac OS X

What does it support?
- runs on latest mac os!
- ags v3.2 games
- graphics and sound
- mouse, keyboard input

What's missing?
- midi support
- backwards compatibility
- other stuff? (eg avi/flc playing)

Games tested against:
- Demo Quest
- Gemini Rue
- Eternally Us, ^_^
- Blackwell games
- Aeronuts
- Beacon
- Space quest 2
- Concurrence (seems to have weird issues with input)
- Prime Ministers Questions
- Unga needs Mumba
(any others to suggest?)

How to use?
See README for instructions.

Where to get?
dl: http://www.agidev.com/tmp/EngineMac_2012_04_26.dmg
github branch: https://github.com/sonneveld/ags/tree/sdlwrap


Hey guys,

I did a partial port of the AGS engine to the SDL library.  This enabled me to compile on the latest mac osx.  There's no sound, and obviously no plugins will work, but demo quest and gemini rue works (although slowly, probably because sdl has to convert 16bit to a 32bit surface? edit: fixed).  I only just got it working but I wanted to share some screenshots.




Cool hey?  I'll clean up the branch and commit to my repository tomorrow if anyone's interested.

Why sdl?  Allegro 4 seems to be a dead end and A5 doesn't support all the pixel drawing/palette manip stuff that the engine supports. Also it helped me figure out what parts of allegro were actually being used.  Finally, it might help if we own our own versions of the pixel drawing routines to ensure compatibility.  Later on we could write enough of an abstraction layer to port to other platforms.

The engine works by reading resources out of its own app bundle for now.

- Nick
« Last Edit: 26 Apr 2012, 13:41 by sonneveld »

straydogstrut

  • Barking up the wrong tree
    • I can help with play testing
    • I can help with proof reading
Re: AGS engine sdl/mac port
« Reply #1 on: 08 Apr 2012, 15:35 »
This is very cool  :o
I must admit to being a bit confused about what Mac ports there are, if any??  ??? I've heard people mention AGS games already being cross-platform but as far as I understand it they're not? Not sure of the Linux port, but the only Mac port I know of is the one in the thread in the Tech board which is now abandoned. I think that was a port of AGS 2.72 and from the last comments in that thread it seems it's a Power PC app so is no longer compatible with Mac OS X 10.7 "Lion"

EDIT: I think i'm getting two different ports confused here..I did have the 2.72 Editor running on my Mac previously but I may have managed that using Wine tbh. I'd rather use the latest official version so I use BootCamp. The thread i've linked above is a port of the Engine.

I know a full Mac port of the Engine is probably a long way off so i've kept quiet about wanting this. I couldn't code a port myself so I don't feel it's right to expect this could be done overnight. I'm sure this has been requested countless times anyway so I don't want to add to start another 'me, me, me' discussion ::)

I don't expect anything release worthy any time soon but kudos to you Nick for attempting this. I have an intel Mac running Lion so if anyone needs any testing done, please please shoot me a PM :D
« Last Edit: 08 Apr 2012, 15:51 by straydogstrut »

Re: AGS engine sdl/mac port
« Reply #2 on: 09 Apr 2012, 09:58 »
Good job.

- Alan

Re: AGS engine sdl/mac port
« Reply #3 on: 09 Apr 2012, 10:08 »
Good to see you got it working. :-)

(The performance hit for converting from 16bpp shouldn't be noticeable on that hardware - maybe your 16bpp path for transparency is slow?)

Re: AGS engine sdl/mac port
« Reply #4 on: 09 Apr 2012, 11:07 »
(The performance hit for converting from 16bpp shouldn't be noticeable on that hardware - maybe your 16bpp path for transparency is slow?)

Actually, I was calling SDL_Flip after every blit.  Moving that to after every render seemed to speed things up significantly.

Re: AGS engine sdl/mac port
« Reply #5 on: 09 Apr 2012, 13:02 »
I have some binaries if someone wants to test them.  I've only tested Demo Quest and Gemini Rue.  To setup a game, open up the app bundle (right click and Show Package Contents), then copy the game exe and other resources into Contents/Resources. Then rename the exe to Game.exe.  (a hack I know).

what works: graphics, mouse input
what doesn't work: sound, keyboard input, some graphics drawing, save games?

dl link: http://www.agidev.com/tmp/EngineMac_fixed_2012_04_09.zip (includes engine with no game, and DemoQuest.app with prebundled resources)
github branch: https://github.com/sonneveld/ags/tree/sdlwrap

the terribly hacky allegro/sdl wrapper is in Engine/sdlwrap/ .  You may notice that some of the drawing code is copied verbatim from allegro 4.2 (hopefully copyrights are still there, if not, that will be fixed.)

edit: updated dl link.
« Last Edit: 09 Apr 2012, 13:45 by sonneveld »

straydogstrut

  • Barking up the wrong tree
    • I can help with play testing
    • I can help with proof reading
Re: AGS engine sdl/mac port
« Reply #6 on: 09 Apr 2012, 13:24 »
It's probably me doing something wrong as honestly I have no idea but I cannot get it to run at all=S

From your instructions, i'm assuming the DemoGame.app should run as is? Then to try other games I need to put their files in the resources folder of EngineMac, renaming the exe as you've described.

Trying to run either gives me an error like: "DemoGame cannot be opened because of a problem. Check with the Developer to make sure DemoGame works with this version of Mac OS X."

The error log is as follows. Hope it helps.

Code: [Select]
Process:         EngineMac [1126]
Path:            /Users/USER/Downloads/*/DemoGame.app/Contents/MacOS/EngineMac
Identifier:      BlueCup.EngineMac
Version:         1.0 (1)
Code Type:       X86 (Native)
Parent Process:  launchd [231]

Date/Time:       2012-04-09 13:18:43.432 +0100
OS Version:      Mac OS X 10.7.3 (11D50)
Report Version:  9

Interval Since Last Report:          404045 sec
Crashes Since Last Report:           27
Per-App Crashes Since Last Report:   7
Anonymous UUID:                      F84AA333-6BA6-4384-9527-55C60A7604D5

Crashed Thread:  0

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000002, 0x0000000000000000

Application Specific Information:
dyld: launch, loading dependent libraries

Dyld Error Message:
  Library not loaded: @rpath/SDL.framework/Versions/A/SDL
  Referenced from: /Users/USER/Downloads/*/DemoGame.app/Contents/MacOS/EngineMac
  Reason: image not found

Binary Images:
    0x1000 -   0x102fff +BlueCup.EngineMac (1.0 - 1) <129EB5BC-5478-3E02-BB35-2E0D9828BE14> /Users/USER/Downloads/*/DemoGame.app/Contents/MacOS/EngineMac
0x8fe8c000 - 0x8febeaa7  dyld (195.6 - ???) <3A866A34-4CDD-35A4-B26E-F145B05F3644> /usr/lib/dyld
0x9b4c0000 - 0x9b4c0fff  com.apple.Cocoa (6.6 - ???) <5FAFE73E-6AF5-3D09-9191-0BDC8C6875CB> /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa

Model: iMac5,1, BootROM IM51.0090.B09, 2 processors, Intel Core 2 Duo, 2 GHz, 4 GB, SMC 1.8f2
Graphics: ATI Radeon X1600, ATY,RadeonX1600, PCIe, 128 MB
Memory Module: BANK 0/DIMM0, 2 GB, DDR2 SDRAM, 667 MHz, 0x7F98000000000000, 0x202020202020202020202020202020202020
Memory Module: BANK 1/DIMM1, 2 GB, DDR2 SDRAM, 667 MHz, 0x7F98000000000000, 0x202020202020202020202020202020202020
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x87), Broadcom BCM43xx 1.0 (5.10.131.36.11)
Bluetooth: Version 4.0.3f12, 2 service, 18 devices, 1 incoming serial ports
Network Service: AirPort, AirPort, en1
Serial ATA Device: WDC WD1600AAJS-55M0A0, 160.04 GB
Parallel ATA Device: MATSHITADVD-R   UJ-85J
USB Device: Ext HDD 1021, 0x1058  (Western Digital Technologies, Inc.), 0x1021, 0xfd100000 / 6
USB Device: Built-in iSight, apple_vendor_id, 0x8501, 0xfd400000 / 5
USB Device: Keyboard Hub, apple_vendor_id, 0x1006, 0xfd300000 / 2
USB Device: Apple Optical USB Mouse, apple_vendor_id, 0x0304, 0xfd330000 / 4
USB Device: Apple Keyboard, apple_vendor_id, 0x0250, 0xfd320000 / 3
USB Device: Bluetooth USB Host Controller, apple_vendor_id, 0x8206, 0x7d100000 / 2
USB Device: IR Receiver, apple_vendor_id, 0x8240, 0x7d200000 / 3

Re: AGS engine sdl/mac port
« Reply #7 on: 09 Apr 2012, 13:44 »
Trying to run either gives me an error like: "DemoGame cannot be opened because of a problem. Check with the Developer to make sure DemoGame works with this version of Mac OS X."

oh nice error message! I had bundled the SDL framework but I didn't fix the runpath so it was still using my system copy.  Fixed now!  Thanks for that.
Fixed dl link: http://www.agidev.com/tmp/EngineMac_fixed_2012_04_09.zip

Please let me know if it works. :)

straydogstrut

  • Barking up the wrong tree
    • I can help with play testing
    • I can help with proof reading
Re: AGS engine sdl/mac port
« Reply #8 on: 09 Apr 2012, 13:51 »
I had bundled the SDL framework but I didn't fix the runpath so it was still using my system copy. 

Please let me know if it works. :)

I *thought* that's what the error message meant but didn't want to appear foolish by guessing ;)

It works!! Going to run through some more games now and come back to you with some results..

straydogstrut

  • Barking up the wrong tree
    • I can help with play testing
    • I can help with proof reading
Re: AGS engine sdl/mac port
« Reply #9 on: 09 Apr 2012, 15:37 »
Okay, i've tried quite a few games out with the steps listed above. I didn't have a lot of success but I think that was to be expected with an alpha version :) Unfortunately where the games didn't run I didn't get any crash reports so I can't tell you very much (if you know where I can find such things, please let me know). Also I know some of these are probably due to games with plugins although most that I downloaded didn't have the .dll file in the folder so looked like they didn't have plugins. It was hit and miss really, I just tried a random bunch of games.

Games tested

Anna  - doesn't work :(
5 Days a Stranger  - doesn't work :(
Ben Jordan 1: Deluxe  - doesn't work :(
McCarthy Chronices - doesn't work :(
Stargate Adventure - doesn't work :(
Over The Edge - doesn't work :(
Trilby's Notes - doesn't work :(
Blackwell Legacy Demo - doesn't work :(
Eternally Us - works :) with graphical glitches (see below)
Underland - doesn't work :(
Death - Episode One - doesn't work :(
Nelly Cootalot Spoonbeaks Ahoy! - doesn't work :(
Unga Needs Mumba - doesn't work :(
A Tale of Two Kingdoms - doesn't work :(
Da New Guys - Day of the Jackass Demo - works :) at least initially, see below
Aeronuts - doesn't work :(
Gemini Rue Demo - works :)

Eternally Us

Works fine except for some graphical glitches in the menu, text and rain effects (and obviously no audio):




The rain glitch made it difficult to see what was going on so I didn't play any further.

Da New Guys - Day of the Jackass

Started fine, minor graphical glitch with the cursor on the main menu:


It then went into the intro (I think, been awhile since I tried the demo) where I would assume a voiceover is playing. After a few seconds it crashed. Crash log here.


I wasn't able to configure the game options for any of these as would usually be the case through WinSetup.exe so it may be that the crashes were due to the default choices set. I did try editing acsetup.cfg manually but the changes did not take any effect. Da New Guys was already set to a 4x filter but trying this on Eternally Us for example had no effect, none of the other options did either.
« Last Edit: 09 Apr 2012, 15:40 by straydogstrut »

selmiak

  • ǝsıɔɹǝxǝ ʞɔǝu puɐ uıɐɹq
    • I can help with play testing
    • I can help with proof reading
    • I can help with translating
    • I can help with web design
    • selmiak worked on one or more games that won an AGS Award!
    •  
    • selmiak worked on one or more games that was nominated for an AGS Award!
Re: AGS engine sdl/mac port
« Reply #10 on: 09 Apr 2012, 18:26 »
I like where this is going. The graphic glitches seem to be semitransparent pngs...

Re: AGS engine sdl/mac port
« Reply #11 on: 10 Apr 2012, 04:07 »
Okay, i've tried quite a few games out with the steps listed above. I didn't have a lot of success but I think that was to be expected with an alpha version :) Unfortunately where the games didn't run I didn't get any crash reports so I can't tell you very much (if you know where I can find such things, please let me know).

Thanks for testing all those games!  The engine I'm porting is the open-sourced v3.2.1 engine so there might be difficulties running older games (although the psp port seems to have overcome some).  I've found that if a plugin isn't loaded, the game won't load because those symbols don't exist...  I manually added symbols to allow for Gemini Rue to run without having to port the rain/snow and shell plugins.   

The logging is through stdout.  On my system, stdout gets logged to /var/log/system.log so hopefully you'll get a bunch of messages there.  Easiest way to view it is using the Console app.  I'll fix that so they're saved in a better spot like ~/Library/Logs.

Re: AGS engine sdl/mac port
« Reply #12 on: 10 Apr 2012, 07:00 »
Thanks for testing all those games!  The engine I'm porting is the open-sourced v3.2.1 engine so there might be difficulties running older games (although the psp port seems to have overcome some).

Well, the PSP porter wrote a bunch of new code to support the older versions (e.g. the audio stuff changed quite a bit for 3.2), as well as code for the plugins, which is why I originally suggested starting with that repository..

Obviously that adds a lot more complexity to the code though, so if you're intending to maintain a shiny new refactored repository then (as discussed) perhaps you should just forget the older games and let ScummVM deal with them. I think "shiny new refactored repository for further development of AGS" and "supporting the old audio system and interactions and leaving all the non-native coordinate code cluttering the codebase" are not much fun to combine.

Re: AGS engine sdl/mac port
« Reply #13 on: 16 Apr 2012, 07:24 »
.. which is why I originally suggested starting with that repository..

I think "shiny new refactored repository for further development of AGS" and "supporting the old audio system and interactions and leaving all the non-native coordinate code cluttering the codebase" are not much fun to combine.

I know... but unfortunately I had started with a clone of the subversion repository. Shiny new repository does sound appealing but depends on if/when other people want to get involved on the next version too.

Re: AGS engine Mac OS X/SDL Port
« Reply #14 on: 16 Apr 2012, 07:32 »
New version out!

- keyboard support
- initial sound support.  Only ogg for now so you can test against Gemini Rue.  I will add wav and midi support.
- alert boxes for errors :)

See README for running instructions.  You still have to copy the game files for now, to create a standalone game app.

I have yet to test on any games other than Gemini Rue and Demo Quest.   Does anyone have a handy list of v3.2 games?

dl: http://www.agidev.com/tmp/EngineMac_2012_04_16.zip
github branch: https://github.com/sonneveld/ags/tree/sdlwrap

Re: AGS engine Mac OS X/SDL Port
« Reply #15 on: 16 Apr 2012, 08:34 »
I have yet to test on any games other than Gemini Rue and Demo Quest.   Does anyone have a handy list of v3.2 games?

To pick some random games from my test set which claim to be 3.2: Beacon, bird, Blackwell Deception demo, ^_^, Eternally Us, Cart Life, Concurrence, AeroNuts, UNGA needs MUMBA, King's Quest III Redux, Prime Minister's Questions, Space Quest: Vohaul Strikes Back, Quest for Glory II, King's Quest II.

Re: AGS engine Mac OS X/SDL Port
« Reply #16 on: 16 Apr 2012, 10:51 »
To pick some random games from my test set which claim to be 3.2: ...

great list! thank you.

Re: AGS v3.2.1 Engine Mac OS X/SDL Port
« Reply #17 on: 25 Apr 2012, 08:30 »
Okay, another update:

- open file dialog , you don't need to copy files now
- save games work
- ttf font rendering
- wave file support
- hopefully fixed more graphical glitches

See README for instructions.

dl: http://www.agidev.com/tmp/EngineMac_2012_04_25.zip
or try this one: http://www.agidev.com/tmp/EngineMac_2012_04_25_options.zip
github branch: github branch: https://github.com/sonneveld/ags/tree/sdlwrap
« Last Edit: 25 Apr 2012, 13:52 by sonneveld »

subspark

  • Some things, you just can't unsee.
    • I can help with animation
    • I can help with backgrounds
    • I can help with characters
    • I can help with making music
    • I can help with play testing
    • I can help with proof reading
    • I can help with story design
    • I can help with translating
    • I can help with voice acting
    • subspark worked on one or more games that won an AGS Award!
Re: AGS v3.2.1 Engine Mac OS X/SDL Port
« Reply #18 on: 25 Apr 2012, 09:35 »
Having trouble with the update, Sonneveld.
I double click EngineMac and it flashes in the dock but then disappears when I click on the bobbing icon.

Re: AGS v3.2.1 Engine Mac OS X/SDL Port
« Reply #19 on: 25 Apr 2012, 11:21 »
Having trouble with the update, Sonneveld.
I double click EngineMac and it flashes in the dock but then disappears when I click on the bobbing icon.

Okay, that's weird.  First thing it should do is open a dialog box to let you choose an exe file.  If you run console.app do you see anything in the logs?  What version of osx are you running?

Try this: http://www.agidev.com/tmp/EngineMac_2012_04_25_options.zip
There's the dialog version (edit: slightly modified) + non dialog version with the demo game bundled with it.

If that doesn't help, you could try deleting the old caches/preferences in ~/Library:
~/Library/Caches/BlueCup.EngineMac
~/Library/Preferences/BlueCup.EngineMac.plist*
~/Library/Saved Application State/BlueCup.EngineMac.savedState

is there any recent crash log data?
~/Library/Logs/DiagnosticReports/EngineMac*
~/Library/Logs/CrashReporter/EngineMac*

« Last Edit: 25 Apr 2012, 11:30 by sonneveld »

subspark

  • Some things, you just can't unsee.
    • I can help with animation
    • I can help with backgrounds
    • I can help with characters
    • I can help with making music
    • I can help with play testing
    • I can help with proof reading
    • I can help with story design
    • I can help with translating
    • I can help with voice acting
    • subspark worked on one or more games that won an AGS Award!
Re: AGS v3.2.1 Engine Mac OS X/SDL Port
« Reply #20 on: 25 Apr 2012, 12:53 »
Cheers man, I'll take it for a thorough test run now.

Re: AGS v3.2.1 Engine Mac OS X/SDL Port
« Reply #21 on: 26 Apr 2012, 13:36 »
Another update.. fixes some more graphical glitches.. should actually load gfx filters now.

Please let me know if it works for you or not! :)

dl: http://www.agidev.com/tmp/EngineMac_2012_04_26.dmg
github branch: https://github.com/sonneveld/ags/tree/sdlwrap

straydogstrut

  • Barking up the wrong tree
    • I can help with play testing
    • I can help with proof reading
Re: AGS v3.2.1 Engine Mac OS X/SDL Port
« Reply #22 on: 27 Apr 2012, 21:46 »
I've just played through Eternally Us again with the latest version and it works flawlessly. It also made me cry. Again. It is a hauntingly beautiful game :~(

I've briefly tried Unga Needs Mumba and there doesn't seem to be any problems. I get a notification now that games cannot be run either because they are corrupted or (more likely) created with a version of AGS prior to 3.2 which is handy. I might have a bit of free time this weekend to test some more games hopefully. Is there a way of telling which version of AGS was used to create a game as I don't see anything on the games page or in the info about the exes (Using Get Info on my Mac)?

Re: AGS v3.2.1 Engine Mac OS X/SDL Port
« Reply #23 on: 22 Oct 2014, 21:23 »
I am getting an error while trying to run EngineMac.app

"EngineMac” can’t be opened because it is from an unidentified developer.

I'm on 10.9

straydogstrut

  • Barking up the wrong tree
    • I can help with play testing
    • I can help with proof reading
Re: AGS v3.2.1 Engine Mac OS X/SDL Port
« Reply #24 on: 22 Oct 2014, 23:15 »
This will be because your security settings will be set to either Mac App Store or Mac App Store and Identified Developers.

Go into Preferences > Security & Privacy > General tab and there will be an option to 'run anyway' the app you just tried to run.