/* main plugin entry point */
enum plugin_status plugin_start(const void* parameter)
{
    size_t size = 0xffff;
    sound_on = false;

#ifdef HAVE_ADJUSTABLE_CPU_FREQ
    rb->cpu_boost(true);
#endif
    rb->backlight_on();
    rb->lcd_clear_display();

    VROM = (BYTE*)rb->plugin_get_audio_buffer(&size);
    ROM = (BYTE*) VROM + 0xffff * 8;
    wfx = (WORD*)(ROM + 0xffff * 16);
    ApuEventQueue = (struct ApuEvent_t*)(wfx + LCD_HEIGHT * NES_DISP_WIDTH);

  /* Start ROM file if specified */
  if (parameter)
  {
    if (start_application((char*) parameter))
    {
      /* MainLoop */
      InfoNES_Main();

      /* End */
      SaveSRAM();
    }
    else
    {
      rb->splash(HZ, "Not a valid NES ROM!!");
      return PLUGIN_OK;
    }
  }
  else
  {
     rb->splash(HZ*3/2, "Play NES ROM file!");
     return PLUGIN_OK;
  }
return PLUGIN_OK;
}
Esempio n. 2
0
void *InfoNES_Proc(void *pArgs)
{
	JNIEnv* pEnv;
	NES_CONTEXT *pNesContext = (NES_CONTEXT *)pArgs;
	LOGV("InfoNES_Proc start, pNesContext = %x, thread id = %d", pNesContext, pthread_self() );

	JavaVMAttachArgs lJavaVMAttachArgs;
	lJavaVMAttachArgs.version = JNI_VERSION_1_6;
	lJavaVMAttachArgs.name = "NativeThread";
	lJavaVMAttachArgs.group = NULL;
	if ((*(pNesContext->pJavaVM))->AttachCurrentThread(pNesContext->pJavaVM, &pEnv, &lJavaVMAttachArgs)
			!= JNI_OK) {
		LOGV("InfoNES_Proc failed 1");
		pthread_exit(NULL);
	}

	InfoNES_Main();
//	pthread_exit((void *)1);
	LOGV("InfoNES_Proc finish, pNesContext = %x, thread id = %d", pNesContext, pNesContext->threadNes );
	(*(pNesContext->pJavaVM))->DetachCurrentThread(pNesContext->pJavaVM);
	pthread_exit(NULL);
}