summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util/chd.h
Commit message (Collapse)AuthorAgeFilesLines
* util/chd.cpp, util/chdcodec.cpp: Added a safer way to let codecs do special ↵ Vas Crabb2024-10-141-0/+1
| | | | stuff with hunks.
* util/chd.cpp: Made a few more member functions return error conditions. Vas Crabb2024-10-131-7/+5
| | | | Also mark error paths as unexpected to optimise against them.
* chd.cpp: More API changes AJR2024-10-111-8/+8
| | | | | | | | | - Have metadata_find return std::error_condition instead of throwing an exception - Replace the is_XXX predicates with check_is_XXX methods that return a std::error_condition, enabling improved error reporting for cdrom_image_device - Retain read error information in chd_file_compressor - Make a bunch of methods noexcept This mostly restores the changes from cc772072fa635146b1df39a5694d2a8f8aa5a34f.
* util/chd.cpp, util/chdcodec.cpp: Made some APIs return errors rather than ↵ Vas Crabb2024-10-111-8/+8
| | | | | | throwing exceptions. [AJR] Mostly salvaged from 901a68e2e0bb0d9178ffdb59e128718c1495250f.
* tools/chdman.cpp: Fixed numerous issues, including: Vas Crabb2024-02-101-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | Support input start/size options for createdvd. Fixed not reporting an error on unrecognised command line options. Fixed --fix/-f option for verify command not working. Report an error when conflicting options are supplied (e.g. hard disk template and C/H/S geometry, or input start offset in both bytes and hunks). Previously the results would be unpredictable. Detect more invalid combinations of options, and detect when output unit size or hunk size doesn't match parent. Changed order of processing options for createhd so using a template cannot not inadvertently result in an invalid combination of sector size and hunk size. Don't require an explicit unit size for createraw if an output parent CHD file is supplied. Fixed an object leak in createcd.
* Revert "chd.cpp, chdcodec.cpp: Minor refactoring" Vas Crabb2023-10-271-8/+8
| | | | This reverts commit 901a68e2e0bb0d9178ffdb59e128718c1495250f.
* Revert "chd.cpp: Refactoring, part 2" Vas Crabb2023-10-271-6/+6
| | | | This reverts commit cc772072fa635146b1df39a5694d2a8f8aa5a34f.
* chd.cpp: Refactoring, part 2 AJR2023-10-231-6/+6
| | | | | | | - Change is_XXX to return std::error_condition instead of bool so that errors can be passed down the line; rename these to check_is_XXX to indicate that they are no longer basic predicates - Change return type of internal function metadata_find to std::error_condition so that errors can be returned rather than thrown * imagedev/cdromimg.cpp: Fix bug where cdrom_file object could be constructed twice in a row for CD-ROMs and once for DVDs
* chd.cpp, chdcodec.cpp: Minor refactoring AJR2023-10-221-8/+8
| | | | | | | | | - Return std::error_condition from set_raw_sha1 and set_parent_sha1 instead of throwing exceptions - Fix a few cases where error codes could be swallowed - Catch exceptions in is_XXX predicates - Add const qualifier to SHA-1 extraction methods - Add noexcept qualifier to a few internal functions - Clean up various comments
* Allow clone CHDs to use parent CHDs as parents. Vas Crabb2023-10-201-13/+18
| | | | | | | | | | | * util/chd.cpp: Allow caller to provide a helper for finding parent CHDs and expose (recursive) missing parent status. * emu/romload.cpp: Search parent systems/devices/software for parent CHDs on encountering a delta CHD. * emu/romload.cpp: Report error on delta CHDs when parent can't be found. * emu/romload.cpp: Check parents for matching CHDs with different names for devices as well as systems and software.
* chd.cpp, chdcodec.cpp, flac.cpp: Use multibyte.h functions AJR2023-09-171-2/+0
| | | | * multibyte.h: Add functions for reading and writing 48-bit values
* chd: Add dvd support. better abstraction in general, multi-image support in ↵ Olivier Galibert2023-05-041-4/+14
| | | | arcade-type drivers
* formats, osd, util: Started refactoring file I/O stuff. (#8456) Vas Crabb2021-08-221-138/+136
| | | | | | | | | Added more modern generic I/O interfaces with implementation backed by stdio, osd_file and core_file, replacing io_generic. Also replaced core_file's build-in zlib compression with a filter. unzip.cpp, un7z.cpp: Added option to supply abstract I/O interface rather than filename. Converted osd_file, core_file, archive_file, chd_file and device_image_interface to use std::error_condition rather than their own error enums. Allow mounting TI-99 RPK from inside archives.
* Low-level #include overhaul AJR2021-01-021-3/+0
| | | | | | | - vecstream.h: Revert changes made in aa29519528cb3dbdbfac56819bea670ed8c56c5d. The std::string_view conversion has been made a non-member function (util::buf_to_string_view) and moved to coretmpl.h. - strformat.h: Remove the using declaration importing util::string_format into the global namespace. It has been moved to emucore.h and a few tool sources; other references have been qualified. - osdcore.h: Split out file, directory and path classes and methods to a new header (osdfile.h), Doxygenizing the documentation comments. - Disaggregate many #includes that were including other standard or custom headers. emu.h now includes basically the same things that it did, but other headers have been streamlined; for instance, emucore.h no longer stealth-includes osdcore.h several ways.
* Better support for screen orientation/geometry: Vas Crabb2018-07-261-5/+4
| | | | | | | | | | | | | | | | | | | | | * Eliminates the need for the horizontal/vertical/LCD/SVG layout files * Screens can now have orientation and physical aspect ratio specified * RASTER/VECTOR defaults to 4:3, LCD/SVG defaults to square pixels at config time * System orientation is applied on top of screen orientation Automatically generated single-screen views and orientation flags in XML output now work correctly for systems with multiple screens in different geometries/orientations, e.g. housemnq, rocnms, stepstag, or netmerc. The "core rotation options" only interact with system orientation. Allowing multi-screen systems to work well with one monitor per emulated screen is a complex topic. System orientation also affects the GFX viewer while screen orientation doesn't. The orientation displayed in the system selection menu is from the system orientation. Let me know if I've broken any systems or use cases. Also, add save state support for std::array/C array nested to any depth.
* NOTICE (TYPE NAME CONSOLIDATION) Miodrag Milanovic2016-10-221-161/+161
| | | | | Use standard uint64_t, uint32_t, uint16_t or uint8_t instead of UINT64, UINT32, UINT16 or UINT8 also use standard int64_t, int32_t, int16_t or int8_t instead of INT64, INT32, INT16 or INT8
* dynamic_buffer is just std::vector<UINT8> (nw) Miodrag Milanovic2016-10-211-8/+8
|
* Moved src/emu/hash.[cpp|h] into src/lib/util, and namespaced that code (and ↵ Nathan Woods2016-07-231-18/+18
| | | | hashing.[cpp|h]) into util::
* Various cleanups suggested by static analyzer (nw) Miodrag Milanovic2016-04-241-1/+1
|
* chd: initialized m_hunknum inside the constructor. (nw) dankan18902016-04-151-0/+1
|
* Turn core_file into a proper class that gets cleaned up safely using unique_ptr Vas Crabb2016-03-061-5/+5
| | | | Subverted somewhat by chd_file class
* use std::atomic in chd.cpp/h (nw) Miodrag Milanovic2016-03-011-2/+2
|
* clang-modernize part 1 (nw) Miodrag Milanovic2015-12-031-8/+8
|
* moved all to std::string (nw) Miodrag Milanovic2015-04-221-3/+4
|
* Replace dynamic_array with std::vector [O. Galibert] Olivier Galibert2015-04-141-2/+2
|
* cstr() - > c_str() as preparation for move to std::string (nw) Miodrag Milanovic2015-04-111-1/+1
|
* more ThreadSanitizer data race warning "fixes" (nw) Oliver Stöneberg2014-12-311-1/+3
|
* chd updates: [MetalliC] R. Belmont2014-04-181-1/+2
| | | | | | | | | - Bugfixed byte order for GD-ROM audio tracks so FLAC compression is effective - Fixed uninitialized struct on MSVC (and possibly other) builds nw: this will change the SHA1s of every GD-ROM CHD in MAME; a patch to reflect that is pending (the old images still work, they just take a little more space than is necessary). "chdman copy" suffices to upgrade; no downloading is necessary.
* Cleanups and version bumpmame0153 Miodrag Milanovic2014-04-071-1/+1
|
* fixed ubsan invalid vptr error with dynamic_array<hash_pair> in struct ↵ Oliver Stöneberg2014-02-261-0/+11
| | | | work_item (nw)
* Bulk convert files that already had standard BSD license in my name Aaron Giles2013-10-161-31/+2
| | | | to new license tagged form.
* Cleanups and version bumpmame0148 Miodrag Milanovic2013-01-111-66/+66
|
* When copying CHDs, preserve the flag that indicates whether the metadata Aaron Giles2012-03-061-2/+2
| | | | | | | | | is included in the SHA1. When creating LD CHDs, don't use a checksum on the AVLD metadata, like we did before. Fixes recompression of laserdisc CHDs. Fix copy/paste error in the chd.h header which caused the flags passed to be ignored when writing metadata.
* chdman: Correct processing of GDI files, add ability to extractcd to .gdi, ↵ R. Belmont2012-03-041-0/+2
| | | | verified perfect checksum round-tripping on .GDI files. [R. Belmont]
* Clean-ups and version bumpmame0145u1 Angelo Salese2012-02-191-74/+74
|
* Major CHD/chdman update. The CHD version number has been increased Aaron Giles2012-02-161-226/+430
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Missing files from the last checkin (nw) R. Belmont2012-01-221-5/+6
|
* Cleanups and version bump. Aaron Giles2010-06-171-1/+1
|
* chdman/cdrom updates: [R. Belmont] R. Belmont2010-05-301-1/+3
| | | | | | | | | | | - CDRWIN .bin/.cue images now supported for both input and output - Pregap and postgap information is now preserved in the format - Output of CDRDAO images is significantly improved Existing CHD-CDs will continue to work fine and for data-only discs no action needs to be taken. For mixed data/audio discs (e.g. analog 573/Bemani games) they should be re-converted for better preservation.
* Cleanups and version bump.mame0134u3 Aaron Giles2009-10-121-13/+13
|
* Assert copyright ownership of core library files, and relicense Aaron Giles2009-10-091-2/+30
| | | | under standard BSD license.
* Fix chdman -update to leave the write protect state alone when updating Aaron Giles2009-08-021-1/+1
| | | | uncompressed CHDs. [Michael Zapf]
* V4 header format is no longer proposed. Aaron Giles2009-03-201-1/+1
|
* Moved chd_clone_metadata code into chdman.c so that it can intelligently Aaron Giles2009-03-101-0/+9
| | | | | | | | | | | | | | | 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.
* Redid metadata hashing. A digest of tags and hashes for each Aaron Giles2009-03-101-4/+2
| | | | | | | 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.
* NOTE: With the change, all existing CHD diff files are invalid. Aaron Giles2009-03-091-7/+21
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Added flags to the metadata entries, encoded in the top bit. Right now Aaron Giles2009-03-051-2/+22
| | | | | it is a no-op, but eventually will be used to indicate which bits of metadata are included in the overall checksum.
* Changed requirements for laserdisc CHDs to require a new chunk of Aaron Giles2008-09-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Rejiggered huffman.c to support multiple interleaving Aaron Giles2008-08-121-31/+21
| | | | | | | | | | | | | 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.
* Removed obsolete makemeta tool. Replaced it with new ldverify Aaron Giles2008-08-051-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.