Skip to content

Commit

Permalink
Files for 271
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbbert committed Oct 31, 2024
1 parent a20351e commit a42cf1f
Show file tree
Hide file tree
Showing 13 changed files with 356 additions and 161 deletions.
2 changes: 1 addition & 1 deletion docs/release/build/uprel.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
\goto end
git fetch upstream
git merge upstream/release0270
git merge upstream/release0271
git checkout master
:end
pause
16 changes: 10 additions & 6 deletions docs/release/scripts/src/osd/modules.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ end
function addlibfromstring(str)
if (str==nil) then return end
for w in str:gmatch("%S+") do
if string.starts(w,"-l")==true then
if string.starts(w,"-l") then
links {
string.sub(w,3)
}
Expand All @@ -27,7 +27,7 @@ end
function addoptionsfromstring(str)
if (str==nil) then return end
for w in str:gmatch("%S+") do
if string.starts(w,"-l")==false then
if not string.starts(w,"-l") then
linkoptions {
w
}
Expand Down Expand Up @@ -383,12 +383,16 @@ function qtdebuggerbuild()
if _OPTIONS["QT_HOME"]~=nil then
MOCTST = backtick(_OPTIONS["QT_HOME"] .. "/bin/moc --version 2>/dev/null")
if (MOCTST=='') then
MOCTST = backtick(_OPTIONS["QT_HOME"] .. "/libexec/moc --version 2>/dev/null")
if (MOCTST=='') then
local qt_host_libexecs = backtick(_OPTIONS["QT_HOME"] .. "/bin/qmake -query QT_HOST_LIBEXECS")
if not string.starts(qt_host_libexecs,"/") then
qt_host_libexecs = _OPTIONS["QT_HOME"] .. "/libexec"
end
MOCTST = backtick(qt_host_libexecs .. "/moc --version 2>/dev/null")
if MOCTST=='' then
print("Qt's Meta Object Compiler (moc) wasn't found!")
os.exit(1)
else
MOC = _OPTIONS["QT_HOME"] .. "/libexec/moc"
MOC = qt_host_libexecs .. "/moc"
end
else
MOC = _OPTIONS["QT_HOME"] .. "/bin/moc"
Expand All @@ -398,7 +402,7 @@ function qtdebuggerbuild()
if (MOCTST=='') then
MOCTST = backtick("which moc 2>/dev/null")
end
if (MOCTST=='') then
if MOCTST=='' then
print("Qt's Meta Object Compiler (moc) wasn't found!")
os.exit(1)
end
Expand Down
8 changes: 4 additions & 4 deletions docs/release/src/devices/imagedev/floppy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "formats/dsk_dsk.h"
#include "formats/pc_dsk.h"
#include "formats/ipf_dsk.h"
#include "formats/86f_dsk.h"

#include "formats/fs_unformatted.h"
#include "formats/fsblk_vec.h"
Expand Down Expand Up @@ -164,6 +165,7 @@ void format_registration::add_fm_containers()
add(FLOPPY_MFM_FORMAT);
add(FLOPPY_TD0_FORMAT);
add(FLOPPY_IMD_FORMAT);
add(FLOPPY_86F_FORMAT);
}

void format_registration::add_mfm_containers()
Expand Down Expand Up @@ -890,18 +892,16 @@ bool floppy_image_device::floppy_is_hd()
{
if (!m_image)
return false;
u32 variant = m_image->get_variant();
u32 const variant = m_image->get_variant();
return variant == floppy_image::DSHD;

}

bool floppy_image_device::floppy_is_ed()
{
if (!m_image)
return false;
u32 variant = m_image->get_variant();
u32 const variant = m_image->get_variant();
return variant == floppy_image::DSED;

}

void floppy_image_device::track_changed()
Expand Down
115 changes: 74 additions & 41 deletions docs/release/src/emu/ioport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <algorithm>
#include <cctype>
#include <ctime>
#include <sstream>


namespace {
Expand Down Expand Up @@ -236,6 +237,19 @@ const struct
{ INPUT_STRING_None, "None" },
};

const char *const input_gm_notes_names[128] = {
"C-1", "C-1#", "D-1", "D-1#", "E-1", "F-1", "F-1#", "G-1", "G-1#", "A-1", "A-1#", "B-1",
"C0", "C0#", "D0", "D0#", "E0", "F0", "F0#", "G0", "G0#", "A0", "A0#", "B0",
"C1", "C1#", "D1", "D1#", "E1", "F1", "F1#", "G1", "G1#", "A1", "A1#", "B1",
"C2", "C2#", "D2", "D2#", "E2", "F2", "F2#", "G2", "G2#", "A2", "A2#", "B2",
"C3", "C3#", "D3", "D3#", "E3", "F3", "F3#", "G3", "G3#", "A3", "A3#", "B3",
"C4", "C4#", "D4", "D4#", "E4", "F4", "F4#", "G4", "G4#", "A4", "A4#", "B4",
"C5", "C5#", "D5", "D5#", "E5", "F5", "F5#", "G5", "G5#", "A5", "A5#", "B5",
"C6", "C6#", "D6", "D6#", "E6", "F6", "F6#", "G6", "G6#", "A6", "A6#", "B6",
"C7", "C7#", "D7", "D7#", "E7", "F7", "F7#", "G7", "G7#", "A7", "A7#", "B7",
"C8", "C8#", "D8", "D8#", "E8", "F8", "F8#", "G8", "G8#", "A8", "A8#", "B8",
"C9", "C9#", "D9", "D9#", "E9", "F9", "F9#", "G9"
};

inline bool input_seq_good(running_machine &machine, input_seq const &seq)
{
Expand Down Expand Up @@ -310,16 +324,13 @@ u8 const inp_header::MAGIC[inp_header::OFFS_BASETIME - inp_header::OFFS_MAGIC] =
// to the current list
//-------------------------------------------------

void ioport_list::append(device_t &device, std::string &errorbuf)
void ioport_list::append(device_t &device, std::ostream &errorbuf)
{
// no constructor, no list
ioport_constructor constructor = device.input_ports();
if (constructor == nullptr)
if (!constructor)
return;

// reset error buffer
errorbuf.clear();

// detokenize into the list
(*constructor)(device, *this, errorbuf);

Expand Down Expand Up @@ -582,7 +593,7 @@ ioport_setting::ioport_setting(ioport_field &field, ioport_value _value, const c
// ioport_diplocation - constructor
//-------------------------------------------------

ioport_diplocation::ioport_diplocation(const char *name, u8 swnum, bool invert) :
ioport_diplocation::ioport_diplocation(std::string_view name, u8 swnum, bool invert) :
m_name(name),
m_number(swnum),
m_invert(invert)
Expand Down Expand Up @@ -1249,7 +1260,7 @@ float ioport_field::crosshair_read() const
// descriptions
//-------------------------------------------------

void ioport_field::expand_diplocation(const char *location, std::string &errorbuf)
void ioport_field::expand_diplocation(const char *location, std::ostream &errorbuf)
{
// if nothing present, bail
if (!location)
Expand All @@ -1258,70 +1269,76 @@ void ioport_field::expand_diplocation(const char *location, std::string &errorbu
m_diploclist.clear();

// parse the string
std::string name; // Don't move this variable inside the loop, lastname's lifetime depends on it being outside
const char *lastname = nullptr;
std::string_view lastname;
const char *curentry = location;
int entries = 0;
while (*curentry != 0)
while (*curentry)
{
// find the end of this entry
const char *comma = strchr(curentry, ',');
if (comma == nullptr)
if (!comma)
comma = curentry + strlen(curentry);

// extract it to tempbuf
std::string tempstr(curentry, comma - curentry);
std::string_view tempstr(curentry, comma - curentry);

// first extract the switch name if present
const char *number = tempstr.c_str();
const char *colon = strchr(tempstr.c_str(), ':');
std::string_view::size_type number = 0;
std::string_view::size_type const colon = tempstr.find(':');

if (colon != nullptr)
std::string_view name;
if (colon != std::string_view::npos)
{
// allocate and copy the name if it is present
lastname = name.assign(number, colon - number).c_str();
lastname = tempstr.substr(0, colon);
number = colon + 1;
if (lastname.empty())
{
util::stream_format(errorbuf, "Switch location '%s' has empty switch name!\n", location);
lastname = "UNK";
}
name = lastname;
}
else
{
// otherwise, just copy the last name
if (lastname == nullptr)
if (lastname.empty())
{
errorbuf.append(string_format("Switch location '%s' missing switch name!\n", location));
lastname = (char *)"UNK";
util::stream_format(errorbuf, "Switch location '%s' missing switch name!\n", location);
lastname = "UNK";
}
name.assign(lastname);
name = lastname;
}

// if the number is preceded by a '!' it's active high
bool invert = false;
if (*number == '!')
{
invert = true;
number++;
}
bool const invert = tempstr[number] == '!';
if (invert)
++number;

// now scan the switch number
int swnum = -1;
if (sscanf(number, "%d", &swnum) != 1)
errorbuf.append(string_format("Switch location '%s' has invalid format!\n", location));
if (sscanf(&tempstr[number], "%d", &swnum) != 1)
util::stream_format(errorbuf, "Switch location '%s' has invalid format!\n", location);
else if (0 >= swnum)
util::stream_format(errorbuf, "Switch location '%s' has switch number that is not positive!\n", location);

// allocate a new entry
m_diploclist.emplace_back(name.c_str(), swnum, invert);
if (0 < swnum)
m_diploclist.emplace_back(name, swnum, invert);
entries++;

// advance to the next item
curentry = comma;
if (*curentry != 0)
if (*curentry)
curentry++;
}

// then verify the number of bits in the mask matches
int const bits = population_count_32(m_mask);
if (bits > entries)
errorbuf.append(string_format("Switch location '%s' does not describe enough bits for mask %X\n", location, m_mask));
util::stream_format(errorbuf, "Switch location '%s' does not describe enough bits for mask %X\n", location, m_mask);
else if (bits < entries)
errorbuf.append(string_format("Switch location '%s' describes too many bits for mask %X\n", location, m_mask));
util::stream_format(errorbuf, "Switch location '%s' describes too many bits for mask %X\n", location, m_mask);
}


Expand Down Expand Up @@ -1528,7 +1545,7 @@ void ioport_port::frame_update()
// wholly overlapped by other fields
//-------------------------------------------------

void ioport_port::collapse_fields(std::string &errorbuf)
void ioport_port::collapse_fields(std::ostream &errorbuf)
{
ioport_value maskbits = 0;
int lastmodcount = -1;
Expand Down Expand Up @@ -1557,13 +1574,13 @@ void ioport_port::collapse_fields(std::string &errorbuf)
// for errors
//-------------------------------------------------

void ioport_port::insert_field(ioport_field &newfield, ioport_value &disallowedbits, std::string &errorbuf)
void ioport_port::insert_field(ioport_field &newfield, ioport_value &disallowedbits, std::ostream &errorbuf)
{
// verify against the disallowed bits, but only if we are condition-free
if (newfield.condition().none())
{
if ((newfield.mask() & disallowedbits) != 0)
errorbuf.append(string_format("INPUT_TOKEN_FIELD specifies duplicate port bits (port=%s mask=%X)\n", tag(), newfield.mask()));
util::stream_format(errorbuf, "INPUT_TOKEN_FIELD specifies duplicate port bits (port=%s mask=%X)\n", tag(), newfield.mask());
disallowedbits |= newfield.mask();
}

Expand Down Expand Up @@ -1702,12 +1719,17 @@ time_t ioport_manager::initialize()

// if we have a token list, proceed
device_enumerator iter(machine().root_device());
for (device_t &device : iter)
{
std::string errors;
m_portlist.append(device, errors);
if (!errors.empty())
osd_printf_error("Input port errors:\n%s", errors);
std::ostringstream errors;
for (device_t &device : iter)
{
m_portlist.append(device, errors);
if (errors.tellp())
{
osd_printf_error("Input port errors:\n%s", std::move(errors).str());
errors.str("");
}
}
}

// renumber player numbers for controller ports
Expand Down Expand Up @@ -3164,7 +3186,7 @@ void ioport_manager::record_port(ioport_port &port)
// ioport_configurer - constructor
//-------------------------------------------------

ioport_configurer::ioport_configurer(device_t &owner, ioport_list &portlist, std::string &errorbuf) :
ioport_configurer::ioport_configurer(device_t &owner, ioport_list &portlist, std::ostream &errorbuf) :
m_owner(owner),
m_portlist(portlist),
m_errorbuf(errorbuf),
Expand All @@ -3174,6 +3196,17 @@ ioport_configurer::ioport_configurer(device_t &owner, ioport_list &portlist, std
{
}

//-------------------------------------------------
// field_set_gm_note - set a ioport as a general
// midi-encoded note number. Only sets the name
// for now
//-------------------------------------------------

ioport_configurer& ioport_configurer::field_set_gm_note(u8 note)
{
field_set_name(input_gm_notes_names[note]);
return *this;
}

//-------------------------------------------------
// string_from_token - convert an
Expand Down
Loading

0 comments on commit a42cf1f

Please sign in to comment.