View previous topic :: View next topic |
Author |
Message |
doob
Joined: 06 Jan 2007 Posts: 367
|
Posted: Mon Oct 06, 2008 9:34 am Post subject: |
|
|
I fixed all the runtime errors I had and I think everything is working. I have not tested inside a bundle yet.
I still don't know what to do about the arguments that are passed to the main function, the way it's now I'm calling "macInit" (in the user application code) with "fake" arguments like this:
Code: | macInit(1, ["main".ptr]); |
I also have this code in the end of the user application code:
Code: | if (pool)
pool.release;
if (sdlMain)
sdlMain.release; |
I don't know where to place those calls inside derelict. They where called inside CustomApplicationMain in SDLMain but that didn't work, they have to be called after the application has finished, otherwise there will be a lot of memory leaks and the application freezes.
All the files needed including the slightly modified test application:
http://marke.dabb.se/development/d/derelict/macinit.zip
all files, except main.d, should be placed in "DerelictSDL/derelict/sdl/
macinit/"
A diff file for the same: http://marke.dabb.se/development/d/derelict/macinit.patch
There where quite a lot of extra code and files that where needed to be able to port SDLMain. |
|
Back to top |
|
|
doob
Joined: 06 Jan 2007 Posts: 367
|
Posted: Mon Oct 06, 2008 11:38 am Post subject: |
|
|
Perhaps we should add accelerators/shortcuts for menu items like "quit" and "hide"? |
|
Back to top |
|
|
doob
Joined: 06 Jan 2007 Posts: 367
|
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
|
Back to top |
|
|
doob
Joined: 06 Jan 2007 Posts: 367
|
Posted: Tue Oct 14, 2008 4:58 am Post subject: |
|
|
aldacron wrote: | Anything I need to know before applying it? It works as expected? |
Yes it's working, if I correctly understand everything it should do. I have tested inside a bundle now and that works too.
There are a couple of things I don't know how to do, that is integrate it better with derelict. You can read about that on my first post on this page.
There's one other thing I'm thinking about, the ideal would be to build derelict with both version SDL_USE_NIB_FILE and SDL_USE_CPS enabled but then I can't turn off version SDL_USE_NIB_FILE (at least that I know about) when I'm building my application and that will cause problems when not using a bundle. Everything seems to work fine when inside a bundle even if SDL_USE_NIB_FILE is not enabled. |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Mon Oct 20, 2008 7:06 am Post subject: |
|
|
I've just settled to down to go through the new files and I noticed that ID.d is incomplete. Can you paste the contents here, or attach it to a new ticket? _________________ The One With D | The One With Aldacron | D Bits |
|
Back to top |
|
|
doob
Joined: 06 Jan 2007 Posts: 367
|
Posted: Tue Oct 21, 2008 5:56 am Post subject: |
|
|
I don't know why but none of the files are complete viewing them online but if I click Original Format below "Download in other formats:" at the bottom of the page then I get the complete content. |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Tue Oct 21, 2008 6:01 am Post subject: |
|
|
Yes, that's how I downloaded them, via the original format link. Even so, my copy of ID.d looks like this:
Code: |
/*
* Copyright (c) 2004-2008 Derelict Developers
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the names 'Derelict', 'DerelictSDL', nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
Point me to the full version of the file and I'll patch it on up. _________________ The One With D | The One With Aldacron | D Bits |
|
Back to top |
|
|
doob
Joined: 06 Jan 2007 Posts: 367
|
Posted: Tue Oct 21, 2008 6:14 am Post subject: |
|
|
I've sent you an email with the patch |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Tue Oct 21, 2008 11:09 pm Post subject: |
|
|
doob wrote: | I've sent you an email with the patch |
OK, there was a minor issue with the patch file which caused svn to refuse to apply it. In the end, I did it all manually. So I'll need you to make sure everything compiles and works as it should.
If all is well, we then need to go over everything (particularly SDLMain.d) to see what is essential and what can be cut. _________________ The One With D | The One With Aldacron | D Bits |
|
Back to top |
|
|
doob
Joined: 06 Jan 2007 Posts: 367
|
Posted: Wed Oct 22, 2008 4:03 am Post subject: |
|
|
Sounds good |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
|
Back to top |
|
|
doob
Joined: 06 Jan 2007 Posts: 367
|
Posted: Fri Oct 24, 2008 4:07 am Post subject: |
|
|
Yes it compiles after one small change: DerelictSDL.derelict.sdl.macinit.CoreFoundation:84 change from fCFBundleCopyBundleURL to pfCFBundleCopyBundleURL. It was a missing "p" in the variable name. |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Fri Oct 24, 2008 6:11 am Post subject: |
|
|
Fixed. Thanks a lot for your help with this. I just have one more favor to ask -- can you post the source for a simple, functioning app that demonstrates how to use the macinit code?
From what I see, the user will have to call the macinit function manually during initialization and that's the only thing, right? I'd like to go through and see if there's a way to automate that within DerelictSDL.load. As long as nothing in the Cocoa setup requires the command line, then I assume it should be doable. But before I go there, I'd like to see a working program using the source in its current state.
Sucks not having a Mac to dev on. _________________ The One With D | The One With Aldacron | D Bits |
|
Back to top |
|
|
doob
Joined: 06 Jan 2007 Posts: 367
|
Posted: Fri Oct 24, 2008 3:07 pm Post subject: |
|
|
Yes sure: http://tango.pastebin.com/m2b5fb1b6
Line 15 and 123-127 are mac specific. I guess the lines 123-127 could be placed in DerelictSDL.unload. |
|
Back to top |
|
|
|