Stop the flipping insanity [Alex Jackson]

Tilemap flipping is now calculated relative to the center of the visible area
rather than to the total screen size, and the generic flip screen functions
no longer reconfigure the actual screen.
These changes ensure that in most cases flipping should Just Work for drivers
that use MCFG_RAW_PARAMs, games that have a programmable CRTC, and games that
have raster effects, and should fix many longstanding flip/cocktail-related
regressions.

(nw)
Unfortunately, it also means that all the thankless work that Osso and hap
have been doing over the last few months fixing flipscreen regressions will
have to be reverted now. I've also undoubtedly caused new regressions in
drivers that handle flipscreen in unusual ways. But now we can share video
device implementations between drivers that have been updated to RAW_PARAMs
and drivers that haven't without kludges all over the place.
And now I can hook up the programmable CRTC in toaplan1.c without abandoning
all hope of flipscreen ever working again in that driver.

(also nw)
I also added savestate registration for the generic soundlatches, which seemed
like a good idea. Any particular reason why these weren't being saved?
This commit is contained in:
Alex W. Jackson 2014-02-05 17:25:58 +00:00
parent 0353541f5b
commit 1f7a3bf649
6 changed files with 25 additions and 83 deletions

View File

@ -265,6 +265,8 @@ void driver_device::device_start()
video_start();
// save generic states
save_item(NAME(m_latch_clear_value));
save_item(NAME(m_latched_value));
save_item(NAME(m_flip_screen_x));
save_item(NAME(m_flip_screen_y));
}
@ -519,27 +521,6 @@ void driver_device::updateflip()
{
// push the flip state to all tilemaps
machine().tilemap().set_flip_all((TILEMAP_FLIPX & m_flip_screen_x) | (TILEMAP_FLIPY & m_flip_screen_y));
// flip the visible area within the screen width/height
int width = m_screen->width();
int height = m_screen->height();
rectangle visarea = m_screen->visible_area();
if (m_flip_screen_x)
{
int temp = width - visarea.min_x - 1;
visarea.min_x = width - visarea.max_x - 1;
visarea.max_x = temp;
}
if (m_flip_screen_y)
{
int temp = height - visarea.min_y - 1;
visarea.min_y = height - visarea.max_y - 1;
visarea.max_y = temp;
}
// reconfigure the screen with the new visible area
attoseconds_t period = m_screen->frame_period().attoseconds;
m_screen->configure(width, height, visarea, period);
}
@ -556,8 +537,6 @@ void driver_device::flip_screen_set(UINT32 on)
// if something's changed, handle it
if (m_flip_screen_x != on || m_flip_screen_y != on)
{
if (!on)
updateflip(); // flip visarea back
m_flip_screen_x = m_flip_screen_y = on;
updateflip();
}
@ -566,15 +545,15 @@ void driver_device::flip_screen_set(UINT32 on)
//-------------------------------------------------
// flip_screen_set_no_update - set global flip
// do not call update_flip.
// do not call updateflip.
//-------------------------------------------------
void driver_device::flip_screen_set_no_update(UINT32 on)
{
// flip_screen_y is not updated on purpose
// this function is for drivers which
// where writing to flip_screen_x to
// bypass update_flip
// were writing to flip_screen_x to
// bypass updateflip
if (on)
on = ~0;
m_flip_screen_x = on;

View File

@ -404,8 +404,8 @@ private:
UINT8 m_latch_read[4];
// generic video
UINT32 m_flip_screen_x;
UINT32 m_flip_screen_y;
UINT8 m_flip_screen_x;
UINT8 m_flip_screen_y;
};

View File

@ -935,8 +935,10 @@ g_profiler.start(PROFILER_TILEMAP_DRAW);
// flush the dirty state to all tiles as appropriate
realize_all_dirty_tiles();
UINT32 width = screen.width();
UINT32 height = screen.height();
// flip the tilemap around the center of the visible area
rectangle visarea = screen.visible_area();
UINT32 width = visarea.min_x + visarea.max_x + 1;
UINT32 height = visarea.min_y + visarea.max_y + 1;
// XY scrolling playfield
if (m_scrollrows == 1 && m_scrollcols == 1)

View File

@ -21,17 +21,8 @@ WRITE8_MEMBER(arkanoid_state::arkanoid_d008_w)
int bank;
/* bits 0 and 1 flip X and Y, I don't know which is which */
if (flip_screen_x() != (data & 0x01))
{
flip_screen_x_set(data & 0x01);
m_bg_tilemap->mark_all_dirty();
}
if (flip_screen_y() != (data & 0x02))
{
flip_screen_y_set(data & 0x02);
m_bg_tilemap->mark_all_dirty();
}
flip_screen_x_set(data & 0x01);
flip_screen_y_set(data & 0x02);
/* bit 2 selects the input paddle */
m_paddle_select = data & 0x04;
@ -76,17 +67,8 @@ WRITE8_MEMBER(arkanoid_state::brixian_d008_w)
int bank;
/* bits 0 and 1 flip X and Y, I don't know which is which */
if (flip_screen_x() != (data & 0x01))
{
flip_screen_x_set(data & 0x01);
m_bg_tilemap->mark_all_dirty();
}
if (flip_screen_y() != (data & 0x02))
{
flip_screen_y_set(data & 0x02);
m_bg_tilemap->mark_all_dirty();
}
flip_screen_x_set(data & 0x01);
flip_screen_y_set(data & 0x02);
/* bit 2 selects the input paddle */
/* - not relevant to brixian */
@ -125,17 +107,8 @@ WRITE8_MEMBER(arkanoid_state::tetrsark_d008_w)
int bank;
/* bits 0 and 1 flip X and Y, I don't know which is which */
if (flip_screen_x() != (data & 0x01))
{
flip_screen_x_set(data & 0x01);
m_bg_tilemap->mark_all_dirty();
}
if (flip_screen_y() != (data & 0x02))
{
flip_screen_y_set(data & 0x02);
m_bg_tilemap->mark_all_dirty();
}
flip_screen_x_set(data & 0x01);
flip_screen_y_set(data & 0x02);
/* bit 2 selects the input paddle? */
m_paddle_select = data & 0x04;
@ -169,18 +142,8 @@ WRITE8_MEMBER(arkanoid_state::tetrsark_d008_w)
WRITE8_MEMBER(arkanoid_state::hexa_d008_w)
{
/* bit 0 = flipx (or y?) */
if (flip_screen_x() != (data & 0x01))
{
flip_screen_x_set(data & 0x01);
m_bg_tilemap->mark_all_dirty();
}
/* bit 1 = flipy (or x?) */
if (flip_screen_y() != (data & 0x02))
{
flip_screen_y_set(data & 0x02);
m_bg_tilemap->mark_all_dirty();
}
flip_screen_x_set(data & 0x01);
flip_screen_y_set(data & 0x02);
/* bit 2 - 3 unknown */

View File

@ -2324,7 +2324,7 @@ void cps_state::cps1_render_sprites( screen_device &screen, bitmap_ind16 &bitmap
CODE, \
COLOR, \
!(FLIPX),!(FLIPY), \
511-16-(SX),255-16-(SY), screen.priority(),0x02,15); \
512-16-(SX),256-16-(SY), screen.priority(),0x02,15); \
else \
pdrawgfx_transpen(bitmap,\
cliprect,machine().gfx[2], \
@ -2557,7 +2557,7 @@ void cps_state::cps2_render_sprites( screen_device &screen, bitmap_ind16 &bitmap
CODE, \
COLOR, \
!(FLIPX),!(FLIPY), \
511-16-(SX),255-16-(SY), screen.priority(),primasks[priority],15); \
512-16-(SX),256-16-(SY), screen.priority(),primasks[priority],15); \
else \
pdrawgfx_transpen(bitmap,\
cliprect,machine().gfx[2], \
@ -2720,8 +2720,8 @@ void cps_state::cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap,
sy = (sy - m_stars2y) & 0xff;
if (flip_screen())
{
sx = 511 - sx;
sy = 255 - sy;
sx = 512 - sx;
sy = 256 - sy;
}
col = ((col & 0xe0) >> 1) + (screen.frame_number() / 16 & 0x0f);
@ -2745,8 +2745,8 @@ void cps_state::cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap,
sy = (sy - m_stars1y) & 0xff;
if (flip_screen())
{
sx = 511 - sx;
sy = 255 - sy;
sx = 512 - sx;
sy = 256 - sy;
}
col = ((col & 0xe0) >> 1) + (screen.frame_number() / 16 & 0x0f);

View File

@ -492,8 +492,6 @@ VIDEO_START_MEMBER(twin16_state,twin16)
m_text_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(twin16_state::get_text_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
m_text_tilemap->set_transparent_pen(0);
m_text_tilemap->set_scrolldx(0, m_screen->width() - 320);
m_text_tilemap->set_scrolldy(0, m_screen->height() - 256);
palette_set_shadow_factor(machine(),0.4); // screenshots estimate