notaz.gp2x.de
/
picodrive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'libretro' into libretro-reset
[picodrive.git]
/
pico
/
32x
/
draw.c
diff --git
a/pico/32x/draw.c
b/pico/32x/draw.c
index
66814ab
..
ee541bd
100644
(file)
--- a/
pico/32x/draw.c
+++ b/
pico/32x/draw.c
@@
-43,7
+43,7
@@
static void convert_pal555(int invert_prio)
\
for (i = 320; i > 0; i--, pd++, p32x++, pmd++) { \
unsigned short t = *p32x; \
\
for (i = 320; i > 0; i--, pd++, p32x++, pmd++) { \
unsigned short t = *p32x; \
- if (
*pmd != mdbg && !((t ^ inv) & 0x8000)) {
\
+ if (
(*pmd & 0x3f) != mdbg && !((t ^ inv) & 0x8000)) {
\
pmd_draw_code; \
continue; \
} \
pmd_draw_code; \
continue; \
} \
@@
-59,7
+59,7
@@
static void convert_pal555(int invert_prio)
int i; \
for (i = 320; i > 0; i--, pd++, p32x++, pmd++) { \
t = pal[*(unsigned char *)((long)p32x ^ 1)]; \
int i; \
for (i = 320; i > 0; i--, pd++, p32x++, pmd++) { \
t = pal[*(unsigned char *)((long)p32x ^ 1)]; \
- if ((t & 0x20) ||
*pmd == mdbg)
\
+ if ((t & 0x20) ||
(*pmd & 0x3f) == mdbg)
\
*pd = t; \
else \
pmd_draw_code; \
*pd = t; \
else \
pmd_draw_code; \
@@
-74,7
+74,7
@@
static void convert_pal555(int invert_prio)
for (i = 320; i > 0; p32x++) { \
t = pal[*p32x & 0xff]; \
for (len = (*p32x >> 8) + 1; len > 0 && i > 0; len--, i--, pd++, pmd++) { \
for (i = 320; i > 0; p32x++) { \
t = pal[*p32x & 0xff]; \
for (len = (*p32x >> 8) + 1; len > 0 && i > 0; len--, i--, pd++, pmd++) { \
- if (
*pmd == mdbg || (t & 0x20))
\
+ if (
(*pmd & 0x3f) == mdbg || (t & 0x20))
\
*pd = t; \
else \
pmd_draw_code; \
*pd = t; \
else \
pmd_draw_code; \
@@
-82,20
+82,21
@@
static void convert_pal555(int invert_prio)
} \
}
} \
}
-void FinalizeLine32xRGB555(int sh, int line)
+// this is almost never used (Wiz and menu bg gen only)
+void FinalizeLine32xRGB555(int sh, int line, struct PicoEState *est)
{
{
- unsigned short *pd = DrawLineDest;
+ unsigned short *pd =
est->
DrawLineDest;
unsigned short *pal = Pico32xMem->pal_native;
unsigned short *pal = Pico32xMem->pal_native;
- unsigned char *pmd = HighCol + 8;
+ unsigned char *pmd =
est->
HighCol + 8;
unsigned short *dram, *p32x;
unsigned char mdbg;
unsigned short *dram, *p32x;
unsigned char mdbg;
- FinalizeLine555(sh, line);
+ FinalizeLine555(sh, line
, est
);
if ((Pico32x.vdp_regs[0] & P32XV_Mx) == 0 || // 32x blanking
// XXX: how is 32col mode hadled by real hardware?
!(Pico.video.reg[12] & 1) || // 32col mode
if ((Pico32x.vdp_regs[0] & P32XV_Mx) == 0 || // 32x blanking
// XXX: how is 32col mode hadled by real hardware?
!(Pico.video.reg[12] & 1) || // 32col mode
-
!(PicoDrawMask & PDRAW_32X_ON
))
+
(Pico.video.debug_p & PVD_KILL_32X
))
{
return;
}
{
return;
}
@@
-129,7
+130,7
@@
void FinalizeLine32xRGB555(int sh, int line)
#define PICOSCAN_PRE \
PicoScan32xBegin(l + (lines_sft_offs & 0xff)); \
#define PICOSCAN_PRE \
PicoScan32xBegin(l + (lines_sft_offs & 0xff)); \
- dst = DrawLineDest; \
+ dst =
Pico.est.
DrawLineDest; \
#define PICOSCAN_POST \
PicoScan32xEnd(l + (lines_sft_offs & 0xff)); \
#define PICOSCAN_POST \
PicoScan32xEnd(l + (lines_sft_offs & 0xff)); \
@@
-140,9
+141,9
@@
static void do_loop_dc##name(unsigned short *dst, \
unsigned short *dram, int lines_sft_offs, int mdbg) \
{ \
int inv_bit = (Pico32x.vdp_regs[0] & P32XV_PRI) ? 0x8000 : 0; \
unsigned short *dram, int lines_sft_offs, int mdbg) \
{ \
int inv_bit = (Pico32x.vdp_regs[0] & P32XV_PRI) ? 0x8000 : 0; \
- unsigned char *pmd = Pico
Draw2FB +
\
+ unsigned char *pmd = Pico
.est.Draw2FB +
\
328 * (lines_sft_offs & 0xff) + 8; \
328 * (lines_sft_offs & 0xff) + 8; \
- unsigned short *palmd =
HighPal;
\
+ unsigned short *palmd =
Pico.est.HighPal;
\
unsigned short *p32x; \
int lines = lines_sft_offs >> 16; \
int l; \
unsigned short *p32x; \
int lines = lines_sft_offs >> 16; \
int l; \
@@
-160,9
+161,9
@@
static void do_loop_pp##name(unsigned short *dst, \
unsigned short *dram, int lines_sft_offs, int mdbg) \
{ \
unsigned short *pal = Pico32xMem->pal_native; \
unsigned short *dram, int lines_sft_offs, int mdbg) \
{ \
unsigned short *pal = Pico32xMem->pal_native; \
- unsigned char *pmd = Pico
Draw2FB +
\
+ unsigned char *pmd = Pico
.est.Draw2FB +
\
328 * (lines_sft_offs & 0xff) + 8; \
328 * (lines_sft_offs & 0xff) + 8; \
- unsigned short *palmd =
HighPal;
\
+ unsigned short *palmd =
Pico.est.HighPal;
\
unsigned char *p32x; \
int lines = lines_sft_offs >> 16; \
int l; \
unsigned char *p32x; \
int lines = lines_sft_offs >> 16; \
int l; \
@@
-181,9
+182,9
@@
static void do_loop_rl##name(unsigned short *dst, \
unsigned short *dram, int lines_sft_offs, int mdbg) \
{ \
unsigned short *pal = Pico32xMem->pal_native; \
unsigned short *dram, int lines_sft_offs, int mdbg) \
{ \
unsigned short *pal = Pico32xMem->pal_native; \
- unsigned char *pmd = Pico
Draw2FB +
\
+ unsigned char *pmd = Pico
.est.Draw2FB +
\
328 * (lines_sft_offs & 0xff) + 8; \
328 * (lines_sft_offs & 0xff) + 8; \
- unsigned short *palmd =
HighPal;
\
+ unsigned short *palmd =
Pico.est.HighPal;
\
unsigned short *p32x; \
int lines = lines_sft_offs >> 16; \
int l; \
unsigned short *p32x; \
int lines = lines_sft_offs >> 16; \
int l; \
@@
-227,7
+228,7
@@
void PicoDraw32xLayer(int offs, int lines, int md_bg)
int lines_sft_offs;
int which_func;
int lines_sft_offs;
int which_func;
- DrawLineDest = (char *)DrawLineDestBase + offs * DrawLineDestIncrement;
+
Pico.est.
DrawLineDest = (char *)DrawLineDestBase + offs * DrawLineDestIncrement;
dram = Pico32xMem->dram[Pico32x.vdp_regs[0x0a/2] & P32XV_FS];
if (Pico32xDrawMode == PDM32X_BOTH) {
dram = Pico32xMem->dram[Pico32x.vdp_regs[0x0a/2] & P32XV_FS];
if (Pico32xDrawMode == PDM32X_BOTH) {
@@
-265,7
+266,7
@@
do_it:
if (Pico32x.vdp_regs[2 / 2] & P32XV_SFT)
lines_sft_offs |= 1 << 8;
if (Pico32x.vdp_regs[2 / 2] & P32XV_SFT)
lines_sft_offs |= 1 << 8;
- do_loop[which_func](DrawLineDest, dram, lines_sft_offs, md_bg);
+ do_loop[which_func](
Pico.est.
DrawLineDest, dram, lines_sft_offs, md_bg);
}
// mostly unused, games tend to keep 32X layer on
}
// mostly unused, games tend to keep 32X layer on
@@
-273,8
+274,8
@@
void PicoDraw32xLayerMdOnly(int offs, int lines)
{
int have_scan = PicoScan32xBegin != NULL && PicoScan32xEnd != NULL;
unsigned short *dst = (void *)((char *)DrawLineDestBase + offs * DrawLineDestIncrement);
{
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;
+ unsigned char *pmd = Pico
.est.
Draw2FB + 328 * offs + 8;
+ unsigned short *pal =
Pico.est.
HighPal;
int poffs = 0, plen = 320;
int l, p;
int poffs = 0, plen = 320;
int l, p;
@@
-291,7
+292,7
@@
void PicoDraw32xLayerMdOnly(int offs, int lines)
for (l = 0; l < lines; l++) {
if (have_scan) {
PicoScan32xBegin(l + offs);
for (l = 0; l < lines; l++) {
if (have_scan) {
PicoScan32xBegin(l + offs);
- dst = DrawLineDest + poffs;
+ dst =
(unsigned short *)Pico.est.
DrawLineDest + poffs;
}
for (p = 0; p < plen; p += 4) {
dst[p + 0] = pal[*pmd++];
}
for (p = 0; p < plen; p += 4) {
dst[p + 0] = pal[*pmd++];
@@
-306,20
+307,23
@@
void PicoDraw32xLayerMdOnly(int offs, int lines)
}
}
}
}
-void PicoDraw
32xSetFrameMode(int is_on, int only_32x
)
+void PicoDraw
SetOutFormat32x(pdso_t which, int use_32x_line_mode
)
{
#ifdef _ASM_32X_DRAW
extern void *Pico32xNativePal;
Pico32xNativePal = Pico32xMem->pal_native;
#endif
{
#ifdef _ASM_32X_DRAW
extern void *Pico32xNativePal;
Pico32xNativePal = Pico32xMem->pal_native;
#endif
- if (is_on) {
- // use the same layout as alt renderer
- PicoDrawSetInternalBuf(PicoDraw2FB, 328);
- Pico32xDrawMode = only_32x ? PDM32X_32X_ONLY : PDM32X_BOTH;
- } else {
+ if (which == PDF_RGB555 && use_32x_line_mode) {
+ // we'll draw via FinalizeLine32xRGB555 (rare)
PicoDrawSetInternalBuf(NULL, 0);
Pico32xDrawMode = PDM32X_OFF;
PicoDrawSetInternalBuf(NULL, 0);
Pico32xDrawMode = PDM32X_OFF;
+ return;
}
}
+
+ // use the same layout as alt renderer
+ PicoDrawSetInternalBuf(Pico.est.Draw2FB, 328);
+ Pico32xDrawMode = (which == PDF_RGB555) ? PDM32X_32X_ONLY : PDM32X_BOTH;
}
}
+// vim:shiftwidth=2:ts=2:expandtab