mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
32x: still tweaking renderers
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@858 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
07e5dbab71
commit
7a961c19ba
4 changed files with 74 additions and 20 deletions
|
@ -148,24 +148,25 @@ void PicoReset32x(void)
|
||||||
|
|
||||||
static void p32x_start_blank(void)
|
static void p32x_start_blank(void)
|
||||||
{
|
{
|
||||||
if (Pico32xDrawMode != 0) {
|
if (Pico32xDrawMode != PDM32X_OFF && !PicoSkipFrame) {
|
||||||
|
int offs = 8, lines = 224;
|
||||||
|
if ((Pico.video.reg[1] & 8) && !(PicoOpt & POPT_ALT_RENDERER)) {
|
||||||
|
offs = 0;
|
||||||
|
lines = 240;
|
||||||
|
}
|
||||||
|
|
||||||
|
// XXX: no proper handling of 32col mode..
|
||||||
if ((Pico32x.vdp_regs[0] & P32XV_Mx) != 0 && // 32x not blanking
|
if ((Pico32x.vdp_regs[0] & P32XV_Mx) != 0 && // 32x not blanking
|
||||||
(Pico.video.reg[12] & 1) && // 40col mode
|
(Pico.video.reg[12] & 1) && // 40col mode
|
||||||
(PicoDrawMask & PDRAW_32X_ON))
|
(PicoDrawMask & PDRAW_32X_ON))
|
||||||
{
|
{
|
||||||
int md_bg = Pico.video.reg[7] & 0x3f;
|
int md_bg = Pico.video.reg[7] & 0x3f;
|
||||||
int offs = 8, lines = 224;
|
|
||||||
if (Pico.video.reg[1] & 8) {
|
|
||||||
offs = 0;
|
|
||||||
lines = 240;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we draw full layer (not line-by-line)
|
// we draw full layer (not line-by-line)
|
||||||
PicoDraw32xLayer(offs, lines, md_bg);
|
PicoDraw32xLayer(offs, lines, md_bg);
|
||||||
}
|
}
|
||||||
else {
|
else if (Pico32xDrawMode != PDM32X_32X_ONLY)
|
||||||
// TODO: MD layer only?
|
PicoDraw32xLayerMdOnly(offs, lines);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// enter vblank
|
// enter vblank
|
||||||
|
|
|
@ -133,7 +133,8 @@ static void do_loop_dc##name(unsigned short *dst, \
|
||||||
unsigned short *dram, int lines_sft_offs, int mdbg) \
|
unsigned short *dram, int lines_sft_offs, int mdbg) \
|
||||||
{ \
|
{ \
|
||||||
int inv_bit = (Pico32x.vdp_regs[0] & P32XV_PRI) ? 0x8000 : 0; \
|
int inv_bit = (Pico32x.vdp_regs[0] & P32XV_PRI) ? 0x8000 : 0; \
|
||||||
unsigned char *pmd = PicoDraw2FB + 328 * 8 + 8; \
|
unsigned char *pmd = PicoDraw2FB + \
|
||||||
|
328 * (lines_sft_offs & 0xff) + 8; \
|
||||||
unsigned short *palmd = HighPal; \
|
unsigned short *palmd = HighPal; \
|
||||||
unsigned short *p32x; \
|
unsigned short *p32x; \
|
||||||
int lines = lines_sft_offs >> 16; \
|
int lines = lines_sft_offs >> 16; \
|
||||||
|
@ -152,7 +153,8 @@ static void do_loop_pp##name(unsigned short *dst, \
|
||||||
unsigned short *dram, int lines_sft_offs, int mdbg) \
|
unsigned short *dram, int lines_sft_offs, int mdbg) \
|
||||||
{ \
|
{ \
|
||||||
unsigned short *pal = Pico32xMem->pal_native; \
|
unsigned short *pal = Pico32xMem->pal_native; \
|
||||||
unsigned char *pmd = PicoDraw2FB + 328 * 8 + 8; \
|
unsigned char *pmd = PicoDraw2FB + \
|
||||||
|
328 * (lines_sft_offs & 0xff) + 8; \
|
||||||
unsigned short *palmd = HighPal; \
|
unsigned short *palmd = HighPal; \
|
||||||
unsigned char *p32x; \
|
unsigned char *p32x; \
|
||||||
int lines = lines_sft_offs >> 16; \
|
int lines = lines_sft_offs >> 16; \
|
||||||
|
@ -172,7 +174,8 @@ static void do_loop_rl##name(unsigned short *dst, \
|
||||||
unsigned short *dram, int lines_sft_offs, int mdbg) \
|
unsigned short *dram, int lines_sft_offs, int mdbg) \
|
||||||
{ \
|
{ \
|
||||||
unsigned short *pal = Pico32xMem->pal_native; \
|
unsigned short *pal = Pico32xMem->pal_native; \
|
||||||
unsigned char *pmd = PicoDraw2FB + 328 * 8 + 8; \
|
unsigned char *pmd = PicoDraw2FB + \
|
||||||
|
328 * (lines_sft_offs & 0xff) + 8; \
|
||||||
unsigned short *palmd = HighPal; \
|
unsigned short *palmd = HighPal; \
|
||||||
unsigned short *p32x; \
|
unsigned short *p32x; \
|
||||||
int lines = lines_sft_offs >> 16; \
|
int lines = lines_sft_offs >> 16; \
|
||||||
|
@ -217,10 +220,10 @@ void PicoDraw32xLayer(int offs, int lines, int md_bg)
|
||||||
int lines_sft_offs;
|
int lines_sft_offs;
|
||||||
int which_func;
|
int which_func;
|
||||||
|
|
||||||
DrawLineDest = DrawLineDestBase + offs * DrawLineDestIncrement;
|
DrawLineDest = (char *)DrawLineDestBase + offs * DrawLineDestIncrement;
|
||||||
dram = Pico32xMem->dram[Pico32x.vdp_regs[0x0a/2] & P32XV_FS];
|
dram = Pico32xMem->dram[Pico32x.vdp_regs[0x0a/2] & P32XV_FS];
|
||||||
|
|
||||||
if (Pico32xDrawMode == 2) {
|
if (Pico32xDrawMode == PDM32X_BOTH) {
|
||||||
if (Pico.m.dirtyPal)
|
if (Pico.m.dirtyPal)
|
||||||
PicoDrawUpdateHighPal();
|
PicoDrawUpdateHighPal();
|
||||||
}
|
}
|
||||||
|
@ -247,7 +250,7 @@ void PicoDraw32xLayer(int offs, int lines, int md_bg)
|
||||||
}
|
}
|
||||||
|
|
||||||
do_it:
|
do_it:
|
||||||
if (Pico32xDrawMode == 2)
|
if (Pico32xDrawMode == PDM32X_BOTH)
|
||||||
which_func = have_scan ? DO_LOOP_MD_SCAN : DO_LOOP_MD;
|
which_func = have_scan ? DO_LOOP_MD_SCAN : DO_LOOP_MD;
|
||||||
else
|
else
|
||||||
which_func = have_scan ? DO_LOOP_SCAN : DO_LOOP;
|
which_func = have_scan ? DO_LOOP_SCAN : DO_LOOP;
|
||||||
|
@ -258,6 +261,44 @@ do_it:
|
||||||
do_loop[which_func](DrawLineDest, dram, lines_sft_offs, md_bg);
|
do_loop[which_func](DrawLineDest, dram, lines_sft_offs, md_bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// mostly unused, games tend to keep 32X layer on
|
||||||
|
void PicoDraw32xLayerMdOnly(int offs, int lines)
|
||||||
|
{
|
||||||
|
int have_scan = PicoScan32xBegin != NULL && PicoScan32xEnd != NULL;
|
||||||
|
unsigned short *dst = (void *)((char *)DrawLineDestBase + offs * DrawLineDestIncrement);
|
||||||
|
unsigned char *pmd = PicoDraw2FB + 328 * offs + 8;
|
||||||
|
unsigned short *pal = HighPal;
|
||||||
|
int poffs = 0, plen = 320;
|
||||||
|
int l, p;
|
||||||
|
|
||||||
|
if (!(Pico.video.reg[12] & 1)) {
|
||||||
|
// 32col mode
|
||||||
|
poffs = 32;
|
||||||
|
plen = 256;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Pico.m.dirtyPal)
|
||||||
|
PicoDrawUpdateHighPal();
|
||||||
|
|
||||||
|
dst += poffs;
|
||||||
|
for (l = 0; l < lines; l++) {
|
||||||
|
if (have_scan) {
|
||||||
|
PicoScan32xBegin(l + offs);
|
||||||
|
dst = DrawLineDest + poffs;
|
||||||
|
}
|
||||||
|
for (p = 0; p < plen; p += 4) {
|
||||||
|
dst[p + 0] = pal[*pmd++];
|
||||||
|
dst[p + 1] = pal[*pmd++];
|
||||||
|
dst[p + 2] = pal[*pmd++];
|
||||||
|
dst[p + 3] = pal[*pmd++];
|
||||||
|
}
|
||||||
|
dst = (void *)((char *)dst + DrawLineDestIncrement);
|
||||||
|
pmd += 328 - plen;
|
||||||
|
if (have_scan)
|
||||||
|
PicoScan32xEnd(l + offs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PicoDraw32xSetFrameMode(int is_on, int only_32x)
|
void PicoDraw32xSetFrameMode(int is_on, int only_32x)
|
||||||
{
|
{
|
||||||
#ifdef _ASM_32X_DRAW
|
#ifdef _ASM_32X_DRAW
|
||||||
|
@ -268,10 +309,10 @@ void PicoDraw32xSetFrameMode(int is_on, int only_32x)
|
||||||
if (is_on) {
|
if (is_on) {
|
||||||
// use the same layout as alt renderer
|
// use the same layout as alt renderer
|
||||||
PicoDrawSetInternalBuf(PicoDraw2FB + 328*8, 328);
|
PicoDrawSetInternalBuf(PicoDraw2FB + 328*8, 328);
|
||||||
Pico32xDrawMode = only_32x ? 1 : 2;
|
Pico32xDrawMode = only_32x ? PDM32X_32X_ONLY : PDM32X_BOTH;
|
||||||
} else {
|
} else {
|
||||||
PicoDrawSetInternalBuf(NULL, 0);
|
PicoDrawSetInternalBuf(NULL, 0);
|
||||||
Pico32xDrawMode = 0;
|
Pico32xDrawMode = PDM32X_OFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,9 @@ Pico32xNativePal:
|
||||||
ldr r10,[r10, #0x40] @ Pico32x.vdp_regs[0]
|
ldr r10,[r10, #0x40] @ Pico32x.vdp_regs[0]
|
||||||
ldr r11,[r11]
|
ldr r11,[r11]
|
||||||
ldr r9, =HighPal @ palmd
|
ldr r9, =HighPal @ palmd
|
||||||
add r11,r11,#(328*8) @ r11 = pmd: md data
|
and r4, r2, #0xff
|
||||||
|
mov r5, #328
|
||||||
|
mla r11,r4,r5,r11 @ r11 = pmd = PicoDraw2FB + offs*328: md data
|
||||||
tst r10,#P32XV_PRI
|
tst r10,#P32XV_PRI
|
||||||
moveq r10,#0
|
moveq r10,#0
|
||||||
movne r10,#0x8000 @ r10 = inv_bit
|
movne r10,#0x8000 @ r10 = inv_bit
|
||||||
|
@ -135,7 +137,9 @@ Pico32xNativePal:
|
||||||
ldr r11,[r11]
|
ldr r11,[r11]
|
||||||
ldr r10,[r10]
|
ldr r10,[r10]
|
||||||
ldr r9, =HighPal @ palmd
|
ldr r9, =HighPal @ palmd
|
||||||
add r11,r11,#(328*8) @ r11 = pmd: md data
|
and r4, r2, #0xff
|
||||||
|
mov r5, #328
|
||||||
|
mla r11,r4,r5,r11 @ r11 = pmd = PicoDraw2FB + offs*328: md data
|
||||||
call_scan_prep \call_scan
|
call_scan_prep \call_scan
|
||||||
|
|
||||||
mov r4, #0 @ line
|
mov r4, #0 @ line
|
||||||
|
@ -290,7 +294,9 @@ Pico32xNativePal:
|
||||||
ldr r11,[r11]
|
ldr r11,[r11]
|
||||||
ldr r10,[r10]
|
ldr r10,[r10]
|
||||||
ldr r9, =HighPal @ palmd
|
ldr r9, =HighPal @ palmd
|
||||||
add r11,r11,#(328*8) @ r11 = pmd: md data
|
and r4, r2, #0xff
|
||||||
|
mov r5, #328
|
||||||
|
mla r11,r4,r5,r11 @ r11 = pmd = PicoDraw2FB + offs*328: md data
|
||||||
call_scan_prep \call_scan
|
call_scan_prep \call_scan
|
||||||
|
|
||||||
mov r4, #0 @ line
|
mov r4, #0 @ line
|
||||||
|
|
|
@ -722,6 +722,12 @@ void p32x_poll_event(int cpu_mask, int is_vdp);
|
||||||
// 32x/draw.c
|
// 32x/draw.c
|
||||||
void FinalizeLine32xRGB555(int sh, int line);
|
void FinalizeLine32xRGB555(int sh, int line);
|
||||||
void PicoDraw32xLayer(int offs, int lines, int mdbg);
|
void PicoDraw32xLayer(int offs, int lines, int mdbg);
|
||||||
|
void PicoDraw32xLayerMdOnly(int offs, int lines);
|
||||||
|
enum {
|
||||||
|
PDM32X_OFF,
|
||||||
|
PDM32X_32X_ONLY,
|
||||||
|
PDM32X_BOTH,
|
||||||
|
};
|
||||||
extern int Pico32xDrawMode;
|
extern int Pico32xDrawMode;
|
||||||
|
|
||||||
// 32x/pwm.c
|
// 32x/pwm.c
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue