\r
#include <stdarg.h>\r
\r
-#include "../gp2x/emu.h"\r
-#include "../gp2x/menu.h"\r
-#include "../gp2x/gp2x.h"\r
#include "../common/arm_utils.h"\r
#include "../common/fonts.h"\r
#include "../common/emu.h"\r
+#include "../common/menu.h"\r
#include "../common/config.h"\r
#include "../common/common.h"\r
#include "../common/input.h"\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+g_screen_width*(y+h));\r
+ p = (int *) ((unsigned char *) g_screen_ptr+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+g_screen_width*(y+h));\r
+ p = (int *) ((unsigned short *) g_screen_ptr+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 + 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
+ *(unsigned int *)((char *)g_screen_ptr + g_screen_width*2+ 4) =\r
+ *(unsigned int *)((char *)g_screen_ptr + g_screen_width*3+ 4) =\r
+ *(unsigned int *)((char *)g_screen_ptr + g_screen_width*4+ 4) = col_g;\r
+ *(unsigned int *)((char *)g_screen_ptr + g_screen_width*2+12) =\r
+ *(unsigned int *)((char *)g_screen_ptr + g_screen_width*3+12) =\r
+ *(unsigned int *)((char *)g_screen_ptr + g_screen_width*4+12) = col_r;\r
} else {\r
// 16-bit modes\r
- unsigned int *p = (unsigned int *)((short *)gp2x_screen + g_screen_width*2+4);\r
+ unsigned int *p = (unsigned int *)((short *)g_screen_ptr + 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 += g_screen_width/2 - 12/2;\r
\r
static void draw_pico_ptr(void)\r
{\r
- unsigned short *p = (unsigned short *)gp2x_screen;\r
+ unsigned short *p = (unsigned short *)g_screen_ptr;\r
\r
// only if pen enabled and for 16bit modes\r
if (pico_inp_mode == 0 || (PicoOpt&0x10) || !(currentConfig.EmuOpt&0x80)) return;\r
static int EmuScanBegin16(unsigned int num)\r
{\r
if (!(Pico.video.reg[1]&8)) num += 8;\r
- DrawLineDest = (unsigned short *)gp2x_screen + num*800 + 800/2 - 320/2;\r
+ DrawLineDest = (unsigned short *)g_screen_ptr + num*800 + 800/2 - 320/2;\r
//int w = (Pico.video.reg[12]&1) ? 320 : 256;\r
- //DrawLineDest = (unsigned short *)gp2x_screen + num*w;\r
+ //DrawLineDest = (unsigned short *)g_screen_ptr + num*w;\r
\r
return 0;\r
}\r
int len, mask = 0xff;\r
\r
if (!(Pico.video.reg[1]&8)) num += 8;\r
- pd=(unsigned short *)gp2x_screen + num*800*2 + 800/2 - 320*2/2;\r
+ pd=(unsigned short *)g_screen_ptr + num*800*2 + 800/2 - 320*2/2;\r
\r
if (Pico.m.dirtyPal)\r
PicoDoHighPal555(sh);\r
\r
#endif // USE_320_SCREEN\r
\r
-static int EmuScanBegin8(unsigned int num)\r
-{\r
- if (!(Pico.video.reg[1]&8)) num += 8;\r
- DrawLineDest = (unsigned char *) gp2x_screen + g_screen_width * num;\r
-\r
- return 0;\r
-}\r
-\r
int localPal[0x100];\r
static void (*vidCpyM2)(void *dest, void *src) = NULL;\r
\r
Pico.m.dirtyPal = 0;\r
vidConvCpyRGB32(localPal, Pico.cram, 0x40);\r
// feed new palette to our device\r
- gp2x_video_setpalette(localPal, 0x40);\r
+ // gp2x_video_setpalette(localPal, 0x40);\r
}\r
// a hack for VR\r
if (PicoRead16Hook == PicoSVPRead16)\r
memset32((int *)(PicoDraw2FB+328*8+328*223), 0xe0e0e0e0, 328);\r
// do actual copy\r
- vidCpyM2((unsigned char *)gp2x_screen+g_screen_width*8, PicoDraw2FB+328*8);\r
+ vidCpyM2((unsigned char *)g_screen_ptr+g_screen_width*8, PicoDraw2FB+328*8);\r
}\r
else if (!(emu_opt&0x80))\r
{\r
localPal[0xe0] = 0x00000000; // reserved pixels for OSD\r
localPal[0xf0] = 0x00ffffff;\r
}\r
- gp2x_video_setpalette(localPal, pallen);\r
+ // gp2x_video_setpalette(localPal, pallen);\r
}\r
}\r
\r
draw_cd_leds();\r
if (PicoAHW & PAHW_PICO)\r
draw_pico_ptr();\r
-{\r
-//static int u=0;\r
-//memset((char *)gp2x_screen+800*471*2, (u++)>>1, 800*9*2);\r
-}\r
\r
//gp2x_video_wait_vsync();\r
- gp2x_video_flip();\r
+ // gp2x_video_flip();\r
}\r
\r
\r
// clears whole screen or just the notice area (in all buffers)\r
static void clearArea(int full)\r
{\r
- if ((PicoOpt&0x10)||!(currentConfig.EmuOpt&0x80)) {\r
- // 8-bit renderers\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, 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
+ if (full) memset(g_screen_ptr, 0, g_screen_width*g_screen_height*2);\r
+ else memset((short *)g_screen_ptr + g_screen_width * (g_screen_height - 16), 0,\r
+ g_screen_width * 16 * 2);\r
}\r
\r
\r
static void vidResetMode(void)\r
{\r
+#if 0\r
if (PicoOpt&0x10) {\r
gp2x_video_changemode(8);\r
} else if (currentConfig.EmuOpt&0x80) {\r
if (currentConfig.scaling == 2 && !(Pico.video.reg[1]&8))\r
gp2x_video_RGB_setscaling(8, (PicoOpt&0x100)&&!(Pico.video.reg[12]&1) ? 256 : 320, 224);\r
else gp2x_video_RGB_setscaling(0, (PicoOpt&0x100)&&!(Pico.video.reg[12]&1) ? 256 : 320, 240);\r
+#else\r
+#ifdef USE_320_SCREEN\r
+ PicoDrawSetColorFormat(1);\r
+ PicoScanBegin = EmuScanBegin16;\r
+#else\r
+ PicoDrawSetColorFormat(-1);\r
+ PicoScanEnd = EmuScanEnd16;\r
+#endif\r
+#endif\r
}\r
\r
\r
static void emu_msg_cb(const char *msg)\r
{\r
+/*\r
if ((PicoOpt&0x10)||!(currentConfig.EmuOpt&0x80)) {\r
// 8-bit renderers\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
+ gp2x_memcpy_all_buffers((char *)g_screen_ptr+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(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
+ gp2x_memcpy_all_buffers((char *)g_screen_ptr+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
-\r
+*/\r
/* assumption: emu_msg_cb gets called only when something slow is about to happen */\r
reset_timing = 1;\r
}\r
if (do_it) {\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, g_screen_width*g_screen_height*2);\r
+ //gp2x_memcpy_all_buffers(g_screen_ptr, 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+g_screen_width*8, PicoDraw2FB+328*8);\r
+ vidCpyM2((unsigned char *)g_screen_ptr+g_screen_width*8, PicoDraw2FB+328*8);\r
vidConvCpyRGB32(localPal, Pico.cram, 0x40);\r
gp2x_video_setpalette(localPal, 0x40);\r
*/\r
// calc vsync offset to sync timing code with vsync\r
if (currentConfig.EmuOpt&0x2000) {\r
gettimeofday(&tval, 0);\r
- gp2x_video_wait_vsync();\r
+ //gp2x_video_wait_vsync();\r
gettimeofday(&tval, 0);\r
vsync_offset = tval.tv_usec;\r
while (vsync_offset >= target_frametime)\r
vidCpyM2 = vidCpyM2_32col;\r
}\r
}\r
- if (currentConfig.scaling == 2 && !(modes&8)) // want vertical scaling and game is not in 240 line mode\r
- gp2x_video_RGB_setscaling(8, scalex, 224);\r
- else gp2x_video_RGB_setscaling(0, scalex, 240);\r
+ //if (currentConfig.scaling == 2 && !(modes&8)) // want vertical scaling and game is not in 240 line mode\r
+ // gp2x_video_RGB_setscaling(8, scalex, 224);\r
+ // else gp2x_video_RGB_setscaling(0, scalex, 240);\r
oldmodes = modes;\r
clearArea(1);\r
}\r
if (vsync_offset) {\r
if (lim_time - tval.tv_usec > target_frametime/2)\r
simpleWait(pthissec, lim_time - target_frametime/4);\r
- gp2x_video_wait_vsync();\r
+ // gp2x_video_wait_vsync();\r
} else {\r
simpleWait(pthissec, lim_time);\r
}\r
#include <strings.h>\r
#include <linux/limits.h>\r
\r
-#include "../gp2x/gp2x.h"\r
-#include "../gp2x/menu.h"\r
+#include "../gp2x/emu.h" // TODO rm\r
#include "../common/menu.h"\r
#include "../common/emu.h"\r
#include "../common/config.h"\r
#include "../common/input.h"\r
-#include "../gp2x/emu.h"\r
#include "../gp2x/version.h"\r
+#include "pandora.h"\r
\r
\r
-extern int select_exits;\r
extern char *PicoConfigFile;\r
static int load_state_slot = -1;\r
-int mmuhack_status = 0; // TODO rm\r
char **g_argv;\r
\r
void parse_cmd_line(int argc, char *argv[])\r
if(strcasecmp(argv[x], "-config") == 0) {\r
if(x+1 < argc) { ++x; PicoConfigFile = argv[x]; }\r
}\r
- else if(strcasecmp(argv[x], "-selectexit") == 0) {\r
- select_exits = 1;\r
- }\r
else if(strcasecmp(argv[x], "-loadstate") == 0) {\r
if(x+1 < argc) { ++x; load_state_slot = atoi(argv[x]); }\r
}\r
} else {\r
/* External Frontend: ROM Name */\r
FILE *f;\r
- strncpy(rom_fname_reload, argv[x], PATH_MAX);\r
- rom_fname_reload[PATH_MAX-1] = 0;\r
+ strncpy(rom_fname_reload, argv[x], sizeof(rom_fname_reload));\r
+ rom_fname_reload[sizeof(rom_fname_reload) - 1] = 0;\r
f = fopen(rom_fname_reload, "rb");\r
if (f) fclose(f);\r
else unrecognized = 1;\r
}\r
\r
if (unrecognized) {\r
- printf("\n\n\nPicoDrive v" VERSION " (c) notaz, 2006-2008\n");\r
+ printf("\n\n\nPicoDrive v" VERSION " (c) notaz, 2006-2009\n");\r
printf("usage: %s [options] [romfile]\n", argv[0]);\r
printf( "options:\n"\r
- "-menu <menu_path> launch a custom program on exit instead of default gp2xmenu\n"\r
- "-state <param> pass '-state param' to the menu program\n"\r
"-config <file> use specified config file instead of default 'picoconfig.bin'\n"\r
" see currentConfig_t structure in emu.h for the file format\n"\r
- "-selectexit pressing SELECT will exit the emu and start 'menu_path'\n"\r
"-loadstate <num> if ROM is specified, try loading slot <num>\n");\r
}\r
}\r
\r
in_probe();\r
in_debug_dump();\r
- gp2x_init();\r
+ pnd_init();\r
emu_Init();\r
menu_init();\r
\r
endloop:\r
\r
emu_Deinit();\r
+ pnd_exit();\r
\r
return 0;\r
}\r
-\r
#include <stdio.h>\r
#include <stdlib.h>\r
#include <stdarg.h>\r
#include <fcntl.h>\r
#include <errno.h>\r
\r
-#include "../gp2x/gp2x.h"\r
#include "../linux/sndout_oss.h"\r
#include "../common/arm_linux.h"\r
+#include "../common/emu.h"\r
+#include "pandora.h"\r
\r
-static volatile unsigned int *memregs = MAP_FAILED;\r
-//static\r
-int memdev = 0;\r
static int fbdev = -1;\r
\r
#define SCREEN_MAP_SIZE (800*480*2)\r
static void *screen = MAP_FAILED;\r
-void *gp2x_screen;\r
-\r
-\r
-/* video stuff */\r
-void gp2x_video_flip(void)\r
-{\r
-}\r
-\r
-/* doulblebuffered flip */\r
-void gp2x_video_flip2(void)\r
-{\r
-}\r
-\r
-\r
-void gp2x_video_changemode2(int bpp)\r
-{\r
-}\r
-\r
-\r
-void gp2x_video_changemode(int bpp)\r
-{\r
-}\r
-\r
-\r
-void gp2x_video_setpalette(int *pal, int len)\r
-{\r
-}\r
-\r
-\r
-void gp2x_video_RGB_setscaling(int ln_offs, int W, int H)\r
-{\r
-}\r
-\r
-\r
-void gp2x_video_wait_vsync(void)\r
-{\r
-}\r
-\r
-void gp2x_video_flush_cache(void)\r
-{\r
-// cache_flush_d_inval_i(gp2x_screen, (char *)gp2x_screen + 320*240*2, 0);\r
-}\r
-\r
-void gp2x_memcpy_buffers(int buffers, void *data, int offset, int len)\r
-{\r
-}\r
-\r
-\r
-void gp2x_memcpy_all_buffers(void *data, int offset, int len)\r
-{\r
-}\r
-\r
-\r
-void gp2x_memset_all_buffers(int offset, int byte, int len)\r
-{\r
- memset((char *)gp2x_screen + offset, byte, len);\r
-}\r
-\r
-\r
-void gp2x_pd_clone_buffer2(void)\r
-{\r
- memset(gp2x_screen, 0, 800*480*2);\r
-}\r
-\r
-// FIXME\r
-#if 0\r
-static int touchcal[7] = { 6203, 0, -1501397, 0, -4200, 16132680, 65536 };\r
-\r
-typedef struct ucb1x00_ts_event\r
-{\r
- unsigned short pressure;\r
- unsigned short x;\r
- unsigned short y;\r
- unsigned short pad;\r
- struct timeval stamp;\r
-} UCB1X00_TS_EVENT;\r
-\r
-int gp2x_touchpad_read(int *x, int *y)\r
-{\r
- UCB1X00_TS_EVENT event;\r
- static int zero_seen = 0;\r
- int retval;\r
-\r
- if (touchdev < 0) return -1;\r
-\r
- retval = read(touchdev, &event, sizeof(event));\r
- if (retval <= 0) {\r
- printf("touch read failed %i %i\n", retval, errno);\r
- return -1;\r
- }\r
- // this is to ignore the messed-up 4.1.x driver\r
- if (event.pressure == 0) zero_seen = 1;\r
-\r
- if (x) *x = (event.x * touchcal[0] + touchcal[2]) >> 16;\r
- if (y) *y = (event.y * touchcal[4] + touchcal[5]) >> 16;\r
- // printf("read %i %i %i\n", event.pressure, *x, *y);\r
-\r
- return zero_seen ? event.pressure : 0;\r
-}\r
-#else\r
-int gp2x_touchpad_read(int *x, int *y) { return -1; }\r
-#endif\r
\r
/* common */\r
-void gp2x_init(void)\r
+void pnd_init(void)\r
{\r
printf("entering init()\n"); fflush(stdout);\r
\r
- memdev = open("/dev/mem", O_RDWR);\r
- if (memdev == -1)\r
- {\r
- perror("open(\"/dev/mem\")");\r
- exit(1);\r
- }\r
-/*\r
- memregs = mmap(0, 0x01000000, PROT_READ|PROT_WRITE, MAP_SHARED, memdev, 0x48000000);\r
- if (memregs == MAP_FAILED)\r
- {\r
- printf("mmap(memregs) failed with %i\n", errno);\r
- exit(1);\r
- }\r
-*/\r
fbdev = open("/dev/fb0", O_RDWR);\r
if (fbdev == -1)\r
{\r
exit(1);\r
}\r
printf("fbptr %p\n", screen);\r
- gp2x_screen = screen;\r
+ g_screen_ptr = screen;\r
\r
// snd\r
sndout_oss_init();\r
printf("exitting init()\n"); fflush(stdout);\r
}\r
\r
-void gp2x_deinit(void)\r
+void pnd_exit(void)\r
{\r
if (screen != MAP_FAILED)\r
munmap(screen, SCREEN_MAP_SIZE);\r
- if (memregs != MAP_FAILED)\r
- munmap((void *)memregs, 0x10000);\r
- close(memdev);\r
- if (fbdev >= 0) close(fbdev);\r
+ if (fbdev >= 0)\r
+ close(fbdev);\r
\r
sndout_oss_exit();\r
\r
\r
\r
/* fake GP2X */\r
-int crashed_940 = 0;\r
-\r
+/*\r
void set_gamma(int g100, int A_SNs_curve) {}\r
void set_FCLK(unsigned MHZ) {}\r
void set_LCD_custom_rate(int rate) {}\r
void unset_LCD_custom_rate(void) {}\r
void Pause940(int yes) {}\r
void Reset940(int yes, int bank) {}\r
-\r
+*/\r