X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Flinux%2Femu.c;h=d90d610d4a522241f57ed6f3f2476f1d01c12201;hb=7b4813faa6802f3aa07e9daef4aff729d8f78623;hp=591db8a066d3d6d8fbfc9a9a5f8a0141b542e3c2;hpb=636d5f257c3e5bafba99ddbdc385a289e12c9deb;p=picodrive.git diff --git a/platform/linux/emu.c b/platform/linux/emu.c index 591db8a..d90d610 100644 --- a/platform/linux/emu.c +++ b/platform/linux/emu.c @@ -11,15 +11,13 @@ #include "../libpicofe/menu.h" #include "../libpicofe/plat.h" -#include "../libpicofe/linux/sndout_oss.h" #include "../common/emu.h" #include "../common/arm_utils.h" -#include "version.h" +#include "../common/version.h" #include -static short __attribute__((aligned(4))) sndBuffer[2*44100/50]; const char *renderer_names[] = { "16bit accurate", " 8bit accurate", " 8bit fast", NULL }; const char *renderer_names32x[] = { "accurate", "faster", "fastest", NULL }; enum renderer_types { RT_16BIT, RT_8BIT_ACC, RT_8BIT_FAST, RT_COUNT }; @@ -33,42 +31,7 @@ void pemu_validate_config(void) { extern int PicoOpt; // PicoOpt &= ~POPT_EXT_FM; - PicoOpt &= ~POPT_EN_SVP_DRC; -} - -// FIXME: dupes from GP2X, need cleanup -static void (*osd_text)(int x, int y, const char *text); - -/* -static void osd_text8(int x, int y, const char *text) -{ - int len = strlen(text)*8; - int *p, i, h, offs; - - len = (len+3) >> 2; - for (h = 0; h < 8; h++) { - offs = (x + g_screen_width * (y+h)) & ~3; - p = (int *) ((char *)g_screen_ptr + offs); - for (i = len; i; i--, p++) - *p = 0xe0e0e0e0; - } - 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); + PicoOpt &= ~POPT_EN_DRC; } static void draw_cd_leds(void) @@ -105,8 +68,8 @@ void pemu_finalize_frame(const char *fps, const char *notice) { if (currentConfig.renderer != RT_16BIT && !(PicoAHW & PAHW_32X)) { unsigned short *pd = (unsigned short *)g_screen_ptr + 8 * g_screen_width; - unsigned char *ps = PicoDraw2FB + 328*8 + 8; - unsigned short *pal = HighPal; + unsigned char *ps = Pico.est.Draw2FB + 328*8 + 8; + unsigned short *pal = Pico.est.HighPal; int i, x; if (Pico.m.dirtyPal) PicoDrawUpdateHighPal(); @@ -117,9 +80,9 @@ void pemu_finalize_frame(const char *fps, const char *notice) if (notice || (currentConfig.EmuOpt & EOPT_SHOW_FPS)) { if (notice) - osd_text(4, g_screen_height - 8, notice); + emu_osd_text16(4, g_screen_height - 8, notice); if (currentConfig.EmuOpt & EOPT_SHOW_FPS) - osd_text(g_screen_width - 60, g_screen_height - 8, fps); + emu_osd_text16(g_screen_width - 60, g_screen_height - 8, fps); } if ((PicoAHW & PAHW_MCD) && (currentConfig.EmuOpt & EOPT_EN_CD_LEDS)) draw_cd_leds(); @@ -136,7 +99,7 @@ static void apply_renderer(void) case RT_8BIT_ACC: PicoOpt &= ~POPT_ALT_RENDERER; PicoDrawSetOutFormat(PDF_8BIT, 0); - PicoDrawSetOutBuf(PicoDraw2FB + 8, 328); + PicoDrawSetOutBuf(Pico.est.Draw2FB + 8, 328); break; case RT_8BIT_FAST: PicoOpt |= POPT_ALT_RENDERER; @@ -144,17 +107,8 @@ static void apply_renderer(void) break; } - if (PicoAHW & PAHW_32X) { - int only_32x = 0; - if (currentConfig.renderer == RT_16BIT) - only_32x = 1; - else - PicoDrawSetOutFormat(PDF_NONE, 0); - PicoDraw32xSetFrameMode(1, only_32x); + if (PicoAHW & PAHW_32X) PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2); - } - //PicoDraw32xSetFrameMode(0, 0); - //PicoDrawSetOutFormat(PDF_RGB555, 1); } void plat_video_toggle_renderer(int change, int is_menu) @@ -200,7 +154,6 @@ void plat_update_volume(int has_changed, int is_up) void pemu_forced_frame(int no_scale, int do_emu) { PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2); - PicoDraw32xSetFrameMode(0, 0); PicoDrawSetCallbacks(NULL, NULL); Pico.m.dirtyPal = 1; @@ -209,43 +162,9 @@ void pemu_forced_frame(int no_scale, int do_emu) g_menubg_src_ptr = g_screen_ptr; } -static void oss_write_nonblocking(int len) -{ - // sndout_oss_can_write() is not reliable, only use with no_frmlimit - if ((currentConfig.EmuOpt & EOPT_NO_FRMLIMIT) && !sndout_oss_can_write(len)) - return; - - sndout_oss_write_nb(PsndOut, len); -} - void pemu_sound_start(void) { - PsndOut = NULL; - - if (currentConfig.EmuOpt & EOPT_EN_SOUND) - { - int is_stereo = (PicoOpt & POPT_EN_STEREO) ? 1 : 0; - - PsndRerate(Pico.m.frame_count ? 1 : 0); - - printf("starting audio: %i len: %i stereo: %i, pal: %i\n", - PsndRate, PsndLen, is_stereo, Pico.m.pal); - sndout_oss_start(PsndRate, is_stereo, 1); - sndout_oss_setvol(currentConfig.volume, currentConfig.volume); - PicoWriteSound = oss_write_nonblocking; - plat_update_volume(0, 0); - memset(sndBuffer, 0, sizeof(sndBuffer)); - PsndOut = sndBuffer; - } -} - -void pemu_sound_stop(void) -{ -} - -void pemu_sound_wait(void) -{ - // don't need to do anything, writes will block by themselves + emu_sound_start(); } void plat_debug_cat(char *str) @@ -261,15 +180,10 @@ void emu_video_mode_change(int start_line, int line_count, int is_32cols) void pemu_loop_prep(void) { apply_renderer(); - osd_text = osd_text16; - - pemu_sound_start(); } void pemu_loop_end(void) { - pemu_sound_stop(); - /* do one more frame for menu bg */ pemu_forced_frame(0, 1); }