Ejemplo n.º 1
0
static void blit(const char *fps, const char *notice)
{
	int emu_opt = currentConfig.EmuOpt;

	if (PicoOpt&0x10)
	{
		int lines_flags = 224;
		// 8bit fast renderer
		if (Pico.m.dirtyPal) {
			Pico.m.dirtyPal = 0;
			vidConvCpyRGB565(localPal, Pico.cram, 0x40);
		}
		// a hack for VR
		if (PicoAHW & PAHW_SVP)
			memset32((int *)(PicoDraw2FB+328*8+328*223), 0xe0e0e0e0, 328);
		if (!(Pico.video.reg[12]&1)) lines_flags|=0x10000;
		if (currentConfig.EmuOpt&0x4000)
			lines_flags|=0x40000; // (Pico.m.frame_count&1)?0x20000:0x40000;
		vidCpy8to16((unsigned short *)giz_screen+321*8, PicoDraw2FB+328*8, localPal, lines_flags);
	}
	else if (!(emu_opt&0x80))
	{
		int lines_flags;
		// 8bit accurate renderer
		if (Pico.m.dirtyPal) {
			Pico.m.dirtyPal = 0;
			vidConvCpyRGB565(localPal, Pico.cram, 0x40);
			if (Pico.video.reg[0xC]&8) { // shadow/hilight mode
				//vidConvCpyRGB32sh(localPal+0x40, Pico.cram, 0x40);
				//vidConvCpyRGB32hi(localPal+0x80, Pico.cram, 0x40); // TODO?
				memcpy32((void *)(localPal+0xc0), (void *)(localPal+0x40), 0x40*2/4);
				localPal[0xc0] = 0x0600;
				localPal[0xd0] = 0xc000;
				localPal[0xe0] = 0x0000; // reserved pixels for OSD
				localPal[0xf0] = 0xffff;
			}
			/* no support
			else if (rendstatus & 0x20) { // mid-frame palette changes
				vidConvCpyRGB565(localPal+0x40, HighPal, 0x40);
				vidConvCpyRGB565(localPal+0x80, HighPal+0x40, 0x40);
			} */
		}
		lines_flags = (Pico.video.reg[1]&8) ? 240 : 224;
		if (!(Pico.video.reg[12]&1)) lines_flags|=0x10000;
		if (currentConfig.EmuOpt&0x4000)
			lines_flags|=0x40000; // (Pico.m.frame_count&1)?0x20000:0x40000;
		vidCpy8to16((unsigned short *)giz_screen+321*8, PicoDraw2FB+328*8, localPal, lines_flags);
	}

	if (notice || (emu_opt & 2)) {
		int h = 232;
		if (notice)      osd_text(4, h, notice);
		if (emu_opt & 2) osd_text(OSD_FPS_X, h, fps);
	}

	if ((emu_opt & 0x400) && (PicoAHW & PAHW_MCD))
		cd_leds();
}
Ejemplo n.º 2
0
static void osd_channellist_nownext_title(struct osd_t* osd)
{
  uint32_t row_space_y = 50;
  uint32_t x = nownext_win_x + PADDING_X;
  uint32_t y = nownext_win_y + PADDING_Y + row_space_y;
  uint32_t w = nownext_win_w - 2 * PADDING_X; 
  uint32_t h = nownext_win_h - 2 * PADDING_Y;
  uint32_t color;
  uint32_t bg_color = COLOR_BACKGROUND;
  uint32_t date_y = nownext_win_y + PADDING_Y;
  struct tm start_time;
  struct tm stop_time;
  struct event_t* event;
  char str[128];
  int i;
  int update_all;

  update_all = osd->model_now_next.event[0] != osd->model_now_next_current.event[0];
  if (update_all) {
    // clear window
    graphics_resource_fill(osd->img, x - 2, date_y - 5, w + 5, h + 20, COLOR_BACKGROUND);
  }
  
  /* Fixa scroll i nn window. Och endast uppdatera ändringar!! */
  
  for (i = 0; i < 11; i++) {  
    if (osd->model_now_next.event[i] > 0) {
      event = event_copy(osd->model_now_next.event[i], osd->model_now_next.server);
      if (event != NULL) {
        if (osd->model_now_next.selectedIndex == i) {
          color = COLOR_SELECTED_TEXT;
          if (osd->model_channellist.active == 0) {
            bg_color = COLOR_SELECTED_BACKGROUND; 
          }
        }
        else {
          color = COLOR_TEXT;
          bg_color = COLOR_BACKGROUND;
        }  
        
        if(update_all || i == osd->model_now_next.selectedIndex || i == osd->model_now_next_current.selectedIndex) { 
          localtime_r((time_t*)&event->start, &start_time);
          localtime_r((time_t*)&event->stop, &stop_time);
          snprintf(str, sizeof(str),"%02d:%02d - %02d:%02d %s", start_time.tm_hour,start_time.tm_min,stop_time.tm_hour,stop_time.tm_min, event->title);      
          osd_text(osd, x, y, w, row_space_y, color, bg_color, str);
          printf("Now: %s\n", str);
          
          if (i == osd->model_now_next.selectedIndex) {
            graphics_resource_fill(osd->img, x - 2, date_y - 5, w + 5, row_space_y, COLOR_BACKGROUND);
            snprintf(str, sizeof(str),"%s %d", day_str[start_time.tm_wday], start_time.tm_mday);      
            osd_text(osd, x, date_y, w, row_space_y, COLOR_SELECTED_TEXT, COLOR_BACKGROUND, str);            
          }  
        }  
        y += row_space_y;
      }
    }  
  }
}
Ejemplo n.º 3
0
static void osd_channellist_channels(struct osd_t* osd)
{
  int i;
  uint32_t row_space_y = 50;
  uint32_t x = channellist_win_x + PADDING_X;
  uint32_t y = channellist_win_y + PADDING_Y;
  uint32_t color;
  uint32_t bg_color;
  char str[128];
  
  for (i = 0; i < osd->model_channellist.numUsed; i++) {
    if ( osd_model_channellist_compare(&osd->model_channellist, &osd->model_channellist_current, i) == 1 ) {
      //printf("osd_channellist_channels: Update index %d - lcn %d\n", i, osd->model_channellist.channel[i].lcn);
      if (osd->model_channellist.selectedIndex == i) {
        color = COLOR_SELECTED_TEXT;
        if (osd->model_channellist.active) {
          bg_color = COLOR_SELECTED_BACKGROUND;
        }
        else {
          bg_color = COLOR_BACKGROUND;
        }
      }
      else {
        color = COLOR_TEXT;
        bg_color = COLOR_BACKGROUND;
      }
      snprintf(str, sizeof(str), "%d %s", osd->model_channellist.channel[i].lcn, osd->model_channellist.channel[i].name); 
      osd_text(osd, x, y , 500, row_space_y, color, bg_color, str);                      
    }    
    y += row_space_y;     
  }
}
Ejemplo n.º 4
0
void emu_msg_cb(const char *msg)
{
	osd_text(4, msg, 1, 1);
	noticeMsgTime = sceKernelGetSystemTimeLow() - 2000000;

	/* assumption: emu_msg_cb gets called only when something slow is about to happen */
	reset_timing = 1;
}
Ejemplo n.º 5
0
void pemu_finalize_frame(const char *fps, const char *notice)
{
	int emu_opt = currentConfig.EmuOpt;
	int ret;

	if (PicoAHW & PAHW_32X)
		; // nothing to do
	else if (get_renderer() == RT_8BIT_FAST)
	{
		// 8bit fast renderer
		if (Pico.m.dirtyPal) {
			Pico.m.dirtyPal = 0;
			ret = make_local_pal(1);
			// feed new palette to our device
			gp2x_video_setpalette(localPal, ret);
		}
		// a hack for VR
		if (PicoAHW & PAHW_SVP)
			memset32((int *)(PicoDraw2FB+328*8+328*223), 0xe0e0e0e0, 328);
		// do actual copy
		vidcpyM2(g_screen_ptr, PicoDraw2FB+328*8,
			!(Pico.video.reg[12] & 1), !(PicoOpt & POPT_DIS_32C_BORDER));
	}
	else if (get_renderer() == RT_8BIT_ACC)
	{
		// 8bit accurate renderer
		if (Pico.m.dirtyPal)
		{
			Pico.m.dirtyPal = 0;
			ret = make_local_pal(0);
			gp2x_video_setpalette(localPal, ret);
		}
	}

	if (notice)
		osd_text(4, osd_y, notice);
	if (emu_opt & EOPT_SHOW_FPS)
		osd_text(osd_fps_x, osd_y, fps);
	if ((PicoAHW & PAHW_MCD) && (emu_opt & EOPT_EN_CD_LEDS))
		draw_cd_leds();
	if (PicoAHW & PAHW_PICO)
		draw_pico_ptr();
}
Ejemplo n.º 6
0
static void osd_channellist_event_info(struct osd_t* osd)
{
  uint32_t x = eventinfo_win_x + PADDING_X;
  uint32_t y = eventinfo_win_y + PADDING_Y;
  uint32_t w = eventinfo_win_w - 2 * PADDING_X; 
  uint32_t h = eventinfo_win_h - 2 * PADDING_Y;
  struct event_t* event;
  uint32_t event_id;
  
  // clear window
  graphics_resource_fill(osd->img, x - 2, y - 5, w + 5, h + 20, COLOR_BACKGROUND);

  event_id = osd->model_now_next.event[osd->model_now_next.selectedIndex];
  if (event_id > 0) {
    event = event_copy(event_id, osd->model_now_next.server);
    if (event != NULL) {
//      printf("eventinfo: %s\n", event->title);
//      printf("eventinfo: %s\n", event->description);
      osd_text(osd, x, y, w, 50, COLOR_SELECTED_TEXT, COLOR_BACKGROUND, event->title);
      osd_paragraph(osd, event->description, 40, x, y + 50, w, h - 50);
    }
  }   
}
Ejemplo n.º 7
0
static void RunEvents(unsigned int which)
{
	if (which & 0x1800) // save or load (but not both)
	{
		int do_it = 1;

		if (PsndOut != NULL)
			FrameworkAudio_SetPause(1);
		if (giz_screen == NULL)
			giz_screen = Framework2D_LockBuffer(1);
		if ( emu_checkSaveFile(state_slot) &&
				(( (which & 0x1000) && (currentConfig.EmuOpt & 0x800)) || // load
				 (!(which & 0x1000) && (currentConfig.EmuOpt & 0x200))) ) // save
		{
			int keys;
			blit("", (which & 0x1000) ? "LOAD STATE? (PLAY=yes, STOP=no)" : "OVERWRITE SAVE? (PLAY=yes, STOP=no)");
			while( !((keys = Framework_PollGetButtons()) & (BTN_PLAY|BTN_STOP)) )
				Sleep(50);
			if (keys & BTN_STOP) do_it = 0;
			while(  ((keys = Framework_PollGetButtons()) & (BTN_PLAY|BTN_STOP)) ) // wait for release
				Sleep(50);
			clearArea(0);
		}

		if (do_it)
		{
			osd_text(4, 232, (which & 0x1000) ? "LOADING GAME" : "SAVING GAME");
			PicoStateProgressCB = emu_stateCb;
			emu_SaveLoadGame((which & 0x1000) >> 12, 0);
			PicoStateProgressCB = NULL;
			Sleep(0);
		}

		if (PsndOut != NULL)
			FrameworkAudio_SetPause(0);
		reset_timing = 1;
	}
Ejemplo n.º 8
0
/*  
 * Display the menu view 
 */
static void osd_menu_view(struct osd_t* osd)
{
  osd_draw_window(osd, OSD_XMARGIN, OSD_YMARGIN, osd->display_width - 2 * OSD_XMARGIN, 300);
  osd_text(osd, OSD_XMARGIN + PADDING_X, OSD_YMARGIN + PADDING_Y, osd->display_width - 2 * OSD_XMARGIN, 300, COLOR_TEXT, COLOR_BACKGROUND, osd->model_menu.info);
  osd_text(osd, OSD_XMARGIN + PADDING_X, OSD_YMARGIN + PADDING_Y + 50, osd->display_width - 2 * OSD_XMARGIN, 300, COLOR_TEXT, COLOR_BACKGROUND, osd->model_menu.bitrate);  
}