chqflag.cpp: k051937 actually sets up a register when background should be dimmed, fixes start/end pouring event colors [Angelo Salese]
This commit is contained in:
parent
149def928f
commit
1fb897055a
@ -57,14 +57,6 @@ WRITE8_MEMBER(chqflag_state::chqflag_bankswitch_w)
|
||||
/* other bits unknown/unused */
|
||||
}
|
||||
|
||||
inline void chqflag_state::update_background_shadows(uint8_t data)
|
||||
{
|
||||
double brt = (data & 0x80) ? PALETTE_DEFAULT_SHADOW_FACTOR : 1.0;
|
||||
|
||||
for (int i = 512; i < 1024; i++)
|
||||
m_palette->set_pen_contrast(i, brt);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(chqflag_state::chqflag_vreg_w)
|
||||
{
|
||||
/* bits 0 & 1 = coin counters */
|
||||
@ -86,12 +78,13 @@ WRITE8_MEMBER(chqflag_state::chqflag_vreg_w)
|
||||
* 0x88 is for when night shows up (max amount of highlight)
|
||||
* 0x08 is used at dawn after 0x88 state
|
||||
* The shadow part looks ugly when rain starts/ends pouring (-> black colored with a setting of 0x00),
|
||||
* apparently the reference shows dimmed background when car pits in which maybe translates in a
|
||||
* global zoomed sprite that gets clipped in emulation?
|
||||
* the reference shows dimmed background when this event occurs (which is handled via reg 1 bit 0 of k051960 device),
|
||||
* might be actually disabling the shadow here (-> setting 1.0f instead), but can't say for sure from the available reference.
|
||||
*/
|
||||
const float shadow_factors[4] = {PALETTE_DEFAULT_SHADOW_FACTOR, 1.33f, 1.66f, 2.0f };
|
||||
m_palette->set_shadow_factor(shadow_factors[((data & 0x80) >> 6) | ((data & 0x08) >> 3)]);
|
||||
|
||||
#if 0
|
||||
if ((data & 0x80) != m_last_vreg)
|
||||
{
|
||||
m_last_vreg = data & 0x80;
|
||||
@ -99,7 +92,8 @@ WRITE8_MEMBER(chqflag_state::chqflag_vreg_w)
|
||||
/* only affect the background */
|
||||
update_background_shadows(data);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//if ((data & 0xf8) && (data & 0xf8) != 0x88)
|
||||
// popmessage("chqflag_vreg_w %02x",data);
|
||||
|
||||
@ -301,6 +295,26 @@ void chqflag_state::machine_reset()
|
||||
update_background_shadows(0);
|
||||
}
|
||||
|
||||
inline void chqflag_state::update_background_shadows(uint8_t data)
|
||||
{
|
||||
double brt = (data & 1) ? PALETTE_DEFAULT_SHADOW_FACTOR : 1.0;
|
||||
|
||||
for (int i = 512; i < 1024; i++)
|
||||
m_palette->set_pen_contrast(i, brt);
|
||||
}
|
||||
|
||||
|
||||
WRITE_LINE_MEMBER(chqflag_state::background_brt_w)
|
||||
{
|
||||
// popmessage("%d",state);
|
||||
|
||||
if (state != m_last_vreg)
|
||||
{
|
||||
m_last_vreg = state;
|
||||
update_background_shadows(state);
|
||||
}
|
||||
}
|
||||
|
||||
static MACHINE_CONFIG_START( chqflag )
|
||||
|
||||
/* basic machine hardware */
|
||||
@ -339,7 +353,8 @@ static MACHINE_CONFIG_START( chqflag )
|
||||
MCFG_K051960_CB(chqflag_state, sprite_callback)
|
||||
MCFG_K051960_IRQ_HANDLER(INPUTLINE("maincpu", KONAMI_IRQ_LINE))
|
||||
MCFG_K051960_NMI_HANDLER(INPUTLINE("maincpu", INPUT_LINE_NMI))
|
||||
|
||||
MCFG_K051960_VREG_CONTRAST_HANDLER(WRITELINE(chqflag_state,background_brt_w))
|
||||
|
||||
MCFG_DEVICE_ADD("k051316_1", K051316, 0)
|
||||
MCFG_GFX_PALETTE("palette")
|
||||
MCFG_K051316_OFFSETS(7, 0)
|
||||
|
@ -41,6 +41,7 @@ public:
|
||||
DECLARE_WRITE8_MEMBER(k007232_extvolume_w);
|
||||
DECLARE_WRITE8_MEMBER(volume_callback0);
|
||||
DECLARE_WRITE8_MEMBER(volume_callback1);
|
||||
DECLARE_WRITE_LINE_MEMBER(background_brt_w);
|
||||
K051316_CB_MEMBER(zoom_callback_1);
|
||||
K051316_CB_MEMBER(zoom_callback_2);
|
||||
K051960_CB_MEMBER(sprite_callback);
|
||||
|
@ -38,6 +38,7 @@ memory map:
|
||||
001 W Devastators sets bit 1, function unknown.
|
||||
Ultraman sets the register to 0x0f.
|
||||
None of the other games I tested seem to set this register to other than 0.
|
||||
Update: Chequered Flag sets bit 0 when background should be dimmed (palette control?)
|
||||
002-003 W selects the portion of the gfx ROMs to be read.
|
||||
004 W Aliens uses this to select the ROM bank to be read, but Punk Shot
|
||||
and TMNT don't, they use another bit of the registers above. Many
|
||||
@ -136,6 +137,7 @@ k051960_device::k051960_device(const machine_config &mconfig, const char *tag, d
|
||||
, m_irq_handler(*this)
|
||||
, m_firq_handler(*this)
|
||||
, m_nmi_handler(*this)
|
||||
, m_vreg_contrast_handler(*this)
|
||||
, m_romoffset(0)
|
||||
, m_spriteflip(0)
|
||||
, m_readroms(0)
|
||||
@ -207,6 +209,7 @@ void k051960_device::device_start()
|
||||
m_irq_handler.resolve_safe();
|
||||
m_firq_handler.resolve_safe();
|
||||
m_nmi_handler.resolve_safe();
|
||||
m_vreg_contrast_handler.resolve_safe();
|
||||
|
||||
// register for save states
|
||||
save_item(NAME(m_romoffset));
|
||||
@ -330,6 +333,10 @@ WRITE8_MEMBER( k051960_device::k051937_w )
|
||||
}
|
||||
else if (offset == 1)
|
||||
{
|
||||
//popmessage("%04x: write %02x to 051937 address %x", space.device().safe_pc(), data, offset);
|
||||
// Chequered Flag uses this bit to enable background palette dimming
|
||||
// TODO: use a callback here for now, pending further investigation over this bit
|
||||
m_vreg_contrast_handler(BIT(data,0));
|
||||
// unknown, Devastators writes 02 here in game
|
||||
if (0)
|
||||
logerror("%s: %02x to 051937 address %x\n", machine().describe_context(), data, offset);
|
||||
@ -340,7 +347,7 @@ WRITE8_MEMBER( k051960_device::k051937_w )
|
||||
}
|
||||
else
|
||||
{
|
||||
// popmessage("%04x: write %02x to 051937 address %x", space.device().safe_pc(), data, offset);
|
||||
// popmessage("%04x: write %02x to 051937 address %x", space.device().safe_pc(), data, offset);
|
||||
//logerror("%04x: write %02x to unknown 051937 address %x\n", space.device().safe_pc(), data, offset);
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,9 @@ typedef device_delegate<void (int *code, int *color, int *priority, int *shadow)
|
||||
#define MCFG_K051960_NMI_HANDLER(_devcb) \
|
||||
devcb = &k051960_device::set_nmi_handler(*device, DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_K051960_VREG_CONTRAST_HANDLER(_devcb) \
|
||||
devcb = &k051960_device::set_vreg_contrast_handler(*device, DEVCB_##_devcb);
|
||||
|
||||
|
||||
class k051960_device : public device_t, public device_gfx_interface
|
||||
{
|
||||
@ -52,6 +55,10 @@ public:
|
||||
template <class Object> static devcb_base &set_nmi_handler(device_t &device, Object &&cb)
|
||||
{ return downcast<k051960_device &>(device).m_nmi_handler.set_callback(std::forward<Object>(cb)); }
|
||||
|
||||
template <class Object> static devcb_base &set_vreg_contrast_handler(device_t &device, Object &&cb)
|
||||
{ return downcast<k051960_device &>(device).m_vreg_contrast_handler.set_callback(std::forward<Object>(cb)); }
|
||||
|
||||
|
||||
// static configuration
|
||||
static void set_k051960_callback(device_t &device, k051960_cb_delegate callback) { downcast<k051960_device &>(device).m_k051960_cb = callback; }
|
||||
static void set_plane_order(device_t &device, int order);
|
||||
@ -98,8 +105,10 @@ private:
|
||||
k051960_cb_delegate m_k051960_cb;
|
||||
|
||||
devcb_write_line m_irq_handler;
|
||||
// TODO: is this even used by anything?
|
||||
devcb_write_line m_firq_handler;
|
||||
devcb_write_line m_nmi_handler;
|
||||
devcb_write_line m_vreg_contrast_handler;
|
||||
|
||||
uint8_t m_spriterombank[3];
|
||||
int m_romoffset;
|
||||
|
Loading…
Reference in New Issue
Block a user