| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
src/tools).
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Remove both arguments from CUSTOM_INPUT_MEMBER (adding template parameters as necessary)
- Remove 'param' from PORT_CUSTOM_MEMBER and assume 'device' is DEVICE_SELF (use PORT_CUSTOM_DEVICE_MEMBER if it isn't)
- Replace PORT_CUSTOM_MEMBER with PORT_READ_LINE_MEMBER where applicable
Add implicit DEVICE_SELF variants of PORT_READ_LINE_DEVICE_MEMBER and PORT_WRITE_LINE_DEVICE_MEMBER (nw)
Remove ioport_field argument from PORT_CROSSHAIR_MAPPER (nw)
captflag, gmgalax: Separate driver classes from base (nw)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are multiple issues with the current device callbacks:
* They always dispatch through a pointer-to-member
* Chained callbacks are a linked list so the branch unit can't predict the early
* There's a runtime decision made on the left/right shift direction
* There are runtime NULL checks on various objects
* Binding a lambda isn't practical
* Arbitrary transformations are not supported
* When chaining callbacks it isn't clear what the MCFG_DEVCB_ modifiers apply to
* It isn't possible to just append to a callback in derived configuration
* The macros need a magic, hidden local called devcb
* Moving code that uses the magic locals around is error-prone
* Writing the MCFG_ macros to make a device usable is a pain
* You can't discover applicable MCFG_ macros with intellisense
* Macros are not scoped
* Using an inappropriate macro isn't detected at compile time
* Lots of other things
This changeset overcomes the biggest obstacle to remving MCFG_ macros
altogether. Essentially, to allow a devcb to be configured, call
.bind() and expose the result (a bind target for the callback). Bind
target methods starting with "set" repace the current callbacks; methods
starting with "append" append to them. You can't reconfigure a callback
after resolving it. There's no need to use a macro matching the
handler signatures - use FUNC for everything. Current device is implied
if no tag/finder is supplied (no need for explicit this).
Lambdas are supported, and the memory space and offset are optional.
These kinds of things work:
* .read_cb().set([this] () { return something; });
* .read_cb().set([this] (offs_t offset) { return ~offset; });
* .write_cb().set([this] (offs_t offset, u8 data) { m_array[offset] = data; });
* .write_cb().set([this] (int state) { some_var = state; });
Arbitrary transforms are allowed, and they can modify offset/mask for example:
* .read_cb().set(FUNC(my_state::handler)).transform([] (u8 data) { return bitswap<4>(data, 1, 3, 0, 2); });
* .read_cb().set(m_dev, FUNC(some_device::member)).transform([] (offs_t &offset, u8 data) { offset ^= 3; return data; });
It's possible to stack arbitrary transforms, at the cost of compile
time (the whole transform stack gets inlined at compile time). Shifts
count as an arbitrary transform, but mask/exor does not.
Order of mask/shift/exor now matters. Modifications are applied in the
specified order. These are NOT EQUIVALENT:
* .read_cb().set(FUNC(my_state::handler)).mask(0x06).lshift(2);
* .read_cb().set(FUNC(my_state::handler)).lshift(2).mask(0x06);
The bit helper no longer reverses its behaviour for read callbacks, and
I/O ports are no longer aware of the field mask. Binding a read
callback to no-op is not supported - specify a constant. The GND and
VCC aliases have been removed intentionally - they're TTL-centric, and
were already being abused.
Other quirks have been preserved, including write logger only logging
when the data is non-zero (quite unhelpful in many of the cases where
it's used). Legacy syntax is still supported for simple cases, but will
be phased out. New devices should not have MCFG_ macros.
I don't think I've missed any fundamental issues, but if I've broken
something, let me know.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
* use plural names for output finders when there are multiple outputs (nw)
* use plural names for output finders when there are multiple outputs (nw)
* use plural names for output finders when there are multiple outputs (nw)
|
|
|
|
|
|
| |
* Replace set_led_value and set_lamp_value with output_finders. [Wilbert Pol]
* segaufo: keep the 2 bit lamp outputs
|
| |
|
|
|
|
|
| |
Also, a lot more freedom happened, that's going to be more visible
soon.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
SHA-1: 1f90ceab075c4869298e963bf0a14a0aac2f1caa
* tags are now strings (nw)
fix start project for custom builds in Visual Studio (nw)
|
| |
|
|
|
|
| |
fix start project for custom builds in Visual Studio (nw)
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
optional_device<palette_device> m_palette out of driver.* (nw)
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
changed to be members of state classes (no whatsnew)
|
|
|
|
|
|
|
|
| |
This update passes validity checks but will certainly have
a number of drivers failing at startup because all pointers
are defaulted to required by the automated scripts used.
Will fix problems once we get a regression run to find out
which drivers need attention.
|
| |
|
| |
|
|
|
| |
Tomorrow and next days just bug fixing from my side, no big changes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
almost certainly some regressions lurking. Let me know if
something seems busted.
Bitmaps are now strongly typed based on format. bitmap_t still
exists as an abstract base class, but it is almost never used.
Instead, format-specific bitmap classes are provided:
bitmap_ind8 == 8bpp indexed
bitmap_ind16 == 16bpp indexed
bitmap_ind32 == 32bpp indexed
bitmap_ind64 == 64bpp indexed
bitmap_rgb32 == 32bpp RGB
bitmap_argb32 == 32bpp ARGB
bitmap_yuy16 == 16bpp YUY
For each format, a generic pix() method is provided which
references pixels of the correct type. The old pix8/pix16/pix32/
pix64 methods still exist in the short term, but the only one
available is the one that matches the bitmap's pixel size. Note
also that the old RGB15 format bitmaps are no longer supported
at all.
Converted model1, megadriv, and stv drivers away from the RGB15
format bitmaps.
New auto_bitmap_<type>_alloc() macros are provided for allocating
the appropriate type of bitmap.
Screen update functions now must specify the correct bitmap type
as their input parameters. For static update functions the
SCREEN_UPDATE macro is now replaced with SCREEN_UPDATE_RGB32 and
SCREEN_UPDATE_IND16 macros. All existing drivers have been
updated to use the correct macros.
Screen update functions are now required for all screens; there
is no longer any default behavior of copying a "default" bitmap
to the screen (in fact the default bitmap has been deprecated).
Use one of the following to specify your screen_update callback:
MCFG_SCREEN_UPDATE_STATIC(name) - static functions
MCFG_SCREEN_UPDATE_DRIVER(class, func) - driver members
MCFG_SCREEN_UPDATE_DEVICE(tag, class, func) - device members
Because the target bitmap format can now be deduced from the
screen update function itself, the MCFG_SCREEN_FORMAT macro is
no longer necessary, and has been removed. If you specify a
screen update callback that takes a bitmap_ind16, then the screen
will be configured to use a 16bpp indexed bitmap, and if you
specify a callback that takes a bitmap_rgb32, then a 32bpp RGB
bitmap will be provided.
Extended the bitmap classes to support wrapping a subregion of
another bitmap, and cleaner allocation/resetting. The preferred
use of bitmaps now is to define them directly in drivers/devices
and use allocate() or wrap() to set them up, rather than
allocating them via auto_bitmap_*_alloc().
Several common devices needed overhauls or changes as a result
of the above changes:
* Reorganized the laserdisc base driver and all the laserdisc
drivers as modern C++ devices, cleaning the code up
considerably. Merged ldsound device into the laserdsc
device since modern devices are flexible enough to handle
it.
* Reorganized the v9938 device as a modern C++ device. Removed
v9938mod.c in favor of template functions in v9938.c directly.
* Added independent ind16 and rgb32 callbacks for TMS340x0 devices.
* All video devices are now hard-coded to either ind16 or rgb32
bitmaps. The most notable is the mc6845 which is rgb32, and
required changes to a number of consumers.
* Added screen_update methods to most video devices so they can be
directly called via MCFG_SCREEN_UPDATE_DEVICE instead of creating
tons of stub functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
existing modern devices and the legacy wrappers to work in this
environment. This in general greatly simplifies writing a modern
device. [Aaron Giles]
General notes:
* some more cleanup probably needs to happen behind this change,
but I needed to get it in before the next device modernization
or import from MESS :)
* new template function device_creator which automatically defines
the static function that creates the device; use this instead of
creating a static_alloc_device_config function
* added device_stop() method which is called at around the time
the previous device_t's destructor was called; if you auto_free
anything, do it here because the machine is gone when the
destructor is called
* changed the static_set_* calls to pass a device_t & instead of
a device_config *
* for many devices, the static config structure member names over-
lapped the device's names for devcb_* functions; in these cases
the members in the interface were renamed to have a _cb suffix
* changed the driver_enumerator to only cache 100 machine_configs
because caching them all took a ton of memory; fortunately this
implementation detail is completely hidden behind the
driver_enumerator interface
* got rid of the macros for creating derived classes; doing it
manually is now clean enough that it isn't worth hiding the
details in a macro
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
driver_device classes have an m_ prefix on them. When we
eventually move functions using these into member functions,
we will be able to remove the state-> pointers, and having
the member variables prefixed will allow them to be
distinguished from local variables.
Some regex'es used (plus manually fixing the remaining stuff):
In src/mame/...
state->([a-zA-Z_][^_][a-zA-Z0-9_]*)
state->m_\1
state->([^m]_[a-zA-Z0-9_]*)
state->m_\1
state->m_save_item
state->save_item
state->m_save_pointer
state->save_pointer
(AM_BASE_MEMBER *\( *[a-zA-Z0-9_]+ *, *)([a-zA-Z_][^_])
\1m_\2
(AM_BASE_SIZE_MEMBER *\( *[a-zA-Z0-9_]+ *, *)([a-zA-Z_][^_][a-zA-Z0-9_]* *, *)([a-zA-Z_][^_])
\1m_\2m_\3
(AM_SIZE_MEMBER *\( *[a-zA-Z0-9_]+ *, *)([a-zA-Z_][^_])
\1m_\2
m__
m_
In src/mame/includes/...
(\t[a-zA-Z0-9_<>]+[ \t]+[&*]*[ \t]*)([a-zA-Z_][^_][][a-zA-Z0-9_]*;)$
\1m_\2
(\t[a-zA-Z0-9_<>]+[ \t]*[&*]*[ \t]+)([a-zA-Z_][^_][][a-zA-Z0-9_]*;)$
\1m_\2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Screen update function is now per screen device
(it was before but was attached to machine driver)
MCFG_VIDEO_UPDATE -> MCFG_SCREEN_UPDATE
MCFG_VIDEO_EOF -> MCFG_SCREEN_EOF
EOF is now executed for all screens, so for all existing it
is defined just for one screen. This part will be updated in future.
Note that there are now screen_update and screen_eof virtual functions
for "modern" drivers which are called same as they did before.
All drivers are updated and in places where update function was separated per
screen I did name separate function.
This change will enable us to put screen definition fully into device.
|
|
|
|
|
| |
Changed ccastles and cloud9 to use the x2212 instead of the hacked-up
fake version they had.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
work just like required_device<> and optional_device<> for retrieving a
pointer by tag from an address space that specifies AM_SHARE("tag").
Also added templates required_shared_size<> and optional_shared_size<>
for retrieving the size of the AM_SHARE region.
Created a new generic NVRAM device. It can be configured to default to
0-fill, 1-fill, random-fill, or custom fill. In all cases, a same-named
memory region overrides the default fill. The address range where the
NVRAM can be found is now identified by an AM_SHARE() region of the
same tag as the NVRAM device. Drivers can also explicitly configure a
separately-allocated NVRAM region via nvram_device::set_base().
Replaced all instances of MDRV_NVRAM_HANDLER(generic_*) with
MDRV_NVRAM_ADD_*("nvram"). Replaced all AM_BASE_GENERIC/AM_SIZE_GENERIC(nvram)
with AM_SHARE("nvram"). For all remaining drivers that referenced the
generic.nvram directly, changed them to hold a required_shared_ptr<UINTx>
to the NVRAM in their driver state, and use that instead. Removed
nvram and nvram_size from the generic_ptrs.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
class with a new driver_device class, which is the base class for all
driver_data objects now. The new driver devices are added as the
first device in the device list, with a tag of "root"; all other
devices are now owned by the driver device.
Moved core callbacks (machine_start/_reset, sound_start/_reset,
video_start/_reset/_eof/_update, and palette_init) into device
configuration parameters on these new devices. The driver_device
base class overrides device_start(), ensures all other devices have
been started, and then calls, in order, the following overridable
methods:
find_devices() - new, used to locate devices prior to DRIVER_INIT
DRIVER_INIT function from the game driver
palette_init() - by default calls the MDRV_PALETTE_INIT function
driver_start() - new
machine_start() - by default calls the MDRV_MACHINE_START function
sound_start() - by default calls the MDRV_SOUND_START function
video_start() - by default calls the MDRV_VIDEO_START function
Similarly, the driver_device class overrides device_reset() and then
calls these methods in order:
driver_reset() - new
machine_reset() - by default calls the MDRV_MACHINE_RESET function
sound_reset() - by default calls the MDRV_SOUND_RESET function
video_reset() - by default calls the MDRV_VIDEO_RESET function
To accommodate these changes, initialization order is slightly
altered from before. The tilemap, video, sound, and debug systems
are now initialized prior to the devices' start. And the user
callbacks for DRIVER_INIT, PALETTE_INIT, MACHINE_START, SOUND_START,
and VIDEO_START are all called back-to-back. The net effect should
be similar, however.
Added methods (optional_device and required_device) to the new
driver_device class to find devices, intended to be used from the
find_devices() callback. See harddriv.h and beathead.h for examples
of usage.
Changed device_t::subtag to only prepend a prefix if the device is
not the 'root' device, in order to keep compatibility with existing
tag searching.
Changed device startup to actively reorder devices when they report
missing dependencies. This ensures that the reset functions get
called in the same order that the start functions did.
Bulk updated drivers as follows:
First removed the old static alloc function from the driver_data_t:
S: [ \t]*static driver_device \*alloc *\( *running_machine *\&machine *\) *\{ *return auto_alloc_clear *\( *\&machine *, *[a-zA-Z0-9_]+_state *\( *machine *\) *\); *\}[\r\n]*
R:
Then switched from driver_data_t to driver_device:
S: driver_data_t
R: driver_device
Then changed the constructors to pass the correct parameters:
S: ([a-zA-Z0-9_]+)_state *\( *running_machine *\&machine *\)([\r\n\t ]+): *driver_device *\( *machine *\)
R: \1_state\(running_machine \&machine, const driver_device_config_base \&config\)\2: driver_device\(machine, config\)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Defined new class driver_data_t, which all driver_data classes must
derive from. Updated all class definitions to inherit from the new
class, and to call it in the constructor. Also changed the alloc()
signature to return a driver_data_t pointer instead of a void *.
Renamed and hid machine->driver_data as machine->m_driver_data.
Added a new templatized method machine->driver_data<class> which returns
a properly downcast'ed version of the driver data. Updated all code
which looked like this:
mydriver_state *state = (mydriver_state *)machine->driver_data;
to this:
mydriver_state *state = machine->driver_data<mydriver_state>();
The new function does a downcast<> which in debug builds dynamically
verifies that you're actually casting to the right type.
Changed atarigen_state to be a base class from which all the related
Atari drivers derive their state from.
For MESS: this was mostly a bulk search/replace, in 4 steps in
src/mame:
1. Add ": public driver_data_t" to each driver state class definition:
Search: (class [a-z0-9_]+_state)$
Replace: \1 : public driver_data_t
2. Change the static alloc function to return a driver_data_t *:
Search: static void \*alloc\(
Replace: static driver_data_t \*alloc\(
3. Change the constructor to initialize driver_data_t:
Search: ([a-z0-9_]+_state\(running_machine \&machine\)) { }
Replace: \1\r\n\t\t: driver_data_t(machine) { }
4. Replace the state fetchers to use the new templatized function:
Search: \(([a-z0-9_]+_state) \*\)(.*)machine->driver_data
Replace: \2machine->driver_data<\1>()
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
constructor and a static allocation function.
Changed MDRV_DRIVER_DATA to reference driver_data::alloc
instead of just providing a size. This function is called
to allocate the driver data. This allows objects to be
embedded in the state data and be properly initialized.
Ideally, new driver_data constructors should perform
initialization actions in the constructor, but for now
most just use auto_alloc_clear() to blast everything to
zero.
Moved driver data allocation after device list construction
so that devices can be found when the driver data is
constructed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
is now separate from runtime device state. I have larger plans
for devices, so there is some temporary scaffolding to hold
everything together, but this first step does separate things
out.
There is a new class 'running_device' which represents the
state of a live device. A list of these running_devices sits
in machine->devicelist and is created when a running_machine
is instantiated.
To access the configuration state, use device->baseconfig()
which returns a reference to the configuration.
The list of running_devices in machine->devicelist has a 1:1
correspondance with the list of device configurations in
machine->config->devicelist, and most navigation options work
equally on either (scanning by class, type, etc.)
For the most part, drivers will now deal with running_device
objects instead of const device_config objects. In fact, in
order to do this patch, I did the following global search &
replace:
const device_config -> running_device
device->static_config -> device->baseconfig().static_config
device->inline_config -> device->baseconfig().inline_config
and then fixed up the compiler errors that fell out.
Some specifics:
Removed device_get_info_* functions and replaced them with
methods called get_config_*.
Added methods for get_runtime_* to access runtime state from
the running_device.
DEVICE_GET_INFO callbacks are only passed a device_config *.
This means they have no access to the token or runtime state
at all. For most cases this is fine.
Added new DEVICE_GET_RUNTIME_INFO callback that is passed
the running_device for accessing data that is live at runtime.
In the future this will go away to make room for a cleaner
mechanism.
Cleaned up the handoff of memory regions from the memory
subsystem to the devices.
|
| |
|
|
|
|
|
|
| |
* drop almost completely the use of generic sizes with struct members
* reduce as much as possible accesses to cputag calls during emulation (they are now mainly concentrated at MACHINE_START & DRIVER_INIT)
unfortunately I had been away for half a day and I have found only now rev 7446 (which could have been used in many of these cases). too late to use the new macro, sorry (almost 3AM here)
|
|
|
|
|
| |
1945kiii.c, actfancr.c, aquarium.c and ccastles.c.
some palette/sprite/nvram regions require generic handlers, and are commented out
|