Something went wrong. Try again.
Massive multiplayer game aiming to create a collaborative musical environment.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166/*************************************************************************** * This file have been borowed from the Ogre project * @LICENSE CHECK@ ***************************************************************************//*************************************************************************** * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. ***************************************************************************/#include <CoreFoundation/CoreFoundation.h>#include "macPlugins.h"#include "CEGUILogger.h"
int main(void){}
namespace CEGUI { CFBundleRef mac_loadExeBundle(const char* name) { Logger* logger = Logger::getSingletonPtr(); if(logger) { logger->logEvent("---- Beginning exe bundle loading ----"); logger->logEvent(name); logger->logEvent("Get reference to base bundle", Insane); } CFBundleRef baseBundle = CFBundleGetBundleWithIdentifier(CFSTR("net.sourceforge.crayzedsgui.CEGUIBase"));
if(logger) logger->logEvent("Get reference to main bundle", Insane); CFBundleRef mainBundle = CFBundleGetMainBundle(); if(logger) logger->logEvent("Create name", Insane); CFStringRef nameRef = CFStringCreateWithCString(0, name, kCFStringEncodingASCII); CFURLRef bundleURL = 0; //URL of bundle to load CFBundleRef bundle = 0; //bundle to load // Cut off .bundle if present. if(logger) logger->logEvent("Check if .bundle suffix is on name", Insane); if(CFStringHasSuffix(nameRef, CFSTR(".bundle"))) { if(logger) logger->logEvent("Create temporary name reference", Insane); CFStringRef nameTempRef = nameRef; int end = CFStringGetLength(nameTempRef) - CFStringGetLength(CFSTR(".bundle")); nameRef = CFStringCreateWithSubstring(0, nameTempRef, CFRangeMake(0, end));
if(logger) logger->logEvent("Release temporary name reference", Insane); CFRelease(nameTempRef); } // Assume relative to Resources/ directory of application's bundle. if(logger) logger->logEvent("Create bundle URL", Insane); bundleURL = CFBundleCopyResourceURL(mainBundle, nameRef, CFSTR("bundle"), 0); if(bundleURL) { if(logger) logger->logEvent("Create bundle from URL", Insane); bundle = CFBundleCreate(0, bundleURL); if(logger) logger->logEvent("Release bundle URL", Insane); CFRelease(bundleURL); } // Otherwise, try Resources/ directory of CEGUI Framework bundle. if(!bundle) { if(logger) logger->logEvent("Couldn't get bundle from main bundle reference; try base"); bundleURL = CFBundleCopyResourceURL(baseBundle, nameRef, CFSTR("bundle"), 0); if(bundleURL) { if(logger) logger->logEvent("Create bundle from URL", Insane); bundle = CFBundleCreate(0, bundleURL); if(logger) logger->logEvent("Release bundle URL", Insane); CFRelease(bundleURL); } } if(logger) logger->logEvent("Release name reference", Insane); CFRelease(nameRef); if(bundle) { if(logger) logger->logEvent("Load the bundle executable.", Insane); if(CFBundleLoadExecutable(bundle)) { if(logger) logger->logEvent("Bundle loaded successfully."); return bundle; } else { if(logger) logger->logEvent("Bundle loading failed!"); CFRelease(bundle); } } if(logger) logger->logEvent("Failure; return 0", Insane); return 0; } void* mac_getBundleSym(CFBundleRef bundle, const char* name) { Logger* logger = Logger::getSingletonPtr(); if(logger) logger->logEvent("---- Getting bundle symbol ----", Insane); CFStringRef nameRef = CFStringCreateWithCString(0, name, kCFStringEncodingASCII); if(logger) { logger->logEvent("Find function pointer for name: ", Insane); logger->logEvent(name, Insane); } void* sym = CFBundleGetFunctionPointerForName(bundle, nameRef); if(logger) logger->logEvent("Release bundle name", Insane); CFRelease(nameRef); if(logger) logger->logEvent("---- Done getting bundle symbol ----", Insane); return sym; } // Returns 1 on error, 0 otherwise. bool mac_unloadExeBundle(CFBundleRef bundle) { Logger* logger = Logger::getSingletonPtr(); if(logger) logger->logEvent("---- Beginning exe bundle unloading ----"); if(bundle) { if(logger) logger->logEvent("Bundle unloaded.", Insane);
// No-op, can't unload Obj-C bundles without crashing. return 0; } if(logger) logger->logEvent("---- Ending exe bundle unloading ----"); return 1; } const char* mac_errorBundle() { return "Unknown Error"; }
}