summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/devfind.h
Commit message (Collapse)AuthorAgeFilesLines
* emu/devcb.h: Eliminated the need to call resolve() on callbacks. (#11333) Vas Crabb2023-06-171-11/+33
| | | | | | | | | | | | Read callbacks now need a default return value supplied at construction. Replaced isnull() with isunset() which tells you if the callback wasn't configured rather than whether it isn't safe to call. Enabled validation of device callbacks (it seems it was disabled at some point, probably accidentally). Device callbacks and object finders now implement the same interface for resolution.
* emu/devfind.h: Added a lookup() member function to device finders. Vas Crabb2023-06-121-0/+6
| | | | | | | | | | | | | This simplifies looking up the target device during configuration. It is useful when configuring child devices in things like CPUs with integrated peripherals. emu/device.h: Allow templated subdevice() and siblingdevice() to work with classes that don't derive from device_t (e.g. classes that derive from device_interface). util/delegate.h: Added more noexcept. Won't make much difference as most of the affected member functions are inline anyway.
* Small fixes and cleanup: Vas Crabb2023-04-041-0/+55
| | | | | | | | | * emu/devfind.h: Allow range-based for loops on memory share finders. * emu/emucore.h: Choose correct emu_fatalerror constructor when format string is an rvalue. * osborne/osborne1.cpp: Allocate main RAM as a flat share, and use a view to switch in atttribute RAM. * Reduced scope of some variables and edited some copy/pasted comments.
* Revert "emu: make memory_share_creator endianness param optional, it is ↵ hap2022-08-181-1/+1
| | | | | | nonsense for byte-width RAM" This reverts commit cfbffd321529cc21a5880e16c6a66c750f3b3e3b.
* emu: make memory_share_creator endianness param optional, it is nonsense for ↵ hap2022-08-181-1/+1
| | | | byte-width RAM
* -ui: Made zoom controls a bit more intuitive. Vas Crabb2021-09-061-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * The UI controls are described as zoom in/out, but they had the opposite effect on the palette and tile viewers. That has been changed to make them consistent with the tilemap viewer. * Made the default zoom key not act as a toggle. People are familiar with the function of Ctrl+0/=/- in web browsers, so making them behave similarly in MAME should make it more approachable. Also added the default zoom key to the relevant documentation page. * Implemented the default zoom key for the palette and tile viewers. * In the tilemap viewer, if the view is in default expand to fit mode, zoom in/out starting from the actual zoom ratio. Once again, this behaves more like the zoom controls in a web browser displaying an image so it should be more intuitive. * Made more messages from the tilemap viewer localisable. -util/zippath.cpp: Fixed MT08074. * There were multiple issues at play here. After #8443 was applied, is_root was simply never returning true on Windows, as OSD_WINDOWS isn't actually defined outside libosd and libocore. This caused phantom parent items to appear in disk roots on Windows, but it meant that the check in zippath_resolve would always fail so the trailing backslash would be trimmed. Fixing the macro test in is_root meant the trailing backslash from C:\ would no longer be trimmed, which caused the stat in zippath_resolve to fail. -bigbord2.cpp: Hooked up floppy DRQ that had somehow got lost. -Reduced tag map lookups in several drivers and devices. -util/coretmpl.h: Removed an overload of bitswap that can be avoided using if constexpr. -Added doxygen comments to some classes, and fixed several doxygen warnings. -util, osd: Test for _WIN32 rather than WIN32. * In C++17 mode, WIN32 is no longer a predefined macro, although various things in 3rdparty define it to maintain legacy support. We're better off moving forward anyway for when WIN32 disappears entirely. (WIN32 is not a reserved name, while _WIN32 is, starting with an underscore follwed by an uppercase letter.)
* formats, osd, util: Started refactoring file I/O stuff. (#8456) Vas Crabb2021-08-221-1/+1
| | | | | | | | | Added more modern generic I/O interfaces with implementation backed by stdio, osd_file and core_file, replacing io_generic. Also replaced core_file's build-in zlib compression with a filter. unzip.cpp, un7z.cpp: Added option to supply abstract I/O interface rather than filename. Converted osd_file, core_file, archive_file, chd_file and device_image_interface to use std::error_condition rather than their own error enums. Allow mounting TI-99 RPK from inside archives.
* -Improved accuracy of System 573's digital I/O audio emulation. (#7664) 9871238791132021-01-161-2/+2
| | | | | * Refactored mas3507d and k573dio/fpga to be more accurate to real hardware. -3rdparty/minimp3: Updated to latest master and removed local changes.
* -emu/devfind: More cleanup/consistency changes. Vas Crabb2020-11-131-33/+35
| | | | | | | | | | | * Removed .mask(), as it’s not reliable in the general case. * Added asserts to things that assume power-of-two sizes. * Got rid of virtual qualifier on pointer-to-member operator. * Made helpers a bit more assertive about logging warnings. -emu/rendlay.cpp: Use delegates to avoid hot conditional branches. -docs: Finished off description of object finders and output finders.
* emu/devfind.h: Added missing memory_share_array_creator. Vas Crabb2020-11-081-0/+2
| | | | Also some miscellaneous tidying up.
* -emu/devfind.h: Made read_safe avaiable for optional I/O ports only. Vas Crabb2020-11-061-10/+38
| | | | -docs: Added the next couple of sections explaining object finders.
* -General maintenance on emu/devfind: Vas Crabb2020-11-041-106/+249
| | | | | | | | | | | | * Harmonised memory region/share finder/creator APIs. * Moved .found() to optional object finders. * Added truth test operator to optional object finders. * Fixed things that were testing .found() on required object finders. * Improved Doxygen API documentation. -dec8.cpp: Moved csilver to its own state class. -docs: Added some notes about setting up and using MSYS2.
* Clean-up and consistency fixes after memory system changes. Vas Crabb2020-11-031-10/+23
|
* emumem: Simplify memory management. [O. Galibert] Olivier Galibert2020-11-021-30/+94
| | | | | | | | | | | | | | | | | | | | API impact: - install_ram/rom/writeonly now requires a non-null pointer. If you want automatically managed ram, add it to a memory map, not in machine_start - install_*_bank now requires a memory_bank *, not a string - one can create memory banks outside of memory maps with memory_bank_creator - one can create memory shares outside of memory maps with memory_share_creator Memory maps impact: - ram ranges with overlapping addresses are not shared anymore. Use .share() - ram ranges touching each other are not merged anymore. Stay in your range Extra note: - there is no need to create a bank just to dynamically map some memory/rom. Just use install_rom/ram/writeonly
* emu/save.h: Added support for saving arrays of attotimes and renamed macros ↵ Vas Crabb2020-09-141-5/+6
| | | | to make purpose more obvious.
* validity.cpp, devfind.cpp: Catch missing required I/O ports in systems ↵ Vas Crabb2020-08-281-74/+41
| | | | (excluding slot cards)
* Tidy grammar Zoë Blade2019-10-231-2/+2
|
* (nw) add doxygen comments for a bunch of core stuff, and convert a bunch of ↵ Vas Crabb2019-10-161-9/+5
| | | | comments to doxygen format
* (nw) misc stuff: Vas Crabb2019-10-091-8/+8
| | | | | | | | | | | | | | | | | | | | | | | * screen: validate crystal values used for set_raw * driver: get rid of sound start/reset overrides in machine configuration * vrender0.cpp, nexus3d.cpp: corrected pixel clock crystal value * mw8080bw.cpp: turned several audio subsystems into devices * bus/sat_ctrl: don't start subdevices in device_start - the machine does it for you * mb14241.cpp: simplify handlers * fgoal.cpp: updated for simplified handlers * devfind, screen: repair some doxy comments that had rotted with refactoring * doxygen: disable warnings for undocumented things - it's most of our codebase * snowbros.cpp: restore an output level setting lost in MCFG removal There's an outstanding validation error from the HP98543 DIO video card not using a valid crystal value. Someone needs to find a picture of the card and confirm or deny the existence of the 39.504MHz crystal. The various start/reset overrides are bugs waiting to happen. It's not immediately obvious that the ones run earlier can end up being called multiple times if subsequent ones throw missing dependencies exceptions. They're a relic of when everything from the old C-style drivers was thrown into classes all jumbled together.
* (nw) Clean up the mess on master Vas Crabb2019-03-261-1/+139
| | | | | | | | | | | | | This effectively reverts b380514764cf857469bae61c11143a19f79a74c5 and c24473ddff715ecec2e258a6eb38960cf8c8e98e, restoring the state at 598cd5227223c3b04ca31f0dbc1981256d9ea3ff. Before pushing, please check that what you're about to push is sane. Check your local commit log and ensure there isn't anything out-of-place before pushing to mainline. When things like this happen, it wastes everyone's time. I really don't need this in a week when real work™ is busting my balls and I'm behind where I want to be with preparing for MAME release.
* Revert "conflict resolution (nw)" andreasnaive2019-03-251-139/+1
| | | | | This reverts commit c24473ddff715ecec2e258a6eb38960cf8c8e98e, reversing changes made to 009cba4fb8102102168ef32870892438327f3705.
* Add spacenum getter for required_/optional_address_space (nw) AJR2019-02-171-0/+6
|
* Add object finder for address spaces AJR2019-01-221-1/+133
| | | | (nw) The constructor and set_tag methods for required_address_space and optional_address_space work slightly differently from other finders in that they take the address space number as an extra argument. There is also an option to request a space having a specific data width, and validation checks this as well as the space number. There is also no (required|optional)_address_space_array, but that shouldn't really be necessary since devices shouldn't need large numbers of these finders.
* (nw) add warning comment to dangerous API Vas Crabb2018-07-311-10/+6
| | | | | | | | | | I'm not sure this API is a great idea - see inline comment on https://github.com/mamedev/mame/commit/796abaf7f3200a96499440a4c40bec3440d55209 I realise it seems intuitive, but it breaks with a use-after-free (not even a validity error) if you replace/remove the target device. Implementing it in a way that isn't fragile and doesn't hurt the performance of -romident, -validate and -listxml seems impossible. If it causes developer confusing and things start breaking, back to literal tags we go for this case.
* devfind.h: Fix the build by removing calls that don't exist when DeviceClass ↵ AJR2018-07-311-12/+2
| | | | happens to be an interface (nw)
* devfind: Allow set_tag() with a reference or a pointer to a device [O. Galibert] Olivier Galibert2018-07-301-0/+26
|
* as if millions of this pointers suddenly cried out in terror, and were ↵ Vas Crabb2018-06-081-18/+0
| | | | | | | suddenly silenced * streamline templates in addrmap.h * get rid of overloads on read/write member names - this will become even more important in the near future
* C++14 has one of these in the standard library (nw) Vas Crabb2018-06-011-9/+4
|
* devfind: add asserts to detect being resolved multiple times (nw) Vas Crabb2018-05-311-0/+8
|
* devfind: add asserts to detect tag being set after object resolution (nw) Vas Crabb2018-05-311-8/+32
|
* voodoo: deal with needing to be able to configure screen/CPU or set them at ↵ Vas Crabb2018-05-231-11/+1
| | | | | | | | start in a safer way devfind: revert previous change - if finders aren't set in stone after device_resolve_objects it's going to lead to all kinds of hard-to-diagnose bugs (I'll add more checks for this some time after release) (nw) also clean up rotting tabulation
* Uncrappify voodoo pci devices transfert. Fix some paths on midwayic. (nw) Olivier Galibert2018-05-221-1/+11
|
* Streamline machine configuration macros - everyone's a device edition. Vas Crabb2018-05-061-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-7/+2
| | | | | | | | | | | | | | | | | | | | | * 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.
* Allow devcb to be bound to a device/mixin or the target of a device Vas Crabb2018-05-021-2/+10
| | | | | | | | | | finder. This works outside machine configuration context so the workarounds in ATA HLE and MSX slots are no longer necessary. It also allows reduction in tag repetition in machine configuration (see converted osborne1.cpp, zorba.cpp or the more extreme tranz330.cpp). Allow reimagined device instantiation to take a device finder based on current device being configured to reduce repetition (see tranz330.cpp).
* Route sound relative to current device. Vas Crabb2018-05-011-5/+62
| | | | | | | | Also, look Ma - no magic prologue! Slot card additions run in the context of the slot itself, which isn't entirely intuitive. Slot configuration needs a bunch of other cleanup anyway.
* Set finder tag relative to current device being configured rather than Vas Crabb2018-04-301-7/+25
| | | | | | | | | | | | | | the finder's owner. This meand you no longer need to care about the your relationship to the object being configured and a lot of ^ and : can disappear. There's a bit reduction in string pasting in macros from this. Yes, I have to make this apply to devcb etc. as well, but that's a job for another day. There's probably at least one thing broken by this where optional objects are involved. Most things can be solved by just getting rid of the now-problematic ^ and : prefixes.
* Fixes (nw) Olivier Galibert2018-02-131-0/+21
|
* make object finder arrays meet more Container/Sequence requirements (allows ↵ Vas Crabb2017-02-081-5/+96
| | | | range-based for and many algorithms to work)
* A round of spelling/typographical fixes to source comments (nw) Scott Stone2016-11-241-5/+5
|
* Introduce u8/u16/u32/u64/s8/s16/s32/s64 Vas Crabb2016-11-191-62/+62
| | | | | | | | | | | | * 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-62/+62
| | | | | 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
* Fixed some Doxy comments, and addressed a few nits Nathan Woods2016-10-151-2/+5
|
* [COCO] Changed to use required_ioport_array and optional_ioport Nathan Woods2016-10-151-0/+3
| | | | Also, I added a size() accessor to object_array_finder. If there is a better way to do this, let me know.
* TEMPORARY PATCH to fix the build. Robbbert2016-08-271-2/+2
|
* * Make object finders behave like pointers for the purposes of implicit ↵ Vas Crabb2016-08-271-64/+177
| | | | | | | | | | casts, dereferencing and array access, not something that's part pointer, part reference, part vector * Require dummy tag to be specified explicitly, magical defaults are unhelpful here as the more common case it to search for a real object * Make the search methods private in concrete classes where possible as users should rely on the resolution process for these things Still can't hide the memory bank find method since atari400.cpp subverts the resolution process. Can't get rid of set_target on shared_ptr_finder as it's abused all over the place.
* More prep for removing pointer/reference duality (nw) Vas Crabb2016-08-271-1/+1
|
* Make object_array_finder a bit more flexible, centralise instantiation of ↵ Vas Crabb2016-08-261-25/+124
| | | | more templates, more preparation for crud removal
* hacks for MSVC building until better solutions are found. (nw) smf-2016-08-261-1/+1
|
* * Doxyfy a significant chunk of devfind.h Vas Crabb2016-08-251-342/+440
| | | | | | * Eliminate a lot of boilerplate code from devfind.h * Keep instantiation of templates in one place to improve build time * Remove some dangerous accessors