mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
sdl, complete overhaul of hardware/software scaling
This commit is contained in:
parent
6651998e9f
commit
d5d1778252
21 changed files with 1233 additions and 547 deletions
|
@ -122,7 +122,7 @@ void FinalizeLine32xRGB555(int sh, int line, struct PicoEState *est)
|
|||
FinalizeLine555(sh, line, est);
|
||||
|
||||
if ((Pico32x.vdp_regs[0] & P32XV_Mx) == 0 || // 32x blanking
|
||||
// XXX: how is 32col mode hadled by real hardware?
|
||||
// XXX: how is 32col mode handled by real hardware?
|
||||
!(Pico.video.reg[12] & 1) || // 32col mode
|
||||
(Pico.video.debug_p & PVD_KILL_32X))
|
||||
{
|
||||
|
@ -162,6 +162,7 @@ void FinalizeLine32xRGB555(int sh, int line, struct PicoEState *est)
|
|||
|
||||
#define PICOSCAN_POST \
|
||||
PicoScan32xEnd(l + (lines_sft_offs & 0xff)); \
|
||||
Pico.est.DrawLineDest = (char *)Pico.est.DrawLineDest + DrawLineDestIncrement32x; \
|
||||
|
||||
#define make_do_loop(name, pre_code, post_code, md_code) \
|
||||
/* Direct Color Mode */ \
|
||||
|
@ -260,6 +261,7 @@ void PicoDraw32xLayer(int offs, int lines, int md_bg)
|
|||
int which_func;
|
||||
|
||||
Pico.est.DrawLineDest = (char *)DrawLineDestBase32x + offs * DrawLineDestIncrement32x;
|
||||
Pico.est.DrawLineDestIncr = DrawLineDestIncrement32x;
|
||||
dram = Pico32xMem->dram[Pico32x.vdp_regs[0x0a/2] & P32XV_FS];
|
||||
|
||||
if (Pico32xDrawMode == PDM32X_BOTH)
|
||||
|
@ -330,7 +332,7 @@ void PicoDraw32xLayerMdOnly(int offs, int lines)
|
|||
dst[p + 2] = pal[*pmd++];
|
||||
dst[p + 3] = pal[*pmd++];
|
||||
}
|
||||
dst = (void *)((char *)dst + DrawLineDestIncrement32x);
|
||||
dst = Pico.est.DrawLineDest = (char *)dst + DrawLineDestIncrement32x;
|
||||
pmd += 328 - plen;
|
||||
if (have_scan)
|
||||
PicoScan32xEnd(l + offs);
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
|
||||
PIC_LDR_INIT()
|
||||
|
||||
.macro call_scan_prep cond est @ &Pico.est
|
||||
.macro call_scan_prep cond pico @ &Pico
|
||||
.if \cond
|
||||
PIC_LDR(r4, r6, PicoScan32xBegin)
|
||||
PIC_LDR(r5, r6, PicoScan32xEnd)
|
||||
ldr r6, [\est, #OFS_EST_DrawLineDest]
|
||||
add r6, \pico, #OFS_Pico_est
|
||||
ldr r4, [r4]
|
||||
ldr r5, [r5]
|
||||
stmfd sp!, {r4,r5,r6}
|
||||
|
@ -44,9 +44,9 @@
|
|||
add r0, r0, r4
|
||||
mov lr, pc
|
||||
ldr pc, [sp, #(3+0)*4]
|
||||
ldr r0, [sp, #(3+2)*4] @ &DrawLineDest
|
||||
ldr r0, [sp, #(3+2)*4] @ &Pico.est
|
||||
ldmfd sp!, {r1-r3}
|
||||
ldr r0, [r0]
|
||||
ldr r0, [r0, #OFS_EST_DrawLineDest]
|
||||
.endif
|
||||
.endm
|
||||
|
||||
|
@ -57,6 +57,11 @@
|
|||
add r0, r0, r4
|
||||
mov lr, pc
|
||||
ldr pc, [sp, #(4+1)*4]
|
||||
ldr r1, [sp, #(3+2)*4] @ &Pico.est
|
||||
ldr r0, [r1, #OFS_EST_DrawLineDest]
|
||||
ldr r2, [r1, #OFS_EST_DrawLineDestIncr]
|
||||
add r0, r0, r2
|
||||
str r0, [r1]
|
||||
ldmfd sp!, {r0-r3}
|
||||
.endif
|
||||
.endm
|
||||
|
@ -71,6 +76,7 @@
|
|||
PIC_LDR(lr, r9, Pico)
|
||||
PIC_LDR(r10,r9, Pico32x)
|
||||
ldr r11, [lr, #OFS_Pico_est+OFS_EST_Draw2FB]
|
||||
ldr r12, [lr, #OFS_Pico_est+OFS_EST_DrawLineDestIncr]
|
||||
ldrh r10,[r10, #0x40] @ Pico32x.vdp_regs[0]
|
||||
add r9, lr, #OFS_Pico_est+OFS_EST_HighPal @ palmd
|
||||
|
||||
|
@ -88,6 +94,9 @@
|
|||
|
||||
0: @ loop_outer:
|
||||
call_scan_end \call_scan
|
||||
ldr r12, [r9, #OFS_EST_DrawLineDestIncr-OFS_EST_HighPal]
|
||||
sub r0, r0, #320*2
|
||||
add r0, r0, r12
|
||||
add r4, r4, #1
|
||||
cmp r4, r2, lsr #16
|
||||
call_scan_fin_ge \call_scan
|
||||
|
@ -231,7 +240,7 @@
|
|||
|
||||
PIC_LDR(lr, r9, Pico)
|
||||
PIC_LDR(r10,r9, Pico32xMem)
|
||||
ldr r9,=OFS_PMEM32x_pal_native
|
||||
ldr r9, =OFS_PMEM32x_pal_native
|
||||
ldr r10, [r10]
|
||||
ldr r11, [lr, #OFS_Pico_est+OFS_EST_Draw2FB]
|
||||
add r10,r10,r9
|
||||
|
@ -248,6 +257,9 @@
|
|||
|
||||
0: @ loop_outer:
|
||||
call_scan_end \call_scan
|
||||
ldr r12, [r9, #OFS_EST_DrawLineDestIncr-OFS_EST_HighPal]
|
||||
sub r0, r0, #320*2
|
||||
add r0, r0, r12
|
||||
add r4, r4, #1
|
||||
cmp r4, r2, lsr #16
|
||||
call_scan_fin_ge \call_scan
|
||||
|
@ -400,7 +412,7 @@
|
|||
|
||||
PIC_LDR(lr, r9, Pico)
|
||||
PIC_LDR(r10,r9, Pico32xMem)
|
||||
ldr r9,=OFS_PMEM32x_pal_native
|
||||
ldr r9, =OFS_PMEM32x_pal_native
|
||||
ldr r10, [r10]
|
||||
ldr r11, [lr, #OFS_Pico_est+OFS_EST_Draw2FB]
|
||||
add r10,r10,r9
|
||||
|
@ -417,6 +429,9 @@
|
|||
|
||||
0: @ loop_outer:
|
||||
call_scan_end \call_scan
|
||||
ldr r12, [r9, #OFS_EST_DrawLineDestIncr-OFS_EST_HighPal]
|
||||
sub r0, r0, #320*2
|
||||
add r0, r0, r12
|
||||
add r4, r4, #1
|
||||
cmp r4, r2, lsr #16
|
||||
call_scan_fin_ge \call_scan
|
||||
|
|
73
pico/draw.c
73
pico/draw.c
|
@ -44,6 +44,8 @@
|
|||
*/
|
||||
|
||||
#include "pico_int.h"
|
||||
#include <platform/common/upscale.h>
|
||||
|
||||
#define FORCE // layer forcing via debug register?
|
||||
|
||||
int (*PicoScanBegin)(unsigned int num) = NULL;
|
||||
|
@ -1407,7 +1409,7 @@ static NOINLINE void PrepareSprites(int max_lines)
|
|||
|
||||
if (!(Pico.video.reg[12]&1))
|
||||
max_sprites = 64, max_line_sprites = 16, max_width = 264;
|
||||
if (PicoIn.opt & POPT_DIS_SPRITE_LIM)
|
||||
if (*est->PicoOpt & POPT_DIS_SPRITE_LIM)
|
||||
max_line_sprites = MAX_LINE_SPRITES;
|
||||
|
||||
sh = Pico.video.reg[0xC]&8; // shadow/hilight?
|
||||
|
@ -1643,20 +1645,20 @@ void FinalizeLine555(int sh, int line, struct PicoEState *est)
|
|||
if (Pico.video.reg[12]&1) {
|
||||
len = 320;
|
||||
} else {
|
||||
if (!(PicoIn.opt&POPT_DIS_32C_BORDER)) pd+=32;
|
||||
len = 256;
|
||||
}
|
||||
|
||||
{
|
||||
#if 1
|
||||
int i;
|
||||
|
||||
for (i = len; i > 0; i-=4) {
|
||||
*pd++ = pal[*ps++];
|
||||
*pd++ = pal[*ps++];
|
||||
*pd++ = pal[*ps++];
|
||||
*pd++ = pal[*ps++];
|
||||
if ((*est->PicoOpt & POPT_EN_SOFTSCALE) && len == 256) {
|
||||
switch (PicoIn.filter) {
|
||||
case 3: h_upscale_bl4_4_5(pd, 320, ps, 256, 256, f_pal); break;
|
||||
case 2: h_upscale_bl2_4_5(pd, 320, ps, 256, 256, f_pal); break;
|
||||
case 1: h_upscale_snn_4_5(pd, 320, ps, 256, 256, f_pal); break;
|
||||
default: h_upscale_nn_4_5(pd, 320, ps, 256, 256, f_pal); break;
|
||||
}
|
||||
} else {
|
||||
if (!(*est->PicoOpt & POPT_DIS_32C_BORDER) && len == 256) pd += 32;
|
||||
#if 1
|
||||
h_copy(pd, 320, ps, 320, len, f_pal);
|
||||
#else
|
||||
extern void amips_clut(unsigned short *dst, unsigned char *src, unsigned short *pal, int count);
|
||||
extern void amips_clut_6bit(unsigned short *dst, unsigned char *src, unsigned short *pal, int count);
|
||||
|
@ -1691,19 +1693,32 @@ static void FinalizeLine8bit(int sh, int line, struct PicoEState *est)
|
|||
if (Pico.video.reg[12]&1) {
|
||||
len = 320;
|
||||
} else {
|
||||
if (!(PicoIn.opt & POPT_DIS_32C_BORDER))
|
||||
pd += 32;
|
||||
len = 256;
|
||||
}
|
||||
|
||||
if (DrawLineDestIncrement == 0) {
|
||||
if ((PicoIn.opt & POPT_EN_SOFTSCALE) && len == 256) {
|
||||
unsigned char *ps = est->HighCol+8;
|
||||
unsigned char pal = 0;
|
||||
|
||||
if (!sh && (est->rendstatus & PDRAW_SONIC_MODE))
|
||||
blockcpy_or(pd+8, est->HighCol+8, len, est->SonicPalCount*0x40);
|
||||
} else if (!sh && (est->rendstatus & PDRAW_SONIC_MODE)) {
|
||||
// select active backup palette
|
||||
blockcpy_or(pd, est->HighCol+8, len, est->SonicPalCount*0x40);
|
||||
pal = est->SonicPalCount*0x40;
|
||||
if (DrawLineDestIncrement == 0)
|
||||
pd = est->HighCol+8;
|
||||
// Smoothing can't be used with CLUT, hence it's always Nearest Neighbour.
|
||||
// use reverse version since src and dest ptr may be the same.
|
||||
rh_upscale_nn_4_5(pd, 320, ps, 256, len, f_or);
|
||||
} else if (DrawLineDestIncrement == 0) {
|
||||
if (!sh && (est->rendstatus & PDRAW_SONIC_MODE))
|
||||
blockcpy_or(est->HighCol+8, est->HighCol+8, len, est->SonicPalCount*0x40);
|
||||
} else {
|
||||
blockcpy(pd, est->HighCol+8, len);
|
||||
if (!(PicoIn.opt & POPT_DIS_32C_BORDER))
|
||||
pd += 32;
|
||||
if (!sh && (est->rendstatus & PDRAW_SONIC_MODE)) {
|
||||
// select active backup palette
|
||||
blockcpy_or(pd, est->HighCol+8, len, est->SonicPalCount*0x40);
|
||||
} else {
|
||||
blockcpy(pd, est->HighCol+8, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1828,7 +1843,7 @@ static int DrawDisplay(int sh)
|
|||
// MUST be called every frame
|
||||
PICO_INTERNAL void PicoFrameStart(void)
|
||||
{
|
||||
int offs = 8, lines = 224;
|
||||
int loffs = 8, lines = 224, coffs = 0, columns = 320;
|
||||
int dirty = ((Pico.est.rendstatus & PDRAW_SONIC_MODE) || Pico.m.dirtyPal);
|
||||
int sprep = Pico.est.rendstatus & (PDRAW_SPRITES_MOVED|PDRAW_DIRTY_SPRITES);
|
||||
int skipped = Pico.est.rendstatus & PDRAW_SKIP_FRAME;
|
||||
|
@ -1837,19 +1852,25 @@ PICO_INTERNAL void PicoFrameStart(void)
|
|||
Pico.est.rendstatus = 0;
|
||||
if ((Pico.video.reg[12] & 6) == 6)
|
||||
Pico.est.rendstatus |= PDRAW_INTERLACE; // interlace mode
|
||||
if (!(Pico.video.reg[12] & 1))
|
||||
if (!(Pico.video.reg[12] & 1)) {
|
||||
Pico.est.rendstatus |= PDRAW_32_COLS;
|
||||
if (!(PicoIn.opt & POPT_EN_SOFTSCALE)) {
|
||||
columns = 256;
|
||||
coffs = 32;
|
||||
}
|
||||
}
|
||||
if (Pico.video.reg[1] & 8) {
|
||||
Pico.est.rendstatus |= PDRAW_30_ROWS;
|
||||
offs = 0;
|
||||
lines = 240;
|
||||
loffs = 0;
|
||||
}
|
||||
if (PicoIn.opt & POPT_DIS_32C_BORDER)
|
||||
coffs = 0;
|
||||
|
||||
if (Pico.est.rendstatus != rendstatus_old || lines != rendlines) {
|
||||
rendlines = lines;
|
||||
// mode_change() might reset rendstatus_old by calling SetColorFormat
|
||||
emu_video_mode_change((lines == 240) ? 0 : 8,
|
||||
lines, (Pico.video.reg[12] & 1) ? 0 : 1);
|
||||
emu_video_mode_change(loffs, lines, coffs, columns);
|
||||
rendstatus_old = Pico.est.rendstatus;
|
||||
}
|
||||
if (PicoIn.skipFrame) // preserve this until something is rendered at last
|
||||
|
@ -1857,8 +1878,8 @@ PICO_INTERNAL void PicoFrameStart(void)
|
|||
if (sprep | skipped)
|
||||
Pico.est.rendstatus |= PDRAW_PARSE_SPRITES;
|
||||
|
||||
Pico.est.HighCol = HighColBase + offs * HighColIncrement;
|
||||
Pico.est.DrawLineDest = (char *)DrawLineDestBase + offs * DrawLineDestIncrement;
|
||||
Pico.est.HighCol = HighColBase + loffs * HighColIncrement;
|
||||
Pico.est.DrawLineDest = (char *)DrawLineDestBase + loffs * DrawLineDestIncrement;
|
||||
Pico.est.DrawScanline = 0;
|
||||
skip_next_line = 0;
|
||||
|
||||
|
|
207
pico/draw_arm.S
207
pico/draw_arm.S
|
@ -1653,9 +1653,9 @@ FinalizeLine555:
|
|||
tst r12, #1
|
||||
movne r2, #320/8 @ len
|
||||
bne .fl_no32colRGB555
|
||||
ldr r4, [r10, #OFS_EST_PicoOpt]
|
||||
ldr r5, [r10, #OFS_EST_PicoOpt]
|
||||
mov r2, #256/8
|
||||
ldr r4, [r4]
|
||||
ldr r4, [r5]
|
||||
tst r4, #0x4000
|
||||
bne .fl_32scale_RGB555
|
||||
tst r4, #0x0100
|
||||
|
@ -1705,15 +1705,167 @@ FinalizeLine555:
|
|||
|
||||
|
||||
.fl_32scale_RGB555:
|
||||
mov r9, #0x3900 @ f800 07e0 001f | e000 0780 001c | 3800 01e0 0007
|
||||
orr r9, r9, #0x00e7
|
||||
ldr r5, [r5, #OFS_PicoIn_filter-OFS_PicoIn_opt]
|
||||
|
||||
mov r9, #0xf700 @ f800 07e0 001f | e000 0780 001c | 3800 01e0 0007
|
||||
orr r9, r9, #0x00de
|
||||
|
||||
#ifdef UNALIGNED_DRAWLINEDEST
|
||||
tst r0, #2
|
||||
bne .fl_32scale_RGB555u
|
||||
#endif
|
||||
|
||||
.fl_loop32scale_RGB555:
|
||||
ands r5, r5, #0x3
|
||||
addne pc, pc, r5, lsl #2
|
||||
b .fl_32scale_nn
|
||||
b .fl_32scale_nn
|
||||
b .fl_32scale_snn
|
||||
b .fl_32scale_bl2
|
||||
b .fl_32scale_bl4
|
||||
|
||||
.fl_32scale_nn:
|
||||
ldr r12, [r1], #4
|
||||
ldr r7, [r1], #4
|
||||
|
||||
and r4, lr, r12, lsl #1
|
||||
ldrh r4, [r3, r4]
|
||||
and r5, lr, r12, lsr #7
|
||||
ldrh r5, [r3, r5]
|
||||
and r6, lr, r12, lsr #15
|
||||
ldrh r6, [r3, r6]
|
||||
and r10,lr, r12, lsr #23
|
||||
ldrh r10,[r3, r10]
|
||||
|
||||
orr r4, r4, r5, lsl #16
|
||||
orr r5, r6, r6, lsl #16
|
||||
|
||||
and r6, lr, r7, lsl #1
|
||||
ldrh r6, [r3, r6]
|
||||
and r8, lr, r7, lsr #7
|
||||
ldrh r8, [r3, r8]
|
||||
and r12,lr, r7, lsr #15
|
||||
ldrh r12,[r3, r12]
|
||||
and r7, lr, r7, lsr #23
|
||||
ldrh r7, [r3, r7]
|
||||
|
||||
orr r6, r10,r6, lsl #16
|
||||
orr r8, r8,r12, lsl #16
|
||||
|
||||
subs r2, r2, #1
|
||||
|
||||
orr r10,r12,r7, lsl #16
|
||||
|
||||
stmia r0!, {r4,r5,r6,r8,r10}
|
||||
bne .fl_32scale_nn
|
||||
|
||||
ldmfd sp!, {r4-r10,pc}
|
||||
|
||||
.fl_32scale_snn:
|
||||
ldr r12, [r1], #4
|
||||
ldr r7, [r1], #4
|
||||
|
||||
and r4, lr, r12, lsl #1
|
||||
ldrh r4, [r3, r4]
|
||||
and r5, lr, r12, lsr #7
|
||||
ldrh r5, [r3, r5]
|
||||
and r6, lr, r12, lsr #15
|
||||
ldrh r6, [r3, r6]
|
||||
and r10,lr, r12, lsr #23
|
||||
ldrh r10,[r3, r10]
|
||||
|
||||
and r4, r4, r9
|
||||
and r5, r5, r9
|
||||
orr r4, r4, r5, lsl #16
|
||||
and r6, r6, r9
|
||||
add r5, r5, r6
|
||||
mov r5, r5, lsr #1
|
||||
orr r5, r5, r6, lsl #16
|
||||
|
||||
and r6, lr, r7, lsl #1
|
||||
ldrh r6, [r3, r6]
|
||||
and r8, lr, r7, lsr #7
|
||||
ldrh r8, [r3, r8]
|
||||
and r12,lr, r7, lsr #15
|
||||
ldrh r12,[r3, r12]
|
||||
and r7, lr, r7, lsr #23
|
||||
ldrh r7, [r3, r7]
|
||||
|
||||
and r6, r6, r9
|
||||
and r10,r10,r9
|
||||
orr r6, r10,r6, lsl #16
|
||||
and r12,r12,r9
|
||||
and r7, r7, r9
|
||||
orr r10,r12,r7, lsl #16
|
||||
|
||||
and r8, r8, r9
|
||||
add r12,r12,r8
|
||||
mov r12,r12,lsr #1
|
||||
orr r8, r8,r12, lsl #16
|
||||
|
||||
subs r2, r2, #1
|
||||
|
||||
stmia r0!, {r4,r5,r6,r8,r10}
|
||||
bne .fl_32scale_snn
|
||||
|
||||
ldmfd sp!, {r4-r10,pc}
|
||||
|
||||
.fl_32scale_bl2:
|
||||
ldr r12, [r1], #4
|
||||
ldr r7, [r1], #4
|
||||
|
||||
and r4, lr, r12, lsl #1
|
||||
ldrh r4, [r3, r4]
|
||||
and r5, lr, r12, lsr #7
|
||||
ldrh r5, [r3, r5]
|
||||
and r6, lr, r12, lsr #15
|
||||
ldrh r6, [r3, r6]
|
||||
|
||||
and r4, r4, r9
|
||||
and r5, r5, r9
|
||||
add r10,r4, r5
|
||||
mov r10,r10,lsr #1
|
||||
orr r4, r4, r10,lsl #16 @ px0 | (px0+px1)/2
|
||||
|
||||
and r6, r6, r9
|
||||
add r5, r5, r6
|
||||
mov r5, r5, lsr #1
|
||||
orr r5, r5, r6, lsl #16 @ (px1+px2)/2 | px2
|
||||
|
||||
and r10,lr, r12, lsr #23
|
||||
ldrh r10,[r3, r10]
|
||||
and r8, lr, r7, lsl #1
|
||||
ldrh r8, [r3, r8]
|
||||
|
||||
and r10,r10,r9
|
||||
and r8, r8, r9
|
||||
orr r6, r10,r8, lsl #16 @ px3 | px4
|
||||
|
||||
and r12,lr, r7, lsr #15
|
||||
ldrh r12,[r3, r12]
|
||||
and r10, lr, r7, lsr #23
|
||||
ldrh r10, [r3, r10]
|
||||
and r7, lr, r7, lsr #7
|
||||
ldrh r7, [r3, r7]
|
||||
|
||||
and r12,r12,r9
|
||||
and r10,r10,r9
|
||||
orr r10,r12,r10, lsl #16 @ px6 | px7
|
||||
|
||||
and r7, r7, r9
|
||||
add r12,r12,r7
|
||||
add r8, r8, r7
|
||||
mov r8, r8, lsr #1
|
||||
mov r12,r12,lsr #1
|
||||
orr r8, r8,r12, lsl #16 @ (px4+px5)/2 | (px5+px6)/2
|
||||
|
||||
subs r2, r2, #1
|
||||
|
||||
stmia r0!, {r4,r5,r6,r8,r10}
|
||||
bne .fl_32scale_bl2
|
||||
|
||||
ldmfd sp!, {r4-r10,pc}
|
||||
|
||||
.fl_32scale_bl4:
|
||||
ldr r12, [r1], #4
|
||||
ldr r7, [r1], #4
|
||||
|
||||
|
@ -1721,16 +1873,21 @@ FinalizeLine555:
|
|||
ldrh r4, [r3, r4]
|
||||
and r5, lr, r12,lsr #7
|
||||
ldrh r5, [r3, r5]
|
||||
and r4, r4, r9, lsl #2
|
||||
|
||||
@ r4 = 1/4px0+3/4px1 : px0
|
||||
and r4, r4, r9
|
||||
orr r4, r4, r4, lsl #14 @ r4[31:16] = 1/4 pix_s 0
|
||||
and r5, r5, r9, lsl #2
|
||||
and r5, r5, r9
|
||||
sub r6, r5, r5, lsr #2 @ r6 = 3/4 pix_s 1
|
||||
add r4, r4, r6, lsl #16 @ pix_d 0, 1
|
||||
|
||||
and r6, lr, r12,lsr #15
|
||||
ldrh r6, [r3, r6]
|
||||
and r12,lr, r12,lsr #23
|
||||
ldrh r12,[r3, r12]
|
||||
and r6, r6, r9, lsl #2
|
||||
|
||||
@ r5 = 3/4px2+1/4px3 : (px1+px2)/2
|
||||
and r6, r6, r9
|
||||
add r5, r5, r6
|
||||
mov r5, r5, lsr #1
|
||||
sub r6, r6, r6, lsr #2 @ r6 = 3/4 pix_s 2
|
||||
|
@ -1738,32 +1895,38 @@ FinalizeLine555:
|
|||
|
||||
and r6, lr, r7, lsl #1
|
||||
ldrh r6, [r3, r6]
|
||||
and r12,r12,r9, lsl #2
|
||||
and r12,r12,r9
|
||||
add r5, r5, r12,lsl #14 @ pix_d 2, 3
|
||||
and r6, r6, r9, lsl #2
|
||||
|
||||
@ r6 = px4 : px3
|
||||
and r6, r6, r9
|
||||
orr r6, r12,r6, lsl #16 @ pix_d 4, 5
|
||||
|
||||
@ r8 = (px5+px6)/2 : 1/4px4+3/4px5
|
||||
and r12,lr, r7, lsr #7
|
||||
ldrh r12,[r3, r12]
|
||||
and r10,lr, r7, lsr #15
|
||||
ldrh r10,[r3, r10]
|
||||
and r12,r12,r9, lsl #2
|
||||
and r12,r12,r9
|
||||
sub r8, r12,r12,lsr #2 @ r8 = 3/4 pix_s 1
|
||||
add r8, r8, r6, lsr #18
|
||||
|
||||
and r7, lr, r7, lsr #23
|
||||
ldrh r7, [r3, r7]
|
||||
and r10,r10,r9, lsl #2
|
||||
and r10,r10,r9
|
||||
orr r8, r8, r10,lsl #15
|
||||
add r8, r8, r12,lsl #15 @ pix_d 6, 7
|
||||
|
||||
@ r10 = px7 : 3/4px6+1/4px7
|
||||
sub r10,r10,r10,lsr #2 @ r10= 3/4 pix_s 2
|
||||
and r7, r7, r9, lsl #2
|
||||
and r7, r7, r9
|
||||
add r10,r10,r7, lsr #2 @ += 1/4 pix_s 3
|
||||
orr r10,r10,r7, lsl #16 @ pix_d 8, 9
|
||||
|
||||
subs r2, r2, #1
|
||||
|
||||
stmia r0!, {r4,r5,r6,r8,r10}
|
||||
bne .fl_loop32scale_RGB555
|
||||
bne .fl_32scale_bl4
|
||||
|
||||
ldmfd sp!, {r4-r10,pc}
|
||||
|
||||
|
@ -1826,10 +1989,10 @@ FinalizeLine555:
|
|||
ldrh r6, [r3, r6]
|
||||
and r5, lr, r12,lsr #7
|
||||
ldrh r5, [r3, r5]
|
||||
and r6, r6, r9, lsl #2
|
||||
and r6, r6, r9
|
||||
orr r4, r4, r6, lsl #16 @ r4 = pix_d -1, 0
|
||||
|
||||
and r5, r5, r9, lsl #2
|
||||
and r5, r5, r9
|
||||
sub r8, r5, r5, lsr #2 @ r8 = 3/4 pix_s 1
|
||||
add r6, r8, r6, lsr #2 @ r6 = (1/4 pix_s 0) + (3/4 pix_s 1)
|
||||
orr r5, r6, r5, lsl #15
|
||||
|
@ -1838,20 +2001,20 @@ FinalizeLine555:
|
|||
ldrh r6, [r3, r6]
|
||||
and r12,lr, r12,lsr #23
|
||||
ldrh r12,[r3, r12]
|
||||
and r6, r6, r9, lsl #2
|
||||
and r6, r6, r9
|
||||
add r5, r5, r6, lsl #15 @ r5 = pix_d 1, 2
|
||||
|
||||
and r8, lr, r7, lsl #1
|
||||
ldrh r8, [r3, r8]
|
||||
and r10,lr, r7, lsr #7
|
||||
ldrh r10,[r3, r10]
|
||||
and r12,r12,r9, lsl #2
|
||||
and r12,r12,r9
|
||||
sub r6, r6, r6, lsr #2 @ r6 = 3/4 pix_s 2
|
||||
add r6, r6, r12,lsr #2
|
||||
orr r6, r6, r12,lsl #16 @ r6 = pix_d 3, 4
|
||||
|
||||
and r8, r8, r9, lsl #2
|
||||
and r10,r10,r9, lsl #2
|
||||
and r8, r8, r9
|
||||
and r10,r10,r9
|
||||
sub r12,r10,r10,lsr #2 @ r12 = 3/4 pix_s 5
|
||||
orr r8, r8, r8, lsl #14
|
||||
add r8, r8, r12,lsl #16 @ r8 = pix_d 5, 6
|
||||
|
@ -1859,12 +2022,12 @@ FinalizeLine555:
|
|||
ldrh r12,[r3, r12]
|
||||
and r7, lr, r7, lsr #23
|
||||
ldrh r7, [r3, r7]
|
||||
and r12,r12,r9, lsl #2
|
||||
and r12,r12,r9
|
||||
add r10,r10,r12
|
||||
mov r10,r10, lsr #1
|
||||
sub r12,r12,r12,lsr #2 @ r12 = 3/4 pix_s 6
|
||||
orr r10,r10,r12,lsl #16
|
||||
and r7, r7, r9, lsl #2
|
||||
and r7, r7, r9
|
||||
add r10,r10,r7, lsl #14 @ r10 = pix_d 7, 8
|
||||
|
||||
subs r2, r2, #1
|
||||
|
|
17
pico/mode4.c
17
pico/mode4.c
|
@ -291,7 +291,7 @@ void PicoFrameStartMode4(void)
|
|||
}
|
||||
|
||||
if (Pico.est.rendstatus != rendstatus_old || lines != rendlines) {
|
||||
emu_video_mode_change(screen_offset, lines, 1);
|
||||
emu_video_mode_change(screen_offset, lines, line_offset, 256);
|
||||
rendstatus_old = Pico.est.rendstatus;
|
||||
rendlines = lines;
|
||||
}
|
||||
|
@ -352,6 +352,8 @@ void PicoDoHighPal555M4(void)
|
|||
Pico.est.HighPal[0xe0] = 0;
|
||||
}
|
||||
|
||||
#include <platform/common/upscale.h>
|
||||
|
||||
static void FinalizeLineRGB555M4(int line)
|
||||
{
|
||||
if (Pico.m.dirtyPal)
|
||||
|
@ -364,15 +366,20 @@ static void FinalizeLineRGB555M4(int line)
|
|||
|
||||
static void FinalizeLine8bitM4(int line)
|
||||
{
|
||||
unsigned char *pd = Pico.est.DrawLineDest;
|
||||
unsigned char *pd = Pico.est.DrawLineDest + line_offset;
|
||||
unsigned char *ps = Pico.est.HighCol + line_offset + 8;
|
||||
|
||||
if (DrawLineDestIncrement)
|
||||
memcpy(pd + line_offset, Pico.est.HighCol + line_offset + 8, 256);
|
||||
if (DrawLineDestIncrement) {
|
||||
if (PicoIn.opt & POPT_EN_SOFTSCALE)
|
||||
rh_upscale_nn_4_5(pd, 320, ps, 256, 256, f_nop);
|
||||
else
|
||||
memcpy(pd, ps, 256);
|
||||
}
|
||||
}
|
||||
|
||||
void PicoDrawSetOutputMode4(pdso_t which)
|
||||
{
|
||||
line_offset = PicoIn.opt & POPT_DIS_32C_BORDER ? 0 : 32;
|
||||
line_offset = PicoIn.opt & (POPT_DIS_32C_BORDER|POPT_EN_SOFTSCALE) ? 0 : 32;
|
||||
switch (which)
|
||||
{
|
||||
case PDF_8BIT: FinalizeLineM4 = FinalizeLine8bitM4; break;
|
||||
|
|
|
@ -41,7 +41,7 @@ extern void *plat_mem_get_for_drc(size_t size);
|
|||
extern int plat_mem_set_exec(void *ptr, size_t size);
|
||||
|
||||
// this one should handle display mode changes
|
||||
extern void emu_video_mode_change(int start_line, int line_count, int is_32cols);
|
||||
extern void emu_video_mode_change(int start_line, int line_count, int start_col, int col_count);
|
||||
|
||||
// this must switch to 16bpp mode
|
||||
extern void emu_32x_startup(void);
|
||||
|
@ -86,7 +86,7 @@ extern void *p32x_bios_g, *p32x_bios_m, *p32x_bios_s;
|
|||
|
||||
// the emulator is configured and some status is reported
|
||||
// through this global state (not saved in savestates)
|
||||
typedef struct
|
||||
typedef struct PicoInterface
|
||||
{
|
||||
unsigned int opt; // POPT_* bitfield
|
||||
|
||||
|
@ -101,6 +101,8 @@ typedef struct
|
|||
unsigned short quirks; // game-specific quirks: PQUIRK_*
|
||||
unsigned short overclockM68k; // overclock the emulated 68k, in %
|
||||
|
||||
unsigned short filter; // softscale filter type
|
||||
|
||||
int sndRate; // rate in Hz
|
||||
int sndFilterAlpha; // Low pass sound filter alpha (Q16)
|
||||
short *sndOut; // PCM output buffer
|
||||
|
|
|
@ -356,6 +356,7 @@ struct PicoEState
|
|||
int DrawScanline;
|
||||
int rendstatus;
|
||||
void *DrawLineDest; // draw destination
|
||||
int DrawLineDestIncr;
|
||||
unsigned char *HighCol;
|
||||
s32 *HighPreSpr;
|
||||
struct Pico *Pico;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue