This is something that should go in the Hijack FAQ when it is properly commented here...
How do I write a program for the hijack menu?
(My examples are mainly taken from empacman)
This program should write a "hello world" on the screen.
After getting (making?) an ARM-cross-compiler (see Mark Lord's hijack page for how) you need the hijack.h and empeg.h files. The only way to get these is to download from MArk's page the linux-tree and all the patches and patch the tree, pick out these *.h files and delete the rest of the three.
Compile the program with
gcc vfdlib.c helloworld.c -o helloworld.
Transfer helloworld to the empeg, chmod +x and then run it before the player application is run, using one of the pre-init methods.
When you now acess the hijack-menu, you see another menu item, and when you select that, you get "Hello World" on screen for a while (60sec? 60min?)
Needs a little "niceness" of the code, I cut'n pasted from my files.
/*Includes needed: (maybe not all are needed?)*/
#include <stdlib.h>
#include <sys/ioctl.h>
#include "hijack.h"
#include <time.h>
#include <sys/time.h>
#include <linux/errno.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include "vfdlib.h"
/* hijack.h and vfdlib.h must be aquired from their sources*/
int main(){
/*Variables needed:*/
unsigned char screenbuf[EMPEG_SCREEN_BYTES] = {0,};
hijack_geom_t geom= {Xmin,Xmax,Ymin,Ymax}; /* the size of your "window" on screen when the player is running */
int g_fd, rc; /* a file descriptor and a return code */
/* you need to fork...*/
if(fork() != 0) {
return 0;
}
else {
int pid = getpid();
printf("myprog running as pid %d\n", pid);
/* open the display */
g_fd = open("/dev/display", O_RDWR);
while (1) {
/* Bind to emepg menu and stay there */
char *menulabels[] = {"helloworld", NULL};
rc = ioctl(g_fd, EMPEG_HIJACK_WAITMENU, menulabels);
if (rc < 0) {
perror("failed EMPEG_HIJACK_WAITMENU");
exit(1);
}
/* tell Hijack about our screen requirements */
rc = ioctl(g_fd, EMPEG_HIJACK_SETGEOM, &geom);
/* we need a font */
vfdlib_registerFont("/empeg/lib/fonts/small.bf", 0);
/* documentation of the vfdlib functions are in the library code :-*/
vfdlib_fastclear(screenbuf);
vfdlib_registerFont("/empeg/lib/fonts/small.bf", 0);
vfdlib_drawText(screenbuf, "Hello World!", 0, vfdlib_getTextHeight(0), 1, -1);
/* Now push the screenbuf to our hijack-allocated space */
rc = ioctl(g_fd, EMPEG_HIJACK_DISPWRITE, screenbuf);
/* Display the message a while */
sleep(60);
/* clear up memory */
vfdlib_unregisterAllFonts();
}