Commit Graph

87 Commits

Author SHA1 Message Date
Aaron Giles
4ea9df02a1 Moved core template container classes up from emutempl.h to coretmpl.h:
[Aaron Giles]
 * these classes now no longer take a resource_pool; everything is
    managed globally -- this means that objects added to lists must be
    allocated with global_alloc
 * added new auto_pointer<> template which wraps a pointer and auto-frees
    it upon destruction; it also defaults to NULL so it doesn't need to
    be explicitly initialized
 * moved tagged_list template to tagmap.h

Redo of the low-level memory tracking system: [Aaron Giles]
 * moved low-level tracking out of emu\emualloc into lib\util\corealloc
    so it can be shared among all components and used by core libraries
 * global_alloc and friends no longer use a resource pool to track
    allocations; turns out this was a wholly redundant system that wasted
    a lot of memory
 * removed global_resource_pool entirely
 * added global_free_array to delete arrays allocated with 
    global_alloc_array
 * added tracking of object versus array allocation; we will now error
    if you use global_free on an array, or global_free_array on an object

Added new utility helper const_string_pool which can be used to 
efficiently accumulate strings that are not intended to be modified.
Used by updated makelist and software list code. [Aaron Giles]

Updated png2bdc and makelist tools to not leak memory and use more modern
techniques (no more MAX_DRIVERS in makelist, for example). [Aaron Giles]

Deprecated auto_strdup and removed all uses by way of caller-managed 
astrings and the software list rewrite. [Aaron Giles]

Rewrote software list management: [Aaron Giles]
 * removed the notion of a software_list that is separate from a
    software_list_device; they are one and the same now
 * moved several functions into device_image_interface since they really
    didn't belong in the core software list class
 * lots of simplification as a result of the above changes

Additional notes (no whatsnew):

Moved definition of FPTR to osdcomm.h.

Some changes happened in the OSD code to fix issues, especially regarding
freeing arrays. SDL folks may need to fix up some of these.

The following devices still are using tokens and should be modernized
(I found them because they kept their token as void * and tried to
delete it, which you can't):

namco_52xx_device (mame/audio/namco52.c)
namco_54xx_device (mame/audio/namco54.c)
namco_06xx_device (mame/machine/namco06.c)
namco_50xx_device (mame/machine/namco50.c)
namco_51xx_device (mame/machine/namco51.c)
namco_53xx_device (mame/machine/namco53.c)
voodoo_device (emu/video/voodoo.c)
mos6581_device (emu/sound/mos6581.c)
aica_device (emu/sound/aica.c)
scsp_device (emu/sound/scsp.c)
dmadac_sound_device (emu/sound/dmadac.c)
s3c2440_device (emu/machine/s3c2440.c)
wd1770_device (emu/machine/wd17xx.c)
latch8_device (emu/machine/latch8.c)
duart68681_device (emu/machine/68681.c)
s3c2400_device (emu/machine/s3c2400.c)
s3c2410_device (emu/machine/s3c2410.c)
strataflash_device (mess/machine/strata.c)
hd63450_device (mess/machine/hd63450.c)
tap_990_device (mess/machine/ti99/990_tap.c)
omti8621_device (mess/machine/omti8621.c)
vdt911_device (mess/video/911_vdt.c)
apollo_graphics_15i (mess/video/apollo.c)
asr733_device (mess/video/733_asr.c)
2014-03-11 15:54:58 +00:00
Oliver Stöneberg
aa785afb99 first round of printf fixes (nw) 2014-02-25 11:55:35 +00:00
Aaron Giles
5d0ce54f9e Bulk convert files that already had standard BSD license in my name
to new license tagged form.
2013-10-16 08:14:49 +00:00
Wilbert Pol
b06a8e7c22 audit.c: Fixed software list chd verification. [qmc2] 2013-05-22 18:18:23 +00:00
Wilbert Pol
242445cfe2 Added the parent software to the searchpath when verifying software list entries. (nw) 2013-04-04 17:39:16 +00:00
Miodrag Milanovic
0e19f641d3 Cleanups and version bump 2013-01-11 07:32:46 +00:00
Wilbert Pol
93b5eb783a Added -verifysoftware command. [Wilbert Pol] 2012-09-20 19:34:30 +00:00
smf-
9120af1c1b audit considers a NO DUMP rom to be shared if it has the same name as a parent/device rom. 2012-08-17 13:44:49 +00:00
smf-
ae55397d52 merged changes from mess 2012-02-24 14:22:36 +00:00
smf-
6cac5ee3ab verifyroms looks in parent sets again. The bug caused clone sets to be listed as bad when you didn't have them as it thought every rom was shared with the parent. 2012-02-22 21:35:30 +00:00
Aaron Giles
1db879e232 Removed rom_source abstraction, which was just mapping to devices
anyways. Updated everyone involved to just iterate over devices
directly.
2012-02-20 06:06:58 +00:00
Aaron Giles
24400ec223 Rewrote SAMPLES as a modern device. Updated all callers. FLAC
reading is now done using the FLAC wrapper. There is now a
samples_iterator class to centralize the logic for handling
the sample list walking.

Also redid the cheesy half-baked votrax device since it relied 
on some old samples-based handling. Until we have a real 
implementation, it would be good to route the various clients 
through the current one to at least wire it up properly, even 
if it just plays samples in the end. Will look into that 
shortly.
2012-02-19 01:53:16 +00:00
Aaron Giles
e055a551c1 Remove redundant hashing code, use hashing.h instead.
Remove overabstraction in hash.h; it's ok to hard code the
two types of hashes we have. Even adding another one would
not be very difficult. ;)
2012-02-16 21:53:30 +00:00
Aaron Giles
f0823886a6 Major CHD/chdman update. The CHD version number has been increased
from 4 to 5. This means any diff CHDs will no longer work. If you
absolutely need to keep the data for any existing ones you have,
find both the diff CHD and the original CHD for the game in question 
and upgrade using these commands:

  rename diff\game.dif diff\game-old.dif
  chdman copy -i diff\game-old.dif -ip roms\game.chd -o diff\game.dif -op roms\game.chd -c none

Specifics regarding this change:

Defined a new CHD version 5. New features/behaviors of this version:
  - support for up to 4 codecs; each block can use 1 of the 4
  - new LZMA codec, which tends to do better than zlib overall
  - new FLAC codec, primarily used for CDs (but can be applied anywhere)
  - upgraded AVHuff codec now uses FLAC for encoding audio
  - new Huffman codec, used to catch more nearly-uncompressable blocks
  - compressed CHDs now use a compressed map for significant savings
  - CHDs now are aware of a "unit" size; each hunk holds 1 or more units
     (in general units map to sectors for hard disks/CDs)
  - diff'ing against a parent now diffs at the unit level, greatly
     improving compression

Rewrote and modernized chd.c. CHD versions prior to 3 are unsupported,
and version 3/4 CHDs are only supported for reading. Creating a new
CHD now leaves the file open.  Added methods to read and write at the 
unit and byte level, removing the need to handle this manually. Added
metadata access methods that pass astrings and dynamic_buffers to
simplify the interfaces. A companion class chd_compressor now
implements full multithreaded compression, analyzing and compressing
multiple hunks independently in parallel. Split the codec 
implementations out into a separate file chdcodec.*

Updated harddisk.c and cdrom.c to rely on the caching/byte-level read/
write capabilities of the chd_file class. cdrom.c (and chdman) now also 
pad CDs to 4-frame boundaries instead of hunk boundaries, ensuring that
the same SHA1 hashes are produced regardless of the hunk size.

Rewrote chdman.exe entirely, switching from positional parameters to
proper options. Use "chdman help" to get a list of commands, and
"chdman help <command>" to get help for any particular command. Many 
redundant commands were removed now that additional flexibility is
available. Some basic mappings:

  Old: chdman -createblankhd <out.chd> <cyls> <heads> <secs>
  New: chdman createhd -o <out.chd> -chs <cyls>,<heads>,<secs>

  Old: chdman -createuncomphd <in.raw> <out.chd> ....
  New: chdman createhd -i <in.raw> -o <out.chd> -c none ....

  Old: chdman -verifyfix <in.chd>
  New: chdman verify -i <in.chd> -f

  Old: chdman -merge <parent.chd> <diff.chd> <out.chd>
  New: chdman copy -i <diff.chd> -ip <parent.chd> -o <out.chd>

  Old: chdman -diff <parent.chd> <compare.chd> <diff.chd>
  New: chdman copy -i <compare.chd> -o <diff.chd> -op <parent.chd>

  Old: chdman -update <in.chd> <out.chd>
  New: chdman copy -i <in.chd> -o <out.chd>

Added new core file coretmpl.h to hold core template classes. For now
just one class, dynamic_array<> is defined, which acts like an array
of a given object but which can be appended to and/or resized. Also
defines dynamic_buffer as dynamic_array<UINT8> for holding an 
arbitrary buffer of bytes. Expect to see these used a lot.

Added new core helper hashing.c/.h which defines classes for each of
the common hashing methods and creator classes to wrap the 
computation of these hashes. A future work item is to reimplement
the core emulator hashing code using these.

Split bit buffer helpers out into C++ classes and into their own
public header in bitstream.h.

Updated huffman.c/.h to C++, and changed the interface to make it
more flexible to use in nonstandard ways. Also added huffman compression
of the static tree for slightly better compression rates.

Created flac.c/.h as simplified C++ wrappers around the FLAC interface.
A future work item is to convert the samples sound device to a modern
device and leverage this for reading FLAC files.

Renamed avcomp.* to avhuff.*, updated to C++, and added support for
FLAC as the audio encoding mechanism. The old huffman audio is still
supported for decode only.

Added a variant of core_fload that loads to a dynamic_buffer.

Tweaked winwork.c a bit to not limit the maximum number of processors
unless the work queue was created with the WORK_QUEUE_FLAG_HIGH_FREQ
option. Further adjustments here are likely going to be necessary.

Fixed bug in aviio.c which caused errors when reading some AVI files.
2012-02-16 09:47:18 +00:00
Scott Stone
a4098e8a3a Some cleanup of some observed #include redundancy from source files which use emu.h (nw) 2012-02-06 01:30:22 +00:00
Michaël Banaan Ananas
f32a8799b4 fix -verifysamples from haze 2012-02-04 20:30:08 +00:00
Angelo Salese
505442d0a0 Clean-ups and version bump 2012-01-29 16:34:26 +00:00
Aaron Giles
ed0207f126 Move devices into a proper hierarchy and handle naming
and paths consistently for devices, I/O ports, memory
regions, memory banks, and memory shares. [Aaron Giles]

NOTE: there are likely regressions lurking here, mostly
due to devices not being properly found. I have temporarily
added more logging to -verbose to help understand what's
going on. Please let me know ASAP if anything that is being
actively worked on got broken.

As before, the driver device is the root device and all 
other devices are owned by it. Previously all devices
were kept in a single master list, and the hierarchy was
purely logical. With this change, each device owns its
own list of subdevices, and the hierarchy is explicitly
manifest. This means when a device is removed, all of its
subdevices are automatically removed as well.

A side effect of this is that walking the device list is
no longer simple. To address this, a new set of iterator
classes is provided, which walks the device tree in a depth
first manner. There is a general device_iterator class for
walking all devices, plus templates for a device_type_iterator
and a device_interface_iterator which are used to build
iterators for identifying only devices of a given type or
with a given interface. Typedefs for commonly-used cases
(e.g., screen_device_iterator, memory_interface_iterator)
are provided. Iterators can also provide counts, and can
perform indexed lookups.

All device name lookups are now done relative to another 
device. The maching_config and running_machine classes now
have a root_device() method to get the root of the hierarchy. 
The  existing machine->device("name") is now equivalent to
machine->root_device().subdevice("name").

A proper and normalized device path structure is now
supported. Device names that start with a colon are
treated as absolute paths from the root device. Device
names can also use a caret (^) to refer to the owning
device. Querying the device's tag() returns the device's
full path from the root. A new method basetag() returns
just the final tag.

The new pathing system is built on top of the 
device_t::subtag() method, so anyone using that will 
automatically support the new pathing rules. Each device
has its own internal map to cache successful lookups so
that subsequent lookups should be very fast.

Updated every place I could find that referenced devices,
memory regions, I/O ports, memory banks and memory shares
to leverage subtag/subdevice (or siblingtag/siblingdevice
which are built on top).

Removed the device_list class, as it doesn't apply any
more. Moved some of its methods into running_machine
instead.

Simplified the device callback system since the new 
pathing can describe all of the special-case devices that
were previously handled manually.

Changed the core output function callbacks to be delegates.

Completely rewrote the validity checking mechanism. The
validity checker is now a proper C++ class, and temporarily
takes over the error and warning outputs. All errors and 
warnings are collected during a session, and then output in
a consistent manner, with an explicit driver and source file
listed for each one, as well as additional device and/or
I/O port contexts where appropriate. Validity checkers 
should no longer explicitly output this information, just
the error, assuming that the context is provided.

Rewrote the software_list_device as a modern device, getting
rid of the software_list_config abstraction and simplifying
things.

Changed the way FLAC compiles so that it works like other
external libraries, and also compiles successfully for MSVC
builds.
2012-01-24 20:18:55 +00:00
smf-
770e971650 simplify NONE_NEEDED check, if is only triggered now if it finds no roms and there are no errors. whether any roms are required or not is irrelevant. 2011-09-01 13:53:57 +00:00
smf-
d8b3ab7cf3 only report that no files are needed if there are no optional roms as well as no required roms. 2011-09-01 10:26:46 +00:00
smf-
c26a00ac0c stopped parent roms with a different crc but the same name from being found as bad. 2011-08-31 19:25:06 +00:00
smf-
846463227f doesn't report samples as bad when they aren't found, which makes them consistent with verifyroms. 2011-08-30 10:02:21 +00:00
Fabio Priuli
5594b84961 made handling of NONE_NEEDED audits a bit more coherent. no whatsnew. 2011-08-30 09:57:33 +00:00
Fabio Priuli
69374d9553 fixed segfault when using -verifysamples [Fabio Priuli]
the offending bit was the call of record->shared_source() without having explicitly set m_shared_source to NULL. 
it might be worth to initialize m_shared_source to NULL, but I was not 100% sure about effects on other rom verification routines, so for the moment I simply set it to NULL when verifying samples
2011-08-30 08:21:23 +00:00
Fabio Priuli
610a2d921d only report samples audit result for sets with required samples [Fabio Priuli]
out of whatsnew: this does not fix the the segfault when -verifysamples is used, but I hope to fix it soon (unless anyone beats me to it... be my guest if you want to fix it)
2011-08-30 07:10:30 +00:00
Angelo Salese
2811f1f8f7 Cleanups and version bump 2011-08-25 17:58:46 +00:00
smf-
5a0d918e8f lists the rom source short name for shared roms & individual devices are only verified if they match the "game name". also doesn't display the "approximately matches" just because roms aren't found. 2011-08-20 20:33:18 +00:00
smf-
34974e7c20 made device rom verify consistent with game rom verify & verifies devices when verifying the games as well. this fixes some of the problems with the original patch, others remain & I'm still not sure that it shouldn't just be reverted. 2011-08-20 08:09:00 +00:00
Miodrag Milanovic
ad281de086 audit - Make check have more sense when not found (no whatsnew) 2011-08-18 12:30:21 +00:00
Miodrag Milanovic
1267e03d4e small cleanup (no whatsnew) 2011-08-18 10:41:33 +00:00
Miodrag Milanovic
966af43cc3 Fixed verifyroms so it display romsets for devices too as separate. (no whatsnew) 2011-08-18 10:37:31 +00:00
Miodrag Milanovic
3bdfb55b35 - Updated romload so devices are loaded from separate files [Miodrag Milanovic]
- Removed LOADBYNAME, since it is deprecated by using per device rom load_software_part_region

- Created makedev tool to generate array of devices, and created lst file according to current devices usage.

- Changed listxml command to output device roms too
2011-08-02 15:09:21 +00:00
Miodrag Milanovic
8449a9cbdc - Removing MD5 support in ROMLOAD_* [Oliver Stoneberg]
- Various core and tools memory leaks fixes [Oliver Stoneberg]
2011-07-31 15:46:18 +00:00
smf-
e5ebc225d9 optimized by only comparing the hashes if the length matches. 2011-07-25 16:38:19 +00:00
smf-
6c40e19da9 If a rom is bad for a clone but is good for the parent then it doesn't count towards the clone being found. optimized also_used_by_parent & uses the length as well as hashes. [smf] 2011-07-24 10:53:30 +00:00
smf-
abafc6f38c optional roms aren't treated as required when auditing & simplified the set detection. 2011-07-13 12:12:22 +00:00
smf-
4c5843d213 treat device roms the same as parent roms when auditing. 2011-07-12 12:55:38 +00:00
smf-
13d27fe17a if a driver has no required roms then you have it. 2011-07-12 12:00:38 +00:00
smf-
767bd23c70 fixed access violation when running -verifyroms * in the visual studio debugger. 2011-05-28 09:01:15 +00:00
Aaron Giles
919913f118 Collapsed device_config and device_t into one class. Updated all
existing modern devices and the legacy wrappers to work in this
environment. This in general greatly simplifies writing a modern
device. [Aaron Giles]

General notes:
 * some more cleanup probably needs to happen behind this change,
   but I needed to get it in before the next device modernization 
   or import from MESS  :)

 * new template function device_creator which automatically defines
   the static function that creates the device; use this instead of
   creating a static_alloc_device_config function

 * added device_stop() method which is called at around the time
   the previous device_t's destructor was called; if you auto_free
   anything, do it here because the machine is gone when the 
   destructor is called

 * changed the static_set_* calls to pass a device_t & instead of
   a device_config *

 * for many devices, the static config structure member names over-
   lapped the device's names for devcb_* functions; in these cases
   the members in the interface were renamed to have a _cb suffix

 * changed the driver_enumerator to only cache 100 machine_configs
   because caching them all took a ton of memory; fortunately this
   implementation detail is completely hidden behind the 
   driver_enumerator interface

 * got rid of the macros for creating derived classes; doing it
   manually is now clean enough that it isn't worth hiding the
   details in a macro
2011-04-27 05:11:18 +00:00
Aaron Giles
3628e7eaed Clean up code, adapt to existing coding style. 2011-04-19 04:26:02 +00:00
smf-
70afb316ed Expanded hack to make auditing work the same as rom loading. If the laser disc devices returned the correct searchpath then this wouldn't be required, but they all return "unkldplay". the rom loading doesn't use the searchpath yet, but when it does the laserdisc devices will need fixing. 2011-04-18 16:32:12 +00:00
smf-
0ed53639ba if a clone shares all it's roms with a parent then it assumes the clone is there if the parent is. 2011-04-18 15:22:02 +00:00
Angelo Salese
486fbfa555 Cleanups again 2011-04-18 00:06:50 +00:00
Aaron Giles
18c8bcb17f Add temporary hack to put driver search path back for device roms. 2011-04-17 19:40:52 +00:00
smf-
f430376ca8 fixed chd auditing 2011-04-17 12:47:52 +00:00
Aaron Giles
00d745ca77 (Big tangle of changes that all happened as I was looking into the ROM
loader rewrite, which is still in progress....)

Replaced mamedriv.c with a new driver list mechanism that is generated
by the build tools. The emulator core now expects the presence of a
file called src/$(TARGET)/$(SUBTARGET).lst which is just a raw list of
driver names, one per line. C and C++ comments are still permitted.
This file is parsed by a new build tool makelist which extracts the
driver names, sorts them, and generates a file called drivlist.c, which
is consumed by the core. [Aaron Giles]

Added new osdcore function osd_malloc_array() which is identical to
osd_malloc() but obviously hints that the underlying allocation is for
an array. Updated all callers to use the appropriate form. Modified the
Windows allocator to only use guard pages for array-style allocations,
allowing us to enable them once again in debug builds. [Aaron Giles]

Created new static class driver_list to wrap accesses to the list of
available drivers. Improved speed of driver lookups by relying on the
presorting done by makelist. [Aaron Giles]

Created helper class driver_enumerator as a helper for iterating through 
the list of drivers. This class supports basic filtering and iteration,
and also serves as a temporary cache of machine_configs. [Aaron Giles]

Created cli_frontend object to wrap all the CLI handling code in
clifront.c. Updated/simplified all the code to take advantage of the
driver_enumerator. [Aaron Giles]

Created media_auditor object to wrap all the auditing functions in
audit.c. Updated all users to the new interface. Note that the new
auditing mechanism is slightly out of sync with the romload code in
terms of finding ROMs owned by devices, so it may mis-report some
issues until the new ROM loading code is in. [Aaron Giles]

Added concept of a per-device searchpath. For most devices, their 
searchpath is just the short name of the device. For driver_devices, the
searchpath is driver[;parent[;bios]]. This searchpath will eventually be
used by the rom loader to find ROMs. For now it is used by the media
auditor only. [Aaron Giles]

Created info_xml_creator object to wrap all the info generation functions
in info.c. Converted the file to C++ and cleaned up the input processing
code. [Aaron Giles]

(not for whatsnew ... Known issues: auditing of CHDs appears busted, and 
debug builds report unfreed memory if you use the built-in game picker)
2011-04-13 20:31:00 +00:00
Aaron Giles
04c9a546b5 Attached emu_options to the machine_config, and the running_machine
inherits it now.
2011-03-10 10:17:30 +00:00
Aaron Giles
af6c7a9dac MT04267: Fix -verifyroms to not consider NO_DUMP ROMs as matches to the parent. 2011-03-03 17:39:43 +00:00
Aaron Giles
06ee6804dd Converted core_options to a class. Removed a bunch of marginal
functionality in favor of alternate mechanisms. Errors are
now reported via an astring rather than via callbacks. Every
option must now specify a type (command, integer, float, string,
boolean, etc). Command behavior has changed so that only one
command is permitted. [Aaron Giles]

Changed fileio system to accept just a raw searchpath instead of
an options/option name combination. [Aaron Giles]

Created emu_options class dervied from core_options which wraps
core emulator options. Added mechanisms to cleanly change the
system name and add/remove system-specific options, versus the
old way using callbacks. Also added read accessors for all the
options, to ensure consistency in how parameters are handled.
Changed most core systems to access emu_options instead of
core_options. Also changed machine->options() to return emu_options.
[Aaron Giles]
 
Created cli_options class derived from emu_options which adds the
command-line specific options. Updated clifront code to leverage
the new class and the new core behaviors. cli_execute() now accepts
a cli_options object when called. [Aaron Giles]

Updated both SDL and Windows to have their own options classes,
derived from cli_options, which add the OSD-specific options on
top of everything else. Added accessors for all the options so
that queries are strongly typed and simplified. [Aaron Giles]

Out of whatsnew: I've surely screwed up some stuff, though I have
smoke tested a bunch of things. Let me know if you hit anything odd.
Also I know this change will impact the WINUI stuff, please let me 
know if there are issues. All the functionality necessary should 
still be present. If it's not obvious, please talk to me before 
adding stuff to the core_options class.
2011-03-03 17:05:24 +00:00