mirror of
https://github.com/holub/mame
synced 2025-10-06 17:08:28 +03:00
cps3.cpp : Updates (#4442)
* cps3.cpp : Add save states, Convert drawing routine restricted to cliprect rectangle cps3.h : Use private: * cps3.cpp : Add draw case when fullscreen zoom is 100% * cps3.h : Minor updates
This commit is contained in:
parent
082e78ddc7
commit
497ec3111a
@ -772,12 +772,6 @@ void cps3_state::cps3_decrypt_bios()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void cps3_state::init_common(void)
|
|
||||||
{
|
|
||||||
m_eeprom = std::make_unique<uint32_t[]>(0x400/4);
|
|
||||||
subdevice<nvram_device>("eeprom")->set_base(m_eeprom.get(), 0x400);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void cps3_state::init_crypt(uint32_t key1, uint32_t key2, int altEncryption)
|
void cps3_state::init_crypt(uint32_t key1, uint32_t key2, int altEncryption)
|
||||||
{
|
{
|
||||||
@ -814,8 +808,6 @@ void cps3_state::init_crypt(uint32_t key1, uint32_t key2, int altEncryption)
|
|||||||
m_maincpu->sh2drc_add_fastram(0x040C0030, 0x040C003b, 0, &m_tilemap30_regs_base[0]);
|
m_maincpu->sh2drc_add_fastram(0x040C0030, 0x040C003b, 0, &m_tilemap30_regs_base[0]);
|
||||||
|
|
||||||
cps3_decrypt_bios();
|
cps3_decrypt_bios();
|
||||||
|
|
||||||
init_common();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cps3_state::init_redearth() { init_crypt(0x9e300ab1, 0xa175b82c, 0); }
|
void cps3_state::init_redearth() { init_crypt(0x9e300ab1, 0xa175b82c, 0); }
|
||||||
@ -902,13 +894,8 @@ void cps3_state::cps3_set_mame_colours(int colournum, uint16_t data, uint32_t fa
|
|||||||
|
|
||||||
void cps3_state::video_start()
|
void cps3_state::video_start()
|
||||||
{
|
{
|
||||||
m_ss_ram = std::make_unique<uint32_t[]>(0x10000/4);
|
m_ss_ram = make_unique_clear<uint32_t[]>(0x10000/4);
|
||||||
memset(m_ss_ram.get(), 0x00, 0x10000);
|
m_char_ram = make_unique_clear<uint32_t[]>(0x800000/4);
|
||||||
save_pointer(NAME(m_ss_ram), 0x10000/4);
|
|
||||||
|
|
||||||
m_char_ram = std::make_unique<uint32_t[]>(0x800000/4);
|
|
||||||
memset(m_char_ram.get(), 0x00, 0x800000);
|
|
||||||
save_pointer(NAME(m_char_ram), 0x800000 /4);
|
|
||||||
|
|
||||||
/* create the char set (gfx will then be updated dynamically from RAM) */
|
/* create the char set (gfx will then be updated dynamically from RAM) */
|
||||||
m_gfxdecode->set_gfx(0, std::make_unique<gfx_element>(m_palette, cps3_tiles8x8_layout, (uint8_t *)m_ss_ram.get(), 0, m_palette->entries() / 16, 0));
|
m_gfxdecode->set_gfx(0, std::make_unique<gfx_element>(m_palette, cps3_tiles8x8_layout, (uint8_t *)m_ss_ram.get(), 0, m_palette->entries() / 16, 0));
|
||||||
@ -921,8 +908,7 @@ void cps3_state::video_start()
|
|||||||
|
|
||||||
//decode_charram();
|
//decode_charram();
|
||||||
|
|
||||||
m_mame_colours = std::make_unique<uint32_t[]>(0x80000/4);
|
m_mame_colours = make_unique_clear<uint32_t[]>(0x80000/2);
|
||||||
memset(m_mame_colours.get(), 0x00, 0x80000);
|
|
||||||
|
|
||||||
m_screenwidth = 384;
|
m_screenwidth = 384;
|
||||||
|
|
||||||
@ -933,6 +919,14 @@ void cps3_state::video_start()
|
|||||||
m_renderbuffer_clip.set(0, m_screenwidth-1, 0, 224-1);
|
m_renderbuffer_clip.set(0, m_screenwidth-1, 0, 224-1);
|
||||||
|
|
||||||
m_renderbuffer_bitmap.fill(0x3f, m_renderbuffer_clip);
|
m_renderbuffer_bitmap.fill(0x3f, m_renderbuffer_clip);
|
||||||
|
|
||||||
|
save_item(NAME(m_ss_pal_base));
|
||||||
|
save_item(NAME(m_unk_vidregs));
|
||||||
|
save_item(NAME(m_ss_bank_base));
|
||||||
|
|
||||||
|
save_pointer(NAME(m_ss_ram), 0x10000/4);
|
||||||
|
save_pointer(NAME(m_char_ram), 0x800000/4);
|
||||||
|
save_pointer(NAME(m_mame_colours), 0x80000/2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// the 0x400 bit in the tilemap regs is "draw it upside-down" (bios tilemap during flashing, otherwise capcom logo is flipped)
|
// the 0x400 bit in the tilemap regs is "draw it upside-down" (bios tilemap during flashing, otherwise capcom logo is flipped)
|
||||||
@ -1086,10 +1080,16 @@ uint32_t cps3_state::screen_update_cps3(screen_device &screen, bitmap_rgb32 &bit
|
|||||||
uint32_t fszx = (fullscreenzoomx << 16) / 0x40;
|
uint32_t fszx = (fullscreenzoomx << 16) / 0x40;
|
||||||
uint32_t fszy = (fullscreenzoomy << 16) / 0x40;
|
uint32_t fszy = (fullscreenzoomy << 16) / 0x40;
|
||||||
|
|
||||||
m_renderbuffer_clip.set(
|
if (fullscreenzoomx == 0x40 && fullscreenzoomy == 0x40)
|
||||||
0, ((m_screenwidth*fszx) >> 16) - 1,
|
{
|
||||||
0, ((224 * fszx) >> 16) - 1);
|
m_renderbuffer_clip = cliprect;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_renderbuffer_clip.set(
|
||||||
|
(cliprect.left() * fszx) >> 16, (((cliprect.right() + 1) * fszx + 0x8000) >> 16) - 1,
|
||||||
|
(cliprect.top() * fszy) >> 16, (((cliprect.bottom() + 1) * fszy + 0x8000) >> 16) - 1);
|
||||||
|
}
|
||||||
m_renderbuffer_bitmap.fill(0, m_renderbuffer_clip);
|
m_renderbuffer_bitmap.fill(0, m_renderbuffer_clip);
|
||||||
|
|
||||||
/* Sprites */
|
/* Sprites */
|
||||||
@ -1164,7 +1164,7 @@ uint32_t cps3_state::screen_update_cps3(screen_device &screen, bitmap_rgb32 &bit
|
|||||||
|
|
||||||
if (bg_drawn[tilemapnum] == 0)
|
if (bg_drawn[tilemapnum] == 0)
|
||||||
{
|
{
|
||||||
for (int uu = 0; uu < 1023; uu++)
|
for (int uu = m_renderbuffer_clip.top(); uu <= m_renderbuffer_clip.bottom(); uu++)
|
||||||
{
|
{
|
||||||
cps3_draw_tilemapsprite_line(tilemapnum, uu, m_renderbuffer_bitmap, m_renderbuffer_clip);
|
cps3_draw_tilemapsprite_line(tilemapnum, uu, m_renderbuffer_bitmap, m_renderbuffer_clip);
|
||||||
}
|
}
|
||||||
@ -1269,21 +1269,35 @@ uint32_t cps3_state::screen_update_cps3(screen_device &screen, bitmap_rgb32 &bit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy render bitmap with zoom */
|
if (fullscreenzoomx == 0x40 && fullscreenzoomy == 0x40)
|
||||||
{
|
{
|
||||||
uint32_t srcy = 0;
|
/* copy render bitmap without zoom */
|
||||||
for (uint32_t rendery = 0; rendery < 224; rendery++)
|
for (uint32_t rendery = cliprect.top(); rendery <= cliprect.bottom(); rendery++)
|
||||||
|
{
|
||||||
|
uint32_t* dstbitmap = &bitmap.pix32(rendery);
|
||||||
|
uint32_t* srcbitmap = &m_renderbuffer_bitmap.pix32(rendery);
|
||||||
|
|
||||||
|
for (uint32_t renderx = cliprect.left(); renderx <= cliprect.right(); renderx++)
|
||||||
|
{
|
||||||
|
dstbitmap[renderx] = m_mame_colours[srcbitmap[renderx] & 0x1ffff];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* copy render bitmap with zoom */
|
||||||
|
uint32_t srcy = cliprect.top() * fszy;
|
||||||
|
for (uint32_t rendery = cliprect.top(); rendery <= cliprect.bottom(); rendery++)
|
||||||
{
|
{
|
||||||
uint32_t* dstbitmap = &bitmap.pix32(rendery);
|
uint32_t* dstbitmap = &bitmap.pix32(rendery);
|
||||||
uint32_t* srcbitmap = &m_renderbuffer_bitmap.pix32(srcy >> 16);
|
uint32_t* srcbitmap = &m_renderbuffer_bitmap.pix32(srcy >> 16);
|
||||||
uint32_t srcx = 0;
|
uint32_t srcx = cliprect.left() * fszx;
|
||||||
|
|
||||||
for (uint32_t renderx = 0; renderx < m_screenwidth; renderx++)
|
for (uint32_t renderx = cliprect.left(); renderx <= cliprect.right(); renderx++)
|
||||||
{
|
{
|
||||||
dstbitmap[renderx] = m_mame_colours[srcbitmap[srcx >> 16] & 0x1ffff];
|
dstbitmap[renderx] = m_mame_colours[srcbitmap[srcx >> 16] & 0x1ffff];
|
||||||
srcx += fszx;
|
srcx += fszx;
|
||||||
}
|
}
|
||||||
|
|
||||||
srcy += fszy;
|
srcy += fszy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2275,6 +2289,28 @@ INTERRUPT_GEN_MEMBER(cps3_state::cps3_other_interrupt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void cps3_state::machine_start()
|
||||||
|
{
|
||||||
|
m_eeprom = std::make_unique<uint32_t[]>(0x400/4);
|
||||||
|
subdevice<nvram_device>("eeprom")->set_base(m_eeprom.get(), 0x400);
|
||||||
|
|
||||||
|
save_item(NAME(m_cram_gfxflash_bank));
|
||||||
|
save_item(NAME(m_cram_bank));
|
||||||
|
save_item(NAME(m_current_eeprom_read));
|
||||||
|
save_item(NAME(m_paldma_source));
|
||||||
|
save_item(NAME(m_paldma_realsource));
|
||||||
|
save_item(NAME(m_paldma_dest));
|
||||||
|
save_item(NAME(m_paldma_fade));
|
||||||
|
save_item(NAME(m_paldma_other2));
|
||||||
|
save_item(NAME(m_paldma_length));
|
||||||
|
save_item(NAME(m_chardma_source));
|
||||||
|
save_item(NAME(m_chardma_other));
|
||||||
|
save_item(NAME(m_current_table_address));
|
||||||
|
|
||||||
|
save_pointer(NAME(m_eeprom), 0x400/4);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void cps3_state::machine_reset()
|
void cps3_state::machine_reset()
|
||||||
{
|
{
|
||||||
m_current_table_address = -1;
|
m_current_table_address = -1;
|
||||||
@ -2284,6 +2320,12 @@ void cps3_state::machine_reset()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void cps3_state::device_post_load()
|
||||||
|
{
|
||||||
|
// copy data from flashroms back into user regions + decrypt into regions we execute/draw from.
|
||||||
|
copy_from_nvram();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// make a copy in the regions we execute code / draw gfx from
|
// make a copy in the regions we execute code / draw gfx from
|
||||||
void cps3_state::copy_from_nvram()
|
void cps3_state::copy_from_nvram()
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
// license:BSD-3-Clause
|
// license:BSD-3-Clause
|
||||||
// copyright-holders:David Haywood, Andreas Naive, Tomasz Slanina, ElSemi
|
// copyright-holders:David Haywood, Andreas Naive, Tomasz Slanina, ElSemi
|
||||||
|
#ifndef MAME_INCLUDES_CPS3_H
|
||||||
|
#define MAME_INCLUDES_CPS3_H
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
|
||||||
Capcom CPS-3 Hardware
|
Capcom CPS-3 Hardware
|
||||||
@ -44,6 +49,33 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void init_sfiii3();
|
||||||
|
void init_sfiii();
|
||||||
|
void init_redearth();
|
||||||
|
void init_jojo();
|
||||||
|
void init_jojoba();
|
||||||
|
void init_sfiii2();
|
||||||
|
void init_cps3boot();
|
||||||
|
|
||||||
|
void cps3(machine_config &config);
|
||||||
|
void jojo(machine_config &config);
|
||||||
|
void redearth(machine_config &config);
|
||||||
|
void sfiii2(machine_config &config);
|
||||||
|
void sfiii3(machine_config &config);
|
||||||
|
void sfiii(machine_config &config);
|
||||||
|
void jojoba(machine_config &config);
|
||||||
|
void simm1_64mbit(machine_config &config);
|
||||||
|
void simm2_64mbit(machine_config &config);
|
||||||
|
void simm3_128mbit(machine_config &config);
|
||||||
|
void simm4_128mbit(machine_config &config);
|
||||||
|
void simm5_128mbit(machine_config &config);
|
||||||
|
void simm5_32mbit(machine_config &config);
|
||||||
|
void simm6_128mbit(machine_config &config);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void device_post_load() override;
|
||||||
|
|
||||||
|
private:
|
||||||
required_device<sh2_device> m_maincpu;
|
required_device<sh2_device> m_maincpu;
|
||||||
required_device<gfxdecode_device> m_gfxdecode;
|
required_device<gfxdecode_device> m_gfxdecode;
|
||||||
required_device<palette_device> m_palette;
|
required_device<palette_device> m_palette;
|
||||||
@ -125,14 +157,8 @@ public:
|
|||||||
DECLARE_WRITE32_MEMBER(cps3_unk_vidregs_w);
|
DECLARE_WRITE32_MEMBER(cps3_unk_vidregs_w);
|
||||||
DECLARE_READ32_MEMBER(cps3_colourram_r);
|
DECLARE_READ32_MEMBER(cps3_colourram_r);
|
||||||
DECLARE_WRITE32_MEMBER(cps3_colourram_w);
|
DECLARE_WRITE32_MEMBER(cps3_colourram_w);
|
||||||
void init_sfiii3();
|
|
||||||
void init_sfiii();
|
|
||||||
void init_redearth();
|
|
||||||
void init_jojo();
|
|
||||||
void init_jojoba();
|
|
||||||
void init_sfiii2();
|
|
||||||
void init_cps3boot();
|
|
||||||
SH2_DMA_KLUDGE_CB(dma_callback);
|
SH2_DMA_KLUDGE_CB(dma_callback);
|
||||||
|
virtual void machine_start() override;
|
||||||
virtual void machine_reset() override;
|
virtual void machine_reset() override;
|
||||||
virtual void video_start() override;
|
virtual void video_start() override;
|
||||||
void draw_fg_layer(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
void draw_fg_layer(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||||
@ -143,7 +169,6 @@ public:
|
|||||||
uint16_t rotxor(uint16_t val, uint16_t xorval);
|
uint16_t rotxor(uint16_t val, uint16_t xorval);
|
||||||
uint32_t cps3_mask(uint32_t address, uint32_t key1, uint32_t key2);
|
uint32_t cps3_mask(uint32_t address, uint32_t key1, uint32_t key2);
|
||||||
void cps3_decrypt_bios();
|
void cps3_decrypt_bios();
|
||||||
void init_common(void);
|
|
||||||
void init_crypt(uint32_t key1, uint32_t key2, int altEncryption);
|
void init_crypt(uint32_t key1, uint32_t key2, int altEncryption);
|
||||||
void cps3_set_mame_colours(int colournum, uint16_t data, uint32_t fadeval);
|
void cps3_set_mame_colours(int colournum, uint16_t data, uint32_t fadeval);
|
||||||
void cps3_draw_tilemapsprite_line(int tmnum, int drawline, bitmap_rgb32 &bitmap, const rectangle &cliprect );
|
void cps3_draw_tilemapsprite_line(int tmnum, int drawline, bitmap_rgb32 &bitmap, const rectangle &cliprect );
|
||||||
@ -159,20 +184,8 @@ public:
|
|||||||
unsigned int code, unsigned int color, int flipx, int flipy, int sx, int sy,
|
unsigned int code, unsigned int color, int flipx, int flipy, int sx, int sy,
|
||||||
int transparency, int transparent_color,
|
int transparency, int transparent_color,
|
||||||
int scalex, int scaley, bitmap_ind8 *pri_buffer, uint32_t pri_mask);
|
int scalex, int scaley, bitmap_ind8 *pri_buffer, uint32_t pri_mask);
|
||||||
void cps3(machine_config &config);
|
|
||||||
void jojo(machine_config &config);
|
|
||||||
void redearth(machine_config &config);
|
|
||||||
void sfiii2(machine_config &config);
|
|
||||||
void sfiii3(machine_config &config);
|
|
||||||
void sfiii(machine_config &config);
|
|
||||||
void jojoba(machine_config &config);
|
|
||||||
void simm1_64mbit(machine_config &config);
|
|
||||||
void simm2_64mbit(machine_config &config);
|
|
||||||
void simm3_128mbit(machine_config &config);
|
|
||||||
void simm4_128mbit(machine_config &config);
|
|
||||||
void simm5_128mbit(machine_config &config);
|
|
||||||
void simm5_32mbit(machine_config &config);
|
|
||||||
void simm6_128mbit(machine_config &config);
|
|
||||||
void cps3_map(address_map &map);
|
void cps3_map(address_map &map);
|
||||||
void decrypted_opcodes_map(address_map &map);
|
void decrypted_opcodes_map(address_map &map);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // MAME_INCLUDES_CPS3_H
|
||||||
|
Loading…
Reference in New Issue
Block a user