// Constructor
j1App::j1App(int argc, char* args[]) : argc(argc), args(args)
{
	frames = 0;

	input = new j1Input();
	win = new j1Window();
	render = new j1Render();
	tex = new j1Textures();
	audio = new j1Audio();
	scene = new j1Scene();
	fs = new j1FileSystem("data.zip");

	// Ordered for awake / Start / Update
	// Reverse order of CleanUp
	AddModule(fs);
	AddModule(input);
	AddModule(win);
	AddModule(tex);
	AddModule(audio);
	AddModule(scene);

	// render last to swap buffer
	AddModule(render);
}
Example #2
0
extern int InitMsyms()

{
	auto int	rtn,
			tmp;

	auto struct kernel_sym	*ksym_table,
				*p;


	/* Initialize the kernel module symbol table. */
	FreeModules();


	/*
	 * The system call which returns the kernel symbol table has
	 * essentialy two modes of operation.  Called with a null pointer
	 * the system call returns the number of symbols defined in the
	 * the table.
	 *
	 * The second mode of operation is to pass a valid pointer to
	 * the call which will then load the current symbol table into
	 * the memory provided.
	 *
	 * Returning the symbol table is essentially an all or nothing
	 * proposition so we need to pre-allocate enough memory for the
	 * complete table regardless of how many symbols we need.
	 *
	 * Bummer.
	 */
	if ( (rtn = getsyms((struct kernel_sym *) 0)) < 0 )
	{
		if ( errno == ENOSYS )
			TRACE("No module symbols loaded - "
			      "kernel modules not enabled.\n");
		else
			TRACE("Error loading kernel symbols "
			      "- %s\n", strerror(errno));
		return(0);
	}
	if ( debugging )
		fprintf(stderr, "Loading kernel module symbols - "
			"Size of table: %d\n", rtn);

	ksym_table = (struct kernel_sym *) malloc(rtn * \
						  sizeof(struct kernel_sym));
	if ( ksym_table == (struct kernel_sym *) 0 )
	{
		TRACE("Failed memory allocation for kernel " \
		      "symbol table.\n");
		return(0);
	}
	if ( (rtn = getsyms(ksym_table)) < 0 )
	{
		TRACE("Error reading kernel symbols - %s\n", strerror(errno));
		return(0);
	}


	/*
	 * Build a symbol table compatible with the other one used by
	 * klogd.
	 */
	tmp = rtn;
	p = ksym_table;
	while ( tmp-- )
	{
 		if ( !AddModule(p->value, p->name) )
		{
			TRACE("Error adding kernel module table entry.\n");
			free(ksym_table);
			return(0);
		}
		++p;
	}

	/* Sort the symbol tables in each module. */
	for (rtn = tmp= 0; tmp < num_modules; ++tmp)
	{
		rtn += sym_array_modules[tmp].num_syms;
		if ( sym_array_modules[tmp].num_syms < 2 )
			continue;
		qsort(sym_array_modules[tmp].sym_array, \
		      sym_array_modules[tmp].num_syms, \
		      sizeof(struct sym_table), symsort);
	}

	if ( rtn == 0 )
		TRACE("No module symbols loaded.");
	else
		TRACE("Loaded %d %s from %d module%s", rtn, \
		      (rtn == 1) ? "symbol" : "symbols", \
		      num_modules, (num_modules == 1) ? "." : "s.");
	free(ksym_table);
	return(1);
}
Example #3
0
Application::Application()
{
	renderer = new ModuleRender(this);
	window = new ModuleWindow(this);
	textures = new ModuleTextures(this);
	input = new ModuleInput(this);
	audio = new ModuleAudio(this);
	scene = new ModuleScene(this, false);
	fade = new ModuleFadeToBlack(this);
	particles = new ModuleParticles(this);
	player = new ModulePlayer(this, false);
	enemy = new ModuleEnemy(this, false);
	collision = new ModuleCollision(this, false);
	timer = new ModuleTimer(this, false);
	intro = new ModuleSceneIntro(this, true);
	level = new ModuleLevel(this, false);

	// The order of calls is very important!
	// Modules will Init() Start() and Update in this order
	// They will CleanUp() in reverse order

	// Main Modules
	AddModule(window);
	AddModule(renderer);
	AddModule(textures);
	AddModule(input);
	AddModule(audio);
	
	
	// Scenes
	AddModule(intro);
	AddModule(scene);
	AddModule(timer);
	

	// Misc
	
	AddModule(particles);
	AddModule(collision);
	AddModule(level);

	// Characters
	AddModule(player);
	AddModule(enemy);


	AddModule(fade); // let this after all drawing
}
XnStatus XnStreamReaderDevice::SetInitialState(const XnDeviceConfig* pDeviceConfig, XnPropertySet* pSet)
{
	XnStatus nRetVal = XN_STATUS_OK;
	
	// Fix state (remove some properties that we don't wish to reflect in reader device)
	XnActualPropertiesHash* pDeviceModule = NULL;
	if (XN_STATUS_OK == pSet->pData->Get(XN_MODULE_NAME_DEVICE, pDeviceModule))
	{
		pDeviceModule->Remove(XN_MODULE_PROPERTY_READ_WRITE_MODE);
		pDeviceModule->Remove(XN_MODULE_PROPERTY_PRIMARY_STREAM);
	}

	// now init base using this state (this will also create module DEVICE)
	XnDeviceConfig initConfig;
	initConfig.cpConnectionString = pDeviceConfig->cpConnectionString;
	initConfig.DeviceMode = pDeviceConfig->DeviceMode;
	initConfig.pInitialValues = pSet;
	initConfig.SharingMode = pDeviceConfig->SharingMode;

	nRetVal = XnStreamDevice::InitImpl(&initConfig);
	XN_IS_STATUS_OK(nRetVal);

	// now create the rest of the modules and streams (DEVICE was already created)
	XnPropertySetData* pPropSetData = pSet->pData;
	for (XnPropertySetData::ConstIterator it = pPropSetData->begin(); it != pPropSetData->end(); ++it)
	{
		// ignore module DEVICE
		if (strcmp(XN_MODULE_NAME_DEVICE, it.Key()) == 0)
		{
			continue;
		}

		// check if this is a stream
		XnActualPropertiesHash::ConstIterator itProp = it.Value()->end();
		if (XN_STATUS_OK == it.Value()->Find(XN_STREAM_PROPERTY_TYPE, itProp))
		{
			XnActualStringProperty* pTypeProp = (XnActualStringProperty*)itProp.Value();
			nRetVal = HandleNewStream(pTypeProp->GetValue(), it.Key(), it.Value());
			XN_IS_STATUS_OK(nRetVal);
		}
		else
		{
			// this is module. create it
			XnDeviceModuleHolder* pHolder = NULL;
			nRetVal = CreateModule(it.Key(), &pHolder);
			XN_IS_STATUS_OK(nRetVal);

			// set its props
			nRetVal = pHolder->Init(it.Value());
			if (nRetVal != XN_STATUS_OK)
			{
				DestroyModule(pHolder);
				return (nRetVal);
			}

			// and add it
			nRetVal = AddModule(pHolder);
			if (nRetVal != XN_STATUS_OK)
			{
				DestroyModule(pHolder);
				return (nRetVal);
			}
		}
	} // modules loop
	
	return (XN_STATUS_OK);
}
Example #5
0
// Constructor
j1App::j1App(int argc, char* args[]) : argc(argc), args(args)
{
	PERF_START(ptimer);

	input = new j1Input();
	win = new j1Window();
	render = new j1Render();
	tex = new j1Textures();
	audio = new j1Audio();
	scene = new j1Scene();
	fs = new j1FileSystem();
	map = new j1Map();
	pathfinding = new j1PathFinding();
	font = new j1Fonts();
	gui = new j1Gui();

	// Ordered for awake / Start / Update
	// Reverse order of CleanUp
	AddModule(fs);
	AddModule(input);
	AddModule(win);
	AddModule(tex);
	AddModule(audio);
	AddModule(map);
	AddModule(pathfinding);
	AddModule(font);
	AddModule(gui);
	
	// scene last
	AddModule(scene);

	// render last to swap buffer
	AddModule(render);

	PERF_PEEK(ptimer);
}
Example #6
0
XnStatus XnDeviceBase::CreateStreamImpl(const XnChar* strType, const XnChar* strName, const XnActualPropertiesHash* pInitialSet)
{
	XnStatus nRetVal = XN_STATUS_OK;

	xnLogInfo(XN_MASK_DDK, "Creating stream '%s' of type '%s'...", strName, strType);

	XnDeviceModule* pModule;
	if (FindModule(strName, &pModule) == XN_STATUS_OK)
	{
		// already exists. check sharing mode (when shared, we allow "creating" the same stream)
		if (GetSharingMode() != XN_DEVICE_SHARED ||
			!IsStream(pModule) ||
			strcmp(strType, ((XnDeviceStream*)pModule)->GetType()) != 0)
		{
			XN_LOG_WARNING_RETURN(XN_STATUS_STREAM_ALREADY_EXISTS, XN_MASK_DDK, "A stream with this name already exists!");
		}

		// OK, we'll allow this. Just set new configuration
		if (pInitialSet != NULL)
		{
			nRetVal = pModule->BatchConfig(*pInitialSet);
			XN_IS_STATUS_OK(nRetVal);
		}
	}
	else
	{
		// create stream
		XnDeviceModuleHolder* pNewStreamHolder = NULL;

		nRetVal = CreateStreamModule(strType, strName, &pNewStreamHolder);
		XN_IS_STATUS_OK(nRetVal);

		XnDeviceStream* pNewStream = (XnDeviceStream*)(pNewStreamHolder->GetModule());
		if (pNewStream == NULL)
		{
			DestroyStreamModule(pNewStreamHolder);
			XN_LOG_ERROR_RETURN(XN_STATUS_ERROR, XN_MASK_DDK, "Internal Error: Invalid new stream!");
		}

		// initialize the stream
		xnLogVerbose(XN_MASK_DDK, "Initializing stream '%s'...", strName);

		nRetVal = pNewStreamHolder->Init(pInitialSet);
		if (nRetVal != XN_STATUS_OK)
		{
			DestroyStreamModule(pNewStreamHolder);
			return (nRetVal);
		}

		// set it's mirror value (if not requested otherwise)
		XnBool bSetMirror = TRUE;

		if (pInitialSet != NULL)
		{
			XnActualPropertiesHash::ConstIterator it = pInitialSet->end();
			if (XN_STATUS_OK == pInitialSet->Find(XN_MODULE_PROPERTY_MIRROR, it))
			{
				bSetMirror = FALSE;
			}
		}

		if (bSetMirror)
		{
			nRetVal = pNewStream->SetMirror((XnBool)m_DeviceMirror.GetValue());
			if (nRetVal != XN_STATUS_OK)
			{
				DestroyStreamModule(pNewStreamHolder);
				return (nRetVal);
			}
		}

		// add it to the list of existing modules
		nRetVal = AddModule(pNewStreamHolder);
		if (nRetVal != XN_STATUS_OK)
		{
			DestroyStreamModule(pNewStreamHolder);
			return (nRetVal);
		}

		xnLogInfo(XN_MASK_DDK, "Stream '%s' was initialized.", strName);

		nRetVal = StreamAdded(pNewStream);
		XN_IS_STATUS_OK(nRetVal);

		xnLogInfo(XN_MASK_DDK, "'%s' stream was created.", strName);
	}

	return (XN_STATUS_OK);
}
Example #7
0
void CExarchEngine::MsgAddModule (const SArchonMessage &Msg, const CHexeSecurityCtx *pSecurityCtx)

//	MsgAddModule
//
//	Exarch.addModule [{machineName}] {filePath} [{debug}]

	{
	CSmartLock Lock(m_cs);
	CString sError;

	//	Must be admin service

	if (!ValidateSandboxAdmin(Msg, pSecurityCtx))
		return;

	//	Get parameters

	bool bHasMachineName = (Msg.dPayload.GetCount() >= 2 && !strEndsWith(strToLower(Msg.dPayload.GetElement(0)), STR_EXE_SUFFIX));
	int iArg = 0;
	CString sMachineName = (bHasMachineName ? Msg.dPayload.GetElement(iArg++) : NULL_STR);
	CString sModuleFilePath = Msg.dPayload.GetElement(iArg++);
	CDatum dDebug = Msg.dPayload.GetElement(iArg++);

	//	If we have a machine name, try to parse it in case the user gave us
	//	a partial name.

	if (bHasMachineName)
		{
		if (!ParseMachineName(sMachineName, &sMachineName))
			{
			SendMessageReplyError(MSG_ERROR_UNABLE_TO_COMPLY, strPattern("Unknown machine: %s", sMachineName), Msg);
			return;
			}
		}

	//	If this is not for our machine, then we need to send a message to the
	//	other machine.

	if (!sMachineName.IsEmpty()
			&& !strEqualsNoCase(GetMachineName(), sMachineName))
		{
		CString sAddress = GenerateMachineAddress(sMachineName, ADDRESS_EXARCH_COMMAND);
		if (sAddress.IsEmpty())
			{
			SendMessageReplyError(MSG_ERROR_UNABLE_TO_COMPLY, strPattern("Unable to generate address for: %s", sMachineName), Msg);
			return;
			}

		StartSession(Msg, new CAddModuleSession(this, sAddress, sModuleFilePath));
		}

	//	Otherwise, we add a local module

	else
		{
		//	Add the module

		CString sModuleName;
		if (!AddModule(sModuleFilePath, strEqualsNoCase(dDebug, FIELD_DEBUG), &sModuleName, &sError))
			{
			SendMessageReplyError(MSG_ERROR_UNABLE_TO_COMPLY, sError, Msg);
			return;
			}

		//	Add it to our list of modules

		CComplexArray *pModuleList = new CComplexArray(m_dMachineConfig.GetElement(FIELD_MODULES));
		pModuleList->Append(CDatum(sModuleName));

		CComplexStruct *pConfig = new CComplexStruct(m_dMachineConfig);
		pConfig->SetElement(FIELD_MODULES, CDatum(pModuleList));
		m_dMachineConfig = CDatum(pConfig);

		//	Save it

		WriteConfig();

		//	Done

		SendMessageReply(MSG_OK, CDatum(), Msg);
		}
	}
Example #8
0
/*************************************************************************
 *
 * m a i n
 */
int
main(int argc, char* argv[])
{
    int errcode = SUCCESS;
    PRBool createdb, readOnly;
#define STDINBUF_SIZE 80
    char stdinbuf[STDINBUF_SIZE];

    progName = strrchr(argv[0], '/');
    progName = progName ? progName + 1 : argv[0];

    PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);

    if (parse_args(argc, argv) != SUCCESS) {
        usage();
        errcode = INVALID_USAGE_ERR;
        goto loser;
    }

    if (verify_params() != SUCCESS) {
        usage();
        errcode = INVALID_USAGE_ERR;
        goto loser;
    }

    if (command == NO_COMMAND) {
        PR_fprintf(PR_STDERR, errStrings[NO_COMMAND_ERR]);
        usage();
        errcode = INVALID_USAGE_ERR;
        goto loser;
    }

    /* Set up crypto stuff */
    createdb = command == CREATE_COMMAND;
    readOnly = ((command == LIST_COMMAND) ||
                (command == CHKFIPS_COMMAND) ||
                (command == RAW_LIST_COMMAND));

    /* Make sure browser is not running if we're writing to a database */
    /* Do this before initializing crypto */
    if (!readOnly && !force) {
        char* response;

        PR_fprintf(PR_STDOUT, msgStrings[BROWSER_RUNNING_MSG]);
        if (!PR_fgets(stdinbuf, STDINBUF_SIZE, PR_STDIN)) {
            PR_fprintf(PR_STDERR, errStrings[STDIN_READ_ERR]);
            errcode = STDIN_READ_ERR;
            goto loser;
        }
        if ((response = strtok(stdinbuf, " \r\n\t"))) {
            if (!PL_strcasecmp(response, "q")) {
                PR_fprintf(PR_STDOUT, msgStrings[ABORTING_MSG]);
                errcode = SUCCESS;
                goto loser;
            }
        }
        PR_fprintf(PR_STDOUT, "\n");
    }

    errcode = check_crypto(createdb, readOnly);
    if (errcode != SUCCESS) {
        goto loser;
    }

    if ((command == RAW_LIST_COMMAND) || (command == RAW_ADD_COMMAND)) {
        if (!moduleName) {
            char *readOnlyStr, *noCertDBStr, *sep;
            if (!secmodName)
                secmodName = "secmod.db";
            if (!dbprefix)
                dbprefix = "";
            sep = ((command == RAW_LIST_COMMAND) && nocertdb) ? "," : " ";
            readOnlyStr = (command == RAW_LIST_COMMAND) ? "readOnly" : "";
            noCertDBStr = nocertdb ? "noCertDB" : "";
            SECU_ConfigDirectory(dbdir);

            moduleName = PR_smprintf(
                "name=\"NSS default Module DB\" parameters=\"configdir=%s certPrefix=%s "
                "keyPrefix=%s secmod=%s flags=%s%s%s\" NSS=\"flags=internal,moduleDB,"
                "moduleDBOnly,critical\"",
                SECU_ConfigDirectory(NULL), dbprefix, dbprefix,
                secmodName, readOnlyStr, sep, noCertDBStr);
        }
        if (command == RAW_LIST_COMMAND) {
            errcode = RawListModule(moduleName);
        } else {
            PORT_Assert(moduleSpec);
            errcode = RawAddModule(moduleName, moduleSpec);
        }
        goto loser;
    }

    errcode = init_crypto(createdb, readOnly);
    if (errcode != SUCCESS) {
        goto loser;
    }

    errcode = LoadMechanismList();
    if (errcode != SUCCESS) {
        goto loser;
    }

    /* Execute the command */
    switch (command) {
        case ADD_COMMAND:
            errcode = AddModule(moduleName, libFile, ciphers, mechanisms, secmodString);
            break;
        case CHANGEPW_COMMAND:
            errcode = ChangePW(tokenName, pwFile, newpwFile);
            break;
        case CREATE_COMMAND:
            /* The work was already done in init_crypto() */
            break;
        case DEFAULT_COMMAND:
            errcode = SetDefaultModule(moduleName, slotName, mechanisms);
            break;
        case DELETE_COMMAND:
            errcode = DeleteModule(moduleName);
            break;
        case DISABLE_COMMAND:
            errcode = EnableModule(moduleName, slotName, PR_FALSE);
            break;
        case ENABLE_COMMAND:
            errcode = EnableModule(moduleName, slotName, PR_TRUE);
            break;
        case FIPS_COMMAND:
            errcode = FipsMode(fipsArg);
            break;
        case CHKFIPS_COMMAND:
            errcode = ChkFipsMode(fipsArg);
            break;
        case JAR_COMMAND:
            Pk11Install_SetErrorHandler(install_error);
            errcode = Pk11Install_DoInstall(jarFile, installDir, tempDir,
                                            PR_STDOUT, force, nocertdb);
            break;
        case LIST_COMMAND:
            if (moduleName) {
                errcode = ListModule(moduleName);
            } else {
                errcode = ListModules();
            }
            break;
        case UNDEFAULT_COMMAND:
            errcode = UnsetDefaultModule(moduleName, slotName, mechanisms);
            break;
        default:
            PR_fprintf(PR_STDERR, "This command is not supported yet.\n");
            errcode = INVALID_USAGE_ERR;
            break;
    }

    if (NSS_Shutdown() != SECSuccess) {
        exit(1);
    }

loser:
    PR_Cleanup();
    return errcode;
}
		void DoBuildDependancies()override
		{
			AddModule(GetAssociatedProcessingUnit()->GetModule(MyModuleA::kUniqueId));
		}
Example #10
0
int main(int argc, char **argv)
{
	AddModule(nextArg());
}
Example #11
0
///////////////////////////////////////////////////////////////
//
// CPerfStatManagerImpl::CPerfStatManagerImpl
//
//
//
///////////////////////////////////////////////////////////////
CPerfStatManagerImpl::CPerfStatManagerImpl ( void )
{
    AddModule ( CPerfStatLuaTiming::GetSingleton () );
    AddModule ( CPerfStatLuaMemory::GetSingleton () );
    AddModule ( CPerfStatLibMemory::GetSingleton () );
    AddModule ( CPerfStatPacketUsage::GetSingleton () );
    AddModule ( CPerfStatSqliteTiming::GetSingleton () );
    AddModule ( CPerfStatBandwidthReduction::GetSingleton () );
    AddModule ( CPerfStatBandwidthUsage::GetSingleton () );
    AddModule ( CPerfStatServerInfo::GetSingleton () );
    AddModule ( CPerfStatServerTiming::GetSingleton () );
    AddModule ( CPerfStatFunctionTiming::GetSingleton () );
    AddModule ( CPerfStatDebugInfo::GetSingleton () );
    AddModule ( CPerfStatDebugTable::GetSingleton () );
}
Example #12
0
TSharedPtr<IModuleInterface> FModuleManager::LoadModuleWithFailureReason(const FName InModuleName, EModuleLoadResult& OutFailureReason, bool bWasReloaded /*=false*/)
{
	DECLARE_SCOPE_CYCLE_COUNTER(TEXT("Module Load"), STAT_ModuleLoad, STATGROUP_LoadTime);

#if	STATS
	// This is fine here, we only load a handful of modules.
	static FString Module = TEXT( "Module" );
	const FString LongName = Module / InModuleName.GetPlainNameString();
	const TStatId StatId = FDynamicStats::CreateStatId<FStatGroup_STATGROUP_UObjects>( LongName );
	FScopeCycleCounter CycleCounter( StatId );
#endif // STATS

	TSharedPtr<IModuleInterface> LoadedModule;
	OutFailureReason = EModuleLoadResult::Success;

	// Update our set of known modules, in case we don't already know about this module
	AddModule( InModuleName );

	// Grab the module info.  This has the file name of the module, as well as other info.
	TSharedRef< FModuleInfo > ModuleInfo = Modules.FindChecked( InModuleName );

	if (ModuleInfo->Module.IsValid())
	{
		// Assign the already loaded module into the return value, otherwise the return value gives the impression the module failed load!
		LoadedModule = ModuleInfo->Module;
	}
	else
	{
	// Make sure this isn't a module that we had previously loaded, and then unloaded at shutdown time.
	//
	// If this assert goes off, your trying to load a module during the shutdown phase that was already
	// cleaned up.  The easiest way to fix this is to change your code to query for an already-loaded
	// module instead of trying to load it directly.
	checkf((!ModuleInfo->bWasUnloadedAtShutdown), TEXT("Attempted to load module '%s' that was already unloaded at shutdown.  FModuleManager::LoadModule() was called to load a module that was previously loaded, and was unloaded at shutdown time.  If this assert goes off, your trying to load a module during the shutdown phase that was already cleaned up.  The easiest way to fix this is to change your code to query for an already-loaded module instead of trying to load it directly."), *InModuleName.ToString());

	// Check if we're statically linked with the module.  Those modules register with the module manager using a static variable,
	// so hopefully we already know about the name of the module and how to initialize it.
	const FInitializeStaticallyLinkedModule* ModuleInitializerPtr = StaticallyLinkedModuleInitializers.Find(InModuleName);
		if (ModuleInitializerPtr != NULL)
	{
		const FInitializeStaticallyLinkedModule& ModuleInitializer(*ModuleInitializerPtr);

		// Initialize the module!
		ModuleInfo->Module = MakeShareable(ModuleInitializer.Execute());

		if (ModuleInfo->Module.IsValid())
		{
			// Startup the module
			ModuleInfo->Module->StartupModule();

			// Module was started successfully!  Fire callbacks.
			ModulesChangedEvent.Broadcast(InModuleName, EModuleChangeReason::ModuleLoaded);

			// Set the return parameter
			LoadedModule = ModuleInfo->Module;
		}
		else
		{
			UE_LOG(LogModuleManager, Warning, TEXT("ModuleManager: Unable to load module '%s' because InitializeModule function failed (returned NULL pointer.)"), *InModuleName.ToString());
			OutFailureReason = EModuleLoadResult::FailedToInitialize;
		}
	}
#if IS_MONOLITHIC
		else
		{
	// Monolithic builds that do not have the initializer were *not found* during the build step, so return FileNotFound
	// (FileNotFound is an acceptable error in some case - ie loading a content only project)
	UE_LOG(LogModuleManager, Warning, TEXT("ModuleManager: Module '%s' not found - its StaticallyLinkedModuleInitializers function is null."), *InModuleName.ToString());
	OutFailureReason = EModuleLoadResult::FileNotFound;
		}
#endif
#if !IS_MONOLITHIC
		else
		{
	// Make sure that any UObjects that need to be registered were already processed before we go and
	// load another module.  We just do this so that we can easily tell whether UObjects are present
	// in the module being loaded.
	if (bCanProcessNewlyLoadedObjects)
	{
		ProcessLoadedObjectsCallback.Broadcast();
	}

	// Try to dynamically load the DLL

	UE_LOG(LogModuleManager, Verbose, TEXT("ModuleManager: Load Module '%s' DLL '%s'"), *InModuleName.ToString(), *ModuleInfo->Filename);

	// Determine which file to load for this module.
	const FString ModuleFileToLoad = FPaths::ConvertRelativePathToFull(ModuleInfo->Filename);

	// Clear the handle and set it again below if the module is successfully loaded
	ModuleInfo->Handle = NULL;

	// Skip this check if file manager has not yet been initialized
			if (FPaths::FileExists(ModuleFileToLoad))
	{
				if (CheckModuleCompatibility(*ModuleFileToLoad))
	{
	ModuleInfo->Handle = FPlatformProcess::GetDllHandle(*ModuleFileToLoad);
					if (ModuleInfo->Handle != NULL)
	{
	// First things first.  If the loaded DLL has UObjects in it, then their generated code's
	// static initialization will have run during the DLL loading phase, and we'll need to
	// go in and make sure those new UObject classes are properly registered.
	{
		// Sometimes modules are loaded before even the UObject systems are ready.  We need to assume
		// these modules aren't using UObjects.
		if (bCanProcessNewlyLoadedObjects)
		{
			// OK, we've verified that loading the module caused new UObject classes to be
			// registered, so we'll treat this module as a module with UObjects in it.
			ProcessLoadedObjectsCallback.Broadcast();
		}
	}

	// Find our "InitializeModule" global function, which must exist for all module DLLs
						FInitializeModuleFunctionPtr InitializeModuleFunctionPtr =
							(FInitializeModuleFunctionPtr)FPlatformProcess::GetDllExport(ModuleInfo->Handle, TEXT("InitializeModule"));
						if (InitializeModuleFunctionPtr != NULL)
						{
							// Initialize the module!
							ModuleInfo->Module = MakeShareable(InitializeModuleFunctionPtr());

							if (ModuleInfo->Module.IsValid())
							{
								// Startup the module
								ModuleInfo->Module->StartupModule();

								// Module was started successfully!  Fire callbacks.
								ModulesChangedEvent.Broadcast(InModuleName, EModuleChangeReason::ModuleLoaded);

								// Set the return parameter
								LoadedModule = ModuleInfo->Module;
							}
							else
	{
								UE_LOG(LogModuleManager, Warning, TEXT("ModuleManager: Unable to load module '%s' because InitializeModule function failed (returned NULL pointer.)"), *ModuleFileToLoad);

		FPlatformProcess::FreeDllHandle(ModuleInfo->Handle);
		ModuleInfo->Handle = NULL;
		OutFailureReason = EModuleLoadResult::FailedToInitialize;
							}
	}
						else
	{
							UE_LOG(LogModuleManager, Warning, TEXT("ModuleManager: Unable to load module '%s' because InitializeModule function was not found."), *ModuleFileToLoad);

		FPlatformProcess::FreeDllHandle(ModuleInfo->Handle);
		ModuleInfo->Handle = NULL;
		OutFailureReason = EModuleLoadResult::FailedToInitialize;
						}
					}
					else
					{
						UE_LOG(LogModuleManager, Warning, TEXT("ModuleManager: Unable to load module '%s' because the file couldn't be loaded by the OS."), *ModuleFileToLoad);
						OutFailureReason = EModuleLoadResult::CouldNotBeLoadedByOS;
					}
				}
				else
				{
					// The log warning about this failure reason is within CheckModuleCompatibility
					OutFailureReason = EModuleLoadResult::FileIncompatible;
				}
			}
			else
			{
				UE_LOG(LogModuleManager, Warning, TEXT("ModuleManager: Unable to load module '%s' because the file '%s' was not found."), *InModuleName.ToString(), *ModuleFileToLoad);
				OutFailureReason = EModuleLoadResult::FileNotFound;
			}
	}
#endif
	}