Esempio n. 1
0
static jboolean Emulator_loadROM(JNIEnv *env, jobject self, jstring jfile)
{
	unloadROM(env, self);

	const char *file = env->GetStringUTFChars(jfile, NULL);
	jboolean rv = JNI_FALSE;

	currentGame = engine->loadRom(file);
	if (currentGame == NULL)
		goto error;

	gameSpeed = 1.0f;
	media->audioCreate(env,
			currentGame->soundRate,
			currentGame->soundBits,
			currentGame->soundChannels);

	memset(trackballEvents, 0, sizeof(trackballEvents));

	resumeEmulator();
	rv = JNI_TRUE;
error:
	env->ReleaseStringUTFChars(jfile, file);
	return rv;
}
Esempio n. 2
0
static void Emulator_cleanUp(JNIEnv *env, jobject self)
{
	unloadROM();

	pthread_mutex_lock(&emuStateMutex);
	emuState = EMUSTATE_QUIT;
	pthread_cond_signal(&emuStateCond);
	pthread_mutex_unlock(&emuStateMutex);

	if (audioPlayer != NULL) {
		audioPlayer->destroy();
		audioPlayer = NULL;
	}
	if (engine != NULL) {
		engine->destroy();
		engine = NULL;
	}
}
Esempio n. 3
0
static jboolean Emulator_loadROM(JNIEnv *env, jobject self, jstring jfile)
{
	unloadROM();

	const char *file = env->GetStringUTFChars(jfile, NULL);
	jboolean rv = JNI_FALSE;

	currentGame = engine->loadRom(file);
	if (currentGame == NULL)
		goto error;

	if (audioPlayer != NULL) {
		audioPlayer->init(
			currentGame->soundRate,
			currentGame->soundBits,
			currentGame->soundChannels);
	}

	resumeEmulator();
	rv = JNI_TRUE;
error:
	env->ReleaseStringUTFChars(jfile, file);
	return rv;
}
Esempio n. 4
0
static void Emulator_unloadROM(JNIEnv *env, jobject self)
{
	unloadROM();
}