- // Frame skip table
- static const unsigned char skipTable[12][12] =
- {
- { 0,0,0,0,0,0,0,0,0,0,0,0 },
- { 0,0,0,0,0,0,0,0,0,0,0,1 },
- { 0,0,0,0,0,1,0,0,0,0,0,1 },
- { 0,0,0,1,0,0,0,1,0,0,0,1 },
- { 0,0,1,0,0,1,0,0,1,0,0,1 },
- { 0,1,0,0,1,0,1,0,0,1,0,1 },
- { 0,1,0,1,0,1,0,1,0,1,0,1 },
- { 0,1,0,1,1,0,1,0,1,1,0,1 },
- { 0,1,1,0,1,1,0,1,1,0,1,1 },
- { 0,1,1,1,0,1,1,1,0,1,1,1 },
- { 0,1,1,1,1,1,0,1,1,1,1,1 },
- { 0,1,1,1,1,1,1,1,1,1,1,1 }
- };
-
- // Interlace bit toggle
- GPU_GP1 ^= 0x80000000;
-
- // Update display
- if ((!skipFrame) && (!isSkip) && (!(((GPU_GP1&0x08000000))||((GPU_GP1&0x00800000)))))
- {
- gpuVideoOutput(); // Display updated
-
- if (DisplayArea[3] == 480)
- {
- if (linesInterlace_user) linesInterlace = 3; // 1/4 of lines
- else linesInterlace = 1; // if 480 we only need half of lines
- }
- else if (linesInterlace != linesInterlace_user)
- {
- linesInterlace = linesInterlace_user; // resolution changed from 480 to lower one
- video_clear();
- }
-
- // Limit FPS
- if (frameLimit)
- {
- static unsigned next=get_ticks();
- unsigned now=get_ticks();
- if (!skipFrame)
- {
- if (now<next) wait_ticks(next-now);
- }
- next+=(isPAL?(1000000/50):((unsigned)(1000000.0/59.94)));
- }
- }
-
- // Show FPS statistics
- if (show_fps)
- {
- static u32 real_fps=0;
- static u32 prev=get_ticks();
- static char msg[24]="FPS=000/00 SPD=000%";
- u32 now=get_ticks();
- real_fps++;
- if ((now-prev)>=1000000)
- {
- u32 expected_fps=(isPAL?50:60);
- sprintf(msg,"FPS=%3d/%2d SPD=%3d%%",((real_fps*(12-skipCount))/12),((expected_fps*(12-skipCount))/12),((real_fps*100)/expected_fps));
- prev=now;
- real_fps=0;
- }
- port_printf(5,5,msg);
- }
-
- // Update frame-skip
- if (!alt_fps)
- {
- // Video frame-skip
- skipFrame=skipTable[skipCount][skCount];
- skCount--; if (skCount<0) skCount=11;
- isSkip=skipFrame;
- }
- else
- {
- // Game frame-skip
- if (!isSkip)
- {
- skipFrame=skipTable[skipCount][skCount];
- skCount--; if (skCount<0) skCount=11;
- isSkip=true;
- }
- }
-
- pcsx4all_prof_end_with_resume(PCSX4ALL_PROF_GPU,PCSX4ALL_PROF_COUNTERS);
-}
-
-#else
-
-#include "../../frontend/plugin_lib.h"
-
-extern "C" {
-
-extern void bgr555_to_rgb565(void *dst, void *src, int bytes);
-extern void bgr888_to_rgb888(void *dst, void *src, int bytes);
-static const struct rearmed_cbs *cbs;
-static void *screen_buf;
-
-static void blit(void)