X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pandora%2Femu.c;h=673c96388714f4e32c3792c1989a7cd0c4cc18b5;hb=e31266dd116b6bea59ce3f2036feeb6725c45a72;hp=7c2af0326b77d5aebe660b0be6d83ef7810170ac;hpb=de9b127473936673ed4a2cdfc2387a2a39cdbbe4;p=libpicofe.git diff --git a/pandora/emu.c b/pandora/emu.c index 7c2af03..673c963 100644 --- a/pandora/emu.c +++ b/pandora/emu.c @@ -15,18 +15,20 @@ #include #include "../gp2x/emu.h" -#include "../gp2x/usbjoy.h" #include "../gp2x/menu.h" +#include "../gp2x/gp2x.h" #include "../common/arm_utils.h" #include "../common/fonts.h" #include "../common/emu.h" #include "../common/config.h" #include "../common/common.h" +#include "../common/input.h" +#include "../linux/sndout_oss.h" #include "asm_utils.h" -#include -#include -#include +#include +#include +#include #include //#define PFRAMES @@ -40,21 +42,17 @@ #endif -int engineState; int select_exits = 0; -char romFileName[PATH_MAX]; - static short __attribute__((aligned(4))) sndBuffer[2*44100/50]; static struct timeval noticeMsgTime = { 0, 0 }; // when started showing static int osd_fps_x; -char noticeMsg[64]; // notice msg to draw unsigned char *PicoDraw2FB = NULL; // temporary buffer for alt renderer int reset_timing = 0; #define PICO_PEN_ADJUST_X 4 #define PICO_PEN_ADJUST_Y 2 -static int pico_pen_x = SCREEN_WIDTH/2, pico_pen_y = 240/2; +static int pico_pen_x = 0, pico_pen_y = 240/2; static void emu_msg_cb(const char *msg); static void emu_msg_tray_open(void); @@ -65,7 +63,7 @@ void emu_noticeMsgUpdated(void) gettimeofday(¬iceMsgTime, 0); } -void emu_getMainDir(char *dst, int len) +int emu_getMainDir(char *dst, int len) { extern char **g_argv; int j; @@ -76,6 +74,8 @@ void emu_getMainDir(char *dst, int len) dst[len] = 0; for (j = strlen(dst); j > 0; j--) if (dst[j] == '/') { dst[j+1] = 0; break; } + + return j + 1; } void emu_Init(void) @@ -100,18 +100,6 @@ void emu_Init(void) } -static void scaling_update(void) -{ - PicoOpt &= ~0x4100; - switch (currentConfig.scaling) { - default: break; // off - case 1: // hw hor - case 2: PicoOpt |= 0x0100; break; // hw hor+vert - case 3: PicoOpt |= 0x4000; break; // sw hor - } -} - - void emu_Deinit(void) { // save SRAM @@ -135,12 +123,12 @@ void emu_Deinit(void) void emu_prepareDefaultConfig(void) { memset(&defaultConfig, 0, sizeof(defaultConfig)); - defaultConfig.EmuOpt = 0x9f | 0x00700; // | <- ram_tmng, confirm_save, cd_leds + defaultConfig.EmuOpt = 0x8f | 0x00600; // | <- confirm_save, cd_leds defaultConfig.s_PicoOpt = 0x0f | POPT_EXT_FM|POPT_EN_MCD_PCM|POPT_EN_MCD_CDDA|POPT_EN_SVP_DRC; defaultConfig.s_PicoOpt |= POPT_ACC_SPRITES|POPT_EN_MCD_GFX; - defaultConfig.s_PicoOpt &= ~POPT_EN_SVP_DRC; // crashes :( + defaultConfig.EmuOpt &= ~8; // no save gzip defaultConfig.s_PsndRate = 44100; - defaultConfig.s_PicoRegion = 0; // auto + defaultConfig.s_PicoRegion = 0; defaultConfig.s_PicoAutoRgnOrder = 0x184; // US, EU, JP defaultConfig.s_PicoCDBuffers = 0; defaultConfig.Frameskip = 0; @@ -150,27 +138,17 @@ void emu_prepareDefaultConfig(void) defaultConfig.turbo_rate = 15; } -void emu_setDefaultConfig(void) -{ - memcpy(¤tConfig, &defaultConfig, sizeof(currentConfig)); - PicoOpt = currentConfig.s_PicoOpt; - PsndRate = currentConfig.s_PsndRate; - PicoRegionOverride = currentConfig.s_PicoRegion; - PicoAutoRgnOrder = currentConfig.s_PicoAutoRgnOrder; - PicoCDBuffers = currentConfig.s_PicoCDBuffers; -} - static void textOut16(int x, int y, const char *text) { int i,l,len=strlen(text); - unsigned int *screen = (unsigned int *)((unsigned short *)SCREEN_BUFFER + (x&~1) + y*SCREEN_WIDTH); + unsigned int *screen = (unsigned int *)((unsigned short *)g_screen_ptr + (x&~1) + y*g_screen_width); for (i = 0; i < len; i++) { for (l=0;l<16;) { unsigned char fd = fontdata8x8[((text[i])*8)+l/2]; - unsigned int *d = &screen[l*SCREEN_WIDTH/2]; + unsigned int *d = &screen[l*g_screen_width/2]; if (fd&0x80) d[0]=0xffffffff; if (fd&0x40) d[1]=0xffffffff; if (fd&0x20) d[2]=0xffffffff; @@ -179,7 +157,7 @@ static void textOut16(int x, int y, const char *text) if (fd&0x04) d[5]=0xffffffff; if (fd&0x02) d[6]=0xffffffff; if (fd&0x01) d[7]=0xffffffff; - l++; d = &screen[l*SCREEN_WIDTH/2]; + l++; d = &screen[l*g_screen_width/2]; if (fd&0x80) d[0]=0xffffffff; if (fd&0x40) d[1]=0xffffffff; if (fd&0x20) d[2]=0xffffffff; @@ -204,7 +182,7 @@ void osd_text(int x, int y, const char *text) x &= ~3; // align x len = (len+3) >> 2; for (h = 0; h < 8; h++) { - p = (int *) ((unsigned char *) gp2x_screen+x+SCREEN_WIDTH*(y+h)); + p = (int *) ((unsigned char *) gp2x_screen+x+g_screen_width*(y+h)); for (i = len; i; i--, p++) *p = 0xe0e0e0e0; } emu_textOut8(x, y, text); @@ -213,7 +191,7 @@ void osd_text(int x, int y, const char *text) x &= ~1; // align x len++; for (h = 0; h < 16; h++) { - p = (int *) ((unsigned short *) gp2x_screen+x+SCREEN_WIDTH*(y+h)); + p = (int *) ((unsigned short *) gp2x_screen+x+g_screen_width*(y+h)); for (i = len; i; i--, p++) *p = 0;//(*p>>2)&0x39e7; } textOut16(x, y, text); @@ -231,19 +209,19 @@ static void draw_cd_leds(void) // 8-bit modes unsigned int col_g = (old_reg & 2) ? 0xc0c0c0c0 : 0xe0e0e0e0; unsigned int col_r = (old_reg & 1) ? 0xd0d0d0d0 : 0xe0e0e0e0; - *(unsigned int *)((char *)gp2x_screen + SCREEN_WIDTH*2+ 4) = - *(unsigned int *)((char *)gp2x_screen + SCREEN_WIDTH*3+ 4) = - *(unsigned int *)((char *)gp2x_screen + SCREEN_WIDTH*4+ 4) = col_g; - *(unsigned int *)((char *)gp2x_screen + SCREEN_WIDTH*2+12) = - *(unsigned int *)((char *)gp2x_screen + SCREEN_WIDTH*3+12) = - *(unsigned int *)((char *)gp2x_screen + SCREEN_WIDTH*4+12) = col_r; + *(unsigned int *)((char *)gp2x_screen + g_screen_width*2+ 4) = + *(unsigned int *)((char *)gp2x_screen + g_screen_width*3+ 4) = + *(unsigned int *)((char *)gp2x_screen + g_screen_width*4+ 4) = col_g; + *(unsigned int *)((char *)gp2x_screen + g_screen_width*2+12) = + *(unsigned int *)((char *)gp2x_screen + g_screen_width*3+12) = + *(unsigned int *)((char *)gp2x_screen + g_screen_width*4+12) = col_r; } else { // 16-bit modes - unsigned int *p = (unsigned int *)((short *)gp2x_screen + SCREEN_WIDTH*2+4); + unsigned int *p = (unsigned int *)((short *)gp2x_screen + g_screen_width*2+4); unsigned int col_g = (old_reg & 2) ? 0x06000600 : 0; unsigned int col_r = (old_reg & 1) ? 0xc000c000 : 0; - *p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r; p += SCREEN_WIDTH/2 - 12/2; - *p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r; p += SCREEN_WIDTH/2 - 12/2; + *p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r; p += g_screen_width/2 - 12/2; + *p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r; p += g_screen_width/2 - 12/2; *p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r; } } @@ -258,7 +236,7 @@ static void draw_pico_ptr(void) if (!(Pico.video.reg[12]&1) && !(PicoOpt&POPT_DIS_32C_BORDER)) p += 32; - p += SCREEN_WIDTH * (pico_pen_y + PICO_PEN_ADJUST_Y); + p += g_screen_width * (pico_pen_y + PICO_PEN_ADJUST_Y); p += pico_pen_x + PICO_PEN_ADJUST_X; p[0] ^= 0xffff; p[319] ^= 0xffff; @@ -302,8 +280,8 @@ static int EmuScanEnd16(unsigned int num) len = 256; } - if (!sh && (rendstatus & PDRAW_ACC_SPRITES)) - mask=0x3f; // accurate sprites, upper bits are priority stuff + if (!sh && (rendstatus & PDRAW_SPR_LO_ON_HI)) + mask=0x3f; // messed sprites, upper bits are priority stuff #if 1 clut_line(pd, ps, pal, (mask<<16) | len); @@ -326,7 +304,7 @@ static int EmuScanEnd16(unsigned int num) static int EmuScanBegin8(unsigned int num) { if (!(Pico.video.reg[1]&8)) num += 8; - DrawLineDest = (unsigned char *) gp2x_screen + SCREEN_WIDTH * num; + DrawLineDest = (unsigned char *) gp2x_screen + g_screen_width * num; return 0; } @@ -351,14 +329,14 @@ static void blit(const char *fps, const char *notice) if (PicoRead16Hook == PicoSVPRead16) memset32((int *)(PicoDraw2FB+328*8+328*223), 0xe0e0e0e0, 328); // do actual copy - vidCpyM2((unsigned char *)gp2x_screen+SCREEN_WIDTH*8, PicoDraw2FB+328*8); + vidCpyM2((unsigned char *)gp2x_screen+g_screen_width*8, PicoDraw2FB+328*8); } else if (!(emu_opt&0x80)) { // 8bit accurate renderer if (Pico.m.dirtyPal) { - int pallen = 0x40; + int pallen = 0xc0; Pico.m.dirtyPal = 0; if (Pico.video.reg[0xC]&8) // shadow/hilight mode { @@ -368,13 +346,6 @@ static void blit(const char *fps, const char *notice) memcpy32(localPal+0xc0, localPal+0x40, 0x40); pallen = 0x100; } - else if (rendstatus & PDRAW_ACC_SPRITES) { - vidConvCpyRGB32(localPal, Pico.cram, 0x40); - memcpy32(localPal+0x40, localPal, 0x40); - memcpy32(localPal+0x80, localPal, 0x40); - memcpy32(localPal+0xc0, localPal, 0x40); - pallen = 0x100; - } else if (rendstatus & PDRAW_SONIC_MODE) { // mid-frame palette changes vidConvCpyRGB32(localPal, Pico.cram, 0x40); vidConvCpyRGB32(localPal+0x40, HighPal, 0x40); @@ -383,6 +354,7 @@ static void blit(const char *fps, const char *notice) } else { vidConvCpyRGB32(localPal, Pico.cram, 0x40); + memcpy32(localPal+0x80, localPal, 0x40); } if (pallen > 0xc0) { localPal[0xc0] = 0x0000c000; @@ -395,7 +367,7 @@ static void blit(const char *fps, const char *notice) } if (notice || (emu_opt & 2)) { - int h = SCREEN_HEIGHT-16; + int h = g_screen_height-16; if (currentConfig.scaling == 2 && !(Pico.video.reg[1]&8)) h -= 16; if (notice) osd_text(4, h, notice); if (emu_opt & 2) @@ -420,12 +392,12 @@ static void clearArea(int full) { if ((PicoOpt&0x10)||!(currentConfig.EmuOpt&0x80)) { // 8-bit renderers - if (full) gp2x_memset_all_buffers(0, 0xe0, SCREEN_WIDTH*240); - else gp2x_memset_all_buffers(SCREEN_WIDTH*232, 0xe0, SCREEN_WIDTH*8); + if (full) gp2x_memset_all_buffers(0, 0xe0, g_screen_width*240); + else gp2x_memset_all_buffers(g_screen_width*232, 0xe0, g_screen_width*8); } else { // 16bit accurate renderer - if (full) gp2x_memset_all_buffers(0, 0, SCREEN_WIDTH*SCREEN_HEIGHT*2); - else gp2x_memset_all_buffers(SCREEN_WIDTH*(SCREEN_HEIGHT-16)*2, 0, SCREEN_WIDTH*16*2); + if (full) gp2x_memset_all_buffers(0, 0, g_screen_width*g_screen_height*2); + else gp2x_memset_all_buffers(g_screen_width*(g_screen_height-16)*2, 0, g_screen_width*16*2); } } @@ -470,16 +442,16 @@ static void emu_msg_cb(const char *msg) { if ((PicoOpt&0x10)||!(currentConfig.EmuOpt&0x80)) { // 8-bit renderers - gp2x_memset_all_buffers(SCREEN_WIDTH*(SCREEN_HEIGHT-16), 0xe0, SCREEN_WIDTH*16); - osd_text(4, SCREEN_HEIGHT-16, msg); - gp2x_memcpy_all_buffers((char *)gp2x_screen+SCREEN_WIDTH*(SCREEN_HEIGHT-16), - SCREEN_WIDTH*(SCREEN_HEIGHT-16), SCREEN_WIDTH*16); + gp2x_memset_all_buffers(g_screen_width*(g_screen_height-16), 0xe0, g_screen_width*16); + osd_text(4, g_screen_height-16, msg); + gp2x_memcpy_all_buffers((char *)gp2x_screen+g_screen_width*(g_screen_height-16), + g_screen_width*(g_screen_height-16), g_screen_width*16); } else { // 16bit accurate renderer - gp2x_memset_all_buffers(SCREEN_WIDTH*(SCREEN_HEIGHT-16)*2, 0, SCREEN_WIDTH*16*2); - osd_text(4, SCREEN_HEIGHT-16, msg); - gp2x_memcpy_all_buffers((char *)gp2x_screen+SCREEN_WIDTH*(SCREEN_HEIGHT-16)*2, - SCREEN_WIDTH*(SCREEN_HEIGHT-16)*2, SCREEN_WIDTH*16*2); + gp2x_memset_all_buffers(g_screen_width*(g_screen_height-16)*2, 0, g_screen_width*16*2); + osd_text(4, g_screen_height-16, msg); + gp2x_memcpy_all_buffers((char *)gp2x_screen+g_screen_width*(g_screen_height-16)*2, + g_screen_width*(g_screen_height-16)*2, g_screen_width*16*2); } gettimeofday(¬iceMsgTime, 0); noticeMsgTime.tv_sec -= 2; @@ -500,6 +472,7 @@ static void emu_msg_tray_open(void) gettimeofday(¬iceMsgTime, 0); } +#if 0 static void RunEventsPico(unsigned int events, unsigned int gp2x_keys) { int ret, px, py, lim_x; @@ -551,6 +524,7 @@ static void RunEventsPico(unsigned int events, unsigned int gp2x_keys) PicoPicohw.pen_pos[0] += 0x3c; PicoPicohw.pen_pos[1] = pico_inp_mode == 1 ? (0x2f8 + pico_pen_y) : (0x1fc + pico_pen_y); } +#endif static void update_volume(int has_changed, int is_up) { @@ -568,7 +542,7 @@ static void update_volume(int has_changed, int is_up) if (vol > 0) vol--; } wait_frames = 0; - gp2x_sound_volume(vol, vol); + sndout_oss_setvol(vol, vol); currentConfig.volume = vol; } sprintf(noticeMsg, "VOL: %02i", vol); @@ -594,6 +568,7 @@ static void RunEvents(unsigned int which) if ( emu_checkSaveFile(state_slot) && (( (which & 0x1000) && (currentConfig.EmuOpt & 0x800)) || // load (!(which & 0x1000) && (currentConfig.EmuOpt & 0x200))) ) { // save +#if 0 unsigned long keys; blit("", (which & 0x1000) ? "LOAD STATE? (Y=yes, X=no)" : "OVERWRITE SAVE? (Y=yes, X=no)"); while ( !((keys = gp2x_joystick_read(1)) & (GP2X_X|GP2X_Y)) ) @@ -602,11 +577,12 @@ static void RunEvents(unsigned int which) while ( gp2x_joystick_read(1) & (GP2X_X|GP2X_Y) ) // wait for release usleep(50*1024); clearArea(0); +#endif } if (do_it) { - osd_text(4, SCREEN_HEIGHT-16, (which & 0x1000) ? "LOADING GAME" : "SAVING GAME"); + osd_text(4, g_screen_height-16, (which & 0x1000) ? "LOADING GAME" : "SAVING GAME"); PicoStateProgressCB = emu_state_cb; - gp2x_memcpy_all_buffers(gp2x_screen, 0, SCREEN_WIDTH*SCREEN_HEIGHT*2); + gp2x_memcpy_all_buffers(gp2x_screen, 0, g_screen_width*g_screen_height*2); emu_SaveLoadGame((which & 0x1000) >> 12, 0); PicoStateProgressCB = NULL; } @@ -650,63 +626,11 @@ static void RunEvents(unsigned int which) static void updateKeys(void) { - unsigned int keys, keys2, allActions[2] = { 0, 0 }, events; + unsigned int allActions[2] = { 0, 0 }, events; static unsigned int prevEvents = 0; - int joy, i; - keys = gp2x_joystick_read(0); - if (keys & GP2X_SELECT) { - engineState = select_exits ? PGS_Quit : PGS_Menu; - // wait until select is released, so menu would not resume game - while (gp2x_joystick_read(1) & GP2X_SELECT) usleep(50*1000); - } - - keys &= CONFIGURABLE_KEYS; - keys2 = keys; - - for (i = 0; i < 32; i++) - { - if (keys2 & (1 << i)) - { - int pl, acts = currentConfig.KeyBinds[i]; - if (!acts) continue; - pl = (acts >> 16) & 1; - if (kb_combo_keys & (1 << i)) - { - int u = i+1, acts_c = acts & kb_combo_acts; - // let's try to find the other one - if (acts_c) { - for (; u < 32; u++) - if ( (keys2 & (1 << u)) && (currentConfig.KeyBinds[u] & acts_c) ) { - allActions[pl] |= acts_c & currentConfig.KeyBinds[u]; - keys2 &= ~((1 << i) | (1 << u)); - break; - } - } - // add non-combo actions if combo ones were not found - if (!acts_c || u == 32) - allActions[pl] |= acts & ~kb_combo_acts; - } else { - allActions[pl] |= acts; - } - } - } - - // add joy inputs - if (num_of_joys > 0) - { - gp2x_usbjoy_update(); - for (joy = 0; joy < num_of_joys; joy++) { - int btns = gp2x_usbjoy_check2(joy); - for (i = 0; i < 32; i++) { - if (btns & (1 << i)) { - int acts = currentConfig.JoyBinds[joy][i]; - int pl = (acts >> 16) & 1; - allActions[pl] |= acts; - } - } - } - } + /* FIXME: combos, player2 */ + allActions[0] = in_update(); PicoPad[0] = allActions[0] & 0xfff; PicoPad[1] = allActions[1] & 0xfff; @@ -728,8 +652,10 @@ static void updateKeys(void) events &= ~prevEvents; +/* if (PicoAHW == PAHW_PICO) RunEventsPico(events, keys); +*/ if (events) RunEvents(events); if (movie_data) emu_updateMovie(); @@ -743,7 +669,7 @@ static void updateSound(int len) /* avoid writing audio when lagging behind to prevent audio lag */ if (PicoSkipFrame != 2) - gp2x_sound_write(PsndOut, len<<1); + sndout_oss_write(PsndOut, len<<1); } @@ -781,7 +707,7 @@ void emu_forcedFrame(int opts) clearArea(1); } else vidCpyM2 = vidCpyM2_40col; - vidCpyM2((unsigned char *)gp2x_screen+SCREEN_WIDTH*8, PicoDraw2FB+328*8); + vidCpyM2((unsigned char *)gp2x_screen+g_screen_width*8, PicoDraw2FB+328*8); vidConvCpyRGB32(localPal, Pico.cram, 0x40); gp2x_video_setpalette(localPal, 0x40); */ @@ -789,6 +715,11 @@ void emu_forcedFrame(int opts) currentConfig.EmuOpt = eo_old; } +void emu_platformDebugCat(char *str) +{ + // nothing +} + static void simpleWait(int thissec, int lim_time) { struct timeval tval; @@ -805,10 +736,46 @@ static void simpleWait(int thissec, int lim_time) } } +void emu_startSound(void) +{ + static int PsndRate_old = 0, PicoOpt_old = 0, pal_old = 0; + int target_fps = Pico.m.pal ? 50 : 60; + + PsndOut = NULL; + + if (currentConfig.EmuOpt & 4) + { + int snd_excess_add; + if (PsndRate != PsndRate_old || (PicoOpt&0x20b) != (PicoOpt_old&0x20b) || Pico.m.pal != pal_old) + PsndRerate(Pico.m.frame_count ? 1 : 0); + + snd_excess_add = ((PsndRate - PsndLen*target_fps)<<16) / target_fps; + printf("starting audio: %i len: %i (ex: %04x) stereo: %i, pal: %i\n", + PsndRate, PsndLen, snd_excess_add, (PicoOpt&8)>>3, Pico.m.pal); + sndout_oss_start(PsndRate, 16, (PicoOpt&8)>>3); + sndout_oss_setvol(currentConfig.volume, currentConfig.volume); + PicoWriteSound = updateSound; + update_volume(0, 0); + memset(sndBuffer, 0, sizeof(sndBuffer)); + PsndOut = sndBuffer; + PsndRate_old = PsndRate; + PicoOpt_old = PicoOpt; + pal_old = Pico.m.pal; + } +} + +void emu_endSound(void) +{ +} + +/* wait until we can write more sound */ +void emu_waitSound(void) +{ + // don't need to do anything, writes will block by themselves +} void emu_Loop(void) { - static int PsndRate_old = 0, PicoOpt_old = 0, pal_old = 0; char fpsbuff[24]; // fps count c string struct timeval tval; // timing int pframes_done, pframes_shown, pthissec; // "period" frames, used for sync @@ -822,7 +789,6 @@ void emu_Loop(void) // make sure we are in correct mode vidResetMode(); - scaling_update(); Pico.m.dirtyPal = 1; oldmodes = ((Pico.video.reg[12]&1)<<2) ^ 0xc; emu_findKeyBindCombos(); @@ -832,28 +798,7 @@ void emu_Loop(void) target_frametime = 1000000/target_fps; reset_timing = 1; - // prepare sound stuff - if (currentConfig.EmuOpt & 4) - { - int snd_excess_add; - if (PsndRate != PsndRate_old || (PicoOpt&0x20b) != (PicoOpt_old&0x20b) || Pico.m.pal != pal_old) - PsndRerate(Pico.m.frame_count ? 1 : 0); - - snd_excess_add = ((PsndRate - PsndLen*target_fps)<<16) / target_fps; - printf("starting audio: %i len: %i (ex: %04x) stereo: %i, pal: %i\n", - PsndRate, PsndLen, snd_excess_add, (PicoOpt&8)>>3, Pico.m.pal); - gp2x_start_sound(PsndRate, 16, (PicoOpt&8)>>3); - gp2x_sound_volume(currentConfig.volume, currentConfig.volume); - PicoWriteSound = updateSound; - update_volume(0, 0); - memset(sndBuffer, 0, sizeof(sndBuffer)); - PsndOut = sndBuffer; - PsndRate_old = PsndRate; - PicoOpt_old = PicoOpt; - pal_old = Pico.m.pal; - } else { - PsndOut = NULL; - } + emu_startSound(); // prepare CD buffer if (PicoAHW & PAHW_MCD) PicoCDBufferInit(); @@ -905,7 +850,7 @@ void emu_Loop(void) modes = ((Pico.video.reg[12]&1)<<2)|(Pico.video.reg[1]&8); if (modes != oldmodes) { - int scalex = SCREEN_WIDTH; + int scalex = g_screen_width; osd_fps_x = OSD_FPS_X; if (modes & 4) { vidCpyM2 = vidCpyM2_40col; @@ -938,6 +883,7 @@ void emu_Loop(void) } bench_fps += frames_shown; sprintf(fpsbuff, "%3i/%3i/%3i", frames_shown, bench_fps_s, (bf[0]+bf[1]+bf[2]+bf[3])>>2); + printf("%s\n", fpsbuff); #else if (currentConfig.EmuOpt & 2) { sprintf(fpsbuff, "%3i/%3i", frames_shown, frames_done); @@ -1009,7 +955,8 @@ void emu_Loop(void) if (currentConfig.Frameskip < 0 && tval.tv_usec - lim_time >= 300000) // slowdown detection reset_timing = 1; -/* else if (PsndOut != NULL || currentConfig.Frameskip < 0) +#if 1 + else if (PsndOut != NULL || currentConfig.Frameskip < 0) { // sleep or vsync if we are still too fast // usleep sleeps for ~20ms minimum, so it is not a solution here @@ -1025,7 +972,7 @@ void emu_Loop(void) } } } -*/ +#endif blit(fpsbuff, notice); pframes_done++; pframes_shown++;