X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fgp2x%2Femu.c;h=8db33a9f75752f47aac4c48dbe7cfdd8deb6fca2;hb=4981de9ce79d0aa80222f8583667bf2fbf2265f2;hp=7db89c29253258782d95dfbe9cd6c13c886844f6;hpb=9a1f192a146e9b9752ec1a760745b1261fe9bdec;p=picodrive.git diff --git a/platform/gp2x/emu.c b/platform/gp2x/emu.c index 7db89c2..8db33a9 100644 --- a/platform/gp2x/emu.c +++ b/platform/gp2x/emu.c @@ -128,21 +128,6 @@ static void osd_text8(int x, int y, const char *text) emu_text_out8(x, y, text); } -static void osd_text16(int x, int y, const char *text) -{ - int len = strlen(text)*8; - int *p, i, h, offs; - - len = (len+1) >> 1; - for (h = 0; h < 8; h++) { - offs = (x + g_screen_width * (y+h)) & ~1; - p = (int *) ((short *)g_screen_ptr + offs); - for (i = len; i; i--, p++) - *p = (*p >> 2) & 0x39e7; - } - emu_text_out16(x, y, text); -} - static void osd_text8_rot(int x, int y, const char *text) { int len = strlen(text) * 8; @@ -237,7 +222,7 @@ static unsigned char __attribute__((aligned(4))) rot_buff[320*4*2]; static int EmuScanBegin16_rot(unsigned int num) { - DrawLineDest = rot_buff + (num & 3) * 320 * 2; + Pico.est.DrawLineDest = rot_buff + (num & 3) * 320 * 2; return 0; } @@ -252,7 +237,7 @@ static int EmuScanEnd16_rot(unsigned int num) static int EmuScanBegin8_rot(unsigned int num) { - DrawLineDest = rot_buff + (num & 3) * 320; + Pico.est.DrawLineDest = rot_buff + (num & 3) * 320; return 0; } @@ -277,14 +262,14 @@ static int EmuScanBegin16_ld(unsigned int num) if (emu_scan_begin) return emu_scan_begin(ld_counter); else - DrawLineDest = (char *)g_screen_ptr + 320 * ld_counter * gp2x_current_bpp / 8; + Pico.est.DrawLineDest = (char *)g_screen_ptr + 320 * ld_counter * gp2x_current_bpp / 8; return 0; } static int EmuScanEnd16_ld(unsigned int num) { - void *oldline = DrawLineDest; + void *oldline = Pico.est.DrawLineDest; if (emu_scan_end) emu_scan_end(ld_counter); @@ -295,7 +280,7 @@ static int EmuScanEnd16_ld(unsigned int num) ld_left = ld_lines; EmuScanBegin16_ld(num); - memcpy32(DrawLineDest, oldline, 320 * gp2x_current_bpp / 8 / 4); + memcpy32(Pico.est.DrawLineDest, oldline, 320 * gp2x_current_bpp / 8 / 4); if (emu_scan_end) emu_scan_end(ld_counter); @@ -325,7 +310,7 @@ static int make_local_pal_md(int fast_mode) localPal[0xf0] = 0x00ffffff; pallen = 0x100; } - else if (rendstatus & PDRAW_SONIC_MODE) { // mid-frame palette changes + else if (Pico.est.rendstatus & PDRAW_SONIC_MODE) { // mid-frame palette changes bgr444_to_rgb32(localPal+0x40, HighPal); bgr444_to_rgb32(localPal+0x80, HighPal+0x40); } @@ -407,7 +392,6 @@ void plat_video_flip(void) } /* XXX */ -#ifdef __GP2X__ unsigned int plat_get_ticks_ms(void) { return gp2x_get_ticks_ms(); @@ -417,7 +401,6 @@ unsigned int plat_get_ticks_us(void) { return gp2x_get_ticks_us(); } -#endif void plat_wait_till_us(unsigned int us_to) { @@ -542,7 +525,7 @@ static void vid_reset_mode(void) PicoDrawSetCallbacks(emu_scan_begin, emu_scan_end); if (is_16bit_mode()) - osd_text = (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) ? osd_text16_rot : osd_text16; + osd_text = (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) ? osd_text16_rot : emu_osd_text16; else osd_text = (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) ? osd_text8_rot : osd_text8; @@ -562,7 +545,7 @@ static void vid_reset_mode(void) if (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) gp2x_mode = -gp2x_mode; - gp2x_video_changemode(gp2x_mode); + gp2x_video_changemode(gp2x_mode, Pico.m.pal); Pico.m.dirtyPal = 1; @@ -701,47 +684,20 @@ void plat_update_volume(int has_changed, int is_up) void pemu_sound_start(void) { - emu_sound_start(); - - plat_target_step_volume(¤tConfig.volume, 0); - -#if 0 - static int PsndRate_old = 0, PicoOpt_old = 0, pal_old = 0; + gp2x_soc_t soc; - PsndOut = NULL; + emu_sound_start(); - // prepare sound stuff if (currentConfig.EmuOpt & EOPT_EN_SOUND) { - int is_stereo = (PicoOpt & POPT_EN_STEREO) ? 1 : 0; - int snd_rate_oss = PsndRate; - gp2x_soc_t soc; - - memset(sndBuffer, 0, sizeof(sndBuffer)); - PsndOut = sndBuffer; - PicoWriteSound = oss_write_nonblocking; - plat_update_volume(0, 0); - - printf("starting audio: %i len: %i stereo: %i, pal: %i\n", - PsndRate, PsndLen, is_stereo, Pico.m.pal); - sndout_oss_start(snd_rate_oss, is_stereo, 1); - sndout_oss_setvol(currentConfig.volume, currentConfig.volume); - soc = soc_detect(); - if (soc == SOCID_POLLUX) + if (soc == SOCID_POLLUX) { PsndRate = pollux_get_real_snd_rate(PsndRate); - - #define SOUND_RERATE_FLAGS (POPT_EN_FM|POPT_EN_PSG|POPT_EN_STEREO|POPT_EXT_FM|POPT_EN_MCD_CDDA) - if (PsndRate != PsndRate_old || Pico.m.pal != pal_old || ((PicoOpt & POPT_EXT_FM) && crashed_940) || - ((PicoOpt ^ PicoOpt_old) & SOUND_RERATE_FLAGS)) { PsndRerate(Pico.m.frame_count ? 1 : 0); } - PsndRate_old = PsndRate; - PicoOpt_old = PicoOpt; - pal_old = Pico.m.pal; + plat_target_step_volume(¤tConfig.volume, 0); } -#endif } static const int sound_rates[] = { 44100, 32000, 22050, 16000, 11025, 8000 };