diff options
author | 2015-06-07 17:37:34 +0200 | |
---|---|---|
committer | 2015-06-07 17:37:34 +0200 | |
commit | b6ce8ee991c7e14ca214a2931bfbc4e4a5a0dc0f (patch) | |
tree | da1e239053b7bfd9e841a103bbb36aefb71c4e7f | |
parent | b6a4cf45ca6fdf842b319806d61d638cf2d8b2d2 (diff) |
Licenses for Raphael Nabet (nw)
121 files changed, 3757 insertions, 621 deletions
diff --git a/src/emu/cpu/apexc/apexc.c b/src/emu/cpu/apexc/apexc.c index 7a982e01f53..77e5c919f44 100644 --- a/src/emu/cpu/apexc/apexc.c +++ b/src/emu/cpu/apexc/apexc.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet /* cpu/apexc/apexc.c: APE(X)C CPU emulation diff --git a/src/emu/cpu/apexc/apexc.h b/src/emu/cpu/apexc/apexc.h index 98ebc825f35..538d903ab44 100644 --- a/src/emu/cpu/apexc/apexc.h +++ b/src/emu/cpu/apexc/apexc.h @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet /* register names for apexc_get_reg & apexc_set_reg */ #pragma once diff --git a/src/emu/cpu/apexc/apexcdsm.c b/src/emu/cpu/apexc/apexcdsm.c index c79359c7025..81effc58b0e 100644 --- a/src/emu/cpu/apexc/apexcdsm.c +++ b/src/emu/cpu/apexc/apexcdsm.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet /* cpu/apexc/apexcsm.c : APE(X)C CPU disassembler diff --git a/src/emu/cpu/pdp1/pdp1.c b/src/emu/cpu/pdp1/pdp1.c index 3c414bd5ed6..bb7beee4128 100644 --- a/src/emu/cpu/pdp1/pdp1.c +++ b/src/emu/cpu/pdp1/pdp1.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet /* * Note: Original Java source written by: diff --git a/src/emu/cpu/pdp1/pdp1.h b/src/emu/cpu/pdp1/pdp1.h index c4c9c8c465e..f4d1281aa07 100644 --- a/src/emu/cpu/pdp1/pdp1.h +++ b/src/emu/cpu/pdp1/pdp1.h @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet #pragma once diff --git a/src/emu/cpu/pdp1/pdp1dasm.c b/src/emu/cpu/pdp1/pdp1dasm.c index 036aa3e2f22..c8682ca1491 100644 --- a/src/emu/cpu/pdp1/pdp1dasm.c +++ b/src/emu/cpu/pdp1/pdp1dasm.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet #include "emu.h" #include "cpu/pdp1/pdp1.h" diff --git a/src/emu/cpu/pdp1/tx0.c b/src/emu/cpu/pdp1/tx0.c index 1a3ab230f4b..03c8441d88f 100644 --- a/src/emu/cpu/pdp1/tx0.c +++ b/src/emu/cpu/pdp1/tx0.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet /* TX-0 emulator diff --git a/src/emu/cpu/pdp1/tx0.h b/src/emu/cpu/pdp1/tx0.h index bdb492bbfc3..e88172bc8ff 100644 --- a/src/emu/cpu/pdp1/tx0.h +++ b/src/emu/cpu/pdp1/tx0.h @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet #pragma once diff --git a/src/emu/cpu/pdp1/tx0dasm.c b/src/emu/cpu/pdp1/tx0dasm.c index 8eef06f832e..3d8a1daf9e1 100644 --- a/src/emu/cpu/pdp1/tx0dasm.c +++ b/src/emu/cpu/pdp1/tx0dasm.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet #include "emu.h" #include "cpu/pdp1/tx0.h" diff --git a/src/emu/cpu/tms9900/9900dasm.c b/src/emu/cpu/tms9900/9900dasm.c index 010908290ed..7b3153e6c4c 100644 --- a/src/emu/cpu/tms9900/9900dasm.c +++ b/src/emu/cpu/tms9900/9900dasm.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet /***************************************************************************** * diff --git a/src/emu/cpu/tms9900/99xxcore.h b/src/emu/cpu/tms9900/99xxcore.h index 794be20fcb4..cb94fac286f 100644 --- a/src/emu/cpu/tms9900/99xxcore.h +++ b/src/emu/cpu/tms9900/99xxcore.h @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet /*************************************************************************** diff --git a/src/emu/imagedev/harddriv.c b/src/emu/imagedev/harddriv.c index 3134506e61b..bc39d53e4b3 100644 --- a/src/emu/imagedev/harddriv.c +++ b/src/emu/imagedev/harddriv.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Nathan Woods, Raphael Nabet, Miodrag Milanovic /********************************************************************* diff --git a/src/emu/imagedev/harddriv.h b/src/emu/imagedev/harddriv.h index c80044478b2..f72dc0553f1 100644 --- a/src/emu/imagedev/harddriv.h +++ b/src/emu/imagedev/harddriv.h @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Nathan Woods, Raphael Nabet, Miodrag Milanovic /********************************************************************* diff --git a/src/emu/machine/at29040a.c b/src/emu/machine/at29040a.c index 31be262b7c1..3285b265792 100644 --- a/src/emu/machine/at29040a.c +++ b/src/emu/machine/at29040a.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet, Michael Zapf /* Atmel at29c040a flash EEPROM diff --git a/src/emu/machine/at29040a.h b/src/emu/machine/at29040a.h index 0dc6473edff..1af258fb719 100644 --- a/src/emu/machine/at29040a.h +++ b/src/emu/machine/at29040a.h @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet, Michael Zapf /* ATMEL 29040a diff --git a/src/emu/machine/corvushd.c b/src/emu/machine/corvushd.c index 659945da93d..0444d3cb530 100644 --- a/src/emu/machine/corvushd.c +++ b/src/emu/machine/corvushd.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Brett Wyer, Raphael Nabet // // corvus_hd diff --git a/src/emu/machine/corvushd.h b/src/emu/machine/corvushd.h index 324fef4f1bf..bc83fa2585d 100644 --- a/src/emu/machine/corvushd.h +++ b/src/emu/machine/corvushd.h @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Brett Wyer, Raphael Nabet /***************************************************************************** * diff --git a/src/emu/machine/mm58274c.c b/src/emu/machine/mm58274c.c index bc1b27daede..db2d1d07dcf 100644 --- a/src/emu/machine/mm58274c.c +++ b/src/emu/machine/mm58274c.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet /*************************************************************************** diff --git a/src/emu/machine/mm58274c.h b/src/emu/machine/mm58274c.h index 729e1a65fad..225340721ea 100644 --- a/src/emu/machine/mm58274c.h +++ b/src/emu/machine/mm58274c.h @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet #ifndef __MM58274C_H__ #define __MM58274C_H__ diff --git a/src/emu/machine/rtc65271.c b/src/emu/machine/rtc65271.c index 0e5b8802754..074b8d87f48 100644 --- a/src/emu/machine/rtc65271.c +++ b/src/emu/machine/rtc65271.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet, R. Belmont /* rtc65271 emulation diff --git a/src/emu/machine/rtc65271.h b/src/emu/machine/rtc65271.h index 326ccf7d116..b81e92755d5 100644 --- a/src/emu/machine/rtc65271.h +++ b/src/emu/machine/rtc65271.h @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet, R. Belmont /* rtc65271.h: include file for rtc65271.c diff --git a/src/emu/machine/smc92x4.c b/src/emu/machine/smc92x4.c index 6a87f8b4bf6..9154648b00d 100644 --- a/src/emu/machine/smc92x4.c +++ b/src/emu/machine/smc92x4.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet, Michael Zapf /* HDC9224 and HDC9234 Hard and Floppy Disk Controller diff --git a/src/emu/machine/smc92x4.h b/src/emu/machine/smc92x4.h index 9cc80b815ea..d8b4720c87a 100644 --- a/src/emu/machine/smc92x4.h +++ b/src/emu/machine/smc92x4.h @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet, Michael Zapf /* Interface */ diff --git a/src/emu/machine/spchrom.c b/src/emu/machine/spchrom.c index ae906840f43..a49590e9e00 100644 --- a/src/emu/machine/spchrom.c +++ b/src/emu/machine/spchrom.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Frank Palazzolo, Aaron Giles, Jonathan Gevaryahu, Raphael Nabet, Couriersud, Michael Zapf /* spchroms.c - This is an emulator for "typical" speech ROMs from TI, as used by TI99/4(a). diff --git a/src/emu/machine/spchrom.h b/src/emu/machine/spchrom.h index e45ba8092e5..520c7fc967b 100644 --- a/src/emu/machine/spchrom.h +++ b/src/emu/machine/spchrom.h @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Frank Palazzolo, Aaron Giles, Jonathan Gevaryahu, Raphael Nabet, Couriersud, Michael Zapf /* * Voice Synthesis Memory diff --git a/src/emu/machine/strata.c b/src/emu/machine/strata.c index 26da2fb3f72..01651eb90bd 100644 --- a/src/emu/machine/strata.c +++ b/src/emu/machine/strata.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet, Michael Zapf /* Intel 28F640J5 Flash ROM emulation (could also handle 28F320J5 with minor diff --git a/src/emu/machine/strata.h b/src/emu/machine/strata.h index f68a30e5fef..c037a24396b 100644 --- a/src/emu/machine/strata.h +++ b/src/emu/machine/strata.h @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet, Michael Zapf /* strata.h: header file for strata.c diff --git a/src/emu/sound/tms5220.c b/src/emu/sound/tms5220.c index 388862728ea..972780279f3 100644 --- a/src/emu/sound/tms5220.c +++ b/src/emu/sound/tms5220.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Frank Palazzolo, Aaron Giles, Jonathan Gevaryahu, Raphael Nabet, Couriersud, Michael Zapf /********************************************************************************************** diff --git a/src/emu/sound/tms5220.h b/src/emu/sound/tms5220.h index 6a9b36b723e..7150ce5457b 100644 --- a/src/emu/sound/tms5220.h +++ b/src/emu/sound/tms5220.h @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Frank Palazzolo, Aaron Giles, Jonathan Gevaryahu, Raphael Nabet, Couriersud, Michael Zapf #pragma once diff --git a/src/emu/video/tms3556.c b/src/emu/video/tms3556.c index 819e18840d8..9d073bdbe0d 100644 --- a/src/emu/video/tms3556.c +++ b/src/emu/video/tms3556.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet /* tms3556 emulation diff --git a/src/emu/video/tms3556.h b/src/emu/video/tms3556.h index 8c153ab2d5b..a331b8333e3 100644 --- a/src/emu/video/tms3556.h +++ b/src/emu/video/tms3556.h @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet /*************************************************************************** diff --git a/src/lib/util/avhuff.c b/src/lib/util/avhuff.c index dd589c6abdd..cb00ab23336 100644 --- a/src/lib/util/avhuff.c +++ b/src/lib/util/avhuff.c @@ -143,7 +143,6 @@ inline void avhuff_encoder::deltarle_encoder::encode_one(bitstream_out &bitbuf, //------------------------------------------------- // decode_one - decode data //------------------------------------------------- - inline UINT32 avhuff_decoder::deltarle_decoder::decode_one(bitstream_in &bitbuf) { // return RLE data if we still have some @@ -174,9 +173,13 @@ inline UINT32 avhuff_decoder::deltarle_decoder::decode_one(bitstream_in &bitbuf) // AVHUFF ENCODER //************************************************************************** -//------------------------------------------------- -// avhuff_encoder - constructor -//------------------------------------------------- +/** + * @fn avhuff_encoder::avhuff_encoder() + * + * @brief ------------------------------------------------- + * avhuff_encoder - constructor + * -------------------------------------------------. + */ avhuff_encoder::avhuff_encoder() { @@ -185,11 +188,19 @@ m_flac_encoder.set_num_channels(1); m_flac_encoder.set_strip_metadata(true); } - -//------------------------------------------------- -// encode_data - encode a block of data into a -// compressed data stream -//------------------------------------------------- +/** + * @fn avhuff_error avhuff_encoder::encode_data(const UINT8 *source, UINT8 *dest, UINT32 &complength) + * + * @brief ------------------------------------------------- + * encode_data - encode a block of data into a compressed data stream + * -------------------------------------------------. + * + * @param source Source for the. + * @param [in,out] dest If non-null, destination for the. + * @param [in,out] complength The complength. + * + * @return An avhuff_error. + */ avhuff_error avhuff_encoder::encode_data(const UINT8 *source, UINT8 *dest, UINT32 &complength) { @@ -266,11 +277,17 @@ avhuff_error avhuff_encoder::encode_data(const UINT8 *source, UINT8 *dest, UINT3 return AVHERR_NONE; } - -//------------------------------------------------- -// raw_data_size - return the raw data size of -// a raw stream based on the header -//------------------------------------------------- +/** + * @fn UINT32 avhuff_encoder::raw_data_size(const UINT8 *data) + * + * @brief ------------------------------------------------- + * raw_data_size - return the raw data size of a raw stream based on the header + * -------------------------------------------------. + * + * @param data The data. + * + * @return An UINT32. + */ UINT32 avhuff_encoder::raw_data_size(const UINT8 *data) { @@ -290,11 +307,23 @@ UINT32 avhuff_encoder::raw_data_size(const UINT8 *data) return size; } - -//------------------------------------------------- -// assemble_data - assemble a datastream from raw -// bits -//------------------------------------------------- +/** + * @fn avhuff_error avhuff_encoder::assemble_data(dynamic_buffer &buffer, bitmap_yuy16 &bitmap, UINT8 channels, UINT32 numsamples, INT16 **samples, UINT8 *metadata, UINT32 metadatasize) + * + * @brief ------------------------------------------------- + * assemble_data - assemble a datastream from raw bits + * -------------------------------------------------. + * + * @param [in,out] buffer The buffer. + * @param [in,out] bitmap The bitmap. + * @param channels The channels. + * @param numsamples The numsamples. + * @param [in,out] samples If non-null, the samples. + * @param [in,out] metadata If non-null, the metadata. + * @param metadatasize The metadatasize. + * + * @return An avhuff_error. + */ avhuff_error avhuff_encoder::assemble_data(dynamic_buffer &buffer, bitmap_yuy16 &bitmap, UINT8 channels, UINT32 numsamples, INT16 **samples, UINT8 *metadata, UINT32 metadatasize) { @@ -348,11 +377,21 @@ avhuff_error avhuff_encoder::assemble_data(dynamic_buffer &buffer, bitmap_yuy16 return AVHERR_NONE; } - -//------------------------------------------------- -// encode_audio - encode raw audio data to the -// destination -//------------------------------------------------- +/** + * @fn avhuff_error avhuff_encoder::encode_audio(const UINT8 *source, int channels, int samples, UINT8 *dest, UINT8 *sizes) + * + * @brief ------------------------------------------------- + * encode_audio - encode raw audio data to the destination + * -------------------------------------------------. + * + * @param source Source for the. + * @param channels The channels. + * @param samples The samples. + * @param [in,out] dest If non-null, destination for the. + * @param [in,out] sizes If non-null, the sizes. + * + * @return An avhuff_error. + */ avhuff_error avhuff_encoder::encode_audio(const UINT8 *source, int channels, int samples, UINT8 *dest, UINT8 *sizes) { @@ -471,11 +510,21 @@ avhuff_error avhuff_encoder::encode_audio(const UINT8 *source, int channels, int return AVHERR_NONE; } - -//------------------------------------------------- -// encode_video - encode raw video data to the -// destination -//------------------------------------------------- +/** + * @fn avhuff_error avhuff_encoder::encode_video(const UINT8 *source, int width, int height, UINT8 *dest, UINT32 &complength) + * + * @brief ------------------------------------------------- + * encode_video - encode raw video data to the destination + * -------------------------------------------------. + * + * @param source Source for the. + * @param width The width. + * @param height The height. + * @param [in,out] dest If non-null, destination for the. + * @param [in,out] complength The complength. + * + * @return An avhuff_error. + */ avhuff_error avhuff_encoder::encode_video(const UINT8 *source, int width, int height, UINT8 *dest, UINT32 &complength) { @@ -483,11 +532,22 @@ avhuff_error avhuff_encoder::encode_video(const UINT8 *source, int width, int he return encode_video_lossless(source, width, height, dest, complength); } - -//------------------------------------------------- -// encode_video_lossless - do a lossless video -// encoding using deltas and huffman encoding -//------------------------------------------------- +/** + * @fn avhuff_error avhuff_encoder::encode_video_lossless(const UINT8 *source, int width, int height, UINT8 *dest, UINT32 &complength) + * + * @brief ------------------------------------------------- + * encode_video_lossless - do a lossless video encoding using deltas and huffman + * encoding + * -------------------------------------------------. + * + * @param source Source for the. + * @param width The width. + * @param height The height. + * @param [in,out] dest If non-null, destination for the. + * @param [in,out] complength The complength. + * + * @return An avhuff_error. + */ avhuff_error avhuff_encoder::encode_video_lossless(const UINT8 *source, int width, int height, UINT8 *dest, UINT32 &complength) { @@ -540,10 +600,20 @@ avhuff_error avhuff_encoder::encode_video_lossless(const UINT8 *source, int widt // DELTA-RLE ENCODER //************************************************************************** -//------------------------------------------------- -// rle_and_histo_bitmap - RLE compress and -// histogram a bitmap's worth of data -//------------------------------------------------- +/** + * @fn UINT16 *avhuff_encoder::deltarle_encoder::rle_and_histo_bitmap(const UINT8 *source, UINT32 items_per_row, UINT32 item_advance, UINT32 row_count) + * + * @brief ------------------------------------------------- + * rle_and_histo_bitmap - RLE compress and histogram a bitmap's worth of data + * -------------------------------------------------. + * + * @param source Source for the. + * @param items_per_row The items per row. + * @param item_advance The item advance. + * @param row_count Number of rows. + * + * @return null if it fails, else an UINT16*. + */ UINT16 *avhuff_encoder::deltarle_encoder::rle_and_histo_bitmap(const UINT8 *source, UINT32 items_per_row, UINT32 item_advance, UINT32 row_count) { @@ -608,18 +678,27 @@ UINT16 *avhuff_encoder::deltarle_encoder::rle_and_histo_bitmap(const UINT8 *sour // AVHUFF DECODER //************************************************************************** -//------------------------------------------------- -// avhuff_decoder - constructor -//------------------------------------------------- +/** + * @fn avhuff_decoder::avhuff_decoder() + * + * @brief ------------------------------------------------- + * avhuff_decoder - constructor + * -------------------------------------------------. + */ avhuff_decoder::avhuff_decoder() { } - -//------------------------------------------------- -// configure - configure decompression parameters -//------------------------------------------------- +/** + * @fn void avhuff_decoder::configure(const avhuff_decompress_config &config) + * + * @brief ------------------------------------------------- + * configure - configure decompression parameters + * -------------------------------------------------. + * + * @param config The configuration. + */ void avhuff_decoder::configure(const avhuff_decompress_config &config) { @@ -632,11 +711,19 @@ void avhuff_decoder::configure(const avhuff_decompress_config &config) m_config.metadata = config.metadata; } - -//------------------------------------------------- -// decode_data - decode both audio and video from -// a raw data stream -//------------------------------------------------- +/** + * @fn avhuff_error avhuff_decoder::decode_data(const UINT8 *source, UINT32 complength, UINT8 *dest) + * + * @brief ------------------------------------------------- + * decode_data - decode both audio and video from a raw data stream + * -------------------------------------------------. + * + * @param source Source for the. + * @param complength The complength. + * @param [in,out] dest If non-null, destination for the. + * + * @return An avhuff_error. + */ avhuff_error avhuff_decoder::decode_data(const UINT8 *source, UINT32 complength, UINT8 *dest) { @@ -765,11 +852,25 @@ avhuff_error avhuff_decoder::decode_data(const UINT8 *source, UINT32 complength, return AVHERR_NONE; } - -//------------------------------------------------- -// decode_audio - decode audio from a compressed -// data stream -//------------------------------------------------- +/** + * @fn avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const UINT8 *source, UINT8 **dest, UINT32 dxor, const UINT8 *sizes) + * + * @brief ------------------------------------------------- + * decode_audio - decode audio from a compressed data stream + * -------------------------------------------------. + * + * @exception CHDERR_DECOMPRESSION_ERROR Thrown when a chderr decompression error error + * condition occurs. + * + * @param channels The channels. + * @param samples The samples. + * @param source Source for the. + * @param [in,out] dest If non-null, destination for the. + * @param dxor The dxor. + * @param sizes The sizes. + * + * @return An avhuff_error. + */ avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const UINT8 *source, UINT8 **dest, UINT32 dxor, const UINT8 *sizes) { @@ -889,11 +990,23 @@ avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const UINT8 return AVHERR_NONE; } - -//------------------------------------------------- -// decode_video - decode video from a compressed -// data stream -//------------------------------------------------- +/** + * @fn avhuff_error avhuff_decoder::decode_video(int width, int height, const UINT8 *source, UINT32 complength, UINT8 *dest, UINT32 dstride, UINT32 dxor) + * + * @brief ------------------------------------------------- + * decode_video - decode video from a compressed data stream + * -------------------------------------------------. + * + * @param width The width. + * @param height The height. + * @param source Source for the. + * @param complength The complength. + * @param [in,out] dest If non-null, destination for the. + * @param dstride The dstride. + * @param dxor The dxor. + * + * @return An avhuff_error. + */ avhuff_error avhuff_decoder::decode_video(int width, int height, const UINT8 *source, UINT32 complength, UINT8 *dest, UINT32 dstride, UINT32 dxor) { @@ -904,11 +1017,24 @@ avhuff_error avhuff_decoder::decode_video(int width, int height, const UINT8 *so return AVHERR_INVALID_DATA; } - -//------------------------------------------------- -// decode_video_lossless - do a lossless video -// decoding using deltas and huffman encoding -//------------------------------------------------- +/** + * @fn avhuff_error avhuff_decoder::decode_video_lossless(int width, int height, const UINT8 *source, UINT32 complength, UINT8 *dest, UINT32 dstride, UINT32 dxor) + * + * @brief ------------------------------------------------- + * decode_video_lossless - do a lossless video decoding using deltas and huffman + * encoding + * -------------------------------------------------. + * + * @param width The width. + * @param height The height. + * @param source Source for the. + * @param complength The complength. + * @param [in,out] dest If non-null, destination for the. + * @param dstride The dstride. + * @param dxor The dxor. + * + * @return An avhuff_error. + */ avhuff_error avhuff_decoder::decode_video_lossless(int width, int height, const UINT8 *source, UINT32 complength, UINT8 *dest, UINT32 dstride, UINT32 dxor) { diff --git a/src/lib/util/aviio.c b/src/lib/util/aviio.c index 0d0403809f8..dcc14428716 100644 --- a/src/lib/util/aviio.c +++ b/src/lib/util/aviio.c @@ -18,59 +18,207 @@ CONSTANTS ***************************************************************************/ +/** + * @def FILETYPE_READ + * + * @brief A macro that defines filetype read. + */ + #define FILETYPE_READ 1 + +/** + * @def FILETYPE_CREATE + * + * @brief A macro that defines filetype create. + */ + #define FILETYPE_CREATE 2 +/** @brief Size of the maximum riff. */ #define MAX_RIFF_SIZE (2UL * 1024 * 1024 * 1024 - 1024) /* just under 2GB */ +/** @brief The maximum avi size in gigabytes. */ #define MAX_AVI_SIZE_IN_GB (256) + +/** + * @def FOUR_GB + * + * @brief A macro that defines four gigabytes. + */ + #define FOUR_GB ((UINT64)1 << 32) +/** + * @def MAX_SOUND_CHANNELS + * + * @brief A macro that defines maximum sound channels. + */ + #define MAX_SOUND_CHANNELS 2 + +/** + * @def SOUND_BUFFER_MSEC + * + * @brief A macro that defines sound buffer msec. + */ + #define SOUND_BUFFER_MSEC 2000 /* milliseconds of sound buffering */ +/** @brief The chunktype riff. */ #define CHUNKTYPE_RIFF AVI_FOURCC('R','I','F','F') +/** @brief List of chunktypes. */ #define CHUNKTYPE_LIST AVI_FOURCC('L','I','S','T') +/** @brief The chunktype junk. */ #define CHUNKTYPE_JUNK AVI_FOURCC('J','U','N','K') +/** @brief The chunktype avih. */ #define CHUNKTYPE_AVIH AVI_FOURCC('a','v','i','h') +/** @brief The chunktype strh. */ #define CHUNKTYPE_STRH AVI_FOURCC('s','t','r','h') +/** @brief The chunktype strf. */ #define CHUNKTYPE_STRF AVI_FOURCC('s','t','r','f') +/** @brief The first chunktype index. */ #define CHUNKTYPE_IDX1 AVI_FOURCC('i','d','x','1') +/** @brief The chunktype indx. */ #define CHUNKTYPE_INDX AVI_FOURCC('i','n','d','x') +/** @brief The chunktype xxdb. */ #define CHUNKTYPE_XXDB AVI_FOURCC(0x00,0x00,'d','b') +/** @brief The chunktype xxdc. */ #define CHUNKTYPE_XXDC AVI_FOURCC(0x00,0x00,'d','c') +/** @brief The chunktype xxwb. */ #define CHUNKTYPE_XXWB AVI_FOURCC(0x00,0x00,'w','b') +/** @brief The chunktype ixxx. */ #define CHUNKTYPE_IXXX AVI_FOURCC('i','x',0x00,0x00) +/** @brief The chunktype xx mask. */ #define CHUNKTYPE_XX_MASK AVI_FOURCC(0x00,0x00,0xff,0xff) +/** @brief The listtype avi. */ #define LISTTYPE_AVI AVI_FOURCC('A','V','I',' ') +/** @brief The listtype avix. */ #define LISTTYPE_AVIX AVI_FOURCC('A','V','I','X') +/** @brief The listtype hdrl. */ #define LISTTYPE_HDRL AVI_FOURCC('h','d','r','l') +/** @brief The listtype strl. */ #define LISTTYPE_STRL AVI_FOURCC('s','t','r','l') +/** @brief The listtype movi. */ #define LISTTYPE_MOVI AVI_FOURCC('m','o','v','i') +/** @brief The streamtype vids. */ #define STREAMTYPE_VIDS AVI_FOURCC('v','i','d','s') +/** @brief The streamtype auds. */ #define STREAMTYPE_AUDS AVI_FOURCC('a','u','d','s') +/** @brief The handler bitmap. */ #define HANDLER_DIB AVI_FOURCC('D','I','B',' ') +/** @brief The handler hfyu. */ #define HANDLER_HFYU AVI_FOURCC('h','f','y','u') /* main AVI header files */ + +/** + * @def AVIF_HASINDEX + * + * @brief A macro that defines avif hasindex. + */ + #define AVIF_HASINDEX 0x00000010 + +/** + * @def AVIF_MUSTUSEINDEX + * + * @brief A macro that defines avif mustuseindex. + */ + #define AVIF_MUSTUSEINDEX 0x00000020 + +/** + * @def AVIF_ISINTERLEAVED + * + * @brief A macro that defines avif isinterleaved. + */ + #define AVIF_ISINTERLEAVED 0x00000100 + +/** + * @def AVIF_COPYRIGHTED + * + * @brief A macro that defines avif copyrighted. + */ + #define AVIF_COPYRIGHTED 0x00010000 + +/** + * @def AVIF_WASCAPTUREFILE + * + * @brief A macro that defines avif wascapturefile. + */ + #define AVIF_WASCAPTUREFILE 0x00020000 /* index definitions */ + +/** + * @def AVI_INDEX_OF_INDEXES + * + * @brief A macro that defines avi index of indexes. + */ + #define AVI_INDEX_OF_INDEXES 0x00 + +/** + * @def AVI_INDEX_OF_CHUNKS + * + * @brief A macro that defines avi index of chunks. + */ + #define AVI_INDEX_OF_CHUNKS 0x01 + +/** + * @def AVI_INDEX_IS_DATA + * + * @brief A macro that defines avi index is data. + */ + #define AVI_INDEX_IS_DATA 0x80 + +/** + * @def AVI_INDEX_2FIELD + * + * @brief A macro that defines avi index 2 field. + */ + #define AVI_INDEX_2FIELD 0x01 /* HuffYUV definitions */ + +/** + * @def HUFFYUV_PREDICT_LEFT + * + * @brief A macro that defines huffyuv predict left. + */ + #define HUFFYUV_PREDICT_LEFT 0 + +/** + * @def HUFFYUV_PREDICT_GRADIENT + * + * @brief A macro that defines huffyuv predict gradient. + */ + #define HUFFYUV_PREDICT_GRADIENT 1 + +/** + * @def HUFFYUV_PREDICT_MEDIAN + * + * @brief A macro that defines huffyuv predict median. + */ + #define HUFFYUV_PREDICT_MEDIAN 2 + +/** + * @def HUFFYUV_PREDICT_DECORR + * + * @brief A macro that defines huffyuv predict decorr. + */ + #define HUFFYUV_PREDICT_DECORR 0x40 @@ -79,96 +227,177 @@ TYPE DEFINITIONS ***************************************************************************/ +/** + * @struct avi_chunk + * + * @brief An avi chunk. + */ + struct avi_chunk { + /** @brief The offset. */ UINT64 offset; /* file offset of chunk header */ + /** @brief The size. */ UINT64 size; /* size of this chunk */ + /** @brief The type. */ UINT32 type; /* type of this chunk */ + /** @brief The listtype. */ UINT32 listtype; /* type of this list (if we are a list) */ }; +/** + * @struct avi_chunk_list + * + * @brief List of avi chunks. + */ struct avi_chunk_list { + /** @brief The offset. */ UINT64 offset; /* offset in the file of header */ + /** @brief The length. */ UINT32 length; /* length of the chunk including header */ }; +/** + * @struct huffyuv_table + * + * @brief A huffyuv table. + */ struct huffyuv_table { + /** @brief The shift[ 256]. */ UINT8 shift[256]; /* bit shift amounts */ + /** @brief The bits[ 256]. */ UINT32 bits[256]; /* bit match values */ + /** @brief The mask[ 256]. */ UINT32 mask[256]; /* bit mask values */ + /** @brief The baselookup[ 65536]. */ UINT16 baselookup[65536]; /* base lookup table */ + /** @brief The extralookup. */ UINT16 * extralookup; /* extra lookup tables */ }; +/** + * @struct huffyuv_data + * + * @brief A huffyuv data. + */ struct huffyuv_data { + /** @brief The predictor. */ UINT8 predictor; /* predictor */ + /** @brief The table[ 3]. */ huffyuv_table table[3]; /* array of tables */ }; +/** + * @struct avi_stream + * + * @brief An avi stream. + */ struct avi_stream { + /** @brief The type. */ UINT32 type; /* subtype of stream */ + /** @brief Describes the format to use. */ UINT32 format; /* format of stream data */ + /** @brief The rate. */ UINT32 rate; /* timescale for stream */ + /** @brief The scale. */ UINT32 scale; /* duration of one sample in the stream */ + /** @brief The samples. */ UINT32 samples; /* number of samples */ + /** @brief The chunk. */ avi_chunk_list * chunk; /* list of chunks */ + /** @brief The chunks. */ UINT32 chunks; /* chunks currently known */ + /** @brief The chunksalloc. */ UINT32 chunksalloc; /* number of chunks allocated */ + /** @brief The width. */ UINT32 width; /* width of video */ + /** @brief The height. */ UINT32 height; /* height of video */ + /** @brief The depth. */ UINT32 depth; /* depth of video */ + /** @brief The interlace. */ UINT8 interlace; /* interlace parameters */ + /** @brief The huffyuv. */ huffyuv_data * huffyuv; /* huffyuv decompression data */ + /** @brief The channels. */ UINT16 channels; /* audio channels */ + /** @brief The samplebits. */ UINT16 samplebits; /* audio bits per sample */ + /** @brief The samplerate. */ UINT32 samplerate; /* audio sample rate */ /* only used when creating */ + /** @brief The saved strh offset. */ UINT64 saved_strh_offset; /* writeoffset of strh chunk */ + /** @brief The saved indx offset. */ UINT64 saved_indx_offset; /* writeoffset of indx chunk */ }; +/** + * @struct avi_file + * + * @brief An avi file. + */ struct avi_file { /* shared data */ + /** @brief The file. */ osd_file * file; /* pointer to open file */ + /** @brief The type. */ int type; /* type of access (read/create) */ + /** @brief The information. */ avi_movie_info info; /* movie info structure */ + /** @brief The tempbuffer. */ UINT8 * tempbuffer; /* temporary buffer */ + /** @brief The tempbuffersize. */ UINT32 tempbuffersize; /* size of the temporary buffer */ /* only used when reading */ + /** @brief The streams. */ int streams; /* number of streams */ + /** @brief The stream. */ avi_stream * stream; /* allocated array of stream information */ + /** @brief The rootchunk. */ avi_chunk rootchunk; /* dummy root chunk that wraps the whole file */ /* only used when creating */ + /** @brief The writeoffs. */ UINT64 writeoffs; /* current file write offset */ + /** @brief The riffbase. */ UINT64 riffbase; /* base of the current RIFF */ + /** @brief The chunkstack[ 8]. */ avi_chunk chunkstack[8]; /* stack of chunks we are writing */ + /** @brief The chunksp. */ int chunksp; /* stack pointer for the current chunk */ + /** @brief The saved movi offset. */ UINT64 saved_movi_offset; /* writeoffset of movi list */ + /** @brief The saved avih offset. */ UINT64 saved_avih_offset; /* writeoffset of avih chunk */ + /** @brief The soundbuf. */ INT16 * soundbuf; /* buffer for sound data */ + /** @brief The soundbuf samples. */ UINT32 soundbuf_samples; /* length of sound buffer in samples */ + /** @brief The soundbuf chansamples[ maximum sound channels]. */ UINT32 soundbuf_chansamples[MAX_SOUND_CHANNELS]; /* samples in buffer for each channel */ + /** @brief The soundbuf chunks. */ UINT32 soundbuf_chunks; /* number of chunks completed so far */ + /** @brief The soundbuf frames. */ UINT32 soundbuf_frames; /* number of frames ahead of the video */ }; @@ -241,6 +470,16 @@ static void printf_chunk_recursive(avi_file *file, avi_chunk *chunk, int indent) from the given buffer -------------------------------------------------*/ +/** + * @fn INLINE UINT16 fetch_16bits(const UINT8 *data) + * + * @brief Fetches the 16bits. + * + * @param data The data. + * + * @return The 16bits. + */ + INLINE UINT16 fetch_16bits(const UINT8 *data) { return data[0] | (data[1] << 8); @@ -252,6 +491,16 @@ INLINE UINT16 fetch_16bits(const UINT8 *data) from the given buffer -------------------------------------------------*/ +/** + * @fn INLINE UINT32 fetch_32bits(const UINT8 *data) + * + * @brief Fetches the 32bits. + * + * @param data The data. + * + * @return The 32bits. + */ + INLINE UINT32 fetch_32bits(const UINT8 *data) { return data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); @@ -263,6 +512,16 @@ INLINE UINT32 fetch_32bits(const UINT8 *data) from the given buffer -------------------------------------------------*/ +/** + * @fn INLINE UINT64 fetch_64bits(const UINT8 *data) + * + * @brief Fetches the 64bits. + * + * @param data The data. + * + * @return The 64bits. + */ + INLINE UINT64 fetch_64bits(const UINT8 *data) { return (UINT64)data[0] | ((UINT64)data[1] << 8) | @@ -277,6 +536,15 @@ INLINE UINT64 fetch_64bits(const UINT8 *data) to the given buffer -------------------------------------------------*/ +/** + * @fn INLINE void put_16bits(UINT8 *data, UINT16 value) + * + * @brief Puts the 16bits. + * + * @param [in,out] data If non-null, the data. + * @param value The value. + */ + INLINE void put_16bits(UINT8 *data, UINT16 value) { data[0] = value >> 0; @@ -289,6 +557,15 @@ INLINE void put_16bits(UINT8 *data, UINT16 value) to the given buffer -------------------------------------------------*/ +/** + * @fn INLINE void put_32bits(UINT8 *data, UINT32 value) + * + * @brief Puts the 32bits. + * + * @param [in,out] data If non-null, the data. + * @param value The value. + */ + INLINE void put_32bits(UINT8 *data, UINT32 value) { data[0] = value >> 0; @@ -303,6 +580,15 @@ INLINE void put_32bits(UINT8 *data, UINT32 value) to the given buffer -------------------------------------------------*/ +/** + * @fn INLINE void put_64bits(UINT8 *data, UINT64 value) + * + * @brief Puts the 64bits. + * + * @param [in,out] data If non-null, the data. + * @param value The value. + */ + INLINE void put_64bits(UINT8 *data, UINT64 value) { data[0] = value >> 0; @@ -321,6 +607,16 @@ INLINE void put_64bits(UINT8 *data, UINT64 value) video stream -------------------------------------------------*/ +/** + * @fn INLINE avi_stream *get_video_stream(avi_file *file) + * + * @brief Gets video stream. + * + * @param [in,out] file If non-null, the file. + * + * @return null if it fails, else the video stream. + */ + INLINE avi_stream *get_video_stream(avi_file *file) { int streamnum; @@ -339,6 +635,18 @@ INLINE avi_stream *get_video_stream(avi_file *file) audio stream for the 'n'th channel -------------------------------------------------*/ +/** + * @fn INLINE avi_stream *get_audio_stream(avi_file *file, int channel, int *offset) + * + * @brief Gets audio stream. + * + * @param [in,out] file If non-null, the file. + * @param channel The channel. + * @param [in,out] offset If non-null, the offset. + * + * @return null if it fails, else the audio stream. + */ + INLINE avi_stream *get_audio_stream(avi_file *file, int channel, int *offset) { int streamnum; @@ -365,6 +673,19 @@ INLINE avi_stream *get_audio_stream(avi_file *file, int channel, int *offset) for a given chunk within a stream -------------------------------------------------*/ +/** + * @fn INLINE avi_error set_stream_chunk_info(avi_stream *stream, UINT32 index, UINT64 offset, UINT32 length) + * + * @brief Sets stream chunk information. + * + * @param [in,out] stream If non-null, the stream. + * @param index Zero-based index of the. + * @param offset The offset. + * @param length The length. + * + * @return An avi_error. + */ + INLINE avi_error set_stream_chunk_info(avi_stream *stream, UINT32 index, UINT64 offset, UINT32 length) { /* if we need to allocate more, allocate more */ @@ -398,6 +719,16 @@ INLINE avi_error set_stream_chunk_info(avi_stream *stream, UINT32 index, UINT64 idx1 chunk -------------------------------------------------*/ +/** + * @fn INLINE UINT32 compute_idx1_size(avi_file *file) + * + * @brief Calculates the index 1 size. + * + * @param [in,out] file If non-null, the file. + * + * @return The calculated index 1 size. + */ + INLINE UINT32 compute_idx1_size(avi_file *file) { int chunks = 0; @@ -416,6 +747,17 @@ INLINE UINT32 compute_idx1_size(avi_file *file) a given stream -------------------------------------------------*/ +/** + * @fn INLINE UINT32 get_chunkid_for_stream(avi_file *file, avi_stream *stream) + * + * @brief Gets chunkid for stream. + * + * @param [in,out] file If non-null, the file. + * @param [in,out] stream If non-null, the stream. + * + * @return The chunkid for stream. + */ + INLINE UINT32 get_chunkid_for_stream(avi_file *file, avi_stream *stream) { UINT32 chunkid; @@ -435,6 +777,17 @@ INLINE UINT32 get_chunkid_for_stream(avi_file *file, avi_stream *stream) number, get the first sample number -------------------------------------------------*/ +/** + * @fn INLINE UINT32 framenum_to_samplenum(avi_file *file, UINT32 framenum) + * + * @brief Framenum to samplenum. + * + * @param [in,out] file If non-null, the file. + * @param framenum The framenum. + * + * @return An UINT32. + */ + INLINE UINT32 framenum_to_samplenum(avi_file *file, UINT32 framenum) { return ((UINT64)file->info.audio_samplerate * (UINT64)framenum * (UINT64)file->info.video_sampletime + file->info.video_timescale - 1) / (UINT64)file->info.video_timescale; @@ -447,6 +800,17 @@ INLINE UINT32 framenum_to_samplenum(avi_file *file, UINT32 framenum) requested amount of data -------------------------------------------------*/ +/** + * @fn INLINE avi_error expand_tempbuffer(avi_file *file, UINT32 length) + * + * @brief Expand tempbuffer. + * + * @param [in,out] file If non-null, the file. + * @param length The length. + * + * @return An avi_error. + */ + INLINE avi_error expand_tempbuffer(avi_file *file, UINT32 length) { /* expand the tempbuffer to hold the data if necessary */ @@ -473,6 +837,17 @@ INLINE avi_error expand_tempbuffer(avi_file *file, UINT32 length) avi_open - open an AVI movie file for read -------------------------------------------------*/ +/** + * @fn avi_error avi_open(const char *filename, avi_file **file) + * + * @brief Queries if a given avi open. + * + * @param filename Filename of the file. + * @param [in,out] file If non-null, the file. + * + * @return An avi_error. + */ + avi_error avi_open(const char *filename, avi_file **file) { avi_file *newfile = NULL; @@ -525,6 +900,18 @@ error: avi_create - create a new AVI movie file -------------------------------------------------*/ +/** + * @fn avi_error avi_create(const char *filename, const avi_movie_info *info, avi_file **file) + * + * @brief Avi create. + * + * @param filename Filename of the file. + * @param info The information. + * @param [in,out] file If non-null, the file. + * + * @return An avi_error. + */ + avi_error avi_create(const char *filename, const avi_movie_info *info, avi_file **file) { avi_file *newfile = NULL; @@ -632,6 +1019,16 @@ error: avi_close - close an AVI movie file -------------------------------------------------*/ +/** + * @fn avi_error avi_close(avi_file *file) + * + * @brief Avi close. + * + * @param [in,out] file If non-null, the file. + * + * @return An avi_error. + */ + avi_error avi_close(avi_file *file) { avi_error avierr = AVIERR_NONE; @@ -706,6 +1103,14 @@ avi_error avi_close(avi_file *file) avi_printf_chunks - print the chunks in a file -------------------------------------------------*/ +/** + * @fn void avi_printf_chunks(avi_file *file) + * + * @brief Avi printf chunks. + * + * @param [in,out] file If non-null, the file. + */ + void avi_printf_chunks(avi_file *file) { printf_chunk_recursive(file, &file->rootchunk, 0); @@ -717,6 +1122,16 @@ void avi_printf_chunks(avi_file *file) an avi_error -------------------------------------------------*/ +/** + * @fn const char *avi_error_string(avi_error err) + * + * @brief Avi error string. + * + * @param err The error. + * + * @return null if it fails, else a char*. + */ + const char *avi_error_string(avi_error err) { switch (err) @@ -748,6 +1163,16 @@ const char *avi_error_string(avi_error err) movie info -------------------------------------------------*/ +/** + * @fn const avi_movie_info *avi_get_movie_info(avi_file *file) + * + * @brief Avi get movie information. + * + * @param [in,out] file If non-null, the file. + * + * @return null if it fails, else an avi_movie_info*. + */ + const avi_movie_info *avi_get_movie_info(avi_file *file) { return &file->info; @@ -759,6 +1184,17 @@ const avi_movie_info *avi_get_movie_info(avi_file *file) to a sample index -------------------------------------------------*/ +/** + * @fn UINT32 avi_first_sample_in_frame(avi_file *file, UINT32 framenum) + * + * @brief Avi first sample in frame. + * + * @param [in,out] file If non-null, the file. + * @param framenum The framenum. + * + * @return An UINT32. + */ + UINT32 avi_first_sample_in_frame(avi_file *file, UINT32 framenum) { return framenum_to_samplenum(file, framenum); @@ -771,6 +1207,18 @@ UINT32 avi_first_sample_in_frame(avi_file *file, UINT32 framenum) converting to YUY16 format -------------------------------------------------*/ +/** + * @fn avi_error avi_read_video_frame(avi_file *file, UINT32 framenum, bitmap_yuy16 &bitmap) + * + * @brief Avi read video frame. + * + * @param [in,out] file If non-null, the file. + * @param framenum The framenum. + * @param [in,out] bitmap The bitmap. + * + * @return An avi_error. + */ + avi_error avi_read_video_frame(avi_file *file, UINT32 framenum, bitmap_yuy16 &bitmap) { avi_error avierr = AVIERR_NONE; @@ -829,6 +1277,20 @@ avi_error avi_read_video_frame(avi_file *file, UINT32 framenum, bitmap_yuy16 &bi data from an AVI file -------------------------------------------------*/ +/** + * @fn avi_error avi_read_sound_samples(avi_file *file, int channel, UINT32 firstsample, UINT32 numsamples, INT16 *output) + * + * @brief Avi read sound samples. + * + * @param [in,out] file If non-null, the file. + * @param channel The channel. + * @param firstsample The firstsample. + * @param numsamples The numsamples. + * @param [in,out] output If non-null, the output. + * + * @return An avi_error. + */ + avi_error avi_read_sound_samples(avi_file *file, int channel, UINT32 firstsample, UINT32 numsamples, INT16 *output) { avi_error avierr = AVIERR_NONE; @@ -935,6 +1397,17 @@ avi_error avi_read_sound_samples(avi_file *file, int channel, UINT32 firstsample of video in YUY16 format -------------------------------------------------*/ +/** + * @fn avi_error avi_append_video_frame(avi_file *file, bitmap_yuy16 &bitmap) + * + * @brief Avi append video frame. + * + * @param [in,out] file If non-null, the file. + * @param [in,out] bitmap The bitmap. + * + * @return An avi_error. + */ + avi_error avi_append_video_frame(avi_file *file, bitmap_yuy16 &bitmap) { avi_stream *stream = get_video_stream(file); @@ -982,6 +1455,17 @@ avi_error avi_append_video_frame(avi_file *file, bitmap_yuy16 &bitmap) of video in RGB32 format -------------------------------------------------*/ +/** + * @fn avi_error avi_append_video_frame(avi_file *file, bitmap_rgb32 &bitmap) + * + * @brief Avi append video frame. + * + * @param [in,out] file If non-null, the file. + * @param [in,out] bitmap The bitmap. + * + * @return An avi_error. + */ + avi_error avi_append_video_frame(avi_file *file, bitmap_rgb32 &bitmap) { avi_stream *stream = get_video_stream(file); @@ -1033,6 +1517,20 @@ avi_error avi_append_video_frame(avi_file *file, bitmap_rgb32 &bitmap) samples -------------------------------------------------*/ +/** + * @fn avi_error avi_append_sound_samples(avi_file *file, int channel, const INT16 *samples, UINT32 numsamples, UINT32 sampleskip) + * + * @brief Avi append sound samples. + * + * @param [in,out] file If non-null, the file. + * @param channel The channel. + * @param samples The samples. + * @param numsamples The numsamples. + * @param sampleskip The sampleskip. + * + * @return An avi_error. + */ + avi_error avi_append_sound_samples(avi_file *file, int channel, const INT16 *samples, UINT32 numsamples, UINT32 sampleskip) { UINT32 sampoffset = file->soundbuf_chansamples[channel]; @@ -1062,6 +1560,18 @@ avi_error avi_append_sound_samples(avi_file *file, int channel, const INT16 *sam memory -------------------------------------------------*/ +/** + * @fn static avi_error read_chunk_data(avi_file *file, const avi_chunk *chunk, UINT8 **buffer) + * + * @brief Reads chunk data. + * + * @param [in,out] file If non-null, the file. + * @param chunk The chunk. + * @param [in,out] buffer If non-null, the buffer. + * + * @return The chunk data. + */ + static avi_error read_chunk_data(avi_file *file, const avi_chunk *chunk, UINT8 **buffer) { file_error filerr; @@ -1090,6 +1600,18 @@ static avi_error read_chunk_data(avi_file *file, const avi_chunk *chunk, UINT8 * first chunk in a container -------------------------------------------------*/ +/** + * @fn static avi_error get_first_chunk(avi_file *file, const avi_chunk *parent, avi_chunk *newchunk) + * + * @brief Gets the first chunk. + * + * @param [in,out] file If non-null, the file. + * @param parent The parent. + * @param [in,out] newchunk If non-null, the newchunk. + * + * @return The first chunk. + */ + static avi_error get_first_chunk(avi_file *file, const avi_chunk *parent, avi_chunk *newchunk) { UINT64 startoffset = (parent != NULL && parent->type != 0) ? parent->offset + 12 : 0; @@ -1104,6 +1626,18 @@ static avi_error get_first_chunk(avi_file *file, const avi_chunk *parent, avi_ch next chunk in a container -------------------------------------------------*/ +/** + * @fn static avi_error get_next_chunk(avi_file *file, const avi_chunk *parent, avi_chunk *newchunk) + * + * @brief Gets the next chunk. + * + * @param [in,out] file If non-null, the file. + * @param parent The parent. + * @param [in,out] newchunk If non-null, the newchunk. + * + * @return The next chunk. + */ + static avi_error get_next_chunk(avi_file *file, const avi_chunk *parent, avi_chunk *newchunk) { UINT64 nextoffset = newchunk->offset + 8 + newchunk->size + (newchunk->size & 1); @@ -1116,6 +1650,19 @@ static avi_error get_next_chunk(avi_file *file, const avi_chunk *parent, avi_chu first chunk of a particular type in a container -------------------------------------------------*/ +/** + * @fn static avi_error find_first_chunk(avi_file *file, UINT32 findme, const avi_chunk *container, avi_chunk *result) + * + * @brief Searches for the first chunk. + * + * @param [in,out] file If non-null, the file. + * @param findme The findme. + * @param container The container. + * @param [out] result If non-null, the result. + * + * @return The found chunk. + */ + static avi_error find_first_chunk(avi_file *file, UINT32 findme, const avi_chunk *container, avi_chunk *result) { avi_error avierr; @@ -1133,6 +1680,19 @@ static avi_error find_first_chunk(avi_file *file, UINT32 findme, const avi_chunk next chunk of a particular type in a container -------------------------------------------------*/ +/** + * @fn static avi_error find_next_chunk(avi_file *file, UINT32 findme, const avi_chunk *container, avi_chunk *result) + * + * @brief Searches for the next chunk. + * + * @param [in,out] file If non-null, the file. + * @param findme The findme. + * @param container The container. + * @param [out] result If non-null, the result. + * + * @return The found chunk. + */ + static avi_error find_next_chunk(avi_file *file, UINT32 findme, const avi_chunk *container, avi_chunk *result) { avi_error avierr; @@ -1150,6 +1710,19 @@ static avi_error find_next_chunk(avi_file *file, UINT32 findme, const avi_chunk first list of a particular type in a container -------------------------------------------------*/ +/** + * @fn static avi_error find_first_list(avi_file *file, UINT32 findme, const avi_chunk *container, avi_chunk *result) + * + * @brief Searches for the first list. + * + * @param [in,out] file If non-null, the file. + * @param findme The findme. + * @param container The container. + * @param [out] result If non-null, the result. + * + * @return The found list. + */ + static avi_error find_first_list(avi_file *file, UINT32 findme, const avi_chunk *container, avi_chunk *result) { avi_error avierr; @@ -1167,6 +1740,19 @@ static avi_error find_first_list(avi_file *file, UINT32 findme, const avi_chunk next list of a particular type in a container -------------------------------------------------*/ +/** + * @fn static avi_error find_next_list(avi_file *file, UINT32 findme, const avi_chunk *container, avi_chunk *result) + * + * @brief Searches for the next list. + * + * @param [in,out] file If non-null, the file. + * @param findme The findme. + * @param container The container. + * @param [out] result If non-null, the result. + * + * @return The found list. + */ + static avi_error find_next_list(avi_file *file, UINT32 findme, const avi_chunk *container, avi_chunk *result) { avi_error avierr; @@ -1184,6 +1770,19 @@ static avi_error find_next_list(avi_file *file, UINT32 findme, const avi_chunk * chunk relative to the current one -------------------------------------------------*/ +/** + * @fn static avi_error get_next_chunk_internal(avi_file *file, const avi_chunk *parent, avi_chunk *newchunk, UINT64 offset) + * + * @brief Gets the next chunk internal. + * + * @param [in,out] file If non-null, the file. + * @param parent The parent. + * @param [in,out] newchunk If non-null, the newchunk. + * @param offset The offset. + * + * @return The next chunk internal. + */ + static avi_error get_next_chunk_internal(avi_file *file, const avi_chunk *parent, avi_chunk *newchunk, UINT64 offset) { file_error filerr; @@ -1227,6 +1826,16 @@ static avi_error get_next_chunk_internal(avi_file *file, const avi_chunk *parent read_movie_data - get data about a movie -------------------------------------------------*/ +/** + * @fn static avi_error read_movie_data(avi_file *file) + * + * @brief Reads movie data. + * + * @param [in,out] file If non-null, the file. + * + * @return The movie data. + */ + static avi_error read_movie_data(avi_file *file) { avi_chunk riff, hdrl, avih, strl, strh, strf, indx, movi, idx1; @@ -1328,6 +1937,16 @@ error: from the streams we've read -------------------------------------------------*/ +/** + * @fn static avi_error extract_movie_info(avi_file *file) + * + * @brief Extracts the movie information described by file. + * + * @param [in,out] file If non-null, the file. + * + * @return The extracted movie information. + */ + static avi_error extract_movie_info(avi_file *file) { //avi_stream *audiostream; @@ -1389,6 +2008,17 @@ static avi_error extract_movie_info(avi_file *file) chunk -------------------------------------------------*/ +/** + * @fn static avi_error parse_avih_chunk(avi_file *file, avi_chunk *avih) + * + * @brief Parse avih chunk. + * + * @param [in,out] file If non-null, the file. + * @param [in,out] avih If non-null, the avih. + * + * @return An avi_error. + */ + static avi_error parse_avih_chunk(avi_file *file, avi_chunk *avih) { UINT8 *chunkdata = NULL; @@ -1420,6 +2050,18 @@ error: chunk -------------------------------------------------*/ +/** + * @fn static avi_error parse_strh_chunk(avi_file *file, avi_stream *stream, avi_chunk *strh) + * + * @brief Parse strh chunk. + * + * @param [in,out] file If non-null, the file. + * @param [in,out] stream If non-null, the stream. + * @param [in,out] strh If non-null, the strh. + * + * @return An avi_error. + */ + static avi_error parse_strh_chunk(avi_file *file, avi_stream *stream, avi_chunk *strh) { UINT8 *chunkdata = NULL; @@ -1448,6 +2090,18 @@ error: chunk -------------------------------------------------*/ +/** + * @fn static avi_error parse_strf_chunk(avi_file *file, avi_stream *stream, avi_chunk *strf) + * + * @brief Parse strf chunk. + * + * @param [in,out] file If non-null, the file. + * @param [in,out] stream If non-null, the stream. + * @param [in,out] strf If non-null, the strf. + * + * @return An avi_error. + */ + static avi_error parse_strf_chunk(avi_file *file, avi_stream *stream, avi_chunk *strf) { UINT8 *chunkdata = NULL; @@ -1492,6 +2146,18 @@ error: parse_indx_chunk - parse an indx chunk -------------------------------------------------*/ +/** + * @fn static avi_error parse_indx_chunk(avi_file *file, avi_stream *stream, avi_chunk *strf) + * + * @brief Parse indx chunk. + * + * @param [in,out] file If non-null, the file. + * @param [in,out] stream If non-null, the stream. + * @param [in,out] strf If non-null, the strf. + * + * @return An avi_error. + */ + static avi_error parse_indx_chunk(avi_file *file, avi_stream *stream, avi_chunk *strf) { UINT32 entries, entry; @@ -1582,6 +2248,18 @@ error: parse_idx1_chunk - parse an idx1 chunk -------------------------------------------------*/ +/** + * @fn static avi_error parse_idx1_chunk(avi_file *file, UINT64 baseoffset, avi_chunk *idx1) + * + * @brief Parse index 1 chunk. + * + * @param [in,out] file If non-null, the file. + * @param baseoffset The baseoffset. + * @param [in,out] idx1 If non-null, the first index. + * + * @return An avi_error. + */ + static avi_error parse_idx1_chunk(avi_file *file, UINT64 baseoffset, avi_chunk *idx1) { UINT8 *chunkdata = NULL; @@ -1632,6 +2310,19 @@ error: chunk_open - open a new chunk for writing -------------------------------------------------*/ +/** + * @fn static avi_error chunk_open(avi_file *file, UINT32 type, UINT32 listtype, UINT32 estlength) + * + * @brief Queries if a given chunk open. + * + * @param [in,out] file If non-null, the file. + * @param type The type. + * @param listtype The listtype. + * @param estlength The estlength. + * + * @return An avi_error. + */ + static avi_error chunk_open(avi_file *file, UINT32 type, UINT32 listtype, UINT32 estlength) { file_error filerr; @@ -1690,6 +2381,16 @@ static avi_error chunk_open(avi_file *file, UINT32 type, UINT32 listtype, UINT32 chunk_close - finish writing an chunk -------------------------------------------------*/ +/** + * @fn static avi_error chunk_close(avi_file *file) + * + * @brief Chunk close. + * + * @param [in,out] file If non-null, the file. + * + * @return An avi_error. + */ + static avi_error chunk_close(avi_file *file) { avi_chunk *chunk = &file->chunkstack[--file->chunksp]; @@ -1723,6 +2424,19 @@ static avi_error chunk_close(avi_file *file) chunk_write - write an chunk and its data -------------------------------------------------*/ +/** + * @fn static avi_error chunk_write(avi_file *file, UINT32 type, const void *data, UINT32 length) + * + * @brief Chunk write. + * + * @param [in,out] file If non-null, the file. + * @param type The type. + * @param data The data. + * @param length The length. + * + * @return An avi_error. + */ + static avi_error chunk_write(avi_file *file, UINT32 type, const void *data, UINT32 length) { file_error filerr; @@ -1794,6 +2508,21 @@ static avi_error chunk_write(avi_file *file, UINT32 type, const void *data, UINT original -------------------------------------------------*/ +/** + * @fn static avi_error chunk_overwrite(avi_file *file, UINT32 type, const void *data, UINT32 length, UINT64 *offset, int initial_write) + * + * @brief Chunk overwrite. + * + * @param [in,out] file If non-null, the file. + * @param type The type. + * @param data The data. + * @param length The length. + * @param [in,out] offset If non-null, the offset. + * @param initial_write The initial write. + * + * @return An avi_error. + */ + static avi_error chunk_overwrite(avi_file *file, UINT32 type, const void *data, UINT32 length, UINT64 *offset, int initial_write) { UINT64 savedoffset = 0; @@ -1826,6 +2555,16 @@ static avi_error chunk_overwrite(avi_file *file, UINT32 type, const void *data, set of AVI and stream headers -------------------------------------------------*/ +/** + * @fn static avi_error write_initial_headers(avi_file *file) + * + * @brief Writes an initial headers. + * + * @param [in,out] file If non-null, the file. + * + * @return An avi_error. + */ + static avi_error write_initial_headers(avi_file *file) { avi_error avierr; @@ -1898,6 +2637,17 @@ static avi_error write_initial_headers(avi_file *file) chunk -------------------------------------------------*/ +/** + * @fn static avi_error write_avih_chunk(avi_file *file, int initial_write) + * + * @brief Writes an avih chunk. + * + * @param [in,out] file If non-null, the file. + * @param initial_write The initial write. + * + * @return An avi_error. + */ + static avi_error write_avih_chunk(avi_file *file, int initial_write) { avi_stream *video = get_video_stream(file); @@ -1923,6 +2673,18 @@ static avi_error write_avih_chunk(avi_file *file, int initial_write) chunk -------------------------------------------------*/ +/** + * @fn static avi_error write_strh_chunk(avi_file *file, avi_stream *stream, int initial_write) + * + * @brief Writes a strh chunk. + * + * @param [in,out] file If non-null, the file. + * @param [in,out] stream If non-null, the stream. + * @param initial_write The initial write. + * + * @return An avi_error. + */ + static avi_error write_strh_chunk(avi_file *file, avi_stream *stream, int initial_write) { UINT8 buffer[56]; @@ -1966,6 +2728,17 @@ static avi_error write_strh_chunk(avi_file *file, avi_stream *stream, int initia chunk -------------------------------------------------*/ +/** + * @fn static avi_error write_strf_chunk(avi_file *file, avi_stream *stream) + * + * @brief Writes a strf chunk. + * + * @param [in,out] file If non-null, the file. + * @param [in,out] stream If non-null, the stream. + * + * @return An avi_error. + */ + static avi_error write_strf_chunk(avi_file *file, avi_stream *stream) { /* video stream */ @@ -2019,6 +2792,18 @@ static avi_error write_strf_chunk(avi_file *file, avi_stream *stream) chunk -------------------------------------------------*/ +/** + * @fn static avi_error write_indx_chunk(avi_file *file, avi_stream *stream, int initial_write) + * + * @brief Writes an indx chunk. + * + * @param [in,out] file If non-null, the file. + * @param [in,out] stream If non-null, the stream. + * @param initial_write The initial write. + * + * @return An avi_error. + */ + static avi_error write_indx_chunk(avi_file *file, avi_stream *stream, int initial_write) { UINT8 buffer[24 + 16 * MAX_AVI_SIZE_IN_GB / 4]; @@ -2115,6 +2900,16 @@ static avi_error write_indx_chunk(avi_file *file, avi_stream *stream, int initia write_idx1_chunk - write the idx1 chunk -------------------------------------------------*/ +/** + * @fn static avi_error write_idx1_chunk(avi_file *file) + * + * @brief Writes an index 1 chunk. + * + * @param [in,out] file If non-null, the file. + * + * @return An avi_error. + */ + static avi_error write_idx1_chunk(avi_file *file) { UINT32 tempbuflength = compute_idx1_size(file) - 8; @@ -2164,6 +2959,16 @@ static avi_error write_idx1_chunk(avi_file *file) buffering system -------------------------------------------------*/ +/** + * @fn static avi_error soundbuf_initialize(avi_file *file) + * + * @brief Soundbuf initialize. + * + * @param [in,out] file If non-null, the file. + * + * @return An avi_error. + */ + static avi_error soundbuf_initialize(avi_file *file) { avi_stream *audio = get_audio_stream(file, 0, NULL); @@ -2197,6 +3002,17 @@ static avi_error soundbuf_initialize(avi_file *file) chunk data -------------------------------------------------*/ +/** + * @fn static avi_error soundbuf_write_chunk(avi_file *file, UINT32 framenum) + * + * @brief Soundbuf write chunk. + * + * @param [in,out] file If non-null, the file. + * @param framenum The framenum. + * + * @return An avi_error. + */ + static avi_error soundbuf_write_chunk(avi_file *file, UINT32 framenum) { avi_stream *stream = get_audio_stream(file, 0, NULL); @@ -2229,6 +3045,17 @@ static avi_error soundbuf_write_chunk(avi_file *file, UINT32 framenum) buffers -------------------------------------------------*/ +/** + * @fn static avi_error soundbuf_flush(avi_file *file, int only_flush_full) + * + * @brief Soundbuf flush. + * + * @param [in,out] file If non-null, the file. + * @param only_flush_full The only flush full. + * + * @return An avi_error. + */ + static avi_error soundbuf_flush(avi_file *file, int only_flush_full) { avi_stream *stream = get_audio_stream(file, 0, NULL); @@ -2322,6 +3149,19 @@ static avi_error soundbuf_flush(avi_file *file, int only_flush_full) bitmap to an RGB encoded frame -------------------------------------------------*/ +/** + * @fn static avi_error rgb32_compress_to_rgb(avi_stream *stream, const bitmap_rgb32 &bitmap, UINT8 *data, UINT32 numbytes) + * + * @brief RGB 32 compress to RGB. + * + * @param [in,out] stream If non-null, the stream. + * @param bitmap The bitmap. + * @param [in,out] data If non-null, the data. + * @param numbytes The numbytes. + * + * @return An avi_error. + */ + static avi_error rgb32_compress_to_rgb(avi_stream *stream, const bitmap_rgb32 &bitmap, UINT8 *data, UINT32 numbytes) { int height = MIN(stream->height, bitmap.height()); @@ -2373,6 +3213,19 @@ static avi_error rgb32_compress_to_rgb(avi_stream *stream, const bitmap_rgb32 &b encoded frame to a YUY16 bitmap -------------------------------------------------*/ +/** + * @fn static avi_error yuv_decompress_to_yuy16(avi_stream *stream, const UINT8 *data, UINT32 numbytes, bitmap_yuy16 &bitmap) + * + * @brief Yuv decompress to yuy 16. + * + * @param [in,out] stream If non-null, the stream. + * @param data The data. + * @param numbytes The numbytes. + * @param [in,out] bitmap The bitmap. + * + * @return An avi_error. + */ + static avi_error yuv_decompress_to_yuy16(avi_stream *stream, const UINT8 *data, UINT32 numbytes, bitmap_yuy16 &bitmap) { const UINT16 *dataend = (const UINT16 *)(data + numbytes); @@ -2412,6 +3265,19 @@ static avi_error yuv_decompress_to_yuy16(avi_stream *stream, const UINT8 *data, bitmap to a YUV encoded frame -------------------------------------------------*/ +/** + * @fn static avi_error yuy16_compress_to_yuy(avi_stream *stream, const bitmap_yuy16 &bitmap, UINT8 *data, UINT32 numbytes) + * + * @brief Yuy 16 compress to yuy. + * + * @param [in,out] stream If non-null, the stream. + * @param bitmap The bitmap. + * @param [in,out] data If non-null, the data. + * @param numbytes The numbytes. + * + * @return An avi_error. + */ + static avi_error yuy16_compress_to_yuy(avi_stream *stream, const bitmap_yuy16 &bitmap, UINT8 *data, UINT32 numbytes) { const UINT16 *dataend = (const UINT16 *)(data + numbytes); @@ -2451,6 +3317,18 @@ static avi_error yuy16_compress_to_yuy(avi_stream *stream, const bitmap_yuy16 &b tables -------------------------------------------------*/ +/** + * @fn static avi_error huffyuv_extract_tables(avi_stream *stream, const UINT8 *chunkdata, UINT32 size) + * + * @brief Huffyuv extract tables. + * + * @param [in,out] stream If non-null, the stream. + * @param chunkdata The chunkdata. + * @param size The size. + * + * @return An avi_error. + */ + static avi_error huffyuv_extract_tables(avi_stream *stream, const UINT8 *chunkdata, UINT32 size) { const UINT8 *chunkend = chunkdata + size; @@ -2590,6 +3468,19 @@ error: HuffYUV-encoded frame to a YUY16 bitmap -------------------------------------------------*/ +/** + * @fn static avi_error huffyuv_decompress_to_yuy16(avi_stream *stream, const UINT8 *data, UINT32 numbytes, bitmap_yuy16 &bitmap) + * + * @brief Huffyuv decompress to yuy 16. + * + * @param [in,out] stream If non-null, the stream. + * @param data The data. + * @param numbytes The numbytes. + * @param [in,out] bitmap The bitmap. + * + * @return An avi_error. + */ + static avi_error huffyuv_decompress_to_yuy16(avi_stream *stream, const UINT8 *data, UINT32 numbytes, bitmap_yuy16 &bitmap) { huffyuv_data *huffyuv = stream->huffyuv; @@ -2793,6 +3684,14 @@ static avi_error huffyuv_decompress_to_yuy16(avi_stream *stream, const UINT8 *da return AVIERR_NONE; } +/** + * @fn static void u64toa(UINT64 val, char *output) + * + * @brief 64toas. + * + * @param val The value. + * @param [in,out] output If non-null, the output. + */ static void u64toa(UINT64 val, char *output) { @@ -2810,6 +3709,16 @@ static void u64toa(UINT64 val, char *output) about a chunk recursively -------------------------------------------------*/ +/** + * @fn static void printf_chunk_recursive(avi_file *file, avi_chunk *container, int indent) + * + * @brief Printf chunk recursive. + * + * @param [in,out] file If non-null, the file. + * @param [in,out] container If non-null, the container. + * @param indent The indent. + */ + static void printf_chunk_recursive(avi_file *file, avi_chunk *container, int indent) { char size[20], offset[20]; diff --git a/src/lib/util/bitmap.c b/src/lib/util/bitmap.c index a6e7b02f957..e9e941f3fc5 100644 --- a/src/lib/util/bitmap.c +++ b/src/lib/util/bitmap.c @@ -20,9 +20,9 @@ // CONSTANTS //************************************************************************** -// alignment values; 128 bytes is the largest cache line on typical -// architectures today +/** @brief alignment values; 128 bytes is the largest cache line on typical architectures today. */ const UINT32 BITMAP_OVERALL_ALIGN = 128; +/** @brief The bitmap rowbytes align. */ const UINT32 BITMAP_ROWBYTES_ALIGN = 128; @@ -61,9 +61,20 @@ inline void bitmap_t::compute_base(int xslop, int yslop) // BITMAP ALLOCATION/CONFIGURATION //************************************************************************** -//------------------------------------------------- -// bitmap_t - basic constructor -//------------------------------------------------- +/** + * @fn bitmap_t::bitmap_t(bitmap_format format, int bpp, int width, int height, int xslop, int yslop) + * + * @brief ------------------------------------------------- + * bitmap_t - basic constructor + * -------------------------------------------------. + * + * @param format Describes the format to use. + * @param bpp The bits per pixel. + * @param width The width. + * @param height The height. + * @param xslop The xslop. + * @param yslop The yslop. + */ bitmap_t::bitmap_t(bitmap_format format, int bpp, int width, int height, int xslop, int yslop) : m_alloc(NULL), @@ -76,6 +87,18 @@ bitmap_t::bitmap_t(bitmap_format format, int bpp, int width, int height, int xsl allocate(width, height, xslop, yslop); } +/** + * @fn bitmap_t::bitmap_t(bitmap_format format, int bpp, void *base, int width, int height, int rowpixels) + * + * @brief Constructor. + * + * @param format Describes the format to use. + * @param bpp The bits per pixel. + * @param [in,out] base If non-null, the base. + * @param width The width. + * @param height The height. + * @param rowpixels The rowpixels. + */ bitmap_t::bitmap_t(bitmap_format format, int bpp, void *base, int width, int height, int rowpixels) : m_alloc(NULL), @@ -91,6 +114,16 @@ bitmap_t::bitmap_t(bitmap_format format, int bpp, void *base, int width, int hei { } +/** + * @fn bitmap_t::bitmap_t(bitmap_format format, int bpp, bitmap_t &source, const rectangle &subrect) + * + * @brief Constructor. + * + * @param format Describes the format to use. + * @param bpp The bits per pixel. + * @param [in,out] source Source for the. + * @param subrect The subrect. + */ bitmap_t::bitmap_t(bitmap_format format, int bpp, bitmap_t &source, const rectangle &subrect) : m_alloc(NULL), @@ -109,10 +142,13 @@ bitmap_t::bitmap_t(bitmap_format format, int bpp, bitmap_t &source, const rectan assert(source.cliprect().contains(subrect)); } - -//------------------------------------------------- -// ~bitmap_t - basic destructor -//------------------------------------------------- +/** + * @fn bitmap_t::~bitmap_t() + * + * @brief ------------------------------------------------- + * ~bitmap_t - basic destructor + * -------------------------------------------------. + */ bitmap_t::~bitmap_t() { @@ -120,12 +156,19 @@ bitmap_t::~bitmap_t() reset(); } - -//------------------------------------------------- -// allocate -- (re)allocate memory for the bitmap -// at the given size, destroying anything that -// already exists -//------------------------------------------------- +/** + * @fn void bitmap_t::allocate(int width, int height, int xslop, int yslop) + * + * @brief ------------------------------------------------- + * allocate -- (re)allocate memory for the bitmap at the given size, destroying + * anything that already exists + * -------------------------------------------------. + * + * @param width The width. + * @param height The height. + * @param xslop The xslop. + * @param yslop The yslop. + */ void bitmap_t::allocate(int width, int height, int xslop, int yslop) { @@ -157,12 +200,19 @@ void bitmap_t::allocate(int width, int height, int xslop, int yslop) compute_base(xslop, yslop); } - -//------------------------------------------------- -// resize -- resize a bitmap, reusing existing -// memory if the new size is smaller than the -// current size -//------------------------------------------------- +/** + * @fn void bitmap_t::resize(int width, int height, int xslop, int yslop) + * + * @brief ------------------------------------------------- + * resize -- resize a bitmap, reusing existing memory if the new size is smaller than + * the current size + * -------------------------------------------------. + * + * @param width The width. + * @param height The height. + * @param xslop The xslop. + * @param yslop The yslop. + */ void bitmap_t::resize(int width, int height, int xslop, int yslop) { @@ -197,11 +247,13 @@ void bitmap_t::resize(int width, int height, int xslop, int yslop) compute_base(xslop, yslop); } - -//------------------------------------------------- -// reset -- reset to an invalid bitmap, deleting -// all allocated stuff -//------------------------------------------------- +/** + * @fn void bitmap_t::reset() + * + * @brief ------------------------------------------------- + * reset -- reset to an invalid bitmap, deleting all allocated stuff + * -------------------------------------------------. + */ void bitmap_t::reset() { @@ -218,11 +270,18 @@ void bitmap_t::reset() m_cliprect.set(0, -1, 0, -1); } - -//------------------------------------------------- -// wrap -- wrap an array of memory; the target -// bitmap does not own the memory -//------------------------------------------------- +/** + * @fn void bitmap_t::wrap(void *base, int width, int height, int rowpixels) + * + * @brief ------------------------------------------------- + * wrap -- wrap an array of memory; the target bitmap does not own the memory + * -------------------------------------------------. + * + * @param [in,out] base If non-null, the base. + * @param width The width. + * @param height The height. + * @param rowpixels The rowpixels. + */ void bitmap_t::wrap(void *base, int width, int height, int rowpixels) { @@ -237,12 +296,17 @@ void bitmap_t::wrap(void *base, int width, int height, int rowpixels) m_cliprect.set(0, m_width - 1, 0, m_height - 1); } - -//------------------------------------------------- -// wrap -- wrap a subrectangle of an existing -// bitmap by copying its fields; the target -// bitmap does not own the memory -//------------------------------------------------- +/** + * @fn void bitmap_t::wrap(const bitmap_t &source, const rectangle &subrect) + * + * @brief ------------------------------------------------- + * wrap -- wrap a subrectangle of an existing bitmap by copying its fields; the target + * bitmap does not own the memory + * -------------------------------------------------. + * + * @param source Source for the. + * @param subrect The subrect. + */ void bitmap_t::wrap(const bitmap_t &source, const rectangle &subrect) { @@ -262,11 +326,15 @@ void bitmap_t::wrap(const bitmap_t &source, const rectangle &subrect) m_cliprect.set(0, m_width - 1, 0, m_height - 1); } - -//------------------------------------------------- -// set_palette -- associate a palette with a -// bitmap -//------------------------------------------------- +/** + * @fn void bitmap_t::set_palette(palette_t *palette) + * + * @brief ------------------------------------------------- + * set_palette -- associate a palette with a bitmap + * -------------------------------------------------. + * + * @param [in,out] palette If non-null, the palette. + */ void bitmap_t::set_palette(palette_t *palette) { @@ -285,10 +353,16 @@ void bitmap_t::set_palette(palette_t *palette) } } - -//------------------------------------------------- -// fill -- fill a bitmap with a solid color -//------------------------------------------------- +/** + * @fn void bitmap_t::fill(UINT32 color, const rectangle &cliprect) + * + * @brief ------------------------------------------------- + * fill -- fill a bitmap with a solid color + * -------------------------------------------------. + * + * @param color The color. + * @param cliprect The cliprect. + */ void bitmap_t::fill(UINT32 color, const rectangle &cliprect) { diff --git a/src/lib/util/cdrom.c b/src/lib/util/cdrom.c index 6655418583a..40f3caf4190 100644 --- a/src/lib/util/cdrom.c +++ b/src/lib/util/cdrom.c @@ -28,11 +28,41 @@ DEBUGGING ***************************************************************************/ +/** @brief The verbose. */ #define VERBOSE (0) #if VERBOSE + +/** + * @def LOG(x) do + * + * @brief A macro that defines log. + * + * @param x The void to process. + */ + #define LOG(x) do { if (VERBOSE) logerror x; } while (0) + +/** + * @fn void CLIB_DECL logerror(const char *text, ...) ATTR_PRINTF(1,2); + * + * @brief Logerrors the given text. + * + * @param text The text. + * + * @return A CLIB_DECL. + */ + void CLIB_DECL logerror(const char *text, ...) ATTR_PRINTF(1,2); #else + +/** + * @def LOG(x); + * + * @brief A macro that defines log. + * + * @param x The void to process. + */ + #define LOG(x) #endif @@ -42,18 +72,27 @@ void CLIB_DECL logerror(const char *text, ...) ATTR_PRINTF(1,2); CONSTANTS ***************************************************************************/ -const int SYNC_OFFSET = 0x000; // offset within sector -const int SYNC_NUM_BYTES = 12; // 12 bytes +/** @brief offset within sector. */ +const int SYNC_OFFSET = 0x000; +/** @brief 12 bytes. */ +const int SYNC_NUM_BYTES = 12; -const int MODE_OFFSET = 0x00f; // offset within sector +/** @brief offset within sector. */ +const int MODE_OFFSET = 0x00f; -const int ECC_P_OFFSET = 0x81c; // offset within sector -const int ECC_P_NUM_BYTES = 86; // 2 lots of 86 -const int ECC_P_COMP = 24; // 24 bytes each +/** @brief offset within sector. */ +const int ECC_P_OFFSET = 0x81c; +/** @brief 2 lots of 86. */ +const int ECC_P_NUM_BYTES = 86; +/** @brief 24 bytes each. */ +const int ECC_P_COMP = 24; +/** @brief The ECC q offset. */ const int ECC_Q_OFFSET = ECC_P_OFFSET + 2 * ECC_P_NUM_BYTES; -const int ECC_Q_NUM_BYTES = 52; // 2 lots of 52 -const int ECC_Q_COMP = 43; // 43 bytes each +/** @brief 2 lots of 52. */ +const int ECC_Q_NUM_BYTES = 52; +/** @brief 43 bytes each. */ +const int ECC_Q_COMP = 43; @@ -61,11 +100,21 @@ const int ECC_Q_COMP = 43; // 43 bytes each TYPE DEFINITIONS ***************************************************************************/ +/** + * @struct cdrom_file + * + * @brief A cdrom file. + */ + struct cdrom_file { + /** @brief The chd. */ chd_file * chd; /* CHD file */ + /** @brief The cdtoc. */ cdrom_toc cdtoc; /* TOC for the CD */ + /** @brief Information describing the track. */ chdcd_track_input_info track_info; /* track info */ + /** @brief The fhandle[ CD maximum tracks]. */ core_file * fhandle[CD_MAX_TRACKS];/* file handle */ }; @@ -80,6 +129,18 @@ struct cdrom_file and the track number -------------------------------------------------*/ +/** + * @fn INLINE UINT32 physical_to_chd_lba(cdrom_file *file, UINT32 physlba, UINT32 &tracknum) + * + * @brief Physical to chd lba. + * + * @param [in,out] file If non-null, the file. + * @param physlba The physlba. + * @param [in,out] tracknum The tracknum. + * + * @return An UINT32. + */ + INLINE UINT32 physical_to_chd_lba(cdrom_file *file, UINT32 physlba, UINT32 &tracknum) { UINT32 chdlba; @@ -102,6 +163,18 @@ INLINE UINT32 physical_to_chd_lba(cdrom_file *file, UINT32 physlba, UINT32 &trac and the track number -------------------------------------------------*/ +/** + * @fn INLINE UINT32 logical_to_chd_lba(cdrom_file *file, UINT32 loglba, UINT32 &tracknum) + * + * @brief Logical to chd lba. + * + * @param [in,out] file If non-null, the file. + * @param loglba The loglba. + * @param [in,out] tracknum The tracknum. + * + * @return An UINT32. + */ + INLINE UINT32 logical_to_chd_lba(cdrom_file *file, UINT32 loglba, UINT32 &tracknum) { UINT32 chdlba, physlba; @@ -134,6 +207,16 @@ INLINE UINT32 logical_to_chd_lba(cdrom_file *file, UINT32 loglba, UINT32 &trackn BASE FUNCTIONALITY ***************************************************************************/ +/** + * @fn cdrom_file *cdrom_open(const char *inputfile) + * + * @brief Queries if a given cdrom open. + * + * @param inputfile The inputfile. + * + * @return null if it fails, else a cdrom_file*. + */ + cdrom_file *cdrom_open(const char *inputfile) { int i; @@ -220,6 +303,16 @@ cdrom_file *cdrom_open(const char *inputfile) already-opened CHD file -------------------------------------------------*/ +/** + * @fn cdrom_file *cdrom_open(chd_file *chd) + * + * @brief Queries if a given cdrom open. + * + * @param [in,out] chd If non-null, the chd. + * + * @return null if it fails, else a cdrom_file*. + */ + cdrom_file *cdrom_open(chd_file *chd) { int i; @@ -308,6 +401,14 @@ cdrom_file *cdrom_open(chd_file *chd) cdrom_close - "close" a CD-ROM file -------------------------------------------------*/ +/** + * @fn void cdrom_close(cdrom_file *file) + * + * @brief Cdrom close. + * + * @param [in,out] file If non-null, the file. + */ + void cdrom_close(cdrom_file *file) { if (file == NULL) @@ -330,6 +431,22 @@ void cdrom_close(cdrom_file *file) CORE READ ACCESS ***************************************************************************/ +/** + * @fn chd_error read_partial_sector(cdrom_file *file, void *dest, UINT32 lbasector, UINT32 chdsector, UINT32 tracknum, UINT32 startoffs, UINT32 length) + * + * @brief Reads partial sector. + * + * @param [in,out] file If non-null, the file. + * @param [in,out] dest If non-null, destination for the. + * @param lbasector The lbasector. + * @param chdsector The chdsector. + * @param tracknum The tracknum. + * @param startoffs The startoffs. + * @param length The length. + * + * @return The partial sector. + */ + chd_error read_partial_sector(cdrom_file *file, void *dest, UINT32 lbasector, UINT32 chdsector, UINT32 tracknum, UINT32 startoffs, UINT32 length) { chd_error result = CHDERR_NONE; @@ -388,6 +505,20 @@ chd_error read_partial_sector(cdrom_file *file, void *dest, UINT32 lbasector, UI from a CD-ROM -------------------------------------------------*/ +/** + * @fn UINT32 cdrom_read_data(cdrom_file *file, UINT32 lbasector, void *buffer, UINT32 datatype, bool phys) + * + * @brief Cdrom read data. + * + * @param [in,out] file If non-null, the file. + * @param lbasector The lbasector. + * @param [in,out] buffer If non-null, the buffer. + * @param datatype The datatype. + * @param phys true to physical. + * + * @return An UINT32. + */ + UINT32 cdrom_read_data(cdrom_file *file, UINT32 lbasector, void *buffer, UINT32 datatype, bool phys) { if (file == NULL) @@ -460,6 +591,19 @@ UINT32 cdrom_read_data(cdrom_file *file, UINT32 lbasector, void *buffer, UINT32 a sector -------------------------------------------------*/ +/** + * @fn UINT32 cdrom_read_subcode(cdrom_file *file, UINT32 lbasector, void *buffer, bool phys) + * + * @brief Cdrom read subcode. + * + * @param [in,out] file If non-null, the file. + * @param lbasector The lbasector. + * @param [in,out] buffer If non-null, the buffer. + * @param phys true to physical. + * + * @return An UINT32. + */ + UINT32 cdrom_read_subcode(cdrom_file *file, UINT32 lbasector, void *buffer, bool phys) { if (file == NULL) @@ -497,6 +641,17 @@ UINT32 cdrom_read_subcode(cdrom_file *file, UINT32 lbasector, void *buffer, bool for a physical frame number -------------------------------------------------*/ +/** + * @fn UINT32 cdrom_get_track(cdrom_file *file, UINT32 frame) + * + * @brief Cdrom get track. + * + * @param [in,out] file If non-null, the file. + * @param frame The frame. + * + * @return An UINT32. + */ + UINT32 cdrom_get_track(cdrom_file *file, UINT32 frame) { UINT32 track = 0; @@ -516,6 +671,17 @@ UINT32 cdrom_get_track(cdrom_file *file, UINT32 frame) that a track starts at -------------------------------------------------*/ +/** + * @fn UINT32 cdrom_get_track_start(cdrom_file *file, UINT32 track) + * + * @brief Cdrom get track start. + * + * @param [in,out] file If non-null, the file. + * @param track The track. + * + * @return An UINT32. + */ + UINT32 cdrom_get_track_start(cdrom_file *file, UINT32 track) { if (file == NULL) @@ -533,6 +699,17 @@ UINT32 cdrom_get_track_start(cdrom_file *file, UINT32 track) physical frame number that a track starts at -------------------------------------------------*/ +/** + * @fn UINT32 cdrom_get_track_start_phys(cdrom_file *file, UINT32 track) + * + * @brief Cdrom get track start physical. + * + * @param [in,out] file If non-null, the file. + * @param track The track. + * + * @return An UINT32. + */ + UINT32 cdrom_get_track_start_phys(cdrom_file *file, UINT32 track) { if (file == NULL) @@ -554,6 +731,16 @@ UINT32 cdrom_get_track_start_phys(cdrom_file *file, UINT32 track) number -------------------------------------------------*/ +/** + * @fn int cdrom_get_last_track(cdrom_file *file) + * + * @brief Cdrom get last track. + * + * @param [in,out] file If non-null, the file. + * + * @return An int. + */ + int cdrom_get_last_track(cdrom_file *file) { if (file == NULL) @@ -568,6 +755,17 @@ int cdrom_get_last_track(cdrom_file *file) for a track -------------------------------------------------*/ +/** + * @fn int cdrom_get_adr_control(cdrom_file *file, int track) + * + * @brief Cdrom get address control. + * + * @param [in,out] file If non-null, the file. + * @param track The track. + * + * @return An int. + */ + int cdrom_get_adr_control(cdrom_file *file, int track) { if (file == NULL) @@ -586,6 +784,17 @@ int cdrom_get_adr_control(cdrom_file *file, int track) cdrom_get_track_type - return the track type -------------------------------------------------*/ +/** + * @fn int cdrom_get_track_type(cdrom_file *file, int track) + * + * @brief Cdrom get track type. + * + * @param [in,out] file If non-null, the file. + * @param track The track. + * + * @return An int. + */ + int cdrom_get_track_type(cdrom_file *file, int track) { if (file == NULL) @@ -600,6 +809,16 @@ int cdrom_get_track_type(cdrom_file *file, int track) CD-ROM -------------------------------------------------*/ +/** + * @fn const cdrom_toc *cdrom_get_toc(cdrom_file *file) + * + * @brief Cdrom get TOC. + * + * @param [in,out] file If non-null, the file. + * + * @return null if it fails, else a cdrom_toc*. + */ + const cdrom_toc *cdrom_get_toc(cdrom_file *file) { if (file == NULL) @@ -620,6 +839,16 @@ const cdrom_toc *cdrom_get_toc(cdrom_file *file) and track data size -------------------------------------------------*/ +/** + * @fn static void cdrom_get_info_from_type_string(const char *typestring, UINT32 *trktype, UINT32 *datasize) + * + * @brief Cdrom get information from type string. + * + * @param typestring The typestring. + * @param [in,out] trktype If non-null, the trktype. + * @param [in,out] datasize If non-null, the datasize. + */ + static void cdrom_get_info_from_type_string(const char *typestring, UINT32 *trktype, UINT32 *datasize) { if (!strcmp(typestring, "MODE1")) @@ -705,6 +934,15 @@ static void cdrom_get_info_from_type_string(const char *typestring, UINT32 *trkt and track data size -------------------------------------------------*/ +/** + * @fn void cdrom_convert_type_string_to_track_info(const char *typestring, cdrom_track_info *info) + * + * @brief Cdrom convert type string to track information. + * + * @param typestring The typestring. + * @param [in,out] info If non-null, the information. + */ + void cdrom_convert_type_string_to_track_info(const char *typestring, cdrom_track_info *info) { cdrom_get_info_from_type_string(typestring, &info->trktype, &info->datasize); @@ -716,6 +954,15 @@ void cdrom_convert_type_string_to_track_info(const char *typestring, cdrom_track and pregap data size -------------------------------------------------*/ +/** + * @fn void cdrom_convert_type_string_to_pregap_info(const char *typestring, cdrom_track_info *info) + * + * @brief Cdrom convert type string to pregap information. + * + * @param typestring The typestring. + * @param [in,out] info If non-null, the information. + */ + void cdrom_convert_type_string_to_pregap_info(const char *typestring, cdrom_track_info *info) { cdrom_get_info_from_type_string(typestring, &info->pgtype, &info->pgdatasize); @@ -727,6 +974,15 @@ void cdrom_convert_type_string_to_pregap_info(const char *typestring, cdrom_trac and track subcode data size -------------------------------------------------*/ +/** + * @fn void cdrom_convert_subtype_string_to_track_info(const char *typestring, cdrom_track_info *info) + * + * @brief Cdrom convert subtype string to track information. + * + * @param typestring The typestring. + * @param [in,out] info If non-null, the information. + */ + void cdrom_convert_subtype_string_to_track_info(const char *typestring, cdrom_track_info *info) { if (!strcmp(typestring, "RW")) @@ -747,6 +1003,15 @@ void cdrom_convert_subtype_string_to_track_info(const char *typestring, cdrom_tr and track subcode data size -------------------------------------------------*/ +/** + * @fn void cdrom_convert_subtype_string_to_pregap_info(const char *typestring, cdrom_track_info *info) + * + * @brief Cdrom convert subtype string to pregap information. + * + * @param typestring The typestring. + * @param [in,out] info If non-null, the information. + */ + void cdrom_convert_subtype_string_to_pregap_info(const char *typestring, cdrom_track_info *info) { if (!strcmp(typestring, "RW")) @@ -766,6 +1031,16 @@ void cdrom_convert_subtype_string_to_pregap_info(const char *typestring, cdrom_t associated with the given type -------------------------------------------------*/ +/** + * @fn const char *cdrom_get_type_string(UINT32 trktype) + * + * @brief Cdrom get type string. + * + * @param trktype The trktype. + * + * @return null if it fails, else a char*. + */ + const char *cdrom_get_type_string(UINT32 trktype) { switch (trktype) @@ -788,6 +1063,16 @@ const char *cdrom_get_type_string(UINT32 trktype) associated with the given subcode type -------------------------------------------------*/ +/** + * @fn const char *cdrom_get_subtype_string(UINT32 subtype) + * + * @brief Cdrom get subtype string. + * + * @param subtype The subtype. + * + * @return null if it fails, else a char*. + */ + const char *cdrom_get_subtype_string(UINT32 subtype) { switch (subtype) @@ -809,6 +1094,17 @@ const char *cdrom_get_subtype_string(UINT32 subtype) TOC structure -------------------------------------------------*/ +/** + * @fn chd_error cdrom_parse_metadata(chd_file *chd, cdrom_toc *toc) + * + * @brief Cdrom parse metadata. + * + * @param [in,out] chd If non-null, the chd. + * @param [in,out] toc If non-null, the TOC. + * + * @return A chd_error. + */ + chd_error cdrom_parse_metadata(chd_file *chd, cdrom_toc *toc) { std::string metadata; @@ -975,6 +1271,17 @@ chd_error cdrom_parse_metadata(chd_file *chd, cdrom_toc *toc) cdrom_write_metadata - write metadata -------------------------------------------------*/ +/** + * @fn chd_error cdrom_write_metadata(chd_file *chd, const cdrom_toc *toc) + * + * @brief Cdrom write metadata. + * + * @param [in,out] chd If non-null, the chd. + * @param toc The TOC. + * + * @return A chd_error. + */ + chd_error cdrom_write_metadata(chd_file *chd, const cdrom_toc *toc) { chd_error err; @@ -1019,11 +1326,11 @@ chd_error cdrom_write_metadata(chd_file *chd, const cdrom_toc *toc) return CHDERR_NONE; } - -//------------------------------------------------- -// ECC lookup tables -// pre-calculated tables for ECC data calcs -//------------------------------------------------- +/** + * @brief ------------------------------------------------- + * ECC lookup tables pre-calculated tables for ECC data calcs + * -------------------------------------------------. + */ static const UINT8 ecclow[256] = { @@ -1045,6 +1352,7 @@ static const UINT8 ecclow[256] = 0xfd, 0xff, 0xf9, 0xfb, 0xf5, 0xf7, 0xf1, 0xf3, 0xed, 0xef, 0xe9, 0xeb, 0xe5, 0xe7, 0xe1, 0xe3 }; +/** @brief The ecchigh[ 256]. */ static const UINT8 ecchigh[256] = { 0x00, 0xf4, 0xf5, 0x01, 0xf7, 0x03, 0x02, 0xf6, 0xf3, 0x07, 0x06, 0xf2, 0x04, 0xf0, 0xf1, 0x05, @@ -1065,13 +1373,12 @@ static const UINT8 ecchigh[256] = 0x50, 0xa4, 0xa5, 0x51, 0xa7, 0x53, 0x52, 0xa6, 0xa3, 0x57, 0x56, 0xa2, 0x54, 0xa0, 0xa1, 0x55 }; - -//------------------------------------------------- -// poffsets - each row represents the addresses -// used to calculate a byte of the ECC P data -// 86 (*2) ECC P bytes, 24 values represented by -// each -//------------------------------------------------- +/** + * @brief ------------------------------------------------- + * poffsets - each row represents the addresses used to calculate a byte of the ECC P + * data 86 (*2) ECC P bytes, 24 values represented by each + * -------------------------------------------------. + */ static const UINT16 poffsets[ECC_P_NUM_BYTES][ECC_P_COMP] = { @@ -1163,13 +1470,12 @@ static const UINT16 poffsets[ECC_P_NUM_BYTES][ECC_P_COMP] = { 0x055,0x0ab,0x101,0x157,0x1ad,0x203,0x259,0x2af,0x305,0x35b,0x3b1,0x407,0x45d,0x4b3,0x509,0x55f,0x5b5,0x60b,0x661,0x6b7,0x70d,0x763,0x7b9,0x80f } }; - -//------------------------------------------------- -// qoffsets - each row represents the addresses -// used to calculate a byte of the ECC Q data -// 52 (*2) ECC Q bytes, 43 values represented by -// each -//------------------------------------------------- +/** + * @brief ------------------------------------------------- + * qoffsets - each row represents the addresses used to calculate a byte of the ECC Q + * data 52 (*2) ECC Q bytes, 43 values represented by each + * -------------------------------------------------. + */ static const UINT16 qoffsets[ECC_Q_NUM_BYTES][ECC_Q_COMP] = { @@ -1240,11 +1546,19 @@ inline UINT8 ecc_source_byte(const UINT8 *sector, UINT32 offset) return (sector[MODE_OFFSET] == 2 && offset < 4) ? 0x00 : sector[SYNC_OFFSET + SYNC_NUM_BYTES + offset]; } - -//------------------------------------------------- -// ecc_compute_bytes - calculate an ECC value -// (P or Q) -//------------------------------------------------- +/** + * @fn void ecc_compute_bytes(const UINT8 *sector, const UINT16 *row, int rowlen, UINT8 &val1, UINT8 &val2) + * + * @brief ------------------------------------------------- + * ecc_compute_bytes - calculate an ECC value (P or Q) + * -------------------------------------------------. + * + * @param sector The sector. + * @param row The row. + * @param rowlen The rowlen. + * @param [in,out] val1 The first value. + * @param [in,out] val2 The second value. + */ void ecc_compute_bytes(const UINT8 *sector, const UINT16 *row, int rowlen, UINT8 &val1, UINT8 &val2) { @@ -1259,11 +1573,17 @@ void ecc_compute_bytes(const UINT8 *sector, const UINT16 *row, int rowlen, UINT8 val2 ^= val1; } - -//------------------------------------------------- -// ecc_verify - verify the P and Q ECC codes in -// a sector -//------------------------------------------------- +/** + * @fn bool ecc_verify(const UINT8 *sector) + * + * @brief ------------------------------------------------- + * ecc_verify - verify the P and Q ECC codes in a sector + * -------------------------------------------------. + * + * @param sector The sector. + * + * @return true if it succeeds, false if it fails. + */ bool ecc_verify(const UINT8 *sector) { @@ -1287,11 +1607,16 @@ bool ecc_verify(const UINT8 *sector) return true; } - -//------------------------------------------------- -// ecc_generate - generate the P and Q ECC codes -// for a sector, overwriting any existing codes -//------------------------------------------------- +/** + * @fn void ecc_generate(UINT8 *sector) + * + * @brief ------------------------------------------------- + * ecc_generate - generate the P and Q ECC codes for a sector, overwriting any + * existing codes + * -------------------------------------------------. + * + * @param [in,out] sector If non-null, the sector. + */ void ecc_generate(UINT8 *sector) { @@ -1304,11 +1629,15 @@ void ecc_generate(UINT8 *sector) ecc_compute_bytes(sector, qoffsets[byte], ECC_Q_COMP, sector[ECC_Q_OFFSET + byte], sector[ECC_Q_OFFSET + ECC_Q_NUM_BYTES + byte]); } - -//------------------------------------------------- -// ecc_clear - erase the ECC P and Q cods to 0 -// within a sector -//------------------------------------------------- +/** + * @fn void ecc_clear(UINT8 *sector) + * + * @brief ------------------------------------------------- + * ecc_clear - erase the ECC P and Q cods to 0 within a sector + * -------------------------------------------------. + * + * @param [in,out] sector If non-null, the sector. + */ void ecc_clear(UINT8 *sector) { diff --git a/src/lib/util/chd.c b/src/lib/util/chd.c index 3dd088c0121..f9bdf179f8a 100644 --- a/src/lib/util/chd.c +++ b/src/lib/util/chd.c @@ -57,23 +57,37 @@ enum // V5 compression types enum { + ///< codec #0 // these types are live when running - COMPRESSION_TYPE_0 = 0, // codec #0 - COMPRESSION_TYPE_1 = 1, // codec #1 - COMPRESSION_TYPE_2 = 2, // codec #2 - COMPRESSION_TYPE_3 = 3, // codec #3 - COMPRESSION_NONE = 4, // no compression; implicit length = hunkbytes - COMPRESSION_SELF = 5, // same as another block in this chd - COMPRESSION_PARENT = 6, // same as a hunk's worth of units in the parent chd - + COMPRESSION_TYPE_0 = 0, + ///< codec #1 + COMPRESSION_TYPE_1 = 1, + ///< codec #2 + COMPRESSION_TYPE_2 = 2, + ///< codec #3 + COMPRESSION_TYPE_3 = 3, + ///< no compression; implicit length = hunkbytes + COMPRESSION_NONE = 4, + ///< same as another block in this chd + COMPRESSION_SELF = 5, + ///< same as a hunk's worth of units in the parent chd + COMPRESSION_PARENT = 6, + + ///< start of small RLE run (4-bit length) // these additional pseudo-types are used for compressed encodings: - COMPRESSION_RLE_SMALL, // start of small RLE run (4-bit length) - COMPRESSION_RLE_LARGE, // start of large RLE run (8-bit length) - COMPRESSION_SELF_0, // same as the last COMPRESSION_SELF block - COMPRESSION_SELF_1, // same as the last COMPRESSION_SELF block + 1 - COMPRESSION_PARENT_SELF, // same block in the parent - COMPRESSION_PARENT_0, // same as the last COMPRESSION_PARENT block - COMPRESSION_PARENT_1 // same as the last COMPRESSION_PARENT block + 1 + COMPRESSION_RLE_SMALL, + ///< start of large RLE run (8-bit length) + COMPRESSION_RLE_LARGE, + ///< same as the last COMPRESSION_SELF block + COMPRESSION_SELF_0, + ///< same as the last COMPRESSION_SELF block + 1 + COMPRESSION_SELF_1, + ///< same block in the parent + COMPRESSION_PARENT_SELF, + ///< same as the last COMPRESSION_PARENT block + COMPRESSION_PARENT_0, + ///< same as the last COMPRESSION_PARENT block + 1 + COMPRESSION_PARENT_1 }; @@ -265,9 +279,13 @@ inline UINT8 chd_file::bits_for_value(UINT64 value) // CHD FILE MANAGEMENT //************************************************************************** -//------------------------------------------------- -// chd_file - constructor -//------------------------------------------------- +/** + * @fn chd_file::chd_file() + * + * @brief ------------------------------------------------- + * chd_file - constructor + * -------------------------------------------------. + */ chd_file::chd_file() : m_file(NULL), @@ -278,10 +296,13 @@ chd_file::chd_file() close(); } - -//------------------------------------------------- -// ~chd_file - destructor -//------------------------------------------------- +/** + * @fn chd_file::~chd_file() + * + * @brief ------------------------------------------------- + * ~chd_file - destructor + * -------------------------------------------------. + */ chd_file::~chd_file() { @@ -289,10 +310,15 @@ chd_file::~chd_file() close(); } - -//------------------------------------------------- -// sha1 - return our SHA1 value -//------------------------------------------------- +/** + * @fn sha1_t chd_file::sha1() + * + * @brief ------------------------------------------------- + * sha1 - return our SHA1 value + * -------------------------------------------------. + * + * @return A sha1_t. + */ sha1_t chd_file::sha1() { @@ -310,10 +336,18 @@ sha1_t chd_file::sha1() } } - -//------------------------------------------------- -// raw_sha1 - return our raw SHA1 value -//------------------------------------------------- +/** + * @fn sha1_t chd_file::raw_sha1() + * + * @brief ------------------------------------------------- + * raw_sha1 - return our raw SHA1 value + * -------------------------------------------------. + * + * @exception CHDERR_UNSUPPORTED_VERSION Thrown when a chderr unsupported version error + * condition occurs. + * + * @return A sha1_t. + */ sha1_t chd_file::raw_sha1() { @@ -335,10 +369,18 @@ sha1_t chd_file::raw_sha1() } } - -//------------------------------------------------- -// parent_sha1 - return our parent's SHA1 value -//------------------------------------------------- +/** + * @fn sha1_t chd_file::parent_sha1() + * + * @brief ------------------------------------------------- + * parent_sha1 - return our parent's SHA1 value + * -------------------------------------------------. + * + * @exception CHDERR_UNSUPPORTED_VERSION Thrown when a chderr unsupported version error + * condition occurs. + * + * @return A sha1_t. + */ sha1_t chd_file::parent_sha1() { @@ -360,11 +402,19 @@ sha1_t chd_file::parent_sha1() } } - -//------------------------------------------------- -// hunk_info - return information about this -// hunk -//------------------------------------------------- +/** + * @fn chd_error chd_file::hunk_info(UINT32 hunknum, chd_codec_type &compressor, UINT32 &compbytes) + * + * @brief ------------------------------------------------- + * hunk_info - return information about this hunk + * -------------------------------------------------. + * + * @param hunknum The hunknum. + * @param [in,out] compressor The compressor. + * @param [in,out] compbytes The compbytes. + * + * @return A chd_error. + */ chd_error chd_file::hunk_info(UINT32 hunknum, chd_codec_type &compressor, UINT32 &compbytes) { @@ -463,10 +513,15 @@ chd_error chd_file::hunk_info(UINT32 hunknum, chd_codec_type &compressor, UINT32 return CHDERR_NONE; } - -//------------------------------------------------- -// set_raw_sha1 - set our SHA1 values -//------------------------------------------------- +/** + * @fn void chd_file::set_raw_sha1(sha1_t rawdata) + * + * @brief ------------------------------------------------- + * set_raw_sha1 - set our SHA1 values + * -------------------------------------------------. + * + * @param rawdata The rawdata. + */ void chd_file::set_raw_sha1(sha1_t rawdata) { @@ -484,10 +539,17 @@ void chd_file::set_raw_sha1(sha1_t rawdata) metadata_update_hash(); } - -//------------------------------------------------- -// set_parent_sha1 - set the parent SHA1 value -//------------------------------------------------- +/** + * @fn void chd_file::set_parent_sha1(sha1_t parent) + * + * @brief ------------------------------------------------- + * set_parent_sha1 - set the parent SHA1 value + * -------------------------------------------------. + * + * @exception CHDERR_INVALID_FILE Thrown when a chderr invalid file error condition occurs. + * + * @param parent The parent. + */ void chd_file::set_parent_sha1(sha1_t parent) { @@ -504,11 +566,21 @@ void chd_file::set_parent_sha1(sha1_t parent) file_write(m_parentsha1_offset, rawbuf, sizeof(rawbuf)); } - -//------------------------------------------------- -// create - create a new file with no parent -// using an existing opened file handle -//------------------------------------------------- +/** + * @fn chd_error chd_file::create(core_file &file, UINT64 logicalbytes, UINT32 hunkbytes, UINT32 unitbytes, chd_codec_type compression[4]) + * + * @brief ------------------------------------------------- + * create - create a new file with no parent using an existing opened file handle + * -------------------------------------------------. + * + * @param [in,out] file The file. + * @param logicalbytes The logicalbytes. + * @param hunkbytes The hunkbytes. + * @param unitbytes The unitbytes. + * @param compression The compression. + * + * @return A chd_error. + */ chd_error chd_file::create(core_file &file, UINT64 logicalbytes, UINT32 hunkbytes, UINT32 unitbytes, chd_codec_type compression[4]) { @@ -529,11 +601,21 @@ chd_error chd_file::create(core_file &file, UINT64 logicalbytes, UINT32 hunkbyte return create_common(); } - -//------------------------------------------------- -// create - create a new file with a parent -// using an existing opened file handle -//------------------------------------------------- +/** + * @fn chd_error chd_file::create(core_file &file, UINT64 logicalbytes, UINT32 hunkbytes, chd_codec_type compression[4], chd_file &parent) + * + * @brief ------------------------------------------------- + * create - create a new file with a parent using an existing opened file handle + * -------------------------------------------------. + * + * @param [in,out] file The file. + * @param logicalbytes The logicalbytes. + * @param hunkbytes The hunkbytes. + * @param compression The compression. + * @param [in,out] parent The parent. + * + * @return A chd_error. + */ chd_error chd_file::create(core_file &file, UINT64 logicalbytes, UINT32 hunkbytes, chd_codec_type compression[4], chd_file &parent) { @@ -554,11 +636,21 @@ chd_error chd_file::create(core_file &file, UINT64 logicalbytes, UINT32 hunkbyte return create_common(); } - -//------------------------------------------------- -// create - create a new file with no parent -// using a filename -//------------------------------------------------- +/** + * @fn chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hunkbytes, UINT32 unitbytes, chd_codec_type compression[4]) + * + * @brief ------------------------------------------------- + * create - create a new file with no parent using a filename + * -------------------------------------------------. + * + * @param filename Filename of the file. + * @param logicalbytes The logicalbytes. + * @param hunkbytes The hunkbytes. + * @param unitbytes The unitbytes. + * @param compression The compression. + * + * @return A chd_error. + */ chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hunkbytes, UINT32 unitbytes, chd_codec_type compression[4]) { @@ -585,11 +677,21 @@ chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hun return chderr; } - -//------------------------------------------------- -// create - create a new file with a parent -// using a filename -//------------------------------------------------- +/** + * @fn chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hunkbytes, chd_codec_type compression[4], chd_file &parent) + * + * @brief ------------------------------------------------- + * create - create a new file with a parent using a filename + * -------------------------------------------------. + * + * @param filename Filename of the file. + * @param logicalbytes The logicalbytes. + * @param hunkbytes The hunkbytes. + * @param compression The compression. + * @param [in,out] parent The parent. + * + * @return A chd_error. + */ chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hunkbytes, chd_codec_type compression[4], chd_file &parent) { @@ -616,11 +718,19 @@ chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hun return chderr; } - -//------------------------------------------------- -// open - open an existing file for read or -// read/write -//------------------------------------------------- +/** + * @fn chd_error chd_file::open(const char *filename, bool writeable, chd_file *parent) + * + * @brief ------------------------------------------------- + * open - open an existing file for read or read/write + * -------------------------------------------------. + * + * @param filename Filename of the file. + * @param writeable true if writeable. + * @param [in,out] parent If non-null, the parent. + * + * @return A chd_error. + */ chd_error chd_file::open(const char *filename, bool writeable, chd_file *parent) { @@ -648,11 +758,19 @@ chd_error chd_file::open(const char *filename, bool writeable, chd_file *parent) return err; } - -//------------------------------------------------- -// open - open an existing file for read or -// read/write -//------------------------------------------------- +/** + * @fn chd_error chd_file::open(core_file &file, bool writeable, chd_file *parent) + * + * @brief ------------------------------------------------- + * open - open an existing file for read or read/write + * -------------------------------------------------. + * + * @param [in,out] file The file. + * @param writeable true if writeable. + * @param [in,out] parent If non-null, the parent. + * + * @return A chd_error. + */ chd_error chd_file::open(core_file &file, bool writeable, chd_file *parent) { @@ -667,10 +785,13 @@ chd_error chd_file::open(core_file &file, bool writeable, chd_file *parent) return open_common(writeable); } - -//------------------------------------------------- -// close - close a CHD file for access -//------------------------------------------------- +/** + * @fn void chd_file::close() + * + * @brief ------------------------------------------------- + * close - close a CHD file for access + * -------------------------------------------------. + */ void chd_file::close() { @@ -719,10 +840,28 @@ void chd_file::close() m_cachehunk = ~0; } - -//------------------------------------------------- -// read - read a single hunk from the CHD file -//------------------------------------------------- +/** + * @fn chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer) + * + * @brief ------------------------------------------------- + * read - read a single hunk from the CHD file + * -------------------------------------------------. + * + * @exception CHDERR_NOT_OPEN Thrown when a chderr not open error condition occurs. + * @exception CHDERR_HUNK_OUT_OF_RANGE Thrown when a chderr hunk out of range error + * condition occurs. + * @exception CHDERR_DECOMPRESSION_ERROR Thrown when a chderr decompression error error + * condition occurs. + * @exception CHDERR_REQUIRES_PARENT Thrown when a chderr requires parent error condition + * occurs. + * @exception CHDERR_READ_ERROR Thrown when a chderr read error error condition + * occurs. + * + * @param hunknum The hunknum. + * @param [in,out] buffer If non-null, the buffer. + * + * @return The hunk. + */ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer) { @@ -850,10 +989,24 @@ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer) } } - -//------------------------------------------------- -// write - write a single hunk to the CHD file -//------------------------------------------------- +/** + * @fn chd_error chd_file::write_hunk(UINT32 hunknum, const void *buffer) + * + * @brief ------------------------------------------------- + * write - write a single hunk to the CHD file + * -------------------------------------------------. + * + * @exception CHDERR_NOT_OPEN Thrown when a chderr not open error condition occurs. + * @exception CHDERR_HUNK_OUT_OF_RANGE Thrown when a chderr hunk out of range error + * condition occurs. + * @exception CHDERR_FILE_NOT_WRITEABLE Thrown when a chderr file not writeable error + * condition occurs. + * + * @param hunknum The hunknum. + * @param buffer The buffer. + * + * @return A chd_error. + */ chd_error chd_file::write_hunk(UINT32 hunknum, const void *buffer) { @@ -922,33 +1075,58 @@ chd_error chd_file::write_hunk(UINT32 hunknum, const void *buffer) } } - -//------------------------------------------------- -// read_units - read the given number of units -// from the CHD -//------------------------------------------------- +/** + * @fn chd_error chd_file::read_units(UINT64 unitnum, void *buffer, UINT32 count) + * + * @brief ------------------------------------------------- + * read_units - read the given number of units from the CHD + * -------------------------------------------------. + * + * @param unitnum The unitnum. + * @param [in,out] buffer If non-null, the buffer. + * @param count Number of. + * + * @return The units. + */ chd_error chd_file::read_units(UINT64 unitnum, void *buffer, UINT32 count) { return read_bytes(unitnum * UINT64(m_unitbytes), buffer, count * m_unitbytes); } - -//------------------------------------------------- -// write_units - write the given number of units -// to the CHD -//------------------------------------------------- +/** + * @fn chd_error chd_file::write_units(UINT64 unitnum, const void *buffer, UINT32 count) + * + * @brief ------------------------------------------------- + * write_units - write the given number of units to the CHD + * -------------------------------------------------. + * + * @param unitnum The unitnum. + * @param buffer The buffer. + * @param count Number of. + * + * @return A chd_error. + */ chd_error chd_file::write_units(UINT64 unitnum, const void *buffer, UINT32 count) { return write_bytes(unitnum * UINT64(m_unitbytes), buffer, count * m_unitbytes); } - -//------------------------------------------------- -// read_bytes - read from the CHD at a byte level, -// using the cache to handle partial hunks -//------------------------------------------------- +/** + * @fn chd_error chd_file::read_bytes(UINT64 offset, void *buffer, UINT32 bytes) + * + * @brief ------------------------------------------------- + * read_bytes - read from the CHD at a byte level, using the cache to handle partial + * hunks + * -------------------------------------------------. + * + * @param offset The offset. + * @param [in,out] buffer If non-null, the buffer. + * @param bytes The bytes. + * + * @return The bytes. + */ chd_error chd_file::read_bytes(UINT64 offset, void *buffer, UINT32 bytes) { @@ -988,11 +1166,20 @@ chd_error chd_file::read_bytes(UINT64 offset, void *buffer, UINT32 bytes) return CHDERR_NONE; } - -//------------------------------------------------- -// write_bytes - write to the CHD at a byte level, -// using the cache to handle partial hunks -//------------------------------------------------- +/** + * @fn chd_error chd_file::write_bytes(UINT64 offset, const void *buffer, UINT32 bytes) + * + * @brief ------------------------------------------------- + * write_bytes - write to the CHD at a byte level, using the cache to handle partial + * hunks + * -------------------------------------------------. + * + * @param offset The offset. + * @param buffer The buffer. + * @param bytes The bytes. + * + * @return A chd_error. + */ chd_error chd_file::write_bytes(UINT64 offset, const void *buffer, UINT32 bytes) { @@ -1033,11 +1220,22 @@ chd_error chd_file::write_bytes(UINT64 offset, const void *buffer, UINT32 bytes) return CHDERR_NONE; } - -//------------------------------------------------- -// read_metadata - read the indexed metadata -// of the given type -//------------------------------------------------- +/** + * @fn chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, std::string &output) + * + * @brief ------------------------------------------------- + * read_metadata - read the indexed metadata of the given type + * -------------------------------------------------. + * + * @exception CHDERR_METADATA_NOT_FOUND Thrown when a chderr metadata not found error + * condition occurs. + * + * @param searchtag The searchtag. + * @param searchindex The searchindex. + * @param [in,out] output The output. + * + * @return The metadata. + */ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, std::string &output) { @@ -1066,6 +1264,21 @@ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex } } +/** + * @fn chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, dynamic_buffer &output) + * + * @brief Reads a metadata. + * + * @exception CHDERR_METADATA_NOT_FOUND Thrown when a chderr metadata not found error + * condition occurs. + * + * @param searchtag The searchtag. + * @param searchindex The searchindex. + * @param [in,out] output The output. + * + * @return The metadata. + */ + chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, dynamic_buffer &output) { // wrap this for clean reporting @@ -1089,6 +1302,23 @@ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex } } +/** + * @fn chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, void *output, UINT32 outputlen, UINT32 &resultlen) + * + * @brief Reads a metadata. + * + * @exception CHDERR_METADATA_NOT_FOUND Thrown when a chderr metadata not found error + * condition occurs. + * + * @param searchtag The searchtag. + * @param searchindex The searchindex. + * @param [in,out] output If non-null, the output. + * @param outputlen The outputlen. + * @param [in,out] resultlen The resultlen. + * + * @return The metadata. + */ + chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, void *output, UINT32 outputlen, UINT32 &resultlen) { // wrap this for clean reporting @@ -1112,6 +1342,23 @@ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex } } +/** + * @fn chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, dynamic_buffer &output, chd_metadata_tag &resulttag, UINT8 &resultflags) + * + * @brief Reads a metadata. + * + * @exception CHDERR_METADATA_NOT_FOUND Thrown when a chderr metadata not found error + * condition occurs. + * + * @param searchtag The searchtag. + * @param searchindex The searchindex. + * @param [in,out] output The output. + * @param [in,out] resulttag The resulttag. + * @param [in,out] resultflags The resultflags. + * + * @return The metadata. + */ + chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, dynamic_buffer &output, chd_metadata_tag &resulttag, UINT8 &resultflags) { // wrap this for clean reporting @@ -1137,11 +1384,21 @@ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex } } - -//------------------------------------------------- -// write_metadata - write the indexed metadata -// of the given type -//------------------------------------------------- +/** + * @fn chd_error chd_file::write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const void *inputbuf, UINT32 inputlen, UINT8 flags) + * + * @brief ------------------------------------------------- + * write_metadata - write the indexed metadata of the given type + * -------------------------------------------------. + * + * @param metatag The metatag. + * @param metaindex The metaindex. + * @param inputbuf The inputbuf. + * @param inputlen The inputlen. + * @param flags The flags. + * + * @return A chd_error. + */ chd_error chd_file::write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const void *inputbuf, UINT32 inputlen, UINT8 flags) { @@ -1209,11 +1466,21 @@ chd_error chd_file::write_metadata(chd_metadata_tag metatag, UINT32 metaindex, c } } - -//------------------------------------------------- -// delete_metadata - remove the given metadata -// from the list -//------------------------------------------------- +/** + * @fn chd_error chd_file::delete_metadata(chd_metadata_tag metatag, UINT32 metaindex) + * + * @brief ------------------------------------------------- + * delete_metadata - remove the given metadata from the list + * -------------------------------------------------. + * + * @exception CHDERR_METADATA_NOT_FOUND Thrown when a chderr metadata not found error + * condition occurs. + * + * @param metatag The metatag. + * @param metaindex The metaindex. + * + * @return A chd_error. + */ chd_error chd_file::delete_metadata(chd_metadata_tag metatag, UINT32 metaindex) { @@ -1237,11 +1504,19 @@ chd_error chd_file::delete_metadata(chd_metadata_tag metatag, UINT32 metaindex) } } - -//------------------------------------------------- -// clone_all_metadata - clone the metadata from -// one CHD to a second -//------------------------------------------------- +/** + * @fn chd_error chd_file::clone_all_metadata(chd_file &source) + * + * @brief ------------------------------------------------- + * clone_all_metadata - clone the metadata from one CHD to a second + * -------------------------------------------------. + * + * @exception err Thrown when an error error condition occurs. + * + * @param [in,out] source Another instance to copy. + * + * @return A chd_error. + */ chd_error chd_file::clone_all_metadata(chd_file &source) { @@ -1276,12 +1551,18 @@ chd_error chd_file::clone_all_metadata(chd_file &source) } } - -//------------------------------------------------- -// compute_overall_sha1 - iterate through the -// metadata and compute the overall hash of the -// CHD file -//------------------------------------------------- +/** + * @fn sha1_t chd_file::compute_overall_sha1(sha1_t rawsha1) + * + * @brief ------------------------------------------------- + * compute_overall_sha1 - iterate through the metadata and compute the overall hash of + * the CHD file + * -------------------------------------------------. + * + * @param rawsha1 The first rawsha. + * + * @return The calculated overall sha 1. + */ sha1_t chd_file::compute_overall_sha1(sha1_t rawsha1) { @@ -1322,10 +1603,19 @@ sha1_t chd_file::compute_overall_sha1(sha1_t rawsha1) return overall_sha1.finish(); } - -//------------------------------------------------- -// codec_config - set internal codec parameters -//------------------------------------------------- +/** + * @fn chd_error chd_file::codec_configure(chd_codec_type codec, int param, void *config) + * + * @brief ------------------------------------------------- + * codec_config - set internal codec parameters + * -------------------------------------------------. + * + * @param codec The codec. + * @param param The parameter. + * @param [in,out] config If non-null, the configuration. + * + * @return A chd_error. + */ chd_error chd_file::codec_configure(chd_codec_type codec, int param, void *config) { @@ -1349,11 +1639,17 @@ chd_error chd_file::codec_configure(chd_codec_type codec, int param, void *confi } } - -//------------------------------------------------- -// error_string - return an error string for -// the given CHD error -//------------------------------------------------- +/** + * @fn const char *chd_file::error_string(chd_error err) + * + * @brief ------------------------------------------------- + * error_string - return an error string for the given CHD error + * -------------------------------------------------. + * + * @param err The error. + * + * @return null if it fails, else a char*. + */ const char *chd_file::error_string(chd_error err) { @@ -1401,10 +1697,16 @@ const char *chd_file::error_string(chd_error err) // INTERNAL HELPERS //************************************************************************** -//------------------------------------------------- -// guess_unitbytes - for older CHD formats, take -// a guess at the bytes/unit based on metadata -//------------------------------------------------- +/** + * @fn UINT32 chd_file::guess_unitbytes() + * + * @brief ------------------------------------------------- + * guess_unitbytes - for older CHD formats, take a guess at the bytes/unit based on + * metadata + * -------------------------------------------------. + * + * @return An UINT32. + */ UINT32 chd_file::guess_unitbytes() { @@ -1426,11 +1728,21 @@ UINT32 chd_file::guess_unitbytes() return m_hunkbytes; } - -//------------------------------------------------- -// parse_v3_header - parse the header from a v3 -// file and configure core parameters -//------------------------------------------------- +/** + * @fn void chd_file::parse_v3_header(UINT8 *rawheader, sha1_t &parentsha1) + * + * @brief ------------------------------------------------- + * parse_v3_header - parse the header from a v3 file and configure core parameters + * -------------------------------------------------. + * + * @exception CHDERR_INVALID_FILE Thrown when a chderr invalid file error condition + * occurs. + * @exception CHDERR_UNKNOWN_COMPRESSION Thrown when a chderr unknown compression error + * condition occurs. + * + * @param [in,out] rawheader If non-null, the rawheader. + * @param [in,out] parentsha1 The first parentsha. + */ void chd_file::parse_v3_header(UINT8 *rawheader, sha1_t &parentsha1) { @@ -1479,11 +1791,21 @@ void chd_file::parse_v3_header(UINT8 *rawheader, sha1_t &parentsha1) m_unitcount = (m_logicalbytes + m_unitbytes - 1) / m_unitbytes; } - -//------------------------------------------------- -// parse_v4_header - parse the header from a v4 -// file and configure core parameters -//------------------------------------------------- +/** + * @fn void chd_file::parse_v4_header(UINT8 *rawheader, sha1_t &parentsha1) + * + * @brief ------------------------------------------------- + * parse_v4_header - parse the header from a v4 file and configure core parameters + * -------------------------------------------------. + * + * @exception CHDERR_INVALID_FILE Thrown when a chderr invalid file error condition + * occurs. + * @exception CHDERR_UNKNOWN_COMPRESSION Thrown when a chderr unknown compression error + * condition occurs. + * + * @param [in,out] rawheader If non-null, the rawheader. + * @param [in,out] parentsha1 The first parentsha. + */ void chd_file::parse_v4_header(UINT8 *rawheader, sha1_t &parentsha1) { @@ -1532,11 +1854,18 @@ void chd_file::parse_v4_header(UINT8 *rawheader, sha1_t &parentsha1) m_unitcount = (m_logicalbytes + m_unitbytes - 1) / m_unitbytes; } - -//------------------------------------------------- -// parse_v5_header - read the header from a v5 -// file and configure core parameters -//------------------------------------------------- +/** + * @fn void chd_file::parse_v5_header(UINT8 *rawheader, sha1_t &parentsha1) + * + * @brief ------------------------------------------------- + * parse_v5_header - read the header from a v5 file and configure core parameters + * -------------------------------------------------. + * + * @exception CHDERR_INVALID_FILE Thrown when a chderr invalid file error condition occurs. + * + * @param [in,out] rawheader If non-null, the rawheader. + * @param [in,out] parentsha1 The first parentsha. + */ void chd_file::parse_v5_header(UINT8 *rawheader, sha1_t &parentsha1) { @@ -1575,11 +1904,18 @@ void chd_file::parse_v5_header(UINT8 *rawheader, sha1_t &parentsha1) parentsha1 = be_read_sha1(&rawheader[m_parentsha1_offset]); } - -//------------------------------------------------- -// compress_v5_map - compress the v5 map and -// write it to the end of the file -//------------------------------------------------- +/** + * @fn chd_error chd_file::compress_v5_map() + * + * @brief ------------------------------------------------- + * compress_v5_map - compress the v5 map and write it to the end of the file + * -------------------------------------------------. + * + * @exception CHDERR_COMPRESSION_ERROR Thrown when a chderr compression error error + * condition occurs. + * + * @return A chd_error. + */ chd_error chd_file::compress_v5_map() { @@ -1782,10 +2118,16 @@ chd_error chd_file::compress_v5_map() } } - -//------------------------------------------------- -// decompress_v5_map - decompress the v5 map -//------------------------------------------------- +/** + * @fn void chd_file::decompress_v5_map() + * + * @brief ------------------------------------------------- + * decompress_v5_map - decompress the v5 map + * -------------------------------------------------. + * + * @exception CHDERR_DECOMPRESSION_ERROR Thrown when a chderr decompression error error + * condition occurs. + */ void chd_file::decompress_v5_map() { @@ -1900,11 +2242,22 @@ void chd_file::decompress_v5_map() throw CHDERR_DECOMPRESSION_ERROR; } - -//------------------------------------------------- -// create_common - command path when creating a -// new CHD file -//------------------------------------------------- +/** + * @fn chd_error chd_file::create_common() + * + * @brief ------------------------------------------------- + * create_common - command path when creating a new CHD file + * -------------------------------------------------. + * + * @exception CHDERR_UNSUPPORTED_VERSION Thrown when a chderr unsupported version error + * condition occurs. + * @exception CHDERR_INVALID_PARAMETER Thrown when a chderr invalid parameter error + * condition occurs. + * @exception CHDERR_UNKNOWN_COMPRESSION Thrown when a chderr unknown compression error + * condition occurs. + * + * @return The new common. + */ chd_error chd_file::create_common() { @@ -1999,11 +2352,28 @@ chd_error chd_file::create_common() return CHDERR_NONE; } - -//------------------------------------------------- -// open_common - common path when opening an -// existing CHD file for input -//------------------------------------------------- +/** + * @fn chd_error chd_file::open_common(bool writeable) + * + * @brief ------------------------------------------------- + * open_common - common path when opening an existing CHD file for input + * -------------------------------------------------. + * + * @exception CHDERR_INVALID_FILE Thrown when a chderr invalid file error condition + * occurs. + * @exception CHDERR_UNSUPPORTED_VERSION Thrown when a chderr unsupported version error + * condition occurs. + * @exception CHDERR_FILE_NOT_WRITEABLE Thrown when a chderr file not writeable error + * condition occurs. + * @exception CHDERR_INVALID_PARENT Thrown when a chderr invalid parent error condition + * occurs. + * @exception CHDERR_INVALID_PARAMETER Thrown when a chderr invalid parameter error + * condition occurs. + * + * @param writeable true if writeable. + * + * @return A chd_error. + */ chd_error chd_file::open_common(bool writeable) { @@ -2063,11 +2433,16 @@ chd_error chd_file::open_common(bool writeable) } } - -//------------------------------------------------- -// create_open_common - common code for handling -// creation and opening of a file -//------------------------------------------------- +/** + * @fn void chd_file::create_open_common() + * + * @brief ------------------------------------------------- + * create_open_common - common code for handling creation and opening of a file + * -------------------------------------------------. + * + * @exception CHDERR_UNKNOWN_COMPRESSION Thrown when a chderr unknown compression error + * condition occurs. + */ void chd_file::create_open_common() { @@ -2091,12 +2466,24 @@ void chd_file::create_open_common() m_cache.resize(m_hunkbytes); } - -//------------------------------------------------- -// verify_proper_compression_append - verify that -// the given hunk is a proper candidate for -// appending to a compressed CHD -//------------------------------------------------- +/** + * @fn void chd_file::verify_proper_compression_append(UINT32 hunknum) + * + * @brief ------------------------------------------------- + * verify_proper_compression_append - verify that the given hunk is a proper candidate + * for appending to a compressed CHD + * -------------------------------------------------. + * + * @exception CHDERR_NOT_OPEN Thrown when a chderr not open error condition occurs. + * @exception CHDERR_HUNK_OUT_OF_RANGE Thrown when a chderr hunk out of range error + * condition occurs. + * @exception CHDERR_FILE_NOT_WRITEABLE Thrown when a chderr file not writeable error + * condition occurs. + * @exception CHDERR_COMPRESSION_ERROR Thrown when a chderr compression error error + * condition occurs. + * + * @param hunknum The hunknum. + */ void chd_file::verify_proper_compression_append(UINT32 hunknum) { @@ -2127,12 +2514,20 @@ void chd_file::verify_proper_compression_append(UINT32 hunknum) throw CHDERR_COMPRESSION_ERROR; } - -//------------------------------------------------- -// hunk_write_compressed - write a hunk to a -// compressed CHD, discovering the best -// technique -//------------------------------------------------- +/** + * @fn void chd_file::hunk_write_compressed(UINT32 hunknum, INT8 compression, const UINT8 *compressed, UINT32 complength, crc16_t crc16) + * + * @brief ------------------------------------------------- + * hunk_write_compressed - write a hunk to a compressed CHD, discovering the best + * technique + * -------------------------------------------------. + * + * @param hunknum The hunknum. + * @param compression The compression. + * @param compressed The compressed. + * @param complength The complength. + * @param crc16 The CRC 16. + */ void chd_file::hunk_write_compressed(UINT32 hunknum, INT8 compression, const UINT8 *compressed, UINT32 complength, crc16_t crc16) { @@ -2150,11 +2545,19 @@ void chd_file::hunk_write_compressed(UINT32 hunknum, INT8 compression, const UIN be_write(&rawmap[10], crc16, 2); } - -//------------------------------------------------- -// hunk_copy_from_self - mark a hunk as being a -// copy of another hunk in the same CHD -//------------------------------------------------- +/** + * @fn void chd_file::hunk_copy_from_self(UINT32 hunknum, UINT32 otherhunk) + * + * @brief ------------------------------------------------- + * hunk_copy_from_self - mark a hunk as being a copy of another hunk in the same CHD + * -------------------------------------------------. + * + * @exception CHDERR_INVALID_PARAMETER Thrown when a chderr invalid parameter error + * condition occurs. + * + * @param hunknum The hunknum. + * @param otherhunk The otherhunk. + */ void chd_file::hunk_copy_from_self(UINT32 hunknum, UINT32 otherhunk) { @@ -2173,11 +2576,16 @@ void chd_file::hunk_copy_from_self(UINT32 hunknum, UINT32 otherhunk) be_write(&rawmap[10], 0, 2); } - -//------------------------------------------------- -// hunk_copy_from_parent - mark a hunk as being a -// copy of a hunk from a parent CHD -//------------------------------------------------- +/** + * @fn void chd_file::hunk_copy_from_parent(UINT32 hunknum, UINT64 parentunit) + * + * @brief ------------------------------------------------- + * hunk_copy_from_parent - mark a hunk as being a copy of a hunk from a parent CHD + * -------------------------------------------------. + * + * @param hunknum The hunknum. + * @param parentunit The parentunit. + */ void chd_file::hunk_copy_from_parent(UINT32 hunknum, UINT64 parentunit) { @@ -2192,10 +2600,20 @@ void chd_file::hunk_copy_from_parent(UINT32 hunknum, UINT64 parentunit) be_write(&rawmap[10], 0, 2); } - -//------------------------------------------------- -// metadata_find - find a metadata entry -//------------------------------------------------- +/** + * @fn bool chd_file::metadata_find(chd_metadata_tag metatag, INT32 metaindex, metadata_entry &metaentry, bool resume) + * + * @brief ------------------------------------------------- + * metadata_find - find a metadata entry + * -------------------------------------------------. + * + * @param metatag The metatag. + * @param metaindex The metaindex. + * @param [in,out] metaentry The metaentry. + * @param resume true to resume. + * + * @return true if it succeeds, false if it fails. + */ bool chd_file::metadata_find(chd_metadata_tag metatag, INT32 metaindex, metadata_entry &metaentry, bool resume) { @@ -2238,11 +2656,16 @@ bool chd_file::metadata_find(chd_metadata_tag metatag, INT32 metaindex, metadata return false; } - -//------------------------------------------------- -// metadata_set_previous_next - set the 'next' -// offset of a piece of metadata -//------------------------------------------------- +/** + * @fn void chd_file::metadata_set_previous_next(UINT64 prevoffset, UINT64 nextoffset) + * + * @brief ------------------------------------------------- + * metadata_set_previous_next - set the 'next' offset of a piece of metadata + * -------------------------------------------------. + * + * @param prevoffset The prevoffset. + * @param nextoffset The nextoffset. + */ void chd_file::metadata_set_previous_next(UINT64 prevoffset, UINT64 nextoffset) { @@ -2267,11 +2690,13 @@ void chd_file::metadata_set_previous_next(UINT64 prevoffset, UINT64 nextoffset) file_write(offset, rawbuf, sizeof(rawbuf)); } - -//------------------------------------------------- -// metadata_update_hash - compute the SHA1 -// hash of all metadata that requests it -//------------------------------------------------- +/** + * @fn void chd_file::metadata_update_hash() + * + * @brief ------------------------------------------------- + * metadata_update_hash - compute the SHA1 hash of all metadata that requests it + * -------------------------------------------------. + */ void chd_file::metadata_update_hash() { @@ -2290,11 +2715,18 @@ void chd_file::metadata_update_hash() file_write(m_sha1_offset, rawbuf, sizeof(rawbuf)); } - -//------------------------------------------------- -// metadata_hash_compare - compare two hash -// entries -//------------------------------------------------- +/** + * @fn int CLIB_DECL chd_file::metadata_hash_compare(const void *elem1, const void *elem2) + * + * @brief ------------------------------------------------- + * metadata_hash_compare - compare two hash entries + * -------------------------------------------------. + * + * @param elem1 The first element. + * @param elem2 The second element. + * + * @return A CLIB_DECL. + */ int CLIB_DECL chd_file::metadata_hash_compare(const void *elem1, const void *elem2) { @@ -2307,9 +2739,13 @@ int CLIB_DECL chd_file::metadata_hash_compare(const void *elem1, const void *ele // CHD COMPRESSOR //************************************************************************** -//------------------------------------------------- -// chd_file_compressor - constructor -//------------------------------------------------- +/** + * @fn chd_file_compressor::chd_file_compressor() + * + * @brief ------------------------------------------------- + * chd_file_compressor - constructor + * -------------------------------------------------. + */ chd_file_compressor::chd_file_compressor() : m_walking_parent(false), @@ -2330,10 +2766,13 @@ chd_file_compressor::chd_file_compressor() m_work_queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_MULTI); } - -//------------------------------------------------- -// ~chd_file_compressor - destructor -//------------------------------------------------- +/** + * @fn chd_file_compressor::~chd_file_compressor() + * + * @brief ------------------------------------------------- + * ~chd_file_compressor - destructor + * -------------------------------------------------. + */ chd_file_compressor::~chd_file_compressor() { @@ -2346,10 +2785,13 @@ chd_file_compressor::~chd_file_compressor() delete m_codecs[codecnum]; } - -//------------------------------------------------- -// compress_begin - initiate compression -//------------------------------------------------- +/** + * @fn void chd_file_compressor::compress_begin() + * + * @brief ------------------------------------------------- + * compress_begin - initiate compression + * -------------------------------------------------. + */ void chd_file_compressor::compress_begin() { @@ -2392,10 +2834,18 @@ void chd_file_compressor::compress_begin() m_write_hunk = 0; } - -//------------------------------------------------- -// compress_continue - continue compression -//------------------------------------------------- +/** + * @fn chd_error chd_file_compressor::compress_continue(double &progress, double &ratio) + * + * @brief ------------------------------------------------- + * compress_continue - continue compression + * -------------------------------------------------. + * + * @param [in,out] progress The progress. + * @param [in,out] ratio The ratio. + * + * @return A chd_error. + */ chd_error chd_file_compressor::compress_continue(double &progress, double &ratio) { @@ -2538,11 +2988,18 @@ chd_error chd_file_compressor::compress_continue(double &progress, double &ratio return m_walking_parent ? CHDERR_WALKING_PARENT : CHDERR_COMPRESSING; } - -//------------------------------------------------- -// async_walk_parent - handle asynchronous parent -// walking operations -//------------------------------------------------- +/** + * @fn void *chd_file_compressor::async_walk_parent_static(void *param, int threadid) + * + * @brief ------------------------------------------------- + * async_walk_parent - handle asynchronous parent walking operations + * -------------------------------------------------. + * + * @param [in,out] param If non-null, the parameter. + * @param threadid The threadid. + * + * @return null if it fails, else a void*. + */ void *chd_file_compressor::async_walk_parent_static(void *param, int threadid) { @@ -2551,6 +3008,14 @@ void *chd_file_compressor::async_walk_parent_static(void *param, int threadid) return NULL; } +/** + * @fn void chd_file_compressor::async_walk_parent(work_item &item) + * + * @brief Asynchronous walk parent. + * + * @param [in,out] item The item. + */ + void chd_file_compressor::async_walk_parent(work_item &item) { // compute CRC-16 and SHA-1 hashes for each unit, unless we're the last one or we're uncompressed @@ -2565,11 +3030,18 @@ void chd_file_compressor::async_walk_parent(work_item &item) atomic_exchange32(&item.m_status, WS_COMPLETE); } - -//------------------------------------------------- -// async_compress_hunk - handle asynchronous -// hunk compression -//------------------------------------------------- +/** + * @fn void *chd_file_compressor::async_compress_hunk_static(void *param, int threadid) + * + * @brief ------------------------------------------------- + * async_compress_hunk - handle asynchronous hunk compression + * -------------------------------------------------. + * + * @param [in,out] param If non-null, the parameter. + * @param threadid The threadid. + * + * @return null if it fails, else a void*. + */ void *chd_file_compressor::async_compress_hunk_static(void *param, int threadid) { @@ -2578,6 +3050,15 @@ void *chd_file_compressor::async_compress_hunk_static(void *param, int threadid) return NULL; } +/** + * @fn void chd_file_compressor::async_compress_hunk(work_item &item, int threadid) + * + * @brief Asynchronous compress hunk. + * + * @param [in,out] item The item. + * @param threadid The threadid. + */ + void chd_file_compressor::async_compress_hunk(work_item &item, int threadid) { // use our thread's codec @@ -2599,11 +3080,18 @@ void chd_file_compressor::async_compress_hunk(work_item &item, int threadid) atomic_exchange32(&item.m_status, WS_COMPLETE); } - -//------------------------------------------------- -// async_read - handle asynchronous source file -// reading -//------------------------------------------------- +/** + * @fn void *chd_file_compressor::async_read_static(void *param, int threadid) + * + * @brief ------------------------------------------------- + * async_read - handle asynchronous source file reading + * -------------------------------------------------. + * + * @param [in,out] param If non-null, the parameter. + * @param threadid The threadid. + * + * @return null if it fails, else a void*. + */ void *chd_file_compressor::async_read_static(void *param, int threadid) { @@ -2611,6 +3099,12 @@ void *chd_file_compressor::async_read_static(void *param, int threadid) return NULL; } +/** + * @fn void chd_file_compressor::async_read() + * + * @brief Asynchronous read. + */ + void chd_file_compressor::async_read() { // if in the error or complete state, stop @@ -2686,9 +3180,13 @@ void chd_file_compressor::async_read() // CHD COMPRESSOR HASHMAP //************************************************************************** -//------------------------------------------------- -// hashmap - constructor -//------------------------------------------------- +/** + * @fn chd_file_compressor::hashmap::hashmap() + * + * @brief ------------------------------------------------- + * hashmap - constructor + * -------------------------------------------------. + */ chd_file_compressor::hashmap::hashmap() : m_block_list(new entry_block(NULL)) @@ -2697,10 +3195,13 @@ chd_file_compressor::hashmap::hashmap() memset(m_map, 0, sizeof(m_map)); } - -//------------------------------------------------- -// ~hashmap - destructor -//------------------------------------------------- +/** + * @fn chd_file_compressor::hashmap::~hashmap() + * + * @brief ------------------------------------------------- + * ~hashmap - destructor + * -------------------------------------------------. + */ chd_file_compressor::hashmap::~hashmap() { @@ -2708,10 +3209,13 @@ chd_file_compressor::hashmap::~hashmap() delete m_block_list; } - -//------------------------------------------------- -// reset - reset the state of the map -//------------------------------------------------- +/** + * @fn void chd_file_compressor::hashmap::reset() + * + * @brief ------------------------------------------------- + * reset - reset the state of the map + * -------------------------------------------------. + */ void chd_file_compressor::hashmap::reset() { @@ -2728,10 +3232,18 @@ void chd_file_compressor::hashmap::reset() memset(m_map, 0, sizeof(m_map)); } - -//------------------------------------------------- -// find - find an item in the CRC map -//------------------------------------------------- +/** + * @fn UINT64 chd_file_compressor::hashmap::find(crc16_t crc16, sha1_t sha1) + * + * @brief ------------------------------------------------- + * find - find an item in the CRC map + * -------------------------------------------------. + * + * @param crc16 The CRC 16. + * @param sha1 The first sha. + * + * @return An UINT64. + */ UINT64 chd_file_compressor::hashmap::find(crc16_t crc16, sha1_t sha1) { @@ -2742,10 +3254,17 @@ UINT64 chd_file_compressor::hashmap::find(crc16_t crc16, sha1_t sha1) return NOT_FOUND; } - -//------------------------------------------------- -// add - add an item to the CRC map -//------------------------------------------------- +/** + * @fn void chd_file_compressor::hashmap::add(UINT64 itemnum, crc16_t crc16, sha1_t sha1) + * + * @brief ------------------------------------------------- + * add - add an item to the CRC map + * -------------------------------------------------. + * + * @param itemnum The itemnum. + * @param crc16 The CRC 16. + * @param sha1 The first sha. + */ void chd_file_compressor::hashmap::add(UINT64 itemnum, crc16_t crc16, sha1_t sha1) { diff --git a/src/lib/util/chdcd.c b/src/lib/util/chdcd.c index a94b27c1590..d55b83f5a82 100644 --- a/src/lib/util/chdcd.c +++ b/src/lib/util/chdcd.c @@ -21,6 +21,18 @@ CONSTANTS & DEFINES ***************************************************************************/ +/** + * @def TOKENIZE(); + * + * @brief A macro that defines tokenize. + * + * @param linebuffer The linebuffer. + * @param i Zero-based index of the. + * @param sizeof(linebuffer) The sizeof(linebuffer) + * @param token The token. + * @param sizeof(token) The sizeof(token) + */ + #define TOKENIZE i = tokenize( linebuffer, i, sizeof(linebuffer), token, sizeof(token) ); @@ -29,6 +41,7 @@ GLOBAL VARIABLES ***************************************************************************/ +/** @brief The linebuffer[ 512]. */ static char linebuffer[512]; @@ -37,6 +50,16 @@ static char linebuffer[512]; IMPLEMENTATION ***************************************************************************/ +/** + * @fn static std::string get_file_path(std::string &path) + * + * @brief Gets file path. + * + * @param [in,out] path Full pathname of the file. + * + * @return The file path. + */ + static std::string get_file_path(std::string &path) { int pos = path.find_last_of('\\'); @@ -52,6 +75,16 @@ static std::string get_file_path(std::string &path) get_file_size - get the size of a file -------------------------------------------------*/ +/** + * @fn static UINT64 get_file_size(const char *filename) + * + * @brief Gets file size. + * + * @param filename Filename of the file. + * + * @return The file size. + */ + static UINT64 get_file_size(const char *filename) { osd_file *file; @@ -70,6 +103,20 @@ static UINT64 get_file_size(const char *filename) tokenize - get a token from the line buffer -------------------------------------------------*/ +/** + * @fn static int tokenize( const char *linebuffer, int i, int linebuffersize, char *token, int tokensize ) + * + * @brief Tokenizes. + * + * @param linebuffer The linebuffer. + * @param i Zero-based index of the. + * @param linebuffersize The linebuffersize. + * @param [in,out] token If non-null, the token. + * @param tokensize The tokensize. + * + * @return An int. + */ + static int tokenize( const char *linebuffer, int i, int linebuffersize, char *token, int tokensize ) { int j = 0; @@ -114,6 +161,16 @@ static int tokenize( const char *linebuffer, int i, int linebuffersize, char *to msf_to_frames - convert m:s:f into a number of frames -------------------------------------------------*/ +/** + * @fn static int msf_to_frames( char *token ) + * + * @brief Msf to frames. + * + * @param [in,out] token If non-null, the token. + * + * @return An int. + */ + static int msf_to_frames( char *token ) { int m = 0; @@ -140,6 +197,18 @@ static int msf_to_frames( char *token ) length in bytes of the data and the offset in bytes to where the data starts in the file. -------------------------------------------------*/ + +/** + * @fn static UINT32 parse_wav_sample(const char *filename, UINT32 *dataoffs) + * + * @brief Parse WAV sample. + * + * @param filename Filename of the file. + * @param [in,out] dataoffs If non-null, the dataoffs. + * + * @return An UINT32. + */ + static UINT32 parse_wav_sample(const char *filename, UINT32 *dataoffs) { unsigned long offset = 0; @@ -308,6 +377,16 @@ static UINT32 parse_wav_sample(const char *filename, UINT32 *dataoffs) return length; } +/** + * @fn UINT16 read_uint16(FILE *infile) + * + * @brief Reads uint 16. + * + * @param [in,out] infile If non-null, the infile. + * + * @return The uint 16. + */ + UINT16 read_uint16(FILE *infile) { UINT16 res = 0; @@ -320,6 +399,16 @@ UINT16 read_uint16(FILE *infile) return res; } +/** + * @fn UINT32 read_uint32(FILE *infile) + * + * @brief Reads uint 32. + * + * @param [in,out] infile If non-null, the infile. + * + * @return The uint 32. + */ + UINT32 read_uint32(FILE *infile) { UINT32 res = 0; @@ -332,6 +421,16 @@ UINT32 read_uint32(FILE *infile) return res; } +/** + * @fn UINT64 read_uint64(FILE *infile) + * + * @brief Reads uint 64. + * + * @param [in,out] infile If non-null, the infile. + * + * @return The uint 64. + */ + UINT64 read_uint64(FILE *infile) { UINT64 res0 = U64(0), res1 = U64(0); @@ -352,6 +451,18 @@ UINT64 read_uint64(FILE *infile) chdcd_parse_nero - parse a Nero .NRG file -------------------------------------------------*/ +/** + * @fn chd_error chdcd_parse_nero(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) + * + * @brief Chdcd parse nero. + * + * @param tocfname The tocfname. + * @param [in,out] outtoc The outtoc. + * @param [in,out] outinfo The outinfo. + * + * @return A chd_error. + */ + chd_error chdcd_parse_nero(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) { FILE *infile; @@ -526,6 +637,18 @@ chd_error chdcd_parse_nero(const char *tocfname, cdrom_toc &outtoc, chdcd_track_ chdcd_parse_iso - parse a .ISO file -------------------------------------------------*/ +/** + * @fn chd_error chdcd_parse_iso(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) + * + * @brief Chdcd parse ISO. + * + * @param tocfname The tocfname. + * @param [in,out] outtoc The outtoc. + * @param [in,out] outinfo The outinfo. + * + * @return A chd_error. + */ + chd_error chdcd_parse_iso(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) { FILE *infile; @@ -591,6 +714,18 @@ chd_error chdcd_parse_iso(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i chdcd_parse_gdi - parse a Sega GD-ROM rip -------------------------------------------------*/ +/** + * @fn static chd_error chdcd_parse_gdi(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) + * + * @brief Chdcd parse GDI. + * + * @param tocfname The tocfname. + * @param [in,out] outtoc The outtoc. + * @param [in,out] outinfo The outinfo. + * + * @return A chd_error. + */ + static chd_error chdcd_parse_gdi(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) { FILE *infile; @@ -711,6 +846,18 @@ static chd_error chdcd_parse_gdi(const char *tocfname, cdrom_toc &outtoc, chdcd_ chdcd_parse_cue - parse a CDRWin format CUE file -------------------------------------------------*/ +/** + * @fn chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) + * + * @brief Chdcd parse cue. + * + * @param tocfname The tocfname. + * @param [in,out] outtoc The outtoc. + * @param [in,out] outinfo The outinfo. + * + * @return A chd_error. + */ + chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) { FILE *infile; @@ -994,6 +1141,18 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i chdcd_parse_toc - parse a CDRDAO format TOC file -------------------------------------------------*/ +/** + * @fn chd_error chdcd_parse_toc(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) + * + * @brief Chdcd parse TOC. + * + * @param tocfname The tocfname. + * @param [in,out] outtoc The outtoc. + * @param [in,out] outinfo The outinfo. + * + * @return A chd_error. + */ + chd_error chdcd_parse_toc(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) { FILE *infile; diff --git a/src/lib/util/chdcodec.c b/src/lib/util/chdcodec.c index 3a7781fced8..753ce852dd3 100644 --- a/src/lib/util/chdcodec.c +++ b/src/lib/util/chdcodec.c @@ -1453,10 +1453,17 @@ UINT32 chd_cd_flac_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 * return complen; } - -//------------------------------------------------- -// blocksize - return the optimal block size -//------------------------------------------------- +/** + * @fn UINT32 chd_cd_flac_compressor::blocksize(UINT32 bytes) + * + * @brief ------------------------------------------------- + * blocksize - return the optimal block size + * -------------------------------------------------. + * + * @param bytes The bytes. + * + * @return An UINT32. + */ UINT32 chd_cd_flac_compressor::blocksize(UINT32 bytes) { @@ -1473,9 +1480,19 @@ UINT32 chd_cd_flac_compressor::blocksize(UINT32 bytes) // CD FLAC DECOMPRESSOR //************************************************************************** -//------------------------------------------------- -// chd_cd_flac_decompressor - constructor -//------------------------------------------------- +/** + * @fn chd_cd_flac_decompressor::chd_cd_flac_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy) + * + * @brief ------------------------------------------------- + * chd_cd_flac_decompressor - constructor + * -------------------------------------------------. + * + * @exception CHDERR_CODEC_ERROR Thrown when a chderr codec error error condition occurs. + * + * @param [in,out] chd The chd. + * @param hunkbytes The hunkbytes. + * @param lossy true to lossy. + */ chd_cd_flac_decompressor::chd_cd_flac_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy) : chd_decompressor(chd, hunkbytes, lossy), @@ -1503,21 +1520,34 @@ chd_cd_flac_decompressor::chd_cd_flac_decompressor(chd_file &chd, UINT32 hunkbyt throw CHDERR_CODEC_ERROR; } - -//------------------------------------------------- -// ~chd_cd_flac_decompressor - destructor -//------------------------------------------------- +/** + * @fn chd_cd_flac_decompressor::~chd_cd_flac_decompressor() + * + * @brief ------------------------------------------------- + * ~chd_cd_flac_decompressor - destructor + * -------------------------------------------------. + */ chd_cd_flac_decompressor::~chd_cd_flac_decompressor() { inflateEnd(&m_inflater); } - -//------------------------------------------------- -// decompress - decompress data using the FLAC -// codec -//------------------------------------------------- +/** + * @fn void chd_cd_flac_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) + * + * @brief ------------------------------------------------- + * decompress - decompress data using the FLAC codec + * -------------------------------------------------. + * + * @exception CHDERR_DECOMPRESSION_ERROR Thrown when a chderr decompression error error + * condition occurs. + * + * @param src Source for the. + * @param complen The complen. + * @param [in,out] dest If non-null, destination for the. + * @param destlen The destlen. + */ void chd_cd_flac_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) { @@ -1562,9 +1592,17 @@ void chd_cd_flac_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT // AVHUFF COMPRESSOR //************************************************************************** -//------------------------------------------------- -// chd_avhuff_compressor - constructor -//------------------------------------------------- +/** + * @fn chd_avhuff_compressor::chd_avhuff_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy) + * + * @brief ------------------------------------------------- + * chd_avhuff_compressor - constructor + * -------------------------------------------------. + * + * @param [in,out] chd The chd. + * @param hunkbytes The hunkbytes. + * @param lossy true to lossy. + */ chd_avhuff_compressor::chd_avhuff_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy) : chd_compressor(chd, hunkbytes, lossy), @@ -1581,10 +1619,24 @@ chd_avhuff_compressor::chd_avhuff_compressor(chd_file &chd, UINT32 hunkbytes, bo } } - -//------------------------------------------------- -// compress - compress data using the A/V codec -//------------------------------------------------- +/** + * @fn UINT32 chd_avhuff_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *dest) + * + * @brief ------------------------------------------------- + * compress - compress data using the A/V codec + * -------------------------------------------------. + * + * @exception CHDERR_INVALID_DATA Thrown when a chderr invalid data error condition + * occurs. + * @exception CHDERR_COMPRESSION_ERROR Thrown when a chderr compression error error + * condition occurs. + * + * @param src Source for the. + * @param srclen The srclen. + * @param [in,out] dest If non-null, destination for the. + * + * @return An UINT32. + */ UINT32 chd_avhuff_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *dest) { @@ -1609,12 +1661,18 @@ UINT32 chd_avhuff_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *d return complen; } - -//------------------------------------------------- -// postinit - actual initialization of avhuff -// happens here, on the first attempt to compress -// or decompress data -//------------------------------------------------- +/** + * @fn void chd_avhuff_compressor::postinit() + * + * @brief ------------------------------------------------- + * postinit - actual initialization of avhuff happens here, on the first attempt to + * compress or decompress data + * -------------------------------------------------. + * + * @exception err Thrown when an error error condition occurs. + * @exception CHDERR_INVALID_METADATA Thrown when a chderr invalid metadata error condition + * occurs. + */ void chd_avhuff_compressor::postinit() { @@ -1646,20 +1704,38 @@ void chd_avhuff_compressor::postinit() // AVHUFF DECOMPRESSOR //************************************************************************** -//------------------------------------------------- -// chd_avhuff_decompressor - constructor -//------------------------------------------------- +/** + * @fn chd_avhuff_decompressor::chd_avhuff_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy) + * + * @brief ------------------------------------------------- + * chd_avhuff_decompressor - constructor + * -------------------------------------------------. + * + * @param [in,out] chd The chd. + * @param hunkbytes The hunkbytes. + * @param lossy true to lossy. + */ chd_avhuff_decompressor::chd_avhuff_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy) : chd_decompressor(chd, hunkbytes, lossy) { } - -//------------------------------------------------- -// decompress - decompress data using the A/V -// codec -//------------------------------------------------- +/** + * @fn void chd_avhuff_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) + * + * @brief ------------------------------------------------- + * decompress - decompress data using the A/V codec + * -------------------------------------------------. + * + * @exception CHDERR_DECOMPRESSION_ERROR Thrown when a chderr decompression error error + * condition occurs. + * + * @param src Source for the. + * @param complen The complen. + * @param [in,out] dest If non-null, destination for the. + * @param destlen The destlen. + */ void chd_avhuff_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) { @@ -1677,11 +1753,19 @@ void chd_avhuff_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 } } - -//------------------------------------------------- -// config - codec-specific configuration for the -// A/V codec -//------------------------------------------------- +/** + * @fn void chd_avhuff_decompressor::configure(int param, void *config) + * + * @brief ------------------------------------------------- + * config - codec-specific configuration for the A/V codec + * -------------------------------------------------. + * + * @exception CHDERR_INVALID_PARAMETER Thrown when a chderr invalid parameter error + * condition occurs. + * + * @param param The parameter. + * @param [in,out] config If non-null, the configuration. + */ void chd_avhuff_decompressor::configure(int param, void *config) { diff --git a/src/lib/util/corealloc.c b/src/lib/util/corealloc.c index d4de33fe35d..c8fcf7e3aa5 100644 --- a/src/lib/util/corealloc.c +++ b/src/lib/util/corealloc.c @@ -359,11 +359,15 @@ void memory_entry::release(memory_entry *entry, const char *file, int line) release_lock(); } - -//------------------------------------------------- -// report_unfreed - print a list of unfreed -// memory to the target file -//------------------------------------------------- +/** + * @fn void memory_entry::report_unfreed(UINT64 start) + * + * @brief ------------------------------------------------- + * report_unfreed - print a list of unfreed memory to the target file + * -------------------------------------------------. + * + * @param start The start. + */ void memory_entry::report_unfreed(UINT64 start) { diff --git a/src/lib/util/corefile.c b/src/lib/util/corefile.c index 823d37b8b55..30639615a58 100644 --- a/src/lib/util/corefile.c +++ b/src/lib/util/corefile.c @@ -1028,6 +1028,20 @@ static file_error osd_or_zlib_read(core_file *file, void *buffer, UINT64 offset, handles zlib-compressed data -------------------------------------------------*/ +/** + * @fn static file_error osd_or_zlib_write(core_file *file, const void *buffer, UINT64 offset, UINT32 length, UINT32 *actual) + * + * @brief OSD or zlib write. + * + * @param [in,out] file If non-null, the file. + * @param buffer The buffer. + * @param offset The offset. + * @param length The length. + * @param [in,out] actual If non-null, the actual. + * + * @return A file_error. + */ + static file_error osd_or_zlib_write(core_file *file, const void *buffer, UINT64 offset, UINT32 length, UINT32 *actual) { /* if no compression, just pass through */ diff --git a/src/lib/util/corestr.c b/src/lib/util/corestr.c index 8a78a672ac6..eb6f76ac4b4 100644 --- a/src/lib/util/corestr.c +++ b/src/lib/util/corestr.c @@ -294,12 +294,34 @@ std::string strmakeupper(std::string& str) return str; } +/** + * @fn std::string strmakelower(std::string& str) + * + * @brief Strmakelowers the given string. + * + * @param [in,out] str The string. + * + * @return A std::string. + */ + std::string strmakelower(std::string& str) { std::transform(str.begin(), str.end(), str.begin(), ::tolower); return str; } +/** + * @fn int strreplace(std::string &str, const std::string& search, const std::string& replace) + * + * @brief Strreplaces. + * + * @param [in,out] str The string. + * @param search The search. + * @param replace The replace. + * + * @return An int. + */ + int strreplace(std::string &str, const std::string& search, const std::string& replace) { int searchlen = search.length(); diff --git a/src/lib/util/coreutil.c b/src/lib/util/coreutil.c index fbc807caad3..2a2a27d712e 100644 --- a/src/lib/util/coreutil.c +++ b/src/lib/util/coreutil.c @@ -67,6 +67,18 @@ int gregorian_is_leap_year(int year) /* months are one counted */ + +/** + * @fn int gregorian_days_in_month(int month, int year) + * + * @brief Gregorian days in month. + * + * @param month The month. + * @param year The year. + * + * @return An int. + */ + int gregorian_days_in_month(int month, int year) { if (month == 2) @@ -82,6 +94,15 @@ int gregorian_days_in_month(int month, int year) MISC ***************************************************************************/ +/** + * @fn void rand_memory(void *memory, size_t length) + * + * @brief Random memory. + * + * @param [in,out] memory If non-null, the memory. + * @param length The length. + */ + void rand_memory(void *memory, size_t length) { static UINT32 seed = 0; diff --git a/src/lib/util/cstrpool.c b/src/lib/util/cstrpool.c index b77557c1056..36c5ff694bb 100644 --- a/src/lib/util/cstrpool.c +++ b/src/lib/util/cstrpool.c @@ -70,10 +70,13 @@ bool const_string_pool::contains(const char *string) return false; } - -//------------------------------------------------- -// pool_chunk - constructor -//------------------------------------------------- +/** + * @fn const_string_pool::pool_chunk::pool_chunk() + * + * @brief ------------------------------------------------- + * pool_chunk - constructor + * -------------------------------------------------. + */ const_string_pool::pool_chunk::pool_chunk() : m_next(NULL), @@ -81,10 +84,17 @@ const_string_pool::pool_chunk::pool_chunk() { } - -//------------------------------------------------- -// add - add a string to this pool -//------------------------------------------------- +/** + * @fn const char *const_string_pool::pool_chunk::add(const char *string) + * + * @brief ------------------------------------------------- + * add - add a string to this pool + * -------------------------------------------------. + * + * @param string The string to add. + * + * @return null if it fails, else a char*. + */ const char *const_string_pool::pool_chunk::add(const char *string) { diff --git a/src/lib/util/delegate.c b/src/lib/util/delegate.c index 6c688f72985..5abf04b3a32 100644 --- a/src/lib/util/delegate.c +++ b/src/lib/util/delegate.c @@ -32,11 +32,18 @@ delegate_mfp::raw_mfp_data delegate_mfp::s_null_mfp = { 0 }; #if (USE_DELEGATE_TYPE == DELEGATE_TYPE_INTERNAL) -//------------------------------------------------- -// delegate_convert_raw - given an object and -// an raw function, adjust the object base and -// return the actual final code pointer -//------------------------------------------------- +/** + * @fn delegate_generic_function delegate_mfp::convert_to_generic(delegate_generic_class *&object) const + * + * @brief ------------------------------------------------- + * delegate_convert_raw - given an object and an raw function, adjust the object base + * and return the actual final code pointer + * -------------------------------------------------. + * + * @param [in,out] object [in,out] If non-null, the object. + * + * @return The given data converted to a generic. + */ delegate_generic_function delegate_mfp::convert_to_generic(delegate_generic_class *&object) const { diff --git a/src/lib/util/flac.c b/src/lib/util/flac.c index d2f576e637e..2e1e999977d 100644 --- a/src/lib/util/flac.c +++ b/src/lib/util/flac.c @@ -608,10 +608,17 @@ FLAC__StreamDecoderWriteStatus flac_decoder::write_callback(const ::FLAC__Frame return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; } - -//------------------------------------------------- -// error_callback - handle errors (ignore them) -//------------------------------------------------- +/** + * @fn void flac_decoder::error_callback_static(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) + * + * @brief ------------------------------------------------- + * error_callback - handle errors (ignore them) + * -------------------------------------------------. + * + * @param decoder The decoder. + * @param status The status. + * @param [in,out] client_data If non-null, information describing the client. + */ void flac_decoder::error_callback_static(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) { diff --git a/src/lib/util/harddisk.c b/src/lib/util/harddisk.c index 4760a5fd51f..4b041cf29a8 100644 --- a/src/lib/util/harddisk.c +++ b/src/lib/util/harddisk.c @@ -97,6 +97,16 @@ chd_file *hard_disk_get_chd(hard_disk_file *file) a hard disk -------------------------------------------------*/ +/** + * @fn hard_disk_info *hard_disk_get_info(hard_disk_file *file) + * + * @brief Hard disk get information. + * + * @param [in,out] file If non-null, the file. + * + * @return null if it fails, else a hard_disk_info*. + */ + hard_disk_info *hard_disk_get_info(hard_disk_file *file) { return &file->info; @@ -108,6 +118,18 @@ hard_disk_info *hard_disk_get_info(hard_disk_file *file) disk -------------------------------------------------*/ +/** + * @fn UINT32 hard_disk_read(hard_disk_file *file, UINT32 lbasector, void *buffer) + * + * @brief Hard disk read. + * + * @param [in,out] file If non-null, the file. + * @param lbasector The lbasector. + * @param [in,out] buffer If non-null, the buffer. + * + * @return An UINT32. + */ + UINT32 hard_disk_read(hard_disk_file *file, UINT32 lbasector, void *buffer) { chd_error err = file->chd->read_units(lbasector, buffer); @@ -120,6 +142,18 @@ UINT32 hard_disk_read(hard_disk_file *file, UINT32 lbasector, void *buffer) disk -------------------------------------------------*/ +/** + * @fn UINT32 hard_disk_write(hard_disk_file *file, UINT32 lbasector, const void *buffer) + * + * @brief Hard disk write. + * + * @param [in,out] file If non-null, the file. + * @param lbasector The lbasector. + * @param buffer The buffer. + * + * @return An UINT32. + */ + UINT32 hard_disk_write(hard_disk_file *file, UINT32 lbasector, const void *buffer) { chd_error err = file->chd->write_units(lbasector, buffer); diff --git a/src/lib/util/hashing.c b/src/lib/util/hashing.c index 1481de34a12..d7244d4edcf 100644 --- a/src/lib/util/hashing.c +++ b/src/lib/util/hashing.c @@ -214,10 +214,17 @@ bool crc16_t::from_string(const char *string, int length) return true; } - -//------------------------------------------------- -// as_string - convert to a string -//------------------------------------------------- +/** + * @fn const char *crc16_t::as_string(std::string &buffer) const + * + * @brief ------------------------------------------------- + * as_string - convert to a string + * -------------------------------------------------. + * + * @param [in,out] buffer The buffer. + * + * @return null if it fails, else a char*. + */ const char *crc16_t::as_string(std::string &buffer) const { @@ -225,11 +232,16 @@ const char *crc16_t::as_string(std::string &buffer) const return buffer.c_str(); } - -//------------------------------------------------- -// append - hash a block of data, appending to -// the currently-accumulated value -//------------------------------------------------- +/** + * @fn void crc16_creator::append(const void *data, UINT32 length) + * + * @brief ------------------------------------------------- + * append - hash a block of data, appending to the currently-accumulated value + * -------------------------------------------------. + * + * @param data The data. + * @param length The length. + */ void crc16_creator::append(const void *data, UINT32 length) { diff --git a/src/lib/util/huffman.c b/src/lib/util/huffman.c index 7e6d1906456..7f804aec222 100644 --- a/src/lib/util/huffman.c +++ b/src/lib/util/huffman.c @@ -730,10 +730,20 @@ huffman_8bit_decoder::huffman_8bit_decoder() { } - -//------------------------------------------------- -// decode - decode a full buffer -//------------------------------------------------- +/** + * @fn huffman_error huffman_8bit_decoder::decode(const UINT8 *source, UINT32 slength, UINT8 *dest, UINT32 dlength) + * + * @brief ------------------------------------------------- + * decode - decode a full buffer + * -------------------------------------------------. + * + * @param source Source for the. + * @param slength The slength. + * @param [in,out] dest If non-null, destination for the. + * @param dlength The dlength. + * + * @return A huffman_error. + */ huffman_error huffman_8bit_decoder::decode(const UINT8 *source, UINT32 slength, UINT8 *dest, UINT32 dlength) { diff --git a/src/lib/util/jedparse.c b/src/lib/util/jedparse.c index b8aa6d85418..37bee01fa85 100644 --- a/src/lib/util/jedparse.c +++ b/src/lib/util/jedparse.c @@ -410,6 +410,18 @@ int jedbin_parse(const void *data, size_t length, jed_data *result) based on the jed_data provided -------------------------------------------------*/ +/** + * @fn size_t jedbin_output(const jed_data *data, void *result, size_t length) + * + * @brief Jedbin output. + * + * @param data The data. + * @param [out] result If non-null, the result. + * @param length The length. + * + * @return A size_t. + */ + size_t jedbin_output(const jed_data *data, void *result, size_t length) { UINT8 *curdst = (UINT8 *)result; diff --git a/src/lib/util/md5.c b/src/lib/util/md5.c index 1fdcb26de03..7c571d9442e 100644 --- a/src/lib/util/md5.c +++ b/src/lib/util/md5.c @@ -153,6 +153,16 @@ MD5Final(md5byte digest[16], struct MD5Context *ctx) * reflect the addition of 16 longwords of new data. MD5Update blocks * the data and converts bytes into longwords for this routine. */ + +/** + * @fn void MD5Transform(UWORD32 buf[4], UWORD32 const in[16]) + * + * @brief Md 5 transform. + * + * @param buf The buffer. + * @param in The in. + */ + void MD5Transform(UWORD32 buf[4], UWORD32 const in[16]) { diff --git a/src/lib/util/opresolv.c b/src/lib/util/opresolv.c index 0cfa1030932..0dd9252d7b6 100644 --- a/src/lib/util/opresolv.c +++ b/src/lib/util/opresolv.c @@ -536,14 +536,31 @@ optreserr_t option_resolution_isvalidvalue(const char *specification, int option return OPTIONRESOLUTION_ERROR_PARAMOUTOFRANGE; } - +/** + * @fn int option_resolution_contains(const char *specification, int option_char) + * + * @brief Option resolution contains. + * + * @param specification The specification. + * @param option_char The option character. + * + * @return An int. + */ int option_resolution_contains(const char *specification, int option_char) { return strchr(specification, option_char) != NULL; } - +/** + * @fn const char *option_resolution_error_string(optreserr_t err) + * + * @brief Option resolution error string. + * + * @param err The error. + * + * @return null if it fails, else a char*. + */ const char *option_resolution_error_string(optreserr_t err) { diff --git a/src/lib/util/options.c b/src/lib/util/options.c index 62c3cc0379a..b365c1dd0ff 100644 --- a/src/lib/util/options.c +++ b/src/lib/util/options.c @@ -709,10 +709,15 @@ void core_options::remove_entry(core_options::entry &delentry) m_entrylist.remove(delentry); } - -//------------------------------------------------- -// copyfrom - copy options from another set -//------------------------------------------------- +/** + * @fn void core_options::copyfrom(const core_options &src) + * + * @brief ------------------------------------------------- + * copyfrom - copy options from another set + * -------------------------------------------------. + * + * @param src Source for the. + */ void core_options::copyfrom(const core_options &src) { @@ -724,12 +729,21 @@ void core_options::copyfrom(const core_options &src) append_entry(*global_alloc(entry(curentry->name(), curentry->description(), curentry->flags(), curentry->default_value()))); } - -//------------------------------------------------- -// validate_and_set_data - make sure the data is -// of the appropriate type and within range, -// then set it -//------------------------------------------------- +/** + * @fn bool core_options::validate_and_set_data(core_options::entry &curentry, const char *newdata, int priority, std::string &error_string) + * + * @brief ------------------------------------------------- + * validate_and_set_data - make sure the data is of the appropriate type and within + * range, then set it + * -------------------------------------------------. + * + * @param [in,out] curentry The curentry. + * @param newdata The newdata. + * @param priority The priority. + * @param [in,out] error_string The error string. + * + * @return true if it succeeds, false if it fails. + */ bool core_options::validate_and_set_data(core_options::entry &curentry, const char *newdata, int priority, std::string &error_string) { diff --git a/src/lib/util/palette.c b/src/lib/util/palette.c index 321f5ebca72..7e20e7e9cb7 100644 --- a/src/lib/util/palette.c +++ b/src/lib/util/palette.c @@ -467,11 +467,16 @@ void palette_t::normalize_range(UINT32 start, UINT32 end, int lum_min, int lum_m } } - -//------------------------------------------------- -// update_adjusted_color - update a color index -// by group and index pair -//------------------------------------------------- +/** + * @fn void palette_t::update_adjusted_color(UINT32 group, UINT32 index) + * + * @brief ------------------------------------------------- + * update_adjusted_color - update a color index by group and index pair + * -------------------------------------------------. + * + * @param group The group. + * @param index Zero-based index of the. + */ void palette_t::update_adjusted_color(UINT32 group, UINT32 index) { diff --git a/src/lib/util/plaparse.c b/src/lib/util/plaparse.c index 03502e80560..f6228d2cbe9 100644 --- a/src/lib/util/plaparse.c +++ b/src/lib/util/plaparse.c @@ -294,6 +294,18 @@ static bool process_field(jed_data *data, const UINT8 **src, const UINT8 *srcend that has been loaded raw into memory -------------------------------------------------*/ +/** + * @fn int pla_parse(const void *data, size_t length, jed_data *result) + * + * @brief Pla parse. + * + * @param data The data. + * @param length The length. + * @param [out] result If non-null, the result. + * + * @return An int. + */ + int pla_parse(const void *data, size_t length, jed_data *result) { const UINT8 *src = (const UINT8 *)data; diff --git a/src/lib/util/png.c b/src/lib/util/png.c index 076b1b02965..224cdf8d3dc 100644 --- a/src/lib/util/png.c +++ b/src/lib/util/png.c @@ -1096,6 +1096,18 @@ png_error png_write_bitmap(core_file *fp, png_info *info, bitmap_t &bitmap, int ********************************************************************************/ +/** + * @fn png_error mng_capture_start(core_file *fp, bitmap_t &bitmap, double rate) + * + * @brief Mng capture start. + * + * @param [in,out] fp If non-null, the fp. + * @param [in,out] bitmap The bitmap. + * @param rate The rate. + * + * @return A png_error. + */ + png_error mng_capture_start(core_file *fp, bitmap_t &bitmap, double rate) { UINT8 mhdr[28]; @@ -1118,11 +1130,35 @@ png_error mng_capture_start(core_file *fp, bitmap_t &bitmap, double rate) return PNGERR_NONE; } +/** + * @fn png_error mng_capture_frame(core_file *fp, png_info *info, bitmap_t &bitmap, int palette_length, const rgb_t *palette) + * + * @brief Mng capture frame. + * + * @param [in,out] fp If non-null, the fp. + * @param [in,out] info If non-null, the information. + * @param [in,out] bitmap The bitmap. + * @param palette_length Length of the palette. + * @param palette The palette. + * + * @return A png_error. + */ + png_error mng_capture_frame(core_file *fp, png_info *info, bitmap_t &bitmap, int palette_length, const rgb_t *palette) { return write_png_stream(fp, info, bitmap, palette_length, palette); } +/** + * @fn png_error mng_capture_stop(core_file *fp) + * + * @brief Mng capture stop. + * + * @param [in,out] fp If non-null, the fp. + * + * @return A png_error. + */ + png_error mng_capture_stop(core_file *fp) { return write_chunk(fp, NULL, MNG_CN_MEND, 0); diff --git a/src/lib/util/pool.c b/src/lib/util/pool.c index 807d3568077..0ca2be3deaa 100644 --- a/src/lib/util/pool.c +++ b/src/lib/util/pool.c @@ -570,6 +570,14 @@ static void memory_error(const char *message) pool behavior -------------------------------------------------*/ +/** + * @fn int test_memory_pools(void) + * + * @brief Tests memory pools. + * + * @return An int. + */ + int test_memory_pools(void) { object_pool *pool; diff --git a/src/lib/util/sha1.c b/src/lib/util/sha1.c index b8de519c7bc..732828d9ccf 100644 --- a/src/lib/util/sha1.c +++ b/src/lib/util/sha1.c @@ -121,6 +121,14 @@ static void WRITE_UINT32(unsigned char* data, UINT32 val) /* Initialize the SHA values */ +/** + * @fn void sha1_init(struct sha1_ctx *ctx) + * + * @brief Sha 1 initialise. + * + * @param [in,out] ctx If non-null, the context. + */ + void sha1_init(struct sha1_ctx *ctx) { @@ -145,6 +153,15 @@ sha1_init(struct sha1_ctx *ctx) Note that this function destroys the data area */ +/** + * @fn static void sha1_transform(UINT32 *state, UINT32 *data) + * + * @brief Sha 1 transform. + * + * @param [in,out] state If non-null, the state. + * @param [in,out] data If non-null, the data. + */ + static void sha1_transform(UINT32 *state, UINT32 *data) { @@ -250,6 +267,15 @@ sha1_transform(UINT32 *state, UINT32 *data) state[4] += E; } +/** + * @fn static void sha1_block(struct sha1_ctx *ctx, const UINT8 *block) + * + * @brief Sha 1 block. + * + * @param [in,out] ctx If non-null, the context. + * @param block The block. + */ + static void sha1_block(struct sha1_ctx *ctx, const UINT8 *block) { @@ -267,6 +293,16 @@ sha1_block(struct sha1_ctx *ctx, const UINT8 *block) sha1_transform(ctx->digest, data); } +/** + * @fn void sha1_update(struct sha1_ctx *ctx, unsigned length, const UINT8 *buffer) + * + * @brief Sha 1 update. + * + * @param [in,out] ctx If non-null, the context. + * @param length The length. + * @param buffer The buffer. + */ + void sha1_update(struct sha1_ctx *ctx, unsigned length, const UINT8 *buffer) @@ -303,6 +339,14 @@ sha1_update(struct sha1_ctx *ctx, /* Final wrapup - pad to SHA1_DATA_SIZE-byte boundary with the bit pattern 1 0* (64-bit count of bits processed, MSB-first) */ +/** + * @fn void sha1_final(struct sha1_ctx *ctx) + * + * @brief Sha 1 final. + * + * @param [in,out] ctx If non-null, the context. + */ + void sha1_final(struct sha1_ctx *ctx) { @@ -346,6 +390,16 @@ sha1_final(struct sha1_ctx *ctx) sha1_transform(ctx->digest, data); } +/** + * @fn void sha1_digest(const struct sha1_ctx *ctx, unsigned length, UINT8 *digest) + * + * @brief Sha 1 digest. + * + * @param ctx The context. + * @param length The length. + * @param [in,out] digest If non-null, the digest. + */ + void sha1_digest(const struct sha1_ctx *ctx, unsigned length, diff --git a/src/lib/util/tagmap.c b/src/lib/util/tagmap.c index c8247899dcc..95b0ec4fabf 100644 --- a/src/lib/util/tagmap.c +++ b/src/lib/util/tagmap.c @@ -13,6 +13,8 @@ #include "tagmap.h" #ifdef MAME_DEBUG +/** @brief The tagmap finds. */ INT32 g_tagmap_finds = 0; +/** @brief true to enable, false to disable the tagmap counter. */ bool g_tagmap_counter_enabled = false; #endif diff --git a/src/lib/util/un7z.c b/src/lib/util/un7z.c index 149ead60e4d..57c7eeb0890 100644 --- a/src/lib/util/un7z.c +++ b/src/lib/util/un7z.c @@ -467,6 +467,14 @@ _7z_error _7z_file_decompress(_7z_file *new_7z, void *buffer, UINT32 length) _7z_file -------------------------------------------------*/ +/** + * @fn static void free__7z_file(_7z_file *_7z) + * + * @brief Free 7z file. + * + * @param [in,out] _7z If non-null, the 7z. + */ + static void free__7z_file(_7z_file *_7z) { if (_7z != NULL) diff --git a/src/lib/util/unicode.c b/src/lib/util/unicode.c index c87965415d7..7f264bc1fb6 100644 --- a/src/lib/util/unicode.c +++ b/src/lib/util/unicode.c @@ -308,6 +308,16 @@ int utf16f_from_uchar(utf16_char *utf16string, size_t count, unicode_char uchar) previous character in a string -------------------------------------------------*/ +/** + * @fn const char *utf8_previous_char(const char *utf8string) + * + * @brief UTF 8 previous character. + * + * @param utf8string The UTF 8string. + * + * @return null if it fails, else a char*. + */ + const char *utf8_previous_char(const char *utf8string) { while ((*--utf8string & 0xc0) == 0x80) @@ -322,6 +332,16 @@ const char *utf8_previous_char(const char *utf8string) UTF-8 characters -------------------------------------------------*/ +/** + * @fn int utf8_is_valid_string(const char *utf8string) + * + * @brief UTF 8 is valid string. + * + * @param utf8string The UTF 8string. + * + * @return An int. + */ + int utf8_is_valid_string(const char *utf8string) { int remaining_length = strlen(utf8string); diff --git a/src/lib/util/unzip.c b/src/lib/util/unzip.c index 264029052be..072e29c130d 100644 --- a/src/lib/util/unzip.c +++ b/src/lib/util/unzip.c @@ -67,8 +67,29 @@ #define ZIPCRC 0x0e #define ZIPSIZE 0x12 #define ZIPUNCMP 0x16 + +/** + * @def ZIPFNLN + * + * @brief A macro that defines zipfnln. + */ + #define ZIPFNLN 0x1a + +/** + * @def ZIPXTRALN + * + * @brief A macro that defines zipxtraln. + */ + #define ZIPXTRALN 0x1c + +/** + * @def ZIPNAME + * + * @brief A macro that defines zipname. + */ + #define ZIPNAME 0x1e @@ -77,11 +98,31 @@ INLINE FUNCTIONS ***************************************************************************/ +/** + * @fn INLINE UINT16 read_word(UINT8 *buf) + * + * @brief Reads a word. + * + * @param [in,out] buf If non-null, the buffer. + * + * @return The word. + */ + INLINE UINT16 read_word(UINT8 *buf) { return (buf[1] << 8) | buf[0]; } +/** + * @fn INLINE UINT32 read_dword(UINT8 *buf) + * + * @brief Reads a double word. + * + * @param [in,out] buf If non-null, the buffer. + * + * @return The double word. + */ + INLINE UINT32 read_dword(UINT8 *buf) { return (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]; @@ -93,6 +134,7 @@ INLINE UINT32 read_dword(UINT8 *buf) GLOBAL VARIABLES ***************************************************************************/ +/** @brief The zip cache[ zip cache size]. */ static zip_file *zip_cache[ZIP_CACHE_SIZE]; @@ -122,6 +164,17 @@ static zip_error decompress_data_type_8(zip_file *zip, UINT64 offset, void *buff zip_file_open - opens a ZIP file for reading -------------------------------------------------*/ +/** + * @fn zip_error zip_file_open(const char *filename, zip_file **zip) + * + * @brief Queries if a given zip file open. + * + * @param filename Filename of the file. + * @param [in,out] zip If non-null, the zip. + * + * @return A zip_error. + */ + zip_error zip_file_open(const char *filename, zip_file **zip) { zip_error ziperr = ZIPERR_NONE; @@ -213,6 +266,14 @@ error: to the cache -------------------------------------------------*/ +/** + * @fn void zip_file_close(zip_file *zip) + * + * @brief Zip file close. + * + * @param [in,out] zip If non-null, the zip. + */ + void zip_file_close(zip_file *zip) { int cachenum; @@ -243,6 +304,12 @@ void zip_file_close(zip_file *zip) cache and free all memory -------------------------------------------------*/ +/** + * @fn void zip_file_cache_clear(void) + * + * @brief Zip file cache clear. + */ + void zip_file_cache_clear(void) { int cachenum; @@ -267,6 +334,16 @@ void zip_file_cache_clear(void) in the ZIP -------------------------------------------------*/ +/** + * @fn const zip_file_header *zip_file_first_file(zip_file *zip) + * + * @brief Zip file first file. + * + * @param [in,out] zip If non-null, the zip. + * + * @return null if it fails, else a zip_file_header*. + */ + const zip_file_header *zip_file_first_file(zip_file *zip) { /* reset the position and go from there */ @@ -280,6 +357,16 @@ const zip_file_header *zip_file_first_file(zip_file *zip) in the ZIP -------------------------------------------------*/ +/** + * @fn const zip_file_header *zip_file_next_file(zip_file *zip) + * + * @brief Zip file next file. + * + * @param [in,out] zip If non-null, the zip. + * + * @return null if it fails, else a zip_file_header*. + */ + const zip_file_header *zip_file_next_file(zip_file *zip) { /* fix up any modified data */ @@ -337,6 +424,18 @@ const zip_file_header *zip_file_next_file(zip_file *zip) from a ZIP into the target buffer -------------------------------------------------*/ +/** + * @fn zip_error zip_file_decompress(zip_file *zip, void *buffer, UINT32 length) + * + * @brief Zip file decompress. + * + * @param [in,out] zip If non-null, the zip. + * @param [in,out] buffer If non-null, the buffer. + * @param length The length. + * + * @return A zip_error. + */ + zip_error zip_file_decompress(zip_file *zip, void *buffer, UINT32 length) { zip_error ziperr; @@ -384,6 +483,14 @@ zip_error zip_file_decompress(zip_file *zip, void *buffer, UINT32 length) zip_file -------------------------------------------------*/ +/** + * @fn static void free_zip_file(zip_file *zip) + * + * @brief Free zip file. + * + * @param [in,out] zip If non-null, the zip. + */ + static void free_zip_file(zip_file *zip) { if (zip != NULL) @@ -410,6 +517,16 @@ static void free_zip_file(zip_file *zip) read_ecd - read the ECD data -------------------------------------------------*/ +/** + * @fn static zip_error read_ecd(zip_file *zip) + * + * @brief Reads an ecd. + * + * @param [in,out] zip If non-null, the zip. + * + * @return The ecd. + */ + static zip_error read_ecd(zip_file *zip) { UINT32 buflen = 1024; @@ -484,6 +601,17 @@ static zip_error read_ecd(zip_file *zip) offset of the compressed data -------------------------------------------------*/ +/** + * @fn static zip_error get_compressed_data_offset(zip_file *zip, UINT64 *offset) + * + * @brief Gets compressed data offset. + * + * @param [in,out] zip If non-null, the zip. + * @param [in,out] offset If non-null, the offset. + * + * @return The compressed data offset. + */ + static zip_error get_compressed_data_offset(zip_file *zip, UINT64 *offset) { file_error error; @@ -521,6 +649,19 @@ static zip_error get_compressed_data_offset(zip_file *zip, UINT64 *offset) type 0 data (which is uncompressed) -------------------------------------------------*/ +/** + * @fn static zip_error decompress_data_type_0(zip_file *zip, UINT64 offset, void *buffer, UINT32 length) + * + * @brief Decompress the data type 0. + * + * @param [in,out] zip If non-null, the zip. + * @param offset The offset. + * @param [in,out] buffer If non-null, the buffer. + * @param length The length. + * + * @return A zip_error. + */ + static zip_error decompress_data_type_0(zip_file *zip, UINT64 offset, void *buffer, UINT32 length) { file_error filerr; @@ -542,6 +683,19 @@ static zip_error decompress_data_type_0(zip_file *zip, UINT64 offset, void *buff type 8 data (which is deflated) -------------------------------------------------*/ +/** + * @fn static zip_error decompress_data_type_8(zip_file *zip, UINT64 offset, void *buffer, UINT32 length) + * + * @brief Decompress the data type 8. + * + * @param [in,out] zip If non-null, the zip. + * @param offset The offset. + * @param [in,out] buffer If non-null, the buffer. + * @param length The length. + * + * @return A zip_error. + */ + static zip_error decompress_data_type_8(zip_file *zip, UINT64 offset, void *buffer, UINT32 length) { UINT32 input_remaining = zip->header.compressed_length; diff --git a/src/lib/util/vbiparse.c b/src/lib/util/vbiparse.c index 3f22e51c990..43cfb57c158 100644 --- a/src/lib/util/vbiparse.c +++ b/src/lib/util/vbiparse.c @@ -276,6 +276,18 @@ int vbi_parse_white_flag(const UINT16 *source, int sourcewidth, int sourceshift) frame -------------------------------------------------*/ +/** + * @fn void vbi_parse_all(const UINT16 *source, int sourcerowpixels, int sourcewidth, int sourceshift, vbi_metadata *vbi) + * + * @brief Vbi parse all. + * + * @param source Source for the. + * @param sourcerowpixels The sourcerowpixels. + * @param sourcewidth The sourcewidth. + * @param sourceshift The sourceshift. + * @param [in,out] vbi If non-null, the vbi. + */ + void vbi_parse_all(const UINT16 *source, int sourcerowpixels, int sourcewidth, int sourceshift, vbi_metadata *vbi) { UINT32 bits[2][24]; @@ -338,6 +350,16 @@ void vbi_parse_all(const UINT16 *source, int sourcerowpixels, int sourcewidth, i into a smaller form for storage -------------------------------------------------*/ +/** + * @fn void vbi_metadata_pack(UINT8 *dest, UINT32 framenum, const vbi_metadata *vbi) + * + * @brief Vbi metadata pack. + * + * @param [in,out] dest If non-null, destination for the. + * @param framenum The framenum. + * @param vbi The vbi. + */ + void vbi_metadata_pack(UINT8 *dest, UINT32 framenum, const vbi_metadata *vbi) { dest[0] = framenum >> 16; @@ -364,6 +386,16 @@ void vbi_metadata_pack(UINT8 *dest, UINT32 framenum, const vbi_metadata *vbi) from a smaller form into the full structure -------------------------------------------------*/ +/** + * @fn void vbi_metadata_unpack(vbi_metadata *vbi, UINT32 *framenum, const UINT8 *source) + * + * @brief Vbi metadata unpack. + * + * @param [in,out] vbi If non-null, the vbi. + * @param [in,out] framenum If non-null, the framenum. + * @param source Source for the. + */ + void vbi_metadata_unpack(vbi_metadata *vbi, UINT32 *framenum, const UINT8 *source) { if (framenum != NULL) diff --git a/src/lib/util/xmlfile.c b/src/lib/util/xmlfile.c index 7956654a984..193717b30aa 100644 --- a/src/lib/util/xmlfile.c +++ b/src/lib/util/xmlfile.c @@ -451,6 +451,18 @@ int xml_get_attribute_int_format(xml_data_node *node, const char *attribute) found, return = the provided default -------------------------------------------------*/ +/** + * @fn float xml_get_attribute_float(xml_data_node *node, const char *attribute, float defvalue) + * + * @brief XML get attribute float. + * + * @param [in,out] node If non-null, the node. + * @param attribute The attribute. + * @param defvalue The defvalue. + * + * @return A float. + */ + float xml_get_attribute_float(xml_data_node *node, const char *attribute, float defvalue) { const char *string = xml_get_attribute_string(node, attribute, NULL); @@ -467,6 +479,18 @@ float xml_get_attribute_float(xml_data_node *node, const char *attribute, float string value on the node -------------------------------------------------*/ +/** + * @fn xml_attribute_node *xml_set_attribute(xml_data_node *node, const char *name, const char *value) + * + * @brief XML set attribute. + * + * @param [in,out] node If non-null, the node. + * @param name The name. + * @param value The value. + * + * @return null if it fails, else an xml_attribute_node*. + */ + xml_attribute_node *xml_set_attribute(xml_data_node *node, const char *name, const char *value) { xml_attribute_node *anode; @@ -495,6 +519,18 @@ xml_attribute_node *xml_set_attribute(xml_data_node *node, const char *name, con integer value on the node -------------------------------------------------*/ +/** + * @fn xml_attribute_node *xml_set_attribute_int(xml_data_node *node, const char *name, int value) + * + * @brief XML set attribute int. + * + * @param [in,out] node If non-null, the node. + * @param name The name. + * @param value The value. + * + * @return null if it fails, else an xml_attribute_node*. + */ + xml_attribute_node *xml_set_attribute_int(xml_data_node *node, const char *name, int value) { char buffer[100]; @@ -508,6 +544,18 @@ xml_attribute_node *xml_set_attribute_int(xml_data_node *node, const char *name, float value on the node -------------------------------------------------*/ +/** + * @fn xml_attribute_node *xml_set_attribute_float(xml_data_node *node, const char *name, float value) + * + * @brief XML set attribute float. + * + * @param [in,out] node If non-null, the node. + * @param name The name. + * @param value The value. + * + * @return null if it fails, else an xml_attribute_node*. + */ + xml_attribute_node *xml_set_attribute_float(xml_data_node *node, const char *name, float value) { char buffer[100]; @@ -526,6 +574,16 @@ xml_attribute_node *xml_set_attribute_float(xml_data_node *node, const char *nam to ensure it doesn't contain embedded tags -------------------------------------------------*/ +/** + * @fn const char *xml_normalize_string(const char *string) + * + * @brief XML normalize string. + * + * @param string The string. + * + * @return null if it fails, else a char*. + */ + const char *xml_normalize_string(const char *string) { static char buffer[1024]; @@ -564,6 +622,16 @@ const char *xml_normalize_string(const char *string) systems -------------------------------------------------*/ +/** + * @fn static void *expat_malloc(size_t size) + * + * @brief Expat malloc. + * + * @param size The size. + * + * @return null if it fails, else a void*. + */ + static void *expat_malloc(size_t size) { UINT32 *result = (UINT32 *)malloc(size + 4 * sizeof(UINT32)); @@ -571,12 +639,31 @@ static void *expat_malloc(size_t size) return &result[4]; } +/** + * @fn static void expat_free(void *ptr) + * + * @brief Expat free. + * + * @param [in,out] ptr If non-null, the pointer. + */ + static void expat_free(void *ptr) { if (ptr != NULL) free(&((UINT32 *)ptr)[-4]); } +/** + * @fn static void *expat_realloc(void *ptr, size_t size) + * + * @brief Expat realloc. + * + * @param [in,out] ptr If non-null, the pointer. + * @param size The size. + * + * @return null if it fails, else a void*. + */ + static void *expat_realloc(void *ptr, size_t size) { void *newptr = expat_malloc(size); @@ -596,6 +683,17 @@ static void *expat_realloc(void *ptr, size_t size) expat_setup_parser - set up expat for parsing -------------------------------------------------*/ +/** + * @fn static int expat_setup_parser(xml_parse_info *parse_info, xml_parse_options *opts) + * + * @brief Expat setup parser. + * + * @param [in,out] parse_info If non-null, information describing the parse. + * @param [in,out] opts If non-null, options for controlling the operation. + * + * @return An int. + */ + static int expat_setup_parser(xml_parse_info *parse_info, xml_parse_options *opts) { XML_Memory_Handling_Suite memcallbacks; @@ -647,6 +745,16 @@ static int expat_setup_parser(xml_parse_info *parse_info, xml_parse_options *opt element -------------------------------------------------*/ +/** + * @fn static void expat_element_start(void *data, const XML_Char *name, const XML_Char **attributes) + * + * @brief Expat element start. + * + * @param [in,out] data If non-null, the data. + * @param name The name. + * @param attributes The attributes. + */ + static void expat_element_start(void *data, const XML_Char *name, const XML_Char **attributes) { xml_parse_info *parse_info = (xml_parse_info *) data; @@ -676,6 +784,16 @@ static void expat_element_start(void *data, const XML_Char *name, const XML_Char element data -------------------------------------------------*/ +/** + * @fn static void expat_data(void *data, const XML_Char *s, int len) + * + * @brief Expat data. + * + * @param [in,out] data If non-null, the data. + * @param s The const XML_Char * to process. + * @param len The length. + */ + static void expat_data(void *data, const XML_Char *s, int len) { xml_parse_info *parse_info = (xml_parse_info *) data; @@ -714,6 +832,15 @@ static void expat_data(void *data, const XML_Char *s, int len) of an element -------------------------------------------------*/ +/** + * @fn static void expat_element_end(void *data, const XML_Char *name) + * + * @brief Expat element end. + * + * @param [in,out] data If non-null, the data. + * @param name The name. + */ + static void expat_element_end(void *data, const XML_Char *name) { xml_parse_info *parse_info = (xml_parse_info *) data; @@ -764,6 +891,18 @@ static void expat_element_end(void *data, const XML_Char *name) add_child - add a new node to the parent -------------------------------------------------*/ +/** + * @fn static xml_data_node *add_child(xml_data_node *parent, const char *name, const char *value) + * + * @brief Adds a child. + * + * @param [in,out] parent If non-null, the parent. + * @param name The name. + * @param value The value. + * + * @return null if it fails, else an xml_data_node*. + */ + static xml_data_node *add_child(xml_data_node *parent, const char *name, const char *value) { xml_data_node **pnode; @@ -806,6 +945,18 @@ static xml_data_node *add_child(xml_data_node *parent, const char *name, const c given node -------------------------------------------------*/ +/** + * @fn static xml_attribute_node *add_attribute(xml_data_node *node, const char *name, const char *value) + * + * @brief Adds an attribute. + * + * @param [in,out] node If non-null, the node. + * @param name The name. + * @param value The value. + * + * @return null if it fails, else an xml_attribute_node*. + */ + static xml_attribute_node *add_attribute(xml_data_node *node, const char *name, const char *value) { xml_attribute_node *anode, **panode; @@ -849,6 +1000,16 @@ static xml_attribute_node *add_attribute(xml_data_node *node, const char *name, an XML node and its children to a file -------------------------------------------------*/ +/** + * @fn static void write_node_recursive(xml_data_node *node, int indent, core_file *file) + * + * @brief Writes a node recursive. + * + * @param [in,out] node If non-null, the node. + * @param indent The indent. + * @param [in,out] file If non-null, the file. + */ + static void write_node_recursive(xml_data_node *node, int indent, core_file *file) { xml_attribute_node *anode; @@ -892,6 +1053,14 @@ static void write_node_recursive(xml_data_node *node, int indent, core_file *fil the data allocated to an XML node -------------------------------------------------*/ +/** + * @fn static void free_node_recursive(xml_data_node *node) + * + * @brief Free node recursive. + * + * @param [in,out] node If non-null, the node. + */ + static void free_node_recursive(xml_data_node *node) { xml_attribute_node *anode, *nanode; diff --git a/src/lib/util/zippath.c b/src/lib/util/zippath.c index d24f8438509..8d22952223a 100644 --- a/src/lib/util/zippath.c +++ b/src/lib/util/zippath.c @@ -22,13 +22,25 @@ TYPE DEFINITIONS ***************************************************************************/ +/** + * @struct zippath_returned_directory + * + * @brief A zippath returned directory. + */ + struct zippath_returned_directory { + /** @brief The next. */ zippath_returned_directory *next; + /** @brief The name. */ std::string name; }; - +/** + * @class zippath_directory + * + * @brief A zippath directory. + */ class zippath_directory { @@ -41,16 +53,23 @@ public: returned_dirlist(NULL) { } /* common */ + /** @brief true to returned parent. */ bool returned_parent; + /** @brief The returned entry. */ osd_directory_entry returned_entry; /* specific to normal directories */ + /** @brief Pathname of the directory. */ osd_directory *directory; /* specific to ZIP directories */ + /** @brief true to called zip first. */ bool called_zip_first; + /** @brief The zipfile. */ zip_file *zipfile; + /** @brief The zipprefix. */ std::string zipprefix; + /** @brief The returned dirlist. */ zippath_returned_directory *returned_dirlist; }; @@ -69,9 +88,17 @@ static int is_7z_file(const char *path); PATH OPERATIONS ***************************************************************************/ -//============================================================ -// is_path_separator -//============================================================ +/** + * @fn int is_path_separator(char c) + * + * @brief ============================================================ + * is_path_separator + * ============================================================. + * + * @param c The character. + * + * @return An int. + */ int is_path_separator(char c) { @@ -82,6 +109,16 @@ int is_path_separator(char c) parse_parent_path - parses out the parent path -------------------------------------------------*/ +/** + * @fn static void parse_parent_path(const char *path, int *beginpos, int *endpos) + * + * @brief Parse parent path. + * + * @param path Full pathname of the file. + * @param [in,out] beginpos If non-null, the beginpos. + * @param [in,out] endpos If non-null, the endpos. + */ + static void parse_parent_path(const char *path, int *beginpos, int *endpos) { int length = strlen(path); @@ -111,6 +148,17 @@ static void parse_parent_path(const char *path, int *beginpos, int *endpos) zippath_parent - retrieves the parent directory -------------------------------------------------*/ +/** + * @fn std::string &zippath_parent(std::string &dst, const char *path) + * + * @brief Zippath parent. + * + * @param [in,out] dst Destination for the. + * @param path Full pathname of the file. + * + * @return A std::string& + */ + std::string &zippath_parent(std::string &dst, const char *path) { int pos; @@ -133,6 +181,17 @@ std::string &zippath_parent(std::string &dst, const char *path) directory basename -------------------------------------------------*/ +/** + * @fn std::string &zippath_parent_basename(std::string &dst, const char *path) + * + * @brief Zippath parent basename. + * + * @param [in,out] dst Destination for the. + * @param path Full pathname of the file. + * + * @return A std::string& + */ + std::string &zippath_parent_basename(std::string &dst, const char *path) { int beginpos, endpos; @@ -147,6 +206,18 @@ std::string &zippath_parent_basename(std::string &dst, const char *path) zippath_combine - combines two paths -------------------------------------------------*/ +/** + * @fn std::string &zippath_combine(std::string &dst, const char *path1, const char *path2) + * + * @brief Zippath combine. + * + * @param [in,out] dst Destination for the. + * @param path1 The first path. + * @param path2 The second path. + * + * @return A std::string& + */ + std::string &zippath_combine(std::string &dst, const char *path1, const char *path2) { if (!strcmp(path2, ".")) @@ -183,6 +254,16 @@ std::string &zippath_combine(std::string &dst, const char *path1, const char *pa file_error to a zip_error -------------------------------------------------*/ +/** + * @fn static file_error file_error_from_zip_error(zip_error ziperr) + * + * @brief File error from zip error. + * + * @param ziperr The ziperr. + * + * @return A file_error. + */ + static file_error file_error_from_zip_error(zip_error ziperr) { file_error filerr; @@ -216,6 +297,18 @@ static file_error file_error_from_zip_error(zip_error ziperr) from a zip file entry -------------------------------------------------*/ +/** + * @fn static file_error create_core_file_from_zip(zip_file *zip, const zip_file_header *header, core_file *&file) + * + * @brief Creates core file from zip. + * + * @param [in,out] zip If non-null, the zip. + * @param header The header. + * @param [in,out] file [in,out] If non-null, the file. + * + * @return The new core file from zip. + */ + static file_error create_core_file_from_zip(zip_file *zip, const zip_file_header *header, core_file *&file) { file_error filerr; @@ -251,6 +344,19 @@ done: zippath_fopen - opens a zip path file -------------------------------------------------*/ +/** + * @fn file_error zippath_fopen(const char *filename, UINT32 openflags, core_file *&file, std::string &revised_path) + * + * @brief Zippath fopen. + * + * @param filename Filename of the file. + * @param openflags The openflags. + * @param [in,out] file [in,out] If non-null, the file. + * @param [in,out] revised_path Full pathname of the revised file. + * + * @return A file_error. + */ + file_error zippath_fopen(const char *filename, UINT32 openflags, core_file *&file, std::string &revised_path) { file_error filerr = FILERR_NOT_FOUND; @@ -380,6 +486,16 @@ done: is_root - tests to see if this path is the root -------------------------------------------------*/ +/** + * @fn static int is_root(const char *path) + * + * @brief Is root. + * + * @param path Full pathname of the file. + * + * @return An int. + */ + static int is_root(const char *path) { int i = 0; @@ -402,6 +518,16 @@ static int is_root(const char *path) 7-zip file -------------------------------------------------*/ +/** + * @fn static int is_7z_file(const char *path) + * + * @brief Is 7z file. + * + * @param path Full pathname of the file. + * + * @return An int. + */ + static int is_7z_file(const char *path) { const char *s = strrchr(path, '.'); @@ -414,6 +540,16 @@ static int is_7z_file(const char *path) ZIP file -------------------------------------------------*/ +/** + * @fn static int is_zip_file(const char *path) + * + * @brief Is zip file. + * + * @param path Full pathname of the file. + * + * @return An int. + */ + static int is_zip_file(const char *path) { const char *s = strrchr(path, '.'); @@ -427,6 +563,16 @@ static int is_zip_file(const char *path) character is a path separator within a ZIP file -------------------------------------------------*/ +/** + * @fn static int is_zip_file_separator(char c) + * + * @brief Is zip file separator. + * + * @param c The character. + * + * @return An int. + */ + static int is_zip_file_separator(char c) { return (c == '/') || (c == '\\'); @@ -439,6 +585,16 @@ static int is_zip_file_separator(char c) character is a path separator within a ZIP path -------------------------------------------------*/ +/** + * @fn static int is_zip_path_separator(char c) + * + * @brief Is zip path separator. + * + * @param c The character. + * + * @return An int. + */ + static int is_zip_path_separator(char c) { return is_zip_file_separator(c) || is_path_separator(c); @@ -451,6 +607,17 @@ static int is_zip_path_separator(char c) character, normalizing separators as '/' -------------------------------------------------*/ +/** + * @fn static char next_path_char(const char *s, int *pos) + * + * @brief Next path character. + * + * @param s The const char * to process. + * @param [in,out] pos If non-null, the position. + * + * @return A char. + */ + static char next_path_char(const char *s, int *pos) { char result; @@ -493,6 +660,18 @@ static char next_path_char(const char *s, int *pos) type of a sub path in a zip file -------------------------------------------------*/ +/** + * @fn static const zip_file_header *zippath_find_sub_path(zip_file *zipfile, const char *subpath, osd_dir_entry_type *type) + * + * @brief Zippath find sub path. + * + * @param [in,out] zipfile If non-null, the zipfile. + * @param subpath The subpath. + * @param [in,out] type If non-null, the type. + * + * @return null if it fails, else a zip_file_header*. + */ + static const zip_file_header *zippath_find_sub_path(zip_file *zipfile, const char *subpath, osd_dir_entry_type *type) { int i, j; @@ -546,6 +725,19 @@ static const zip_file_header *zippath_find_sub_path(zip_file *zipfile, const cha true path and ZIP entry components -------------------------------------------------*/ +/** + * @fn static file_error zippath_resolve(const char *path, osd_dir_entry_type &entry_type, zip_file *&zipfile, std::string &newpath) + * + * @brief Zippath resolve. + * + * @param path Full pathname of the file. + * @param [in,out] entry_type Type of the entry. + * @param [in,out] zipfile [in,out] If non-null, the zipfile. + * @param [in,out] newpath The newpath. + * + * @return A file_error. + */ + static file_error zippath_resolve(const char *path, osd_dir_entry_type &entry_type, zip_file *&zipfile, std::string &newpath) { file_error err; @@ -641,6 +833,17 @@ done: zippath_opendir - opens a directory -------------------------------------------------*/ +/** + * @fn file_error zippath_opendir(const char *path, zippath_directory **directory) + * + * @brief Zippath opendir. + * + * @param path Full pathname of the file. + * @param [in,out] directory If non-null, pathname of the directory. + * + * @return A file_error. + */ + file_error zippath_opendir(const char *path, zippath_directory **directory) { file_error err; @@ -701,6 +904,14 @@ done: zippath_closedir - closes a directory -------------------------------------------------*/ +/** + * @fn void zippath_closedir(zippath_directory *directory) + * + * @brief Zippath closedir. + * + * @param [in,out] directory If non-null, pathname of the directory. + */ + void zippath_closedir(zippath_directory *directory) { if (directory->directory != NULL) @@ -726,6 +937,17 @@ void zippath_closedir(zippath_directory *directory) returns the relative path -------------------------------------------------*/ +/** + * @fn static const char *get_relative_path(zippath_directory *directory, const zip_file_header *header) + * + * @brief Gets relative path. + * + * @param [in,out] directory If non-null, pathname of the directory. + * @param header The header. + * + * @return null if it fails, else the relative path. + */ + static const char *get_relative_path(zippath_directory *directory, const zip_file_header *header) { const char *result = NULL; @@ -747,6 +969,16 @@ static const char *get_relative_path(zippath_directory *directory, const zip_fil zippath_readdir - reads a directory -------------------------------------------------*/ +/** + * @fn const osd_directory_entry *zippath_readdir(zippath_directory *directory) + * + * @brief Zippath readdir. + * + * @param [in,out] directory If non-null, pathname of the directory. + * + * @return null if it fails, else an osd_directory_entry*. + */ + const osd_directory_entry *zippath_readdir(zippath_directory *directory) { const osd_directory_entry *result = NULL; @@ -853,6 +1085,16 @@ const osd_directory_entry *zippath_readdir(zippath_directory *directory) a ZIP path or FALSE if not -------------------------------------------------*/ +/** + * @fn int zippath_is_zip(zippath_directory *directory) + * + * @brief Zippath is zip. + * + * @param [in,out] directory If non-null, pathname of the directory. + * + * @return An int. + */ + int zippath_is_zip(zippath_directory *directory) { return directory->zipfile != NULL; diff --git a/src/mess/audio/mac.c b/src/mess/audio/mac.c index b93b4d86e0d..7a0b7a93a62 100644 --- a/src/mess/audio/mac.c +++ b/src/mess/audio/mac.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont /*************************************************************************** diff --git a/src/mess/drivers/apexc.c b/src/mess/drivers/apexc.c index 01be1660fa9..bc5515274e9 100644 --- a/src/mess/drivers/apexc.c +++ b/src/mess/drivers/apexc.c @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet, Robbbert /* drivers/apexc.c : APEXC driver diff --git a/src/mess/drivers/concept.c b/src/mess/drivers/concept.c index 4d15dd5e213..947d4bfcfa7 100644 --- a/src/mess/drivers/concept.c +++ b/src/mess/drivers/concept.c @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet, Brett Wyer /* Corvus Concept driver diff --git a/src/mess/drivers/exelv.c b/src/mess/drivers/exelv.c index f66216e03d9..c48bd0234dc 100644 --- a/src/mess/drivers/exelv.c +++ b/src/mess/drivers/exelv.c @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /* Experimental exelvision driver diff --git a/src/mess/drivers/lisa.c b/src/mess/drivers/lisa.c index e851ae42eaa..3bba439d0bc 100644 --- a/src/mess/drivers/lisa.c +++ b/src/mess/drivers/lisa.c @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /********************************************************************* diff --git a/src/mess/drivers/mac.c b/src/mess/drivers/mac.c index 65cdb2711ca..bc670603bdc 100644 --- a/src/mess/drivers/mac.c +++ b/src/mess/drivers/mac.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont /**************************************************************************** diff --git a/src/mess/drivers/pdp1.c b/src/mess/drivers/pdp1.c index 4dc3645143c..66ec3979cfb 100644 --- a/src/mess/drivers/pdp1.c +++ b/src/mess/drivers/pdp1.c @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /* diff --git a/src/mess/drivers/ti990_10.c b/src/mess/drivers/ti990_10.c index 8150b5437a4..f7f3f9ff219 100644 --- a/src/mess/drivers/ti990_10.c +++ b/src/mess/drivers/ti990_10.c @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /* TI990/10 driver diff --git a/src/mess/drivers/ti99_2.c b/src/mess/drivers/ti99_2.c index b5cc6681e35..41ed9ac2a7b 100644 --- a/src/mess/drivers/ti99_2.c +++ b/src/mess/drivers/ti99_2.c @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /* Experimental ti99/2 driver diff --git a/src/mess/drivers/tm990189.c b/src/mess/drivers/tm990189.c index b883c01ffcc..f6c778dd305 100644 --- a/src/mess/drivers/tm990189.c +++ b/src/mess/drivers/tm990189.c @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet, Robbbert /* Experimental tm990/189 ("University Module") driver. diff --git a/src/mess/drivers/tutor.c b/src/mess/drivers/tutor.c index c675256be72..1978e64fdb0 100644 --- a/src/mess/drivers/tutor.c +++ b/src/mess/drivers/tutor.c @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /* Experimental Tomy Tutor driver diff --git a/src/mess/drivers/tx0.c b/src/mess/drivers/tx0.c index c06cb542064..b00fcc1c714 100644 --- a/src/mess/drivers/tx0.c +++ b/src/mess/drivers/tx0.c @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /* TX-0 diff --git a/src/mess/includes/concept.h b/src/mess/includes/concept.h index 73dcb5f7e4e..c9759c893a8 100644 --- a/src/mess/includes/concept.h +++ b/src/mess/includes/concept.h @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet, Brett Wyer /***************************************************************************** * diff --git a/src/mess/includes/lisa.h b/src/mess/includes/lisa.h index fc034a1059f..c52c53fb833 100644 --- a/src/mess/includes/lisa.h +++ b/src/mess/includes/lisa.h @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /***************************************************************************** * diff --git a/src/mess/includes/mac.h b/src/mess/includes/mac.h index 36b9bf6e5f9..6b0092501fd 100644 --- a/src/mess/includes/mac.h +++ b/src/mess/includes/mac.h @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont /***************************************************************************** * diff --git a/src/mess/includes/pdp1.h b/src/mess/includes/pdp1.h index 80a7d297beb..ee2c5f7f703 100644 --- a/src/mess/includes/pdp1.h +++ b/src/mess/includes/pdp1.h @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /***************************************************************************** * diff --git a/src/mess/includes/tx0.h b/src/mess/includes/tx0.h index 83fc093a4b8..b961a415224 100644 --- a/src/mess/includes/tx0.h +++ b/src/mess/includes/tx0.h @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /***************************************************************************** * diff --git a/src/mess/machine/applefdc.c b/src/mess/machine/applefdc.c index cf9b08b206b..dac524308ba 100644 --- a/src/mess/machine/applefdc.c +++ b/src/mess/machine/applefdc.c @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:R. Belmont +// copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont /********************************************************************* applefdc.c diff --git a/src/mess/machine/applefdc.h b/src/mess/machine/applefdc.h index cd132a8e00a..38efb9036d2 100644 --- a/src/mess/machine/applefdc.h +++ b/src/mess/machine/applefdc.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:R. Belmont +// copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont /********************************************************************* applefdc.h diff --git a/src/mess/machine/concept.c b/src/mess/machine/concept.c index 8c547c51903..7beeb8fe1d7 100644 --- a/src/mess/machine/concept.c +++ b/src/mess/machine/concept.c @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet, Brett Wyer /* Corvus Concept driver diff --git a/src/mess/machine/lisa.c b/src/mess/machine/lisa.c index aee6ef4ba70..2e2b2bb6bc6 100644 --- a/src/mess/machine/lisa.c +++ b/src/mess/machine/lisa.c @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /* experimental LISA driver diff --git a/src/mess/machine/mac.c b/src/mess/machine/mac.c index 74bbaae1a00..7ce5a0ab2c4 100644 --- a/src/mess/machine/mac.c +++ b/src/mess/machine/mac.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont /**************************************************************************** diff --git a/src/mess/machine/smartmed.c b/src/mess/machine/smartmed.c index fcbb3966dad..32e9c53bcaa 100644 --- a/src/mess/machine/smartmed.c +++ b/src/mess/machine/smartmed.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet /* smartmed.c: SmartMedia Flash ROM emulation diff --git a/src/mess/machine/smartmed.h b/src/mess/machine/smartmed.h index 1e6c1d0b50c..4f15cf35a0f 100644 --- a/src/mess/machine/smartmed.h +++ b/src/mess/machine/smartmed.h @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet /* smartmed.h: header file for smartmed.c diff --git a/src/mess/machine/sonydriv.c b/src/mess/machine/sonydriv.c index da47caaf37a..31c88e4f988 100644 --- a/src/mess/machine/sonydriv.c +++ b/src/mess/machine/sonydriv.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont /********************************************************************* diff --git a/src/mess/machine/sonydriv.h b/src/mess/machine/sonydriv.h index 3ebd46cb601..52ecca6697a 100644 --- a/src/mess/machine/sonydriv.h +++ b/src/mess/machine/sonydriv.h @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont /********************************************************************* diff --git a/src/mess/machine/ti99/990_dk.c b/src/mess/machine/ti99/990_dk.c index ccdddbad62d..5eb8ea58892 100644 --- a/src/mess/machine/ti99/990_dk.c +++ b/src/mess/machine/ti99/990_dk.c @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /* 990_dk.c: emulation of a TI FD800 'Diablo' floppy disk controller diff --git a/src/mess/machine/ti99/990_dk.h b/src/mess/machine/ti99/990_dk.h index 63af5cfdc3c..eb044b2974f 100644 --- a/src/mess/machine/ti99/990_dk.h +++ b/src/mess/machine/ti99/990_dk.h @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /* 990_dk.h: include file for 990_dk.c diff --git a/src/mess/machine/ti99/990_hd.c b/src/mess/machine/ti99/990_hd.c index 31c5b73d1e5..fa0cd00646b 100644 --- a/src/mess/machine/ti99/990_hd.c +++ b/src/mess/machine/ti99/990_hd.c @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /* 990_hd.c: emulation of a generic ti990 hard disk controller, for use with diff --git a/src/mess/machine/ti99/990_hd.h b/src/mess/machine/ti99/990_hd.h index aad7cec651c..4c5e85f928d 100644 --- a/src/mess/machine/ti99/990_hd.h +++ b/src/mess/machine/ti99/990_hd.h @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /* 990_hd.h: include file for 990_hd.c diff --git a/src/mess/machine/ti99/990_tap.c b/src/mess/machine/ti99/990_tap.c index 65a77b9dd9d..20ca2333f7b 100644 --- a/src/mess/machine/ti99/990_tap.c +++ b/src/mess/machine/ti99/990_tap.c @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /* 990_tap.c: emulation of a generic ti990 tape controller, for use with diff --git a/src/mess/machine/ti99/990_tap.h b/src/mess/machine/ti99/990_tap.h index aed56f24ee2..09e2e30da0a 100644 --- a/src/mess/machine/ti99/990_tap.h +++ b/src/mess/machine/ti99/990_tap.h @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /* 990_tap.h: include file for 990_tap.c diff --git a/src/mess/tools/imgtool/imghd.c b/src/mess/tools/imgtool/imghd.c index d48e8a0f0b2..8ac129751f9 100644 --- a/src/mess/tools/imgtool/imghd.c +++ b/src/mess/tools/imgtool/imghd.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Nathan Woods, Raphael Nabet /* Code to interface the MESS image code with MAME's harddisk core. diff --git a/src/mess/tools/imgtool/modules/concept.c b/src/mess/tools/imgtool/modules/concept.c index 8cf115a9d4b..a5c5a37b1ad 100644 --- a/src/mess/tools/imgtool/modules/concept.c +++ b/src/mess/tools/imgtool/modules/concept.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet /* Handlers for concept floppy images diff --git a/src/mess/tools/imgtool/modules/fat.c b/src/mess/tools/imgtool/modules/fat.c index ce4bbff8c6d..4f2fca17c25 100644 --- a/src/mess/tools/imgtool/modules/fat.c +++ b/src/mess/tools/imgtool/modules/fat.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet /**************************************************************************** diff --git a/src/mess/tools/imgtool/modules/fat.h b/src/mess/tools/imgtool/modules/fat.h index b46ad77a357..46f741999c3 100644 --- a/src/mess/tools/imgtool/modules/fat.h +++ b/src/mess/tools/imgtool/modules/fat.h @@ -1,3 +1,3 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet void fat_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info); diff --git a/src/mess/tools/imgtool/modules/mac.c b/src/mess/tools/imgtool/modules/mac.c index 8e2465bab4e..53ae4be3ec0 100644 --- a/src/mess/tools/imgtool/modules/mac.c +++ b/src/mess/tools/imgtool/modules/mac.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet /**************************************************************************** diff --git a/src/mess/tools/imgtool/modules/macbin.c b/src/mess/tools/imgtool/modules/macbin.c index 5ecd20119ba..3ef85a039d1 100644 --- a/src/mess/tools/imgtool/modules/macbin.c +++ b/src/mess/tools/imgtool/modules/macbin.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet /**************************************************************************** diff --git a/src/mess/tools/imgtool/modules/macutil.c b/src/mess/tools/imgtool/modules/macutil.c index 3f8b0b90c96..fe2e1ade51a 100644 --- a/src/mess/tools/imgtool/modules/macutil.c +++ b/src/mess/tools/imgtool/modules/macutil.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet /**************************************************************************** diff --git a/src/mess/tools/imgtool/modules/macutil.h b/src/mess/tools/imgtool/modules/macutil.h index 1bb793467d9..71121dade31 100644 --- a/src/mess/tools/imgtool/modules/macutil.h +++ b/src/mess/tools/imgtool/modules/macutil.h @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet /**************************************************************************** diff --git a/src/mess/tools/imgtool/modules/pc_flop.c b/src/mess/tools/imgtool/modules/pc_flop.c index d7d498ef829..916cf873c46 100644 --- a/src/mess/tools/imgtool/modules/pc_flop.c +++ b/src/mess/tools/imgtool/modules/pc_flop.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet /**************************************************************************** diff --git a/src/mess/tools/imgtool/modules/pc_hard.c b/src/mess/tools/imgtool/modules/pc_hard.c index 9d3cfb79107..915032932c7 100644 --- a/src/mess/tools/imgtool/modules/pc_hard.c +++ b/src/mess/tools/imgtool/modules/pc_hard.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet /**************************************************************************** diff --git a/src/mess/tools/imgtool/modules/prodos.c b/src/mess/tools/imgtool/modules/prodos.c index 1e781759a86..5800e2bf9f3 100644 --- a/src/mess/tools/imgtool/modules/prodos.c +++ b/src/mess/tools/imgtool/modules/prodos.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet /**************************************************************************** diff --git a/src/mess/tools/imgtool/modules/ti99.c b/src/mess/tools/imgtool/modules/ti99.c index f8d25e5a72f..220cbebdb27 100644 --- a/src/mess/tools/imgtool/modules/ti99.c +++ b/src/mess/tools/imgtool/modules/ti99.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet /* Handlers for ti99 disk images diff --git a/src/mess/tools/imgtool/modules/ti990hd.c b/src/mess/tools/imgtool/modules/ti990hd.c index 37bcc6dd928..2c2a6c3a13c 100644 --- a/src/mess/tools/imgtool/modules/ti990hd.c +++ b/src/mess/tools/imgtool/modules/ti990hd.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet /* Handlers for ti990 disk images diff --git a/src/mess/tools/imgtool/modules/vzdos.c b/src/mess/tools/imgtool/modules/vzdos.c index 25e8dad5d38..d24d1286019 100644 --- a/src/mess/tools/imgtool/modules/vzdos.c +++ b/src/mess/tools/imgtool/modules/vzdos.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Raphael Nabet /**************************************************************************** diff --git a/src/mess/video/733_asr.c b/src/mess/video/733_asr.c index 5aabc4788be..da1286d69f5 100644 --- a/src/mess/video/733_asr.c +++ b/src/mess/video/733_asr.c @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /* 733 ASR emulation diff --git a/src/mess/video/733_asr.h b/src/mess/video/733_asr.h index 323e3f688fe..6182a21eb52 100644 --- a/src/mess/video/733_asr.h +++ b/src/mess/video/733_asr.h @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet #define asr733_chr_region ":gfx1" diff --git a/src/mess/video/911_chr.h b/src/mess/video/911_chr.h index de41d265a06..6d24b5d0415 100644 --- a/src/mess/video/911_chr.h +++ b/src/mess/video/911_chr.h @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /* 911_chr.h: character definitions for 911_vdt.c diff --git a/src/mess/video/911_key.h b/src/mess/video/911_key.h index cf0e77d2148..108bf85fd7d 100644 --- a/src/mess/video/911_key.h +++ b/src/mess/video/911_key.h @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /* key translation table for both US and UK terminals diff --git a/src/mess/video/911_vdt.c b/src/mess/video/911_vdt.c index 3c323cd10fe..c0d30600681 100644 --- a/src/mess/video/911_vdt.c +++ b/src/mess/video/911_vdt.c @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /* TI 911 VDT core. To be operated with the TI 990 line of computers (can be connected to diff --git a/src/mess/video/911_vdt.h b/src/mess/video/911_vdt.h index 3c8bbe02521..7eb0f55dbc1 100644 --- a/src/mess/video/911_vdt.h +++ b/src/mess/video/911_vdt.h @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet #include "sound/beep.h" diff --git a/src/mess/video/crt.c b/src/mess/video/crt.c index 214b88c0078..d075600baf7 100644 --- a/src/mess/video/crt.c +++ b/src/mess/video/crt.c @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /* video/crt.c diff --git a/src/mess/video/crt.h b/src/mess/video/crt.h index ccca938ad3b..cb0767ad0d9 100644 --- a/src/mess/video/crt.h +++ b/src/mess/video/crt.h @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /************************************************************************* diff --git a/src/mess/video/mac.c b/src/mess/video/mac.c index 1856aa4427e..baffedf186d 100644 --- a/src/mess/video/mac.c +++ b/src/mess/video/mac.c @@ -1,4 +1,4 @@ -// license:??? +// license:BSD-3-Clause // copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont /*************************************************************************** diff --git a/src/mess/video/pdp1.c b/src/mess/video/pdp1.c index e2735bb18b9..eea7b521679 100644 --- a/src/mess/video/pdp1.c +++ b/src/mess/video/pdp1.c @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /* video/pdp1.c diff --git a/src/mess/video/tx0.c b/src/mess/video/tx0.c index c74fb8df1ad..4da8462a4af 100644 --- a/src/mess/video/tx0.c +++ b/src/mess/video/tx0.c @@ -1,4 +1,4 @@ -// license:??? +// license:GPL-2.0+ // copyright-holders:Raphael Nabet /* TX-0 |