gp2x, fixes for sms

This commit is contained in:
kub 2021-10-15 19:27:37 +02:00
parent a58b8f39e0
commit 9b2d466aeb
2 changed files with 25 additions and 23 deletions

View file

@ -9,10 +9,10 @@
.text
.align 4
@ Convert 0000bbb0 ggg0rrr0 0000bbb0 ggg0rrr0
@ to 00000000 rrr00000 ggg00000 bbb00000 ...
@ Convert 0000bbbb ggggrrrr 0000bbbb ggggrrrr
@ to 00000000 rrrr0000 gggg0000 bbbb0000 ...
@ lr = 0x00e000e0, out: r3=lower_pix, r2=higher_pix; trashes rin
@ lr = 0x00f000f0, out: r3=lower_pix, r2=higher_pix; trashes rin
.macro convRGB32_2 rin sh=0
and r2, lr, \rin, lsr #4 @ blue
and r3, \rin, lr
@ -25,13 +25,13 @@
mov r3, r3, ror #17 @ shadow mode
.elseif \sh == 2
adds r3, r3, #0x40000000 @ green
orrcs r3, r3, #0xe0000000
orrcs r3, r3, lr, lsl #24
mov r3, r3, ror #8
adds r3, r3, #0x40000000
orrcs r3, r3, #0xe0000000
orrcs r3, r3, lr, lsl #24
mov r3, r3, ror #16
adds r3, r3, #0x40000000
orrcs r3, r3, #0xe0000000
orrcs r3, r3, lr, lsl #24
mov r3, r3, ror #24
.else
mov r3, r3, ror #16 @ r3=low
@ -47,13 +47,13 @@
.elseif \sh == 2
mov r2, r2, ror #8
adds r2, r2, #0x40000000 @ blue
orrcs r2, r2, #0xe0000000
orrcs r2, r2, lr, lsl #24
mov r2, r2, ror #8
adds r2, r2, #0x40000000
orrcs r2, r2, #0xe0000000
orrcs r2, r2, lr, lsl #24
mov r2, r2, ror #8
adds r2, r2, #0x40000000
orrcs r2, r2, #0xe0000000
orrcs r2, r2, lr, lsl #24
mov r2, r2, ror #8
.endif
@ -68,17 +68,17 @@ bgr444_to_rgb32:
stmfd sp!, {r4-r7,lr}
mov r12, #0x40>>3 @ repeats
mov lr, #0x00e00000
orr lr, lr, #0x00e0
mov lr, #0x00f00000
orr lr, lr, #0x00f0
.loopRGB32:
subs r12, r12, #1
ldmia r1!, {r4-r7}
convRGB32_2 r4
convRGB32_2 r5
convRGB32_2 r6
convRGB32_2 r7
subs r12, r12, #1
bgt .loopRGB32
ldmfd sp!, {r4-r7,pc}
@ -91,24 +91,25 @@ bgr444_to_rgb32_sh:
mov r12, #0x40>>3 @ repeats
add r0, r0, #0x40*4
mov lr, #0x00e00000
orr lr, lr, #0x00e0
mov lr, #0x00f00000
orr lr, lr, #0x00f0
.loopRGB32sh:
subs r12, r12, #1
ldmia r1!, {r4-r7}
convRGB32_2 r4, 2
convRGB32_2 r5, 2
convRGB32_2 r6, 2
convRGB32_2 r7, 2
subs r12, r12, #1
bgt .loopRGB32sh
mov r12, #0x40>>3 @ repeats
sub r1, r1, #0x40*2
and lr, lr, lr, lsl #1 @ kill LSB for correct shadow colors
.loopRGB32hi:
ldmia r1!, {r4-r7}
ldmia r1!, {r4-r7}
convRGB32_2 r4, 1
convRGB32_2 r5, 1
convRGB32_2 r6, 1

View file

@ -83,6 +83,10 @@ void pemu_validate_config(void)
static int get_renderer(void)
{
if (doing_bg_frame)
return RT_16BIT;
if ((PicoIn.AHW & PAHW_SMS) && currentConfig.renderer == RT_8BIT_FAST)
return RT_8BIT_ACC; // 8bpp fast is not there (yet?)
if (PicoIn.AHW & PAHW_32X)
return currentConfig.renderer32x;
else
@ -391,7 +395,7 @@ void plat_video_flip(void)
stride *= 2;
// the fast renderer has overlap areas and can't directly render to
// screen buffers. Its output is copied to screen in finalize_frame
if (currentConfig.renderer != RT_8BIT_FAST || (PicoIn.AHW & PAHW_32X))
if (get_renderer() != RT_8BIT_FAST || (PicoIn.AHW & PAHW_32X))
PicoDrawSetOutBuf(g_screen_ptr, stride);
}
@ -476,9 +480,6 @@ static void vid_reset_mode(void)
int gp2x_mode = 16;
int renderer = get_renderer();
if (doing_bg_frame)
renderer = RT_16BIT;
PicoIn.opt &= ~POPT_ALT_RENDERER;
emu_scan_begin = NULL;
emu_scan_end = NULL;
@ -554,7 +555,7 @@ static void vid_reset_mode(void)
if (currentConfig.scaling == EOPT_SCALE_SW) {
PicoIn.opt |= POPT_EN_SOFTSCALE;
PicoIn.filter = EOPT_FILTER_BILINEAR2;
} else if (currentConfig.scaling == EOPT_SCALE_HW && is_16bit_mode())
} else if (currentConfig.scaling == EOPT_SCALE_HW)
// hw scaling, render without any padding
PicoIn.opt |= POPT_DIS_32C_BORDER;