Commit Graph

51 Commits

Author SHA1 Message Date
Aaron Giles
d971ce8f36 Privatized most of the m_machine pointers in the system to prevent
direct use.
2011-04-19 06:02:01 +00:00
Aaron Giles
2ad5072023 BIG update.
Remove redundant machine items from address_space and device_t.
Neither machine nor m_machine are directly accessible anymore.
Instead a new getter machine() is available which returns a
machine reference. So:

  space->machine->xxx   ==>  space->machine().xxx
  device->machine->yyy  ==>  device->machine().yyy

Globally changed all running_machine pointers to running_machine
references. Any function/method that takes a running_machine takes
it as a required parameter (1 or 2 exceptions). Being consistent
here gets rid of a lot of odd &machine or *machine, but it does
mean a very large bulk change across the project.

Structs which have a running_machine * now have that variable
renamed to m_machine, and now have a shiny new machine() method
that works like the space and device methods above. Since most of
these are things that should eventually be devices anyway, consider
this a step in that direction.

98% of the update was done with regex searches. The changes are
architected such that the compiler will catch the remaining
errors:

// find things that use an embedded machine directly and replace
// with a machine() getter call
S: ->machine->
R: ->machine\(\)\.

// do the same if via a reference
S: \.machine->
R: \.machine\(\)\.

// convert function parameters to running_machine &
S: running_machine \*machine([^;])
R: running_machine \&machine\1

// replace machine-> with machine.
S: machine->
R: machine\.

// replace &machine() with machine()
S: \&([()->a-z0-9_]+machine\(\))
R: \1

// sanity check: look for this used as a cast
(running_machine &)
// and change to this:
*(running_machine *)
2011-03-29 15:50:04 +00:00
Aaron Giles
af071893a6 Cleanup of machine.h. Shuffled some fields around, and moved several
to private member variables with accessors:

machine->m_respool     ==> machine->respool()
machine->config        ==> machine->config()
machine->gamedrv       ==> machine->system()
machine->m_regionlist  ==> machine->first_region()
machine->sample_rate   ==> machine->sample_rate()

Also converted internal lists to use simple_list.
2011-03-28 09:10:17 +00:00
Aaron Giles
5db7b9e8a3 Ok, last major rename for this round:
memory_region()        == machine->region()->base()
memory_region_length() == machine->region()->bytes()

region_info -> memory_region

Regex searches:

S: memory_region( *)\(( *)([^,&]+), *([^)]+)\)
R: \3->region\1\(\2\4\)->base\(\)

S: memory_region_length( *)\(( *)([^,&]+), *([^)]+)\)
R: \3->region\1\(\2\4\)->bytes\(\)
2011-01-01 00:41:25 +00:00
Aaron Giles
2ca38fad3e Remove public decodechar function. 2010-12-31 21:24:46 +00:00
Aaron Giles
733b797a3d Split mame.c into mame.c and machine.c, the latter containing the
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.
2010-06-30 03:46:21 +00:00
Aaron Giles
41b9dbb9ac Made the machine_config a proper object. Added detokenize method to
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.
2010-06-28 06:40:44 +00:00
Fabio Priuli
c1fd5b50bf not worth mention: added very small workaround which fixes mingw32 crash on 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...
2010-02-28 14:26:29 +00:00
Aaron Giles
d061ced592 Created new template class tagged_list which manages a simple list
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.
2010-01-17 09:26:29 +00:00
Aaron Giles
2b23d7c017 Bulk driver.h -> emu.h switch. 2010-01-10 18:00:42 +00:00
Aaron Giles
4498faacd9 First round of an attempted cleanup of header files in the system.
- 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!)
2010-01-10 00:29:26 +00:00
Aaron Giles
91a1b8d634 NOTE: This change requires two new osd functions: osd_malloc() and
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.
2010-01-08 06:05:29 +00:00
Phil Bennett
5be4dc8d54 Added some missing header declarations and static qualifiers. Added 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
2010-01-06 21:09:25 +00:00
Aaron Giles
bd24fb23c1 Results of running the latest srcclean. 2009-12-28 09:04:00 +00:00
Aaron Giles
6f4ff3c823 Moved machine->gfx initialization out of the video module and
into drawgfx. We now call this before devices are initialized,
so that devices can dynamically append to the machine->gfx as
needed.
2009-12-23 17:15:41 +00:00
Phil Bennett
685bac3770 Removed deprecated core function decodegfx() [Christophe Jaillet]
---------- 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
2009-12-21 16:32:45 +00:00
Phil Bennett
c8608dcc22 Cleaned-up several drivers; added missing prototypes and removed dead ones,
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
2009-12-08 14:54:29 +00:00
Aaron Giles
35f7dd5c6d Cleaned out remaining generic drawgfx usage. Removed the
TRANSPARENCY_* constants, cleaning up vestigial usages.
2009-07-02 05:45:07 +00:00
Aaron Giles
02df84f38a Part 1 of the drawgfx changes. [Atari Ace] 2009-07-02 04:46:21 +00:00
Aaron Giles
ad4910a8a8 Bulk change alert.
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.
2009-04-26 23:54:37 +00:00
Aaron Giles
eb539cce9d Many casts added to the core files, and various other tweaks
to make them compile as either C or C++.
2009-03-12 07:43:03 +00:00
Aaron Giles
864560d4af From: Atari Ace [mailto:atari_ace@verizon.net]
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
2009-02-26 08:52:27 +00:00
Aaron Giles
4141d22d07 02862: Many sets in taitosj.c: During the scroling the lower part of the screen becomes black 2009-01-29 09:51:42 +00:00
Aaron Giles
7f2e4e19be Cleanups and version bump. 2009-01-15 08:33:24 +00:00
Aaron Giles
f449ec6100 Added new function gfx_element_build_temporary() to safely build a temporary
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.
2009-01-14 05:16:23 +00:00
Aaron Giles
ac0abd1706 Major drawgfx cleanup, global removal, and feature enhancements:
- 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.
2009-01-12 11:05:15 +00:00
Aaron Giles
a7db377c87 From: Atari Ace [mailto:atari_ace@verizon.net]
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
2008-12-14 08:45:12 +00:00
Aaron Giles
9476c50ee6 Cleanups for 0.124. Marked Mermaid as working per checkin comment. 2008-03-24 04:07:46 +00:00
Aaron Giles
abda9cf18b Undid recent change to remove pen lookups in 16bpp modes. This code
is shared between INDEXED16 and RGB15 rendering and we're not ready 
to remove the lookups yet.
2008-03-24 01:20:39 +00:00
Zsolt Vasvari
772311642a Removed unneeded pen lookups.
Some code formatting clean-up.
2008-03-18 08:34:01 +00:00
Couriersud
76847517a4 Identified code not used and marked with "#ifdef UNUSED_FUNCTION" 2008-03-01 01:34:43 +00:00
Zsolt Vasvari
f8cbcafd5e Replaces mame_bitmap with bitmap_t
Removes mame_bitmap
2008-02-29 04:01:09 +00:00
Aaron Giles
41d2a2d8c1 Change priority_bitmap accesses back to UINT8s, now that we are
again allocating an 8bpp bitmap. Fixes crashes in several games.
2008-02-26 10:48:45 +00:00
Zsolt Vasvari
2b1192dec8 - Backs out BITMAP8 removal from most places.
- 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
2008-02-24 23:24:29 +00:00
Zsolt Vasvari
803ece9d96 Removes 8-bit bitmap support and converts all previously 8-bit bitmaps to 16-bit 2008-02-24 13:30:08 +00:00
Zsolt Vasvari
51cae46fac - Added some asserts to drawgfx and drawgfxzoom
- 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.
2008-02-24 06:33:02 +00:00
Aaron Giles
aad4c81ac4 Pulled remaining vestiges of old-style colortables:
* 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.
2008-02-19 17:52:21 +00:00
Zsolt Vasvari
72dc0af97c Removes no longer used TRANSPARENCY_COLOR. Clean compile required. 2008-02-11 03:05:29 +00:00
Zsolt Vasvari
190247c1fb Removes no longer neccessary check as drawgfxzoom support all remaining transparency modes 2008-02-04 09:33:16 +00:00
Zsolt Vasvari
1426e5865f Removed TRANSPARENCY_BLEND_RAW transparancy mode. Needs a recompile just to be on the safe side. 2008-02-04 09:27:44 +00:00
Zsolt Vasvari
354acd5f1b - Removed TRANSPARENCY_NONE_RAW, TRANSPARENCY_PENS_RAW and 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.
2008-01-28 13:02:04 +00:00
Zsolt Vasvari
10b4ed5a2d Removes TRANSPARENCY_BLEND completely and TRANSPARENCY_BLEND_RAW as an option to copybitmap. Source tree needs to be recompiled as the transparancy mode enum has changed. 2008-01-27 07:48:31 +00:00
Zsolt Vasvari
b4cc7b0021 Removes TRANSPARENCY_NONE case from copybitmap_core, which can never happen 2008-01-25 16:35:16 +00:00
Zsolt Vasvari
596635241a - Removes copybitmap_remap and copyscrollbitmap_remap, neither which was used by anybody
- Removes some obsolete commented out code
- Fixed up some comments
2008-01-25 16:22:26 +00:00
Zsolt Vasvari
4930b2dbfd - Added deprecat.h that contains some deprecated/discouraged contructs (see 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
2008-01-25 09:30:43 +00:00
Aaron Giles
c96a3b766a (From AtariAce)
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.
2008-01-11 06:31:19 +00:00
Aaron Giles
fa3061392e (From Atari Ace)
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.
2008-01-06 01:21:33 +00:00
Aaron Giles
ee9f88963c Copyright cleanup:
- removed years from copyright notices
 - removed redundant (c) from copyright notices
 - updated "the MAME Team" to be "Nicola Salmoria and the MAME Team"
2008-01-06 00:47:40 +00:00
Aaron Giles
28d23853ae (From AtariAce)
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.
2007-12-26 16:55:35 +00:00
Aaron Giles
507ca2d275 Changes for MAME 0.121u4. 2007-12-17 16:41:39 +00:00