Hello guys,
I have been coding a neat little replacement front-end for the GP2X, and was looking for a bit of advice, particulary from Ryo (gmenu2x), as that is a very good project.
Basicly, I have already written all the GUI functionality, which is working really well. Taskbar, multiple desktops, containers, dialogs, menus, etc are all implimented.
But now im moving onto the actual core of the project, and unfortunatly its something I know very little about. Im currently trying to work on a function to run an external application on the GP2X, such as "mygame.gpe", then return control back to ACID-2X (my front-end).
I have some clever little data structures for storing 'link' information, but the actual process of executing the external application I am not having luck with. Here is the code I am using:
Any ideas? If someone can push me in the right direction I would appreciate that very much!...
Also, the standard GPH application. I notice since FW2.1 that only mplayer and MusicPlayer are still stand-alone programs... That kinda sucks, but part of ACID-2X will be developing a decent text reader etc... anyway.
What command lines does mplayer and MusicPlayer take?
I have been coding a neat little replacement front-end for the GP2X, and was looking for a bit of advice, particulary from Ryo (gmenu2x), as that is a very good project.
Basicly, I have already written all the GUI functionality, which is working really well. Taskbar, multiple desktops, containers, dialogs, menus, etc are all implimented.
But now im moving onto the actual core of the project, and unfortunatly its something I know very little about. Im currently trying to work on a function to run an external application on the GP2X, such as "mygame.gpe", then return control back to ACID-2X (my front-end).
I have some clever little data structures for storing 'link' information, but the actual process of executing the external application I am not having luck with. Here is the code I am using:
Code:
bool executeExternal(char *exec_path, char *cmd_line) {
// function parameters
pid_t pid;
int rv;
int commpipe[2];
// setup communication pipeline
if (pipe(commpipe)) {
return false;
}
// now attempt to unix FORK!
pid = fork();
if (pid == -1) {
return false;
}
// if the process is ACID-2X
if (pid){
dup2(commpipe[1],1);
close(commpipe[0]);
setvbuf(stdout,(char*)NULL,_IONBF,0);
wait(&rv);
// if the process is child
} else{
dup2(commpipe[0],0);
close(commpipe[1]);
if (execl(exec_path, cmd_line, NULL) == -1){
return false;
}
}
return true;
}
Any ideas? If someone can push me in the right direction I would appreciate that very much!...
Also, the standard GPH application. I notice since FW2.1 that only mplayer and MusicPlayer are still stand-alone programs... That kinda sucks, but part of ACID-2X will be developing a decent text reader etc... anyway.
What command lines does mplayer and MusicPlayer take?