コード例 #1
0
ファイル: launch.c プロジェクト: CNCBASHER/LasaurApp
/* once init'ed, you might want to extractBinaries()
 * If you do, what comes after is very platform specific.
 * Once you've taken care of the platform specific details,
 * or if there are no binaries to extract, you go on
 * to doIt(), which is the important part
 */
int doIt(ARCHIVE_STATUS *status, int argc, char *argv[])
{
	int rc = 0;
	/* Load Python DLL */
	if (loadPython(status))
		return -1;

	/* Start Python. */
	if (startPython(status, argc, argv))
		return -1;

	/* Import modules from archive - bootstrap */
	if (importModules(status))
		return -1;

	/* Install zlibs  - now all hooks in place */
	if (installZlibs(status))
		return -1;

	/* Run scripts */
	rc = runScripts(status);

	VS("OK.\n");

	return rc;
}
コード例 #2
0
ファイル: GameEngineC.cpp プロジェクト: Cethric/GameEngineC
bool GameEngineC::prepare(int width, int height, InitialiseCallback callback) {
    if (loadGLFW(width, height) && loadAntTweakBar(width, height) && loadPython()) {
        callback();
        return true;
    }
    return false;
}
コード例 #3
0
ファイル: launch.c プロジェクト: ludisnet/ludisoft
/*
 * Launch an archive with the given fully-qualified path name
 * No command line, no extracting of binaries
 * Designed for embedding situations.
 */
int launchembedded(char const * archivePath, char  const * archiveName)
{
	char pathnm[_MAX_PATH];

	VS("START\n");
	strcpy(pathnm, archivePath);
	strcat(pathnm, archiveName);
	/* Set up paths */
	if (setPaths(archivePath, archiveName))
		return -1;
	VS("Got Paths\n");
	/* Open the archive */
	if (openArchive())
		return -1;
	VS("Opened Archive\n");
	/* Load Python DLL */
	if (loadPython())
		return -1;

	/* Start Python with silly command line */
	if (startPython(1, (char**)&pathnm))
		return -1;
	VS("Started Python\n");

	/* a signal to scripts */
	PyRun_SimpleString("import sys;sys.frozen='dll'\n");
	VS("set sys.frozen\n");
	/* Import modules from archive - this is to bootstrap */
	if (importModules())
		return -1;
	VS("Imported Modules\n");
	/* Install zlibs - now import hooks are in place */
	if (installZlibs())
		return -1;
	VS("Installed Zlibs\n");
	/* Run scripts */
	if (runScripts())
		return -1;
	VS("All scripts run\n");
	if (PyErr_Occurred()) {
		// PyErr_Print();
		//PyErr_Clear();
		VS("Some error occurred\n");
	}
	VS("OK.\n");

	return 0;
}
コード例 #4
0
ファイル: launch.c プロジェクト: ludisnet/ludisoft
/*
 * use this from a dll instead of loadPython()
 * it will attach to an existing pythonXX.dll,
 * or load one if needed.
 */
int attachPython(int *loadedNew)
{
	HMODULE dll;
	char nm[_MAX_PATH + 1];

	/* Get python's name */
	sprintf(nm, "python%02d.dll", ntohl(f_cookie.pyvers));

	/* See if it's loaded */
	dll = GetModuleHandle(nm);  
	if (dll == 0) {
		*loadedNew = 1;
		return loadPython();
	}
	mapNames(dll);
	*loadedNew = 0;
	return 0;
}
コード例 #5
0
ファイル: launch.c プロジェクト: CNCBASHER/LasaurApp
/*
 * use this from a dll instead of loadPython()
 * it will attach to an existing pythonXX.dll,
 * or load one if needed.
 */
int attachPython(ARCHIVE_STATUS *status, int *loadedNew)
{
#ifdef WIN32
	HMODULE dll;
	char nm[_MAX_PATH + 1];
    int pyvers = ntohl(status->cookie.pyvers);

	/* Get python's name */
	sprintf(nm, "python%02d.dll", pyvers);

	/* See if it's loaded */
	dll = GetModuleHandleA(nm);
	if (dll == 0) {
		*loadedNew = 1;
		return loadPython(status);
	}
	mapNames(dll, pyvers);
	*loadedNew = 0;
#endif
	return 0;
}