示例#1
0
void iphone_main(int argc, char *argv[]) {

	//OSystem_IPHONE::migrateApp();

	FILE *newfp = fopen("/var/mobile/.scummvm.log", "a");
	if (newfp != NULL) {
		fclose(stdout);
		fclose(stderr);
		*stdout = *newfp;
		*stderr = *newfp;
		setbuf(stdout, NULL);
		setbuf(stderr, NULL);

		//extern int gDebugLevel;
		//gDebugLevel = 10;
	}

#ifdef IPHONE_SANDBOXED
	chdir(iPhone_getDocumentsDir());
#else
	system("mkdir " SCUMMVM_ROOT_PATH);
	system("mkdir " SCUMMVM_SAVE_PATH);

	chdir("/var/mobile/");
#endif

	g_system = OSystem_IPHONE_create();
	assert(g_system);

	// Invoke the actual ScummVM main entry point:
	scummvm_main(argc, argv);
	g_system->quit();       // TODO: Consider removing / replacing this!
}
示例#2
0
int main(void) {
	//change clock rate to 333mhz
	scePowerSetClockFrequency(333, 333, 166);

	PowerManager::instance();	// Setup power manager

	SetupCallbacks();

	static const char *argv[] = { "scummvm", NULL };
	static int argc = sizeof(argv) / sizeof(char *) - 1;

	g_system = new OSystem_PSP();
	assert(g_system);

#ifdef DYNAMIC_MODULES
	PluginManager::instance().addPluginProvider(new PSPPluginProvider());
#endif

/* unit/speed tests */
#if defined (PSP_ENABLE_UNIT_TESTS) || defined (PSP_ENABLE_SPEED_TESTS)
	PSP_INFO_PRINT("running tests\n");
	psp_tests();
	sceKernelSleepThread();	// that's it. That's all we're doing
#endif

	int res = scummvm_main(argc, argv);

	g_system->quit();	// TODO: Consider removing / replacing this!

	PowerManager::destroy();	// get rid of PowerManager

	sceKernelSleepThread();

	return res;
}
示例#3
0
int main(int argc, char *argv[]) {

#ifdef __SWITCH_DEBUG__
	socketInitializeDefault();
	nxlinkStdio();
#endif

	// Create our OSystem instance
	g_system = new OSystem_Switch();
	assert(g_system);

	// Pre initialize the backend
	((OSystem_Switch *)g_system)->init();

#ifdef DYNAMIC_MODULES
	PluginManager::instance().addPluginProvider(new SDLPluginProvider());
#endif

	// Invoke the actual ScummVM main entry point:
	int res = scummvm_main(argc, argv);

	// Free OSystem
	g_system->destroy();

#ifdef __SWITCH_DEBUG__
	socketExit();
#endif

	return res;
}
示例#4
0
文件: main.cpp 项目: Tkachov/scummvm
int main(int argc, char *argv[]) {
	// Initialize basic libctru stuff
	gfxInitDefault();
	cfguInit();
	osSetSpeedupEnable(true);
// 	consoleInit(GFX_TOP, NULL);

	g_system = new _3DS::OSystem_3DS();
	assert(g_system);

	// Invoke the actual ScummVM main entry point
// 	if (argc > 2)
// 		res = scummvm_main(argc-2, &argv[2]);
// 	else
// 		res = scummvm_main(argc, argv);
	scummvm_main(0, nullptr);

	delete dynamic_cast<_3DS::OSystem_3DS*>(g_system);
	
	// Turn on both screen backlights before exiting.
	if (R_SUCCEEDED(gspLcdInit())) {
		GSPLCD_PowerOnBacklight(GSPLCD_SCREEN_BOTH);
		gspLcdExit();
	}
	
	cfguExit();
	gfxExit();
	return 0;
}
示例#5
0
文件: null.cpp 项目: peres/scummvm
int main(int argc, char *argv[]) {
	g_system = OSystem_NULL_create();
	assert(g_system);

	// Invoke the actual ScummVM main entry point:
	int res = scummvm_main(argc, argv);
	delete (OSystem_NULL *)g_system;
	return res;
}
示例#6
0
int main(void) {
	g_system = new OSystem_N64();
	assert(g_system);

	// Invoke the actual ScummVM main entry point:
	int res = scummvm_main(0, NULL);
	g_system->quit();       // TODO: Consider removing / replacing this!
	return res;
}
示例#7
0
int main(int argc, char *argv[]) {

	// The following will gather the application name and add the install path
	// to a variable in AmigaOS4's ENV(ARC) system. It will be placed in AppPaths
	// so that ScummVM can become AmiUpdate aware
	const char *const appname = "ScummVM";

	BPTR lock;
	APTR oldwin;

	// Obtain a lock to the home directory
	if ((lock = IDOS->GetProgramDir())) {
		TEXT progpath[2048];
		TEXT apppath[1024] = "AppPaths";

		if (IDOS->DevNameFromLock(lock,
			progpath,
			sizeof(progpath),
			DN_FULLPATH)) {

			// Stop any "Insert volume..." type requesters
			oldwin = IDOS->SetProcWindow((APTR)-1);

			// Finally, set the variable to the path the executable was run from
			IDOS->AddPart( apppath, appname, 1024);
			IDOS->SetVar( apppath, progpath, -1, GVF_GLOBAL_ONLY|GVF_SAVE_VAR );

			// Turn system requesters back on
			IDOS->SetProcWindow( oldwin );
		}
	}

	// Set up a stack cookie to avoid crashes from a stack set too low
	static const char *stack_cookie __attribute__((used)) = "$STACK: 600000";

	// Create our OSystem instance
	g_system = new OSystem_AmigaOS();
	assert(g_system);

	// Pre initialize the backend
	((OSystem_AmigaOS *)g_system)->init();

#ifdef DYNAMIC_MODULES
	PluginManager::instance().addPluginProvider(new SDLPluginProvider());
#endif

	// Invoke the actual ScummVM main entry point
	int res = scummvm_main(argc, argv);

	// Free OSystem
	delete (OSystem_AmigaOS *)g_system;

	return res;
}
示例#8
0
int main(int argc, char *argv[]) {

	g_system = new OSystem_GP2XWIZ();
	assert(g_system);

#ifdef DYNAMIC_MODULES
	PluginManager::instance().addPluginProvider(new POSIXPluginProvider());
#endif

	// Invoke the actual ScummVM main entry point:
	int res = scummvm_main(argc, argv);
	g_system->quit();

	return res;
}
示例#9
0
int main(int argc, char *argv[]) {

	// Create our OSystem instance
	g_system = new OSystem_LINUXMOTO();
	assert(g_system);

	// Pre initialize the backend
	((OSystem_POSIX *)g_system)->init();

	// Invoke the actual ScummVM main entry point:
	int res = scummvm_main(argc, argv);

	// Free OSystem
	delete (OSystem_LINUXMOTO *)g_system;

	return res;
}
示例#10
0
int main(int argc, char* argv[]) {
	g_system = new OSystem_SDL_WebOS();
	assert(g_system);

	((OSystem_SDL_WebOS *)g_system)->init();

#ifdef DYNAMIC_MODULES
	PluginManager::instance().addPluginProvider(new SDLPluginProvider());
#endif

	// Invoke the actual ScummVM main entry point:
	int res = scummvm_main(argc, argv);

	// Free OSystem
	delete (OSystem_SDL_WebOS *)g_system;

	return res;
}
示例#11
0
static void palm_main(int argc, char **argvP)  {
#ifdef COMPILE_OS5
	if (gVars->advancedMode)
		g_system = new OSystem_PalmOS5Ex();
	else
		g_system = new OSystem_PalmOS5();
#elif defined(COMPILE_ZODIAC)
	g_system = new OSystem_PalmZodiac();
#else
	#error "No target defined."
#endif

	assert(g_system);

	// Invoke the actual ScummVM main entry point:
	scummvm_main(argc, argvP);

	g_system->quit();	// TODO: Consider removing / replacing this!
}
示例#12
0
int main(int argc, char *argv[]) {
	// Create our OSystem instance
	g_system = new OSystem_Win32();
	assert(g_system);

	// Pre initialize the backend
	((OSystem_Win32 *)g_system)->init();

#ifdef DYNAMIC_MODULES
	PluginManager::instance().addPluginProvider(new SDLPluginProvider());
#endif

	// Invoke the actual ScummVM main entry point:
	int res = scummvm_main(argc, argv);

	// Free OSystem
	delete (OSystem_Win32 *)g_system;

	return res;
}
示例#13
0
extern "C" int Game_Main(char *path, char *) {
	chdir(path);

	// Create OSystem instance
	g_system = new OSystem_SDL_SamsungTV();
	assert(g_system);

	// Pre initialize the backend
	((OSystem_POSIX *)g_system)->init();

#ifdef DYNAMIC_MODULES
	PluginManager::instance().addPluginProvider(new SDLPluginProvider());
#endif

	// Invoke the actual ScummVM main entry point:
	int res = scummvm_main(0, 0);

	// Free OSystem
	g_system->destroy();

	return res;
}
示例#14
0
// Symbian SDL_Main implementation
// Redirects standard io, creates Symbian specific SDL backend (inherited from main SDL)
int main(int argc, char *argv[]) {
	//
	// Set up redirects for stdout/stderr under Symbian.
	// Code copied from SDL_main.
	//

	// Symbian does not like any output to the console through any *print* function
	char STDOUT_FILE[256], STDERR_FILE[256]; // shhh, don't tell anybody :)
	strcpy(STDOUT_FILE, Symbian::GetExecutablePath());
	strcpy(STDERR_FILE, Symbian::GetExecutablePath());
	strcat(STDOUT_FILE, "scummvm.stdout.txt");
	strcat(STDERR_FILE, "scummvm.stderr.txt");

	/* Flush the output in case anything is queued */
	fclose(stdout);
	fclose(stderr);

	/* Redirect standard input and standard output */
	FILE *newfp = freopen(STDOUT_FILE, "w", stdout);
	if (newfp == NULL) {	/* This happens on NT */
#if !defined(stdout)
		stdout = fopen(STDOUT_FILE, "w");
#else
		newfp = fopen(STDOUT_FILE, "w");
		if (newfp) {
			*stdout = *newfp;
		}
#endif
	}
	newfp = freopen(STDERR_FILE, "w", stderr);
	if (newfp == NULL) {	/* This happens on NT */
#if !defined(stderr)
		stderr = fopen(STDERR_FILE, "w");
#else
		newfp = fopen(STDERR_FILE, "w");
		if (newfp) {
			*stderr = *newfp;
		}
#endif
	}
	setbuf(stderr, NULL);			/* No buffering */

	// Create our OSystem instance
	g_system = new OSystem_SDL_Symbian();
	assert(g_system);

	// Pre initialize the backend
	((OSystem_SDL_Symbian *)g_system)->init();

#ifdef DYNAMIC_MODULES
	PluginManager::instance().addPluginProvider(new SDLPluginProvider());
#endif

	// Invoke the actual ScummVM main entry point:
	int res = scummvm_main(argc, argv);

	// Free OSystem
	delete (OSystem_SDL_Symbian *)g_system;

	return res;
}
示例#15
0
int main(int argc, char *argv[]) {
	s32 res;

#if defined(USE_WII_DI) && !defined(GAMECUBE)
	DI_Init();
#endif

	VIDEO_Init();
	PAD_Init();
	DSP_Init();
	AUDIO_Init(NULL);

	gfx_video_init(NULL);
	gfx_init();
	gfx_con_init(NULL);

#ifdef DEBUG_WII_GDB
	DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
#endif

	printf("startup as ");
	if (argc > 0)
		printf("'%s'\n", argv[0]);
	else
		printf("<unknown>\n");

	SYS_RegisterResetFunc(&resetinfo);

	SYS_SetResetCallback(reset_cb);
#ifndef GAMECUBE
	SYS_SetPowerCallback(power_cb);
#endif

	if (!fatInitDefault()) {
		printf("fatInitDefault failed\n");
	} else {
		// set the default path if libfat couldnt set it
		// this allows loading over tcp/usbgecko
		char cwd[MAXPATHLEN];

		if (getcwd(cwd, MAXPATHLEN)) {
			size_t len = strlen(cwd);

			if (len > 2 && (cwd[len - 1] == ':' || cwd[len - 2] == ':')) {
				printf("chdir to default\n");
				chdir("/apps/scummvm");
			}
		}
	}

	g_system = new OSystem_Wii();
	assert(g_system);

#ifdef DYNAMIC_MODULES
	PluginManager::instance().addPluginProvider(new WiiPluginProvider());
#endif

	res = scummvm_main(argc, argv);
	g_system->quit();

	printf("shutdown\n");

	SYS_UnregisterResetFunc(&resetinfo);
	fatUnmountDefault();

	if (res)
		show_console(res);

	if (power_btn_pressed) {
		printf("shutting down\n");
		SYS_ResetSystem(SYS_POWEROFF, 0, 0);
	}

	printf("reloading\n");

	gfx_con_deinit();
	gfx_deinit();
	gfx_video_deinit();

	return res;
}
示例#16
0
jint JNI::main(JNIEnv *env, jobject self, jobjectArray args) {
	assert(_system);

	const int MAX_NARGS = 32;
	int res = -1;

	int argc = env->GetArrayLength(args);
	if (argc > MAX_NARGS) {
		throwByName(env, "java/lang/IllegalArgumentException",
					"too many arguments");
		return 0;
	}

	char *argv[MAX_NARGS];

	// note use in cleanup loop below
	int nargs;

	for (nargs = 0; nargs < argc; ++nargs) {
		jstring arg = (jstring)env->GetObjectArrayElement(args, nargs);

		if (arg == 0) {
			argv[nargs] = 0;
		} else {
			const char *cstr = env->GetStringUTFChars(arg, 0);

			argv[nargs] = const_cast<char *>(cstr);

			// exception already thrown?
			if (cstr == 0)
				goto cleanup;
		}

		env->DeleteLocalRef(arg);
	}

	LOGI("Entering scummvm_main with %d args", argc);

	res = scummvm_main(argc, argv);

	LOGI("scummvm_main exited with code %d", res);

	_system->quit();

cleanup:
	nargs--;

	for (int i = 0; i < nargs; ++i) {
		if (argv[i] == 0)
			continue;

		jstring arg = (jstring)env->GetObjectArrayElement(args, nargs);

		// Exception already thrown?
		if (arg == 0)
			return res;

		env->ReleaseStringUTFChars(arg, argv[i]);
		env->DeleteLocalRef(arg);
	}

	return res;
}
示例#17
0
int main(int argc, char *argv[]) {
	s32 res;

#ifdef USE_WII_DI
	DI_Init();
#endif

	VIDEO_Init();
	PAD_Init();
	AUDIO_Init(NULL);

#ifdef DEBUG_WII_USBGECKO
	CON_EnableGecko(1, false);
#endif

#ifdef DEBUG_WII_GDB
	DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
#endif

	printf("startup as ");
	if (argc > 0)
		printf("'%s'\n", argv[0]);
	else
		printf("<unknown>\n");

	SYS_SetResetCallback(reset_cb);
#ifndef GAMECUBE
	SYS_SetPowerCallback(power_cb);
#endif

#ifdef USE_WII_DI
	// initial async mount for the browser, see wii-fs.cpp
	DI_Mount();
#endif

	if (!fatInitDefault()) {
		printf("fatInitDefault failed\n");
	} else {
		// set the default path if libfat couldnt set it
		// this allows loading over tcp/usbgecko
		char cwd[MAXPATHLEN];

		if (getcwd(cwd, MAXPATHLEN)) {
			size_t len = strlen(cwd);

			if (len > 2 && (cwd[len - 1] == ':' || cwd[len - 2] == ':')) {
				printf("chdir to default\n");
				chdir("/apps/scummvm");
			}
		}
	}

	g_system = new OSystem_Wii();
	assert(g_system);

	res = scummvm_main(argc, argv);
	g_system->quit();

	printf("shutdown\n");

	fatUnmountDefault();

#ifdef USE_WII_DI
	DI_Close();
#endif

	if (power_btn_pressed) {
		printf("shutting down\n");
		SYS_ResetSystem(SYS_POWEROFF, 0, 0);
	}

	printf("reloading\n");

	return res;
}