X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=linux%2Femu.c;h=95666ad25ba41ab89d6172fd683a2726439be494;hb=ca69c3e5a0ecf407c02dc85c6f3282ebb1efc5a2;hp=7dc2c14ec89211d5311865bda92f646b6e8aa17a;hpb=662e622b59369f975691a70756f80188d8d27ea0;p=libpicofe.git diff --git a/linux/emu.c b/linux/emu.c index 7dc2c14..95666ad 100644 --- a/linux/emu.c +++ b/linux/emu.c @@ -17,11 +17,8 @@ static short __attribute__((aligned(4))) sndBuffer[2*44100/50]; -char cpu_clk_name[] = "unused"; -const char *renderer_names_[] = { "16bit accurate", " 8bit accurate", " 8bit fast", NULL }; -const char *renderer_names32x_[] = { "accurate", "faster ", "fastest ", NULL }; -const char **renderer_names = renderer_names_; -const char **renderer_names32x = renderer_names32x_; +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 }; @@ -127,9 +124,6 @@ void pemu_finalize_frame(const char *fps, const char *notice) static void apply_renderer(void) { - PicoScanBegin = NULL; - PicoScanEnd = NULL; - switch (currentConfig.renderer) { case RT_16BIT: PicoOpt &= ~POPT_ALT_RENDERER; @@ -156,6 +150,8 @@ static void apply_renderer(void) PicoDraw32xSetFrameMode(1, only_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) @@ -178,7 +174,7 @@ void plat_video_menu_enter(int is_rom_loaded) void plat_video_menu_begin(void) { - memcpy32(g_screen_ptr, g_menubg_ptr, g_screen_width * g_screen_height * 2 / 4); + g_menuscreen_ptr = g_screen_ptr; } void plat_video_menu_end(void) @@ -212,60 +208,42 @@ void plat_update_volume(int has_changed, int is_up) { } -void pemu_forced_frame(int opts) +void pemu_forced_frame(int no_scale, int do_emu) { - int po_old = PicoOpt; - int eo_old = currentConfig.EmuOpt; - - PicoOpt &= ~POPT_ALT_RENDERER; - PicoOpt |= opts|POPT_ACC_SPRITES; // acc_sprites - - PicoDrawSetOutFormat(PDF_RGB555, 0); - + PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2); + PicoDraw32xSetFrameMode(0, 0); + PicoDrawSetCallbacks(NULL, NULL); Pico.m.dirtyPal = 1; - PicoFrameDrawOnly(); - PicoOpt = po_old; - currentConfig.EmuOpt = eo_old; + emu_cmn_forced_frame(no_scale, do_emu); + + g_menubg_src_ptr = g_screen_ptr; } -static void updateSound(int len) +static void oss_write_nonblocking(int len) { - len <<= 1; - if (PicoOpt & POPT_EN_STEREO) - len <<= 1; - + // sndout_oss_can_write() is not reliable, only use with no_frmlimit if ((currentConfig.EmuOpt & EOPT_NO_FRMLIMIT) && !sndout_oss_can_write(len)) return; - /* avoid writing audio when lagging behind to prevent audio lag */ - if (PicoSkipFrame != 2) - sndout_oss_write(PsndOut, len); + sndout_oss_write_nb(PsndOut, len); } void pemu_sound_start(void) { - int target_fps = Pico.m.pal ? 50 : 60; - PsndOut = NULL; if (currentConfig.EmuOpt & EOPT_EN_SOUND) { - int snd_excess_add, frame_samples; int is_stereo = (PicoOpt & POPT_EN_STEREO) ? 1 : 0; PsndRerate(Pico.m.frame_count ? 1 : 0); - frame_samples = PsndLen; - snd_excess_add = ((PsndRate - PsndLen * target_fps)<<16) / target_fps; - if (snd_excess_add != 0) - frame_samples++; - - printf("starting audio: %i len: %i (ex: %04x) stereo: %i, pal: %i\n", - PsndRate, PsndLen, snd_excess_add, is_stereo, Pico.m.pal); - sndout_oss_start(PsndRate, frame_samples, is_stereo); + 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 = updateSound; + PicoWriteSound = oss_write_nonblocking; plat_update_volume(0, 0); memset(sndBuffer, 0, sizeof(sndBuffer)); PsndOut = sndBuffer; @@ -301,22 +279,10 @@ void pemu_loop_prep(void) void pemu_loop_end(void) { - int po_old = PicoOpt; - int eo_old = currentConfig.EmuOpt; - pemu_sound_stop(); - memset32(g_screen_ptr, 0, g_screen_width * g_screen_height * 2 / 4); /* do one more frame for menu bg */ - PicoOpt &= ~POPT_ALT_RENDERER; - PicoOpt |= POPT_EN_SOFTSCALE|POPT_ACC_SPRITES; - - PicoDrawSetOutFormat(PDF_RGB555, 0); - Pico.m.dirtyPal = 1; - PicoFrame(); - - PicoOpt = po_old; - currentConfig.EmuOpt = eo_old; + pemu_forced_frame(0, 1); } void plat_wait_till_us(unsigned int us_to) @@ -332,24 +298,3 @@ void plat_wait_till_us(unsigned int us_to) } } -const char *plat_get_credits(void) -{ - return "PicoDrive v" VERSION " (c) notaz, 2006-2009\n\n\n" - "Credits:\n" - "fDave: Cyclone 68000 core,\n" - " base code of PicoDrive\n" - "Reesy & FluBBa: DrZ80 core\n" - "MAME devs: YM2612 and SN76496 cores\n" - "rlyeh and others: minimal SDK\n" - "Squidge: mmuhack\n" - "Dzz: ARM940 sample\n" - "GnoStiC / Puck2099: USB joy code\n" - "craigix: GP2X hardware\n" - "ketchupgun: skin design\n" - "\n" - "special thanks (for docs, ideas):\n" - " Charles MacDonald, Haze,\n" - " Stephane Dallongeville,\n" - " Lordus, Exophase, Rokas,\n" - " Nemesis, Tasco Deluxe"; -}