#endif\r
\r
\r
-int engineState;\r
int select_exits = 0;\r
\r
-char romFileName[PATH_MAX];\r
-\r
static short __attribute__((aligned(4))) sndBuffer[2*44100/50];\r
static struct timeval noticeMsgTime = { 0, 0 }; // when started showing\r
static int osd_fps_x;\r
\r
#define PICO_PEN_ADJUST_X 4\r
#define PICO_PEN_ADJUST_Y 2\r
-static int pico_pen_x = SCREEN_WIDTH/2, pico_pen_y = 240/2;\r
+static int pico_pen_x = 0, pico_pen_y = 240/2;\r
\r
static void emu_msg_cb(const char *msg);\r
static void emu_msg_tray_open(void);\r
defaultConfig.EmuOpt = 0x8f | 0x00600; // | <- confirm_save, cd_leds\r
defaultConfig.s_PicoOpt = 0x0f | POPT_EXT_FM|POPT_EN_MCD_PCM|POPT_EN_MCD_CDDA|POPT_EN_SVP_DRC;\r
defaultConfig.s_PicoOpt |= POPT_ACC_SPRITES|POPT_EN_MCD_GFX;\r
-// defaultConfig.s_PicoOpt &= ~POPT_EN_SVP_DRC; // crashes :(\r
defaultConfig.EmuOpt &= ~8; // no save gzip\r
defaultConfig.s_PsndRate = 44100;\r
defaultConfig.s_PicoRegion = 0;\r
static void textOut16(int x, int y, const char *text)\r
{\r
int i,l,len=strlen(text);\r
- unsigned int *screen = (unsigned int *)((unsigned short *)SCREEN_BUFFER + (x&~1) + y*SCREEN_WIDTH);\r
+ unsigned int *screen = (unsigned int *)((unsigned short *)g_screen_ptr + (x&~1) + y*g_screen_width);\r
\r
for (i = 0; i < len; i++)\r
{\r
for (l=0;l<16;)\r
{\r
unsigned char fd = fontdata8x8[((text[i])*8)+l/2];\r
- unsigned int *d = &screen[l*SCREEN_WIDTH/2];\r
+ unsigned int *d = &screen[l*g_screen_width/2];\r
if (fd&0x80) d[0]=0xffffffff;\r
if (fd&0x40) d[1]=0xffffffff;\r
if (fd&0x20) d[2]=0xffffffff;\r
if (fd&0x04) d[5]=0xffffffff;\r
if (fd&0x02) d[6]=0xffffffff;\r
if (fd&0x01) d[7]=0xffffffff;\r
- l++; d = &screen[l*SCREEN_WIDTH/2];\r
+ l++; d = &screen[l*g_screen_width/2];\r
if (fd&0x80) d[0]=0xffffffff;\r
if (fd&0x40) d[1]=0xffffffff;\r
if (fd&0x20) d[2]=0xffffffff;\r
x &= ~3; // align x\r
len = (len+3) >> 2;\r
for (h = 0; h < 8; h++) {\r
- p = (int *) ((unsigned char *) gp2x_screen+x+SCREEN_WIDTH*(y+h));\r
+ p = (int *) ((unsigned char *) gp2x_screen+x+g_screen_width*(y+h));\r
for (i = len; i; i--, p++) *p = 0xe0e0e0e0;\r
}\r
emu_textOut8(x, y, text);\r
x &= ~1; // align x\r
len++;\r
for (h = 0; h < 16; h++) {\r
- p = (int *) ((unsigned short *) gp2x_screen+x+SCREEN_WIDTH*(y+h));\r
+ p = (int *) ((unsigned short *) gp2x_screen+x+g_screen_width*(y+h));\r
for (i = len; i; i--, p++) *p = 0;//(*p>>2)&0x39e7;\r
}\r
textOut16(x, y, text);\r
// 8-bit modes\r
unsigned int col_g = (old_reg & 2) ? 0xc0c0c0c0 : 0xe0e0e0e0;\r
unsigned int col_r = (old_reg & 1) ? 0xd0d0d0d0 : 0xe0e0e0e0;\r
- *(unsigned int *)((char *)gp2x_screen + SCREEN_WIDTH*2+ 4) =\r
- *(unsigned int *)((char *)gp2x_screen + SCREEN_WIDTH*3+ 4) =\r
- *(unsigned int *)((char *)gp2x_screen + SCREEN_WIDTH*4+ 4) = col_g;\r
- *(unsigned int *)((char *)gp2x_screen + SCREEN_WIDTH*2+12) =\r
- *(unsigned int *)((char *)gp2x_screen + SCREEN_WIDTH*3+12) =\r
- *(unsigned int *)((char *)gp2x_screen + SCREEN_WIDTH*4+12) = col_r;\r
+ *(unsigned int *)((char *)gp2x_screen + g_screen_width*2+ 4) =\r
+ *(unsigned int *)((char *)gp2x_screen + g_screen_width*3+ 4) =\r
+ *(unsigned int *)((char *)gp2x_screen + g_screen_width*4+ 4) = col_g;\r
+ *(unsigned int *)((char *)gp2x_screen + g_screen_width*2+12) =\r
+ *(unsigned int *)((char *)gp2x_screen + g_screen_width*3+12) =\r
+ *(unsigned int *)((char *)gp2x_screen + g_screen_width*4+12) = col_r;\r
} else {\r
// 16-bit modes\r
- unsigned int *p = (unsigned int *)((short *)gp2x_screen + SCREEN_WIDTH*2+4);\r
+ unsigned int *p = (unsigned int *)((short *)gp2x_screen + g_screen_width*2+4);\r
unsigned int col_g = (old_reg & 2) ? 0x06000600 : 0;\r
unsigned int col_r = (old_reg & 1) ? 0xc000c000 : 0;\r
- *p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r; p += SCREEN_WIDTH/2 - 12/2;\r
- *p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r; p += SCREEN_WIDTH/2 - 12/2;\r
+ *p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r; p += g_screen_width/2 - 12/2;\r
+ *p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r; p += g_screen_width/2 - 12/2;\r
*p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r;\r
}\r
}\r
if (!(Pico.video.reg[12]&1) && !(PicoOpt&POPT_DIS_32C_BORDER))\r
p += 32;\r
\r
- p += SCREEN_WIDTH * (pico_pen_y + PICO_PEN_ADJUST_Y);\r
+ p += g_screen_width * (pico_pen_y + PICO_PEN_ADJUST_Y);\r
p += pico_pen_x + PICO_PEN_ADJUST_X;\r
p[0] ^= 0xffff;\r
p[319] ^= 0xffff;\r
static int EmuScanBegin8(unsigned int num)\r
{\r
if (!(Pico.video.reg[1]&8)) num += 8;\r
- DrawLineDest = (unsigned char *) gp2x_screen + SCREEN_WIDTH * num;\r
+ DrawLineDest = (unsigned char *) gp2x_screen + g_screen_width * num;\r
\r
return 0;\r
}\r
if (PicoRead16Hook == PicoSVPRead16)\r
memset32((int *)(PicoDraw2FB+328*8+328*223), 0xe0e0e0e0, 328);\r
// do actual copy\r
- vidCpyM2((unsigned char *)gp2x_screen+SCREEN_WIDTH*8, PicoDraw2FB+328*8);\r
+ vidCpyM2((unsigned char *)gp2x_screen+g_screen_width*8, PicoDraw2FB+328*8);\r
}\r
else if (!(emu_opt&0x80))\r
{\r
}\r
\r
if (notice || (emu_opt & 2)) {\r
- int h = SCREEN_HEIGHT-16;\r
+ int h = g_screen_height-16;\r
if (currentConfig.scaling == 2 && !(Pico.video.reg[1]&8)) h -= 16;\r
if (notice) osd_text(4, h, notice);\r
if (emu_opt & 2)\r
{\r
if ((PicoOpt&0x10)||!(currentConfig.EmuOpt&0x80)) {\r
// 8-bit renderers\r
- if (full) gp2x_memset_all_buffers(0, 0xe0, SCREEN_WIDTH*240);\r
- else gp2x_memset_all_buffers(SCREEN_WIDTH*232, 0xe0, SCREEN_WIDTH*8);\r
+ if (full) gp2x_memset_all_buffers(0, 0xe0, g_screen_width*240);\r
+ else gp2x_memset_all_buffers(g_screen_width*232, 0xe0, g_screen_width*8);\r
} else {\r
// 16bit accurate renderer\r
- if (full) gp2x_memset_all_buffers(0, 0, SCREEN_WIDTH*SCREEN_HEIGHT*2);\r
- else gp2x_memset_all_buffers(SCREEN_WIDTH*(SCREEN_HEIGHT-16)*2, 0, SCREEN_WIDTH*16*2);\r
+ if (full) gp2x_memset_all_buffers(0, 0, g_screen_width*g_screen_height*2);\r
+ else gp2x_memset_all_buffers(g_screen_width*(g_screen_height-16)*2, 0, g_screen_width*16*2);\r
}\r
}\r
\r
{\r
if ((PicoOpt&0x10)||!(currentConfig.EmuOpt&0x80)) {\r
// 8-bit renderers\r
- gp2x_memset_all_buffers(SCREEN_WIDTH*(SCREEN_HEIGHT-16), 0xe0, SCREEN_WIDTH*16);\r
- osd_text(4, SCREEN_HEIGHT-16, msg);\r
- gp2x_memcpy_all_buffers((char *)gp2x_screen+SCREEN_WIDTH*(SCREEN_HEIGHT-16),\r
- SCREEN_WIDTH*(SCREEN_HEIGHT-16), SCREEN_WIDTH*16);\r
+ gp2x_memset_all_buffers(g_screen_width*(g_screen_height-16), 0xe0, g_screen_width*16);\r
+ osd_text(4, g_screen_height-16, msg);\r
+ gp2x_memcpy_all_buffers((char *)gp2x_screen+g_screen_width*(g_screen_height-16),\r
+ g_screen_width*(g_screen_height-16), g_screen_width*16);\r
} else {\r
// 16bit accurate renderer\r
- gp2x_memset_all_buffers(SCREEN_WIDTH*(SCREEN_HEIGHT-16)*2, 0, SCREEN_WIDTH*16*2);\r
- osd_text(4, SCREEN_HEIGHT-16, msg);\r
- gp2x_memcpy_all_buffers((char *)gp2x_screen+SCREEN_WIDTH*(SCREEN_HEIGHT-16)*2,\r
- SCREEN_WIDTH*(SCREEN_HEIGHT-16)*2, SCREEN_WIDTH*16*2);\r
+ gp2x_memset_all_buffers(g_screen_width*(g_screen_height-16)*2, 0, g_screen_width*16*2);\r
+ osd_text(4, g_screen_height-16, msg);\r
+ gp2x_memcpy_all_buffers((char *)gp2x_screen+g_screen_width*(g_screen_height-16)*2,\r
+ g_screen_width*(g_screen_height-16)*2, g_screen_width*16*2);\r
}\r
gettimeofday(¬iceMsgTime, 0);\r
noticeMsgTime.tv_sec -= 2;\r
#endif\r
}\r
if (do_it) {\r
- osd_text(4, SCREEN_HEIGHT-16, (which & 0x1000) ? "LOADING GAME" : "SAVING GAME");\r
+ osd_text(4, g_screen_height-16, (which & 0x1000) ? "LOADING GAME" : "SAVING GAME");\r
PicoStateProgressCB = emu_state_cb;\r
- gp2x_memcpy_all_buffers(gp2x_screen, 0, SCREEN_WIDTH*SCREEN_HEIGHT*2);\r
+ gp2x_memcpy_all_buffers(gp2x_screen, 0, g_screen_width*g_screen_height*2);\r
emu_SaveLoadGame((which & 0x1000) >> 12, 0);\r
PicoStateProgressCB = NULL;\r
}\r
clearArea(1);\r
} else vidCpyM2 = vidCpyM2_40col;\r
\r
- vidCpyM2((unsigned char *)gp2x_screen+SCREEN_WIDTH*8, PicoDraw2FB+328*8);\r
+ vidCpyM2((unsigned char *)gp2x_screen+g_screen_width*8, PicoDraw2FB+328*8);\r
vidConvCpyRGB32(localPal, Pico.cram, 0x40);\r
gp2x_video_setpalette(localPal, 0x40);\r
*/\r
modes = ((Pico.video.reg[12]&1)<<2)|(Pico.video.reg[1]&8);\r
if (modes != oldmodes)\r
{\r
- int scalex = SCREEN_WIDTH;\r
+ int scalex = g_screen_width;\r
osd_fps_x = OSD_FPS_X;\r
if (modes & 4) {\r
vidCpyM2 = vidCpyM2_40col;\r