mirror of
https://github.com/holub/mame
synced 2025-04-20 23:42:22 +03:00
fixed some modernize-use-auto clang-tidy warnings (nw) (#6238)
This commit is contained in:
parent
4a10205777
commit
dfaf9dd5bc
@ -298,7 +298,7 @@ public:
|
||||
std::uint32_t width = info.video_width;
|
||||
std::uint32_t height = info.video_height;
|
||||
|
||||
std::uint32_t integal_multiple = std::uint32_t(AVI_INTEGRAL_MULTIPLE);
|
||||
auto integal_multiple = std::uint32_t(AVI_INTEGRAL_MULTIPLE);
|
||||
if (integal_multiple > 1)
|
||||
{
|
||||
width = width - (width % integal_multiple);
|
||||
@ -720,8 +720,8 @@ inline void put_64bits(std::uint8_t *data, std::uint64_t value)
|
||||
|
||||
inline void u64toa(std::uint64_t val, char *output)
|
||||
{
|
||||
std::uint32_t lo = std::uint32_t(val & 0xffffffff);
|
||||
std::uint32_t hi = std::uint32_t(val >> 32);
|
||||
auto lo = std::uint32_t(val & 0xffffffff);
|
||||
auto hi = std::uint32_t(val >> 32);
|
||||
if (hi != 0)
|
||||
sprintf(output, "%X%08X", hi, lo);
|
||||
else
|
||||
@ -1055,7 +1055,7 @@ avi_file::error avi_stream::rgb32_compress_to_rgb(const bitmap_rgb32 &bitmap, st
|
||||
|
||||
avi_file::error avi_stream::yuv_decompress_to_yuy16(const std::uint8_t *data, std::uint32_t numbytes, bitmap_yuy16 &bitmap) const
|
||||
{
|
||||
std::uint16_t const *const dataend = reinterpret_cast<const std::uint16_t *>(data + numbytes);
|
||||
auto const *const dataend = reinterpret_cast<const std::uint16_t *>(data + numbytes);
|
||||
int x, y;
|
||||
|
||||
/* compressed video */
|
||||
@ -1107,7 +1107,7 @@ avi_file::error avi_stream::yuv_decompress_to_yuy16(const std::uint8_t *data, st
|
||||
|
||||
avi_file::error avi_stream::yuy16_compress_to_yuy(const bitmap_yuy16 &bitmap, std::uint8_t *data, std::uint32_t numbytes) const
|
||||
{
|
||||
std::uint16_t *const dataend = reinterpret_cast<std::uint16_t *>(data + numbytes);
|
||||
auto *const dataend = reinterpret_cast<std::uint16_t *>(data + numbytes);
|
||||
int x, y;
|
||||
|
||||
/* compressed video */
|
||||
@ -1871,7 +1871,7 @@ avi_file::error avi_file_impl::read_sound_samples(int channel, std::uint32_t fir
|
||||
/* extract 16-bit samples from the chunk */
|
||||
if (stream->samplebits() == 16)
|
||||
{
|
||||
const std::int16_t *base = reinterpret_cast<const std::int16_t *>(&m_tempbuffer[8]);
|
||||
const auto *base = reinterpret_cast<const std::int16_t *>(&m_tempbuffer[8]);
|
||||
base += stream->channels() * (firstsample - chunkbase) + offset;
|
||||
for (sampnum = 0; sampnum < samples_this_chunk; sampnum++)
|
||||
{
|
||||
|
@ -558,7 +558,7 @@ uint32_t cdrom_read_data(cdrom_file *file, uint32_t lbasector, void *buffer, uin
|
||||
/* return 2352 byte mode 1 raw sector from 2048 bytes of mode 1 data */
|
||||
if ((datatype == CD_TRACK_MODE1_RAW) && (tracktype == CD_TRACK_MODE1))
|
||||
{
|
||||
uint8_t *bufptr = (uint8_t *)buffer;
|
||||
auto *bufptr = (uint8_t *)buffer;
|
||||
uint32_t msf = lba_to_msf(lbasector);
|
||||
|
||||
static const uint8_t syncbytes[12] = {0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00};
|
||||
@ -1247,7 +1247,7 @@ chd_error cdrom_parse_metadata(chd_file *chd, cdrom_toc *toc)
|
||||
return err;
|
||||
|
||||
/* reconstruct the TOC from it */
|
||||
uint32_t *mrp = reinterpret_cast<uint32_t *>(&oldmetadata[0]);
|
||||
auto *mrp = reinterpret_cast<uint32_t *>(&oldmetadata[0]);
|
||||
toc->numtrks = *mrp++;
|
||||
|
||||
for (i = 0; i < CD_MAX_TRACKS; i++)
|
||||
|
@ -888,7 +888,7 @@ chd_error chd_file::read_hunk(uint32_t hunknum, void *buffer)
|
||||
uint32_t blocklen;
|
||||
util::crc32_t blockcrc;
|
||||
uint8_t *rawmap;
|
||||
uint8_t *dest = reinterpret_cast<uint8_t *>(buffer);
|
||||
auto *dest = reinterpret_cast<uint8_t *>(buffer);
|
||||
switch (m_version)
|
||||
{
|
||||
// v3/v4 map entries
|
||||
@ -1045,7 +1045,7 @@ chd_error chd_file::write_hunk(uint32_t hunknum, const void *buffer)
|
||||
{
|
||||
// first make sure we need to allocate it
|
||||
bool all_zeros = true;
|
||||
const uint32_t *scan = reinterpret_cast<const uint32_t *>(buffer);
|
||||
const auto *scan = reinterpret_cast<const uint32_t *>(buffer);
|
||||
for (uint32_t index = 0; index < m_hunkbytes / 4; index++)
|
||||
if (scan[index] != 0)
|
||||
{
|
||||
@ -1140,7 +1140,7 @@ chd_error chd_file::read_bytes(uint64_t offset, void *buffer, uint32_t bytes)
|
||||
// iterate over hunks
|
||||
uint32_t first_hunk = offset / m_hunkbytes;
|
||||
uint32_t last_hunk = (offset + bytes - 1) / m_hunkbytes;
|
||||
uint8_t *dest = reinterpret_cast<uint8_t *>(buffer);
|
||||
auto *dest = reinterpret_cast<uint8_t *>(buffer);
|
||||
for (uint32_t curhunk = first_hunk; curhunk <= last_hunk; curhunk++)
|
||||
{
|
||||
// determine start/end boundaries
|
||||
@ -1193,7 +1193,7 @@ chd_error chd_file::write_bytes(uint64_t offset, const void *buffer, uint32_t by
|
||||
// iterate over hunks
|
||||
uint32_t first_hunk = offset / m_hunkbytes;
|
||||
uint32_t last_hunk = (offset + bytes - 1) / m_hunkbytes;
|
||||
const uint8_t *source = reinterpret_cast<const uint8_t *>(buffer);
|
||||
const auto *source = reinterpret_cast<const uint8_t *>(buffer);
|
||||
for (uint32_t curhunk = first_hunk; curhunk <= last_hunk; curhunk++)
|
||||
{
|
||||
// determine start/end boundaries
|
||||
@ -3010,7 +3010,7 @@ chd_error chd_file_compressor::compress_continue(double &progress, double &ratio
|
||||
|
||||
void *chd_file_compressor::async_walk_parent_static(void *param, int threadid)
|
||||
{
|
||||
work_item *item = reinterpret_cast<work_item *>(param);
|
||||
auto *item = reinterpret_cast<work_item *>(param);
|
||||
item->m_compressor->async_walk_parent(*item);
|
||||
return nullptr;
|
||||
}
|
||||
@ -3052,7 +3052,7 @@ void chd_file_compressor::async_walk_parent(work_item &item)
|
||||
|
||||
void *chd_file_compressor::async_compress_hunk_static(void *param, int threadid)
|
||||
{
|
||||
work_item *item = reinterpret_cast<work_item *>(param);
|
||||
auto *item = reinterpret_cast<work_item *>(param);
|
||||
item->m_compressor->async_compress_hunk(*item, threadid);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -751,7 +751,7 @@ void chd_zlib_allocator::install(z_stream &stream)
|
||||
|
||||
voidpf chd_zlib_allocator::fast_alloc(voidpf opaque, uInt items, uInt size)
|
||||
{
|
||||
chd_zlib_allocator *codec = reinterpret_cast<chd_zlib_allocator *>(opaque);
|
||||
auto *codec = reinterpret_cast<chd_zlib_allocator *>(opaque);
|
||||
|
||||
// compute the size, rounding to the nearest 1k
|
||||
size = (size * items + 0x3ff) & ~0x3ff;
|
||||
@ -769,7 +769,7 @@ voidpf chd_zlib_allocator::fast_alloc(voidpf opaque, uInt items, uInt size)
|
||||
}
|
||||
|
||||
// alloc a new one and put it into the list
|
||||
uint32_t *ptr = reinterpret_cast<uint32_t *>(new uint8_t[size + sizeof(uint32_t)]);
|
||||
auto *ptr = reinterpret_cast<uint32_t *>(new uint8_t[size + sizeof(uint32_t)]);
|
||||
for (int scan = 0; scan < MAX_ZLIB_ALLOCS; scan++)
|
||||
if (codec->m_allocptr[scan] == nullptr)
|
||||
{
|
||||
@ -790,7 +790,7 @@ voidpf chd_zlib_allocator::fast_alloc(voidpf opaque, uInt items, uInt size)
|
||||
|
||||
void chd_zlib_allocator::fast_free(voidpf opaque, voidpf address)
|
||||
{
|
||||
chd_zlib_allocator *codec = reinterpret_cast<chd_zlib_allocator *>(opaque);
|
||||
auto *codec = reinterpret_cast<chd_zlib_allocator *>(opaque);
|
||||
|
||||
// find the hunk
|
||||
uint32_t *ptr = reinterpret_cast<uint32_t *>(address) - 1;
|
||||
@ -971,7 +971,7 @@ chd_lzma_allocator::~chd_lzma_allocator()
|
||||
|
||||
void *chd_lzma_allocator::fast_alloc(void *p, size_t size)
|
||||
{
|
||||
chd_lzma_allocator *codec = reinterpret_cast<chd_lzma_allocator *>(p);
|
||||
auto *codec = reinterpret_cast<chd_lzma_allocator *>(p);
|
||||
|
||||
// compute the size, rounding to the nearest 1k
|
||||
size = (size + 0x3ff) & ~0x3ff;
|
||||
@ -989,7 +989,7 @@ void *chd_lzma_allocator::fast_alloc(void *p, size_t size)
|
||||
}
|
||||
|
||||
// alloc a new one and put it into the list
|
||||
uint32_t *ptr = reinterpret_cast<uint32_t *>(new uint8_t[size + sizeof(uint32_t)]);
|
||||
auto *ptr = reinterpret_cast<uint32_t *>(new uint8_t[size + sizeof(uint32_t)]);
|
||||
for (int scan = 0; scan < MAX_LZMA_ALLOCS; scan++)
|
||||
if (codec->m_allocptr[scan] == nullptr)
|
||||
{
|
||||
@ -1013,7 +1013,7 @@ void chd_lzma_allocator::fast_free(void *p, void *address)
|
||||
if (address == nullptr)
|
||||
return;
|
||||
|
||||
chd_lzma_allocator *codec = reinterpret_cast<chd_lzma_allocator *>(p);
|
||||
auto *codec = reinterpret_cast<chd_lzma_allocator *>(p);
|
||||
|
||||
// find the hunk
|
||||
uint32_t *ptr = reinterpret_cast<uint32_t *>(address) - 1;
|
||||
|
@ -395,7 +395,7 @@ int core_text_file::getc()
|
||||
|
||||
// fetch the next character
|
||||
char16_t utf16_buffer[UTF16_CHAR_MAX];
|
||||
char32_t uchar = char32_t(~0);
|
||||
auto uchar = char32_t(~0);
|
||||
switch (m_text_type)
|
||||
{
|
||||
default:
|
||||
|
@ -559,7 +559,7 @@ void flac_decoder::metadata_callback_static(const FLAC__StreamDecoder *decoder,
|
||||
return;
|
||||
|
||||
// parse out the data we care about
|
||||
flac_decoder *fldecoder = reinterpret_cast<flac_decoder *>(client_data);
|
||||
auto *fldecoder = reinterpret_cast<flac_decoder *>(client_data);
|
||||
fldecoder->m_sample_rate = metadata->data.stream_info.sample_rate;
|
||||
fldecoder->m_bits_per_sample = metadata->data.stream_info.bits_per_sample;
|
||||
fldecoder->m_channels = metadata->data.stream_info.channels;
|
||||
|
@ -284,7 +284,7 @@ void crc16_creator::append(const void *data, uint32_t length)
|
||||
0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
|
||||
};
|
||||
|
||||
const uint8_t *src = reinterpret_cast<const uint8_t *>(data);
|
||||
const auto *src = reinterpret_cast<const uint8_t *>(data);
|
||||
|
||||
// fetch the current value into a local and rip through the source data
|
||||
uint16_t crc = m_accum.m_raw;
|
||||
|
@ -189,7 +189,7 @@ static void process_field(jed_data *data, const uint8_t *cursrc, const uint8_t *
|
||||
|
||||
int jed_parse(const void *data, size_t length, jed_data *result)
|
||||
{
|
||||
const uint8_t *cursrc = (const uint8_t *)data;
|
||||
const auto *cursrc = (const uint8_t *)data;
|
||||
const uint8_t *srcend = cursrc + length;
|
||||
const uint8_t *scan;
|
||||
jed_parse_info pinfo;
|
||||
@ -283,7 +283,7 @@ int jed_parse(const void *data, size_t length, jed_data *result)
|
||||
|
||||
size_t jed_output(const jed_data *data, void *result, size_t length)
|
||||
{
|
||||
uint8_t *curdst = (uint8_t *)result;
|
||||
auto *curdst = (uint8_t *)result;
|
||||
uint8_t *dstend = curdst + length;
|
||||
int i, zeros, ones;
|
||||
char tempbuf[256];
|
||||
@ -379,7 +379,7 @@ size_t jed_output(const jed_data *data, void *result, size_t length)
|
||||
|
||||
int jedbin_parse(const void *data, size_t length, jed_data *result)
|
||||
{
|
||||
const uint8_t *cursrc = (const uint8_t *)data;
|
||||
const auto *cursrc = (const uint8_t *)data;
|
||||
|
||||
/* initialize the output */
|
||||
memset(result, 0, sizeof(*result));
|
||||
@ -424,7 +424,7 @@ int jedbin_parse(const void *data, size_t length, jed_data *result)
|
||||
|
||||
size_t jedbin_output(const jed_data *data, void *result, size_t length)
|
||||
{
|
||||
uint8_t *curdst = (uint8_t *)result;
|
||||
auto *curdst = (uint8_t *)result;
|
||||
|
||||
/* ensure we have enough room */
|
||||
if (length >= 4 + (data->numfuses + 7) / 8)
|
||||
|
@ -308,7 +308,7 @@ static bool process_field(jed_data *data, const uint8_t **src, const uint8_t *sr
|
||||
|
||||
int pla_parse(const void *data, size_t length, jed_data *result)
|
||||
{
|
||||
const uint8_t *src = (const uint8_t *)data;
|
||||
const auto *src = (const uint8_t *)data;
|
||||
const uint8_t *srcend = src + length;
|
||||
|
||||
parse_info pinfo;
|
||||
|
@ -201,7 +201,7 @@ private:
|
||||
stream.next_out = pnginfo.image.get();
|
||||
stream.avail_out = expected;
|
||||
stream.avail_in = 0;
|
||||
std::list<image_data_chunk>::const_iterator it = idata.begin();
|
||||
auto it = idata.begin();
|
||||
while ((idata.end() != it) && ((Z_OK == zerr) || (Z_BUF_ERROR == zerr)) && !stream.avail_in)
|
||||
{
|
||||
stream.avail_in = it->length;
|
||||
@ -1042,7 +1042,7 @@ static png_error convert_bitmap_to_image_palette(png_info &pnginfo, const bitmap
|
||||
/* copy in the pixels, specifying a nullptr filter */
|
||||
for (y = 0; y < pnginfo.height; y++)
|
||||
{
|
||||
uint16_t *src = reinterpret_cast<uint16_t *>(bitmap.raw_pixptr(y));
|
||||
auto *src = reinterpret_cast<uint16_t *>(bitmap.raw_pixptr(y));
|
||||
uint8_t *dst = &pnginfo.image[y * (rowbytes + 1)];
|
||||
|
||||
/* store the filter byte, then copy the data */
|
||||
@ -1088,7 +1088,7 @@ static png_error convert_bitmap_to_image_rgb(png_info &pnginfo, const bitmap_t &
|
||||
/* 16bpp palettized format */
|
||||
if (bitmap.format() == BITMAP_FORMAT_IND16)
|
||||
{
|
||||
uint16_t *src16 = reinterpret_cast<uint16_t *>(bitmap.raw_pixptr(y));
|
||||
auto *src16 = reinterpret_cast<uint16_t *>(bitmap.raw_pixptr(y));
|
||||
for (x = 0; x < pnginfo.width; x++)
|
||||
{
|
||||
rgb_t color = palette[*src16++];
|
||||
@ -1101,7 +1101,7 @@ static png_error convert_bitmap_to_image_rgb(png_info &pnginfo, const bitmap_t &
|
||||
/* 32-bit RGB direct */
|
||||
else if (bitmap.format() == BITMAP_FORMAT_RGB32)
|
||||
{
|
||||
uint32_t *src32 = reinterpret_cast<uint32_t *>(bitmap.raw_pixptr(y));
|
||||
auto *src32 = reinterpret_cast<uint32_t *>(bitmap.raw_pixptr(y));
|
||||
for (x = 0; x < pnginfo.width; x++)
|
||||
{
|
||||
rgb_t raw = *src32++;
|
||||
@ -1114,7 +1114,7 @@ static png_error convert_bitmap_to_image_rgb(png_info &pnginfo, const bitmap_t &
|
||||
/* 32-bit ARGB direct */
|
||||
else if (bitmap.format() == BITMAP_FORMAT_ARGB32)
|
||||
{
|
||||
uint32_t *src32 = reinterpret_cast<uint32_t *>(bitmap.raw_pixptr(y));
|
||||
auto *src32 = reinterpret_cast<uint32_t *>(bitmap.raw_pixptr(y));
|
||||
for (x = 0; x < pnginfo.width; x++)
|
||||
{
|
||||
rgb_t raw = *src32++;
|
||||
|
@ -23,7 +23,7 @@ wav_file *wav_open(const char *filename, int sample_rate, int channels)
|
||||
std::uint16_t temp16;
|
||||
|
||||
// allocate memory for the wav struct
|
||||
wav_file *const wav = new (std::nothrow) wav_file;
|
||||
auto *const wav = new (std::nothrow) wav_file;
|
||||
if (!wav)
|
||||
return nullptr;
|
||||
|
||||
|
@ -754,7 +754,7 @@ const char *normalize_string(const char *string)
|
||||
|
||||
static void *expat_malloc(size_t size)
|
||||
{
|
||||
uint32_t *result = (uint32_t *)malloc(size + 4 * sizeof(uint32_t));
|
||||
auto *result = (uint32_t *)malloc(size + 4 * sizeof(uint32_t));
|
||||
*result = size;
|
||||
return &result[4];
|
||||
}
|
||||
@ -837,7 +837,7 @@ static bool expat_setup_parser(parse_info &info, parse_options const *opts)
|
||||
|
||||
static void expat_element_start(void *data, const XML_Char *name, const XML_Char **attributes)
|
||||
{
|
||||
parse_info *info = (parse_info *) data;
|
||||
auto *info = (parse_info *) data;
|
||||
data_node **curnode = &info->curnode;
|
||||
data_node *newnode;
|
||||
int attr;
|
||||
@ -866,7 +866,7 @@ static void expat_element_start(void *data, const XML_Char *name, const XML_Char
|
||||
|
||||
static void expat_data(void *data, const XML_Char *s, int len)
|
||||
{
|
||||
parse_info *info = (parse_info *) data;
|
||||
auto *info = (parse_info *) data;
|
||||
data_node **curnode = &info->curnode;
|
||||
(*curnode)->append_value(s, len);
|
||||
}
|
||||
@ -879,7 +879,7 @@ static void expat_data(void *data, const XML_Char *s, int len)
|
||||
|
||||
static void expat_element_end(void *data, const XML_Char *name)
|
||||
{
|
||||
parse_info *info = (parse_info *) data;
|
||||
auto *info = (parse_info *) data;
|
||||
data_node **curnode = &info->curnode;
|
||||
|
||||
/* strip leading/trailing spaces from the value data */
|
||||
|
@ -261,7 +261,7 @@ static inline void map_attr_to_fg_bg(unsigned char attr, rgb_t *fg, rgb_t *bg)
|
||||
|
||||
bool debug_imgui::get_view_source(void* data, int idx, const char** out_text)
|
||||
{
|
||||
debug_view* vw = static_cast<debug_view*>(data);
|
||||
auto* vw = static_cast<debug_view*>(data);
|
||||
*out_text = vw->source(idx)->name();
|
||||
return true;
|
||||
}
|
||||
@ -295,7 +295,7 @@ void debug_imgui::handle_mouse_views()
|
||||
view_main_disasm->view->set_cursor_position(newpos);
|
||||
view_main_disasm->view->set_cursor_visible(true);
|
||||
}
|
||||
for(std::vector<debug_area*>::iterator it = view_list.begin();it != view_list.end();++it)
|
||||
for(auto it = view_list.begin();it != view_list.end();++it)
|
||||
{
|
||||
rect.min_x = (*it)->ofs_x;
|
||||
rect.min_y = (*it)->ofs_y;
|
||||
@ -323,7 +323,7 @@ void debug_imgui::handle_keys()
|
||||
debug_area* focus_view = nullptr;
|
||||
|
||||
// find view that has focus (should only be one at a time)
|
||||
for(std::vector<debug_area*>::iterator view_ptr = view_list.begin();view_ptr != view_list.end();++view_ptr)
|
||||
for(auto view_ptr = view_list.begin();view_ptr != view_list.end();++view_ptr)
|
||||
if((*view_ptr)->has_focus)
|
||||
focus_view = *view_ptr;
|
||||
|
||||
@ -425,7 +425,7 @@ void debug_imgui::handle_keys_views()
|
||||
{
|
||||
debug_area* focus_view = nullptr;
|
||||
// find view that has focus (should only be one at a time)
|
||||
for(std::vector<debug_area*>::iterator view_ptr = view_list.begin();view_ptr != view_list.end();++view_ptr)
|
||||
for(auto view_ptr = view_list.begin();view_ptr != view_list.end();++view_ptr)
|
||||
if((*view_ptr)->has_focus)
|
||||
focus_view = *view_ptr;
|
||||
|
||||
@ -764,7 +764,7 @@ void debug_imgui::draw_disasm(debug_area* view_ptr, bool* opened)
|
||||
{
|
||||
if(ImGui::BeginMenu("Options"))
|
||||
{
|
||||
debug_view_disasm* disasm = downcast<debug_view_disasm*>(view_ptr->view);
|
||||
auto* disasm = downcast<debug_view_disasm*>(view_ptr->view);
|
||||
int rightcol = disasm->right_column();
|
||||
|
||||
if(ImGui::MenuItem("Raw opcodes", nullptr,(rightcol == DASM_RIGHTCOL_RAW) ? true : false))
|
||||
@ -845,7 +845,7 @@ void debug_imgui::draw_memory(debug_area* view_ptr, bool* opened)
|
||||
{
|
||||
if(ImGui::BeginMenu("Options"))
|
||||
{
|
||||
debug_view_memory* mem = downcast<debug_view_memory*>(view_ptr->view);
|
||||
auto* mem = downcast<debug_view_memory*>(view_ptr->view);
|
||||
bool physical = mem->physical();
|
||||
bool rev = mem->reverse();
|
||||
int format = mem->get_data_format();
|
||||
@ -971,7 +971,7 @@ void debug_imgui::create_image()
|
||||
|
||||
if(m_dialog_image->image_type() == IO_FLOPPY)
|
||||
{
|
||||
floppy_image_device *fd = static_cast<floppy_image_device *>(m_dialog_image);
|
||||
auto *fd = static_cast<floppy_image_device *>(m_dialog_image);
|
||||
res = fd->create(m_path,nullptr,nullptr);
|
||||
if(res == image_init_result::PASS)
|
||||
fd->setup_write(m_typelist.at(m_format_sel).format);
|
||||
@ -1036,7 +1036,7 @@ void debug_imgui::refresh_filelist()
|
||||
|
||||
void debug_imgui::refresh_typelist()
|
||||
{
|
||||
floppy_image_device *fd = static_cast<floppy_image_device *>(m_dialog_image);
|
||||
auto *fd = static_cast<floppy_image_device *>(m_dialog_image);
|
||||
|
||||
m_typelist.clear();
|
||||
if(m_dialog_image->formatlist().empty())
|
||||
@ -1115,7 +1115,7 @@ void debug_imgui::draw_mount_dialog(const char* label)
|
||||
ImGui::Separator();
|
||||
{
|
||||
ImGui::ListBoxHeader("##filelist",m_filelist.size(),15);
|
||||
for(std::vector<file_entry>::iterator f = m_filelist.begin();f != m_filelist.end();++f)
|
||||
for(auto f = m_filelist.begin();f != m_filelist.end();++f)
|
||||
{
|
||||
std::string txt_name;
|
||||
bool sel = false;
|
||||
@ -1177,7 +1177,7 @@ void debug_imgui::draw_create_dialog(const char* label)
|
||||
{
|
||||
std::string combo_str;
|
||||
combo_str.clear();
|
||||
for(std::vector<image_type_entry>::iterator f = m_typelist.begin();f != m_typelist.end();++f)
|
||||
for(auto f = m_typelist.begin();f != m_typelist.end();++f)
|
||||
{
|
||||
// TODO: perhaps do this at the time the format list is generated, rather than every frame
|
||||
combo_str.append((*f).longname);
|
||||
@ -1282,12 +1282,12 @@ void debug_imgui::draw_console()
|
||||
{
|
||||
if(ImGui::MenuItem("Show all"))
|
||||
{
|
||||
for(std::vector<debug_area*>::iterator view_ptr = view_list.begin();view_ptr != view_list.end();++view_ptr)
|
||||
for(auto view_ptr = view_list.begin();view_ptr != view_list.end();++view_ptr)
|
||||
ImGui::SetWindowCollapsed((*view_ptr)->title.c_str(),false);
|
||||
}
|
||||
ImGui::Separator();
|
||||
// list all extra windows, so we can un-collapse the windows if necessary
|
||||
for(std::vector<debug_area*>::iterator view_ptr = view_list.begin();view_ptr != view_list.end();++view_ptr)
|
||||
for(auto view_ptr = view_list.begin();view_ptr != view_list.end();++view_ptr)
|
||||
{
|
||||
bool collapsed = false;
|
||||
if((*view_ptr)->is_collapsed)
|
||||
|
@ -439,7 +439,7 @@ bool consolewin_info::handle_command(WPARAM wparam, LPARAM lparam)
|
||||
}
|
||||
if (img->device().type() == CASSETTE)
|
||||
{
|
||||
cassette_image_device *const cassette = downcast<cassette_image_device *>(&img->device());
|
||||
auto *const cassette = downcast<cassette_image_device *>(&img->device());
|
||||
bool s;
|
||||
switch ((LOWORD(wparam) - ID_DEVICE_OPTIONS) % DEVOPTION_MAX)
|
||||
{
|
||||
|
@ -758,7 +758,7 @@ LRESULT debugview_info::view_proc(UINT message, WPARAM wparam, LPARAM lparam)
|
||||
|
||||
void debugview_info::static_update(debug_view &view, void *osdprivate)
|
||||
{
|
||||
debugview_info *const info = (debugview_info *)osdprivate;
|
||||
auto *const info = (debugview_info *)osdprivate;
|
||||
assert(info->m_view == &view);
|
||||
info->update();
|
||||
}
|
||||
@ -774,7 +774,7 @@ LRESULT CALLBACK debugview_info::static_view_proc(HWND wnd, UINT message, WPARAM
|
||||
return 0;
|
||||
}
|
||||
|
||||
debugview_info *const info = (debugview_info *)(uintptr_t)GetWindowLongPtr(wnd, GWLP_USERDATA);
|
||||
auto *const info = (debugview_info *)(uintptr_t)GetWindowLongPtr(wnd, GWLP_USERDATA);
|
||||
if (info == nullptr)
|
||||
return DefWindowProc(wnd, message, wparam, lparam);
|
||||
|
||||
|
@ -432,7 +432,7 @@ LRESULT debugwin_info::window_proc(UINT message, WPARAM wparam, LPARAM lparam)
|
||||
// get min/max info: set the minimum window size
|
||||
case WM_GETMINMAXINFO:
|
||||
{
|
||||
MINMAXINFO *minmax = (MINMAXINFO *)lparam;
|
||||
auto *minmax = (MINMAXINFO *)lparam;
|
||||
minmax->ptMinTrackSize.x = m_minwidth;
|
||||
minmax->ptMinTrackSize.y = m_minheight;
|
||||
minmax->ptMaxSize.x = minmax->ptMaxTrackSize.x = m_maxwidth;
|
||||
@ -570,14 +570,14 @@ LRESULT CALLBACK debugwin_info::static_window_proc(HWND wnd, UINT message, WPARA
|
||||
{
|
||||
// set the info pointer
|
||||
CREATESTRUCT const *const createinfo = (CREATESTRUCT *)lparam;
|
||||
debugwin_info *const info = (debugwin_info *)createinfo->lpCreateParams;
|
||||
auto *const info = (debugwin_info *)createinfo->lpCreateParams;
|
||||
SetWindowLongPtr(wnd, GWLP_USERDATA, (LONG_PTR)createinfo->lpCreateParams);
|
||||
if (info->m_handler)
|
||||
SetWindowLongPtr(wnd, GWLP_WNDPROC, (LONG_PTR)info->m_handler);
|
||||
return 0;
|
||||
}
|
||||
|
||||
debugwin_info *const info = (debugwin_info *)(uintptr_t)GetWindowLongPtr(wnd, GWLP_USERDATA);
|
||||
auto *const info = (debugwin_info *)(uintptr_t)GetWindowLongPtr(wnd, GWLP_USERDATA);
|
||||
if (info == nullptr)
|
||||
return DefWindowProc(wnd, message, wparam, lparam);
|
||||
|
||||
|
@ -100,7 +100,7 @@ void disasmbasewin_info::update_menu()
|
||||
{
|
||||
editwin_info::update_menu();
|
||||
|
||||
disasmview_info *const dasmview = downcast<disasmview_info *>(m_views[0].get());
|
||||
auto *const dasmview = downcast<disasmview_info *>(m_views[0].get());
|
||||
HMENU const menu = GetMenu(window());
|
||||
|
||||
bool const disasm_cursor_visible = dasmview->cursor_visible();
|
||||
@ -146,7 +146,7 @@ void disasmbasewin_info::update_menu()
|
||||
|
||||
bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
disasmview_info *const dasmview = downcast<disasmview_info *>(m_views[0].get());
|
||||
auto *const dasmview = downcast<disasmview_info *>(m_views[0].get());
|
||||
|
||||
switch (HIWORD(wparam))
|
||||
{
|
||||
|
@ -232,7 +232,7 @@ LRESULT editwin_info::edit_proc(UINT message, WPARAM wparam, LPARAM lparam)
|
||||
|
||||
LRESULT CALLBACK editwin_info::static_edit_proc(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
editwin_info *const info = (editwin_info *)uintptr_t(GetWindowLongPtr(wnd, GWLP_USERDATA));
|
||||
auto *const info = (editwin_info *)uintptr_t(GetWindowLongPtr(wnd, GWLP_USERDATA));
|
||||
assert(info->m_editwnd == wnd);
|
||||
return info->edit_proc(message, wparam, lparam);
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ void memorywin_info::update_menu()
|
||||
{
|
||||
editwin_info::update_menu();
|
||||
|
||||
memoryview_info *const memview = downcast<memoryview_info *>(m_views[0].get());
|
||||
auto *const memview = downcast<memoryview_info *>(m_views[0].get());
|
||||
HMENU const menu = GetMenu(window());
|
||||
CheckMenuItem(menu, ID_1_BYTE_CHUNKS, MF_BYCOMMAND | (memview->data_format() == 1 ? MF_CHECKED : MF_UNCHECKED));
|
||||
CheckMenuItem(menu, ID_2_BYTE_CHUNKS, MF_BYCOMMAND | (memview->data_format() == 2 ? MF_CHECKED : MF_UNCHECKED));
|
||||
@ -196,7 +196,7 @@ void memorywin_info::update_menu()
|
||||
|
||||
bool memorywin_info::handle_command(WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
memoryview_info *const memview = downcast<memoryview_info *>(m_views[0].get());
|
||||
auto *const memview = downcast<memoryview_info *>(m_views[0].get());
|
||||
switch (HIWORD(wparam))
|
||||
{
|
||||
// combo box selection changed
|
||||
|
@ -601,7 +601,7 @@ uintptr_t symbol_manager::get_text_section_base()
|
||||
ImageNtHeader_fn image_nt_header = m_dbghelp_dll->bind<ImageNtHeader_fn>("ImageNtHeader");
|
||||
|
||||
// start with the image base
|
||||
PVOID base = reinterpret_cast<PVOID>(GetModuleHandleUni());
|
||||
auto base = reinterpret_cast<PVOID>(GetModuleHandleUni());
|
||||
assert(base != nullptr);
|
||||
|
||||
// make sure we have the functions we need
|
||||
@ -694,8 +694,8 @@ void sampling_profiler::stop()
|
||||
|
||||
int CLIB_DECL sampling_profiler::compare_address(const void *item1, const void *item2)
|
||||
{
|
||||
const uintptr_t *entry1 = reinterpret_cast<const uintptr_t *>(item1);
|
||||
const uintptr_t *entry2 = reinterpret_cast<const uintptr_t *>(item2);
|
||||
const auto *entry1 = reinterpret_cast<const uintptr_t *>(item1);
|
||||
const auto *entry2 = reinterpret_cast<const uintptr_t *>(item2);
|
||||
int mincount = std::min(entry1[0], entry2[0]);
|
||||
|
||||
// sort in order of: bucket, caller, caller's caller, etc.
|
||||
@ -715,8 +715,8 @@ int CLIB_DECL sampling_profiler::compare_address(const void *item1, const void *
|
||||
|
||||
int CLIB_DECL sampling_profiler::compare_frequency(const void *item1, const void *item2)
|
||||
{
|
||||
const uintptr_t *entry1 = reinterpret_cast<const uintptr_t *>(item1);
|
||||
const uintptr_t *entry2 = reinterpret_cast<const uintptr_t *>(item2);
|
||||
const auto *entry1 = reinterpret_cast<const uintptr_t *>(item1);
|
||||
const auto *entry2 = reinterpret_cast<const uintptr_t *>(item2);
|
||||
|
||||
// sort by frequency, then by address
|
||||
if (entry1[0] != entry2[0])
|
||||
|
@ -403,7 +403,7 @@ public:
|
||||
// populate the buttons
|
||||
for (butnum = 0; butnum < devinfo->dinput.caps.dwButtons; butnum++)
|
||||
{
|
||||
uintptr_t offset = reinterpret_cast<uintptr_t>(&static_cast<DIMOUSESTATE *>(nullptr)->rgbButtons[butnum]);
|
||||
auto offset = reinterpret_cast<uintptr_t>(&static_cast<DIMOUSESTATE *>(nullptr)->rgbButtons[butnum]);
|
||||
|
||||
// add to the mouse device
|
||||
std::string name = device_item_name(devinfo, offset, default_button_name(butnum), nullptr);
|
||||
@ -535,7 +535,7 @@ int dinput_joystick_device::configure()
|
||||
// populate the buttons
|
||||
for (uint32_t butnum = 0; butnum < dinput.caps.dwButtons; butnum++)
|
||||
{
|
||||
uintptr_t offset = reinterpret_cast<uintptr_t>(&static_cast<DIJOYSTATE2 *>(nullptr)->rgbButtons[butnum]);
|
||||
auto offset = reinterpret_cast<uintptr_t>(&static_cast<DIJOYSTATE2 *>(nullptr)->rgbButtons[butnum]);
|
||||
std::string name = dinput_module::device_item_name(this, offset, default_button_name(butnum), nullptr);
|
||||
|
||||
input_item_id itemid;
|
||||
@ -602,7 +602,7 @@ public:
|
||||
|
||||
static int32_t dinput_joystick_pov_get_state(void *device_internal, void *item_internal)
|
||||
{
|
||||
dinput_joystick_device *devinfo = static_cast<dinput_joystick_device *>(device_internal);
|
||||
auto *devinfo = static_cast<dinput_joystick_device *>(device_internal);
|
||||
int povnum = reinterpret_cast<uintptr_t>(item_internal) / 4;
|
||||
int povdir = reinterpret_cast<uintptr_t>(item_internal) % 4;
|
||||
int32_t result = 0;
|
||||
|
@ -619,7 +619,7 @@ protected:
|
||||
{
|
||||
std::lock_guard<std::mutex> scope_lock(m_module_lock);
|
||||
|
||||
RAWINPUT *input = reinterpret_cast<RAWINPUT*>(data);
|
||||
auto *input = reinterpret_cast<RAWINPUT*>(data);
|
||||
|
||||
// find the device in the list and update
|
||||
auto target_device = std::find_if(devicelist()->begin(), devicelist()->end(), [input](auto &device)
|
||||
@ -661,7 +661,7 @@ protected:
|
||||
return;
|
||||
|
||||
// allocate and link in a new device
|
||||
rawinput_keyboard_device *devinfo = create_rawinput_device<rawinput_keyboard_device>(machine, device);
|
||||
auto *devinfo = create_rawinput_device<rawinput_keyboard_device>(machine, device);
|
||||
if (devinfo == nullptr)
|
||||
return;
|
||||
|
||||
@ -706,7 +706,7 @@ protected:
|
||||
return;
|
||||
|
||||
// allocate and link in a new device
|
||||
rawinput_mouse_device *devinfo = create_rawinput_device<rawinput_mouse_device>(machine, device);
|
||||
auto *devinfo = create_rawinput_device<rawinput_mouse_device>(machine, device);
|
||||
if (devinfo == nullptr)
|
||||
return;
|
||||
|
||||
@ -755,7 +755,7 @@ protected:
|
||||
return;
|
||||
|
||||
// allocate and link in a new device
|
||||
rawinput_lightgun_device *devinfo = create_rawinput_device<rawinput_lightgun_device>(machine, device);
|
||||
auto *devinfo = create_rawinput_device<rawinput_lightgun_device>(machine, device);
|
||||
if (devinfo == nullptr)
|
||||
return;
|
||||
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
virtual void input_init(running_machine &machine) override
|
||||
{
|
||||
// Add a single win32 keyboard device that we'll monitor using Win32
|
||||
win32_keyboard_device *devinfo = devicelist()->create_device<win32_keyboard_device>(machine, "Win32 Keyboard 1", "Win32 Keyboard 1", *this);
|
||||
auto *devinfo = devicelist()->create_device<win32_keyboard_device>(machine, "Win32 Keyboard 1", "Win32 Keyboard 1", *this);
|
||||
|
||||
keyboard_trans_table &table = keyboard_trans_table::instance();
|
||||
|
||||
|
@ -262,7 +262,7 @@ protected:
|
||||
|
||||
if (module != nullptr)
|
||||
{
|
||||
generic_fptr_t function = reinterpret_cast<generic_fptr_t>(GetProcAddress(module, symbol));
|
||||
auto function = reinterpret_cast<generic_fptr_t>(GetProcAddress(module, symbol));
|
||||
|
||||
if (function != nullptr)
|
||||
{
|
||||
|
@ -445,7 +445,7 @@ void osd_common_t::init(running_machine &machine)
|
||||
|
||||
m_machine = &machine;
|
||||
|
||||
osd_options &options = downcast<osd_options &>(machine.options());
|
||||
auto &options = downcast<osd_options &>(machine.options());
|
||||
// extract the verbose printing option
|
||||
if (options.verbose())
|
||||
set_verbose(true);
|
||||
@ -624,7 +624,7 @@ bool osd_common_t::execute_command(const char *command)
|
||||
else if (strcmp(command, OSDCOMMAND_LIST_MIDI_DEVICES) == 0)
|
||||
{
|
||||
osd_module *om = select_module_options(options(), OSD_MIDI_PROVIDER);
|
||||
midi_module *pm = select_module_options<midi_module *>(options(), OSD_MIDI_PROVIDER);
|
||||
auto *pm = select_module_options<midi_module *>(options(), OSD_MIDI_PROVIDER);
|
||||
|
||||
if (om->probe())
|
||||
{
|
||||
|
@ -106,7 +106,7 @@ protected:
|
||||
private:
|
||||
static BOOL CALLBACK monitor_enum_callback(HMONITOR handle, HDC dc, LPRECT rect, LPARAM data)
|
||||
{
|
||||
win32_monitor_module* self = reinterpret_cast<win32_monitor_module*>(data);
|
||||
auto* self = reinterpret_cast<win32_monitor_module*>(data);
|
||||
MONITORINFOEX info;
|
||||
BOOL result;
|
||||
|
||||
|
@ -250,7 +250,7 @@ netdev_pcap::~netdev_pcap()
|
||||
|
||||
static CREATE_NETDEV(create_pcap)
|
||||
{
|
||||
class netdev_pcap *dev = global_alloc(netdev_pcap(ifname, ifdev, rate));
|
||||
auto *dev = global_alloc(netdev_pcap(ifname, ifdev, rate));
|
||||
return dynamic_cast<osd_netdev *>(dev);
|
||||
}
|
||||
|
||||
|
@ -337,7 +337,7 @@ int netdev_tap::recv_dev(uint8_t **buf)
|
||||
|
||||
static CREATE_NETDEV(create_tap)
|
||||
{
|
||||
class netdev_tap *dev = global_alloc(netdev_tap(ifname, ifdev, rate));
|
||||
auto *dev = global_alloc(netdev_tap(ifname, ifdev, rate));
|
||||
return dynamic_cast<osd_netdev *>(dev);
|
||||
}
|
||||
|
||||
|
@ -395,7 +395,7 @@ int gl_compile_shader_file( GLhandleARB *shader, GLenum type, const char * shade
|
||||
int const buffer_len = (int)ftell(file);
|
||||
fseek(file, 0, SEEK_SET);
|
||||
|
||||
GLcharARB *const buffer = (GLcharARB *)malloc(buffer_len + 1);
|
||||
auto *const buffer = (GLcharARB *)malloc(buffer_len + 1);
|
||||
memset(buffer, 0, buffer_len + 1);
|
||||
|
||||
/* Load Shader Sources */
|
||||
|
@ -326,7 +326,7 @@ LRESULT output_win32::send_id_string(HWND hwnd, LPARAM id)
|
||||
// allocate memory for the message
|
||||
datalen = sizeof(copydata_id_string) + strlen(name) + 1;
|
||||
std::vector<uint8_t> buffer(datalen);
|
||||
copydata_id_string *temp = (copydata_id_string *)&buffer[0];
|
||||
auto *temp = (copydata_id_string *)&buffer[0];
|
||||
temp->id = id;
|
||||
strcpy(temp->string, name);
|
||||
|
||||
|
@ -119,7 +119,7 @@ void bgfx_chain::process(chain_manager::screen_prim &prim, int view, int screen,
|
||||
static int64_t last = m_current_time;
|
||||
const int64_t frameTime = m_current_time - last;
|
||||
last = m_current_time;
|
||||
const double freq = double(bx::getHPFrequency());
|
||||
const auto freq = double(bx::getHPFrequency());
|
||||
const double toMs = 1000.0 / freq;
|
||||
const double frameTimeInSeconds = (double)frameTime / 1000000.0;
|
||||
|
||||
@ -145,7 +145,7 @@ uint32_t bgfx_chain::applicable_passes()
|
||||
|
||||
void bgfx_chain::insert_effect(uint32_t index, bgfx_effect *effect, std::string name, std::string source, chain_manager &chains)
|
||||
{
|
||||
clear_state *clear = new clear_state(BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH | BGFX_CLEAR_STENCIL, 0, 1.0f, 0);
|
||||
auto *clear = new clear_state(BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH | BGFX_CLEAR_STENCIL, 0, 1.0f, 0);
|
||||
std::vector<bgfx_suppressor*> suppressors;
|
||||
|
||||
std::vector<bgfx_input_pair*> inputs;
|
||||
|
@ -73,10 +73,10 @@ void bgfx_chain_entry::submit(int view, chain_manager::screen_prim &prim, textur
|
||||
uint32_t tint = 0xffffffff;
|
||||
if (m_apply_tint)
|
||||
{
|
||||
const uint8_t a = (uint8_t)std::round(prim.m_prim->color.a * 255);
|
||||
const uint8_t r = (uint8_t)std::round(prim.m_prim->color.r * 255);
|
||||
const uint8_t g = (uint8_t)std::round(prim.m_prim->color.g * 255);
|
||||
const uint8_t b = (uint8_t)std::round(prim.m_prim->color.b * 255);
|
||||
const auto a = (uint8_t)std::round(prim.m_prim->color.a * 255);
|
||||
const auto r = (uint8_t)std::round(prim.m_prim->color.r * 255);
|
||||
const auto g = (uint8_t)std::round(prim.m_prim->color.g * 255);
|
||||
const auto b = (uint8_t)std::round(prim.m_prim->color.b * 255);
|
||||
tint = (a << 24) | (b << 16) | (g << 8) | r;
|
||||
}
|
||||
|
||||
@ -291,7 +291,7 @@ void bgfx_chain_entry::put_screen_buffer(uint16_t screen_width, uint16_t screen_
|
||||
return;
|
||||
}
|
||||
|
||||
ScreenVertex* vertex = reinterpret_cast<ScreenVertex*>(buffer->data);
|
||||
auto* vertex = reinterpret_cast<ScreenVertex*>(buffer->data);
|
||||
|
||||
float x[4] = { 0, 1, 0, 1 };
|
||||
float y[4] = { 0, 0, 1, 1 };
|
||||
|
@ -178,7 +178,7 @@ bgfx_chain_entry* chain_entry_reader::read_from_value(const Value& value, std::s
|
||||
}
|
||||
|
||||
std::string sampler = input["sampler"].GetString();
|
||||
bgfx_input_pair* input_pair = new bgfx_input_pair(i, sampler, texture_name, texture_names, selection, chains, screen_index);
|
||||
auto* input_pair = new bgfx_input_pair(i, sampler, texture_name, texture_names, selection, chains, screen_index);
|
||||
inputs.push_back(input_pair);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ clear_state* clear_reader::read_from_value(const Value& value, std::string prefi
|
||||
for (int i = 0; i < colors.Size(); i++)
|
||||
{
|
||||
if (!READER_CHECK(colors[i].IsNumber(), (prefix + "clearcolor[" + std::to_string(i) + "] must be a numeric value\n").c_str())) return nullptr;
|
||||
int32_t val = int32_t(float(colors[i].GetDouble()) * 255.0f);
|
||||
auto val = int32_t(float(colors[i].GetDouble()) * 255.0f);
|
||||
if (val > 255) val = 255;
|
||||
if (val < 0) val = 0;
|
||||
clear_color |= val << (24 - (i * 3));
|
||||
|
@ -51,6 +51,6 @@ void bgfx_effect::submit(int view, uint64_t blend)
|
||||
|
||||
bgfx_uniform* bgfx_effect::uniform(std::string name)
|
||||
{
|
||||
std::map<std::string, bgfx_uniform*>::iterator iter = m_uniforms.find(name);
|
||||
auto iter = m_uniforms.find(name);
|
||||
return iter != m_uniforms.end() ? iter->second : nullptr;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ bgfx_parameter* parameter_reader::read_from_value(const Value& value, std::strin
|
||||
}
|
||||
else if (type == bgfx_parameter::parameter_type::PARAM_TIME)
|
||||
{
|
||||
float limit = float(value["limit"].GetDouble());
|
||||
auto limit = float(value["limit"].GetDouble());
|
||||
return new bgfx_time_parameter(name, type, limit);
|
||||
}
|
||||
else
|
||||
|
@ -103,7 +103,7 @@ int32_t bgfx_slider::update(std::string *str, int32_t newval)
|
||||
|
||||
default:
|
||||
{
|
||||
float *val_ptr = reinterpret_cast<float *>(&m_value);
|
||||
auto *val_ptr = reinterpret_cast<float *>(&m_value);
|
||||
if (newval != SLIDER_NOCHANGE)
|
||||
{
|
||||
*val_ptr = float(newval) * m_step;
|
||||
|
@ -47,7 +47,7 @@ target_manager::~target_manager()
|
||||
|
||||
bgfx_target* target_manager::create_target(std::string name, bgfx::TextureFormat::Enum format, uint16_t width, uint16_t height, uint32_t style, bool double_buffer, bool filter, uint16_t scale, uint32_t screen)
|
||||
{
|
||||
bgfx_target* target = new bgfx_target(name, format, width, height, style, double_buffer, filter, scale, screen);
|
||||
auto* target = new bgfx_target(name, format, width, height, style, double_buffer, filter, scale, screen);
|
||||
std::string full_name = name + std::to_string(screen);
|
||||
|
||||
m_targets[full_name] = target;
|
||||
@ -70,7 +70,7 @@ void target_manager::destroy_target(std::string name, uint32_t screen)
|
||||
|
||||
bgfx_target* target_manager::create_backbuffer(void *handle, uint16_t width, uint16_t height)
|
||||
{
|
||||
bgfx_target* target = new bgfx_target(handle, width, height);
|
||||
auto* target = new bgfx_target(handle, width, height);
|
||||
m_targets["backbuffer"] = target;
|
||||
return target;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ texture_manager::~texture_manager()
|
||||
|
||||
void texture_manager::add_provider(std::string name, bgfx_texture_handle_provider* provider)
|
||||
{
|
||||
std::map<std::string, bgfx_texture_handle_provider*>::iterator iter = m_textures.find(name);
|
||||
auto iter = m_textures.find(name);
|
||||
if (iter != m_textures.end())
|
||||
{
|
||||
iter->second = provider;
|
||||
@ -50,7 +50,7 @@ void texture_manager::add_provider(std::string name, bgfx_texture_handle_provide
|
||||
|
||||
bgfx_texture* texture_manager::create_texture(std::string name, bgfx::TextureFormat::Enum format, uint32_t width, uint32_t height, void* data, uint32_t flags)
|
||||
{
|
||||
bgfx_texture* texture = new bgfx_texture(name, format, width, height, flags, data);
|
||||
auto* texture = new bgfx_texture(name, format, width, height, flags, data);
|
||||
m_textures[name] = texture;
|
||||
return texture;
|
||||
}
|
||||
@ -67,13 +67,13 @@ bgfx_texture* texture_manager::create_png_texture(std::string path, std::string
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint8_t *data = new uint8_t[bitmap.width() * bitmap.height() * 4];
|
||||
uint32_t *data32 = reinterpret_cast<uint32_t *>(data);
|
||||
auto *data = new uint8_t[bitmap.width() * bitmap.height() * 4];
|
||||
auto *data32 = reinterpret_cast<uint32_t *>(data);
|
||||
|
||||
const uint32_t width = bitmap.width();
|
||||
const uint32_t height = bitmap.height();
|
||||
const uint32_t rowpixels = bitmap.rowpixels();
|
||||
uint32_t* base = reinterpret_cast<uint32_t *>(bitmap.raw_pixptr(0));
|
||||
auto* base = reinterpret_cast<uint32_t *>(bitmap.raw_pixptr(0));
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
copy_util::copyline_argb32(data32 + y * width, base + y * rowpixels, width, nullptr);
|
||||
@ -96,7 +96,7 @@ bgfx::TextureHandle texture_manager::create_or_update_mame_texture(uint32_t form
|
||||
bgfx::TextureHandle handle = BGFX_INVALID_HANDLE;
|
||||
if (old_key != ~0ULL)
|
||||
{
|
||||
std::map<uint64_t, sequenced_handle>::iterator iter = m_mame_textures.find(old_key);
|
||||
auto iter = m_mame_textures.find(old_key);
|
||||
if (iter != m_mame_textures.end())
|
||||
{
|
||||
handle = iter->second.handle;
|
||||
@ -129,7 +129,7 @@ bgfx::TextureHandle texture_manager::create_or_update_mame_texture(uint32_t form
|
||||
}
|
||||
else
|
||||
{
|
||||
std::map<uint64_t, sequenced_handle>::iterator iter = m_mame_textures.find(key);
|
||||
auto iter = m_mame_textures.find(key);
|
||||
if (iter != m_mame_textures.end())
|
||||
{
|
||||
handle = iter->second.handle;
|
||||
@ -168,7 +168,7 @@ bgfx::TextureHandle texture_manager::create_or_update_mame_texture(uint32_t form
|
||||
bgfx::TextureHandle texture_manager::handle(std::string name)
|
||||
{
|
||||
bgfx::TextureHandle handle = BGFX_INVALID_HANDLE;
|
||||
std::map<std::string, bgfx_texture_handle_provider*>::iterator iter = m_textures.find(name);
|
||||
auto iter = m_textures.find(name);
|
||||
if (iter != m_textures.end())
|
||||
{
|
||||
handle = (iter->second)->texture();
|
||||
@ -180,7 +180,7 @@ bgfx::TextureHandle texture_manager::handle(std::string name)
|
||||
|
||||
bgfx_texture_handle_provider* texture_manager::provider(std::string name)
|
||||
{
|
||||
std::map<std::string, bgfx_texture_handle_provider*>::iterator iter = m_textures.find(name);
|
||||
auto iter = m_textures.find(name);
|
||||
if (iter != m_textures.end())
|
||||
{
|
||||
return iter->second;
|
||||
|
@ -32,7 +32,7 @@ bgfx_uniform* uniform_reader::read_from_value(const Value& value, std::string pr
|
||||
const size_t array_size = value_array.Size() * sizeof(float);
|
||||
|
||||
const size_t alloc_size = (type_size > array_size) ? type_size : array_size;
|
||||
float* data = reinterpret_cast<float*>(new char[alloc_size]);
|
||||
auto* data = reinterpret_cast<float*>(new char[alloc_size]);
|
||||
|
||||
unsigned int index = 0;
|
||||
for (; index < type_size / 4 && index < value_array.Size(); index++)
|
||||
@ -45,7 +45,7 @@ bgfx_uniform* uniform_reader::read_from_value(const Value& value, std::string pr
|
||||
data[index] = 0.0f;
|
||||
}
|
||||
|
||||
bgfx_uniform* uniform = new bgfx_uniform(name, type);
|
||||
auto* uniform = new bgfx_uniform(name, type);
|
||||
uniform->set((void*)data, type_size);
|
||||
delete [] data;
|
||||
|
||||
|
@ -39,9 +39,9 @@ const bgfx::Memory* bgfx_util::mame_texture_data_to_bgfx_texture_data(bgfx::Text
|
||||
const bgfx::Memory* bgfx_util::mame_texture_data_to_argb32(uint32_t src_format, int width, int height, int rowpixels, const rgb_t *palette, void *base)
|
||||
{
|
||||
const bgfx::Memory* mem = bgfx::alloc(width * height * 4);
|
||||
uint32_t* dst = reinterpret_cast<uint32_t*>(mem->data);
|
||||
uint16_t* src16 = reinterpret_cast<uint16_t*>(base);
|
||||
uint32_t* src32 = reinterpret_cast<uint32_t*>(base);
|
||||
auto* dst = reinterpret_cast<uint32_t*>(mem->data);
|
||||
auto* src16 = reinterpret_cast<uint16_t*>(base);
|
||||
auto* src32 = reinterpret_cast<uint32_t*>(base);
|
||||
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
|
@ -114,7 +114,7 @@ public:
|
||||
|
||||
for (int y = 0; y < m_height; y++)
|
||||
{
|
||||
DWORD *src = (DWORD *)((BYTE *)rect.pBits + y * rect.Pitch);
|
||||
auto *src = (DWORD *)((BYTE *)rect.pBits + y * rect.Pitch);
|
||||
uint32_t *dst = &m_frame.pix32(y);
|
||||
|
||||
for (int x = 0; x < m_width; x++)
|
||||
@ -342,7 +342,7 @@ void shaders::render_snapshot(IDirect3DSurface9 *surface)
|
||||
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
DWORD *src = (DWORD *)((BYTE *)rect.pBits + y * rect.Pitch);
|
||||
auto *src = (DWORD *)((BYTE *)rect.pBits + y * rect.Pitch);
|
||||
uint32_t *dst = &snapshot.pix32(y);
|
||||
|
||||
for (int x = 0; x < width; x++)
|
||||
@ -492,7 +492,7 @@ bool shaders::init(d3d_base *d3dintf, running_machine *machine, renderer_d3d9 *r
|
||||
|
||||
enumerate_screens();
|
||||
|
||||
windows_options &winoptions = downcast<windows_options &>(machine->options());
|
||||
auto &winoptions = downcast<windows_options &>(machine->options());
|
||||
|
||||
post_fx_enable = winoptions.d3d_hlsl_enable();
|
||||
oversampling_enable = winoptions.d3d_hlsl_oversampling();
|
||||
@ -2013,7 +2013,7 @@ int32_t slider::update(std::string *str, int32_t newval)
|
||||
{
|
||||
case SLIDER_INT_ENUM:
|
||||
{
|
||||
int32_t *val_ptr = reinterpret_cast<int32_t *>(m_value);
|
||||
auto *val_ptr = reinterpret_cast<int32_t *>(m_value);
|
||||
if (newval != SLIDER_NOCHANGE)
|
||||
{
|
||||
*val_ptr = newval;
|
||||
@ -2041,7 +2041,7 @@ int32_t slider::update(std::string *str, int32_t newval)
|
||||
|
||||
default:
|
||||
{
|
||||
float *val_ptr = reinterpret_cast<float *>(m_value);
|
||||
auto *val_ptr = reinterpret_cast<float *>(m_value);
|
||||
if (newval != SLIDER_NOCHANGE)
|
||||
{
|
||||
*val_ptr = (float)newval * m_desc->scale;
|
||||
@ -2354,7 +2354,7 @@ void shaders::init_slider_list()
|
||||
|
||||
for (int j = 0; j < count; j++)
|
||||
{
|
||||
slider* slider_arg = new slider(desc, get_slider_option(desc->id, j), &options->params_dirty);
|
||||
auto* slider_arg = new slider(desc, get_slider_option(desc->id, j), &options->params_dirty);
|
||||
internal_sliders.push_back(slider_arg);
|
||||
std::string name = desc->name;
|
||||
switch (desc->slider_type)
|
||||
|
@ -454,7 +454,7 @@ bgfx::VertexLayout ScreenVertex::ms_decl;
|
||||
void renderer_bgfx::put_packed_quad(render_primitive *prim, uint32_t hash, ScreenVertex* vertices)
|
||||
{
|
||||
rectangle_packer::packed_rectangle& rect = m_hash_to_entry[hash];
|
||||
float size = float(CACHE_SIZE);
|
||||
auto size = float(CACHE_SIZE);
|
||||
float u0 = (float(rect.x()) + 0.5f) / size;
|
||||
float v0 = (float(rect.y()) + 0.5f) / size;
|
||||
float u1 = u0 + (float(rect.width()) - 1.0f) / size;
|
||||
@ -517,7 +517,7 @@ void renderer_bgfx::vertex(ScreenVertex* vertex, float x, float y, float z, uint
|
||||
|
||||
void renderer_bgfx::render_post_screen_quad(int view, render_primitive* prim, bgfx::TransientVertexBuffer* buffer, int32_t screen)
|
||||
{
|
||||
ScreenVertex* vertices = reinterpret_cast<ScreenVertex*>(buffer->data);
|
||||
auto* vertices = reinterpret_cast<ScreenVertex*>(buffer->data);
|
||||
|
||||
float x[4] = { prim->bounds.x0, prim->bounds.x1, prim->bounds.x0, prim->bounds.x1 };
|
||||
float y[4] = { prim->bounds.y0, prim->bounds.y0, prim->bounds.y1, prim->bounds.y1 };
|
||||
@ -553,7 +553,7 @@ void renderer_bgfx::render_avi_quad()
|
||||
|
||||
bgfx::TransientVertexBuffer buffer;
|
||||
bgfx::allocTransientVertexBuffer(&buffer, 6, ScreenVertex::ms_decl);
|
||||
ScreenVertex* vertices = reinterpret_cast<ScreenVertex*>(buffer.data);
|
||||
auto* vertices = reinterpret_cast<ScreenVertex*>(buffer.data);
|
||||
|
||||
float x[4] = { 0.0f, float(m_width[0]), 0.0f, float(m_width[0]) };
|
||||
float y[4] = { 0.0f, 0.0f, float(m_height[0]), float(m_height[0]) };
|
||||
@ -576,7 +576,7 @@ void renderer_bgfx::render_avi_quad()
|
||||
|
||||
void renderer_bgfx::render_textured_quad(render_primitive* prim, bgfx::TransientVertexBuffer* buffer)
|
||||
{
|
||||
ScreenVertex* vertices = reinterpret_cast<ScreenVertex*>(buffer->data);
|
||||
auto* vertices = reinterpret_cast<ScreenVertex*>(buffer->data);
|
||||
uint32_t rgba = u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255);
|
||||
|
||||
float x[4] = { prim->bounds.x0, prim->bounds.x1, prim->bounds.x0, prim->bounds.x1 };
|
||||
|
@ -489,9 +489,9 @@ texture_info *d3d_texture_manager::find_texinfo(const render_texinfo *texinfo, u
|
||||
// find a match
|
||||
for (auto it = m_texture_list.begin(); it != m_texture_list.end(); it++)
|
||||
{
|
||||
uint32_t test_screen = (uint32_t)((*it)->get_texinfo().unique_id >> 57);
|
||||
auto test_screen = (uint32_t)((*it)->get_texinfo().unique_id >> 57);
|
||||
uint32_t test_page = (uint32_t)((*it)->get_texinfo().unique_id >> 56) & 1;
|
||||
uint32_t prim_screen = (uint32_t)(texinfo->unique_id >> 57);
|
||||
auto prim_screen = (uint32_t)(texinfo->unique_id >> 57);
|
||||
uint32_t prim_page = (uint32_t)(texinfo->unique_id >> 56) & 1;
|
||||
if (test_screen != prim_screen || test_page != prim_page)
|
||||
continue;
|
||||
@ -778,7 +778,7 @@ void renderer_d3d9::update_gamma_ramp()
|
||||
if (win->fullscreen())
|
||||
{
|
||||
// only set the gamma if it's not 1.0
|
||||
windows_options &options = downcast<windows_options &>(win->machine().options());
|
||||
auto &options = downcast<windows_options &>(win->machine().options());
|
||||
float brightness = options.full_screen_brightness();
|
||||
float contrast = options.full_screen_contrast();
|
||||
float gamma = options.full_screen_gamma();
|
||||
@ -1484,8 +1484,8 @@ void renderer_d3d9::batch_vectors(int vector_count)
|
||||
((rotation_0 || rotation_90) && orientation_swap_xy) ||
|
||||
((rotation_180 || rotation_90) && !orientation_swap_xy);
|
||||
|
||||
float screen_width = float(this->get_width());
|
||||
float screen_height = float(this->get_height());
|
||||
auto screen_width = float(this->get_width());
|
||||
auto screen_height = float(this->get_height());
|
||||
float half_screen_width = screen_width * 0.5f;
|
||||
float half_screen_height = screen_height * 0.5f;
|
||||
float screen_swap_x_factor = 1.0f / screen_width * screen_height;
|
||||
@ -1614,10 +1614,10 @@ void renderer_d3d9::batch_vector(const render_primitive &prim)
|
||||
}
|
||||
|
||||
// determine the color of the line
|
||||
int32_t r = (int32_t)(prim.color.r * 255.0f);
|
||||
int32_t g = (int32_t)(prim.color.g * 255.0f);
|
||||
int32_t b = (int32_t)(prim.color.b * 255.0f);
|
||||
int32_t a = (int32_t)(prim.color.a * 255.0f);
|
||||
auto r = (int32_t)(prim.color.r * 255.0f);
|
||||
auto g = (int32_t)(prim.color.g * 255.0f);
|
||||
auto b = (int32_t)(prim.color.b * 255.0f);
|
||||
auto a = (int32_t)(prim.color.a * 255.0f);
|
||||
DWORD color = D3DCOLOR_ARGB(a, r, g, b);
|
||||
|
||||
// set the color, Z parameters to standard values
|
||||
@ -1684,10 +1684,10 @@ void renderer_d3d9::draw_line(const render_primitive &prim)
|
||||
vertex[3].v0 = stop.c.y;
|
||||
|
||||
// determine the color of the line
|
||||
int32_t r = (int32_t)(prim.color.r * 255.0f);
|
||||
int32_t g = (int32_t)(prim.color.g * 255.0f);
|
||||
int32_t b = (int32_t)(prim.color.b * 255.0f);
|
||||
int32_t a = (int32_t)(prim.color.a * 255.0f);
|
||||
auto r = (int32_t)(prim.color.r * 255.0f);
|
||||
auto g = (int32_t)(prim.color.g * 255.0f);
|
||||
auto b = (int32_t)(prim.color.b * 255.0f);
|
||||
auto a = (int32_t)(prim.color.a * 255.0f);
|
||||
DWORD color = D3DCOLOR_ARGB(a, r, g, b);
|
||||
|
||||
// set the color, Z parameters to standard values
|
||||
@ -1753,10 +1753,10 @@ void renderer_d3d9::draw_quad(const render_primitive &prim)
|
||||
}
|
||||
|
||||
// determine the color, allowing for over modulation
|
||||
int32_t r = (int32_t)(prim.color.r * 255.0f);
|
||||
int32_t g = (int32_t)(prim.color.g * 255.0f);
|
||||
int32_t b = (int32_t)(prim.color.b * 255.0f);
|
||||
int32_t a = (int32_t)(prim.color.a * 255.0f);
|
||||
auto r = (int32_t)(prim.color.r * 255.0f);
|
||||
auto g = (int32_t)(prim.color.g * 255.0f);
|
||||
auto b = (int32_t)(prim.color.b * 255.0f);
|
||||
auto a = (int32_t)(prim.color.a * 255.0f);
|
||||
DWORD color = D3DCOLOR_ARGB(a, r, g, b);
|
||||
|
||||
// adjust half pixel X/Y offset, set the color, Z parameters to standard values
|
||||
@ -2706,8 +2706,8 @@ bool d3d_render_target::init(renderer_d3d9 *d3d, int source_width, int source_he
|
||||
float scale_factor = 0.75f;
|
||||
int scale_count = vector_screen ? MAX_BLOOM_COUNT : HALF_BLOOM_COUNT;
|
||||
|
||||
float bloom_width = (float)source_width;
|
||||
float bloom_height = (float)source_height;
|
||||
auto bloom_width = (float)source_width;
|
||||
auto bloom_height = (float)source_height;
|
||||
float bloom_size = bloom_width < bloom_height ? bloom_width : bloom_height;
|
||||
for (int bloom_index = 0; bloom_index < scale_count && bloom_size >= 2.0f; bloom_size *= scale_factor)
|
||||
{
|
||||
|
@ -445,7 +445,7 @@ void osd_work_queue_free(osd_work_queue *queue)
|
||||
// free all items in the free list
|
||||
while (queue->free.load() != nullptr)
|
||||
{
|
||||
osd_work_item *item = (osd_work_item *)queue->free;
|
||||
auto *item = (osd_work_item *)queue->free;
|
||||
queue->free = item->next;
|
||||
delete item->event;
|
||||
delete item;
|
||||
@ -454,7 +454,7 @@ void osd_work_queue_free(osd_work_queue *queue)
|
||||
// free all items in the active list
|
||||
while (queue->list.load() != nullptr)
|
||||
{
|
||||
osd_work_item *item = (osd_work_item *)queue->list;
|
||||
auto *item = (osd_work_item *)queue->list;
|
||||
queue->list = item->next;
|
||||
delete item->event;
|
||||
delete item;
|
||||
@ -670,7 +670,7 @@ static int effective_num_processors()
|
||||
|
||||
static void *worker_thread_entry(void *param)
|
||||
{
|
||||
work_thread_info *thread = (work_thread_info *)param;
|
||||
auto *thread = (work_thread_info *)param;
|
||||
osd_work_queue &queue = thread->queue;
|
||||
|
||||
// loop until we exit
|
||||
|
@ -43,7 +43,7 @@ void osd_watchdog::setTimeout(int timeout)
|
||||
|
||||
void *osd_watchdog::watchdog_thread(void *param)
|
||||
{
|
||||
osd_watchdog *const thiz(reinterpret_cast<osd_watchdog *>(param));
|
||||
auto *const thiz(reinterpret_cast<osd_watchdog *>(param));
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ bool windows_osd_interface::video_init()
|
||||
window_init();
|
||||
|
||||
// create the windows
|
||||
windows_options &options = downcast<windows_options &>(machine().options());
|
||||
auto &options = downcast<windows_options &>(machine().options());
|
||||
for (int index = 0; index < video_config.numscreens; index++)
|
||||
{
|
||||
win_window_info::create(machine(), index, m_monitor_module->pick_monitor(options, index), &windows[index]);
|
||||
|
@ -780,7 +780,7 @@ void win_window_info::create(running_machine &machine, int index, std::shared_pt
|
||||
window->m_target = machine.render().target_alloc();
|
||||
|
||||
// set the specific view
|
||||
windows_options &options = downcast<windows_options &>(machine.options());
|
||||
auto &options = downcast<windows_options &>(machine.options());
|
||||
|
||||
const char *defview = options.view();
|
||||
window->set_starting_view(index, defview, options.view(index));
|
||||
@ -1180,7 +1180,7 @@ int win_window_info::complete_create()
|
||||
LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
LONG_PTR ptr = GetWindowLongPtr(wnd, GWLP_USERDATA);
|
||||
win_window_info *window = (win_window_info *)ptr;
|
||||
auto *window = (win_window_info *)ptr;
|
||||
|
||||
// we may get called before SetWindowLongPtr is called
|
||||
if (window != nullptr)
|
||||
@ -1293,7 +1293,7 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR
|
||||
// get min/max info: set the minimum window size
|
||||
case WM_GETMINMAXINFO:
|
||||
{
|
||||
MINMAXINFO *minmax = (MINMAXINFO *)lparam;
|
||||
auto *minmax = (MINMAXINFO *)lparam;
|
||||
minmax->ptMinTrackSize.x = MIN_WINDOW_DIM;
|
||||
minmax->ptMinTrackSize.y = MIN_WINDOW_DIM;
|
||||
break;
|
||||
|
@ -514,7 +514,7 @@ void windows_osd_interface::init(running_machine &machine)
|
||||
osd_common_t::init(machine);
|
||||
|
||||
const char *stemp;
|
||||
windows_options &options = downcast<windows_options &>(machine.options());
|
||||
auto &options = downcast<windows_options &>(machine.options());
|
||||
|
||||
// determine if we are benchmarking, and adjust options appropriately
|
||||
int bench = options.bench();
|
||||
|
@ -100,7 +100,7 @@ std::string win_get_window_text_utf8(HWND window)
|
||||
if (length <= 0)
|
||||
return std::string();
|
||||
|
||||
TCHAR *buffer = (TCHAR *) alloca((length + 1) * sizeof(TCHAR));
|
||||
auto *buffer = (TCHAR *) alloca((length + 1) * sizeof(TCHAR));
|
||||
GetWindowText(window, buffer, length + 1);
|
||||
return osd::text::from_tstring(buffer);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user