sms mode 4, fix 8 bit renderer code

This commit is contained in:
kub 2020-07-25 23:58:57 +02:00
parent 2e5cbf5b6a
commit 7980d47767
4 changed files with 35 additions and 14 deletions

View file

@ -22,6 +22,8 @@ const char *renderer_names[] = { "16bit accurate", " 8bit accurate", " 8bit fast
const char *renderer_names32x[] = { "accurate", "faster", "fastest", NULL };
enum renderer_types { RT_16BIT, RT_8BIT_ACC, RT_8BIT_FAST, RT_COUNT };
static int out_x, out_y;
static int out_w, out_h;
void pemu_prep_defconfig(void)
{
@ -70,15 +72,18 @@ static void draw_cd_leds(void)
void pemu_finalize_frame(const char *fps, const char *notice)
{
if (currentConfig.renderer != RT_16BIT && !(PicoIn.AHW & PAHW_32X)) {
unsigned short *pd = (unsigned short *)g_screen_ptr + 8 * g_screen_ppitch;
unsigned char *ps = Pico.est.Draw2FB + 328*8 + 8;
unsigned short *pd = (unsigned short *)g_screen_ptr + out_y * g_screen_ppitch + out_x;
unsigned char *ps = Pico.est.Draw2FB + 328*out_y + out_x + 8;
unsigned short *pal = Pico.est.HighPal;
int i, x;
PicoDrawUpdateHighPal();
for (i = 0; i < 224; i++, ps += 8)
for (x = 0; x < 320; x++)
for (i = 0; i < out_h; i++, ps += 8) {
for (x = 0; x < out_w; x++)
*pd++ = pal[*ps++];
pd += 320 - out_w;
ps += 320 - out_w;
}
}
if (notice || (currentConfig.EmuOpt & EOPT_SHOW_FPS)) {
@ -180,9 +185,10 @@ void emu_video_mode_change(int start_line, int line_count, int is_32cols)
{
// clear whole screen in all buffers
if (currentConfig.renderer != RT_16BIT && !(PicoIn.AHW & PAHW_32X))
memset32(Pico.est.Draw2FB, 0, (320+8) * (8+240+8) / 4);
else
memset32(g_screen_ptr, 0, g_screen_ppitch * g_screen_height * 2 / 4);
memset32(Pico.est.Draw2FB, 0xe0e0e0e0, (320+8) * (8+240+8) / 4);
memset32(g_screen_ptr, 0, g_screen_ppitch * g_screen_height * 2 / 4);
out_y = start_line; out_x = (is_32cols ? 32 : 0);
out_h = line_count; out_w = (is_32cols ? 256:320);
}
void pemu_loop_prep(void)