Fixed a few more class memory access warnings, and a little cleanup.

This commit is contained in:
Vas Crabb 2024-04-22 04:19:47 +10:00
parent afc8de349e
commit 24154bc1f0
9 changed files with 68 additions and 90 deletions

View file

@ -151,9 +151,9 @@ msx_slot_fsa1fm_device::msx_slot_fsa1fm_device(const machine_config &mconfig, co
static INPUT_PORTS_START(fsa1fm)
PORT_START("SWITCH")
PORT_CONFNAME(0x04, 0x00, "Firmware")
PORT_CONFSETTING(0x04, "disabled")
PORT_CONFSETTING(0x00, "enabled")
PORT_CONFNAME(0x04, 0x00, "Enable Firmware")
PORT_CONFSETTING(0x04, DEF_STR(No))
PORT_CONFSETTING(0x00, DEF_STR(Yes))
INPUT_PORTS_END
ioport_constructor msx_slot_fsa1fm_device::device_input_ports() const

View file

@ -11,8 +11,11 @@
#include "emu.h"
#include "floppy.h"
#include "formats/vt_dsk.h"
#include "formats/fs_vtech.h"
#include "formats/vt_dsk.h"
#include <algorithm>
//**************************************************************************
@ -143,7 +146,7 @@ void vtech_floppy_controller_device::device_reset()
m_last_latching_inverter_update_time = machine().time();
m_write_start_time = attotime::never;
m_write_position = 0;
memset(m_write_buffer, 0, sizeof(m_write_buffer));
std::fill(std::begin(m_write_buffer), std::end(m_write_buffer), attotime::zero);
}
@ -309,13 +312,13 @@ void vtech_floppy_controller_device::flush_writes(bool keep_margin)
m_write_position -= kept_count;
if(m_write_position && m_write_buffer[0] == m_write_start_time) {
if(m_write_position)
memmove(m_write_buffer, m_write_buffer+1, sizeof(m_write_buffer[0])*(m_write_position-1));
std::copy_n(m_write_buffer + 1, m_write_position - 1, m_write_buffer);
m_write_position--;
}
m_selected_floppy->write_flux(m_write_start_time, limit, m_write_position, m_write_buffer);
m_write_start_time = limit;
if(kept_count != 0)
memmove(m_write_buffer, m_write_buffer+kept_pos, kept_count*sizeof(m_write_buffer[0]));
std::copy_n(m_write_buffer + kept_pos, kept_count, m_write_buffer);
m_write_position = kept_count;
}

View file

@ -11,9 +11,14 @@
#include "emu.h"
#include "spu.h"
#include "spureverb.h"
#include "cpu/psx/psx.h"
#include "corestr.h"
#include <algorithm>
//
//
//
@ -360,24 +365,19 @@ struct spu_device::cache_pointer
signed short *ptr;
sample_cache *cache;
cache_pointer()
: ptr(nullptr),
cache(nullptr)
cache_pointer() : ptr(nullptr), cache(nullptr)
{
}
cache_pointer(const cache_pointer &other)
: ptr(nullptr),
cache(nullptr)
cache_pointer(const cache_pointer &other) : cache_pointer()
{
operator =(other);
operator=(other);
}
cache_pointer(signed short *_ptr, sample_cache *_cache)
: ptr(_ptr),
cache(_cache)
cache_pointer(signed short *_ptr, sample_cache *_cache) : ptr(_ptr), cache(_cache)
{
if (cache) cache->add_ref();
if (cache)
cache->add_ref();
}
~cache_pointer()
@ -386,23 +386,20 @@ struct spu_device::cache_pointer
}
void reset();
cache_pointer &operator =(const cache_pointer &other);
cache_pointer &operator=(const cache_pointer &other);
bool update(spu_device *spu);
unsigned int get_address() const
{
if (cache)
{
return cache->get_sample_address(ptr);
} else
{
else
return -1;
}
}
operator bool() const { return cache!=nullptr; }
bool is_valid() const { return ((cache) && (cache->is_valid_pointer(ptr))); }
bool is_valid() const { return cache && cache->is_valid_pointer(ptr); }
};
//
@ -411,35 +408,34 @@ struct spu_device::cache_pointer
struct spu_device::voiceinfo
{
cache_pointer play,loop;
sample_loop_cache *loop_cache;
unsigned int dptr,
lcptr;
cache_pointer play, loop;
sample_loop_cache *loop_cache = nullptr;
unsigned int dptr = 0, lcptr = 0;
int env_state;
float env_ar,
env_dr,
env_sr,
env_rr,
env_sl,
env_level,
env_delta,
int env_state = 0;
float env_ar = 0.0F,
env_dr = 0.0F,
env_sr = 0.0F,
env_rr = 0.0F,
env_sl = 0.0F,
env_level = 0.0F,
env_delta = 0.0F,
//>>
sweep_vol[2],
sweep_rate[2];
int vol[2];
sweep_vol[2] = { 0.0F, 0.0F },
sweep_rate[2] = { 0.0F, 0.0F };
int vol[2] = { 0, 0 };
//<<
unsigned int pitch,
samplestoend,
samplestoirq,
envsamples;
bool hitirq,
inloopcache,
forceloop,
_pad;
int64_t keyontime;
unsigned int pitch = 0,
samplestoend = 0,
samplestoirq = 0,
envsamples = 0;
bool hitirq = false,
inloopcache = false,
forceloop = false,
_pad = false;
int64_t keyontime = 0;
};
//
@ -970,11 +966,11 @@ void spu_device::device_start()
generate_linear_release_rate_table();
generate_exp_release_rate_table();
voice=new voiceinfo [24];
spu_ram=std::make_unique<unsigned char []>(spu_ram_size);
voice = new voiceinfo [24];
spu_ram = std::make_unique<unsigned char []>(spu_ram_size);
xa_buffer=new spu_stream_buffer(xa_sector_size,xa_buffer_sectors);
cdda_buffer=new spu_stream_buffer(cdda_sector_size,cdda_buffer_sectors);
xa_buffer = new spu_stream_buffer(xa_sector_size, xa_buffer_sectors);
cdda_buffer = new spu_stream_buffer(cdda_sector_size, cdda_buffer_sectors);
init_stream();
@ -1037,7 +1033,7 @@ void spu_device::device_reset()
memset(spu_ram.get(),0,spu_ram_size);
memset(reg,0,0x200);
memset(voice,0,sizeof(voiceinfo)*24);
std::fill_n(voice, 24, voiceinfo());
spureg.status|=(1<<7)|(1<<10);
@ -1087,7 +1083,7 @@ void spu_device::device_stop()
cache.reset();
delete xa_buffer;
delete cdda_buffer;
delete [] voice;
delete[] voice;
}
//
//

View file

@ -505,18 +505,17 @@ void midtunit_video_device::dma_draw()
// only process if not clipped
if (sx >= m_dma_state.leftclip && sx <= m_dma_state.rightclip)
{
// special case similar handling of zero/non-zero
if (Zero == NonZero)
{
// special case similar handling of zero/non-zero
if (Zero == PIXEL_COLOR)
d[sx] = color;
else if (Zero == PIXEL_COPY)
d[sx] = (EXTRACTGEN(mask)) | pal;
}
// otherwise, read the pixel and look
else
{
// otherwise, read the pixel and look
int pixel = (EXTRACTGEN(mask));
// non-zero pixel case
@ -962,18 +961,17 @@ void midtunit_video_device::log_bitmap(int command, int bpp, bool Skip)
// loop until we draw the entire width
while (ix < width)
{
// special case similar handling of zero/non-zero
if (Zero == NonZero)
{
// special case similar handling of zero/non-zero
if (Zero == PIXEL_COLOR)
*d = m_palette->palette()->entry_list_raw()[color];
else if (Zero == PIXEL_COPY)
*d = m_palette->palette()->entry_list_raw()[(EXTRACTGEN(mask)) | pal];
}
// otherwise, read the pixel and look
else
{
// otherwise, read the pixel and look
int const pixel = (EXTRACTGEN(mask));
// non-zero pixel case

View file

@ -91,7 +91,7 @@ public:
uint8_t numpages = 0; // number of allocated pages
uint8_t flip = 0; // screen flip?
uint8_t rowscroll = 0, colscroll = 0; // are rowscroll/colscroll enabled (if external enables are used)
uint8_t bank[8]; // indexes of the tile banks
uint8_t bank[8] = {0,0,0,0,0,0,0,0}; // indexes of the tile banks
uint16_t banksize = 0; // number of tiles per bank
uint16_t latched_xscroll[4] = {0,0,0,0}; // latched X scroll values
uint16_t latched_yscroll[4] = {0,0,0,0}; // latched Y scroll values

View file

@ -192,9 +192,6 @@ raiden2cop_device::raiden2cop_device(const machine_config &mconfig, const char *
memset(cop_itoa_digits, 0, sizeof(uint8_t)*10);
memset(cop_regs, 0, sizeof(uint32_t)*8);
memset(cop_collision_info, 0, sizeof(colinfo)*2);
}

View file

@ -110,29 +110,13 @@ public:
struct colinfo {
colinfo()
{
pos[0] = pos[1] = pos[2] = 0;
dx[0] = dx[1] = dx[2] = 0;
size[0] = size[1] = size[2] = 0;
allow_swap = false;
flags_swap = 0;
spradr = 0;
min[0] = min[1] = min[2] = 0;
max[0] = max[1] = max[2] = 0;
}
int16_t pos[3];
int8_t dx[3];
uint8_t size[3];
bool allow_swap;
uint16_t flags_swap;
uint32_t spradr;
int16_t min[3], max[3];
int16_t pos[3] = { 0, 0, 0 };
int8_t dx[3] = { 0, 0, 0 };
uint8_t size[3] = { 0, 0, 0 };
bool allow_swap = false;
uint16_t flags_swap = 0;
uint32_t spradr = 0;
int16_t min[3] = { 0, 0, 0 }, max[3] = { 0, 0, 0 };
};
colinfo cop_collision_info[2];

View file

@ -9,6 +9,8 @@
#include "emu.h"
#include "hpc3.h"
#include <algorithm>
#define LOG_UNKNOWN (1U << 1)
#define LOG_PBUS_DMA (1U << 2)
#define LOG_SCSI (1U << 3)
@ -155,7 +157,7 @@ void hpc3_device::device_reset()
{
m_cpu_aux_ctrl = 0;
memset(m_scsi_dma, 0, sizeof(scsi_dma_t) * 2);
std::fill(std::begin(m_scsi_dma), std::end(m_scsi_dma), scsi_dma_t());
for (uint32_t i = 0; i < 8; i++)
{

View file

@ -45,9 +45,7 @@ static const char *const usbregnames[] = {
ohci_usb_controller::ohci_usb_controller()
{
memset(&ohcist, 0, sizeof(ohcist));
m_maincpu = nullptr;
irq_callback = nullptr;
}
void ohci_usb_controller::start()