\r
#define USE_CACHE\r
\r
+// note: this is not implemented in ARM asm\r
+#if defined(DRAW2_OVERRIDE_LINE_WIDTH)\r
+#define LINE_WIDTH DRAW2_OVERRIDE_LINE_WIDTH\r
+#else\r
+#define LINE_WIDTH 328\r
+#endif\r
\r
int currpri = 0;\r
\r
unsigned int pack=0; unsigned int t=0, blank = 1;\r
int i;\r
\r
- for(i=8; i; i--, addr+=2, pd += 320+8) {\r
+ for(i=8; i; i--, addr+=2, pd += LINE_WIDTH) {\r
pack=*(unsigned int *)(Pico.vram+addr); // Get 8 pixels\r
if(!pack) continue;\r
\r
unsigned int pack=0; unsigned int t=0, blank = 1;\r
int i;\r
\r
- for(i=8; i; i--, addr+=2, pd += 320+8) {\r
+ for(i=8; i; i--, addr+=2, pd += LINE_WIDTH) {\r
pack=*(unsigned int *)(Pico.vram+addr); // Get 8 pixels\r
if(!pack) continue;\r
\r
int i;\r
\r
addr+=14;\r
- for(i=8; i; i--, addr-=2, pd += 320+8) {\r
+ for(i=8; i; i--, addr-=2, pd += LINE_WIDTH) {\r
pack=*(unsigned int *)(Pico.vram+addr); // Get 8 pixels\r
if(!pack) continue;\r
\r
int i;\r
\r
addr+=14;\r
- for(i=8; i; i--, addr-=2, pd += 320+8) {\r
+ for(i=8; i; i--, addr-=2, pd += LINE_WIDTH) {\r
pack=*(unsigned int *)(Pico.vram+addr); // Get 8 pixels\r
if(!pack) continue;\r
\r
code=Pico.vram[nametab+tile_start];\r
if ((code>>15) != prio) return; // hack: just assume that whole window uses same priority\r
\r
- scrpos+=8*328+8;\r
- scrpos+=8*328*(start-START_ROW);\r
+ scrpos+=8*LINE_WIDTH+8;\r
+ scrpos+=8*LINE_WIDTH*(start-START_ROW);\r
\r
// do a window until we reach planestart row\r
for(trow = start; trow < end; trow++, nametab+=nametab_step) { // current tile row\r
if(zero) blank=code; // We know this tile is blank now\r
}\r
\r
- scrpos += 328*8;\r
+ scrpos += LINE_WIDTH*8;\r
}\r
}\r
\r
else nametab=(pvid->reg[4]&0x07)<<12; // B\r
\r
scrpos = PicoDraw2FB;\r
- scrpos+=8*328*(planestart-START_ROW);\r
+ scrpos+=8*LINE_WIDTH*(planestart-START_ROW);\r
\r
// Get vertical scroll value:\r
vscroll=Pico.vsram[plane]&0x1ff;\r
- scrpos+=(8-(vscroll&7))*328;\r
+ scrpos+=(8-(vscroll&7))*LINE_WIDTH;\r
if(vscroll&7) planeend++; // we have vertically clipped tiles due to vscroll, so we need 1 more row\r
\r
*hcache++ = 8-(vscroll&7); // push y-offset to tilecache\r
if(zero) blank=code; // We know this tile is blank now\r
}\r
\r
- scrpos += 328*8;\r
+ scrpos += LINE_WIDTH*8;\r
}\r
\r
*hcache = 0; // terminate cache\r
unsigned char *scrpos = PicoDraw2FB, *pd = 0;\r
\r
// *hcache++ = code|(dx<<16)|(trow<<27); // cache it\r
- scrpos+=(*hc++)*328 - START_ROW*328*8;\r
+ scrpos+=(*hc++)*LINE_WIDTH - START_ROW*LINE_WIDTH*8;\r
\r
while((code=*hc++)) {\r
if((short)code == blank) continue;\r
// y pos\r
if(((unsigned)code>>27) != prevy) {\r
prevy = (unsigned)code>>27;\r
- pd = scrpos + prevy*328*8;\r
+ pd = scrpos + prevy*LINE_WIDTH*8;\r
}\r
\r
// Get tile address/2:\r
while(sy <= START_ROW*8) { sy+=8; tile+=tdeltay; height--; }\r
\r
scrpos = PicoDraw2FB;\r
- scrpos+=(sy-START_ROW*8)*328;\r
+ scrpos+=(sy-START_ROW*8)*LINE_WIDTH;\r
\r
for (; height > 0; height--, sy+=8, tile+=tdeltay)\r
{\r
}\r
}\r
\r
- scrpos+=8*328;\r
+ scrpos+=8*LINE_WIDTH;\r
}\r
}\r
#endif\r
back|=back<<8;\r
back|=back<<16;\r
\r
- for(i = (8+320)*(8+(END_ROW-START_ROW)*8)/16; i; i--) {\r
+ for(i = LINE_WIDTH*(8+(END_ROW-START_ROW)*8)/16; i; i--) {\r
*p++ = back; // do 16 pixels per iteration\r
*p++ = back;\r
*p++ = back;\r