mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
core, fixes and improvements for type issues
This commit is contained in:
parent
107cdd508b
commit
15eed40550
9 changed files with 128 additions and 126 deletions
138
pico/draw.c
138
pico/draw.c
|
@ -53,15 +53,15 @@ static unsigned char DefHighCol[8+320+8];
|
|||
unsigned char *HighColBase = DefHighCol;
|
||||
int HighColIncrement;
|
||||
|
||||
static unsigned int DefOutBuff[320*2/2];
|
||||
static u16 DefOutBuff[320*2];
|
||||
void *DrawLineDestBase = DefOutBuff;
|
||||
int DrawLineDestIncrement;
|
||||
|
||||
static int HighCacheA[41*2+1]; // caches for high layers
|
||||
static int HighCacheB[41*2+1];
|
||||
static int HighPreSpr[80*2+1]; // slightly preprocessed sprites
|
||||
static u32 HighCacheA[41*2+1]; // caches for high layers
|
||||
static u32 HighCacheB[41*2+1];
|
||||
static u32 HighPreSpr[80*2+1]; // slightly preprocessed sprites
|
||||
|
||||
unsigned int VdpSATCache[128]; // VDP sprite cache (1st 32 sprite attr bits)
|
||||
u32 VdpSATCache[128]; // VDP sprite cache (1st 32 sprite attr bits)
|
||||
|
||||
// NB don't change any defines without checking their usage in ASM
|
||||
|
||||
|
@ -104,7 +104,7 @@ struct TileStrip
|
|||
int line; // Line number in pixels 0x000-0x3ff within the virtual tilemap
|
||||
int hscroll; // Horizontal scroll value in pixels for the line
|
||||
int xmask; // X-Mask (0x1f - 0x7f) for horizontal wraparound in the tilemap
|
||||
int *hc; // cache for high tile codes and their positions
|
||||
u32 *hc; // cache for high tile codes and their positions
|
||||
int cells; // cells (tiles) to draw (32 col mode doesn't need to update whole 320)
|
||||
};
|
||||
|
||||
|
@ -114,10 +114,10 @@ void DrawWindow(int tstart, int tend, int prio, int sh,
|
|||
struct PicoEState *est);
|
||||
void DrawAllSprites(unsigned char *sprited, int prio, int sh,
|
||||
struct PicoEState *est);
|
||||
void DrawTilesFromCache(int *hc, int sh, int rlim,
|
||||
void DrawTilesFromCache(u32 *hc, int sh, int rlim,
|
||||
struct PicoEState *est);
|
||||
void DrawSpritesSHi(unsigned char *sprited, struct PicoEState *est);
|
||||
void DrawLayer(int plane_sh, int *hcache, int cellskip, int maxcells,
|
||||
void DrawLayer(int plane_sh, u32 *hcache, int cellskip, int maxcells,
|
||||
struct PicoEState *est);
|
||||
void *blockcpy(void *dst, const void *src, size_t n);
|
||||
void blockcpy_or(void *dst, void *src, size_t n, int pat);
|
||||
|
@ -134,7 +134,7 @@ void blockcpy_or(void *dst, void *src, size_t n, int pat)
|
|||
|
||||
#define TileNormMaker_(pix_func,ret) \
|
||||
{ \
|
||||
unsigned int t; \
|
||||
unsigned char t; \
|
||||
\
|
||||
t = (pack&0x0000f000)>>12; pix_func(0); \
|
||||
t = (pack&0x00000f00)>> 8; pix_func(1); \
|
||||
|
@ -149,7 +149,7 @@ void blockcpy_or(void *dst, void *src, size_t n, int pat)
|
|||
|
||||
#define TileFlipMaker_(pix_func,ret) \
|
||||
{ \
|
||||
unsigned int t; \
|
||||
unsigned char t; \
|
||||
\
|
||||
t = (pack&0x000f0000)>>16; pix_func(0); \
|
||||
t = (pack&0x00f00000)>>20; pix_func(1); \
|
||||
|
@ -163,24 +163,24 @@ void blockcpy_or(void *dst, void *src, size_t n, int pat)
|
|||
}
|
||||
|
||||
#define TileNormMaker(funcname, pix_func) \
|
||||
static void funcname(unsigned char *pd, unsigned int pack, int pal) \
|
||||
static void funcname(unsigned char *pd, unsigned int pack, unsigned char pal) \
|
||||
TileNormMaker_(pix_func,)
|
||||
|
||||
#define TileFlipMaker(funcname, pix_func) \
|
||||
static void funcname(unsigned char *pd, unsigned int pack, int pal) \
|
||||
static void funcname(unsigned char *pd, unsigned int pack, unsigned char pal) \
|
||||
TileFlipMaker_(pix_func,)
|
||||
|
||||
#define TileNormMakerAS(funcname, pix_func) \
|
||||
static unsigned funcname(unsigned m, unsigned char *pd, unsigned int pack, int pal) \
|
||||
static unsigned funcname(unsigned m, unsigned char *pd, unsigned int pack, unsigned char pal) \
|
||||
TileNormMaker_(pix_func,m)
|
||||
|
||||
#define TileFlipMakerAS(funcname, pix_func) \
|
||||
static unsigned funcname(unsigned m, unsigned char *pd, unsigned int pack, int pal) \
|
||||
static unsigned funcname(unsigned m, unsigned char *pd, unsigned int pack, unsigned char pal) \
|
||||
TileFlipMaker_(pix_func,m)
|
||||
|
||||
// draw layer or non-s/h sprite pixels (no operator colors)
|
||||
#define pix_just_write(x) \
|
||||
if (t) pd[x]=pal|t
|
||||
if (likely(t)) pd[x]=pal|t
|
||||
|
||||
TileNormMaker(TileNorm, pix_just_write)
|
||||
TileFlipMaker(TileFlip, pix_just_write)
|
||||
|
@ -189,28 +189,26 @@ TileFlipMaker(TileFlip, pix_just_write)
|
|||
|
||||
// draw low prio sprite non-s/h pixels in s/h mode
|
||||
#define pix_nonsh(x) \
|
||||
if (t == 0xe) pd[x]=(pal|t)&~0x80; /* disable shadow for color 14 (hw bug?) */ \
|
||||
else if (t) pd[x]=pal|t
|
||||
if (likely(t)) { \
|
||||
pd[x]=pal|t; \
|
||||
if (unlikely(t==0xe)) pd[x]&=~0x80; /* disable shadow for color 14 (hw bug?) */ \
|
||||
}
|
||||
|
||||
TileNormMaker(TileNormNonSH, pix_nonsh)
|
||||
TileFlipMaker(TileFlipNonSH, pix_nonsh)
|
||||
|
||||
// draw sprite pixels, process operator colors
|
||||
#define pix_sh(x) \
|
||||
if (t) { \
|
||||
if (t>=0xe) pd[x]|=(t-1)<<6; /* 80 shadow, 40 hilight */ \
|
||||
else pd[x]=pal|t; \
|
||||
}
|
||||
if (likely(t)) \
|
||||
pd[x]=(likely(t<0xe) ? pal|t : pd[x]|((t-1)<<6));
|
||||
|
||||
TileNormMaker(TileNormSH, pix_sh)
|
||||
TileFlipMaker(TileFlipSH, pix_sh)
|
||||
|
||||
// draw sprite pixels, mark but don't process operator colors
|
||||
#define pix_sh_markop(x) \
|
||||
if (t) { \
|
||||
if (t>=0xe) pd[x]|=0x40; \
|
||||
else pd[x]=pal|t; \
|
||||
}
|
||||
if (likely(t)) \
|
||||
pd[x]=(likely(t<0xe) ? pal|t : pd[x]|0x40);
|
||||
|
||||
TileNormMaker(TileNormSH_markop, pix_sh_markop)
|
||||
TileFlipMaker(TileFlipSH_markop, pix_sh_markop)
|
||||
|
@ -219,7 +217,7 @@ TileFlipMaker(TileFlipSH_markop, pix_sh_markop)
|
|||
|
||||
// draw low prio sprite operator pixels if visible (i.e. marked)
|
||||
#define pix_sh_onlyop(x) \
|
||||
if (t>=0xe && (pd[x]&0x40)) \
|
||||
if (unlikely(t>=0xe && (pd[x]&0x40))) \
|
||||
pd[x]=(pd[x]&~0x40)|((t-1)<<6)
|
||||
|
||||
#ifndef _ASM_DRAW_C
|
||||
|
@ -233,7 +231,8 @@ TileFlipMaker(TileFlipSH_onlyop_lp, pix_sh_onlyop)
|
|||
|
||||
// draw high prio sprite pixels (AS)
|
||||
#define pix_as(x) \
|
||||
if (t && (m & (1<<(x+8)))) m &= ~(1<<(x+8)), pd[x] = pal | t
|
||||
if (likely(t && (m & (1<<(x+8))))) \
|
||||
m &= ~(1<<(x+8)), pd[x] = pal|t
|
||||
|
||||
TileNormMakerAS(TileNormAS, pix_as)
|
||||
TileFlipMakerAS(TileFlipAS, pix_as)
|
||||
|
@ -241,10 +240,9 @@ TileFlipMakerAS(TileFlipAS, pix_as)
|
|||
// draw high prio sprite pixels, process operator colors (AS)
|
||||
// NB sprite+planes: h+s->n, h+[nh]->h, s+[nhs]->s, hence mask h before op
|
||||
#define pix_sh_as(x) \
|
||||
if (t && (m & (1<<(x+8)))) { \
|
||||
if (likely(t && (m & (1<<(x+8))))) { \
|
||||
m &= ~(1<<(x+8)); \
|
||||
if (t>=0xe) pd[x]=(pd[x]&~0x40)|((t-1)<<6); \
|
||||
else pd[x] = pal | t; \
|
||||
pd[x]=(likely(t<0xe) ? pal|t : (pd[x]&~0x40)|((t-1)<<6)); \
|
||||
}
|
||||
|
||||
TileNormMakerAS(TileNormSH_AS, pix_sh_as)
|
||||
|
@ -252,7 +250,7 @@ TileFlipMakerAS(TileFlipSH_AS, pix_sh_as)
|
|||
|
||||
// draw only sprite operator pixels (AS)
|
||||
#define pix_sh_as_onlyop(x) \
|
||||
if (t && (m & (1<<(x+8)))) { \
|
||||
if (likely(t && (m & (1<<(x+8))))) { \
|
||||
m &= ~(1<<(x+8)); \
|
||||
pix_sh_onlyop(x); \
|
||||
}
|
||||
|
@ -262,7 +260,7 @@ TileFlipMakerAS(TileFlipSH_AS_onlyop_lp, pix_sh_as_onlyop)
|
|||
|
||||
// mark low prio sprite pixels (AS)
|
||||
#define pix_sh_as_onlymark(x) \
|
||||
if (t) m &= ~(1<<(x+8))
|
||||
if (likely(t)) m &= ~(1<<(x+8))
|
||||
|
||||
TileNormMakerAS(TileNormAS_onlymark, pix_sh_as_onlymark)
|
||||
TileFlipMakerAS(TileFlipAS_onlymark, pix_sh_as_onlymark)
|
||||
|
@ -272,7 +270,7 @@ TileFlipMakerAS(TileFlipAS_onlymark, pix_sh_as_onlymark)
|
|||
// forced both layer draw (through debug reg)
|
||||
#define pix_and(x) \
|
||||
pal |= 0xc0; /* leave s/h bits untouched in pixel "and" */ \
|
||||
pd[x] &= pal | t
|
||||
pd[x] &= pal|t
|
||||
|
||||
TileNormMaker(TileNorm_and, pix_and)
|
||||
TileFlipMaker(TileFlip_and, pix_and)
|
||||
|
@ -280,9 +278,9 @@ TileFlipMaker(TileFlip_and, pix_and)
|
|||
// forced sprite draw (through debug reg)
|
||||
#define pix_sh_as_and(x) \
|
||||
pal |= 0xc0; /* leave s/h bits untouched in pixel "and" */ \
|
||||
if (m & (1<<(x+8))) { \
|
||||
if (likely(m & (1<<(x+8)))) { \
|
||||
m &= ~(1<<(x+8)); \
|
||||
if (t<0xe) pd[x] &= pal | t; \
|
||||
if (t<0xe) pd[x] &= pal|t; \
|
||||
}
|
||||
|
||||
TileNormMakerAS(TileNormSH_AS_and, pix_sh_as_and)
|
||||
|
@ -295,7 +293,7 @@ TileFlipMakerAS(TileFlipSH_AS_and, pix_sh_as_and)
|
|||
static void DrawStrip(struct TileStrip *ts, int lflags, int cellskip)
|
||||
{
|
||||
unsigned char *pd = Pico.est.HighCol;
|
||||
int *hc = ts->hc;
|
||||
u32 *hc = ts->hc;
|
||||
int tilex, dx, ty, cells;
|
||||
int oldcode = -1, blank = -1; // The tile we know is blank
|
||||
unsigned int pal = 0, pack = 0, sh;
|
||||
|
@ -329,7 +327,7 @@ static void DrawStrip(struct TileStrip *ts, int lflags, int cellskip)
|
|||
|
||||
pal = ((code>>9)&0x30) | sh; // shadow
|
||||
|
||||
pack = *(unsigned int *)(PicoMem.vram + addr);
|
||||
pack = *(u32 *)(PicoMem.vram + addr);
|
||||
if (!pack)
|
||||
blank = code;
|
||||
}
|
||||
|
@ -356,7 +354,7 @@ static void DrawStrip(struct TileStrip *ts, int lflags, int cellskip)
|
|||
static void DrawStripVSRam(struct TileStrip *ts, int plane_sh, int cellskip)
|
||||
{
|
||||
unsigned char *pd = Pico.est.HighCol;
|
||||
int *hc = ts->hc;
|
||||
u32 *hc = ts->hc;
|
||||
int tilex, dx, ty = 0, addr = 0, cell = 0, nametabadd = 0;
|
||||
int oldcode = -1, blank = -1; // The tile we know is blank
|
||||
unsigned int pal = 0, scan = Pico.est.DrawScanline, sh, plane;
|
||||
|
@ -418,7 +416,7 @@ static void DrawStripVSRam(struct TileStrip *ts, int plane_sh, int cellskip)
|
|||
}
|
||||
|
||||
pack = (code & 0x1000 ? ty^0xe : ty); // Y-flip
|
||||
pack = *(unsigned int *)(PicoMem.vram + addr+pack);
|
||||
pack = *(u32 *)(PicoMem.vram + addr+pack);
|
||||
if (!pack)
|
||||
blank = code;
|
||||
|
||||
|
@ -445,7 +443,7 @@ static
|
|||
void DrawStripInterlace(struct TileStrip *ts, int plane_sh)
|
||||
{
|
||||
unsigned char *pd = Pico.est.HighCol;
|
||||
int *hc = ts->hc;
|
||||
u32 *hc = ts->hc;
|
||||
int tilex = 0, dx = 0, ty = 0, cells;
|
||||
int oldcode = -1, blank = -1; // The tile we know is blank
|
||||
unsigned int pal = 0, pack = 0, sh;
|
||||
|
@ -478,7 +476,7 @@ void DrawStripInterlace(struct TileStrip *ts, int plane_sh)
|
|||
|
||||
pal = ((code>>9)&0x30) | sh; // shadow
|
||||
|
||||
pack = *(unsigned int *)(PicoMem.vram + addr);
|
||||
pack = *(u32 *)(PicoMem.vram + addr);
|
||||
if (!pack)
|
||||
blank = code;
|
||||
}
|
||||
|
@ -504,7 +502,7 @@ void DrawStripInterlace(struct TileStrip *ts, int plane_sh)
|
|||
// --------------------------------------------
|
||||
|
||||
#ifndef _ASM_DRAW_C
|
||||
static void DrawLayer(int plane_sh, int *hcache, int cellskip, int maxcells,
|
||||
static void DrawLayer(int plane_sh, u32 *hcache, int cellskip, int maxcells,
|
||||
struct PicoEState *est)
|
||||
{
|
||||
struct PicoVideo *pvid=&Pico.video;
|
||||
|
@ -628,7 +626,7 @@ static void DrawWindow(int tstart, int tend, int prio, int sh,
|
|||
addr=(code&0x7ff)<<4;
|
||||
if (code&0x1000) addr+=14-ty; else addr+=ty; // Y-flip
|
||||
|
||||
pack = *(unsigned int *)(PicoMem.vram + addr);
|
||||
pack = *(u32 *)(PicoMem.vram + addr);
|
||||
if (!pack) {
|
||||
blank = code;
|
||||
continue;
|
||||
|
@ -670,7 +668,7 @@ static void DrawWindow(int tstart, int tend, int prio, int sh,
|
|||
addr=(code&0x7ff)<<4;
|
||||
if (code&0x1000) addr+=14-ty; else addr+=ty; // Y-flip
|
||||
|
||||
pack = *(unsigned int *)(PicoMem.vram + addr);
|
||||
pack = *(u32 *)(PicoMem.vram + addr);
|
||||
if (!pack) {
|
||||
blank = code;
|
||||
continue;
|
||||
|
@ -699,7 +697,7 @@ static void DrawTilesFromCacheShPrep(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void DrawTilesFromCache(int *hc, int sh, int rlim, struct PicoEState *est)
|
||||
static void DrawTilesFromCache(u32 *hc, int sh, int rlim, struct PicoEState *est)
|
||||
{
|
||||
unsigned char *pd = Pico.est.HighCol;
|
||||
int code, dx;
|
||||
|
@ -797,12 +795,13 @@ last_cut_tile:
|
|||
// Index + 0 : hhhhvvvv ab--hhvv yyyyyyyy yyyyyyyy // a: offscreen h, b: offs. v, h: horiz. size
|
||||
// Index + 4 : xxxxxxxx xxxxxxxx pccvhnnn nnnnnnnn // x: x coord + 8
|
||||
|
||||
static void DrawSprite(int *sprite, int sh, int w)
|
||||
static void DrawSprite(u32 *sprite, int sh, int w)
|
||||
{
|
||||
void (*fTileFunc)(unsigned char *pd, unsigned int pack, int pal);
|
||||
void (*fTileFunc)(unsigned char *pd, unsigned int pack, unsigned char pal);
|
||||
unsigned char *pd = Pico.est.HighCol;
|
||||
int width=0,height=0;
|
||||
int row=0,code=0;
|
||||
int row=0;
|
||||
u32 code=0;
|
||||
int pal;
|
||||
int tile=0,delta=0;
|
||||
int sx, sy;
|
||||
|
@ -848,7 +847,7 @@ static void DrawSprite(int *sprite, int sh, int w)
|
|||
if(sx<=0) continue;
|
||||
if(sx>=328) break; // Offscreen
|
||||
|
||||
pack = *(unsigned int *)(PicoMem.vram + (tile & 0x7fff));
|
||||
pack = *(u32 *)(PicoMem.vram + (tile & 0x7fff));
|
||||
fTileFunc(pd + sx, pack, pal);
|
||||
}
|
||||
}
|
||||
|
@ -894,7 +893,7 @@ static void DrawSpriteInterlace(unsigned int *sprite)
|
|||
if(sx<=0) continue;
|
||||
if(sx>=328) break; // Offscreen
|
||||
|
||||
pack = *(unsigned int *)(PicoMem.vram + (tile & 0x7fff));
|
||||
pack = *(u32 *)(PicoMem.vram + (tile & 0x7fff));
|
||||
if (code & 0x0800) TileFlip(pd + sx, pack, pal);
|
||||
else TileNorm(pd + sx, pack, pal);
|
||||
}
|
||||
|
@ -917,7 +916,7 @@ static NOINLINE void DrawAllSpritesInterlace(int pri, int sh)
|
|||
unsigned int *sprite;
|
||||
int code, sx, sy, height;
|
||||
|
||||
sprite=(unsigned int *)(PicoMem.vram+((table+(link<<2))&0x7ffc)); // Find sprite
|
||||
sprite=(u32 *)(PicoMem.vram+((table+(link<<2))&0x7ffc)); // Find sprite
|
||||
|
||||
// get sprite info
|
||||
code = sprite[0];
|
||||
|
@ -959,11 +958,11 @@ static NOINLINE void DrawAllSpritesInterlace(int pri, int sh)
|
|||
*/
|
||||
static void DrawSpritesSHi(unsigned char *sprited, const struct PicoEState *est)
|
||||
{
|
||||
static void (*tilefuncs[2][2][2])(unsigned char *, unsigned, int) = {
|
||||
static void (*tilefuncs[2][2][2])(unsigned char *, unsigned, unsigned char) = {
|
||||
{ {NULL, NULL}, {TileNorm, TileFlip} },
|
||||
{ {TileNormSH_onlyop_lp, TileFlipSH_onlyop_lp}, {TileNormSH, TileFlipSH} }
|
||||
}; // [sh?][hi?][flip?]
|
||||
void (*fTileFunc)(unsigned char *pd, unsigned int pack, int pal);
|
||||
void (*fTileFunc)(unsigned char *pd, unsigned int pack, unsigned char pal);
|
||||
unsigned char *pd = Pico.est.HighCol;
|
||||
unsigned char *p;
|
||||
int cnt, w;
|
||||
|
@ -979,7 +978,8 @@ static void DrawSpritesSHi(unsigned char *sprited, const struct PicoEState *est)
|
|||
w = p[cnt]; // possibly clipped width of last sprite
|
||||
for (cnt--; cnt >= 0; cnt--, w = 0)
|
||||
{
|
||||
int *sprite, code, pal, tile, sx, sy;
|
||||
u32 *sprite, code;
|
||||
int pal, tile, sx, sy;
|
||||
int offs, delta, width, height, row;
|
||||
|
||||
offs = (p[cnt] & 0x7f) * 2;
|
||||
|
@ -1016,7 +1016,7 @@ static void DrawSpritesSHi(unsigned char *sprited, const struct PicoEState *est)
|
|||
if(sx<=0) continue;
|
||||
if(sx>=328) break; // Offscreen
|
||||
|
||||
pack = *(unsigned int *)(PicoMem.vram + (tile & 0x7fff));
|
||||
pack = *(u32 *)(PicoMem.vram + (tile & 0x7fff));
|
||||
fTileFunc(pd + sx, pack, pal);
|
||||
}
|
||||
}
|
||||
|
@ -1025,11 +1025,11 @@ static void DrawSpritesSHi(unsigned char *sprited, const struct PicoEState *est)
|
|||
|
||||
static void DrawSpritesHiAS(unsigned char *sprited, int sh)
|
||||
{
|
||||
static unsigned (*tilefuncs[2][2][2])(unsigned, unsigned char *, unsigned, int) = {
|
||||
static unsigned (*tilefuncs[2][2][2])(unsigned, unsigned char *, unsigned, unsigned char) = {
|
||||
{ {TileNormAS_onlymark, TileFlipAS_onlymark}, {TileNormAS, TileFlipAS} },
|
||||
{ {TileNormSH_AS_onlyop_lp, TileFlipSH_AS_onlyop_lp}, {TileNormSH_AS, TileFlipSH_AS} }
|
||||
}; // [sh?][hi?][flip?]
|
||||
unsigned (*fTileFunc)(unsigned m, unsigned char *pd, unsigned int pack, int pal);
|
||||
unsigned (*fTileFunc)(unsigned m, unsigned char *pd, unsigned int pack, unsigned char pal);
|
||||
unsigned char *pd = Pico.est.HighCol;
|
||||
unsigned char mb[sizeof(DefHighCol)/8];
|
||||
unsigned char *p, *mp;
|
||||
|
@ -1047,7 +1047,8 @@ static void DrawSpritesHiAS(unsigned char *sprited, int sh)
|
|||
// Go through sprites:
|
||||
for (entry = 0; entry < cnt; entry++)
|
||||
{
|
||||
int *sprite, code, pal, tile, sx, sy;
|
||||
u32 *sprite, code;
|
||||
int pal, tile, sx, sy;
|
||||
int offs, delta, width, height, row;
|
||||
|
||||
offs = (p[entry] & 0x7f) * 2;
|
||||
|
@ -1084,7 +1085,7 @@ static void DrawSpritesHiAS(unsigned char *sprited, int sh)
|
|||
|
||||
if(sx>=328) break; // Offscreen
|
||||
|
||||
pack = *(unsigned int *)(PicoMem.vram + (tile & 0x7fff));
|
||||
pack = *(u32 *)(PicoMem.vram + (tile & 0x7fff));
|
||||
|
||||
m |= mp[1] << 8; // next mask byte
|
||||
// shift mask bits to bits 8-15 for easier load/store handling
|
||||
|
@ -1127,7 +1128,7 @@ static void DrawStripForced(struct TileStrip *ts, int cellskip)
|
|||
pal = (code>>9)&0x30;
|
||||
}
|
||||
|
||||
pack = *(unsigned int *)(PicoMem.vram + addr);
|
||||
pack = *(u32 *)(PicoMem.vram + addr);
|
||||
|
||||
if (code & 0x0800) TileFlip_and(pd + dx, pack, pal);
|
||||
else TileNorm_and(pd + dx, pack, pal);
|
||||
|
@ -1191,7 +1192,7 @@ static void DrawStripVSRamForced(struct TileStrip *ts, int plane_sh, int cellski
|
|||
}
|
||||
|
||||
pack = code & 0x1000 ? ty^0xe : ty; // Y-flip
|
||||
pack = *(unsigned int *)(PicoMem.vram + addr+pack);
|
||||
pack = *(u32 *)(PicoMem.vram + addr+pack);
|
||||
|
||||
if (code & 0x0800) TileFlip_and(pd + dx, pack, pal);
|
||||
else TileNorm_and(pd + dx, pack, pal);
|
||||
|
@ -1225,7 +1226,7 @@ void DrawStripInterlaceForced(struct TileStrip *ts)
|
|||
|
||||
pal = (code>>9)&0x30; // shadow
|
||||
|
||||
pack = *(unsigned int *)(PicoMem.vram + addr);
|
||||
pack = *(u32 *)(PicoMem.vram + addr);
|
||||
}
|
||||
|
||||
if (code & 0x0800) TileFlip_and(pd + dx, pack, pal);
|
||||
|
@ -1305,7 +1306,7 @@ static void DrawLayerForced(int plane_sh, int cellskip, int maxcells,
|
|||
|
||||
static void DrawSpritesForced(unsigned char *sprited)
|
||||
{
|
||||
unsigned (*fTileFunc)(unsigned m, unsigned char *pd, unsigned int pack, int pal);
|
||||
unsigned (*fTileFunc)(unsigned m, unsigned char *pd, unsigned int pack, unsigned char pal);
|
||||
unsigned char *pd = Pico.est.HighCol;
|
||||
unsigned char mb[sizeof(DefHighCol)/8];
|
||||
unsigned char *p, *mp;
|
||||
|
@ -1323,7 +1324,8 @@ static void DrawSpritesForced(unsigned char *sprited)
|
|||
// Go through sprites:
|
||||
for (entry = 0; entry < cnt; entry++)
|
||||
{
|
||||
int *sprite, code, pal, tile, sx, sy;
|
||||
u32 *sprite, code;
|
||||
int pal, tile, sx, sy;
|
||||
int offs, delta, width, height, row;
|
||||
|
||||
offs = (p[entry] & 0x7f) * 2;
|
||||
|
@ -1361,7 +1363,7 @@ static void DrawSpritesForced(unsigned char *sprited)
|
|||
|
||||
if(sx>=328) break; // Offscreen
|
||||
|
||||
pack = *(unsigned int *)(PicoMem.vram + (tile & 0x7fff));
|
||||
pack = *(u32 *)(PicoMem.vram + (tile & 0x7fff));
|
||||
|
||||
m |= mp[1] << 8; // next mask byte
|
||||
// shift mask bits to bits 8-15 for easier load/store handling
|
||||
|
@ -1395,7 +1397,7 @@ static NOINLINE void PrepareSprites(int max_lines)
|
|||
const struct PicoEState *est=&Pico.est;
|
||||
int u,link=0,sh;
|
||||
int table=0;
|
||||
int *pd = HighPreSpr;
|
||||
u32 *pd = HighPreSpr;
|
||||
int max_sprites = 80, max_width = 328;
|
||||
int max_line_sprites = 20; // 20 sprites, 40 tiles
|
||||
|
||||
|
@ -1418,7 +1420,7 @@ static NOINLINE void PrepareSprites(int max_lines)
|
|||
unsigned int *sprite;
|
||||
int code, code2, sx, sy, hv, height, width;
|
||||
|
||||
sprite=(unsigned int *)(PicoMem.vram+((table+(link<<2))&0x7ffc)); // Find sprite
|
||||
sprite=(u32 *)(PicoMem.vram+((table+(link<<2))&0x7ffc)); // Find sprite
|
||||
|
||||
// parse sprite info. the 1st half comes from the VDPs internal cache,
|
||||
// the 2nd half is read from VRAM
|
||||
|
@ -1521,7 +1523,7 @@ static void DrawAllSprites(unsigned char *sprited, int prio, int sh,
|
|||
w = p[cnt]; // possibly clipped width of last sprite
|
||||
for (cnt--; cnt >= 0; cnt--, w = 0)
|
||||
{
|
||||
int *sp = HighPreSpr + (p[cnt]&0x7f) * 2;
|
||||
u32 *sp = HighPreSpr + (p[cnt]&0x7f) * 2;
|
||||
if ((p[cnt] >> 7) != prio) continue;
|
||||
DrawSprite(sp, sh, w);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue