Exemple #1
0
void gui_app_exec(int n)
{
	pid_t childpid;
	int status;

	int lenght = strlen ( item->exec_path[n] );

	while ( item->exec_path[n][lenght] != '/' )
		lenght--;

	gui_clean();

	if ((childpid = fork()) == -1)
	{
		perror("Error in the fork");
	}
	else if (childpid == 0)
	{
   		if ( execl( pdm_dir_and("exec.sh"), pdm_dir_and("exec.sh"), item->exec_path[n], str_sub( item->exec_path[n], 0, lenght ), NULL) < 0 )
		{
			perror("Exec failed");
		}
	}
	else if (childpid != wait(&status))
	{ 
		perror("A signal occurred before the child exited");
	}

	gui_init();
	gui_load();
}
Exemple #2
0
/**
 * @brief Loads a GUI.
 *
 *    @param wdw Window triggering function.
 *    @param str Unused.
 */
static void setgui_load( unsigned int wdw, char *str )
{
   (void)str;
   char *gui;
   int wid;

   wid = window_get( _("Select GUI") );
   gui = toolkit_getList( wid, "lstGUI" );
   if (strcmp(gui,_("None")) == 0)
      return;

   if (player.guiOverride == 0) {
      if (dialogue_YesNo( _("GUI Override is not set."),
               _("Enable GUI Override and change GUI to '%s'?"), gui )) {
         player.guiOverride = 1;
         window_checkboxSet( wid, "chkOverride", player.guiOverride );
      }
      else {
         return;
      }
   }

   /* Set the GUI. */
   if (player.gui != NULL)
      free( player.gui );
   player.gui = strdup( gui );

   /* Close menus before loading for proper rendering. */
   setgui_close(wdw, NULL);

   /* Load the GUI. */
   gui_load( gui_pick() );
}
Exemple #3
0
void gui_app_exec( int n )
{
    char fullpath[512];
    strcpy( fullpath, applications[category]->fullpath[n] );

    char id[512];
    strcpy( id, applications[category]->id[n] );

    char exec_name[512];
    strcpy( exec_name, applications[category]->exec_name[n] );

    int clock = applications[category]->clock[n];
    int nox = applications[category]->noX[n];

	gui_clean();

    if ( nox )
    {
        printf( "Application ask noX\n" );

        pnd_apps_exec ( pndrun, fullpath, id, exec_name, fullpath, NULL, clock, PND_EXEC_OPTION_NOX11 );

        exit( 0 );
    }
    else
    {
        printf( "Application do not ask X shutdown\n" );

        pnd_apps_exec ( pndrun, fullpath, id, exec_name, fullpath, NULL, clock, PND_EXEC_OPTION_BLOCK );

        gui_init();
        gui_load();
        //gui_load_preview( category, n );
    }
}
Exemple #4
0
int main( )
{
    gui_init();

	gui_done = 0;

	category = EMULATORS;
	alpha_up = 1;
	alpha = 150;
	reset_scroll_count = 1;

    if ( cfg_pmenu_read() < 1 )
    {
        debug_error( "cfg_pmenu_read failed, exiting..." );
        GLES2D_Quit();
        exit(0);
    }

	if ( cfg_gui_read() < 1 )
    {
        GLES2D_Quit();
        debug_error( "cfg_gui_read failed, exiting..." );
        exit(0);
    }

	gui_load();

	GLES2D_FpsCounterInit();

    nh_countdown = 60;
    debug_func = 0;

    strcpy( now_path, "/media" );

	while( ! gui_done )
	{
        check_rediscover();

		handle_dpad();

		if ( pmenu->effect )
		{
            gui_draw();
            GLES2D_DrawFont( fnt[SMALL], 750, 0, GLES2D_GetFpsChar() );
            GLES2D_SwapBuffers();
            GLES2D_FpsCounterUpdate();
		}

		if( do_quit )
            gui_done = 1;

		//usleep( 10000 );
	}

	gui_clean();

	system( "echo startxfce4 > /tmp/gui.load" );

	return 0;
}
Exemple #5
0
int main(int argc, char *argv[])
{

	int gui_done = 0;
	scroll_count = 800;
	selected_menu = ROMS;
	alpha_up = 1;
	alpha = 0;
	mouse_y_pos = 120;
	selected_option_item = 0;

	if(!cfg_read("config.txt"))
	{
		printf("Fail => cfg_read()\n");
		exit(0);
	}

	if(!gui_init_sdl())
	{
		printf("Fail => gui_init_sdl()\n");
		exit(0);
	}

	emu_config_init();
	
	gui_load();

	strncpy(now_path, config->roms_path, MAXPATH);
	filer_read_dir(now_path);

	SDL_initFramerate( &sixteen );
	SDL_setFramerate( &sixteen, 65 );

	while(!gui_done)
	{
		handle_mouse();

		while( SDL_PollEvent( &event ) )
		{	
			switch(event.type)
			{
				case SDL_QUIT:
				{
					gui_clean();
					free(emu);
					exit(0);
				}
				break;
			}
		}
		gui_draw();
		SDL_Flip(myscreen);
		SDL_framerateDelay( &sixteen );
	}
	return 0;
}
Exemple #6
0
int main( int argc, char *argv[] )
{
	selected_item = 0;
	scroll_count = 800;
	alpha_up = 1;
	alpha = 0;

	if ( argc > 1 )
	{
		strcpy( pdm_dir, argv[1] );
		if ( pdm_dir[strlen(pdm_dir)-1] != '/' )
			strcat( pdm_dir, "/" );
	}
	else
	{
		fprintf(stderr, "Usage: %s pdm_exec_dir\n", argv[0] );
		exit(0);
	}

	write_pid();
	
	printf("reading configuration file: %s\n", pdm_dir_and("data/pdm.conf") );
	cfg_read( pdm_dir_and("data/pdm.conf") );

	if( general->autoboot_item >= 0 )
	{
		execl( item->exec_path[general->autoboot_item], item->exec_path[general->autoboot_item], NULL);
		free( item );
		free( general );
		exit(0);
	}

	gui_init();
	gui_load();

	while( !gui_done )
	{
		gui_draw();

		gui_events();
	}	

	gui_clean();
	free(item);
	free(general);

	return 0;
}
Exemple #7
0
/**
 * @brief Loads a GUI.
 *
 *    @param wdw Window triggering function.
 *    @param str Unused.
 */
static void setgui_load( unsigned int wdw, char *str )
{
   (void)str;
   char *gui;
   int wid;

   wid = window_get( "Select GUI" );
   gui = toolkit_getList( wid, "lstGUI" );
   if (strcmp(gui,"None") == 0)
      return;

   /* Set the GUI. */
   if (player.gui != NULL)
      free( player.gui );
   player.gui = strdup( gui );

   /* Close menus before loading for proper rendering. */
   setgui_close(wdw, NULL);

   /* Load the GUI. */
   gui_load( gui_pick() );
}
Exemple #8
0
int gui_init(int argc, char **argv)
{
	if (gui == NULL) {
		gui = (struct _GuiCore*)malloc(sizeof(struct _GuiCore));
		if (gui == NULL) return -1;
	}

	
	memset(gui, 0, sizeof(struct _GuiCore) );
	gui->running = 1;
	gui->need_update = 1;

	register_widget("Window"     , &window_ops      );
	register_widget("ListBox"    , &listbox_ops     );
	register_widget("ListBoxItem", &listboxitem_ops );
	register_widget("Button"     , &button_ops      );
	register_widget("Image"      , &image_ops       );
	register_widget("label"      , &label_ops       );
	register_widget("NoteBook"   , &notebook_ops    );
	register_widget("MessageBox"   , &msgbox_ops    );
//	register_widget("MessageBox" , &messagebox_ops	);

	gui->signal_hash = hash_new(1, signal_Free      );
	gui->font_hash   = hash_new(1, FontDesc_Free    );
	gui->image_hash  = hash_new(9, ImageDesc_Free   );
	gui->theme_hash  = hash_new(1, Theme_Free       );

	gui->win_stack   = stack_new(NULL);
	gui->root_widget = widget_new("root", "Window", NULL);
	gui->argc = argc;
	gui->argv = argv;

	if (gui_load("./gui.xml") != 0 ) return -1;
	if (sdl_init(gui->width, gui->height, gui->bpp) != 0) return -1;

	return 0;
}
Exemple #9
0
void emu_exec(int n)
{
	pid_t childpid;
	int status;

	gui_clean();

	arg = (ARGS *) malloc( sizeof(ARGS));

	int n_args = build_args();

	char exec_rom[512];
	sprintf( exec_rom, "%s/%s", config->roms_path, roms[n] );

	if ((childpid = fork()) == -1)
	{
		printf("Error in the fork");
	}
	else if (childpid == 0)
	{
		printf("childpid OK\n");

		if(n_args == 0)
		{
			if (execl(emu->exec, emu->exec, exec_rom, NULL) < 0) printf("Exec failed");
		}
		else if(n_args == 1)
		{
			if (execl(emu->exec, emu->exec,  arg->value[0], exec_rom, NULL) < 0) printf("Exec failed");
		}
		else if(n_args == 2)
		{
			if (execl(emu->exec, emu->exec,  arg->value[0], arg->value[1], exec_rom, NULL) < 0) printf("Exec failed");
		}
		else if(n_args == 3)
		{
			if (execl(emu->exec, emu->exec,  arg->value[0], arg->value[1], arg->value[2], exec_rom, NULL) < 0) printf("Exec failed");
		}
		else if(n_args == 4)
		{
			printf("args : %s %s %s %s\n", arg->value[0], arg->value[1], arg->value[2], arg->value[3] );
			if (execl(emu->exec, emu->exec,  arg->value[0], arg->value[1], arg->value[2], arg->value[3], exec_rom, NULL) < 0) printf("Exec failed");
		}
		else if(n_args == 5)
		{
			if (execl(emu->exec, emu->exec,  arg->value[0], arg->value[1], arg->value[2], arg->value[3], arg->value[4], exec_rom, NULL) < 0) printf("Exec failed");
		}
		else if(n_args == 6)
		{
			if (execl(emu->exec, emu->exec,  arg->value[0], arg->value[1], arg->value[2], arg->value[3], arg->value[4], arg->value[5], exec_rom, NULL) < 0) printf("Exec failed");
		}
		else if(n_args == 7)
		{
			if (execl(emu->exec, emu->exec,  arg->value[0], arg->value[1], arg->value[2], arg->value[3], arg->value[4], arg->value[5], arg->value[6], exec_rom, NULL) < 0) printf("Exec failed");
		}
		else if(n_args == 8)
		{
			if (execl(emu->exec, emu->exec,   arg->value[0], arg->value[1], arg->value[2], arg->value[3], arg->value[4], arg->value[5], arg->value[6], arg->value[7], exec_rom, NULL) < 0) printf("Exec failed");
		}
		else if(n_args == 9)
		{
			if (execl(emu->exec, emu->exec,  arg->value[0], arg->value[1], arg->value[2], arg->value[3], arg->value[4], arg->value[5], arg->value[6], arg->value[7], arg->value[8], exec_rom, NULL) < 0) printf("Exec failed");
		}
		else if(n_args == 10)
		{
			if (execl(emu->exec, emu->exec,  arg->value[0], arg->value[1], arg->value[2], arg->value[3], arg->value[4], arg->value[5], arg->value[6], arg->value[7], arg->value[8], arg->value[9], exec_rom, NULL) < 0) printf("Exec failed");
		}
		else if(n_args == 11)
		{
			if (execl(emu->exec, emu->exec,  arg->value[0], arg->value[1], arg->value[2], arg->value[3], arg->value[4], arg->value[5], arg->value[6], arg->value[7], arg->value[8], arg->value[9], arg->value[10], exec_rom, NULL) < 0) printf("Exec failed");
		}
		else if(n_args == 12)
		{
			if (execl(emu->exec, emu->exec,  arg->value[0], arg->value[1], arg->value[2], arg->value[3], arg->value[4], arg->value[5], arg->value[6], arg->value[7], arg->value[8], arg->value[9], arg->value[10], arg->value[11], exec_rom, NULL) < 0) printf("Exec failed");
		}
		else if(n_args == 13)
		{
			if (execl(emu->exec, emu->exec,  arg->value[0], arg->value[1], arg->value[2], arg->value[3], arg->value[4], arg->value[5], arg->value[6], arg->value[7], arg->value[8], arg->value[9], arg->value[10], arg->value[11], arg->value[12], exec_rom, NULL) < 0) printf("Exec failed");
		}
		else if(n_args == 14)
		{
			if (execl(emu->exec, emu->exec,  arg->value[0], arg->value[1], arg->value[2], arg->value[3], arg->value[4], arg->value[5], arg->value[6], arg->value[7], arg->value[8], arg->value[9], arg->value[10], arg->value[11], arg->value[12], arg->value[13], exec_rom, NULL) < 0) printf("Exec failed");
		}
	}
	else if (childpid != wait(&status))
	{ 
		printf("A signal occurred before the child exited");
	}

	free(arg);
	gui_init_sdl();
	gui_load();
}