| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
running_machine definition and implementation.
Moved global machine-level operations and accessors into methods on the
running_machine class. For the most part, this doesn't affect drivers
except for a few occasional bits:
mame_get_phase() == machine->phase()
add_reset_callback() == machine->add_notifier(MACHINE_NOTIFY_RESET, ...)
add_exit_callback() == machine->add_notifier(MACHINE_NOTIFY_EXIT, ...)
mame_get_base_datetime() == machine->base_datetime()
mame_get_current_datetime() == machine->current_datetime()
Cleaned up the region_info class, removing most global region accessors
except for memory_region() and memory_region_length(). Again, this doesn't
generally affect drivers.
|
|
|
|
|
|
|
|
|
|
|
|
| |
this object which can be called multiple times to append new devices
after the initial machine configuration is set up. Updated member
variables to match new naming convention.
Changed the running_machine to take a constructed machine_config
object in the constructor, instead of creating one itself, for
consistency. Also added machine->total_colors() as a shortcut to
machine->config->m_total_colors.
|
|
|
|
|
|
|
| |
my eeepc.
I guess it could be related to some problem in my system (ASUS EeePC, Intel Atom CPU Z520 @ 1.33GHz 0,99GB RAM), but I don't get why non-symbols compile is crashing at this file while symbols build always compiles fine. Any suggestion is welcome, but I hope nobody has any objection against this change.
FWIW, I came to this "fix" after noticing that the removal of one of the for loops (any of the 3) was fixing the issue...
|
|
|
|
|
|
|
|
| |
along with a tagmap. Changed memory regions, input ports, and devices
to use this class. For devices, converted typenext and classnext
fields into methods which dynamically search for the next item.
Changed a number of macros to use the features of the class, removing
the need for a bunch of helper functions.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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!)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
| |
into drawgfx. We now call this before devices are initialized,
so that devices can dynamically append to the machine->gfx as
needed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
---------- Forwarded message ----------
From: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
Date: Mon, Dec 14, 2009 at 9:56 PM
Subject: Removal of a deprecated function
To: submit@mamedev.org
Hi,
a function in "drawgfx.c" is declared in "deprecat.h"
This function ("decodegfx(...)") is not used any more in the code, so it
could be removed.
Hope this help.
Best regards,
CJ
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
marked non-exported functions as static and removed cases of #include "deprecat.h" [Atari Ace]
---------- Forwarded message ----------
From: Atari Ace <atari_ace@verizon.net>
Date: Sat, Dec 5, 2009 at 7:18 AM
Subject: [patch] Header cleanups
To: submit@mamedev.org
Cc: atariace@hotmail.com
Hi mamedev,
This patch improves the quality of the mame driver headers, by adding
missing prototypes and source comments, removing dead prototypes, and
marking some non-exported functions as static within the drivers. It
also eliminates about a dozen cases of #include "deprecat.h".
~aa
|
|
|
|
| |
TRANSPARENCY_* constants, cleaning up vestigial usages.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
to make them compile as either C or C++.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sent: Monday, February 16, 2009 7:10 PM
To: submit@mamedev.org
Cc: atariace@hotmail.com
Subject: [patch] Add some missing static qualifiers
Hi mamedev,
This patch mostly adds missing static qualifiers, plus a few related header/name adjustments. In particular, I tackled m68kmake.c and tmsmake.c which exposed a fair amount of dead code.
~aa
|
|
|
|
| |
screen becomes black
|
| |
|
|
|
|
|
|
|
| |
gfx_element. Updated the drivers that did this to use the new function, fixing
random crashes.
Fixed a couple of other minor regressions with recent drawgfx changes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Added built-in dirty tile tracking to the gfx_element. This removes
the need for all drivers that had dynamically populated graphics
to do their own dirty tracking. Tiles are marked dirty via the
new function gfx_element_mark_dirty(). Any driver that needs access
to the decoded data must call gfx_element_get_data() in order to
ensure that the referenced tile is clean before proceeding.
- In order to support dirty tracking, the gfx_element was enhanced to
keep track of the original source pointer, so that it can go back
and regenerate tiles on demand. For systems that set NULL for the
region in the gfxdecode, they must use gfx_element_set_source()
to specify a pointer to the raw data before drawing anything.
- Changed allocgfx() to gfx_element_alloc(), and added parameters to
specify the source data pointer, base color index, and total colors.
Many drivers had to whack these values in after the fact, so this
allowed for some minor additional cleanup.
- Added a dirtyseq member to the gfx_element struct. This is
incremented on each tile dirty, and can be used to sniff if
something has changed.
- Added logic in the tilemap engine to track which gfx_elements are
used for a given tilemap, and automatically detect changes to the
tiles so that drivers no longer have to explicitly invalidate the
tilemap when tiles change. In the future, this may grow smarter to
only invalidate the affected tiles, but for now it invalidates the
entire tilemap.
- Updated a number of drivers to remove their own dirty handling and
leverage the new internal dirty marking.
- Because the source data must always be present, updated the atarigen
zwackery and mystwarr graphics handing code to support this.
- Thanks to the dirty tracking, this actually allows all gfx decoding
to happen on the fly instead of all at once up front. Since there
was some concern that this would cause undesirable behavior due to
decoding lots of tiles on the fly, it is controlled with a compile-
time constant in mame.h (PREDECODE_GFX). Set this to 1 to get the
old behavior back.
- Moved decodechar() and decodegfx() to deprecat.h. All drivers in MAME
have been updated to simply mark tiles dirty and let the rendering
system decode them as needed, so these functions may go away in the
future.
- Rewrote entirely the rendering code in drawgfx. This code previously
used extensive recursive #includes and tricks to build, and was
very difficult to understand. The new code is based off of a set of
macros defined in drawgfxm.h. These new macros separate the core
rendering logic from the per-pixel operation, allowing the operation
to be easily "plugged" into any of the renderers. These macros are
also available to any driver that wants custom rendering behavior
that is similar to existing core behavior, without needing to
populate the core with esoteric one-off rendering behaviors.
- Added a set of new functions for [p]drawgfx[zoom], one for each
transparency type. The old [p]drawgfx[zoom] functions are still
present, but now switch off the transparency type and call through
to one of these new transparency-specific functions. The old
functions are also now reduced to only supporting TRANSPARENCY_NONE,
TRANSPARENCY_PEN, and TRANSPARENCY_PENS. All other rendering types
must use the new functions.
- All new rendering functions have extensive asserts to catch improper
clipping rectangles and other common errors.
- All new rendering functions automatically downgrade to optimized
versions where appropriate. For example, calling drawgfx_transpen
with an out-of-range pen automatically falls back to drawgfx_opaque.
And drawgfxzoom_* with xscale=yscale=1.0 automatically falls back
to drawgfx_*. And many other examples. In general, this relieves
drivers from needing to make these sorts of decisions.
- All new rendering functions have a consistent parameter order that
is a bit different from the existing functions. The cliprect
parameter is now specified immediately after the destination bitmap,
to match the convention used throughout the rest of the system.
The core parameters are followed by the scale parameters (for the
zoom functions), and then followed by the priority parameters (for
the pdrawgfx* functions), finally followed by any PIXEL_OP*-specific
parameters (such as transparent pen, alpha, drawing tables, etc.)
- Removed drawgfx_alpha_cache, alpha_set_level(), and the inline
functions alpha_blend16() and alpha_blend32(). To render graphics
with alpha, use the new [p]drawgfx[zoom]_alpha functions, which
take an explicit alpha value. To render tilemaps with alpha, the
TILEMAP_DRAW_ALPHA option now takes an explicit alpha parameter.
And to do you own alpha blending, use the alpha_blend_r16() and
alpha_blend_r32() functions, which take an explicit alpha.
- Updated a number of drivers as a result of removing the implicit
alpha in the drawgfx_alpha_cache.
- Removed drawgfx_pen_table and TRANSPARENCY_PEN_TABLE. To achieve
the same effect, build your own table and pass it to
[p]drawgfx[zoom]_transtable, along with a pointer to the
machine->shadow_table to use for shadows. Eventually
machine->shadow_table is likely to go away, and drivers will need
to fetch the shadow table from the palette directly.
- Updated a number of drivers to remove use of drawgfx_pen_table.
- Removed TRANSPARENCY_ALPHARANGE; it was only used by the psikyosh
driver, so it is now moved locally into that driver and built
using the macros in drawgfxm.h.
- Removed TRANSPARENCY_PEN_RAW; to achieve the same effect, call the
new [p]drawgfx[zoom]_transpen_raw() functions. Updated drivers to
make this change.
- Removed the unused mdrawgfx* functions entirely.
- Added new function gfx_element_set_source_clip() to specify a
source clipping rectangle for any element. This replaces the nasty
hacks that were being used in bnstars, ms32, namcos86, and namcos1
to achieve similar behaviors.
- Simplified the copyrozbitmap() functions to match the copybitmap()
functions in having separate opaque and transparent versions. Also
removed the 'priority' parameter which was only used by one driver,
and moved that logic into a custom renderer built using macros in
drawgfxm.h. Updated copyrozbitmap* to use the destbitmap, cliprect
parameter ordering convention as well.
- Simplified the draw_scanline*() functions to always render opaque.
Only one driver was doing otherwise, and it now does its work
internally (draw_scanline is dead-simple ever since we moved
rotation to the OSD code; I almost just removed it entirely).
Other changes:
- Added a cliprect to the bitmap_t type, which describes the full
bitmap.
- Removed tilemap_set_pen_data_offset; unfortunately, this adds a
random tile offset behind the scenes and goes against the dirty
tile detection and invalidation. Updated the mainsnk, snk, and
snk68 drivers to use old fashioned tile banking. (Sorry Nicola.)
- Changed zac2650 gfxdecode to use scale factors.
- Added function video_assert_out_of_range_pixels() to help find
the source of invalid pixels (generally out-of-range palette
entries due to invalid data or sloppy calculations). Place this
after each step in your rendering in a debug build to discover
which code is generating improper pixels.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sent: Saturday, December 13, 2008 5:07 PM
To: submit@mamedev.org
Cc: atariace@hotmail.com
Subject: [patch] Add machine to allocgfx
Hi mamedev,
This patch eliminates the #include "deprecat.h" from drawgfx.h. It
does so in a fashion similar to my recent tilemap patch, adding the
machine pointer to gfx_element, changing allocgfx to take a machine,
and then adjusting the internals to use the machine field as needed.
The changes outside of drawgfx.[ch] were done with the attached
script.
~aa
|
| |
|
|
|
|
|
| |
is shared between INDEXED16 and RGB15 rendering and we're not ready
to remove the lookups yet.
|
|
|
|
| |
Some code formatting clean-up.
|
| |
|
|
|
|
| |
Removes mame_bitmap
|
|
|
|
| |
again allocating an 8bpp bitmap. Fixes crashes in several games.
|
|
|
|
|
| |
- I still left drawgfx.c as is, the only piece of code that used any of the functions in drawgfx
was s2636.c -- everything else uses 8-bit bitmaps as a replacement for a two dimensional array
|
| |
|
|
|
|
|
|
|
|
| |
- Moved some variable declerations so that they are only visible where they are actually used
Note that the diff is large only because I removed a level of indentation from a huge chunk of code.
I could do that because the case it was checking for was already caught by one of the asserts added.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* PALETTE_INIT no longer has a colortable parameter
* removed game_colortable and remapped_colortable from machine_config
* updated a few stragglers that still referenced these fields
* removed tile_draw_colortable from tilemap.c
(From Zsolt): Added support for the new colortable object in the palette viewer
Changed the input port tokens to use a union instead of casting everything to FPTR.
In the future, C99-enabled compilers will be able to achieve type safety with
designated initializers.
|
| |
|
|
|
|
| |
transparency modes
|
|
|
|
| |
be on the safe side.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TRANSPARENCY_PEN_TABLE_RAW as they were no
longer used. Source needs to be recompiled because of the changed enum.
- Changed copybitmap and copyscrollbitmap:
There are now 2 versions of each, one without and with transparency:
void copybitmap(mame_bitmap *dest,mame_bitmap *src,int flipx,int flipy, int sx,int sy,const rectangle *clip);
void copybitmap_trans(mame_bitmap *dest,mame_bitmap *src,int flipx,int flipy, int sx,int sy,const rectangle *clip, pen_t transparent_pen);
void copyscrollbitmap(mame_bitmap *dest,mame_bitmap *src, nt rows,const int *rowscroll,int cols,const int *colscroll, const rectangle *clip);
void copyscrollbitmap_trans(mame_bitmap *dest,mame_bitmap *src, int rows,const int *rowscroll,int cols,const int *colscroll, const rectangle *clip, pen_t transparent_pen);
The version without _trans is the equivalent of the old TRANSPARENCY_NONE, The *_trans version is the equivalent
of the old TRANSPARENCY_PEN. The old TRANSPARENCY_COLOR mode is done via calling *_trans version and passing in
the pen that has been looked up via machine->pens[].
So for example, copybitmap(..., TRANSPARENCY_COLOR, 0) becomes
copybitmap_trans(..., machine->pens[0])
- Changed all drivers to the new calls. Suprising how few drivers still use these functions.
Most have still not been converted to tilemaps, or they are still writing to a tmpbitmap
which gets copied over to the real bitmap in VIDEO_UPDATE.
- Changed machine->screen[0].visarea to 'cliprect' where appropriate.
|
|
|
|
| |
option to copybitmap. Source tree needs to be recompiled as the transparancy mode enum has changed.
|
| |
|
|
|
|
|
|
|
| |
used by anybody
- Removes some obsolete commented out code
- Fixed up some comments
|
|
|
|
|
|
|
|
|
| |
below)
The idea is to create extra work if a driver wants to use these and hopefully
gives an incentive to look for an alternate solution
- Added #include of deprecat.h that rely on these contructs
- Removed a bunch of unneccassary #include's from these files
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While investigating alternate gfx layout schemes, I stumbled across
the fact that some drivers are allocating graphics with one layout and
then decoding them with another (!). There's no guarantee this will
work, but for the drivers that do so (all Konami games), the layouts
are similar enough that it does. A related potential bug is that many
drivers are decoding using the layout provided to allocgfx, not the
layout attached the element returned from allocgfx. If the element
had scaling applied to it, this would be incorrect, but since scaling
is rare these are also benign. It would also be a problem if the
layout data had a different internal representation (which is
something I'm experimenting with), so to reduce the possibility of
coding errors and allow for future changes, I'd like to remove the
layout parameter from decodechar.
So here's two patches, the first fixes the affected Konami drivers to
allocate and decode using the same layouts. It changes the notion of
plane_order and bpp in the functions somewhat to let the start
routines select the appropriate layout, but acceptably so IMHO (I can
clean this up further if there are loud objections). The second patch
then removes the layout parameter from all the decodechar() calls.
I also reviewed MESS to see if it had similar problems and didn't find
any.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
0. This patch does minor cleanup to existing layouts, trimming/padding
entries as appropriate and reformating a few layouts.
1. This patch introduces a GFXLAYOUT_RAW() macro, and uses it
throughout. It codifies the requirements for a raw layout in one
place.
2. This patch adds new validation code to the core for some previously
unchecked assumptions about layouts, and reduces the number of
references to the gfx_layout fields in preparation for a change in the
representation.
3. This patch constifies the remaining non-const gfx_layouts in MAME.
It does this by adjusting the code so that the only modification to a
layout ever needed is for the total field, which is then handled by
modifying a stack-based copy of the layout before invoking allocgfx. I
also spent some time consolidating and simplifying the layout code in
konamiic.c.
|
|
|
|
|
|
| |
- removed years from copyright notices
- removed redundant (c) from copyright notices
- updated "the MAME Team" to be "Nicola Salmoria and the MAME Team"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch should complete the addition of static qualifiers to all
MAME symbols that aren't explicitly exported. It primarily handles
generated code (e.g. amspdwy.c), plus a handful of cases I'd
previously missed and some new cases introduced in the last update.
One interesting bit was the discovery that the 32-bit scanline
routines in drawgfx.c are unused. I debated eliminating them but
decided instead to just export them. Various internal drawgfx
functions were conditionally removed by examining a new RAW define,
although one routine (blockmove_8toN_alphaone) was determined to be
dead code.
While investigating constifying MESS, I came across a few core APIs
that were missing const qualifiers which this patch fixes. I also
consted up tx1.c while I was at it.
|
| |
|
|
|