diff --git a/hash/bkrankp_cart.xml b/hash/bkrankp_cart.xml
index a9d29a56db3..607765065d1 100644
--- a/hash/bkrankp_cart.xml
+++ b/hash/bkrankp_cart.xml
@@ -217,8 +217,8 @@ Known carts:
Disney Dream Hit Song
2015
Bandai
-
+
diff --git a/src/devices/sound/gb.cpp b/src/devices/sound/gb.cpp
index ea537870907..e2e28e4d1d3 100644
--- a/src/devices/sound/gb.cpp
+++ b/src/devices/sound/gb.cpp
@@ -510,8 +510,9 @@ void agb_apu_device::update_wave_channel(struct SOUND &snd, uint64_t cycles)
{
if (snd.on)
{
- const uint8_t level_table[8] = {0, 4, 2, 1, 3, 3, 3, 3};
- // compensate for left over cycles
+ constexpr uint8_t level_table[8] = { 0, 4, 2, 1, 3, 3, 3, 3 };
+
+ // compensate for leftover cycles
if (snd.cycles_left > 0)
{
if (cycles <= snd.cycles_left)
@@ -523,7 +524,6 @@ void agb_apu_device::update_wave_channel(struct SOUND &snd, uint64_t cycles)
else
{
// Emit samples
-
cycles -= snd.cycles_left;
snd.cycles_left = 0;
}
@@ -553,10 +553,10 @@ void agb_apu_device::update_wave_channel(struct SOUND &snd, uint64_t cycles)
snd.current_sample >>= 4;
}
snd.current_sample = (snd.current_sample & 0x0f) - 8;
- snd.signal = level ? (snd.current_sample * level) / 4 : 0;
+ snd.signal = level ? ((snd.current_sample * level) / 4) : 0;
cycles %= distance;
- snd.sample_reading = cycles ? false : true;
+ snd.sample_reading = !cycles;
snd.frequency_counter = snd.frequency + cycles;
}
@@ -750,12 +750,11 @@ u8 agb_apu_device::sound_r(offs_t offset)
if ((offset >= AUD3W0) && (offset <= AUD3WF))
return wave_r(offset - AUD3W0);
- static const uint8_t read_mask[0x40] =
- {
+ static constexpr uint8_t read_mask[0x40] = {
0x80, 0x3f, 0x00, 0xff, 0xbf, 0xff, 0x3f, 0x00, 0xff, 0xbf, 0x1f, 0xff, 0x1f, 0xff, 0xbf, 0xff,
0xff, 0x00, 0x00, 0xbf, 0x00, 0x00, 0x70, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
// Make sure we are up to date.
m_channel->update();
diff --git a/src/devices/sound/gb.h b/src/devices/sound/gb.h
index dd5204dee6b..87e9c8ae7b2 100644
--- a/src/devices/sound/gb.h
+++ b/src/devices/sound/gb.h
@@ -199,6 +199,7 @@ protected:
virtual void update_wave_channel(struct SOUND &snd, uint64_t cycles) override;
};
+
class agb_apu_device : public cgb04_apu_device
{
public:
@@ -215,6 +216,7 @@ protected:
virtual void update_wave_channel(struct SOUND &snd, uint64_t cycles) override;
};
+
DECLARE_DEVICE_TYPE(DMG_APU, dmg_apu_device)
//DECLARE_DEVICE_TYPE(CGB02_APU, cgb02_apu_device)
DECLARE_DEVICE_TYPE(CGB04_APU, cgb04_apu_device)
diff --git a/src/lib/formats/fs_fat.cpp b/src/lib/formats/fs_fat.cpp
index fe9a7b949c4..3ccd4a5bca7 100644
--- a/src/lib/formats/fs_fat.cpp
+++ b/src/lib/formats/fs_fat.cpp
@@ -150,6 +150,8 @@
#include
#include
+#include
+
using namespace fs;
@@ -287,9 +289,9 @@ private:
std::optional find_entity(const std::vector &path) const;
directory_span::ptr find_directory(std::vector::const_iterator path_begin, std::vector::const_iterator path_end) const;
std::optional find_child(const directory_span ¤t_dir, std::string_view target) const;
- void iterate_directory_entries(const directory_span &dir, const std::function &callback) const;
- bool is_valid_short_filename(std::string &filename);
- err_t build_direntry_filename(std::string &filename, std::string &fname);
+ template void iterate_directory_entries(const directory_span &dir, T &&callback) const;
+ bool is_valid_short_filename(std::string const &filename);
+ err_t build_direntry_filename(std::string const &filename, std::string &fname);
err_t file_create_root(std::string &fname, u8 attributes = 0);
err_t file_create_directory(directory_entry &dirent, std::string &fname, u8 attributes = 0);
err_t file_create_sector(u32 sector, std::string &fname, u8 attributes);
@@ -350,7 +352,7 @@ private:
namespace {
bool validate_filename(std::string_view name)
{
- auto is_invalid_filename_char = [](char ch)
+ auto const is_invalid_filename_char = [] (char ch)
{
return ch == '\0' || strchr("\\/:*?\"<>|", ch);
};
@@ -450,8 +452,8 @@ char fs::fat_image::directory_separator() const
std::vector fs::fat_image::volume_meta_description() const
{
std::vector results;
- results.emplace_back(meta_name::name, "UNTITLED", false, [](const meta_value &m) { return validate_filename(m.as_string()); }, "Volume name");
- results.emplace_back(meta_name::oem_name, "", false, [](const meta_value &m) { return m.as_string().size() <= 8; }, "OEM name, up to 8 characters");
+ results.emplace_back(meta_name::name, "UNTITLED", false, [] (const meta_value &m) { return validate_filename(m.as_string()); }, "Volume name");
+ results.emplace_back(meta_name::oem_name, "", false, [] (const meta_value &m) { return m.as_string().size() <= 8; }, "OEM name, up to 8 characters");
return results;
}
@@ -463,7 +465,7 @@ std::vector fs::fat_image::volume_meta_description() const
std::vector fs::fat_image::file_meta_description() const
{
std::vector results;
- results.emplace_back(meta_name::name, "", false, [](const meta_value &m) { return validate_filename(m.as_string()); }, "File name");
+ results.emplace_back(meta_name::name, "", false, [] (const meta_value &m) { return validate_filename(m.as_string()); }, "File name");
results.emplace_back(meta_name::creation_date, util::arbitrary_datetime::now(), false, nullptr, "Creation time");
results.emplace_back(meta_name::modification_date, util::arbitrary_datetime::now(), false, nullptr, "Modification time");
results.emplace_back(meta_name::length, 0, true, nullptr, "Size of the file in bytes");
@@ -478,7 +480,7 @@ std::vector fs::fat_image::file_meta_description() const
std::vector fs::fat_image::directory_meta_description() const
{
std::vector results;
- results.emplace_back(meta_name::name, "", false, [](const meta_value &m) { return validate_filename(m.as_string()); }, "File name");
+ results.emplace_back(meta_name::name, "", false, [] (const meta_value &m) { return validate_filename(m.as_string()); }, "File name");
results.emplace_back(meta_name::creation_date, util::arbitrary_datetime::now(), false, nullptr, "Creation time");
results.emplace_back(meta_name::modification_date, util::arbitrary_datetime::now(), false, nullptr, "Modification time");
return results;
@@ -577,7 +579,7 @@ meta_data impl::volume_metadata()
// Get the volume label from the root directory, not the extended BPB (whose name field may not be kept up-to-date even when it exists)
meta_data results;
- auto callback = [&results](const directory_entry &dirent)
+ auto const callback = [&results] (const directory_entry &dirent)
{
if (dirent.is_volume_label())
{
@@ -620,7 +622,7 @@ std::pair> impl::directory_contents(const std::vec
return std::make_pair(ERR_NOT_FOUND, std::vector());
std::vector results;
- auto callback = [&results](const directory_entry &dirent)
+ auto const callback = [&results] (const directory_entry &dirent)
{
if (!dirent.is_volume_label())
{
@@ -664,7 +666,7 @@ std::pair> impl::file_read(const std::vector
}
-bool impl::is_valid_short_filename(std::string &filename)
+bool impl::is_valid_short_filename(std::string const &filename)
{
/*
Valid characters in DOS file names:
@@ -680,7 +682,7 @@ bool impl::is_valid_short_filename(std::string &filename)
}
-err_t impl::build_direntry_filename(std::string &filename, std::string &fname)
+err_t impl::build_direntry_filename(std::string const &filename, std::string &fname)
{
std::regex filename_regex("([A-Z0-9!#\\$%&\\(\\)\\-@^_`\\{\\}~]{0,8})(\\.([A-Z0-9!#\\$%&\\(\\)\\-@^_`\\{\\}~]{0,3}))?");
std::smatch smatch;
@@ -712,14 +714,16 @@ err_t impl::file_create(const std::vector &path, const meta_data &m
if (path.empty())
{
return file_create_root(fname);
- } else {
+ }
+ else
+ {
// Make sure that all parts of the path exist, creating the path parts as needed.
std::optional dirent = find_entity(path);
if (!dirent)
{
std::vector partial_path;
- std::optional parent_entry = { };
- for (auto path_part : path)
+ std::optional parent_entry;
+ for (auto const &path_part : path)
{
partial_path.emplace_back(path_part);
std::optional dir_entry = find_entity(partial_path);
@@ -733,8 +737,8 @@ err_t impl::file_create(const std::vector &path, const meta_data &m
if (err != ERR_OK)
return err;
err = !parent_entry ?
- file_create_root(part_fname, directory_entry::ATTR_DIRECTORY) :
- file_create_directory(parent_entry.value(), part_fname, directory_entry::ATTR_DIRECTORY);
+ file_create_root(part_fname, directory_entry::ATTR_DIRECTORY) :
+ file_create_directory(parent_entry.value(), part_fname, directory_entry::ATTR_DIRECTORY);
if (err != ERR_OK)
return err;
@@ -759,7 +763,7 @@ err_t impl::file_create(const std::vector &path, const meta_data &m
return ERR_INVALID;
}
- return file_create_directory(dirent.value(), fname);
+ return file_create_directory(*dirent, fname);
}
}
@@ -825,7 +829,8 @@ err_t impl::file_create_directory(directory_entry &dirent, std::string &fname, u
u32 current_cluster = dirent.start_cluster();
do {
const u32 first_sector = first_cluster_sector(current_cluster);
- for (int i = 0; i < m_sectors_per_cluster; i++) {
+ for (int i = 0; i < m_sectors_per_cluster; i++)
+ {
err_t err = file_create_sector(first_sector + i, fname, attributes);
if (err != ERR_NOT_FOUND)
return err;
@@ -833,7 +838,8 @@ err_t impl::file_create_directory(directory_entry &dirent, std::string &fname, u
// File could not be created yet. Move to next cluster, allocating a new cluster when needed.
u32 next_cluster = get_next_cluster(current_cluster);
- if (next_cluster >= m_last_valid_cluster) {
+ if (next_cluster >= m_last_valid_cluster)
+ {
next_cluster = find_free_cluster();
if (next_cluster == 0)
return ERR_NO_SPACE;
@@ -861,7 +867,8 @@ u32 impl::first_cluster_sector(u32 cluster)
void impl::clear_cluster_sectors(u32 cluster, u8 fill_byte)
{
const u32 sector = first_cluster_sector(cluster);
- for (int i = 0; i < m_sectors_per_cluster; i++) {
+ for (int i = 0; i < m_sectors_per_cluster; i++)
+ {
auto dirblk = m_blockdev.get(sector + i);
for (int offset = 0; offset < m_bytes_per_sector; offset++)
dirblk.w8(offset, fill_byte);
@@ -1095,7 +1102,8 @@ void impl::set_next_cluster(u32 cluster, u32 next_cluster)
next_cluster = next_cluster >> bit_count;
current_bit += bit_count;
// Write back to backing blocks
- for (int i = 0; i < m_fat_count; i++) {
+ for (int i = 0; i < m_fat_count; i++)
+ {
u32 fat_sector = m_fat_start_sector + (i * m_fat_sector_count) + (byte_pos / m_bytes_per_sector);
auto fatblk = m_blockdev.get(fat_sector);
fatblk.w8(byte_pos % m_bytes_per_sector, m_file_allocation_table[byte_pos]);
@@ -1113,7 +1121,8 @@ u32 impl::find_free_cluster()
u32 data_starting_sector = m_starting_sector + m_reserved_sector_count + fat_sector_count + root_directory_sector_count;
u32 data_cluster_count = (m_sector_count - data_starting_sector) / m_sectors_per_cluster;
- for (u32 cluster = FIRST_VALID_CLUSTER; cluster < (data_cluster_count + 2); cluster++) {
+ for (u32 cluster = FIRST_VALID_CLUSTER; cluster < (data_cluster_count + 2); cluster++)
+ {
u32 entry_bit_position = cluster * m_bits_per_fat_entry;
if (entry_bit_position + m_bits_per_fat_entry <= m_file_allocation_table.size() * 8)
@@ -1191,7 +1200,7 @@ directory_span::ptr impl::find_directory(std::vector::const_iterato
std::optional impl::find_child(const directory_span ¤t_dir, std::string_view target) const
{
std::optional result;
- auto callback = [&result, target](const directory_entry &dirent)
+ auto const callback = [&result, target] (const directory_entry &dirent)
{
bool found = dirent.name() == target;
if (found)
@@ -1207,7 +1216,8 @@ std::optional impl::find_child(const directory_span ¤t_di
// impl::iterate_directory_entries
//-------------------------------------------------
-void impl::iterate_directory_entries(const directory_span &dir, const std::function &callback) const
+template
+void impl::iterate_directory_entries(const directory_span &dir, T &&callback) const
{
std::vector sectors = dir.get_directory_sectors();
for (u32 sector : sectors)
diff --git a/src/lib/util/cdrom.cpp b/src/lib/util/cdrom.cpp
index d9074bfd838..76f3fe55155 100644
--- a/src/lib/util/cdrom.cpp
+++ b/src/lib/util/cdrom.cpp
@@ -181,7 +181,7 @@ cdrom_file::cdrom_file(std::string_view inputfile)
track.logframeofs = track.pregap;
}
- if ((cdtoc.flags & CD_FLAG_MULTISESSION) && cdtrack_info.track[i].leadin != -1)
+ if ((cdtoc.flags & CD_FLAG_MULTISESSION) && (cdtrack_info.track[i].leadin != -1))
logofs += cdtrack_info.track[i].leadin;
track.physframeofs = physofs;
@@ -199,24 +199,26 @@ cdrom_file::cdrom_file(std::string_view inputfile)
logofs += cdtrack_info.track[i].leadout;
if (EXTRA_VERBOSE)
+ {
printf("session %d track %02d is format %d subtype %d datasize %d subsize %d frames %d extraframes %d pregap %d pgmode %d presize %d postgap %d logofs %d physofs %d chdofs %d logframes %d pad %d\n",
- track.session+1,
- i+1,
- track.trktype,
- track.subtype,
- track.datasize,
- track.subsize,
- track.frames,
- track.extraframes,
- track.pregap,
- track.pgtype,
- track.pgdatasize,
- track.postgap,
- track.logframeofs,
- track.physframeofs,
- track.chdframeofs,
- track.logframes,
- track.padframes);
+ track.session + 1,
+ i + 1,
+ track.trktype,
+ track.subtype,
+ track.datasize,
+ track.subsize,
+ track.frames,
+ track.extraframes,
+ track.pregap,
+ track.pgtype,
+ track.pgdatasize,
+ track.postgap,
+ track.logframeofs,
+ track.physframeofs,
+ track.chdframeofs,
+ track.logframes,
+ track.padframes);
+ }
}
// fill out dummy entries for the last track to help our search
@@ -299,24 +301,26 @@ cdrom_file::cdrom_file(chd_file *_chd)
logofs += track.frames;
if (EXTRA_VERBOSE)
+ {
printf("session %d track %02d is format %d subtype %d datasize %d subsize %d frames %d extraframes %d pregap %d pgmode %d presize %d postgap %d logofs %d physofs %d chdofs %d logframes %d pad %d\n",
- track.session+1,
- i+1,
- track.trktype,
- track.subtype,
- track.datasize,
- track.subsize,
- track.frames,
- track.extraframes,
- track.pregap,
- track.pgtype,
- track.pgdatasize,
- track.postgap,
- track.logframeofs,
- track.physframeofs,
- track.chdframeofs,
- track.logframes,
- track.padframes);
+ track.session + 1,
+ i + 1,
+ track.trktype,
+ track.subtype,
+ track.datasize,
+ track.subsize,
+ track.frames,
+ track.extraframes,
+ track.pregap,
+ track.pgtype,
+ track.pgdatasize,
+ track.postgap,
+ track.logframeofs,
+ track.physframeofs,
+ track.chdframeofs,
+ track.logframes,
+ track.padframes);
+ }
}
// fill out dummy entries for the last track to help our search
@@ -916,7 +920,7 @@ std::error_condition cdrom_file::parse_metadata(chd_file *chd, toc &toc)
std::fill(std::begin(pgtype), std::end(pgtype), 0);
std::fill(std::begin(pgsub), std::end(pgsub), 0);
- /* fetch the metadata for this track */
+ // fetch the metadata for this track
if (!chd->read_metadata(CDROM_TRACK_METADATA_TAG, toc.numtrks, metadata))
{
if (sscanf(metadata.c_str(), CDROM_TRACK_METADATA_FORMAT, &tracknum, type, subtype, &frames) != 4)
@@ -929,11 +933,10 @@ std::error_condition cdrom_file::parse_metadata(chd_file *chd, toc &toc)
}
else
{
- /* fall through to GD-ROM detection */
+ // fall through to GD-ROM detection
err = chd->read_metadata(GDROM_OLD_METADATA_TAG, toc.numtrks, metadata);
if (!err)
- /* legacy GDROM track was detected */
- toc.flags |= CD_FLAG_GDROMLE;
+ toc.flags |= CD_FLAG_GDROMLE; // legacy GDROM track was detected
else
err = chd->read_metadata(GDROM_TRACK_METADATA_TAG, toc.numtrks, metadata);
@@ -951,25 +954,25 @@ std::error_condition cdrom_file::parse_metadata(chd_file *chd, toc &toc)
track = &toc.tracks[tracknum - 1];
- /* extract the track type and determine the data size */
+ // extract the track type and determine the data size
track->trktype = CD_TRACK_MODE1;
track->datasize = 0;
convert_type_string_to_track_info(type, track);
if (track->datasize == 0)
return chd_file::error::INVALID_DATA;
- /* extract the subtype and determine the subcode data size */
+ // extract the subtype and determine the subcode data size
track->subtype = CD_SUB_NONE;
track->subsize = 0;
convert_subtype_string_to_track_info(subtype, track);
- /* set the frames and extra frames data */
+ // set the frames and extra frames data
track->frames = frames;
track->padframes = padframes;
int padded = (frames + TRACK_PADDING - 1) / TRACK_PADDING;
track->extraframes = padded * TRACK_PADDING - frames;
- /* set the pregap info */
+ // set the pregap info
track->pregap = pregap;
track->pgtype = CD_TRACK_MODE1;
track->pgsub = CD_SUB_NONE;
@@ -1515,7 +1518,7 @@ uint64_t cdrom_file::get_file_size(std::string_view filename)
* @return An int.
*/
-int cdrom_file::tokenize( const char *linebuffer, int i, int linebuffersize, char *token, int tokensize )
+int cdrom_file::tokenize(const char *linebuffer, int i, int linebuffersize, char *token, int tokensize)
{
int j = 0;
bool singlequote = false;
@@ -1569,19 +1572,19 @@ int cdrom_file::tokenize( const char *linebuffer, int i, int linebuffersize, cha
* @return An int.
*/
-int cdrom_file::msf_to_frames( char *token )
+int cdrom_file::msf_to_frames(const char *token)
{
int m = 0;
int s = 0;
int f = 0;
- if( sscanf( token, "%d:%d:%d", &m, &s, &f ) == 1 )
+ if (sscanf(token, "%d:%d:%d", &m, &s, &f ) == 1)
{
f = m;
}
else
{
- /* convert to just frames */
+ // convert to just frames
s += (m * 60);
f += (s * 75);
}
@@ -2318,7 +2321,7 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto
/* get pregap time */
TOKENIZE
- session_pregap = msf_to_frames( token );
+ session_pregap = msf_to_frames(token);
}
else if (!strncmp(linebuffer+i, "LEAD-OUT", 8))
{
@@ -2332,7 +2335,7 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto
/* get lead-out time */
TOKENIZE
- int leadout_offset = msf_to_frames( token );
+ int leadout_offset = msf_to_frames(token);
outinfo.track[trknum].leadout = leadout_offset;
}
else if (!strncmp(linebuffer+i, "LEAD-IN", 7))
@@ -2345,7 +2348,7 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto
/* get lead-in time */
TOKENIZE
- leadin = msf_to_frames( token );
+ leadin = msf_to_frames(token);
}
else if (is_gdrom && !strncmp(linebuffer+i, "SINGLE-DENSITY AREA", 19))
{
@@ -2479,7 +2482,7 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto
/* get index */
TOKENIZE
- frames = msf_to_frames( token );
+ frames = msf_to_frames(token);
if (idx < 0 || idx > MAX_INDEX)
{
@@ -2509,7 +2512,7 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto
/* get index */
TOKENIZE
- frames = msf_to_frames( token );
+ frames = msf_to_frames(token);
outtoc.tracks[trknum].pregap = frames;
}
@@ -2519,7 +2522,7 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto
/* get index */
TOKENIZE
- frames = msf_to_frames( token );
+ frames = msf_to_frames(token);
outtoc.tracks[trknum].postgap = frames;
}
@@ -2719,24 +2722,26 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto
}
if (EXTRA_VERBOSE)
+ {
for (trknum = 0; trknum < outtoc.numtrks; trknum++)
{
printf("session %d trk %d: %d frames @ offset %d, pad=%d, split=%d, area=%d, phys=%d, pregap=%d, pgtype=%d, pgdatasize=%d, idx0=%d, idx1=%d, dataframes=%d\n",
- outtoc.tracks[trknum].session+1,
- trknum+1,
- outtoc.tracks[trknum].frames,
- outinfo.track[trknum].offset,
- outtoc.tracks[trknum].padframes,
- outtoc.tracks[trknum].splitframes,
- outtoc.tracks[trknum].multicuearea,
- outtoc.tracks[trknum].physframeofs,
- outtoc.tracks[trknum].pregap,
- outtoc.tracks[trknum].pgtype,
- outtoc.tracks[trknum].pgdatasize,
- outinfo.track[trknum].idx[0],
- outinfo.track[trknum].idx[1],
- outtoc.tracks[trknum].frames - outtoc.tracks[trknum].padframes);
+ outtoc.tracks[trknum].session + 1,
+ trknum + 1,
+ outtoc.tracks[trknum].frames,
+ outinfo.track[trknum].offset,
+ outtoc.tracks[trknum].padframes,
+ outtoc.tracks[trknum].splitframes,
+ outtoc.tracks[trknum].multicuearea,
+ outtoc.tracks[trknum].physframeofs,
+ outtoc.tracks[trknum].pregap,
+ outtoc.tracks[trknum].pgtype,
+ outtoc.tracks[trknum].pgdatasize,
+ outinfo.track[trknum].idx[0],
+ outinfo.track[trknum].idx[1],
+ outtoc.tracks[trknum].frames - outtoc.tracks[trknum].padframes);
}
+ }
return std::error_condition();
}
@@ -2913,7 +2918,7 @@ std::error_condition cdrom_file::parse_toc(std::string_view tocfname, toc &outto
else if (isdigit((uint8_t)token[0]))
{
/* convert the time to an offset */
- f = msf_to_frames( token );
+ f = msf_to_frames(token);
f *= (outtoc.tracks[trknum].datasize + outtoc.tracks[trknum].subsize);
}
@@ -2929,7 +2934,7 @@ std::error_condition cdrom_file::parse_toc(std::string_view tocfname, toc &outto
if (isdigit((uint8_t)token[0]))
{
// this could be the length or an offset from the previous field.
- f = msf_to_frames( token );
+ f = msf_to_frames(token);
TOKENIZE
@@ -2941,7 +2946,7 @@ std::error_condition cdrom_file::parse_toc(std::string_view tocfname, toc &outto
outinfo.track[trknum].offset += f;
// this is the length.
- f = msf_to_frames( token );
+ f = msf_to_frames(token);
}
}
else if( trknum == 0 && outinfo.track[trknum].offset != 0 )
@@ -2991,7 +2996,7 @@ std::error_condition cdrom_file::parse_toc(std::string_view tocfname, toc &outto
/* get index */
TOKENIZE
- frames = msf_to_frames( token );
+ frames = msf_to_frames(token);
outtoc.tracks[trknum].pregap = frames;
}
diff --git a/src/lib/util/cdrom.h b/src/lib/util/cdrom.h
index dd62badeff1..b11ecb5b3ba 100644
--- a/src/lib/util/cdrom.h
+++ b/src/lib/util/cdrom.h
@@ -16,6 +16,12 @@
#include "ioprocs.h"
#include "osdcore.h"
+#include
+#include
+#include
+#include
+
+
class cdrom_file {
public:
// tracks are padded to a multiple of this many frames
@@ -159,7 +165,8 @@ public:
static std::error_condition parse_toc(std::string_view tocfname, toc &outtoc, track_input_info &outinfo);
int get_last_session() const { return cdtoc.numsessions ? cdtoc.numsessions : 1; }
int get_last_track() const { return cdtoc.numtrks; }
- int get_adr_control(int track) const {
+ int get_adr_control(int track) const
+ {
if (track == 0xaa)
track = get_last_track() - 1; // use last track's flags
int adrctl = (CD_FLAG_ADR_START_TIME << 4) | (cdtoc.tracks[track].control_flags & 0x0f);
@@ -282,8 +289,8 @@ private:
static std::string get_file_path(std::string &path);
static uint64_t get_file_size(std::string_view filename);
- static int tokenize( const char *linebuffer, int i, int linebuffersize, char *token, int tokensize );
- static int msf_to_frames( char *token );
+ static int tokenize(const char *linebuffer, int i, int linebuffersize, char *token, int tokensize);
+ static int msf_to_frames(const char *token);
static uint32_t parse_wav_sample(std::string_view filename, uint32_t *dataoffs);
static uint16_t read_uint16(FILE *infile);
static uint32_t read_uint32(FILE *infile);
diff --git a/src/mame/nintendo/gba.cpp b/src/mame/nintendo/gba.cpp
index 7730b2a699a..93401f513c6 100644
--- a/src/mame/nintendo/gba.cpp
+++ b/src/mame/nintendo/gba.cpp
@@ -1453,7 +1453,7 @@ static void gba_cart(device_slot_interface &device)
void gba_state::gbadv(machine_config &config)
{
- ARM7(config, m_maincpu, XTAL(4'194'304) * 4); // 4.194304MHz * 4
+ ARM7(config, m_maincpu, 4.194304_MHz_XTAL * 4);
m_maincpu->set_addrmap(AS_PROGRAM, &gba_state::gba_map);
gba_lcd_device &lcd(GBA_LCD(config, "lcd", 0));
@@ -1465,7 +1465,7 @@ void gba_state::gbadv(machine_config &config)
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
- AGB_APU(config, m_gbsound, XTAL(4'194'304));
+ AGB_APU(config, m_gbsound, 4.194304_MHz_XTAL);
m_gbsound->add_route(0, "lspeaker", 0.5);
m_gbsound->add_route(1, "rspeaker", 0.5);
diff --git a/src/mame/olympia/dday.cpp b/src/mame/olympia/dday.cpp
index ad6db7ab5a0..1b7b006e930 100644
--- a/src/mame/olympia/dday.cpp
+++ b/src/mame/olympia/dday.cpp
@@ -73,7 +73,7 @@ public:
m_textvideoram(*this, "textvideoram"),
m_fgvideoram(*this, "fgvideoram"),
m_bgvideoram(*this, "bgvideoram"),
- m_colorram(*this, "colorram"),
+ m_colorram(*this, "colorram", 0x400 >> 5, ENDIANNESS_LITTLE),
m_sl_map(*this, "sl_map"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
@@ -93,7 +93,7 @@ private:
required_shared_ptr m_textvideoram;
required_shared_ptr m_fgvideoram;
required_shared_ptr m_bgvideoram;
- required_shared_ptr m_colorram;
+ memory_share_creator m_colorram;
required_region_ptr m_sl_map;
required_device m_maincpu;
@@ -273,8 +273,8 @@ TILE_GET_INFO_MEMBER(dday_state::get_bg_tile_info)
TILE_GET_INFO_MEMBER(dday_state::get_fg_tile_info)
{
- int const flipx = m_colorram[tile_index & 0x03e0] & 0x01;
- int const code = m_fgvideoram[flipx ? tile_index ^ 0x1f : tile_index];
+ int const flipx = m_colorram[tile_index >> 5] & 0x01;
+ int const code = m_fgvideoram[flipx ? (tile_index ^ 0x1f) : tile_index];
tileinfo.set(2, code, code >> 5, flipx ? TILE_FLIPX : 0);
}
@@ -288,8 +288,8 @@ TILE_GET_INFO_MEMBER(dday_state::get_sl_tile_info)
{
uint8_t *sl_map = &m_sl_map[(m_sl_image & 0x07) * 0x0200];
- int const flipx = (tile_index >> 4) & 0x01;
- int const sl_flipx = (m_sl_image >> 3) & 0x01;
+ int const flipx = BIT(tile_index, 4);
+ int const sl_flipx = BIT(m_sl_image, 3);
// bit 4 is really a flip indicator. Need to shift bits 5-9 to the right by 1
tile_index = ((tile_index & 0x03e0) >> 1) | (tile_index & 0x0f);
@@ -351,7 +351,7 @@ void dday_state::colorram_w(offs_t offset, uint8_t data)
{
offset &= 0x03e0;
- m_colorram[offset & 0x3e0] = data;
+ m_colorram[offset >> 5] = data;
for (int i = 0; i < 0x20; i++)
m_fg_tilemap->mark_tile_dirty(offset + i);
@@ -359,7 +359,7 @@ void dday_state::colorram_w(offs_t offset, uint8_t data)
uint8_t dday_state::colorram_r(offs_t offset)
{
- return m_colorram[offset & 0x03e0];
+ return m_colorram[offset >> 5];
}
@@ -438,7 +438,7 @@ void dday_state::program_map(address_map &map)
map(0x5000, 0x53ff).ram().w(FUNC(dday_state::textvideoram_w)).share(m_textvideoram);
map(0x5400, 0x57ff).ram().w(FUNC(dday_state::fgvideoram_w)).share(m_fgvideoram);
map(0x5800, 0x5bff).ram().w(FUNC(dday_state::bgvideoram_w)).share(m_bgvideoram);
- map(0x5c00, 0x5fff).rw(FUNC(dday_state::colorram_r), FUNC(dday_state::colorram_w)).share(m_colorram);
+ map(0x5c00, 0x5fff).rw(FUNC(dday_state::colorram_r), FUNC(dday_state::colorram_w));
map(0x6000, 0x63ff).ram();
map(0x6400, 0x6401).mirror(0x000e).w(m_ay1, FUNC(ay8912_device::address_data_w));
map(0x6800, 0x6801).w("ay2", FUNC(ay8912_device::address_data_w));