Ejemplo n.º 1
0
void GW_Game_DKong::clock_update(int mode)
{
    if (mode==-1) mode=GetMode();

    // display clock
    data().position_get(PS_NUMBER, 1)->show();
    data().position_get(PS_NUMBER, 2)->show();
    data().position_get(PS_NUMBER, 3)->show();
    data().position_get(PS_NUMBER, 4)->show();


    GW_Platform_Time time=platform_get()->time_get();

    //GW_Device::devtime_t time;
    //device_get()->GetTime(&time);

    data().position_get(PS_SEMICOLON)->visible_set(time.s % 2 == 0);
    if (mode==MODE_TIME)
    {
        // show current time
        data().position_get(PS_AM)->visible_set(time.h<12);
        data().position_get(PS_PM)->visible_set(time.h>=12);

        setnumber((time.h>12?time.h-12:time.h), 1, 2, false);
        setnumber(time.n, 3, 4);
    } else if (mode==MODE_ALARM) {
        // show 12:00 AM
        data().position_get(PS_AM)->show();
        setnumber(12, 1, 2);
        setnumber(0, 3, 4);
    }
}
Ejemplo n.º 2
0
int game_list_create( void ) {
	struct game *game = NULL;
	struct game *prev = NULL;
	struct config_game *config_game = config_get()->games;
	
	if( !config_game )
		platform_add_unknown();
	
	game_image_type = (char*)image_type_name( IMAGE_LOGO );
	
	while( config_game ) {
		game = malloc(sizeof(struct game));
		if( game == NULL ) {
			return -1;
		}
		else {
			struct config_game_category *config_game_category = config_game->categories;
			struct category *category = category_first();
			int i = 0;
			
			memset( game, 0, sizeof(struct game) );
			game->name = config_game->name;
			game->texture = NULL;
			game->rom_path = config_game->rom_image;
			game->params = config_game->params;
			if( config_game->platform ) {
				game->platform = platform_get( config_game->platform->name );
			}
			else {
				platform_add_unknown();
				game->platform = platform_get( NULL );
			}
			
			if( config_game->emulator && config_game->emulator[0] ) {
				game->emulator = emulator_get_by_name( config_game->emulator );
				if( !game->emulator )
					fprintf( stderr, "Warning: Emulator '%s' defined for game '%s' not found\n", config_game->emulator, game->name );
			}
			if( !game->emulator && config_game->platform ) {
				game->emulator = emulator_get_by_platform( config_game->platform->name );
			}
			if( !game->emulator ) {
				game->emulator = emulator_get_default();
			}
			if( !game->emulator ) {
				fprintf( stderr, "Warning: No emulator found for game '%s'\n", game->name );
				free( game );
				continue;
			}
			
			/* Add game categories. */
			game->categories = NULL;
			while( config_game_category ) {
				if( config_game_category->category->id == 0 )
					game_add_category( game, (char*)config_get()->iface.labels.label_lists, config_game_category->value->name );
				else
					game_add_category( game, config_game_category->category->name, (char*)lookup_category( config_game_category->category, (const char*)config_game_category->value->name ) );
				config_game_category = config_game_category->next;
			}
			
			game->media = NULL;
			for( i = 0 ; i < NUM_IMAGE_TYPES ; i++ ) {
				struct game_media *image = malloc( sizeof(struct game_media) );
				if( image ) {
					struct config_image *config_game_image = config_game->images;
					
					memset( image, 0, sizeof(struct game_media) );
					image->type = MEDIA_IMAGE;
					
					while( config_game_image ) {
						if( strcasecmp( config_game_image->type->name, image_type_name(i) ) == 0 ) {
							image->subtype = config_game_image->type->name;
							location_get_path( image->subtype, config_game_image->file_name, image->file_name );						
							break;
						}
						config_game_image = config_game_image->next;
					}
					if( image->file_name[0] == '\0' ) {
						image->subtype = (char*)image_type_name(i);
						location_get_match( image->subtype, game->rom_path, image->file_name );
					}
					
					if( image->file_name[0] == '\0' ) {
						free( image );
					}
					else {
						image->next = game->media;
						game->media = image;
					}
				}
				else {
					fprintf( stderr, "Warning: Couldn't allocate game image object for '%s'\n", game->name );
				}
			}
		
			{
				struct game_media *video = malloc( sizeof(struct game_media) );
				if( video ) {
					memset( video, 0, sizeof(struct game_media) );
					video->type = MEDIA_VIDEO;
					location_get_path( media_type_name(MEDIA_VIDEO), config_game->video, video->file_name );

					if( video->file_name[0] == '\0' ) {
						location_get_match( media_type_name(MEDIA_VIDEO), game->rom_path, video->file_name );
					}

					if( video->file_name[0] == '\0' ) {
						free( video );
					}
					else {
						video->next = game->media;
						game->media = video;
					}
				}
				else {
					fprintf( stderr, "Warning: Couldn't allocate game video object for '%s'\n", game->name );
				}
			}

			/* Fill in "unknown" values for categories undefined for this game. */
			if( category ) {
				do {
					struct game_category *gc = game->categories;
					while( gc ) {
						if( gc->name == category->name ) {
							break;
						}
						gc = gc->next;
					}
					if( gc == NULL ) {
						/* Category undefine for this game */
						category_value_add_unknown( category );
						game_add_category( game, category->name, NULL );
					}
					category = category->next;
				} while( category != category_first() );
			}			
			
			/* insert into list (sort by name) */
			prev = game_start;
			if( game_start ) {
				prev = game_start->all_prev;
				while( strcasecmp( prev->name, game->name ) > 0 ) {
					prev = prev->all_prev;
					if( prev == game_start->all_prev ) break;
				}
			}
			game_add( game, prev );
			if( !game_start || strcasecmp( game->name, game_start->name ) < 0 ) {
				game_start = game;
			}
			game->next = game->all_next;
			game->prev = game->all_prev;
		}
		config_game = config_game->next;
	}
	game_list_unfilter();

/*  if( game_start ) {
		struct game *g = game_start;
		while( g ) {
			struct game_media *gm = g->media;
			struct game_category *gc = g->categories;

			printf("Game: %s\n", g->name );
			while( gm ) {
				printf("  '%d/%s' = '%s'\n", gm->type, gm->subtype, gm->file_name );
				gm = gm->next;
			}
			while( gc ) {
				printf("  '%s' = '%s'\n", gc->name, gc->value );
				gc = gc->next;
			}
			g = g->all_next;
			if( g == game_start ) break;
		}
	}*/

	return 0;
}