| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
used for statics and structure members, and some compilers (esp. C++
compilers) don't allow that.
|
| |
|
| |
|
|
|
|
| |
tilemaps (no whatsnew)
|
| |
|
| |
|
|
|
|
| |
from within a device, and be passed that device in your callback.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
> To: submit@mamedev.org
> CC: atariace@hotmail.com
> Subject: [patch] Introduce tilemap_private to running_machine
> Date: Thu, 23 Jul 2009 18:49:08 -0700
>
> Hi mamedev,
>
> Tilemaps in MAME are currently globally tracked. If multiple machines
> with different tilemaps are ever to be supported, this needs to be
> changed, which this patchset does.
>
> 0. This patch add tilemap_private to running_machine, adds machine to
> a few apis and adds two new apis to replace the convention that tmap =
> NULL => all tilemaps.
> 1. This patch mechanically converts all the uses of ALL_TILEMAPS to
> use the new apis.
> 2. This patch removes ALL_TILEMAPS and makes tilemap_private
> dynamically allocated per machine.
>
> ~aa
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
> Sent: Wednesday, July 22, 2009 8:18 PM
> To: submit@mamedev.org
> Cc: atariace@hotmail.com
> Subject: [patch] priority_bitmap global begone!
>
> Hi mamedev,
>
> This patch set migrates priority_bitmap from a global variable to the
> running_machine object. The first patch adds it to the machine
> object, adjusting some routines to take a machine/screen object in
> preparation and others to use a local variable for the bitmap. The
> second patch then converts all the global vars to (typically)
> machine->priority_bitmap, this patch was generated by the included
> script. The last patch removes the global priority_bitmap.
>
> ~aa
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 1:03 PM
To: submit@mamedev.org
Subject: Speed up 'src\mame\video\mcatadv.c'
Hi,
here is a patch against 'src\mame\video\mcatadv.c'
This patch moves a call to 'memory_region' outside of a hot loop in the 'draw_sprites' function.
This gives a fiew pourcents speed up in games such as 'nost'.
Hope this helps,
Best regards,
Christophe Jaillet
--
From: Christophe Jaillet [christophe.jaillet@wanadoo.fr]
Sent: Monday, February 16, 2009 1:53 PM
To: submit@mamedev.org
Subject: Another speed up in 'src\mame\video\mcatadv.c'
Hi,
here is a patch against 'src\mame\video\mcatadv.c'
This patch , by re-arranging the code, give a +/- 5% speed up in the emulation.
Before, we :
- fetch a pixel,
- make some computation for lower/higher part of it
- check if we should render it
- test for priority
- update destination if necessary
With this patch, we check priority first in order to avoid useless processing and testing on pixel that can't be displayed due to priority reason. So in the best case, it is faster, in the worse case execution time should be more or less the same because :
if ((drawxpos >= cliprect->min_x) && (drawxpos <= cliprect->max_x) &&
pix)
is likely to be true (IMO). So the same tests are performed, only the order is different.
Hope this helps,
Best regards,
Christophe Jaillet
--
From: Christophe Jaillet [christophe.jaillet@wanadoo.fr]
Sent: Monday, February 16, 2009 1:09 PM
To: submit@mamedev.org
Subject: Clean up of 'src\emu\tilemap.c' (with the patch...)
Hi,
here is a patch against 'src\emu\tilemap.c'
This patch removes a variable called 'original_cliprect' from the top of 'tilemap_get_tile_flags'.
This variable is useless because all cases that need it, already make the same copy in a variable with the same name, shodawing the former one.
Hope this helps,
Best regards,
Christophe Jaillet
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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 1:34 PM
To: submit@mamedev.org
Cc: atariace@hotmail.com
Subject: [patch] Add machine parameter to tilemap_create()
Hi mamdev,
This set of patches eliminates the #include "deprecat.h" from
tilemap.c. The main change is to require callers of tilemap_create to
provide a machine pointer. This pointer is then attached to the
tilemap and used when needed inside tilemap.c.
The first patch simply adds running_machine *machine to some driver
functions that will soon need them. The second patch makes the needed
changes to tilemap.[ch]. The (large) third patch adds machine to all
the tilemap_create calls, and was generated entirely by the attached
script.
~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.
|
|
|
|
|
|
| |
state_save_combine_module_and_tag() function in favor of passing
the tag when registering. Revisited all save state item registrations
and changed them to use the tag where appropriate.
|
|
|
|
|
| |
implemented dynamic tile & sprite bit depth in the Taito F3 driver.
02024: pbobble3, pbobble4, ringrage and clones: Color Regression
|
|
|
|
|
| |
While this isn't 'free' as tilemap_set_palette_offset() is (when the offset changes, the pixmap cache needs to be invalidated), it helps removing some redundant code from drivers.
Updated snk.c and snk68.c to take advantage of the new function.
|
|
|
|
| |
rects smaller than the tilemap. This reduces by an order of magnitude the time taken to render the bg in Gunnail stage 5.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
only remaining form is the one that takes a pointer parameter.
Added macros for STATE_PRESAVE and STATE_POSTLOAD to define common
functions. Added machine parameter to these functions.
Updated all drivers and CPU/sound cores to use the new macros
and consolidate on the single function type. As a result pushed
the machine parameter through a few initialization stacks.
Removed unnecessary postload callbacks which only marked all tiles
dirty, since this is done automatically by the tilemap engine.
|
|
|
|
|
| |
Actually remove tilemap invalidating from tilemap_set_palette_offset (tilemap.c)
Following recommendation from Aaron added a comment to tilemap.h
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Attached is update for Merit hardware based on V9938 (CRT-250 and CRT-260 - meritm.c).
New playable games:
Pit Boss II
Super Pit Boss
Pit Boss Megastar
Megatouch IV
Megatouch IV Tournament Edition
Megatouch 6
|
|
|
|
|
|
|
|
|
| |
- Added video_screen_auto_bitmap_alloc(screen) -- it is just a shorthand for
auto_bitmap_alloc(video_screen_get_width(screen), video_screen_get_height(screen), video_screen_get_format(screen))
which is a common operation
- The Dynax/Don Den Lover games now do their updating in VIDEO_UPDATE instead of VIDEO_EOF. This semmed to
have fixed the palette problems
- Went through some of these drivers and changed Machine to machine
|
|
|
|
|
|
|
|
|
|
| |
suffixed with _func. Did this throughout the core and
drivers I was familiar with.
Fixed gcc compiler error with recent render.c changes.
gcc does not like explicit (int) casts on float or
double functions. This is fracking annoying and stupid,
but there you have it.
|
|
|
|
| |
Removes mame_bitmap
|
|
|
|
|
| |
- 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
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
| |
|
|
|
|
| |
longer used for anything.
|
| |
|
|
|
|
|
|
| |
the latest changes in MAME 0.122u7 broke the screenless systems in
MESS. The attached patch fixes this.
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
| |
- removed years from copyright notices
- removed redundant (c) from copyright notices
- updated "the MAME Team" to be "Nicola Salmoria and the MAME Team"
|
|
|