mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
sms mode 4, fix 8 bit renderer code
This commit is contained in:
parent
2e5cbf5b6a
commit
7980d47767
4 changed files with 35 additions and 14 deletions
10
pico/draw.c
10
pico/draw.c
|
@ -36,8 +36,8 @@ int (*PicoScanBegin)(unsigned int num) = NULL;
|
||||||
int (*PicoScanEnd) (unsigned int num) = NULL;
|
int (*PicoScanEnd) (unsigned int num) = NULL;
|
||||||
|
|
||||||
static unsigned char DefHighCol[8+320+8];
|
static unsigned char DefHighCol[8+320+8];
|
||||||
static unsigned char *HighColBase = DefHighCol;
|
unsigned char *HighColBase = DefHighCol;
|
||||||
static int HighColIncrement;
|
int HighColIncrement;
|
||||||
|
|
||||||
static unsigned int DefOutBuff[320*2/2];
|
static unsigned int DefOutBuff[320*2/2];
|
||||||
void *DrawLineDestBase = DefOutBuff;
|
void *DrawLineDestBase = DefOutBuff;
|
||||||
|
@ -1848,7 +1848,9 @@ void PicoDrawUpdateHighPal(void)
|
||||||
if ((PicoIn.opt & POPT_ALT_RENDERER) | (est->rendstatus & PDRAW_SONIC_MODE))
|
if ((PicoIn.opt & POPT_ALT_RENDERER) | (est->rendstatus & PDRAW_SONIC_MODE))
|
||||||
sh = 0; // no s/h support
|
sh = 0; // no s/h support
|
||||||
|
|
||||||
if (FinalizeLine == FinalizeLine8bit)
|
if (PicoIn.AHW & PAHW_SMS)
|
||||||
|
PicoDoHighPal555M4();
|
||||||
|
else if (FinalizeLine == FinalizeLine8bit)
|
||||||
PicoDoHighPal555_8bit(sh, 0, est);
|
PicoDoHighPal555_8bit(sh, 0, est);
|
||||||
else
|
else
|
||||||
PicoDoHighPal555(sh, 0, est);
|
PicoDoHighPal555(sh, 0, est);
|
||||||
|
@ -1863,6 +1865,7 @@ void PicoDrawUpdateHighPal(void)
|
||||||
|
|
||||||
void PicoDrawSetOutFormat(pdso_t which, int use_32x_line_mode)
|
void PicoDrawSetOutFormat(pdso_t which, int use_32x_line_mode)
|
||||||
{
|
{
|
||||||
|
PicoDrawSetInternalBuf(NULL, 0);
|
||||||
switch (which)
|
switch (which)
|
||||||
{
|
{
|
||||||
case PDF_8BIT:
|
case PDF_8BIT:
|
||||||
|
@ -1878,6 +1881,7 @@ void PicoDrawSetOutFormat(pdso_t which, int use_32x_line_mode)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
FinalizeLine = NULL;
|
FinalizeLine = NULL;
|
||||||
|
PicoDrawSetOutBufMD(Pico.est.Draw2FB+8, 328);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (PicoIn.AHW & PAHW_32X)
|
if (PicoIn.AHW & PAHW_32X)
|
||||||
|
|
17
pico/mode4.c
17
pico/mode4.c
|
@ -69,6 +69,8 @@ static void draw_sprites(int scanline)
|
||||||
|
|
||||||
if (pv->reg[0] & 8)
|
if (pv->reg[0] & 8)
|
||||||
xoff = 0;
|
xoff = 0;
|
||||||
|
if (!(PicoIn.opt & POPT_DIS_32C_BORDER))
|
||||||
|
xoff += 32;
|
||||||
|
|
||||||
sat = (unsigned char *)PicoMem.vram + ((pv->reg[5] & 0x7e) << 7);
|
sat = (unsigned char *)PicoMem.vram + ((pv->reg[5] & 0x7e) << 7);
|
||||||
if (pv->reg[1] & 2) {
|
if (pv->reg[1] & 2) {
|
||||||
|
@ -177,6 +179,8 @@ static void DrawDisplayM4(int scanline)
|
||||||
if (dx != 8)
|
if (dx != 8)
|
||||||
cells++; // have hscroll, need to draw 1 cell more
|
cells++; // have hscroll, need to draw 1 cell more
|
||||||
dx += cellskip << 3;
|
dx += cellskip << 3;
|
||||||
|
if (!FinalizeLineM4 && !(PicoIn.opt & POPT_DIS_32C_BORDER))
|
||||||
|
dx += 32;
|
||||||
|
|
||||||
// low priority tiles
|
// low priority tiles
|
||||||
if (!(pv->debug_p & PVD_KILL_B))
|
if (!(pv->debug_p & PVD_KILL_B))
|
||||||
|
@ -190,9 +194,11 @@ static void DrawDisplayM4(int scanline)
|
||||||
if (!(pv->debug_p & PVD_KILL_A))
|
if (!(pv->debug_p & PVD_KILL_A))
|
||||||
draw_strip(nametab, dx, cells, tilex | 0x1000 | (ty << 16));
|
draw_strip(nametab, dx, cells, tilex | 0x1000 | (ty << 16));
|
||||||
|
|
||||||
if (pv->reg[0] & 0x20)
|
if (pv->reg[0] & 0x20) {
|
||||||
// first column masked
|
// first column masked, caculate offset to start of line
|
||||||
((int *)Pico.est.HighCol)[2] = ((int *)Pico.est.HighCol)[3] = 0xe0e0e0e0;
|
dx = (dx&~0x1f) / 4;
|
||||||
|
((u32 *)Pico.est.HighCol)[dx+2] = ((u32 *)Pico.est.HighCol)[dx+3] = 0xe0e0e0e0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PicoFrameStartMode4(void)
|
void PicoFrameStartMode4(void)
|
||||||
|
@ -219,6 +225,7 @@ void PicoFrameStartMode4(void)
|
||||||
rendlines = lines;
|
rendlines = lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Pico.est.HighCol = HighColBase + screen_offset * HighColIncrement;
|
||||||
Pico.est.DrawLineDest = (char *)DrawLineDestBase + screen_offset * DrawLineDestIncrement;
|
Pico.est.DrawLineDest = (char *)DrawLineDestBase + screen_offset * DrawLineDestIncrement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,6 +250,7 @@ void PicoLineMode4(int line)
|
||||||
if (PicoScanEnd != NULL)
|
if (PicoScanEnd != NULL)
|
||||||
skip_next_line = PicoScanEnd(line + screen_offset);
|
skip_next_line = PicoScanEnd(line + screen_offset);
|
||||||
|
|
||||||
|
Pico.est.HighCol += HighColIncrement;
|
||||||
Pico.est.DrawLineDest = (char *)Pico.est.DrawLineDest + DrawLineDestIncrement;
|
Pico.est.DrawLineDest = (char *)Pico.est.DrawLineDest + DrawLineDestIncrement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,7 +304,8 @@ void PicoDrawSetOutputMode4(pdso_t which)
|
||||||
{
|
{
|
||||||
case PDF_8BIT: FinalizeLineM4 = FinalizeLine8bitM4; break;
|
case PDF_8BIT: FinalizeLineM4 = FinalizeLine8bitM4; break;
|
||||||
case PDF_RGB555: FinalizeLineM4 = FinalizeLineRGB555M4; break;
|
case PDF_RGB555: FinalizeLineM4 = FinalizeLineRGB555M4; break;
|
||||||
default: FinalizeLineM4 = NULL; break;
|
default: FinalizeLineM4 = NULL;
|
||||||
|
PicoDrawSetInternalBuf(Pico.est.Draw2FB, 328); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -666,6 +666,8 @@ extern int (*PicoScanBegin)(unsigned int num);
|
||||||
extern int (*PicoScanEnd)(unsigned int num);
|
extern int (*PicoScanEnd)(unsigned int num);
|
||||||
#define MAX_LINE_SPRITES 27 // +1 last sprite width, +4 hdr; total 32
|
#define MAX_LINE_SPRITES 27 // +1 last sprite width, +4 hdr; total 32
|
||||||
extern unsigned char HighLnSpr[240][4+MAX_LINE_SPRITES+1];
|
extern unsigned char HighLnSpr[240][4+MAX_LINE_SPRITES+1];
|
||||||
|
extern unsigned char *HighColBase;
|
||||||
|
extern int HighColIncrement;
|
||||||
extern void *DrawLineDestBase;
|
extern void *DrawLineDestBase;
|
||||||
extern int DrawLineDestIncrement;
|
extern int DrawLineDestIncrement;
|
||||||
extern unsigned int VdpSATCache[128];
|
extern unsigned int VdpSATCache[128];
|
||||||
|
|
|
@ -22,6 +22,8 @@ const char *renderer_names[] = { "16bit accurate", " 8bit accurate", " 8bit fast
|
||||||
const char *renderer_names32x[] = { "accurate", "faster", "fastest", NULL };
|
const char *renderer_names32x[] = { "accurate", "faster", "fastest", NULL };
|
||||||
enum renderer_types { RT_16BIT, RT_8BIT_ACC, RT_8BIT_FAST, RT_COUNT };
|
enum renderer_types { RT_16BIT, RT_8BIT_ACC, RT_8BIT_FAST, RT_COUNT };
|
||||||
|
|
||||||
|
static int out_x, out_y;
|
||||||
|
static int out_w, out_h;
|
||||||
|
|
||||||
void pemu_prep_defconfig(void)
|
void pemu_prep_defconfig(void)
|
||||||
{
|
{
|
||||||
|
@ -70,15 +72,18 @@ static void draw_cd_leds(void)
|
||||||
void pemu_finalize_frame(const char *fps, const char *notice)
|
void pemu_finalize_frame(const char *fps, const char *notice)
|
||||||
{
|
{
|
||||||
if (currentConfig.renderer != RT_16BIT && !(PicoIn.AHW & PAHW_32X)) {
|
if (currentConfig.renderer != RT_16BIT && !(PicoIn.AHW & PAHW_32X)) {
|
||||||
unsigned short *pd = (unsigned short *)g_screen_ptr + 8 * g_screen_ppitch;
|
unsigned short *pd = (unsigned short *)g_screen_ptr + out_y * g_screen_ppitch + out_x;
|
||||||
unsigned char *ps = Pico.est.Draw2FB + 328*8 + 8;
|
unsigned char *ps = Pico.est.Draw2FB + 328*out_y + out_x + 8;
|
||||||
unsigned short *pal = Pico.est.HighPal;
|
unsigned short *pal = Pico.est.HighPal;
|
||||||
int i, x;
|
int i, x;
|
||||||
|
|
||||||
PicoDrawUpdateHighPal();
|
PicoDrawUpdateHighPal();
|
||||||
for (i = 0; i < 224; i++, ps += 8)
|
for (i = 0; i < out_h; i++, ps += 8) {
|
||||||
for (x = 0; x < 320; x++)
|
for (x = 0; x < out_w; x++)
|
||||||
*pd++ = pal[*ps++];
|
*pd++ = pal[*ps++];
|
||||||
|
pd += 320 - out_w;
|
||||||
|
ps += 320 - out_w;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notice || (currentConfig.EmuOpt & EOPT_SHOW_FPS)) {
|
if (notice || (currentConfig.EmuOpt & EOPT_SHOW_FPS)) {
|
||||||
|
@ -180,9 +185,10 @@ void emu_video_mode_change(int start_line, int line_count, int is_32cols)
|
||||||
{
|
{
|
||||||
// clear whole screen in all buffers
|
// clear whole screen in all buffers
|
||||||
if (currentConfig.renderer != RT_16BIT && !(PicoIn.AHW & PAHW_32X))
|
if (currentConfig.renderer != RT_16BIT && !(PicoIn.AHW & PAHW_32X))
|
||||||
memset32(Pico.est.Draw2FB, 0, (320+8) * (8+240+8) / 4);
|
memset32(Pico.est.Draw2FB, 0xe0e0e0e0, (320+8) * (8+240+8) / 4);
|
||||||
else
|
memset32(g_screen_ptr, 0, g_screen_ppitch * g_screen_height * 2 / 4);
|
||||||
memset32(g_screen_ptr, 0, g_screen_ppitch * g_screen_height * 2 / 4);
|
out_y = start_line; out_x = (is_32cols ? 32 : 0);
|
||||||
|
out_h = line_count; out_w = (is_32cols ? 256:320);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pemu_loop_prep(void)
|
void pemu_loop_prep(void)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue