\r
#include <stdio.h>\r
#include <unistd.h>\r
-#include <stdarg.h>\r
#include <sys/types.h>\r
#include <sys/stat.h>\r
#include <fcntl.h>\r
\r
void pemu_forced_frame(int no_scale, int do_emu)\r
{\r
- int po_old = PicoOpt;\r
-\r
- memset32(g_screen_ptr, 0, g_screen_width * g_screen_height * 2 / 4);\r
-\r
- PicoOpt |= POPT_ACC_SPRITES;\r
- if (!no_scale)\r
- PicoOpt |= POPT_EN_SOFTSCALE;\r
-\r
- PicoDrawSetOutFormat(PDF_RGB555, 1);\r
- Pico.m.dirtyPal = 1;\r
doing_bg_frame = 1;\r
- if (do_emu)\r
- PicoFrame();\r
- else\r
- PicoFrameDrawOnly();\r
+ emu_cmn_forced_frame(no_scale, do_emu);\r
doing_bg_frame = 0;\r
\r
// making a copy because enabling the layer clears it's mem\r
memcpy32((void *)fb_copy, g_screen_ptr, sizeof(fb_copy) / 4);\r
make_bg(no_scale);\r
-\r
- PicoOpt = po_old;\r
}\r
\r
-static void updateSound(int len)\r
+static void oss_write_nonblocking(int len)\r
{\r
- unsigned int t;\r
-\r
- len <<= 1;\r
- if (PicoOpt & POPT_EN_STEREO)\r
- len <<= 1;\r
-\r
- // sndout_oss_can_write() not reliable..\r
+ // sndout_oss_can_write() is not reliable, only use with no_frmlimit\r
if ((currentConfig.EmuOpt & EOPT_NO_FRMLIMIT) && !sndout_oss_can_write(len))\r
return;\r
\r
- /* avoid writing audio when lagging behind to prevent audio lag */\r
- if (PicoSkipFrame == 2)\r
- return;\r
-\r
- t = plat_get_ticks_ms();\r
- sndout_oss_write(PsndOut, len);\r
- t = plat_get_ticks_ms() - t;\r
- if (t > 1)\r
- printf("audio lag %u\n", t);\r
+ sndout_oss_write_nb(PsndOut, len);\r
}\r
\r
void pemu_sound_start(void)\r
PsndRate, PsndLen, is_stereo, Pico.m.pal);\r
sndout_oss_start(PsndRate, is_stereo, 2);\r
//sndout_oss_setvol(currentConfig.volume, currentConfig.volume);\r
- PicoWriteSound = updateSound;\r
+ PicoWriteSound = oss_write_nonblocking;\r
plat_update_volume(0, 0);\r
memset(sndBuffer, 0, sizeof(sndBuffer));\r
PsndOut = sndBuffer;\r
printf("all done\n");\r
}\r
\r
-/* lprintf */\r
-void lprintf(const char *fmt, ...)\r
-{\r
- va_list vl;\r
-\r
- va_start(vl, fmt);\r
- vprintf(fmt, vl);\r
- va_end(vl);\r
-}\r
-\r