--- /dev/null
+/* FCE Ultra - NES/Famicom Emulator
+ *
+ * Copyright notice for this file:
+ * Copyright (C) 2002 Ben Parnell
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <pthread.h>
+
+#include "sdl.h"
+#include "../common/vidblit.h"
+
+
+#ifdef GP2X
+#include "minimal.h"
+
+char* fps_str=NULL;
+#endif
+extern int showfps;
+
+int stretch_offset=32;
+
+unsigned long framesRendered;
+unsigned long fps;
+unsigned long fps_samplecount=0;
+unsigned long total_fps=-1;
+unsigned long ticks;
+
+pthread_t gp2x_video_thread=0;
+uint8 * XBufHelper=NULL;
+
+
+#define _sline srendline
+#define _eline erendline
+
+#ifndef GP2X
+SDL_Surface *screen;
+#endif
+
+static int tlines;
+static int inited=0;
+
+static int exs,eys,eefx;
+#define NWIDTH (256-((eoptions&EO_CLIPSIDES)?16:0))
+#define NOFFSET (eoptions&EO_CLIPSIDES?8:0)
+
+
+
+int paletterefresh;
+#ifdef GP2X
+static int screenSizeInBytes = 320 * 240;
+#endif
+#define FPS_COLOR 61
+
+
+
+
+static unsigned char fontdata8x8[] =
+{
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x3C,0x42,0x99,0xBD,0xBD,0x99,0x42,0x3C,0x3C,0x42,0x81,0x81,0x81,0x81,0x42,0x3C,
+ 0xFE,0x82,0x8A,0xD2,0xA2,0x82,0xFE,0x00,0xFE,0x82,0x82,0x82,0x82,0x82,0xFE,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x64,0x74,0x7C,0x38,0x00,0x00,
+ 0x80,0xC0,0xF0,0xFC,0xF0,0xC0,0x80,0x00,0x01,0x03,0x0F,0x3F,0x0F,0x03,0x01,0x00,
+ 0x18,0x3C,0x7E,0x18,0x7E,0x3C,0x18,0x00,0xEE,0xEE,0xEE,0xCC,0x00,0xCC,0xCC,0x00,
+ 0x00,0x00,0x30,0x68,0x78,0x30,0x00,0x00,0x00,0x38,0x64,0x74,0x7C,0x38,0x00,0x00,
+ 0x3C,0x66,0x7A,0x7A,0x7E,0x7E,0x3C,0x00,0x0E,0x3E,0x3A,0x22,0x26,0x6E,0xE4,0x40,
+ 0x18,0x3C,0x7E,0x3C,0x3C,0x3C,0x3C,0x00,0x3C,0x3C,0x3C,0x3C,0x7E,0x3C,0x18,0x00,
+ 0x08,0x7C,0x7E,0x7E,0x7C,0x08,0x00,0x00,0x10,0x3E,0x7E,0x7E,0x3E,0x10,0x00,0x00,
+ 0x58,0x2A,0xDC,0xC8,0xDC,0x2A,0x58,0x00,0x24,0x66,0xFF,0xFF,0x66,0x24,0x00,0x00,
+ 0x00,0x10,0x10,0x38,0x38,0x7C,0xFE,0x00,0xFE,0x7C,0x38,0x38,0x10,0x10,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x1C,0x1C,0x18,0x00,0x18,0x18,0x00,
+ 0x6C,0x6C,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x28,0x7C,0x28,0x7C,0x28,0x00,0x00,
+ 0x10,0x38,0x60,0x38,0x0C,0x78,0x10,0x00,0x40,0xA4,0x48,0x10,0x24,0x4A,0x04,0x00,
+ 0x18,0x34,0x18,0x3A,0x6C,0x66,0x3A,0x00,0x18,0x18,0x20,0x00,0x00,0x00,0x00,0x00,
+ 0x30,0x60,0x60,0x60,0x60,0x60,0x30,0x00,0x0C,0x06,0x06,0x06,0x06,0x06,0x0C,0x00,
+ 0x10,0x54,0x38,0x7C,0x38,0x54,0x10,0x00,0x00,0x18,0x18,0x7E,0x18,0x18,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x18,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x04,0x08,0x10,0x20,0x40,0x00,0x00,
+ 0x38,0x4C,0xC6,0xC6,0xC6,0x64,0x38,0x00,0x18,0x38,0x18,0x18,0x18,0x18,0x7E,0x00,
+ 0x7C,0xC6,0x0E,0x3C,0x78,0xE0,0xFE,0x00,0x7E,0x0C,0x18,0x3C,0x06,0xC6,0x7C,0x00,
+ 0x1C,0x3C,0x6C,0xCC,0xFE,0x0C,0x0C,0x00,0xFC,0xC0,0xFC,0x06,0x06,0xC6,0x7C,0x00,
+ 0x3C,0x60,0xC0,0xFC,0xC6,0xC6,0x7C,0x00,0xFE,0xC6,0x0C,0x18,0x30,0x30,0x30,0x00,
+ 0x78,0xC4,0xE4,0x78,0x86,0x86,0x7C,0x00,0x7C,0xC6,0xC6,0x7E,0x06,0x0C,0x78,0x00,
+ 0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x18,0x30,
+ 0x1C,0x38,0x70,0xE0,0x70,0x38,0x1C,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00,
+ 0x70,0x38,0x1C,0x0E,0x1C,0x38,0x70,0x00,0x7C,0xC6,0xC6,0x1C,0x18,0x00,0x18,0x00,
+ 0x3C,0x42,0x99,0xA1,0xA5,0x99,0x42,0x3C,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0x00,
+ 0xFC,0xC6,0xC6,0xFC,0xC6,0xC6,0xFC,0x00,0x3C,0x66,0xC0,0xC0,0xC0,0x66,0x3C,0x00,
+ 0xF8,0xCC,0xC6,0xC6,0xC6,0xCC,0xF8,0x00,0xFE,0xC0,0xC0,0xFC,0xC0,0xC0,0xFE,0x00,
+ 0xFE,0xC0,0xC0,0xFC,0xC0,0xC0,0xC0,0x00,0x3E,0x60,0xC0,0xCE,0xC6,0x66,0x3E,0x00,
+ 0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0x00,0x7E,0x18,0x18,0x18,0x18,0x18,0x7E,0x00,
+ 0x06,0x06,0x06,0x06,0xC6,0xC6,0x7C,0x00,0xC6,0xCC,0xD8,0xF0,0xF8,0xDC,0xCE,0x00,
+ 0x60,0x60,0x60,0x60,0x60,0x60,0x7E,0x00,0xC6,0xEE,0xFE,0xFE,0xD6,0xC6,0xC6,0x00,
+ 0xC6,0xE6,0xF6,0xFE,0xDE,0xCE,0xC6,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,
+ 0xFC,0xC6,0xC6,0xC6,0xFC,0xC0,0xC0,0x00,0x7C,0xC6,0xC6,0xC6,0xDE,0xCC,0x7A,0x00,
+ 0xFC,0xC6,0xC6,0xCE,0xF8,0xDC,0xCE,0x00,0x78,0xCC,0xC0,0x7C,0x06,0xC6,0x7C,0x00,
+ 0x7E,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,
+ 0xC6,0xC6,0xC6,0xEE,0x7C,0x38,0x10,0x00,0xC6,0xC6,0xD6,0xFE,0xFE,0xEE,0xC6,0x00,
+ 0xC6,0xEE,0x3C,0x38,0x7C,0xEE,0xC6,0x00,0x66,0x66,0x66,0x3C,0x18,0x18,0x18,0x00,
+ 0xFE,0x0E,0x1C,0x38,0x70,0xE0,0xFE,0x00,0x3C,0x30,0x30,0x30,0x30,0x30,0x3C,0x00,
+ 0x60,0x60,0x30,0x18,0x0C,0x06,0x06,0x00,0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3C,0x00,
+ 0x18,0x3C,0x66,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,
+ 0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x06,0x3E,0x66,0x66,0x3C,0x00,
+ 0x60,0x7C,0x66,0x66,0x66,0x66,0x7C,0x00,0x00,0x3C,0x66,0x60,0x60,0x66,0x3C,0x00,
+ 0x06,0x3E,0x66,0x66,0x66,0x66,0x3E,0x00,0x00,0x3C,0x66,0x66,0x7E,0x60,0x3C,0x00,
+ 0x1C,0x30,0x78,0x30,0x30,0x30,0x30,0x00,0x00,0x3E,0x66,0x66,0x66,0x3E,0x06,0x3C,
+ 0x60,0x7C,0x76,0x66,0x66,0x66,0x66,0x00,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x00,
+ 0x0C,0x00,0x1C,0x0C,0x0C,0x0C,0x0C,0x38,0x60,0x60,0x66,0x6C,0x78,0x6C,0x66,0x00,
+ 0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0xEC,0xFE,0xFE,0xFE,0xD6,0xC6,0x00,
+ 0x00,0x7C,0x76,0x66,0x66,0x66,0x66,0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x3C,0x00,
+ 0x00,0x7C,0x66,0x66,0x66,0x7C,0x60,0x60,0x00,0x3E,0x66,0x66,0x66,0x3E,0x06,0x06,
+ 0x00,0x7E,0x70,0x60,0x60,0x60,0x60,0x00,0x00,0x3C,0x60,0x3C,0x06,0x66,0x3C,0x00,
+ 0x30,0x78,0x30,0x30,0x30,0x30,0x1C,0x00,0x00,0x66,0x66,0x66,0x66,0x6E,0x3E,0x00,
+ 0x00,0x66,0x66,0x66,0x66,0x3C,0x18,0x00,0x00,0xC6,0xD6,0xFE,0xFE,0x7C,0x6C,0x00,
+ 0x00,0x66,0x3C,0x18,0x3C,0x66,0x66,0x00,0x00,0x66,0x66,0x66,0x66,0x3E,0x06,0x3C,
+ 0x00,0x7E,0x0C,0x18,0x30,0x60,0x7E,0x00,0x0E,0x18,0x0C,0x38,0x0C,0x18,0x0E,0x00,
+ 0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x00,0x70,0x18,0x30,0x1C,0x30,0x18,0x70,0x00,
+ 0x00,0x00,0x76,0xDC,0x00,0x00,0x00,0x00,0x10,0x28,0x10,0x54,0xAA,0x44,0x00,0x00,
+};
+
+static void gp2x_text(unsigned char *screen, int x, int y, char *text, int color, int flip)
+{
+ int i,l,slen;
+ slen=strlen(text);
+
+ screen=screen+x+y*320;
+
+ for (i=0;i<slen;i++)
+ {
+ for (l=0;l<8;l++)
+ {
+
+ screen[l*320+0]=(fontdata8x8[((text[i])*8)+l]&0x80)?color:screen[l*320+0];
+ screen[l*320+1]=(fontdata8x8[((text[i])*8)+l]&0x40)?color:screen[l*320+1];
+ screen[l*320+2]=(fontdata8x8[((text[i])*8)+l]&0x20)?color:screen[l*320+2];
+ screen[l*320+3]=(fontdata8x8[((text[i])*8)+l]&0x10)?color:screen[l*320+3];
+ screen[l*320+4]=(fontdata8x8[((text[i])*8)+l]&0x08)?color:screen[l*320+4];
+ screen[l*320+5]=(fontdata8x8[((text[i])*8)+l]&0x04)?color:screen[l*320+5];
+ screen[l*320+6]=(fontdata8x8[((text[i])*8)+l]&0x02)?color:screen[l*320+6];
+ screen[l*320+7]=(fontdata8x8[((text[i])*8)+l]&0x01)?color:screen[l*320+7];
+
+ }
+ screen+=8;
+ }
+}
+
+
+
+
+void CleanSurface(void)
+{
+#ifdef GP2X
+ int c=4;
+ while (c--)
+{
+ memset (gp2x_screen8, 0x80, screenSizeInBytes);
+ gp2x_video_flip();
+ }
+
+#else
+ uint32 x;
+
+ x=screen->pitch*screen->h;
+
+ if(SDL_MUSTLOCK(screen))
+ SDL_LockSurface(screen);
+
+ memset((uint8*)screen->pixels, 0x3F, x);
+
+ if(SDL_MUSTLOCK(screen))
+ SDL_UnlockSurface(screen);
+
+ SDL_UpdateRect(screen, 0, 0, 0, 0);
+#endif
+}
+
+
+
+void KillVideo(void)
+{
+#ifdef GP2X
+ if (fps_str)
+ free(fps_str);
+ inited&=~1;
+
+
+#else
+ if(inited&1)
+ {
+ SDL_QuitSubSystem(SDL_INIT_VIDEO);
+ }
+ inited=0;
+#endif
+}
+
+int InitVideo(void)
+{
+#ifdef GP2X
+
+
+ fps_str=malloc(3);
+ fps_str[0]='5'; fps_str[1]='0'; fps_str[2]=0;
+
+ CleanSurface();
+
+
+ inited|=1;
+
+ puts("Initialized GP2X VIDEO via minimal");
+
+ srendline=0;
+ erendline=239;
+ return 1;
+
+
+#else
+ const SDL_VideoInfo *vinf;
+ int flags=0;
+
+ #ifdef BROKEN
+ if(_fullscreen && _fshack)
+ setenv("SDL_VIDEODRIVER",_fshack,1);
+ else
+ {
+ if(!_fshacksave)
+ unsetenv("SDL_VIDEODRIVER");
+ else
+ setenv("SDL_VIDEODRIVER",_fshacksave,1);
+ }
+ #endif
+ if(SDL_InitSubSystem(SDL_INIT_VIDEO)==-1)
+ {
+ puts(SDL_GetError());
+ return(0);
+ }
+ inited|=1;
+
+ SDL_ShowCursor(0);
+ tlines=_eline-_sline+1;
+
+ vinf=SDL_GetVideoInfo();
+
+ if(vinf->hw_available)
+ flags|=SDL_HWSURFACE;
+
+ if(_fullscreen)
+ flags|=SDL_FULLSCREEN;
+ flags|=SDL_HWPALETTE;
+
+ if(_fullscreen)
+ {
+ exs=_xscalefs;
+ eys=_yscalefs;
+ eefx=_efxfs;
+ if(_xres<NWIDTH*exs || _yres<tlines*eys)
+ {
+ puts("xscale and/or yscale out of bounds.");
+ KillVideo();
+ return(0);
+ }
+ screen = SDL_SetVideoMode(_xres, _yres, 8, flags);
+ }
+ else
+ {
+ exs=_xscale;
+ eys=_yscale;
+ eefx=_efx;
+ screen = SDL_SetVideoMode(NWIDTH*exs, tlines*eys, 8, flags);
+ }
+ if(!screen)
+ {
+ puts(SDL_GetError());
+ KillVideo();
+ return(0);
+ }
+ inited=1;
+ CleanSurface();
+
+ SDL_WM_SetCaption("FCE Ultra","FCE Ultra");
+ paletterefresh=1;
+ printf("srendline %d, erendline %d\n", srendline, erendline);
+ return 1;
+#endif
+}
+
+void ToggleFS(void)
+{
+#ifndef GP2X
+ KillVideo();
+ _fullscreen=!_fullscreen;
+
+ if(!InitVideo())
+ {
+ _fullscreen=!_fullscreen;
+ if(!InitVideo())
+ {
+ puts("Gah, bailing out.");
+ exit(1);
+ }
+ }
+#endif
+}
+
+
+#ifndef GP2X
+static SDL_Color psdl[256];
+
+void FCEUD_SetPalette(uint8 index, uint8 r, uint8 g, uint8 b)
+{
+
+ psdl[index].r=r;
+ psdl[index].g=g;
+ psdl[index].b=b;
+
+ paletterefresh=1;
+}
+
+void FCEUD_GetPalette(uint8 index, uint8 *r, uint8 *g, uint8 *b)
+{
+ *r=psdl[index].r;
+ *g=psdl[index].g;
+ *b=psdl[index].b;
+}
+
+static void RedoPalette(void)
+{
+ SDL_SetPalette(screen,SDL_PHYSPAL,psdl,0,256);
+}
+#else
+
+
+
+void FCEUD_SetPalette(uint8 index, uint8 r, uint8 g, uint8 b)
+{
+ gp2x_video_color8(index, r, g, b);
+ gp2x_video_setpalette();
+
+
+ paletterefresh = 1;
+}
+void FCEUD_GetPalette(uint8 index, uint8 * r, uint8 * g, uint8 * b)
+{
+ *r = (uint8) gp2x_palette[(index << 1) + 1];
+ *g = (uint8) (gp2x_palette[(index << 1) + 0] >> 8);
+ *b = (uint8) gp2x_palette[(index << 1) + 0];
+}
+
+static void RedoPalette(void)
+{
+}
+
+
+
+unsigned int gp2x_ticks_per_ms=7372800;
+int needfpsflip=1;
+#ifdef FRAMESKIP
+int skipval=16;
+int framecount=0;
+int numrepeats=0;
+int doskipping=0;
+#endif
+
+
+INLINE void printFps(uint8 *screen)
+{
+ int y;
+ int* destt;
+
+ if (needfpsflip)
+ {
+ if (stretch_offset > 0)
+ {
+ y=240;
+ while (y--)
+ {
+
+ int* dest=(int *) (screen+((y << 8) + (y << 6))+stretch_offset);
+
+ destt=dest - 8;
+ destt[0]=0x3F3F3F3F; destt[1]=0x3F3F3F3F; destt[2]=0x3F3F3F3F; destt[3]=0x3F3F3F3F;
+ destt[4]=0x3F3F3F3F; destt[5]=0x3F3F3F3F; destt[6]=0x3F3F3F3F; destt[7]=0x3F3F3F3F;
+
+ destt=dest + 64;
+ destt[0]=0x3F3F3F3F; destt[1]=0x3F3F3F3F; destt[2]=0x3F3F3F3F; destt[3]=0x3F3F3F3F;
+ destt[4]=0x3F3F3F3F; destt[5]=0x3F3F3F3F; destt[6]=0x3F3F3F3F; destt[7]=0x3F3F3F3F;
+ }
+ if (showfps)
+ {
+ gp2x_text(screen, 0, 0, fps_str, FPS_COLOR, 0);
+ }
+ }
+
+ if (needfpsflip <= 3)
+ {
+ if (showfps)
+ {
+ gp2x_text(screen, 0, 0, fps_str, FPS_COLOR, 0);
+ }
+ needfpsflip++;
+ }
+ else
+ {
+ needfpsflip=0;
+ }
+ }
+#ifdef FRAMESKIP
+ if ((fps < 59) && doskipping && ((framesRendered % skipval) == (skipval-1)))
+ {
+ FCEUI_FrameSkip(1);
+ }
+#endif
+ if ((framesRendered & 0x3F) != 0x3F)
+ {
+ return;
+ }
+
+ unsigned long currTime=gp2x_timer_read_ms();
+ fps= (unsigned long)( framesRendered * 7372800 / (currTime - ticks));
+ if (fps > 90)
+ fps=90;
+
+ if (fps > 30)
+ {
+ fps_samplecount++;
+ total_fps+=fps;
+ }
+ if (stretch_offset && showfps)
+ {
+ sprintf(fps_str, "%d", (int)fps);
+ needfpsflip=1;
+ fps_str[2]=0;
+ gp2x_text(screen, 0, 0, fps_str, stretch_offset, 0);
+ }
+
+#ifdef FRAMESKIP
+ if (fps < 59)
+ {
+ numrepeats++;
+ if (numrepeats >= 4)
+ {
+ if (skipval > 4)
+ {
+ skipval-=2;
+ }
+ doskipping=1;
+ printf("skipping every %dth frame, currfps=%d\n", skipval, fps);
+ numrepeats=0;
+ }
+ }
+ else
+ {
+ numrepeats=0;
+ }
+#endif
+ ticks = currTime;
+ framesRendered = 0;
+}
+#endif
+
+
+
+
+
+
+
+
+
+
+
+void LockConsole(){}
+void UnlockConsole(){}
+
+
+#ifdef GP2X
+
+void BlitScreen(uint8 * XBuf)
+{
+
+ int x, y, yinc;
+ if (!XBuf) return;
+ XBufHelper=XBuf;
+ framesRendered++;
+ XBuf = XBuf ;
+
+ y=240;
+ yinc=272*(y-1);
+ while (y--)
+ {
+ int* dest=(int *) (gp2x_screen8+((y << 8) + (y << 6))+stretch_offset);
+
+ int* src=(int *) (XBuf+yinc);
+ x=64;
+ while (x--)
+ {
+ dest[x]=src[x];
+ }
+ yinc-=272;
+ }
+
+ if (paletterefresh)
+ {
+ gp2x_video_setpalette();
+ paletterefresh = 0;
+ }
+
+ printFps(gp2x_screen8);
+ gp2x_video_flip();
+}
+
+
+
+
+#else
+extern void SpeedThrottle();
+void BlitScreen(uint8 *XBuf)
+{
+ uint8 *dest;
+ int xo=0,yo=0;
+
+ SpeedThrottle();
+
+ if(paletterefresh)
+ {
+ RedoPalette();
+ paletterefresh=0;
+ }
+
+ XBuf+=_sline*272;
+
+ if(SDL_MUSTLOCK(screen))
+ SDL_LockSurface(screen);
+
+ dest=screen->pixels;
+
+ if(_fullscreen)
+ {
+ xo=(((screen->w-NWIDTH*exs))>>1);
+ dest+=xo;
+ if(screen->h>(tlines*eys))
+ {
+ yo=((screen->h-tlines*eys)>>1);
+ dest+=yo*screen->pitch;
+ }
+ }
+
+ Blit8To8(XBuf+NOFFSET,dest, NWIDTH, tlines, screen->pitch,exs,eys,eefx);
+
+ if(SDL_MUSTLOCK(screen))
+ SDL_UnlockSurface(screen);
+
+ SDL_UpdateRect(screen, xo, yo, NWIDTH*exs, tlines*eys);
+
+ if (0)
+ {
+ gp2x_text(NULL, 0, 0, NULL, 0, 0);
+ }
+}
+
+uint32 PtoV(uint16 x, uint16 y)
+{
+ if(_fullscreen)
+ {
+
+ }
+ else
+ {
+ if(eoptions&EO_CLIPSIDES)
+ x+=8;
+ y+=srendline;
+ }
+ return(x|(y<<16));
+}
+#endif