| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
performance as a result of this change. Do not panic; report issues to the
list in the short term and I will look into them. There are probably also
some details I forgot to mention. Please ask questions if anything is not
clear.
NOTE: This is a major internal change to the way devices are handled in
MAME. There is a small impact on drivers, but the bulk of the changes are
to the devices themselves. Full documentation on the new device handling
is in progress at http://mamedev.org/devwiki/index.php/MAME_Device_Basics
Defined two new casting helpers: [Aaron Giles]
downcast<type>(value) should be used for safe and efficient downcasting
from a base class to a derived class. It wraps static_cast<> by adding
an assert that a matching dynamic_cast<> returns the same result in
debug builds.
crosscast<type>(value) should be used for safe casting from one type to
another in multiple inheritance scenarios. It compiles to a
dynamic_cast<> plus an assert on the result. Since it does not optimize
down to static_cast<>, you should prefer downcast<> over crosscast<>
when you can.
Redefined running_device to be a proper C++ class (now called device_t).
Same for device_config (still called device_config). All devices and
device_configs must now be derived from these base classes. This means
each device type now has a pair of its own unique classes that describe
the device. Drivers are encouraged to use the specific device types
instead of the generic running_device or device_t classes. Drivers that
have a state class defined in their header file are encouraged to use
initializers off the constructor to locate devices. [Aaron Giles]
Removed the following fields from the device and device configuration
classes as they never were necessary or provided any use: device class,
device family, source file, version, credits. [Aaron Giles]
Added templatized variant of machine->device() which performs a downcast
as part of the device fetch. Thus machine->device<timer_device>("timer")
will locate a device named "timer", downcast it to a timer_device, and
assert if the downcast fails. [Aaron Giles]
Removed most publically accessible members of running_device/device_t in
favor of inline accessor functions. The only remaining public member is
machine. Thus all references to device->type are now device->type(), etc.
[Aaron Giles]
Created a number of device interface classes which are designed to be mix-
ins for the device classes, providing specific extended functionality and
information. There are standard interface classes for sound, execution,
state, nvram, memory, and disassembly. Devices can opt into 0 or more of
these classes. [Aaron Giles]
Converted the classic CPU device to a standard device that uses the
execution, state, memory, and disassembly interfaces. Used this new class
(cpu_device) to implement the existing CPU device interface. In the future
it will be possible to convert each CPU core to its own device type, but
for now they are still all CPU devices with a cpu_type() that specifies
exactly which kind of CPU. [Aaron Giles]
Created a new header devlegcy.h which wraps the old device interface using
some special template classes. To use these with an existing device,
simply remove from the device header the DEVICE_GET_INFO() declaration and
the #define mapping the ALL_CAPS name to the DEVICE_GET_INFO. In their
place #include "devlegcy.h" and use the DECLARE_LEGACY_DEVICE() macro.
In addition, there is a DECLARE_LEGACY_SOUND_DEVICE() macro for wrapping
existing sound devices into new-style devices, and a
DECLARE_LEGACY_NVRAM_DEVICE() for wrapping NVRAM devices. Also moved the
token and inline_config members to the legacy device class, as these are
not used in modern devices. [Aaron Giles]
Converted the standard base devices (VIDEO_SCREEN, SPEAKER, and TIMER)
from legacy devices to the new C++ style. Also renamed VIDEO_SCREEN to
simply SCREEN. The various global functions that were previously used to
access information or modify the state of these devices are now replaced
by methods on the device classes. Specifically:
video_screen_configure() == screen->configure()
video_screen_set_visarea() == screen->set_visible_area()
video_screen_update_partial() == screen->update_partial()
video_screen_update_now() == screen->update_now()
video_screen_get_vpos() == screen->vpos()
video_screen_get_hpos() == screen->hpos()
video_screen_get_vblank() == screen->vblank()
video_screen_get_hblank() == screen->hblank()
video_screen_get_width() == screen->width()
video_screen_get_height() == screen->height()
video_screen_get_visible_area() == screen->visible_area()
video_screen_get_time_until_pos() == screen->time_until_pos()
video_screen_get_time_until_vblank_start() ==
screen->time_until_vblank_start()
video_screen_get_time_until_vblank_end() ==
screen->time_until_vblank_end()
video_screen_get_time_until_update() == screen->time_until_update()
video_screen_get_scan_period() == screen->scan_period()
video_screen_get_frame_period() == screen->frame_period()
video_screen_get_frame_number() == screen->frame_number()
timer_device_adjust_oneshot() == timer->adjust()
timer_device_adjust_periodic() == timer->adjust()
timer_device_reset() == timer->reset()
timer_device_enable() == timer->enable()
timer_device_enabled() == timer->enabled()
timer_device_get_param() == timer->param()
timer_device_set_param() == timer->set_param()
timer_device_get_ptr() == timer->get_ptr()
timer_device_set_ptr() == timer->set_ptr()
timer_device_timeelapsed() == timer->time_elapsed()
timer_device_timeleft() == timer->time_left()
timer_device_starttime() == timer->start_time()
timer_device_firetime() == timer->fire_time()
Updated all drivers that use the above functions to fetch the specific
device type (timer_device or screen_device) and call the appropriate
method. [Aaron Giles]
Changed machine->primary_screen and the 'screen' parameter to VIDEO_UPDATE
to specifically pass in a screen_device object. [Aaron Giles]
Defined a new custom interface for the Z80 daisy chain. This interface
behaves like the standard interfaces, and can be added to any device that
implements the Z80 daisy chain behavior. Converted all existing Z80 daisy
chain devices to new-style devices that inherit this interface.
[Aaron Giles]
Changed the way CPU state tables are built up. Previously, these were data
structures defined by a CPU core which described all the registers and how
to output them. This functionality is now part of the state interface and
is implemented via the device_state_entry class. Updated all CPU cores
which were using the old data structure to use the new form. The syntax is
currently awkward, but will be cleaner for CPUs that are native new
devices. [Aaron Giles]
Converted the okim6295 and eeprom devices to the new model. These were
necessary because they both require multiple interfaces to operate and it
didn't make sense to create legacy device templates for these single cases.
(okim6295 needs the sound interface and the memory interface, while eeprom
requires both the nvram and memory interfaces). [Aaron Giles]
Changed parameters in a few callback functions from pointers to references
in situations where they are guaranteed to never be NULL. [Aaron Giles]
Removed MDRV_CPU_FLAGS() which was only used for disabling a CPU. Changed
it to MDRV_DEVICE_DISABLE() instead. Updated drivers. [Aaron Giles]
Reorganized the token parsing for machine configurations. The core parsing
code knows how to create/replace/remove devices, but all device token
parsing is now handled in the device_config class, which in turn will make
use of any interface classes or device-specific token handling for custom
token processing. [Aaron Giles]
Moved many validity checks out of validity.c and into the device interface
classes. For example, address space validation is now part of the memory
interface class. [Aaron Giles]
Consolidated address space parameters (bus width, endianness, etc.) into
a single address_space_config class. Updated all code that queried for
address space parameters to use the new mechanism. [Aaron Giles]
|
|
|
|
|
|
| |
Added inline tag() function to return a const char * version. Updated
callers to use this instead of directly accessing tag.cstr() which
was awkward.
|
|
|
|
|
| |
just call through to the get info function. Removed old macros that
wrapped calls.
|
|
|
|
|
|
| |
functions into methods of those classes. The most wide-ranging
change was converting device_reset() to device->reset(). Apart
from that it was mostly internal shuffling in the core.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
devtag_get_device ... machine->device()
memory_find_address_space ... device->space()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Created new central header "emu.h"; this should be included
by pretty much any driver or device as the first include. This
file in turn includes pretty much everything a driver or device
will need, minus any other devices it references. Note that
emu.h should *never* be included by another header file.
- Updated all files in the core (src/emu) to use emu.h.
- Removed a ton of redundant and poorly-tracked header includes
from within other header files.
- Temporarily changed driver.h to map to emu.h until we update
files outside of the core.
Added class wrapper around tagmap so it can be directly included
and accessed within objects that need it. Updated all users to
embed tagmap objects and changed them to call through the class.
Added nicer functions for finding devices, ports, and regions in
a machine:
machine->device("tag") -- return the named device, or NULL
machine->port("tag") -- return the named port, or NULL
machine->region("tag"[, &length[, &flags]]) -- return the
named region and optionally its length and flags
Made the device tag an astring. This required touching a lot of
code that printed the device to explicitly fetch the C-string
from it. (Thank you gcc for flagging that issue!)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
useable as a stack object. Also designed the interfaces to allow
for chaining operations. And added a casting operator to const
char * for seamless use in most functions that take plain old C
strings.
Changed all uses of astring to use the object directly on the
stack or embedded in objects instead of explicitly allocating
and deallocating it. Removed a lot of annoying memory management
code as a result.
Changed interfaces that accepted/returned an astring * to
use an astring & instead.
Removed auto_alloc_astring(machine). Use
auto_alloc(machine, astring) instead.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
osd_free(). They take the same parameters as malloc() and free().
Renamed mamecore.h -> emucore.h.
New C++-aware memory manager, implemented in emualloc.*. This is a
simple manager that allows you to add any type of object to a
resource pool. Most commonly, allocated objects are added, and so
a set of allocation macros is provided to allow you to manage
objects in a particular pool:
pool_alloc(p, t) = allocate object of type 't' and add to pool 'p'
pool_alloc_clear(p, t) = same as above, but clear the memory first
pool_alloc_array(p, t, c) = allocate an array of 'c' objects of type
't' and add to pool 'p'
pool_alloc_array_clear(p, t, c) = same, but with clearing
pool_free(p, v) = free object 'v' and remove it from the pool
Note that pool_alloc[_clear] is roughly equivalent to "new t" and
pool_alloc_array[_clear] is roughly equivalent to "new t[c]". Also
note that pool_free works for single objects and arrays.
There is a single global_resource_pool defined which should be used
for any global allocations. It has equivalent macros to the pool_*
macros above that automatically target the global pool.
In addition, the memory module defines global new/delete overrides
that access file and line number parameters so that allocations can
be tracked. Currently this tracking is only done if MAME_DEBUG is
enabled. In debug builds, any unfreed memory will be printed at
the end of the session.
emualloc.h also has #defines to disable malloc/free/realloc/calloc.
Since emualloc.h is included by emucore.h, this means pretty much
all code within the emulator is forced to use the new allocators.
Although straight new/delete do work, their use is discouraged, as
any allocations made with them will not be tracked.
Changed the familar auto_alloc_* macros to map to the resource pool
model described above. The running_machine is now a class and contains
a resource pool which is automatically destructed upon deletion. If
you are a driver writer, all your allocations should be done with
auto_alloc_*.
Changed all drivers and files in the core using malloc/realloc or the
old alloc_*_or_die macros to use (preferably) the auto_alloc_* macros
instead, or the global_alloc_* macros if necessary.
Added simple C++ wrappers for astring and bitmap_t, as these need
proper constructors/destructors to be used for auto_alloc_astring and
auto_alloc_bitmap.
Removed references to the winalloc prefix file. Most of its
functionality has moved into the core, save for the guard page
allocations, which are now implemented in osd_alloc and osd_free.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
validity.h to the core for consistency as well as an explicit foo.h in each foo.c. [Atari Ace]
---------- Forwarded message ----------
From: Atari Ace <atari_ace@verizon.net>
Date: Sat, Dec 26, 2009 at 5:01 PM
Subject: [patch] Header/static cleanups
To: submit@mamedev.org
Cc: atariace@hotmail.com
- Hide quoted text -
Hi mamedev,
This patch add some missing header declarations and static qualifiers,
and adjusts a few names. In the core, it adds validity.h for
consistency as well as an explicit foo.h in each foo.c.
~aa
|
|
|
| |
STREAM_UPDATE_FREQUENCY now reflects the frequency.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Hi mamedev,
This patch continues deglobalifying the MAME core, this time targeting
sound.c. The first two patches adds running_machine to apis in
sound.h that lack it (the first patch is generated by the perl script,
the second patch fixes some cases it didn't handle well). The last
patch then removes the globals in the traditional way.
~aa
|
| |
|
|
|
|
|
| |
can now be optionally compiled with the C++ compiler (mingw g++
only for the moment; MSVC still has issues).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This update changes the way we handle memory allocation. Rather
than allocating in terms of bytes, allocations are now done in
terms of objects. This is done via new set of macros that replace
the malloc_or_die() macro:
alloc_or_die(t) - allocate memory for an object of type 't'
alloc_array_or_die(t,c) - allocate memory for an array of 'c' objects of type 't'
alloc_clear_or_die(t) - same as alloc_or_die but memset's the memory to 0
alloc_array_clear_or_die(t,c) - same as alloc_array_or_die but memset's the memory to 0
All original callers of malloc_or_die have been updated to call these
new macros. If you just need an array of bytes, you can use
alloc_array_or_die(UINT8, numbytes).
Made a similar change to the auto_* allocation macros. In addition,
added 'machine' as a required parameter to the auto-allocation macros,
as the resource pools will eventually be owned by the machine object.
The new macros are:
auto_alloc(m,t) - allocate memory for an object of type 't'
auto_alloc_array(m,t,c) - allocate memory for an array of 'c' objects of type 't'
auto_alloc_clear(m,t) - allocate and memset
auto_alloc_array_clear(m,t,c) - allocate and memset
All original calls or auto_malloc have been updated to use the new
macros. In addition, auto_realloc(), auto_strdup(), auto_astring_alloc(),
and auto_bitmap_alloc() have been updated to take a machine parameter.
Changed validity check allocations to not rely on auto_alloc* anymore
because they are not done in the context of a machine.
One final change that is included is the removal of SMH_BANKn macros.
Just use SMH_BANK(n) instead, which is what the previous macros mapped
to anyhow.
|
|
|
|
|
|
|
|
|
| |
function here. Remaining devices have been converted to have
device-specific functions to do the same thing with proper type
checking.
CPUs still have a set_info function but it is CPU-specific now and
no longer piggybacks on the general device function.
|
|
|
|
| |
to make them compile as either C or C++.
|
|
|
|
| |
to other sound chips to be broken.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
assumption that all device tags are unique. Specifically, the
following no longer need to provide a device type:
AM_DEVREAD/WRITE
DEVCB_DEVICE_HANDLER
devtag_get_device
devtag_reset
device_list_find_by_tag
as well as several device interfaces that referenced other devices.
Also fixed assertion due to overflow in the recent sound fix.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
compilation:
- new option CPP_COMPILE to trigger this (off by default)
- split CFLAGS into common, C-only, and C++-only flags
- when enabled, CPP_COMPILE causes 'pp' to be appended to
the target name
NOTE THAT THE SYSTEM CANNOT ACTUALLY BE COMPILED THIS WAY
YET. IT IS JUST AN EXPERIMENT.
Modified lib.mak to always build zlib/expat as C regardless
of CPP_COMPILE.
Modified windows.mak to fix warnings with MAXOPT=1, and to
leverage the new CFLAGs definitions.
Modified vconv.c to do appropriate conversions for new C++
options.
Updated sources so that libutil, libocore (Windows), and
libosd (Windows) can be cleanly compiled as C or C++. This
was mostly adding some casts against void *.
Fixed a few more general obvious problems at random
locations in the source:
- device->class is now device->devclass
- TYPES_COMPATIBLE uses typeid() when compiled for C++
- some functions with reserved names ('xor' in particular)
were renamed
- nested enums and structs were pulled out into separate
definitions (under C++ these would need to be scoped to
be referenced)
- TOKEN_VALUE cannot use .field=x initialization in C++ :(
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This was primarily added to allow for sound routes to be supported in a way that
is compatible with the current driver structure. A device can now define a
DEVICE_CUSTOM_CONFIG callback which is called whenever one of the
MCONFIG_TOKEN_DEVICE_CONFIG_CUSTOM_* tokens is encountered. A special token
MCONFIG_TOKEN_DEVICE_CONFIG_CUSTOM_FREE is defined to clean up memory allocated
and/or reset the custom configuration, and is called when the device is torn down
to allow for memory cleanup.
Reimplemented the sound routing using this new mechanism.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Please note: regression testing is in progress, but the first round
of glaring regressions have already been taken care of. That said,
there is likely to be a host of regressions as a result of this
change.
Also note: There are still a few rough edges in the interfaces. I
will try to clean them up systematically once the basic system is
working.
All sound chips are now proper devices.
Merged the sound chip interface into the device interface,
removing any differences (such as the whole ALIASing concept).
Modified every sound chip in the following ways:
* updated to match the device interface
* reduced read/write handlers down to the minimal number
* added the use of get_safe_token() for ensuring correctness
* other minor cleanup
Removed the custom sound device. The additional work to just make
custom sound cases into full devices is minimal, so I just converted
them all over to be actual devices.
Vastly simplified the sound interfaces, removing the ghastly
sndti_* business and moving everyone over to using tags for
sound identity. sndintrf, like cpuintrf, is now just a header
file with no implementation.
Modified each and every driver that references a sound chip:
* all memory maps explicitly reference the targeted device via
AM_DEVREAD/AM_DEVWRITE/AM_DEVREADWRITE
* 16-bit and 32-bit accesses to 8-bit chips no longer use
trampoline functions but instead use the 8-bit AM_DEVREAD/WRITE
macros
* all references to sound chips are now done via tags
* note that these changes are brute force, not optimal; in many
cases drivers should grab pointers to devices in MACHINE_START
and stash them away
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
> On Mon, Jan 19, 2009 at 05:37:35AM -0800, R. Belmont wrote:
> > My mistake. I thought you were suggesting that we should actually
> > somehow handle malloc failures. Given that aborting is an OK way to
> > express failure, I'd suggest the return values be changed to DEFER
> > and DONT_DEFER to eliminate the conceptual imbalance of OK/DEFER.
>
> That's where comes the fact that we have 130 OK/DONT_DEFER and 1
> DEFER. It makes me think that the exceptional DEFER case should be
> handled by an exceptional function call.
>
> I know, code talks, but I'm at work right now :-)
Here we go.
OG.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sent: Monday, December 22, 2008 3:00 PM
To: submit@mamedev.org
Cc: atariace@hotmail.com
Subject: [patch] Make SOUND_xxx pointers to SND_GET_INFO functions
Hi mamedev,
This patch probably should wait till after 0.129 goes out, but may be
of interest regardless. It makes the treatment of SOUND_xxx the same
as that of CPU_xxx. That is, they are function pointers to the
SND_GET_INFO routine for the sound.
The first patch just adds some missing include files and modifies a
few cases where a sound_type was used as an integer. This could go in
now. The second patch then adds the needed #defines to all the sound
headers (it assumes the previous patch I sent to add the SND_GET_INFO
declarations was applied), and modifies the sound code accordingly. It
also moves the sound clock to the device object. Note that the dummy
sound core is removed entirely. I cheated a bit and made VERIFY_SNDTI
also declare and fill in the sndnum, making this an INLINE function
would probably be more appropriate, but all of this code's days are
numbered.
There may be some performance loss in drivers that expect sndti_xxx
routines to be fast, since sound_matrix has been removed. The
performance however should be similar to looking up items in a
devicelist, so those drivers will have to adjust eventually.
~aa
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
interfaces when handling strings. Namely, the generic
get_info functions allocate a temporary string and the
device in question copies its string to the target,
instead of assigning a const char *. Updated all device
and sound cores to operate this way.
Added the concept of a cpu_state_table, which is
supplied by the CPU cores and which describes all the
register state accessible to the debugger and other
subsystems. The format of the table is such that most
data can be simply fetched from memory without the
further involvement of the CPU core, including the
display of common formats. Extensibility points are
available for custom display and for importing/exporting
the data to intermediate variables for more complicated
scenarios. Updated the ADSP21xx, TMS340x0, and i86 cores
to use this.
Removed the old debugger register list, which was never
used. Replaced it with using ordering from the
cpu_state_table.
Renamed REG_PC -> REG_GENPC, REG_SP -> REG_GENSP, and
REG_PREVIOUSPC -> REG_GENPCBASE. Updated a few spots
that were using these directly. Moved these definitions
into the end of the register area rather than leaving
them outside which put them in a weird range.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sent: Wednesday, December 17, 2008 9:03 PM
To: submit@mamedev.org
Cc: atariace@hotmail.com
Subject: [patch] STREAM_UPDATE update
Hi mamedev,
This patch modifies the parameters of the stream_update_func callback.
The first two patches go through and changes all the callbacks to use
a consistent set of parameters (the larger patch was mechanically
generated, the smaller second patch are hand edits where review or
compilation showed issues with the automatic conversion). The third
patch then macroizes all the callbacks to STREAM_UPDATE, and was done
mechanically except for the change to streams.h. The fourth patch
then adds device to the callback, and eliminates Machine in a handful
of callbacks by referencing the device. deprecat.h -= 8.
~aa
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sent: Tuesday, December 09, 2008 8:13 PM
To: submit@mamedev.org
Cc: atariace@hotmail.com
Subject: [patch] Add device parameter to stream_create()
Hi mamedev,
This patch adds the sound device to the parameters passed to
stream_create so that the global Machine can be removed from
streams.c. It assumes my previous patch which added CUSTOM_START and
SAMPLES_START has been applied.
~aa
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a reworked/expanded version of the patch I sent yesterday.
This one is split into three parts:
1. This introduces function macros for SAMPLES_START,
CUSTOM_{START,STOP,RESET}, and ANTIC_RENDERER.
2. This introduces running_machine *machine throughout MAME.
Principally it adds running_machine *machine = Machine to the top of
functions, but in some static functions the parameter is added
directly. Some similar changes in 99xxcore.h, v9938.c, v9938mod.c,
galaxold.c, psx.c, taito_l.c are also made to eliminate Machine
params. No global API is changed.
3. This changes the APIs introduced in the first part to pass device
or space as appropriate. A few similar changes in some other global
apis are made as well.
The net result of this sequence of patches is to remove 40% of the
Machine references and 27 deprecat.h includes.
~aa
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
appropriate, and to keep all global variables hanging off the
machine structure. Once again, this means all state registration
call sites have been touched:
- state_save_register_global* now takes a machine parameter
- state_save_register_item* now takes a machine parameter
- added new state_save_register_device_item* which now uses
the device name and tag to generate the base name
Extended the fake sound devices to have more populated fields.
Modified sound cores to use tags from the devices and simplified
the start function.
Renumbered CPU and sound get/set info constants to align with
the device constants, and shared values where they were perfectly
aligned.
Set the type field in the fake device_configs for CPU and sound
chips to a get_info stub which calls through to the CPU and sound
specific get_info functions. This means the device_get_info()
functions work for CPU and sound cores, even in their fake state.
Changed device information getters from device_info() to
device_get_info() to match the CPU and sound macros.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
recent cpu core changes. Specifically, it adds a fake device
implementation similar to the one the cpu cores were using in 128u3
(i.e. it only provides the machine pointer and the token), and makes
some interface adjustments aligned to 128u4 (i.e. adding
snd_class_header, adding get_ to various getter functions). The
primary benefit of this change is the removal of "deprecat.h" from 23
sound cores. I also adjusted ui.c to stop calling sndnum_clock and
access the clock data similarly to how it does the cpu clock data.
[AtariAce]
|
|
|
|
|
| |
and timer_get_time to pass the machine parameter. Moved timer globals
to hang off of the running_machine.
|
| |
|
|
|
|
|
|
|
|
| |
Subject: Machine -> machine
This is a big patch adding running_machine* parameters and using
"machine" where available.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
is either DEVICE_START_OK or DEVICE_START_MISSING_DEPENDENCY. The latter
should be returned by a device if there is another device it depends on
which hasn't been started yet. Added new flag in the device interface to
indicate whether a device has been started.
Changed laserdisc interface to explicitly specify the screen and sound
devices it should route to. Drivers no longer have to manually call
laserdisc_vsync(). Instead, the laserdisc code connects up to the routed
screen device and works based on that screen's VBLANK timing. Removed
all existing calls to laserdisc_vsync().
Changed laserdisc behavior so that it completes the previous video read
and initiates the next read at the end of VBLANK instead of the beginning.
This gives player logic time during VBLANK to alter the slider position
prior to fetching the next frame.
Added new laserdisc callback for vsync begin and changed the update
callback to be called at the end of VBLANK. Also added functions to set
the slider speed, advance the slider, and directly control the video/
audio squelch. In addition, there is a new status function to get the
slider position in general terms.
Added parameter to the VBLANK callbacks supported in emu/video.c. Updated
all callers to provide a callback value.
Fixed bug that would cause watchpoints to trigger if you had a memory
window open to the watchpoint address.
Further updates to the PR-8210 ROM simulation. Still not quite there but
the system is much better understood now. Added layout to the PR-8210
which displays the state of the front-panel LEDs.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Subject: Various cleanups
A couple of minor cleanups sitting on my disk for a while:
- removed obsolete ENABLE_DEBUGGER occurance
- removed more unprintable characters in SH-2 disassembler
- memset() usage cleanups
- removed duplicated TMS5110 entry in sound.mak
- use machine in uigfx.c where it's already available
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
integer value, regions are now referred to by a region class and
a region tag. The class specifies the type of region (one of CPU,
gfx, sound, user, disk, prom, pld) while the tag uniquely specifies
the region. This change required updating all the ROM region
definitions in the project to specify the class/tag instead of
region number.
Updated the core memory_region_* functions to accept a class/tag
pair. Added new memory_region_next() function to allow for iteration
over all memory regions of a given class. Added new function
memory_region_class_name() to return the name for a given CPU
memory region class.
Changed the auto-binding behavior of CPU regions. Previously, the
first CPU would auto-bind to REGION_CPU1 (that is, any ROM references
would automatically assume that they lived in the corresponding
region). Now, each CPU automatically binds to the RGNCLASS_CPU region
with the same tag as the CPU itself. This behavior required ensuring
that all previous REGION_CPU* regions were changed to RGNCLASS_CPU
with the same tag as the CPU.
Introduced a new auto-binding mechanism for sound cores. This works
similarly to the CPU binding. Each sound core that requires a memory
region now auto-binds to the RGNCLASS_SOUND with the same tag as the
sound core. In almost all cases, this allowed for the removal of the
explicit region item in the sound configuration, which in turn
allowed for many sound configurations to removed altogether.
Updated the expression engine's memory reference behavior. A recent
update expanded the scope of memory references to allow for referencing
data in non-active CPU spaces, in memory regions, and in EEPROMs.
However, this previous update required an index, which is no longer
appropriate for regions and will become increasingly less appropriate
for CPUs over time. Instead, a new syntax is supported, of the form:
"[tag.][space]size@addr", where 'tag' is an optional tag for the CPU
or memory region you wish to access, followed by a period as a
separator; 'space' is the memory address space or region class you
wish to access (p/d/i for program/data/I/O spaces; o for opcode space;
r for direct RAM; c/u/g/s for CPU/user/gfx/sound regions; e for
EEPROMs); and 'size' is the usual b/w/d/q for byte/word/dword/qword.
Cleaned up ROM definition flags and removed some ugly hacks that had
existed previously. Expanded to support up to 256 BIOSes. Updated
ROM_COPY to support specifying class/tag for the source region.
Updated the address map AM_REGION macro to support specifying a
class/tag for the region.
Updated debugger windows to display the CPU and region tags where
appropriate.
Updated -listxml to output region class and tag for each ROM entry.
|
|
|
|
| |
in -samplerate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Input ports are now maintained hierarchically. At the top
level are input ports, which contain a list of fields. Each
field represents one or more bits of the port. Certain fields
such as DIP switches and configuration switches contain a
list of settings, which can be selected. DIP switch fields
can also contain a list of DIP switch locations.
* Normalized behavior of port overrides (via PORT_INCLUDE or
by defining multiple overlapping bits). All fields within a
port are kept in strict increasing bit order, so altered DIP
switches are now kept in the appropriate order. This addresses
MAMETesters bug 01671.
* Live port state is now fully separate from configured
state. This is manifested in a similar way to devices, where
a const list of ports can be managed either offline or live.
Each port has a pointer to an opaque set of live state which
is NULL when offline or valid when live. Each port also has
a running_machine * which is also NULL when offline.
* Because of this new arrangement, the conversion from tokens
to a list of ports now requires reasonably complex memory
allocation, so these port lists must be explicitly allocated
and freed (they are not mantained by automatic resource
allocation).
* Custom and changed callbacks now take a pointer to a field
config instead of a running machine. This provides more
information about what field triggered the change notification.
The machine can be found by referenced field->port->machine.
* The inptport.c module has been cleaned up and many
ambiguities resolved. Most of this is internal, though it did
result in osd_customize_inputport_list() being changed to
osd_customize_input_type_list(). The parameter to this function
is now a linked list instead of an array, and the structures
referenced have been reorganized somewhat.
* Updated config.c to pass machine parameters to its callbacks.
* Updated validity checks, XML output, and UI system to handle
the new structures.
* Moved large table of default input settings to a separate
include file inpttype.h.
* Removed gross hacks in trackfld and hyperspt NVRAM. These
may be broken as a result.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
to write RGB bitmaps. Unfortunately, the only option is fully
uncompressed, which means the resulting AVIs are *HUGE* and
may not play correctly in realtime due to high data rate. The
intention is that these uncompressed AVIs are post-processed
by other utilities to compress the video and produce a
realtime playable result.
Added new command-line option -aviwrite which works just like
-mngwrite, except it produces AVIs and streams sound to them.
Updated documentation accordingly.
Shift+F12 still produces MNGs for now, though this might change
in the future.
Modified fileio.c to retain the full pathname to the file so
that it can be queried while the file is open.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Subject: [patch] Remove more Machine globals, #include "deprecat.h"
Hi mamedev,
The attached patch goes through and converts a number of Machine
globals to machine locals, and then removes #include "deprecat.h" if
appropriate. The script that generated it is included, since the
patch itself is rather large and would have been time consuming to
produce otherwise.
The script doesn't convert cases of Machine that aren't in common
macros. I'll try to tackle those later if someone doesn't beat me to
it.
~aa
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Subject: Machine -> machine cleanups
This patch changes "Machine" to "machine", when the runnin-machine
parameter is already available. In some cases I could even remove the
dprecat.h.
I will look for some occurances where it can be easily changed and
afterward take a step at adding the running_machine parameter in a
few places.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Added DEVINFO_INT_TOKEN_BYTES, which is queried before device
startup. It should return the size of the structure that will
be hung off of device->token. It must not return 0.
Changed the core device interface to allocate and zero a block
of memory the size of DEVINFO_INT_TOKEN_BYTES before calling
device_start. The pointer to this memory is already attached
to device->token at the time device_start is called.
The primary motivation for this is to allow the device_start
function to make internal calls and pass the device_config *
around as if the object were fully constructed. Since the token
is used to indicate whether or not a device is live, this makes
the device "live" at the time device_start is called rather
than after it completes.
|
|
|
|
| |
Cannot use == to compare float with the loaded value in this case.
|
| |
|
|
|
|
|
|
|
|
|
| |
than tokens and individual bits to the device callbacks. Updated
all existing devices accordingly.
Removed machine from the parameters of some of the device_get_info
and device_set_info calls because that information is stored
with the device now.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
to use the macros.
Added the concept of device classes. Devices specify their class
in their get_info function. Classes can be used to walk through
devices at a more general level than their type. Functions have
been added to iterate through devices by class just as you can
by type.
Removed some unused fields from device_config.
|
| |
|