Wintermute Engine Forum

Wintermute Engine => WME Lite => Topic started by: Dan Peach on April 13, 2012, 11:58:03 PM

Title: Compiling for iOS
Post by: Dan Peach on April 13, 2012, 11:58:03 PM
Ok, so I have my Mac and I have my xcode.....I don't understand what to do now. I'm starting right at the bottom with this iOS development, having not used a Mac ever before today.  :(

I'm supposed to download the "sources", but where exactly can I find those? And once I have downloaded them, what do I do with them? And what are the "dependencies"...?

A little nudge in the right direction to get me on my way would be most helpful.  :)
Title: Re: Compiling for iOS
Post by: joaomesq on April 15, 2012, 02:17:00 PM
Sources - the software - can be downloaded from

Like most software nowadays, WME uses libraries provided by the operating system and third parties that are responsible for low-level functionality that would be very tedious for the software writer to do them himself. Sometimes, these are called "dependencies". In the link above, you will also find all the dependencies you will need.

Title: Re: Compiling for iOS
Post by: Dan Peach on April 15, 2012, 03:38:05 PM
Thanks.  :)

Which is the "source" download in that list? In the WME Lite documentation it says I should get the sources from the SVN repository, but I don't know how to do that.

And then, once I have these sources, what do I do with them?

I'm porting my current game from Windows to iOS just as a test, so I've changed all my WME scripts to take into account the iOS touchscreen, removed the video files, removed the rotating sprites etc., so I'm all ready to compile, but I don't know where to start with that as I've never used a Mac or Xcode before in my life. :)
Title: Re: Compiling for iOS
Post by: MaaS on April 19, 2012, 05:45:54 PM
Hi there... just a question  ;D

Where should I put the data.dcp? In the wme lite documentation It says that I should put it inside "xcode-ios/wmelite" ... and there it is... (the compiled data.dcp from the wme  touch demo)... When you open the project it appears inside the Resources folder.

The dcp runs on windows and mac, so I suposse I'm doing something wrong.

PS. Xcode debugger stops at class directory_iterator of operations.hpp, line "{ detail::directory_iterator_construct(*this, p, 0); }" with a EXC_BAD_ACCESS... with i suposse its "i dont find the file" sort of thing hehe :P

Title: Re: Compiling for iOS
Post by: MaaS on April 19, 2012, 06:21:11 PM
A few more info... it stops when scanning packages... there are 4 paths, but it stops a the first one on "for (directory_iterator dit(absPath); dit != endIter; ++dit)"


Code: [Select]

EDIT: More on that... when running on emulator it seems to pass the package checking... LOG:

Code: [Select]
12:17:32: Scanning: /Users/MaaS/Library/Application Support/iPhone Simulator/5.0/Applications/58979FF0-943E-4C6B-806C-645B4694BAEA/
12:24:11: /Users/MaaS/Library/Application Support/iPhone Simulator/5.0/Applications/58979FF0-943E-4C6B-806C-645B4694BAEA/
12:24:18: /Users/MaaS/Library/Application Support/iPhone Simulator/5.0/Applications/58979FF0-943E-4C6B-806C-645B4694BAEA/
12:24:20: /Users/MaaS/Library/Application Support/iPhone Simulator/5.0/Applications/58979FF0-943E-4C6B-806C-645B4694BAEA/
12:24:23: /Users/MaaS/Library/Application Support/iPhone Simulator/5.0/Applications/58979FF0-943E-4C6B-806C-645B4694BAEA/
12:24:33: /Users/MaaS/Library/Application Support/iPhone Simulator/5.0/Applications/58979FF0-943E-4C6B-806C-645B4694BAEA/
12:24:35: /Users/MaaS/Library/Application Support/iPhone Simulator/5.0/Applications/58979FF0-943E-4C6B-806C-645B4694BAEA/
12:24:37: /Users/MaaS/Library/Application Support/iPhone Simulator/5.0/Applications/58979FF0-943E-4C6B-806C-645B4694BAEA/
12:24:38: /Users/MaaS/Library/Application Support/iPhone Simulator/5.0/Applications/58979FF0-943E-4C6B-806C-645B4694BAEA/
12:24:40: /Users/MaaS/Library/Application Support/iPhone Simulator/5.0/Applications/58979FF0-943E-4C6B-806C-645B4694BAEA/
12:24:41: /Users/MaaS/Library/Application Support/iPhone Simulator/5.0/Applications/58979FF0-943E-4C6B-806C-645B4694BAEA/
12:24:42: /Users/MaaS/Library/Application Support/iPhone Simulator/5.0/Applications/58979FF0-943E-4C6B-806C-645B4694BAEA/

12:25:44: Scanning: /Users/MaaS/Library/Application Support/iPhone Simulator/5.0/Applications/58979FF0-943E-4C6B-806C-645B4694BAEA/
12:25:46: /Users/MaaS/Library/Application Support/iPhone Simulator/5.0/Applications/58979FF0-943E-4C6B-806C-645B4694BAEA/

12:25:55: Scanning: /Users/MaaS/Library/Application Support/iPhone Simulator/5.0/Applications/58979FF0-943E-4C6B-806C-645B4694BAEA/

12:25:56: Scanning: /Users/MaaS/Library/Application Support/iPhone Simulator/5.0/Applications/58979FF0-943E-4C6B-806C-645B4694BAEA/\

12:26:01:   Registered 1063 files in 1 package(s)

But when running on the device it breaks... if debugging you got "path absPath = system_complete(m_PackagePaths);" with the path "/private/var/mobile/Applications/68DABE61-187F-4CEF-9CF4-85FE1875291F/" inside but when you do "!exists(auxpath)" the path inside turns nil... :?:?:?

Is there any settings that could be preventing the app to access the directory?
Title: Re: Compiling for iOS
Post by: MaaS on April 21, 2012, 11:47:09 PM
Ok... I couldnt fix it hehe... not so used to xcode... so I just changed all the RegisterPackages() method looking for dcp files... to directly register the files.

Title: Re: Compiling for iOS
Post by: genuinefafa on July 06, 2012, 12:50:17 AM

I am having the same problem here...  ???

[EDIT] I can probably do this, but, but, but, ...

But I was unable to apply your solution. I mean...
1. operations.hpp [check]
2. directory_iterator class [check]
3. Apply RegisterPackages() [wrong]

Maybe you can share a .diff file trought pastebin or something for people like me to figure it out?

I really apreciate it.
Title: Re: Compiling for iOS
Post by: MaaS on October 21, 2012, 11:55:44 AM
Oh my, sorry...

I have to put that project on pause so I didnt come here for a while :/

What I did was to comment the part where the engine looks for any dcp file and register the package myself. It's just a patch...

The file is BFileManager.cpp, I changed the method HRESULT CBFileManager::RegisterPackages() for this thing :

Code: [Select]
HRESULT CBFileManager::RegisterPackages()

Game->LOG(0, "Scanning packages...");

/*AnsiString extension = AnsiString(".") + AnsiString(PACKAGE_EXTENSION);
    Game->LOG(0, "Total Paths: %i", m_PackagePaths.GetSize());
for(int i=0; i<m_PackagePaths.GetSize(); i++)
path absPath = system_complete(m_PackagePaths[i]);
Game->LOG(0, "Paths: %s", absPath.string().c_str());
for(int i=0; i<m_PackagePaths.GetSize(); i++)
path absPath = system_complete(m_PackagePaths[i]);
        //path auxpath = system_complete(m_PackagePaths[i]);

Game->LOG(0, "Scanning: %s", absPath.string().c_str());
//printf("Scanning: %s\n", absPath.string().c_str());

if (!exists(absPath)) continue;

// scan files
directory_iterator endIter;
        //directory_iterator aux(absPath);
for (directory_iterator dit(absPath); dit != endIter; ++dit)
if (!is_directory((*dit).status()))
AnsiString fileName = (*dit).path().string();
                Game->LOG(0, fileName.c_str());
if (!IsValidPackage(fileName)) continue;

//printf("%s\n", fileName.c_str());

if (!StringUtil::CompareNoCase(extension, PathUtil::GetExtension(fileName))) continue;
                Game->LOG(0, "REGISTRANDO: %s -> %s",absPath.string().c_str(),dit->path().filename().string().c_str());
RegisterPackage(absPath.string().c_str(), dit->path().filename().string().c_str());
    path absPath = system_complete(m_PackagePaths[0]);
    RegisterPackage(absPath.string().c_str(), "data.dcp");

Game->LOG(0, "  Registered %d files in %d package(s)", m_Files.size(), m_Packages.GetSize());

return S_OK;

As you see, everything is commented and I just did a

path absPath = system_complete(m_PackagePaths[0]);
RegisterPackage(absPath.string().c_str(), "data.dcp");

... And the file data.dcp is inside the resource folder of the project. I hope this helps and it's not too late :)
Title: Re: Compiling for iOS
Post by: genuinefafa on November 20, 2012, 08:14:40 PM

I have more info on that matter. I know where is our problem, now. :)
It's in the boost library. WME uses many differents external dependencies, in particular

Both of them must be compiled for the specific arquitecture/compiler/technology. I cannot be of more help, yet.
I'll create a new post on the forum regarding this specific issue.

Anyways, answering the former question, packages can be added wherever you want to, the important thing is that they reside inside the build.

See this screenshot of our build, for example,

ps: If you care about point-and-click adventures, you can vote for Reversion Chapter 2 on Greenlight -