void gp2x_video_flip(void)\r
{\r
unsigned int address = gp2x_screenaddrs[screensel&3];\r
+ unsigned short msb16 = (unsigned short)(address >> 16);\r
+ unsigned short lsb16 = (unsigned short)(address);\r
\r
- /* test */\r
-/* {\r
- int i; char *p=gp2x_screen;\r
- for (i=0; i < 240; i++) { memset(p+i*320, 0, 32); }\r
- }*/\r
-\r
- gp2x_memregs[0x290E>>1]=(unsigned short)(address);\r
- gp2x_memregs[0x2910>>1]=(unsigned short)(address >> 16);\r
- gp2x_memregs[0x2912>>1]=(unsigned short)(address);\r
- gp2x_memregs[0x2914>>1]=(unsigned short)(address >> 16);\r
+ gp2x_memregs[0x290E>>1] = lsb16;\r
+ gp2x_memregs[0x2910>>1] = msb16;\r
+ gp2x_memregs[0x2912>>1] = lsb16;\r
+ gp2x_memregs[0x2914>>1] = msb16;\r
\r
// jump to other buffer:\r
gp2x_screen = gp2x_screens[++screensel&3];\r
}\r
\r
+/* doulblebuffered flip */\r
+void gp2x_video_flip2(void)\r
+{\r
+ unsigned int address = gp2x_screenaddrs[screensel&1];\r
+ unsigned short msb16 = (unsigned short)(address >> 16);\r
+ unsigned short lsb16 = (unsigned short)(address);\r
\r
-void gp2x_video_changemode(int bpp)\r
+ gp2x_memregs[0x290E>>1] = lsb16;\r
+ gp2x_memregs[0x2910>>1] = msb16;\r
+ gp2x_memregs[0x2912>>1] = lsb16;\r
+ gp2x_memregs[0x2914>>1] = msb16;\r
+\r
+ // jump to other buffer:\r
+ gp2x_screen = gp2x_screens[++screensel&1];\r
+}\r
+\r
+\r
+void gp2x_video_changemode2(int bpp)\r
{\r
gp2x_memregs[0x28DA>>1]=(((bpp+1)/8)<<9)|0xAB; /*8/15/16/24bpp...*/\r
gp2x_memregs[0x290C>>1]=320*((bpp+1)/8); /*line width in bytes*/\r
+}\r
+\r
+\r
+void gp2x_video_changemode(int bpp)\r
+{\r
+ gp2x_video_changemode2(bpp);\r
\r
gp2x_memset_all_buffers(0, 0, 640*480);\r
gp2x_video_flip();\r
}\r
\r
\r
+void gp2x_pd_clone_buffer2(void)\r
+{\r
+ memcpy(gp2x_screen, gp2x_screens[2], 320*240);\r
+ memset(gp2x_screen, 0xe0, 320*8);\r
+ memset(gp2x_screen + 320*232, 0xe0, 320*8);\r
+}\r
+\r
+\r
unsigned long gp2x_joystick_read(int allow_usb_joy)\r
{\r
int i;\r
vsprintf(buffer,texto,args);\r
va_end(args);\r
\r
- gp2x_text(gp2x_screen,x,y,buffer,1);\r
+ gp2x_text(gp2x_screen,x,y,buffer,0xf0);\r
}\r
\r
\r
if (max < 0) max = 0;\r
buffer[max] = 0;\r
\r
- gp2x_text(gp2x_screen,x,y,buffer,1);\r
+ gp2x_text(gp2x_screen,x,y,buffer,0xf0);\r
}\r
\r
\r
start = 12 - sel;\r
n--; // exclude current dir (".")\r
\r
- memset(gp2x_screen, 0, 320*240);\r
+ //memset(gp2x_screen, 0, 320*240);\r
+ gp2x_pd_clone_buffer2();\r
\r
if(start - 2 >= 0)\r
gp2x_text_out8_lim(14, (start - 2)*10, curdir, 38);\r
}\r
}\r
gp2x_text_out8(5, 120, ">");\r
- gp2x_video_flip();\r
+ gp2x_video_flip2();\r
}\r
\r
static int scandir_cmp(const void *p1, const void *p2)\r
}\r
}\r
\r
- memset(gp2x_screen, 0, 320*240);\r
+ //memset(gp2x_screen, 0, 320*240);\r
+ gp2x_pd_clone_buffer2();\r
gp2x_text_out8(60, 40, "Action: %s", actionNames[curr_act]);\r
gp2x_text_out8(60, 60, "Keys: %s", strkeys);\r
\r
gp2x_text_out8(30, 190, "Press a key to bind/unbind");\r
gp2x_text_out8(30, 200, "Select \"Done\" action and");\r
gp2x_text_out8(30, 210, " press any key to finish");\r
- gp2x_video_flip();\r
+ gp2x_video_flip2();\r
}\r
\r
static void key_config_loop(int is_p2)\r
char joyname[36];\r
\r
y = tl_y;\r
- memset(gp2x_screen, 0, 320*240);\r
+ //memset(gp2x_screen, 0, 320*240);\r
+ gp2x_pd_clone_buffer2();\r
gp2x_text_out8(tl_x, y, "Player 1");\r
gp2x_text_out8(tl_x, (y+=10), "Player 2");\r
gp2x_text_out8(tl_x, (y+=10), "Done");\r
}\r
\r
\r
- gp2x_video_flip();\r
+ gp2x_video_flip2();\r
}\r
\r
static void kc_sel_loop(void)\r
int tl_x = 25, tl_y = 60, y;\r
\r
y = tl_y;\r
- memset(gp2x_screen, 0, 320*240);\r
+ //memset(gp2x_screen, 0, 320*240);\r
+ gp2x_pd_clone_buffer2();\r
+\r
gp2x_text_out8(tl_x, y, "USA BIOS: %s", b_us); // 0\r
gp2x_text_out8(tl_x, (y+=10), "EUR BIOS: %s", b_eu); // 1\r
gp2x_text_out8(tl_x, (y+=10), "JAP BIOS: %s", b_jp); // 2\r
(menu_sel == 2 && strcmp(b_jp, "NOT FOUND")))\r
gp2x_text_out8(tl_x, 220, "Press start to test selected BIOS");\r
\r
- gp2x_video_flip();\r
+ gp2x_video_flip2();\r
}\r
\r
static void cd_menu_loop_options(void)\r
char *mms = mmuhack_status ? "active) " : "inactive)";\r
\r
y = tl_y;\r
- memset(gp2x_screen, 0, 320*240);\r
+ //memset(gp2x_screen, 0, 320*240);\r
+ gp2x_pd_clone_buffer2();\r
+\r
gp2x_text_out8(tl_x, y, "Scale 32 column mode %s", (currentConfig.PicoOpt&0x100)?"ON":"OFF"); // 0\r
gp2x_text_out8(tl_x, (y+=10), "Gamma correction %i.%02i", currentConfig.gamma / 100, currentConfig.gamma%100); // 1\r
gp2x_text_out8(tl_x, (y+=10), "Emulate Z80 %s", (currentConfig.PicoOpt&0x004)?"ON":"OFF"); // 2\r
// draw cursor\r
gp2x_text_out8(tl_x - 16, tl_y + menu_sel*10, ">");\r
\r
- gp2x_video_flip();\r
+ gp2x_video_flip2();\r
}\r
\r
static void amenu_loop_options(void)\r
}\r
\r
y = tl_y;\r
- memset(gp2x_screen, 0, 320*240);\r
+ //memset(gp2x_screen, 0, 320*240);\r
+ gp2x_pd_clone_buffer2();\r
+\r
gp2x_text_out8(tl_x, y, "Renderer: %s", strrend); // 0\r
gp2x_text_out8(tl_x, (y+=10), "Accurate timing (slower) %s", (currentConfig.PicoOpt&0x040)?"ON":"OFF"); // 1\r
gp2x_text_out8(tl_x, (y+=10), "Accurate sprites (slower) %s", (currentConfig.PicoOpt&0x080)?"ON":"OFF"); // 2\r
// draw cursor\r
gp2x_text_out8(tl_x - 16, tl_y + menu_sel*10, ">");\r
\r
- gp2x_video_flip();\r
+ gp2x_video_flip2();\r
}\r
\r
static int sndrate_prevnext(int rate, int dir)\r
static void draw_menu_credits(void)\r
{\r
int tl_x = 15, tl_y = 70, y;\r
- memset(gp2x_screen, 0, 320*240);\r
+ //memset(gp2x_screen, 0, 320*240);\r
+ gp2x_pd_clone_buffer2();\r
\r
gp2x_text_out8(tl_x, 20, "PicoDrive v" VERSION " (c) notaz, 2006,2007");\r
y = tl_y;\r
gp2x_text_out8(tl_x, (y+=10), "GnoStiC / Puck2099: USB joystick");\r
gp2x_text_out8(tl_x, (y+=10), "craigix: GP2X hardware");\r
\r
- gp2x_video_flip();\r
+ gp2x_video_flip2();\r
}\r
\r
\r
static void draw_menu_root(int menu_sel)\r
{\r
int tl_x = 70, tl_y = 70, y;\r
- memset(gp2x_screen, 0, 320*240);\r
+ //memset(gp2x_screen, 0, 320*240);\r
+ gp2x_pd_clone_buffer2();\r
\r
gp2x_text_out8(tl_x, 20, "PicoDrive v" VERSION);\r
\r
gp2x_text_out8(tl_x - 16, tl_y + menu_sel*10, ">");\r
// error\r
if (menuErrorMsg[0]) gp2x_text_out8(5, 226, menuErrorMsg);\r
- gp2x_video_flip();\r
+ gp2x_video_flip2();\r
}\r
\r
\r
}\r
\r
\r
-void menu_loop(void)\r
+static void menu_gfx_prepare(void)\r
{\r
- int pal[2];\r
+ extern int localPal[0x100];\r
+ int i;\r
+\r
+ // don't clear old palette just for fun (but make it dark)\r
+ for (i = 0x100-1; i >= 0; i--)\r
+ localPal[i] = (localPal[i] >> 2) & 0x003f3f3f;\r
+ localPal[0xe0] = 0x00000000; // reserved pixels for OSD\r
+ localPal[0xf0] = 0x00ffffff;\r
\r
// switch to 8bpp\r
- gp2x_video_changemode(8);\r
+ gp2x_video_changemode2(8);\r
gp2x_video_RGB_setscaling(320, 240);\r
- // set pal\r
- pal[0] = 0;\r
- pal[1] = 0x00ffffff;\r
- gp2x_video_setpalette(pal, 2);\r
+ gp2x_video_setpalette(localPal, 0x100);\r
+ gp2x_video_flip2();\r
+}\r
+\r
+\r
+void menu_loop(void)\r
+{\r
+ menu_gfx_prepare();\r
\r
menu_loop_root();\r
\r
// static _940_data_t shared_data_;
static _940_ctl_t shared_ctl_;
// static _940_data_t *shared_data = &shared_data_;
-static _940_ctl_t *shared_ctl = &shared_ctl_;
+_940_ctl_t *shared_ctl = &shared_ctl_;
unsigned char *mp3_mem = 0;
/***********************************************************/
-#define MAXOUT (+32767)
-#define MINOUT (-32768)
-
-/* limitter */
-#define Limit(val, max,min) { \
- if ( val > max ) val = max; \
- else if ( val < min ) val = min; \
-}
-
int YM2612Write_940(unsigned int a, unsigned int v)
{
}
-void YM2612Init_940(int baseclock, int rate)
+void sharedmem_init(void)
{
mp3_mem = malloc(MP3_SIZE_MAX);
+}
+
+void sharedmem_deinit(void)
+{
+ free(mp3_mem);
+}
+void YM2612Init_940(int baseclock, int rate)
+{
YM2612Init_(baseclock, rate);
}
}
+void mp3_update(int *buffer, int length, int stereo)
+{
+ // nothing..
+}
+
+
/***********************************************************/
void mp3_start_play(FILE *f, int pos) // pos is 0-1023
return 0;
}
+
+/* unimplemented... */
+void mix_16h_to_32(int *dest_buf, short *mp3_buf, int count)
+{
+}
+
+void mix_16h_to_32_s1(int *dest_buf, short *mp3_buf, int count)
+{
+}
+
+void mix_16h_to_32_s2(int *dest_buf, short *mp3_buf, int count)
+{
+}
+