Commit Graph

45 Commits

Author SHA1 Message Date
AJR
297b99c0fa Move ROM loading macros to romentry.h and remove romload.h from emu.h (nw) 2018-06-24 09:05:55 -04:00
Vas Crabb
93eaa6a494 as if millions of this pointers suddenly cried out in terror, and were 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
2018-06-08 01:29:39 +10:00
Vas Crabb
384bf0e510 Route sound relative to current device.
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.
2018-05-01 21:35:58 +10:00
Vas Crabb
f2568bb918 Make devopt menu localisable.
Make machine_config aware of device being configured so owner doesn't need to be passed everywhere.
2018-04-28 16:34:09 +10:00
Vas Crabb
57fd28d36a Sarayan made me do it.
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.
2018-04-28 00:01:30 +10:00
Vas Crabb
503be5cbdb Allow machine configuration to specify BIOS easily, move default BIOS selection into device configuration complete 2018-03-26 19:53:18 +11:00
wilbertpol
3b923d59cc destaticify initializations (nw) (#3289)
* destaticify initializations (nw)

* fix this->set_screen (nw)
2018-03-04 04:18:08 +11:00
Olivier Galibert
5f215ff7d4 Fixes (nw) 2018-02-13 10:55:23 +01:00
Vas Crabb
d5ac7c11cf Move object finder resolution before device_start - should solve github #2759 2017-10-28 13:58:03 +11:00
Ivan Vangelista
60ceaff438 finally got rid of machine_mconfig_additions (nw) 2017-06-14 21:45:37 +02:00
Vas Crabb
89524dd10e There's no day like today. This just follows up on the last commit: game drivers are less special special - they have configuration instantiated in the usual way. 2017-05-22 18:17:29 +10:00
Vas Crabb
0f0d39ef81 Move static data out of devices into the device types. This is a significant change, so please pay attention.
The core changes are:
* Short name, full name and source file are no longer members of device_t, they are part of the device type
* MACHINE_COFIG_START no longer needs a driver class
* MACHINE_CONFIG_DERIVED_CLASS is no longer necessary
* Specify the state class you want in the GAME/COMP/CONS line
* The compiler will work out the base class where the driver init member is declared
* There is one static device type object per driver rather than one per machine configuration

Use DECLARE_DEVICE_TYPE or DECLARE_DEVICE_TYPE_NS to declare device type.
* DECLARE_DEVICE_TYPE forward-declares teh device type and class, and declares extern object finders.
* DECLARE_DEVICE_TYPE_NS is for devices classes in namespaces - it doesn't forward-declare the device type.

Use  DEFINE_DEVICE_TYPE or DEFINE_DEVICE_TYPE_NS to define device types.
* These macros declare storage for the static data, and instantiate the device type and device finder templates.

The rest of the changes are mostly just moving stuff out of headers that shouldn't be there, renaming stuff for consistency, and scoping stuff down where appropriate.

Things I've actually messed with substantially:
* More descriptive names for a lot of devices
* Untangled the fantasy sound from the driver state, which necessitates breaking up sound/flip writes
* Changed DECO BSMT2000 ready callback into a device delegate
* Untangled Microprose 3D noise from driver state
* Used object finders for CoCo multipak, KC85 D002, and Irem sound subdevices
* Started to get TI-99 stuff out of the TI-990 directory and arrange bus devices properly
* Started to break out common parts of Samsung ARM SoC devices
* Turned some of FM, SID, SCSP DSP, EPIC12 and Voodoo cores into something resmbling C++
* Tried to make Z180 table allocation/setup a bit safer
* Converted generic keyboard/terminal to not use WRITE8 - space/offset aren't relevant
* Dynamically allocate generic terminal buffer so derived devices (e.g. teleprinter) can specify size
* Imporved encapsulation of Z80DART channels
* Refactored the SPC7110 bit table generator loop to make it more readable
* Added wrappers for SNES PPU operations so members can be made protected
* Factored out some boilerplate for YM chips with PSG
* toaplan2 gfx
* stic/intv resolution
* Video System video
* Out Run/Y-board sprite alignment
* GIC video hookup
* Amstrad CPC ROM box members
* IQ151 ROM cart region
* MSX cart IRQ callback resolution time
* SMS passthrough control devices starting subslots

I've smoke-tested several drivers, but I've probably missed something.  Things I've missed will likely blow up spectacularly with failure to bind errors and the like.  Let me know if there's more subtle breakage (could have happened in FM or Voodoo).

And can everyone please, please try to keep stuff clean.  In particular, please stop polluting the global namespace.  Keep things out of headers that don't need to be there, and use things that can be scoped down rather than macros.
It feels like an uphill battle trying to get this stuff under control while more of it's added.
2017-05-14 21:44:11 +10:00
AJR
a0bf95bc4d Defend clocks_to_attotime and attotime_to_clocks against the possibility of the device clock being 0 (nw) 2017-04-21 14:52:45 -04:00
AJR
9f12134990 Mechanism for devices to generate clocks for other devices
- Have set_unscaled_clock and set_clock_scale not call notify_clock_changed unless the device has been started.
- Owner-derived clocks are now updated whenever the owner's clock is changed, including at configuration time. This simplifies the configuration of various NES clones.
- Add clock_update_delegate type to represent device-generated clock outputs that may be dynamically modified. The model implementation of this is the CLK output in I8085A.
2017-04-21 14:52:36 -04:00
Vas Crabb
aa739563d1 Self-registering devices.
* MAME now walks all devices when generating -lx output irrespective of whether they're actually instantiated anywhere or not.
* -lx is at least 30% faster than previous implementation.
* Only possible drawback is that filtering drivers no longer filters devices.
2017-03-03 00:45:14 +11:00
Vas Crabb
6c23897483 Self-registering devices prep:
* 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.
2017-02-27 22:57:14 +11:00
Scott Stone
30cda1d3e5 A round of spelling/typographical fixes to source comments (nw) 2016-11-24 09:24:01 -05:00
Vas Crabb
8179a84458 Introduce u8/u16/u32/u64/s8/s16/s32/s64
* 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
2016-11-19 05:38:48 +11:00
Miodrag Milanovic
ddb290d5f6 NOTICE (TYPE NAME CONSOLIDATION)
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
2016-10-22 13:13:17 +02:00
Vas Crabb
1c98b515c5 * Doxyfy a significant chunk of devfind.h
* Eliminate a lot of boilerplate code from devfind.h
* Keep instantiation of templates in one place to improve build time
* Remove some dangerous accessors
2016-08-25 21:34:42 +10:00
Vas Crabb
5d40f2c9d8 remove legacy forms of (required|optional)_(shared_ptr|ioport)_array 2016-08-25 03:05:55 +10:00
Nathan Woods
f5968efcea C++-fiied code that iterates over rom_entry arrays (without usage of rom_[first|next]_*) 2016-08-07 10:29:51 -04:00
Nathan Woods
7f5e233933 Created a tiny_rom_entry structure for the purposes of rom_entry declarations in code, and a first pass at the required core changes
to unpack tiny_rom_entry structures at runtime.

WARNING - I've done preliminary testing on a tiny build (pacman works), but nothing more.  I know for a fact that a full compile fails
2016-08-06 08:54:37 -04:00
Miodrag Milanovic
63f9a01f8c Cleanup and version bump 2016-06-29 08:34:30 +02:00
AJR
7f3699e69d More efficient device error logging 2016-06-20 14:31:08 -04:00
Miodrag Milanovic
78c3929217 tagged_list to unordered_map in emumem (nw) 2016-06-18 15:32:15 +02:00
Miodrag Milanovic
4a291564f3 remove dependency (nw) 2016-04-16 13:48:25 +02:00
AJR
34be7d4166 Eliminate device_t::static_config, a type-unsafe legacy feature.
Rewrite or remove every last instance of MCFG_DEVICE_CONFIG and its two aliases, including within comments and dead code.

Make the Z80/Z180 daisy chain an interface that interfaces with the existing interface. Z8000 has been hooked up to this as well (p8000_16 already configures it), but currently does nothing with it.
2016-04-14 21:20:49 -04:00
AJR
c0f366c613 Devfind revision phase 1, cleaning out some legacy stuff
- Eliminate the cached device_t::m_region pointer and its region() getter method. Devices that need to bind to a region with the same tag should use optional/required_memory_region or optional/required_region_ptr with DEVICE_SELF as the subtag; this improves error checking. (DEVICE_SELF has been moved to device.h for greater visibility in the source.)
- Allow required/optional_region_ptr to specify a specific length which must match that of the region found.
- Implement finder_base::finder_tag() getter for diagnostic purposes.
- Perform some (not very efficient) validity checks on memory region finders instead of allowing them to automatically pass.
- Privatize device_memory_interface::m_addrspace.
2016-04-07 18:59:38 -04:00
AJR
a7e393b36b Iterate over core classes C++11 style
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).
2016-03-31 09:43:53 -04:00
Vas Crabb
a830ea7627 * Support *n conversion in stream_format/string_format
* Make stream_format return characters printed
* Add iostreams with std::vector storage
* Move to type-safe templates for logerror and popmessage
* Remove now-unnecessary I64FMT from calls to logerror/popmessage
* Put some lib/util stuff in util:: namespace
* Some fixes to Japanese translation
2016-03-01 06:52:36 +11:00
Scott Stone
b74eab06c5 Eliminate remaining this == NULL entry 2016-01-23 17:30:14 +01:00
therealmogminer@gmail.com
5a9fb4c340 Remove this==NULL comps, nw 2016-01-23 17:30:14 +01:00
Miodrag Milanovic
4e8e3066f8 reverting:
SHA-1: 1f90ceab07

* tags are now strings (nw)
fix start project for custom builds in Visual Studio (nw)
2016-01-20 21:42:13 +01:00
Miodrag Milanovic
7c9cd3feea Revert "rest of device parameters to std::string (nw)"
This reverts commit caba131d84.
2016-01-20 21:35:11 +01:00
Miodrag Milanovic
caba131d84 rest of device parameters to std::string (nw) 2016-01-16 20:05:32 +01:00
Miodrag Milanovic
1f90ceab07 tags are now strings (nw)
fix start project for custom builds in Visual Studio (nw)
2016-01-16 14:54:42 +01:00
Miodrag Milanovic
3414b0166e tagmap_t to std::unordered_map or std::unordered_set where applicable (nw) 2015-12-09 21:14:13 +01:00
Miodrag Milanovic
91605d3f4d clang-modernize part 1 (nw) 2015-12-03 18:17:25 +01:00
Miodrag Milanovic
92f81361d6 Initial conversion of core to C++14. Note that compilers are now limited to GCC 4.9.0 and up, Clang 3.4.0 and up, and VS2013 and up [Miodrag Milanovic] 2015-12-03 11:40:45 +01:00
Miodrag Milanovic
0825ce4f3b Cleanups and version bump 2015-11-25 08:22:24 +01:00
Miodrag Milanovic
19ff46c113 More cleanups (nw) 2015-11-11 18:07:13 +01:00
Miodrag Milanovic
7c7e62455e removed unused code (nw) 2015-11-11 13:25:45 +01:00
Miodrag Milanovic
c27f551ac3 fix breakage while logerror (nw) 2015-11-08 20:24:44 +01:00
Miodrag Milanovic
7c19aac60e Rename *.c -> *.cpp in our source (nw) 2015-11-08 12:56:12 +01:00