// umask
umask ( 022 ); // emitted files can be rwxr-xr-x
-
+
} // set up daemon
/* hmm, seems to not like working right after boot.. do we depend on another daemon or
// sucks
return ( 0 );
}
-
+
return ( 1 );
}
// umask
umask ( 022 ); // emitted files can be rwxr-xr-x
-
+
} // set up daemon
// wait for a user to be logged in - we should probably get hupped when a user logs in, so we can handle
// -s startdir
// -b name for the appdir
- if ( ( strcmp ( argv [ i ], "-a" ) == 0 ) ||
+ if ( ( strcmp ( argv [ i ], "-a" ) == 0 ) ||
( strcmp ( argv [ i ], "-p" ) == 0 ) ||
( strcmp ( argv [ i ], "-e" ) == 0 ) ||
( strcmp ( argv [ i ], "-s" ) == 0 ) ||
} else {
// child, do it
execv ( pndrun, argv );
- }
+ }
// by definition, either error occurred or we are the original application.
} // key or key/value?
} // section or key/value line?
-
+
} // while
// clean up a trifle
{
match = pnd_map_dotdesktop_category ( c, t );
}
-
+
if ( match ) {
strncat ( target_buffer, match, len );
len -= strlen ( target_buffer );
{
match = pnd_map_dotdesktop_category ( c, t );
}
-
+
if ( match ) {
if ( target_buffer [ 0 ] != '\0' && len > 0 ) {
strcat ( target_buffer, ";" );
{
match = pnd_map_dotdesktop_category ( c, t );
}
-
+
if ( match ) {
strncat ( target_buffer, match, len );
len -= strlen ( target_buffer );
{
match = pnd_map_dotdesktop_category ( c, t );
}
-
+
if ( match ) {
if ( target_buffer [ 0 ] != '\0' && len > 0 ) {
strcat ( target_buffer, ";" );
p -> appdata_dirname = strdup ( pnd_pxml_get_appdata_dirname ( pxmlh ) );
}
if ( pnd_pxml_get_clockspeed ( pxmlh ) ) {
- p -> clockspeed = strdup ( pnd_pxml_get_clockspeed ( pxmlh ) );
+ p -> clockspeed = strdup ( pnd_pxml_get_clockspeed ( pxmlh ) );
}
if ( pnd_pxml_get_startdir ( pxmlh ) ) {
- p -> startdir = strdup ( pnd_pxml_get_startdir ( pxmlh ) );
+ p -> startdir = strdup ( pnd_pxml_get_startdir ( pxmlh ) );
}
// category kruft
if ( pnd_pxml_get_main_category ( pxmlh ) ) {
ret = select ( maxfd + 1, &fdset, NULL, NULL, ptv );
- if ( ret < 0 ) {
+ if ( ret < 0 ) {
return ( 0 ); // something bad
} else if ( ret == 0 ) {
return ( 1 ); // all good, nothing here
PND_CheckEvent ( &ev[i], device );
}
}
-
+
} // got fd?
return;
switch( event->code ) {
case KEY_UP:
- if ( event->value ) {
+ if ( event->value ) {
GLES2D_Pad[pke_pad_up] = 1;
} else {
GLES2D_Pad[pke_pad_up] = 0;
break;
case KEY_DOWN:
- if ( event->value ) {
+ if ( event->value ) {
GLES2D_Pad[pke_pad_down] = 1;
} else {
GLES2D_Pad[pke_pad_down] = 0;
break;
case KEY_LEFT:
- if ( event->value ) {
+ if ( event->value ) {
GLES2D_Pad[pke_pad_left] = 1;
} else {
GLES2D_Pad[pke_pad_left] = 0;
break;
case KEY_RIGHT:
- if ( event->value ) {
+ if ( event->value ) {
GLES2D_Pad[pke_pad_right] = 1;
} else {
GLES2D_Pad[pke_pad_right] = 0;
break;
case KEY_MENU:
- if ( event->value ) {
+ if ( event->value ) {
GLES2D_Pad[pke_pad_menu] = 1;
} else {
GLES2D_Pad[pke_pad_menu] = 0;
break;
case BTN_X:
- if ( event->value ) {
+ if ( event->value ) {
GLES2D_Pad[pke_pad_x] = 1;
} else {
GLES2D_Pad[pke_pad_x] = 0;
break;
case BTN_Y:
- if ( event->value ) {
+ if ( event->value ) {
GLES2D_Pad[pke_pad_y] = 1;
} else {
GLES2D_Pad[pke_pad_y] = 0;
break;
case BTN_A:
- if ( event->value ) {
+ if ( event->value ) {
GLES2D_Pad[pke_pad_a] = 1;
} else {
GLES2D_Pad[pke_pad_a] = 0;
break;
case BTN_B:
- if ( event->value ) {
+ if ( event->value ) {
GLES2D_Pad[pke_pad_b] = 1;
} else {
GLES2D_Pad[pke_pad_b] = 0;
break;
case BTN_TL:
- if ( event->value ) {
+ if ( event->value ) {
GLES2D_Pad[pke_pad_l] = 1;
} else {
GLES2D_Pad[pke_pad_l] = 0;
break;
case BTN_TR:
- if ( event->value ) {
+ if ( event->value ) {
GLES2D_Pad[pke_pad_r] = 1;
} else {
GLES2D_Pad[pke_pad_r] = 0;
break;
}
break;
-
+
case EV_ABS:
switch ( device ) {
if( value > 0 ) {
value = 1;
} else if( value < 0 ) {
- value = 1;
+ value = 1;
}
} else {
}
}
-
+
if( event->code == ABS_Y ) {
//printf( "nub1 y %3d\n", value );
if( abs(value) > NUB1_CUTOFF ) {
if( value > 0 ) {
value = 1;
} else if( value < 0 ) {
- value = 1;
+ value = 1;
}
} else {
}
}
-
+
if(event->code == ABS_Y) {
//printf( "nub2 y %3d\n", value );
if( abs(value) > NUB2_CUTOFF ) {
ioctl(fd, EVIOCGNAME(sizeof(dev_name)), dev_name);
printf("Input device name: \"%s\"\n", dev_name);
-
+
return fd;
}
} else {
// child, do it
execv ( pndrun, argv );
- }
+ }
// wait until mountscript actually completes
int status = 0;
}
void pnd_pxml_set_app_name ( pnd_pxml_handle h, char *v ) {
- /*
+ /*
* Please do not use this function if it can be avoided; it is only here for compatibility.
* The function might fail on low memory, and there's no way for the user to know when this happens.
*/
app->descriptions_alloc_c = 4; //TODO: adjust this based on how many descriptions a PXML usually has. Power of 2.
app->descriptions = (pnd_localized_string_t *)malloc(sizeof(pnd_localized_string_t) * app->descriptions_alloc_c);
- if (!app->descriptions)
+ if (!app->descriptions)
{
app->descriptions_alloc_c = 0;
return (0); //errno = NOMEM
{
app->previewpic2 = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_PREVPICSRC);
}
- }
+ }
} //previewpic
//The author info:
i = 0;
//Goes through all the top-level categories and their sub-categories. i helps limit these to 2.
- for (pElem = pElem->FirstChildElement(PND_PXML_ENAME_CAT); pElem && i < 2;
+ for (pElem = pElem->FirstChildElement(PND_PXML_ENAME_CAT); pElem && i < 2;
pElem = pElem->NextSiblingElement(PND_PXML_ENAME_CAT), i++)
{
//TODO: Fix pnd_pxml_t so that there can be more than 2 category 'trees' and more than 2 subcategories. Then this can be removed.
{
i = 0;
//Go through all associations. i serves as index; since the format only supports 3 associations we need to keep track of the number.
- for (pElem = pElem->FirstChildElement(PND_PXML_ENAME_ASSOC); pElem && i < 3;
+ for (pElem = pElem->FirstChildElement(PND_PXML_ENAME_ASSOC); pElem && i < 3;
pElem = pElem->NextSiblingElement(PND_PXML_ENAME_ASSOC), i++)
{
char *name = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_ASSOCNAME);
//Performance related things (aka: Clockspeed XD):
pElem = hRoot.FirstChild(PND_PXML_ENAME_CLOCK).Element();
if (pElem)
- {
+ {
app->clockspeed = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_CLOCKFREQ);
}
// Package
pElem = hRoot.FirstChild ( PND_PXML_ENAME_PACKAGE ).Element();
- if ( pElem ) {
+ if ( pElem ) {
app -> package_name = pnd_pxml_get_attribute ( pElem, PND_PXML_ATTRNAME_PACKAGE_NAME );
app -> package_release_date = pnd_pxml_get_attribute ( pElem, PND_PXML_ATTRNAME_PACKAGE_DATE );
}
}
while ( ( pElem = pElem -> NextSiblingElement ( PND_PXML_ENAME_MKDIR ) ) ) {
-
+
if ( ( t = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_MKDIRPATH) ) ) {
char *foo = (char*) malloc ( strlen ( app -> mkdir_sp ) + strlen ( t ) + 1 /*:*/ + 1 /*\0*/ );
}
// set up target filename to copy
snprintf ( buffer, PATH_MAX, "%s/%s/%s.png", cacheoutpath, cache_path, app -> unique_id );
- pnd_log ( pndn_debug, "Found free space to cache preview to here: %s", buffer );
+ pnd_log ( pndn_debug, "Found free space to cache preview to here: %s", buffer );
if ( ! pnd_filecopy ( filepath, buffer ) ) {
- pnd_log ( pndn_error, "ERROR: Copying preview from %s to %s", filepath, buffer );
+ pnd_log ( pndn_error, "ERROR: Copying preview from %s to %s", filepath, buffer );
}
} else {
pnd_log ( pndn_warning, "WARN: Couldn't find a device to cache preview to.\n" );
if ( parentcatname ) {
if ( ( ! fdcat -> parent_cat ) ||
( ! fdpcat ) )
- {
+ {
// child cat points to a different parent than requested parent!
cat_is_clean = 0;
pnd_log ( pndn_warning, "PXML Fail %s: Cat request %s (parent %s) -> cat wants to be child of a cat which FD says is the wrong parent (1)\n", app -> title_en ? app -> title_en : "no name?", catname, parentcatname ? parentcatname : "n/a" );
int category_index ( char *catname ) {
unsigned char i;
-
+
for ( i = 0; i < g_categorycount; i++ ) {
-
+
if ( strcasecmp ( g_categories [ i ] -> catname, catname ) == 0 ) {
return ( i );
}
-
+
}
-
+
return ( -1 );
}
// does item begin with app or tab tag?
char *k = pnd_box_get_key ( v );
- if ( k &&
+ if ( k &&
( strncasecmp ( k, "appshow.", 8 ) == 0 ||
strncasecmp ( k, "tabshow.", 8 ) == 0 )
)
// does item begin with app or tab tag?
char *k = pnd_box_get_key ( v );
- if ( k &&
+ if ( k &&
( strncasecmp ( k, "appshow.", 8 ) == 0 ||
strncasecmp ( k, "tabshow.", 8 ) == 0 )
)
} else {
// something else came in, so dir must not be empty
closedir ( d );
- return ( 0 );
+ return ( 0 );
}
de = readdir ( d );
( pnd_pxml_get_x11 ( iter -> option_no_x11 ) == pnd_pxml_x11_required && g_x11_present == 1 )
)
{
-
+
if ( iter -> title_en == NULL || iter -> title_en [ 0 ] == '\0' ) {
// null title; just skip it.
} else {
} else {
// child, do it
execl ( "/bin/sh", "/bin/sh", "-c", buffer + strlen(MM_RUN) + 1, (char*) NULL );
- }
+ }
return;
}
context_alive = 0; // nolonger visible, so lets just get out
}
-
+
break;
case context_app_recategorize:
} // while waiting for input
} // while
-
+
return ( 0 );
}
// umask
umask ( 022 ); // emitted files can be rwxr-xr-x
-
+
} // set up daemon
// check frontend
//Used like a unit test, almost
int main (int argc, char **argv)
{
- if (argc != 2)
+ if (argc != 2)
{
printf("Wrong nr of args.\nUsage: %s <pxml filename>\n", argv[0]);
return 1;
cecho "ERROR: Your squashfs version is older then version 4, please upgrade to 4.0 or later" $red
exit 1
fi
- mksquashfs $FOLDER $PNDNAME.iso -nopad -no-recovery
+ mksquashfs $FOLDER $PNDNAME.iso # -nopad -no-recovery
else
check_for_tool mkisofs
mkisofs -o $PNDNAME.iso -R $FOLDER