mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
core, revisit Sega 8 bit hardware handling
This commit is contained in:
parent
cab84f29e5
commit
0aa63fce12
9 changed files with 63 additions and 58 deletions
18
pico/mode4.c
18
pico/mode4.c
|
@ -162,7 +162,7 @@ static void ParseSpritesM4(int scanline)
|
|||
|
||||
if (pv->reg[0] & 8)
|
||||
xoff -= 8; // sprite shift
|
||||
if ((Pico.m.hardware & (PMS_HW_GG|PMS_HW_LCD)) == (PMS_HW_GG|PMS_HW_LCD))
|
||||
if (Pico.m.hardware & PMS_HW_LCD)
|
||||
xoff -= 48; // GG LCD, adjust to center 160 px
|
||||
|
||||
sat = (u8 *)PicoMem.vram + ((pv->reg[5] & 0x7e) << 7);
|
||||
|
@ -237,7 +237,7 @@ static void DrawStripM4(const u16 *nametab, int cells_dx, int tilex_ty)
|
|||
int addr = 0, pal = 0;
|
||||
|
||||
// Draw tiles across screen:
|
||||
for (; cells_dx > 0; cells_dx += 8, tilex_ty++, cells_dx -= 0x10000)
|
||||
for (; cells_dx >= 0; cells_dx += 8, tilex_ty++, cells_dx -= 0x10000)
|
||||
{
|
||||
unsigned int pack;
|
||||
unsigned code;
|
||||
|
@ -294,7 +294,7 @@ static void DrawDisplayM4(int scanline)
|
|||
|
||||
tilex = (32 - (dx >> 3) + cellskip) & 0x1f;
|
||||
ty = (line & 7) << 1; // Y-Offset into tile
|
||||
cells = maxcells - cellskip;
|
||||
cells = maxcells - cellskip - 1;
|
||||
|
||||
dx = (dx & 7);
|
||||
dx += cellskip << 3;
|
||||
|
@ -302,7 +302,7 @@ static void DrawDisplayM4(int scanline)
|
|||
|
||||
// tiles
|
||||
if (!(pv->debug_p & PVD_KILL_B)) {
|
||||
if ((Pico.m.hardware & (PMS_HW_GG|PMS_HW_LCD)) == (PMS_HW_GG|PMS_HW_LCD)) {
|
||||
if (Pico.m.hardware & PMS_HW_LCD) {
|
||||
// on GG render only the center 160 px, but mind hscroll
|
||||
DrawStripM4(nametab , (dx-8) | ((cells-11)<< 16),(tilex+5) | (ty << 16));
|
||||
} else if (pv->reg[0] & 0x80) {
|
||||
|
@ -318,7 +318,7 @@ static void DrawDisplayM4(int scanline)
|
|||
if (!(pv->debug_p & PVD_KILL_S_LO))
|
||||
DrawSpritesM4();
|
||||
|
||||
if ((pv->reg[0] & 0x20) && (Pico.m.hardware & (PMS_HW_GG|PMS_HW_LCD)) != (PMS_HW_GG|PMS_HW_LCD)) {
|
||||
if ((pv->reg[0] & 0x20) && !(Pico.m.hardware & PMS_HW_LCD)) {
|
||||
// first column masked with background, caculate offset to start of line
|
||||
dx = line_offset / 4;
|
||||
ty = ((pv->reg[7]&0x0f)|0x10) * 0x01010101;
|
||||
|
@ -742,7 +742,7 @@ void PicoFrameStartSMS(void)
|
|||
|
||||
// Copy LCD enable flag for easier handling
|
||||
Pico.m.hardware &= ~PMS_HW_LCD;
|
||||
if ((PicoIn.opt & POPT_EN_GG_LCD) && (Pico.m.hardware & PMS_HW_GG))
|
||||
if ((PicoIn.opt & POPT_EN_GG_LCD) && (PicoIn.AHW & PAHW_GG))
|
||||
Pico.m.hardware |= PMS_HW_LCD;
|
||||
|
||||
if (!(Pico.m.hardware & PMS_HW_LCD) && (mode & 4) && (Pico.video.reg[0] & 0x20)) {
|
||||
|
@ -750,7 +750,7 @@ void PicoFrameStartSMS(void)
|
|||
columns = 248;
|
||||
Pico.est.rendstatus |= PDRAW_SMS_BLANK_1;
|
||||
}
|
||||
if ((Pico.m.hardware & (PMS_HW_GG|PMS_HW_LCD)) == (PMS_HW_GG|PMS_HW_LCD)) {
|
||||
if (Pico.m.hardware & PMS_HW_LCD) {
|
||||
// GG LCD always has 160x144 regardless of settings
|
||||
screen_offset = 24; // nonetheless the vdp timing has 224 lines
|
||||
loffs = 48;
|
||||
|
@ -811,7 +811,7 @@ void PicoLineSMS(int line)
|
|||
unsigned bgcolor;
|
||||
|
||||
// GG LCD, render only visible part of screen
|
||||
if ((Pico.m.hardware & (PMS_HW_GG|PMS_HW_LCD)) == (PMS_HW_GG|PMS_HW_LCD) && (line < 24 || line >= 24+144))
|
||||
if ((Pico.m.hardware & PMS_HW_LCD) && (line < 24 || line >= 24+144))
|
||||
goto norender;
|
||||
|
||||
if (PicoScanBegin != NULL && skip == 0)
|
||||
|
@ -878,7 +878,7 @@ void PicoDoHighPal555SMS(void)
|
|||
* hence GG/SMS/TMS can all be handled the same here */
|
||||
for (j = cnt; j > 0; j--) {
|
||||
if (!(Pico.video.reg[0] & 0x4)) // fixed palette in TMS modes
|
||||
spal = (u32 *)tmspal + (Pico.m.hardware & (PMS_HW_SG|PMS_HW_SC) ? 16/2:0);
|
||||
spal = (u32 *)tmspal + (PicoIn.AHW & (PAHW_SG|PAHW_SC) ? 16/2:0);
|
||||
for (i = 0x20/2; i > 0; i--, spal++, dpal++) {
|
||||
t = *spal;
|
||||
#if defined(USE_BGR555)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue