diff --git a/docs/release/build/uprel.bat b/docs/release/build/uprel.bat index d873543c3e1..45975025769 100644 --- a/docs/release/build/uprel.bat +++ b/docs/release/build/uprel.bat @@ -1,6 +1,6 @@ \goto end git fetch upstream -git merge upstream/release0270 +git merge upstream/release0271 git checkout master :end pause diff --git a/docs/release/scripts/src/osd/modules.lua b/docs/release/scripts/src/osd/modules.lua index 38bfd764255..94f5964a9fc 100644 --- a/docs/release/scripts/src/osd/modules.lua +++ b/docs/release/scripts/src/osd/modules.lua @@ -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) } @@ -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 } @@ -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" @@ -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 diff --git a/docs/release/src/devices/imagedev/floppy.cpp b/docs/release/src/devices/imagedev/floppy.cpp index 722738ed083..219c9214bcd 100644 --- a/docs/release/src/devices/imagedev/floppy.cpp +++ b/docs/release/src/devices/imagedev/floppy.cpp @@ -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" @@ -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() @@ -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() diff --git a/docs/release/src/emu/ioport.cpp b/docs/release/src/emu/ioport.cpp index f131dbc38f4..5ee4b879126 100644 --- a/docs/release/src/emu/ioport.cpp +++ b/docs/release/src/emu/ioport.cpp @@ -31,6 +31,7 @@ #include #include #include +#include namespace { @@ -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) { @@ -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); @@ -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) @@ -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) @@ -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); } @@ -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; @@ -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(); } @@ -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 @@ -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), @@ -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 diff --git a/docs/release/src/emu/ioport.h b/docs/release/src/emu/ioport.h index ec96b405f07..a3685199cc9 100644 --- a/docs/release/src/emu/ioport.h +++ b/docs/release/src/emu/ioport.h @@ -26,9 +26,12 @@ #include #include #include +#include +#include #include #include #include +#include #include @@ -326,7 +329,7 @@ enum //************************************************************************** // constructor function pointer -typedef void(*ioport_constructor)(device_t &owner, ioport_list &portlist, std::string &errorbuf); +typedef void(*ioport_constructor)(device_t &owner, ioport_list &portlist, std::ostream &errorbuf); // I/O port callback function delegates typedef device_delegate ioport_field_read_delegate; @@ -640,7 +643,7 @@ class ioport_diplocation { public: // construction/destruction - ioport_diplocation(const char *name, u8 swnum, bool invert); + ioport_diplocation(std::string_view name, u8 swnum, bool invert); // getters const char *name() const { return m_name.c_str(); } @@ -775,7 +778,7 @@ class ioport_field void set_user_settings(const user_settings &settings); private: - void expand_diplocation(const char *location, std::string &errorbuf); + void expand_diplocation(const char *location, std::ostream &errorbuf); // internal state ioport_field * m_next; // pointer to next field in sequence @@ -855,7 +858,7 @@ class ioport_list : public std::map> public: ioport_list() { } - void append(device_t &device, std::string &errorbuf); + void append(device_t &device, std::ostream &errorbuf); }; @@ -890,13 +893,13 @@ class ioport_port // other operations ioport_field *field(ioport_value mask) const; - void collapse_fields(std::string &errorbuf); + void collapse_fields(std::ostream &errorbuf); void frame_update(); void init_live_state(); void update_defvalue(bool flush_defaults); private: - void insert_field(ioport_field &newfield, ioport_value &disallowedbits, std::string &errorbuf); + void insert_field(ioport_field &newfield, ioport_value &disallowedbits, std::ostream &errorbuf); // internal state ioport_port * m_next; // pointer to next port @@ -1144,7 +1147,7 @@ class ioport_configurer { public: // construction/destruction - ioport_configurer(device_t &owner, ioport_list &portlist, std::string &errorbuf); + ioport_configurer(device_t &owner, ioport_list &portlist, std::ostream &errorbuf); // static helpers static const char *string_from_token(const char *string); @@ -1181,6 +1184,7 @@ class ioport_configurer ioport_configurer& field_set_dynamic_read(ioport_field_read_delegate delegate) { m_curfield->m_read = delegate; return *this; } ioport_configurer& field_set_dynamic_write(ioport_field_write_delegate delegate, u32 param = 0) { m_curfield->m_write = delegate; m_curfield->m_write_param = param; return *this; } ioport_configurer& field_set_diplocation(const char *location) { m_curfield->expand_diplocation(location, m_errorbuf); return *this; } + ioport_configurer& field_set_gm_note(u8 note); // setting helpers ioport_configurer& setting_alloc(ioport_value value, const char *name); @@ -1193,7 +1197,7 @@ class ioport_configurer // internal state device_t & m_owner; ioport_list & m_portlist; - std::string & m_errorbuf; + std::ostream & m_errorbuf; ioport_port * m_curport; ioport_field * m_curfield; @@ -1233,7 +1237,7 @@ class ioport_configurer // start of table #define INPUT_PORTS_START(_name) \ -ATTR_COLD void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, std::string &errorbuf) \ +ATTR_COLD void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, std::ostream &errorbuf) \ { \ ioport_configurer configurer(owner, portlist, errorbuf); // end of table @@ -1242,7 +1246,7 @@ ATTR_COLD void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, s // aliasing #define INPUT_PORTS_EXTERN(_name) \ - extern void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, std::string &errorbuf) + extern void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, std::ostream &errorbuf) // including #define PORT_INCLUDE(_name) \ @@ -1312,6 +1316,9 @@ ATTR_COLD void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, s #define PORT_OPTIONAL \ configurer.field_set_optional(); +#define PORT_GM_NOTE(_id) \ + configurer.field_set_gm_note(_id); + // analog settings // if this macro is not used, the minimum defaults to 0 and maximum defaults to the mask value #define PORT_MINMAX(_min, _max) \ @@ -1329,11 +1336,10 @@ ATTR_COLD void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, s #define PORT_CROSSHAIR(axis, scale, offset, altaxis) \ configurer.field_set_crosshair(CROSSHAIR_AXIS_##axis, altaxis, scale, offset); -#define PORT_CROSSHAIR_MAPPER(_callback) \ - configurer.field_set_crossmapper(ioport_field_crossmap_delegate(owner, DEVICE_SELF, _callback, #_callback)); - -#define PORT_CROSSHAIR_MAPPER_MEMBER(_device, _class, _member) \ - configurer.field_set_crossmapper(ioport_field_crossmap_delegate(owner, _device, &_class::_member, #_class "::" #_member)); +#define PORT_CROSSHAIR_MAPPER_MEMBER_IMPL(_device, _funcptr, _name) \ + configurer.field_set_crossmapper(ioport_field_crossmap_delegate(owner, _device, _funcptr, _name)); +#define PORT_CROSSHAIR_MAPPER_DEVICE_MEMBER(...) PORT_CROSSHAIR_MAPPER_MEMBER_IMPL(__VA_ARGS__) +#define PORT_CROSSHAIR_MAPPER_MEMBER(...) PORT_CROSSHAIR_MAPPER_MEMBER_IMPL(DEVICE_SELF, __VA_ARGS__) // how many optical counts for 1 full turn of the control #define PORT_FULL_TURN_COUNT(_count) \ @@ -1359,48 +1365,41 @@ ATTR_COLD void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, s configurer.field_set_analog_invert(); // read callbacks -#define PORT_CUSTOM_MEMBER(_class, _member) \ - configurer.field_set_dynamic_read(ioport_field_read_delegate(owner, DEVICE_SELF, &_class::_member, #_class "::" #_member)); -#define PORT_CUSTOM_DEVICE_MEMBER(_device, _class, _member) \ - configurer.field_set_dynamic_read(ioport_field_read_delegate(owner, _device, &_class::_member, #_class "::" #_member)); +#define PORT_CUSTOM_MEMBER_IMPL(_device, _funcptr, _name) \ + configurer.field_set_dynamic_read(ioport_field_read_delegate(owner, _device, _funcptr, _name)); +#define PORT_CUSTOM_DEVICE_MEMBER(...) PORT_CUSTOM_MEMBER_IMPL(__VA_ARGS__) +#define PORT_CUSTOM_MEMBER(...) PORT_CUSTOM_MEMBER_IMPL(DEVICE_SELF, __VA_ARGS__); // write callbacks -#define PORT_CHANGED_MEMBER(_device, _class, _member, _param) \ - configurer.field_set_dynamic_write(ioport_field_write_delegate(owner, _device, &_class::_member, #_class "::" #_member), (_param)); +#define PORT_CHANGED_MEMBER_IMPL(_device, _funcptr, _name, _param) \ + configurer.field_set_dynamic_write(ioport_field_write_delegate(owner, _device, _funcptr, _name), (_param)); +#define PORT_CHANGED_MEMBER(...) PORT_CHANGED_MEMBER_IMPL(__VA_ARGS__) // input device handler -#define PORT_READ_LINE_MEMBER(_class, _member) \ - configurer.field_set_dynamic_read( \ - ioport_field_read_delegate( \ - owner, \ - DEVICE_SELF, \ - static_cast([] (_class &device) -> ioport_value { return (device._member() & 1) ? ~ioport_value(0) : 0; }), \ - #_class "::" #_member)); -#define PORT_READ_LINE_DEVICE_MEMBER(_device, _class, _member) \ +#define PORT_READ_LINE_MEMBER_IMPL(_device, _funcptr, _name) \ configurer.field_set_dynamic_read( \ ioport_field_read_delegate( \ owner, \ _device, \ - static_cast([] (_class &device) -> ioport_value { return (device._member() & 1) ? ~ioport_value(0) : 0; }), \ - #_class "::" #_member)); + static_cast &)>( \ + [] (auto &device) -> ioport_value { return (std::invoke(_funcptr, device) & 1) ? ~ioport_value(0) : 0; }), \ + _name)); +#define PORT_READ_LINE_DEVICE_MEMBER(...) PORT_READ_LINE_MEMBER_IMPL(__VA_ARGS__) +#define PORT_READ_LINE_MEMBER(...) PORT_READ_LINE_MEMBER_IMPL(DEVICE_SELF, __VA_ARGS__) // output device handler -#define PORT_WRITE_LINE_MEMBER(_class, _member) \ - configurer.field_set_dynamic_write( \ - ioport_field_write_delegate( \ - owner, \ - DEVICE_SELF, \ - static_cast([] (_class &device, ioport_field &field, u32 param, ioport_value oldval, ioport_value newval) { device._member(newval); }), \ - #_class "::" #_member)); -#define PORT_WRITE_LINE_DEVICE_MEMBER(_device, _class, _member) \ +#define PORT_WRITE_LINE_MEMBER_IMPL(_device, _funcptr, _name) \ configurer.field_set_dynamic_write( \ ioport_field_write_delegate( \ owner, \ _device, \ - static_cast([] (_class &device, ioport_field &field, u32 param, ioport_value oldval, ioport_value newval) { device._member(newval); }), \ - #_class "::" #_member)); + static_cast &, ioport_field &, u32, ioport_value, ioport_value)>( \ + [] (auto &device, ioport_field &field, u32 param, ioport_value oldval, ioport_value newval) { std::invoke(_funcptr, device, newval); }), \ + _name)); +#define PORT_WRITE_LINE_DEVICE_MEMBER(...) PORT_WRITE_LINE_MEMBER_IMPL(__VA_ARGS__) +#define PORT_WRITE_LINE_MEMBER(...) PORT_WRITE_LINE_MEMBER_IMPL(DEVICE_SELF, __VA_ARGS__) -// dip switch definition +// DIP switch definition #define PORT_DIPNAME(_mask, _default, _name) \ configurer.field_alloc(IPT_DIPSWITCH, (_default), (_mask), (_name)); #define PORT_DIPSETTING(_default, _name) \ @@ -1409,7 +1408,7 @@ ATTR_COLD void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, s // note that these are specified LSB-first #define PORT_DIPLOCATION(_location) \ configurer.field_set_diplocation(_location); -// conditionals for dip switch settings +// conditionals for DIP switch settings #define PORT_CONDITION(_tag, _mask, _condition, _value) \ configurer.set_condition(ioport_condition::_condition, _tag, _mask, _value); // analog adjuster definition @@ -1426,6 +1425,103 @@ ATTR_COLD void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, s #define PORT_CHAR(...) \ configurer.field_add_char({ __VA_ARGS__ }); +// General-midi derived piano notes +#define PORT_GM_A0 PORT_GM_NOTE( 21) // Start of 88-key keyboard +#define PORT_GM_AS0 PORT_GM_NOTE( 22) +#define PORT_GM_B0 PORT_GM_NOTE( 23) + +#define PORT_GM_C1 PORT_GM_NOTE( 24) +#define PORT_GM_CS1 PORT_GM_NOTE( 25) +#define PORT_GM_D1 PORT_GM_NOTE( 26) +#define PORT_GM_DS1 PORT_GM_NOTE( 27) +#define PORT_GM_E1 PORT_GM_NOTE( 28) // Start of 76-key keyboard +#define PORT_GM_F1 PORT_GM_NOTE( 29) +#define PORT_GM_FS1 PORT_GM_NOTE( 30) +#define PORT_GM_G1 PORT_GM_NOTE( 31) +#define PORT_GM_GS1 PORT_GM_NOTE( 32) +#define PORT_GM_A1 PORT_GM_NOTE( 33) +#define PORT_GM_AS1 PORT_GM_NOTE( 34) +#define PORT_GM_B1 PORT_GM_NOTE( 35) + +#define PORT_GM_C2 PORT_GM_NOTE( 36) // Start of 49 and 61-key keyboards +#define PORT_GM_CS2 PORT_GM_NOTE( 37) +#define PORT_GM_D2 PORT_GM_NOTE( 38) +#define PORT_GM_DS2 PORT_GM_NOTE( 39) +#define PORT_GM_E2 PORT_GM_NOTE( 40) +#define PORT_GM_F2 PORT_GM_NOTE( 41) +#define PORT_GM_FS2 PORT_GM_NOTE( 42) +#define PORT_GM_G2 PORT_GM_NOTE( 43) +#define PORT_GM_GS2 PORT_GM_NOTE( 44) +#define PORT_GM_A2 PORT_GM_NOTE( 45) +#define PORT_GM_AS2 PORT_GM_NOTE( 46) +#define PORT_GM_B2 PORT_GM_NOTE( 47) + +#define PORT_GM_C3 PORT_GM_NOTE( 48) +#define PORT_GM_CS3 PORT_GM_NOTE( 49) +#define PORT_GM_D3 PORT_GM_NOTE( 50) +#define PORT_GM_DS3 PORT_GM_NOTE( 51) +#define PORT_GM_E3 PORT_GM_NOTE( 52) +#define PORT_GM_F3 PORT_GM_NOTE( 53) +#define PORT_GM_FS3 PORT_GM_NOTE( 54) +#define PORT_GM_G3 PORT_GM_NOTE( 55) +#define PORT_GM_GS3 PORT_GM_NOTE( 56) +#define PORT_GM_A3 PORT_GM_NOTE( 57) +#define PORT_GM_AS3 PORT_GM_NOTE( 58) +#define PORT_GM_B3 PORT_GM_NOTE( 59) + +#define PORT_GM_C4 PORT_GM_NOTE( 60) // Middle C +#define PORT_GM_CS4 PORT_GM_NOTE( 61) +#define PORT_GM_D4 PORT_GM_NOTE( 62) +#define PORT_GM_DS4 PORT_GM_NOTE( 63) +#define PORT_GM_E4 PORT_GM_NOTE( 64) +#define PORT_GM_F4 PORT_GM_NOTE( 65) +#define PORT_GM_FS4 PORT_GM_NOTE( 66) +#define PORT_GM_G4 PORT_GM_NOTE( 67) +#define PORT_GM_GS4 PORT_GM_NOTE( 68) +#define PORT_GM_A4 PORT_GM_NOTE( 69) +#define PORT_GM_AS4 PORT_GM_NOTE( 70) +#define PORT_GM_B4 PORT_GM_NOTE( 71) + +#define PORT_GM_C5 PORT_GM_NOTE( 72) +#define PORT_GM_CS5 PORT_GM_NOTE( 73) +#define PORT_GM_D5 PORT_GM_NOTE( 74) +#define PORT_GM_DS5 PORT_GM_NOTE( 75) +#define PORT_GM_E5 PORT_GM_NOTE( 76) +#define PORT_GM_F5 PORT_GM_NOTE( 77) +#define PORT_GM_FS5 PORT_GM_NOTE( 78) +#define PORT_GM_G5 PORT_GM_NOTE( 79) +#define PORT_GM_GS5 PORT_GM_NOTE( 80) +#define PORT_GM_A5 PORT_GM_NOTE( 81) +#define PORT_GM_AS5 PORT_GM_NOTE( 82) +#define PORT_GM_B5 PORT_GM_NOTE( 83) + +#define PORT_GM_C6 PORT_GM_NOTE( 84) // End of 49-key keyboard +#define PORT_GM_CS6 PORT_GM_NOTE( 85) +#define PORT_GM_D6 PORT_GM_NOTE( 86) +#define PORT_GM_DS6 PORT_GM_NOTE( 87) +#define PORT_GM_E6 PORT_GM_NOTE( 88) +#define PORT_GM_F6 PORT_GM_NOTE( 89) +#define PORT_GM_FS6 PORT_GM_NOTE( 90) +#define PORT_GM_G6 PORT_GM_NOTE( 91) +#define PORT_GM_GS6 PORT_GM_NOTE( 92) +#define PORT_GM_A6 PORT_GM_NOTE( 93) +#define PORT_GM_AS6 PORT_GM_NOTE( 94) +#define PORT_GM_B6 PORT_GM_NOTE( 95) + +#define PORT_GM_C7 PORT_GM_NOTE( 96) // End of 61-key keyboard +#define PORT_GM_CS7 PORT_GM_NOTE( 97) +#define PORT_GM_D7 PORT_GM_NOTE( 98) +#define PORT_GM_DS7 PORT_GM_NOTE( 99) +#define PORT_GM_E7 PORT_GM_NOTE(100) +#define PORT_GM_F7 PORT_GM_NOTE(101) +#define PORT_GM_FS7 PORT_GM_NOTE(102) +#define PORT_GM_G7 PORT_GM_NOTE(103) // End of 76-key keyboard +#define PORT_GM_GS7 PORT_GM_NOTE(104) +#define PORT_GM_A7 PORT_GM_NOTE(105) +#define PORT_GM_AS7 PORT_GM_NOTE(106) +#define PORT_GM_B7 PORT_GM_NOTE(107) + +#define PORT_GM_C8 PORT_GM_NOTE(108) // End of 88-key keyboard // name of table #define DEVICE_INPUT_DEFAULTS_NAME(_name) device_iptdef_##_name @@ -1470,10 +1566,10 @@ ATTR_COLD void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, s PORT_BIT( _mask, _mask & _default, IPT_SERVICE ) PORT_NAME( DEF_STR( Service_Mode )) #define PORT_VBLANK(_screen) \ - PORT_READ_LINE_DEVICE_MEMBER(_screen, screen_device, vblank) + PORT_READ_LINE_DEVICE_MEMBER(_screen, FUNC(screen_device::vblank)) #define PORT_HBLANK(_screen) \ - PORT_READ_LINE_DEVICE_MEMBER(_screen, screen_device, hblank) + PORT_READ_LINE_DEVICE_MEMBER(_screen, FUNC(screen_device::hblank)) //************************************************************************** // INLINE FUNCTIONS diff --git a/docs/release/src/frontend/mame/ui/ui.cpp b/docs/release/src/frontend/mame/ui/ui.cpp index c7a5b118206..cf86e756074 100644 --- a/docs/release/src/frontend/mame/ui/ui.cpp +++ b/docs/release/src/frontend/mame/ui/ui.cpp @@ -188,25 +188,66 @@ struct mame_ui_manager::active_pointer }; -struct mame_ui_manager::pointer_options +class mame_ui_manager::pointer_options { +public: pointer_options() - : timeout(std::chrono::seconds(3)) - , hide_inactive(true) - , timeout_set(false) - , hide_inactive_set(false) + : m_initial_timeout(std::chrono::seconds(3)) + , m_timeout(std::chrono::seconds(3)) + , m_initial_hide_inactive(true) + , m_hide_inactive(true) + , m_timeout_set(false) + , m_hide_inactive_set(false) { } - bool options_set() const + std::chrono::steady_clock::duration timeout() const noexcept { return m_timeout; } + bool hide_inactive() const noexcept { return m_hide_inactive; } + bool timeout_set() const noexcept { return m_timeout_set; } + bool hide_inactive_set() const noexcept { return m_hide_inactive_set; } + bool options_set() const noexcept { return m_timeout_set || m_hide_inactive_set; } + + void set_initial_timeout(std::chrono::steady_clock::duration value) noexcept + { + m_initial_timeout = value; + if (!m_timeout_set) + m_timeout = value; + } + + void set_initial_hide_inactive(bool value) noexcept + { + m_initial_hide_inactive = value; + if (!m_hide_inactive_set) + m_hide_inactive = value; + } + + void set_timeout(std::chrono::steady_clock::duration value) noexcept { - return timeout_set || hide_inactive_set; + m_timeout = value; + m_timeout_set = true; } - std::chrono::steady_clock::duration timeout; - bool hide_inactive; - bool timeout_set; - bool hide_inactive_set; + void set_hide_inactive(bool value) noexcept + { + m_hide_inactive = value; + m_hide_inactive_set = true; + } + + void restore_initial() noexcept + { + m_timeout = m_initial_timeout; + m_hide_inactive = m_initial_hide_inactive; + m_timeout_set = false; + m_hide_inactive_set = false; + } + +private: + std::chrono::steady_clock::duration m_initial_timeout; + std::chrono::steady_clock::duration m_timeout; + bool m_initial_hide_inactive; + bool m_hide_inactive; + bool m_timeout_set; + bool m_hide_inactive_set; }; @@ -452,17 +493,19 @@ void mame_ui_manager::config_load_pointers( auto const ms(std::lround(timeout * 1000.0F)); if ((0 <= ms) && (10'000 >= ms)) { - m_pointer_options[index].timeout = std::chrono::milliseconds(ms); if (config_type::SYSTEM == cfg_type) - m_pointer_options[index].timeout_set = true; + m_pointer_options[index].set_timeout(std::chrono::milliseconds(ms)); + else + m_pointer_options[index].set_initial_timeout(std::chrono::milliseconds(ms)); } auto const hide(targetnode->get_attribute_int("hide_inactive", -1)); if (0 <= hide) { - m_pointer_options[index].hide_inactive = hide != 0; if (config_type::SYSTEM == cfg_type) - m_pointer_options[index].hide_inactive_set = true; + m_pointer_options[index].set_hide_inactive(hide != 0); + else + m_pointer_options[index].set_initial_hide_inactive(hide != 0); } } } @@ -495,13 +538,13 @@ void mame_ui_manager::config_save_pointers( if (targetnode) { targetnode->set_attribute_int("index", i); - if (options.timeout_set) + if (options.timeout_set()) { - auto const ms(std::chrono::duration_cast(options.timeout)); + auto const ms(std::chrono::duration_cast(options.timeout())); targetnode->set_attribute_float("activity_timeout", float(ms.count()) * 0.001F); } - if (options.hide_inactive_set) - targetnode->set_attribute_int("hide_inactive", options.hide_inactive); + if (options.hide_inactive_set()) + targetnode->set_attribute_int("hide_inactive", options.hide_inactive()); } } } @@ -1518,8 +1561,8 @@ uint32_t mame_ui_manager::handler_ingame(render_container &container) { target = pointer.target; view = &target->current_view(); - hide_inactive = m_pointer_options[target->index()].hide_inactive && view->hide_inactive_pointers(); - expiry = now - m_pointer_options[target->index()].timeout; + hide_inactive = m_pointer_options[target->index()].hide_inactive() && view->hide_inactive_pointers(); + expiry = now - m_pointer_options[target->index()].timeout(); } if (view->show_pointers()) { @@ -1735,10 +1778,7 @@ void mame_ui_manager::set_pointer_activity_timeout(int target, std::chrono::stea { assert((0 <= target) && (m_pointer_options.size() > target)); if ((0 <= target) && (m_pointer_options.size() > target)) - { - m_pointer_options[target].timeout = timeout; - m_pointer_options[target].timeout_set = true; - } + m_pointer_options[target].set_timeout(timeout); } @@ -1751,10 +1791,20 @@ void mame_ui_manager::set_hide_inactive_pointers(int target, bool hide) noexcept { assert((0 <= target) && (m_pointer_options.size() > target)); if ((0 <= target) && (m_pointer_options.size() > target)) - { - m_pointer_options[target].hide_inactive = hide; - m_pointer_options[target].hide_inactive_set = true; - } + m_pointer_options[target].set_hide_inactive(hide); +} + + +//------------------------------------------------- +// restore_initial_pointer_options - restore +// initial per-target pointer settings +//------------------------------------------------- + +void mame_ui_manager::restore_initial_pointer_options(int target) noexcept +{ + assert((0 <= target) && (m_pointer_options.size() > target)); + if ((0 <= target) && (m_pointer_options.size() > target)) + m_pointer_options[target].restore_initial(); } @@ -1767,9 +1817,9 @@ std::chrono::steady_clock::duration mame_ui_manager::pointer_activity_timeout(in { assert((0 <= target) && (m_pointer_options.size() > target)); if ((0 <= target) && (m_pointer_options.size() > target)) - return m_pointer_options[target].timeout; + return m_pointer_options[target].timeout(); else - return pointer_options().timeout; + return pointer_options().timeout(); } @@ -1782,9 +1832,9 @@ bool mame_ui_manager::hide_inactive_pointers(int target) const noexcept { assert((0 <= target) && (m_pointer_options.size() > target)); if ((0 <= target) && (m_pointer_options.size() > target)) - return m_pointer_options[target].hide_inactive; + return m_pointer_options[target].hide_inactive(); else - return pointer_options().hide_inactive; + return pointer_options().hide_inactive(); } diff --git a/docs/release/src/mame/nintendo/snes.cpp b/docs/release/src/mame/nintendo/snes.cpp index 32864ceadf9..e7c226c5625 100644 --- a/docs/release/src/mame/nintendo/snes.cpp +++ b/docs/release/src/mame/nintendo/snes.cpp @@ -99,15 +99,15 @@ class snes_console_state : public snes_state virtual void write_joy_latch(uint8_t data) override; virtual void wrio_write(uint8_t data) override; - virtual void machine_start() override; - virtual void machine_reset() override; + virtual void machine_start() override ATTR_COLD; + virtual void machine_reset() override ATTR_COLD; int m_type = 0; required_device m_ctrl1; required_device m_ctrl2; optional_device m_cartslot; - void snes_map(address_map &map); - void spc_map(address_map &map); + void snes_map(address_map &map) ATTR_COLD; + void spc_map(address_map &map) ATTR_COLD; }; diff --git a/docs/release/src/osd/winui/mui_util.cpp b/docs/release/src/osd/winui/mui_util.cpp index f2d710bb5ef..f61c54eb76b 100644 --- a/docs/release/src/osd/winui/mui_util.cpp +++ b/docs/release/src/osd/winui/mui_util.cpp @@ -527,7 +527,7 @@ static void InitDriversInfo(void) if (gamedrv->ipt) { ioport_list portlist; - std::string errors; + std::ostringstream errors; for (device_t &cfg : device_enumerator(config.root_device())) if (cfg.input_ports()) portlist.append(cfg, errors); @@ -801,43 +801,51 @@ HANDLE win_create_file_utf8(const char* filename, DWORD desiredmode, DWORD share return result; } -//============================================================ +//================================================================= // win_get_current_directory_utf8 -//============================================================ +// return value: 0 for failure, otherwise size of returned string +//================================================================= -DWORD win_get_current_directory_utf8(DWORD bufferlength, char* buffer) +DWORD win_get_current_directory_utf8(size_t bufferlength, char* buffer) { - DWORD result = 0; + buffer = 0; + if (!bufferlength) + return 0; + TCHAR* t_buffer = NULL; + t_buffer = (TCHAR*)malloc((bufferlength * sizeof(TCHAR)) + 1); + if( !t_buffer ) + return 0; - if( bufferlength > 0 ) + DWORD result = GetCurrentDirectory(bufferlength, t_buffer); + + if (result == 0) { - t_buffer = (TCHAR*)malloc((bufferlength * sizeof(TCHAR)) + 1); - if( !t_buffer ) - return result; + printf("ERROR: win_get_current_directory_utf8: GetCurrentDirectory failed\n"); + free (t_buffer); + return 0; } - result = GetCurrentDirectory(bufferlength, t_buffer); - - char* utf8_buffer = NULL; - if( bufferlength > 0 ) + if (result > bufferlength) { - utf8_buffer = ui_utf8_from_wstring(t_buffer); - if( !utf8_buffer ) - { - free(t_buffer); - return result; - } + printf("ERROR: win_get_current_directory_utf8: Need buffer size of %d\n",int(result)); + free (t_buffer); + return 0; } + char* utf8_buffer = NULL; + utf8_buffer = ui_utf8_from_wstring(t_buffer); + + free(t_buffer); + + if( !utf8_buffer ) + return 0; + strncpy(buffer, utf8_buffer, bufferlength); if( utf8_buffer ) free(utf8_buffer); - if( t_buffer ) - free(t_buffer); - return result; } diff --git a/docs/release/src/osd/winui/mui_util.h b/docs/release/src/osd/winui/mui_util.h index b18b9248fa2..675e4773957 100644 --- a/docs/release/src/osd/winui/mui_util.h +++ b/docs/release/src/osd/winui/mui_util.h @@ -64,7 +64,7 @@ TCHAR* win_tstring_strdup(LPCTSTR str); HANDLE win_create_file_utf8(const char* filename, DWORD desiredmode, DWORD sharemode, LPSECURITY_ATTRIBUTES securityattributes, DWORD creationdisposition, DWORD flagsandattributes, HANDLE templatehandle); -DWORD win_get_current_directory_utf8(DWORD bufferlength, char* buffer); +DWORD win_get_current_directory_utf8(size_t bufferlength, char* buffer); HANDLE win_find_first_file_utf8(const char* filename, LPWIN32_FIND_DATA findfiledata); void ErrorMessageBox(const char *fmt, ...); diff --git a/docs/release/src/osd/winui/softwarepicker.cpp b/docs/release/src/osd/winui/softwarepicker.cpp index 6fbdccd8666..cc71372ec35 100644 --- a/docs/release/src/osd/winui/softwarepicker.cpp +++ b/docs/release/src/osd/winui/softwarepicker.cpp @@ -89,6 +89,10 @@ static const TCHAR software_picker_property_name[] = TEXT("SWPICKER"); +//============================================================ +// To Do: win_get_current_directory_utf8 returns a value: +// 0 for failure, or the length of the returned string +// This needs to be incorporated into the code. //============================================================ static LPCSTR NormalizePath(LPCSTR pszPath, LPSTR pszBuffer, size_t nBufferSize) diff --git a/docs/release/src/version.cpp b/docs/release/src/version.cpp index 608f0480d6d..51b5d13a38a 100644 --- a/docs/release/src/version.cpp +++ b/docs/release/src/version.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ -#define BARE_BUILD_VERSION "0.270.0" +#define BARE_BUILD_VERSION "0.271.0" extern const char bare_build_version[]; extern const char build_version[]; diff --git a/makefile b/makefile index a27d401b1e4..11c5eca3d93 100644 --- a/makefile +++ b/makefile @@ -1578,7 +1578,7 @@ endif ifeq (posix,$(SHELLTYPE)) $(GENDIR)/version.cpp: makefile $(GENDIR)/git_desc | $(GEN_FOLDERS) - @echo '#define BARE_BUILD_VERSION "0.270.x"' > $@ + @echo '#define BARE_BUILD_VERSION "0.271.0"' > $@ @echo '#define BARE_VCS_REVISION "$(NEW_GIT_VERSION)"' >> $@ @echo 'extern const char bare_build_version[];' >> $@ @echo 'extern const char bare_vcs_revision[];' >> $@ @@ -1588,7 +1588,7 @@ $(GENDIR)/version.cpp: makefile $(GENDIR)/git_desc | $(GEN_FOLDERS) @echo 'const char build_version[] = BARE_BUILD_VERSION " (" BARE_VCS_REVISION ")";' >> $@ else $(GENDIR)/version.cpp: makefile $(GENDIR)/git_desc | $(GEN_FOLDERS) - @echo #define BARE_BUILD_VERSION "0.270.x" > $@ + @echo #define BARE_BUILD_VERSION "0.271.0" > $@ @echo #define BARE_VCS_REVISION "$(NEW_GIT_VERSION)" >> $@ @echo extern const char bare_build_version[]; >> $@ @echo extern const char bare_vcs_revision[]; >> $@ diff --git a/src/version.cpp b/src/version.cpp index b13c14a1c39..51b5d13a38a 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ -#define BARE_BUILD_VERSION "0.270.x" +#define BARE_BUILD_VERSION "0.271.0" extern const char bare_build_version[]; extern const char build_version[];