unsigned short *dram, int lines_sft_offs, int mdbg) \
{ \
int inv_bit = (Pico32x.vdp_regs[0] & P32XV_PRI) ? 0x8000 : 0; \
- unsigned char *pmd = PicoDraw2FB + \
+ unsigned char *pmd = Pico.est.Draw2FB + \
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 *dram, int lines_sft_offs, int mdbg) \
{ \
unsigned short *pal = Pico32xMem->pal_native; \
- unsigned char *pmd = PicoDraw2FB + \
+ unsigned char *pmd = Pico.est.Draw2FB + \
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 short *dram, int lines_sft_offs, int mdbg) \
{ \
unsigned short *pal = Pico32xMem->pal_native; \
- unsigned char *pmd = PicoDraw2FB + \
+ unsigned char *pmd = Pico.est.Draw2FB + \
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; \
{
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;
}
// use the same layout as alt renderer
- PicoDrawSetInternalBuf(PicoDraw2FB, 328);
+ PicoDrawSetInternalBuf(Pico.est.Draw2FB, 328);
Pico32xDrawMode = (which == PDF_RGB555) ? PDM32X_32X_ONLY : PDM32X_BOTH;
}
void PDebugShowPalette(unsigned short *screen, int stride)
{
+ struct PicoEState *est = &Pico.est;
int x, y;
Pico.m.dirtyPal = 1;
if (PicoAHW & PAHW_SMS)
PicoDoHighPal555M4();
else
- PicoDoHighPal555(1, 0, &Pico.est);
+ PicoDoHighPal555(1, 0, est);
Pico.m.dirtyPal = 1;
screen += 16*stride+8;
for (y = 0; y < 8*4; y++)
for (x = 0; x < 8*16; x++)
- screen[x + y*stride] = HighPal[x/8 + (y/8)*16];
+ screen[x + y*stride] = est->HighPal[x/8 + (y/8)*16];
screen += 160;
for (y = 0; y < 8*4; y++)
for (x = 0; x < 8*16; x++)
- screen[x + y*stride] = HighPal[(x/8 + (y/8)*16) | 0x40];
+ screen[x + y*stride] = est->HighPal[(x/8 + (y/8)*16) | 0x40];
screen += stride*48;
for (y = 0; y < 8*4; y++)
for (x = 0; x < 8*16; x++)
- screen[x + y*stride] = HighPal[(x/8 + (y/8)*16) | 0x80];
+ screen[x + y*stride] = est->HighPal[(x/8 + (y/8)*16) | 0x80];
}
#if defined(DRAW2_OVERRIDE_LINE_WIDTH)
PicoFrameFull();
for (y = 0; y < 8*4; y++)
{
- unsigned char *ps = PicoDraw2FB + DRAW2_LINE_WIDTH*y + 8;
+ unsigned char *ps = Pico.est.Draw2FB + DRAW2_LINE_WIDTH*y + 8;
for (x = 0; x < 8*4; x++)
- if (ps[x]) screen[x] = HighPal[ps[x]], ps[x] = 0;
+ if (ps[x]) screen[x] = Pico.est.HighPal[ps[x]], ps[x] = 0;
screen += stride;
}
\r
// --------------------------------------------\r
\r
-unsigned short HighPal[0x100];\r
-\r
#ifndef _ASM_DRAW_C\r
void PicoDoHighPal555(int sh, int line, struct PicoEState *est)\r
{\r
Pico.m.dirtyPal = 0;\r
\r
spal = (void *)Pico.cram;\r
- dpal = (void *)HighPal;\r
+ dpal = (void *)est->HighPal;\r
\r
for (i = 0; i < 0x40 / 2; i++) {\r
t = spal[i];\r
{\r
unsigned short *pd=est->DrawLineDest;\r
unsigned char *ps=est->HighCol+8;\r
- unsigned short *pal=HighPal;\r
+ unsigned short *pal=est->HighPal;\r
int len;\r
\r
if (Pico.m.dirtyPal)\r
rs |= PDRAW_SONIC_MODE;\r
est->rendstatus = rs;\r
if (dirty_count == 3) {\r
- blockcpy(HighPal, Pico.cram, 0x40*2);\r
+ blockcpy(est->HighPal, Pico.cram, 0x40*2);\r
} else if (dirty_count == 11) {\r
- blockcpy(HighPal+0x40, Pico.cram, 0x40*2);\r
+ blockcpy(est->HighPal+0x40, Pico.cram, 0x40*2);\r
}\r
}\r
\r
// also works for fast renderer\r
void PicoDrawUpdateHighPal(void)\r
{\r
+ struct PicoEState *est = &Pico.est;\r
int sh = (Pico.video.reg[0xC] & 8) >> 3; // shadow/hilight?\r
if (PicoOpt & POPT_ALT_RENDERER)\r
sh = 0; // no s/h support\r
\r
PicoDoHighPal555(sh, 0, &Pico.est);\r
- if (Pico.est.rendstatus & PDRAW_SONIC_MODE) {\r
+ if (est->rendstatus & PDRAW_SONIC_MODE) {\r
// FIXME?\r
- memcpy(HighPal + 0x40, HighPal, 0x40*2);\r
- memcpy(HighPal + 0x80, HighPal, 0x40*2);\r
+ memcpy(est->HighPal + 0x40, est->HighPal, 0x40*2);\r
+ memcpy(est->HighPal + 0x80, est->HighPal, 0x40*2);\r
}\r
}\r
\r
#endif\r
\r
static unsigned char PicoDraw2FB_[(8+320) * (8+240+8)];\r
-unsigned char *PicoDraw2FB = PicoDraw2FB_;\r
\r
static int HighCache2A[41*(TILE_ROWS+1)+1+1]; // caches for high layers\r
static int HighCache2B[41*(TILE_ROWS+1)+1+1];\r
\r
// stuff available in asm:\r
#ifdef _ASM_DRAW_C\r
-void BackFillFull(int reg7);\r
-void DrawLayerFull(int plane, int *hcache, int planestart, int planeend);\r
-void DrawTilesFromCacheF(int *hc);\r
-void DrawWindowFull(int start, int end, int prio);\r
-void DrawSpriteFull(unsigned int *sprite);\r
+void BackFillFull(void *dst, int reg7);\r
+void DrawLayerFull(int plane, int *hcache, int planestart, int planeend,\r
+ struct PicoEState *est);\r
+void DrawTilesFromCacheF(int *hc, struct PicoEState *est);\r
+void DrawWindowFull(int start, int end, int prio, struct PicoEState *est);\r
+void DrawSpriteFull(unsigned int *sprite, struct PicoEState *est);\r
#else\r
\r
\r
\r
\r
// start: (tile_start<<16)|row_start, end: [same]\r
-static void DrawWindowFull(int start, int end, int prio)\r
+static void DrawWindowFull(int start, int end, int prio, struct PicoEState *est)\r
{\r
struct PicoVideo *pvid=&Pico.video;\r
int nametab, nametab_step, trow, tilex, blank=-1, code;\r
- unsigned char *scrpos = PicoDraw2FB;\r
+ unsigned char *scrpos = est->Draw2FB;\r
int tile_start, tile_end; // in cells\r
\r
// parse ranges\r
}\r
\r
\r
-static void DrawLayerFull(int plane, int *hcache, int planestart, int planeend)\r
+static void DrawLayerFull(int plane, int *hcache, int planestart, int planeend,\r
+ struct PicoEState *est)\r
{\r
struct PicoVideo *pvid=&Pico.video;\r
static char shift[4]={5,6,6,7}; // 32,64 or 128 sized tilemaps\r
if (plane==0) nametab=(pvid->reg[2]&0x38)<< 9; // A\r
else nametab=(pvid->reg[4]&0x07)<<12; // B\r
\r
- scrpos = PicoDraw2FB;\r
+ scrpos = est->Draw2FB;\r
scrpos+=8*LINE_WIDTH*(planestart-START_ROW);\r
\r
// Get vertical scroll value:\r
}\r
\r
\r
-static void DrawTilesFromCacheF(int *hc)\r
+static void DrawTilesFromCacheF(int *hc, struct PicoEState *est)\r
{\r
int code, addr, zero = 0;\r
unsigned int prevy=0xFFFFFFFF;\r
// unsigned short *pal;\r
unsigned char pal;\r
short blank=-1; // The tile we know is blank\r
- unsigned char *scrpos = PicoDraw2FB, *pd = 0;\r
+ unsigned char *scrpos = est->Draw2FB, *pd = 0;\r
\r
// *hcache++ = code|(dx<<16)|(trow<<27); // cache it\r
scrpos+=(*hc++)*LINE_WIDTH - START_ROW*LINE_WIDTH*8;\r
\r
\r
// sx and sy are coords of virtual screen with 8pix borders on top and on left\r
-static void DrawSpriteFull(unsigned int *sprite)\r
+static void DrawSpriteFull(unsigned int *sprite, struct PicoEState *est)\r
{\r
int width=0,height=0;\r
// unsigned short *pal=NULL;\r
// goto first vertically visible tile\r
while(sy <= START_ROW*8) { sy+=8; tile+=tdeltay; height--; }\r
\r
- scrpos = PicoDraw2FB;\r
+ scrpos = est->Draw2FB;\r
scrpos+=(sy-START_ROW*8)*LINE_WIDTH;\r
\r
for (; height > 0; height--, sy+=8, tile+=tdeltay)\r
}\r
\r
// Go through sprites backwards:\r
- for (i-- ;i>=0; i--)\r
+ for (i--; i >= 0; i--)\r
{\r
- DrawSpriteFull(sprites[i]);\r
+ DrawSpriteFull(sprites[i], &Pico.est);\r
}\r
}\r
\r
#ifndef _ASM_DRAW_C\r
-static void BackFillFull(int reg7)\r
+static void BackFillFull(void *dst, int reg7)\r
{\r
unsigned int back;\r
\r
// Start with a background color:\r
-// back=PicoCramHigh[reg7&0x3f];\r
back=reg7&0x3f;\r
back|=back<<8;\r
back|=back<<16;\r
\r
- memset32((int *)PicoDraw2FB, back, LINE_WIDTH*(8+(END_ROW-START_ROW)*8)/4);\r
+ memset32(dst, back, LINE_WIDTH*(8+(END_ROW-START_ROW)*8)/4);\r
}\r
#endif\r
\r
static void DrawDisplayFull(void)\r
{\r
+ struct PicoEState *est = &Pico.est;\r
struct PicoVideo *pvid=&Pico.video;\r
int win, edge=0, hvwin=0; // LSb->MSb: hwin&plane, vwin&plane, full\r
int planestart=START_ROW, planeend=END_ROW; // plane A start/end when window shares display with plane A (in tile rows or columns)\r
\r
HighCache2A[1] = HighCache2B[1] = 0;\r
if (PicoDrawMask & PDRAW_LAYERB_ON)\r
- DrawLayerFull(1, HighCache2B, START_ROW, (maxcolc<<16)|END_ROW);\r
+ DrawLayerFull(1, HighCache2B, START_ROW, (maxcolc<<16)|END_ROW, est);\r
if (PicoDrawMask & PDRAW_LAYERA_ON) switch (hvwin)\r
{\r
case 4:\r
// fullscreen window\r
- DrawWindowFull(START_ROW, (maxcolc<<16)|END_ROW, 0);\r
+ DrawWindowFull(START_ROW, (maxcolc<<16)|END_ROW, 0, est);\r
break;\r
\r
case 3:\r
// we have plane A and both v and h windows\r
- DrawLayerFull(0, HighCache2A, planestart, planeend);\r
- DrawWindowFull( winstart&~0xff0000, (winend&~0xff0000)|(maxcolc<<16), 0); // h\r
- DrawWindowFull((winstart&~0xff)|START_ROW, (winend&~0xff)|END_ROW, 0); // v\r
+ DrawLayerFull(0, HighCache2A, planestart, planeend, est);\r
+ DrawWindowFull( winstart&~0xff0000, (winend&~0xff0000)|(maxcolc<<16), 0, est); // h\r
+ DrawWindowFull((winstart&~0xff)|START_ROW, (winend&~0xff)|END_ROW, 0, est); // v\r
break;\r
\r
case 2:\r
case 1:\r
// both window and plane A visible, window is vertical XOR horizontal\r
- DrawLayerFull(0, HighCache2A, planestart, planeend);\r
- DrawWindowFull(winstart, winend, 0);\r
+ DrawLayerFull(0, HighCache2A, planestart, planeend, est);\r
+ DrawWindowFull(winstart, winend, 0, est);\r
break;\r
\r
default:\r
// fullscreen plane A\r
- DrawLayerFull(0, HighCache2A, START_ROW, (maxcolc<<16)|END_ROW);\r
+ DrawLayerFull(0, HighCache2A, START_ROW, (maxcolc<<16)|END_ROW, est);\r
break;\r
}\r
if (PicoDrawMask & PDRAW_SPRITES_LOW_ON)\r
DrawAllSpritesFull(0, maxw);\r
\r
- if (HighCache2B[1]) DrawTilesFromCacheF(HighCache2B);\r
- if (HighCache2A[1]) DrawTilesFromCacheF(HighCache2A);\r
+ if (HighCache2B[1]) DrawTilesFromCacheF(HighCache2B, est);\r
+ if (HighCache2A[1]) DrawTilesFromCacheF(HighCache2A, est);\r
if (PicoDrawMask & PDRAW_LAYERA_ON) switch (hvwin)\r
{\r
case 4:\r
// fullscreen window\r
- DrawWindowFull(START_ROW, (maxcolc<<16)|END_ROW, 1);\r
+ DrawWindowFull(START_ROW, (maxcolc<<16)|END_ROW, 1, est);\r
break;\r
\r
case 3:\r
// we have plane A and both v and h windows\r
- DrawWindowFull( winstart&~0xff0000, (winend&~0xff0000)|(maxcolc<<16), 1); // h\r
- DrawWindowFull((winstart&~0xff)|START_ROW, (winend&~0xff)|END_ROW, 1); // v\r
+ DrawWindowFull( winstart&~0xff0000, (winend&~0xff0000)|(maxcolc<<16), 1, est); // h\r
+ DrawWindowFull((winstart&~0xff)|START_ROW, (winend&~0xff)|END_ROW, 1, est); // v\r
break;\r
\r
case 2:\r
case 1:\r
// both window and plane A visible, window is vertical XOR horizontal\r
- DrawWindowFull(winstart, winend, 1);\r
+ DrawWindowFull(winstart, winend, 1, est);\r
break;\r
}\r
if (PicoDrawMask & PDRAW_SPRITES_HI_ON)\r
if (PicoPrepareCram) PicoPrepareCram();\r
\r
// Draw screen:\r
- BackFillFull(Pico.video.reg[7]);\r
+ BackFillFull(Pico.est.Draw2FB, Pico.video.reg[7]);\r
if (Pico.video.reg[1] & 0x40)\r
DrawDisplayFull();\r
\r
pprof_end(draw);\r
}\r
\r
+void PicoDraw2Init(void)\r
+{\r
+ Pico.est.Draw2FB = PicoDraw2FB_;\r
+}\r
* this is highly specialized, be careful if changing related C code!\r
*/\r
\r
-.extern Pico\r
-.extern PicoDraw2FB\r
+#include "pico_int_o32.h"\r
\r
@ define these constants in your include file:\r
@ .equiv START_ROW, 1\r
.text\r
.align 2\r
\r
-.global BackFillFull @ int reg7\r
+@ void BackFillFull(void *dst, int reg7)\r
+\r
+.global BackFillFull\r
\r
BackFillFull:\r
stmfd sp!, {r4-r9,lr}\r
\r
- ldr lr, =PicoDraw2FB @ lr=PicoDraw2FB\r
- mov r0, r0, lsl #26\r
- ldr lr, [lr]\r
+ add lr, r0, #328*8\r
+ mov r0, r1, lsl #26\r
mov r0, r0, lsr #26\r
- add lr, lr, #328*8\r
\r
orr r0, r0, r0, lsl #8\r
orr r0, r0, r0, lsl #16\r
\r
bne .bff_loop\r
\r
- ldmfd sp!, {r4-r9,r12}\r
- bx r12\r
+ ldmfd sp!, {r4-r9,lr}\r
+ bx lr\r
\r
.pool\r
\r
\r
@ DrawLayerTiles(*hcache, *scrpos, (cells<<24)|(nametab<<9)|(vscroll&0x3ff)<<11|(shift[width]<<8)|planeend, (ymask<<24)|(planestart<<16)|[htab||hscroll]\r
\r
-@static void DrawLayerFull(int plane, int *hcache, int planestart, int planeend)\r
+@ void DrawLayerFull(int plane, int *hcache, int planestart, int planeend,\r
+@ struct PicoEState *est)\r
\r
.global DrawLayerFull\r
\r
DrawLayerFull:\r
+ ldr r12,[sp] @ est\r
stmfd sp!, {r4-r11,lr}\r
\r
mov r6, r1 @ hcache\r
\r
- ldr r11, =(Pico+0x22228) @ Pico.video\r
- ldr r10, =(Pico+0x10000) @ r10=Pico.vram\r
+ ldr r11, [r12, #OFS_Pico_video]\r
+ ldr r10, [r12, #OFS_Pico_vram]\r
ldrb r5, [r11, #13] @ pvid->reg[13]\r
ldrb r7, [r11, #11]\r
\r
and r4, r4, #7\r
orr lr, lr, r4, lsl #13 @ lr|=nametab_bits{3}<<13\r
\r
- ldr r11, =PicoDraw2FB @ r11=PicoDraw2FB\r
+ ldr r11,[sp, #9*4] @ est\r
sub r4, r9, #(START_ROW<<24)\r
- ldr r11, [r11]\r
+ ldr r11, [r11, #OFS_Draw2FB]\r
mov r4, r4, asr #24\r
mov r7, #328*8\r
mla r11, r4, r7, r11 @ scrpos+=8*328*(planestart-START_ROW);\r
.pool\r
\r
\r
+@ void DrawTilesFromCacheF(int *hc, struct PicoEState *est)\r
\r
-.global DrawTilesFromCacheF @ int *hc\r
+.global DrawTilesFromCacheF\r
\r
DrawTilesFromCacheF:\r
stmfd sp!, {r4-r10,lr}\r
mov r9, #0xff000000 @ r9=prevcode=-1\r
mvn r6, #0 @ r6=prevy=-1\r
\r
- ldr r4, =PicoDraw2FB @ r4=PicoDraw2FB\r
- ldr r1, [r0], #4 @ read y offset\r
- ldr r4, [r4]\r
+ ldr r4, [r1, #OFS_Draw2FB]\r
+ ldr r2, [r0], #4 @ read y offset\r
mov r7, #328\r
- mla r1, r7, r1, r4\r
- sub r12, r1, #(328*8*START_ROW) @ r12=scrpos\r
+ mla r2, r7, r2, r4\r
+ sub r12, r2, #(328*8*START_ROW) @ r12=scrpos\r
\r
- ldr r10, =(Pico+0x10000) @ r10=Pico.vram\r
+ ldr r10, [r1, #OFS_Pico_vram]\r
mov r8, r0 @ hc\r
mov r0, #0xf\r
\r
@ @@@@@@@@@@@@@@@\r
\r
@ (tile_start<<16)|row_start\r
-.global DrawWindowFull @ int tstart, int tend, int prio\r
+@ void DrawWindowFull(int start, int end, int prio, struct PicoEState *est)\r
+\r
+.global DrawWindowFull\r
\r
DrawWindowFull:\r
stmfd sp!, {r4-r11,lr}\r
\r
- ldr r11, =(Pico+0x22228) @ Pico.video\r
+ ldr r11, [r3, #OFS_Pico_video]\r
ldrb r12, [r11, #3] @ pvid->reg[3]\r
mov r12, r12, lsl #10\r
\r
and r4, r0, #0xff\r
mla r12, r5, r4, r12 @ nametab += nametab_step*start;\r
\r
+ ldr r10, [r3, #OFS_Pico_vram]\r
mov r4, r0, lsr #16 @ r4=start_cell_h\r
add r7, r12, r4, lsl #1\r
\r
@ fetch the first code now\r
- ldr r10, =(Pico+0x10000) @ lr=Pico.vram\r
ldrh r7, [r10, r7]\r
cmp r2, r7, lsr #15\r
ldmnefd sp!, {r4-r11,pc} @ hack: simply assume that whole window uses same priority\r
\r
mov r9, #0xff000000 @ r9=prevcode=-1\r
\r
- ldr r11, =PicoDraw2FB @ r11=scrpos\r
+ ldr r11, [r3, #OFS_Draw2FB]\r
and r4, r0, #0xff\r
- ldr r11, [r11]\r
- sub r4, r4, #START_ROW\r
add r11, r11, #328*8\r
+ sub r4, r4, #START_ROW\r
add r11, r11, #8\r
\r
mov r7, #328*8\r
b 52b\r
.endm\r
\r
+@ void DrawSpriteFull(unsigned int *sprite, struct PicoEState *est)\r
\r
-.global DrawSpriteFull @ unsigned int *sprite\r
+.global DrawSpriteFull\r
\r
DrawSpriteFull:\r
stmfd sp!, {r4-r11,lr}\r
and r3, lr, #0x6000\r
mov r3, r3, lsr #9 @ r3=pal=((code>>9)&0x30);\r
\r
- ldr r11, =PicoDraw2FB @ r11=scrpos\r
- ldr r10, =(Pico+0x10000) @ r10=Pico.vram\r
- ldr r11, [r11]\r
+ ldr r11, [r1, #OFS_Draw2FB]\r
+ ldr r10, [r1, #OFS_Pico_vram]\r
sub r1, r12, #(START_ROW*8)\r
mov r0, #328\r
mla r11, r1, r0, r11 @ scrpos+=(sy-START_ROW*8)*328;\r
PicoDoHighPal555_nopush:\r
orr r9, r1, r0, lsl #31 @ 0:called from FinalizeLine555, 31: s/h\r
\r
- ldr r0, =HighPal\r
+ add r0, r10, #OFS_HighPal\r
\r
mov r1, #0\r
strb r1, [r8, #-0x1a] @ 0x2220e ~ dirtyPal\r
tst r9, #(1<<31)\r
beq PicoDoHighPal555_end\r
\r
- ldr r3, =HighPal\r
+ add r3, r10, #OFS_HighPal\r
\r
@ shadowed pixels:\r
mov r12, #0x008e\r
bne PicoDoHighPal555_nopush\r
\r
FinalizeLineRGB555_pal_done:\r
- ldr r3, =HighPal\r
+ add r3, r10, #OFS_HighPal\r
\r
ldr r12, [r10, #OFS_rendstatus]\r
eors r0, r0, #1 @ sh is 0\r
void PicoDoHighPal555M4(void)
{
unsigned int *spal=(void *)Pico.cram;
- unsigned int *dpal=(void *)HighPal;
+ unsigned int *dpal=(void *)Pico.est.HighPal;
unsigned int t;
int i;
t |= (t >> 4) & 0x08610861;
*dpal = t;
}
- HighPal[0xe0] = 0;
+ Pico.est.HighPal[0xe0] = 0;
}
static void FinalizeLineRGB555M4(int line)
Pico32xInit();\r
\r
PicoDrawInit();\r
+ PicoDraw2Init();\r
}\r
\r
// to be called once on emu exit\r
#define PDRAW_32_COLS (1<<8) // 32 column mode\r
extern int rendstatus_old;\r
extern int rendlines;\r
-extern unsigned short HighPal[0x100];\r
\r
// draw.c\r
void PicoDrawUpdateHighPal(void);\r
\r
// draw2.c\r
// stuff below is optional\r
-extern unsigned char *PicoDraw2FB; // buffer for fast renderer in format (8+320)x(8+224+8) (eights for borders)\r
extern unsigned short *PicoCramHigh; // pointer to CRAM buff (0x40 shorts), converted to native device color (works only with 16bit for now)\r
extern void (*PicoPrepareCram)(); // prepares PicoCramHigh for renderer to use\r
\r
{\r
int DrawScanline;\r
int rendstatus;\r
- void *DrawLineDest; // draw estination\r
+ void *DrawLineDest; // draw destination\r
unsigned char *HighCol;\r
int *HighPreSpr;\r
void *Pico_video;\r
void *Pico_vram;\r
int *PicoOpt;\r
+ unsigned char *Draw2FB;\r
+ unsigned short HighPal[0x100];\r
};\r
\r
// some assembly stuff depend on these, do not touch!\r
extern int DrawLineDestIncrement;\r
\r
// draw2.c\r
+void PicoDraw2Init(void);\r
PICO_INTERNAL void PicoFrameFull();\r
\r
// mode4.c\r
#define OFS_Pico_video 0x14
#define OFS_Pico_vram 0x18
#define OFS_PicoOpt 0x1c
+#define OFS_Draw2FB 0x20
+#define OFS_HighPal 0x24
}
// a hack for VR
if (PicoAHW & PAHW_SVP)
- memset32((int *)(PicoDraw2FB+328*8+328*223), 0xe0e0e0e0, 328);
+ memset32((int *)(Pico.est.Draw2FB+328*8+328*223), 0xe0e0e0e0, 328);
if (!(Pico.video.reg[12]&1)) lines_flags|=0x10000;
if (currentConfig.EmuOpt&0x4000)
lines_flags|=0x40000; // (Pico.m.frame_count&1)?0x20000:0x40000;
- vidCpy8to16((unsigned short *)giz_screen+321*8, PicoDraw2FB+328*8, localPal, lines_flags);
+ vidCpy8to16((unsigned short *)giz_screen+321*8, Pico.est.Draw2FB+328*8, localPal, lines_flags);
}
else if (!(emu_opt&0x80))
{
if (!(Pico.video.reg[12]&1)) lines_flags|=0x10000;
if (currentConfig.EmuOpt&0x4000)
lines_flags|=0x40000; // (Pico.m.frame_count&1)?0x20000:0x40000;
- vidCpy8to16((unsigned short *)giz_screen+321*8, PicoDraw2FB+328*8, localPal, lines_flags);
+ vidCpy8to16((unsigned short *)giz_screen+321*8, Pico.est.Draw2FB+328*8, localPal, lines_flags);
}
if (notice || (emu_opt & 2)) {
* - 8bpp tile renderer\r
* In 32x mode:\r
* - 32x layer is overlayed on top of 16bpp one\r
- * - line internal one done on PicoDraw2FB, then mixed with 32x\r
- * - tile internal one done on PicoDraw2FB, then mixed with 32x\r
+ * - line internal one done on .Draw2FB, then mixed with 32x\r
+ * - tile internal one done on .Draw2FB, then mixed with 32x\r
*/\r
\r
#include <stdio.h>\r
pallen = 0x100;\r
}\r
else if (Pico.est.rendstatus & PDRAW_SONIC_MODE) { // mid-frame palette changes\r
- bgr444_to_rgb32(localPal+0x40, HighPal);\r
- bgr444_to_rgb32(localPal+0x80, HighPal+0x40);\r
+ bgr444_to_rgb32(localPal+0x40, Pico.est.HighPal);\r
+ bgr444_to_rgb32(localPal+0x80, Pico.est.HighPal+0x40);\r
}\r
else\r
memcpy32(localPal+0x80, localPal, 0x40); // for spr prio mess\r
}\r
// a hack for VR\r
if (PicoAHW & PAHW_SVP)\r
- memset32((int *)(PicoDraw2FB+328*8+328*223), 0xe0e0e0e0, 328);\r
+ memset32((int *)(Pico.est.Draw2FB+328*8+328*223), 0xe0e0e0e0, 328);\r
// do actual copy\r
- vidcpyM2(g_screen_ptr, PicoDraw2FB+328*8,\r
+ vidcpyM2(g_screen_ptr, Pico.est.Draw2FB+328*8,\r
!(Pico.video.reg[12] & 1), !(PicoOpt & POPT_DIS_32C_BORDER));\r
}\r
else if (get_renderer() == RT_8BIT_ACC)\r
{\r
if (currentConfig.renderer != RT_16BIT && !(PicoAHW & PAHW_32X)) {\r
unsigned short *pd = (unsigned short *)g_screen_ptr + 8 * g_screen_width;\r
- unsigned char *ps = PicoDraw2FB + 328*8 + 8;\r
- unsigned short *pal = HighPal;\r
+ unsigned char *ps = Pico.est.Draw2FB + 328*8 + 8;\r
+ unsigned short *pal = Pico.est.HighPal;\r
int i, x;\r
if (Pico.m.dirtyPal)\r
PicoDrawUpdateHighPal();\r
case RT_8BIT_ACC:\r
PicoOpt &= ~POPT_ALT_RENDERER;\r
PicoDrawSetOutFormat(PDF_8BIT, 0);\r
- PicoDrawSetOutBuf(PicoDraw2FB + 8, 328);\r
+ PicoDrawSetOutBuf(Pico.est.Draw2FB + 8, 328);\r
break;\r
case RT_8BIT_FAST:\r
PicoOpt |= POPT_ALT_RENDERER;\r
int sceAudioOutput2GetRestSample();
-//unsigned char *PicoDraw2FB = (unsigned char *)VRAM_CACHED_STUFF + 8; // +8 to be able to skip border with 1 quadword..
+//unsigned char *Draw2FB = (unsigned char *)VRAM_CACHED_STUFF + 8; // +8 to be able to skip border with 1 quadword..
int engineStateSuspend;
#define PICO_PEN_ADJUST_X 4
int i;
unsigned char *pd;
// clear top and bottom trash
- for (pd = PicoDraw2FB+8, i = 8; i > 0; i--, pd += 512)
+ for (pd = Pico.est.Draw2FB+8, i = 8; i > 0; i--, pd += 512)
memset32((int *)pd, 0xe0e0e0e0, 320/4);
- for (pd = PicoDraw2FB+512*232+8, i = 8; i > 0; i--, pd += 512)
+ for (pd = Pico.est.Draw2FB+512*232+8, i = 8; i > 0; i--, pd += 512)
memset32((int *)pd, 0xe0e0e0e0, 320/4);
}
DUMP(f, Pico_video);
DUMP(f, Pico_vram);
DUMP(f, PicoOpt);
+ DUMP(f, Draw2FB);
+ DUMP(f, HighPal);
fclose(f);
return 0;