summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/mconfig.cpp
Commit message (Collapse)AuthorAgeFilesLines
* mconfig: allow sub-mcfg to unset perfect quantum hap2024-12-161-1/+1
|
* emu/mconfig.cpp: Made checks on device add/replace stricter. Vas Crabb2021-12-091-11/+10
| | | | | | Trying to replace a non-existent device or trying to add a device with root or parent references in the path is now fatal. If you find yourself wanting to do this, your design is probably broken.
* Much more core std::string_view modernization AJR2021-01-201-11/+6
| | | | | | | | | | | | | | | - Remove corestr.h from emu.h; update a few source files to not use it at all - Change strtrimspace, strtrimrightspace and core_filename_extract_* to be pure functions taking a std::string_view by value and returning the same type - Change strmakeupper and strmakelower to be pure functions taking a std::string_view and constructing a std::string - Remove the string-modifying version of zippath_parent - Change tag-based lookup functions in device_t to take std::string_view instead of const std::string & or const char * - Remove the subdevice tag cache from device_t (since device finders are now recommended) and replace it with a map covering directly owned subdevices only - Move the working directory setup method out of device_image_interface (only the UI seems to actually use the full version of this) - Change output_manager to use std::string_view for output name arguments - Change core_options to accept std::string_view for most name and value arguments (return values are still C strings for now) - Change miscellaneous other functions to accept std::string_view arguments - Remove a few string accessor macros from romload.h - Remove many unnecessary c_str() calls from logging/error messages
* Eliminate many unnecessary c_str calls AJR2020-12-211-1/+1
|
* Fairly significant overhaul of Lua engine and some cleanup. Vas Crabb2020-11-251-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The things that were previously called device iterators are not iterators in the C++ sense of the word. This is confusing for newcomers. These have been renamed to be device enumerators. Several Lua methods and properties that previously returned tables now return lightweight wrappers for the underlying objects. This means creating them is a lot faster, but you can't modify them, and the performance characteristics of different operations varies. The render manager's target list uses 1-based indexing to be more like idiomatic Lua. It's now possible to create a device enumerator on any device, and then get subdevices (or sibling devices) using a relative tag. Much more render/layout functionality has been exposed to Lua. Layout scripts now have access to the layout file and can directly set the state of an item with no bindings, or register callbacks to obtain state. Some things that were previously methods are now read-only properties. Layout files are no longer required to supply a "name". This was problematic because the same layout file could be loaded for multiple instances of the same device, and each instance of the layout file should use the correct inputs (and in the future outputs) for the device instance it's associated with. This should also fix video output with MSVC builds by avoiding delegates that return things that don't fit in a register.
* emu: correct some file headers (nw) hap2020-06-191-1/+1
|
* (nw) Cleanup on the way: Vas Crabb2020-03-101-3/+0
| | | | | | | | | | * Add doxygen comments for bit manipulation functions * Add an overload of BIT that works like the AArch64 UBFX instruction * Kill off some of the silly concatenating overloads for emu_file::open * Make searchpath acually useful for devices This is a checkpoint - I'm planning to improve ROM loading behaviour at least a little.
* use C++ library includes (nw) firewave2020-01-221-1/+1
|
* Spring cleaning: Vas Crabb2019-11-011-23/+111
| | | | | | | | | | | | * Changed emu_fatalerror to use util::string_format semantics * Fixed some incorrectly marked up stuff in build scripts * Make internal layout compression type a scoped enum (only zlib is supported still, but at least the values aren't magic numbers now) * Fixed memory leaks in Xbox USB * There can only be one "perfect quantum" device - enforce that only the root machine can set it, as allowing subdevices to will cause weird issues with slot cards overiding it * Allow multiple devices to set maximum quantum and use the most restrictive one (it's maximum quantum, it would be minimum interleave) * Got rid of device_slot_card_interface as it wasn't providing value * Added a helper template to reduce certain kinds of boilerplate in slots/buses * Cleaned up some particularly bad slot code (plenty more of that to do), and made some slots more idiomatic
* Allow per-device internal layouts and remove some more MCFG_ macros. Vas Crabb2018-07-161-3/+29
| | | | | | | | | | | Input and screen tags are now resolved relative to a layout's owner device. Easy way to demonstrate is with: mame64 intlc440 -tty ie15 Previously you'd only get the IE15 terminal's layout and you'd be unable to use the INTELLEC 4/40 front panel. Now you'll get the choice of layouts from both the system and the terminal device in video options.
* Add support for custom device constructors when replacing devices. Vas Crabb2018-05-081-82/+93
| | | | | | | | | | Current syntax: MCFG_DEVICE_REPLACE(tag_or_finder, TYPE, ...) Next-generation syntax: TYPE(config.replace(), tag_or_finder, ...) (nw) Kill off some more low-value macros that aren't needed any more, and get rid of the token-pasting voodoo and casts in the discrete sound macros.
* Streamline machine configuration macros - everyone's a device edition. Vas Crabb2018-05-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Start replacing special device macros with additional constructors, starting with ISA, INTELLEC 4 and RS-232 buses. Allow an object finder to take on the target of another object finder. (For a combination of the previous two things in action, see either the INTELLEC 4 driver, or the Apple 2 PC Exporter card. Also check out looping over a device finder array to instantiate devices in some places. Lots of things no longer need to pass tags around.) Start supplying default clocks for things that have a standard clock or have all clocks internal. Eliminate the separate DEV versions of the DEVCB_ macros. Previously, the plain versions were a shortcut for DEVICE_SELF as the target. You can now supply a string tag (relative to current device being configured), an object finder (takes on the base and relative tag), or a reference to a device/interface (only do this if you know the device won't be replaced out from under it, but that's a safe assumption for your subdevices). In almost all cases, you can get the effect you want by supplying *this as the target. Eliminate sound and CPU versions of macros. They serve no useful purpose, provide no extra checks, make error messages longer, add indirection, and mislead newbies into thinking there's a difference. Remove a lot of now-unnecessary ":" prefixes binding things relative to machine root. Clean up some miscellaneous rot. Examples of new functionality in use in (some more subtle than others): * src/mame/drivers/intellec4.cpp * src/mame/drivers/tranz330.cpp * src/mame/drivers/osboren1.cpp * src/mame/drivers/zorba.cpp * src/mame/devices/smioc.cpp * src/devices/bus/a2bus/pc_xporter.cpp * src/devices/bus/isa/isa.h * src/devices/bus/isa/isa.h * src/devices/bus/intellec4/intellec4.h
* Make MCFG_DEVICE_ADD and callable device types more flexible: Vas Crabb2018-05-041-8/+32
| | | | | | | | | | | | | | | | | | | | | * Allows defaulted clocks (see subtle example with vboy) * Allows additional constructors (see RS232 port in tranz330) * Allows use of device finder in place of tag in MCFG_DEVICE_ADD * Requires out-of-line destructor for devices using incomplete types * Requires XTAL or explicit u32 for clocks for devices with private types Devices must still define the standard constructor. When writing additional constructors, be aware that the constructor runs before device_add_mconfig in the context of the existing device, not the new device. See osborne1, zorba, tranz330, and vboy for examples of this in use. Compilation is a bit slower, but this is temporary while refactoring is in progress. Eliminated the need for MCFG_SOUND_ROUTE_EX. Removed macros from slot option configuration - they just obfuscated code and slowed it down with needless dynamic casts, but didn't actually simplify it.
* Make devopt menu localisable. Vas Crabb2018-04-281-28/+48
| | | | Make machine_config aware of device being configured so owner doesn't need to be passed everywhere.
* duh (nw) Vas Crabb2018-04-281-1/+1
|
* Sarayan made me do it. Vas Crabb2018-04-281-10/+3
| | | | | | | | | | Concrete device types now have a call operator that instantiates a device. This change means you *must* use DECLARE_DEVICE_TYPE to declare the public interface of your device, even if it's device_t. If you want to use private implementation classes, use DEFINE_DEVICE_TYPE_PRIVATE and instantiate the object finders.
* Remove commented code, nw mooglyguy2018-03-101-11/+0
|
* Remove first_screen() accessor from machine_config now that it is not used, nw mooglyguy2018-03-101-4/+4
|
* destaticify initializations (nw) (#3289) wilbertpol2018-03-041-2/+2
| | | | | | * destaticify initializations (nw) * fix this->set_screen (nw)
* do you user-defined literal? also some more notes on the digital scale (nw) Vas Crabb2018-01-241-2/+2
|
* xtal.h is dead, long live to xtal.cpp [O. Galibert] Olivier Galibert2018-01-231-0/+15
|
* API Change: Machine configs are now a method of the owner class, and the ↵ Olivier Galibert2018-01-171-3/+3
| | | | | | | | | | prototype is simplified [O. Galibert] Beware, the device context does not follow in MCFG_FRAGMENT_ADD anymore due to the prototype change. So creating a device then configuring through a fragment doesn't work as-is. The simplest solution is just to add a MCFG_DEVICE_MODIFY at the start of the fragment with the correct tag.
* Fix -slot card,bios=rev (selected BIOS was being applied to slot itself, not ↵ Vas Crabb2017-08-041-5/+4
| | | | card)
* Overhaul to how MAME handles options, take two (#2341) npwoods2017-06-251-6/+5
|
* improve code for instantiating slot devices for validation - still doesn't ↵ Vas Crabb2017-06-111-1/+1
| | | | find regions properly, need to work out why
* let's use Zaccaria as a demo for machine config in members Vas Crabb2017-05-221-1/+1
|
* order of initialisation (nw) Vas Crabb2017-05-221-3/+3
|
* There's no day like today. This just follows up on the last commit: game ↵ Vas Crabb2017-05-221-32/+13
| | | | drivers are less special special - they have configuration instantiated in the usual way.
* Goodbye MACHINE_CONFIG_FRAGMENT, it was nice knowing you. Vas Crabb2017-05-221-2/+2
| | | | | | | | | (nw) This is a pretty minimal change. The point where the root device is added has been moved from the MACHINE_CONFIG_START macro to the constructor of the machine configuration class (made possible by giving drivers their own device types). This isn't the final change in this area. The root device is still being handled specially in that its configuration comes from the game driver structure. This needs to be harmonised with regular devices. But that's a job for another day.
* Remove unhelpful assert (nw) AJR2017-05-181-1/+0
|
* Revert "Overhaul to how MAME handles options (#2260)" Vas Crabb2017-05-071-5/+6
| | | | | | | | | | | | This reverts commit 536990e77b49ccc50ef275bfbf1018cc29c16154. Conflicts: src/frontend/mame/mame.cpp Sorry, but this change was half-baked. It breaks a lot of existing functionality and clearly hasn't been tested in more than a tiny subset of use cases. Please play this work back onto your own branch, and test it before submitting another PR.
* Overhaul to how MAME handles options (#2260) npwoods2017-05-051-6/+5
| | | | | | | | | | | | This is an overhaul to how MAME handles options to provide a better foundation for what MAME is already doing in practice. Previously, core_options was designed to provide an input/output facility for reading options from the command line and INI files. However, the current needs (image/slot/get_default_card_software calculus and MewUI) go way beyond that. Broadly, this PR makes the following changes: * core_options now has an extensibility mechanism, so one can register options that behave dramatically differently * With that foundation, emu_options now encapsulates all of the funky image/slot/get_default_card_software calculus that were previously handled by static methods in mameopts.cpp. Changes to emu_options should not automatically cascade in such a way so that it stays in a consistent state * emu_options no longer provides direct access to the slot_options/image_options maps; there are simpler API functions that control these capabilities * Many core_options functions that expose internal data structures (e.g. - priority) that were only really needed because of previous (now obsolete) techniques have been removed. * core_options is now exception based (rather than dumping text to an std::string). The burden is on the caller to catch these, and discern between warnings and errors as needed. Obviously this is a risky change; that's why this is being submitted at the start of the dev cycle.
* More options refactoring Nathan Woods2017-04-161-1/+5
| | | | | | | | This should address outstanding concerns with PR#2231. I'm trying to turn emu_options into a self contained structure that encapsulates behaviors related to options, including the gymnastics pertaining to image/slot loading and interactions with get_default_card_software() and "just works". When the MAME 0.186 development cycle starts up, I hope to take this further. I want to make core_options::entry an abstract base class so that the entries associated with image options and slot options can derive from it. This will eliminate the current need for emu_options to directly expose maps for image and slot options. For now, I'm in stabilization mode, and I hope to get things working for a stable 0.185 release.
* Refactoring in response to MT#6531 Nathan Woods2017-04-061-13/+24
| | | | | | | | | | Prior to this change, options for images and slots were stored in the emu_options collection. Anything that might restart the emulation (such as slot changes and images that reset on load) had to manipulate the emu_options structure directly. The dynamic nature of images and slots meant that some elaborate conventions for setting up this collection had to be understood by clients. After this change, emu_options has two new members (image_options and slot_options) that expose image and slot selections via an std::map. Anything that changes images or slots in a fashion that needs to persist across sessions needs to modify these data structures. Additionally, some of the hairly logic (e.g. - get_default_card_software) now records its data here rather than trying to subvert the core_options system. This is how MT#6531 was fixed; now when diimage.cpp sees an image that resets on load, it just modifies the image_options structure and forces a reset. This allowed some further cleanups to happen within diimage. This should be considered a very risky change, and scrutiny/feedback is welcome. In particular, there seems to be functionality surrounding device bioses that I'm not 100% sure how it works; the syntax seems to imply that it only works on slot devices.
* Self-registering devices prep: Vas Crabb2017-02-271-17/+23
| | | | | | | | | | | | | | * Make device_creator a variable template and get rid of the ampersands * Remove screen.h and speaker.h from emu.h and add where necessary * Centralise instantiations of screen and speaker finder templates * Add/standardise #include guards in many hearers * Remove many redundant #includes * Order #includesr to help catch headers that can't be #included alone (nw) This changes #include order to be prefix, unit header if applicable then other stuff roughly in order from most dependent to least dependent library. This helps catch headers that don't #include things that they use.
* Introduce u8/u16/u32/u64/s8/s16/s32/s64 Vas Crabb2016-11-191-2/+2
| | | | | | | | | | | | * New abbreviated types are in osd and util namespaces, and also in global namespace for things that #include "emu.h" * Get rid of import of cstdint types to global namespace (C99 does this anyway) * Remove the cstdint types from everything in emu * Get rid of U64/S64 macros * Fix a bug in dps16 caused by incorrect use of macro * Fix debugcon not checking for "do " prefix case-insensitively * Fix a lot of messed up tabulation * More constexpr * Fix up many __names
* NOTICE (TYPE NAME CONSOLIDATION) Miodrag Milanovic2016-10-221-2/+2
| | | | | Use standard uint64_t, uint32_t, uint16_t or uint8_t instead of UINT64, UINT32, UINT16 or UINT8 also use standard int64_t, int32_t, int16_t or int8_t instead of INT64, INT32, INT16 or INT8
* remove legacy calls (nw) Miodrag Milanovic2016-05-011-4/+0
|
* Make watchdog timer a separate device AJR2016-04-301-0/+2
| | | | | - Separate watchdog implementation from running_machine (once again) and driver_device - Old-style methods, now hidden behind #ifdefs, will probably be safe to remove soon
* Cleanups and version bumpmame0173 Miodrag Milanovic2016-04-271-1/+1
|
* Iterate over devices C++11 style AJR2016-04-181-15/+12
| | | | | | Replace the old device_iterator and its specialized versions with functionally equivalent classes that use standard operators to yield references to devices/interfaces rather than pointers. With range-based for loops, they no longer have to be stored in named variables, though they can also be reused concurrently since the iteration state is now maintained by a subclass. Add a few more typical getters to device_t::subdevice_list.
* Revert software-installed slot/image options when changing software AJR2016-04-041-1/+0
| | | | | - Remove emu.h's stealth include of emuopts.h through mconfig.h; reduce dependency on emuopts.h in other headers and source files. - MCFG_CPU_FORCE_NO_DRC is now a CPU configuration parameter rather than a global one; it still works to override the -drc option setting.
* Iterate over core classes C++11 style AJR2016-03-311-25/+69
| | | | | | | | C++11 range-based for loops can now iterate over simple_list, tagged_list, core_options, device_t::subdevice_list, device_t::interface_list, render_primitive_list and all subclasses of the above, and much code has been refactored to use them. Most core classes that have these lists as members now have methods that return the lists themselves, replacing most of the methods that returned the object at an owned list's head. (A few have been retained due to their use in drivers or OSD.) device_t now manages subdevice and interface lists through subclasses, but has given up the work of adding and removing subdevices to machine_config. memory_manager has its tagged lists exposed, though the old rooted tag lookup methods have been removed (they were privatized already).
* reverting: Miodrag Milanovic2016-01-201-13/+12
| | | | | | | SHA-1: 1f90ceab075c4869298e963bf0a14a0aac2f1caa * tags are now strings (nw) fix start project for custom builds in Visual Studio (nw)
* Revert "Fix for hang, emu_options::add_slot_options was changed, other ↵ Miodrag Milanovic2016-01-201-4/+4
| | | | | | things are just cleanup (nw)" This reverts commit 841a55985e60a16f745422fb9aa06c420d8be8ba.
* Fix for hang, emu_options::add_slot_options was changed, other things are ↵ Miodrag Milanovic2016-01-181-4/+4
| | | | just cleanup (nw)
* tags are now strings (nw) Miodrag Milanovic2016-01-161-12/+13
| | | | fix start project for custom builds in Visual Studio (nw)
* Return std::string objects by value rather than pass by reference AJR2016-01-101-7/+8
| | | | | | - strprintf is unaltered, but strformat now takes one fewer argument - state_string_export still fills a buffer, but has been made const - get_default_card_software now takes no arguments but returns a string
* clang-modernize part 1 (nw) Miodrag Milanovic2015-12-031-21/+21
|
* Initial conversion of core to C++14. Note that compilers are now limited to ↵ Miodrag Milanovic2015-12-031-3/+3
| | | | GCC 4.9.0 and up, Clang 3.4.0 and up, and VS2013 and up [Miodrag Milanovic]