Example #1
0
void st_paint(float t)
{
    int stereo = config_get_d(CONFIG_STEREO);

    state_drawn = 1;

    if (state && state->paint)
    {
        if (stereo)
        {
            glDrawBuffer(GL_BACK_LEFT);
            video_clear();
            state->paint(state->gui_id, t);

            glDrawBuffer(GL_BACK_RIGHT);
            video_clear();
            state->paint(state->gui_id, t);
        }
        else
        {
            video_clear();
            state->paint(state->gui_id, t);
        }
    }
}
void video_banner(void)
{
    block_dev_desc_t *ide;
    int i;
    char *s;
    int maxdev;


    if (video_inited == 0) return;
#ifdef EASTEREGG
    if (video_easteregg_active)
    {
	prompt_string="";
	video_clear();
	printf("\n");
	printf("    **** COMMODORE 64 BASIC X2 ****\n\n");
	printf(" 64K RAM SYSTEM  38911 BASIC BYTES FREE\n\n");
	printf("READY\n");
    }
    else
    {
#endif
	s = getenv("ide_maxbus");
	if (s)
	    maxdev = atoi(s) * 2;
	else
	    maxdev = 4;

	s = getenv("stdout");
	if (s && strcmp(s, "serial") == 0)
	    return;

	video_clear();
	printf("%s\n\nCPU: ", version_string);
	checkcpu();
	printf("DRAM: %ld MB\n", gd->bd->bi_memsize/(1024*1024));
	printf("FSB: %ld MHz\n", gd->bd->bi_busfreq/1000000);

	printf("\n---- Disk summary ----\n");
	for (i = 0; i < maxdev; i++)
	{
	    ide = ide_get_dev(i);
	    printf("Device %d: ", i);
	    dev_print(ide);
	}

/*
    video_draw_box(SINGLE_BOX, 0x0F, "Test 1", 0, 0,18, 72, 4);
    video_draw_box(DOUBLE_BOX, 0x0F, "Test 2", 1, 4,10, 50, 6);
    video_draw_box(DOUBLE_BOX, 0x0F, "Test 3", 0, 40, 3, 20, 5);

    video_draw_text(1, 4, 0x2F, "Highlighted options");
    video_draw_text(1, 5, 0x0F, "Non-selected option");
    video_draw_text(1, 6, 0x07, "disabled option");
*/
#ifdef EASTEREGG
    }
#endif
}
Example #3
0
void level_snap(int i, const char *path)
{
    char *filename;

    /* Convert the level name to a PNG filename. */

    filename = concat_string(path,
                             "/",
                             base_name_sans(level_v[i].file, ".sol"),
                             ".png",
                             NULL);

    /* Initialize the game for a snapshot. */

    if (game_client_init(level_v[i].file))
    {
        union cmd cmd;
        cmd.type = CMD_GOAL_OPEN;
        game_proxy_enq(&cmd);
        game_client_sync(NULL);

        /* Render the level and grab the screen. */

        video_clear();
        game_client_fly(1.0f);
        game_kill_fade();
        game_client_draw(POSE_LEVEL, 0);
        video_snap(filename);
        video_swap();
    }

    free(filename);
}
Example #4
0
static int gui_RunMenu(MENU *menu)
{
	MENUITEM *mi;
	u32 keys;

	for (;;) {
		mi = menu->m + menu->cur;
		keys = key_read();

		video_clear();

		// check keys
		if (keys & KEY_SELECT) {
			key_reset();
			return 0;
		} else if (keys & KEY_UP) {
			do {
				if (--menu->cur < 0)
					menu->cur = menu->num - 1;
			} while (!(menu->m + menu->cur)->name); // Skip over an empty menu entry.

		} else if (keys & KEY_DOWN) {
			do {
				if (++menu->cur == menu->num)
					menu->cur = 0;
			} while (!(menu->m + menu->cur)->name); // Skip over an empty menu entry.
		} else if (keys & KEY_A) {
			if (mi->on_press_a) {
				key_reset();
				int result = (*mi->on_press_a)();
				if (result)
					return result;
			}
		} else if (keys & KEY_B) {
			menu->cur = menu->num - 1;
			key_reset();
		}

		if ((keys & (KEY_LEFT | KEY_RIGHT)) && mi->on_press) {
			int result = (*mi->on_press)(keys);
			if (result)
				return result;
		}

		// diplay menu
		ShowMenu(menu);

		video_flip();
		timer_delay(75);

		if (keys & (KEY_A | KEY_B | KEY_X | KEY_Y | KEY_L | KEY_R |
			    KEY_LEFT | KEY_RIGHT | KEY_UP | KEY_DOWN))
			timer_delay(50);
	}

	return 0;
}
Example #5
0
void setup()
{
   video_clear();
   printf("-= o00oO =- Starting....\n\n");
   init_serial_uart(PORT_COM1);   printf("serial1 ready\n");
//   init_serial_uart(PORT_COM2);   printf("serial2 ready\n");
//   init_serial_uart(PORT_COM3);   printf("serial3 ready\n");
//   init_serial_uart(PORT_COM4);   printf("serial4 ready\n");
   printf("-= o00oO =- Crash OS ready.\n\n");
}
Example #6
0
//Called via callback when handlepbp() in cdriso.cpp detects a multi-CD
// .pbp image is being loaded, so user can choose CD to boot from.
// This is necessary because we do not know if a given CD image is
// a multi-CD image until after cdrom plugin has gone through many
// steps and verifications.
static CALLBACK void gui_select_multicd_to_boot_from(void)
{
	if (cdrIsoMultidiskSelect >= cdrIsoMultidiskCount)
		cdrIsoMultidiskSelect = 0;

	//Pass false to indicate a CD is not being swapped through front-end menu
	gui_select_multicd(false);

	//Before return to emu, clear/flip once more in case we're triple-buffered
	video_clear();
	video_flip();
}
Example #7
0
void st_paint(float t)
{
    state_drawn = 1;

    if (state && state->paint)
    {
        video_clear();

        if (hmd_stat())
        {
            hmd_prep_left();
            video_clear();
            state->paint(state->gui_id, t);

            hmd_prep_right();
            video_clear();
            state->paint(state->gui_id, t);
        }
        else
            state->paint(state->gui_id, t);
    }
}
Example #8
0
static int gui_state_save(int slot)
{
	if (sshot_img) {
		free(sshot_img);
		sshot_img = NULL;
	}

	// Remember which saveslot was accessed last
	saveslot = slot;

	video_clear();
	port_printf(160-(6*8/2), 120-(8/2), "SAVING");
	video_flip();

	if (state_save(slot) < 0) {
		// Error saving

		for (;;) {
			u32 keys = key_read();
			video_clear();
			// check keys
			if (keys) {
				key_reset();
				return 0;
			}

			port_printf(160-(11*8/2), 120-12, "SAVE FAILED");
			port_printf(160-(18*8/2), 120+12, "Out of disk space?");
			video_flip();
			timer_delay(75);
		}
	}

	// Return -1 to gui_StateSave() caller menu, so it knows
	//  to tell main menu to return back to main menu.
	return -1;
}
Example #9
0
void cmain()
{
	bool risu;
	int proc;	
	
	kernel_init();
	video_clear();
	log_message("Welcome into KVM on PitOS Release");
	log_show();
	
	ki_activate_p(umain,100,0,proc, risu);
	if(risu == false) 
		log_message("Non posso Allocare un Processo");
	kernel_go();		
}
Example #10
0
File: assert.c Project: quad/voot
static void assert_puts (const char *in_str)
{
    uint16     *vram_index;
    static char null_string[] = "NULL";

    if (!in_str)
        in_str = null_string;

    /*
        STAGE: Position our text correctly.
        
        Assumes 640x - but then, so does bfont.
    */

    vram_index  = VIDEO_VRAM_START;
    vram_index += INDENT_BYTES;
    vram_index += (VCON_FIRST_PIXEL + (vc_line * LINE_SPACING)) * 640;

    /* STAGE: Make sure we handle '\n's. */

    while (*in_str)
    {
        if (*in_str == '\n')
        {
            vc_line++;
            in_str++;

            vram_index  = VIDEO_VRAM_START;
            vram_index += INDENT_BYTES;
            vram_index += (VCON_FIRST_PIXEL + (vc_line * LINE_SPACING)) * 640;

            continue;
        }

        /*
            STAGE: If the biosfont library is locked, just blank the screen.
            
            The fact we clear multiple times is not a bug. It's just
            laziness on the coder's part.
        */

        if (!(bfont_draw (vram_index += 12, 640, *in_str++)))
            return video_clear (100, 0, 0);
    }

    vc_line++;
}
Example #11
0
static int gui_Credits()
{
	for (;;) {
		u32 keys = key_read();

		video_clear();

		// check keys
		if (keys) {
			key_reset();
			return 0;
		}

		// diplay menu
		port_printf(15 * 8 + 4, 10, "CREDITS:");
		port_printf( 2 * 8, 30, "pcsx team, pcsx-df team, pcsx-r team");

		port_printf( 6 * 8, 50, "Franxis and Chui - PCSX4ALL");
		port_printf( 4 * 8, 60, "Unai - fast PCSX4ALL GPU plugin");

		port_printf( 5 * 8, 80, "Ulrich Hecht - psx4all-dingoo");

		port_printf(10 * 8, 90, "notaz - PCSX-ReArmed");

		port_printf( 0 * 8, 110, "Dmitry Smagin - porting and optimizing");
		port_printf( 0 * 8, 120, "                of mips recompiler,");
		port_printf( 0 * 8, 130, "                gui coding");

		port_printf( 0 * 8, 150, "senquack - fixing polygons in gpu_unai,");
		port_printf( 0 * 8, 160, "           porting spu and other stuff");
		port_printf( 0 * 8, 170, "           from pcsx_rearmed and pcsx-r,");
		port_printf( 0 * 8, 180, "           many fixes and improvements");

		port_printf( 0 * 8, 195, "JohnnyonFlame   - gpu_unai dithering");
		port_printf( 0 * 8, 205, "                  and other fixes");

		port_printf( 0 * 8, 220, "zear         - gui fixing and testing");

		video_flip();
		timer_delay(75);
	}

	return 0;
}
Example #12
0
File: fb.c Project: gettler/mvpmc
void
fb_exit(void)
{
	audio_stop = 1;
	audio_clear();

	pthread_kill(audio_thread, SIGURG);

	if (current) {
		free(current);
		current = NULL;
	}
	mvpw_hide(fb_progress);

	video_clear();
	av_stop();
	if (!mvpw_visible(playlist_widget))
		playlist_clear();
}
Example #13
0
char *FileReq(char *dir, const char *ext, char *result)
{
	static char *cwd = NULL;
	static s32 cursor_pos = 1;
	static s32 first_visible;
	static s32 num_items = 0;
	DIR *dirstream;
	struct dirent *direntry;
	static s32 row;
	char tmp_string[41];
	u32 keys;

	if (dir)
		ChDir(dir);

	cwd = GetCwd();

	for (;;) {
		keys = key_read();

		video_clear();

		if (keys & KEY_SELECT) {
			FREE_LIST();
			key_reset();
			return NULL;
		}

		if (num_items == 0) {
			dirstream = opendir(cwd);
			if (dirstream == NULL) {
				port_printf(0, 20, "error opening directory");
				return NULL;
			}
			// read directory entries
			while ((direntry = readdir(dirstream))) {
				s32 type = get_entry_type(cwd, direntry->d_name);

				// this is a very ugly way of only accepting a certain extension
				if ((type == 0 && strcmp(direntry->d_name, ".")) ||
				     check_ext(direntry->d_name) ||
				    (ext && (strlen(direntry->d_name) > 4 &&0 == strncasecmp(direntry->d_name + (strlen(direntry->d_name) - strlen(ext)), ext, strlen(ext))))) {
					// Hide ".." if at Unix root dir. Don't display Unix hidden files (.file).
					if ((!strcmp(direntry->d_name, "..") && strcmp(cwd, "/")) || direntry->d_name[0] != '.')
					{
						filereq_dir_items[num_items].name = (char *)malloc(strlen(direntry->d_name) + 1);
						strcpy(filereq_dir_items[num_items].name, direntry->d_name);
						filereq_dir_items[num_items].type = type;
						num_items++;
						if (num_items > 1024) break;
					}
				}
			}
			closedir(dirstream);

			sort_dir(filereq_dir_items, num_items);
			cursor_pos = 0;
			first_visible = 0;
		}

		// display current directory
		int len = strlen(cwd);

		if (len > 40) {
			strcpy(tmp_string, "..");
			strcat(tmp_string, cwd + len - 38);
			port_printf(0, MENU_Y, tmp_string);
		} else
			port_printf(0, MENU_Y, cwd);

		if (keys & KEY_DOWN) { //down
			if (++cursor_pos >= num_items) {
				cursor_pos = 0;
				first_visible = 0;
			}
			if ((cursor_pos - first_visible) >= MENU_HEIGHT) first_visible++;
		} else if (keys & KEY_UP) { // up
			if (--cursor_pos < 0) {
				cursor_pos = num_items - 1;
				first_visible = cursor_pos - MENU_HEIGHT + 1;
				if (first_visible < 0) first_visible = 0;
			}
			if (cursor_pos < first_visible) first_visible--;
		} else if (keys & KEY_LEFT) { //left
			if (cursor_pos >= 10) cursor_pos -= 10;
			else cursor_pos = 0;
			if (cursor_pos < first_visible) first_visible = cursor_pos;
		} else if (keys & KEY_RIGHT) { //right
			if (cursor_pos < (num_items - 11)) cursor_pos += 10;
			else cursor_pos = num_items - 1;
			if ((cursor_pos - first_visible) >= MENU_HEIGHT)
				first_visible = cursor_pos - (MENU_HEIGHT - 1);
		} else if (keys & KEY_A) { // button 1
			// directory selected
			if (filereq_dir_items[cursor_pos].type == 0) {
				strcat(cwd, "/");
				strcat(cwd, filereq_dir_items[cursor_pos].name);

				ChDir(cwd);
				cwd = GetCwd();

				FREE_LIST();
				key_reset();
			} else {
				sprintf(result, "%s/%s", cwd, filereq_dir_items[cursor_pos].name);
				if (dir)
					strcpy(dir, cwd);

				video_clear();
				port_printf(16 * 8, 120, "LOADING");
				video_flip();

				FREE_LIST();
				key_reset();
				return result;
			}
		} else if (keys & KEY_B) {
			cursor_pos = 0;
			first_visible = 0;
			key_reset();
		}

		// display directory contents
		row = 0;
		while (row < num_items && row < MENU_HEIGHT) {
			if (row == (cursor_pos - first_visible)) {
				// draw cursor
				port_printf(MENU_X + 16, MENU_LS + (10 * row), "-->");
			}

			if (filereq_dir_items[row + first_visible].type == 0)
				port_printf(MENU_X, MENU_LS + (10 * row), "DIR");
			int len = strlen(filereq_dir_items[row + first_visible].name);
			if (len > 32) {
				snprintf(tmp_string, 16, "%s", filereq_dir_items[row + first_visible].name);
				strcat(tmp_string, "..");
				strcat(tmp_string, &filereq_dir_items[row + first_visible].name[len - 15]);
			} else
			snprintf(tmp_string, 33, "%s", filereq_dir_items[row + first_visible].name);
			port_printf(MENU_X + (8 * 5), MENU_LS + (10 * row), tmp_string);
			row++;
		}
		while (row < MENU_HEIGHT)
			row++;

		video_flip();
		timer_delay(75);

		if (keys & (KEY_A | KEY_B | KEY_X | KEY_Y | KEY_L | KEY_R |
			    KEY_LEFT | KEY_RIGHT | KEY_UP | KEY_DOWN))
			timer_delay(50);
	}

	return NULL;
}
Example #14
0
int	trap_Clear(lua_State *s)
{
	video_clear();
	return 0;
}
Example #15
0
int main(void) {

	//*uart_chan0_interruptenable |= INTERRUPTENABLE_ERBFI;

	//uint16_t* blip = _binary_blip_start;

	//for (int i = 0; i < sizeof(_binary_blip_start) / 2; i++) {
	//	*(sound_bank_0 + i) = *blip++;
	//}
	//*sound_channel_0_samplelength = sizeof(_binary_blip_start);
	//*sound_channel_master_config = 0xFFFF;
	//*sound_channel_master_volume = 0xFF99;
	//*sound_channel_0_volume = 0xFF22;
	//*sound_channel_0_config = 0xF9FF;

	FATFS fs;
	FRESULT result;
	result = pf_mount(&fs);
	util_printffresult(result);
	util_printfat(&fs);
	result = pf_open("test.txt");
	util_printffresult(result);
	char buf[64];
	uint16_t len;
	pf_read(buf, 63, &len);

	printf("read from file: %s\n", buf);

	image_loadimagefromfile(&fs, &pai, "pai.bz", true);
	image_loadimagefromfile(&fs, &ballimage, "ball.be", false);

	newball(&ball1, 0, 0, &ballimage);
	newball(&ball2, 50, 0, &ballimage);

	initvideo();

	machine_setinterruptmask(0);

	while (1) {

		if (fbready)
			continue;

		static uint16_t lastframe = 0;
		static uint16_t thisframe;

		uint16_t vidflags = video_register_flags;
		uint8_t port0 = input_port0;

		thisframe = video_register_frame;

		updateball(&ball1, thisframe, lastframe);
		updateball(&ball2, thisframe, lastframe);
		ballcollision(&ball1, &ball2);

		video_begin();
		video_clear(0xFFFF);
		video_blitimage_nocopy(pai.width, pai.height, 30, 30, pai.data);
		sprite_draw(ball1.sprite);
		sprite_draw(ball2.sprite);
		video_drawline(&vect);
		video_gputs("Hello World!", _binary_fontrom_start, 1, 1);

		lastframe = thisframe;
		video_commit();
		//video_flip();
		fbready = true;

	}

	printf("Shouldn't have got here!");

	while (1) {

	}

	return 0;

}
Example #16
0
static adv_error cmd_onvideo_animate(void)
{
	adv_mode mode;
	adv_crtc* crtc;
	unsigned i;
	int counter;

	mode_reset(&mode);

	if (the_mode_index == MODE_FLAGS_INDEX_TEXT) {
		error_set("Command supported only in graphics mode");
		return -1;
	}

	crtc = menu_current();
	if (!crtc)
		return -1;

	if (!crtc_is_fake(crtc) && !crtc_clock_check(&the_monitor, crtc))
		return -1;

	if (video_mode_generate(&mode, crtc, the_mode_index)!=0) {
		return -1;
	}

	if (text_mode_set(&mode) != 0) {
		text_reset();
		return -1;
	}

	update_init(2);

	draw_graphics_palette();

	for(i=0;i<3;++i) {
		update_start();
		video_clear(update_x_get(), update_y_get(), video_size_x(), video_size_y(), 0);
		update_stop(update_x_get(), update_y_get(), video_size_x(), video_size_y(), 1);
	}

	counter = update_page_max_get();
	
	while (!inputb_hit()) {
		os_poll();
		
		update_start();
		draw_graphics_animate(update_x_get(), update_y_get(), video_size_x(), video_size_y(), counter - update_page_max_get() + 1, 1);
		++counter;
		draw_graphics_animate(update_x_get(), update_y_get(), video_size_x(), video_size_y(), counter, 0);
		update_stop(update_x_get(), update_y_get(), video_size_x(), video_size_y(), 1);
	}

	update_done();

	do {
		target_idle();
		os_poll();
	} while (inputb_get()==INPUTB_NONE);

	return 0;
}
Example #17
0
//To choose which of a multi-CD image should be used. Can be called
// from front-end 'Swap CD' menu item, in which case parameter
// 'swapping_cd' is true. Or, can be called via callback function
// gui_select_multicd_to_boot_from() inside cdriso.cpp, in which
// case swapping_cd parameter is false.
static int gui_select_multicd(bool swapping_cd)
{
	if (cdrIsoMultidiskCount <= 1)
		return 0;

	// Only max of 8 ISO images inside an Eboot multi-disk .pbp are supported
	//  by cdriso.cpp PBP code, but enforce it here to be sure:
	int num_rows = (cdrIsoMultidiskCount > 8) ? 8 : cdrIsoMultidiskCount;

	int cursor_pos = cdrIsoMultidiskSelect;
	if ((cursor_pos >= num_rows) || (cursor_pos < 0))
		cursor_pos = 0;

	for (;;) {
		video_clear();
		u32 keys = key_read();

		if ((swapping_cd) && (keys & KEY_SELECT)) {
			key_reset();
			return 0;
		}

		if (!swapping_cd)
			port_printf(MENU_X, MENU_Y, "Multi-CD image detected:");

		char tmp_string[41];
		for (int row=0; row < num_rows; ++row) {
			if (row == cursor_pos) {
				// draw cursor
				port_printf(MENU_X + 16, MENU_LS + 10 + (10 * row), "-->");
			}

			sprintf(tmp_string, "CD %d", (row+1));

			if (swapping_cd && (row == cdrIsoMultidiskSelect)) {
				// print indication of which CD is already inserted
				strcat(tmp_string, " (inserted)");
			}

			port_printf(MENU_X + (8 * 5), MENU_LS + 10 + (10 * row), tmp_string);
		}

		if (keys & KEY_DOWN) { //down
			if (++cursor_pos >= num_rows)
				cursor_pos = 0;
		} else if (keys & KEY_UP) { // up
			if (--cursor_pos < 0)
				cursor_pos = num_rows - 1;
		} else if (keys & KEY_LEFT) { //left
			cursor_pos = 0;
		} else if (keys & KEY_RIGHT) { //right
			cursor_pos = num_rows - 1;
		} else if (keys & KEY_A) { // button 1
			key_reset();
			cdrIsoMultidiskSelect = cursor_pos;
			video_clear();
			video_flip();
			// Forget last used save slot
			saveslot = -1;
			return 1;
		}

		video_flip();
		timer_delay(75);

		if (keys & (KEY_A | KEY_B | KEY_X | KEY_Y | KEY_L | KEY_R |
			    KEY_LEFT | KEY_RIGHT | KEY_UP | KEY_DOWN))
			timer_delay(50);
	}

}
Example #18
0
static int moonbase_video_clear( lua_State *s )
{
	video_clear( );
	return 0;
}
Example #19
0
File: fb.c Project: gettler/mvpmc
static void
select_callback(mvp_widget_t *widget, char *item, void *key)
{
	char path[1024], *ptr;
	struct stat64 sb;

	sprintf(path, "%s/%s", cwd, item);
	if (stat64(path, &sb)!=0) {
		printf("Could not stat %s error %d\n",item,errno);
		if (strcmp(item,"../")==0 ) {
			// probably lost network put you back in root
			strcpy(cwd,"/");
			strcpy(path,"/");
			stat64(path, &sb);
		}
	}

	if (current_pl && !is_playlist(item)) {
		free(current_pl);
		current_pl = NULL;
	}

	if (current_pl && (playlist == NULL)) {
		free(current_pl);
		current_pl = NULL;
	}

	printf("%s(): path '%s'\n", __FUNCTION__, path);

	if (current && (strcmp(path, current) == 0)) {
		printf("selected current item\n");
		if (is_video(item) || (is_streaming(item) > 100)) {
			mvpw_hide(widget);
			mvpw_hide(fb_progress);
			av_move(0, 0, 0);
			screensaver_disable();
			return;
		}
	}

	if (current_pl && (strcmp(path, current_pl) == 0)) {
		if (is_playlist(item)) {
			mvpw_show(fb_progress);
			mvpw_set_timer(fb_progress, fb_osd_update, 500);
			mvpw_hide(widget);
			printf("Show playlist menu\n");
			mvpw_show(playlist_widget);
			mvpw_focus(playlist_widget);
			return;
		}
	}

	if (S_ISDIR(sb.st_mode)) {
		if (strcmp(item, "../") == 0) {
			strcpy(path, cwd);
			if (path[strlen(path)-1] == '/')
				path[strlen(path)-1] = '\0';
			if ((ptr=strrchr(path, '/')) != NULL)
				*ptr = '\0';
			if (path[0] == '\0')
				sprintf(path, "/");
		} else {
			if ((ptr=strrchr(path, '/')) != NULL)
				*ptr = '\0';
		}
		if (strstr(path,"/uPnP")!=NULL && strstr(cwd,"/uPnP")==NULL ){
			mount_djmount(path);
				
		} else if (strstr(path,"/uPnP")==NULL && strstr(cwd,"/uPnP")!=NULL ) { 
			unmount_djmount();
		}
		strncpy(cwd, path, sizeof(cwd));

		while ((cwd[0] == '/') && (cwd[1] == '/'))
			memmove(cwd, cwd+1, strlen(cwd));

		mvpw_clear_menu(widget);
		mvpw_set_menu_title(widget, cwd);

		busy_start();
		add_dirs(widget);
		add_files(widget);
		busy_end();

		mvpw_expose(widget);
	} else {
		switch_hw_state(MVPMC_STATE_FILEBROWSER);

		if (current)
			free(current);
		current = NULL;
		audio_stop = 1;
		pthread_kill(audio_thread, SIGURG);

		while (audio_playing)
			usleep(1000);

		current = strdup(path);

		if (is_streaming(item) > 100) {
			// Use VLC callbacks for streaming items
			video_functions = &vlc_functions;
			// Allow broadcast messages to be sent so
			// we can tell VLC to start the stream
			vlc_broadcast_enabled = 1;
		} else {
			video_functions = &file_functions;
		}

		add_osd_widget(fb_program_widget, OSD_PROGRAM,
			       osd_settings.program, NULL);

		mvpw_set_text_str(fb_name, item);

		/*
		 * This code sends the currently playing file name to the display.
		 */
		snprintf(display_message, sizeof(display_message),
			 "File:%s\n", item);
		display_send(display_message);

		audio_clear();
		video_clear();
		playlist_clear();

		if (is_video(item)) {
			if (key != NULL) {
				mvpw_hide(widget);
				mvpw_hide(fb_progress);
				av_move(0, 0, 0);
			} else {
				mvpw_show(fb_progress);
			}
			mvpw_set_timer(fb_progress, fb_osd_update, 500);
			video_play(NULL);
			mvpw_show(root);
			mvpw_expose(root);
			mvpw_focus(root);
		} else if (is_audio(item) || is_streaming(item)>=0 ) {
			mvpw_show(fb_progress);
			mvpw_set_timer(fb_progress, fb_osd_update, 500);
			audio_play(NULL);
		} else if (is_image(item)) {
			mvpw_hide(widget);
			printf("Displaying image '%s'\n", path);
			if (mvpw_load_image_jpeg(iw, path) == 0) {
				mvpw_show_image_jpeg(iw);
				av_wss_update_aspect(WSS_ASPECT_UNKNOWN);
			} else {
				mvpw_set_image(iw, path);
			}
			mvpw_show(iw);
			mvpw_focus(iw);
			loaded_offset = 0;
			loaded_status = 0;
			fb_next_image(1);
		} else if (is_playlist(item)) {
			if (current_pl)
				free(current_pl);
			current_pl = strdup(path);
			mvpw_show(fb_progress);
			mvpw_set_timer(fb_progress, fb_osd_update, 500);
			mvpw_hide(widget);
			printf("Show playlist menu\n");
			mvpw_show(playlist_widget);
			mvpw_focus(playlist_widget);
			playlist_clear();
			playlist_play(NULL);
		}
	}
}
Example #20
0
/*----------------------------------------------------------------------------*/
void main(void)
{
	char temp[16];
	fb_t* display;
	/** initialize gpio */
	gpio_init();
	gpio_config(ERROR_LED,GPIO_OUTPUT);
	timer_init();
	/** initialize video stuff - mailbox before that! */
	mailbox_init();
	do
	{
		blink_error(2);
		timer_wait(TIMER_S);
		display = video_init(VIDEO_RES_VGA);
	}
	while (!display);
	video_set_bgcolor(COLOR_BLUE);
	video_clear();
	/** write something */
	video_text_char('H');
	video_text_char('E');
	video_text_char('L');
	video_text_char('L');
	video_text_char('O');
	video_text_char('!');
	video_text_string("\nHAHA!");
	video_text_cursor(3,1);
	video_text_string("Welcome!");
	/* display info */
	video_text_newline();
	video_text_string("DISPX: ");
	int2str(temp,display->screen.xres);
	video_text_string(temp);
	video_text_string(", ");
	video_text_string("DISPY: ");
	int2str(temp,display->screen.yres);
	video_text_string(temp);
	video_text_string(", ");
	video_text_string("VDISPX: ");
	int2str(temp,display->screen.xout);
	video_text_string(temp);
	video_text_string(", ");
	video_text_string("VDISPY: ");
	int2str(temp,display->screen.yout);
	video_text_string(temp);
	video_text_char('\n');
	video_text_string("OFFX: ");
	int2str(temp,display->screen.xoff);
	video_text_string(temp);
	video_text_string(", ");
	video_text_string("OFFY: ");
	int2str(temp,display->screen.yoff);
	video_text_string(temp);
	video_text_string(", ");
	video_text_string("XMAX: ");
	int2str(temp,display->cursor.xmax);
	video_text_string(temp);
	video_text_string(", ");
	video_text_string("YMAX: ");
	int2str(temp,display->cursor.ymax);
	video_text_string(temp);
	video_text_char('\n');
	video_text_string("PITCH: ");
	int2str(temp,display->screen.pskip);
	video_text_string(temp);
	video_text_string(", ");
	video_text_string("DEPTH: ");
	int2str(temp,display->screen.depth);
	video_text_string(temp);
	/* test col overflow */
	video_text_cursor(display->cursor.y+1,display->cursor.xmax-5);
	video_text_string("Continue next line!");
	/* test line drawing */
	video_draw_line(100,100,200,100);
	video_draw_line(200,100,100,200);
	video_draw_line(100,200,100,100);
	video_text_string("\nWait for it...");
	blink_error(3);
	/* test row overflow */
	video_text_cursor(display->cursor.ymax-1,display->cursor.xmax-5);
	video_text_string("Scroll this!");
	/** sticking around */
	while(1);
}
Example #21
0
/* Set up the display ready for use */
static int video_post_probe(struct udevice *dev)
{
	struct video_uc_platdata *plat = dev_get_uclass_platdata(dev);
	struct video_priv *priv = dev_get_uclass_priv(dev);
	char name[30], drv[15], *str;
	const char *drv_name = drv;
	struct udevice *cons;
	int ret;

	/* Set up the line and display size */
	priv->fb = map_sysmem(plat->base, plat->size);
	priv->line_length = priv->xsize * VNBYTES(priv->bpix);
	priv->fb_size = priv->line_length * priv->ysize;

	/* Set up colours - we could in future support other colours */
#ifdef CONFIG_SYS_WHITE_ON_BLACK
	priv->colour_fg = 0xffffff;
#else
	priv->colour_bg = 0xffffff;
#endif
	video_clear(dev);

	/*
	 * Create a text console device. For now we always do this, although
	 * it might be useful to support only bitmap drawing on the device
	 * for boards that don't need to display text. We create a TrueType
	 * console if enabled, a rotated console if the video driver requests
	 * it, otherwise a normal console.
	 *
	 * The console can be override by setting vidconsole_drv_name before
	 * probing this video driver, or in the probe() method.
	 *
	 * TrueType does not support rotation at present so fall back to the
	 * rotated console in that case.
	 */
	if (!priv->rot && IS_ENABLED(CONFIG_CONSOLE_TRUETYPE)) {
		snprintf(name, sizeof(name), "%s.vidconsole_tt", dev->name);
		strcpy(drv, "vidconsole_tt");
	} else {
		snprintf(name, sizeof(name), "%s.vidconsole%d", dev->name,
			 priv->rot);
		snprintf(drv, sizeof(drv), "vidconsole%d", priv->rot);
	}

	str = strdup(name);
	if (!str)
		return -ENOMEM;
	if (priv->vidconsole_drv_name)
		drv_name = priv->vidconsole_drv_name;
	ret = device_bind_driver(dev, drv_name, str, &cons);
	if (ret) {
		debug("%s: Cannot bind console driver\n", __func__);
		return ret;
	}

	ret = device_probe(cons);
	if (ret) {
		debug("%s: Cannot probe console driver\n", __func__);
		return ret;
	}

	return 0;
};