From 175fcca31ab8a0a2e6e42c5b107d8edd978debbf Mon Sep 17 00:00:00 2001 From: Robbbert Date: Sun, 10 Apr 2022 00:14:27 +1000 Subject: [PATCH] cps1: init vars; coverity 351281; use standard variable names. --- src/mame/drivers/cps1.cpp | 14 ++-- src/mame/includes/cps1.h | 136 +++++++++++++++++++------------------- 2 files changed, 75 insertions(+), 75 deletions(-) diff --git a/src/mame/drivers/cps1.cpp b/src/mame/drivers/cps1.cpp index f7f86ac404d..b573a2fcb7e 100644 --- a/src/mame/drivers/cps1.cpp +++ b/src/mame/drivers/cps1.cpp @@ -14030,16 +14030,16 @@ void cps_state::init_sf2dongb() uint16_t cps_state::sf2ceblp_prot_r() { - if (sf2ceblp_prot == 0x0) + if (m_sf2ceblp_prot == 0x0) return 0x1992; - if (sf2ceblp_prot == 0x04) + if (m_sf2ceblp_prot == 0x04) return 0x0408; return 0xffff; } void cps_state::sf2ceblp_prot_w(uint16_t data) { - sf2ceblp_prot = data; + m_sf2ceblp_prot = data; } @@ -14180,16 +14180,16 @@ Pang 3b4 - code accesso to $5762b0 and $57a2b0 (PIC) */ uint16_t cps_state::pang3b4_prot_r() { - if ((pang3b4_prot & 0xff) >=0 && (pang3b4_prot & 0xff) <=7) - return (pang3b4_prot & 0xff) + 0x20; // Game level + extend - if (pang3b4_prot == 0x17) + if ((m_pang3b4_prot & 0xff) <=7) + return (m_pang3b4_prot & 0xff) + 0x20; // Game level + extend + if (m_pang3b4_prot == 0x17) return 0x7321; // Guessed from code @0x314 return 0xffff; } void cps_state::pang3b4_prot_w(uint16_t data) { - pang3b4_prot = data; + m_pang3b4_prot = data; } diff --git a/src/mame/includes/cps1.h b/src/mame/includes/cps1.h index 05deeda3fd0..135960de09a 100644 --- a/src/mame/includes/cps1.h +++ b/src/mame/includes/cps1.h @@ -51,54 +51,54 @@ struct gfx_range // start and end are as passed by the game (shift adjusted to be all // in the same scale a 8x8 tiles): they don't necessarily match the // position in ROM. - int type; - int start; - int end; - int bank; + int type = 0; + int start = 0; + int end = 0; + int bank = 0; }; struct CPS1config { - const char *name; /* game driver name */ + const char *name = nullptr; /* game driver name */ /* Some games interrogate a couple of registers on bootup. */ /* These are CPS1 board B self test checks. They wander from game to */ /* game. */ - int cpsb_addr; /* CPS board B test register address */ - int cpsb_value; /* CPS board B test register expected value */ + int cpsb_addr = 0; /* CPS board B test register address */ + int cpsb_value = 0; /* CPS board B test register expected value */ /* some games use as a protection check the ability to do 16-bit multiplies */ /* with a 32-bit result, by writing the factors to two ports and reading the */ /* result from two other ports. */ /* It looks like this feature was introduced with 3wonders (CPSB ID = 08xx) */ - int mult_factor1; - int mult_factor2; - int mult_result_lo; - int mult_result_hi; + int mult_factor1 = 0; + int mult_factor2 = 0; + int mult_result_lo = 0; + int mult_result_hi = 0; /* unknown registers which might be related to the multiply protection */ - int unknown1; - int unknown2; - int unknown3; + int unknown1 = 0; + int unknown2 = 0; + int unknown3 = 0; - int layer_control; - int priority[4]; - int palette_control; + int layer_control = 0; + int priority[4]{}; + int palette_control = 0; /* ideally, the layer enable masks should consist of only one bit, */ /* but in many cases it is unknown which bit is which. */ - int layer_enable_mask[5]; + int layer_enable_mask[5]{}; /* these depend on the B-board model and PAL */ - int bank_sizes[4]; + int bank_sizes[4]{}; const struct gfx_range *bank_mapper; /* some C-boards have additional I/O for extra buttons/extra players */ - int in2_addr; - int in3_addr; - int out2_addr; + int in2_addr = 0; + int in3_addr = 0; + int out2_addr = 0; - int bootleg_kludge; + int bootleg_kludge = 0; }; @@ -237,40 +237,40 @@ protected: void varthb2_map(address_map &map); // game-specific - uint16_t sf2ceblp_prot; - uint16_t pang3b4_prot; + uint16_t m_sf2ceblp_prot = 0; + uint16_t m_pang3b4_prot = 0; /* video-related */ - tilemap_t *m_bg_tilemap[3]; - int m_scanline1; - int m_scanline2; - int m_scancalls; + tilemap_t *m_bg_tilemap[3]{}; + int m_scanline1 = 0; + int m_scanline2 = 0; + int m_scancalls = 0; - int m_scroll1x; - int m_scroll1y; - int m_scroll2x; - int m_scroll2y; - int m_scroll3x; - int m_scroll3y; + int m_scroll1x = 0; + int m_scroll1y = 0; + int m_scroll2x = 0; + int m_scroll2y = 0; + int m_scroll3x = 0; + int m_scroll3y = 0; - int m_stars_enabled[2]; /* Layer enabled [Y/N] */ - int m_stars1x; - int m_stars1y; - int m_stars2x; - int m_stars2y; - int m_last_sprite_offset; /* Offset of the last sprite */ + int m_stars_enabled[2]{}; /* Layer enabled [Y/N] */ + int m_stars1x = 0; + int m_stars1y = 0; + int m_stars2x = 0; + int m_stars2y = 0; + int m_last_sprite_offset = 0; /* Offset of the last sprite */ bitmap_ind16 m_dummy_bitmap; /* video config (never changed after video_start) */ const struct CPS1config *m_game_config; - int m_scroll_size; - int m_obj_size; - int m_other_size; - int m_palette_align; - int m_palette_size; - int m_stars_rom_size; - uint8_t m_empty_tile[32*32]; + int m_scroll_size = 0; + int m_obj_size = 0; + int m_other_size = 0; + int m_palette_align = 0; + int m_palette_size = 0; + int m_stars_rom_size = 0; + uint8_t m_empty_tile[32*32]{}; /* video/cps1.cpp */ inline uint16_t *cps1_base( int offset, int boundary ); @@ -289,16 +289,16 @@ protected: required_shared_ptr m_gfxram; required_shared_ptr m_cps_a_regs; required_shared_ptr m_cps_b_regs; - uint16_t * m_scroll1; - uint16_t * m_scroll2; - uint16_t * m_scroll3; - uint16_t * m_obj; - uint16_t * m_other; + uint16_t * m_scroll1 = nullptr; + uint16_t * m_scroll2 = nullptr; + uint16_t * m_scroll3 = nullptr; + uint16_t * m_obj = nullptr; + uint16_t * m_other = nullptr; std::unique_ptr m_buffered_obj; optional_shared_ptr m_qsound_sharedram1; optional_shared_ptr m_qsound_sharedram2; std::unique_ptr m_decrypt_kabuki; - int m_cps_version; + int m_cps_version = 0; /* devices */ required_device m_maincpu; @@ -399,22 +399,22 @@ private: std::unique_ptr m_gigaman2_dummyqsound_ram; /* video-related */ - int m_cps2_last_sprite_offset; /* Offset of the last sprite */ - int m_pri_ctrl; /* Sprite layer priorities */ - int m_objram_bank; - int m_cps2_obj_size; + int m_cps2_last_sprite_offset = 0; /* Offset of the last sprite */ + int m_pri_ctrl = 0; /* Sprite layer priorities */ + int m_objram_bank = 0; + int m_cps2_obj_size = 0; /* misc */ - int m_readpaddle; // pzloop2 - int m_cps2networkpresent; - int m_cps2digitalvolumelevel; - int m_cps2disabledigitalvolume; - emu_timer *m_digital_volume_timer; - int m_cps2_dial_type; - int m_ecofghtr_dial_direction0; - int m_ecofghtr_dial_direction1; - int m_ecofghtr_dial_last0; - int m_ecofghtr_dial_last1; + int m_readpaddle = 0; // pzloop2 + int m_cps2networkpresent = 0; + int m_cps2digitalvolumelevel = 0; + int m_cps2disabledigitalvolume = 0; + emu_timer *m_digital_volume_timer = nullptr; + int m_cps2_dial_type = 0; + int m_ecofghtr_dial_direction0 = 0; + int m_ecofghtr_dial_direction1 = 0; + int m_ecofghtr_dial_last0 = 0; + int m_ecofghtr_dial_last1 = 0; };