Esempio n. 1
0
File: voot.c Progetto: quad/voot
void voot_dump_buffer(const uint8 *in_data, uint32 in_data_length)
{
    uint32 index, remain, segment_size;
    voot_packet *sizer;

    segment_size = sizeof(sizer->buffer) - 1;

    voot_send_command(VOOT_COMMAND_TYPE_DUMPON);

    for (index = 0; index < (in_data_length / segment_size); index++)
    {
        const uint8 *in_data_segment;

        in_data_segment = in_data + (segment_size * index);

        if (!voot_send_packet(VOOT_PACKET_TYPE_DUMP, in_data_segment, segment_size))
        {
            voot_debug("Error sending packet in main dump loop! Abort!");
            break;
        }

        /* STAGE: Delay so we don't flood the receiving system. */
        vid_waitvbl();
    }

    remain = in_data_length % segment_size;
    if (remain)
        voot_send_packet(VOOT_PACKET_TYPE_DUMP, (in_data + in_data_length) - remain, remain);

    voot_send_command(VOOT_COMMAND_TYPE_DUMPOFF);
}
Esempio n. 2
0
File: biudp.c Progetto: quad/voot
bool biudp_write_buffer(const uint8 *in_data, uint32 in_data_length)
{
    uint32 index, remain;

    if (!control.initialized)
        return FALSE;

    /* STAGE: Split the incoming data into BIUDP_SEGMENT_SIZE byte chunks
        and feed those out. */
    for (index = 0; index < (in_data_length / BIUDP_SEGMENT_SIZE); index++)
    {
        const uint8 *in_data_segment;

        in_data_segment = in_data + (BIUDP_SEGMENT_SIZE * index);

        if (!biudp_write_segment(in_data_segment, BIUDP_SEGMENT_SIZE))
            return FALSE;

        /* STAGE: Delay so we don't flood the receiving system. */
        vid_waitvbl();
    }

    remain = in_data_length % BIUDP_SEGMENT_SIZE;
    if (remain)
        return biudp_write_segment((in_data + in_data_length) - remain, remain);
    else
        return TRUE;
}
Esempio n. 3
0
/* Shut down the PVR chip from ready status, leaving it in 2D mode as it
   was before the init. */
int pvr_shutdown() {
    if(!pvr_state.valid)
        return -1;

    /* Set us invalid */
    pvr_state.valid = 0;

    /* Stop anything that might be going on */
    PVR_SET(PVR_RESET, PVR_RESET_ALL);
    PVR_SET(PVR_RESET, PVR_RESET_NONE);

    /* Unhook any int handlers */
    vblank_handler_remove(pvr_state.vbl_handle);
    asic_evt_set_handler(ASIC_EVT_PVR_OPAQUEDONE, NULL);
    asic_evt_disable(ASIC_EVT_PVR_OPAQUEDONE, ASIC_IRQ_DEFAULT);
    asic_evt_set_handler(ASIC_EVT_PVR_OPAQUEMODDONE, NULL);
    asic_evt_disable(ASIC_EVT_PVR_OPAQUEMODDONE, ASIC_IRQ_DEFAULT);
    asic_evt_set_handler(ASIC_EVT_PVR_TRANSDONE, NULL);
    asic_evt_disable(ASIC_EVT_PVR_TRANSDONE, ASIC_IRQ_DEFAULT);
    asic_evt_set_handler(ASIC_EVT_PVR_TRANSMODDONE, NULL);
    asic_evt_disable(ASIC_EVT_PVR_TRANSMODDONE, ASIC_IRQ_DEFAULT);
    asic_evt_set_handler(ASIC_EVT_PVR_PTDONE, NULL);
    asic_evt_disable(ASIC_EVT_PVR_PTDONE, ASIC_IRQ_DEFAULT);
    asic_evt_set_handler(ASIC_EVT_PVR_RENDERDONE, NULL);
    asic_evt_disable(ASIC_EVT_PVR_RENDERDONE, ASIC_IRQ_DEFAULT);

    /* Shut down PVR DMA */
    pvr_dma_shutdown();

    /* Invalidate our memory pool */
    pvr_mem_reset();

    /* Destroy the semaphore */
    sem_destroy((semaphore_t *)&pvr_state.ready_sem);
    mutex_destroy((mutex_t *)&pvr_state.dma_lock);

    /* Clear video memory */
    vid_empty();

    /* Reset the frame buffer offset */
    vid_waitvbl();
    vid_set_start(0);

    /* Return success */
    return 0;
}
Esempio n. 4
0
void init_text(int splash)
{
	SDL_Surface *tmp;

	if (prSDLScreen==NULL)
	{
		SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO|SDL_INIT_JOYSTICK);
		prSDLScreen=SDL_SetVideoMode(320,240,16,VIDEO_FLAGS);
    		SDL_ShowCursor(SDL_DISABLE);
 	   	//SDL_JoystickEventState(SDL_ENABLE);
    		//SDL_JoystickOpen(0);
	}
#ifdef DREAMCAST
        __sdl_dc_emulate_keyboard=1;
#endif
	if (!text_screen)
	{
		text_screen=SDL_CreateRGBSurface(prSDLScreen->flags,prSDLScreen->w,prSDLScreen->h,prSDLScreen->format->BitsPerPixel,prSDLScreen->format->Rmask,prSDLScreen->format->Gmask,prSDLScreen->format->Bmask,prSDLScreen->format->Amask);
		tmp=SDL_LoadBMP(MENU_FILE_TEXT);
		if (text_screen==NULL || tmp==NULL)
			exit(-1);
		text_image=SDL_DisplayFormat(tmp);
		SDL_FreeSurface(tmp);
		if (text_image==NULL)
			exit(-2);
		SDL_SetColorKey(text_image,(SDL_SRCCOLORKEY | SDL_RLEACCEL),SDL_MapRGB(text_image -> format, 0, 0, 0));
		tmp=SDL_LoadBMP(MENU_FILE_BACKGROUND);
		if (tmp==NULL)
			exit(-3);
		text_background=SDL_DisplayFormat(tmp);
		SDL_FreeSurface(tmp);
		if (text_background==NULL)
			exit(-3);
		tmp=SDL_LoadBMP(MENU_FILE_WINDOW);
		if (tmp==NULL)
			exit(-4);
		text_window_background=SDL_DisplayFormat(tmp);
		SDL_FreeSurface(tmp);
		if (text_window_background==NULL)
			exit(-5);
	}
	if (splash)
	{
		SDL_Surface *sur;
		SDL_Rect r;
		int i,j;

		obten_colores();
		uae4all_init_sound();
		if (skipintro) goto skipintro;
#if !defined(DEBUG_UAE4ALL) && !defined(PROFILER_UAE4ALL) && !defined(AUTO_RUN) && !defined(AUTO_FRAMERATE)
		tmp=SDL_LoadBMP(MENU_FILE_SPLASH);
		if (tmp==NULL)
			exit(-6);
		sur = SDL_DisplayFormat(tmp);
		SDL_FreeSurface(tmp);
		r.x=(text_screen->w - sur->w)/2;
		r.y=(text_screen->h - sur->h)/2;
		r.h=sur->w;
		r.w=sur->h;
		SDL_FillRect(text_screen,NULL,0xFFFFFFFF);
		for (i=128;i>-8;i-=8)
		{
#ifdef DREAMCAST
			vid_waitvbl();
#else
			SDL_Delay(50);
#endif
			SDL_FillRect(text_screen,NULL,0xFFFFFFFF);
			SDL_BlitSurface(sur,NULL,text_screen,&r);
			fade16(text_screen,i);
			text_flip();
		}
		SDL_Delay(3000);
		for(i=0;i<128;i+=16)
		{
#ifdef DREAMCAST
			vid_waitvbl();
#else
			SDL_Delay(50);
#endif
			SDL_FillRect(text_screen,NULL,0xFFFFFFFF);
			SDL_BlitSurface(sur,NULL,text_screen,&r);
			fade16(text_screen,i);
			text_flip();
		}
		for(i=128;i>-8;i-=8)
		{
#ifdef DREAMCAST
			vid_waitvbl();
#else
			SDL_Delay(50);
#endif
			text_draw_background();
			fade16(text_screen,i);
			text_flip();
		}
		SDL_FreeSurface(sur);
#else
#if !defined (DREAMCAST) && !defined (GP2X)
		chdir("example");
#else
#ifdef DREAMCAST
		fs_chdir("/cd");
#endif
#endif
#endif
skipintro:
		for(i=0;i<10;i++)
		{
			SDL_Event ev;
			if (!uae4all_init_rom(romfile))
				break;

			text_draw_background();
			text_draw_window(54,91,250,64,"--- ERROR ---");
			write_text(11,14,"KICK.ROM not found");
			write_text(8,16,"Press any button to retry");
			text_flip();
			SDL_Delay(333);
			while(SDL_PollEvent(&ev))
#ifndef DREAMCAST
				if (ev.type==SDL_QUIT)
					exit(1);
				else
#endif
				SDL_Delay(10);
			while(!SDL_PollEvent(&ev))
				SDL_Delay(10);
			while(SDL_PollEvent(&ev))
				if (ev.type==SDL_QUIT)
					exit(1);
			text_draw_background();
			text_flip();
			SDL_Delay(333);
		}
		if (i>=10)
			exit(1);
	}
	else
	{
		SDL_FillRect(text_screen,NULL,0xFFFFFFFF);
		text_flip();
		uae4all_resume_music();
	}
	menu_msg_time=SDL_GetTicks();
}
Esempio n. 5
0
void init_text(int splash)
{
	SDL_Event ev;
	int toexit=0;
	SDL_Surface *sur;
	SDL_Rect r;
	int i,j;


	if (!text_screen)
	{

//		text_screen=SDL_ConvertSurface(screen,screen->format,0);
		text_screen=SDL_CreateRGBSurface(screen->flags,screen->w,screen->h,screen->format->BitsPerPixel,screen->format->Rmask,screen->format->Gmask,screen->format->Bmask,screen->format->Amask);
//		text_screen=SDL_DisplayFormat(screen);
		if (!text_screen)
		{
#ifdef STDOUTPUT
			puts("Unable to make a SDL_Surface (text_screen)");
#endif
			exit(-1);

		}
	}

#ifdef DREAMCAST
        __sdl_dc_emulate_keyboard=1;
#endif
	if (!splash)
	{
		menu_raise();
		return;
	}

	text_image2=load_img_0(MENU_FILE_TEXT2);
	font_inv.Surface=text_image2;
	SFont_InitFontInfo(&font_inv);

	text_image=load_img_0(MENU_FILE_TEXT);
	SFont_InitFont(text_image);

	text_win_uleft=load_img_255(MENU_FILE_WIN_ULEFT);
	text_win_uright=load_img_255(MENU_FILE_WIN_URIGHT);
	text_win_upper=load_img_255(MENU_FILE_WIN_UPPER);
	text_win_left=load_img_255(MENU_FILE_WIN_LEFT);
	text_win_right=load_img_255(MENU_FILE_WIN_RIGHT);
	text_win_bright=load_img_255(MENU_FILE_WIN_BRIGHT);
	text_win_bleft=load_img_255(MENU_FILE_WIN_BLEFT);
	text_win_bottom=load_img_255(MENU_FILE_WIN_BOTTOM);
	text_cdrom=menu_IMG_Load(MENU_FILE_LOADING);

	init_background();

	obten_colores();
	sound_play_menu_music();
#ifndef AUTO_EVENTS
	sur=menu_IMG_Load(MENU_FILE_SPLASH);
	r.x=(text_screen->w - sur->w)/2;
	r.y=(text_screen->h - sur->h)/2;
	r.h=sur->w;
	r.w=sur->h;
	SDL_FillRect(text_screen,NULL,0); //0xFFFFFFFF);
	while(SDL_PollEvent(&ev)) SDL_Delay(50);
	for (i=128;(i>-8)&&(!toexit);i-=8)
	{
#ifdef DREAMCAST
		vid_waitvbl();
#else
		SDL_Delay(50);
#endif
		SDL_FillRect(text_screen,NULL,0); //0xFFFFFFFF);
		SDL_BlitSurface(sur,NULL,text_screen,&r);
		fade16(text_screen,i);
		text_flip();
		while(SDL_PollEvent(&ev)) toexit=1;
	}
	for(i=0;(i<23)&&(!toexit);i++)
	{
		while(SDL_PollEvent(&ev)) toexit=1;
		SDL_Delay(100);
	}
	for(i=0;(i<128)&&(!toexit);i+=16)
	{
#ifdef DREAMCAST
		vid_waitvbl();
#else
		SDL_Delay(50);
#endif
		SDL_FillRect(text_screen,NULL,0); //0xFFFFFFFF);
		SDL_BlitSurface(sur,NULL,text_screen,&r);
		fade16(text_screen,i);
		text_flip();
		while(SDL_PollEvent(&ev)) toexit=1;
	}
	for(i=128;(i>-8)&&(!toexit);i-=8)
	{
#ifdef DREAMCAST
		vid_waitvbl();
#else
		SDL_Delay(50);
#endif
		text_draw_background();
		fade16(text_screen,i);
		text_flip();
		while(SDL_PollEvent(&ev)) toexit=1;
	}
	SDL_FreeSurface(sur);
#else
#ifndef DREAMCAST
	chdir(ROM_PREFIX);
#else
//	fs_chdir(ROM_PREFIX);
	fs_chdir("/");//ROM_PREFIX);
#endif
#endif
//	menu_msg_time=SDL_GetTicks();
}