Commit Graph

183 Commits

Author SHA1 Message Date
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
df24d3be59 Added new function core_fload() to load a file into an allocated buffer.
Updated src2html, regrep, and chdman tools to use this function where
appropriate.

In chdman, changed -addmeta to -addmetatext or -addmetabin to explicitly
specify the type of data (previous auto-detect was too dangerous).
2009-03-11 05:06:34 +00:00
Aaron Giles
e0ccde49a3 Moved chd_clone_metadata code into chdman.c so that it can intelligently
update old tags.

Modified cdrom.c to expose metadata read/write functions, and changed
chdman to use them. Also changed chdman to parse old-style metadata and
convert it to new-style metadata since we're going to need to re-do this
anyway and the two won't hash to the same value.

Added completely untested support for the ident metadata to the hard
disk creation path. If a filename is provided immediately after the
source filename, it is taken as an ident file and processed for CHS
data and added. Other metadata types can be added afterwards via
-addmeta.
2009-03-10 15:09:00 +00:00
Aaron Giles
d2d22a19af Redid metadata hashing. A digest of tags and hashes for each
piece of metadata along with the hash for the raw data is then 
hashed to produce the final SHA1.

Updated romload to skip the obsolete MD5 field.
2009-03-10 00:27:30 +00:00
Aaron Giles
21b5f27224 NOTE: With the change, all existing CHD diff files are invalid.
Updated CHD format to version 4. Checksums are now computed and
stored separately for raw data and metadata, and metadata is now
checksummed by default.

We will need to go through all existing CHDs, run a chdman -update
on them, and update the SHA1s stored in the drivers to accommodate
this (MD5s should be removed).

Updated chdman to support a generic metadata addition system:

  chdman -addmeta <chdfile> <tag> [<index>] <sourcefile>

The <sourcefile> is examined and if it appears to be strictly text,
any EOFs and trailing EOLs are stripped, and the result is NULL-
terminated to match the behavior of existing metadata.

Updated chdman to report and fix errors in the raw and metadata
SHA1s.

Changed the CHD verify interfaces to pass back a structure containing
all the necessary data for verification and fixing.
2009-03-09 16:49:56 +00:00
Aaron Giles
99d297a6fd Cleanups and version bump. 2009-03-05 09:38:53 +00:00
Aaron Giles
e8c09b35f6 Added flags to the metadata entries, encoded in the top bit. Right now
it is a no-op, but eventually will be used to indicate which bits of
metadata are included in the overall checksum.
2009-03-05 07:35:24 +00:00
Couriersud
0a7a58fdde include stddef.h for ptrdiff_t 2009-03-01 12:30:12 +00:00
Aaron Giles
e2757c60d2 Modified the makefile to support experimental optional C++
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++ :(
2009-02-28 22:10:06 +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
7f2e4e19be Cleanups and version bump. 2009-01-15 08:33:24 +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
84618c3f7a romload cleanups:
- added running_machine to internal structure, removed as explicit parameter
 - added new function rom_file_size() to compute the size of a ROM
 - removed rom_first_chunk() and rom_next_chunk() which are no longer needed
 - changed progress display to be based on size of ROMs loaded, not number
 - changed temporary load buffer to be dynamically allocated
 - fixed reload logic to handle skipped BIOSes

Also changed rand_memory() to use a fixed seed for consistent behavior.
2009-01-02 19:20:55 +00:00
Aaron Giles
f32fa3b2e6 02745: all sets using autosave: Games using autosave segfault on startup 2008-12-20 07:39:19 +00:00
Aaron Giles
e26c70d35b Fixed crash bug in DCS games.
Updated the fcompress APIs to allow for specifying a compression level.

Removed the concept of state saving tags, which was a hack to get save states
to work with multiple CPU cores. Simplified the state saving system as a
result, performing the operation in a single pass and without allocating
a full blob of memory. Also enabled minimal compression.
2008-12-11 17:03:13 +00:00
Aaron Giles
d92a2e0c4e Cleanups/version bump/added missing drivers. 2008-12-06 17:54:42 +00:00
Aaron Giles
013e6eff00 02688: DIP switch settings are not being stored in INP files.
To fix this, I had to break old INP files. While I was in there,
I added corefile support for compressing/decompressing data on
the fly, and enabled it for INPs, meaning the newer format INPs
are output and processed compressed.
2008-12-04 08:34:30 +00:00
Aaron Giles
bbac5a66b2 Pool items are now tracked globally, and freed in reverse order
of allocation. This enables proper nesting.
2008-11-26 04:37:25 +00:00
R. Belmont
c6e16e1925 02456: wrong sector size at CD_TRACK_MODE2 conversion routine 2008-10-30 03:08:35 +00:00
Aaron Giles
5123b07115 Cleanups and version bump. 2008-10-02 05:34:21 +00:00
Aaron Giles
3355357ffc Simplified core deinterlacing logic based on availability of pre-
decoded VBI data. Added plumbing for allowing for overall brightness/
contrast/gamma corrections on laserdisc video. Fixed bug when combining
brightness values in the palette logic.
2008-09-29 09:23:22 +00:00
Aaron Giles
296347baab Plumbed machine parameters through the renderer. Removed need for
deprecat.h.

Changed render_texture_set_bitmap() to accept a palette object 
instead of a palette index. The renderer remains optimized for the 
system palette but will work if objects have their own palette as 
well.

Changed renderer to permit palettes for RGB and YUY textures. If
specified, these palettes specify a 32-entry (RGB15) or 256-entry
(others) lookup for applying additional brightness/contrast/gamma
on a per-texture basis.

Removed rescale notification. It never really worked that well and 
violated proper layering.

Renamed palette_set_brightness() to palette_set_pen_contrast() for 
clarity.

Changed palette objects to support global brightness/contrast/gamma
in addition to per-group and per-entry controls.
2008-09-29 08:02:58 +00:00
Aaron Giles
6c05b835a2 02442: -aviwrite produces faulty files 2008-09-27 22:48:52 +00:00
Aaron Giles
9766dc2367 Changed MAKE_RGB macro to set the alpha to 255 instead of 0. Updated
palette.c to preserve the alpha when transforming palette values.
These changes should be transparent to almost all drivers and rendering
(ha-ha), but there may be an occasional instance where a driver relied
on the alpha being 0 in the system palette. This also means that the
palette_set_color() function preserves any alpha value that is set.

Changed Firefox to RGB32 to allow for mid-screen palette changes. Because
of the above change, the hacky alpha manipulation that was previously
required is no longer necessary; the alpha is set directly in the palette
entry.
2008-09-27 20:36:04 +00:00
Aaron Giles
c391ab646f 02410: -aviwrite: files over 2 gigs sometimes get cut off 2008-09-27 20:04:01 +00:00
Aaron Giles
229d598989 Cleanups and version bump. 2008-09-26 13:42:51 +00:00
Aaron Giles
0f775dc84e From: Christophe Jaillet [mailto:christophe.jaillet@wanadoo.fr]
Sent: Wed 9/24/2008 2:00 PM
To: submit@mamedev.org
Subject: Speed up fillbitmap
Hi,

there are many places in mame which make use of "fill_bitmap" or the
equivalent "fillbitmap"

An optimisation is done when the depth of the bitmap is 16 or 32 bpp and
when the UINT16 or UINT32 corresponding to the color is composed of same
bytes (i.e 0xffff for example). This is usefull because most of the calls
are for color 0 (black).

In all other cases, the bitmap is filled one pixel at a time using a loop
with a code like :
================
    for (y = fill.min_y; y <= fill.max_y; y++)
    {
     UINT16 *destrow = BITMAP_ADDR16(dest, y, 0);
     for (x = fill.min_x; x <= fill.max_x; x++)
      destrow[x] = (UINT16)color;
    }

================


However, each rows of the final bitmap will be the same. So I modified this
simple assigned to work as follow :
    1) fill the first row one pixel at a time
    2) fill all the other rows by copying the first one.
This makes us use memcpy instead of a hard coded loop for most of the
filling process.
2008-09-26 05:31:34 +00:00
Aaron Giles
0f3e79564d From: Atari Ace [mailto:atari_ace@verizon.net]
Sent: Sunday, September 21, 2008 10:45 AM
To: submit@mamedev.org
Cc: atariace@hotmail.com
Subject: [patch] More static qualifiers

Hi mamedev,

Another static function update from yours truly, almost entirely
affecting code added in the last few months to MAME.  The fixes are
the usual lot, changing enum definitions so they aren't declared,
decorating dead code/declarations with #if...#endif, and of course,
adding static where appropriate.  In addition, I fixed a bunch of
UNUSED_FUNCTON symbols to be spelled correctly (I didn't introduce
this).

~aa
2008-09-26 05:25:11 +00:00
Aaron Giles
7f819dbfef Cleanups and version bump. 2008-09-18 16:17:42 +00:00
Aaron Giles
1eb3c2d964 Changed requirements for laserdisc CHDs to require a new chunk of
metadata with pre-decoded frame information. Modified chdman to
automatically produce this for CHDs that are of the appropriate
parameters. To fix up existing CHDs, use chdman -fixavdata on the
CHD.

Modified the laserdisc core to leverage the pre-decoded frame
metadata, which is now required. This improves seek times when
searching and allows the player-specific emulation access to the
VBI data as soon as it would really be available. Changed update
callback timing to fire just before the first line of VBI data
would be read; at that point, the frame selection is assumed to
be committed. 

Converted PR-8210 emulation over to using the actual MCU from the
laserdisc player. This MCU controls low-level functions such as
slider position and laser on/off, and receives decoded vertical
blanking data in order to make decisions. Removed old HLE behavior.
Note that the overlay text is displayed via the UI; this is
temporary and will be fixed shortly.

Converted Simutrek-hacked laserdisc emulation to using the actual
MCU from the game, which in turn hands off commands to the PR-8210
MCU. This is still not 100% but is pretty close at this point and
achieves the correct behaviors in most cases.

Fixed Cube Quest overlay scaling to cover the whole screen.

Changed laserdisc video parameters to position the screen area at
the bottom rather than the top, since this corresponds more closely
to standard line numbering.

Extended the vbiparse code to support pack/unpack, and to more
fully document all the meanings of the VBI codes.

Updated ldplayer to support slow/fast forward movement, frame/chapter
display, and separate controls for scanning/stepping.

Added new built-in variable "frame" to the debugger.

Fixed device-based ROM loading to support loading ROMs from the
game's ZIP as well.
2008-09-18 15:17:42 +00:00
Aaron Giles
aa2b6bd29a Cleanups and version bump. 2008-09-11 16:25:46 +00:00
Nathan Woods
f1d5b2a1ec Added a core_fopen_ram_copy() call, similar to core_fopen_ram() except that it
copies the memory
2008-09-06 22:47:05 +00:00
Aaron Giles
a2caa558e2 Cleanups and version bump. 2008-08-28 15:26:11 +00:00
Aaron Giles
fd883f1e72 Fixed bug when writing AVI files with more than one RIFF chunk.
Added missing chdman error messages when extracting to an AVI file.
2008-08-21 04:18:12 +00:00
Aaron Giles
0523e9feb7 Cleanups and version bump. 2008-08-19 07:31:55 +00:00
Aaron Giles
284b5a0d95 Added new generic laserdisc VIDEO_UPDATE handler to the laserdisc code.
This handler works for both disc-only games and those with overlays. 
For disc-only games, the base macro is sufficient. For games with 
overlays, an additional set of configuration macros are provided:

   MDRV_LASERDISC_OVERLAY - specifies update function, width, height,
      and bitmap format of the overlay
   MDRV_LASERDISC_OVERLAY_CLIP - specifies the visible area of the
      overlay bitmap
   MDRV_LASERDISC_OVERLAY_POSITION - specifies default x,y position
   MDRV_LASERDISC_OVERLAY_SCALE - specifies default x,y scale factors

The update function provided to MDRV_LASERDISC_OVERLAY is identical to
a normal VIDEO_UPDATE callback, so a standard one can be used. All
existing laserdisc drivers have been updated to support this new
rendering mechanism, removing much duplicated code.

Added the ability to configure the overlay position and scale 
parameters at runtime. Added OSD menus to control them. Added logic
to save/restore the data in the game's configuration file.

Added new macros MDRV_LASERDISC_SCREEN_ADD_NTSC and _PAL, which
defines a standard screen with the correct video timing characteristics
and update function for laserdiscs. Updated all drivers to use these
macros instead of defining their own screens.

Added DISK_REGIONS to all laserdisc drivers.

Added DISK_IMAGE_READONLY_OPTIONAL to support games (like Cube Quest)
where the disk is non-essential to the game's operation.

Fixed bug in identifying the custom sound driver for the laserdisc.

Updated ldverify to identify blank regions of the disc for post-
processing.

Fixed rendering 16bpp with alpha using bilinear filters (fixes
screenshots of laserdisc games with overlays).

Included support for parsing .gdi files in chdman. [ElSemi]

Added new driver for Cube Quest. This includes CPU cores for the three
bitslice processors, as well as laserdisc support for the hacked
laserdisc that was used to drive the games. 
[Philip Bennett, Joe Magiera, Warren Ondras]

Note that the SHA1/MD5 for the laserdisc will likely undergo at least
one more change before being finalized.
2008-08-18 04:31:08 +00:00
Aaron Giles
224eb1f58b Cleanups and version bump. 2008-08-14 08:05:35 +00:00
Aaron Giles
480df37d02 Added new flag to menu items: MENU_FLAG_DISABLE, which means the
item will be visible but not selectable.

Fixed bug that prevented the cheat engine from working when the
debugger was disabled.

Modified xmlfile.c to accept integer values in decimal or hex. The
default is decimal. Numbers may be prefixed by '#' for decimal
values, or by '$' or '0x' to indicate hexadecimal values. Also
added function xml_get_attribute_int_format() to return the format
of the attribute, so that it can be later replicated.

Updated cheat parser to preserve the format of attribute values
used for cheat parameters and items.

Added support for information-only cheat items, which will be
displayed in the menu but which are not selectable and have no
action associated with them. Empty information-only items are
automatically converted to menu separators.
2008-08-13 04:55:42 +00:00
Aaron Giles
111a34fea5 Added video level detection and reporting to ldverify.
Removed channels parameter from avcomp decode configuration.

Fixed incorrect test in winwork that led to spinning instead
of using the nicely allocated events we had on hand.

Forced a sound synchronization on each vsync in the laserdisc
playback. This prevents overwriting the tail end of the
buffer which was fouling up the MACH 3 audio decoding.

Removed obsolete size check for uncompressable audio data.
2008-08-12 17:37:53 +00:00
Aaron Giles
a85c4c754d Rejiggered huffman.c to support multiple interleaving
streams and a delta-RLE pre-encoding. Added optimized
case for the Y/Cb/Y/Cr video encoding case. Cleaned up
the code.

Updated avcomp.c to use the new huffman.c functions.
Reworked configuration options to allow for both input
and output of naturally aligned data streams. Updated
chdman and laserdsc to use the new interfaces. New
compression gives an additional 3-7% over previous
attempt and compresses the dummy CHDs down significantly.
2008-08-12 09:24:22 +00:00
Aaron Giles
b40a4f5531 Cleanups and version bump. 2008-08-07 16:02:05 +00:00
Aaron Giles
3107dc2dff ldverify now prints transient progress to stderr, allows for frame #0,
and reports if no white flags were seen.

Fixed bug in aviio.c which could cause an infinite loop if attempting
to read sound beyond the end of the file.

Rewrote the white flag detection to use a histogram for outlier detection
and peak identification.
2008-08-07 15:07:12 +00:00
Aaron Giles
5e3764d0a0 Removed obsolete makemeta tool. Replaced it with new ldverify
tool which walks through either an AVI or CHD capture from a
laserdisc and ensures that there are no anomalies lurking in
the VBI data.

Added new option to chdman, where if you use -createav with
a special filename (either 2:2 or 3:2) it will create a fake
laserdisc files with the equivalent cadence. This can be used
for testing until full captures are available. Most games used
2:2 apart from Dragon's Lair and Space Ace, which were 3:2.
Note that even though these files are essentially blank, they 
are Huffman-compressed, meaning that the maximum compression
ratio you will get is 8:1, so they still end up ~5GB.

Moved error strings from chdman.c to chd.c, where they can be
fetched from any caller via the new chd_error_string()
function.

Updated vbiparse to improve Manchester code decoding. It now
assigns a confidence level per bit based on how solid the
data is. Also added a new function vbi_parse_all which parses
the white flag and all three lines of metadata from a 
laserdisc frame. It then compares line 17 and 18 against each
other and selects the most likely candidate based on per-bit
confidence and other factors.

Added frame number display to laserdsc.c. It is off by
default, though most players can be configured to turn it on
(not sure if any actually do). It can be manually toggled via
the backslash key during playback.
2008-08-05 16:30:35 +00:00
Aaron Giles
95e3753dd2 Added proper laserdisc support for MACH 3, Us vs. Them, and Cobra
Commander (MACH 3 hardware). Old laserdisc hacks are now removed.
The code now talks to the standard Pioneer PR-8210 interface. Also
removed hacky "target list" from the MACH 3 ROMs; this information
is now decoded on the fly from the right channel laserdisc audio.
 
Other Gottlieb cleanups:
 - moved sound inputs to audio/gottlieb and included them in
    all relevant drivers
 - ordered input ports and ROM definitions consistently
 
Other laserdisc changes:
 - changed PR-8210 interface to work consistently for both Gottlieb
    and Stern games
 - added audio callback mechanism to allow drivers to peek at the
    raw audio streams
 - extended the VBI parser to be even more lenient
2008-08-04 15:26:41 +00:00
Aaron Giles
776b251aa2 Removed per-frame metadata support from chdman. Creating an A/V
now simply requires an AVI file input.

Relaxed VBI Manchester code clocking to allow for a little bit
of wiggle when finding the clock.

Changed laserdisc support to parse white flags and other data
from the VBI data directly, rather than relying on the textual
metadata. Expanded video frame cache to 3. Changed the way
frames are assembled to decrease the likelihood of getting an
interlaced weave. Fixed sound creation so that it is done at
reset time instead of device start, when the sound devices aren't
yet live.

Fixed bug in winwork that caused the creation of single work 
items to return NULL, and thus lead to massive memory leaks when
using A/V CHDs.
2008-08-01 02:23:26 +00:00
Aaron Giles
57bd1856b5 Cleanups/version bump. 2008-07-31 09:00:13 +00:00
Aaron Giles
a69088c498 Added new options 'cheatpath' to specify one or more paths for cheat
files. Removed old option 'cheat_file'.

Updated xmlfile.c to specify the line number for each node, for more
accurate error reporting.

Removed old cheat.c/.h and replaced them with code that will read and
write the new XML-based cheat format using the new cheatpath option
(cheats still need to be enabled in order to load at all). Note that
the cheats are not implemented yet, but they are fully parsed. To test
saving, whenever a cheat file is successfully loaded, it is immediately
written back out as 'output.xml' to the cheat directory for validation.
2008-07-31 08:19:53 +00:00
Aaron Giles
0b77a69691 From: Atari Ace [mailto:atari_ace@verizon.net]
Subject: [patch] Conditional code cleanup resubmit

Hi mamedev,

This is a resubmit of a previous patch.  The earlier version would not
compile with 32-bit MSVC, due to the fact that its linker required
external dependencies in dead code to be met before dead code
elimination was done, causing linker errors.  The proper fix for this
would be to add the necessary dependencies, so I instead simply left
the conditional code in place in winalloc.c and chd.c.

~aa

Original submission email below:
----
Conditionally compiled code tends to bitrot, so MAME should try to
avoid it as much as possible.  I sent a patch six months ago to
eliminate conditional code associated with logging, here's another
patch that does more of this.  Some notes:

1.  drc_ops.c: I couldn't find a LOG_CODE anywhere, so I used if (0).
2.  romload.c: I converted all the users of debugload to use
LOG((...)) instead, following the traditional conditional logging
pattern.
3.  windows/sound.c: I eliminated the separate sound log and directed
the few outputs to the error log.

~aa
2008-07-24 06:26:47 +00:00
Aaron Giles
5244807bf3 Cleanups. 2008-07-17 08:09:52 +00:00
Aaron Giles
894fcaad28 Added logic to parse out the white flag. 2008-07-16 14:25:14 +00:00
Aaron Giles
26b6c2cf16 Fixed popmessage. 2008-07-14 15:00:58 +00:00
Aaron Giles
d8715ab4ac Note: I have done some testing, but there are probably more bugs
lurking. If you run into anything odd, please let me know.

Added new module uiinput.c which manages input for the user interface.
The OSD is responsible for pushing mouse events and character events
to this interface in order to support mouse movement and text-based
input (currently only used for the select game menu). Added support
for navigating through the menus using the mouse. 
[Nathan Woods, Aaron Giles]

Redesigned the UI menus so that they can maintain a richer state. Now
the menus can be generated once and reused, rather than requiring them
to be regenerated on each frame. All menus also share a comment eventing
system and navigation through them is managed centrally. Rewrote all the 
menus to use the new system, apart from the cheat menus, which are now 
disabled. Reorganized the video menu to make it easier to understand.
[Aaron Giles]
2008-07-12 20:18:25 +00:00
Aaron Giles
48cd251861 Removed unnecessary includes and added check against maximum source width. 2008-07-08 07:59:31 +00:00
Aaron Giles
d256dc7e88 Split out Philips code parsing into a separate utility module.
Rewrote Philips code parsing to be clock based.
Updated makemeta to call the new function.
2008-07-08 07:55:49 +00:00
Aaron Giles
db6a98ce9c Changed makemeta to parse a different format for metadata.
Fixed Huffyuv decompression in aviio.
2008-07-07 17:03:46 +00:00
Nathan Woods
6c95713095 Fixed assertion when compiled against MSVC and the string is UTF-8 2008-06-28 21:51:12 +00:00
Aaron Giles
c852c42952 Cleanups for 0.125u3. 2008-05-29 09:25:51 +00:00
Aaron Giles
65934e7aa5 Added new option -snapname which lets you provide a template for how snapshot
names are generated.

Added new astring functions astring_del, astring_replace, and astring_replacec
to help perform simple search/replace substitution.
2008-05-29 08:00:23 +00:00
Aaron Giles
21a686cf7d Cleanups and version bump. 2008-05-15 08:56:29 +00:00
Aaron Giles
86dd599aa8 Added uncompressed AVI recording. Extended aviio to be able
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.
2008-05-13 03:02:11 +00:00
Aaron Giles
737ff53930 From: Atari Ace [mailto:atari_ace@verizon.net]
Subject: [patch] Eliminate assignments in conditionals

Hi mamedev,

Assignments in conditionals are never really needed in C and are
occasionally just plain bugs (== gets typed as =).  As such, it would
be good to remove these from MAME so that compilers that warn on this
construct can flag the likely bugs (MSVC does this for example).  The
attached patch does just that.  In addition, it refactors some
repeated code which had this in taito_f3.c into a couple macros. Using
inline functions would unfortunately have required more significant
changes, perhaps I'll tackle that another day.

~aa
2008-04-24 05:59:39 +00:00
Aaron Giles
f57b3da9a3 From: Justin Kerk
Subject: xml_normalize_string() bogusly escapes UTF-8

Various parts of MAME have recently been changed to support UTF-8
strings, so I thought I'd test out using a UTF-8 driver name for the
Sam Coupe driver in MESS, just to see if anything breaks. Most things
do seem to work well - the name is correctly drawn in the UI etc. One
thing that doesn't work properly is the output from -listxml: "Sam
Coupe" becomes "Sam Coup&#195;&#169;" - each UTF-8 byte is
individually escaped, resulting in two gibberish characters instead of
the correct character.

The culprit here is xml_normalize_string() in src/lib/util/xmlfile.c -
the code converts any high-bit byte to an XML escape, which is totally
bogus for any encoding but ISO-8859-1 because XML escapes are defined
as Unicode codepoints regardless of the document encoding.

Fortunately, this is very simple to fix - in fact, it is sufficient
just to remove the escaping code and pass through the UTF-8 bytes
directly, because UTF-8 is mandated as the default encoding in the XML
standard.[1] The attached patch does this.

This should be a pretty safe change since as far as I can tell nothing
in MAME or MESS currently triggers this code (that is, the string "&#"
does not occur in the -listxml output of either). One potentially
negative effect is that the ASCII controls which are illegal in XML
(0x00-0x19 excepting line breaks and tabs) would no longer be escaped.
However, I can't imagine why you would want any in a string destined
for -listxml, so IMO that would be a problem elsewhere in the code and
having XML parsers barf on it would be desirable.

-Justin Kerk
2008-04-12 05:12:47 +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
509dc4c064 De-deprecat-ed ui.c.
Changed xmlfile.c to pass in memory handlers to expat so that
our memory overrides are properly managed.
2008-03-21 14:51:26 +00:00
Aaron Giles
e31f9a6313 Normalized function pointer typedefs: they are now all
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.
2008-03-03 01:51:31 +00:00
Couriersud
6ab989af82 Reverted change to options.c - not ready for release due to potential breakage of frontends. 2008-03-02 00:39:56 +00:00
Couriersud
7df031fb4f Rewrote some potentially compiler specific code:
* added ATTR_FORCE_INLINE to osdcomm.h
* added ATTR_NONNULL
* moved U64 S64 fram mamecore.h to osdcomm.h
* define SETJMP_GNUC_PROTECT() in osdcomm.h for use in ppc602, ppc603
2008-03-02 00:35:58 +00:00
Couriersud
492612b6c9 Various clean ups:
* remove more unreachable code
* identify more functions not being used
* Changed a number of global functions to being static
2008-03-01 16:54:52 +00:00
Couriersud
76847517a4 Identified code not used and marked with "#ifdef UNUSED_FUNCTION" 2008-03-01 01:34:43 +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
87265897e1 Fixes copy/paste error in comment 2008-02-16 23:51:58 +00:00
Aaron Giles
4c5cebc661 From: Atari Ace [mailto:atari_ace@verizon.net]
Subject: [patch] Fix some comments

Hi mamedev,

The following patch updates the initialization comments at the top of
mame.c and corrects/adds a few filename declarations at the top of a
handful of files.

~aa
2008-02-03 00:56:06 +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
5254f279d4 Need to actually set the pool fail callback when allocating a pool. 2008-01-19 20:38:14 +00:00
R. Belmont
6cbe41fbc1 Fixes hang/crash on empty config file. (patch by Wilbert Pol) 2008-01-10 04:23:41 +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
415aebd2bd Rewrote sbrkout driver based on schematics:
* XTAL-based timing
 * Correct video timing
 * Full memory map
 * Correct memory usage ("zero page" RAM is shared with videoram)
 * Removed all input hacks
 * Fixed interrupt generation
 * Connected coin counters
 * Added save state support

Also fixed incorrect dependency in cdrom.c.
2008-01-03 09:01:18 +00:00
Aaron Giles
422ccce762 (From Oliver Stoneberg)
This is an updated version of my earlier ATTR_PRINTF patch. It was 
reviewed by Atari Ace to use ATTR_PRINTF properly and fixes even more 
format errors. I also reviewed the whole source again and it is now 
used in all possible places.
2008-01-03 05:37:18 +00:00
Aaron Giles
460437f8d1 (From Atari Ace)
The attached patch adjusts most conditional logging in MAME to use the
idiom "do { if (VERBOSE) logerror x; } while (0)".   This has the
benefit that the compiler checks the syntax of the logging even in the
case it will be eliminated, and in fact a number of cases here needed
adjustments to compile because of this.
2007-12-31 02:04:39 +00:00
Aaron Giles
507ca2d275 Changes for MAME 0.121u4. 2007-12-17 16:41:39 +00:00
Aaron Giles
8a8ccc5949 Changes for MAME 0.121u1. 2007-12-17 16:33:33 +00:00
Aaron Giles
7b77f12186 Initial checkin of MAME 0.121. 2007-12-17 15:19:59 +00:00