summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2016-10-22 13:13:17 +0200
committer Miodrag Milanovic <mmicko@gmail.com>2016-10-22 13:13:17 +0200
commitddb290d5f615019c33c42b8d94e5a5254cabcf33 (patch)
treea70f688b0df3acd19da7b1151e5902e3c6af3fa5 /src/lib
parent333bff8de64dfaeb98134000412796b4fdef970b (diff)
NOTICE (TYPE NAME CONSOLIDATION)
Use standard uint64_t, uint32_t, uint16_t or uint8_t instead of UINT64, UINT32, UINT16 or UINT8 also use standard int64_t, int32_t, int16_t or int8_t instead of INT64, INT32, INT16 or INT8
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/formats/a26_cas.cpp30
-rw-r--r--src/lib/formats/ace_tap.cpp14
-rw-r--r--src/lib/formats/ace_tap.h16
-rw-r--r--src/lib/formats/acorn_dsk.cpp80
-rw-r--r--src/lib/formats/acorn_dsk.h28
-rw-r--r--src/lib/formats/adam_cas.cpp6
-rw-r--r--src/lib/formats/afs_dsk.cpp2
-rw-r--r--src/lib/formats/afs_dsk.h2
-rw-r--r--src/lib/formats/ami_dsk.cpp28
-rw-r--r--src/lib/formats/ami_dsk.h8
-rw-r--r--src/lib/formats/ap2_dsk.cpp266
-rw-r--r--src/lib/formats/ap2_dsk.h22
-rw-r--r--src/lib/formats/ap_dsk35.cpp324
-rw-r--r--src/lib/formats/ap_dsk35.h12
-rw-r--r--src/lib/formats/apf_apt.cpp34
-rw-r--r--src/lib/formats/apollo_dsk.cpp6
-rw-r--r--src/lib/formats/apollo_dsk.h2
-rw-r--r--src/lib/formats/apridisk.cpp34
-rw-r--r--src/lib/formats/apridisk.h4
-rw-r--r--src/lib/formats/atom_tap.cpp10
-rw-r--r--src/lib/formats/basicdsk.cpp22
-rw-r--r--src/lib/formats/basicdsk.h8
-rw-r--r--src/lib/formats/c3040_dsk.cpp2
-rw-r--r--src/lib/formats/c3040_dsk.h2
-rw-r--r--src/lib/formats/c4040_dsk.cpp2
-rw-r--r--src/lib/formats/c4040_dsk.h2
-rw-r--r--src/lib/formats/camplynx_cas.cpp20
-rw-r--r--src/lib/formats/cassimg.cpp122
-rw-r--r--src/lib/formats/cassimg.h38
-rw-r--r--src/lib/formats/cbm_crt.cpp20
-rw-r--r--src/lib/formats/cbm_crt.h30
-rw-r--r--src/lib/formats/cbm_tap.cpp18
-rw-r--r--src/lib/formats/ccvf_dsk.cpp16
-rw-r--r--src/lib/formats/ccvf_dsk.h8
-rw-r--r--src/lib/formats/cgen_cas.cpp8
-rw-r--r--src/lib/formats/coco_cas.cpp24
-rw-r--r--src/lib/formats/concept_dsk.cpp18
-rw-r--r--src/lib/formats/concept_dsk.h6
-rw-r--r--src/lib/formats/coupedsk.cpp12
-rw-r--r--src/lib/formats/coupedsk.h4
-rw-r--r--src/lib/formats/cqm_dsk.cpp44
-rw-r--r--src/lib/formats/cqm_dsk.h4
-rw-r--r--src/lib/formats/csw_cas.cpp52
-rw-r--r--src/lib/formats/d64_dsk.cpp40
-rw-r--r--src/lib/formats/d64_dsk.h34
-rw-r--r--src/lib/formats/d80_dsk.cpp6
-rw-r--r--src/lib/formats/d80_dsk.h6
-rw-r--r--src/lib/formats/d88_dsk.cpp90
-rw-r--r--src/lib/formats/d88_dsk.h4
-rw-r--r--src/lib/formats/dcp_dsk.cpp14
-rw-r--r--src/lib/formats/dcp_dsk.h4
-rw-r--r--src/lib/formats/dfi_dsk.cpp36
-rw-r--r--src/lib/formats/dfi_dsk.h4
-rw-r--r--src/lib/formats/dim_dsk.cpp20
-rw-r--r--src/lib/formats/dim_dsk.h4
-rw-r--r--src/lib/formats/dip_dsk.cpp8
-rw-r--r--src/lib/formats/dip_dsk.h4
-rw-r--r--src/lib/formats/dmk_dsk.cpp18
-rw-r--r--src/lib/formats/dmk_dsk.h4
-rw-r--r--src/lib/formats/dsk_dsk.cpp86
-rw-r--r--src/lib/formats/dsk_dsk.h4
-rw-r--r--src/lib/formats/esq16_dsk.cpp18
-rw-r--r--src/lib/formats/esq16_dsk.h6
-rw-r--r--src/lib/formats/esq8_dsk.cpp10
-rw-r--r--src/lib/formats/esq8_dsk.h4
-rw-r--r--src/lib/formats/fc100_cas.cpp20
-rw-r--r--src/lib/formats/fdd_dsk.cpp26
-rw-r--r--src/lib/formats/fdd_dsk.h4
-rw-r--r--src/lib/formats/fdi_dsk.cpp64
-rw-r--r--src/lib/formats/flex_dsk.cpp6
-rw-r--r--src/lib/formats/flex_dsk.h34
-rw-r--r--src/lib/formats/flopimg.cpp294
-rw-r--r--src/lib/formats/flopimg.h160
-rw-r--r--src/lib/formats/fm7_cas.cpp10
-rw-r--r--src/lib/formats/fmsx_cas.cpp6
-rw-r--r--src/lib/formats/fsd_dsk.cpp22
-rw-r--r--src/lib/formats/fsd_dsk.h4
-rw-r--r--src/lib/formats/g64_dsk.cpp38
-rw-r--r--src/lib/formats/g64_dsk.h8
-rw-r--r--src/lib/formats/gtp_cas.cpp20
-rw-r--r--src/lib/formats/hect_tap.cpp22
-rw-r--r--src/lib/formats/hxchfe_dsk.cpp76
-rw-r--r--src/lib/formats/hxchfe_dsk.h8
-rw-r--r--src/lib/formats/hxcmfm_dsk.cpp32
-rw-r--r--src/lib/formats/hxcmfm_dsk.h4
-rw-r--r--src/lib/formats/imageutl.h108
-rw-r--r--src/lib/formats/imd_dsk.cpp86
-rw-r--r--src/lib/formats/imd_dsk.h4
-rw-r--r--src/lib/formats/ioprocs.cpp32
-rw-r--r--src/lib/formats/ioprocs.h14
-rw-r--r--src/lib/formats/ipf_dsk.cpp174
-rw-r--r--src/lib/formats/ipf_dsk.h88
-rw-r--r--src/lib/formats/jvc_dsk.cpp18
-rw-r--r--src/lib/formats/jvc_dsk.h14
-rw-r--r--src/lib/formats/kc_cas.cpp32
-rw-r--r--src/lib/formats/kim1_cas.cpp16
-rw-r--r--src/lib/formats/lviv_lvt.cpp12
-rw-r--r--src/lib/formats/m20_dsk.cpp6
-rw-r--r--src/lib/formats/m20_dsk.h4
-rw-r--r--src/lib/formats/mbee_cas.cpp24
-rw-r--r--src/lib/formats/mfi_dsk.cpp18
-rw-r--r--src/lib/formats/mfi_dsk.h4
-rw-r--r--src/lib/formats/mfm_hd.cpp30
-rw-r--r--src/lib/formats/mfm_hd.h20
-rw-r--r--src/lib/formats/mz_cas.cpp24
-rw-r--r--src/lib/formats/naslite_dsk.cpp2
-rw-r--r--src/lib/formats/naslite_dsk.h2
-rw-r--r--src/lib/formats/nes_dsk.cpp4
-rw-r--r--src/lib/formats/nfd_dsk.cpp42
-rw-r--r--src/lib/formats/nfd_dsk.h4
-rw-r--r--src/lib/formats/orao_cas.cpp12
-rw-r--r--src/lib/formats/oric_dsk.cpp12
-rw-r--r--src/lib/formats/oric_dsk.h4
-rw-r--r--src/lib/formats/oric_tap.cpp42
-rw-r--r--src/lib/formats/p6001_cas.cpp8
-rw-r--r--src/lib/formats/pasti_dsk.cpp74
-rw-r--r--src/lib/formats/pasti_dsk.h30
-rw-r--r--src/lib/formats/pc98fdi_dsk.cpp34
-rw-r--r--src/lib/formats/pc98fdi_dsk.h4
-rw-r--r--src/lib/formats/pc_dsk.cpp8
-rw-r--r--src/lib/formats/phc25_cas.cpp20
-rw-r--r--src/lib/formats/pmd_cas.cpp22
-rw-r--r--src/lib/formats/primoptp.cpp36
-rw-r--r--src/lib/formats/rk_cas.cpp30
-rw-r--r--src/lib/formats/rx50_dsk.cpp18
-rw-r--r--src/lib/formats/rx50_dsk.h6
-rw-r--r--src/lib/formats/sc3000_bit.cpp6
-rw-r--r--src/lib/formats/sol_cas.cpp46
-rw-r--r--src/lib/formats/sorc_cas.cpp18
-rw-r--r--src/lib/formats/sorc_dsk.cpp14
-rw-r--r--src/lib/formats/sord_cas.cpp16
-rw-r--r--src/lib/formats/spc1000_cas.cpp24
-rw-r--r--src/lib/formats/st_dsk.cpp50
-rw-r--r--src/lib/formats/st_dsk.h16
-rw-r--r--src/lib/formats/svi_cas.cpp6
-rw-r--r--src/lib/formats/svi_dsk.cpp16
-rw-r--r--src/lib/formats/svi_dsk.h4
-rw-r--r--src/lib/formats/td0_dsk.cpp128
-rw-r--r--src/lib/formats/td0_dsk.h4
-rw-r--r--src/lib/formats/thom_cas.cpp30
-rw-r--r--src/lib/formats/thom_dsk.cpp40
-rw-r--r--src/lib/formats/ti99_dsk.cpp50
-rw-r--r--src/lib/formats/ti99_dsk.h50
-rw-r--r--src/lib/formats/trs_cas.cpp10
-rw-r--r--src/lib/formats/tvc_cas.cpp22
-rw-r--r--src/lib/formats/tzx_cas.cpp98
-rw-r--r--src/lib/formats/uef_cas.cpp32
-rw-r--r--src/lib/formats/upd765_dsk.cpp26
-rw-r--r--src/lib/formats/upd765_dsk.h14
-rw-r--r--src/lib/formats/vdk_dsk.cpp18
-rw-r--r--src/lib/formats/vdk_dsk.h4
-rw-r--r--src/lib/formats/vg5k_cas.cpp18
-rw-r--r--src/lib/formats/victor9k_dsk.cpp28
-rw-r--r--src/lib/formats/victor9k_dsk.h24
-rw-r--r--src/lib/formats/vt_cas.cpp16
-rw-r--r--src/lib/formats/wavfile.cpp68
-rw-r--r--src/lib/formats/wd177x_dsk.cpp26
-rw-r--r--src/lib/formats/wd177x_dsk.h14
-rw-r--r--src/lib/formats/x07_cas.cpp12
-rw-r--r--src/lib/formats/x1_tap.cpp10
-rw-r--r--src/lib/formats/zx81_p.cpp36
-rw-r--r--src/lib/util/avhuff.cpp194
-rw-r--r--src/lib/util/avhuff.h46
-rw-r--r--src/lib/util/bitmap.cpp74
-rw-r--r--src/lib/util/bitmap.h150
-rw-r--r--src/lib/util/bitstream.h56
-rw-r--r--src/lib/util/cdrom.cpp124
-rw-r--r--src/lib/util/cdrom.h68
-rw-r--r--src/lib/util/chd.cpp430
-rw-r--r--src/lib/util/chd.h322
-rw-r--r--src/lib/util/chdcd.cpp72
-rw-r--r--src/lib/util/chdcd.h6
-rw-r--r--src/lib/util/chdcodec.cpp266
-rw-r--r--src/lib/util/chdcodec.h32
-rw-r--r--src/lib/util/corefile.cpp4
-rw-r--r--src/lib/util/corefile.h2
-rw-r--r--src/lib/util/corestr.cpp12
-rw-r--r--src/lib/util/coreutil.cpp18
-rw-r--r--src/lib/util/coreutil.h6
-rw-r--r--src/lib/util/flac.cpp54
-rw-r--r--src/lib/util/flac.h68
-rw-r--r--src/lib/util/harddisk.cpp12
-rw-r--r--src/lib/util/harddisk.h12
-rw-r--r--src/lib/util/hash.cpp2
-rw-r--r--src/lib/util/hash.h8
-rw-r--r--src/lib/util/hashing.cpp12
-rw-r--r--src/lib/util/hashing.h36
-rw-r--r--src/lib/util/huffman.cpp52
-rw-r--r--src/lib/util/huffman.h42
-rw-r--r--src/lib/util/jedparse.cpp42
-rw-r--r--src/lib/util/jedparse.h8
-rw-r--r--src/lib/util/options.cpp14
-rw-r--r--src/lib/util/options.h24
-rw-r--r--src/lib/util/palette.cpp82
-rw-r--r--src/lib/util/palette.h130
-rw-r--r--src/lib/util/plaparse.cpp30
-rw-r--r--src/lib/util/png.cpp110
-rw-r--r--src/lib/util/png.h30
-rw-r--r--src/lib/util/pool.cpp2
-rw-r--r--src/lib/util/pool.h2
-rw-r--r--src/lib/util/sha1.cpp36
-rw-r--r--src/lib/util/sha1.h10
-rw-r--r--src/lib/util/vbiparse.cpp36
-rw-r--r--src/lib/util/vbiparse.h20
-rw-r--r--src/lib/util/wavwrite.cpp26
-rw-r--r--src/lib/util/wavwrite.h8
-rw-r--r--src/lib/util/xmlfile.cpp14
-rw-r--r--src/lib/util/xmlfile.h2
-rw-r--r--src/lib/util/zippath.cpp4
-rw-r--r--src/lib/util/zippath.h2
210 files changed, 3820 insertions, 3820 deletions
diff --git a/src/lib/formats/a26_cas.cpp b/src/lib/formats/a26_cas.cpp
index 2e76eea73a0..5030c2bfe0f 100644
--- a/src/lib/formats/a26_cas.cpp
+++ b/src/lib/formats/a26_cas.cpp
@@ -17,16 +17,16 @@ Atari 2600 SuperCharger support
#define BIT_ONE_LENGTH 15
#define ZEROS_ONES 2755
-static const UINT16 one_wave[BIT_ONE_LENGTH] = {
+static const uint16_t one_wave[BIT_ONE_LENGTH] = {
0x2AE5, 0x4E60, 0x644E, 0x68E4, 0x5B56, 0x3DFE, 0x15ED, 0xEA13, 0xC202, 0xA4AA,
0x971C, 0x9BB2, 0xB1A0, 0xD51B, 0x0000
};
-static const UINT16 zero_wave[BIT_ZERO_LENGTH] = {
+static const uint16_t zero_wave[BIT_ZERO_LENGTH] = {
0x3DFE, 0x644E, 0x644E, 0x3DFE, 0x0000, 0xC202, 0x9BB2, 0x9BB2, 0xC202, 0x0000
};
-static int a26_cas_output_wave( INT16 **buffer, INT16 wave_data, int length ) {
+static int a26_cas_output_wave( int16_t **buffer, int16_t wave_data, int length ) {
int i;
if ( buffer ) {
@@ -38,10 +38,10 @@ static int a26_cas_output_wave( INT16 **buffer, INT16 wave_data, int length ) {
return length;
}
-static int a26_cas_output_bit( INT16 **buffer, int bit ) {
+static int a26_cas_output_bit( int16_t **buffer, int bit ) {
int size = 0;
int bit_size = bit ? BIT_ONE_LENGTH : BIT_ZERO_LENGTH;
- const INT16 *p = bit ? (const INT16 *)one_wave : (const INT16 *)zero_wave;
+ const int16_t *p = bit ? (const int16_t *)one_wave : (const int16_t *)zero_wave;
int i;
for ( i = 0; i < bit_size; i++ ) {
@@ -51,7 +51,7 @@ static int a26_cas_output_bit( INT16 **buffer, int bit ) {
return size;
}
-static int a26_cas_output_byte( INT16 **buffer, UINT8 byte ) {
+static int a26_cas_output_byte( int16_t **buffer, uint8_t byte ) {
int size = 0;
int i;
@@ -61,14 +61,14 @@ static int a26_cas_output_byte( INT16 **buffer, UINT8 byte ) {
return size;
}
-static int a26_cas_clearing_tone( INT16 **buffer ) {
+static int a26_cas_clearing_tone( int16_t **buffer ) {
int size = 0;
size += a26_cas_output_wave( buffer, 0, 44100 );
return size;
}
-static int a26_cas_zeros_ones( INT16 **buffer ) {
+static int a26_cas_zeros_ones( int16_t **buffer ) {
int size = 0;
int i;
@@ -81,7 +81,7 @@ static int a26_cas_zeros_ones( INT16 **buffer ) {
return size;
}
-static int a26_cas_output_contents( INT16 **buffer, const UINT8 *bytes ) {
+static int a26_cas_output_contents( int16_t **buffer, const uint8_t *bytes ) {
int size = 0;
int i, pages, j;
@@ -104,7 +104,7 @@ static int a26_cas_output_contents( INT16 **buffer, const UINT8 *bytes ) {
return size;
}
-static int a26_cas_do_work( INT16 **buffer, const UINT8 *bytes ) {
+static int a26_cas_do_work( int16_t **buffer, const uint8_t *bytes ) {
int size = 0;
/* Output clearing tone */
@@ -122,13 +122,13 @@ static int a26_cas_do_work( INT16 **buffer, const UINT8 *bytes ) {
return size;
}
-static int a26_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
- INT16 *p = buffer;
+static int a26_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) {
+ int16_t *p = buffer;
- return a26_cas_do_work( &p, (const UINT8 *)bytes );
+ return a26_cas_do_work( &p, (const uint8_t *)bytes );
}
-static int a26_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
+static int a26_cas_to_wav_size( const uint8_t *casdata, int caslen ) {
return a26_cas_do_work( nullptr, casdata );
}
@@ -143,7 +143,7 @@ static const struct CassetteLegacyWaveFiller a26_legacy_fill_wave = {
};
static cassette_image::error a26_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) {
- UINT64 size;
+ uint64_t size;
size = cassette_image_size( cassette );
if ( size == A26_CAS_SIZE ) {
diff --git a/src/lib/formats/ace_tap.cpp b/src/lib/formats/ace_tap.cpp
index 6d0e4ad2c6e..56b4bd877c8 100644
--- a/src/lib/formats/ace_tap.cpp
+++ b/src/lib/formats/ace_tap.cpp
@@ -26,7 +26,7 @@ static int cas_size;
/*******************************************************************
Generate one high-low cycle of sample data
********************************************************************/
-static inline int ace_tap_cycle(INT16 *buffer, int sample_pos, int high, int low)
+static inline int ace_tap_cycle(int16_t *buffer, int sample_pos, int high, int low)
{
int i = 0;
@@ -48,7 +48,7 @@ static inline int ace_tap_cycle(INT16 *buffer, int sample_pos, int high, int low
}
-static inline int ace_tap_silence(INT16 *buffer, int sample_pos, int samples)
+static inline int ace_tap_silence(int16_t *buffer, int sample_pos, int samples)
{
int i = 0;
@@ -64,7 +64,7 @@ static inline int ace_tap_silence(INT16 *buffer, int sample_pos, int samples)
}
-static inline int ace_tap_byte(INT16 *buffer, int sample_pos, UINT8 data)
+static inline int ace_tap_byte(int16_t *buffer, int sample_pos, uint8_t data)
{
int i, samples;
@@ -82,7 +82,7 @@ static inline int ace_tap_byte(INT16 *buffer, int sample_pos, UINT8 data)
}
-static int ace_handle_tap(INT16 *buffer, const UINT8 *casdata)
+static int ace_handle_tap(int16_t *buffer, const uint8_t *casdata)
{
int data_pos, sample_count;
@@ -97,7 +97,7 @@ static int ace_handle_tap(INT16 *buffer, const UINT8 *casdata)
while( data_pos < cas_size )
{
- UINT16 block_size;
+ uint16_t block_size;
int i;
/* Handle a block of tape data */
@@ -138,7 +138,7 @@ static int ace_handle_tap(INT16 *buffer, const UINT8 *casdata)
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int ace_tap_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int ace_tap_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return ace_handle_tap( buffer, bytes );
}
@@ -147,7 +147,7 @@ static int ace_tap_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
/*******************************************************************
Calculate the number of samples needed for this tape image
********************************************************************/
-static int ace_tap_to_wav_size(const UINT8 *casdata, int caslen)
+static int ace_tap_to_wav_size(const uint8_t *casdata, int caslen)
{
cas_size = caslen;
diff --git a/src/lib/formats/ace_tap.h b/src/lib/formats/ace_tap.h
index 27a1e93129d..0113fdf6484 100644
--- a/src/lib/formats/ace_tap.h
+++ b/src/lib/formats/ace_tap.h
@@ -16,14 +16,14 @@
#if 0
struct ace_tape_t
{
- UINT8 hdr_type;
- UINT8 hdr_name[10];
- UINT16 hdr_len;
- UINT16 hdr_addr;
- UINT8 hdr_vars[8];
- UINT8 hdr_3c4c;
- UINT8 hdr_3c4d;
- UINT16 dat_len;
+ uint8_t hdr_type;
+ uint8_t hdr_name[10];
+ uint16_t hdr_len;
+ uint16_t hdr_addr;
+ uint8_t hdr_vars[8];
+ uint8_t hdr_3c4c;
+ uint8_t hdr_3c4d;
+ uint16_t dat_len;
};
#endif
diff --git a/src/lib/formats/acorn_dsk.cpp b/src/lib/formats/acorn_dsk.cpp
index e8e0289ead1..b880b28018f 100644
--- a/src/lib/formats/acorn_dsk.cpp
+++ b/src/lib/formats/acorn_dsk.cpp
@@ -29,23 +29,23 @@ const char *acorn_ssd_format::extensions() const
return "ssd,bbc,img";
}
-int acorn_ssd_format::find_size(io_generic *io, UINT32 form_factor)
+int acorn_ssd_format::find_size(io_generic *io, uint32_t form_factor)
{
- UINT8 cat[8];
- UINT32 sectors0, sectors2;
+ uint8_t cat[8];
+ uint32_t sectors0, sectors2;
// read sector count from side 0 catalogue
io_generic_read(io, cat, 0x100, 8);
sectors0 = ((cat[6] & 3) << 8) + cat[7];
LOG_FORMATS("ssd: sector count 0: %d %s\n", sectors0, sectors0 % 10 != 0 ? "invalid" : "");
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
for(int i=0; formats[i].form_factor; i++) {
const format &f = formats[i];
if(form_factor != floppy_image::FF_UNKNOWN && form_factor != f.form_factor)
continue;
- if ((size <= (UINT64)compute_track_size(f) * f.track_count * f.head_count) && (sectors0 <= f.track_count * f.sector_count)) {
+ if ((size <= (uint64_t)compute_track_size(f) * f.track_count * f.head_count) && (sectors0 <= f.track_count * f.sector_count)) {
if (f.head_count == 2)
{
// read sector count from side 2 catalogue
@@ -66,7 +66,7 @@ int acorn_ssd_format::find_size(io_generic *io, UINT32 form_factor)
return -1;
}
-int acorn_ssd_format::identify(io_generic *io, UINT32 form_factor)
+int acorn_ssd_format::identify(io_generic *io, uint32_t form_factor)
{
int type = find_size(io, form_factor);
@@ -124,23 +124,23 @@ const char *acorn_dsd_format::extensions() const
return "dsd";
}
-int acorn_dsd_format::find_size(io_generic *io, UINT32 form_factor)
+int acorn_dsd_format::find_size(io_generic *io, uint32_t form_factor)
{
- UINT8 cat[8];
- UINT32 sectors0, sectors2;
+ uint8_t cat[8];
+ uint32_t sectors0, sectors2;
// read sector count from side 0 catalogue
io_generic_read(io, cat, 0x100, 8);
sectors0 = ((cat[6] & 3) << 8) + cat[7];
LOG_FORMATS("dsd: sector count 0: %d %s\n", sectors0, sectors0 % 10 != 0 ? "invalid" : "");
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
for (int i = 0; formats[i].form_factor; i++) {
const format &f = formats[i];
if (form_factor != floppy_image::FF_UNKNOWN && form_factor != f.form_factor)
continue;
- if ((size <= (UINT64)compute_track_size(f) * f.track_count * f.head_count) && (sectors0 <= f.track_count * f.sector_count)) {
+ if ((size <= (uint64_t)compute_track_size(f) * f.track_count * f.head_count) && (sectors0 <= f.track_count * f.sector_count)) {
// read sector count from side 2 catalogue
io_generic_read(io, cat, 0xb00, 8); // interleaved
sectors2 = ((cat[6] & 3) << 8) + cat[7];
@@ -154,7 +154,7 @@ int acorn_dsd_format::find_size(io_generic *io, UINT32 form_factor)
return -1;
}
-int acorn_dsd_format::identify(io_generic *io, UINT32 form_factor)
+int acorn_dsd_format::identify(io_generic *io, uint32_t form_factor)
{
int type = find_size(io, form_factor);
@@ -204,23 +204,23 @@ const char *opus_ddos_format::extensions() const
return "dds";
}
-int opus_ddos_format::find_size(io_generic *io, UINT32 form_factor)
+int opus_ddos_format::find_size(io_generic *io, uint32_t form_factor)
{
- UINT8 cat[8];
- UINT32 sectors0, sectors2;
+ uint8_t cat[8];
+ uint32_t sectors0, sectors2;
// read sector count from side 0 catalogue
io_generic_read(io, cat, 0x1000, 8);
sectors0 = (cat[1] << 8) + cat[2];
LOG_FORMATS("ddos: sector count 0: %d %s\n", sectors0, sectors0 % 18 != 0 ? "invalid" : "");
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
for (int i = 0; formats[i].form_factor; i++) {
const format &f = formats[i];
if (form_factor != floppy_image::FF_UNKNOWN && form_factor != f.form_factor)
continue;
- if ((size <= (UINT64)compute_track_size(f) * f.track_count * f.head_count) && (sectors0 <= f.track_count * f.sector_count)) {
+ if ((size <= (uint64_t)compute_track_size(f) * f.track_count * f.head_count) && (sectors0 <= f.track_count * f.sector_count)) {
if (f.head_count == 2)
{
// read sector count from side 2 catalogue
@@ -241,7 +241,7 @@ int opus_ddos_format::find_size(io_generic *io, UINT32 form_factor)
return -1;
}
-int opus_ddos_format::identify(io_generic *io, UINT32 form_factor)
+int opus_ddos_format::identify(io_generic *io, uint32_t form_factor)
{
int type = find_size(io, form_factor);
@@ -299,11 +299,11 @@ const char *acorn_adfs_old_format::extensions() const
return "adf,ads,adm,adl";
}
-int acorn_adfs_old_format::find_size(io_generic *io, UINT32 form_factor)
+int acorn_adfs_old_format::find_size(io_generic *io, uint32_t form_factor)
{
- UINT8 map[3];
- UINT32 sectors;
- UINT8 oldmap[4];
+ uint8_t map[3];
+ uint32_t sectors;
+ uint8_t oldmap[4];
// read sector count from free space map
io_generic_read(io, map, 0xfc, 3);
@@ -314,14 +314,14 @@ int acorn_adfs_old_format::find_size(io_generic *io, UINT32 form_factor)
io_generic_read(io, oldmap, 0x201, 4);
LOG_FORMATS("adfs_o: map identifier %s %s\n", oldmap, memcmp(oldmap, "Hugo", 4) != 0 ? "invalid" : "");
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
for(int i=0; formats[i].form_factor; i++) {
const format &f = formats[i];
if(form_factor != floppy_image::FF_UNKNOWN && form_factor != f.form_factor)
continue;
// valid images will have map identifier 'Hugo' and sector counts adfs-s = 0x280; adfs-m = 0x500; adfs-l = 0xa00; though many adfs-s images are incorrect
- if ((size <= (UINT64)compute_track_size(f) * f.track_count * f.head_count) && memcmp(oldmap, "Hugo", 4) == 0 && (sectors == 0x280 || sectors == 0x500 || sectors == 0xa00 || size == 819200)) {
+ if ((size <= (uint64_t)compute_track_size(f) * f.track_count * f.head_count) && memcmp(oldmap, "Hugo", 4) == 0 && (sectors == 0x280 || sectors == 0x500 || sectors == 0xa00 || size == 819200)) {
return i;
}
}
@@ -329,7 +329,7 @@ int acorn_adfs_old_format::find_size(io_generic *io, UINT32 form_factor)
return -1;
}
-int acorn_adfs_old_format::identify(io_generic *io, UINT32 form_factor)
+int acorn_adfs_old_format::identify(io_generic *io, uint32_t form_factor)
{
int type = find_size(io, form_factor);
@@ -395,10 +395,10 @@ const char *acorn_adfs_new_format::extensions() const
return "adf";
}
-int acorn_adfs_new_format::find_size(io_generic *io, UINT32 form_factor)
+int acorn_adfs_new_format::find_size(io_generic *io, uint32_t form_factor)
{
- UINT8 dform[4];
- UINT8 eform[4];
+ uint8_t dform[4];
+ uint8_t eform[4];
// read map identifiers for D and E formats
io_generic_read(io, dform, 0x401, 4);
@@ -406,14 +406,14 @@ int acorn_adfs_new_format::find_size(io_generic *io, UINT32 form_factor)
io_generic_read(io, eform, 0x801, 4);
LOG_FORMATS("adfs_n: map identifier (E format) %s %s\n", eform, memcmp(eform, "Nick", 4) != 0 ? "invalid" : "");
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
for (int i = 0; formats[i].form_factor; i++) {
const format &f = formats[i];
if (form_factor != floppy_image::FF_UNKNOWN && form_factor != f.form_factor)
continue;
// valid images will have map identifier Nick
- if ((size == (UINT64)compute_track_size(f) * f.track_count * f.head_count) && (memcmp(dform, "Nick", 4) == 0 || memcmp(eform, "Nick", 4) == 0)) {
+ if ((size == (uint64_t)compute_track_size(f) * f.track_count * f.head_count) && (memcmp(dform, "Nick", 4) == 0 || memcmp(eform, "Nick", 4) == 0)) {
return i;
}
}
@@ -421,7 +421,7 @@ int acorn_adfs_new_format::find_size(io_generic *io, UINT32 form_factor)
return -1;
}
-int acorn_adfs_new_format::identify(io_generic *io, UINT32 form_factor)
+int acorn_adfs_new_format::identify(io_generic *io, uint32_t form_factor)
{
int type = find_size(io, form_factor);
@@ -471,18 +471,18 @@ const char *acorn_dos_format::extensions() const
return "img,adl";
}
-int acorn_dos_format::find_size(io_generic *io, UINT32 form_factor)
+int acorn_dos_format::find_size(io_generic *io, uint32_t form_factor)
{
- UINT8 cat[3];
- UINT32 sectors;
+ uint8_t cat[3];
+ uint32_t sectors;
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
for(int i=0; formats[i].form_factor; i++) {
const format &f = formats[i];
if(form_factor != floppy_image::FF_UNKNOWN && form_factor != f.form_factor)
continue;
- if (size == (UINT64)compute_track_size(f) * f.track_count * f.head_count) {
+ if (size == (uint64_t)compute_track_size(f) * f.track_count * f.head_count) {
switch (size)
{
case 640 * 1024: // 640K Acorn (Bootable) DOS Format
@@ -513,7 +513,7 @@ int acorn_dos_format::find_size(io_generic *io, UINT32 form_factor)
return -1;
}
-int acorn_dos_format::identify(io_generic *io, UINT32 form_factor)
+int acorn_dos_format::identify(io_generic *io, uint32_t form_factor)
{
int type = find_size(io, form_factor);
@@ -567,9 +567,9 @@ const char *acorn_cpm_format::extensions() const
return "img,ssd,dsd";
}
-int acorn_cpm_format::identify(io_generic *io, UINT32 form_factor)
+int acorn_cpm_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 h[8];
+ uint8_t h[8];
io_generic_read(io, h, 0, 8);
@@ -627,7 +627,7 @@ const char *torch_cpn_format::extensions() const
return "dsd";
}
-int torch_cpn_format::identify(io_generic *io, UINT32 form_factor)
+int torch_cpn_format::identify(io_generic *io, uint32_t form_factor)
{
int type = find_size(io, form_factor);
diff --git a/src/lib/formats/acorn_dsk.h b/src/lib/formats/acorn_dsk.h
index 8982169a31b..76d4462b01d 100644
--- a/src/lib/formats/acorn_dsk.h
+++ b/src/lib/formats/acorn_dsk.h
@@ -20,8 +20,8 @@ class acorn_ssd_format : public wd177x_format
public:
acorn_ssd_format();
- virtual int find_size(io_generic *io, UINT32 form_factor) override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual int find_size(io_generic *io, uint32_t form_factor) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
virtual int get_image_offset(const format &f, int head, int track) override;
virtual const char *name() const override;
virtual const char *description() const override;
@@ -36,8 +36,8 @@ class acorn_dsd_format : public wd177x_format
public:
acorn_dsd_format();
- virtual int find_size(io_generic *io, UINT32 form_factor) override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual int find_size(io_generic *io, uint32_t form_factor) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
virtual int get_image_offset(const format &f, int head, int track) override;
virtual const char *name() const override;
virtual const char *description() const override;
@@ -52,8 +52,8 @@ class opus_ddos_format : public wd177x_format
public:
opus_ddos_format();
- virtual int find_size(io_generic *io, UINT32 form_factor) override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual int find_size(io_generic *io, uint32_t form_factor) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
virtual int get_image_offset(const format &f, int head, int track) override;
virtual const char *name() const override;
virtual const char *description() const override;
@@ -68,8 +68,8 @@ class acorn_adfs_old_format : public wd177x_format
public:
acorn_adfs_old_format();
- virtual int find_size(io_generic *io, UINT32 form_factor) override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual int find_size(io_generic *io, uint32_t form_factor) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
virtual int get_image_offset(const format &f, int head, int track) override;
virtual const char *name() const override;
virtual const char *description() const override;
@@ -84,8 +84,8 @@ class acorn_adfs_new_format : public wd177x_format
public:
acorn_adfs_new_format();
- virtual int find_size(io_generic *io, UINT32 form_factor) override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual int find_size(io_generic *io, uint32_t form_factor) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
virtual int get_image_offset(const format &f, int head, int track) override;
virtual const char *name() const override;
virtual const char *description() const override;
@@ -100,8 +100,8 @@ class acorn_dos_format : public wd177x_format
public:
acorn_dos_format();
- virtual int find_size(io_generic *io, UINT32 form_factor) override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual int find_size(io_generic *io, uint32_t form_factor) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
virtual int get_image_offset(const format &f, int head, int track) override;
virtual const char *name() const override;
virtual const char *description() const override;
@@ -116,7 +116,7 @@ class acorn_cpm_format : public wd177x_format
public:
acorn_cpm_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
virtual int get_image_offset(const format &f, int head, int track) override;
virtual const char *name() const override;
virtual const char *description() const override;
@@ -131,7 +131,7 @@ class torch_cpn_format : public wd177x_format
public:
torch_cpn_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
virtual int get_image_offset(const format &f, int head, int track) override;
virtual const char *name() const override;
virtual const char *description() const override;
diff --git a/src/lib/formats/adam_cas.cpp b/src/lib/formats/adam_cas.cpp
index 30deb27a1a9..3de9413cb90 100644
--- a/src/lib/formats/adam_cas.cpp
+++ b/src/lib/formats/adam_cas.cpp
@@ -83,10 +83,10 @@ cassette_image::error coladam_put_byte(cassette_image *cass, int channel, double
return err;
}
-cassette_image::error coladam_put_block(cassette_image *cass, int channel, double *time_index, int *prev_sign, int block_index, UINT8 *buffer, int layout_type)
+cassette_image::error coladam_put_block(cassette_image *cass, int channel, double *time_index, int *prev_sign, int block_index, uint8_t *buffer, int layout_type)
{
int i, checksum_16=0;
- UINT8 header[] = { 0x16, 0x48, 0x45, 0x00, static_cast<UINT8>(block_index), 0xff, static_cast<UINT8>(0xff - block_index), 0x00, 0x80, 0xf4 };
+ uint8_t header[] = { 0x16, 0x48, 0x45, 0x00, static_cast<uint8_t>(block_index), 0xff, static_cast<uint8_t>(0xff - block_index), 0x00, 0x80, 0xf4 };
cassette_image::error err;
if (layout_type == TYPE_GW)
{
@@ -130,7 +130,7 @@ static cassette_image::error coladam_ddp_load( cassette_image *cass )
{
double time = 0.;
int i, block, prev_sign=-1;
- UINT8 buffer[0x400];
+ uint8_t buffer[0x400];
cassette_image::error err = cassette_image::error::SUCCESS;
// It would appear that data packs that originally had the type GW data layout and headers work fine when converted to type
diff --git a/src/lib/formats/afs_dsk.cpp b/src/lib/formats/afs_dsk.cpp
index 5e1ff5aa66c..dc952b60181 100644
--- a/src/lib/formats/afs_dsk.cpp
+++ b/src/lib/formats/afs_dsk.cpp
@@ -30,7 +30,7 @@ const char *afs_format::extensions() const
return "adl,img";
}
-int afs_format::identify(io_generic *io, UINT32 form_factor)
+int afs_format::identify(io_generic *io, uint32_t form_factor)
{
int type = find_size(io, form_factor);
diff --git a/src/lib/formats/afs_dsk.h b/src/lib/formats/afs_dsk.h
index e8e7190f7cd..e9afc3e699f 100644
--- a/src/lib/formats/afs_dsk.h
+++ b/src/lib/formats/afs_dsk.h
@@ -21,7 +21,7 @@ class afs_format : public wd177x_format
public:
afs_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
virtual int get_image_offset(const format &f, int head, int track) override;
virtual const char *name() const override;
virtual const char *description() const override;
diff --git a/src/lib/formats/ami_dsk.cpp b/src/lib/formats/ami_dsk.cpp
index a222208d46d..8a757e6a4c9 100644
--- a/src/lib/formats/ami_dsk.cpp
+++ b/src/lib/formats/ami_dsk.cpp
@@ -36,9 +36,9 @@ bool adf_format::supports_save() const
return true;
}
-int adf_format::identify(io_generic *io, UINT32 form_factor)
+int adf_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
if ((size == 901120) || (size == 912384) || (size == 1802240))
{
return 50;
@@ -46,10 +46,10 @@ int adf_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool adf_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool adf_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
desc_s sectors[22];
- UINT8 sectdata[512*22];
+ uint8_t sectdata[512*22];
bool is_hd = false;
int tracks = 80;
@@ -59,7 +59,7 @@ bool adf_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
sectors[i].sector_id = i;
}
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
if(size == 901120)
{
is_hd = false;
@@ -97,7 +97,7 @@ bool adf_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
return true;
}
-UINT32 adf_format::g32(const UINT8 *trackbuf, int track_size, int pos)
+uint32_t adf_format::g32(const uint8_t *trackbuf, int track_size, int pos)
{
if(pos >= 0 && track_size-pos >= 40) {
int pp = pos >> 3;
@@ -109,7 +109,7 @@ UINT32 adf_format::g32(const UINT8 *trackbuf, int track_size, int pos)
(trackbuf[pp+3] << dp) |
(trackbuf[pp+4] >> (8-dp));
} else {
- UINT32 res = 0;
+ uint32_t res = 0;
for(int i=0; i<32; i++) {
int pp = (pos+i) % track_size;
if(trackbuf[pp>>3] & (0x80 >> (pp & 7)))
@@ -119,9 +119,9 @@ UINT32 adf_format::g32(const UINT8 *trackbuf, int track_size, int pos)
}
}
-UINT32 adf_format::checksum(const UINT8 *trackbuf, int track_size, int pos, int long_count)
+uint32_t adf_format::checksum(const uint8_t *trackbuf, int track_size, int pos, int long_count)
{
- UINT32 check = 0;
+ uint32_t check = 0;
for(int i=0; i<long_count; i++)
check ^= g32(trackbuf, track_size, pos+32*i);
return check & 0x55555555;
@@ -129,8 +129,8 @@ UINT32 adf_format::checksum(const UINT8 *trackbuf, int track_size, int pos, int
bool adf_format::save(io_generic *io, floppy_image *image)
{
- UINT8 sectdata[512*22];
- UINT8 trackbuf[300000/8];
+ uint8_t sectdata[512*22];
+ uint8_t trackbuf[300000/8];
bool hd = image->get_variant() == floppy_image::DSHD;
@@ -145,14 +145,14 @@ bool adf_format::save(io_generic *io, floppy_image *image)
if(g32(trackbuf, track_size, i) == 0x44894489 &&
(g32(trackbuf, track_size, i+384) & 0x55555555) == checksum(trackbuf, track_size, i+32, 10) &&
(g32(trackbuf, track_size, i+448) & 0x55555555) == checksum(trackbuf, track_size, i+480, 256)) {
- UINT32 head = ((g32(trackbuf, track_size, i+32) & 0x55555555) << 1) | (g32(trackbuf, track_size, i+64) & 0x55555555);
+ uint32_t head = ((g32(trackbuf, track_size, i+32) & 0x55555555) << 1) | (g32(trackbuf, track_size, i+64) & 0x55555555);
int sect = (head >> 8) & 0xff;
if(sect > (hd ? 22 : 11))
continue;
- UINT8 *dest = sectdata + 512*sect;
+ uint8_t *dest = sectdata + 512*sect;
for(int j=0; j<128; j++) {
- UINT32 val = ((g32(trackbuf, track_size, i+480+32*j) & 0x55555555) << 1) | (g32(trackbuf, track_size, i+4576+32*j) & 0x55555555);
+ uint32_t val = ((g32(trackbuf, track_size, i+480+32*j) & 0x55555555) << 1) | (g32(trackbuf, track_size, i+4576+32*j) & 0x55555555);
*dest++ = val >> 24;
*dest++ = val >> 16;
*dest++ = val >> 8;
diff --git a/src/lib/formats/ami_dsk.h b/src/lib/formats/ami_dsk.h
index f10ac007d71..3fcddff023e 100644
--- a/src/lib/formats/ami_dsk.h
+++ b/src/lib/formats/ami_dsk.h
@@ -18,8 +18,8 @@ class adf_format : public floppy_image_format_t
public:
adf_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual const char *name() const override;
@@ -28,8 +28,8 @@ public:
virtual bool supports_save() const override;
private:
- static UINT32 g32(const UINT8 *trackbuf, int track_size, int pos);
- static UINT32 checksum(const UINT8 *trackbuf, int track_size, int pos, int long_count);
+ static uint32_t g32(const uint8_t *trackbuf, int track_size, int pos);
+ static uint32_t checksum(const uint8_t *trackbuf, int track_size, int pos, int long_count);
};
extern const floppy_format_type FLOPPY_ADF_FORMAT;
diff --git a/src/lib/formats/ap2_dsk.cpp b/src/lib/formats/ap2_dsk.cpp
index 774d4785735..6cba1db6757 100644
--- a/src/lib/formats/ap2_dsk.cpp
+++ b/src/lib/formats/ap2_dsk.cpp
@@ -22,25 +22,25 @@
/* used in for all Apple II images */
-static UINT32 apple2_get_track_size(floppy_image_legacy *floppy, int head, int track);
-static int disk_decode_nib(UINT8 *data, const UINT8 *nibble, int *volume, int *track, int *sector);
-static void disk_encode_nib(UINT8 *nibble, const UINT8 *data, int volume, int track, int sector);
+static uint32_t apple2_get_track_size(floppy_image_legacy *floppy, int head, int track);
+static int disk_decode_nib(uint8_t *data, const uint8_t *nibble, int *volume, int *track, int *sector);
+static void disk_encode_nib(uint8_t *nibble, const uint8_t *data, int volume, int track, int sector);
/* used in DOS/ProDOS order images */
static int apple2_do_translate_sector(floppy_image_legacy *floppy, int sector);
static int apple2_po_translate_sector(floppy_image_legacy *floppy, int sector);
-static floperr_t apple2_dsk_read_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, void *buffer, size_t buflen);
-static floperr_t apple2_dsk_write_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, const void *buffer, size_t buflen);
+static floperr_t apple2_dsk_read_track(floppy_image_legacy *floppy, int head, int track, uint64_t offset, void *buffer, size_t buflen);
+static floperr_t apple2_dsk_write_track(floppy_image_legacy *floppy, int head, int track, uint64_t offset, const void *buffer, size_t buflen);
/* used in nibble order images */
-static floperr_t apple2_nib_read_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, void *buffer, size_t buflen);
-static floperr_t apple2_nib_write_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, const void *buffer, size_t buflen);
+static floperr_t apple2_nib_read_track(floppy_image_legacy *floppy, int head, int track, uint64_t offset, void *buffer, size_t buflen);
+static floperr_t apple2_nib_write_track(floppy_image_legacy *floppy, int head, int track, uint64_t offset, const void *buffer, size_t buflen);
static floperr_t apple2_nib_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen);
static floperr_t apple2_nib_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam);
-static floperr_t apple2_nib_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length);
+static floperr_t apple2_nib_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length);
-static const UINT8 translate6[0x40] =
+static const uint8_t translate6[0x40] =
{
0x96, 0x97, 0x9a, 0x9b, 0x9d, 0x9e, 0x9f, 0xa6,
0xa7, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb2, 0xb3,
@@ -58,11 +58,11 @@ static const UINT8 translate6[0x40] =
* Utility code
* ----------------------------------------------------------------------- */
-static const UINT8 *get_untranslate6_map(void)
+static const uint8_t *get_untranslate6_map(void)
{
- static UINT8 map[256];
+ static uint8_t map[256];
static int map_inited = 0;
- UINT8 i;
+ uint8_t i;
if (!map_inited)
{
@@ -133,8 +133,8 @@ static floperr_t apple2_general_construct(floppy_image_legacy *floppy, int flopp
static FLOPPY_IDENTIFY(apple2_dsk_identify)
{
- UINT64 size;
- UINT64 expected_size;
+ uint64_t size;
+ uint64_t expected_size;
size = floppy_image_size(floppy);
expected_size = APPLE2_TRACK_COUNT * APPLE2_SECTOR_COUNT * APPLE2_SECTOR_SIZE;
@@ -154,7 +154,7 @@ static FLOPPY_IDENTIFY(apple2_dsk_identify)
static int apple2_do_translate_sector(floppy_image_legacy *floppy, int sector)
{
- static const UINT8 skewing[] =
+ static const uint8_t skewing[] =
{
/* DOS order (*.do) */
0x00, 0x07, 0x0E, 0x06, 0x0D, 0x05, 0x0C, 0x04,
@@ -167,7 +167,7 @@ static int apple2_do_translate_sector(floppy_image_legacy *floppy, int sector)
static int apple2_po_translate_sector(floppy_image_legacy *floppy, int sector)
{
- static const UINT8 skewing[] =
+ static const uint8_t skewing[] =
{
/* ProDOS order (*.po) */
0x00, 0x08, 0x01, 0x09, 0x02, 0x0A, 0x03, 0x0B,
@@ -192,11 +192,11 @@ static FLOPPY_CONSTRUCT(apple2_po_construct)
-static floperr_t apple2_dsk_read_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, void *buffer, size_t buflen)
+static floperr_t apple2_dsk_read_track(floppy_image_legacy *floppy, int head, int track, uint64_t offset, void *buffer, size_t buflen)
{
- UINT8 sector_buffer[APPLE2_SECTOR_SIZE];
+ uint8_t sector_buffer[APPLE2_SECTOR_SIZE];
int sector;
- UINT8 *nibble;
+ uint8_t *nibble;
if (buflen < APPLE2_NIBBLE_SIZE*APPLE2_SECTOR_COUNT)
return FLOPPY_ERROR_INTERNAL;
@@ -207,7 +207,7 @@ static floperr_t apple2_dsk_read_track(floppy_image_legacy *floppy, int head, in
for (sector = 0; sector < APPLE2_SECTOR_COUNT; sector++)
{
- nibble = (UINT8 *)buffer;
+ nibble = (uint8_t *)buffer;
nibble += sector * APPLE2_SMALL_NIBBLE_SIZE;
floppy_read_sector(floppy, head, track, sector, 0, sector_buffer, sizeof(sector_buffer));
@@ -218,18 +218,18 @@ static floperr_t apple2_dsk_read_track(floppy_image_legacy *floppy, int head, in
-static floperr_t apple2_dsk_write_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, const void *buffer, size_t buflen)
+static floperr_t apple2_dsk_write_track(floppy_image_legacy *floppy, int head, int track, uint64_t offset, const void *buffer, size_t buflen)
{
int sector;
- UINT8 sector_buffer[APPLE2_SECTOR_SIZE];
- const UINT8 *nibble;
+ uint8_t sector_buffer[APPLE2_SECTOR_SIZE];
+ const uint8_t *nibble;
if (offset != 0)
return FLOPPY_ERROR_UNSUPPORTED;
for (sector = 0; sector < APPLE2_SECTOR_COUNT; sector++)
{
- nibble = (UINT8 *)buffer;
+ nibble = (uint8_t *)buffer;
nibble += sector * APPLE2_SMALL_NIBBLE_SIZE;
disk_decode_nib(sector_buffer, nibble, nullptr, nullptr, nullptr);
@@ -247,7 +247,7 @@ static floperr_t apple2_dsk_write_track(floppy_image_legacy *floppy, int head, i
static FLOPPY_IDENTIFY(apple2_nib_identify)
{
- UINT64 size;
+ uint64_t size;
size = floppy_image_size(floppy);
*vote = ((size == APPLE2_TRACK_COUNT * APPLE2_SECTOR_COUNT * APPLE2_NIBBLE_SIZE) || (size == (APPLE2_TRACK_COUNT + 1) * APPLE2_SECTOR_COUNT * APPLE2_NIBBLE_SIZE)) ? 100 : 0;
return FLOPPY_ERROR_SUCCESS;
@@ -262,7 +262,7 @@ static FLOPPY_CONSTRUCT(apple2_nib_construct)
-static floperr_t apple2_nib_read_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, void *buffer, size_t buflen)
+static floperr_t apple2_nib_read_track(floppy_image_legacy *floppy, int head, int track, uint64_t offset, void *buffer, size_t buflen)
{
if ((head != 0) || (track < 0) || (track > APPLE2_TRACK_COUNT))
return FLOPPY_ERROR_SEEKERROR;
@@ -274,7 +274,7 @@ static floperr_t apple2_nib_read_track(floppy_image_legacy *floppy, int head, in
-static floperr_t apple2_nib_write_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, const void *buffer, size_t buflen)
+static floperr_t apple2_nib_write_track(floppy_image_legacy *floppy, int head, int track, uint64_t offset, const void *buffer, size_t buflen)
{
if ((head != 0) || (track < 0) || (track > APPLE2_TRACK_COUNT))
return FLOPPY_ERROR_SEEKERROR;
@@ -290,7 +290,7 @@ static floperr_t apple2_nib_write_track(floppy_image_legacy *floppy, int head, i
* Track conversion
* ----------------------------------------------------------------------- */
-static int decode_nibbyte(UINT8 *nibint, const UINT8 *nibdata)
+static int decode_nibbyte(uint8_t *nibint, const uint8_t *nibdata)
{
if ((nibdata[0] & 0xAA) != 0xAA)
return 1;
@@ -304,16 +304,16 @@ static int decode_nibbyte(UINT8 *nibint, const UINT8 *nibdata)
-static int disk_decode_nib(UINT8 *data, const UINT8 *nibble, int *volume, int *track, int *sector)
+static int disk_decode_nib(uint8_t *data, const uint8_t *nibble, int *volume, int *track, int *sector)
{
- UINT8 read_volume;
- UINT8 read_track;
- UINT8 read_sector;
- UINT8 read_checksum;
+ uint8_t read_volume;
+ uint8_t read_track;
+ uint8_t read_sector;
+ uint8_t read_checksum;
int i;
- UINT8 b, xorvalue, newvalue;
+ uint8_t b, xorvalue, newvalue;
- const UINT8 *untranslate6 = get_untranslate6_map();
+ const uint8_t *untranslate6 = get_untranslate6_map();
/* pick apart the volume/track/sector info and checksum */
if (decode_nibbyte(&read_volume, &nibble[10]))
@@ -367,8 +367,8 @@ static int disk_decode_nib(UINT8 *data, const UINT8 *nibble, int *volume, int *t
static floperr_t apple2_nib_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen)
{
floperr_t err;
- const UINT8 *nibble;
- UINT8 *track_data;
+ const uint8_t *nibble;
+ uint8_t *track_data;
void *track_data_v;
if ((sector < 0) || (sector >= APPLE2_SECTOR_COUNT))
@@ -379,11 +379,11 @@ static floperr_t apple2_nib_read_sector(floppy_image_legacy *floppy, int head, i
err = floppy_load_track(floppy, head, track, FALSE, &track_data_v, nullptr);
if (err)
return err;
- track_data = (UINT8 *) track_data_v;
+ track_data = (uint8_t *) track_data_v;
nibble = track_data + (sector * APPLE2_NIBBLE_SIZE);
- if (disk_decode_nib((UINT8 *)buffer, nibble, nullptr, nullptr, nullptr))
+ if (disk_decode_nib((uint8_t *)buffer, nibble, nullptr, nullptr, nullptr))
return FLOPPY_ERROR_INVALIDIMAGE;
return FLOPPY_ERROR_SUCCESS;
@@ -391,7 +391,7 @@ static floperr_t apple2_nib_read_sector(floppy_image_legacy *floppy, int head, i
-static void disk_encode_nib(UINT8 *nibble, const UINT8 *data, int volume, int track, int sector)
+static void disk_encode_nib(uint8_t *nibble, const uint8_t *data, int volume, int track, int sector)
{
int checksum, oldvalue, xorvalue, i;
@@ -457,7 +457,7 @@ static void disk_encode_nib(UINT8 *nibble, const UINT8 *data, int volume, int tr
static floperr_t apple2_nib_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam)
{
floperr_t err;
- UINT8 *track_data;
+ uint8_t *track_data;
void *track_data_v;
if ((sector < 0) || (sector >= APPLE2_SECTOR_COUNT))
@@ -468,15 +468,15 @@ static floperr_t apple2_nib_write_sector(floppy_image_legacy *floppy, int head,
err = floppy_load_track(floppy, head, track, TRUE, &track_data_v, nullptr);
if (err)
return err;
- track_data = (UINT8 *) track_data_v;
+ track_data = (uint8_t *) track_data_v;
- disk_encode_nib(track_data + sector * APPLE2_NIBBLE_SIZE, (const UINT8 *)buffer, 254, track, sector);
+ disk_encode_nib(track_data + sector * APPLE2_NIBBLE_SIZE, (const uint8_t *)buffer, 254, track, sector);
return FLOPPY_ERROR_SUCCESS;
}
-static floperr_t apple2_nib_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
+static floperr_t apple2_nib_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
{
*sector_length = APPLE2_SECTOR_SIZE;
return FLOPPY_ERROR_SUCCESS;
@@ -484,7 +484,7 @@ static floperr_t apple2_nib_get_sector_length(floppy_image_legacy *floppy, int h
-static UINT32 apple2_get_track_size(floppy_image_legacy *floppy, int head, int track)
+static uint32_t apple2_get_track_size(floppy_image_legacy *floppy, int head, int track)
{
return APPLE2_NIBBLE_SIZE * APPLE2_SECTOR_COUNT;
}
@@ -522,13 +522,13 @@ LEGACY_FLOPPY_OPTIONS_END
****************************************************************************/
-static const UINT8 dos_skewing[] =
+static const uint8_t dos_skewing[] =
{
0x00, 0x07, 0x0E, 0x06, 0x0D, 0x05, 0x0C, 0x04,
0x0B, 0x03, 0x0A, 0x02, 0x09, 0x01, 0x08, 0x0F
};
-static const UINT8 prodos_skewing[] =
+static const uint8_t prodos_skewing[] =
{
0x00, 0x08, 0x01, 0x09, 0x02, 0x0A, 0x03, 0x0B,
0x04, 0x0C, 0x05, 0x0D, 0x06, 0x0E, 0x07, 0x0F
@@ -559,10 +559,10 @@ bool a2_16sect_format::supports_save() const
return true;
}
-int a2_16sect_format::identify(io_generic *io, UINT32 form_factor)
+int a2_16sect_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT64 size = io_generic_size(io);
- UINT32 expected_size = 35 * 16 * 256;
+ uint64_t size = io_generic_size(io);
+ uint32_t expected_size = 35 * 16 * 256;
// check standard size plus some oddball sizes in our softlist
if ((size == expected_size) || (size == 143403) || (size == 143363) || (size == 143358))
@@ -603,14 +603,14 @@ const floppy_image_format_t::desc_e a2_16sect_format::mac_gcr[] = {
{ END },
};
-bool a2_16sect_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool a2_16sect_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
m_prodos_order = false;
int fpos = 0;
for(int track=0; track < 35; track++) {
- std::vector<UINT32> track_data;
- UINT8 sector_data[256*16];
+ std::vector<uint32_t> track_data;
+ uint8_t sector_data[256*16];
static const unsigned char pascal_block1[4] = { 0x08, 0xa5, 0x0f, 0x29 };
static const unsigned char pascal2_block1[4] = { 0xff, 0xa2, 0x00, 0x8e };
static const unsigned char dos33_block1[4] = { 0xa2, 0x02, 0x8e, 0x52 };
@@ -682,7 +682,7 @@ bool a2_16sect_format::load(io_generic *io, UINT32 form_factor, floppy_image *im
sector = dos_skewing[i];
}
- const UINT8 *sdata = sector_data + 256 * sector;
+ const uint8_t *sdata = sector_data + 256 * sector;
for(int j=0; j<20; j++)
raw_w(track_data, 10, 0x3fc);
raw_w(track_data, 8, 0xff);
@@ -700,9 +700,9 @@ bool a2_16sect_format::load(io_generic *io, UINT32 form_factor, floppy_image *im
raw_w(track_data, 24, 0xd5aaad);
raw_w(track_data, 1, 0);
- UINT8 pval = 0x00;
+ uint8_t pval = 0x00;
for(int i=0; i<342; i++) {
- UINT8 nval;
+ uint8_t nval;
if(i >= 0x56)
nval = sdata[i - 0x56] >> 2;
else {
@@ -730,9 +730,9 @@ bool a2_16sect_format::load(io_generic *io, UINT32 form_factor, floppy_image *im
return true;
}
-UINT8 a2_16sect_format::gb(const UINT8 *buf, int ts, int &pos, int &wrap)
+uint8_t a2_16sect_format::gb(const uint8_t *buf, int ts, int &pos, int &wrap)
{
- UINT8 v = 0;
+ uint8_t v = 0;
int w1 = wrap;
while(wrap != w1+2 && !(v & 0x80)) {
v = v << 1 | ((buf[pos >> 3] >> (7-(pos & 7))) & 1);
@@ -745,7 +745,7 @@ UINT8 a2_16sect_format::gb(const UINT8 *buf, int ts, int &pos, int &wrap)
return v;
}
-void a2_16sect_format::update_chk(const UINT8 *data, int size, UINT32 &chk)
+void a2_16sect_format::update_chk(const uint8_t *data, int size, uint32_t &chk)
{
}
@@ -786,10 +786,10 @@ bool a2_16sect_format::save(io_generic *io, floppy_image *image)
int pos_data = 0;
for(int track=0; track < 35; track++) {
- UINT8 sectdata[(256)*16];
+ uint8_t sectdata[(256)*16];
memset(sectdata, 0, sizeof(sectdata));
int nsect = 16;
- UINT8 buf[10000]; // normal is 51090 cells, e.g. 6387 bytes, add 50% and round up for denser than normal disks
+ uint8_t buf[10000]; // normal is 51090 cells, e.g. 6387 bytes, add 50% and round up for denser than normal disks
int ts;
#ifdef VERBOSE_SAVE
fprintf(stderr,"DEBUG: a2_16sect_format::save() about to generate bitstream from track %d...", track);
@@ -803,7 +803,7 @@ bool a2_16sect_format::save(io_generic *io, floppy_image *image)
int hb = 0;
int dosver = 0; // apple dos version; 0 = >=3.3, 1 = <3.3
for(;;) {
- UINT8 v = gb(buf, ts, pos, wrap);
+ uint8_t v = gb(buf, ts, pos, wrap);
if(v == 0xff) {
hb = 1;
}
@@ -821,16 +821,16 @@ bool a2_16sect_format::save(io_generic *io, floppy_image *image)
hb = 0;
if(hb == 4) {
- UINT8 h[11];
+ uint8_t h[11];
for(auto & elem : h)
elem = gb(buf, ts, pos, wrap);
- //UINT8 v2 = gcr6bw_tb[h[2]];
- UINT8 vl = gcr4_decode(h[0],h[1]);
- UINT8 tr = gcr4_decode(h[2],h[3]);
- UINT8 se = gcr4_decode(h[4],h[5]);
- UINT8 chk = gcr4_decode(h[6],h[7]);
+ //uint8_t v2 = gcr6bw_tb[h[2]];
+ uint8_t vl = gcr4_decode(h[0],h[1]);
+ uint8_t tr = gcr4_decode(h[2],h[3]);
+ uint8_t se = gcr4_decode(h[4],h[5]);
+ uint8_t chk = gcr4_decode(h[6],h[7]);
#ifdef VERBOSE_SAVE
- UINT32 post = (h[8]<<16)|(h[9]<<8)|h[10];
+ uint32_t post = (h[8]<<16)|(h[9]<<8)|h[10];
printf("Address Mark:\tVolume %d, Track %d, Sector %2d, Checksum %02X: %s, Postamble %03X: %s\n", vl, tr, se, chk, (chk ^ vl ^ tr ^ se)==0?"OK":"BAD", post, (post&0xFFFF00)==0xDEAA00?"OK":"BAD");
#endif
// sanity check
@@ -860,10 +860,10 @@ bool a2_16sect_format::save(io_generic *io, floppy_image *image)
}
if((hb == 4)&&(dosver == 0)) {
visualgrid[se][track] |= DATAFOUND;
- UINT8 *dest;
- UINT8 data[0x157];
- UINT32 dpost = 0;
- UINT8 c = 0;
+ uint8_t *dest;
+ uint8_t data[0x157];
+ uint32_t dpost = 0;
+ uint8_t c = 0;
if (m_prodos_order)
{
@@ -889,7 +889,7 @@ bool a2_16sect_format::save(io_generic *io, floppy_image *image)
dpost |= gb(buf, ts, pos, wrap);
}
// next combine in the upper 2 bits of each byte
- UINT8 bit_swap[4] = { 0, 2, 1, 3 };
+ uint8_t bit_swap[4] = { 0, 2, 1, 3 };
for(int i=0; i<0x56; i++)
data[i+0x056] = data[i+0x056]<<2 | bit_swap[data[i]&3];
for(int i=0; i<0x56; i++)
@@ -913,7 +913,7 @@ bool a2_16sect_format::save(io_generic *io, floppy_image *image)
(((data[0x156] != c) && (dpost&0xFFFF00)!=0xDEAA00) && (((visualgrid[se][track]&DATAGOOD)==0)&&(visualgrid[se][track]&DATAPOST)==0))
) {
for(int i=0x56; i<0x156; i++) {
- UINT8 dv = data[i];
+ uint8_t dv = data[i];
*dest++ = dv;
}
}
@@ -921,7 +921,7 @@ bool a2_16sect_format::save(io_generic *io, floppy_image *image)
#else
if ((visualgrid[se][track]&DATAGOOD)==0) {
for(int i=0x56; i<0x156; i++) {
- UINT8 dv = data[i];
+ uint8_t dv = data[i];
*dest++ = dv;
}
}
@@ -948,7 +948,7 @@ bool a2_16sect_format::save(io_generic *io, floppy_image *image)
}
for(int i=0; i<nsect; i++) {
//if(nsect>0) printf("t%d,", track);
- UINT8 *data = sectdata + (256)*i;
+ uint8_t *data = sectdata + (256)*i;
io_generic_write(io, data, pos_data, 256);
pos_data += 256;
}
@@ -1029,10 +1029,10 @@ bool a2_rwts18_format::supports_save() const
return true;
}
-int a2_rwts18_format::identify(io_generic *io, UINT32 form_factor)
+int a2_rwts18_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT64 size = io_generic_size(io);
- UINT32 expected_size = 35 * 16 * 256;
+ uint64_t size = io_generic_size(io);
+ uint32_t expected_size = 35 * 16 * 256;
return size == expected_size;
}
@@ -1067,10 +1067,10 @@ const floppy_image_format_t::desc_e a2_rwts18_format::mac_gcr[] = {
};
-bool a2_rwts18_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool a2_rwts18_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
/* TODO: rewrite me properly
- UINT8 sector_data[(256)*16];
+ uint8_t sector_data[(256)*16];
memset(sector_data, 0, sizeof(sector_data));
desc_s sectors[16];
@@ -1082,7 +1082,7 @@ bool a2_rwts18_format::load(io_generic *io, UINT32 form_factor, floppy_image *im
for(int track=0; track < 35; track++) {
for(int head=0; head < head_count; head++) {
for(int si=0; si<16; si++) {
- UINT8 *data = sector_data + (256)*si;
+ uint8_t *data = sector_data + (256)*si;
sectors[si].data = data;
sectors[si].size = 256;
sectors[si].sector_id = si;
@@ -1097,9 +1097,9 @@ bool a2_rwts18_format::load(io_generic *io, UINT32 form_factor, floppy_image *im
return false; // I hope that throws an error...
}
-UINT8 a2_rwts18_format::gb(const UINT8 *buf, int ts, int &pos, int &wrap)
+uint8_t a2_rwts18_format::gb(const uint8_t *buf, int ts, int &pos, int &wrap)
{
- UINT8 v = 0;
+ uint8_t v = 0;
int w1 = wrap;
while(wrap != w1+2 && !(v & 0x80)) {
v = v << 1 | ((buf[pos >> 3] >> (7-(pos & 7))) & 1);
@@ -1112,7 +1112,7 @@ UINT8 a2_rwts18_format::gb(const UINT8 *buf, int ts, int &pos, int &wrap)
return v;
}
-void a2_rwts18_format::update_chk(const UINT8 *data, int size, UINT32 &chk)
+void a2_rwts18_format::update_chk(const uint8_t *data, int size, uint32_t &chk)
{
}
@@ -1152,10 +1152,10 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
int pos_data = 0;
// for track 0 ONLY:
- UINT8 sectdata[(768)*6];
+ uint8_t sectdata[(768)*6];
memset(sectdata, 0, sizeof(sectdata));
int nsect = 18;
- UINT8 buf[130000]; // originally 13000, multiread dfi disks need larger
+ uint8_t buf[130000]; // originally 13000, multiread dfi disks need larger
int ts;
//fprintf(stderr,"DEBUG: a2_rwts18_format::save() about to generate bitstream from physical track %d (logical %d)...", track, track/2);
//~332 samples per cell, times 3+8+3 (14) for address mark, 24 for sync, 3+343+3 (349) for data mark, 24 for sync is around 743, near 776 expected
@@ -1166,7 +1166,7 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
int hb = 0;
int dosver = 0; // apple dos version; 0 = >=3.3, 1 = <3.3
for(;;) {
- UINT8 v = gb(buf, ts, pos, wrap);
+ uint8_t v = gb(buf, ts, pos, wrap);
if(v == 0xff)
hb = 1;
else if(hb == 1 && v == 0xd5)
@@ -1181,15 +1181,15 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
hb = 0;
if(hb == 4) {
- UINT8 h[11];
+ uint8_t h[11];
for(auto & elem : h)
elem = gb(buf, ts, pos, wrap);
- //UINT8 v2 = gcr6bw_tb[h[2]];
- UINT8 vl = gcr4_decode(h[0],h[1]);
- UINT8 tr = gcr4_decode(h[2],h[3]);
- UINT8 se = gcr4_decode(h[4],h[5]);
- UINT8 chk = gcr4_decode(h[6],h[7]);
- UINT32 post = (h[8]<<16)|(h[9]<<8)|h[10];
+ //uint8_t v2 = gcr6bw_tb[h[2]];
+ uint8_t vl = gcr4_decode(h[0],h[1]);
+ uint8_t tr = gcr4_decode(h[2],h[3]);
+ uint8_t se = gcr4_decode(h[4],h[5]);
+ uint8_t chk = gcr4_decode(h[6],h[7]);
+ uint32_t post = (h[8]<<16)|(h[9]<<8)|h[10];
printf("Address Mark:\tVolume %d, Track %d, Sector %2d, Checksum %02X: %s, Postamble %03X: %s\n", vl, tr, se, chk, (chk ^ vl ^ tr ^ se)==0?"OK":"BAD", post, (post&0xFFFF00)==0xDEAA00?"OK":"BAD");
// sanity check
if (tr == 0 && se < nsect) {
@@ -1233,10 +1233,10 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
0x04, 0x0C, 0x05, 0x0D, 0x06, 0x0E, 0x07, 0x0F
#endif
};
- UINT8 *dest = sectdata+(256)*sector_translate[se];
- UINT8 data[0x157];
- UINT32 dpost = 0;
- UINT8 c = 0;
+ uint8_t *dest = sectdata+(256)*sector_translate[se];
+ uint8_t data[0x157];
+ uint32_t dpost = 0;
+ uint8_t c = 0;
// first read in sector and decode to 6bit form
for(int i=0; i<0x156; i++) {
data[i] = gcr6bw_tb[gb(buf, ts, pos, wrap)] ^ c;
@@ -1252,7 +1252,7 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
dpost |= gb(buf, ts, pos, wrap);
}
// next combine in the upper 2 bits of each byte
- UINT8 bit_swap[4] = { 0, 2, 1, 3 };
+ uint8_t bit_swap[4] = { 0, 2, 1, 3 };
for(int i=0; i<0x56; i++)
data[i+0x056] = data[i+0x056]<<2 | bit_swap[data[i]&3];
for(int i=0; i<0x56; i++)
@@ -1276,7 +1276,7 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
(((data[0x156] != c) && (dpost&0xFFFF00)!=0xDEAA00) && (((visualgrid[se][0]&DATAGOOD)==0)&&(visualgrid[se][0]&DATAPOST)==0))
) {
for(int i=0x56; i<0x156; i++) {
- UINT8 dv = data[i];
+ uint8_t dv = data[i];
*dest++ = dv;
}
}
@@ -1284,7 +1284,7 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
#else
if ((visualgrid[se][0]&DATAGOOD)==0) {
for(int i=0x56; i<0x156; i++) {
- UINT8 dv = data[i];
+ uint8_t dv = data[i];
*dest++ = dv;
}
}
@@ -1309,17 +1309,17 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
}
for(int i=0; i<nsect; i++) {
//if(nsect>0) printf("t%d,", track);
- UINT8 *data = sectdata + (256)*i;
+ uint8_t *data = sectdata + (256)*i;
io_generic_write(io, data, pos_data, 256);
pos_data += 256;
}
// for the rest of the tracks
for(int track=2; track < 70; track+=2) {
- UINT8 sectdata[(768)*6];
+ uint8_t sectdata[(768)*6];
memset(sectdata, 0, sizeof(sectdata));
int nsect = 18;
- UINT8 buf[130000]; // originally 13000, multiread dfi disks need larger
+ uint8_t buf[130000]; // originally 13000, multiread dfi disks need larger
int ts;
//fprintf(stderr,"DEBUG: a2_rwts18_format::save() about to generate bitstream from physical track %d (logical %d)...", track, track/2);
//~332 samples per cell, times 3+8+3 (14) for address mark, 24 for sync, 3+343+3 (349) for data mark, 24 for sync is around 743, near 776 expected
@@ -1330,7 +1330,7 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
int wrap = 0;
int hb = 0;
for(;;) {
- UINT8 v = gb(buf, ts, pos, wrap);
+ uint8_t v = gb(buf, ts, pos, wrap);
if((v == 0xff) || (v == 0x9a)) // note 0x9a varies per title! this is an LFSR? generated value intended to throw off copiers, and only appears after the track splice (before sector 5)
hb = 1;
else if(hb == 1 && v == 0xd5)
@@ -1343,15 +1343,15 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
if(hb == 3) {
printf("AM at offset: %d, relative: %d\n", pos, pos-oldpos);
oldpos=pos;
- UINT8 h[7];
+ uint8_t h[7];
// grab exactly 7 bytes: should be Track, Sector, Checksum, AA, FF and FF and the Br0derbund Title ID
for(auto & elem : h)
elem = gb(buf, ts, pos, wrap);
- UINT8 tr = gcr6bw_tb[h[0]];
- UINT8 se = gcr6bw_tb[h[1]];
- UINT8 chk = gcr6bw_tb[h[2]];
- UINT32 post = (h[3]<<16)|(h[4]<<8)|h[5];
- UINT8 bbundid = h[6];
+ uint8_t tr = gcr6bw_tb[h[0]];
+ uint8_t se = gcr6bw_tb[h[1]];
+ uint8_t chk = gcr6bw_tb[h[2]];
+ uint32_t post = (h[3]<<16)|(h[4]<<8)|h[5];
+ uint8_t bbundid = h[6];
printf("RWTS18 AM:\t Track %d, Sector %2d, Checksum %02X: %s, Postamble %03X: %s, BBUNDID %02x\n", tr, se, chk, (chk ^ tr ^ se)==0?"OK":"BAD", post, post==0xAAFFFF?"OK":"BAD", bbundid);
// sanity check
if (tr == track/2 && se < nsect) {
@@ -1366,10 +1366,10 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
//int owrap = wrap;
// RWTS18 doesn't have a true data mark, its part of the address header
visualgrid[se][track/2] |= DATAFOUND;
- UINT8 *dest = sectdata+(256)*se;
- UINT8 data[0x401];
- UINT32 dpost = 0;
- UINT8 c = 0;
+ uint8_t *dest = sectdata+(256)*se;
+ uint8_t data[0x401];
+ uint32_t dpost = 0;
+ uint8_t c = 0;
//dest = sectdata+(768)*se;
// now read in the sector and decode to 6bit form
for(int i=0; i<0x400; i++) {
@@ -1429,21 +1429,21 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
data[(4*i)+1] |= (data[4*i]&0x30)<<2;
//printf("%c", (data[4*i]&0x3F)+0x40);
//if (((i&0xf)+1)==0x10) printf("\n");
- UINT8 dv = data[(4*i)+1];
+ uint8_t dv = data[(4*i)+1];
*dest++ = dv;
}
// second sector:
dest = sectdata+(256)*(se+6);
for(int i=0; i<0x100; i++) {
data[(4*i)+2] |= (data[4*i]&0x0c)<<4;
- UINT8 dv = data[(4*i)+2];
+ uint8_t dv = data[(4*i)+2];
*dest++ = dv;
}
// third sector:
dest = sectdata+(256)*(se+12);
for(int i=0; i<0x100; i++) {
data[(4*i)+3] |= (data[4*i]&0x03)<<6;
- UINT8 dv = data[(4*i)+3];
+ uint8_t dv = data[(4*i)+3];
*dest++ = dv;
}
}
@@ -1459,21 +1459,21 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
data[(4*i)+1] |= (data[4*i]&0x30)<<2;
//printf("%c", (data[4*i]&0x3F)+0x40);
//if (((i&0xf)+1)==0x10) printf("\n");
- UINT8 dv = data[(4*i)+1];
+ uint8_t dv = data[(4*i)+1];
*dest++ = dv;
}
// second sector:
dest = sectdata+(256)*(se+6);
for(int i=0; i<0x100; i++) {
data[(4*i)+2] |= (data[4*i]&0x0c)<<4;
- UINT8 dv = data[(4*i)+2];
+ uint8_t dv = data[(4*i)+2];
*dest++ = dv;
}
// third sector:
dest = sectdata+(256)*(se+12);
for(int i=0; i<0x100; i++) {
data[(4*i)+3] |= (data[4*i]&0x03)<<6;
- UINT8 dv = data[(4*i)+3];
+ uint8_t dv = data[(4*i)+3];
*dest++ = dv;
}
}
@@ -1492,7 +1492,7 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
}
for(int i=0; i<nsect; i++) {
//if(nsect>0) printf("t%d,", track);
- UINT8 *data = sectdata + (256)*i;
+ uint8_t *data = sectdata + (256)*i;
io_generic_write(io, data, pos_data, 256);
pos_data += 256;
}
@@ -1545,23 +1545,23 @@ bool a2_edd_format::supports_save() const
return true;
}
-int a2_edd_format::identify(io_generic *io, UINT32 form_factor)
+int a2_edd_format::identify(io_generic *io, uint32_t form_factor)
{
return ((io_generic_size(io) == 2244608) || (io_generic_size(io) == 2310144)) ? 50 : 0;
}
-UINT8 a2_edd_format::pick(const UINT8 *data, int pos)
+uint8_t a2_edd_format::pick(const uint8_t *data, int pos)
{
return ((data[pos>>3] << 8) | data[(pos>>3)+1]) >> (8-(pos & 7));
}
-bool a2_edd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool a2_edd_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 *img;
- UINT8 nibble[16384], stream[16384];
+ uint8_t *img;
+ uint8_t nibble[16384], stream[16384];
int npos[16384];
- img = (UINT8 *) malloc(2244608);
+ img = (uint8_t *) malloc(2244608);
if (!img)
{
@@ -1571,11 +1571,11 @@ bool a2_edd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image
io_generic_read(io, img, 0, 2244608);
for(int i=0; i<137; i++) {
- const UINT8 *trk = img + 16384*i;
+ const uint8_t *trk = img + 16384*i;
int pos = 0;
int wpos = 0;
while(pos < 16383*8) {
- UINT8 acc = pick(trk, pos);
+ uint8_t acc = pick(trk, pos);
pos += 8;
while(!(acc & 0x80) && pos < 16384*8) {
acc <<= 1;
@@ -1633,7 +1633,7 @@ bool a2_edd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image
stream[splice >> 3] ^= 0x80 >> (splice & 7);
generate_track_from_bitstream(i >> 2, 0, stream, len, image, i & 3);
- image->set_write_splice_position(i >> 2, 0, UINT32(U64(200000000)*splice/len), i & 3);
+ image->set_write_splice_position(i >> 2, 0, uint32_t(U64(200000000)*splice/len), i & 3);
}
free(img);
return true;
diff --git a/src/lib/formats/ap2_dsk.h b/src/lib/formats/ap2_dsk.h
index 19e55e05ff0..3d140ac86e9 100644
--- a/src/lib/formats/ap2_dsk.h
+++ b/src/lib/formats/ap2_dsk.h
@@ -39,8 +39,8 @@ class a2_16sect_format : public floppy_image_format_t
public:
a2_16sect_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual const char *name() const override;
@@ -51,8 +51,8 @@ public:
private:
static const desc_e mac_gcr[];
- UINT8 gb(const UINT8 *buf, int ts, int &pos, int &wrap);
- void update_chk(const UINT8 *data, int size, UINT32 &chk);
+ uint8_t gb(const uint8_t *buf, int ts, int &pos, int &wrap);
+ void update_chk(const uint8_t *data, int size, uint32_t &chk);
bool m_prodos_order;
};
@@ -64,8 +64,8 @@ class a2_rwts18_format : public floppy_image_format_t
public:
a2_rwts18_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual const char *name() const override;
@@ -76,8 +76,8 @@ public:
private:
static const desc_e mac_gcr[];
- UINT8 gb(const UINT8 *buf, int ts, int &pos, int &wrap);
- void update_chk(const UINT8 *data, int size, UINT32 &chk);
+ uint8_t gb(const uint8_t *buf, int ts, int &pos, int &wrap);
+ void update_chk(const uint8_t *data, int size, uint32_t &chk);
};
extern const floppy_format_type FLOPPY_RWTS18_FORMAT;
@@ -88,8 +88,8 @@ class a2_edd_format : public floppy_image_format_t
public:
a2_edd_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool supports_save() const override;
virtual const char *name() const override;
@@ -97,7 +97,7 @@ public:
virtual const char *extensions() const override;
private:
- static UINT8 pick(const UINT8 *data, int pos);
+ static uint8_t pick(const uint8_t *data, int pos);
};
extern const floppy_format_type FLOPPY_EDD_FORMAT;
diff --git a/src/lib/formats/ap_dsk35.cpp b/src/lib/formats/ap_dsk35.cpp
index baa60254b4b..38a36a956ec 100644
--- a/src/lib/formats/ap_dsk35.cpp
+++ b/src/lib/formats/ap_dsk35.cpp
@@ -106,21 +106,21 @@
struct apple35_tag
{
- UINT32 data_offset;
- UINT32 data_size;
- UINT8 format_byte;
- UINT8 sides;
+ uint32_t data_offset;
+ uint32_t data_size;
+ uint8_t format_byte;
+ uint8_t sides;
unsigned int is_1440k : 1;
/* stuff used in DiskCopy images */
- UINT32 tag_offset;
- UINT32 tag_size;
+ uint32_t tag_offset;
+ uint32_t tag_size;
};
/* normal number of sector for each track */
-static const UINT8 apple35_tracklen_800kb[80] =
+static const uint8_t apple35_tracklen_800kb[80] =
{
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
@@ -130,7 +130,7 @@ static const UINT8 apple35_tracklen_800kb[80] =
};
/* blocks of data used to nibblize tracks */
-static const UINT8 diskbytes[] =
+static const uint8_t diskbytes[] =
{
0x96, 0x97, 0x9A, 0x9B, 0x9D, 0x9E, 0x9F, 0xA6, /* 0x00 */
0xA7, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB2, 0xB3,
@@ -143,7 +143,7 @@ static const UINT8 diskbytes[] =
};
/* reverse lookup of diskbytes */
-static const INT16 rev_diskbytes[] =
+static const int16_t rev_diskbytes[] =
{
-1, -1, -1, -1, -1, -1, -1, -1, /* 0x00 */
-1, -1, -1, -1, -1, -1, -1, -1,
@@ -179,7 +179,7 @@ static const INT16 rev_diskbytes[] =
-1, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F
};
-static const UINT8 blk1[] =
+static const uint8_t blk1[] =
{
/*0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
@@ -200,11 +200,11 @@ static const UINT8 blk1[] =
0xFF, 0x3F, 0xCF, 0xF3, 0xFC, 0xFF,
0xD5, 0xAA, 0x96
};
-static const UINT8 blk2[] =
+static const uint8_t blk2[] =
{
0xDE, 0xAA, 0xFF, 0xFF, 0x3F, 0xCF, 0xF3, 0xFC, 0xFF, 0xD5, 0xAA, 0xAD
};
-static const UINT8 blk3[] =
+static const uint8_t blk3[] =
{
0xDE, 0xAA, 0xFF
};
@@ -243,13 +243,13 @@ int apple35_sectors_per_track(floppy_image_legacy *image, int track)
tag data IS important, since it allows data recovery when the catalog is trashed
*/
-static void sony_nibblize35(const UINT8 *in, UINT8 *nib_ptr, UINT8 *csum)
+static void sony_nibblize35(const uint8_t *in, uint8_t *nib_ptr, uint8_t *csum)
{
int i, j;
- UINT32 c1, c2, c3, c4;
- UINT8 val;
- UINT8 w1, w2, w3, w4;
- UINT8 b1[175], b2[175], b3[175];
+ uint32_t c1, c2, c3, c4;
+ uint8_t val;
+ uint8_t w1, w2, w3, w4;
+ uint8_t b1[175], b2[175], b3[175];
/* Copy from the user's buffer to our buffer, while computing
* the three-byte data checksum
@@ -327,13 +327,13 @@ static void sony_nibblize35(const UINT8 *in, UINT8 *nib_ptr, UINT8 *csum)
/*
does the reverse process of sony_nibblize35
*/
-static void sony_denibblize35(UINT8 *out, const UINT8 *nib_ptr, UINT8 *checksum)
+static void sony_denibblize35(uint8_t *out, const uint8_t *nib_ptr, uint8_t *checksum)
{
int i, j;
- UINT32 c1,c2,c3,c4;
- UINT8 val;
- UINT8 w1,w2,w3=0,w4;
- UINT8 b1[175],b2[175],b3[175];
+ uint32_t c1,c2,c3,c4;
+ uint8_t val;
+ uint8_t w1,w2,w3=0,w4;
+ uint8_t b1[175],b2[175],b3[175];
j = 0;
for (i=0; i<=174; i++)
@@ -405,7 +405,7 @@ static void sony_denibblize35(UINT8 *out, const UINT8 *nib_ptr, UINT8 *checksum)
-void sony_filltrack(UINT8 *buffer, size_t buffer_len, size_t *pos, UINT8 data)
+void sony_filltrack(uint8_t *buffer, size_t buffer_len, size_t *pos, uint8_t data)
{
buffer[*pos / 8] &= 0xFF << (8 - (*pos % 8));
buffer[*pos / 8] |= data >> (*pos % 8);
@@ -419,9 +419,9 @@ void sony_filltrack(UINT8 *buffer, size_t buffer_len, size_t *pos, UINT8 data)
-UINT8 sony_fetchtrack(const UINT8 *buffer, size_t buffer_len, size_t *pos)
+uint8_t sony_fetchtrack(const uint8_t *buffer, size_t buffer_len, size_t *pos)
{
- UINT8 data;
+ uint8_t data;
data = buffer[*pos / 8] << (*pos % 8);
*pos += 8;
@@ -446,10 +446,10 @@ UINT8 sony_fetchtrack(const UINT8 *buffer, size_t buffer_len, size_t *pos)
-static UINT32 apple35_get_offset(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *tag_offset)
+static uint32_t apple35_get_offset(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *tag_offset)
{
int i;
- UINT32 sector_index = 0;
+ uint32_t sector_index = 0;
struct apple35_tag *tag;
tag = get_apple35_tag(floppy);
@@ -487,7 +487,7 @@ static UINT32 apple35_get_offset(floppy_image_legacy *floppy, int head, int trac
static floperr_t apple35_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen)
{
- UINT32 data_offset;
+ uint32_t data_offset;
data_offset = apple35_get_offset(floppy, head, track, sector, nullptr);
if (data_offset == ~0)
{
@@ -501,7 +501,7 @@ static floperr_t apple35_read_sector(floppy_image_legacy *floppy, int head, int
static floperr_t apple35_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam)
{
- UINT32 data_offset;
+ uint32_t data_offset;
data_offset = apple35_get_offset(floppy, head, track, sector, nullptr);
if (data_offset == ~0)
@@ -515,12 +515,12 @@ static floperr_t apple35_write_sector(floppy_image_legacy *floppy, int head, int
static floperr_t apple35_read_sector_td(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen)
{
floperr_t err;
- UINT32 tag_offset = 0;
+ uint32_t tag_offset = 0;
assert(buflen == 524);
/* first read the sector */
- err = apple35_read_sector(floppy, head, track, sector, ((UINT8 *) buffer) + 12, 512);
+ err = apple35_read_sector(floppy, head, track, sector, ((uint8_t *) buffer) + 12, 512);
if (err)
{
return err;
@@ -542,12 +542,12 @@ static floperr_t apple35_read_sector_td(floppy_image_legacy *floppy, int head, i
static floperr_t apple35_write_sector_td(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam)
{
floperr_t err;
- UINT32 tag_offset = 0;
+ uint32_t tag_offset = 0;
assert(buflen == 524);
/* first write the sector */
- err = apple35_write_sector(floppy, head, track, sector, ((const UINT8 *) buffer) + 12, 512, 0);
+ err = apple35_write_sector(floppy, head, track, sector, ((const uint8_t *) buffer) + 12, 512, 0);
if (err)
return err;
@@ -561,7 +561,7 @@ static floperr_t apple35_write_sector_td(floppy_image_legacy *floppy, int head,
-static floperr_t apple35_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
+static floperr_t apple35_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
{
*sector_length = 512;
return FLOPPY_ERROR_SUCCESS;
@@ -583,7 +583,7 @@ static int apple35_get_tracks_per_disk(floppy_image_legacy *floppy)
-static UINT32 apple35_get_track_size(floppy_image_legacy *floppy, int head, int track)
+static uint32_t apple35_get_track_size(floppy_image_legacy *floppy, int head, int track)
{
if ((track < 0) || (track >= 80))
return 0;
@@ -592,9 +592,9 @@ static UINT32 apple35_get_track_size(floppy_image_legacy *floppy, int head, int
-static UINT8 calculate_side(int head, int track)
+static uint8_t calculate_side(int head, int track)
{
- UINT8 side;
+ uint8_t side;
side = head ? 0x20 : 0x00;
if (track & 0x40)
side |= 0x01;
@@ -603,16 +603,16 @@ static UINT8 calculate_side(int head, int track)
-static floperr_t apple35_read_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, void *buffer, size_t buflen)
+static floperr_t apple35_read_track(floppy_image_legacy *floppy, int head, int track, uint64_t offset, void *buffer, size_t buflen)
{
floperr_t err;
size_t pos = 0;
int sector_count, sector, i;
- UINT8 sum, side;
+ uint8_t sum, side;
struct apple35_tag *tag;
- UINT8 sector_data[524];
- UINT8 nibble_data[699];
- UINT8 checksum[4];
+ uint8_t sector_data[524];
+ uint8_t nibble_data[699];
+ uint8_t checksum[4];
tag = get_apple35_tag(floppy);
@@ -637,29 +637,29 @@ static floperr_t apple35_read_track(floppy_image_legacy *floppy, int head, int t
sony_nibblize35(sector_data, nibble_data, checksum);
for (i = 0; i < ARRAY_LENGTH(blk1); i++)
- sony_filltrack((UINT8*)buffer, buflen, &pos, blk1[i]);
+ sony_filltrack((uint8_t*)buffer, buflen, &pos, blk1[i]);
sum = (track ^ sector ^ side ^ tag->format_byte) & 0x3F;
- sony_filltrack((UINT8*)buffer, buflen, &pos, diskbytes[track & 0x3f]);
- sony_filltrack((UINT8*)buffer, buflen, &pos, diskbytes[sector]);
- sony_filltrack((UINT8*)buffer, buflen, &pos, diskbytes[side]);
- sony_filltrack((UINT8*)buffer, buflen, &pos, diskbytes[tag->format_byte]);
- sony_filltrack((UINT8*)buffer, buflen, &pos, diskbytes[sum]);
+ sony_filltrack((uint8_t*)buffer, buflen, &pos, diskbytes[track & 0x3f]);
+ sony_filltrack((uint8_t*)buffer, buflen, &pos, diskbytes[sector]);
+ sony_filltrack((uint8_t*)buffer, buflen, &pos, diskbytes[side]);
+ sony_filltrack((uint8_t*)buffer, buflen, &pos, diskbytes[tag->format_byte]);
+ sony_filltrack((uint8_t*)buffer, buflen, &pos, diskbytes[sum]);
for (i = 0; i < ARRAY_LENGTH(blk2); i++)
- sony_filltrack((UINT8*)buffer, buflen, &pos, blk2[i]);
+ sony_filltrack((uint8_t*)buffer, buflen, &pos, blk2[i]);
- sony_filltrack((UINT8*)buffer, buflen, &pos, diskbytes[sector]);
+ sony_filltrack((uint8_t*)buffer, buflen, &pos, diskbytes[sector]);
for (i = 0; i < ARRAY_LENGTH(nibble_data); i++)
- sony_filltrack((UINT8*)buffer, buflen, &pos, diskbytes[nibble_data[i]]);
+ sony_filltrack((uint8_t*)buffer, buflen, &pos, diskbytes[nibble_data[i]]);
for (i = 3; i >= 0; i--)
- sony_filltrack((UINT8*)buffer, buflen, &pos, diskbytes[checksum[i]]);
+ sony_filltrack((uint8_t*)buffer, buflen, &pos, diskbytes[checksum[i]]);
for (i = 0; i < ARRAY_LENGTH(blk3); i++)
- sony_filltrack((UINT8*)buffer, buflen, &pos, blk3[i]);
+ sony_filltrack((uint8_t*)buffer, buflen, &pos, blk3[i]);
}
return FLOPPY_ERROR_SUCCESS;
@@ -667,17 +667,17 @@ static floperr_t apple35_read_track(floppy_image_legacy *floppy, int head, int t
-static floperr_t apple35_write_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, const void *buffer, size_t buflen)
+static floperr_t apple35_write_track(floppy_image_legacy *floppy, int head, int track, uint64_t offset, const void *buffer, size_t buflen)
{
floperr_t err;
size_t pos = 0;
int sector_count, sector, i, j;
struct apple35_tag *tag;
- UINT8 sum, format_byte, val, side;
- UINT32 found_sectors = 0;
- UINT8 sector_data[524];
- UINT8 nibble_data[699];
- UINT8 checksum[4];
+ uint8_t sum, format_byte, val, side;
+ uint32_t found_sectors = 0;
+ uint8_t sector_data[524];
+ uint8_t nibble_data[699];
+ uint8_t checksum[4];
tag = get_apple35_tag(floppy);
@@ -692,32 +692,32 @@ static floperr_t apple35_write_track(floppy_image_legacy *floppy, int head, int
/* do 2 rotations, in case the bit slip stuff prevent us to read the first sector */
for (j = 0; j < (buflen * 2); j++)
{
- if (sony_fetchtrack((UINT8*)buffer, buflen, &pos) != 0xD5)
+ if (sony_fetchtrack((uint8_t*)buffer, buflen, &pos) != 0xD5)
continue;
j++;
- if (sony_fetchtrack((UINT8*)buffer, buflen, &pos) != 0xAA)
+ if (sony_fetchtrack((uint8_t*)buffer, buflen, &pos) != 0xAA)
continue;
j++;
- if (sony_fetchtrack((UINT8*)buffer, buflen, &pos) != 0x96)
+ if (sony_fetchtrack((uint8_t*)buffer, buflen, &pos) != 0x96)
continue;
j++;
- if (rev_diskbytes[sony_fetchtrack((UINT8*)buffer, buflen, &pos)] != (track & 0x3F))
+ if (rev_diskbytes[sony_fetchtrack((uint8_t*)buffer, buflen, &pos)] != (track & 0x3F))
continue;
j++;
- sector = rev_diskbytes[sony_fetchtrack((UINT8*)buffer, buflen, &pos)];
+ sector = rev_diskbytes[sony_fetchtrack((uint8_t*)buffer, buflen, &pos)];
if ((sector < 0) || (sector >= sector_count))
continue;
j++;
- if (rev_diskbytes[sony_fetchtrack((UINT8*)buffer, buflen, &pos)] != side)
+ if (rev_diskbytes[sony_fetchtrack((uint8_t*)buffer, buflen, &pos)] != side)
continue;
j++;
- format_byte = rev_diskbytes[sony_fetchtrack((UINT8*)buffer, buflen, &pos)];
+ format_byte = rev_diskbytes[sony_fetchtrack((uint8_t*)buffer, buflen, &pos)];
if (format_byte != tag->format_byte)
{
/* this is an error, but not THAT critical, I guess */
@@ -725,52 +725,52 @@ static floperr_t apple35_write_track(floppy_image_legacy *floppy, int head, int
j++;
sum = track ^ sector ^ side ^ format_byte;
- if (rev_diskbytes[sony_fetchtrack((UINT8*)buffer, buflen, &pos)] != sum)
+ if (rev_diskbytes[sony_fetchtrack((uint8_t*)buffer, buflen, &pos)] != sum)
continue;
j++;
- if (sony_fetchtrack((UINT8*)buffer, buflen, &pos) != 0xDE)
+ if (sony_fetchtrack((uint8_t*)buffer, buflen, &pos) != 0xDE)
continue;
j++;
- if (sony_fetchtrack((UINT8*)buffer, buflen, &pos) != 0xAA)
+ if (sony_fetchtrack((uint8_t*)buffer, buflen, &pos) != 0xAA)
continue;
j++;
- while((val = sony_fetchtrack((UINT8*)buffer, buflen, &pos)) == 0xFF)
+ while((val = sony_fetchtrack((uint8_t*)buffer, buflen, &pos)) == 0xFF)
j++;
if (val != 0xD5)
continue; /* lost bit slip mark! */
j++;
- if (sony_fetchtrack((UINT8*)buffer, buflen, &pos) != 0xAA)
+ if (sony_fetchtrack((uint8_t*)buffer, buflen, &pos) != 0xAA)
continue;
j++;
- if (sony_fetchtrack((UINT8*)buffer, buflen, &pos) != 0xAD)
+ if (sony_fetchtrack((uint8_t*)buffer, buflen, &pos) != 0xAD)
continue;
j++;
/* should this be regarded as a critical error ??? */
- if (rev_diskbytes[sony_fetchtrack((UINT8*)buffer, buflen, &pos)] != sector)
+ if (rev_diskbytes[sony_fetchtrack((uint8_t*)buffer, buflen, &pos)] != sector)
continue;
j++;
for (i = 0; i < ARRAY_LENGTH(nibble_data); i++)
{
- nibble_data[i] = rev_diskbytes[sony_fetchtrack((UINT8*)buffer, buflen, &pos)];
+ nibble_data[i] = rev_diskbytes[sony_fetchtrack((uint8_t*)buffer, buflen, &pos)];
j++;
}
for (i = 3; i >= 0; i--)
{
/* should be checking checksum */
- sony_fetchtrack((UINT8*)buffer, buflen, &pos);
+ sony_fetchtrack((uint8_t*)buffer, buflen, &pos);
}
- sony_fetchtrack((UINT8*)buffer, buflen, &pos); /* should get 0xDE */
- sony_fetchtrack((UINT8*)buffer, buflen, &pos); /* should get 0xAA */
- sony_fetchtrack((UINT8*)buffer, buflen, &pos); /* should get 0xFF */
+ sony_fetchtrack((uint8_t*)buffer, buflen, &pos); /* should get 0xDE */
+ sony_fetchtrack((uint8_t*)buffer, buflen, &pos); /* should get 0xAA */
+ sony_fetchtrack((uint8_t*)buffer, buflen, &pos); /* should get 0xFF */
/* did we already write this sector? */
if ((found_sectors & (1 << sector)) == 0)
@@ -790,8 +790,8 @@ static floperr_t apple35_write_track(floppy_image_legacy *floppy, int head, int
-static floperr_t apple35_construct(floppy_image_legacy *floppy, UINT32 data_offset, UINT32 data_size,
- UINT32 tag_offset, UINT32 tag_size, INT16 format_byte, UINT8 sides, int is_1440k)
+static floperr_t apple35_construct(floppy_image_legacy *floppy, uint32_t data_offset, uint32_t data_size,
+ uint32_t tag_offset, uint32_t tag_size, int16_t format_byte, uint8_t sides, int is_1440k)
{
struct apple35_tag *tag;
struct FloppyCallbacks *format;
@@ -820,7 +820,7 @@ static floperr_t apple35_construct(floppy_image_legacy *floppy, UINT32 data_offs
tag->data_size = data_size;
tag->tag_offset = tag_offset;
tag->tag_size = tag_size;
- tag->format_byte = (UINT8) format_byte;
+ tag->format_byte = (uint8_t) format_byte;
tag->sides = sides;
tag->is_1440k = is_1440k ? 1 : 0;
@@ -843,7 +843,7 @@ static floperr_t apple35_construct(floppy_image_legacy *floppy, UINT32 data_offs
static FLOPPY_IDENTIFY(apple35_raw_identify)
{
- UINT64 size;
+ uint64_t size;
size = floppy_image_size(floppy);
*vote = ((size == 80*1*10*512) || (size == 80*2*10*512) || (size == (80*2*18*512)+84)
|| (size == 80*2*18*512)) ? 100 : 0;
@@ -855,8 +855,8 @@ static FLOPPY_IDENTIFY(apple35_raw_identify)
static FLOPPY_CONSTRUCT(apple35_raw_construct)
{
- UINT64 size;
- UINT8 sides;
+ uint64_t size;
+ uint8_t sides;
int is_1440k;
if (params)
@@ -884,7 +884,7 @@ static FLOPPY_CONSTRUCT(apple35_raw_construct)
return FLOPPY_ERROR_INVALIDIMAGE;
}
- return apple35_construct(floppy, 0, (UINT32) size, 0, 0, -1, sides, is_1440k);
+ return apple35_construct(floppy, 0, (uint32_t) size, 0, 0, -1, sides, is_1440k);
}
@@ -893,25 +893,25 @@ static FLOPPY_CONSTRUCT(apple35_raw_construct)
struct header_diskcopy
{
- UINT8 disk_name[64]; /* name of the disk */
- UINT32 data_size; /* total size of data for all sectors (512*number_of_sectors) */
- UINT32 tag_size; /* total size of tag data for all sectors (12*number_of_sectors for GCR 3.5" floppies, 20*number_of_sectors for HD20, 0 otherwise) */
- UINT32 data_checksum; /* CRC32 checksum of all sector data */
- UINT32 tag_checksum; /* CRC32 checksum of all tag data */
- UINT8 disk_format; /* 0 = 400K, 1 = 800K, 2 = 720K, 3 = 1440K (other values reserved) */
- UINT8 format_byte; /* should be $00 Apple II, $01 Lisa, $02 Mac MFS ??? */
+ uint8_t disk_name[64]; /* name of the disk */
+ uint32_t data_size; /* total size of data for all sectors (512*number_of_sectors) */
+ uint32_t tag_size; /* total size of tag data for all sectors (12*number_of_sectors for GCR 3.5" floppies, 20*number_of_sectors for HD20, 0 otherwise) */
+ uint32_t data_checksum; /* CRC32 checksum of all sector data */
+ uint32_t tag_checksum; /* CRC32 checksum of all tag data */
+ uint8_t disk_format; /* 0 = 400K, 1 = 800K, 2 = 720K, 3 = 1440K (other values reserved) */
+ uint8_t format_byte; /* should be $00 Apple II, $01 Lisa, $02 Mac MFS ??? */
/* $12 = 400K, $22 = >400K Macintosh (DiskCopy uses this value for
all Apple II disks not 800K in size, and even for some of those),
$24 = 800K Apple II disk */
- UINT16 magic; /* always $0100 (otherwise, the file may be in a different format. */
+ uint16_t magic; /* always $0100 (otherwise, the file may be in a different format. */
};
-static floperr_t apple35_diskcopy_headerdecode(floppy_image_legacy *floppy, UINT32 *data_offset,
- UINT32 *data_size, UINT32 *tag_offset, UINT32 *tag_size, UINT8 *format_byte, UINT8 *sides)
+static floperr_t apple35_diskcopy_headerdecode(floppy_image_legacy *floppy, uint32_t *data_offset,
+ uint32_t *data_size, uint32_t *tag_offset, uint32_t *tag_size, uint8_t *format_byte, uint8_t *sides)
{
- UINT64 size;
+ uint64_t size;
struct header_diskcopy header;
if (data_offset)
@@ -986,10 +986,10 @@ static FLOPPY_IDENTIFY(apple35_diskcopy_identify)
static FLOPPY_CONSTRUCT(apple35_diskcopy_construct)
{
floperr_t err;
- UINT8 format_byte, sides;
- UINT32 data_offset, data_size;
- UINT32 tag_offset, tag_size;
- INT16 format_byte_param = -1;
+ uint8_t format_byte, sides;
+ uint32_t data_offset, data_size;
+ uint32_t tag_offset, tag_size;
+ int16_t format_byte_param = -1;
struct header_diskcopy header;
if (params)
@@ -1030,18 +1030,18 @@ struct header_2img
{
char magic[4]; /* '2IMG' */
char creator[4]; /* signature; 'MESS' for MESS */
- UINT16 header_length;
- UINT16 version;
- UINT32 image_format;
- UINT32 flags;
- UINT32 block_count;
- UINT32 data_offset;
- UINT32 data_length;
- UINT32 comment_offset;
- UINT32 comment_length;
- UINT32 creator_offset;
- UINT32 creator_length;
- UINT32 padding[4];
+ uint16_t header_length;
+ uint16_t version;
+ uint32_t image_format;
+ uint32_t flags;
+ uint32_t block_count;
+ uint32_t data_offset;
+ uint32_t data_length;
+ uint32_t comment_offset;
+ uint32_t comment_length;
+ uint32_t creator_offset;
+ uint32_t creator_length;
+ uint32_t padding[4];
};
#define IMAGE_FORMAT_DO 0
@@ -1051,11 +1051,11 @@ struct header_2img
-static floperr_t apple35_2img_decode(floppy_image_legacy *floppy, UINT32 *image_format,
- UINT32 *data_offset, UINT32 *data_length)
+static floperr_t apple35_2img_decode(floppy_image_legacy *floppy, uint32_t *image_format,
+ uint32_t *data_offset, uint32_t *data_length)
{
struct header_2img header;
- UINT64 size;
+ uint64_t size;
if (image_format)
*image_format = 0;
@@ -1097,11 +1097,11 @@ static floperr_t apple35_2img_decode(floppy_image_legacy *floppy, UINT32 *image_
header.data_length = 0x0c8000;
}
- if ((((UINT64) header.data_offset) + header.data_length) > size)
+ if ((((uint64_t) header.data_offset) + header.data_length) > size)
return FLOPPY_ERROR_INVALIDIMAGE;
- if ((((UINT64) header.comment_offset) + header.comment_length) > size)
+ if ((((uint64_t) header.comment_offset) + header.comment_length) > size)
return FLOPPY_ERROR_INVALIDIMAGE;
- if ((((UINT64) header.creator_offset) + header.creator_length) > size)
+ if ((((uint64_t) header.creator_offset) + header.creator_length) > size)
return FLOPPY_ERROR_INVALIDIMAGE;
if ((header.image_format != IMAGE_FORMAT_DO) &&
(header.image_format != IMAGE_FORMAT_PO) &&
@@ -1130,10 +1130,10 @@ static FLOPPY_IDENTIFY(apple35_2img_identify)
static FLOPPY_CONSTRUCT(apple35_2img_construct)
{
floperr_t err;
- UINT32 image_format;
- UINT32 data_offset;
- UINT32 data_size;
- UINT8 sides = 2;
+ uint32_t image_format;
+ uint32_t data_offset;
+ uint32_t data_size;
+ uint8_t sides = 2;
struct header_2img header;
if (params)
@@ -1232,16 +1232,16 @@ bool dc42_format::supports_save() const
return true;
}
-int dc42_format::identify(io_generic *io, UINT32 form_factor)
+int dc42_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 h[0x54];
- UINT64 size = io_generic_size(io);
+ uint8_t h[0x54];
+ uint64_t size = io_generic_size(io);
if(size < 0x54)
return 0;
io_generic_read(io, h, 0, 0x54);
- UINT32 dsize = (h[0x40] << 24) | (h[0x41] << 16) | (h[0x42] << 8) | h[0x43];
- UINT32 tsize = (h[0x44] << 24) | (h[0x45] << 16) | (h[0x46] << 8) | h[0x47];
+ uint32_t dsize = (h[0x40] << 24) | (h[0x41] << 16) | (h[0x42] << 8) | h[0x43];
+ uint32_t tsize = (h[0x44] << 24) | (h[0x45] << 16) | (h[0x46] << 8) | h[0x47];
return size == 0x54+tsize+dsize && h[0] < 64 && h[0x52] == 1 && h[0x53] == 0 ? 100 : 0;
}
@@ -1276,22 +1276,22 @@ const floppy_image_format_t::desc_e dc42_format::mac_gcr[] = {
};
-bool dc42_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool dc42_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 h[0x54];
+ uint8_t h[0x54];
io_generic_read(io, h, 0, 0x54);
int dsize = (h[0x40] << 24) | (h[0x41] << 16) | (h[0x42] << 8) | h[0x43];
int tsize = (h[0x44] << 24) | (h[0x45] << 16) | (h[0x46] << 8) | h[0x47];
- UINT8 encoding = h[0x50];
- UINT8 format = h[0x51];
+ uint8_t encoding = h[0x50];
+ uint8_t format = h[0x51];
if((encoding != 0x00 || format != 0x02) && (encoding != 0x01 || format != 0x22)) {
osd_printf_error("dc42: Unsupported encoding/format combination %02x/%02x\n", encoding, format);
return false;
}
- UINT8 sector_data[(512+12)*12];
+ uint8_t sector_data[(512+12)*12];
memset(sector_data, 0, sizeof(sector_data));
desc_s sectors[12];
@@ -1306,7 +1306,7 @@ bool dc42_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
int ns = 12 - (track/16);
int si = 0;
for(int i=0; i<ns; i++) {
- UINT8 *data = sector_data + (512+12)*i;
+ uint8_t *data = sector_data + (512+12)*i;
sectors[si].data = data;
sectors[si].size = 512+12;
sectors[si].sector_id = i;
@@ -1327,9 +1327,9 @@ bool dc42_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
return true;
}
-UINT8 dc42_format::gb(const UINT8 *buf, int ts, int &pos, int &wrap)
+uint8_t dc42_format::gb(const uint8_t *buf, int ts, int &pos, int &wrap)
{
- UINT8 v = 0;
+ uint8_t v = 0;
int w1 = wrap;
while(wrap != w1+2 && !(v & 0x80)) {
v = v << 1 | ((buf[pos >> 3] >> (7-(pos & 7))) & 1);
@@ -1342,7 +1342,7 @@ UINT8 dc42_format::gb(const UINT8 *buf, int ts, int &pos, int &wrap)
return v;
}
-void dc42_format::update_chk(const UINT8 *data, int size, UINT32 &chk)
+void dc42_format::update_chk(const uint8_t *data, int size, uint32_t &chk)
{
for(int i=0; i<size; i+=2) {
chk += (data[i] << 8) | data[i+1];
@@ -1358,13 +1358,13 @@ bool dc42_format::save(io_generic *io, floppy_image *image)
if(g_heads == 0)
g_heads = 1;
- UINT8 h[0x54];
+ uint8_t h[0x54];
memset(h, 0, 0x54);
strcpy((char *)h+1, "Unnamed");
h[0] = 7;
int nsect = 16*(12+11+10+9+8)*g_heads;
- UINT32 dsize = nsect*512;
- UINT32 tsize = nsect*12;
+ uint32_t dsize = nsect*512;
+ uint32_t tsize = nsect*12;
h[0x40] = dsize >> 24;
h[0x41] = dsize >> 16;
h[0x42] = dsize >> 8;
@@ -1378,25 +1378,25 @@ bool dc42_format::save(io_generic *io, floppy_image *image)
h[0x52] = 0x01;
h[0x53] = 0x00;
- UINT32 dchk = 0;
- UINT32 tchk = 0;
+ uint32_t dchk = 0;
+ uint32_t tchk = 0;
int pos_data = 0x54;
int pos_tag = 0x54+dsize;
for(int track=0; track < 80; track++) {
for(int head=0; head < g_heads; head++) {
- UINT8 sectdata[(512+12)*12];
+ uint8_t sectdata[(512+12)*12];
memset(sectdata, 0, sizeof(sectdata));
int nsect = 12-(track/16);
- UINT8 buf[13000];
+ uint8_t buf[13000];
int ts;
generate_bitstream_from_track(track, head, 200000000/(6208*nsect), buf, ts, image);
int pos = 0;
int wrap = 0;
int hb = 0;
for(;;) {
- UINT8 v = gb(buf, ts, pos, wrap);
+ uint8_t v = gb(buf, ts, pos, wrap);
if(v == 0xff)
hb = 1;
else if(hb == 1 && v == 0xd5)
@@ -1409,18 +1409,18 @@ bool dc42_format::save(io_generic *io, floppy_image *image)
hb = 0;
if(hb == 4) {
- UINT8 h[7];
+ uint8_t h[7];
for(auto & elem : h)
elem = gb(buf, ts, pos, wrap);
- UINT8 v2 = gcr6bw_tb[h[2]];
- UINT8 v3 = gcr6bw_tb[h[3]];
- UINT8 tr = gcr6bw_tb[h[0]] | (v2 & 1 ? 0x40 : 0x00);
- UINT8 se = gcr6bw_tb[h[1]];
- UINT8 si = v2 & 0x20 ? 1 : 0;
- // UINT8 ds = v3 & 0x20 ? 1 : 0;
- // UINT8 fmt = v3 & 0x1f;
- UINT8 c1 = (tr^se^v2^v3) & 0x3f;
- UINT8 chk = gcr6bw_tb[h[4]];
+ uint8_t v2 = gcr6bw_tb[h[2]];
+ uint8_t v3 = gcr6bw_tb[h[3]];
+ uint8_t tr = gcr6bw_tb[h[0]] | (v2 & 1 ? 0x40 : 0x00);
+ uint8_t se = gcr6bw_tb[h[1]];
+ uint8_t si = v2 & 0x20 ? 1 : 0;
+ // uint8_t ds = v3 & 0x20 ? 1 : 0;
+ // uint8_t fmt = v3 & 0x1f;
+ uint8_t c1 = (tr^se^v2^v3) & 0x3f;
+ uint8_t chk = gcr6bw_tb[h[4]];
if(chk == c1 && tr == track && si == head && se < nsect) {
int opos = pos;
int owrap = wrap;
@@ -1439,15 +1439,15 @@ bool dc42_format::save(io_generic *io, floppy_image *image)
hb = 0;
}
if(hb == 4) {
- UINT8 *dest = sectdata+(512+12)*se;
+ uint8_t *dest = sectdata+(512+12)*se;
gb(buf, ts, pos, wrap); // Ignore the sector byte
- UINT8 ca = 0, cb = 0, cc = 0;
+ uint8_t ca = 0, cb = 0, cc = 0;
for(int i=0; i<522/3+1; i++) {
- UINT8 e0 = gb(buf, ts, pos, wrap);
- UINT8 e1 = gb(buf, ts, pos, wrap);
- UINT8 e2 = gb(buf, ts, pos, wrap);
- UINT8 e3 = i == 522/3 ? 0x96 : gb(buf, ts, pos, wrap);
- UINT8 va, vb, vc;
+ uint8_t e0 = gb(buf, ts, pos, wrap);
+ uint8_t e1 = gb(buf, ts, pos, wrap);
+ uint8_t e2 = gb(buf, ts, pos, wrap);
+ uint8_t e3 = i == 522/3 ? 0x96 : gb(buf, ts, pos, wrap);
+ uint8_t va, vb, vc;
gcr6_decode(e0, e1, e2, e3, va, vb, vc);
cc = (cc << 1) | (cc >> 7);
va = va ^ cc;
@@ -1474,7 +1474,7 @@ bool dc42_format::save(io_generic *io, floppy_image *image)
break;
}
for(int i=0; i<nsect; i++) {
- UINT8 *data = sectdata + (512+12)*i;
+ uint8_t *data = sectdata + (512+12)*i;
io_generic_write(io, data, pos_tag, 12);
io_generic_write(io, data+12, pos_data, 512);
pos_tag += 12;
diff --git a/src/lib/formats/ap_dsk35.h b/src/lib/formats/ap_dsk35.h
index 533307e2708..6e7b2d583c5 100644
--- a/src/lib/formats/ap_dsk35.h
+++ b/src/lib/formats/ap_dsk35.h
@@ -13,8 +13,8 @@
#include "flopimg.h"
-void sony_filltrack(UINT8 *buffer, size_t buffer_len, size_t *pos, UINT8 data);
-UINT8 sony_fetchtrack(const UINT8 *buffer, size_t buffer_len, size_t *pos);
+void sony_filltrack(uint8_t *buffer, size_t buffer_len, size_t *pos, uint8_t data);
+uint8_t sony_fetchtrack(const uint8_t *buffer, size_t buffer_len, size_t *pos);
int apple35_sectors_per_track(floppy_image_legacy *image, int track);
@@ -28,8 +28,8 @@ class dc42_format : public floppy_image_format_t
public:
dc42_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual const char *name() const override;
@@ -40,8 +40,8 @@ public:
private:
static const desc_e mac_gcr[];
- UINT8 gb(const UINT8 *buf, int ts, int &pos, int &wrap);
- void update_chk(const UINT8 *data, int size, UINT32 &chk);
+ uint8_t gb(const uint8_t *buf, int ts, int &pos, int &wrap);
+ void update_chk(const uint8_t *data, int size, uint32_t &chk);
};
extern const floppy_format_type FLOPPY_DC42_FORMAT;
diff --git a/src/lib/formats/apf_apt.cpp b/src/lib/formats/apf_apt.cpp
index d2064122d82..de919b0bddd 100644
--- a/src/lib/formats/apf_apt.cpp
+++ b/src/lib/formats/apf_apt.cpp
@@ -47,7 +47,7 @@ e. A checksum byte (8-bit addition)
/* 500 microsecond of bit 0 and 1000 microsecond of bit 1 */
static int apf_image_size;
-static int apf_put_samples(INT16 *buffer, int sample_pos, int count, int level)
+static int apf_put_samples(int16_t *buffer, int sample_pos, int count, int level)
{
if (buffer)
{
@@ -58,7 +58,7 @@ static int apf_put_samples(INT16 *buffer, int sample_pos, int count, int level)
return count;
}
-static int apf_output_bit(INT16 *buffer, int sample_pos, bool bit)
+static int apf_output_bit(int16_t *buffer, int sample_pos, bool bit)
{
int samples = 0;
@@ -76,10 +76,10 @@ static int apf_output_bit(INT16 *buffer, int sample_pos, bool bit)
return samples;
}
-static int apf_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
+static int apf_output_byte(int16_t *buffer, int sample_pos, uint8_t byte)
{
int samples = 0;
- UINT8 i;
+ uint8_t i;
/* data */
for (i = 0; i<8; i++)
@@ -88,12 +88,12 @@ static int apf_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
return samples;
}
-static int apf_apt_handle_cassette(INT16 *buffer, const UINT8 *bytes)
+static int apf_apt_handle_cassette(int16_t *buffer, const uint8_t *bytes)
{
- UINT32 sample_count = 0;
- UINT32 i;
- UINT8 cksm = 0;
- UINT32 temp = 0;
+ uint32_t sample_count = 0;
+ uint32_t i;
+ uint8_t cksm = 0;
+ uint32_t temp = 0;
// silence
sample_count += apf_put_samples(buffer, 0, 12000, 0);
@@ -121,11 +121,11 @@ static int apf_apt_handle_cassette(INT16 *buffer, const UINT8 *bytes)
return sample_count;
}
-static int apf_cpf_handle_cassette(INT16 *buffer, const UINT8 *bytes)
+static int apf_cpf_handle_cassette(int16_t *buffer, const uint8_t *bytes)
{
- UINT32 sample_count = 0;
- UINT32 i;
- UINT8 cksm = 0;
+ uint32_t sample_count = 0;
+ uint32_t i;
+ uint8_t cksm = 0;
// silence
sample_count += apf_put_samples(buffer, 0, 12000, 0);
@@ -154,12 +154,12 @@ static int apf_cpf_handle_cassette(INT16 *buffer, const UINT8 *bytes)
Generate samples for the tape image
********************************************************************/
-static int apf_apt_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int apf_apt_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
return apf_apt_handle_cassette(buffer, bytes);
}
-static int apf_cpf_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int apf_cpf_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
return apf_cpf_handle_cassette(buffer, bytes);
}
@@ -168,14 +168,14 @@ static int apf_cpf_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
Calculate the number of samples needed for this tape image
********************************************************************/
-static int apf_apt_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int apf_apt_calculate_size_in_samples(const uint8_t *bytes, int length)
{
apf_image_size = length;
return apf_apt_handle_cassette(nullptr, bytes);
}
-static int apf_cpf_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int apf_cpf_calculate_size_in_samples(const uint8_t *bytes, int length)
{
apf_image_size = length;
diff --git a/src/lib/formats/apollo_dsk.cpp b/src/lib/formats/apollo_dsk.cpp
index 29dbe23b0b5..b2fef28be71 100644
--- a/src/lib/formats/apollo_dsk.cpp
+++ b/src/lib/formats/apollo_dsk.cpp
@@ -46,10 +46,10 @@ const apollo_format::format apollo_format::formats[] = {
const floppy_format_type FLOPPY_APOLLO_FORMAT = &floppy_image_format_creator<apollo_format>;
-int apollo_format::identify(io_generic *io, UINT32 form_factor)
+int apollo_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT64 size = io_generic_size(io);
- UINT32 expected_size = 77*2*8*1024;
+ uint64_t size = io_generic_size(io);
+ uint32_t expected_size = 77*2*8*1024;
return ((size == expected_size) || (size == 0)) ? 1 : 0;
}
diff --git a/src/lib/formats/apollo_dsk.h b/src/lib/formats/apollo_dsk.h
index 51f9eb4aebc..47de0373d23 100644
--- a/src/lib/formats/apollo_dsk.h
+++ b/src/lib/formats/apollo_dsk.h
@@ -17,7 +17,7 @@ class apollo_format : public upd765_format {
public:
apollo_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
virtual const char *name() const override;
virtual const char *description() const override;
virtual const char *extensions() const override;
diff --git a/src/lib/formats/apridisk.cpp b/src/lib/formats/apridisk.cpp
index a004d54ccd0..a42aa9fa4d4 100644
--- a/src/lib/formats/apridisk.cpp
+++ b/src/lib/formats/apridisk.cpp
@@ -31,9 +31,9 @@ const char *apridisk_format::extensions() const
return "dsk";
}
-int apridisk_format::identify(io_generic *io, UINT32 form_factor)
+int apridisk_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 header[APR_HEADER_SIZE];
+ uint8_t header[APR_HEADER_SIZE];
io_generic_read(io, header, 0, APR_HEADER_SIZE);
const char magic[] = "ACT Apricot disk image\x1a\x04";
@@ -44,35 +44,35 @@ int apridisk_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool apridisk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool apridisk_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
desc_pc_sector sectors[80][2][18];
- UINT8 sector_data[MAX_SECTORS * SECTOR_SIZE];
- UINT8 *data_ptr = sector_data;
+ uint8_t sector_data[MAX_SECTORS * SECTOR_SIZE];
+ uint8_t *data_ptr = sector_data;
int track_count = 0, head_count = 0, sector_count = 0;
- UINT64 file_size = io_generic_size(io);
- UINT64 file_offset = APR_HEADER_SIZE;
+ uint64_t file_size = io_generic_size(io);
+ uint64_t file_offset = APR_HEADER_SIZE;
while (file_offset < file_size)
{
// read sector header
- UINT8 sector_header[16];
+ uint8_t sector_header[16];
io_generic_read(io, sector_header, file_offset, 16);
- UINT32 type = pick_integer_le(&sector_header, 0, 4);
- UINT16 compression = pick_integer_le(&sector_header, 4, 2);
- UINT16 header_size = pick_integer_le(&sector_header, 6, 2);
- UINT32 data_size = pick_integer_le(&sector_header, 8, 4);
+ uint32_t type = pick_integer_le(&sector_header, 0, 4);
+ uint16_t compression = pick_integer_le(&sector_header, 4, 2);
+ uint16_t header_size = pick_integer_le(&sector_header, 6, 2);
+ uint32_t data_size = pick_integer_le(&sector_header, 8, 4);
file_offset += header_size;
switch (type)
{
case APR_SECTOR:
- UINT8 head = pick_integer_le(&sector_header, 12, 1);
- UINT8 sector = pick_integer_le(&sector_header, 13, 1);
- UINT8 track = (UINT8) pick_integer_le(&sector_header, 14, 2);
+ uint8_t head = pick_integer_le(&sector_header, 12, 1);
+ uint8_t sector = pick_integer_le(&sector_header, 13, 1);
+ uint8_t track = (uint8_t) pick_integer_le(&sector_header, 14, 2);
track_count = std::max(track_count, int(unsigned(track)));
head_count = std::max(head_count, int(unsigned(head)));
@@ -92,9 +92,9 @@ bool apridisk_format::load(io_generic *io, UINT32 form_factor, floppy_image *ima
{
case APR_COMPRESSED:
{
- UINT8 comp[3];
+ uint8_t comp[3];
io_generic_read(io, comp, file_offset, 3);
- UINT16 length = pick_integer_le(comp, 0, 2);
+ uint16_t length = pick_integer_le(comp, 0, 2);
if (length != SECTOR_SIZE)
fatalerror("apridisk_format: Invalid compression length %04x\n", length);
diff --git a/src/lib/formats/apridisk.h b/src/lib/formats/apridisk.h
index 4faf756fd5a..81db4b41105 100644
--- a/src/lib/formats/apridisk.h
+++ b/src/lib/formats/apridisk.h
@@ -24,8 +24,8 @@ public:
virtual const char *description() const override;
virtual const char *extensions() const override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual bool supports_save() const override;
diff --git a/src/lib/formats/atom_tap.cpp b/src/lib/formats/atom_tap.cpp
index f3ab980a8fa..3c606901b90 100644
--- a/src/lib/formats/atom_tap.cpp
+++ b/src/lib/formats/atom_tap.cpp
@@ -69,9 +69,9 @@ static const struct CassetteModulation atom_tap_modulation =
cassette_image_read_uint8 - read tape data
-------------------------------------------------*/
-static UINT8 cassette_image_read_uint8(cassette_image *cassette, UINT64 offset)
+static uint8_t cassette_image_read_uint8(cassette_image *cassette, uint64_t offset)
{
- UINT8 data;
+ uint8_t data;
cassette_image_read(cassette, &data, offset, 1);
return data;
}
@@ -101,14 +101,14 @@ static cassette_image::error atom_tap_identify(cassette_image *cassette, struct
static cassette_image::error atom_tap_load(cassette_image *cassette)
{
cassette_image::error err;
- UINT64 image_size = cassette_image_size(cassette);
- UINT64 image_pos = 0;
+ uint64_t image_size = cassette_image_size(cassette);
+ uint64_t image_pos = 0;
double time_index = 0.0;
double time_displacement;
while (image_pos < image_size)
{
- UINT8 data = cassette_image_read_uint8(cassette, image_pos);
+ uint8_t data = cassette_image_read_uint8(cassette, image_pos);
/* start bit */
MODULATE(0);
diff --git a/src/lib/formats/basicdsk.cpp b/src/lib/formats/basicdsk.cpp
index 35207c0c86b..b24ca47346d 100644
--- a/src/lib/formats/basicdsk.cpp
+++ b/src/lib/formats/basicdsk.cpp
@@ -18,8 +18,8 @@ static floperr_t basicdsk_read_sector(floppy_image_legacy *floppy, int head, int
static floperr_t basicdsk_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam);
static floperr_t basicdsk_read_indexed_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen);
static floperr_t basicdsk_write_indexed_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam);
-static floperr_t basicdsk_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length);
-static floperr_t basicdsk_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags);
+static floperr_t basicdsk_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length);
+static floperr_t basicdsk_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags);
static int basicdsk_get_heads_per_disk(floppy_image_legacy *floppy);
static int basicdsk_get_tracks_per_disk(floppy_image_legacy *floppy);
static floperr_t basicdsk_format_track(floppy_image_legacy *floppy, int head, int track, util::option_resolution *params);
@@ -77,10 +77,10 @@ floperr_t basicdsk_construct(floppy_image_legacy *floppy, const struct basicdsk_
-static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, UINT64 *offset)
+static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, uint64_t *offset)
{
const struct basicdsk_geometry *geom;
- UINT64 offs;
+ uint64_t offs;
geom = get_geometry(floppy);
@@ -131,7 +131,7 @@ static int internal_basicdsk_translate_sector_interleave(floppy_image_legacy *fl
static floperr_t internal_basicdsk_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen)
{
- UINT64 offset;
+ uint64_t offset;
floperr_t err;
err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
@@ -145,7 +145,7 @@ static floperr_t internal_basicdsk_read_sector(floppy_image_legacy *floppy, int
static floperr_t internal_basicdsk_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, const void *buffer, size_t buflen, int ddam)
{
- UINT64 offset;
+ uint64_t offset;
floperr_t err;
err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
@@ -183,10 +183,10 @@ static floperr_t basicdsk_write_indexed_sector(floppy_image_legacy *floppy, int
static floperr_t basicdsk_format_track(floppy_image_legacy *floppy, int head, int track, util::option_resolution *params)
{
floperr_t err = FLOPPY_ERROR_SUCCESS;
- UINT8 local_buffer[512];
+ uint8_t local_buffer[512];
void *alloc_buffer = nullptr;
void *buffer;
- UINT32 sector_length;
+ uint32_t sector_length;
int sector;
const struct basicdsk_geometry *geometry;
@@ -241,7 +241,7 @@ static int basicdsk_get_tracks_per_disk(floppy_image_legacy *floppy)
-static floperr_t basicdsk_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
+static floperr_t basicdsk_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
{
floperr_t err;
@@ -256,7 +256,7 @@ static floperr_t basicdsk_get_sector_length(floppy_image_legacy *floppy, int hea
-static floperr_t basicdsk_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags)
+static floperr_t basicdsk_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags)
{
const struct basicdsk_geometry *geom = get_geometry(floppy);
@@ -338,7 +338,7 @@ FLOPPY_CONSTRUCT(basicdsk_construct_default)
FLOPPY_IDENTIFY(basicdsk_identify_default)
{
- UINT64 expected_size;
+ uint64_t expected_size;
struct basicdsk_geometry geometry;
basicdsk_default_geometry(format, &geometry);
diff --git a/src/lib/formats/basicdsk.h b/src/lib/formats/basicdsk.h
index 77f234da949..eae442993e3 100644
--- a/src/lib/formats/basicdsk.h
+++ b/src/lib/formats/basicdsk.h
@@ -21,12 +21,12 @@ struct basicdsk_geometry
int first_sector_id;
int interleave;
int sector_map[256];
- UINT32 sector_length;
- UINT64 offset;
+ uint32_t sector_length;
+ uint64_t offset;
int (*translate_sector)(floppy_image_legacy *floppy, int sector);
- UINT64 (*translate_offset)(floppy_image_legacy *floppy, const struct basicdsk_geometry *geom, int track, int head, int sector);
- UINT64 (*get_ddam)(floppy_image_legacy *floppy, const struct basicdsk_geometry *geom, int track, int head, int sector);
+ uint64_t (*translate_offset)(floppy_image_legacy *floppy, const struct basicdsk_geometry *geom, int track, int head, int sector);
+ uint64_t (*get_ddam)(floppy_image_legacy *floppy, const struct basicdsk_geometry *geom, int track, int head, int sector);
};
floperr_t basicdsk_construct(floppy_image_legacy *floppy, const struct basicdsk_geometry *geometry);
diff --git a/src/lib/formats/c3040_dsk.cpp b/src/lib/formats/c3040_dsk.cpp
index 9fb6669ab20..78786979953 100644
--- a/src/lib/formats/c3040_dsk.cpp
+++ b/src/lib/formats/c3040_dsk.cpp
@@ -56,7 +56,7 @@ const int c3040_format::c3040_gap2[] =
12, 12, 12, 12, 12 // 31-35
};
-floppy_image_format_t::desc_e* c3040_format::get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2)
+floppy_image_format_t::desc_e* c3040_format::get_sector_desc(const format &f, int &current_size, int sector_count, uint8_t id1, uint8_t id2, int gap_2)
{
static floppy_image_format_t::desc_e desc[] = {
/* 00 */ { SECTOR_LOOP_START, 0, -1 },
diff --git a/src/lib/formats/c3040_dsk.h b/src/lib/formats/c3040_dsk.h
index 659b2748571..4a549abad13 100644
--- a/src/lib/formats/c3040_dsk.h
+++ b/src/lib/formats/c3040_dsk.h
@@ -23,7 +23,7 @@ public:
protected:
virtual int get_sectors_per_track(const format &f, int track) override { return c3040_sectors_per_track[track]; }
- virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2) override;
+ virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, uint8_t id1, uint8_t id2, int gap_2) override;
virtual int get_gap2(const format &f, int head, int track) override { return c3040_gap2[track]; }
virtual void fix_end_gap(floppy_image_format_t::desc_e* desc, int remaining_size) override;
diff --git a/src/lib/formats/c4040_dsk.cpp b/src/lib/formats/c4040_dsk.cpp
index 9e6dff7f627..e6314f69261 100644
--- a/src/lib/formats/c4040_dsk.cpp
+++ b/src/lib/formats/c4040_dsk.cpp
@@ -46,7 +46,7 @@ const int c4040_format::c4040_gap2[] =
12, 12, 12, 12, 12 // 31-35
};
-floppy_image_format_t::desc_e* c4040_format::get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2)
+floppy_image_format_t::desc_e* c4040_format::get_sector_desc(const format &f, int &current_size, int sector_count, uint8_t id1, uint8_t id2, int gap_2)
{
static floppy_image_format_t::desc_e desc[] = {
/* 00 */ { SECTOR_LOOP_START, 0, -1 },
diff --git a/src/lib/formats/c4040_dsk.h b/src/lib/formats/c4040_dsk.h
index 591fcd42925..08d62ca3e23 100644
--- a/src/lib/formats/c4040_dsk.h
+++ b/src/lib/formats/c4040_dsk.h
@@ -22,7 +22,7 @@ public:
virtual const char *extensions() const override;
protected:
- virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2) override;
+ virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, uint8_t id1, uint8_t id2, int gap_2) override;
virtual int get_gap2(const format &f, int head, int track) override { return c4040_gap2[track]; }
virtual void fix_end_gap(floppy_image_format_t::desc_e* desc, int remaining_size) override;
diff --git a/src/lib/formats/camplynx_cas.cpp b/src/lib/formats/camplynx_cas.cpp
index 330df5601a1..d6181d845ff 100644
--- a/src/lib/formats/camplynx_cas.cpp
+++ b/src/lib/formats/camplynx_cas.cpp
@@ -37,7 +37,7 @@ Each byte is 8 bits (MSB first) with no start or stop bits.
// image size
static int camplynx_image_size;
-static int camplynx_put_samples(INT16 *buffer, int sample_pos, int count, int level)
+static int camplynx_put_samples(int16_t *buffer, int sample_pos, int count, int level)
{
if (buffer)
{
@@ -48,7 +48,7 @@ static int camplynx_put_samples(INT16 *buffer, int sample_pos, int count, int le
return count;
}
-static int camplynx_output_bit(INT16 *buffer, int sample_pos, bool bit)
+static int camplynx_output_bit(int16_t *buffer, int sample_pos, bool bit)
{
int samples = 0;
@@ -66,10 +66,10 @@ static int camplynx_output_bit(INT16 *buffer, int sample_pos, bool bit)
return samples;
}
-static int camplynx_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
+static int camplynx_output_byte(int16_t *buffer, int sample_pos, uint8_t byte)
{
int samples = 0;
- UINT8 i;
+ uint8_t i;
/* data */
for (i = 0; i<8; i++)
@@ -78,11 +78,11 @@ static int camplynx_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
return samples;
}
-static int camplynx_handle_cassette(INT16 *buffer, const UINT8 *bytes)
+static int camplynx_handle_cassette(int16_t *buffer, const uint8_t *bytes)
{
- UINT32 sample_count = 0;
- UINT32 byte_count = 0;
- UINT32 i;
+ uint32_t sample_count = 0;
+ uint32_t byte_count = 0;
+ uint32_t i;
/* header zeroes */
for (i=0; i<555; i++)
@@ -137,7 +137,7 @@ static int camplynx_handle_cassette(INT16 *buffer, const UINT8 *bytes)
Generate samples for the tape image
********************************************************************/
-static int camplynx_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int camplynx_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
return camplynx_handle_cassette(buffer, bytes);
}
@@ -146,7 +146,7 @@ static int camplynx_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
Calculate the number of samples needed for this tape image
********************************************************************/
-static int camplynx_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int camplynx_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
{
camplynx_image_size = length;
diff --git a/src/lib/formats/cassimg.cpp b/src/lib/formats/cassimg.cpp
index 39e3176e121..87636b81349 100644
--- a/src/lib/formats/cassimg.cpp
+++ b/src/lib/formats/cassimg.cpp
@@ -33,7 +33,7 @@ CASSETTE_FORMATLIST_END
helper code
*********************************************************************/
-static double map_double(double d, UINT64 low, UINT64 high, UINT64 value)
+static double map_double(double d, uint64_t low, uint64_t high, uint64_t value)
{
return d * (value - low) / (high - low);
}
@@ -51,24 +51,24 @@ static size_t waveform_bytes_per_sample(int waveform_flags)
extrapolation and interpolation
*********************************************************************/
-static INT32 extrapolate8(INT8 value)
+static int32_t extrapolate8(int8_t value)
{
- return ((INT32) value) << 24;
+ return ((int32_t) value) << 24;
}
-static INT32 extrapolate16(INT16 value)
+static int32_t extrapolate16(int16_t value)
{
- return ((INT32) value) << 16;
+ return ((int32_t) value) << 16;
}
-static INT8 interpolate8(INT32 value)
+static int8_t interpolate8(int32_t value)
{
- return (INT8) (value >> 24);
+ return (int8_t) (value >> 24);
}
-static INT16 interpolate16(INT32 value)
+static int16_t interpolate16(int32_t value)
{
- return (INT16) (value >> 16);
+ return (int16_t) (value >> 16);
}
@@ -309,21 +309,21 @@ void cassette_change(cassette_image *cassette, void *file, const struct io_procs
calls for accessing the raw cassette image
*********************************************************************/
-void cassette_image_read(cassette_image *cassette, void *buffer, UINT64 offset, size_t length)
+void cassette_image_read(cassette_image *cassette, void *buffer, uint64_t offset, size_t length)
{
io_generic_read(&cassette->io, buffer, offset, length);
}
-void cassette_image_write(cassette_image *cassette, const void *buffer, UINT64 offset, size_t length)
+void cassette_image_write(cassette_image *cassette, const void *buffer, uint64_t offset, size_t length)
{
io_generic_write(&cassette->io, buffer, offset, length);
}
-UINT64 cassette_image_size(cassette_image *cassette)
+uint64_t cassette_image_size(cassette_image *cassette)
{
return io_generic_size(&cassette->io);
}
@@ -379,7 +379,7 @@ static cassette_image::error compute_manipulation_ranges(cassette_image *cassett
-static cassette_image::error lookup_sample(cassette_image *cassette, int channel, size_t sample, INT32 **ptr)
+static cassette_image::error lookup_sample(cassette_image *cassette, int channel, size_t sample, int32_t **ptr)
{
*ptr = nullptr;
size_t sample_blocknum = (sample / SAMPLES_PER_BLOCK) * cassette->channels + channel;
@@ -422,12 +422,12 @@ cassette_image::error cassette_get_samples(cassette_image *cassette, int channel
struct manipulation_ranges ranges;
size_t sample_index;
size_t cassette_sample_index;
- UINT8 *dest_ptr;
- const INT32 *source_ptr;
+ uint8_t *dest_ptr;
+ const int32_t *source_ptr;
double d;
- INT16 word;
- INT32 dword;
- INT64 sum;
+ int16_t word;
+ int32_t dword;
+ int64_t sum;
assert(cassette);
@@ -444,7 +444,7 @@ cassette_image::error cassette_get_samples(cassette_image *cassette, int channel
/* find the sample that we are putting */
d = map_double(ranges.sample_last + 1 - ranges.sample_first, 0, sample_count, sample_index) + ranges.sample_first;
cassette_sample_index = (size_t) d;
- err = lookup_sample(cassette, channel, cassette_sample_index, (INT32 **) &source_ptr);
+ err = lookup_sample(cassette, channel, cassette_sample_index, (int32_t **) &source_ptr);
if (err != cassette_image::error::SUCCESS)
return err;
@@ -455,24 +455,24 @@ cassette_image::error cassette_get_samples(cassette_image *cassette, int channel
sum /= (ranges.channel_last + 1 - ranges.channel_first);
/* and write out the result */
- dest_ptr = (UINT8*)samples;
+ dest_ptr = (uint8_t*)samples;
dest_ptr += waveform_bytes_per_sample(waveform_flags) * sample_index * cassette->channels;
switch(waveform_bytes_per_sample(waveform_flags))
{
case 1:
- *((INT8 *) dest_ptr) = interpolate8(sum);
+ *((int8_t *) dest_ptr) = interpolate8(sum);
break;
case 2:
word = interpolate16(sum);
if (waveform_flags & CASSETTE_WAVEFORM_ENDIAN_FLIP)
word = flipendian_int16(word);
- *((INT16 *) dest_ptr) = word;
+ *((int16_t *) dest_ptr) = word;
break;
case 4:
dword = sum;
if (waveform_flags & CASSETTE_WAVEFORM_ENDIAN_FLIP)
dword = flipendian_int32(dword);
- *((INT32 *) dest_ptr) = dword;
+ *((int32_t *) dest_ptr) = dword;
break;
}
}
@@ -488,11 +488,11 @@ cassette_image::error cassette_put_samples(cassette_image *cassette, int channel
cassette_image::error err;
struct manipulation_ranges ranges;
size_t sample_index;
- INT32 *dest_ptr;
- INT32 dest_value;
- INT16 word;
- INT32 dword;
- const UINT8 *source_ptr;
+ int32_t *dest_ptr;
+ int32_t dest_value;
+ int16_t word;
+ int32_t dword;
+ const uint8_t *source_ptr;
double d;
if (!cassette)
@@ -520,25 +520,25 @@ cassette_image::error cassette_put_samples(cassette_image *cassette, int channel
{
/* figure out the source pointer */
d = map_double(sample_count, ranges.sample_first, ranges.sample_last + 1, sample_index);
- source_ptr = (const UINT8*)samples;
+ source_ptr = (const uint8_t*)samples;
source_ptr += ((size_t) d) * sample_bytes;
/* compute the value that we are writing */
switch(waveform_bytes_per_sample(waveform_flags)) {
case 1:
if (waveform_flags & CASSETTE_WAVEFORM_UNSIGNED)
- dest_value = extrapolate8((INT8)(*source_ptr - 128));
+ dest_value = extrapolate8((int8_t)(*source_ptr - 128));
else
- dest_value = extrapolate8(*((INT8 *) source_ptr));
+ dest_value = extrapolate8(*((int8_t *) source_ptr));
break;
case 2:
- word = *((INT16 *) source_ptr);
+ word = *((int16_t *) source_ptr);
if (waveform_flags & CASSETTE_WAVEFORM_ENDIAN_FLIP)
word = flipendian_int16(word);
dest_value = extrapolate16(word);
break;
case 4:
- dword = *((INT32 *) source_ptr);
+ dword = *((int32_t *) source_ptr);
if (waveform_flags & CASSETTE_WAVEFORM_ENDIAN_FLIP)
dword = flipendian_int32(dword);
dest_value = dword;
@@ -562,7 +562,7 @@ cassette_image::error cassette_put_samples(cassette_image *cassette, int channel
cassette_image::error cassette_get_sample(cassette_image *cassette, int channel,
- double time_index, double sample_period, INT32 *sample)
+ double time_index, double sample_period, int32_t *sample)
{
return cassette_get_samples(cassette, channel, time_index,
sample_period, 1, 0, sample, CASSETTE_WAVEFORM_32BIT);
@@ -571,7 +571,7 @@ cassette_image::error cassette_get_sample(cassette_image *cassette, int channel,
cassette_image::error cassette_put_sample(cassette_image *cassette, int channel,
- double time_index, double sample_period, INT32 sample)
+ double time_index, double sample_period, int32_t sample)
{
return cassette_put_samples(cassette, channel, time_index,
sample_period, 1, 0, &sample, CASSETTE_WAVEFORM_32BIT);
@@ -584,7 +584,7 @@ cassette_image::error cassette_put_sample(cassette_image *cassette, int channel,
*********************************************************************/
cassette_image::error cassette_read_samples(cassette_image *cassette, int channels, double time_index,
- double sample_period, size_t sample_count, UINT64 offset, int waveform_flags)
+ double sample_period, size_t sample_count, uint64_t offset, int waveform_flags)
{
cassette_image::error err;
size_t chunk_sample_count;
@@ -594,7 +594,7 @@ cassette_image::error cassette_read_samples(cassette_image *cassette, int channe
double chunk_time_index;
double chunk_sample_period;
int channel;
- UINT8 buffer[8192];
+ uint8_t buffer[8192];
bytes_per_sample = waveform_bytes_per_sample(waveform_flags);
sample_bytes = bytes_per_sample * channels;
@@ -624,7 +624,7 @@ cassette_image::error cassette_read_samples(cassette_image *cassette, int channe
cassette_image::error cassette_write_samples(cassette_image *cassette, int channels, double time_index,
- double sample_period, size_t sample_count, UINT64 offset, int waveform_flags)
+ double sample_period, size_t sample_count, uint64_t offset, int waveform_flags)
{
cassette_image::error err;
size_t chunk_sample_count;
@@ -634,7 +634,7 @@ cassette_image::error cassette_write_samples(cassette_image *cassette, int chann
double chunk_time_index;
double chunk_sample_period;
int channel;
- UINT8 buffer[8192];
+ uint8_t buffer[8192];
bytes_per_sample = waveform_bytes_per_sample(waveform_flags);
sample_bytes = bytes_per_sample * channels;
@@ -667,10 +667,10 @@ cassette_image::error cassette_write_samples(cassette_image *cassette, int chann
waveform accesses to/from the raw image
*********************************************************************/
-static const INT8 *choose_wave(const struct CassetteModulation *modulation, size_t *wave_bytes_length)
+static const int8_t *choose_wave(const struct CassetteModulation *modulation, size_t *wave_bytes_length)
{
- static const INT8 square_wave[] = { -128, 127 };
- static const INT8 sine_wave[] = { 0, 48, 89, 117, 127, 117, 89, 48, 0, -48, -89, -117, -127, -117, -89, -48 };
+ static const int8_t square_wave[] = { -128, 127 };
+ static const int8_t sine_wave[] = { 0, 48, 89, 117, 127, 117, 89, 48, 0, -48, -89, -117, -127, -117, -89, -48 };
if (modulation->flags & CASSETTE_MODULATION_SINEWAVE)
{
@@ -693,7 +693,7 @@ cassette_image::error cassette_modulation_identify(cassette_image *cassette, con
choose_wave(modulation, &wave_bytes_length);
opts->bits_per_sample = 8;
opts->channels = 1;
- opts->sample_frequency = (UINT32) (std::max(modulation->zero_frequency_high, modulation->one_frequency_high) * wave_bytes_length * 2);
+ opts->sample_frequency = (uint32_t) (std::max(modulation->zero_frequency_high, modulation->one_frequency_high) * wave_bytes_length * 2);
return cassette_image::error::SUCCESS;
}
@@ -704,13 +704,13 @@ cassette_image::error cassette_put_modulated_data(cassette_image *cassette, int
double *time_displacement)
{
cassette_image::error err;
- const UINT8 *data_bytes = (const UINT8 *)data;
- const INT8 *wave_bytes;
+ const uint8_t *data_bytes = (const uint8_t *)data;
+ const int8_t *wave_bytes;
size_t wave_bytes_length;
double total_displacement = 0.0;
double pulse_period;
double pulse_frequency;
- UINT8 b;
+ uint8_t b;
int i;
wave_bytes = choose_wave(modulation, &wave_bytes_length);
@@ -740,7 +740,7 @@ done:
cassette_image::error cassette_put_modulated_filler(cassette_image *cassette, int channel, double time_index,
- UINT8 filler, size_t filler_length, const struct CassetteModulation *modulation,
+ uint8_t filler, size_t filler_length, const struct CassetteModulation *modulation,
double *time_displacement)
{
cassette_image::error err;
@@ -764,13 +764,13 @@ cassette_image::error cassette_put_modulated_filler(cassette_image *cassette, in
cassette_image::error cassette_read_modulated_data(cassette_image *cassette, int channel, double time_index,
- UINT64 offset, UINT64 length, const struct CassetteModulation *modulation,
+ uint64_t offset, uint64_t length, const struct CassetteModulation *modulation,
double *time_displacement)
{
cassette_image::error err;
- UINT8 buffer_stack[1024];
- UINT8 *buffer;
- UINT8 *alloc_buffer = nullptr;
+ uint8_t buffer_stack[1024];
+ uint8_t *buffer;
+ uint8_t *alloc_buffer = nullptr;
double delta;
double total_displacement = 0.0;
size_t this_length;
@@ -783,8 +783,8 @@ cassette_image::error cassette_read_modulated_data(cassette_image *cassette, int
}
else
{
- buffer_length = std::min<UINT64>(length, 100000);
- alloc_buffer = (UINT8*)malloc(buffer_length);
+ buffer_length = std::min<uint64_t>(length, 100000);
+ alloc_buffer = (uint8_t*)malloc(buffer_length);
if (!alloc_buffer)
{
err = cassette_image::error::OUT_OF_MEMORY;
@@ -795,7 +795,7 @@ cassette_image::error cassette_read_modulated_data(cassette_image *cassette, int
while(length > 0)
{
- this_length = (std::min<UINT64>)(length, buffer_length);
+ this_length = (std::min<uint64_t>)(length, buffer_length);
cassette_image_read(cassette, buffer, offset, this_length);
err = cassette_put_modulated_data(cassette, channel, time_index, buffer, this_length, modulation, &delta);
@@ -819,11 +819,11 @@ done:
cassette_image::error cassette_put_modulated_data_bit(cassette_image *cassette, int channel, double time_index,
- UINT8 data, const struct CassetteModulation *modulation,
+ uint8_t data, const struct CassetteModulation *modulation,
double *time_displacement)
{
cassette_image::error err;
- const INT8 *wave_bytes;
+ const int8_t *wave_bytes;
size_t wave_bytes_length;
double total_displacement = 0.0;
double pulse_period;
@@ -870,12 +870,12 @@ cassette_image::error cassette_legacy_construct(cassette_image *cassette,
cassette_image::error err;
int length;
int sample_count;
- std::vector<UINT8> bytes;
- std::vector<UINT8> chunk;
- std::vector<INT16> samples;
+ std::vector<uint8_t> bytes;
+ std::vector<uint8_t> chunk;
+ std::vector<int16_t> samples;
int pos = 0;
- UINT64 offset = 0;
- UINT64 size;
+ uint64_t offset = 0;
+ uint64_t size;
struct CassetteLegacyWaveFiller args;
/* sanity check the args */
diff --git a/src/lib/formats/cassimg.h b/src/lib/formats/cassimg.h
index 0bf8865e6ff..2f9ff01f1cb 100644
--- a/src/lib/formats/cassimg.h
+++ b/src/lib/formats/cassimg.h
@@ -66,20 +66,20 @@
***************************************************************************/
-typedef std::vector<INT32> sample_block;
+typedef std::vector<int32_t> sample_block;
struct CassetteOptions
{
int channels;
int bits_per_sample;
- UINT32 sample_frequency;
+ uint32_t sample_frequency;
};
struct CassetteInfo
{
int channels;
int bits_per_sample;
- UINT32 sample_frequency;
+ uint32_t sample_frequency;
size_t sample_count;
};
@@ -100,7 +100,7 @@ struct cassette_image
int channels;
int flags;
- UINT32 sample_frequency;
+ uint32_t sample_frequency;
std::vector<sample_block *> blocks;
size_t sample_count;
@@ -129,11 +129,11 @@ struct CassetteModulation
/* code to adapt existing legacy fill_wave functions */
struct CassetteLegacyWaveFiller
{
- int (*fill_wave)(INT16 *, int, UINT8 *);
+ int (*fill_wave)(int16_t *, int, uint8_t *);
int chunk_size;
int chunk_samples;
- int (*chunk_sample_calc)(const UINT8 *bytes, int length);
- UINT32 sample_frequency;
+ int (*chunk_sample_calc)(const uint8_t *bytes, int length);
+ uint32_t sample_frequency;
int header_samples;
int trailer_samples;
};
@@ -175,9 +175,9 @@ void cassette_change(cassette_image *cassette, void *file, const struct io_procs
void cassette_get_info(cassette_image *cassette, struct CassetteInfo *info);
/* calls for accessing the raw cassette image */
-void cassette_image_read(cassette_image *cassette, void *buffer, UINT64 offset, size_t length);
-void cassette_image_write(cassette_image *cassette, const void *buffer, UINT64 offset, size_t length);
-UINT64 cassette_image_size(cassette_image *cassette);
+void cassette_image_read(cassette_image *cassette, void *buffer, uint64_t offset, size_t length);
+void cassette_image_write(cassette_image *cassette, const void *buffer, uint64_t offset, size_t length);
+uint64_t cassette_image_size(cassette_image *cassette);
/* waveform accesses */
cassette_image::error cassette_get_samples(cassette_image *cassette, int channel,
@@ -187,15 +187,15 @@ cassette_image::error cassette_put_samples(cassette_image *cassette, int channel
double time_index, double sample_period, size_t sample_count, size_t sample_bytes,
const void *samples, int waveform_flags);
cassette_image::error cassette_get_sample(cassette_image *cassette, int channel,
- double time_index, double sample_period, INT32 *sample);
+ double time_index, double sample_period, int32_t *sample);
cassette_image::error cassette_put_sample(cassette_image *cassette, int channel,
- double time_index, double sample_period, INT32 sample);
+ double time_index, double sample_period, int32_t sample);
/* waveform accesses to/from the raw image */
cassette_image::error cassette_read_samples(cassette_image *cassette, int channels, double time_index,
- double sample_period, size_t sample_count, UINT64 offset, int waveform_flags);
+ double sample_period, size_t sample_count, uint64_t offset, int waveform_flags);
cassette_image::error cassette_write_samples(cassette_image *cassette, int channels, double time_index,
- double sample_period, size_t sample_count, UINT64 offset, int waveform_flags);
+ double sample_period, size_t sample_count, uint64_t offset, int waveform_flags);
/* modulation support */
cassette_image::error cassette_modulation_identify(cassette_image *cassette, const struct CassetteModulation *modulation,
@@ -204,21 +204,21 @@ cassette_image::error cassette_put_modulated_data(cassette_image *cassette, int
const void *data, size_t data_length, const struct CassetteModulation *modulation,
double *time_displacement);
cassette_image::error cassette_put_modulated_filler(cassette_image *cassette, int channel, double time_index,
- UINT8 filler, size_t filler_length, const struct CassetteModulation *modulation,
+ uint8_t filler, size_t filler_length, const struct CassetteModulation *modulation,
double *time_displacement);
cassette_image::error cassette_read_modulated_data(cassette_image *cassette, int channel, double time_index,
- UINT64 offset, UINT64 length, const struct CassetteModulation *modulation,
+ uint64_t offset, uint64_t length, const struct CassetteModulation *modulation,
double *time_displacement);
cassette_image::error cassette_put_modulated_data_bit(cassette_image *cassette, int channel, double time_index,
- UINT8 data, const struct CassetteModulation *modulation,
+ uint8_t data, const struct CassetteModulation *modulation,
double *time_displacement);
/* debug calls */
void cassette_dump(cassette_image *image, const char *filename);
/* legacy code support */
-#define CODE_HEADER ((UINT8*)-1)
-#define CODE_TRAILER ((UINT8*)-2)
+#define CODE_HEADER ((uint8_t*)-1)
+#define CODE_TRAILER ((uint8_t*)-2)
cassette_image::error cassette_legacy_identify(cassette_image *cassette, struct CassetteOptions *opts,
const struct CassetteLegacyWaveFiller *legacy_args);
cassette_image::error cassette_legacy_construct(cassette_image *cassette,
diff --git a/src/lib/formats/cbm_crt.cpp b/src/lib/formats/cbm_crt.cpp
index 43e440e725c..0da119c006f 100644
--- a/src/lib/formats/cbm_crt.cpp
+++ b/src/lib/formats/cbm_crt.cpp
@@ -130,7 +130,7 @@ std::string cbm_crt_get_card(util::core_file &file)
if (memcmp(header.signature, CRT_SIGNATURE, 16) == 0)
{
- UINT16 hardware = pick_integer_be(header.hardware, 0, 2);
+ uint16_t hardware = pick_integer_be(header.hardware, 0, 2);
return std::string(CRT_C64_SLOT_NAMES[hardware]);
}
@@ -152,7 +152,7 @@ bool cbm_crt_read_header(util::core_file &file, size_t *roml_size, size_t *romh_
if (memcmp(header.signature, CRT_SIGNATURE, 16) != 0)
return false;
- UINT16 hardware = pick_integer_be(header.hardware, 0, 2);
+ uint16_t hardware = pick_integer_be(header.hardware, 0, 2);
*exrom = header.exrom;
*game = header.game;
@@ -171,9 +171,9 @@ bool cbm_crt_read_header(util::core_file &file, size_t *roml_size, size_t *romh_
cbm_crt_chip chip;
file.read(&chip, CRT_CHIP_LENGTH);
- UINT16 address = pick_integer_be(chip.start_address, 0, 2);
- UINT16 size = pick_integer_be(chip.image_size, 0, 2);
- UINT16 type = pick_integer_be(chip.chip_type, 0, 2);
+ uint16_t address = pick_integer_be(chip.start_address, 0, 2);
+ uint16_t size = pick_integer_be(chip.image_size, 0, 2);
+ uint16_t type = pick_integer_be(chip.chip_type, 0, 2);
if (LOG)
{
@@ -201,10 +201,10 @@ bool cbm_crt_read_header(util::core_file &file, size_t *roml_size, size_t *romh_
// cbm_crt_read_data - read cartridge data
//-------------------------------------------------
-bool cbm_crt_read_data(util::core_file &file, UINT8 *roml, UINT8 *romh)
+bool cbm_crt_read_data(util::core_file &file, uint8_t *roml, uint8_t *romh)
{
- UINT32 roml_offset = 0;
- UINT32 romh_offset = 0;
+ uint32_t roml_offset = 0;
+ uint32_t romh_offset = 0;
file.seek(CRT_HEADER_LENGTH, SEEK_SET);
@@ -213,8 +213,8 @@ bool cbm_crt_read_data(util::core_file &file, UINT8 *roml, UINT8 *romh)
cbm_crt_chip chip;
file.read(&chip, CRT_CHIP_LENGTH);
- UINT16 address = pick_integer_be(chip.start_address, 0, 2);
- UINT16 size = pick_integer_be(chip.image_size, 0, 2);
+ uint16_t address = pick_integer_be(chip.start_address, 0, 2);
+ uint16_t size = pick_integer_be(chip.image_size, 0, 2);
switch (address)
{
diff --git a/src/lib/formats/cbm_crt.h b/src/lib/formats/cbm_crt.h
index 96d04cea2f6..2a5e5331a8a 100644
--- a/src/lib/formats/cbm_crt.h
+++ b/src/lib/formats/cbm_crt.h
@@ -108,25 +108,25 @@ enum
struct cbm_crt_header
{
- UINT8 signature[16];
- UINT8 header_length[4];
- UINT8 version[2];
- UINT8 hardware[2];
- UINT8 exrom;
- UINT8 game;
- UINT8 reserved[6];
- UINT8 name[32];
+ uint8_t signature[16];
+ uint8_t header_length[4];
+ uint8_t version[2];
+ uint8_t hardware[2];
+ uint8_t exrom;
+ uint8_t game;
+ uint8_t reserved[6];
+ uint8_t name[32];
};
struct cbm_crt_chip
{
- UINT8 signature[4];
- UINT8 packet_length[4];
- UINT8 chip_type[2];
- UINT8 bank[2];
- UINT8 start_address[2];
- UINT8 image_size[2];
+ uint8_t signature[4];
+ uint8_t packet_length[4];
+ uint8_t chip_type[2];
+ uint8_t bank[2];
+ uint8_t start_address[2];
+ uint8_t image_size[2];
};
@@ -137,7 +137,7 @@ struct cbm_crt_chip
std::string cbm_crt_get_card(util::core_file &file);
bool cbm_crt_read_header(util::core_file &file, size_t *roml_size, size_t *romh_size, int *exrom, int *game);
-bool cbm_crt_read_data(util::core_file &file, UINT8 *roml, UINT8 *romh);
+bool cbm_crt_read_data(util::core_file &file, uint8_t *roml, uint8_t *romh);
#endif
diff --git a/src/lib/formats/cbm_tap.cpp b/src/lib/formats/cbm_tap.cpp
index a7b28a8f8af..0b0950eebcc 100644
--- a/src/lib/formats/cbm_tap.cpp
+++ b/src/lib/formats/cbm_tap.cpp
@@ -130,7 +130,7 @@ below could be not working. FP ]
#define CBM_HEADER_SIZE 20
-static INT16 wave_data = 0;
+static int16_t wave_data = 0;
static int len;
@@ -155,7 +155,7 @@ static void toggle_wave_data(void )
wave_data = (wave_data == WAVE_HIGH) ? WAVE_LOW : WAVE_HIGH;
}
-static void cbm_output_wave( INT16 **buffer, int length )
+static void cbm_output_wave( int16_t **buffer, int length )
{
if (buffer == nullptr)
return;
@@ -168,7 +168,7 @@ static void cbm_output_wave( INT16 **buffer, int length )
}
-static int cbm_tap_do_work( INT16 **buffer, int length, const UINT8 *data )
+static int cbm_tap_do_work( int16_t **buffer, int length, const uint8_t *data )
{
int i, j = 0;
int size = 0;
@@ -179,7 +179,7 @@ static int cbm_tap_do_work( INT16 **buffer, int length, const UINT8 *data )
int tap_frequency = 0;
int byte_samples = 0;
- UINT8 over_pulse_bytes[3] = {0 , 0, 0 };
+ uint8_t over_pulse_bytes[3] = {0 , 0, 0 };
int over_pulse_length = 0;
/* These waveamp_* values are currently stored but not used.
Further investigations are needed to find real pulse amplitude
@@ -228,7 +228,7 @@ static int cbm_tap_do_work( INT16 **buffer, int length, const UINT8 *data )
for (i = CBM_HEADER_SIZE; i < length; i++)
{
- UINT8 byte = data[i];
+ uint8_t byte = data[i];
/* .TAP v0 */
/* Here is simple:
@@ -319,7 +319,7 @@ static int cbm_tap_do_work( INT16 **buffer, int length, const UINT8 *data )
}
-static int cbm_tap_to_wav_size( const UINT8 *tapdata, int taplen )
+static int cbm_tap_to_wav_size( const uint8_t *tapdata, int taplen )
{
int size = cbm_tap_do_work(nullptr, taplen, tapdata);
len = taplen;
@@ -327,11 +327,11 @@ static int cbm_tap_to_wav_size( const UINT8 *tapdata, int taplen )
return size;
}
-static int cbm_tap_fill_wave( INT16 *buffer, int length, UINT8 *bytes )
+static int cbm_tap_fill_wave( int16_t *buffer, int length, uint8_t *bytes )
{
- INT16 *p = buffer;
+ int16_t *p = buffer;
- return cbm_tap_do_work(&p, len, (const UINT8 *)bytes);
+ return cbm_tap_do_work(&p, len, (const uint8_t *)bytes);
}
diff --git a/src/lib/formats/ccvf_dsk.cpp b/src/lib/formats/ccvf_dsk.cpp
index abce7fb55da..12acbeea37a 100644
--- a/src/lib/formats/ccvf_dsk.cpp
+++ b/src/lib/formats/ccvf_dsk.cpp
@@ -44,7 +44,7 @@ const ccvf_format::format ccvf_format::file_formats[] = {
{}
};
-int ccvf_format::identify(io_generic *io, UINT32 form_factor)
+int ccvf_format::identify(io_generic *io, uint32_t form_factor)
{
char h[36];
@@ -85,20 +85,20 @@ floppy_image_format_t::desc_e* ccvf_format::get_desc_8n1(const format &f, int &c
return desc;
}
-bool ccvf_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool ccvf_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
const format &f = formats[0];
- UINT64 size = io_generic_size(io);
- std::vector<UINT8> img(size);
+ uint64_t size = io_generic_size(io);
+ std::vector<uint8_t> img(size);
io_generic_read(io, &img[0], 0, size);
std::string ccvf = std::string((const char *)&img[0], size);
- std::vector<UINT8> bytes(78720);
+ std::vector<uint8_t> bytes(78720);
int start = 0, end = 0;
std::string line;
- UINT32 byteoffs = 0;
+ uint32_t byteoffs = 0;
char hex[3] = {0};
do {
@@ -115,11 +115,11 @@ bool ccvf_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
start = end + 1;
} while (start > 0 && end != -1);
- UINT64 pos = 0;
+ uint64_t pos = 0;
int total_size = 200000000/f.cell_size;
for(int track=0; track < f.track_count; track++) {
- std::vector<UINT32> buffer;
+ std::vector<uint32_t> buffer;
int offset = 0;
for (int i=0; i<1920 && pos<size; i++, pos++) {
diff --git a/src/lib/formats/ccvf_dsk.h b/src/lib/formats/ccvf_dsk.h
index 671b0c0f88c..39922485b5c 100644
--- a/src/lib/formats/ccvf_dsk.h
+++ b/src/lib/formats/ccvf_dsk.h
@@ -16,8 +16,8 @@
class ccvf_format : public floppy_image_format_t {
public:
struct format {
- UINT32 form_factor; // See floppy_image for possible values
- UINT32 variant; // See floppy_image for possible values
+ uint32_t form_factor; // See floppy_image for possible values
+ uint32_t variant; // See floppy_image for possible values
int cell_size; // See floppy_image_format_t for details
int sector_count;
@@ -36,8 +36,8 @@ public:
virtual const char *description() const override;
virtual const char *extensions() const override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool supports_save() const override;
protected:
diff --git a/src/lib/formats/cgen_cas.cpp b/src/lib/formats/cgen_cas.cpp
index 17ad904c630..be4b9397f89 100644
--- a/src/lib/formats/cgen_cas.cpp
+++ b/src/lib/formats/cgen_cas.cpp
@@ -33,7 +33,7 @@ static int cas_size;
static int level;
-static int cgenie_output_byte(INT16 *buffer, int sample_count, UINT8 data)
+static int cgenie_output_byte(int16_t *buffer, int sample_count, uint8_t data)
{
int samples = 0;
@@ -58,7 +58,7 @@ static int cgenie_output_byte(INT16 *buffer, int sample_count, UINT8 data)
}
-static int cgenie_handle_cas(INT16 *buffer, const UINT8 *casdata)
+static int cgenie_handle_cas(int16_t *buffer, const uint8_t *casdata)
{
int data_pos, sample_count;
@@ -108,7 +108,7 @@ static int cgenie_handle_cas(INT16 *buffer, const UINT8 *casdata)
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int cgenie_cas_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int cgenie_cas_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return cgenie_handle_cas(buffer, bytes);
}
@@ -117,7 +117,7 @@ static int cgenie_cas_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
/*******************************************************************
Calculate the number of samples needed for this tape image
********************************************************************/
-static int cgenie_cas_to_wav_size(const UINT8 *casdata, int caslen)
+static int cgenie_cas_to_wav_size(const uint8_t *casdata, int caslen)
{
cas_size = caslen;
diff --git a/src/lib/formats/coco_cas.cpp b/src/lib/formats/coco_cas.cpp
index cf711718a34..ba5186f539d 100644
--- a/src/lib/formats/coco_cas.cpp
+++ b/src/lib/formats/coco_cas.cpp
@@ -61,12 +61,12 @@ static cassette_image::error coco_cas_identify(cassette_image *cassette, struct
-static int get_cas_block(cassette_image *cassette, UINT64 *offset, UINT8 *block, int *block_len)
+static int get_cas_block(cassette_image *cassette, uint64_t *offset, uint8_t *block, int *block_len)
{
- UINT8 block_length = 0;
- UINT8 block_checksum = 0;
- UINT64 current_offset;
- UINT64 image_size;
+ uint8_t block_length = 0;
+ uint8_t block_checksum = 0;
+ uint64_t current_offset;
+ uint64_t image_size;
PAIR p;
int i;
int state = 0;
@@ -150,21 +150,21 @@ static int get_cas_block(cassette_image *cassette, UINT64 *offset, UINT8 *block,
-static cassette_image::error cas_load(cassette_image *cassette, UINT8 silence)
+static cassette_image::error cas_load(cassette_image *cassette, uint8_t silence)
{
cassette_image::error err;
- UINT64 offset;
- UINT64 image_size;
- UINT8 block[258]; /* 255 bytes per block + 3 (type, length, checksum) */
+ uint64_t offset;
+ uint64_t image_size;
+ uint8_t block[258]; /* 255 bytes per block + 3 (type, length, checksum) */
int block_length = 0;
- UINT8 last_blocktype;
+ uint8_t last_blocktype;
double time_index = 0.0;
double time_displacement;
- static const UINT8 magic_bytes[2] = { 0x55, 0x3C };
+ static const uint8_t magic_bytes[2] = { 0x55, 0x3C };
#if 0
{
- static const UINT8 dummy_bytes[] =
+ static const uint8_t dummy_bytes[] =
{
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
diff --git a/src/lib/formats/concept_dsk.cpp b/src/lib/formats/concept_dsk.cpp
index c23a3c35675..eea65064fc7 100644
--- a/src/lib/formats/concept_dsk.cpp
+++ b/src/lib/formats/concept_dsk.cpp
@@ -72,15 +72,15 @@ bool cc525dsdd_format::supports_save() const
return true;
}
-void cc525dsdd_format::find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 &sector_count)
+void cc525dsdd_format::find_size(io_generic *io, uint8_t &track_count, uint8_t &head_count, uint8_t &sector_count)
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
track_count = 77;
head_count = 2;
sector_count = 9;
- UINT32 expected_size = 512 * track_count*head_count*sector_count;
+ uint32_t expected_size = 512 * track_count*head_count*sector_count;
if (size == expected_size)
{
return;
@@ -89,9 +89,9 @@ void cc525dsdd_format::find_size(io_generic *io, UINT8 &track_count, UINT8 &head
track_count = head_count = sector_count = 0;
}
-int cc525dsdd_format::identify(io_generic *io, UINT32 form_factor)
+int cc525dsdd_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 track_count, head_count, sector_count;
+ uint8_t track_count, head_count, sector_count;
find_size(io, track_count, head_count, sector_count);
if(track_count)
@@ -99,12 +99,12 @@ int cc525dsdd_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool cc525dsdd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool cc525dsdd_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 track_count, head_count, sector_count;
+ uint8_t track_count, head_count, sector_count;
find_size(io, track_count, head_count, sector_count);
- UINT8 sectdata[10*512];
+ uint8_t sectdata[10*512];
desc_s sectors[10];
for(int i=0; i<sector_count; i++) {
sectors[i+1].data = sectdata + 512*i;
@@ -140,7 +140,7 @@ bool cc525dsdd_format::save(io_generic *io, floppy_image *image)
if(sector_count != 9)
sector_count = 9;
- UINT8 sectdata[9*512];
+ uint8_t sectdata[9*512];
int track_size = sector_count*512;
for(int track=0; track < track_count; track++) {
diff --git a/src/lib/formats/concept_dsk.h b/src/lib/formats/concept_dsk.h
index 87444c31ab0..d762bcb64c0 100644
--- a/src/lib/formats/concept_dsk.h
+++ b/src/lib/formats/concept_dsk.h
@@ -18,8 +18,8 @@ class cc525dsdd_format : public floppy_image_format_t
public:
cc525dsdd_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual const char *name() const override;
@@ -30,7 +30,7 @@ public:
static const desc_e cc_9_desc[];
private:
- void find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 &sector_count);
+ void find_size(io_generic *io, uint8_t &track_count, uint8_t &head_count, uint8_t &sector_count);
};
extern const floppy_format_type FLOPPY_CONCEPT_525DSDD_FORMAT;
diff --git a/src/lib/formats/coupedsk.cpp b/src/lib/formats/coupedsk.cpp
index f45222ae1ae..803f69bbbb7 100644
--- a/src/lib/formats/coupedsk.cpp
+++ b/src/lib/formats/coupedsk.cpp
@@ -64,9 +64,9 @@ bool mgt_format::supports_save() const
return true;
}
-int mgt_format::identify(io_generic *io, UINT32 form_factor)
+int mgt_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
if(/*size == 737280 || */ size == 819200)
return 50;
@@ -74,12 +74,12 @@ int mgt_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool mgt_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool mgt_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
int sector_count = size == 737280 ? 9 : 10;
- UINT8 sectdata[10*512];
+ uint8_t sectdata[10*512];
desc_s sectors[10];
for(int i=0; i<sector_count; i++) {
sectors[i].data = sectdata + 512*i;
@@ -109,7 +109,7 @@ bool mgt_format::save(io_generic *io, floppy_image *image)
else if(sector_count < 9)
sector_count = 9;
- UINT8 sectdata[10*512];
+ uint8_t sectdata[10*512];
int track_size = sector_count*512;
for(int head=0; head < 2; head++) {
diff --git a/src/lib/formats/coupedsk.h b/src/lib/formats/coupedsk.h
index 19f2d7ddac5..52d619ff6cd 100644
--- a/src/lib/formats/coupedsk.h
+++ b/src/lib/formats/coupedsk.h
@@ -18,8 +18,8 @@ class mgt_format : public floppy_image_format_t
public:
mgt_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual const char *name() const override;
diff --git a/src/lib/formats/cqm_dsk.cpp b/src/lib/formats/cqm_dsk.cpp
index 94ba350c2a4..3c13f3d44b4 100644
--- a/src/lib/formats/cqm_dsk.cpp
+++ b/src/lib/formats/cqm_dsk.cpp
@@ -24,8 +24,8 @@ struct cqmdsk_tag
int interleave;
int skew;
- UINT8* buf;
- UINT64 track_offsets[84*2]; /* offset within data for each track */
+ uint8_t* buf;
+ uint64_t track_offsets[84*2]; /* offset within data for each track */
};
@@ -40,7 +40,7 @@ static struct cqmdsk_tag *get_tag(floppy_image_legacy *floppy)
FLOPPY_IDENTIFY( cqm_dsk_identify )
{
- UINT8 header[2];
+ uint8_t header[2];
floppy_image_read(floppy, header, 0, 2);
if (header[0]=='C' && header[1]=='Q') {
@@ -61,16 +61,16 @@ static int cqm_get_tracks_per_disk(floppy_image_legacy *floppy)
return get_tag(floppy)->tracks;
}
-static UINT64 cqm_get_track_offset(floppy_image_legacy *floppy, int head, int track)
+static uint64_t cqm_get_track_offset(floppy_image_legacy *floppy, int head, int track)
{
return get_tag(floppy)->track_offsets[(track<<1) + head];
}
-static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, UINT64 *offset)
+static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, uint64_t *offset)
{
- UINT64 pos = 0;
- UINT8 data;
- INT16 len;
+ uint64_t pos = 0;
+ uint8_t data;
+ int16_t len;
int s;
if ((head < 0) || (head >= get_tag(floppy)->heads) || (track < 0) || (track >= get_tag(floppy)->tracks)
@@ -103,7 +103,7 @@ static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, in
static floperr_t internal_cqm_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen)
{
- UINT64 offset;
+ uint64_t offset;
floperr_t err;
// take sector offset
@@ -125,7 +125,7 @@ static floperr_t cqm_read_indexed_sector(floppy_image_legacy *floppy, int head,
return internal_cqm_read_sector(floppy, head, track, sector, TRUE, buffer, buflen);
}
-static floperr_t cqm_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
+static floperr_t cqm_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
{
floperr_t err;
err = get_offset(floppy, head, track, sector, FALSE, nullptr);
@@ -138,7 +138,7 @@ static floperr_t cqm_get_sector_length(floppy_image_legacy *floppy, int head, in
return FLOPPY_ERROR_SUCCESS;
}
-static floperr_t cqm_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags)
+static floperr_t cqm_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags)
{
if (sector_index >= get_tag(floppy)->sector_per_track) return FLOPPY_ERROR_SEEKERROR;
@@ -163,9 +163,9 @@ FLOPPY_CONSTRUCT( cqm_dsk_construct )
{
struct FloppyCallbacks *callbacks;
struct cqmdsk_tag *tag;
- UINT8 header[CQM_HEADER_SIZE];
- UINT64 pos = 0;
- INT16 len;
+ uint8_t header[CQM_HEADER_SIZE];
+ uint64_t pos = 0;
+ int16_t len;
int head;
int track;
int s;
@@ -194,7 +194,7 @@ FLOPPY_CONSTRUCT( cqm_dsk_construct )
pos = CQM_HEADER_SIZE + (header[0x70] << 8) + header[0x6f];
track = 0;
head = 0;
- tag->buf = (UINT8*)malloc(tag->sector_size*tag->sector_per_track);
+ tag->buf = (uint8_t*)malloc(tag->sector_size*tag->sector_per_track);
do {
tag->track_offsets[(track<<1) + head] = pos;
s = 0;
@@ -261,9 +261,9 @@ const char *cqm_format::extensions() const
return "cqm,cqi,dsk";
}
-int cqm_format::identify(io_generic *io, UINT32 form_factor)
+int cqm_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 h[3];
+ uint8_t h[3];
io_generic_read(io, h, 0, 3);
if (h[0] == 'C' && h[1] == 'Q' && h[2] == 0x14)
@@ -272,11 +272,11 @@ int cqm_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool cqm_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool cqm_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
const int max_size = 4*1024*1024; // 4MB ought to be large enough for any floppy
- std::vector<UINT8> imagebuf(max_size);
- UINT8 header[CQM_HEADER_SIZE];
+ std::vector<uint8_t> imagebuf(max_size);
+ uint8_t header[CQM_HEADER_SIZE];
io_generic_read(io, header, 0, CQM_HEADER_SIZE);
int sector_size = (header[0x04] << 8) | header[0x03];
@@ -318,13 +318,13 @@ bool cqm_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
int base_cell_count = rate*60/rpm;
int cqm_size = io_generic_size(io);
- std::vector<UINT8> cqmbuf(cqm_size);
+ std::vector<uint8_t> cqmbuf(cqm_size);
io_generic_read(io, &cqmbuf[0], 0, cqm_size);
// decode the RLE data
for (int s = 0, pos = CQM_HEADER_SIZE + comment_size; pos < cqm_size; )
{
- INT16 len = (cqmbuf[pos + 1] << 8) | cqmbuf[pos];
+ int16_t len = (cqmbuf[pos + 1] << 8) | cqmbuf[pos];
pos += 2;
if(len < 0)
{
diff --git a/src/lib/formats/cqm_dsk.h b/src/lib/formats/cqm_dsk.h
index 48bc8d5521c..7ae12ccff2b 100644
--- a/src/lib/formats/cqm_dsk.h
+++ b/src/lib/formats/cqm_dsk.h
@@ -18,8 +18,8 @@ class cqm_format : public floppy_image_format_t
public:
cqm_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual const char *name() const override;
diff --git a/src/lib/formats/csw_cas.cpp b/src/lib/formats/csw_cas.cpp
index 0790dd16dee..a8feccf5300 100644
--- a/src/lib/formats/csw_cas.cpp
+++ b/src/lib/formats/csw_cas.cpp
@@ -32,32 +32,32 @@ Offset Value Type Description
#define CSW_WAV_FREQUENCY 44100
-static const UINT8 CSW_HEADER[] = { "Compressed Square Wave" };
+static const uint8_t CSW_HEADER[] = { "Compressed Square Wave" };
-static UINT32 get_leuint32(const void *ptr)
+static uint32_t get_leuint32(const void *ptr)
{
- UINT32 value;
+ uint32_t value;
memcpy(&value, ptr, sizeof(value));
return little_endianize_int32(value);
}
static int mycaslen;
-static int csw_cas_to_wav_size( const UINT8 *casdata, int caslen )
+static int csw_cas_to_wav_size( const uint8_t *casdata, int caslen )
{
- UINT32 SampleRate;
- UINT32 NumberOfPulses;
- UINT8 MajorRevision;
- UINT8 MinorRevision;
- UINT8 CompressionType;
- UINT8 Flags;
- UINT8 HeaderExtensionLength;
- std::vector<UINT8> gz_ptr;
+ uint32_t SampleRate;
+ uint32_t NumberOfPulses;
+ uint8_t MajorRevision;
+ uint8_t MinorRevision;
+ uint8_t CompressionType;
+ uint8_t Flags;
+ uint8_t HeaderExtensionLength;
+ std::vector<uint8_t> gz_ptr;
int total_size;
z_stream d_stream;
int err;
- UINT8 *in_ptr;
+ uint8_t *in_ptr;
int bsize=0;
if ( memcmp( casdata, CSW_HEADER, sizeof(CSW_HEADER)-1 ) )
@@ -98,7 +98,7 @@ static int csw_cas_to_wav_size( const UINT8 *casdata, int caslen )
mycaslen=caslen;
//from here on down for now I am assuming it is compressed csw file.
- in_ptr = (UINT8*) casdata+0x34+HeaderExtensionLength;
+ in_ptr = (uint8_t*) casdata+0x34+HeaderExtensionLength;
gz_ptr.resize( 8 );
@@ -163,20 +163,20 @@ cleanup:
return -1;
}
-static int csw_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes )
+static int csw_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes )
{
- UINT32 SampleRate;
- UINT32 NumberOfPulses;
- UINT8 CompressionType;
- UINT8 Flags;
- UINT8 HeaderExtensionLength;
- INT8 Bit;
-
- std::vector<UINT8> gz_ptr;
+ uint32_t SampleRate;
+ uint32_t NumberOfPulses;
+ uint8_t CompressionType;
+ uint8_t Flags;
+ uint8_t HeaderExtensionLength;
+ int8_t Bit;
+
+ std::vector<uint8_t> gz_ptr;
int total_size;
z_stream d_stream;
int err;
- UINT8 *in_ptr;
+ uint8_t *in_ptr;
int bsize=0;
int i;
@@ -206,7 +206,7 @@ static int csw_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes )
//from here on down for now I am assuming it is compressed csw file.
- in_ptr = (UINT8*) bytes+0x34+HeaderExtensionLength;
+ in_ptr = (uint8_t*) bytes+0x34+HeaderExtensionLength;
gz_ptr.resize( 8 );
@@ -288,7 +288,7 @@ static const struct CassetteLegacyWaveFiller csw_legacy_fill_wave = {
static cassette_image::error csw_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts )
{
- UINT8 header[22];
+ uint8_t header[22];
cassette_image_read(cassette, header, 0, sizeof(header));
if (memcmp(&header[0], CSW_HEADER, sizeof(CSW_HEADER) - 1)) {
diff --git a/src/lib/formats/d64_dsk.cpp b/src/lib/formats/d64_dsk.cpp
index 2cece44c43a..f26a3e676fb 100644
--- a/src/lib/formats/d64_dsk.cpp
+++ b/src/lib/formats/d64_dsk.cpp
@@ -51,7 +51,7 @@ const d64_format::format d64_format::file_formats[] = {
{}
};
-const UINT32 d64_format::cell_size[] =
+const uint32_t d64_format::cell_size[] =
{
4000, // 16MHz/16/4
3750, // 16MHz/15/4
@@ -79,20 +79,20 @@ const int d64_format::speed_zone[] =
0, 0 // 41-42
};
-int d64_format::find_size(io_generic *io, UINT32 form_factor) const
+int d64_format::find_size(io_generic *io, uint32_t form_factor) const
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
for(int i=0; formats[i].sector_count; i++) {
const format &f = formats[i];
- if(size == (UINT32) f.sector_count*f.sector_base_size*f.head_count)
+ if(size == (uint32_t) f.sector_count*f.sector_base_size*f.head_count)
return i;
- if(size == (UINT32) (f.sector_count*f.sector_base_size*f.head_count) + f.sector_count)
+ if(size == (uint32_t) (f.sector_count*f.sector_base_size*f.head_count) + f.sector_count)
return i;
}
return -1;
}
-int d64_format::identify(io_generic *io, UINT32 form_factor)
+int d64_format::identify(io_generic *io, uint32_t form_factor)
{
int type = find_size(io, form_factor);
@@ -114,9 +114,9 @@ int d64_format::get_disk_id_offset(const format &f)
return 0x165a2;
}
-void d64_format::get_disk_id(const format &f, io_generic *io, UINT8 &id1, UINT8 &id2)
+void d64_format::get_disk_id(const format &f, io_generic *io, uint8_t &id1, uint8_t &id2)
{
- UINT8 id[2];
+ uint8_t id[2];
io_generic_read(io, id, get_disk_id_offset(f), 2);
id1 = id[0];
id2 = id[1];
@@ -141,7 +141,7 @@ int d64_format::compute_track_size(const format &f, int track)
return this->get_sectors_per_track(f, track) * f.sector_base_size;
}
-UINT32 d64_format::get_cell_size(const format &f, int track)
+uint32_t d64_format::get_cell_size(const format &f, int track)
{
return cell_size[speed_zone[track]];
}
@@ -151,7 +151,7 @@ int d64_format::get_sectors_per_track(const format &f, int track)
return sectors_per_track[track];
}
-floppy_image_format_t::desc_e* d64_format::get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2)
+floppy_image_format_t::desc_e* d64_format::get_sector_desc(const format &f, int &current_size, int sector_count, uint8_t id1, uint8_t id2, int gap_2)
{
static floppy_image_format_t::desc_e desc[] = {
/* 00 */ { SECTOR_LOOP_START, 0, -1 },
@@ -186,7 +186,7 @@ floppy_image_format_t::desc_e* d64_format::get_sector_desc(const format &f, int
return desc;
}
-void d64_format::build_sector_description(const format &f, UINT8 *sectdata, UINT32 sect_offs, UINT32 error_offs, desc_s *sectors, int sector_count) const
+void d64_format::build_sector_description(const format &f, uint8_t *sectdata, uint32_t sect_offs, uint32_t error_offs, desc_s *sectors, int sector_count) const
{
for (int i = 0; i < sector_count; i++) {
sectors[i].data = sectdata + sect_offs;
@@ -206,7 +206,7 @@ void d64_format::fix_end_gap(floppy_image_format_t::desc_e* desc, int remaining_
desc[22].p1 >>= remaining_size & 0x01;
}
-bool d64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool d64_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
int type = find_size(io, form_factor);
if(type == -1)
@@ -214,10 +214,10 @@ bool d64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
const format &f = formats[type];
- UINT64 size = io_generic_size(io);
- std::vector<UINT8> img;
+ uint64_t size = io_generic_size(io);
+ std::vector<uint8_t> img;
- if(size == (UINT32)f.sector_count*f.sector_base_size) {
+ if(size == (uint32_t)f.sector_count*f.sector_base_size) {
img.resize(size + f.sector_count);
memset(&img[0], ERROR_00, size + f.sector_count);
}
@@ -229,7 +229,7 @@ bool d64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
int track_offset = 0, error_offset = f.sector_count*f.sector_base_size;
- UINT8 id1 = 0, id2 = 0;
+ uint8_t id1 = 0, id2 = 0;
get_disk_id(f, io, id1, id2);
for (int head = 0; head < f.head_count; head++) {
@@ -272,7 +272,7 @@ bool d64_format::save(io_generic *io, floppy_image *image)
for(int track=0; track < f.track_count; track++) {
int sector_count = this->get_sectors_per_track(f, track);
int track_size = compute_track_size(f, track);
- UINT8 sectdata[40*256] = { 0 };
+ uint8_t sectdata[40*256] = { 0 };
desc_s sectors[40];
int offset = get_image_offset(f, head, track);
@@ -287,8 +287,8 @@ bool d64_format::save(io_generic *io, floppy_image *image)
void d64_format::extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head, int sector_count)
{
- UINT8 bitstream[500000/8];
- UINT8 sectdata[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sectdata[50000];
desc_xs sectors[256];
int physical_track = this->get_physical_track(f, head, track);
int cell_size = this->get_cell_size(f, track);
@@ -305,7 +305,7 @@ void d64_format::extract_sectors(floppy_image *image, const format &f, desc_s *s
memset((void *)ds.data, 0, ds.size);
else if(xs.size < ds.size) {
memcpy((void *)ds.data, xs.data, xs.size);
- memset((UINT8 *)ds.data + xs.size, 0, xs.size - ds.size);
+ memset((uint8_t *)ds.data + xs.size, 0, xs.size - ds.size);
} else
memcpy((void *)ds.data, xs.data, ds.size);
}
diff --git a/src/lib/formats/d64_dsk.h b/src/lib/formats/d64_dsk.h
index c5bef4b3313..28726332fa3 100644
--- a/src/lib/formats/d64_dsk.h
+++ b/src/lib/formats/d64_dsk.h
@@ -16,15 +16,15 @@
class d64_format : public floppy_image_format_t {
public:
struct format {
- UINT32 form_factor; // See floppy_image for possible values
- UINT32 variant; // See floppy_image for possible values
-
- UINT16 sector_count;
- UINT8 track_count;
- UINT8 head_count;
- UINT16 sector_base_size;
- UINT8 gap_1;
- UINT8 gap_2;
+ uint32_t form_factor; // See floppy_image for possible values
+ uint32_t variant; // See floppy_image for possible values
+
+ uint16_t sector_count;
+ uint8_t track_count;
+ uint8_t head_count;
+ uint16_t sector_base_size;
+ uint8_t gap_1;
+ uint8_t gap_2;
};
d64_format();
@@ -34,8 +34,8 @@ public:
virtual const char *description() const override;
virtual const char *extensions() const override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual bool supports_save() const override { return true; }
@@ -58,23 +58,23 @@ protected:
const format *formats;
- int find_size(io_generic *io, UINT32 form_factor) const;
+ int find_size(io_generic *io, uint32_t form_factor) const;
virtual int get_physical_track(const format &f, int head, int track);
- virtual UINT32 get_cell_size(const format &f, int track);
+ virtual uint32_t get_cell_size(const format &f, int track);
virtual int get_sectors_per_track(const format &f, int track);
virtual int get_disk_id_offset(const format &f);
- void get_disk_id(const format &f, io_generic *io, UINT8 &id1, UINT8 &id2);
+ void get_disk_id(const format &f, io_generic *io, uint8_t &id1, uint8_t &id2);
virtual int get_image_offset(const format &f, int head, int track);
int compute_track_size(const format &f, int track);
virtual int get_gap2(const format &f, int head, int track) { return f.gap_2; }
- virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2);
- void build_sector_description(const format &f, UINT8 *sectdata, UINT32 sect_offs, UINT32 error_offs, desc_s *sectors, int sector_count) const;
+ virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, uint8_t id1, uint8_t id2, int gap_2);
+ void build_sector_description(const format &f, uint8_t *sectdata, uint32_t sect_offs, uint32_t error_offs, desc_s *sectors, int sector_count) const;
virtual void fix_end_gap(floppy_image_format_t::desc_e* desc, int remaining_size);
void extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head, int sector_count);
static const format file_formats[];
- static const UINT32 cell_size[];
+ static const uint32_t cell_size[];
static const int sectors_per_track[];
static const int speed_zone[];
};
diff --git a/src/lib/formats/d80_dsk.cpp b/src/lib/formats/d80_dsk.cpp
index 12ea14ad80f..e08ef22f6b9 100644
--- a/src/lib/formats/d80_dsk.cpp
+++ b/src/lib/formats/d80_dsk.cpp
@@ -42,7 +42,7 @@ const d80_format::format d80_format::file_formats[] = {
{}
};
-const UINT32 d80_format::d80_cell_size[] =
+const uint32_t d80_format::d80_cell_size[] =
{
2667, // 12MHz/2/16
2500, // 12MHz/2/15
@@ -75,7 +75,7 @@ int d80_format::get_physical_track(const format &f, int head, int track)
return track;
}
-UINT32 d80_format::get_cell_size(const format &f, int track)
+uint32_t d80_format::get_cell_size(const format &f, int track)
{
return d80_cell_size[d80_speed_zone[track]];
}
@@ -91,7 +91,7 @@ int d80_format::get_disk_id_offset(const format &f)
return 0x44e18;
}
-floppy_image_format_t::desc_e* d80_format::get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2)
+floppy_image_format_t::desc_e* d80_format::get_sector_desc(const format &f, int &current_size, int sector_count, uint8_t id1, uint8_t id2, int gap_2)
{
static floppy_image_format_t::desc_e desc[] = {
/* 00 */ { SECTOR_LOOP_START, 0, -1 },
diff --git a/src/lib/formats/d80_dsk.h b/src/lib/formats/d80_dsk.h
index d823b85a9bc..4f6482efffe 100644
--- a/src/lib/formats/d80_dsk.h
+++ b/src/lib/formats/d80_dsk.h
@@ -26,15 +26,15 @@ protected:
const format *formats;
virtual int get_physical_track(const format &f, int head, int track) override;
- virtual UINT32 get_cell_size(const format &f, int track) override;
+ virtual uint32_t get_cell_size(const format &f, int track) override;
virtual int get_sectors_per_track(const format &f, int track) override;
virtual int get_disk_id_offset(const format &f) override;
- virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2) override;
+ virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, uint8_t id1, uint8_t id2, int gap_2) override;
virtual void fix_end_gap(floppy_image_format_t::desc_e* desc, int remaining_size) override;
static const format file_formats[];
- static const UINT32 d80_cell_size[];
+ static const uint32_t d80_cell_size[];
static const int d80_speed_zone[];
static const int d80_sectors_per_track[];
};
diff --git a/src/lib/formats/d88_dsk.cpp b/src/lib/formats/d88_dsk.cpp
index 21c73fec5c0..cc95dcedb69 100644
--- a/src/lib/formats/d88_dsk.cpp
+++ b/src/lib/formats/d88_dsk.cpp
@@ -38,11 +38,11 @@
struct d88_tag
{
- UINT32 image_size;
- UINT32 trackoffset[164];
- UINT8 write_protect;
- UINT8 disk_type;
- UINT8 heads;
+ uint32_t image_size;
+ uint32_t trackoffset[164];
+ uint8_t write_protect;
+ uint8_t disk_type;
+ uint8_t heads;
};
static struct d88_tag *get_d88_tag(floppy_image_legacy *floppy)
@@ -53,8 +53,8 @@ static struct d88_tag *get_d88_tag(floppy_image_legacy *floppy)
static int d88_get_sector_id(floppy_image_legacy *floppy, int head, int track, int sector_index)
{
struct d88_tag* tag = get_d88_tag(floppy);
- UINT32 offset;
- UINT8 sector_hdr[16];
+ uint32_t offset;
+ uint8_t sector_hdr[16];
int x;
offset = tag->trackoffset[(track*tag->heads)+head];
@@ -91,8 +91,8 @@ static int d88_get_heads_per_disk(floppy_image_legacy *floppy)
static int d88_get_sectors_per_track(floppy_image_legacy *floppy, int head, int track)
{
struct d88_tag* tag = get_d88_tag(floppy);
- UINT32 offset;
- UINT8 sector_hdr[16];
+ uint32_t offset;
+ uint8_t sector_hdr[16];
offset = tag->trackoffset[(track*tag->heads)+head];
@@ -101,12 +101,12 @@ static int d88_get_sectors_per_track(floppy_image_legacy *floppy, int head, int
return sector_hdr[4];
}
-static floperr_t d88_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
+static floperr_t d88_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
{
struct d88_tag* tag = get_d88_tag(floppy);
- UINT32 offset;
- UINT8 sector_hdr[16];
- UINT32 len;
+ uint32_t offset;
+ uint8_t sector_hdr[16];
+ uint32_t len;
int count,secs;
offset = tag->trackoffset[(track*tag->heads)+head];
@@ -131,20 +131,20 @@ static floperr_t d88_get_sector_length(floppy_image_legacy *floppy, int head, in
return FLOPPY_ERROR_SEEKERROR;
}
-static floperr_t d88_read_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, void *buffer, size_t buflen)
+static floperr_t d88_read_track(floppy_image_legacy *floppy, int head, int track, uint64_t offset, void *buffer, size_t buflen)
{
// floperr_t err;
return FLOPPY_ERROR_UNSUPPORTED;
}
-static UINT32 d88_get_sector_offset(floppy_image_legacy* floppy, int head, int track, int sector)
+static uint32_t d88_get_sector_offset(floppy_image_legacy* floppy, int head, int track, int sector)
{
struct d88_tag* tag = get_d88_tag(floppy);
- UINT32 offset = 0;
- UINT8 sector_hdr[16];
- UINT32 len;
- UINT32 secs;
+ uint32_t offset = 0;
+ uint8_t sector_hdr[16];
+ uint32_t len;
+ uint32_t secs;
int count;
// get offset of the beginning of the track
@@ -169,11 +169,11 @@ static UINT32 d88_get_sector_offset(floppy_image_legacy* floppy, int head, int t
return 0;
}
-static floperr_t d88_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags)
+static floperr_t d88_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags)
{
struct d88_tag* tag = get_d88_tag(floppy);
- UINT32 offset;
- UINT8 sector_hdr[16];
+ uint32_t offset;
+ uint8_t sector_hdr[16];
int x;
offset = tag->trackoffset[(track*tag->heads)+head];
@@ -216,8 +216,8 @@ static floperr_t d88_get_indexed_sector_info(floppy_image_legacy *floppy, int he
static floperr_t d88_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen)
{
- UINT64 offset;
- UINT32 sector_length;
+ uint64_t offset;
+ uint32_t sector_length;
offset = d88_get_sector_offset(floppy,head,track,sector);
@@ -245,8 +245,8 @@ static floperr_t d88_read_indexed_sector(floppy_image_legacy *floppy, int head,
static floperr_t d88_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam)
{
- UINT64 offset;
- UINT32 sector_length;
+ uint64_t offset;
+ uint32_t sector_length;
offset = d88_get_sector_offset(floppy,head,track,sector);
@@ -272,9 +272,9 @@ static floperr_t d88_write_indexed_sector(floppy_image_legacy *floppy, int head,
return d88_write_sector(floppy,head,track,sec,buffer,buflen,ddam);
}
-static void d88_get_header(floppy_image_legacy* floppy,UINT32* size, UINT8* prot, UINT8* type, UINT32* offsets)
+static void d88_get_header(floppy_image_legacy* floppy,uint32_t* size, uint8_t* prot, uint8_t* type, uint32_t* offsets)
{
- UINT8 header[D88_HEADER_LEN];
+ uint8_t header[D88_HEADER_LEN];
int x,s;
floppy_image_read(floppy,header,0,D88_HEADER_LEN);
@@ -282,8 +282,8 @@ static void d88_get_header(floppy_image_legacy* floppy,UINT32* size, UINT8* prot
#ifdef SPOT_DUPLICATES
// there exist many .d88 files with same data and different headers and
// this allows to spot duplicates, making easier to debug softlists.
- UINT32 temp_size = floppy_image_size(floppy);
- UINT8 tmp_copy[temp_size - D88_HEADER_LEN];
+ uint32_t temp_size = floppy_image_size(floppy);
+ uint8_t tmp_copy[temp_size - D88_HEADER_LEN];
floppy_image_read(floppy,tmp_copy,D88_HEADER_LEN,temp_size - D88_HEADER_LEN);
printf("CRC16: %d\n", ccitt_crc16(0xffff, tmp_copy, temp_size - D88_HEADER_LEN));
#endif
@@ -317,7 +317,7 @@ static void d88_get_header(floppy_image_legacy* floppy,UINT32* size, UINT8* prot
FLOPPY_IDENTIFY(d88_dsk_identify)
{
- UINT32 size;
+ uint32_t size;
d88_get_header(floppy,&size,nullptr,nullptr,nullptr);
@@ -336,9 +336,9 @@ FLOPPY_CONSTRUCT(d88_dsk_construct)
{
struct FloppyCallbacks *callbacks;
struct d88_tag *tag;
- UINT32 size;
- UINT8 prot,type = 0;
- UINT32 offs[164];
+ uint32_t size;
+ uint8_t prot,type = 0;
+ uint32_t offs[164];
int x;
if(params)
@@ -414,22 +414,22 @@ const char *d88_format::extensions() const
return "d77,d88,1dd";
}
-int d88_format::identify(io_generic *io, UINT32 form_factor)
+int d88_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT64 size = io_generic_size(io);
- UINT8 h[32];
+ uint64_t size = io_generic_size(io);
+ uint8_t h[32];
io_generic_read(io, h, 0, 32);
- if((little_endianize_int32(*(UINT32 *)(h+0x1c)) == size) &&
+ if((little_endianize_int32(*(uint32_t *)(h+0x1c)) == size) &&
(h[0x1b] == 0x00 || h[0x1b] == 0x10 || h[0x1b] == 0x20 || h[0x1b] == 0x30 || h[0x1b] == 0x40))
return 100;
return 0;
}
-bool d88_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool d88_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 h[32];
+ uint8_t h[32];
io_generic_read(io, h, 0, 32);
@@ -476,7 +476,7 @@ bool d88_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
if(!head_count)
return false;
- UINT32 track_pos[164];
+ uint32_t track_pos[164];
io_generic_read(io, track_pos, 32, 164*4);
for(int track=0; track < track_count; track++)
@@ -486,17 +486,17 @@ bool d88_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
continue;
desc_pc_sector sects[256];
- UINT8 sect_data[65536];
+ uint8_t sect_data[65536];
int sdatapos = 0;
int sector_count = 1;
for(int i=0; i<sector_count; i++) {
- UINT8 hs[16];
+ uint8_t hs[16];
io_generic_read(io, hs, pos, 16);
pos += 16;
- UINT16 size = little_endianize_int16(*(UINT16 *)(hs+14));
+ uint16_t size = little_endianize_int16(*(uint16_t *)(hs+14));
if(i == 0) {
- sector_count = little_endianize_int16(*(UINT16 *)(hs+4));
+ sector_count = little_endianize_int16(*(uint16_t *)(hs+4));
// Support broken vfman converter
if(sector_count == 0x1000)
sector_count = 0x10;
diff --git a/src/lib/formats/d88_dsk.h b/src/lib/formats/d88_dsk.h
index 2ab8db763f6..5ba52c4fe45 100644
--- a/src/lib/formats/d88_dsk.h
+++ b/src/lib/formats/d88_dsk.h
@@ -19,8 +19,8 @@ class d88_format : public floppy_image_format_t
public:
d88_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual const char *name() const override;
diff --git a/src/lib/formats/dcp_dsk.cpp b/src/lib/formats/dcp_dsk.cpp
index 4e2c305e6f6..179552409f8 100644
--- a/src/lib/formats/dcp_dsk.cpp
+++ b/src/lib/formats/dcp_dsk.cpp
@@ -43,10 +43,10 @@ const char *dcp_format::extensions() const
return "dcp,dcu";
}
-int dcp_format::identify(io_generic *io, UINT32 form_factor)
+int dcp_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT64 size = io_generic_size(io);
- UINT8 h[0xa2];
+ uint64_t size = io_generic_size(io);
+ uint8_t h[0xa2];
int heads, tracks, spt, bps, count_tracks = 0;
bool is_hdb = false;
@@ -112,9 +112,9 @@ int dcp_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool dcp_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool dcp_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 h[0xa2];
+ uint8_t h[0xa2];
int heads, tracks, spt, bps;
bool is_hdb = false;
@@ -208,7 +208,7 @@ bool dcp_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
for (ssize = 0; (128 << ssize) < bps; ssize++) {};
desc_pc_sector sects[256];
- UINT8 sect_data[65536];
+ uint8_t sect_data[65536];
if (!is_hdb)
{
@@ -269,7 +269,7 @@ bool dcp_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
build_pc_track_mfm(0, 1, image, cell_count, spt, sects, calc_default_pc_gap3_size(form_factor, bps));
// Read other tracks as usual
- UINT32 data_offs = 0xa2 + (26 * 0x80) + (26 * 0x100);
+ uint32_t data_offs = 0xa2 + (26 * 0x80) + (26 * 0x100);
for (int track = 1; track < tracks; track++)
for (int head = 0; head < heads; head++)
{
diff --git a/src/lib/formats/dcp_dsk.h b/src/lib/formats/dcp_dsk.h
index 92e447741f5..940a8aca931 100644
--- a/src/lib/formats/dcp_dsk.h
+++ b/src/lib/formats/dcp_dsk.h
@@ -19,8 +19,8 @@ class dcp_format : public floppy_image_format_t
public:
dcp_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual const char *name() const override;
virtual const char *description() const override;
diff --git a/src/lib/formats/dfi_dsk.cpp b/src/lib/formats/dfi_dsk.cpp
index dae3d737b67..6c9f32cbb31 100644
--- a/src/lib/formats/dfi_dsk.cpp
+++ b/src/lib/formats/dfi_dsk.cpp
@@ -55,7 +55,7 @@ bool dfi_format::supports_save() const
return false;
}
-int dfi_format::identify(io_generic *io, UINT32 form_factor)
+int dfi_format::identify(io_generic *io, uint32_t form_factor)
{
char sign[4];
io_generic_read(io, sign, 0, 4);
@@ -64,21 +64,21 @@ int dfi_format::identify(io_generic *io, UINT32 form_factor)
return memcmp(sign, "DFE2", 4) ? 0 : 100;
}
-bool dfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool dfi_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT64 size = io_generic_size(io);
- UINT64 pos = 4;
- std::vector<UINT8> data;
+ uint64_t size = io_generic_size(io);
+ uint64_t pos = 4;
+ std::vector<uint8_t> data;
int onerev_time = 0; // time for one revolution, used to guess clock and rpm for DFE2 files
unsigned long clock_rate = 100000000; // sample clock rate in megahertz
int rpm=360; // drive rpm
while(pos < size) {
- UINT8 h[10];
+ uint8_t h[10];
io_generic_read(io, h, pos, 10);
- UINT16 track = (h[0] << 8) | h[1];
- UINT16 head = (h[2] << 8) | h[3];
+ uint16_t track = (h[0] << 8) | h[1];
+ uint16_t head = (h[2] << 8) | h[3];
// Ignore sector
- UINT32 tsize = (h[6] << 24) | (h[7] << 16) | (h[8] << 8) | h[9];
+ uint32_t tsize = (h[6] << 24) | (h[7] << 16) | (h[8] << 8) | h[9];
// if the position-so-far-in-file plus 10 (for the header) plus track size
// is larger than the size of the file, free buffers and bail out
@@ -98,7 +98,7 @@ bool dfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
//int index_polarity = 1; // current polarity of index, starts high
int total_time = 0; // total sampled time per track
for(int i=0; i<tsize; i++) {
- UINT8 v = data[i];
+ uint8_t v = data[i];
if (v == 0xFF) { fprintf(stderr,"DFI stream contained a 0xFF at t%d, position%d, THIS SHOULD NEVER HAPPEN! Bailing out!\n", track, i); exit(1); }
if((v & 0x7f) == 0x7f)
total_time += 0x7f;
@@ -149,7 +149,7 @@ bool dfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
if(!index_time)
index_time = total_time;
- std::vector<UINT32> &buf = image->get_buffer(track, head);
+ std::vector<uint32_t> &buf = image->get_buffer(track, head);
buf.resize(tsize);
int cur_time = 0;
@@ -162,11 +162,11 @@ bool dfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
#endif
index_count = 0;
//index_polarity = 0;
- UINT32 mg = floppy_image::MG_A;
+ uint32_t mg = floppy_image::MG_A;
int tpos = 0;
buf[tpos++] = mg;
for(int i=0; i<tsize; i++) {
- UINT8 v = data[i];
+ uint8_t v = data[i];
if((v & 0x7f) == 0x7f) // 0x7F : no transition, but a carry (FF is a board-on-fire error and is checked for above)
cur_time += 0x7f;
else if(v & 0x80) { // 0x80 set, note the index (TODO: actually do this!) and add number to count
@@ -188,7 +188,7 @@ bool dfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
// the normal case: write the transition at the appropriate time
if ((prev_time == 0) || ((trans_time > MIN_THRESH) && (trans_time <= MAX_THRESH))) {
mg = mg == floppy_image::MG_A ? floppy_image::MG_B : floppy_image::MG_A;
- buf[tpos++] = mg | UINT32((200000000ULL*cur_time)/index_time);
+ buf[tpos++] = mg | uint32_t((200000000ULL*cur_time)/index_time);
prev_time = cur_time;
}
// the long case: we probably missed a transition, stuff an extra guessed one in there to see if it helps
@@ -196,14 +196,14 @@ bool dfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
mg = mg == floppy_image::MG_A ? floppy_image::MG_B : floppy_image::MG_A;
if (((track%2)==0)&&(head==0)) fprintf(stderr,"missed transition, total time for transition is %d\n",trans_time);
#ifndef FAKETRANS_ONE
- buf[tpos++] = mg | UINT32((200000000ULL*(cur_time-(trans_time/2)))/index_time); // generate imaginary transition at half period
+ buf[tpos++] = mg | uint32_t((200000000ULL*(cur_time-(trans_time/2)))/index_time); // generate imaginary transition at half period
#else
- buf[tpos++] = mg | UINT32((200000000ULL*(cur_time-((trans_time*2)/3)))/index_time);
+ buf[tpos++] = mg | uint32_t((200000000ULL*(cur_time-((trans_time*2)/3)))/index_time);
mg = mg == floppy_image::MG_A ? floppy_image::MG_B : floppy_image::MG_A;
- buf[tpos++] = mg | UINT32((200000000ULL*(cur_time-(trans_time/3)))/index_time);
+ buf[tpos++] = mg | uint32_t((200000000ULL*(cur_time-(trans_time/3)))/index_time);
#endif
mg = mg == floppy_image::MG_A ? floppy_image::MG_B : floppy_image::MG_A;
- buf[tpos++] = mg | UINT32(200000000ULL*cur_time/index_time); // generate transition now
+ buf[tpos++] = mg | uint32_t(200000000ULL*cur_time/index_time); // generate transition now
prev_time = cur_time;
}
}
diff --git a/src/lib/formats/dfi_dsk.h b/src/lib/formats/dfi_dsk.h
index b25278275f3..030776a9b4f 100644
--- a/src/lib/formats/dfi_dsk.h
+++ b/src/lib/formats/dfi_dsk.h
@@ -10,8 +10,8 @@ class dfi_format : public floppy_image_format_t
public:
dfi_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
// virtual bool save(io_generic *io, floppy_image *image);
virtual const char *name() const override;
diff --git a/src/lib/formats/dim_dsk.cpp b/src/lib/formats/dim_dsk.cpp
index 42668b39faf..67c04adc2bf 100644
--- a/src/lib/formats/dim_dsk.cpp
+++ b/src/lib/formats/dim_dsk.cpp
@@ -16,9 +16,9 @@
FLOPPY_IDENTIFY(dim_dsk_identify)
{
- UINT8 dim_header[16];
+ uint8_t dim_header[16];
- floppy_image_read(floppy, (UINT8*)dim_header,0xab,16);
+ floppy_image_read(floppy, (uint8_t*)dim_header,0xab,16);
if(strncmp((const char*)dim_header,"DIFC HEADER",11) == 0)
*vote = 100;
@@ -36,9 +36,9 @@ FLOPPY_CONSTRUCT(dim_dsk_construct)
int sectors = 8; // per track
int sectorlen = 1024;
int firstsector = 0x01;
- UINT8 format_tmp;
+ uint8_t format_tmp;
int x;
- UINT16 temp;
+ uint16_t temp;
if(params)
{
@@ -132,9 +132,9 @@ const char *dim_format::extensions() const
return "dim";
}
-int dim_format::identify(io_generic *io, UINT32 form_factor)
+int dim_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 h[16];
+ uint8_t h[16];
io_generic_read(io, h, 0xab, 16);
@@ -144,11 +144,11 @@ int dim_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool dim_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool dim_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
int offset = 0x100;
- UINT8 h;
- UINT8 track_total = 77;
+ uint8_t h;
+ uint8_t track_total = 77;
int cell_count = form_factor == floppy_image::FF_35 ? 200000 : 166666;
io_generic_read(io, &h, 0, 1);
@@ -192,7 +192,7 @@ bool dim_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
for(int track=0; track < track_total; track++)
for(int head=0; head < 2; head++) {
desc_pc_sector sects[30];
- UINT8 sect_data[10000];
+ uint8_t sect_data[10000];
int sdatapos = 0;
for(int i=0; i<spt; i++) {
sects[i].track = track;
diff --git a/src/lib/formats/dim_dsk.h b/src/lib/formats/dim_dsk.h
index 54f84aff471..3529c84253d 100644
--- a/src/lib/formats/dim_dsk.h
+++ b/src/lib/formats/dim_dsk.h
@@ -24,8 +24,8 @@ class dim_format : public floppy_image_format_t
public:
dim_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual const char *name() const override;
diff --git a/src/lib/formats/dip_dsk.cpp b/src/lib/formats/dip_dsk.cpp
index 9e6570f8071..310eab56a73 100644
--- a/src/lib/formats/dip_dsk.cpp
+++ b/src/lib/formats/dip_dsk.cpp
@@ -37,9 +37,9 @@ const char *dip_format::extensions() const
return "dip";
}
-int dip_format::identify(io_generic *io, UINT32 form_factor)
+int dip_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
if (size == 0x134000 + 0x100)
return 100;
@@ -47,7 +47,7 @@ int dip_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool dip_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool dip_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
int heads, tracks, spt, bps;
@@ -64,7 +64,7 @@ bool dip_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
for (ssize = 0; (128 << ssize) < bps; ssize++) {};
desc_pc_sector sects[256];
- UINT8 sect_data[65536];
+ uint8_t sect_data[65536];
for (int track = 0; track < tracks; track++)
for (int head = 0; head < heads; head++)
diff --git a/src/lib/formats/dip_dsk.h b/src/lib/formats/dip_dsk.h
index dba5e4afee9..2f392ff8ab2 100644
--- a/src/lib/formats/dip_dsk.h
+++ b/src/lib/formats/dip_dsk.h
@@ -19,8 +19,8 @@ class dip_format : public floppy_image_format_t
public:
dip_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual const char *name() const override;
virtual const char *description() const override;
diff --git a/src/lib/formats/dmk_dsk.cpp b/src/lib/formats/dmk_dsk.cpp
index aa37206f736..5ca0a3b8781 100644
--- a/src/lib/formats/dmk_dsk.cpp
+++ b/src/lib/formats/dmk_dsk.cpp
@@ -41,12 +41,12 @@ const char *dmk_format::extensions() const
}
-int dmk_format::identify(io_generic *io, UINT32 form_factor)
+int dmk_format::identify(io_generic *io, uint32_t form_factor)
{
const int header_size = 16;
- UINT8 header[header_size];
+ uint8_t header[header_size];
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
io_generic_read(io, header, 0, header_size);
@@ -81,10 +81,10 @@ int dmk_format::identify(io_generic *io, UINT32 form_factor)
}
-bool dmk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool dmk_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
const int header_size = 16;
- UINT8 header[header_size];
+ uint8_t header[header_size];
io_generic_read(io, header, 0, header_size);
@@ -121,8 +121,8 @@ bool dmk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
{
for (int head = 0; head < heads; head++)
{
- std::vector<UINT8> track_data(track_size);
- std::vector<UINT32> raw_track_data;
+ std::vector<uint8_t> track_data(track_size);
+ std::vector<uint32_t> raw_track_data;
int iam_location = -1;
int idam_location[64];
int dam_location[64];
@@ -137,8 +137,8 @@ bool dmk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
}
// Find IDAM locations
- UINT16 track_header_offset = 0;
- UINT16 track_offset = ( ( track_data[track_header_offset + 1] << 8 ) | track_data[track_header_offset] ) & 0x3fff;
+ uint16_t track_header_offset = 0;
+ uint16_t track_offset = ( ( track_data[track_header_offset + 1] << 8 ) | track_data[track_header_offset] ) & 0x3fff;
track_header_offset += 2;
while ( track_offset != 0 && track_offset >= 0x83 && track_offset < track_size && track_header_offset < 0x80 )
diff --git a/src/lib/formats/dmk_dsk.h b/src/lib/formats/dmk_dsk.h
index 5a2f2f6cb7c..6b15000baab 100644
--- a/src/lib/formats/dmk_dsk.h
+++ b/src/lib/formats/dmk_dsk.h
@@ -20,8 +20,8 @@ class dmk_format : public floppy_image_format_t
public:
dmk_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual const char *name() const override;
diff --git a/src/lib/formats/dsk_dsk.cpp b/src/lib/formats/dsk_dsk.cpp
index 528f30c24be..a4b498f47b2 100644
--- a/src/lib/formats/dsk_dsk.cpp
+++ b/src/lib/formats/dsk_dsk.cpp
@@ -23,7 +23,7 @@ struct dskdsk_tag
int heads;
int tracks;
int sector_size;
- UINT64 track_offsets[84*2]; /* offset within data for each track */
+ uint64_t track_offsets[84*2]; /* offset within data for each track */
};
@@ -39,7 +39,7 @@ static struct dskdsk_tag *get_tag(floppy_image_legacy *floppy)
FLOPPY_IDENTIFY( dsk_dsk_identify )
{
- UINT8 header[8];
+ uint8_t header[8];
floppy_image_read(floppy, header, 0, 8);
if ( memcmp( header, MV_CPC, 8 ) ==0) {
@@ -63,17 +63,17 @@ static int dsk_get_tracks_per_disk(floppy_image_legacy *floppy)
return get_tag(floppy)->tracks;
}
-static UINT64 dsk_get_track_offset(floppy_image_legacy *floppy, int head, int track)
+static uint64_t dsk_get_track_offset(floppy_image_legacy *floppy, int head, int track)
{
return get_tag(floppy)->track_offsets[(track<<1) + head];
}
-static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, UINT64 *offset)
+static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, uint64_t *offset)
{
- UINT64 offs;
- UINT64 track_offset;
- UINT8 track_info[0x100];
- UINT8 sectors_per_track;
+ uint64_t offs;
+ uint64_t track_offset;
+ uint8_t track_info[0x100];
+ uint8_t sectors_per_track;
int i;
/* translate the sector to a raw sector */
@@ -113,7 +113,7 @@ static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, in
static floperr_t internal_dsk_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen)
{
- UINT64 offset;
+ uint64_t offset;
floperr_t err;
err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
if (err)
@@ -126,7 +126,7 @@ static floperr_t internal_dsk_read_sector(floppy_image_legacy *floppy, int head,
static floperr_t internal_dsk_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, const void *buffer, size_t buflen, int ddam)
{
- UINT64 offset;
+ uint64_t offset;
floperr_t err;
err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
@@ -159,7 +159,7 @@ static floperr_t dsk_write_indexed_sector(floppy_image_legacy *floppy, int head,
return internal_dsk_write_sector(floppy, head, track, sector, TRUE, buffer, buflen, ddam);
}
-static floperr_t dsk_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
+static floperr_t dsk_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
{
floperr_t err;
err = get_offset(floppy, head, track, sector, FALSE, nullptr);
@@ -172,11 +172,11 @@ static floperr_t dsk_get_sector_length(floppy_image_legacy *floppy, int head, in
return FLOPPY_ERROR_SUCCESS;
}
-static floperr_t dsk_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags)
+static floperr_t dsk_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags)
{
floperr_t retVal;
- UINT64 offset;
- UINT8 sector_info[0x100];
+ uint64_t offset;
+ uint8_t sector_info[0x100];
int pos;
retVal = get_offset(floppy, head, track, sector_index, FALSE, nullptr);
@@ -202,8 +202,8 @@ FLOPPY_CONSTRUCT( dsk_dsk_construct )
{
struct FloppyCallbacks *callbacks;
struct dskdsk_tag *tag;
- UINT8 header[0x100];
- UINT64 tmp = 0;
+ uint8_t header[0x100];
+ uint64_t tmp = 0;
int i;
int skip,cnt;
@@ -216,8 +216,8 @@ FLOPPY_CONSTRUCT( dsk_dsk_construct )
floppy_image_read(floppy, header, 0, 0x100);
#ifdef SPOT_DUPLICATES
// this allow to spot .dsk files with same data and different headers, making easier to debug softlists.
- UINT32 temp_size = floppy_image_size(floppy);
- UINT8 tmp_copy[temp_size - 0x100];
+ uint32_t temp_size = floppy_image_size(floppy);
+ uint8_t tmp_copy[temp_size - 0x100];
floppy_image_read(floppy,tmp_copy,0x100,temp_size - 0x100);
printf("CRC16: %d\n", ccitt_crc16(0xffff, tmp_copy, temp_size - 0x100));
#endif
@@ -295,9 +295,9 @@ bool dsk_format::supports_save() const
return false;
}
-int dsk_format::identify(io_generic *io, UINT32 form_factor)
+int dsk_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 header[16];
+ uint8_t header[16];
io_generic_read(io, &header, 0, sizeof(header));
if ( memcmp( header, DSK_FORMAT_HEADER, 8 ) ==0) {
@@ -314,38 +314,38 @@ int dsk_format::identify(io_generic *io, UINT32 form_factor)
struct track_header
{
- UINT8 headertag[13];
- UINT16 unused1;
- UINT8 unused1b;
- UINT8 track_number;
- UINT8 side_number;
- UINT8 datarate;
- UINT8 rec_mode;
- UINT8 sector_size_code;
- UINT8 number_of_sector;
- UINT8 gap3_length;
- UINT8 filler_byte;
+ uint8_t headertag[13];
+ uint16_t unused1;
+ uint8_t unused1b;
+ uint8_t track_number;
+ uint8_t side_number;
+ uint8_t datarate;
+ uint8_t rec_mode;
+ uint8_t sector_size_code;
+ uint8_t number_of_sector;
+ uint8_t gap3_length;
+ uint8_t filler_byte;
};
struct sector_header
{
- UINT8 track;
- UINT8 side;
- UINT8 sector_id;
- UINT8 sector_size_code;
- UINT8 fdc_status_reg1;
- UINT8 fdc_status_reg2;
- UINT16 data_length;
+ uint8_t track;
+ uint8_t side;
+ uint8_t sector_id;
+ uint8_t sector_size_code;
+ uint8_t fdc_status_reg1;
+ uint8_t fdc_status_reg2;
+ uint16_t data_length;
};
#pragma pack()
-bool dsk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool dsk_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 header[0x100];
+ uint8_t header[0x100];
bool extendformat = false;
- UINT64 image_size = io_generic_size(io);
+ uint64_t image_size = io_generic_size(io);
io_generic_read(io, &header, 0, sizeof(header));
if ( memcmp( header, EXT_FORMAT_HEADER, 16 ) ==0) {
@@ -358,7 +358,7 @@ bool dsk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
skip = 2;
}
int tracks = header[0x30];
- UINT64 track_offsets[84*2];
+ uint64_t track_offsets[84*2];
int cnt =0;
if (!extendformat) {
int tmp = 0x100;
@@ -395,7 +395,7 @@ bool dsk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
track_header tr;
io_generic_read(io, &tr,track_offsets[(track<<1)+side],sizeof(tr));
desc_pc_sector sects[256];
- UINT8 sect_data[65536];
+ uint8_t sect_data[65536];
int sdatapos = 0;
int pos = track_offsets[(track<<1)+side] + 0x100;
for(int j=0;j<tr.number_of_sector;j++) {
diff --git a/src/lib/formats/dsk_dsk.h b/src/lib/formats/dsk_dsk.h
index fc27c0c5030..61af930fdb5 100644
--- a/src/lib/formats/dsk_dsk.h
+++ b/src/lib/formats/dsk_dsk.h
@@ -18,8 +18,8 @@ class dsk_format : public floppy_image_format_t
public:
dsk_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual const char *name() const override;
virtual const char *description() const override;
diff --git a/src/lib/formats/esq16_dsk.cpp b/src/lib/formats/esq16_dsk.cpp
index 517bb756577..1f6e86f295f 100644
--- a/src/lib/formats/esq16_dsk.cpp
+++ b/src/lib/formats/esq16_dsk.cpp
@@ -71,14 +71,14 @@ bool esqimg_format::supports_save() const
return true;
}
-void esqimg_format::find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 &sector_count)
+void esqimg_format::find_size(io_generic *io, uint8_t &track_count, uint8_t &head_count, uint8_t &sector_count)
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
track_count = 80;
head_count = 2;
sector_count = 10;
- UINT32 expected_size = 512 * track_count*head_count*sector_count;
+ uint32_t expected_size = 512 * track_count*head_count*sector_count;
if (size == expected_size)
{
return;
@@ -87,9 +87,9 @@ void esqimg_format::find_size(io_generic *io, UINT8 &track_count, UINT8 &head_co
track_count = head_count = sector_count = 0;
}
-int esqimg_format::identify(io_generic *io, UINT32 form_factor)
+int esqimg_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 track_count, head_count, sector_count;
+ uint8_t track_count, head_count, sector_count;
find_size(io, track_count, head_count, sector_count);
if(track_count)
@@ -97,12 +97,12 @@ int esqimg_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool esqimg_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool esqimg_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 track_count, head_count, sector_count;
+ uint8_t track_count, head_count, sector_count;
find_size(io, track_count, head_count, sector_count);
- UINT8 sectdata[10*512];
+ uint8_t sectdata[10*512];
desc_s sectors[10];
for(int i=0; i<sector_count; i++) {
sectors[i].data = sectdata + 512*i;
@@ -138,7 +138,7 @@ bool esqimg_format::save(io_generic *io, floppy_image *image)
if(sector_count != 10)
sector_count = 10;
- UINT8 sectdata[11*512];
+ uint8_t sectdata[11*512];
int track_size = sector_count*512;
for(int track=0; track < track_count; track++) {
diff --git a/src/lib/formats/esq16_dsk.h b/src/lib/formats/esq16_dsk.h
index 696db98345c..76c210fd60d 100644
--- a/src/lib/formats/esq16_dsk.h
+++ b/src/lib/formats/esq16_dsk.h
@@ -20,8 +20,8 @@ class esqimg_format : public floppy_image_format_t
public:
esqimg_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual const char *name() const override;
@@ -32,7 +32,7 @@ public:
static const desc_e esq_10_desc[];
private:
- void find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 &sector_count);
+ void find_size(io_generic *io, uint8_t &track_count, uint8_t &head_count, uint8_t &sector_count);
};
extern const floppy_format_type FLOPPY_ESQIMG_FORMAT;
diff --git a/src/lib/formats/esq8_dsk.cpp b/src/lib/formats/esq8_dsk.cpp
index f887cba8951..c575fe0db2f 100644
--- a/src/lib/formats/esq8_dsk.cpp
+++ b/src/lib/formats/esq8_dsk.cpp
@@ -75,7 +75,7 @@ bool esq8img_format::supports_save() const
void esq8img_format::find_size(io_generic *io, int &track_count, int &head_count, int &sector_count)
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
track_count = 80;
head_count = 1;
sector_count = 6;
@@ -88,7 +88,7 @@ void esq8img_format::find_size(io_generic *io, int &track_count, int &head_count
track_count = head_count = sector_count = 0;
}
-int esq8img_format::identify(io_generic *io, UINT32 form_factor)
+int esq8img_format::identify(io_generic *io, uint32_t form_factor)
{
int track_count, head_count, sector_count;
find_size(io, track_count, head_count, sector_count);
@@ -98,12 +98,12 @@ int esq8img_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool esq8img_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool esq8img_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
int track_count, head_count, sector_count;
find_size(io, track_count, head_count, sector_count);
- UINT8 sectdata[(5*1024) + 512];
+ uint8_t sectdata[(5*1024) + 512];
desc_s sectors[6];
for(int i=0; i<sector_count; i++) {
if (i < 5)
@@ -151,7 +151,7 @@ bool esq8img_format::save(io_generic *io, floppy_image *image)
if(sector_count != 6)
sector_count = 6;
- UINT8 sectdata[10*512];
+ uint8_t sectdata[10*512];
int track_size = (5*1024) + 512;
for(int track=0; track < track_count; track++) {
diff --git a/src/lib/formats/esq8_dsk.h b/src/lib/formats/esq8_dsk.h
index 5fb998bf3b0..d5925805f30 100644
--- a/src/lib/formats/esq8_dsk.h
+++ b/src/lib/formats/esq8_dsk.h
@@ -22,8 +22,8 @@ class esq8img_format : public floppy_image_format_t
public:
esq8img_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual const char *name() const override;
diff --git a/src/lib/formats/fc100_cas.cpp b/src/lib/formats/fc100_cas.cpp
index 48f2373dc19..5004da147d3 100644
--- a/src/lib/formats/fc100_cas.cpp
+++ b/src/lib/formats/fc100_cas.cpp
@@ -23,7 +23,7 @@ it's all a guess.
// image size
static int fc100_image_size;
-static int fc100_put_samples(INT16 *buffer, int sample_pos, int count, int level)
+static int fc100_put_samples(int16_t *buffer, int sample_pos, int count, int level)
{
if (buffer)
{
@@ -34,7 +34,7 @@ static int fc100_put_samples(INT16 *buffer, int sample_pos, int count, int level
return count;
}
-static int fc100_output_bit(INT16 *buffer, int sample_pos, bool bit)
+static int fc100_output_bit(int16_t *buffer, int sample_pos, bool bit)
{
int samples = 0;
@@ -54,10 +54,10 @@ static int fc100_output_bit(INT16 *buffer, int sample_pos, bool bit)
return samples;
}
-static int fc100_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
+static int fc100_output_byte(int16_t *buffer, int sample_pos, uint8_t byte)
{
int samples = 0;
- UINT8 i;
+ uint8_t i;
/* start */
samples += fc100_output_bit (buffer, sample_pos + samples, 0);
@@ -73,11 +73,11 @@ static int fc100_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
return samples;
}
-static int fc100_handle_cassette(INT16 *buffer, const UINT8 *bytes)
+static int fc100_handle_cassette(int16_t *buffer, const uint8_t *bytes)
{
- UINT32 sample_count = 0;
- UINT32 byte_count = 0;
- UINT32 i;
+ uint32_t sample_count = 0;
+ uint32_t byte_count = 0;
+ uint32_t i;
/* start */
@@ -106,7 +106,7 @@ static int fc100_handle_cassette(INT16 *buffer, const UINT8 *bytes)
Generate samples for the tape image
********************************************************************/
-static int fc100_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int fc100_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
return fc100_handle_cassette(buffer, bytes);
}
@@ -115,7 +115,7 @@ static int fc100_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
Calculate the number of samples needed for this tape image
********************************************************************/
-static int fc100_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int fc100_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
{
fc100_image_size = length;
diff --git a/src/lib/formats/fdd_dsk.cpp b/src/lib/formats/fdd_dsk.cpp
index 46aa8976605..5e34c4ad7df 100644
--- a/src/lib/formats/fdd_dsk.cpp
+++ b/src/lib/formats/fdd_dsk.cpp
@@ -54,9 +54,9 @@ const char *fdd_format::extensions() const
return "fdd";
}
-int fdd_format::identify(io_generic *io, UINT32 form_factor)
+int fdd_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 h[7];
+ uint8_t h[7];
io_generic_read(io, h, 0, 7);
if (strncmp((const char *)h, "VFD1.0", 6) == 0)
@@ -65,18 +65,18 @@ int fdd_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool fdd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool fdd_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 hsec[0x0c];
+ uint8_t hsec[0x0c];
// sector map
- UINT8 num_secs[160];
- UINT8 tracks[160 * 26];
- UINT8 heads[160 * 26];
- UINT8 secs[160 * 26];
- UINT8 fill_vals[160 * 26];
- UINT32 sec_offs[160 * 26];
- UINT8 sec_sizes[160 * 26];
+ uint8_t num_secs[160];
+ uint8_t tracks[160 * 26];
+ uint8_t heads[160 * 26];
+ uint8_t secs[160 * 26];
+ uint8_t fill_vals[160 * 26];
+ uint32_t sec_offs[160 * 26];
+ uint8_t sec_sizes[160 * 26];
int pos = 0xdc;
@@ -97,7 +97,7 @@ bool fdd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
secs[(track * 26) + sect] = hsec[2];
sec_sizes[(track * 26) + sect] = hsec[3];
fill_vals[(track * 26) + sect] = hsec[4];
- sec_offs[(track * 26) + sect] = little_endianize_int32(*(UINT32 *)(hsec + 0x08));
+ sec_offs[(track * 26) + sect] = little_endianize_int32(*(uint32_t *)(hsec + 0x08));
curr_track_size += (128 << hsec[3]);
curr_num_sec++;
@@ -107,7 +107,7 @@ bool fdd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
int cell_count = form_factor == floppy_image::FF_35 ? 200000 : 166666;
desc_pc_sector sects[256];
- UINT8 sect_data[65536];
+ uint8_t sect_data[65536];
int cur_sec_map = 0, sector_size;
for (int track = 0; track < 160; track++)
diff --git a/src/lib/formats/fdd_dsk.h b/src/lib/formats/fdd_dsk.h
index 6a7faa57669..f73e18cd696 100644
--- a/src/lib/formats/fdd_dsk.h
+++ b/src/lib/formats/fdd_dsk.h
@@ -19,8 +19,8 @@ class fdd_format : public floppy_image_format_t
public:
fdd_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual const char *name() const override;
virtual const char *description() const override;
diff --git a/src/lib/formats/fdi_dsk.cpp b/src/lib/formats/fdi_dsk.cpp
index b766671ecb8..c703f29cc69 100644
--- a/src/lib/formats/fdi_dsk.cpp
+++ b/src/lib/formats/fdi_dsk.cpp
@@ -86,45 +86,45 @@ struct fdidsk_tag
int version;
int heads; /* number of physical heads */
int tracks; /* number of physical tracks */
- UINT32 track_offset[MAX_TRACKS]; /* offset within data for each track */
- UINT8 track_type[MAX_TRACKS];
+ uint32_t track_offset[MAX_TRACKS]; /* offset within data for each track */
+ uint8_t track_type[MAX_TRACKS];
};
struct fdi_track
{
- UINT8 type;
- UINT8 size;
+ uint8_t type;
+ uint8_t size;
};
struct fdi_header
{
- UINT8 signature[27];
- UINT8 creator[32];
- UINT8 comment[80];
- UINT8 eof;
- UINT8 version[2];
- UINT8 ltrack[2];
- UINT8 lhead;
- UINT8 type;
- UINT8 rotspeed;
- UINT8 flags;
- UINT8 tpi;
- UINT8 headwidth;
- UINT8 reserved[2];
+ uint8_t signature[27];
+ uint8_t creator[32];
+ uint8_t comment[80];
+ uint8_t eof;
+ uint8_t version[2];
+ uint8_t ltrack[2];
+ uint8_t lhead;
+ uint8_t type;
+ uint8_t rotspeed;
+ uint8_t flags;
+ uint8_t tpi;
+ uint8_t headwidth;
+ uint8_t reserved[2];
struct fdi_track track[MAX_TRACKS];
};
struct fdi_pulse_track_header
{
- UINT8 numpulses[4];
- UINT8 averagesz[3];
- UINT8 minsize[3];
- UINT8 maxsize[3];
- UINT8 indexsize[3];
-// UINT8 averagedt[averagesz];
-// UINT8 mindata[minsize];
-// UINT8 maxdata[maxsize];
-// UINT8 indexdata[indexsize];
+ uint8_t numpulses[4];
+ uint8_t averagesz[3];
+ uint8_t minsize[3];
+ uint8_t maxsize[3];
+ uint8_t indexsize[3];
+// uint8_t averagedt[averagesz];
+// uint8_t mindata[minsize];
+// uint8_t maxdata[maxsize];
+// uint8_t indexdata[indexsize];
};
/***************************************************************************
@@ -155,22 +155,22 @@ static int fdi_get_sectors_per_track(floppy_image_legacy *floppy, int head, int
return 0;
}
-static floperr_t fdi_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
+static floperr_t fdi_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
{
return FLOPPY_ERROR_SUCCESS;
}
/*
-static UINT32 fdi_get_sector_offset(floppy_image_legacy* floppy, int head, int track, int sector)
+static uint32_t fdi_get_sector_offset(floppy_image_legacy* floppy, int head, int track, int sector)
{
return 0;
}
*/
-static floperr_t fdi_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags)
+static floperr_t fdi_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags)
{
return FLOPPY_ERROR_UNSUPPORTED;
}
-static floperr_t fdi_read_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, void *buffer, size_t buflen)
+static floperr_t fdi_read_track(floppy_image_legacy *floppy, int head, int track, uint64_t offset, void *buffer, size_t buflen)
{
return FLOPPY_ERROR_UNSUPPORTED;
}
@@ -201,7 +201,7 @@ static floperr_t fdi_write_indexed_sector(floppy_image_legacy *floppy, int head,
FLOPPY_IDENTIFY( fdi_dsk_identify )
{
- UINT8 header[25];
+ uint8_t header[25];
floppy_image_read(floppy, header, 0, 25);
@@ -261,7 +261,7 @@ FLOPPY_CONSTRUCT( fdi_dsk_construct )
for (int track = 0; track < tag->tracks; track++)
{
- UINT8 type = header.track[track].type;
+ uint8_t type = header.track[track].type;
int size = header.track[track].size * 256;
if (LOG) LOG_FORMATS("FDI track %d type %02x size %d offset %d\n", track, type, size, offset);
diff --git a/src/lib/formats/flex_dsk.cpp b/src/lib/formats/flex_dsk.cpp
index ced4bf2f8a5..fb7dfb1499b 100644
--- a/src/lib/formats/flex_dsk.cpp
+++ b/src/lib/formats/flex_dsk.cpp
@@ -33,7 +33,7 @@ bool flex_format::supports_save() const
return true;
}
-int flex_format::identify(io_generic *io, UINT32 form_factor)
+int flex_format::identify(io_generic *io, uint32_t form_factor)
{
io_generic_read(io, &info, 256 * 2, sizeof(struct sysinfo_sector));
@@ -45,7 +45,7 @@ int flex_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool flex_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool flex_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
int spt = info.last_sec;
int bps = 256;
@@ -76,7 +76,7 @@ bool flex_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
for(int head=0;head < head_num;head++)
{
desc_pc_sector sects[80];
- UINT8 sect_data[20000];
+ uint8_t sect_data[20000];
int sdatapos = 0;
for(int i=0; i<spt; i++)
{
diff --git a/src/lib/formats/flex_dsk.h b/src/lib/formats/flex_dsk.h
index bade0115c56..c40e0fbda15 100644
--- a/src/lib/formats/flex_dsk.h
+++ b/src/lib/formats/flex_dsk.h
@@ -18,28 +18,28 @@ public:
virtual const char *name() const override;
virtual const char *description() const override;
virtual const char *extensions() const override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool supports_save() const override;
private:
struct sysinfo_sector
{
- UINT8 unused1[16];
- UINT8 disk_name[8];
- UINT8 disk_ext[3];
- UINT8 disk_number[2];
- UINT8 fc_start_trk;
- UINT8 fc_start_sec;
- UINT8 fc_end_trk;
- UINT8 fc_end_sec;
- UINT8 free[2];
- UINT8 month;
- UINT8 day;
- UINT8 year;
- UINT8 last_trk;
- UINT8 last_sec;
- UINT8 unused2[216];
+ uint8_t unused1[16];
+ uint8_t disk_name[8];
+ uint8_t disk_ext[3];
+ uint8_t disk_number[2];
+ uint8_t fc_start_trk;
+ uint8_t fc_start_sec;
+ uint8_t fc_end_trk;
+ uint8_t fc_end_sec;
+ uint8_t free[2];
+ uint8_t month;
+ uint8_t day;
+ uint8_t year;
+ uint8_t last_trk;
+ uint8_t last_sec;
+ uint8_t unused2[216];
} info;
};
diff --git a/src/lib/formats/flopimg.cpp b/src/lib/formats/flopimg.cpp
index 72786f6422e..c924050ac08 100644
--- a/src/lib/formats/flopimg.cpp
+++ b/src/lib/formats/flopimg.cpp
@@ -36,10 +36,10 @@ struct floppy_image_legacy
/* loaded track stuff */
int loaded_track_head;
int loaded_track_index;
- UINT32 loaded_track_size;
+ uint32_t loaded_track_size;
void *loaded_track_data;
- UINT8 loaded_track_status;
- UINT8 flags;
+ uint8_t loaded_track_status;
+ uint8_t flags;
/* tagging system */
object_pool *tags;
@@ -89,7 +89,7 @@ static floppy_image_legacy *floppy_init(void *fp, const struct io_procs *procs,
floppy->io.file = fp;
floppy->io.procs = procs;
floppy->io.filler = 0xFF;
- floppy->flags = (UINT8) flags;
+ floppy->flags = (uint8_t) flags;
return floppy;
}
@@ -337,14 +337,14 @@ void *floppy_create_tag(floppy_image_legacy *floppy, size_t tagsize)
-UINT8 floppy_get_filler(floppy_image_legacy *floppy)
+uint8_t floppy_get_filler(floppy_image_legacy *floppy)
{
return floppy->io.filler;
}
-void floppy_set_filler(floppy_image_legacy *floppy, UINT8 filler)
+void floppy_set_filler(floppy_image_legacy *floppy, uint8_t filler)
{
floppy->io.filler = filler;
}
@@ -355,28 +355,28 @@ void floppy_set_filler(floppy_image_legacy *floppy, UINT8 filler)
calls for accessing the raw disk image
*********************************************************************/
-void floppy_image_read(floppy_image_legacy *floppy, void *buffer, UINT64 offset, size_t length)
+void floppy_image_read(floppy_image_legacy *floppy, void *buffer, uint64_t offset, size_t length)
{
io_generic_read(&floppy->io, buffer, offset, length);
}
-void floppy_image_write(floppy_image_legacy *floppy, const void *buffer, UINT64 offset, size_t length)
+void floppy_image_write(floppy_image_legacy *floppy, const void *buffer, uint64_t offset, size_t length)
{
io_generic_write(&floppy->io, buffer, offset, length);
}
-void floppy_image_write_filler(floppy_image_legacy *floppy, UINT8 filler, UINT64 offset, size_t length)
+void floppy_image_write_filler(floppy_image_legacy *floppy, uint8_t filler, uint64_t offset, size_t length)
{
io_generic_write_filler(&floppy->io, filler, offset, length);
}
-UINT64 floppy_image_size(floppy_image_legacy *floppy)
+uint64_t floppy_image_size(floppy_image_legacy *floppy)
{
return io_generic_size(&floppy->io);
}
@@ -393,9 +393,9 @@ static floperr_t floppy_readwrite_sector(floppy_image_legacy *floppy, int head,
floperr_t err;
const struct FloppyCallbacks *fmt;
size_t this_buffer_len;
- std::vector<UINT8> alloc_buf;
- UINT32 sector_length;
- UINT8 *buffer_ptr = (UINT8 *)buffer;
+ std::vector<uint8_t> alloc_buf;
+ uint32_t sector_length;
+ uint8_t *buffer_ptr = (uint8_t *)buffer;
floperr_t (*read_sector)(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen);
floperr_t (*write_sector)(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam);
@@ -532,7 +532,7 @@ floperr_t floppy_write_indexed_sector(floppy_image_legacy *floppy, int head, int
}
-static floperr_t floppy_get_track_data_offset(floppy_image_legacy *floppy, int head, int track, UINT64 *offset)
+static floperr_t floppy_get_track_data_offset(floppy_image_legacy *floppy, int head, int track, uint64_t *offset)
{
floperr_t err;
const struct FloppyCallbacks *callbacks;
@@ -550,7 +550,7 @@ static floperr_t floppy_get_track_data_offset(floppy_image_legacy *floppy, int h
-static floperr_t floppy_read_track_offset(floppy_image_legacy *floppy, int head, int track, UINT64 offset, void *buffer, size_t buffer_len)
+static floperr_t floppy_read_track_offset(floppy_image_legacy *floppy, int head, int track, uint64_t offset, void *buffer, size_t buffer_len)
{
floperr_t err;
const struct FloppyCallbacks *format;
@@ -583,7 +583,7 @@ floperr_t floppy_read_track(floppy_image_legacy *floppy, int head, int track, vo
floperr_t floppy_read_track_data(floppy_image_legacy *floppy, int head, int track, void *buffer, size_t buffer_len)
{
floperr_t err;
- UINT64 offset;
+ uint64_t offset;
err = floppy_get_track_data_offset(floppy, head, track, &offset);
if (err)
@@ -594,7 +594,7 @@ floperr_t floppy_read_track_data(floppy_image_legacy *floppy, int head, int trac
-static floperr_t floppy_write_track_offset(floppy_image_legacy *floppy, int head, int track, UINT64 offset, const void *buffer, size_t buffer_len)
+static floperr_t floppy_write_track_offset(floppy_image_legacy *floppy, int head, int track, uint64_t offset, const void *buffer, size_t buffer_len)
{
floperr_t err;
@@ -629,7 +629,7 @@ floperr_t floppy_write_track(floppy_image_legacy *floppy, int head, int track, c
floperr_t floppy_write_track_data(floppy_image_legacy *floppy, int head, int track, const void *buffer, size_t buffer_len)
{
floperr_t err;
- UINT64 offset;
+ uint64_t offset;
err = floppy_get_track_data_offset(floppy, head, track, &offset);
if (err)
@@ -690,7 +690,7 @@ int floppy_get_heads_per_disk(floppy_image_legacy *floppy)
-UINT32 floppy_get_track_size(floppy_image_legacy *floppy, int head, int track)
+uint32_t floppy_get_track_size(floppy_image_legacy *floppy, int head, int track)
{
const struct FloppyCallbacks *fmt;
@@ -703,7 +703,7 @@ UINT32 floppy_get_track_size(floppy_image_legacy *floppy, int head, int track)
-floperr_t floppy_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
+floperr_t floppy_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
{
const struct FloppyCallbacks *fmt;
@@ -716,7 +716,7 @@ floperr_t floppy_get_sector_length(floppy_image_legacy *floppy, int head, int tr
-floperr_t floppy_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags)
+floperr_t floppy_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags)
{
const struct FloppyCallbacks *fmt;
@@ -758,7 +758,7 @@ int floppy_is_read_only(floppy_image_legacy *floppy)
-UINT8 floppy_random_byte(floppy_image_legacy *floppy)
+uint8_t floppy_random_byte(floppy_image_legacy *floppy)
{
/* can't use mame_rand(); this might not be in the core */
#ifdef rand
@@ -777,7 +777,7 @@ floperr_t floppy_load_track(floppy_image_legacy *floppy, int head, int track, in
{
floperr_t err;
void *new_loaded_track_data;
- UINT32 track_size;
+ uint32_t track_size;
/* have we already loaded this track? */
if (((floppy->loaded_track_status & TRACK_LOADED) == 0) || (head != floppy->loaded_track_head) || (track != floppy->loaded_track_index))
@@ -892,7 +892,7 @@ LEGACY_FLOPPY_OPTIONS_END
****************************************************************************/
-floppy_image::floppy_image(int _tracks, int _heads, UINT32 _form_factor)
+floppy_image::floppy_image(int _tracks, int _heads, uint32_t _form_factor)
{
tracks = _tracks;
heads = _heads;
@@ -952,7 +952,7 @@ int floppy_image::get_resolution() const
return 0;
}
-const char *floppy_image::get_variant_name(UINT32 form_factor, UINT32 variant)
+const char *floppy_image::get_variant_name(uint32_t form_factor, uint32_t variant)
{
switch(variant) {
case SSSD: return "Single side, single density";
@@ -1105,42 +1105,42 @@ int floppy_image_format_t::crc_cells_size(int type) const
}
}
-bool floppy_image_format_t::bit_r(const std::vector<UINT32> &buffer, int offset)
+bool floppy_image_format_t::bit_r(const std::vector<uint32_t> &buffer, int offset)
{
return (buffer[offset] & floppy_image::MG_MASK) == MG_1;
}
-UINT32 floppy_image_format_t::bitn_r(const std::vector<UINT32> &buffer, int offset, int count)
+uint32_t floppy_image_format_t::bitn_r(const std::vector<uint32_t> &buffer, int offset, int count)
{
- UINT32 r = 0;
+ uint32_t r = 0;
for(int i=0; i<count; i++)
- r = (r << 1) | (UINT32) bit_r(buffer, offset+i);
+ r = (r << 1) | (uint32_t) bit_r(buffer, offset+i);
return r;
}
-void floppy_image_format_t::bit_w(std::vector<UINT32> &buffer, bool val, UINT32 size, int offset)
+void floppy_image_format_t::bit_w(std::vector<uint32_t> &buffer, bool val, uint32_t size, int offset)
{
buffer[offset] = (val ? MG_1 : MG_0) | size;
}
-void floppy_image_format_t::bit_w(std::vector<UINT32> &buffer, bool val, UINT32 size)
+void floppy_image_format_t::bit_w(std::vector<uint32_t> &buffer, bool val, uint32_t size)
{
buffer.push_back((val ? MG_1 : MG_0) | size);
}
-void floppy_image_format_t::raw_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size)
+void floppy_image_format_t::raw_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size)
{
for(int i=n-1; i>=0; i--)
bit_w(buffer, (val >> i) & 1, size);
}
-void floppy_image_format_t::raw_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size, int offset)
+void floppy_image_format_t::raw_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size, int offset)
{
for(int i=n-1; i>=0; i--)
bit_w(buffer, (val >> i) & 1, size, offset++);
}
-void floppy_image_format_t::mfm_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size)
+void floppy_image_format_t::mfm_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size)
{
int prec = buffer.empty() ? 0 : bit_r(buffer, buffer.size()-1);
for(int i=n-1; i>=0; i--) {
@@ -1151,7 +1151,7 @@ void floppy_image_format_t::mfm_w(std::vector<UINT32> &buffer, int n, UINT32 val
}
}
-void floppy_image_format_t::mfm_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size, int offset)
+void floppy_image_format_t::mfm_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size, int offset)
{
int prec = offset ? bit_r(buffer, offset-1) : 0;
for(int i=n-1; i>=0; i--) {
@@ -1162,7 +1162,7 @@ void floppy_image_format_t::mfm_w(std::vector<UINT32> &buffer, int n, UINT32 val
}
}
-void floppy_image_format_t::fm_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size)
+void floppy_image_format_t::fm_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size)
{
for(int i=n-1; i>=0; i--) {
int bit = (val >> i) & 1;
@@ -1171,7 +1171,7 @@ void floppy_image_format_t::fm_w(std::vector<UINT32> &buffer, int n, UINT32 val,
}
}
-void floppy_image_format_t::fm_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size, int offset)
+void floppy_image_format_t::fm_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size, int offset)
{
for(int i=n-1; i>=0; i--) {
int bit = (val >> i) & 1;
@@ -1180,7 +1180,7 @@ void floppy_image_format_t::fm_w(std::vector<UINT32> &buffer, int n, UINT32 val,
}
}
-void floppy_image_format_t::mfm_half_w(std::vector<UINT32> &buffer, int start_bit, UINT32 val, UINT32 size)
+void floppy_image_format_t::mfm_half_w(std::vector<uint32_t> &buffer, int start_bit, uint32_t val, uint32_t size)
{
int prec = buffer.empty() ? 0 : bit_r(buffer, buffer.size()-1);
for(int i=start_bit; i>=0; i-=2) {
@@ -1191,23 +1191,23 @@ void floppy_image_format_t::mfm_half_w(std::vector<UINT32> &buffer, int start_bi
}
}
-void floppy_image_format_t::gcr5_w(std::vector<UINT32> &buffer, UINT8 val, UINT32 size)
+void floppy_image_format_t::gcr5_w(std::vector<uint32_t> &buffer, uint8_t val, uint32_t size)
{
- UINT32 e0 = gcr5fw_tb[val >> 4];
- UINT32 e1 = gcr5fw_tb[val & 0x0f];
+ uint32_t e0 = gcr5fw_tb[val >> 4];
+ uint32_t e1 = gcr5fw_tb[val & 0x0f];
raw_w(buffer, 5, e0, size);
raw_w(buffer, 5, e1, size);
}
-void floppy_image_format_t::gcr5_w(std::vector<UINT32> &buffer, UINT8 val, UINT32 size, int offset)
+void floppy_image_format_t::gcr5_w(std::vector<uint32_t> &buffer, uint8_t val, uint32_t size, int offset)
{
- UINT32 e0 = gcr5fw_tb[val >> 4];
- UINT32 e1 = gcr5fw_tb[val & 0x0f];
+ uint32_t e0 = gcr5fw_tb[val >> 4];
+ uint32_t e1 = gcr5fw_tb[val & 0x0f];
raw_w(buffer, 5, e0, size, offset);
raw_w(buffer, 5, e1, size, offset+5);
}
-void floppy_image_format_t::_8n1_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size)
+void floppy_image_format_t::_8n1_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size)
{
bit_w(buffer, 0, size);
for(int i=n-1; i>=0; i--) {
@@ -1217,9 +1217,9 @@ void floppy_image_format_t::_8n1_w(std::vector<UINT32> &buffer, int n, UINT32 va
bit_w(buffer, 1, size);
}
-void floppy_image_format_t::fixup_crc_amiga(std::vector<UINT32> &buffer, const gen_crc_info *crc)
+void floppy_image_format_t::fixup_crc_amiga(std::vector<uint32_t> &buffer, const gen_crc_info *crc)
{
- UINT16 res = 0;
+ uint16_t res = 0;
int size = crc->end - crc->start;
for(int i=1; i<size; i+=2)
if(bit_r(buffer, crc->start + i))
@@ -1228,9 +1228,9 @@ void floppy_image_format_t::fixup_crc_amiga(std::vector<UINT32> &buffer, const g
mfm_w(buffer, 16, res, 1000, crc->write+32);
}
-void floppy_image_format_t::fixup_crc_cbm(std::vector<UINT32> &buffer, const gen_crc_info *crc)
+void floppy_image_format_t::fixup_crc_cbm(std::vector<uint32_t> &buffer, const gen_crc_info *crc)
{
- UINT8 v = 0;
+ uint8_t v = 0;
for(int o = crc->start; o < crc->end; o+=10) {
v = v ^ (gcr5bw_tb[bitn_r(buffer, o, 5)] << 4);
v = v ^ gcr5bw_tb[bitn_r(buffer, o+5, 5)];
@@ -1238,9 +1238,9 @@ void floppy_image_format_t::fixup_crc_cbm(std::vector<UINT32> &buffer, const gen
gcr5_w(buffer, v, 1000, crc->write);
}
-UINT16 floppy_image_format_t::calc_crc_ccitt(const std::vector<UINT32> &buffer, int start, int end)
+uint16_t floppy_image_format_t::calc_crc_ccitt(const std::vector<uint32_t> &buffer, int start, int end)
{
- UINT32 res = 0xffff;
+ uint32_t res = 0xffff;
int size = end - start;
for(int i=1; i<size; i+=2) {
res <<= 1;
@@ -1252,47 +1252,47 @@ UINT16 floppy_image_format_t::calc_crc_ccitt(const std::vector<UINT32> &buffer,
return res;
}
-void floppy_image_format_t::fixup_crc_ccitt(std::vector<UINT32> &buffer, const gen_crc_info *crc)
+void floppy_image_format_t::fixup_crc_ccitt(std::vector<uint32_t> &buffer, const gen_crc_info *crc)
{
mfm_w(buffer, 16, calc_crc_ccitt(buffer, crc->start, crc->end), 1000, crc->write);
}
-void floppy_image_format_t::fixup_crc_ccitt_fm(std::vector<UINT32> &buffer, const gen_crc_info *crc)
+void floppy_image_format_t::fixup_crc_ccitt_fm(std::vector<uint32_t> &buffer, const gen_crc_info *crc)
{
fm_w(buffer, 16, calc_crc_ccitt(buffer, crc->start, crc->end), 1000, crc->write);
}
-void floppy_image_format_t::fixup_crc_machead(std::vector<UINT32> &buffer, const gen_crc_info *crc)
+void floppy_image_format_t::fixup_crc_machead(std::vector<uint32_t> &buffer, const gen_crc_info *crc)
{
- UINT8 v = 0;
+ uint8_t v = 0;
for(int o = crc->start; o < crc->end; o+=8)
v = v ^ gcr6bw_tb[bitn_r(buffer, o, 8)];
raw_w(buffer, 8, gcr6fw_tb[v], 1000, crc->write);
}
-void floppy_image_format_t::fixup_crc_fcs(std::vector<UINT32> &buffer, const gen_crc_info *crc)
+void floppy_image_format_t::fixup_crc_fcs(std::vector<uint32_t> &buffer, const gen_crc_info *crc)
{
// TODO
}
-void floppy_image_format_t::fixup_crc_victor_header(std::vector<UINT32> &buffer, const gen_crc_info *crc)
+void floppy_image_format_t::fixup_crc_victor_header(std::vector<uint32_t> &buffer, const gen_crc_info *crc)
{
- UINT8 v = 0;
+ uint8_t v = 0;
for(int o = crc->start; o < crc->end; o+=10)
v += ((gcr5bw_tb[bitn_r(buffer, o, 5)] << 4) | gcr5bw_tb[bitn_r(buffer, o+5, 5)]);
gcr5_w(buffer, v, 1000, crc->write);
}
-void floppy_image_format_t::fixup_crc_victor_data(std::vector<UINT32> &buffer, const gen_crc_info *crc)
+void floppy_image_format_t::fixup_crc_victor_data(std::vector<uint32_t> &buffer, const gen_crc_info *crc)
{
- UINT16 v = 0;
+ uint16_t v = 0;
for(int o = crc->start; o < crc->end; o+=10)
v += ((gcr5bw_tb[bitn_r(buffer, o, 5)] << 4) | gcr5bw_tb[bitn_r(buffer, o+5, 5)]);
gcr5_w(buffer, v & 0xff, 1000, crc->write);
gcr5_w(buffer, v >> 8, 1000, crc->write+10);
}
-void floppy_image_format_t::fixup_crcs(std::vector<UINT32> &buffer, gen_crc_info *crcs)
+void floppy_image_format_t::fixup_crcs(std::vector<uint32_t> &buffer, gen_crc_info *crcs)
{
for(int i=0; i != MAX_CRC_COUNT; i++)
if(crcs[i].write != -1) {
@@ -1314,9 +1314,9 @@ void floppy_image_format_t::fixup_crcs(std::vector<UINT32> &buffer, gen_crc_info
}
}
-UINT32 floppy_image_format_t::gcr6_encode(UINT8 va, UINT8 vb, UINT8 vc)
+uint32_t floppy_image_format_t::gcr6_encode(uint8_t va, uint8_t vb, uint8_t vc)
{
- UINT32 r;
+ uint32_t r;
r = gcr6fw_tb[((va >> 2) & 0x30) | ((vb >> 4) & 0x0c) | ((vc >> 6) & 0x03)] << 24;
r |= gcr6fw_tb[va & 0x3f] << 16;
r |= gcr6fw_tb[vb & 0x3f] << 8;
@@ -1324,7 +1324,7 @@ UINT32 floppy_image_format_t::gcr6_encode(UINT8 va, UINT8 vb, UINT8 vc)
return r;
}
-void floppy_image_format_t::gcr6_decode(UINT8 e0, UINT8 e1, UINT8 e2, UINT8 e3, UINT8 &va, UINT8 &vb, UINT8 &vc)
+void floppy_image_format_t::gcr6_decode(uint8_t e0, uint8_t e1, uint8_t e2, uint8_t e3, uint8_t &va, uint8_t &vb, uint8_t &vc)
{
e0 = gcr6bw_tb[e0];
e1 = gcr6bw_tb[e1];
@@ -1336,12 +1336,12 @@ void floppy_image_format_t::gcr6_decode(UINT8 e0, UINT8 e1, UINT8 e2, UINT8 e3,
vc = ((e0 << 6) & 0xc0) | e3;
}
-UINT16 floppy_image_format_t::gcr4_encode(UINT8 va)
+uint16_t floppy_image_format_t::gcr4_encode(uint8_t va)
{
return (va << 7) | va | 0xaaaa;
}
-UINT8 floppy_image_format_t::gcr4_decode(UINT8 e0, UINT8 e1)
+uint8_t floppy_image_format_t::gcr4_decode(uint8_t e0, uint8_t e1)
{
return ((e0 << 1) & 0xaa) | (e1 & 0x55);
}
@@ -1371,7 +1371,7 @@ int floppy_image_format_t::calc_sector_index(int num, int interleave, int skew,
void floppy_image_format_t::generate_track(const desc_e *desc, int track, int head, const desc_s *sect, int sect_count, int track_size, floppy_image *image)
{
- std::vector<UINT32> buffer;
+ std::vector<uint32_t> buffer;
gen_crc_info crcs[MAX_CRC_COUNT];
collect_crcs(desc, crcs);
@@ -1617,14 +1617,14 @@ void floppy_image_format_t::generate_track(const desc_e *desc, int track, int he
case SECTOR_DATA_MAC: {
const desc_s *csect = sect + (desc[index].p1 >= 0 ? desc[index].p1 : sector_idx);
- const UINT8 *data = csect->data;
+ const uint8_t *data = csect->data;
int size = csect->size;
- UINT8 ca = 0, cb = 0, cc = 0;
+ uint8_t ca = 0, cb = 0, cc = 0;
for(int i=0; i < size; i+=3) {
int dt = size-i;
- UINT8 va = data[i];
- UINT8 vb = dt > 1 ? data[i+1] : 0;
- UINT8 vc = dt > 2 ? data[i+2] : 0;
+ uint8_t va = data[i];
+ uint8_t vb = dt > 1 ? data[i+1] : 0;
+ uint8_t vc = dt > 2 ? data[i+2] : 0;
cc = (cc << 1) | (cc >> 7);
int suma = ca + va + (cc & 1);
@@ -1665,7 +1665,7 @@ void floppy_image_format_t::generate_track(const desc_e *desc, int track, int he
generate_track_from_levels(track, head, buffer, 0, image);
}
-void floppy_image_format_t::normalize_times(std::vector<UINT32> &buffer)
+void floppy_image_format_t::normalize_times(std::vector<uint32_t> &buffer)
{
unsigned int total_sum = 0;
for(unsigned int i=0; i != buffer.size(); i++)
@@ -1673,20 +1673,20 @@ void floppy_image_format_t::normalize_times(std::vector<UINT32> &buffer)
unsigned int current_sum = 0;
for(unsigned int i=0; i != buffer.size(); i++) {
- UINT32 time = buffer[i] & floppy_image::TIME_MASK;
+ uint32_t time = buffer[i] & floppy_image::TIME_MASK;
buffer[i] = (buffer[i] & floppy_image::MG_MASK) | (200000000ULL * current_sum / total_sum);
current_sum += time;
}
}
-void floppy_image_format_t::generate_track_from_bitstream(int track, int head, const UINT8 *trackbuf, int track_size, floppy_image *image, int subtrack)
+void floppy_image_format_t::generate_track_from_bitstream(int track, int head, const uint8_t *trackbuf, int track_size, floppy_image *image, int subtrack)
{
// Maximal number of cells which happens when the buffer is all 1
- std::vector<UINT32> &dest = image->get_buffer(track, head, subtrack);
+ std::vector<uint32_t> &dest = image->get_buffer(track, head, subtrack);
dest.clear();
- UINT32 cbit = floppy_image::MG_A;
- UINT32 count = 0;
+ uint32_t cbit = floppy_image::MG_A;
+ uint32_t count = 0;
for(int i=0; i != track_size; i++)
if(trackbuf[i >> 3] & (0x80 >> (i & 7))) {
dest.push_back(cbit | (count+1));
@@ -1702,11 +1702,11 @@ void floppy_image_format_t::generate_track_from_bitstream(int track, int head, c
image->set_write_splice_position(track, head, 0, subtrack);
}
-void floppy_image_format_t::generate_track_from_levels(int track, int head, std::vector<UINT32> &trackbuf, int splice_pos, floppy_image *image)
+void floppy_image_format_t::generate_track_from_levels(int track, int head, std::vector<uint32_t> &trackbuf, int splice_pos, floppy_image *image)
{
// Retrieve the angular splice pos before messing with the data
splice_pos = splice_pos % trackbuf.size();
- UINT32 splice_angular_pos = trackbuf[splice_pos] & floppy_image::TIME_MASK;
+ uint32_t splice_angular_pos = trackbuf[splice_pos] & floppy_image::TIME_MASK;
// Check if we need to invert a cell to get an even number of
// transitions on the whole track
@@ -1755,14 +1755,14 @@ void floppy_image_format_t::generate_track_from_levels(int track, int head, std:
}
// Maximal number of cells which happens when the buffer is all MG_1/MG_N alternated, which would be 3/2
- std::vector<UINT32> &dest = image->get_buffer(track, head);
+ std::vector<uint32_t> &dest = image->get_buffer(track, head);
dest.clear();
- UINT32 cbit = floppy_image::MG_A;
- UINT32 count = 0;
+ uint32_t cbit = floppy_image::MG_A;
+ uint32_t count = 0;
for(auto & elem : trackbuf) {
- UINT32 bit = elem & floppy_image::MG_MASK;
- UINT32 time = elem & floppy_image::TIME_MASK;
+ uint32_t bit = elem & floppy_image::MG_MASK;
+ uint32_t time = elem & floppy_image::TIME_MASK;
if(bit == MG_0) {
count += time;
continue;
@@ -1786,13 +1786,13 @@ void floppy_image_format_t::generate_track_from_levels(int track, int head, std:
image->set_write_splice_position(track, head, splice_angular_pos);
}
-const UINT8 floppy_image_format_t::gcr5fw_tb[0x10] =
+const uint8_t floppy_image_format_t::gcr5fw_tb[0x10] =
{
0x0a, 0x0b, 0x12, 0x13, 0x0e, 0x0f, 0x16, 0x17,
0x09, 0x19, 0x1a, 0x1b, 0x0d, 0x1d, 0x1e, 0x15
};
-const UINT8 floppy_image_format_t::gcr5bw_tb[0x20] =
+const uint8_t floppy_image_format_t::gcr5bw_tb[0x20] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x08, 0x00, 0x01, 0x00, 0x0c, 0x04, 0x05,
@@ -1800,7 +1800,7 @@ const UINT8 floppy_image_format_t::gcr5bw_tb[0x20] =
0x00, 0x09, 0x0a, 0x0b, 0x00, 0x0d, 0x0e, 0x00
};
-const UINT8 floppy_image_format_t::gcr6fw_tb[0x40] =
+const uint8_t floppy_image_format_t::gcr6fw_tb[0x40] =
{
0x96, 0x97, 0x9a, 0x9b, 0x9d, 0x9e, 0x9f, 0xa6,
0xa7, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb2, 0xb3,
@@ -1812,7 +1812,7 @@ const UINT8 floppy_image_format_t::gcr6fw_tb[0x40] =
0xf7, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
};
-const UINT8 floppy_image_format_t::gcr6bw_tb[0x100] =
+const uint8_t floppy_image_format_t::gcr6bw_tb[0x100] =
{
// 0 1 2 3 4 5 6 7 8 9 a b c d e f
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -2192,9 +2192,9 @@ const floppy_image_format_t::desc_e floppy_image_format_t::amiga_22[] = {
{ END }
};
-void floppy_image_format_t::generate_bitstream_from_track(int track, int head, int cell_size, UINT8 *trackbuf, int &track_size, floppy_image *image, int subtrack)
+void floppy_image_format_t::generate_bitstream_from_track(int track, int head, int cell_size, uint8_t *trackbuf, int &track_size, floppy_image *image, int subtrack)
{
- std::vector<UINT32> &tbuf = image->get_buffer(track, head, subtrack);
+ std::vector<uint32_t> &tbuf = image->get_buffer(track, head, subtrack);
if(tbuf.size() <= 1) {
// Unformatted track
track_size = 200000000/cell_size;
@@ -2203,7 +2203,7 @@ void floppy_image_format_t::generate_bitstream_from_track(int track, int head, i
}
// Start at the write splice
- UINT32 splice = image->get_write_splice_position(track, head, subtrack);
+ uint32_t splice = image->get_write_splice_position(track, head, subtrack);
int cur_pos = splice;
int cur_entry = 0;
while(cur_entry < int(tbuf.size())-1 && (tbuf[cur_entry+1] & floppy_image::TIME_MASK) < cur_pos)
@@ -2219,7 +2219,7 @@ void floppy_image_format_t::generate_bitstream_from_track(int track, int head, i
int phase_adjust = 0;
int freq_hist = 0;
- UINT32 scanned = 0;
+ uint32_t scanned = 0;
while(scanned < 200000000) {
// Note that all magnetic cell type changes are considered
// edges. No randomness added for neutral/damaged cells
@@ -2294,12 +2294,12 @@ void floppy_image_format_t::generate_bitstream_from_track(int track, int head, i
track_size = cur_bit;
}
-int floppy_image_format_t::sbit_r(const UINT8 *bitstream, int pos)
+int floppy_image_format_t::sbit_r(const uint8_t *bitstream, int pos)
{
return (bitstream[pos >> 3] & (0x80 >> (pos & 7))) != 0;
}
-int floppy_image_format_t::sbit_rp(const UINT8 *bitstream, int &pos, int track_size)
+int floppy_image_format_t::sbit_rp(const uint8_t *bitstream, int &pos, int track_size)
{
int res = sbit_r(bitstream, pos);
pos ++;
@@ -2308,9 +2308,9 @@ int floppy_image_format_t::sbit_rp(const UINT8 *bitstream, int &pos, int track_s
return res;
}
-UINT8 floppy_image_format_t::sbyte_mfm_r(const UINT8 *bitstream, int &pos, int track_size)
+uint8_t floppy_image_format_t::sbyte_mfm_r(const uint8_t *bitstream, int &pos, int track_size)
{
- UINT8 res = 0;
+ uint8_t res = 0;
for(int i=0; i<8; i++) {
sbit_rp(bitstream, pos, track_size);
if(sbit_rp(bitstream, pos, track_size))
@@ -2319,9 +2319,9 @@ UINT8 floppy_image_format_t::sbyte_mfm_r(const UINT8 *bitstream, int &pos, int t
return res;
}
-UINT8 floppy_image_format_t::sbyte_gcr5_r(const UINT8 *bitstream, int &pos, int track_size)
+uint8_t floppy_image_format_t::sbyte_gcr5_r(const uint8_t *bitstream, int &pos, int track_size)
{
- UINT16 gcr = 0;
+ uint16_t gcr = 0;
for(int i=0; i<10; i++) {
if(sbit_rp(bitstream, pos, track_size))
gcr |= 0x200 >> i;
@@ -2330,7 +2330,7 @@ UINT8 floppy_image_format_t::sbyte_gcr5_r(const UINT8 *bitstream, int &pos, int
return (gcr5bw_tb[gcr >> 5] << 4) | gcr5bw_tb[gcr & 0x1f];
}
-void floppy_image_format_t::extract_sectors_from_bitstream_mfm_pc(const UINT8 *bitstream, int track_size, desc_xs *sectors, UINT8 *sectdata, int sectdata_size)
+void floppy_image_format_t::extract_sectors_from_bitstream_mfm_pc(const uint8_t *bitstream, int track_size, desc_xs *sectors, uint8_t *sectdata, int sectdata_size)
{
memset(sectors, 0, 256*sizeof(desc_xs));
@@ -2347,7 +2347,7 @@ void floppy_image_format_t::extract_sectors_from_bitstream_mfm_pc(const UINT8 *b
int idblk_count = 0, dblk_count = 0;
// Precharge the shift register to detect over-the-index stuff
- UINT16 shift_reg = 0;
+ uint16_t shift_reg = 0;
for(int i=0; i<16; i++)
if(sbit_r(bitstream, track_size-16+i))
shift_reg |= 0x8000 >> i;
@@ -2357,7 +2357,7 @@ void floppy_image_format_t::extract_sectors_from_bitstream_mfm_pc(const UINT8 *b
for(int i=0; i<track_size; i++) {
shift_reg = (shift_reg << 1) | sbit_r(bitstream, i);
if(shift_reg == 0x4489) {
- UINT16 header;
+ uint16_t header;
int pos = i+1;
do {
header = 0;
@@ -2389,10 +2389,10 @@ void floppy_image_format_t::extract_sectors_from_bitstream_mfm_pc(const UINT8 *b
int sectdata_pos = 0;
for(int i=0; i<idblk_count; i++) {
int pos = idblk[i];
- UINT8 track = sbyte_mfm_r(bitstream, pos, track_size);
- UINT8 head = sbyte_mfm_r(bitstream, pos, track_size);
- UINT8 sector = sbyte_mfm_r(bitstream, pos, track_size);
- UINT8 size = sbyte_mfm_r(bitstream, pos, track_size);
+ uint8_t track = sbyte_mfm_r(bitstream, pos, track_size);
+ uint8_t head = sbyte_mfm_r(bitstream, pos, track_size);
+ uint8_t sector = sbyte_mfm_r(bitstream, pos, track_size);
+ uint8_t size = sbyte_mfm_r(bitstream, pos, track_size);
if(size >= 8)
continue;
@@ -2436,8 +2436,8 @@ void floppy_image_format_t::get_geometry_mfm_pc(floppy_image *image, int cell_si
return;
}
- UINT8 bitstream[500000/8];
- UINT8 sectdata[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sectdata[50000];
desc_xs sectors[256];
int track_size;
@@ -2455,17 +2455,17 @@ void floppy_image_format_t::get_geometry_mfm_pc(floppy_image *image, int cell_si
}
-void floppy_image_format_t::get_track_data_mfm_pc(int track, int head, floppy_image *image, int cell_size, int sector_size, int sector_count, UINT8 *sectdata)
+void floppy_image_format_t::get_track_data_mfm_pc(int track, int head, floppy_image *image, int cell_size, int sector_size, int sector_count, uint8_t *sectdata)
{
- UINT8 bitstream[500000/8];
- UINT8 sectbuf[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sectbuf[50000];
desc_xs sectors[256];
int track_size;
generate_bitstream_from_track(track, head, cell_size, bitstream, track_size, image);
extract_sectors_from_bitstream_mfm_pc(bitstream, track_size, sectors, sectbuf, sizeof(sectbuf));
for(int sector=1; sector <= sector_count; sector++) {
- UINT8 *sd = sectdata + (sector-1)*sector_size;
+ uint8_t *sd = sectdata + (sector-1)*sector_size;
if(sectors[sector].data && sectors[sector].track == track && sectors[sector].head == head) {
int asize = sectors[sector].size;
if(asize > sector_size)
@@ -2479,7 +2479,7 @@ void floppy_image_format_t::get_track_data_mfm_pc(int track, int head, floppy_im
}
-void floppy_image_format_t::extract_sectors_from_bitstream_fm_pc(const UINT8 *bitstream, int track_size, desc_xs *sectors, UINT8 *sectdata, int sectdata_size)
+void floppy_image_format_t::extract_sectors_from_bitstream_fm_pc(const uint8_t *bitstream, int track_size, desc_xs *sectors, uint8_t *sectdata, int sectdata_size)
{
memset(sectors, 0, 256*sizeof(desc_xs));
@@ -2496,7 +2496,7 @@ void floppy_image_format_t::extract_sectors_from_bitstream_fm_pc(const UINT8 *bi
int idblk_count = 0, dblk_count = 0;
// Precharge the shift register to detect over-the-index stuff
- UINT16 shift_reg = 0;
+ uint16_t shift_reg = 0;
for(int i=0; i<16; i++)
if(sbit_r(bitstream, track_size-16+i))
shift_reg |= 0x8000 >> i;
@@ -2526,10 +2526,10 @@ void floppy_image_format_t::extract_sectors_from_bitstream_fm_pc(const UINT8 *bi
int sectdata_pos = 0;
for(int i=0; i<idblk_count; i++) {
int pos = idblk[i];
- UINT8 track = sbyte_mfm_r(bitstream, pos, track_size);
- UINT8 head = sbyte_mfm_r(bitstream, pos, track_size);
- UINT8 sector = sbyte_mfm_r(bitstream, pos, track_size);
- UINT8 size = sbyte_mfm_r(bitstream, pos, track_size);
+ uint8_t track = sbyte_mfm_r(bitstream, pos, track_size);
+ uint8_t head = sbyte_mfm_r(bitstream, pos, track_size);
+ uint8_t sector = sbyte_mfm_r(bitstream, pos, track_size);
+ uint8_t size = sbyte_mfm_r(bitstream, pos, track_size);
if(size >= 8)
continue;
int ssize = 128 << size;
@@ -2571,8 +2571,8 @@ void floppy_image_format_t::get_geometry_fm_pc(floppy_image *image, int cell_siz
return;
}
- UINT8 bitstream[500000/8];
- UINT8 sectdata[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sectdata[50000];
desc_xs sectors[256];
int track_size;
@@ -2590,17 +2590,17 @@ void floppy_image_format_t::get_geometry_fm_pc(floppy_image *image, int cell_siz
}
-void floppy_image_format_t::get_track_data_fm_pc(int track, int head, floppy_image *image, int cell_size, int sector_size, int sector_count, UINT8 *sectdata)
+void floppy_image_format_t::get_track_data_fm_pc(int track, int head, floppy_image *image, int cell_size, int sector_size, int sector_count, uint8_t *sectdata)
{
- UINT8 bitstream[500000/8];
- UINT8 sectbuf[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sectbuf[50000];
desc_xs sectors[256];
int track_size;
generate_bitstream_from_track(track, head, cell_size, bitstream, track_size, image);
extract_sectors_from_bitstream_fm_pc(bitstream, track_size, sectors, sectbuf, sizeof(sectbuf));
for(int sector=1; sector <= sector_count; sector++) {
- UINT8 *sd = sectdata + (sector-1)*sector_size;
+ uint8_t *sd = sectdata + (sector-1)*sector_size;
if(sectors[sector].data && sectors[sector].track == track && sectors[sector].head == head) {
int asize = sectors[sector].size;
if(asize > sector_size)
@@ -2613,7 +2613,7 @@ void floppy_image_format_t::get_track_data_fm_pc(int track, int head, floppy_ima
}
}
-int floppy_image_format_t::calc_default_pc_gap3_size(UINT32 form_factor, int sector_size)
+int floppy_image_format_t::calc_default_pc_gap3_size(uint32_t form_factor, int sector_size)
{
return
form_factor == floppy_image::FF_8 ? 25 :
@@ -2634,7 +2634,7 @@ void floppy_image_format_t::build_wd_track_mfm(int track, int head, floppy_image
void floppy_image_format_t::build_pc_track_fm(int track, int head, floppy_image *image, int cell_count, int sector_count, const desc_pc_sector *sects, int gap_3, int gap_4a, int gap_1, int gap_2)
{
- std::vector<UINT32> track_data;
+ std::vector<uint32_t> track_data;
// gap 4a , IAM and gap 1
if(gap_4a != -1) {
@@ -2658,7 +2658,7 @@ void floppy_image_format_t::build_pc_track_fm(int track, int head, floppy_image
// Build the track
for(int i=0; i<sector_count; i++) {
- UINT16 crc;
+ uint16_t crc;
// sync and IDAM and gap 2
for(int j=0; j< 6; j++) fm_w(track_data, 8, 0x00);
@@ -2700,7 +2700,7 @@ void floppy_image_format_t::build_pc_track_fm(int track, int head, floppy_image
void floppy_image_format_t::build_pc_track_mfm(int track, int head, floppy_image *image, int cell_count, int sector_count, const desc_pc_sector *sects, int gap_3, int gap_4a, int gap_1, int gap_2)
{
- std::vector<UINT32> track_data;
+ std::vector<uint32_t> track_data;
// gap 4a , IAM and gap 1
if(gap_4a != -1) {
@@ -2725,7 +2725,7 @@ void floppy_image_format_t::build_pc_track_mfm(int track, int head, floppy_image
// Build the track
for(int i=0; i<sector_count; i++) {
- UINT16 crc;
+ uint16_t crc;
// sync and IDAM and gap 2
for(int j=0; j<12; j++) mfm_w(track_data, 8, 0x00);
unsigned int cpos = track_data.size();
@@ -2766,7 +2766,7 @@ void floppy_image_format_t::build_pc_track_mfm(int track, int head, floppy_image
generate_track_from_levels(track, head, track_data, 0, image);
}
-void floppy_image_format_t::extract_sectors_from_bitstream_gcr5(const UINT8 *bitstream, int track_size, desc_xs *sectors, UINT8 *sectdata, int sectdata_size, int head, int tracks)
+void floppy_image_format_t::extract_sectors_from_bitstream_gcr5(const uint8_t *bitstream, int track_size, desc_xs *sectors, uint8_t *sectdata, int sectdata_size, int head, int tracks)
{
memset(sectors, 0, 256*sizeof(desc_xs));
@@ -2779,7 +2779,7 @@ void floppy_image_format_t::extract_sectors_from_bitstream_gcr5(const UINT8 *bit
int hblk_count = 0, dblk_count = 0;
// Precharge the shift register to detect over-the-index stuff
- UINT16 shift_reg = 0;
+ uint16_t shift_reg = 0;
for(int i=0; i<16; i++)
if(sbit_r(bitstream, track_size-16+i))
shift_reg |= 0x8000 >> i;
@@ -2791,7 +2791,7 @@ void floppy_image_format_t::extract_sectors_from_bitstream_gcr5(const UINT8 *bit
shift_reg = ((shift_reg << 1) | bit) & 0x3ff;
if (sync && !bit) {
- UINT8 id = sbyte_gcr5_r(bitstream, i, track_size);
+ uint8_t id = sbyte_gcr5_r(bitstream, i, track_size);
switch (id) {
case 0x08:
@@ -2813,12 +2813,12 @@ void floppy_image_format_t::extract_sectors_from_bitstream_gcr5(const UINT8 *bit
int sectdata_pos = 0;
for(int i=0; i<hblk_count; i++) {
int pos = hblk[i];
- ATTR_UNUSED UINT8 block_id = sbyte_gcr5_r(bitstream, pos, track_size);
- UINT8 crc = sbyte_gcr5_r(bitstream, pos, track_size);
- UINT8 sector = sbyte_gcr5_r(bitstream, pos, track_size);
- UINT8 track = sbyte_gcr5_r(bitstream, pos, track_size);
- UINT8 id2 = sbyte_gcr5_r(bitstream, pos, track_size);
- UINT8 id1 = sbyte_gcr5_r(bitstream, pos, track_size);
+ ATTR_UNUSED uint8_t block_id = sbyte_gcr5_r(bitstream, pos, track_size);
+ uint8_t crc = sbyte_gcr5_r(bitstream, pos, track_size);
+ uint8_t sector = sbyte_gcr5_r(bitstream, pos, track_size);
+ uint8_t track = sbyte_gcr5_r(bitstream, pos, track_size);
+ uint8_t id2 = sbyte_gcr5_r(bitstream, pos, track_size);
+ uint8_t id1 = sbyte_gcr5_r(bitstream, pos, track_size);
if (crc ^ sector ^ track ^ id2 ^ id1) {
// header crc mismatch
@@ -2832,9 +2832,9 @@ void floppy_image_format_t::extract_sectors_from_bitstream_gcr5(const UINT8 *bit
sectors[sector].head = head;
sectors[sector].size = 256;
sectors[sector].data = sectdata + sectdata_pos;
- UINT8 data_crc = 0;
+ uint8_t data_crc = 0;
for(int j=0; j<sectors[sector].size; j++) {
- UINT8 data = sbyte_gcr5_r(bitstream, pos, track_size);
+ uint8_t data = sbyte_gcr5_r(bitstream, pos, track_size);
data_crc ^= data;
sectdata[sectdata_pos++] = data;
}
@@ -2845,7 +2845,7 @@ void floppy_image_format_t::extract_sectors_from_bitstream_gcr5(const UINT8 *bit
}
}
-void floppy_image_format_t::extract_sectors_from_bitstream_victor_gcr5(const UINT8 *bitstream, int track_size, desc_xs *sectors, UINT8 *sectdata, int sectdata_size)
+void floppy_image_format_t::extract_sectors_from_bitstream_victor_gcr5(const uint8_t *bitstream, int track_size, desc_xs *sectors, uint8_t *sectdata, int sectdata_size)
{
memset(sectors, 0, 256*sizeof(desc_xs));
@@ -2858,7 +2858,7 @@ void floppy_image_format_t::extract_sectors_from_bitstream_victor_gcr5(const UIN
int hblk_count = 0, dblk_count = 0;
// Precharge the shift register to detect over-the-index stuff
- UINT16 shift_reg = 0;
+ uint16_t shift_reg = 0;
for(int i=0; i<16; i++)
if(sbit_r(bitstream, track_size-16+i))
shift_reg |= 0x8000 >> i;
@@ -2870,7 +2870,7 @@ void floppy_image_format_t::extract_sectors_from_bitstream_victor_gcr5(const UIN
shift_reg = ((shift_reg << 1) | bit) & 0x3ff;
if (sync && !bit) {
- UINT8 id = sbyte_gcr5_r(bitstream, i, track_size);
+ uint8_t id = sbyte_gcr5_r(bitstream, i, track_size);
switch (id) {
case 0x07:
@@ -2892,9 +2892,9 @@ void floppy_image_format_t::extract_sectors_from_bitstream_victor_gcr5(const UIN
int sectdata_pos = 0;
for(int i=0; i<hblk_count; i++) {
int pos = hblk[i];
- ATTR_UNUSED UINT8 block_id = sbyte_gcr5_r(bitstream, pos, track_size);
- UINT8 track = sbyte_gcr5_r(bitstream, pos, track_size);
- UINT8 sector = sbyte_gcr5_r(bitstream, pos, track_size);
+ ATTR_UNUSED uint8_t block_id = sbyte_gcr5_r(bitstream, pos, track_size);
+ uint8_t track = sbyte_gcr5_r(bitstream, pos, track_size);
+ uint8_t sector = sbyte_gcr5_r(bitstream, pos, track_size);
pos = dblk[i];
block_id = sbyte_gcr5_r(bitstream, pos, track_size);
@@ -2904,7 +2904,7 @@ void floppy_image_format_t::extract_sectors_from_bitstream_victor_gcr5(const UIN
sectors[sector].size = 512;
sectors[sector].data = sectdata + sectdata_pos;
for(int j=0; j<sectors[sector].size; j++) {
- UINT8 data = sbyte_gcr5_r(bitstream, pos, track_size);
+ uint8_t data = sbyte_gcr5_r(bitstream, pos, track_size);
sectdata[sectdata_pos++] = data;
}
}
diff --git a/src/lib/formats/flopimg.h b/src/lib/formats/flopimg.h
index 9a8f1513623..1ad73d94f81 100644
--- a/src/lib/formats/flopimg.h
+++ b/src/lib/formats/flopimg.h
@@ -66,17 +66,17 @@ struct FloppyCallbacks
floperr_t (*write_sector)(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam);
floperr_t (*read_indexed_sector)(floppy_image_legacy *floppy, int head, int track, int sector_index, void *buffer, size_t buflen);
floperr_t (*write_indexed_sector)(floppy_image_legacy *floppy, int head, int track, int sector_index, const void *buffer, size_t buflen, int ddam);
- floperr_t (*read_track)(floppy_image_legacy *floppy, int head, int track, UINT64 offset, void *buffer, size_t buflen);
- floperr_t (*write_track)(floppy_image_legacy *floppy, int head, int track, UINT64 offset, const void *buffer, size_t buflen);
+ floperr_t (*read_track)(floppy_image_legacy *floppy, int head, int track, uint64_t offset, void *buffer, size_t buflen);
+ floperr_t (*write_track)(floppy_image_legacy *floppy, int head, int track, uint64_t offset, const void *buffer, size_t buflen);
floperr_t (*format_track)(floppy_image_legacy *floppy, int head, int track, util::option_resolution *params);
floperr_t (*post_format)(floppy_image_legacy *floppy, util::option_resolution *params);
int (*get_heads_per_disk)(floppy_image_legacy *floppy);
int (*get_tracks_per_disk)(floppy_image_legacy *floppy);
int (*get_sectors_per_track)(floppy_image_legacy *floppy, int head, int track);
- UINT32 (*get_track_size)(floppy_image_legacy *floppy, int head, int track);
- floperr_t (*get_sector_length)(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length);
- floperr_t (*get_indexed_sector_info)(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags);
- floperr_t (*get_track_data_offset)(floppy_image_legacy *floppy, int head, int track, UINT64 *offset);
+ uint32_t (*get_track_size)(floppy_image_legacy *floppy, int head, int track);
+ floperr_t (*get_sector_length)(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length);
+ floperr_t (*get_indexed_sector_info)(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags);
+ floperr_t (*get_track_data_offset)(floppy_image_legacy *floppy, int head, int track, uint64_t *offset);
};
@@ -177,8 +177,8 @@ floperr_t floppy_identify(void *fp, const struct io_procs *procs, const char *ex
void *floppy_tag(floppy_image_legacy *floppy);
void *floppy_create_tag(floppy_image_legacy *floppy, size_t tagsize);
struct FloppyCallbacks *floppy_callbacks(floppy_image_legacy *floppy);
-UINT8 floppy_get_filler(floppy_image_legacy *floppy);
-void floppy_set_filler(floppy_image_legacy *floppy, UINT8 filler);
+uint8_t floppy_get_filler(floppy_image_legacy *floppy);
+void floppy_set_filler(floppy_image_legacy *floppy, uint8_t filler);
/* calls for accessing disk image data */
floperr_t floppy_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, int offset, void *buffer, size_t buffer_len);
@@ -192,22 +192,22 @@ floperr_t floppy_write_track_data(floppy_image_legacy *floppy, int head, int tra
floperr_t floppy_format_track(floppy_image_legacy *floppy, int head, int track, util::option_resolution *params);
int floppy_get_tracks_per_disk(floppy_image_legacy *floppy);
int floppy_get_heads_per_disk(floppy_image_legacy *floppy);
-UINT32 floppy_get_track_size(floppy_image_legacy *floppy, int head, int track);
-floperr_t floppy_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length);
-floperr_t floppy_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags);
+uint32_t floppy_get_track_size(floppy_image_legacy *floppy, int head, int track);
+floperr_t floppy_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length);
+floperr_t floppy_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags);
floperr_t floppy_get_sector_count(floppy_image_legacy *floppy, int head, int track, int *sector_count);
floperr_t floppy_load_track(floppy_image_legacy *floppy, int head, int track, int dirtify, void **track_data, size_t *track_length);
int floppy_is_read_only(floppy_image_legacy *floppy);
-UINT8 floppy_random_byte(floppy_image_legacy *floppy);
+uint8_t floppy_random_byte(floppy_image_legacy *floppy);
/* accessors for meta information about the image */
const char *floppy_format_description(floppy_image_legacy *floppy);
/* calls for accessing the raw disk image */
-void floppy_image_read(floppy_image_legacy *floppy, void *buffer, UINT64 offset, size_t length);
-void floppy_image_write(floppy_image_legacy *floppy, const void *buffer, UINT64 offset, size_t length);
-void floppy_image_write_filler(floppy_image_legacy *floppy, UINT8 filler, UINT64 offset, size_t length);
-UINT64 floppy_image_size(floppy_image_legacy *floppy);
+void floppy_image_read(floppy_image_legacy *floppy, void *buffer, uint64_t offset, size_t length);
+void floppy_image_write(floppy_image_legacy *floppy, const void *buffer, uint64_t offset, size_t length);
+void floppy_image_write_filler(floppy_image_legacy *floppy, uint8_t filler, uint64_t offset, size_t length);
+uint64_t floppy_image_size(floppy_image_legacy *floppy);
/* misc */
const char *floppy_error(floperr_t err);
@@ -234,7 +234,7 @@ public:
in floppy_image
@return 1 if image valid, 0 otherwise.
*/
- virtual int identify(io_generic *io, UINT32 form_factor) = 0;
+ virtual int identify(io_generic *io, uint32_t form_factor) = 0;
/*! @brief Load an image.
The load function opens an image file and converts it to the
@@ -245,7 +245,7 @@ public:
@param image output buffer for data in MESS internal format.
@return true on success, false otherwise.
*/
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) = 0;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) = 0;
/*! @brief Save an image.
The save function writes back an image from the MESS internal
@@ -363,9 +363,9 @@ protected:
//! Sector data description
struct desc_s {
int size; //!< Sector size, int bytes
- const UINT8 *data; //!< Sector data
- UINT8 sector_id; //!< Sector ID
- UINT8 sector_info; //!< Sector free byte
+ const uint8_t *data; //!< Sector data
+ uint8_t sector_id; //!< Sector ID
+ uint8_t sector_info; //!< Sector free byte
};
@@ -387,7 +387,7 @@ protected:
@param track_size in cells, not bytes.
@param image
*/
- void generate_track_from_bitstream(int track, int head, const UINT8 *trackbuf, int track_size, floppy_image *image, int subtrack = 0);
+ void generate_track_from_bitstream(int track, int head, const uint8_t *trackbuf, int track_size, floppy_image *image, int subtrack = 0);
//! @brief Generate a track from cell level values (0/1/W/D/N).
@@ -404,14 +404,14 @@ protected:
know. trackbuf may be modified at that position or after.
@param image
*/
- void generate_track_from_levels(int track, int head, std::vector<UINT32> &trackbuf, int splice_pos, floppy_image *image);
+ void generate_track_from_levels(int track, int head, std::vector<uint32_t> &trackbuf, int splice_pos, floppy_image *image);
//! Normalize the times in a cell buffer to sum up to 200000000
- void normalize_times(std::vector<UINT32> &buffer);
+ void normalize_times(std::vector<uint32_t> &buffer);
// Some conversion tables for gcr
- static const UINT8 gcr5fw_tb[0x10], gcr5bw_tb[0x20];
- static const UINT8 gcr6fw_tb[0x40], gcr6bw_tb[0x100];
+ static const uint8_t gcr5fw_tb[0x10], gcr5bw_tb[0x20];
+ static const uint8_t gcr6fw_tb[0x40], gcr6bw_tb[0x100];
// Some useful descriptions shared by multiple formats
@@ -484,25 +484,25 @@ protected:
@endverbatim
*/
- void generate_bitstream_from_track(int track, int head, int cell_size, UINT8 *trackbuf, int &track_size, floppy_image *image, int subtrack = 0);
+ void generate_bitstream_from_track(int track, int head, int cell_size, uint8_t *trackbuf, int &track_size, floppy_image *image, int subtrack = 0);
//! Defines a standard sector for extracting.
struct desc_xs {
int track, //!< Track for this sector
head, //!< Head for this sector
size; //!< Size of this sector
- const UINT8 *data; //!< Data within this sector
+ const uint8_t *data; //!< Data within this sector
};
struct desc_pc_sector {
- UINT8 track, head, sector, size;
+ uint8_t track, head, sector, size;
int actual_size;
- UINT8 *data;
+ uint8_t *data;
bool deleted;
bool bad_crc;
};
- int calc_default_pc_gap3_size(UINT32 form_factor, int sector_size);
+ int calc_default_pc_gap3_size(uint32_t form_factor, int sector_size);
void build_wd_track_fm(int track, int head, floppy_image *image, int cell_count, int sector_count, const desc_pc_sector *sects, int gap_3, int gap_1, int gap_2);
void build_wd_track_mfm(int track, int head, floppy_image *image, int cell_count, int sector_count, const desc_pc_sector *sects, int gap_3, int gap_1, int gap_2=22);
void build_pc_track_fm(int track, int head, floppy_image *image, int cell_count, int sector_count, const desc_pc_sector *sects, int gap_3, int gap_4a=40, int gap_1=26, int gap_2=11);
@@ -519,13 +519,13 @@ protected:
//! systems.
//! PC-type sectors with MFM encoding, sector size can go from 128 bytes to 16K.
- void extract_sectors_from_bitstream_mfm_pc(const UINT8 *bitstream, int track_size, desc_xs *sectors, UINT8 *sectdata, int sectdata_size);
+ void extract_sectors_from_bitstream_mfm_pc(const uint8_t *bitstream, int track_size, desc_xs *sectors, uint8_t *sectdata, int sectdata_size);
//! PC-type sectors with FM encoding
- void extract_sectors_from_bitstream_fm_pc(const UINT8 *bitstream, int track_size, desc_xs *sectors, UINT8 *sectdata, int sectdata_size);
+ void extract_sectors_from_bitstream_fm_pc(const uint8_t *bitstream, int track_size, desc_xs *sectors, uint8_t *sectdata, int sectdata_size);
//! Commodore type sectors with GCR5 encoding
- void extract_sectors_from_bitstream_gcr5(const UINT8 *bitstream, int track_size, desc_xs *sectors, UINT8 *sectdata, int sectdata_size, int head, int tracks);
+ void extract_sectors_from_bitstream_gcr5(const uint8_t *bitstream, int track_size, desc_xs *sectors, uint8_t *sectdata, int sectdata_size, int head, int tracks);
//! Victor 9000 type sectors with GCR5 encoding
- void extract_sectors_from_bitstream_victor_gcr5(const UINT8 *bitstream, int track_size, desc_xs *sectors, UINT8 *sectdata, int sectdata_size);
+ void extract_sectors_from_bitstream_victor_gcr5(const uint8_t *bitstream, int track_size, desc_xs *sectors, uint8_t *sectdata, int sectdata_size);
//! @brief Get a geometry (including sectors) from an image.
@@ -538,48 +538,48 @@ protected:
//! Regenerate the data for a full track.
//! PC-type sectors with MFM encoding and fixed-size.
- void get_track_data_mfm_pc(int track, int head, floppy_image *image, int cell_size, int sector_size, int sector_count, UINT8 *sectdata);
+ void get_track_data_mfm_pc(int track, int head, floppy_image *image, int cell_size, int sector_size, int sector_count, uint8_t *sectdata);
//! Regenerate the data for a full track.
//! PC-type sectors with FM encoding and fixed-size.
- void get_track_data_fm_pc(int track, int head, floppy_image *image, int cell_size, int sector_size, int sector_count, UINT8 *sectdata);
+ void get_track_data_fm_pc(int track, int head, floppy_image *image, int cell_size, int sector_size, int sector_count, uint8_t *sectdata);
//! Look up a bit in a level-type stream.
- bool bit_r(const std::vector<UINT32> &buffer, int offset);
+ bool bit_r(const std::vector<uint32_t> &buffer, int offset);
//! Look up multiple bits
- UINT32 bitn_r(const std::vector<UINT32> &buffer, int offset, int count);
+ uint32_t bitn_r(const std::vector<uint32_t> &buffer, int offset, int count);
//! Write a bit with a given size.
- void bit_w(std::vector<UINT32> &buffer, bool val, UINT32 size = 1000);
- void bit_w(std::vector<UINT32> &buffer, bool val, UINT32 size, int offset);
+ void bit_w(std::vector<uint32_t> &buffer, bool val, uint32_t size = 1000);
+ void bit_w(std::vector<uint32_t> &buffer, bool val, uint32_t size, int offset);
//! Calculate a CCITT-type CRC.
- UINT16 calc_crc_ccitt(const std::vector<UINT32> &buffer, int start, int end);
+ uint16_t calc_crc_ccitt(const std::vector<uint32_t> &buffer, int start, int end);
//! Write a series of (raw) bits
- void raw_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size = 1000);
- void raw_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size, int offset);
+ void raw_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size = 1000);
+ void raw_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size, int offset);
//! FM-encode and write a series of bits
- void fm_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size = 1000);
- void fm_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size, int offset);
+ void fm_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size = 1000);
+ void fm_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size, int offset);
//! MFM-encode and write a series of bits
- void mfm_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size = 1000);
- void mfm_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size, int offset);
+ void mfm_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size = 1000);
+ void mfm_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size, int offset);
//! MFM-encode every two bits and write
- void mfm_half_w(std::vector<UINT32> &buffer, int start_bit, UINT32 val, UINT32 size = 1000);
+ void mfm_half_w(std::vector<uint32_t> &buffer, int start_bit, uint32_t val, uint32_t size = 1000);
//! GCR5-encode and write a series of bits
- void gcr5_w(std::vector<UINT32> &buffer, UINT8 val, UINT32 size = 1000);
- void gcr5_w(std::vector<UINT32> &buffer, UINT8 val, UINT32 size, int offset);
+ void gcr5_w(std::vector<uint32_t> &buffer, uint8_t val, uint32_t size = 1000);
+ void gcr5_w(std::vector<uint32_t> &buffer, uint8_t val, uint32_t size, int offset);
//! 8N1-encode and write a series of bits
- void _8n1_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size = 1000);
+ void _8n1_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size = 1000);
//! GCR4 encode (Apple II sector header)
- UINT16 gcr4_encode(UINT8 va);
+ uint16_t gcr4_encode(uint8_t va);
//! GCR4 decode
- UINT8 gcr4_decode(UINT8 e0, UINT8 e1);
+ uint8_t gcr4_decode(uint8_t e0, uint8_t e1);
//! GCR6 encode (Apple II 16-sector and Mac-style GCR)
- UINT32 gcr6_encode(UINT8 va, UINT8 vb, UINT8 vc);
+ uint32_t gcr6_encode(uint8_t va, uint8_t vb, uint8_t vc);
//! GCR6 decode
- void gcr6_decode(UINT8 e0, UINT8 e1, UINT8 e2, UINT8 e3, UINT8 &va, UINT8 &vb, UINT8 &vc);
+ void gcr6_decode(uint8_t e0, uint8_t e1, uint8_t e2, uint8_t e3, uint8_t &va, uint8_t &vb, uint8_t &vc);
- UINT8 sbyte_mfm_r(const UINT8 *bitstream, int &pos, int track_size);
- UINT8 sbyte_gcr5_r(const UINT8 *bitstream, int &pos, int track_size);
+ uint8_t sbyte_mfm_r(const uint8_t *bitstream, int &pos, int track_size);
+ uint8_t sbyte_gcr5_r(const uint8_t *bitstream, int &pos, int track_size);
private:
enum { CRC_NONE, CRC_AMIGA, CRC_CBM, CRC_CCITT, CRC_CCITT_FM, CRC_MACHEAD, CRC_FCS, CRC_VICTOR_HDR, CRC_VICTOR_DATA };
@@ -598,19 +598,19 @@ private:
bool type_data_mfm(int type, int p1, const gen_crc_info *crcs) const;
int crc_cells_size(int type) const;
- void fixup_crc_amiga(std::vector<UINT32> &buffer, const gen_crc_info *crc);
- void fixup_crc_cbm(std::vector<UINT32> &buffer, const gen_crc_info *crc);
- void fixup_crc_ccitt(std::vector<UINT32> &buffer, const gen_crc_info *crc);
- void fixup_crc_ccitt_fm(std::vector<UINT32> &buffer, const gen_crc_info *crc);
- void fixup_crc_machead(std::vector<UINT32> &buffer, const gen_crc_info *crc);
- void fixup_crc_fcs(std::vector<UINT32> &buffer, const gen_crc_info *crc);
- void fixup_crc_victor_header(std::vector<UINT32> &buffer, const gen_crc_info *crc);
- void fixup_crc_victor_data(std::vector<UINT32> &buffer, const gen_crc_info *crc);
- void fixup_crcs(std::vector<UINT32> &buffer, gen_crc_info *crcs);
+ void fixup_crc_amiga(std::vector<uint32_t> &buffer, const gen_crc_info *crc);
+ void fixup_crc_cbm(std::vector<uint32_t> &buffer, const gen_crc_info *crc);
+ void fixup_crc_ccitt(std::vector<uint32_t> &buffer, const gen_crc_info *crc);
+ void fixup_crc_ccitt_fm(std::vector<uint32_t> &buffer, const gen_crc_info *crc);
+ void fixup_crc_machead(std::vector<uint32_t> &buffer, const gen_crc_info *crc);
+ void fixup_crc_fcs(std::vector<uint32_t> &buffer, const gen_crc_info *crc);
+ void fixup_crc_victor_header(std::vector<uint32_t> &buffer, const gen_crc_info *crc);
+ void fixup_crc_victor_data(std::vector<uint32_t> &buffer, const gen_crc_info *crc);
+ void fixup_crcs(std::vector<uint32_t> &buffer, gen_crc_info *crcs);
void collect_crcs(const desc_e *desc, gen_crc_info *crcs) const;
- int sbit_r(const UINT8 *bitstream, int pos);
- int sbit_rp(const UINT8 *bitstream, int &pos, int track_size);
+ int sbit_r(const uint8_t *bitstream, int pos);
+ int sbit_rp(const uint8_t *bitstream, int &pos, int track_size);
int calc_sector_index(int num, int interleave, int skew, int total_sectors, int track_head);
};
@@ -717,15 +717,15 @@ public:
@param _heads number of heads.
@param _form_factor form factor of drive (from enum)
*/
- floppy_image(int tracks, int heads, UINT32 form_factor);
+ floppy_image(int tracks, int heads, uint32_t form_factor);
virtual ~floppy_image();
//! @return the form factor.
- UINT32 get_form_factor() const { return form_factor; }
+ uint32_t get_form_factor() const { return form_factor; }
//! @return the variant.
- UINT32 get_variant() const { return variant; }
+ uint32_t get_variant() const { return variant; }
//! @param v the variant.
- void set_variant(UINT32 v) { variant = v; }
+ void set_variant(uint32_t v) { variant = v; }
/*!
@param track
@@ -733,7 +733,7 @@ public:
@param head head number
@return a pointer to the data buffer for this track and head
*/
- std::vector<UINT32> &get_buffer(int track, int head, int subtrack = 0) { return track_array[track*4+subtrack][head].cell_data; }
+ std::vector<uint32_t> &get_buffer(int track, int head, int subtrack = 0) { return track_array[track*4+subtrack][head].cell_data; }
//! Sets the write splice position.
//! The "track splice" information indicates where to start writing
@@ -747,9 +747,9 @@ public:
@param head
@param pos the position
*/
- void set_write_splice_position(int track, int head, UINT32 pos, int subtrack = 0) { track_array[track*4+subtrack][head].write_splice = pos; }
+ void set_write_splice_position(int track, int head, uint32_t pos, int subtrack = 0) { track_array[track*4+subtrack][head].write_splice = pos; }
//! @return the current write splice position.
- UINT32 get_write_splice_position(int track, int head, int subtrack = 0) const { return track_array[track*4+subtrack][head].write_splice; }
+ uint32_t get_write_splice_position(int track, int head, int subtrack = 0) const { return track_array[track*4+subtrack][head].write_splice; }
//! @return the maximal geometry supported by this format.
void get_maximal_geometry(int &tracks, int &heads) const;
@@ -763,16 +763,16 @@ public:
//! @param form_factor
//! @param variant
//! @param returns a string containing the variant name.
- static const char *get_variant_name(UINT32 form_factor, UINT32 variant);
+ static const char *get_variant_name(uint32_t form_factor, uint32_t variant);
private:
int tracks, heads;
- UINT32 form_factor, variant;
+ uint32_t form_factor, variant;
struct track_info {
- std::vector<UINT32> cell_data;
- UINT32 write_splice;
+ std::vector<uint32_t> cell_data;
+ uint32_t write_splice;
track_info() { write_splice = 0; }
};
diff --git a/src/lib/formats/fm7_cas.cpp b/src/lib/formats/fm7_cas.cpp
index 5d4aad61092..32cd08e3b27 100644
--- a/src/lib/formats/fm7_cas.cpp
+++ b/src/lib/formats/fm7_cas.cpp
@@ -13,9 +13,9 @@
static int cas_size;
-static int fm7_fill_wave(INT16* buffer, UINT8 high, UINT8 low, int sample_pos)
+static int fm7_fill_wave(int16_t* buffer, uint8_t high, uint8_t low, int sample_pos)
{
- UINT16 data = (high << 8) + low;
+ uint16_t data = (high << 8) + low;
int sample_count = 0;
int x = 0;
int count = (data & 0x7fff);
@@ -41,7 +41,7 @@ static int fm7_fill_wave(INT16* buffer, UINT8 high, UINT8 low, int sample_pos)
return sample_count;
}
-static int fm7_handle_t77(INT16* buffer, const UINT8* casdata)
+static int fm7_handle_t77(int16_t* buffer, const uint8_t* casdata)
{
int sample_count = 0;
int data_pos = 16;
@@ -61,7 +61,7 @@ static int fm7_handle_t77(INT16* buffer, const UINT8* casdata)
/*******************************************************************
Calculate the number of samples needed for this tape image
********************************************************************/
-static int fm7_cas_to_wav_size (const UINT8 *casdata, int caslen)
+static int fm7_cas_to_wav_size (const uint8_t *casdata, int caslen)
{
cas_size = caslen;
@@ -71,7 +71,7 @@ static int fm7_cas_to_wav_size (const UINT8 *casdata, int caslen)
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int fm7_cas_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int fm7_cas_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return fm7_handle_t77(buffer,bytes);
}
diff --git a/src/lib/formats/fmsx_cas.cpp b/src/lib/formats/fmsx_cas.cpp
index ca2ab078fd4..6da8fc47f81 100644
--- a/src/lib/formats/fmsx_cas.cpp
+++ b/src/lib/formats/fmsx_cas.cpp
@@ -8,7 +8,7 @@
#define CAS_PERIOD (16)
#define CAS_HEADER_PERIODS (4000)
#define CAS_EMPTY_PERIODS (1000)
-static const UINT8 CasHeader[8] = { 0x1F,0xA6,0xDE,0xBA,0xCC,0x13,0x7D,0x74 };
+static const uint8_t CasHeader[8] = { 0x1F,0xA6,0xDE,0xBA,0xCC,0x13,0x7D,0x74 };
static int cas_size;
@@ -16,7 +16,7 @@ static int cas_size;
/*******************************************************************
Calculate the number of samples needed for this tape image
********************************************************************/
-static int fmsx_cas_to_wav_size (const UINT8 *casdata, int caslen)
+static int fmsx_cas_to_wav_size (const uint8_t *casdata, int caslen)
{
int pos, size;
@@ -48,7 +48,7 @@ static int fmsx_cas_to_wav_size (const UINT8 *casdata, int caslen)
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int fmsx_cas_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int fmsx_cas_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
int cas_pos, bit, state = 1, samples_pos, size, n, i, p;
diff --git a/src/lib/formats/fsd_dsk.cpp b/src/lib/formats/fsd_dsk.cpp
index cbf474da116..9cd4bff1f61 100644
--- a/src/lib/formats/fsd_dsk.cpp
+++ b/src/lib/formats/fsd_dsk.cpp
@@ -84,9 +84,9 @@ bool fsd_format::supports_save() const
return false;
}
-int fsd_format::identify(io_generic *io, UINT32 form_factor)
+int fsd_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 h[3];
+ uint8_t h[3];
io_generic_read(io, h, 0, 3);
if (memcmp(h, "FSD", 3) == 0) {
@@ -96,18 +96,18 @@ int fsd_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool fsd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool fsd_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
const char* result[255];
result[0x00] = "OK";
result[0x0e] = "Data CRC Error";
result[0x20] = "Deleted Data";
- UINT64 size = io_generic_size(io);
- std::vector<UINT8> img(size);
+ uint64_t size = io_generic_size(io);
+ std::vector<uint8_t> img(size);
io_generic_read(io, &img[0], 0, size);
- UINT64 pos;
+ uint64_t pos;
std::string title;
for(pos=8; pos < size && img[pos] != '\0'; pos++)
title.append(1, img[pos]);
@@ -122,21 +122,21 @@ bool fsd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
LOG_FORMATS("FSD Release: %d\n", ((img[7] & 0xc0) / 64) * 256 + img[6]);
desc_pc_sector sects[256];
- UINT8 total_tracks = img[pos++];
- UINT8 tnum, hnum, snum, ssize, error;
+ uint8_t total_tracks = img[pos++];
+ uint8_t tnum, hnum, snum, ssize, error;
hnum = 0;
LOG_FORMATS("FSD Tracks: %02d\n", total_tracks+1);
LOG_FORMATS("Tr.# No.S Sec.# Tr.ID Head# SecID IDsiz REsiz Error\n");
for(int curr_track=0; curr_track <= total_tracks; curr_track++)
{
- UINT8 track = img[pos++];
- UINT8 spt = img[pos++];
+ uint8_t track = img[pos++];
+ uint8_t spt = img[pos++];
if (spt > 0) // formatted
{
LOG_FORMATS("%02X %02X\n", track, spt);
- UINT8 readable = img[pos++];
+ uint8_t readable = img[pos++];
for (int i = 0; i < spt; i++)
{
tnum = img[pos++]; // logical track
diff --git a/src/lib/formats/fsd_dsk.h b/src/lib/formats/fsd_dsk.h
index fdfb6fb3d27..8a472016cc6 100644
--- a/src/lib/formats/fsd_dsk.h
+++ b/src/lib/formats/fsd_dsk.h
@@ -34,8 +34,8 @@ public:
virtual const char *extensions() const override;
virtual bool supports_save() const override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
};
extern const floppy_format_type FLOPPY_FSD_FORMAT;
diff --git a/src/lib/formats/g64_dsk.cpp b/src/lib/formats/g64_dsk.cpp
index 302bfc0e842..d0fc182835d 100644
--- a/src/lib/formats/g64_dsk.cpp
+++ b/src/lib/formats/g64_dsk.cpp
@@ -19,7 +19,7 @@ g64_format::g64_format()
{
}
-const UINT32 g64_format::c1541_cell_size[] =
+const uint32_t g64_format::c1541_cell_size[] =
{
4000, // 16MHz/16/4
3750, // 16MHz/15/4
@@ -27,7 +27,7 @@ const UINT32 g64_format::c1541_cell_size[] =
3250 // 16MHz/13/4
};
-int g64_format::identify(io_generic *io, UINT32 form_factor)
+int g64_format::identify(io_generic *io, uint32_t form_factor)
{
char h[8];
@@ -38,10 +38,10 @@ int g64_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool g64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool g64_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT64 size = io_generic_size(io);
- std::vector<UINT8> img(size);
+ uint64_t size = io_generic_size(io);
+ std::vector<uint8_t> img(size);
io_generic_read(io, &img[0], 0, size);
if (img[POS_VERSION]) {
@@ -58,9 +58,9 @@ bool g64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
if (track == TRACK_COUNT)
head = 1;
- UINT32 tpos = POS_TRACK_OFFSET + (track * 4);
- UINT32 spos = tpos + (track_count * 4);
- UINT32 dpos = pick_integer_le(&img[0], tpos, 4);
+ uint32_t tpos = POS_TRACK_OFFSET + (track * 4);
+ uint32_t spos = tpos + (track_count * 4);
+ uint32_t dpos = pick_integer_le(&img[0], tpos, 4);
if (!dpos)
continue;
@@ -68,12 +68,12 @@ bool g64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
if (dpos > size)
throw emu_fatalerror("g64_format: Track %u offset %06x out of bounds", track, dpos);
- UINT32 speed_zone = pick_integer_le(&img[0], spos, 4);
+ uint32_t speed_zone = pick_integer_le(&img[0], spos, 4);
if (speed_zone > 3)
throw emu_fatalerror("g64_format: Unsupported variable speed zones on track %d", track);
- UINT16 track_bytes = pick_integer_le(&img[0], dpos, 2);
+ uint16_t track_bytes = pick_integer_le(&img[0], dpos, 2);
int track_size = track_bytes * 8;
LOG_FORMATS("head %u track %u offs %u size %u cell %ld\n", head, cylinder, dpos, track_bytes, 200000000L/track_size);
@@ -89,7 +89,7 @@ bool g64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
return true;
}
-int g64_format::generate_bitstream(int track, int head, int speed_zone, UINT8 *trackbuf, int &track_size, floppy_image *image)
+int g64_format::generate_bitstream(int track, int head, int speed_zone, uint8_t *trackbuf, int &track_size, floppy_image *image)
{
int cell_size = c1541_cell_size[speed_zone];
@@ -108,19 +108,19 @@ bool g64_format::save(io_generic *io, floppy_image *image)
tracks = TRACK_COUNT * heads;
// write header
- UINT8 header[] = { 'G', 'C', 'R', '-', '1', '5', '4', '1', 0x00, static_cast<UINT8>(tracks), TRACK_LENGTH & 0xff, TRACK_LENGTH >> 8 };
+ uint8_t header[] = { 'G', 'C', 'R', '-', '1', '5', '4', '1', 0x00, static_cast<uint8_t>(tracks), TRACK_LENGTH & 0xff, TRACK_LENGTH >> 8 };
io_generic_write(io, header, POS_SIGNATURE, sizeof(header));
// write tracks
for (int head = 0; head < heads; head++) {
int tracks_written = 0;
- std::vector<UINT8> trackbuf(TRACK_LENGTH-2);
+ std::vector<uint8_t> trackbuf(TRACK_LENGTH-2);
for (int track = 0; track < TRACK_COUNT; track++) {
- UINT32 tpos = POS_TRACK_OFFSET + (track * 4);
- UINT32 spos = tpos + (tracks * 4);
- UINT32 dpos = POS_TRACK_OFFSET + (tracks * 4 * 2) + (tracks_written * TRACK_LENGTH);
+ uint32_t tpos = POS_TRACK_OFFSET + (track * 4);
+ uint32_t spos = tpos + (tracks * 4);
+ uint32_t dpos = POS_TRACK_OFFSET + (tracks * 4 * 2) + (tracks_written * TRACK_LENGTH);
io_generic_write_filler(io, 0x00, tpos, 4);
io_generic_write_filler(io, 0x00, spos, 4);
@@ -140,9 +140,9 @@ bool g64_format::save(io_generic *io, floppy_image *image)
LOG_FORMATS("head %u track %u size %u cell %u\n", head, track, track_size, c1541_cell_size[speed_zone]);
- UINT8 track_offset[4];
- UINT8 speed_offset[4];
- UINT8 track_length[2];
+ uint8_t track_offset[4];
+ uint8_t speed_offset[4];
+ uint8_t track_length[2];
place_integer_le(track_offset, 0, 4, dpos);
place_integer_le(speed_offset, 0, 4, speed_zone);
diff --git a/src/lib/formats/g64_dsk.h b/src/lib/formats/g64_dsk.h
index ddc12636b7e..e0966f8690e 100644
--- a/src/lib/formats/g64_dsk.h
+++ b/src/lib/formats/g64_dsk.h
@@ -18,8 +18,8 @@ class g64_format : public floppy_image_format_t {
public:
g64_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual const char *name() const override;
@@ -43,9 +43,9 @@ protected:
TRACK_COUNT = 84
};
- static const UINT32 c1541_cell_size[];
+ static const uint32_t c1541_cell_size[];
- int generate_bitstream(int track, int head, int speed_zone, UINT8 *trackbuf, int &track_size, floppy_image *image);
+ int generate_bitstream(int track, int head, int speed_zone, uint8_t *trackbuf, int &track_size, floppy_image *image);
};
extern const floppy_format_type FLOPPY_G64_FORMAT;
diff --git a/src/lib/formats/gtp_cas.cpp b/src/lib/formats/gtp_cas.cpp
index 577d878b67a..fd3a16932b3 100644
--- a/src/lib/formats/gtp_cas.cpp
+++ b/src/lib/formats/gtp_cas.cpp
@@ -20,8 +20,8 @@
#define GTP_BLOCK_TURBO 0x01
#define GTP_BLOCK_NAME 0x10
-static INT16 wave_data;
-static INT16 len;
+static int16_t wave_data;
+static int16_t len;
#define PULSE_WIDTH 30
#define PERIOD_BASE 150
@@ -32,7 +32,7 @@ static INT16 len;
#define INTERBLOCK_PAUSE 100000
-static void gtp_output_wave( INT16 **buffer, int length ) {
+static void gtp_output_wave( int16_t **buffer, int length ) {
if ( buffer == nullptr ) {
return;
}
@@ -45,7 +45,7 @@ static void gtp_output_wave( INT16 **buffer, int length ) {
-static int gtp_mod_1( INT16 **buffer )
+static int gtp_mod_1( int16_t **buffer )
{
wave_data = WAVE_LOW;
gtp_output_wave(buffer,PULSE_WIDTH);
@@ -63,7 +63,7 @@ static int gtp_mod_1( INT16 **buffer )
return PERIOD_1 * 2;
}
-static int gtp_mod_0( INT16 **buffer )
+static int gtp_mod_0( int16_t **buffer )
{
wave_data = WAVE_LOW;
gtp_output_wave(buffer,PULSE_WIDTH);
@@ -75,9 +75,9 @@ static int gtp_mod_0( INT16 **buffer )
return PERIOD_0;
}
-static int gtp_byte( INT16 **buffer, UINT8 val )
+static int gtp_byte( int16_t **buffer, uint8_t val )
{
- UINT8 b;
+ uint8_t b;
int j,size = 0;
for (j=0;j<8;j++) {
b = (val >> j) & 1;
@@ -90,7 +90,7 @@ static int gtp_byte( INT16 **buffer, UINT8 val )
return size;
}
-static int gtp_sync( INT16 **buffer )
+static int gtp_sync( int16_t **buffer )
{
int i;
int size = 0;
@@ -107,7 +107,7 @@ static int gtp_sync( INT16 **buffer )
return size;
}
-static int gtp_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
+static int gtp_cas_to_wav_size( const uint8_t *casdata, int caslen ) {
int size,n;
size = 0;
n = 0;
@@ -128,7 +128,7 @@ static int gtp_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
return size;
}
-static int gtp_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
+static int gtp_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) {
int i,size,n;
size = 0;
n = 0;
diff --git a/src/lib/formats/hect_tap.cpp b/src/lib/formats/hect_tap.cpp
index d24c5625c78..4f823fb24e5 100644
--- a/src/lib/formats/hect_tap.cpp
+++ b/src/lib/formats/hect_tap.cpp
@@ -40,7 +40,7 @@ enum
/*******************************************************************
Generate one high-low cycle of sample data
********************************************************************/
-static inline int hector_tap_cycle(INT16 *buffer, int sample_pos, int high, int low)
+static inline int hector_tap_cycle(int16_t *buffer, int sample_pos, int high, int low)
{
int i = 0;
@@ -62,7 +62,7 @@ static inline int hector_tap_cycle(INT16 *buffer, int sample_pos, int high, int
}
-static inline int hector_tap_byte(INT16 *buffer, int sample_pos, UINT8 data)
+static inline int hector_tap_byte(int16_t *buffer, int sample_pos, uint8_t data)
{
/* Writing an entire byte */
int i, samples;
@@ -81,7 +81,7 @@ static inline int hector_tap_byte(INT16 *buffer, int sample_pos, UINT8 data)
}
-static inline int hector_tap_synchro(INT16 *buffer, int sample_pos, int nb_synchro)
+static inline int hector_tap_synchro(int16_t *buffer, int sample_pos, int nb_synchro)
{
/* Writing an entire byte */
int i, samples;
@@ -94,7 +94,7 @@ static inline int hector_tap_synchro(INT16 *buffer, int sample_pos, int nb_synch
}
-static int hector_handle_tap(INT16 *buffer, const UINT8 *casdata)
+static int hector_handle_tap(int16_t *buffer, const uint8_t *casdata)
{
int data_pos, sample_count/*, block_count*/;
int previous_block=0;
@@ -110,7 +110,7 @@ static int hector_handle_tap(INT16 *buffer, const UINT8 *casdata)
/* on the entire file*/
while( data_pos < cas_size )
{
- UINT16 block_size;
+ uint16_t block_size;
if (previous_block == 0xFE)
/* Starting a block with 150 cycle of synchro to let time to Hector to do the job ! */
@@ -152,7 +152,7 @@ static int hector_handle_tap(INT16 *buffer, const UINT8 *casdata)
*******************************************************************/
-static int hector_handle_forth_tap(INT16 *buffer, const UINT8 *casdata)
+static int hector_handle_forth_tap(int16_t *buffer, const uint8_t *casdata)
{
int data_pos, sample_count/*, block_count*/;
/*int previous_block=0;*/
@@ -169,7 +169,7 @@ static int hector_handle_forth_tap(INT16 *buffer, const UINT8 *casdata)
/* on the entire file*/
while( data_pos < cas_size )
{
- UINT16 block_size;
+ uint16_t block_size;
/* Starting a block with 768 cycle of synchro*/
sample_count += hector_tap_synchro( buffer, sample_count, 768 );
@@ -204,7 +204,7 @@ static int hector_handle_forth_tap(INT16 *buffer, const UINT8 *casdata)
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int hector_tap_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int hector_tap_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return hector_handle_tap( buffer, bytes );
}
@@ -213,7 +213,7 @@ static int hector_tap_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
/*******************************************************************
Calculate the number of samples needed for this tape image FORTH
********************************************************************/
-static int hector_tap_forth_to_wav_size(const UINT8 *casdata, int caslen)
+static int hector_tap_forth_to_wav_size(const uint8_t *casdata, int caslen)
{
cas_size = caslen ;
@@ -223,7 +223,7 @@ static int hector_tap_forth_to_wav_size(const UINT8 *casdata, int caslen)
/*******************************************************************
Generate samples for the tape image FORTH
********************************************************************/
-static int hector_tap_forth_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int hector_tap_forth_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return hector_handle_forth_tap( buffer, bytes ); //forth removed here !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
}
@@ -232,7 +232,7 @@ static int hector_tap_forth_fill_wave(INT16 *buffer, int sample_count, UINT8 *by
/*******************************************************************
Calculate the number of samples needed for this tape image classical
********************************************************************/
-static int hector_tap_to_wav_size(const UINT8 *casdata, int caslen)
+static int hector_tap_to_wav_size(const uint8_t *casdata, int caslen)
{
cas_size = caslen ;
diff --git a/src/lib/formats/hxchfe_dsk.cpp b/src/lib/formats/hxchfe_dsk.cpp
index 1e532e140b2..f85b1d31678 100644
--- a/src/lib/formats/hxchfe_dsk.cpp
+++ b/src/lib/formats/hxchfe_dsk.cpp
@@ -12,28 +12,28 @@
typedef struct picfileformatheader_
{
- UINT8 HEADERSIGNATURE[8]; // 0: "HXCPICFE"
- UINT8 formatrevision; // 8: Revision 0
- UINT8 number_of_track; // 9: Number of track in the file
- UINT8 number_of_side; // 10: Number of valid side (Not used by the emulator)
- UINT8 track_encoding; // 11: Track Encoding mode
+ uint8_t HEADERSIGNATURE[8]; // 0: "HXCPICFE"
+ uint8_t formatrevision; // 8: Revision 0
+ uint8_t number_of_track; // 9: Number of track in the file
+ uint8_t number_of_side; // 10: Number of valid side (Not used by the emulator)
+ uint8_t track_encoding; // 11: Track Encoding mode
// (Used for the write support - Please see the list above)
- UINT16 bitRate; // 12: Bitrate in Kbit/s. Ex : 250=250000bits/s
+ uint16_t bitRate; // 12: Bitrate in Kbit/s. Ex : 250=250000bits/s
// Max value : 500
- UINT16 floppyRPM; // 14: Rotation per minute (Not used by the emulator)
- UINT8 floppyinterfacemode; // 16: Floppy interface mode. (Please see the list above.)
- UINT8 dnu; // 17: Free
- UINT16 track_list_offset; // 18: Offset of the track list LUT in block of 512 bytes
+ uint16_t floppyRPM; // 14: Rotation per minute (Not used by the emulator)
+ uint8_t floppyinterfacemode; // 16: Floppy interface mode. (Please see the list above.)
+ uint8_t dnu; // 17: Free
+ uint16_t track_list_offset; // 18: Offset of the track list LUT in block of 512 bytes
// (Ex: 1=0x200)
- UINT8 write_allowed; // 20: The Floppy image is write protected ?
- UINT8 single_step; // 21: 0xFF : Single Step – 0x00 Double Step mode
- UINT8 track0s0_altencoding; // 22: 0x00 : Use an alternate track_encoding for track 0 Side 0
- UINT8 track0s0_encoding; // 23: alternate track_encoding for track 0 Side 0
- UINT8 track0s1_altencoding; // 24: 0x00 : Use an alternate track_encoding for track 0 Side 1
- UINT8 track0s1_encoding; // 25: alternate track_encoding for track 0 Side 1
+ uint8_t write_allowed; // 20: The Floppy image is write protected ?
+ uint8_t single_step; // 21: 0xFF : Single Step – 0x00 Double Step mode
+ uint8_t track0s0_altencoding; // 22: 0x00 : Use an alternate track_encoding for track 0 Side 0
+ uint8_t track0s0_encoding; // 23: alternate track_encoding for track 0 Side 0
+ uint8_t track0s1_altencoding; // 24: 0x00 : Use an alternate track_encoding for track 0 Side 1
+ uint8_t track0s1_encoding; // 25: alternate track_encoding for track 0 Side 1
} picfileformatheader;
- Byte order for UINT16 is little endian.
+ Byte order for uint16_t is little endian.
floppyintefacemode values are defined in the header file as floppymode_t,
track_encodings are defined as encoding_t
@@ -46,8 +46,8 @@
typedef struct pictrack_
{
- UINT16 offset; // Offset of the track data in blocks of 512 bytes (Ex: 2=0x400)
- UINT16 track_len; // Length of the track data in byte.
+ uint16_t offset; // Offset of the track data in blocks of 512 bytes (Ex: 2=0x400)
+ uint16_t track_len; // Length of the track data in byte.
} pictrack;
This table has a size of number_of_track*4 bytes.
@@ -142,9 +142,9 @@ bool hfe_format::supports_save() const
return true;
}
-int hfe_format::identify(io_generic *io, UINT32 form_factor)
+int hfe_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 header[8];
+ uint8_t header[8];
io_generic_read(io, &header, 0, sizeof(header));
if ( memcmp( header, HFE_FORMAT_HEADER, 8 ) ==0) {
@@ -153,10 +153,10 @@ int hfe_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool hfe_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool hfe_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 header[HEADER_LENGTH];
- UINT8 track_table[TRACK_TABLE_LENGTH];
+ uint8_t header[HEADER_LENGTH];
+ uint8_t track_table[TRACK_TABLE_LENGTH];
int drivecyl, driveheads;
image->get_maximal_geometry(drivecyl, driveheads);
@@ -233,7 +233,7 @@ bool hfe_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
}
// Load the tracks
- std::vector<UINT8> cylinder_buffer;
+ std::vector<uint8_t> cylinder_buffer;
for(int cyl=0; cyl < m_cylinders; cyl++)
{
// actual data read
@@ -288,7 +288,7 @@ bool hfe_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
return success;
}
-void hfe_format::generate_track_from_hfe_bitstream(int cyl, int head, int samplelength, const UINT8 *trackbuf, int track_end, floppy_image *image)
+void hfe_format::generate_track_from_hfe_bitstream(int cyl, int head, int samplelength, const uint8_t *trackbuf, int track_end, floppy_image *image)
{
// HFE has a minor issue: The track images do not sum up to 200 ms.
// Tracks are samples at 250 kbit/s for both FM and MFM, which yields
@@ -315,11 +315,11 @@ void hfe_format::generate_track_from_hfe_bitstream(int cyl, int head, int sample
// Cell: | AAAABBBB | = MG_1 = | BBBBAAAA |
// | AAAAAAAA | = MG_0 = | BBBBBBBB |
- std::vector<UINT32> &dest = image->get_buffer(cyl, head, 0);
+ std::vector<uint32_t> &dest = image->get_buffer(cyl, head, 0);
dest.clear();
// Start with MG_A
- UINT32 cbit = floppy_image::MG_A;
+ uint32_t cbit = floppy_image::MG_A;
int offset = 0x100;
@@ -329,7 +329,7 @@ void hfe_format::generate_track_from_hfe_bitstream(int cyl, int head, int sample
track_end -= 0x0100;
}
- UINT8 current = 0;
+ uint8_t current = 0;
int time = 0;
dest.push_back(cbit | time);
@@ -402,11 +402,11 @@ void hfe_format::generate_track_from_hfe_bitstream(int cyl, int head, int sample
bool hfe_format::save(io_generic *io, floppy_image *image)
{
- std::vector<UINT8> cylbuf;
+ std::vector<uint8_t> cylbuf;
cylbuf.resize(0x6200);
- UINT8 header[HEADER_LENGTH];
- UINT8 track_table[TRACK_TABLE_LENGTH];
+ uint8_t header[HEADER_LENGTH];
+ uint8_t track_table[TRACK_TABLE_LENGTH];
int track_end = 0x61c0;
int samplelength = 2000;
@@ -498,7 +498,7 @@ bool hfe_format::save(io_generic *io, floppy_image *image)
return true;
}
-void hfe_format::generate_hfe_bitstream_from_track(int cyl, int head, int& samplelength, encoding_t& encoding, UINT8 *cylinder_buffer, int track_end, floppy_image *image)
+void hfe_format::generate_hfe_bitstream_from_track(int cyl, int head, int& samplelength, encoding_t& encoding, uint8_t *cylinder_buffer, int track_end, floppy_image *image)
{
// We are using an own implementation here because the result of the
// parent class method would require some post-processing that we
@@ -508,7 +508,7 @@ void hfe_format::generate_hfe_bitstream_from_track(int cyl, int head, int& sampl
// as the original code
// No subtracks definded
- std::vector<UINT32> &tbuf = image->get_buffer(cyl, head, 0);
+ std::vector<uint32_t> &tbuf = image->get_buffer(cyl, head, 0);
if (tbuf.size() <= 1)
{
// Unformatted track
@@ -563,7 +563,7 @@ void hfe_format::generate_hfe_bitstream_from_track(int cyl, int head, int& sampl
}
// Start at the write splice
- UINT32 splice = image->get_write_splice_position(cyl, head, 0);
+ uint32_t splice = image->get_write_splice_position(cyl, head, 0);
int cur_pos = splice;
int cur_entry = 0;
@@ -579,7 +579,7 @@ void hfe_format::generate_hfe_bitstream_from_track(int cyl, int head, int& sampl
int max_period = int(samplelength*1.25);
int phase_adjust = 0;
int freq_hist = 0;
- UINT32 next = 0;
+ uint32_t next = 0;
int offset = 0x100;
@@ -590,8 +590,8 @@ void hfe_format::generate_hfe_bitstream_from_track(int cyl, int head, int& sampl
track_end -= 0x0100;
}
- UINT8 bit = 0x01;
- UINT8 current = 0;
+ uint8_t bit = 0x01;
+ uint8_t current = 0;
while (next < 200000000) {
int edge = tbuf[cur_entry] & floppy_image::TIME_MASK;
diff --git a/src/lib/formats/hxchfe_dsk.h b/src/lib/formats/hxchfe_dsk.h
index 4f322f659c3..af4652ca9bf 100644
--- a/src/lib/formats/hxchfe_dsk.h
+++ b/src/lib/formats/hxchfe_dsk.h
@@ -48,8 +48,8 @@ class hfe_format : public floppy_image_format_t
public:
hfe_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual const char *name() const override;
@@ -61,8 +61,8 @@ public:
void set_encoding(encoding_t enc) { m_selected_encoding = enc; }
private:
- void generate_track_from_hfe_bitstream(int track, int head, int samplelength, const UINT8 *trackbuf, int track_end, floppy_image *image);
- void generate_hfe_bitstream_from_track(int track, int head, int& samplelength, encoding_t& encoding, UINT8 *trackbuf, int track_end, floppy_image *image);
+ void generate_track_from_hfe_bitstream(int track, int head, int samplelength, const uint8_t *trackbuf, int track_end, floppy_image *image);
+ void generate_hfe_bitstream_from_track(int track, int head, int& samplelength, encoding_t& encoding, uint8_t *trackbuf, int track_end, floppy_image *image);
// Header fields from the HFE format
int m_cylinders; // Number of track in the file
diff --git a/src/lib/formats/hxcmfm_dsk.cpp b/src/lib/formats/hxcmfm_dsk.cpp
index 07a05d3e2f6..274c8a7695f 100644
--- a/src/lib/formats/hxcmfm_dsk.cpp
+++ b/src/lib/formats/hxcmfm_dsk.cpp
@@ -11,24 +11,24 @@
struct MFMIMG
{
- UINT8 headername[7];
+ uint8_t headername[7];
- UINT16 number_of_track;
- UINT8 number_of_side;
+ uint16_t number_of_track;
+ uint8_t number_of_side;
- UINT16 floppyRPM;
- UINT16 floppyBitRate;
- UINT8 floppyiftype;
+ uint16_t floppyRPM;
+ uint16_t floppyBitRate;
+ uint8_t floppyiftype;
- UINT32 mfmtracklistoffset;
+ uint32_t mfmtracklistoffset;
};
struct MFMTRACKIMG
{
- UINT16 track_number;
- UINT8 side_number;
- UINT32 mfmtracksize;
- UINT32 mfmtrackoffset;
+ uint16_t track_number;
+ uint8_t side_number;
+ uint32_t mfmtracksize;
+ uint32_t mfmtrackoffset;
};
#pragma pack()
@@ -57,9 +57,9 @@ bool mfm_format::supports_save() const
return true;
}
-int mfm_format::identify(io_generic *io, UINT32 form_factor)
+int mfm_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 header[7];
+ uint8_t header[7];
io_generic_read(io, &header, 0, sizeof(header));
if ( memcmp( header, MFM_FORMAT_HEADER, 6 ) ==0) {
@@ -68,7 +68,7 @@ int mfm_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool mfm_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool mfm_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
MFMIMG header;
MFMTRACKIMG trackdesc;
@@ -76,7 +76,7 @@ bool mfm_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
// read header
io_generic_read(io, &header, 0, sizeof(header));
int counter = 0;
- std::vector<UINT8> trackbuf;
+ std::vector<uint8_t> trackbuf;
for(int track=0; track < header.number_of_track; track++) {
for(int side=0; side < header.number_of_side; side++) {
// read location of
@@ -117,7 +117,7 @@ bool mfm_format::save(io_generic *io, floppy_image *image)
int tpos = sizeof(MFMIMG);
int dpos = tpos + track_count*head_count*sizeof(MFMTRACKIMG);
- UINT8 trackbuf[150000/8];
+ uint8_t trackbuf[150000/8];
for(int track=0; track < track_count; track++) {
for(int side=0; side < head_count; side++) {
diff --git a/src/lib/formats/hxcmfm_dsk.h b/src/lib/formats/hxcmfm_dsk.h
index 63238ab2006..eb2f8ae245b 100644
--- a/src/lib/formats/hxcmfm_dsk.h
+++ b/src/lib/formats/hxcmfm_dsk.h
@@ -18,8 +18,8 @@ class mfm_format : public floppy_image_format_t
public:
mfm_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual const char *name() const override;
diff --git a/src/lib/formats/imageutl.h b/src/lib/formats/imageutl.h
index 7da4a184112..5e478cfb1e7 100644
--- a/src/lib/formats/imageutl.h
+++ b/src/lib/formats/imageutl.h
@@ -25,43 +25,43 @@ unsigned short ccitt_crc16_one( unsigned short crc, const unsigned char data );
* Alignment-friendly integer placement
* ----------------------------------------------------------------------- */
-static inline void place_integer_be(void *ptr, size_t offset, size_t size, UINT64 value)
+static inline void place_integer_be(void *ptr, size_t offset, size_t size, uint64_t value)
{
- UINT8 *byte_ptr = ((UINT8 *) ptr) + offset;
- UINT16 val16;
- UINT32 val32;
+ uint8_t *byte_ptr = ((uint8_t *) ptr) + offset;
+ uint16_t val16;
+ uint32_t val32;
switch(size)
{
case 2:
- val16 = big_endianize_int16((UINT16) value);
+ val16 = big_endianize_int16((uint16_t) value);
memcpy(byte_ptr, &val16, sizeof(val16));
break;
case 4:
- val32 = big_endianize_int32((UINT32) value);
+ val32 = big_endianize_int32((uint32_t) value);
memcpy(byte_ptr, &val32, sizeof(val32));
break;
default:
- if (size >= 1) byte_ptr[0] = (UINT8) (value >> ((size - 1) * 8));
- if (size >= 2) byte_ptr[1] = (UINT8) (value >> ((size - 2) * 8));
- if (size >= 3) byte_ptr[2] = (UINT8) (value >> ((size - 3) * 8));
- if (size >= 4) byte_ptr[3] = (UINT8) (value >> ((size - 4) * 8));
- if (size >= 5) byte_ptr[4] = (UINT8) (value >> ((size - 5) * 8));
- if (size >= 6) byte_ptr[5] = (UINT8) (value >> ((size - 6) * 8));
- if (size >= 7) byte_ptr[6] = (UINT8) (value >> ((size - 7) * 8));
- if (size >= 8) byte_ptr[7] = (UINT8) (value >> ((size - 8) * 8));
+ if (size >= 1) byte_ptr[0] = (uint8_t) (value >> ((size - 1) * 8));
+ if (size >= 2) byte_ptr[1] = (uint8_t) (value >> ((size - 2) * 8));
+ if (size >= 3) byte_ptr[2] = (uint8_t) (value >> ((size - 3) * 8));
+ if (size >= 4) byte_ptr[3] = (uint8_t) (value >> ((size - 4) * 8));
+ if (size >= 5) byte_ptr[4] = (uint8_t) (value >> ((size - 5) * 8));
+ if (size >= 6) byte_ptr[5] = (uint8_t) (value >> ((size - 6) * 8));
+ if (size >= 7) byte_ptr[6] = (uint8_t) (value >> ((size - 7) * 8));
+ if (size >= 8) byte_ptr[7] = (uint8_t) (value >> ((size - 8) * 8));
break;
}
}
-static inline UINT64 pick_integer_be(const void *ptr, size_t offset, size_t size)
+static inline uint64_t pick_integer_be(const void *ptr, size_t offset, size_t size)
{
- UINT64 result = 0;
- const UINT8 *byte_ptr = ((const UINT8 *) ptr) + offset;
- UINT16 val16;
- UINT32 val32;
+ uint64_t result = 0;
+ const uint8_t *byte_ptr = ((const uint8_t *) ptr) + offset;
+ uint16_t val16;
+ uint32_t val32;
switch(size)
{
@@ -80,56 +80,56 @@ static inline UINT64 pick_integer_be(const void *ptr, size_t offset, size_t size
break;
default:
- if (size >= 1) result |= ((UINT64) byte_ptr[0]) << ((size - 1) * 8);
- if (size >= 2) result |= ((UINT64) byte_ptr[1]) << ((size - 2) * 8);
- if (size >= 3) result |= ((UINT64) byte_ptr[2]) << ((size - 3) * 8);
- if (size >= 4) result |= ((UINT64) byte_ptr[3]) << ((size - 4) * 8);
- if (size >= 5) result |= ((UINT64) byte_ptr[4]) << ((size - 5) * 8);
- if (size >= 6) result |= ((UINT64) byte_ptr[5]) << ((size - 6) * 8);
- if (size >= 7) result |= ((UINT64) byte_ptr[6]) << ((size - 7) * 8);
- if (size >= 8) result |= ((UINT64) byte_ptr[7]) << ((size - 8) * 8);
+ if (size >= 1) result |= ((uint64_t) byte_ptr[0]) << ((size - 1) * 8);
+ if (size >= 2) result |= ((uint64_t) byte_ptr[1]) << ((size - 2) * 8);
+ if (size >= 3) result |= ((uint64_t) byte_ptr[2]) << ((size - 3) * 8);
+ if (size >= 4) result |= ((uint64_t) byte_ptr[3]) << ((size - 4) * 8);
+ if (size >= 5) result |= ((uint64_t) byte_ptr[4]) << ((size - 5) * 8);
+ if (size >= 6) result |= ((uint64_t) byte_ptr[5]) << ((size - 6) * 8);
+ if (size >= 7) result |= ((uint64_t) byte_ptr[6]) << ((size - 7) * 8);
+ if (size >= 8) result |= ((uint64_t) byte_ptr[7]) << ((size - 8) * 8);
break;
}
return result;
}
-static inline void place_integer_le(void *ptr, size_t offset, size_t size, UINT64 value)
+static inline void place_integer_le(void *ptr, size_t offset, size_t size, uint64_t value)
{
- UINT8 *byte_ptr = ((UINT8 *) ptr) + offset;
- UINT16 val16;
- UINT32 val32;
+ uint8_t *byte_ptr = ((uint8_t *) ptr) + offset;
+ uint16_t val16;
+ uint32_t val32;
switch(size)
{
case 2:
- val16 = little_endianize_int16((UINT16) value);
+ val16 = little_endianize_int16((uint16_t) value);
memcpy(byte_ptr, &val16, sizeof(val16));
break;
case 4:
- val32 = little_endianize_int32((UINT32) value);
+ val32 = little_endianize_int32((uint32_t) value);
memcpy(byte_ptr, &val32, sizeof(val32));
break;
default:
- if (size >= 1) byte_ptr[0] = (UINT8) (value >> (0 * 8));
- if (size >= 2) byte_ptr[1] = (UINT8) (value >> (1 * 8));
- if (size >= 3) byte_ptr[2] = (UINT8) (value >> (2 * 8));
- if (size >= 4) byte_ptr[3] = (UINT8) (value >> (3 * 8));
- if (size >= 5) byte_ptr[4] = (UINT8) (value >> (4 * 8));
- if (size >= 6) byte_ptr[5] = (UINT8) (value >> (5 * 8));
- if (size >= 7) byte_ptr[6] = (UINT8) (value >> (6 * 8));
- if (size >= 8) byte_ptr[7] = (UINT8) (value >> (7 * 8));
+ if (size >= 1) byte_ptr[0] = (uint8_t) (value >> (0 * 8));
+ if (size >= 2) byte_ptr[1] = (uint8_t) (value >> (1 * 8));
+ if (size >= 3) byte_ptr[2] = (uint8_t) (value >> (2 * 8));
+ if (size >= 4) byte_ptr[3] = (uint8_t) (value >> (3 * 8));
+ if (size >= 5) byte_ptr[4] = (uint8_t) (value >> (4 * 8));
+ if (size >= 6) byte_ptr[5] = (uint8_t) (value >> (5 * 8));
+ if (size >= 7) byte_ptr[6] = (uint8_t) (value >> (6 * 8));
+ if (size >= 8) byte_ptr[7] = (uint8_t) (value >> (7 * 8));
break;
}
}
-static inline UINT64 pick_integer_le(const void *ptr, size_t offset, size_t size)
+static inline uint64_t pick_integer_le(const void *ptr, size_t offset, size_t size)
{
- UINT64 result = 0;
- const UINT8 *byte_ptr = ((const UINT8 *) ptr) + offset;
- UINT16 val16;
- UINT32 val32;
+ uint64_t result = 0;
+ const uint8_t *byte_ptr = ((const uint8_t *) ptr) + offset;
+ uint16_t val16;
+ uint32_t val32;
switch(size)
{
@@ -148,14 +148,14 @@ static inline UINT64 pick_integer_le(const void *ptr, size_t offset, size_t size
break;
default:
- if (size >= 1) result |= ((UINT64) byte_ptr[0]) << (0 * 8);
- if (size >= 2) result |= ((UINT64) byte_ptr[1]) << (1 * 8);
- if (size >= 3) result |= ((UINT64) byte_ptr[2]) << (2 * 8);
- if (size >= 4) result |= ((UINT64) byte_ptr[3]) << (3 * 8);
- if (size >= 5) result |= ((UINT64) byte_ptr[4]) << (4 * 8);
- if (size >= 6) result |= ((UINT64) byte_ptr[5]) << (5 * 8);
- if (size >= 7) result |= ((UINT64) byte_ptr[6]) << (6 * 8);
- if (size >= 8) result |= ((UINT64) byte_ptr[7]) << (7 * 8);
+ if (size >= 1) result |= ((uint64_t) byte_ptr[0]) << (0 * 8);
+ if (size >= 2) result |= ((uint64_t) byte_ptr[1]) << (1 * 8);
+ if (size >= 3) result |= ((uint64_t) byte_ptr[2]) << (2 * 8);
+ if (size >= 4) result |= ((uint64_t) byte_ptr[3]) << (3 * 8);
+ if (size >= 5) result |= ((uint64_t) byte_ptr[4]) << (4 * 8);
+ if (size >= 6) result |= ((uint64_t) byte_ptr[5]) << (5 * 8);
+ if (size >= 7) result |= ((uint64_t) byte_ptr[6]) << (6 * 8);
+ if (size >= 8) result |= ((uint64_t) byte_ptr[7]) << (7 * 8);
break;
}
return result;
diff --git a/src/lib/formats/imd_dsk.cpp b/src/lib/formats/imd_dsk.cpp
index 13f155b638a..8f3626aedbb 100644
--- a/src/lib/formats/imd_dsk.cpp
+++ b/src/lib/formats/imd_dsk.cpp
@@ -17,7 +17,7 @@ struct imddsk_tag
int heads;
int tracks;
int sector_size;
- UINT64 track_offsets[84*2]; /* offset within data for each track */
+ uint64_t track_offsets[84*2]; /* offset within data for each track */
};
@@ -32,7 +32,7 @@ static struct imddsk_tag *get_tag(floppy_image_legacy *floppy)
FLOPPY_IDENTIFY( imd_dsk_identify )
{
- UINT8 header[3];
+ uint8_t header[3];
floppy_image_read(floppy, header, 0, 3);
if (header[0]=='I' && header[1]=='M' && header[2]=='D') {
@@ -53,16 +53,16 @@ static int imd_get_tracks_per_disk(floppy_image_legacy *floppy)
return get_tag(floppy)->tracks;
}
-static UINT64 imd_get_track_offset(floppy_image_legacy *floppy, int head, int track)
+static uint64_t imd_get_track_offset(floppy_image_legacy *floppy, int head, int track)
{
return get_tag(floppy)->track_offsets[(track<<1) + head];
}
-static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, UINT64 *offset)
+static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, uint64_t *offset)
{
- UINT64 offs = 0;
- UINT8 header[5];
- UINT8 sector_num;
+ uint64_t offs = 0;
+ uint8_t header[5];
+ uint8_t sector_num;
int i;
@@ -98,9 +98,9 @@ static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, in
static floperr_t internal_imd_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen)
{
- UINT64 offset;
+ uint64_t offset;
floperr_t err;
- UINT8 header[1];
+ uint8_t header[1];
// take sector offset
err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
@@ -137,25 +137,25 @@ static floperr_t imd_read_indexed_sector(floppy_image_legacy *floppy, int head,
return internal_imd_read_sector(floppy, head, track, sector, TRUE, buffer, buflen);
}
-static floperr_t imd_expand_file(floppy_image_legacy *floppy , UINT64 offset , size_t amount)
+static floperr_t imd_expand_file(floppy_image_legacy *floppy , uint64_t offset , size_t amount)
{
if (amount == 0) {
return FLOPPY_ERROR_SUCCESS;
}
- UINT64 file_size = floppy_image_size(floppy);
+ uint64_t file_size = floppy_image_size(floppy);
if (offset > file_size) {
return FLOPPY_ERROR_INTERNAL;
}
- UINT64 size_after_off = file_size - offset;
+ uint64_t size_after_off = file_size - offset;
if (size_after_off == 0) {
return FLOPPY_ERROR_SUCCESS;
}
- auto buffer = global_alloc_array(UINT8 , size_after_off);
+ auto buffer = global_alloc_array(uint8_t , size_after_off);
// Read the part of file after offset
floppy_image_read(floppy , buffer , offset , size_after_off);
@@ -172,7 +172,7 @@ static floperr_t imd_expand_file(floppy_image_legacy *floppy , UINT64 offset , s
struct imddsk_tag *tag = get_tag(floppy);
for (int track = 0; track < tag->tracks; track++) {
for (int head = 0; head < tag->heads; head++) {
- UINT64 *track_off = &(tag->track_offsets[ (track << 1) + head ]);
+ uint64_t *track_off = &(tag->track_offsets[ (track << 1) + head ]);
if (*track_off >= offset) {
*track_off += amount;
}
@@ -184,9 +184,9 @@ static floperr_t imd_expand_file(floppy_image_legacy *floppy , UINT64 offset , s
static floperr_t imd_write_indexed_sector(floppy_image_legacy *floppy, int head, int track, int sector_index, const void *buffer, size_t buflen, int ddam)
{
- UINT64 offset;
+ uint64_t offset;
floperr_t err;
- UINT8 header[1];
+ uint8_t header[1];
// take sector offset
err = get_offset(floppy, head, track, sector_index, TRUE, &offset);
@@ -222,7 +222,7 @@ static floperr_t imd_write_indexed_sector(floppy_image_legacy *floppy, int head,
return FLOPPY_ERROR_SUCCESS;
}
-static floperr_t imd_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
+static floperr_t imd_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
{
floperr_t err;
err = get_offset(floppy, head, track, sector, FALSE, nullptr);
@@ -235,14 +235,14 @@ static floperr_t imd_get_sector_length(floppy_image_legacy *floppy, int head, in
return FLOPPY_ERROR_SUCCESS;
}
-static floperr_t imd_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags)
+static floperr_t imd_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags)
{
- UINT64 offset;
- UINT8 header[5];
- UINT8 hd;
- UINT8 tr;
- UINT32 sector_size;
- UINT8 sector_num;
+ uint64_t offset;
+ uint8_t header[5];
+ uint8_t hd;
+ uint8_t tr;
+ uint32_t sector_size;
+ uint8_t sector_num;
offset = imd_get_track_offset(floppy,head,track);
floppy_image_read(floppy, header, offset, 5);
@@ -279,7 +279,7 @@ static floperr_t imd_get_indexed_sector_info(floppy_image_legacy *floppy, int he
*sector_length = sector_size;
}
if (flags) {
- UINT8 skip;
+ uint8_t skip;
if (head & 0x40) {
if (head & 0x80) {
skip = 3;
@@ -302,8 +302,8 @@ FLOPPY_CONSTRUCT( imd_dsk_construct )
{
struct FloppyCallbacks *callbacks;
struct imddsk_tag *tag;
- UINT8 header[0x100];
- UINT64 pos = 0;
+ uint8_t header[0x100];
+ uint64_t pos = 0;
int sector_size = 0;
int sector_num;
int i;
@@ -409,7 +409,7 @@ void imd_format::fixnum(char *start, char *end) const
};
}
-int imd_format::identify(io_generic *io, UINT32 form_factor)
+int imd_format::identify(io_generic *io, uint32_t form_factor)
{
char h[4];
@@ -420,13 +420,13 @@ int imd_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool imd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool imd_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT64 size = io_generic_size(io);
- std::vector<UINT8> img(size);
+ uint64_t size = io_generic_size(io);
+ std::vector<uint8_t> img(size);
io_generic_read(io, &img[0], 0, size);
- UINT64 pos;
+ uint64_t pos;
for(pos=0; pos < size && img[pos] != 0x1a; pos++) {};
pos++;
@@ -434,16 +434,16 @@ bool imd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
return false;
while(pos < size) {
- UINT8 mode = img[pos++];
- UINT8 track = img[pos++];
- UINT8 head = img[pos++];
- UINT8 sector_count = img[pos++];
- UINT8 ssize = img[pos++];
+ uint8_t mode = img[pos++];
+ uint8_t track = img[pos++];
+ uint8_t head = img[pos++];
+ uint8_t sector_count = img[pos++];
+ uint8_t ssize = img[pos++];
if(ssize == 0xff)
throw emu_fatalerror("imd_format: Unsupported variable sector size on track %d head %d", track, head);
- UINT32 actual_size = ssize < 7 ? 128 << ssize : 8192;
+ uint32_t actual_size = ssize < 7 ? 128 << ssize : 8192;
static const int rates[3] = { 500000, 300000, 250000 };
bool fm = mode < 3;
@@ -451,12 +451,12 @@ bool imd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
int rpm = form_factor == floppy_image::FF_8 || (form_factor == floppy_image::FF_525 && rate >= 300000) ? 360 : 300;
int cell_count = (fm ? 1 : 2)*rate*60/rpm;
- const UINT8 *snum = &img[pos];
+ const uint8_t *snum = &img[pos];
pos += sector_count;
- const UINT8 *tnum = head & 0x80 ? &img[pos] : nullptr;
+ const uint8_t *tnum = head & 0x80 ? &img[pos] : nullptr;
if(tnum)
pos += sector_count;
- const UINT8 *hnum = head & 0x40 ? &img[pos] : nullptr;
+ const uint8_t *hnum = head & 0x40 ? &img[pos] : nullptr;
if(hnum)
pos += sector_count;
@@ -467,7 +467,7 @@ bool imd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
desc_pc_sector sects[256];
for(int i=0; i<sector_count; i++) {
- UINT8 stype = img[pos++];
+ uint8_t stype = img[pos++];
sects[i].track = tnum ? tnum[i] : track;
sects[i].head = hnum ? hnum[i] : head;
sects[i].sector = snum[i];
@@ -482,7 +482,7 @@ bool imd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
sects[i].bad_crc = stype == 5 || stype == 6 || stype == 7 || stype == 8;
if(stype == 2 || stype == 4 || stype == 6 || stype == 8) {
- sects[i].data = global_alloc_array(UINT8, actual_size);
+ sects[i].data = global_alloc_array(uint8_t, actual_size);
memset(sects[i].data, img[pos++], actual_size);
} else {
diff --git a/src/lib/formats/imd_dsk.h b/src/lib/formats/imd_dsk.h
index 5f26de88d75..306fd544c7e 100644
--- a/src/lib/formats/imd_dsk.h
+++ b/src/lib/formats/imd_dsk.h
@@ -19,8 +19,8 @@ class imd_format : public floppy_image_format_t
public:
imd_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual const char *name() const override;
virtual const char *description() const override;
diff --git a/src/lib/formats/ioprocs.cpp b/src/lib/formats/ioprocs.cpp
index 0be7cab97f4..69943c13dc0 100644
--- a/src/lib/formats/ioprocs.cpp
+++ b/src/lib/formats/ioprocs.cpp
@@ -17,7 +17,7 @@ static void stdio_closeproc(void *file)
fclose((FILE*)file);
}
-static int stdio_seekproc(void *file, INT64 offset, int whence)
+static int stdio_seekproc(void *file, int64_t offset, int whence)
{
return fseek((FILE*)file, (long) offset, whence);
}
@@ -32,7 +32,7 @@ static size_t stdio_writeproc(void *file, const void *buffer, size_t length)
return fwrite(buffer, 1, length, (FILE*)file);
}
-static UINT64 stdio_filesizeproc(void *file)
+static uint64_t stdio_filesizeproc(void *file)
{
long l, sz;
l = ftell((FILE*)file);
@@ -71,7 +71,7 @@ static void corefile_closeproc(void *file)
delete (util::core_file*)file;
}
-static int corefile_seekproc(void *file, INT64 offset, int whence)
+static int corefile_seekproc(void *file, int64_t offset, int whence)
{
return ((util::core_file*)file)->seek(offset, whence);
}
@@ -86,15 +86,15 @@ static size_t corefile_writeproc(void *file, const void *buffer, size_t length)
return ((util::core_file*)file)->write(buffer, length);
}
-static UINT64 corefile_filesizeproc(void *file)
+static uint64_t corefile_filesizeproc(void *file)
{
const auto l = ((util::core_file*)file)->tell();
if (((util::core_file*)file)->seek(0, SEEK_END))
return (size_t) -1;
const auto sz = ((util::core_file*)file)->tell();
if (((util::core_file*)file)->seek(l, SEEK_SET))
- return UINT64(-1);
- return UINT64(sz);
+ return uint64_t(-1);
+ return uint64_t(sz);
}
const struct io_procs corefile_ioprocs =
@@ -121,7 +121,7 @@ const struct io_procs corefile_ioprocs_noclose =
calls for accessing generic IO
*********************************************************************/
-static void io_generic_seek(struct io_generic *genio, UINT64 offset)
+static void io_generic_seek(struct io_generic *genio, uint64_t offset)
{
genio->procs->seekproc(genio->file, offset, SEEK_SET);
}
@@ -136,9 +136,9 @@ void io_generic_close(struct io_generic *genio)
-void io_generic_read(struct io_generic *genio, void *buffer, UINT64 offset, size_t length)
+void io_generic_read(struct io_generic *genio, void *buffer, uint64_t offset, size_t length)
{
- UINT64 size;
+ uint64_t size;
size_t bytes_read;
size = io_generic_size(genio);
@@ -151,17 +151,17 @@ void io_generic_read(struct io_generic *genio, void *buffer, UINT64 offset, size
io_generic_seek(genio, offset);
bytes_read = genio->procs->readproc(genio->file, buffer, length);
}
- memset(((UINT8 *) buffer) + bytes_read, genio->filler, length - bytes_read);
+ memset(((uint8_t *) buffer) + bytes_read, genio->filler, length - bytes_read);
}
-void io_generic_write(struct io_generic *genio, const void *buffer, UINT64 offset, size_t length)
+void io_generic_write(struct io_generic *genio, const void *buffer, uint64_t offset, size_t length)
{
- UINT64 filler_size = 0;
+ uint64_t filler_size = 0;
char filler_buffer[1024];
size_t bytes_to_write;
- UINT64 size;
+ uint64_t size;
size = io_generic_size(genio);
@@ -191,9 +191,9 @@ void io_generic_write(struct io_generic *genio, const void *buffer, UINT64 offse
-void io_generic_write_filler(struct io_generic *genio, UINT8 filler, UINT64 offset, size_t length)
+void io_generic_write_filler(struct io_generic *genio, uint8_t filler, uint64_t offset, size_t length)
{
- UINT8 buffer[512];
+ uint8_t buffer[512];
size_t this_length;
memset(buffer, filler, std::min(length, sizeof(buffer)));
@@ -209,7 +209,7 @@ void io_generic_write_filler(struct io_generic *genio, UINT8 filler, UINT64 offs
-UINT64 io_generic_size(struct io_generic *genio)
+uint64_t io_generic_size(struct io_generic *genio)
{
return genio->procs->filesizeproc(genio->file);
}
diff --git a/src/lib/formats/ioprocs.h b/src/lib/formats/ioprocs.h
index 08acbe45295..ac032d5e1f3 100644
--- a/src/lib/formats/ioprocs.h
+++ b/src/lib/formats/ioprocs.h
@@ -24,10 +24,10 @@
struct io_procs
{
void (*closeproc)(void *file);
- int (*seekproc)(void *file, INT64 offset, int whence);
+ int (*seekproc)(void *file, int64_t offset, int whence);
size_t (*readproc)(void *file, void *buffer, size_t length);
size_t (*writeproc)(void *file, const void *buffer, size_t length);
- UINT64 (*filesizeproc)(void *file);
+ uint64_t (*filesizeproc)(void *file);
};
@@ -36,7 +36,7 @@ struct io_generic
{
const struct io_procs *procs;
void *file;
- UINT8 filler;
+ uint8_t filler;
};
@@ -62,10 +62,10 @@ extern const struct io_procs corefile_ioprocs_noclose;
void io_generic_close(struct io_generic *genio);
-void io_generic_read(struct io_generic *genio, void *buffer, UINT64 offset, size_t length);
-void io_generic_write(struct io_generic *genio, const void *buffer, UINT64 offset, size_t length);
-void io_generic_write_filler(struct io_generic *genio, UINT8 filler, UINT64 offset, size_t length);
-UINT64 io_generic_size(struct io_generic *genio);
+void io_generic_read(struct io_generic *genio, void *buffer, uint64_t offset, size_t length);
+void io_generic_write(struct io_generic *genio, const void *buffer, uint64_t offset, size_t length);
+void io_generic_write_filler(struct io_generic *genio, uint8_t filler, uint64_t offset, size_t length);
+uint64_t io_generic_size(struct io_generic *genio);
diff --git a/src/lib/formats/ipf_dsk.cpp b/src/lib/formats/ipf_dsk.cpp
index 40ad1229ab8..da50e850ea8 100644
--- a/src/lib/formats/ipf_dsk.cpp
+++ b/src/lib/formats/ipf_dsk.cpp
@@ -30,10 +30,10 @@ bool ipf_format::supports_save() const
return false;
}
-int ipf_format::identify(io_generic *io, UINT32 form_factor)
+int ipf_format::identify(io_generic *io, uint32_t form_factor)
{
- static const UINT8 refh[12] = { 0x43, 0x41, 0x50, 0x53, 0x00, 0x00, 0x00, 0x0c, 0x1c, 0xd5, 0x73, 0xba };
- UINT8 h[12];
+ static const uint8_t refh[12] = { 0x43, 0x41, 0x50, 0x53, 0x00, 0x00, 0x00, 0x0c, 0x1c, 0xd5, 0x73, 0xba };
+ uint8_t h[12];
io_generic_read(io, h, 0, 12);
if(!memcmp(h, refh, 12))
@@ -42,34 +42,34 @@ int ipf_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool ipf_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool ipf_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT64 size = io_generic_size(io);
- std::vector<UINT8> data(size);
+ uint64_t size = io_generic_size(io);
+ std::vector<uint8_t> data(size);
io_generic_read(io, &data[0], 0, size);
bool res = parse(data, image);
return res;
}
-UINT32 ipf_format::r32(const UINT8 *p)
+uint32_t ipf_format::r32(const uint8_t *p)
{
return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
}
-UINT32 ipf_format::rb(const UINT8 *&p, int count)
+uint32_t ipf_format::rb(const uint8_t *&p, int count)
{
- UINT32 v = 0;
+ uint32_t v = 0;
for(int i=0; i<count; i++)
v = (v << 8) | *p++;
return v;
}
-UINT32 ipf_format::crc32r(const UINT8 *data, UINT32 size)
+uint32_t ipf_format::crc32r(const uint8_t *data, uint32_t size)
{
// Reversed crc32
- UINT32 crc = 0xffffffff;
- for(UINT32 i=0; i != size; i++) {
+ uint32_t crc = 0xffffffff;
+ for(uint32_t i=0; i != size; i++) {
crc = crc ^ data[i];
for(int j=0; j<8; j++)
if(crc & 1)
@@ -80,7 +80,7 @@ UINT32 ipf_format::crc32r(const UINT8 *data, UINT32 size)
return ~crc;
}
-bool ipf_format::parse(std::vector<UINT8> &data, floppy_image *image)
+bool ipf_format::parse(std::vector<uint8_t> &data, floppy_image *image)
{
image->set_variant(floppy_image::DSDD); // Not handling anything else yet
tcount = 84*2+1; // Usual max
@@ -93,7 +93,7 @@ bool ipf_format::parse(std::vector<UINT8> &data, floppy_image *image)
return res;
}
-bool ipf_format::parse_info(const UINT8 *info)
+bool ipf_format::parse_info(const uint8_t *info)
{
type = r32(info+12);
if(type != 1)
@@ -116,7 +116,7 @@ bool ipf_format::parse_info(const UINT8 *info)
return true;
}
-ipf_format::track_info *ipf_format::get_index(UINT32 idx)
+ipf_format::track_info *ipf_format::get_index(uint32_t idx)
{
if(idx > 1000)
return nullptr;
@@ -131,7 +131,7 @@ ipf_format::track_info *ipf_format::get_index(UINT32 idx)
return tinfos+idx;
}
-bool ipf_format::parse_imge(const UINT8 *imge)
+bool ipf_format::parse_imge(const uint8_t *imge)
{
track_info *t = get_index(r32(imge+64));
if(!t)
@@ -165,7 +165,7 @@ bool ipf_format::parse_imge(const UINT8 *imge)
return true;
}
-bool ipf_format::parse_data(const UINT8 *data, UINT32 &pos, UINT32 max_extra_size)
+bool ipf_format::parse_data(const uint8_t *data, uint32_t &pos, uint32_t max_extra_size)
{
track_info *t = get_index(r32(data+24));
if(!t)
@@ -182,7 +182,7 @@ bool ipf_format::parse_data(const UINT8 *data, UINT32 &pos, UINT32 max_extra_siz
return true;
}
-bool ipf_format::scan_one_tag(std::vector<UINT8> &data, UINT32 &pos, UINT8 *&tag, UINT32 &tsize)
+bool ipf_format::scan_one_tag(std::vector<uint8_t> &data, uint32_t &pos, uint8_t *&tag, uint32_t &tsize)
{
if(data.size()-pos < 12)
return false;
@@ -190,7 +190,7 @@ bool ipf_format::scan_one_tag(std::vector<UINT8> &data, UINT32 &pos, UINT8 *&tag
tsize = r32(tag+4);
if(data.size()-pos < tsize)
return false;
- UINT32 crc = r32(tag+8);
+ uint32_t crc = r32(tag+8);
tag[8] = tag[9] = tag[10] = tag[11] = 0;
if(crc32r(tag, tsize) != crc)
return false;
@@ -198,13 +198,13 @@ bool ipf_format::scan_one_tag(std::vector<UINT8> &data, UINT32 &pos, UINT8 *&tag
return true;
}
-bool ipf_format::scan_all_tags(std::vector<UINT8> &data)
+bool ipf_format::scan_all_tags(std::vector<uint8_t> &data)
{
- UINT32 pos = 0;
- UINT32 size = data.size();
+ uint32_t pos = 0;
+ uint32_t size = data.size();
while(pos != size) {
- UINT8 *tag;
- UINT32 tsize;
+ uint8_t *tag;
+ uint32_t tsize;
if(!scan_one_tag(data, pos, tag, tsize))
return false;
@@ -245,7 +245,7 @@ bool ipf_format::scan_all_tags(std::vector<UINT8> &data)
bool ipf_format::generate_tracks(floppy_image *image)
{
- for(UINT32 i = 0; i != tcount; i++) {
+ for(uint32_t i = 0; i != tcount; i++) {
track_info *t = tinfos + i;
if(t->info_set && t->data) {
if(!generate_track(t, image))
@@ -257,14 +257,14 @@ bool ipf_format::generate_tracks(floppy_image *image)
return true;
}
-void ipf_format::rotate(std::vector<UINT32> &track, UINT32 offset, UINT32 size)
+void ipf_format::rotate(std::vector<uint32_t> &track, uint32_t offset, uint32_t size)
{
- UINT32 done = 0;
- for(UINT32 bpos=0; done < size; bpos++) {
- UINT32 pos = bpos;
- UINT32 hold = track[pos];
+ uint32_t done = 0;
+ for(uint32_t bpos=0; done < size; bpos++) {
+ uint32_t pos = bpos;
+ uint32_t hold = track[pos];
for(;;) {
- UINT32 npos = pos+offset;
+ uint32_t npos = pos+offset;
if(npos >= size)
npos -= size;
if(npos == bpos)
@@ -278,11 +278,11 @@ void ipf_format::rotate(std::vector<UINT32> &track, UINT32 offset, UINT32 size)
}
}
-void ipf_format::mark_track_splice(std::vector<UINT32> &track, UINT32 offset, UINT32 size)
+void ipf_format::mark_track_splice(std::vector<uint32_t> &track, uint32_t offset, uint32_t size)
{
for(int i=0; i<3; i++) {
- UINT32 pos = (offset + i) % size;
- UINT32 v = track[pos];
+ uint32_t pos = (offset + i) % size;
+ uint32_t v = track[pos];
if((v & floppy_image::MG_MASK) == MG_0)
v = (v & floppy_image::TIME_MASK) | MG_1;
else if((v & floppy_image::MG_MASK) == MG_1)
@@ -291,13 +291,13 @@ void ipf_format::mark_track_splice(std::vector<UINT32> &track, UINT32 offset, UI
}
}
-void ipf_format::timing_set(std::vector<UINT32> &track, UINT32 start, UINT32 end, UINT32 time)
+void ipf_format::timing_set(std::vector<uint32_t> &track, uint32_t start, uint32_t end, uint32_t time)
{
- for(UINT32 i=start; i != end; i++)
+ for(uint32_t i=start; i != end; i++)
track[i] = (track[i] & floppy_image::MG_MASK) | time;
}
-bool ipf_format::generate_timings(track_info *t, std::vector<UINT32> &track, const std::vector<UINT32> &data_pos, const std::vector<UINT32> &gap_pos)
+bool ipf_format::generate_timings(track_info *t, std::vector<uint32_t> &track, const std::vector<uint32_t> &data_pos, const std::vector<uint32_t> &gap_pos)
{
timing_set(track, 0, t->size_cells, 2000);
@@ -362,8 +362,8 @@ bool ipf_format::generate_timings(track_info *t, std::vector<UINT32> &track, con
break;
case 9: {
- UINT32 mask = r32(t->data + 32*t->block_count + 12);
- for(UINT32 i=1; i<t->block_count; i++)
+ uint32_t mask = r32(t->data + 32*t->block_count + 12);
+ for(uint32_t i=1; i<t->block_count; i++)
timing_set(track, data_pos[i], gap_pos[i], mask & (1 << (i-1)) ? 1900 : 2100);
break;
}
@@ -391,14 +391,14 @@ bool ipf_format::generate_track(track_info *t, floppy_image *image)
if(t->index_cells >= t->size_cells)
return false;
- std::vector<UINT32> track(t->size_cells);
- std::vector<UINT32> data_pos(t->block_count+1);
- std::vector<UINT32> gap_pos(t->block_count);
- std::vector<UINT32> splice_pos(t->block_count);
+ std::vector<uint32_t> track(t->size_cells);
+ std::vector<uint32_t> data_pos(t->block_count+1);
+ std::vector<uint32_t> gap_pos(t->block_count);
+ std::vector<uint32_t> splice_pos(t->block_count);
bool context = false;
- UINT32 pos = 0;
- for(UINT32 i = 0; i != t->block_count; i++) {
+ uint32_t pos = 0;
+ for(uint32_t i = 0; i != t->block_count; i++) {
if(!generate_block(t, i, i == t->block_count-1 ? t->size_cells - t->index_cells : 0xffffffff, track, pos, data_pos[i], gap_pos[i], splice_pos[i], context)) {
return false;
}
@@ -423,19 +423,19 @@ bool ipf_format::generate_track(track_info *t, floppy_image *image)
return true;
}
-void ipf_format::track_write_raw(std::vector<UINT32>::iterator &tpos, const UINT8 *data, UINT32 cells, bool &context)
+void ipf_format::track_write_raw(std::vector<uint32_t>::iterator &tpos, const uint8_t *data, uint32_t cells, bool &context)
{
- for(UINT32 i=0; i != cells; i++)
+ for(uint32_t i=0; i != cells; i++)
*tpos++ = data[i>>3] & (0x80 >> (i & 7)) ? MG_1 : MG_0;
if(cells)
context = tpos[-1] == MG_1;
}
-void ipf_format::track_write_mfm(std::vector<UINT32>::iterator &tpos, const UINT8 *data, UINT32 start_offset, UINT32 patlen, UINT32 cells, bool &context)
+void ipf_format::track_write_mfm(std::vector<uint32_t>::iterator &tpos, const uint8_t *data, uint32_t start_offset, uint32_t patlen, uint32_t cells, bool &context)
{
patlen *= 2;
- for(UINT32 i=0; i != cells; i++) {
- UINT32 pos = (i + start_offset) % patlen;
+ for(uint32_t i=0; i != cells; i++) {
+ uint32_t pos = (i + start_offset) % patlen;
bool bit = data[pos>>4] & (0x80 >> ((pos >> 1) & 7));
if(pos & 1) {
*tpos++ = bit ? MG_1 : MG_0;
@@ -445,22 +445,22 @@ void ipf_format::track_write_mfm(std::vector<UINT32>::iterator &tpos, const UINT
}
}
-void ipf_format::track_write_weak(std::vector<UINT32>::iterator &tpos, UINT32 cells)
+void ipf_format::track_write_weak(std::vector<uint32_t>::iterator &tpos, uint32_t cells)
{
- for(UINT32 i=0; i != cells; i++)
+ for(uint32_t i=0; i != cells; i++)
*tpos++ = floppy_image::MG_N;
}
-bool ipf_format::generate_block_data(const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator tpos, std::vector<UINT32>::iterator tlimit, bool &context)
+bool ipf_format::generate_block_data(const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator tpos, std::vector<uint32_t>::iterator tlimit, bool &context)
{
for(;;) {
if(data >= dlimit)
return false;
- UINT8 val = *data++;
+ uint8_t val = *data++;
if((val >> 5) > dlimit-data)
return false;
- UINT32 param = rb(data, val >> 5);
- UINT32 tleft = tlimit - tpos;
+ uint32_t param = rb(data, val >> 5);
+ uint32_t tleft = tlimit - tpos;
switch(val & 0x1f) {
case 0: // End of description
return !tleft;
@@ -493,11 +493,11 @@ bool ipf_format::generate_block_data(const UINT8 *data, const UINT8 *dlimit, std
}
}
-bool ipf_format::generate_block_gap_0(UINT32 gap_cells, UINT8 pattern, UINT32 &spos, UINT32 ipos, std::vector<UINT32>::iterator &tpos, bool &context)
+bool ipf_format::generate_block_gap_0(uint32_t gap_cells, uint8_t pattern, uint32_t &spos, uint32_t ipos, std::vector<uint32_t>::iterator &tpos, bool &context)
{
spos = ipos >= 16 && ipos+16 <= gap_cells ? ipos : gap_cells >> 1;
track_write_mfm(tpos, &pattern, 0, 8, spos, context);
- UINT32 delta = 0;
+ uint32_t delta = 0;
if(gap_cells & 1) {
*tpos++ = MG_0;
delta++;
@@ -506,16 +506,16 @@ bool ipf_format::generate_block_gap_0(UINT32 gap_cells, UINT8 pattern, UINT32 &s
return true;
}
-bool ipf_format::gap_description_to_reserved_size(const UINT8 *&data, const UINT8 *dlimit, UINT32 &res_size)
+bool ipf_format::gap_description_to_reserved_size(const uint8_t *&data, const uint8_t *dlimit, uint32_t &res_size)
{
res_size = 0;
for(;;) {
if(data >= dlimit)
return false;
- UINT8 val = *data++;
+ uint8_t val = *data++;
if((val >> 5) > dlimit-data)
return false;
- UINT32 param = rb(data, val >> 5);
+ uint32_t param = rb(data, val >> 5);
switch(val & 0x1f) {
case 0:
return true;
@@ -531,23 +531,23 @@ bool ipf_format::gap_description_to_reserved_size(const UINT8 *&data, const UINT
}
}
-bool ipf_format::generate_gap_from_description(const UINT8 *&data, const UINT8 *dlimit, std::vector<UINT32>::iterator tpos, UINT32 size, bool pre, bool &context)
+bool ipf_format::generate_gap_from_description(const uint8_t *&data, const uint8_t *dlimit, std::vector<uint32_t>::iterator tpos, uint32_t size, bool pre, bool &context)
{
- const UINT8 *data1 = data;
- UINT32 res_size;
+ const uint8_t *data1 = data;
+ uint32_t res_size;
if(!gap_description_to_reserved_size(data1, dlimit, res_size))
return false;
if(res_size > size)
return false;
- UINT8 pattern[16];
+ uint8_t pattern[16];
memset(pattern, 0, sizeof(pattern));
- UINT32 pattern_size = 0;
+ uint32_t pattern_size = 0;
- UINT32 pos = 0, block_size = 0;
+ uint32_t pos = 0, block_size = 0;
for(;;) {
- UINT8 val = *data++;
- UINT32 param = rb(data, val >> 5);
+ uint8_t val = *data++;
+ uint32_t param = rb(data, val >> 5);
switch(val & 0x1f) {
case 0:
return size == pos;
@@ -601,7 +601,7 @@ bool ipf_format::generate_gap_from_description(const UINT8 *&data, const UINT8 *
}
-bool ipf_format::generate_block_gap_1(UINT32 gap_cells, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator &tpos, bool &context)
+bool ipf_format::generate_block_gap_1(uint32_t gap_cells, uint32_t &spos, uint32_t ipos, const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator &tpos, bool &context)
{
if(ipos >= 16 && ipos < gap_cells-16)
spos = ipos;
@@ -610,7 +610,7 @@ bool ipf_format::generate_block_gap_1(UINT32 gap_cells, UINT32 &spos, UINT32 ipo
return generate_gap_from_description(data, dlimit, tpos, gap_cells, true, context);
}
-bool ipf_format::generate_block_gap_2(UINT32 gap_cells, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator &tpos, bool &context)
+bool ipf_format::generate_block_gap_2(uint32_t gap_cells, uint32_t &spos, uint32_t ipos, const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator &tpos, bool &context)
{
if(ipos >= 16 && ipos < gap_cells-16)
spos = ipos;
@@ -619,13 +619,13 @@ bool ipf_format::generate_block_gap_2(UINT32 gap_cells, UINT32 &spos, UINT32 ipo
return generate_gap_from_description(data, dlimit, tpos, gap_cells, false, context);
}
-bool ipf_format::generate_block_gap_3(UINT32 gap_cells, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator &tpos, bool &context)
+bool ipf_format::generate_block_gap_3(uint32_t gap_cells, uint32_t &spos, uint32_t ipos, const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator &tpos, bool &context)
{
if(ipos >= 16 && ipos < gap_cells-16)
spos = ipos;
else {
- UINT32 presize, postsize;
- const UINT8 *data1 = data;
+ uint32_t presize, postsize;
+ const uint8_t *data1 = data;
if(!gap_description_to_reserved_size(data1, dlimit, presize))
return false;
if(!gap_description_to_reserved_size(data1, dlimit, postsize))
@@ -637,7 +637,7 @@ bool ipf_format::generate_block_gap_3(UINT32 gap_cells, UINT32 &spos, UINT32 ipo
}
if(!generate_gap_from_description(data, dlimit, tpos, spos, true, context))
return false;
- UINT32 delta = 0;
+ uint32_t delta = 0;
if(gap_cells & 1) {
tpos[spos] = MG_0;
delta++;
@@ -646,7 +646,7 @@ bool ipf_format::generate_block_gap_3(UINT32 gap_cells, UINT32 &spos, UINT32 ipo
return generate_gap_from_description(data, dlimit, tpos+spos+delta, gap_cells - spos - delta, false, context);
}
-bool ipf_format::generate_block_gap(UINT32 gap_type, UINT32 gap_cells, UINT8 pattern, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator tpos, bool &context)
+bool ipf_format::generate_block_gap(uint32_t gap_type, uint32_t gap_cells, uint8_t pattern, uint32_t &spos, uint32_t ipos, const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator tpos, bool &context)
{
switch(gap_type) {
case 0:
@@ -662,13 +662,13 @@ bool ipf_format::generate_block_gap(UINT32 gap_type, UINT32 gap_cells, UINT8 pat
}
}
-bool ipf_format::generate_block(track_info *t, UINT32 idx, UINT32 ipos, std::vector<UINT32> &track, UINT32 &pos, UINT32 &dpos, UINT32 &gpos, UINT32 &spos, bool &context)
+bool ipf_format::generate_block(track_info *t, uint32_t idx, uint32_t ipos, std::vector<uint32_t> &track, uint32_t &pos, uint32_t &dpos, uint32_t &gpos, uint32_t &spos, bool &context)
{
- const UINT8 *data = t->data;
- const UINT8 *data_end = t->data + t->data_size;
- const UINT8 *thead = data + 32*idx;
- UINT32 data_cells = r32(thead);
- UINT32 gap_cells = r32(thead+4);
+ const uint8_t *data = t->data;
+ const uint8_t *data_end = t->data + t->data_size;
+ const uint8_t *thead = data + 32*idx;
+ uint32_t data_cells = r32(thead);
+ uint32_t gap_cells = r32(thead+4);
if(gap_cells < 8)
gap_cells = 0;
@@ -694,13 +694,13 @@ bool ipf_format::generate_block(track_info *t, UINT32 idx, UINT32 ipos, std::vec
return true;
}
-UINT32 ipf_format::block_compute_real_size(track_info *t)
+uint32_t ipf_format::block_compute_real_size(track_info *t)
{
- UINT32 size = 0;
- const UINT8 *thead = t->data;
+ uint32_t size = 0;
+ const uint8_t *thead = t->data;
for(unsigned int i=0; i != t->block_count; i++) {
- UINT32 data_cells = r32(thead);
- UINT32 gap_cells = r32(thead+4);
+ uint32_t data_cells = r32(thead);
+ uint32_t gap_cells = r32(thead+4);
if(gap_cells < 8)
gap_cells = 0;
diff --git a/src/lib/formats/ipf_dsk.h b/src/lib/formats/ipf_dsk.h
index 0df0e4c3285..d4f5fcb6ac5 100644
--- a/src/lib/formats/ipf_dsk.h
+++ b/src/lib/formats/ipf_dsk.h
@@ -10,8 +10,8 @@ class ipf_format : public floppy_image_format_t
public:
ipf_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual const char *name() const override;
virtual const char *description() const override;
@@ -20,68 +20,68 @@ public:
private:
struct track_info {
- UINT32 cylinder, head, type;
- UINT32 sigtype, process, reserved[3];
- UINT32 size_bytes, size_cells;
- UINT32 index_bytes, index_cells;
- UINT32 datasize_cells, gapsize_cells;
- UINT32 block_count, weak_bits;
+ uint32_t cylinder, head, type;
+ uint32_t sigtype, process, reserved[3];
+ uint32_t size_bytes, size_cells;
+ uint32_t index_bytes, index_cells;
+ uint32_t datasize_cells, gapsize_cells;
+ uint32_t block_count, weak_bits;
- UINT32 data_size_bits;
+ uint32_t data_size_bits;
bool info_set;
- const UINT8 *data;
- UINT32 data_size;
+ const uint8_t *data;
+ uint32_t data_size;
};
track_info *tinfos;
- UINT32 tcount;
+ uint32_t tcount;
- UINT32 type, release, revision;
- UINT32 encoder_type, encoder_revision, origin;
- UINT32 min_cylinder, max_cylinder, min_head, max_head;
- UINT32 credit_day, credit_time;
- UINT32 platform[4], extra[5];
+ uint32_t type, release, revision;
+ uint32_t encoder_type, encoder_revision, origin;
+ uint32_t min_cylinder, max_cylinder, min_head, max_head;
+ uint32_t credit_day, credit_time;
+ uint32_t platform[4], extra[5];
- UINT32 crc32r(const UINT8 *data, UINT32 size);
+ uint32_t crc32r(const uint8_t *data, uint32_t size);
- bool parse_info(const UINT8 *info);
- bool parse_imge(const UINT8 *imge);
- bool parse_data(const UINT8 *data, UINT32 &pos, UINT32 max_extra_size);
+ bool parse_info(const uint8_t *info);
+ bool parse_imge(const uint8_t *imge);
+ bool parse_data(const uint8_t *data, uint32_t &pos, uint32_t max_extra_size);
- bool scan_one_tag(std::vector<UINT8> &data, UINT32 &pos, UINT8 *&tag, UINT32 &tsize);
- bool scan_all_tags(std::vector<UINT8> &data);
- static UINT32 r32(const UINT8 *p);
- static UINT32 rb(const UINT8 *&p, int count);
+ bool scan_one_tag(std::vector<uint8_t> &data, uint32_t &pos, uint8_t *&tag, uint32_t &tsize);
+ bool scan_all_tags(std::vector<uint8_t> &data);
+ static uint32_t r32(const uint8_t *p);
+ static uint32_t rb(const uint8_t *&p, int count);
- track_info *get_index(UINT32 idx);
+ track_info *get_index(uint32_t idx);
- void track_write_raw(std::vector<UINT32>::iterator &tpos, const UINT8 *data, UINT32 cells, bool &context);
- void track_write_mfm(std::vector<UINT32>::iterator &tpos, const UINT8 *data, UINT32 start_offset, UINT32 patlen, UINT32 cells, bool &context);
- void track_write_weak(std::vector<UINT32>::iterator &tpos, UINT32 cells);
- bool generate_block_data(const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator tpos, std::vector<UINT32>::iterator tlimit, bool &context);
+ void track_write_raw(std::vector<uint32_t>::iterator &tpos, const uint8_t *data, uint32_t cells, bool &context);
+ void track_write_mfm(std::vector<uint32_t>::iterator &tpos, const uint8_t *data, uint32_t start_offset, uint32_t patlen, uint32_t cells, bool &context);
+ void track_write_weak(std::vector<uint32_t>::iterator &tpos, uint32_t cells);
+ bool generate_block_data(const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator tpos, std::vector<uint32_t>::iterator tlimit, bool &context);
- bool gap_description_to_reserved_size(const UINT8 *&data, const UINT8 *dlimit, UINT32 &res_size);
- bool generate_gap_from_description(const UINT8 *&data, const UINT8 *dlimit, std::vector<UINT32>::iterator tpos, UINT32 size, bool pre, bool &context);
- bool generate_block_gap_0(UINT32 gap_cells, UINT8 pattern, UINT32 &spos, UINT32 ipos, std::vector<UINT32>::iterator &tpos, bool &context);
- bool generate_block_gap_1(UINT32 gap_cells, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator &tpos, bool &context);
- bool generate_block_gap_2(UINT32 gap_cells, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator &tpos, bool &context);
- bool generate_block_gap_3(UINT32 gap_cells, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator &tpos, bool &context);
- bool generate_block_gap(UINT32 gap_type, UINT32 gap_cells, UINT8 pattern, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator tpos, bool &context);
+ bool gap_description_to_reserved_size(const uint8_t *&data, const uint8_t *dlimit, uint32_t &res_size);
+ bool generate_gap_from_description(const uint8_t *&data, const uint8_t *dlimit, std::vector<uint32_t>::iterator tpos, uint32_t size, bool pre, bool &context);
+ bool generate_block_gap_0(uint32_t gap_cells, uint8_t pattern, uint32_t &spos, uint32_t ipos, std::vector<uint32_t>::iterator &tpos, bool &context);
+ bool generate_block_gap_1(uint32_t gap_cells, uint32_t &spos, uint32_t ipos, const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator &tpos, bool &context);
+ bool generate_block_gap_2(uint32_t gap_cells, uint32_t &spos, uint32_t ipos, const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator &tpos, bool &context);
+ bool generate_block_gap_3(uint32_t gap_cells, uint32_t &spos, uint32_t ipos, const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator &tpos, bool &context);
+ bool generate_block_gap(uint32_t gap_type, uint32_t gap_cells, uint8_t pattern, uint32_t &spos, uint32_t ipos, const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator tpos, bool &context);
- bool generate_block(track_info *t, UINT32 idx, UINT32 ipos, std::vector<UINT32> &track, UINT32 &pos, UINT32 &dpos, UINT32 &gpos, UINT32 &spos, bool &context);
- UINT32 block_compute_real_size(track_info *t);
+ bool generate_block(track_info *t, uint32_t idx, uint32_t ipos, std::vector<uint32_t> &track, uint32_t &pos, uint32_t &dpos, uint32_t &gpos, uint32_t &spos, bool &context);
+ uint32_t block_compute_real_size(track_info *t);
- void timing_set(std::vector<UINT32> &track, UINT32 start, UINT32 end, UINT32 time);
- bool generate_timings(track_info *t, std::vector<UINT32> &track, const std::vector<UINT32> &data_pos, const std::vector<UINT32> &gap_pos);
+ void timing_set(std::vector<uint32_t> &track, uint32_t start, uint32_t end, uint32_t time);
+ bool generate_timings(track_info *t, std::vector<uint32_t> &track, const std::vector<uint32_t> &data_pos, const std::vector<uint32_t> &gap_pos);
- void rotate(std::vector<UINT32> &track, UINT32 offset, UINT32 size);
- void mark_track_splice(std::vector<UINT32> &track, UINT32 offset, UINT32 size);
+ void rotate(std::vector<uint32_t> &track, uint32_t offset, uint32_t size);
+ void mark_track_splice(std::vector<uint32_t> &track, uint32_t offset, uint32_t size);
bool generate_track(track_info *t, floppy_image *image);
bool generate_tracks(floppy_image *image);
- bool parse(std::vector<UINT8> &data, floppy_image *image);
+ bool parse(std::vector<uint8_t> &data, floppy_image *image);
};
extern const floppy_format_type FLOPPY_IPF_FORMAT;
diff --git a/src/lib/formats/jvc_dsk.cpp b/src/lib/formats/jvc_dsk.cpp
index ce364d9efe2..30417eb3315 100644
--- a/src/lib/formats/jvc_dsk.cpp
+++ b/src/lib/formats/jvc_dsk.cpp
@@ -39,9 +39,9 @@ bool jvc_format::parse_header(io_generic *io, int &header_size, int &tracks, int
{
// The JVC format has a header whose size is the size of the image modulo 256. Currently, we only
// handle up to five header bytes
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
header_size = size % 256;
- UINT8 header[5];
+ uint8_t header[5];
// if we know that this is a header of a bad size, we can fail
// immediately; otherwise read the header
@@ -75,13 +75,13 @@ bool jvc_format::parse_header(io_generic *io, int &header_size, int &tracks, int
return tracks * heads * sectors * sector_size == (size - header_size);
}
-int jvc_format::identify(io_generic *io, UINT32 form_factor)
+int jvc_format::identify(io_generic *io, uint32_t form_factor)
{
int header_size, tracks, heads, sectors, sector_size, sector_base_id;
return parse_header(io, header_size, tracks, heads, sectors, sector_size, sector_base_id) ? 50 : 0;
}
-bool jvc_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool jvc_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
int header_size, track_count, head_count, sector_count, sector_size, sector_base_id;
@@ -99,7 +99,7 @@ bool jvc_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
for (int head = 0; head < head_count ; head++)
{
desc_pc_sector sectors[256];
- UINT8 sector_data[10000];
+ uint8_t sector_data[10000];
int sector_offset = 0;
for (int i = 0; i < sector_count; i++)
@@ -128,10 +128,10 @@ bool jvc_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
bool jvc_format::save(io_generic *io, floppy_image *image)
{
- UINT8 bitstream[500000/8];
- UINT8 sector_data[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sector_data[50000];
desc_xs sectors[256];
- UINT64 file_offset = 0;
+ uint64_t file_offset = 0;
int track_count, head_count;
image->get_actual_geometry(track_count, head_count);
@@ -139,7 +139,7 @@ bool jvc_format::save(io_generic *io, floppy_image *image)
// we'll write a header if the disk is two-sided
if (head_count == 2)
{
- UINT8 header[2];
+ uint8_t header[2];
header[0] = 18;
header[1] = 2;
io_generic_write(io, header, file_offset, sizeof(header));
diff --git a/src/lib/formats/jvc_dsk.h b/src/lib/formats/jvc_dsk.h
index 244c84a8592..bb74fbf8ac4 100644
--- a/src/lib/formats/jvc_dsk.h
+++ b/src/lib/formats/jvc_dsk.h
@@ -24,11 +24,11 @@ public:
struct jvc_header
{
- UINT8 sectors_per_track;
- UINT8 side_count;
- UINT8 sector_size;
- UINT8 first_sector_id;
- UINT8 sector_attribute_flag;
+ uint8_t sectors_per_track;
+ uint8_t side_count;
+ uint8_t sector_size;
+ uint8_t first_sector_id;
+ uint8_t sector_attribute_flag;
int header_size;
};
@@ -36,8 +36,8 @@ public:
virtual const char *description() const override;
virtual const char *extensions() const override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual bool supports_save() const override;
diff --git a/src/lib/formats/kc_cas.cpp b/src/lib/formats/kc_cas.cpp
index 2e9638d19c9..713def9ac83 100644
--- a/src/lib/formats/kc_cas.cpp
+++ b/src/lib/formats/kc_cas.cpp
@@ -43,7 +43,7 @@ static int kc_image_size;
/*******************************************************************
Generate one high-low cycle of sample data
********************************************************************/
-static inline int kc_cas_cycle(INT16 *buffer, int sample_pos, int len)
+static inline int kc_cas_cycle(int16_t *buffer, int sample_pos, int len)
{
int num_samples = KC_WAV_FREQUENCY / (len * 2);
@@ -63,7 +63,7 @@ static inline int kc_cas_cycle(INT16 *buffer, int sample_pos, int len)
/*******************************************************************
Generate n samples of silence
********************************************************************/
-static inline int kc_cas_silence(INT16 *buffer, int sample_pos, int len)
+static inline int kc_cas_silence(int16_t *buffer, int sample_pos, int len)
{
int i = 0;
@@ -78,7 +78,7 @@ static inline int kc_cas_silence(INT16 *buffer, int sample_pos, int len)
/*******************************************************************
Generate samples for 1 byte
********************************************************************/
-static inline int kc_cas_byte(INT16 *buffer, int sample_pos, UINT8 data)
+static inline int kc_cas_byte(int16_t *buffer, int sample_pos, uint8_t data)
{
int samples = 0;
@@ -103,7 +103,7 @@ static inline int kc_cas_byte(INT16 *buffer, int sample_pos, UINT8 data)
return samples;
}
-static int kc_handle_cass(INT16 *buffer, const UINT8 *casdata, int type)
+static int kc_handle_cass(int16_t *buffer, const uint8_t *casdata, int type)
{
int data_pos = (type == KC_IMAGE_KCC || type == KC_IMAGE_KCM) ? 0 : 16;
int sample_count = 0;
@@ -119,7 +119,7 @@ static int kc_handle_cass(INT16 *buffer, const UINT8 *casdata, int type)
// on the entire file
while( data_pos < kc_image_size )
{
- UINT8 checksum = 0;
+ uint8_t checksum = 0;
// 200 cycles of BIT_1 every block
for (int i=0; i<200; i++)
@@ -142,7 +142,7 @@ static int kc_handle_cass(INT16 *buffer, const UINT8 *casdata, int type)
// write the 128 bytes of the block
for (int i=0; i<128; i++)
{
- UINT8 data = 0;
+ uint8_t data = 0;
if (data_pos < kc_image_size)
data = casdata[data_pos++];
@@ -184,13 +184,13 @@ static int kc_handle_cass(INT16 *buffer, const UINT8 *casdata, int type)
}
-static int kc_handle_kcc(INT16 *buffer, const UINT8 *casdata)
+static int kc_handle_kcc(int16_t *buffer, const uint8_t *casdata)
{
return kc_handle_cass(buffer, casdata, KC_IMAGE_KCC);
}
-static int kc_handle_tap(INT16 *buffer, const UINT8 *casdata)
+static int kc_handle_tap(int16_t *buffer, const uint8_t *casdata)
{
if (!strncmp((const char *)(casdata + 1), "KC-TAPE by AF", 13))
{
@@ -210,9 +210,9 @@ static int kc_handle_tap(INT16 *buffer, const UINT8 *casdata)
}
}
-static int kc_handle_sss(INT16 *buffer, const UINT8 *casdata)
+static int kc_handle_sss(int16_t *buffer, const uint8_t *casdata)
{
- std::vector<UINT8> sss(kc_image_size + 11);
+ std::vector<uint8_t> sss(kc_image_size + 11);
// tries to generate the missing head
memset(&sss[0], 0xd3, 3);
@@ -232,7 +232,7 @@ static int kc_handle_sss(INT16 *buffer, const UINT8 *casdata)
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int kc_kcc_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int kc_kcc_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return kc_handle_kcc(buffer, bytes);
}
@@ -241,7 +241,7 @@ static int kc_kcc_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
/*******************************************************************
Calculate the number of samples needed for this tape image classical
********************************************************************/
-static int kc_kcc_to_wav_size(const UINT8 *casdata, int caslen)
+static int kc_kcc_to_wav_size(const uint8_t *casdata, int caslen)
{
kc_image_size = caslen ;
@@ -284,7 +284,7 @@ static const struct CassetteFormat kc_kcc_format =
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int kc_tap_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int kc_tap_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return kc_handle_tap(buffer, bytes);
}
@@ -293,7 +293,7 @@ static int kc_tap_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
/*******************************************************************
Calculate the number of samples needed for this tape image classical
********************************************************************/
-static int kc_tap_to_wav_size(const UINT8 *casdata, int caslen)
+static int kc_tap_to_wav_size(const uint8_t *casdata, int caslen)
{
kc_image_size = caslen ;
@@ -336,7 +336,7 @@ static const struct CassetteFormat kc_tap_format =
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int kc_sss_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int kc_sss_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return kc_handle_sss(buffer, bytes);
}
@@ -345,7 +345,7 @@ static int kc_sss_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
/*******************************************************************
Calculate the number of samples needed for this tape image classical
********************************************************************/
-static int kc_sss_to_wav_size(const UINT8 *casdata, int caslen)
+static int kc_sss_to_wav_size(const uint8_t *casdata, int caslen)
{
kc_image_size = caslen ;
diff --git a/src/lib/formats/kim1_cas.cpp b/src/lib/formats/kim1_cas.cpp
index 6cef030874a..1bfccc7f8a0 100644
--- a/src/lib/formats/kim1_cas.cpp
+++ b/src/lib/formats/kim1_cas.cpp
@@ -11,7 +11,7 @@
static int cas_size;
-static inline int kim1_output_signal( INT16 *buffer, int sample_pos, int high )
+static inline int kim1_output_signal( int16_t *buffer, int sample_pos, int high )
{
int sample_count, i, j;
@@ -62,7 +62,7 @@ static inline int kim1_output_signal( INT16 *buffer, int sample_pos, int high )
}
-static inline int kim1_output_byte( INT16 *buffer, int sample_pos, UINT8 byte )
+static inline int kim1_output_byte( int16_t *buffer, int sample_pos, uint8_t byte )
{
int i;
int sample_count = 0;
@@ -78,11 +78,11 @@ static inline int kim1_output_byte( INT16 *buffer, int sample_pos, UINT8 byte )
}
-static int kim1_handle_kim(INT16 *buffer, const UINT8 *casdata)
+static int kim1_handle_kim(int16_t *buffer, const uint8_t *casdata)
{
- static const UINT8 encoding[16] = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 };
+ static const uint8_t encoding[16] = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 };
int i, data_pos, sample_count;
- UINT16 size, address, file_id, checksum;
+ uint16_t size, address, file_id, checksum;
if ( cas_size < 9 ) return -1;
if ( memcmp( casdata, "KIM1", 4 ) ) return -1;
@@ -115,7 +115,7 @@ static int kim1_handle_kim(INT16 *buffer, const UINT8 *casdata)
/* Output the data */
while( data_pos < cas_size && data_pos < ( size + 9 ) )
{
- UINT8 data = casdata[data_pos];
+ uint8_t data = casdata[data_pos];
sample_count += kim1_output_byte( buffer, sample_count, encoding[ data >> 4 ] );
sample_count += kim1_output_byte( buffer, sample_count, encoding[ data & 0x0f ] );
@@ -143,7 +143,7 @@ static int kim1_handle_kim(INT16 *buffer, const UINT8 *casdata)
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int kim1_kim_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int kim1_kim_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return kim1_handle_kim( buffer, bytes );
}
@@ -152,7 +152,7 @@ static int kim1_kim_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
/*******************************************************************
Calculate the number of samples needed for this tape image
********************************************************************/
-static int kim1_kim_to_wav_size(const UINT8 *casdata, int caslen)
+static int kim1_kim_to_wav_size(const uint8_t *casdata, int caslen)
{
cas_size = caslen;
diff --git a/src/lib/formats/lviv_lvt.cpp b/src/lib/formats/lviv_lvt.cpp
index e53a68be471..09e91eac9fd 100644
--- a/src/lib/formats/lviv_lvt.cpp
+++ b/src/lib/formats/lviv_lvt.cpp
@@ -17,7 +17,7 @@
#define LVIV_LVT_HEADER_PILOT_LENGTH 5190
#define LVIV_LVT_BLOCK_PILOT_LENGTH 1298
-static INT16 *lviv_emit_level(INT16 *p, int count, int level)
+static int16_t *lviv_emit_level(int16_t *p, int count, int level)
{
int i;
@@ -28,7 +28,7 @@ static INT16 *lviv_emit_level(INT16 *p, int count, int level)
return p;
}
-static INT16* lviv_output_bit(INT16 *p, UINT8 b)
+static int16_t* lviv_output_bit(int16_t *p, uint8_t b)
{
if (b)
{
@@ -45,7 +45,7 @@ static INT16* lviv_output_bit(INT16 *p, UINT8 b)
return p;
}
-static INT16* lviv_output_byte(INT16 *p, UINT8 byte)
+static int16_t* lviv_output_byte(int16_t *p, uint8_t byte)
{
int i;
@@ -61,7 +61,7 @@ static INT16* lviv_output_byte(INT16 *p, UINT8 byte)
/*************************************************************************************/
-static int lviv_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int lviv_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
{
int size;
@@ -76,10 +76,10 @@ static int lviv_cassette_calculate_size_in_samples(const UINT8 *bytes, int lengt
/*************************************************************************************/
-static int lviv_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int lviv_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
int i;
- INT16 * p = buffer;
+ int16_t * p = buffer;
int data_size;
diff --git a/src/lib/formats/m20_dsk.cpp b/src/lib/formats/m20_dsk.cpp
index 5fec77cf1d5..a831547e6e7 100644
--- a/src/lib/formats/m20_dsk.cpp
+++ b/src/lib/formats/m20_dsk.cpp
@@ -40,20 +40,20 @@ bool m20_format::supports_save() const
return false;
}
-int m20_format::identify(io_generic *io, UINT32 form_factor)
+int m20_format::identify(io_generic *io, uint32_t form_factor)
{
if(io_generic_size(io) == 286720)
return 50;
return 0;
}
-bool m20_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool m20_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
for(int track = 0; track < 35; track++)
for(int head = 0; head < 2; head ++) {
bool mfm = track || head;
desc_pc_sector sects[16];
- UINT8 sectdata[16*256];
+ uint8_t sectdata[16*256];
io_generic_read(io, sectdata, 16*256*(track*2+head), 16*256);
for(int i=0; i<16; i++) {
int j = i/2 + (i & 1 ? 0 : 8);
diff --git a/src/lib/formats/m20_dsk.h b/src/lib/formats/m20_dsk.h
index 0ed3deda5ef..231728d6164 100644
--- a/src/lib/formats/m20_dsk.h
+++ b/src/lib/formats/m20_dsk.h
@@ -17,8 +17,8 @@ class m20_format : public floppy_image_format_t {
public:
m20_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual const char *name() const override;
diff --git a/src/lib/formats/mbee_cas.cpp b/src/lib/formats/mbee_cas.cpp
index 738bd4e4b31..24024f66f5d 100644
--- a/src/lib/formats/mbee_cas.cpp
+++ b/src/lib/formats/mbee_cas.cpp
@@ -69,7 +69,7 @@ TAP - has an ID header of TAP_DGOS_BEE or MBEE, null terminated.
static int mbee_image_size;
static bool mbee_speed;
-static int mbee_put_samples(INT16 *buffer, int sample_pos, int count, int level)
+static int mbee_put_samples(int16_t *buffer, int sample_pos, int count, int level)
{
if (buffer)
{
@@ -80,7 +80,7 @@ static int mbee_put_samples(INT16 *buffer, int sample_pos, int count, int level)
return count;
}
-static int mbee_output_bit(INT16 *buffer, int sample_pos, bool bit)
+static int mbee_output_bit(int16_t *buffer, int sample_pos, bool bit)
{
int samples = 0;
if (mbee_speed)
@@ -135,10 +135,10 @@ static int mbee_output_bit(INT16 *buffer, int sample_pos, bool bit)
return samples;
}
-static int mbee_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
+static int mbee_output_byte(int16_t *buffer, int sample_pos, uint8_t byte)
{
int samples = 0;
- UINT8 i;
+ uint8_t i;
/* start */
samples += mbee_output_bit (buffer, sample_pos + samples, 0);
@@ -154,14 +154,14 @@ static int mbee_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
return samples;
}
-static int mbee_handle_tap(INT16 *buffer, const UINT8 *bytes)
+static int mbee_handle_tap(int16_t *buffer, const uint8_t *bytes)
{
- UINT32 sample_count = 0;
- UINT32 byte_count = 0;
- UINT32 i = 0;
+ uint32_t sample_count = 0;
+ uint32_t byte_count = 0;
+ uint32_t i = 0;
bool temp_speed = 0;
- UINT8 temp_blocks = 0;
- UINT16 temp_size = 0;
+ uint8_t temp_blocks = 0;
+ uint16_t temp_size = 0;
// TAP file starts with a null-terminate ID string. We just skip this.
while (bytes[byte_count])
@@ -211,7 +211,7 @@ static int mbee_handle_tap(INT16 *buffer, const UINT8 *bytes)
Generate samples for the tape image
********************************************************************/
-static int mbee_tap_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int mbee_tap_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
return mbee_handle_tap(buffer, bytes);
}
@@ -220,7 +220,7 @@ static int mbee_tap_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
Calculate the number of samples needed for this tape image
********************************************************************/
-static int mbee_tap_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int mbee_tap_calculate_size_in_samples(const uint8_t *bytes, int length)
{
mbee_image_size = length;
diff --git a/src/lib/formats/mfi_dsk.cpp b/src/lib/formats/mfi_dsk.cpp
index ea3eed8a29f..b6a8a18460a 100644
--- a/src/lib/formats/mfi_dsk.cpp
+++ b/src/lib/formats/mfi_dsk.cpp
@@ -94,7 +94,7 @@ bool mfi_format::supports_save() const
return true;
}
-int mfi_format::identify(io_generic *io, UINT32 form_factor)
+int mfi_format::identify(io_generic *io, uint32_t form_factor)
{
header h;
@@ -108,7 +108,7 @@ int mfi_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool mfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool mfi_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
header h;
entry entries[84*2*4];
@@ -119,7 +119,7 @@ bool mfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
image->set_variant(h.variant);
- std::vector<UINT8> compressed;
+ std::vector<uint8_t> compressed;
entry *ent = entries;
for(unsigned int cyl=0; cyl <= (h.cyl_count - 1) << 2; cyl += 4 >> resolution)
@@ -138,16 +138,16 @@ bool mfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
io_generic_read(io, &compressed[0], ent->offset, ent->compressed_size);
unsigned int cell_count = ent->uncompressed_size/4;
- std::vector<UINT32> &trackbuf = image->get_buffer(cyl >> 2, head, cyl & 3);;
+ std::vector<uint32_t> &trackbuf = image->get_buffer(cyl >> 2, head, cyl & 3);;
trackbuf.resize(cell_count);
uLongf size = ent->uncompressed_size;
if(uncompress((Bytef *)&trackbuf[0], &size, &compressed[0], ent->compressed_size) != Z_OK)
return false;
- UINT32 cur_time = 0;
+ uint32_t cur_time = 0;
for(unsigned int i=0; i != cell_count; i++) {
- UINT32 next_cur_time = cur_time + (trackbuf[i] & TIME_MASK);
+ uint32_t next_cur_time = cur_time + (trackbuf[i] & TIME_MASK);
trackbuf[i] = (trackbuf[i] & MG_MASK) | cur_time;
cur_time = next_cur_time;
}
@@ -187,12 +187,12 @@ bool mfi_format::save(io_generic *io, floppy_image *image)
int pos = sizeof(header) + (tracks << resolution)*heads*sizeof(entry);
int epos = 0;
- auto precomp = global_alloc_array(UINT32, max_track_size);
- auto postcomp = global_alloc_array(UINT8, max_track_size*4 + 1000);
+ auto precomp = global_alloc_array(uint32_t, max_track_size);
+ auto postcomp = global_alloc_array(uint8_t, max_track_size*4 + 1000);
for(int track=0; track <= (tracks-1) << 2; track += 4 >> resolution)
for(int head=0; head<heads; head++) {
- std::vector<UINT32> &buffer = image->get_buffer(track >> 2, head, track & 3);
+ std::vector<uint32_t> &buffer = image->get_buffer(track >> 2, head, track & 3);
int tsize = buffer.size();
if(!tsize) {
epos++;
diff --git a/src/lib/formats/mfi_dsk.h b/src/lib/formats/mfi_dsk.h
index dfac913d4c1..e18920bd04d 100644
--- a/src/lib/formats/mfi_dsk.h
+++ b/src/lib/formats/mfi_dsk.h
@@ -10,8 +10,8 @@ class mfi_format : public floppy_image_format_t
public:
mfi_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual const char *name() const override;
diff --git a/src/lib/formats/mfm_hd.cpp b/src/lib/formats/mfm_hd.cpp
index 617ebf2b992..032be8622cb 100644
--- a/src/lib/formats/mfm_hd.cpp
+++ b/src/lib/formats/mfm_hd.cpp
@@ -139,7 +139,7 @@ void mfmhd_image_format_t::set_layout_params(mfmhd_layout_params param)
/*
Encode some value with data-type clock bits.
*/
-void mfmhd_image_format_t::mfm_encode(UINT16* trackimage, int& position, UINT8 byte, int count)
+void mfmhd_image_format_t::mfm_encode(uint16_t* trackimage, int& position, uint8_t byte, int count)
{
mfm_encode_mask(trackimage, position, byte, count, 0x00);
}
@@ -147,7 +147,7 @@ void mfmhd_image_format_t::mfm_encode(UINT16* trackimage, int& position, UINT8 b
/*
Encode an A1 value with mark-type clock bits.
*/
-void mfmhd_image_format_t::mfm_encode_a1(UINT16* trackimage, int& position)
+void mfmhd_image_format_t::mfm_encode_a1(uint16_t* trackimage, int& position)
{
m_current_crc = 0xffff;
mfm_encode_mask(trackimage, position, 0xa1, 1, 0x04);
@@ -157,11 +157,11 @@ void mfmhd_image_format_t::mfm_encode_a1(UINT16* trackimage, int& position)
Encode a byte value with a given clock bit mask. Used by both mfm_encode
and mfm_encode_a1 methods.
*/
-void mfmhd_image_format_t::mfm_encode_mask(UINT16* trackimage, int& position, UINT8 byte, int count, int mask)
+void mfmhd_image_format_t::mfm_encode_mask(uint16_t* trackimage, int& position, uint8_t byte, int count, int mask)
{
- UINT16 encclock = 0;
- UINT16 encdata = 0;
- UINT8 thisbyte = byte;
+ uint16_t encclock = 0;
+ uint16_t encdata = 0;
+ uint8_t thisbyte = byte;
bool mark = (mask != 0x00);
m_current_crc = ccitt_crc16_one(m_current_crc, byte);
@@ -226,7 +226,7 @@ void mfmhd_image_format_t::mfm_encode_mask(UINT16* trackimage, int& position, UI
Clock bits and data bits are assumed to be interleaved (cdcdcdcdcdcdcdcd);
the 8 data bits are returned.
*/
-UINT8 mfmhd_image_format_t::mfm_decode(UINT16 raw)
+uint8_t mfmhd_image_format_t::mfm_decode(uint16_t raw)
{
unsigned int value = 0;
@@ -243,7 +243,7 @@ UINT8 mfmhd_image_format_t::mfm_decode(UINT16 raw)
/*
For debugging. Outputs the byte array in a xxd-like way.
*/
-void mfmhd_image_format_t::showtrack(UINT16* enctrack, int length)
+void mfmhd_image_format_t::showtrack(uint16_t* enctrack, int length)
{
for (int i=0; i < length; i+=16)
{
@@ -268,7 +268,7 @@ const mfmhd_format_type MFMHD_GEN_FORMAT = &mfmhd_image_format_creator<mfmhd_gen
define idents beyond cylinder 1023, but formatting programs seem to
continue with 0xfd for cylinders between 1024 and 2047.
*/
-UINT8 mfmhd_generic_format::cylinder_to_ident(int cylinder)
+uint8_t mfmhd_generic_format::cylinder_to_ident(int cylinder)
{
if (cylinder < 256) return 0xfe;
if (cylinder < 512) return 0xff;
@@ -295,10 +295,10 @@ int mfmhd_generic_format::chs_to_lba(int cylinder, int head, int sector)
else return -1;
}
-chd_error mfmhd_generic_format::load(chd_file* chdfile, UINT16* trackimage, int tracksize, int cylinder, int head)
+chd_error mfmhd_generic_format::load(chd_file* chdfile, uint16_t* trackimage, int tracksize, int cylinder, int head)
{
chd_error state = CHDERR_NONE;
- UINT8 sector_content[16384];
+ uint8_t sector_content[16384];
int sectorcount = m_param.sectors_per_track;
int size = m_param.sector_size;
@@ -434,18 +434,18 @@ enum
CHECK_CRC
};
-chd_error mfmhd_generic_format::save(chd_file* chdfile, UINT16* trackimage, int tracksize, int current_cylinder, int current_head)
+chd_error mfmhd_generic_format::save(chd_file* chdfile, uint16_t* trackimage, int tracksize, int current_cylinder, int current_head)
{
if (TRACE_RWTRACK) osd_printf_verbose("%s: write back (c=%d,h=%d) to CHD\n", tag(), current_cylinder, current_head);
- UINT8 buffer[16384]; // for header or sector content
+ uint8_t buffer[16384]; // for header or sector content
int bytepos = 0;
int state = SEARCH_A1;
int count = 0;
int pos = 0;
- UINT16 crc = 0;
- UINT8 byte;
+ uint16_t crc = 0;
+ uint8_t byte;
bool search_header = true;
int ident = 0;
diff --git a/src/lib/formats/mfm_hd.h b/src/lib/formats/mfm_hd.h
index 4e583f46db8..29b23745eac 100644
--- a/src/lib/formats/mfm_hd.h
+++ b/src/lib/formats/mfm_hd.h
@@ -151,10 +151,10 @@ public:
virtual ~mfmhd_image_format_t() {};
// Load the image.
- virtual chd_error load(chd_file* chdfile, UINT16* trackimage, int tracksize, int cylinder, int head) = 0;
+ virtual chd_error load(chd_file* chdfile, uint16_t* trackimage, int tracksize, int cylinder, int head) = 0;
// Save the image.
- virtual chd_error save(chd_file* chdfile, UINT16* trackimage, int tracksize, int cylinder, int head) = 0;
+ virtual chd_error save(chd_file* chdfile, uint16_t* trackimage, int tracksize, int cylinder, int head) = 0;
// Return the original parameters of the image
mfmhd_layout_params* get_initial_params() { return &m_param_old; }
@@ -179,16 +179,16 @@ protected:
mfmhd_layout_params m_param, m_param_old;
- void mfm_encode(UINT16* trackimage, int& position, UINT8 byte, int count=1);
- void mfm_encode_a1(UINT16* trackimage, int& position);
- void mfm_encode_mask(UINT16* trackimage, int& position, UINT8 byte, int count, int mask);
- UINT8 mfm_decode(UINT16 raw);
+ void mfm_encode(uint16_t* trackimage, int& position, uint8_t byte, int count=1);
+ void mfm_encode_a1(uint16_t* trackimage, int& position);
+ void mfm_encode_mask(uint16_t* trackimage, int& position, uint8_t byte, int count, int mask);
+ uint8_t mfm_decode(uint16_t raw);
// Deliver defaults.
virtual int get_default(mfmhd_param_t type) =0;
// Debugging
- void showtrack(UINT16* enctrack, int length);
+ void showtrack(uint16_t* enctrack, int length);
virtual const char* tag() { return m_devtag.c_str(); }
};
@@ -196,15 +196,15 @@ class mfmhd_generic_format : public mfmhd_image_format_t
{
public:
mfmhd_generic_format() { m_devtag = std::string("mfmhd_generic_format"); };
- chd_error load(chd_file* chdfile, UINT16* trackimage, int tracksize, int cylinder, int head) override;
- chd_error save(chd_file* chdfile, UINT16* trackimage, int tracksize, int cylinder, int head) override;
+ chd_error load(chd_file* chdfile, uint16_t* trackimage, int tracksize, int cylinder, int head) override;
+ chd_error save(chd_file* chdfile, uint16_t* trackimage, int tracksize, int cylinder, int head) override;
// Yes, we want to save all parameters
virtual bool save_param(mfmhd_param_t type) override { return true; }
virtual int get_default(mfmhd_param_t type) override;
protected:
- virtual UINT8 cylinder_to_ident(int cylinder);
+ virtual uint8_t cylinder_to_ident(int cylinder);
virtual int chs_to_lba(int cylinder, int head, int sector);
};
diff --git a/src/lib/formats/mz_cas.cpp b/src/lib/formats/mz_cas.cpp
index 1fb9d6c1577..cfcf9f36ed8 100644
--- a/src/lib/formats/mz_cas.cpp
+++ b/src/lib/formats/mz_cas.cpp
@@ -36,7 +36,7 @@
#define STM_0 20
#define STM_L 1
-static int fill_wave_1(INT16 *buffer, int offs)
+static int fill_wave_1(int16_t *buffer, int offs)
{
buffer[offs++] = HI;
buffer[offs++] = HI;
@@ -45,14 +45,14 @@ static int fill_wave_1(INT16 *buffer, int offs)
return LONG_PULSE;
}
-static int fill_wave_0(INT16 *buffer, int offs)
+static int fill_wave_0(int16_t *buffer, int offs)
{
buffer[offs++] = HI;
buffer[offs++] = LO;
return SHORT_PULSE;
}
-static int fill_wave_b(INT16 *buffer, int offs, int byte)
+static int fill_wave_b(int16_t *buffer, int offs, int byte)
{
int i, count = 0;
@@ -69,10 +69,10 @@ static int fill_wave_b(INT16 *buffer, int offs, int byte)
return count;
}
-static int fill_wave(INT16 *buffer, int length, UINT8 *code)
+static int fill_wave(int16_t *buffer, int length, uint8_t *code)
{
- static INT16 *beg;
- static UINT16 csum = 0;
+ static int16_t *beg;
+ static uint16_t csum = 0;
static int header = 1, bytecount = 0;
int count = 0;
@@ -123,7 +123,7 @@ static int fill_wave(INT16 *buffer, int length, UINT8 *code)
if( code == CODE_TRAILER )
{
int i, file_length;
- INT16 *end = buffer;
+ int16_t *end = buffer;
/* is there insufficient space for the CHKF? */
if( count + 2 * BYTE_SAMPLES > length )
@@ -145,12 +145,12 @@ static int fill_wave(INT16 *buffer, int length, UINT8 *code)
for (i = 0; i < 256; i++)
count += fill_wave_0(buffer, count);
- file_length = (int)(end - beg) / sizeof(INT16);
+ file_length = (int)(end - beg) / sizeof(int16_t);
/* is there insufficient space for the FILEC ? */
if( count + file_length > length )
return -1;
LOG(1,"mz700_fill_wave",("FILEC %d samples\n", file_length));
- memcpy(buffer + count, beg, file_length * sizeof(INT16));
+ memcpy(buffer + count, beg, file_length * sizeof(int16_t));
count += file_length;
/* is there insufficient space for the CHKF ? */
@@ -177,7 +177,7 @@ static int fill_wave(INT16 *buffer, int length, UINT8 *code)
if( header == 1 && bytecount == 128 )
{
int i, hdr_length;
- INT16 *end = buffer;
+ int16_t *end = buffer;
/* is there insufficient space for the CHKH ? */
if( count + 2 * BYTE_SAMPLES > length )
@@ -199,12 +199,12 @@ static int fill_wave(INT16 *buffer, int length, UINT8 *code)
for (i = 0; i < 256; i++)
count += fill_wave_0(buffer, count);
- hdr_length = (int)(end - beg) / sizeof(INT16);
+ hdr_length = (int)(end - beg) / sizeof(int16_t);
/* is there insufficient space for the HDRC ? */
if( count + hdr_length > length )
return -1;
LOG(1,"mz700_fill_wave",("HDRC %d samples\n", hdr_length));
- memcpy(buffer + count, beg, hdr_length * sizeof(INT16));
+ memcpy(buffer + count, beg, hdr_length * sizeof(int16_t));
count += hdr_length;
/* is there insufficient space for CHKH ? */
diff --git a/src/lib/formats/naslite_dsk.cpp b/src/lib/formats/naslite_dsk.cpp
index 342407a7c95..cea109c2dc2 100644
--- a/src/lib/formats/naslite_dsk.cpp
+++ b/src/lib/formats/naslite_dsk.cpp
@@ -39,7 +39,7 @@ const naslite_format::format naslite_format::formats[] = {
{}
};
-void naslite_format::build_sector_description(const format &f, UINT8 *sectdata, desc_s *sectors, int track, int head) const
+void naslite_format::build_sector_description(const format &f, uint8_t *sectdata, desc_s *sectors, int track, int head) const
{
for(int i=0; i<f.sector_count; i++) {
int cur_offset = 0;
diff --git a/src/lib/formats/naslite_dsk.h b/src/lib/formats/naslite_dsk.h
index 00f9df1567e..0a3df5535d5 100644
--- a/src/lib/formats/naslite_dsk.h
+++ b/src/lib/formats/naslite_dsk.h
@@ -24,7 +24,7 @@ public:
protected:
static const format formats[];
- virtual void build_sector_description(const format &d, UINT8 *sectdata, desc_s *sectors, int track, int head) const override;
+ virtual void build_sector_description(const format &d, uint8_t *sectdata, desc_s *sectors, int track, int head) const override;
};
extern const floppy_format_type FLOPPY_NASLITE_FORMAT;
diff --git a/src/lib/formats/nes_dsk.cpp b/src/lib/formats/nes_dsk.cpp
index f6560d5f053..60dbba5dafa 100644
--- a/src/lib/formats/nes_dsk.cpp
+++ b/src/lib/formats/nes_dsk.cpp
@@ -24,8 +24,8 @@
static FLOPPY_IDENTIFY( nes_dsk_identify )
{
- UINT64 size;
- UINT8 header[3];
+ uint64_t size;
+ uint8_t header[3];
*vote = 0;
diff --git a/src/lib/formats/nfd_dsk.cpp b/src/lib/formats/nfd_dsk.cpp
index 0691543cce6..4d9d8fab980 100644
--- a/src/lib/formats/nfd_dsk.cpp
+++ b/src/lib/formats/nfd_dsk.cpp
@@ -100,9 +100,9 @@ const char *nfd_format::extensions() const
return "nfd";
}
-int nfd_format::identify(io_generic *io, UINT32 form_factor)
+int nfd_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 h[16];
+ uint8_t h[16];
io_generic_read(io, h, 0, 16);
if (strncmp((const char *)h, "T98FDDIMAGE.R0", 14) == 0 || strncmp((const char *)h, "T98FDDIMAGE.R1", 14) == 0)
@@ -111,25 +111,25 @@ int nfd_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool nfd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool nfd_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT64 size = io_generic_size(io);
- UINT8 h[0x120], hsec[0x10];
+ uint64_t size = io_generic_size(io);
+ uint8_t h[0x120], hsec[0x10];
io_generic_read(io, h, 0, 0x120);
int format_version = !strncmp((const char *)h, "T98FDDIMAGE.R0", 14) ? 0 : 1;
// sector map (the 164th entry is only used by rev.1 format, loops with track < 163 are correct for rev.0)
- UINT8 disk_type = 0;
- UINT8 num_secs[164];
- UINT8 num_specials[164];
- UINT32 track_sizes[164];
- UINT8 tracks[164 * 26];
- UINT8 heads[164 * 26];
- UINT8 secs[164 * 26];
- UINT8 mfm[164 * 26];
- UINT8 sec_sizes[164 * 26];
-
- UINT32 hsize = little_endianize_int32(*(UINT32 *)(h+0x110));
+ uint8_t disk_type = 0;
+ uint8_t num_secs[164];
+ uint8_t num_specials[164];
+ uint32_t track_sizes[164];
+ uint8_t tracks[164 * 26];
+ uint8_t heads[164 * 26];
+ uint8_t secs[164 * 26];
+ uint8_t mfm[164 * 26];
+ uint8_t sec_sizes[164 * 26];
+
+ uint32_t hsize = little_endianize_int32(*(uint32_t *)(h+0x110));
int pos = 0x120;
@@ -142,7 +142,7 @@ bool nfd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
// read sector map absolute location
io_generic_read(io, hsec, pos, 4);
pos += 4;
- UINT32 secmap_addr = little_endianize_int32(*(UINT32 *)(hsec));
+ uint32_t secmap_addr = little_endianize_int32(*(uint32_t *)(hsec));
if (secmap_addr)
{
@@ -151,8 +151,8 @@ bool nfd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
// first WORD is # of sectors, second WORD is # of special data sectors
io_generic_read(io, hsec, secmap_addr, 0x10);
secmap_addr += 0x10;
- num_secs[track] = little_endianize_int16(*(UINT16 *)(hsec));
- num_specials[track] = little_endianize_int16(*(UINT16 *)(hsec + 0x2));
+ num_secs[track] = little_endianize_int16(*(uint16_t *)(hsec));
+ num_specials[track] = little_endianize_int16(*(uint16_t *)(hsec + 0x2));
for (int sect = 0; sect < num_secs[track]; sect++)
{
@@ -177,7 +177,7 @@ bool nfd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
{
io_generic_read(io, hsec, secmap_addr, 0x10);
secmap_addr += 0x10;
- curr_track_size += (hsec[9] + 1) * little_endianize_int32(*(UINT32 *)(hsec + 0x0a));
+ curr_track_size += (hsec[9] + 1) * little_endianize_int32(*(uint32_t *)(hsec + 0x0a));
}
}
}
@@ -239,7 +239,7 @@ bool nfd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
}
desc_pc_sector sects[256];
- UINT8 sect_data[65536];
+ uint8_t sect_data[65536];
int cur_sec_map = 0, sector_size;
pos = hsize;
diff --git a/src/lib/formats/nfd_dsk.h b/src/lib/formats/nfd_dsk.h
index 005196399ba..9721f23478d 100644
--- a/src/lib/formats/nfd_dsk.h
+++ b/src/lib/formats/nfd_dsk.h
@@ -19,8 +19,8 @@ class nfd_format : public floppy_image_format_t
public:
nfd_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual const char *name() const override;
virtual const char *description() const override;
diff --git a/src/lib/formats/orao_cas.cpp b/src/lib/formats/orao_cas.cpp
index a97d8aa691f..2d0f96b2a14 100644
--- a/src/lib/formats/orao_cas.cpp
+++ b/src/lib/formats/orao_cas.cpp
@@ -19,10 +19,10 @@
#define ORAO_HEADER_SIZE 360
-static INT16 wave_data;
+static int16_t wave_data;
static int len;
-static void orao_output_wave( INT16 **buffer, int length ) {
+static void orao_output_wave( int16_t **buffer, int length ) {
if ( buffer == nullptr ) {
return;
}
@@ -32,9 +32,9 @@ static void orao_output_wave( INT16 **buffer, int length ) {
*buffer = *buffer + 1;
}
}
-static int orao_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
+static int orao_cas_to_wav_size( const uint8_t *casdata, int caslen ) {
int i,j,size;
- UINT8 b;
+ uint8_t b;
if (casdata == nullptr) return -1;
if (caslen <= ORAO_HEADER_SIZE) {
@@ -55,9 +55,9 @@ static int orao_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
return size;
}
-static int orao_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
+static int orao_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) {
int i,j,size;
- UINT8 b;
+ uint8_t b;
size = 0;
if (bytes == nullptr) return -1;
for (i=ORAO_HEADER_SIZE;i<len-ORAO_HEADER_SIZE;i++) {
diff --git a/src/lib/formats/oric_dsk.cpp b/src/lib/formats/oric_dsk.cpp
index 5d3071e77c1..45cbcab0fee 100644
--- a/src/lib/formats/oric_dsk.cpp
+++ b/src/lib/formats/oric_dsk.cpp
@@ -35,9 +35,9 @@ bool oric_dsk_format::supports_save() const
return true;
}
-int oric_dsk_format::identify(io_generic *io, UINT32 form_factor)
+int oric_dsk_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 h[256];
+ uint8_t h[256];
io_generic_read(io, h, 0, 256);
if(memcmp(h, "MFM_DISK", 8))
@@ -54,10 +54,10 @@ int oric_dsk_format::identify(io_generic *io, UINT32 form_factor)
return 100;
}
-bool oric_dsk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool oric_dsk_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 h[256];
- UINT8 t[6250+3];
+ uint8_t h[256];
+ uint8_t t[6250+3];
t[6250] = t[6251] = t[6252] = 0;
io_generic_read(io, h, 0, 256);
@@ -68,7 +68,7 @@ bool oric_dsk_format::load(io_generic *io, UINT32 form_factor, floppy_image *ima
for(int side=0; side<sides; side++)
for(int track=0; track<tracks; track++) {
io_generic_read(io, t, 256+6400*(tracks*side + track), 6250);
- std::vector<UINT32> stream;
+ std::vector<uint32_t> stream;
int sector_size = 128;
for(int i=0; i<6250; i++) {
if(t[i] == 0xc2 && t[i+1] == 0xc2 && t[i+2] == 0xc2) {
diff --git a/src/lib/formats/oric_dsk.h b/src/lib/formats/oric_dsk.h
index 3eeb719eed0..23125546931 100644
--- a/src/lib/formats/oric_dsk.h
+++ b/src/lib/formats/oric_dsk.h
@@ -17,8 +17,8 @@ class oric_dsk_format : public floppy_image_format_t
{
public:
oric_dsk_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual const char *name() const override;
diff --git a/src/lib/formats/oric_tap.cpp b/src/lib/formats/oric_tap.cpp
index 5c24d40f47e..c9f84dc7c2a 100644
--- a/src/lib/formats/oric_tap.cpp
+++ b/src/lib/formats/oric_tap.cpp
@@ -51,7 +51,7 @@ static oric_t oric;
/* 8 periods at 2400Hz */
/* hi,lo, hi,lo, hi,lo, hi,lo */
-static INT16 *oric_emit_level(INT16 *p, int count, INT16 wave_state)
+static int16_t *oric_emit_level(int16_t *p, int count, int16_t wave_state)
{
int i;
@@ -63,7 +63,7 @@ static INT16 *oric_emit_level(INT16 *p, int count, INT16 wave_state)
}
/* 4 periods at 1200Hz */
-static INT16* oric_output_bit(INT16 *p, UINT8 b)
+static int16_t* oric_output_bit(int16_t *p, uint8_t b)
{
p = oric_emit_level(p, 1, WAVEENTRY_HIGH);
p = oric_emit_level(p, b ? 1 : 2, WAVEENTRY_LOW);
@@ -71,7 +71,7 @@ static INT16* oric_output_bit(INT16 *p, UINT8 b)
return p;
}
-static int oric_get_bit_size_in_samples(UINT8 b)
+static int oric_get_bit_size_in_samples(uint8_t b)
{
int count;
@@ -119,12 +119,12 @@ static int oric_get_bit_size_in_samples(UINT8 b)
1 * ? -> ???
*/
-static int oric_calculate_byte_size_in_samples(UINT8 byte)
+static int oric_calculate_byte_size_in_samples(uint8_t byte)
{
int count;
int i;
- UINT8 parity;
- UINT8 data;
+ uint8_t parity;
+ uint8_t data;
count = 0;
@@ -139,7 +139,7 @@ static int oric_calculate_byte_size_in_samples(UINT8 byte)
data = byte;
for (i=0; i<8; i++)
{
- UINT8 data_bit;
+ uint8_t data_bit;
data_bit = data & 0x01;
@@ -162,11 +162,11 @@ static int oric_calculate_byte_size_in_samples(UINT8 byte)
}
-static INT16 *oric_output_byte(INT16 *p, UINT8 byte)
+static int16_t *oric_output_byte(int16_t *p, uint8_t byte)
{
int i;
- UINT8 parity;
- UINT8 data;
+ uint8_t parity;
+ uint8_t data;
/* start bit */
p = oric_output_bit(p, 0);
@@ -178,7 +178,7 @@ static INT16 *oric_output_byte(INT16 *p, UINT8 byte)
data = byte;
for (i=0; i<8; i++)
{
- UINT8 data_bit;
+ uint8_t data_bit;
data_bit = data & 0x01;
@@ -200,7 +200,7 @@ static INT16 *oric_output_byte(INT16 *p, UINT8 byte)
return p;
}
-static INT16 *oric_fill_pause(INT16 *p, int sample_count)
+static int16_t *oric_fill_pause(int16_t *p, int sample_count)
{
int i;
@@ -218,14 +218,14 @@ static int oric_seconds_to_samples(float seconds)
}
/* length is length of .tap file! */
-static int oric_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int oric_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
{
unsigned char header[9];
int count;
- const UINT8 *data_ptr;
+ const uint8_t *data_ptr;
int i;
- UINT8 data;
+ uint8_t data;
oric.tap_size = length;
@@ -302,7 +302,7 @@ static int oric_cassette_calculate_size_in_samples(const UINT8 *bytes, int lengt
/* got end of filename? */
if (data==0)
{
- UINT16 end, start;
+ uint16_t end, start;
LOG_FORMATS("got end of filename\n");
/* 100 1 bits to separate header from data */
@@ -343,13 +343,13 @@ static int oric_cassette_calculate_size_in_samples(const UINT8 *bytes, int lengt
}
/* length is length of sample buffer to fill! */
-static int oric_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int oric_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
unsigned char header[9];
- UINT8 *data_ptr;
- INT16 *p;
+ uint8_t *data_ptr;
+ int16_t *p;
int i;
- UINT8 data;
+ uint8_t data;
p = buffer;
@@ -438,7 +438,7 @@ static int oric_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
/* got end of filename? */
if (data==0)
{
- UINT16 end, start;
+ uint16_t end, start;
LOG_FORMATS("got end of filename\n");
/* oric includes a small delay, but I don't see
diff --git a/src/lib/formats/p6001_cas.cpp b/src/lib/formats/p6001_cas.cpp
index bcaf97d94ba..37e1ffcfa2c 100644
--- a/src/lib/formats/p6001_cas.cpp
+++ b/src/lib/formats/p6001_cas.cpp
@@ -13,7 +13,7 @@
static int cas_size;
-static int pc6001_fill_wave(INT16* buffer, UINT8 data, int sample_pos)
+static int pc6001_fill_wave(int16_t* buffer, uint8_t data, int sample_pos)
{
int x;
int sample_count = 0;
@@ -29,7 +29,7 @@ static int pc6001_fill_wave(INT16* buffer, UINT8 data, int sample_pos)
return sample_count;
}
-static int pc6001_handle_cas(INT16* buffer, const UINT8* casdata)
+static int pc6001_handle_cas(int16_t* buffer, const uint8_t* casdata)
{
int sample_count = 0;
int data_pos = 0;
@@ -46,7 +46,7 @@ static int pc6001_handle_cas(INT16* buffer, const UINT8* casdata)
/*******************************************************************
Calculate the number of samples needed for this tape image
********************************************************************/
-static int pc6001_cas_to_wav_size (const UINT8 *casdata, int caslen)
+static int pc6001_cas_to_wav_size (const uint8_t *casdata, int caslen)
{
cas_size = caslen*8;
@@ -56,7 +56,7 @@ static int pc6001_cas_to_wav_size (const UINT8 *casdata, int caslen)
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int pc6001_cas_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int pc6001_cas_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return pc6001_handle_cas(buffer,bytes);
}
diff --git a/src/lib/formats/pasti_dsk.cpp b/src/lib/formats/pasti_dsk.cpp
index 9ddce45138a..3bf5fa7a243 100644
--- a/src/lib/formats/pasti_dsk.cpp
+++ b/src/lib/formats/pasti_dsk.cpp
@@ -37,9 +37,9 @@ bool pasti_format::supports_save() const
return false;
}
-int pasti_format::identify(io_generic *io, UINT32 form_factor)
+int pasti_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 h[16];
+ uint8_t h[16];
io_generic_read(io, h, 0, 16);
if(!memcmp(h, "RSY\0\3\0", 6) &&
@@ -49,7 +49,7 @@ int pasti_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-static void hexdump(const UINT8 *d, int s)
+static void hexdump(const uint8_t *d, int s)
{
for(int i=0; i<s; i+=32) {
printf("%04x:", i);
@@ -59,12 +59,12 @@ static void hexdump(const UINT8 *d, int s)
}
}
-bool pasti_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool pasti_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 fh[16];
+ uint8_t fh[16];
io_generic_read(io, fh, 0, 16);
- std::vector<UINT8> raw_track;
+ std::vector<uint8_t> raw_track;
int tracks = fh[10];
int heads = 1+(tracks >= 160);
@@ -76,7 +76,7 @@ bool pasti_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
for(int track=0; track < tracks; track++) {
for(int head=0; head < heads; head++) {
- UINT8 th[16];
+ uint8_t th[16];
io_generic_read(io, th, pos, 16);
int entry_len = th[0] | (th[1] << 8) | (th[2] << 16) | (th[3] << 24);
int fuzz_len = th[4] | (th[5] << 8) | (th[6] << 16) | (th[7] << 24);
@@ -90,9 +90,9 @@ bool pasti_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
io_generic_read(io, &raw_track[0], pos+16, entry_len-16);
- UINT8 *fuzz = fuzz_len ? &raw_track[16*sect] : nullptr;
- UINT8 *bdata = fuzz ? fuzz+fuzz_len : &raw_track[16*sect];
- UINT8 *tdata = bdata;
+ uint8_t *fuzz = fuzz_len ? &raw_track[16*sect] : nullptr;
+ uint8_t *bdata = fuzz ? fuzz+fuzz_len : &raw_track[16*sect];
+ uint8_t *tdata = bdata;
int syncpos = -1;
if(flags & 0x0080) {
@@ -126,7 +126,7 @@ bool pasti_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
}
for(int s=0; s<sect; s++) {
- UINT8 *sh = &raw_track[16*s];
+ uint8_t *sh = &raw_track[16*s];
int s_off = sh[0] | (sh[1] << 8) | (sh[2] << 16) | (sh[3] << 24);
int s_pos = sh[4] | (sh[5] << 8);
int s_time = sh[6] | (sh[7] << 8);
@@ -170,7 +170,7 @@ void pasti_format::wd_generate_track_from_observations(int track, int head, flop
wd_generate_track_from_sectors_and_track(track, head, image, obs);
}
-void pasti_format::wd_generate_unsynced_gap(std::vector<UINT32> &track, const wd_obs &obs, int tstart, int tend, UINT32 cell_size)
+void pasti_format::wd_generate_unsynced_gap(std::vector<uint32_t> &track, const wd_obs &obs, int tstart, int tend, uint32_t cell_size)
{
for(int i=tstart; i != tend;) {
unsigned char v = obs.track_data[i];
@@ -196,7 +196,7 @@ void pasti_format::wd_generate_unsynced_gap(std::vector<UINT32> &track, const wd
}
}
-void pasti_format::wd_generate_synced_gap(std::vector<UINT32> &track, const wd_obs &obs, int tstart, int tend, UINT32 cell_size)
+void pasti_format::wd_generate_synced_gap(std::vector<uint32_t> &track, const wd_obs &obs, int tstart, int tend, uint32_t cell_size)
{
for(int i = tstart; i != tend; i++) {
unsigned char v = obs.track_data[i];
@@ -214,7 +214,7 @@ void pasti_format::wd_generate_synced_gap(std::vector<UINT32> &track, const wd_o
}
}
-void pasti_format::wd_generate_gap(std::vector<UINT32> &track, const wd_obs &obs, int tstart, int tend, bool synced, UINT32 cell_size_start, UINT32 cell_size_end)
+void pasti_format::wd_generate_gap(std::vector<uint32_t> &track, const wd_obs &obs, int tstart, int tend, bool synced, uint32_t cell_size_start, uint32_t cell_size_end)
{
unsigned int spos = track.size();
if(!synced) {
@@ -231,10 +231,10 @@ void pasti_format::wd_generate_gap(std::vector<UINT32> &track, const wd_obs &obs
wd_generate_synced_gap(track, obs, tstart, tend, cell_size_start);
if(cell_size_end != cell_size_start) {
- INT32 total_size = 0;
+ int32_t total_size = 0;
for(unsigned int i=spos; i != track.size(); i++)
total_size += track[i] & floppy_image::TIME_MASK;
- INT64 cur_size = 0;
+ int64_t cur_size = 0;
for(unsigned int i=spos; i != track.size(); i++) {
cur_size += track[i] & floppy_image::TIME_MASK;
track[i] = (track[i] & floppy_image::MG_MASK) |
@@ -243,7 +243,7 @@ void pasti_format::wd_generate_gap(std::vector<UINT32> &track, const wd_obs &obs
}
}
-void pasti_format::wd_generate_sector_header(std::vector<UINT32> &track, const wd_obs &obs, int sector, int tstart, UINT32 cell_size)
+void pasti_format::wd_generate_sector_header(std::vector<uint32_t> &track, const wd_obs &obs, int sector, int tstart, uint32_t cell_size)
{
raw_w(track, 16, 0x4489, cell_size);
raw_w(track, 16, 0x4489, cell_size);
@@ -253,7 +253,7 @@ void pasti_format::wd_generate_sector_header(std::vector<UINT32> &track, const w
mfm_w(track, 8, obs.sectors[sector].id[i], cell_size);
}
-void pasti_format::wd_generate_sector_data(std::vector<UINT32> &track, const wd_obs &obs, int sector, int tstart, UINT32 cell_size)
+void pasti_format::wd_generate_sector_data(std::vector<uint32_t> &track, const wd_obs &obs, int sector, int tstart, uint32_t cell_size)
{
const wd_sect &s = obs.sectors[sector];
raw_w(track, 16, 0x4489, cell_size);
@@ -262,7 +262,7 @@ void pasti_format::wd_generate_sector_data(std::vector<UINT32> &track, const wd_
mfm_w(track, 8, obs.track_data[tstart+3], cell_size);
for(int i=0; i<128 << (s.id[3] & 3); i++)
mfm_w(track, 8, s.data[i], cell_size);
- UINT16 crc = calc_crc_ccitt(track, track.size() - (2048 << (s.id[3] & 3)) - 16*4, track.size());
+ uint16_t crc = calc_crc_ccitt(track, track.size() - (2048 << (s.id[3] & 3)) - 16*4, track.size());
mfm_w(track, 8, crc >> 8, cell_size);
mfm_w(track, 8, crc, cell_size);
}
@@ -271,7 +271,7 @@ void pasti_format::wd_generate_track_from_sectors_and_track(int track, int head,
{
if(0)
printf("Track %d head %d sectors %d\n", track, head, obs.sector_count);
- std::vector<UINT32> trackbuf;
+ std::vector<uint32_t> trackbuf;
wd_sect_info sect_infos[256];
@@ -306,7 +306,7 @@ void pasti_format::wd_generate_track_from_sectors_and_track(int track, int head,
return;
}
- UINT32 cell_size = UINT32(obs.sectors[0].time_ratio * 1000+0.5);
+ uint32_t cell_size = uint32_t(obs.sectors[0].time_ratio * 1000+0.5);
wd_generate_gap(trackbuf, obs, 0, sect_infos[0].hstart, false, cell_size, cell_size);
for(int i=0; i != obs.sector_count; i++) {
@@ -318,7 +318,7 @@ void pasti_format::wd_generate_track_from_sectors_and_track(int track, int head,
}
}
- UINT32 ncell_size = UINT32(obs.sectors[i+1 != obs.sector_count ? i+1 : 0].time_ratio * 1000+0.5);
+ uint32_t ncell_size = uint32_t(obs.sectors[i+1 != obs.sector_count ? i+1 : 0].time_ratio * 1000+0.5);
wd_generate_sector_header(trackbuf, obs, i, s->hstart, cell_size);
@@ -361,7 +361,7 @@ void pasti_format::wd_generate_track_from_sectors_only(int track, int head, flop
}
}
- std::vector<UINT32> tdata;
+ std::vector<uint32_t> tdata;
for(int i=0; i != obs.sector_count; i++) {
const wd_sect &s = obs.sectors[i];
if(i+1 != obs.sector_count && obs.sectors[i+1].position < s.position+10+44+4+(128 << (s.id[3] & 3))) {
@@ -407,7 +407,7 @@ void pasti_format::wd_generate_track_from_sectors_only(int track, int head, flop
mfm_w(tdata, 8, 0xfb);
for(int j=0; j<128 << (s.id[3] & 3); j++)
mfm_w(tdata, 8, s.data[j]);
- UINT16 crc = calc_crc_ccitt(tdata, tdata.size() - (2048 << (s.id[3] & 3)) - 16*4, tdata.size());
+ uint16_t crc = calc_crc_ccitt(tdata, tdata.size() - (2048 << (s.id[3] & 3)) - 16*4, tdata.size());
mfm_w(tdata, 8, crc >> 8);
mfm_w(tdata, 8, crc);
}
@@ -419,9 +419,9 @@ void pasti_format::wd_generate_track_from_sectors_only(int track, int head, flop
generate_track_from_levels(track, head, tdata, 0, image);
}
-UINT16 pasti_format::byte_to_mfm(UINT8 data, bool context)
+uint16_t pasti_format::byte_to_mfm(uint8_t data, bool context)
{
- static const UINT8 expand[32] = {
+ static const uint8_t expand[32] = {
0xaa, 0xa9, 0xa4, 0xa5, 0x92, 0x91, 0x94, 0x95, 0x4a, 0x49, 0x44, 0x45, 0x52, 0x51, 0x54, 0x55,
0x2a, 0x29, 0x24, 0x25, 0x12, 0x11, 0x14, 0x15, 0x4a, 0x49, 0x44, 0x45, 0x52, 0x51, 0x54, 0x55,
};
@@ -429,15 +429,15 @@ UINT16 pasti_format::byte_to_mfm(UINT8 data, bool context)
return (expand[(data >> 4) | (context ? 16 : 0)] << 8) | expand[data & 0x1f];
}
-void pasti_format::match_mfm_data(wd_obs &obs, int tpos, const UINT8 *data, int size, UINT8 context, int &bcount, int &tend, bool &synced)
+void pasti_format::match_mfm_data(wd_obs &obs, int tpos, const uint8_t *data, int size, uint8_t context, int &bcount, int &tend, bool &synced)
{
- UINT16 shift = byte_to_mfm(context, true);
+ uint16_t shift = byte_to_mfm(context, true);
int bc = 0;
int bc_phase = 0;
int bi = 0;
- UINT8 dbyte = 0;
+ uint8_t dbyte = 0;
bool ds_phase = false;
- UINT16 inshift = byte_to_mfm(data[bi++], shift & 1);
+ uint16_t inshift = byte_to_mfm(data[bi++], shift & 1);
synced = false;
for(;;) {
int bit = (inshift >> (15-bc)) & 1;
@@ -474,7 +474,7 @@ void pasti_format::match_mfm_data(wd_obs &obs, int tpos, const UINT8 *data, int
}
}
-void pasti_format::match_raw_data(wd_obs &obs, int tpos, const UINT8 *data, int size, UINT8 context, int &bcount, int &tend)
+void pasti_format::match_raw_data(wd_obs &obs, int tpos, const uint8_t *data, int size, uint8_t context, int &bcount, int &tend)
{
tend = tpos;
for(bcount=0; bcount != size; bcount++) {
@@ -486,9 +486,9 @@ void pasti_format::match_raw_data(wd_obs &obs, int tpos, const UINT8 *data, int
}
}
-UINT16 pasti_format::calc_crc(const UINT8 *data, int size, UINT16 crc1)
+uint16_t pasti_format::calc_crc(const uint8_t *data, int size, uint16_t crc1)
{
- UINT32 crc = crc1;
+ uint32_t crc = crc1;
for(int i=0; i<size; i++) {
crc = (crc << 8) ^ (*data++ << 16);
if(crc & 0x800000) crc ^= 0x881080;
@@ -514,7 +514,7 @@ void pasti_format::map_sectors_in_track(wd_obs &obs, wd_sect_info *sect_infos)
sect_infos[i].dsynced = false;
}
- const UINT8 *tdata = obs.track_data;
+ const uint8_t *tdata = obs.track_data;
int tsize = obs.track_size;
for(int i=0; i != tsize; i++)
@@ -522,7 +522,7 @@ void pasti_format::map_sectors_in_track(wd_obs &obs, wd_sect_info *sect_infos)
tdata[(i+1) % tsize] == 0xa1 &&
(tdata[(i+2) % tsize] == 0xfe ||
tdata[(i+2) % tsize] == 0xff)) {
- UINT8 hbyte = tdata[(i+2) % tsize];
+ uint8_t hbyte = tdata[(i+2) % tsize];
int hpos = (i+3) % tsize;
int j;
bool synced = false;
@@ -575,7 +575,7 @@ void pasti_format::map_sectors_in_track(wd_obs &obs, wd_sect_info *sect_infos)
}
if(dpos != -1) {
int bcount2, tend2;
- UINT8 dhbyte = tdata[(dpos+tsize-1) % tsize];
+ uint8_t dhbyte = tdata[(dpos+tsize-1) % tsize];
int ssize = 128 << (obs.sectors[j].id[3] & 3);
match_mfm_data(obs, dpos, obs.sectors[j].data, ssize, dhbyte, bcount, tend, synced);
if(bcount < ssize) {
@@ -587,7 +587,7 @@ void pasti_format::map_sectors_in_track(wd_obs &obs, wd_sect_info *sect_infos)
synced = true;
}
}
- UINT16 crc = calc_crc(obs.sectors[j].data, ssize, calc_crc(tdata+((dpos+tsize-1) % tsize), 1, 0xcdb4));
+ uint16_t crc = calc_crc(obs.sectors[j].data, ssize, calc_crc(tdata+((dpos+tsize-1) % tsize), 1, 0xcdb4));
if(synced && tdata[tend] == (crc >> 8) && tdata[(tend+1) % tsize] == (crc & 0xff)) {
tend = (tend+2) % tsize;
bcount += 2;
diff --git a/src/lib/formats/pasti_dsk.h b/src/lib/formats/pasti_dsk.h
index fe724fb1fb5..f1fc1a75aaa 100644
--- a/src/lib/formats/pasti_dsk.h
+++ b/src/lib/formats/pasti_dsk.h
@@ -10,8 +10,8 @@ class pasti_format : public floppy_image_format_t
public:
pasti_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual const char *name() const override;
virtual const char *description() const override;
@@ -22,15 +22,15 @@ public:
protected:
struct wd_sect {
- const UINT8 *data;
- const UINT8 *fuzzy_mask;
- UINT8 id[6];
+ const uint8_t *data;
+ const uint8_t *fuzzy_mask;
+ uint8_t id[6];
int position;
double time_ratio;
};
struct wd_obs {
- const UINT8 *track_data;
+ const uint8_t *track_data;
wd_sect sectors[256];
int track_size, sector_count;
};
@@ -45,16 +45,16 @@ private:
};
void map_sectors_in_track(wd_obs &obs, wd_sect_info *sect_infos);
- void match_mfm_data(wd_obs &obs, int tpos, const UINT8 *data, int size, UINT8 context, int &bcount, int &ccount, bool &synced);
- void match_raw_data(wd_obs &obs, int tpos, const UINT8 *data, int size, UINT8 context, int &bcount, int &ccount);
- UINT16 byte_to_mfm(UINT8 data, bool context);
- UINT16 calc_crc(const UINT8 *data, int size, UINT16 crc);
+ void match_mfm_data(wd_obs &obs, int tpos, const uint8_t *data, int size, uint8_t context, int &bcount, int &ccount, bool &synced);
+ void match_raw_data(wd_obs &obs, int tpos, const uint8_t *data, int size, uint8_t context, int &bcount, int &ccount);
+ uint16_t byte_to_mfm(uint8_t data, bool context);
+ uint16_t calc_crc(const uint8_t *data, int size, uint16_t crc);
- void wd_generate_unsynced_gap(std::vector<UINT32> &track, const wd_obs &obs, int tstart, int tend, UINT32 cell_size);
- void wd_generate_synced_gap(std::vector<UINT32> &track, const wd_obs &obs, int tstart, int tend, UINT32 cell_size);
- void wd_generate_gap(std::vector<UINT32> &track, const wd_obs &obs, int tstart, int tend, bool synced, UINT32 cell_size_start, UINT32 cell_size_end);
- void wd_generate_sector_header(std::vector<UINT32> &track, const wd_obs &obs, int sector, int tstart, UINT32 cell_size);
- void wd_generate_sector_data(std::vector<UINT32> &track, const wd_obs &obs, int sector, int tstart, UINT32 cell_size);
+ void wd_generate_unsynced_gap(std::vector<uint32_t> &track, const wd_obs &obs, int tstart, int tend, uint32_t cell_size);
+ void wd_generate_synced_gap(std::vector<uint32_t> &track, const wd_obs &obs, int tstart, int tend, uint32_t cell_size);
+ void wd_generate_gap(std::vector<uint32_t> &track, const wd_obs &obs, int tstart, int tend, bool synced, uint32_t cell_size_start, uint32_t cell_size_end);
+ void wd_generate_sector_header(std::vector<uint32_t> &track, const wd_obs &obs, int sector, int tstart, uint32_t cell_size);
+ void wd_generate_sector_data(std::vector<uint32_t> &track, const wd_obs &obs, int sector, int tstart, uint32_t cell_size);
void wd_generate_track_from_sectors_and_track(int track, int head, floppy_image *image, wd_obs &obs);
void wd_generate_track_from_sectors_only(int track, int head, floppy_image *image, wd_obs &obs);
};
diff --git a/src/lib/formats/pc98fdi_dsk.cpp b/src/lib/formats/pc98fdi_dsk.cpp
index c4c21d937f6..5b37b1ede37 100644
--- a/src/lib/formats/pc98fdi_dsk.cpp
+++ b/src/lib/formats/pc98fdi_dsk.cpp
@@ -30,35 +30,35 @@ const char *pc98fdi_format::extensions() const
return "fdi";
}
-int pc98fdi_format::identify(io_generic *io, UINT32 form_factor)
+int pc98fdi_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT64 size = io_generic_size(io);
- UINT8 h[32];
+ uint64_t size = io_generic_size(io);
+ uint8_t h[32];
io_generic_read(io, h, 0, 32);
- UINT32 hsize = little_endianize_int32(*(UINT32 *) (h + 0x8));
- UINT32 psize = little_endianize_int32(*(UINT32 *) (h + 0xc));
- UINT32 ssize = little_endianize_int32(*(UINT32 *) (h + 0x10));
- UINT32 scnt = little_endianize_int32(*(UINT32 *) (h + 0x14));
- UINT32 sides = little_endianize_int32(*(UINT32 *) (h + 0x18));
- UINT32 ntrk = little_endianize_int32(*(UINT32 *) (h + 0x1c));
+ uint32_t hsize = little_endianize_int32(*(uint32_t *) (h + 0x8));
+ uint32_t psize = little_endianize_int32(*(uint32_t *) (h + 0xc));
+ uint32_t ssize = little_endianize_int32(*(uint32_t *) (h + 0x10));
+ uint32_t scnt = little_endianize_int32(*(uint32_t *) (h + 0x14));
+ uint32_t sides = little_endianize_int32(*(uint32_t *) (h + 0x18));
+ uint32_t ntrk = little_endianize_int32(*(uint32_t *) (h + 0x1c));
if(size == hsize + psize && psize == ssize*scnt*sides*ntrk)
return 100;
return 0;
}
-bool pc98fdi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool pc98fdi_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 h[32];
+ uint8_t h[32];
io_generic_read(io, h, 0, 32);
- UINT32 hsize = little_endianize_int32(*(UINT32 *)(h+0x8));
- UINT32 sector_size = little_endianize_int32(*(UINT32 *)(h+0x10));
- UINT32 sector_count = little_endianize_int32(*(UINT32 *)(h+0x14));
- UINT32 head_count = little_endianize_int32(*(UINT32 *)(h+0x18));
- UINT32 track_count = little_endianize_int32(*(UINT32 *)(h+0x1c));
+ uint32_t hsize = little_endianize_int32(*(uint32_t *)(h+0x8));
+ uint32_t sector_size = little_endianize_int32(*(uint32_t *)(h+0x10));
+ uint32_t sector_count = little_endianize_int32(*(uint32_t *)(h+0x14));
+ uint32_t head_count = little_endianize_int32(*(uint32_t *)(h+0x18));
+ uint32_t track_count = little_endianize_int32(*(uint32_t *)(h+0x1c));
int cell_count = form_factor == floppy_image::FF_35 ? 200000 : 166666;
@@ -66,7 +66,7 @@ bool pc98fdi_format::load(io_generic *io, UINT32 form_factor, floppy_image *imag
for(ssize=0; (128 << ssize) < sector_size; ssize++) {};
desc_pc_sector sects[256];
- UINT8 sect_data[65536];
+ uint8_t sect_data[65536];
for(int track=0; track < track_count; track++)
for(int head=0; head < head_count; head++) {
diff --git a/src/lib/formats/pc98fdi_dsk.h b/src/lib/formats/pc98fdi_dsk.h
index 05fd1ccc361..46503c81d9c 100644
--- a/src/lib/formats/pc98fdi_dsk.h
+++ b/src/lib/formats/pc98fdi_dsk.h
@@ -19,8 +19,8 @@ class pc98fdi_format : public floppy_image_format_t
public:
pc98fdi_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual const char *name() const override;
virtual const char *description() const override;
diff --git a/src/lib/formats/pc_dsk.cpp b/src/lib/formats/pc_dsk.cpp
index a2e597294f0..73ef727cdaf 100644
--- a/src/lib/formats/pc_dsk.cpp
+++ b/src/lib/formats/pc_dsk.cpp
@@ -16,7 +16,7 @@
struct pc_disk_sizes
{
- UINT32 image_size;
+ uint32_t image_size;
int sectors;
int heads;
};
@@ -43,7 +43,7 @@ static const struct pc_disk_sizes disk_sizes[] =
static floperr_t pc_dsk_compute_geometry(floppy_image_legacy *floppy, struct basicdsk_geometry *geometry)
{
int i;
- UINT64 size;
+ uint64_t size;
memset(geometry, 0, sizeof(*geometry));
size = floppy_image_size(floppy);
@@ -67,12 +67,12 @@ static floperr_t pc_dsk_compute_geometry(floppy_image_legacy *floppy, struct bas
* get info from boot sector.
* not correct on all disks
*/
- UINT8 scl, spt, heads;
+ uint8_t scl, spt, heads;
floppy_image_read(floppy, &scl, 0x0c, 1);
floppy_image_read(floppy, &spt, 0x18, 1);
floppy_image_read(floppy, &heads, 0x1A, 1);
- if (size == ((UINT64) scl) * spt * heads * 0x200)
+ if (size == ((uint64_t) scl) * spt * heads * 0x200)
{
geometry->sectors = spt;
geometry->heads = heads;
diff --git a/src/lib/formats/phc25_cas.cpp b/src/lib/formats/phc25_cas.cpp
index 16a38120441..2cc9ea013e6 100644
--- a/src/lib/formats/phc25_cas.cpp
+++ b/src/lib/formats/phc25_cas.cpp
@@ -42,7 +42,7 @@ enough to make it work.
// image size
static int phc25_image_size;
-static int phc25_put_samples(INT16 *buffer, int sample_pos, int count, int level)
+static int phc25_put_samples(int16_t *buffer, int sample_pos, int count, int level)
{
if (buffer)
{
@@ -53,7 +53,7 @@ static int phc25_put_samples(INT16 *buffer, int sample_pos, int count, int level
return count;
}
-static int phc25_output_bit(INT16 *buffer, int sample_pos, bool bit)
+static int phc25_output_bit(int16_t *buffer, int sample_pos, bool bit)
{
int samples = 0;
@@ -73,10 +73,10 @@ static int phc25_output_bit(INT16 *buffer, int sample_pos, bool bit)
return samples;
}
-static int phc25_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
+static int phc25_output_byte(int16_t *buffer, int sample_pos, uint8_t byte)
{
int samples = 0;
- UINT8 i;
+ uint8_t i;
/* start */
samples += phc25_output_bit (buffer, sample_pos + samples, 0);
@@ -92,11 +92,11 @@ static int phc25_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
return samples;
}
-static int phc25_handle_cassette(INT16 *buffer, const UINT8 *bytes)
+static int phc25_handle_cassette(int16_t *buffer, const uint8_t *bytes)
{
- UINT32 sample_count = 0;
- UINT32 byte_count = 0;
- UINT32 i;
+ uint32_t sample_count = 0;
+ uint32_t byte_count = 0;
+ uint32_t i;
// silence
// sample_count += phc25_put_samples(buffer, 6640, 2, WAVEENTRY_HIGH);
@@ -131,7 +131,7 @@ static int phc25_handle_cassette(INT16 *buffer, const UINT8 *bytes)
Generate samples for the tape image
********************************************************************/
-static int phc25_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int phc25_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
return phc25_handle_cassette(buffer, bytes);
}
@@ -140,7 +140,7 @@ static int phc25_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
Calculate the number of samples needed for this tape image
********************************************************************/
-static int phc25_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int phc25_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
{
phc25_image_size = length;
diff --git a/src/lib/formats/pmd_cas.cpp b/src/lib/formats/pmd_cas.cpp
index 516f8cf867b..79e8820b4bb 100644
--- a/src/lib/formats/pmd_cas.cpp
+++ b/src/lib/formats/pmd_cas.cpp
@@ -28,7 +28,7 @@
// image size
static int pmd85_image_size;
-static int pmd85_emit_level(INT16 *buffer, int sample_pos, int count, int level)
+static int pmd85_emit_level(int16_t *buffer, int sample_pos, int count, int level)
{
if (buffer)
{
@@ -39,7 +39,7 @@ static int pmd85_emit_level(INT16 *buffer, int sample_pos, int count, int level)
return count;
}
-static int pmd85_output_bit(INT16 *buffer, int sample_pos, UINT8 bit)
+static int pmd85_output_bit(int16_t *buffer, int sample_pos, uint8_t bit)
{
int samples = 0;
@@ -57,7 +57,7 @@ static int pmd85_output_bit(INT16 *buffer, int sample_pos, UINT8 bit)
return samples;
}
-static int pmd85_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
+static int pmd85_output_byte(int16_t *buffer, int sample_pos, uint8_t byte)
{
int samples = 0;
@@ -75,7 +75,7 @@ static int pmd85_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
return samples;
}
-static bool pmd85_is_header_block(const UINT8 *bytes)
+static bool pmd85_is_header_block(const uint8_t *bytes)
{
for (int i=0; i<0x10; i++)
{
@@ -86,12 +86,12 @@ static bool pmd85_is_header_block(const UINT8 *bytes)
return true;
}
-static void pmd85_printf_image_info(const UINT8 *bytes, int sample_count)
+static void pmd85_printf_image_info(const uint8_t *bytes, int sample_count)
{
#if 0
char track_name[9];
- UINT32 sec = (UINT32)(sample_count/PMD85_WAV_FREQUENCY);
- UINT16 addr = (bytes[0x33]<<8) | bytes[0x32];
+ uint32_t sec = (uint32_t)(sample_count/PMD85_WAV_FREQUENCY);
+ uint16_t addr = (bytes[0x33]<<8) | bytes[0x32];
strncpy(track_name, (char*)&bytes[0x36], 8);
track_name[8] = '\0';
@@ -99,7 +99,7 @@ static void pmd85_printf_image_info(const UINT8 *bytes, int sample_count)
#endif
}
-static int pmd85_handle_cassette(INT16 *buffer, const UINT8 *bytes)
+static int pmd85_handle_cassette(int16_t *buffer, const uint8_t *bytes)
{
int sample_count = 0;
@@ -137,7 +137,7 @@ static int pmd85_handle_cassette(INT16 *buffer, const UINT8 *bytes)
int data_pos = 0;
while (data_pos < pmd85_image_size)
{
- UINT16 block_size = (bytes[data_pos + 1]<<8) | bytes[data_pos];
+ uint16_t block_size = (bytes[data_pos + 1]<<8) | bytes[data_pos];
int pause_len = PMD85_PAUSE_BITS;
data_pos += 2;
@@ -168,7 +168,7 @@ static int pmd85_handle_cassette(INT16 *buffer, const UINT8 *bytes)
Generate samples for the tape image
********************************************************************/
-static int pmd85_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int pmd85_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
return pmd85_handle_cassette(buffer, bytes);
}
@@ -177,7 +177,7 @@ static int pmd85_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
Calculate the number of samples needed for this tape image
********************************************************************/
-static int pmd85_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int pmd85_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
{
pmd85_image_size = length;
diff --git a/src/lib/formats/primoptp.cpp b/src/lib/formats/primoptp.cpp
index b3c1875ffb1..5c6779b6613 100644
--- a/src/lib/formats/primoptp.cpp
+++ b/src/lib/formats/primoptp.cpp
@@ -26,9 +26,9 @@
#define PRIMO_FILE_PILOT_LENGTH ((4*PRIMO_BIT_1_LENGTH + 4*PRIMO_BIT_0_LENGTH)*512)
#define PRIMO_BLOCK_PILOT_LENGTH ((8*PRIMO_BIT_1_LENGTH)*96 + (5*PRIMO_BIT_1_LENGTH + 3*PRIMO_BIT_0_LENGTH)*3)
-static UINT32 primo_tape_image_length;
+static uint32_t primo_tape_image_length;
-static INT16 *primo_emit_level(INT16 *p, int count, int level)
+static int16_t *primo_emit_level(int16_t *p, int count, int level)
{
int i;
@@ -37,7 +37,7 @@ static INT16 *primo_emit_level(INT16 *p, int count, int level)
return p;
}
-static INT16* primo_output_bit(INT16 *p, UINT8 bit)
+static int16_t* primo_output_bit(int16_t *p, uint8_t bit)
{
if (bit)
{
@@ -52,7 +52,7 @@ static INT16* primo_output_bit(INT16 *p, UINT8 bit)
return p;
}
-static INT16* primo_output_byte(INT16 *p, UINT8 byte)
+static int16_t* primo_output_byte(int16_t *p, uint8_t byte)
{
int i;
@@ -62,11 +62,11 @@ static INT16* primo_output_byte(INT16 *p, UINT8 byte)
return p;
}
-static UINT32 primo_cassette_calculate_number_of_1(const UINT8 *bytes, UINT16 length)
+static uint32_t primo_cassette_calculate_number_of_1(const uint8_t *bytes, uint16_t length)
{
int i,j;
- UINT32 number_of_1 = 0;
+ uint32_t number_of_1 = 0;
for (i=0; i<length; i++)
for (j=0; j<8; j++)
@@ -76,18 +76,18 @@ static UINT32 primo_cassette_calculate_number_of_1(const UINT8 *bytes, UINT16 le
return number_of_1;
}
-static int primo_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int primo_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
{
int i = 0, j = 0;
- UINT8 *b = (UINT8*) bytes;
+ uint8_t *b = (uint8_t*) bytes;
- UINT32 file_size = 0;
- UINT16 block_size = 0;
+ uint32_t file_size = 0;
+ uint16_t block_size = 0;
- UINT32 number_of_1 = 0;
- UINT32 number_of_0 = 0;
- UINT32 size_in_samples = 0;
+ uint32_t number_of_1 = 0;
+ uint32_t number_of_0 = 0;
+ uint32_t size_in_samples = 0;
primo_tape_image_length = length;
@@ -142,15 +142,15 @@ static int primo_cassette_calculate_size_in_samples(const UINT8 *bytes, int leng
return size_in_samples;
}
-static int primo_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int primo_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
int i = 0, j = 0, k;
- INT16 *p = buffer;
- UINT8 *b = bytes;
+ int16_t *p = buffer;
+ uint8_t *b = bytes;
- UINT32 file_size = 0;
- UINT16 block_size = 0;
+ uint32_t file_size = 0;
+ uint16_t block_size = 0;
LOG_FORMATS ("Image size: %d\n", length);
diff --git a/src/lib/formats/rk_cas.cpp b/src/lib/formats/rk_cas.cpp
index 8c422506451..18504fcb130 100644
--- a/src/lib/formats/rk_cas.cpp
+++ b/src/lib/formats/rk_cas.cpp
@@ -22,7 +22,7 @@
static int data_size;
-static INT16 *rk_emit_level(INT16 *p, int count, int level)
+static int16_t *rk_emit_level(int16_t *p, int count, int level)
{
int i;
@@ -33,7 +33,7 @@ static INT16 *rk_emit_level(INT16 *p, int count, int level)
return p;
}
-static INT16* rk_output_bit(INT16 *p, UINT8 b,int bitsize)
+static int16_t* rk_output_bit(int16_t *p, uint8_t b,int bitsize)
{
if (b)
{
@@ -49,7 +49,7 @@ static INT16* rk_output_bit(INT16 *p, UINT8 b,int bitsize)
return p;
}
-static INT16* rk_output_byte(INT16 *p, UINT8 byte,int bitsize)
+static int16_t* rk_output_byte(int16_t *p, uint8_t byte,int bitsize)
{
int i;
for (i=7; i>=0; i--)
@@ -59,29 +59,29 @@ static INT16* rk_output_byte(INT16 *p, UINT8 byte,int bitsize)
}
-static int rk20_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
+static int rk20_cas_to_wav_size( const uint8_t *casdata, int caslen ) {
data_size = caslen;
return (RK_HEADER_LEN * 8 * 2 + 8*2 + caslen * 8 * 2) * RK_SIZE_20;
}
-static int rk22_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
+static int rk22_cas_to_wav_size( const uint8_t *casdata, int caslen ) {
data_size = caslen;
return (RK_HEADER_LEN * 8 * 2 + 8*2 + caslen * 8 * 2) * RK_SIZE_22;
}
-static int rk60_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
+static int rk60_cas_to_wav_size( const uint8_t *casdata, int caslen ) {
data_size = caslen;
return (RK_HEADER_LEN * 8 * 2 + 8*2 + caslen * 8 * 2) * RK_SIZE_60;
}
-static int gam_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
+static int gam_cas_to_wav_size( const uint8_t *casdata, int caslen ) {
data_size = caslen;
return (RK_HEADER_LEN * 8 * 2 + caslen * 8 * 2) * RK_SIZE_20;
}
-static int rk20_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
+static int rk20_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) {
int i;
- INT16 * p = buffer;
+ int16_t * p = buffer;
for (i=0; i<RK_HEADER_LEN; i++) {
p = rk_output_byte (p, 0x00, RK_SIZE_20 );
@@ -95,9 +95,9 @@ static int rk20_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
return p - buffer;
}
-static int rk22_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
+static int rk22_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) {
int i;
- INT16 * p = buffer;
+ int16_t * p = buffer;
for (i=0; i<RK_HEADER_LEN; i++) {
p = rk_output_byte (p, 0x00, RK_SIZE_22 );
@@ -111,9 +111,9 @@ static int rk22_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
return p - buffer;
}
-static int rk60_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
+static int rk60_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) {
int i;
- INT16 * p = buffer;
+ int16_t * p = buffer;
for (i=0; i<RK_HEADER_LEN; i++) {
p = rk_output_byte (p, 0x00, RK_SIZE_60 );
@@ -127,9 +127,9 @@ static int rk60_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
return p - buffer;
}
-static int gam_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
+static int gam_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) {
int i;
- INT16 * p = buffer;
+ int16_t * p = buffer;
for (i=0; i<RK_HEADER_LEN; i++) {
p = rk_output_byte (p, 0x00, RK_SIZE_20 );
diff --git a/src/lib/formats/rx50_dsk.cpp b/src/lib/formats/rx50_dsk.cpp
index dd92318450b..a58a8c5e59c 100644
--- a/src/lib/formats/rx50_dsk.cpp
+++ b/src/lib/formats/rx50_dsk.cpp
@@ -95,12 +95,12 @@ bool rx50img_format::supports_save() const
return true;
}
-void rx50img_format::find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 &sector_count)
+void rx50img_format::find_size(io_generic *io, uint8_t &track_count, uint8_t &head_count, uint8_t &sector_count)
{
head_count = 1;
- UINT32 expected_size = 0;
- UINT64 size = io_generic_size(io);
+ uint32_t expected_size = 0;
+ uint64_t size = io_generic_size(io);
track_count = 80;
sector_count = 10;
@@ -124,9 +124,9 @@ void rx50img_format::find_size(io_generic *io, UINT8 &track_count, UINT8 &head_c
track_count = head_count = sector_count = 0;
}
-int rx50img_format::identify(io_generic *io, UINT32 form_factor)
+int rx50img_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 track_count, head_count, sector_count;
+ uint8_t track_count, head_count, sector_count;
find_size(io, track_count, head_count, sector_count);
if(track_count)
@@ -135,14 +135,14 @@ int rx50img_format::identify(io_generic *io, UINT32 form_factor)
}
// /* Sectors are numbered 1 to 10 */
-bool rx50img_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool rx50img_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 track_count, head_count, sector_count;
+ uint8_t track_count, head_count, sector_count;
find_size(io, track_count, head_count, sector_count);
if(track_count == 0)
return false;
- UINT8 sectdata[10*512];
+ uint8_t sectdata[10*512];
desc_s sectors[10];
for(int i=0; i<sector_count; i++) {
sectors[i].data = sectdata + 512*i;
@@ -193,7 +193,7 @@ bool rx50img_format::save(io_generic *io, floppy_image *image)
}
}
*/
- UINT8 sectdata[11*512];
+ uint8_t sectdata[11*512];
int track_size = sector_count*512;
for(int track=0; track < track_count; track++) {
diff --git a/src/lib/formats/rx50_dsk.h b/src/lib/formats/rx50_dsk.h
index 37decb2fa09..b6d40bceeb8 100644
--- a/src/lib/formats/rx50_dsk.h
+++ b/src/lib/formats/rx50_dsk.h
@@ -22,8 +22,8 @@ class rx50img_format : public floppy_image_format_t
public:
rx50img_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual const char *name() const override;
@@ -34,7 +34,7 @@ public:
static const desc_e rx50_10_desc[];
private:
- void find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 &sector_count);
+ void find_size(io_generic *io, uint8_t &track_count, uint8_t &head_count, uint8_t &sector_count);
};
extern const floppy_format_type FLOPPY_RX50IMG_FORMAT;
diff --git a/src/lib/formats/sc3000_bit.cpp b/src/lib/formats/sc3000_bit.cpp
index 8143c52e14d..c656b54ee95 100644
--- a/src/lib/formats/sc3000_bit.cpp
+++ b/src/lib/formats/sc3000_bit.cpp
@@ -56,11 +56,11 @@ static cassette_image::error sc3000_bit_identify(cassette_image *cassette, struc
static cassette_image::error sc3000_bit_load(cassette_image *cassette)
{
cassette_image::error err;
- UINT64 image_size = cassette_image_size(cassette);
- UINT64 image_pos = 0;
+ uint64_t image_size = cassette_image_size(cassette);
+ uint64_t image_pos = 0;
double time_index = 0.0;
double time_displacement;
- UINT8 data;
+ uint8_t data;
while (image_pos < image_size)
{
diff --git a/src/lib/formats/sol_cas.cpp b/src/lib/formats/sol_cas.cpp
index d42c8d45101..ac668535b51 100644
--- a/src/lib/formats/sol_cas.cpp
+++ b/src/lib/formats/sol_cas.cpp
@@ -44,13 +44,13 @@ SVT - The full explanation may be found on the Solace web site,
#define SOL20_WAV_FREQUENCY 4800
// image size
-static UINT32 sol20_image_size;
+static uint32_t sol20_image_size;
static bool level;
-static UINT8 sol20_cksm_byte;
-static UINT32 sol20_byte_num;
-static UINT8 sol20_header[16];
+static uint8_t sol20_cksm_byte;
+static uint32_t sol20_byte_num;
+static uint8_t sol20_header[16];
-static int sol20_put_samples(INT16 *buffer, int sample_pos, int count)
+static int sol20_put_samples(int16_t *buffer, int sample_pos, int count)
{
if (buffer)
{
@@ -63,7 +63,7 @@ static int sol20_put_samples(INT16 *buffer, int sample_pos, int count)
return count;
}
-static int sol20_output_bit(INT16 *buffer, int sample_pos, bool bit)
+static int sol20_output_bit(int16_t *buffer, int sample_pos, bool bit)
{
int samples = 0;
@@ -80,10 +80,10 @@ static int sol20_output_bit(INT16 *buffer, int sample_pos, bool bit)
return samples;
}
-static int sol20_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
+static int sol20_output_byte(int16_t *buffer, int sample_pos, uint8_t byte)
{
int samples = 0;
- UINT8 i;
+ uint8_t i;
/* start */
samples += sol20_output_bit (buffer, sample_pos + samples, 0);
@@ -100,7 +100,7 @@ static int sol20_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
}
// Calculate checksum
-static UINT8 sol20_calc_cksm(UINT8 cksm, UINT8 data)
+static uint8_t sol20_calc_cksm(uint8_t cksm, uint8_t data)
{
data -= cksm;
cksm = data;
@@ -111,7 +111,7 @@ static UINT8 sol20_calc_cksm(UINT8 cksm, UINT8 data)
}
// Ignore remainder of line
-static void sol20_scan_to_eol(const UINT8 *bytes)
+static void sol20_scan_to_eol(const uint8_t *bytes)
{
bool t = 1;
while (t)
@@ -130,7 +130,7 @@ static void sol20_scan_to_eol(const UINT8 *bytes)
}
// skip spaces and symbols looking for a hex digit
-static void sol20_scan_to_hex(const UINT8 *bytes)
+static void sol20_scan_to_hex(const uint8_t *bytes)
{
bool t = 1;
while (t)
@@ -142,7 +142,7 @@ static void sol20_scan_to_hex(const UINT8 *bytes)
}
else
{
- UINT8 chr = bytes[sol20_byte_num];
+ uint8_t chr = bytes[sol20_byte_num];
if (chr == 0x0d)
t = 0;
else
@@ -155,10 +155,10 @@ static void sol20_scan_to_hex(const UINT8 *bytes)
}
// Turn n digits into hex
-static int sol20_read_hex(const UINT8 *bytes, UINT8 numdigits)
+static int sol20_read_hex(const uint8_t *bytes, uint8_t numdigits)
{
int data = 0;
- UINT8 i,chr;
+ uint8_t i,chr;
for (i = 0; i < numdigits; i++)
{
@@ -181,7 +181,7 @@ static int sol20_read_hex(const UINT8 *bytes, UINT8 numdigits)
}
// Turn digits into decimal
-static int sol20_read_dec(const UINT8 *bytes)
+static int sol20_read_dec(const uint8_t *bytes)
{
int data = 0;
@@ -194,14 +194,14 @@ static int sol20_read_dec(const UINT8 *bytes)
return data;
}
-static int sol20_handle_cassette(INT16 *buffer, const UINT8 *bytes)
+static int sol20_handle_cassette(int16_t *buffer, const uint8_t *bytes)
{
- UINT32 sample_count = 0;
- UINT32 i = 0,t = 0;
- UINT16 cc = 0;
+ uint32_t sample_count = 0;
+ uint32_t i = 0,t = 0;
+ uint16_t cc = 0;
sol20_byte_num = 1;
bool process_d = 0;
- UINT16 length = 0;
+ uint16_t length = 0;
// 1st line of file must say SVT
if ((bytes[0] == 'S') && (bytes[1] == 'V') && (bytes[2] == 'T'))
@@ -216,7 +216,7 @@ static int sol20_handle_cassette(INT16 *buffer, const UINT8 *bytes)
while (sol20_byte_num)
{
sol20_byte_num+=2; // bump to start of next line
- UINT8 chr = bytes[sol20_byte_num]; // Get command
+ uint8_t chr = bytes[sol20_byte_num]; // Get command
if (sol20_byte_num >= sol20_image_size)
sol20_byte_num = 0;
else
@@ -340,7 +340,7 @@ static int sol20_handle_cassette(INT16 *buffer, const UINT8 *bytes)
Generate samples for the tape image
********************************************************************/
-static int sol20_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int sol20_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
return sol20_handle_cassette(buffer, bytes);
}
@@ -349,7 +349,7 @@ static int sol20_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
Calculate the number of samples needed for this tape image
********************************************************************/
-static int sol20_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int sol20_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
{
sol20_image_size = length;
diff --git a/src/lib/formats/sorc_cas.cpp b/src/lib/formats/sorc_cas.cpp
index da31aaa6e49..10fb26197f1 100644
--- a/src/lib/formats/sorc_cas.cpp
+++ b/src/lib/formats/sorc_cas.cpp
@@ -38,7 +38,7 @@ header and leader bytes.
static int sorcerer_image_size;
static bool level;
-static int sorcerer_put_samples(INT16 *buffer, int sample_pos, int count)
+static int sorcerer_put_samples(int16_t *buffer, int sample_pos, int count)
{
if (buffer)
{
@@ -51,7 +51,7 @@ static int sorcerer_put_samples(INT16 *buffer, int sample_pos, int count)
return count;
}
-static int sorcerer_output_bit(INT16 *buffer, int sample_pos, bool bit)
+static int sorcerer_output_bit(int16_t *buffer, int sample_pos, bool bit)
{
int samples = 0;
@@ -68,10 +68,10 @@ static int sorcerer_output_bit(INT16 *buffer, int sample_pos, bool bit)
return samples;
}
-static int sorcerer_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
+static int sorcerer_output_byte(int16_t *buffer, int sample_pos, uint8_t byte)
{
int samples = 0;
- UINT8 i;
+ uint8_t i;
/* start */
samples += sorcerer_output_bit (buffer, sample_pos + samples, 0);
@@ -87,10 +87,10 @@ static int sorcerer_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
return samples;
}
-static int sorcerer_handle_cassette(INT16 *buffer, const UINT8 *bytes)
+static int sorcerer_handle_cassette(int16_t *buffer, const uint8_t *bytes)
{
- UINT32 sample_count = 0;
- UINT32 i;
+ uint32_t sample_count = 0;
+ uint32_t i;
/* idle */
for (i=0; i<2000; i++)
@@ -108,7 +108,7 @@ static int sorcerer_handle_cassette(INT16 *buffer, const UINT8 *bytes)
Generate samples for the tape image
********************************************************************/
-static int sorcerer_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int sorcerer_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
return sorcerer_handle_cassette(buffer, bytes);
}
@@ -117,7 +117,7 @@ static int sorcerer_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
Calculate the number of samples needed for this tape image
********************************************************************/
-static int sorcerer_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int sorcerer_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
{
sorcerer_image_size = length;
diff --git a/src/lib/formats/sorc_dsk.cpp b/src/lib/formats/sorc_dsk.cpp
index 27dc4270f05..ef99fd7ec11 100644
--- a/src/lib/formats/sorc_dsk.cpp
+++ b/src/lib/formats/sorc_dsk.cpp
@@ -30,14 +30,14 @@ static int sorc_get_tracks_per_disk(floppy_image_legacy *floppy)
return 77;
}
-static UINT64 sorc_translate_offset(floppy_image_legacy *floppy, int track, int head, int sector)
+static uint64_t sorc_translate_offset(floppy_image_legacy *floppy, int track, int head, int sector)
{
return 270*(16*track+sector);
}
-static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, UINT64 *offset)
+static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, uint64_t *offset)
{
- UINT64 offs;
+ uint64_t offs;
/* translate the sector to a raw sector */
if (!sector_is_index)
{
@@ -57,7 +57,7 @@ static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, in
static floperr_t internal_sorc_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen)
{
- UINT64 offset;
+ uint64_t offset;
floperr_t err;
err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
if (err)
@@ -71,7 +71,7 @@ static floperr_t internal_sorc_read_sector(floppy_image_legacy *floppy, int head
static floperr_t internal_sorc_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, const void *buffer, size_t buflen, int ddam)
{
- UINT64 offset;
+ uint64_t offset;
floperr_t err;
err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
@@ -104,7 +104,7 @@ static floperr_t sorc_write_indexed_sector(floppy_image_legacy *floppy, int head
return internal_sorc_write_sector(floppy, head, track, sector, TRUE, buffer, buflen, ddam);
}
-static floperr_t sorc_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
+static floperr_t sorc_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
{
floperr_t err;
err = get_offset(floppy, head, track, sector, FALSE, nullptr);
@@ -119,7 +119,7 @@ static floperr_t sorc_get_sector_length(floppy_image_legacy *floppy, int head, i
-static floperr_t sorc_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags)
+static floperr_t sorc_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags)
{
sector_index += 1;
if (cylinder)
diff --git a/src/lib/formats/sord_cas.cpp b/src/lib/formats/sord_cas.cpp
index f535216e18e..bc11c388915 100644
--- a/src/lib/formats/sord_cas.cpp
+++ b/src/lib/formats/sord_cas.cpp
@@ -16,7 +16,7 @@
#define SORDM5_WAVESAMPLES_TRAILER 1
#define SORDM5_WAVESAMPLES_BLOCK 1
-static const UINT8 SORDM5_CAS_HEADER[6] = { 'S', 'O', 'R', 'D', 'M', '5'};
+static const uint8_t SORDM5_CAS_HEADER[6] = { 'S', 'O', 'R', 'D', 'M', '5'};
static const struct CassetteModulation sordm5_cas_modulation =
{
@@ -25,9 +25,9 @@ static const struct CassetteModulation sordm5_cas_modulation =
3150.0 - 600, 3150.0, 3150.0 + 600
};
-static UINT8 cassette_image_read_uint8( cassette_image *cassette, UINT64 offset)
+static uint8_t cassette_image_read_uint8( cassette_image *cassette, uint64_t offset)
{
- UINT8 data;
+ uint8_t data;
cassette_image_read( cassette, &data, offset, 1);
return data;
}
@@ -40,13 +40,13 @@ static cassette_image::error sordm5_tap_identify( cassette_image *cassette, stru
static cassette_image::error sordm5_tap_load( cassette_image *cassette)
{
cassette_image::error err;
- UINT64 image_size;
+ uint64_t image_size;
double time_index = 0.0;
double time_displacement;
- UINT8 header[16];
- UINT64 image_pos;
- UINT8 block_type, byte, bit;
- UINT32 block_size, i, j;
+ uint8_t header[16];
+ uint64_t image_pos;
+ uint8_t block_type, byte, bit;
+ uint32_t block_size, i, j;
size_t filler_length;
// init
image_size = cassette_image_size(cassette);
diff --git a/src/lib/formats/spc1000_cas.cpp b/src/lib/formats/spc1000_cas.cpp
index 6d3a2af52fb..d13021b0047 100644
--- a/src/lib/formats/spc1000_cas.cpp
+++ b/src/lib/formats/spc1000_cas.cpp
@@ -33,7 +33,7 @@ IPL: This seems a quickload format containing RAM dump, not a real tape
// image size
static int spc1000_image_size;
-static int spc1000_put_samples(INT16 *buffer, int sample_pos, int count, int level)
+static int spc1000_put_samples(int16_t *buffer, int sample_pos, int count, int level)
{
if (buffer)
{
@@ -44,7 +44,7 @@ static int spc1000_put_samples(INT16 *buffer, int sample_pos, int count, int lev
return count;
}
-static int spc1000_output_bit(INT16 *buffer, int sample_pos, bool bit)
+static int spc1000_output_bit(int16_t *buffer, int sample_pos, bool bit)
{
int samples = 0;
@@ -62,23 +62,23 @@ static int spc1000_output_bit(INT16 *buffer, int sample_pos, bool bit)
return samples;
}
-static int spc1000_handle_tap(INT16 *buffer, const UINT8 *bytes)
+static int spc1000_handle_tap(int16_t *buffer, const uint8_t *bytes)
{
- UINT32 sample_count = 0;
+ uint32_t sample_count = 0;
/* data */
- for (UINT32 i = 0; i < spc1000_image_size; i++)
+ for (uint32_t i = 0; i < spc1000_image_size; i++)
sample_count += spc1000_output_bit(buffer, sample_count, bytes[i] & 1);
return sample_count;
}
-static int spc1000_handle_cas(INT16 *buffer, const UINT8 *bytes)
+static int spc1000_handle_cas(int16_t *buffer, const uint8_t *bytes)
{
- UINT32 sample_count = 0;
+ uint32_t sample_count = 0;
/* data (skipping first 16 bytes, which is CAS header) */
- for (UINT32 i = 0x10; i < spc1000_image_size; i++)
+ for (uint32_t i = 0x10; i < spc1000_image_size; i++)
for (int j = 0; j < 8; j++)
sample_count += spc1000_output_bit(buffer, sample_count, (bytes[i] >> (7 - j)) & 1);
@@ -90,12 +90,12 @@ static int spc1000_handle_cas(INT16 *buffer, const UINT8 *bytes)
Generate samples for the tape image
********************************************************************/
-static int spc1000_tap_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int spc1000_tap_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
return spc1000_handle_tap(buffer, bytes);
}
-static int spc1000_cas_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int spc1000_cas_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
return spc1000_handle_cas(buffer, bytes);
}
@@ -104,14 +104,14 @@ static int spc1000_cas_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
Calculate the number of samples needed for this tape image
********************************************************************/
-static int spc1000_tap_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int spc1000_tap_calculate_size_in_samples(const uint8_t *bytes, int length)
{
spc1000_image_size = length;
return spc1000_handle_tap(nullptr, bytes);
}
-static int spc1000_cas_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int spc1000_cas_calculate_size_in_samples(const uint8_t *bytes, int length)
{
spc1000_image_size = length;
diff --git a/src/lib/formats/st_dsk.cpp b/src/lib/formats/st_dsk.cpp
index a30165993ea..9808dc56ff9 100644
--- a/src/lib/formats/st_dsk.cpp
+++ b/src/lib/formats/st_dsk.cpp
@@ -36,20 +36,20 @@ bool st_format::supports_save() const
return true;
}
-void st_format::find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 &sector_count)
+void st_format::find_size(io_generic *io, uint8_t &track_count, uint8_t &head_count, uint8_t &sector_count)
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
for(track_count=80; track_count <= 82; track_count++)
for(head_count=1; head_count <= 2; head_count++)
for(sector_count=9; sector_count <= 11; sector_count++)
- if(size == (UINT32)512*track_count*head_count*sector_count)
+ if(size == (uint32_t)512*track_count*head_count*sector_count)
return;
track_count = head_count = sector_count = 0;
}
-int st_format::identify(io_generic *io, UINT32 form_factor)
+int st_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 track_count, head_count, sector_count;
+ uint8_t track_count, head_count, sector_count;
find_size(io, track_count, head_count, sector_count);
if(track_count)
@@ -57,12 +57,12 @@ int st_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool st_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool st_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 track_count, head_count, sector_count;
+ uint8_t track_count, head_count, sector_count;
find_size(io, track_count, head_count, sector_count);
- UINT8 sectdata[11*512];
+ uint8_t sectdata[11*512];
desc_s sectors[11];
for(int i=0; i<sector_count; i++) {
sectors[i].data = sectdata + 512*i;
@@ -103,7 +103,7 @@ bool st_format::save(io_generic *io, floppy_image *image)
else if(sector_count < 9)
sector_count = 9;
- UINT8 sectdata[11*512];
+ uint8_t sectdata[11*512];
int track_size = sector_count*512;
for(int track=0; track < track_count; track++) {
@@ -141,9 +141,9 @@ bool msa_format::supports_save() const
return true;
}
-void msa_format::read_header(io_generic *io, UINT16 &sign, UINT16 &sect, UINT16 &head, UINT16 &strack, UINT16 &etrack)
+void msa_format::read_header(io_generic *io, uint16_t &sign, uint16_t &sect, uint16_t &head, uint16_t &strack, uint16_t &etrack)
{
- UINT8 h[10];
+ uint8_t h[10];
io_generic_read(io, h, 0, 10);
sign = (h[0] << 8) | h[1];
sect = (h[2] << 8) | h[3];
@@ -152,9 +152,9 @@ void msa_format::read_header(io_generic *io, UINT16 &sign, UINT16 &sect, UINT16
etrack = (h[8] << 8) | h[9];
}
-bool msa_format::uncompress(UINT8 *buffer, int csize, int usize)
+bool msa_format::uncompress(uint8_t *buffer, int csize, int usize)
{
- UINT8 sectdata[11*512];
+ uint8_t sectdata[11*512];
int src=0, dst=0;
while(src<csize && dst<usize) {
unsigned char c = buffer[src++];
@@ -178,7 +178,7 @@ bool msa_format::uncompress(UINT8 *buffer, int csize, int usize)
return true;
}
-bool msa_format::compress(const UINT8 *buffer, int usize, UINT8 *dest, int &csize)
+bool msa_format::compress(const uint8_t *buffer, int usize, uint8_t *dest, int &csize)
{
int src=0, dst=0;
while(src<usize && dst<usize) {
@@ -206,9 +206,9 @@ bool msa_format::compress(const UINT8 *buffer, int usize, UINT8 *dest, int &csiz
return dst < usize;
}
-int msa_format::identify(io_generic *io, UINT32 form_factor)
+int msa_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT16 sign, sect, head, strack, etrack;
+ uint16_t sign, sect, head, strack, etrack;
read_header(io, sign, sect, head, strack, etrack);
if(sign == 0x0e0f &&
@@ -220,12 +220,12 @@ int msa_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool msa_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool msa_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT16 sign, sect, heads, strack, etrack;
+ uint16_t sign, sect, heads, strack, etrack;
read_header(io, sign, sect, heads, strack, etrack);
- UINT8 sectdata[11*512];
+ uint8_t sectdata[11*512];
desc_s sectors[11];
for(int i=0; i<sect; i++) {
sectors[i].data = sectdata + 512*1;
@@ -238,7 +238,7 @@ bool msa_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
for(int track=strack; track <= etrack; track++) {
for(int head=0; head <= heads; head++) {
- UINT8 th[2];
+ uint8_t th[2];
io_generic_read(io, th, pos, 2);
pos += 2;
int tsize = (th[0] << 8) | th[1];
@@ -277,7 +277,7 @@ bool msa_format::save(io_generic *io, floppy_image *image)
else if(sector_count < 9)
sector_count = 9;
- UINT8 header[10];
+ uint8_t header[10];
header[0] = 0x0e;
header[1] = 0x0f;
header[2] = 0;
@@ -293,8 +293,8 @@ bool msa_format::save(io_generic *io, floppy_image *image)
int pos = 10;
- UINT8 sectdata[11*512];
- UINT8 compdata[11*512];
+ uint8_t sectdata[11*512];
+ uint8_t compdata[11*512];
int track_size = sector_count*512;
for(int track=0; track < track_count; track++) {
@@ -302,14 +302,14 @@ bool msa_format::save(io_generic *io, floppy_image *image)
get_track_data_mfm_pc(track, head, image, 2000, 512, sector_count, sectdata);
int csize;
if(compress(sectdata, track_size, compdata, csize)) {
- UINT8 th[2];
+ uint8_t th[2];
th[0] = csize >> 8;
th[1] = csize;
io_generic_write(io, th, pos, 2);
io_generic_write(io, compdata, pos+2, csize);
pos += 2+csize;
} else {
- UINT8 th[2];
+ uint8_t th[2];
th[0] = track_size >> 8;
th[1] = track_size;
io_generic_write(io, th, pos, 2);
diff --git a/src/lib/formats/st_dsk.h b/src/lib/formats/st_dsk.h
index 242d7e9cf5b..9245e861eae 100644
--- a/src/lib/formats/st_dsk.h
+++ b/src/lib/formats/st_dsk.h
@@ -18,8 +18,8 @@ class st_format : public floppy_image_format_t
public:
st_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual const char *name() const override;
@@ -28,7 +28,7 @@ public:
virtual bool supports_save() const override;
private:
- void find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 &sector_count);
+ void find_size(io_generic *io, uint8_t &track_count, uint8_t &head_count, uint8_t &sector_count);
};
class msa_format : public floppy_image_format_t
@@ -36,8 +36,8 @@ class msa_format : public floppy_image_format_t
public:
msa_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual const char *name() const override;
@@ -46,9 +46,9 @@ public:
virtual bool supports_save() const override;
private:
- bool uncompress(UINT8 *buffer, int csize, int usize);
- bool compress(const UINT8 *src, int usize, UINT8 *dest, int &csize);
- void read_header(io_generic *io, UINT16 &sign, UINT16 &sect, UINT16 &head, UINT16 &strack, UINT16 &etrack);
+ bool uncompress(uint8_t *buffer, int csize, int usize);
+ bool compress(const uint8_t *src, int usize, uint8_t *dest, int &csize);
+ void read_header(io_generic *io, uint16_t &sign, uint16_t &sect, uint16_t &head, uint16_t &strack, uint16_t &etrack);
};
extern const floppy_format_type FLOPPY_ST_FORMAT;
diff --git a/src/lib/formats/svi_cas.cpp b/src/lib/formats/svi_cas.cpp
index 4030fedc051..c681c36d9dd 100644
--- a/src/lib/formats/svi_cas.cpp
+++ b/src/lib/formats/svi_cas.cpp
@@ -10,7 +10,7 @@
#define CAS_EMPTY_SAMPLES (24220)
#define CAS_INIT_SAMPLES (200)
-static const UINT8 CasHeader[17] =
+static const uint8_t CasHeader[17] =
{
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x7f
@@ -24,7 +24,7 @@ static int cas_size;
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int svi_cas_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int svi_cas_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
int cas_pos, samples_pos, n, i;
@@ -112,7 +112,7 @@ static int svi_cas_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
/*******************************************************************
Calculate the number of samples needed for this tape image
********************************************************************/
-static int svi_cas_to_wav_size(const UINT8 *casdata, int caslen)
+static int svi_cas_to_wav_size(const uint8_t *casdata, int caslen)
{
int cas_pos, samples_pos, size, i;
diff --git a/src/lib/formats/svi_dsk.cpp b/src/lib/formats/svi_dsk.cpp
index aaa6a45e709..aae08ba329d 100644
--- a/src/lib/formats/svi_dsk.cpp
+++ b/src/lib/formats/svi_dsk.cpp
@@ -29,9 +29,9 @@ const char *svi_format::extensions() const
return "dsk";
}
-int svi_format::identify(io_generic *io, UINT32 form_factor)
+int svi_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
if (size == 172032 || size == 346112)
return 50;
@@ -39,9 +39,9 @@ int svi_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool svi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool svi_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
int head_count;
switch (size)
@@ -61,7 +61,7 @@ bool svi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
int sector_size = (track == 0 && head == 0) ? 128 : 256;
desc_pc_sector sectors[20];
- UINT8 sector_data[5000];
+ uint8_t sector_data[5000];
int sector_offset = 0;
for (int i = 0; i < sector_count; i++)
@@ -93,11 +93,11 @@ bool svi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
bool svi_format::save(io_generic *io, floppy_image *image)
{
- UINT8 bitstream[500000/8];
- UINT8 sector_data[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sector_data[50000];
desc_xs sectors[256];
int track_size;
- UINT64 file_offset = 0;
+ uint64_t file_offset = 0;
int track_count, head_count;
image->get_actual_geometry(track_count, head_count);
diff --git a/src/lib/formats/svi_dsk.h b/src/lib/formats/svi_dsk.h
index 9ae933572df..f7ffbfeaf5c 100644
--- a/src/lib/formats/svi_dsk.h
+++ b/src/lib/formats/svi_dsk.h
@@ -24,8 +24,8 @@ public:
virtual const char *description() const override;
virtual const char *extensions() const override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual bool supports_save() const override;
};
diff --git a/src/lib/formats/td0_dsk.cpp b/src/lib/formats/td0_dsk.cpp
index 51fa59488a6..375cf3cdb42 100644
--- a/src/lib/formats/td0_dsk.cpp
+++ b/src/lib/formats/td0_dsk.cpp
@@ -44,51 +44,51 @@ struct td0dsk_tag
int heads;
int tracks;
int sector_size;
- UINT64 track_offsets[84*2]; /* offset within data for each track */
- UINT8 *data;
+ uint64_t track_offsets[84*2]; /* offset within data for each track */
+ uint8_t *data;
};
struct tdlzhuf {
- UINT16 r,
+ uint16_t r,
bufcnt,bufndx,bufpos, // string buffer
// the following to allow block reads from input in next_word()
ibufcnt,ibufndx; // input buffer counters
- UINT8 inbuf[BUFSZ]; // input buffer
+ uint8_t inbuf[BUFSZ]; // input buffer
};
struct td0dsk_t
{
io_generic *floppy_file;
- UINT64 floppy_file_offset;
+ uint64_t floppy_file_offset;
struct tdlzhuf tdctl;
- UINT8 text_buf[N + F - 1];
- UINT16 freq[T + 1]; /* cumulative freq table */
+ uint8_t text_buf[N + F - 1];
+ uint16_t freq[T + 1]; /* cumulative freq table */
/*
* pointing parent nodes.
* area [T..(T + N_CHAR - 1)] are pointers for leaves
*/
- INT16 prnt[T + N_CHAR];
+ int16_t prnt[T + N_CHAR];
/* pointing children nodes (son[], son[] + 1)*/
- INT16 son[T];
+ int16_t son[T];
- UINT16 getbuf;
- UINT8 getlen;
+ uint16_t getbuf;
+ uint8_t getlen;
- int data_read(UINT8 *buf, UINT16 size);
+ int data_read(uint8_t *buf, uint16_t size);
int next_word();
int GetBit();
int GetByte();
void StartHuff();
void reconst();
void update(int c);
- INT16 DecodeChar();
- INT16 DecodePosition();
+ int16_t DecodeChar();
+ int16_t DecodePosition();
void init_Decode();
- int Decode(UINT8 *buf, int len);
+ int Decode(uint8_t *buf, int len);
};
//static td0dsk_t td0dsk;
@@ -103,10 +103,10 @@ struct floppy_image_legacy
/* loaded track stuff */
int loaded_track_head;
int loaded_track_index;
- UINT32 loaded_track_size;
+ uint32_t loaded_track_size;
void *loaded_track_data;
- UINT8 loaded_track_status;
- UINT8 flags;
+ uint8_t loaded_track_status;
+ uint8_t flags;
/* tagging system */
object_pool *tags;
@@ -125,7 +125,7 @@ static struct td0dsk_tag *get_tag(floppy_image_legacy *floppy)
FLOPPY_IDENTIFY( td0_dsk_identify )
{
- UINT8 header[2];
+ uint8_t header[2];
floppy_image_read(floppy, header, 0, 2);
if (header[0]=='T' && header[1]=='D') {
@@ -148,16 +148,16 @@ static int td0_get_tracks_per_disk(floppy_image_legacy *floppy)
return get_tag(floppy)->tracks;
}
-static UINT64 td0_get_track_offset(floppy_image_legacy *floppy, int head, int track)
+static uint64_t td0_get_track_offset(floppy_image_legacy *floppy, int head, int track)
{
return get_tag(floppy)->track_offsets[(track<<1) + head];
}
-static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, UINT64 *offset)
+static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, uint64_t *offset)
{
- UINT64 offs;
- UINT8 *header;
- UINT8 sectors_per_track;
+ uint64_t offs;
+ uint8_t *header;
+ uint8_t sectors_per_track;
int i;
if ((head < 0) || (head >= get_tag(floppy)->heads) || (track < 0) || (track >= get_tag(floppy)->tracks)
@@ -202,16 +202,16 @@ static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, in
static floperr_t internal_td0_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen)
{
- UINT64 offset;
+ uint64_t offset;
floperr_t err;
- UINT8 *header;
+ uint8_t *header;
int size,realsize,i;
int buff_pos;
int data_pos;
- UINT8 *data;
- UINT8 *buf;
+ uint8_t *data;
+ uint8_t *buf;
- buf = (UINT8*)buffer;
+ buf = (uint8_t*)buffer;
// take sector offset
err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
if (err)
@@ -295,7 +295,7 @@ static floperr_t td0_read_indexed_sector(floppy_image_legacy *floppy, int head,
return internal_td0_read_sector(floppy, head, track, sector, TRUE, buffer, buflen);
}
-static floperr_t td0_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
+static floperr_t td0_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
{
floperr_t err;
err = get_offset(floppy, head, track, sector, FALSE, nullptr);
@@ -308,11 +308,11 @@ static floperr_t td0_get_sector_length(floppy_image_legacy *floppy, int head, in
return FLOPPY_ERROR_SUCCESS;
}
-static floperr_t td0_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags)
+static floperr_t td0_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags)
{
floperr_t retVal;
- UINT64 offset = 0;
- UINT8 *sector_info;
+ uint64_t offset = 0;
+ uint8_t *sector_info;
retVal = get_offset(floppy, head, track, sector_index, FALSE, &offset);
sector_info = get_tag(floppy)->data + offset;
@@ -334,9 +334,9 @@ static floperr_t td0_get_indexed_sector_info(floppy_image_legacy *floppy, int he
return retVal;
}
-int td0dsk_t::data_read(UINT8 *buf, UINT16 size)
+int td0dsk_t::data_read(uint8_t *buf, uint16_t size)
{
- UINT64 image_size = io_generic_size(floppy_file);
+ uint64_t image_size = io_generic_size(floppy_file);
if (size > image_size - floppy_file_offset) {
size = image_size - floppy_file_offset;
}
@@ -352,7 +352,7 @@ int td0dsk_t::data_read(UINT8 *buf, UINT16 size)
*/
/* decoder table */
-static const UINT8 d_code[256] = {
+static const uint8_t d_code[256] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -387,7 +387,7 @@ static const UINT8 d_code[256] = {
0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
};
-static const UINT8 d_len[256] = {
+static const uint8_t d_len[256] = {
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
@@ -441,7 +441,7 @@ int td0dsk_t::next_word()
int td0dsk_t::GetBit() /* get one bit */
{
- INT16 i;
+ int16_t i;
if(next_word() < 0)
return(-1);
i = getbuf;
@@ -455,7 +455,7 @@ int td0dsk_t::GetBit() /* get one bit */
int td0dsk_t::GetByte() /* get a byte */
{
- UINT16 i;
+ uint16_t i;
if(next_word() != 0)
return(-1);
i = getbuf;
@@ -494,8 +494,8 @@ void td0dsk_t::StartHuff()
void td0dsk_t::reconst()
{
- INT16 i, j, k;
- UINT16 f, l;
+ int16_t i, j, k;
+ uint16_t f, l;
/* halven cumulative freq for leaf nodes */
j = 0;
@@ -572,10 +572,10 @@ void td0dsk_t::update(int c)
}
-INT16 td0dsk_t::DecodeChar()
+int16_t td0dsk_t::DecodeChar()
{
int ret;
- UINT16 c;
+ uint16_t c;
c = son[R];
@@ -595,16 +595,16 @@ INT16 td0dsk_t::DecodeChar()
return c;
}
-INT16 td0dsk_t::DecodePosition()
+int16_t td0dsk_t::DecodePosition()
{
- INT16 bit;
- UINT16 i, j, c;
+ int16_t bit;
+ uint16_t i, j, c;
/* decode upper 6 bits from given table */
if((bit=GetByte()) < 0)
return(-1);
- i = (UINT16) bit;
- c = (UINT16)d_code[i] << 6;
+ i = (uint16_t) bit;
+ c = (uint16_t)d_code[i] << 6;
j = d_len[i];
/* input lower 6 bits directly */
@@ -637,9 +637,9 @@ void td0dsk_t::init_Decode()
}
-int td0dsk_t::Decode(UINT8 *buf, int len) /* Decoding/Uncompressing */
+int td0dsk_t::Decode(uint8_t *buf, int len) /* Decoding/Uncompressing */
{
- INT16 c,pos;
+ int16_t c,pos;
int count; // was an unsigned long, seems unnecessary
for (count = 0; count < len; ) {
if(tdctl.bufcnt == 0) {
@@ -682,7 +682,7 @@ FLOPPY_CONSTRUCT( td0_dsk_construct )
td0dsk_t state;
struct FloppyCallbacks *callbacks;
struct td0dsk_tag *tag;
- UINT8 *header;
+ uint8_t *header;
int number_of_sectors;
int position;
int i;
@@ -698,7 +698,7 @@ FLOPPY_CONSTRUCT( td0_dsk_construct )
if (!tag)
return FLOPPY_ERROR_OUTOFMEMORY;
- tag->data = (UINT8*)malloc(floppy_image_size(floppy));
+ tag->data = (uint8_t*)malloc(floppy_image_size(floppy));
if (tag->data==nullptr) {
return FLOPPY_ERROR_OUTOFMEMORY;
}
@@ -706,7 +706,7 @@ FLOPPY_CONSTRUCT( td0_dsk_construct )
header = tag->data;
if (header[0]=='t') {
- UINT8 obuf[BUFSZ];
+ uint8_t obuf[BUFSZ];
int rd;
int off = 12;
int size = 0;
@@ -719,7 +719,7 @@ FLOPPY_CONSTRUCT( td0_dsk_construct )
} while(rd == BUFSZ);
memcpy(obuf,tag->data,12);
free(tag->data);
- tag->data = (UINT8*)malloc(size+12);
+ tag->data = (uint8_t*)malloc(size+12);
if (tag->data==nullptr) {
return FLOPPY_ERROR_OUTOFMEMORY;
}
@@ -819,9 +819,9 @@ const char *td0_format::extensions() const
return "td0";
}
-int td0_format::identify(io_generic *io, UINT32 form_factor)
+int td0_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 h[7];
+ uint8_t h[7];
io_generic_read(io, h, 0, 7);
if(((h[0] == 'T') && (h[1] == 'D')) || ((h[0] == 't') && (h[1] == 'd')))
@@ -831,15 +831,15 @@ int td0_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool td0_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool td0_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
int track_count = 0;
int head_count = 0;
int track_spt;
int offset = 0;
const int max_size = 4*1024*1024; // 4MB ought to be large enough for any floppy
- std::vector<UINT8> imagebuf(max_size);
- UINT8 header[12];
+ std::vector<uint8_t> imagebuf(max_size);
+ uint8_t header[12];
io_generic_read(io, header, 0, 12);
head_count = header[9];
@@ -917,7 +917,7 @@ bool td0_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
while(track_spt != 255)
{
desc_pc_sector sects[256];
- UINT8 sect_data[65536];
+ uint8_t sect_data[65536];
int sdatapos = 0;
int track = imagebuf[offset + 1];
int head = imagebuf[offset + 2] & 1;
@@ -925,8 +925,8 @@ bool td0_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
offset += 4;
for(int i = 0; i < track_spt; i++)
{
- UINT8 *hs = &imagebuf[offset];
- UINT16 size;
+ uint8_t *hs = &imagebuf[offset];
+ uint16_t size;
offset += 6;
sects[i].track = hs[0];
@@ -967,8 +967,8 @@ bool td0_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
k = 0;
while(k < size)
{
- UINT16 len = imagebuf[offset];
- UINT16 rep = imagebuf[offset + 1];
+ uint16_t len = imagebuf[offset];
+ uint16_t rep = imagebuf[offset + 1];
offset += 2;
if(!len)
{
diff --git a/src/lib/formats/td0_dsk.h b/src/lib/formats/td0_dsk.h
index eae873e30e0..2207b993c21 100644
--- a/src/lib/formats/td0_dsk.h
+++ b/src/lib/formats/td0_dsk.h
@@ -11,8 +11,8 @@ class td0_format : public floppy_image_format_t
public:
td0_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual const char *name() const override;
diff --git a/src/lib/formats/thom_cas.cpp b/src/lib/formats/thom_cas.cpp
index c6ab5a2d004..45f89ac2a29 100644
--- a/src/lib/formats/thom_cas.cpp
+++ b/src/lib/formats/thom_cas.cpp
@@ -46,8 +46,8 @@
#define TO7_PERIOD_CASS_0 ( 1. / TO7_FREQ_CASS_0 )
#define TO7_PERIOD_CASS_1 ( 1. / TO7_FREQ_CASS_1 )
-static UINT32 to7_k7_bitsize;
-static UINT8* to7_k7_bits;
+static uint32_t to7_k7_bitsize;
+static uint8_t* to7_k7_bits;
#define MO5_BIT_LENGTH 0.000833
#define MO5_HBIT_LENGTH (MO5_BIT_LENGTH / 2.)
@@ -106,12 +106,12 @@ static cassette_image::error to7_k7_identify ( cassette_image *cass, struct Cass
static cassette_image::error to7_k7_load( cassette_image *cass )
{
#if ! K7_SPEED_HACK
- static const INT8 square_wave[] = { -128, 127 };
+ static const int8_t square_wave[] = { -128, 127 };
double time = 0.;
#endif
size_t size = cassette_image_size( cass ), pos = 0;
int i, sz, sz2, bitmax = 1024, invalid = 0;
- UINT8 in, typ, block[264];
+ uint8_t in, typ, block[264];
LOG (( "to7_k7_load: start conversion, size=%li\n", (long)size ));
PRINT (( "to7_k7_load: open cassette, length: %li bytes\n", (long) size ));
@@ -123,7 +123,7 @@ static cassette_image::error to7_k7_load( cassette_image *cass )
}
to7_k7_bitsize = 0;
- to7_k7_bits = (UINT8*)malloc(bitmax );
+ to7_k7_bits = (uint8_t*)malloc(bitmax );
/* store one period */
#if K7_SPEED_HACK
@@ -158,7 +158,7 @@ static cassette_image::error to7_k7_load( cassette_image *cass )
} \
if ( to7_k7_bitsize + 1 >= bitmax ) \
{ \
- UINT8* a = (UINT8*)malloc(bitmax * 2); \
+ uint8_t* a = (uint8_t*)malloc(bitmax * 2); \
memcpy ( a, to7_k7_bits, bitmax ); \
bitmax *= 2; \
to7_k7_bits = a; \
@@ -170,7 +170,7 @@ static cassette_image::error to7_k7_load( cassette_image *cass )
#define K7_PUT_BYTE( BYTE ) \
do \
{ \
- UINT8 x; \
+ uint8_t x; \
K7_PUT_BIT( 0 ); \
for ( x = 0; x < 8; x++ ) \
K7_PUT_BIT( ( (BYTE) >> x ) & 1 ); \
@@ -290,8 +290,8 @@ static cassette_image::error to7_k7_load( cassette_image *cass )
if ( typ == 0 )
{
char name[] = "01234567.ABC";
- UINT8 t = block[15];
- UINT8 u = block[16];
+ uint8_t t = block[15];
+ uint8_t u = block[16];
int p = (to7_k7_bitsize - sz2 - 4 - sz) * TO7_BIT_LENGTH;
memcpy( name, block+4, 8 );
memcpy( name+9, block+12, 3 );
@@ -331,7 +331,7 @@ static cassette_image::error to7_k7_load( cassette_image *cass )
}
if ( invalid < 10 && sz > 4 && in == 0x01 && pos + 4 <= size )
{
- UINT8 in1,in2;
+ uint8_t in1,in2;
cassette_image_read( cass, &in1, pos+1, 1 );
cassette_image_read( cass, &in2, pos+2, 1 );
if ( (in1 == 0x3c) && ((in2 == 0x00) || (in2 == 0x01) ) )
@@ -466,7 +466,7 @@ static cassette_image::error mo5_k5_load( cassette_image *cass )
{
size_t size = cassette_image_size( cass ), pos = 0;
int i, sz, sz2, hbit = 0;
- UINT8 in, in2, in3, typ, block[264], sum;
+ uint8_t in, in2, in3, typ, block[264], sum;
int invalid = 0, hbitsize = 0, dcmoto = 0;
LOG (( "mo5_k5_load: start conversion, size=%li\n", (long)size ));
@@ -502,7 +502,7 @@ static cassette_image::error mo5_k5_load( cassette_image *cass )
#define K5_PUT_BYTE( BYTE ) \
do \
{ \
- UINT8 b = BYTE; \
+ uint8_t b = BYTE; \
int x; \
for ( x = 0; x < 8; x++ ) \
K5_PUT_BIT( (b >> (7 - x)) & 1 ); \
@@ -596,7 +596,7 @@ static cassette_image::error mo5_k5_load( cassette_image *cass )
}
cassette_image_read( cass, block, pos, 4 );
typ = block[2];
- sz2 = (UINT8) (block[3]-1);
+ sz2 = (uint8_t) (block[3]-1);
if ( block[0] != 0x3c || block[1] != 0x5a || ( typ != 0x00 && typ != 0x01 && typ != 0xff ) || pos+sz2 > size )
{
pos -= sz;
@@ -635,8 +635,8 @@ static cassette_image::error mo5_k5_load( cassette_image *cass )
if ( typ == 0 )
{
char name[] = "01234567.ABC";
- UINT8 t = block[15];
- UINT8 u = block[16];
+ uint8_t t = block[15];
+ uint8_t u = block[16];
int p = (hbitsize - sz2 - 4 - sz) * MO5_HBIT_LENGTH;
memcpy( name, block+4, 8 );
memcpy( name+9, block+12, 3 );
diff --git a/src/lib/formats/thom_dsk.cpp b/src/lib/formats/thom_dsk.cpp
index df4d66c84e3..6249d785705 100644
--- a/src/lib/formats/thom_dsk.cpp
+++ b/src/lib/formats/thom_dsk.cpp
@@ -23,7 +23,7 @@ static const char sap_header[] =
"(c) Alexandre PUKALL Avril 1998";
-static const UINT16 sap_crc[] =
+static const uint16_t sap_crc[] =
{
0x0000, 0x1081, 0x2102, 0x3183, 0x4204, 0x5285, 0x6306, 0x7387,
0x8408, 0x9489, 0xa50a, 0xb58b, 0xc60c, 0xd68d, 0xe70e, 0xf78f,
@@ -36,10 +36,10 @@ struct sap_dsk_tag
int sector_pos[80][16]; /* remember sector position in file */
};
-static UINT16 thom_sap_crc( UINT8* data, int size )
+static uint16_t thom_sap_crc( uint8_t* data, int size )
{
int i;
- UINT16 crc = 0xffff, crc2;
+ uint16_t crc = 0xffff, crc2;
for ( i = 0; i < size; i++ )
{
crc2 = ( crc >> 4 ) ^ sap_crc[ ( crc ^ data[i] ) & 15 ];
@@ -79,9 +79,9 @@ static int sap_get_tracks_per_disk(floppy_image_legacy *floppy)
}
-static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, UINT64 *offset)
+static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, uint64_t *offset)
{
- UINT64 offs;
+ uint64_t offs;
struct sap_dsk_tag *tag = get_tag(floppy);
/* translate the sector to a raw sector */
if (!sector_is_index)
@@ -106,16 +106,16 @@ static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, in
static floperr_t internal_sap_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen)
{
- UINT64 offset;
+ uint64_t offset;
floperr_t err;
int i;
- UINT8 *buf;
+ uint8_t *buf;
err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
if (err)
return err;
floppy_image_read(floppy, buffer, offset+4, buflen);
- buf = (UINT8*)buffer;
+ buf = (uint8_t*)buffer;
for (i=0;i<buflen;i++) {
buf[i] ^= sap_magic_num;
}
@@ -126,10 +126,10 @@ static floperr_t internal_sap_read_sector(floppy_image_legacy *floppy, int head,
static floperr_t internal_sap_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, const void *buffer, size_t buflen, int ddam)
{
- UINT64 offset;
+ uint64_t offset;
floperr_t err;
- UINT8 buf[256+6];
- UINT16 crc;
+ uint8_t buf[256+6];
+ uint16_t crc;
int i;
err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
if (err)
@@ -138,7 +138,7 @@ static floperr_t internal_sap_write_sector(floppy_image_legacy *floppy, int head
/* buf = 4-byte header + sector + 2-byte CRC */
floppy_image_read(floppy, buf, offset, 4);
for (i=0;i<buflen;i++) {
- buf[i+4] = ((UINT8*)buffer)[i];
+ buf[i+4] = ((uint8_t*)buffer)[i];
}
crc = thom_sap_crc( buf, buflen+4 );
buf[buflen+4] = crc >> 8;
@@ -172,7 +172,7 @@ static floperr_t sap_write_indexed_sector(floppy_image_legacy *floppy, int head,
return internal_sap_write_sector(floppy, head, track, sector, TRUE, buffer, buflen, ddam);
}
-static floperr_t sap_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
+static floperr_t sap_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
{
floperr_t err;
err = get_offset(floppy, head, track, sector, FALSE, nullptr);
@@ -187,11 +187,11 @@ static floperr_t sap_get_sector_length(floppy_image_legacy *floppy, int head, in
-static floperr_t sap_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags)
+static floperr_t sap_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags)
{
floperr_t err;
- UINT8 header[4];
- UINT64 offset = 0;
+ uint8_t header[4];
+ uint64_t offset = 0;
sector_index += 1;
err = get_offset(floppy, head, track, sector_index, FALSE, &offset);
@@ -214,7 +214,7 @@ static floperr_t sap_post_format(floppy_image_legacy *floppy, util::option_resol
{
int track,sector;
int pos;
- UINT8 buf[256], header[4];
+ uint8_t buf[256], header[4];
struct sap_dsk_tag *tag;
tag = (struct sap_dsk_tag *) floppy_create_tag(floppy, sizeof(struct sap_dsk_tag));
@@ -255,7 +255,7 @@ static FLOPPY_CONSTRUCT(sap_dsk_construct)
struct FloppyCallbacks *callbacks;
struct sap_dsk_tag *tag;
int j;
- UINT8 fmt;
+ uint8_t fmt;
tag = (struct sap_dsk_tag *) floppy_create_tag(floppy, sizeof(struct sap_dsk_tag));
if (!tag)
return FLOPPY_ERROR_OUTOFMEMORY;
@@ -271,9 +271,9 @@ static FLOPPY_CONSTRUCT(sap_dsk_construct)
tag->sector_pos[i][j] = 0;
/* count tracks & fill sector offset table */
- for ( UINT64 i = 0x42; i+4 < floppy_image_size(floppy); i += tag->sector_size + 6 ) // CRC 2 bytes + 4 bytes sector header
+ for ( uint64_t i = 0x42; i+4 < floppy_image_size(floppy); i += tag->sector_size + 6 ) // CRC 2 bytes + 4 bytes sector header
{
- UINT8 sector, track;
+ uint8_t sector, track;
floppy_image_read(floppy, &track, i+2, 1);
floppy_image_read(floppy, &sector, i+3, 1);
if ( track >= 80 || sector < 1 || sector > 16 ) continue;
diff --git a/src/lib/formats/ti99_dsk.cpp b/src/lib/formats/ti99_dsk.cpp
index 0d03cf4fce0..ce8def17289 100644
--- a/src/lib/formats/ti99_dsk.cpp
+++ b/src/lib/formats/ti99_dsk.cpp
@@ -58,7 +58,7 @@
As said above, let's not spend too much effort allowing format deviations.
If the image does not exactly adhere to the format, give up.
*/
-bool ti99_floppy_format::check_for_address_marks(UINT8* trackdata, int encoding)
+bool ti99_floppy_format::check_for_address_marks(uint8_t* trackdata, int encoding)
{
int i=0;
@@ -94,7 +94,7 @@ int ti99_floppy_format::get_encoding(int cell_size)
/*
Load the image from disk and convert it into a sequence of flux levels.
*/
-bool ti99_floppy_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool ti99_floppy_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
int cell_size = 0;
int sector_count = 0;
@@ -105,7 +105,7 @@ bool ti99_floppy_format::load(io_generic *io, UINT32 form_factor, floppy_image *
if (cell_size == 0) return false;
// Be ready to hold a track of up to 36 sectors (with gaps and marks)
- UINT8 trackdata[13000];
+ uint8_t trackdata[13000];
int maxtrack, maxheads;
image->get_maximal_geometry(maxtrack, maxheads);
@@ -188,8 +188,8 @@ bool ti99_floppy_format::save(io_generic *io, floppy_image *image)
{
int act_track_size = 0;
- UINT8 bitstream[500000/8];
- UINT8 trackdata[9216]; // max size
+ uint8_t bitstream[500000/8];
+ uint8_t trackdata[9216]; // max size
int cellsizes[] = { 2000, 4000, 1000, 2000 };
@@ -299,10 +299,10 @@ bool ti99_floppy_format::save(io_generic *io, floppy_image *image)
return true;
}
-void ti99_floppy_format::generate_track_fm(int track, int head, int cell_size, UINT8* trackdata, floppy_image *image)
+void ti99_floppy_format::generate_track_fm(int track, int head, int cell_size, uint8_t* trackdata, floppy_image *image)
{
int track_size_cells = 200000000/cell_size;
- std::vector<UINT32> buffer;
+ std::vector<uint32_t> buffer;
// The TDF has a long track lead-out that makes the track length sum up
// to 3253; this is too long for the number of cells in the real track.
@@ -399,10 +399,10 @@ void ti99_floppy_format::generate_track_fm(int track, int head, int cell_size, U
generate_track_from_levels(track, head, buffer, 0, image);
}
-void ti99_floppy_format::generate_track_mfm(int track, int head, int cell_size, UINT8* trackdata, floppy_image *image)
+void ti99_floppy_format::generate_track_mfm(int track, int head, int cell_size, uint8_t* trackdata, floppy_image *image)
{
int track_size_cells = 200000000/cell_size;
- std::vector<UINT32> buffer;
+ std::vector<uint32_t> buffer;
// See above
// We limit the track size to cell_number / 16, which means 6250 for MFM
@@ -510,15 +510,15 @@ enum
Decodes the bitstream into a TDF track image.
Returns the number of detected marks.
*/
-int ti99_floppy_format::decode_bitstream(const UINT8 *bitstream, UINT8 *trackdata, int* sector, int cell_count, int encoding, UINT8 gapbytes, int track_size)
+int ti99_floppy_format::decode_bitstream(const uint8_t *bitstream, uint8_t *trackdata, int* sector, int cell_count, int encoding, uint8_t gapbytes, int track_size)
{
int databytes = 0;
int a1count = 0;
int lastpos = 0;
int headerbytes = 0;
int curpos = 0;
- UINT8 curbyte = 0;
- UINT16 shift_reg = 0;
+ uint8_t curbyte = 0;
+ uint16_t shift_reg = 0;
int tpos = 0;
int pos = 0;
int state;
@@ -695,7 +695,7 @@ int ti99_floppy_format::decode_bitstream(const UINT8 *bitstream, UINT8 *trackdat
return marks;
}
-UINT8 ti99_floppy_format::get_data_from_encoding(UINT16 raw)
+uint8_t ti99_floppy_format::get_data_from_encoding(uint16_t raw)
{
return (raw & 0x4000 ? 0x80 : 0x00) |
(raw & 0x1000 ? 0x40 : 0x00) |
@@ -750,9 +750,9 @@ const char *ti99_sdf_format::extensions() const
return "dsk";
}
-int ti99_sdf_format::identify(io_generic *io, UINT32 form_factor)
+int ti99_sdf_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT64 file_size = io_generic_size(io);
+ uint64_t file_size = io_generic_size(io);
int vote = 0;
// Adding support for another sector image format which adds 768 bytes
@@ -810,7 +810,7 @@ int ti99_sdf_format::identify(io_generic *io, UINT32 form_factor)
void ti99_sdf_format::determine_sizes(io_generic *io, int& cell_size, int& sector_count, int& heads, int& tracks)
{
- UINT64 file_size = io_generic_size(io);
+ uint64_t file_size = io_generic_size(io);
ti99vib vib;
cell_size = 0;
@@ -910,7 +910,7 @@ int ti99_sdf_format::get_track_size(int cell_size, int sector_count)
acttrack is the actual track when double stepping is used and changes
every two physical tracks.
*/
-void ti99_sdf_format::load_track(io_generic *io, UINT8 *trackdata, int head, int track, int acttrack, int sectorcount, int trackcount, int cellsize)
+void ti99_sdf_format::load_track(io_generic *io, uint8_t *trackdata, int head, int track, int acttrack, int sectorcount, int trackcount, int cellsize)
{
bool fm = (cellsize==4000);
int tracksize = sectorcount * SECTOR_SIZE;
@@ -999,7 +999,7 @@ void ti99_sdf_format::load_track(io_generic *io, UINT8 *trackdata, int head, int
/*
For debugging. Outputs the byte array in a xxd-like way.
*/
-void ti99_floppy_format::showtrack(UINT8* trackdata, int length)
+void ti99_floppy_format::showtrack(uint8_t* trackdata, int length)
{
for (int i=0; i < length; i+=16)
{
@@ -1023,7 +1023,7 @@ void ti99_floppy_format::showtrack(UINT8* trackdata, int length)
Write the data to the disk. We have a list of sector positions, so we
just need to go through that list and save each sector in the track data.
*/
-void ti99_sdf_format::write_track(io_generic *io, UINT8 *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes)
+void ti99_sdf_format::write_track(io_generic *io, uint8_t *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes)
{
int logicaltrack = head * maxtrack;
logicaltrack += ((head&1)==0)? track : (maxtrack - 1 - track);
@@ -1091,11 +1091,11 @@ const char *ti99_tdf_format::extensions() const
/*
Determine whether the image file can be interpreted as a track dump
*/
-int ti99_tdf_format::identify(io_generic *io, UINT32 form_factor)
+int ti99_tdf_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT64 file_size = io_generic_size(io);
+ uint64_t file_size = io_generic_size(io);
int vote = 0;
- UINT8 trackdata[2000];
+ uint8_t trackdata[2000];
// Do we have a plausible image size? From the size alone we only give a 50 percent vote.
if ((file_size == 260240) || (file_size == 549760) || (file_size == 1099520))
@@ -1124,7 +1124,7 @@ int ti99_tdf_format::identify(io_generic *io, UINT32 form_factor)
*/
void ti99_tdf_format::determine_sizes(io_generic *io, int& cell_size, int& sector_count, int& heads, int& tracks)
{
- UINT64 file_size = io_generic_size(io);
+ uint64_t file_size = io_generic_size(io);
heads = 2; // TDF only supports two-sided recordings
if (file_size % get_track_size(2000, 0)==0) cell_size = 2000;
@@ -1138,7 +1138,7 @@ void ti99_tdf_format::determine_sizes(io_generic *io, int& cell_size, int& secto
For TDF this just amounts to loading the track from the image file.
acttrack is not used here, since the file contains the track data.
*/
-void ti99_tdf_format::load_track(io_generic *io, UINT8 *trackdata, int head, int track, int acttrack, int sectorcount, int trackcount, int cellsize)
+void ti99_tdf_format::load_track(io_generic *io, uint8_t *trackdata, int head, int track, int acttrack, int sectorcount, int trackcount, int cellsize)
{
int offset = ((trackcount * head) + track) * get_track_size(cellsize, 0);
io_generic_read(io, trackdata, offset, get_track_size(cellsize, 0));
@@ -1147,7 +1147,7 @@ void ti99_tdf_format::load_track(io_generic *io, UINT8 *trackdata, int head, int
/*
Also here, we just need to write the complete track on the image file.
*/
-void ti99_tdf_format::write_track(io_generic *io, UINT8 *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes)
+void ti99_tdf_format::write_track(io_generic *io, uint8_t *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes)
{
int offset = ((maxtrack * head) + track) * numbytes;
io_generic_write(io, trackdata, offset, numbytes);
diff --git a/src/lib/formats/ti99_dsk.h b/src/lib/formats/ti99_dsk.h
index a34e73d8bd8..d596f4bb17c 100644
--- a/src/lib/formats/ti99_dsk.h
+++ b/src/lib/formats/ti99_dsk.h
@@ -20,29 +20,29 @@ class ti99_floppy_format : public floppy_image_format_t
{
public:
bool supports_save() const override { return true; }
- bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
bool save(io_generic *io, floppy_image *image) override;
protected:
- int decode_bitstream(const UINT8 *bitstream, UINT8 *trackdata, int *sector, int cell_count, int encoding, UINT8 gapbytes, int track_size);
- UINT8 get_data_from_encoding(UINT16 raw);
+ int decode_bitstream(const uint8_t *bitstream, uint8_t *trackdata, int *sector, int cell_count, int encoding, uint8_t gapbytes, int track_size);
+ uint8_t get_data_from_encoding(uint16_t raw);
virtual int min_heads() =0;
virtual void determine_sizes(io_generic *io, int& cell_size, int& sector_count, int& heads, int& tracks) =0;
virtual int get_track_size(int cell_size, int sector_count) =0;
- virtual void load_track(io_generic *io, UINT8 *trackdata, int head, int track, int acttrack, int sectorcount, int trackcount, int cellsize) =0;
- virtual void write_track(io_generic *io, UINT8 *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes) =0;
+ virtual void load_track(io_generic *io, uint8_t *trackdata, int head, int track, int acttrack, int sectorcount, int trackcount, int cellsize) =0;
+ virtual void write_track(io_generic *io, uint8_t *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes) =0;
int get_encoding(int cell_size);
- void generate_track_fm(int track, int head, int cell_size, UINT8* trackdata, floppy_image *image);
- void generate_track_mfm(int track, int head, int cell_size, UINT8* trackdata, floppy_image *image);
+ void generate_track_fm(int track, int head, int cell_size, uint8_t* trackdata, floppy_image *image);
+ void generate_track_mfm(int track, int head, int cell_size, uint8_t* trackdata, floppy_image *image);
- bool check_for_address_marks(UINT8* trackdata, int encoding);
+ bool check_for_address_marks(uint8_t* trackdata, int encoding);
// Debugging
- void showtrack(UINT8* trackdata, int length);
+ void showtrack(uint8_t* trackdata, int length);
};
/*
@@ -51,7 +51,7 @@ protected:
class ti99_sdf_format : public ti99_floppy_format
{
public:
- int identify(io_generic *io, UINT32 form_factor) override;
+ int identify(io_generic *io, uint32_t form_factor) override;
const char *name() const override;
const char *description() const override;
const char *extensions() const override;
@@ -59,8 +59,8 @@ public:
private:
void determine_sizes(io_generic *io, int& cell_size, int& sector_count, int& heads, int& tracks) override;
int get_track_size(int cell_size, int sector_count) override;
- void write_track(io_generic *io, UINT8 *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes) override;
- void load_track(io_generic *io, UINT8 *trackdata, int head, int track, int acttrack, int sectorcount, int trackcount, int cellsize) override;
+ void write_track(io_generic *io, uint8_t *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes) override;
+ void load_track(io_generic *io, uint8_t *trackdata, int head, int track, int acttrack, int sectorcount, int trackcount, int cellsize) override;
// This format supports single-sided images
int min_heads() override { return 1; }
@@ -68,16 +68,16 @@ private:
struct ti99vib
{
char name[10]; // volume name (10 characters, pad with spaces)
- UINT8 totsecsMSB; // disk length in sectors (big-endian) (usually 360, 720 or 1440)
- UINT8 totsecsLSB;
- UINT8 secspertrack; // sectors per track (usually 9 (FM) or 18 (MFM))
- UINT8 id[3]; // String "DSK"
- UINT8 protection; // 'P' if disk is protected, ' ' otherwise.
- UINT8 tracksperside; // tracks per side (usually 40)
- UINT8 sides; // sides (1 or 2)
- UINT8 density; // 0,1 (FM) or 2,3,4 (MFM)
- UINT8 res[36]; // Empty for traditional disks, or up to 3 directory pointers
- UINT8 abm[200]; // allocation bitmap: a 1 for each sector in use (sector 0 is LSBit of byte 0,
+ uint8_t totsecsMSB; // disk length in sectors (big-endian) (usually 360, 720 or 1440)
+ uint8_t totsecsLSB;
+ uint8_t secspertrack; // sectors per track (usually 9 (FM) or 18 (MFM))
+ uint8_t id[3]; // String "DSK"
+ uint8_t protection; // 'P' if disk is protected, ' ' otherwise.
+ uint8_t tracksperside; // tracks per side (usually 40)
+ uint8_t sides; // sides (1 or 2)
+ uint8_t density; // 0,1 (FM) or 2,3,4 (MFM)
+ uint8_t res[36]; // Empty for traditional disks, or up to 3 directory pointers
+ uint8_t abm[200]; // allocation bitmap: a 1 for each sector in use (sector 0 is LSBit of byte 0,
// sector 7 is MSBit of byte 0, sector 8 is LSBit of byte 1, etc.)
};
};
@@ -90,15 +90,15 @@ extern const floppy_format_type FLOPPY_TI99_SDF_FORMAT;
class ti99_tdf_format : public ti99_floppy_format
{
public:
- int identify(io_generic *io, UINT32 form_factor) override;
+ int identify(io_generic *io, uint32_t form_factor) override;
const char *name() const override;
const char *description() const override;
const char *extensions() const override;
private:
void determine_sizes(io_generic *io, int& cell_size, int& sector_count, int& heads, int& tracks) override;
- void load_track(io_generic *io, UINT8 *trackdata, int head, int track, int acttrack, int sectorcount, int trackcount, int cellsize) override;
- void write_track(io_generic *io, UINT8 *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes) override;
+ void load_track(io_generic *io, uint8_t *trackdata, int head, int track, int acttrack, int sectorcount, int trackcount, int cellsize) override;
+ void write_track(io_generic *io, uint8_t *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes) override;
int get_track_size(int cell_size, int sector_count) override;
// This format only supports double-sided images
diff --git a/src/lib/formats/trs_cas.cpp b/src/lib/formats/trs_cas.cpp
index 9f00989bc02..a6701ed1263 100644
--- a/src/lib/formats/trs_cas.cpp
+++ b/src/lib/formats/trs_cas.cpp
@@ -21,7 +21,7 @@ static int cas_size;
/*******************************************************************
Generate one high-low cycle of sample data
********************************************************************/
-static inline int trs80l2_cas_cycle(INT16 *buffer, int sample_pos, int silence, int high, int low)
+static inline int trs80l2_cas_cycle(int16_t *buffer, int sample_pos, int silence, int high, int low)
{
int i = 0;
@@ -48,7 +48,7 @@ static inline int trs80l2_cas_cycle(INT16 *buffer, int sample_pos, int silence,
}
-static int trs80l2_handle_cas(INT16 *buffer, const UINT8 *casdata)
+static int trs80l2_handle_cas(int16_t *buffer, const uint8_t *casdata)
{
int data_pos, sample_count;
@@ -57,7 +57,7 @@ static int trs80l2_handle_cas(INT16 *buffer, const UINT8 *casdata)
while( data_pos < cas_size )
{
- UINT8 data = casdata[data_pos];
+ uint8_t data = casdata[data_pos];
int i;
for ( i = 0; i < 8; i++ )
@@ -83,7 +83,7 @@ static int trs80l2_handle_cas(INT16 *buffer, const UINT8 *casdata)
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int trs80l2_cas_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int trs80l2_cas_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return trs80l2_handle_cas( buffer, bytes );
}
@@ -92,7 +92,7 @@ static int trs80l2_cas_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
/*******************************************************************
Calculate the number of samples needed for this tape image
********************************************************************/
-static int trs80l2_cas_to_wav_size(const UINT8 *casdata, int caslen)
+static int trs80l2_cas_to_wav_size(const uint8_t *casdata, int caslen)
{
cas_size = caslen;
diff --git a/src/lib/formats/tvc_cas.cpp b/src/lib/formats/tvc_cas.cpp
index c7c60829945..9177491278c 100644
--- a/src/lib/formats/tvc_cas.cpp
+++ b/src/lib/formats/tvc_cas.cpp
@@ -28,7 +28,7 @@ static void tvc64_emit_level(cassette_image *cass, double &time, int freq, int l
time += period;
}
-static cassette_image::error tvc64_output_byte(cassette_image *cass, double &time, UINT8 byte)
+static cassette_image::error tvc64_output_byte(cassette_image *cass, double &time, uint8_t byte)
{
for (int i=0; i<8; i++)
{
@@ -58,15 +58,15 @@ static int tvc64_output_predata(cassette_image *cass, double &time, int number)
return (int)cassette_image::error::SUCCESS;
}
-static UINT16 tvc64_calc_crc(const UINT8 *bytes, int size)
+static uint16_t tvc64_calc_crc(const uint8_t *bytes, int size)
{
- UINT16 crc = 0;
+ uint16_t crc = 0;
for (int i=0; i<size; i++)
{
for (int b=0; b<8; b++)
{
- UINT8 al = (bytes[i] & (1<<b)) ? 0x80 : 0x00;
+ uint8_t al = (bytes[i] & (1<<b)) ? 0x80 : 0x00;
al ^= ((crc>>8) & 0xff);
@@ -84,13 +84,13 @@ static UINT16 tvc64_calc_crc(const UINT8 *bytes, int size)
static cassette_image::error tvc64_cassette_load(cassette_image *cassette)
{
- UINT8 tmp_buff[512];
+ uint8_t tmp_buff[512];
int buff_idx = 0;
double time = 0.0;
- UINT8 header[TVC64_HEADER_BYTES];
+ uint8_t header[TVC64_HEADER_BYTES];
cassette_image_read(cassette, header, 0, TVC64_HEADER_BYTES);
- UINT16 cas_size = (header[0x83]<<8) | header[0x82];
+ uint16_t cas_size = (header[0x83]<<8) | header[0x82];
// tape header
tmp_buff[buff_idx++] = 0x00;
@@ -117,7 +117,7 @@ static cassette_image::error tvc64_cassette_load(cassette_image *cassette)
tmp_buff[buff_idx++] = 0x00; // no last sector
// updates the header CRC
- UINT16 crc = tvc64_calc_crc(tmp_buff, buff_idx);
+ uint16_t crc = tvc64_calc_crc(tmp_buff, buff_idx);
tmp_buff[buff_idx++] = crc & 0xff;
tmp_buff[buff_idx++] = (crc>>8) & 0xff;
@@ -155,9 +155,9 @@ static cassette_image::error tvc64_cassette_load(cassette_image *cassette)
tmp_buff[buff_idx++] = 0x00; // data sector
tmp_buff[buff_idx++] = 0x11; // not puffered
tmp_buff[buff_idx++] = 0x00; // not write protected
- tmp_buff[buff_idx++] = (UINT8)((cas_size / 256) + ((cas_size % 256) > 0 ? 1 : 0)); // number of sectors
+ tmp_buff[buff_idx++] = (uint8_t)((cas_size / 256) + ((cas_size % 256) > 0 ? 1 : 0)); // number of sectors
- UINT8 sect_num = 1;
+ uint8_t sect_num = 1;
int sector_num = cas_size / 256;
for (int i=0; i<=sector_num; i++)
{
@@ -202,7 +202,7 @@ static cassette_image::error tvc64_cassette_load(cassette_image *cassette)
static cassette_image::error tvc64_cassette_identify(cassette_image *cassette, struct CassetteOptions *opts)
{
- UINT8 byte;
+ uint8_t byte;
cassette_image_read(cassette, &byte, 0, 1);
if (byte == 0x11)
diff --git a/src/lib/formats/tzx_cas.cpp b/src/lib/formats/tzx_cas.cpp
index bf8142f9b95..748f0227c65 100644
--- a/src/lib/formats/tzx_cas.cpp
+++ b/src/lib/formats/tzx_cas.cpp
@@ -56,7 +56,7 @@ We are currently using the numbers from the TZX specification...
#define INITIAL_MAX_BLOCK_COUNT 256
#define BLOCK_COUNT_INCREMENTS 256
-static const UINT8 TZX_HEADER[8] = { 'Z','X','T','a','p','e','!',0x1a };
+static const uint8_t TZX_HEADER[8] = { 'Z','X','T','a','p','e','!',0x1a };
/*
Global variables
@@ -64,9 +64,9 @@ static const UINT8 TZX_HEADER[8] = { 'Z','X','T','a','p','e','!',0x1a };
Initialized by tzx_cas_get_wave_size, used (and cleaned up) by tzx_cas_fill_wave
*/
-static INT16 wave_data = 0;
+static int16_t wave_data = 0;
static int block_count = 0;
-static UINT8** blocks = nullptr;
+static uint8_t** blocks = nullptr;
static float t_scale = 1; /* for scaling T-states to the 4MHz CPC */
static void toggle_wave_data(void)
@@ -81,32 +81,32 @@ static void toggle_wave_data(void)
}
}
-static void tzx_cas_get_blocks( const UINT8 *casdata, int caslen )
+static void tzx_cas_get_blocks( const uint8_t *casdata, int caslen )
{
int pos = sizeof(TZX_HEADER) + 2;
int max_block_count = INITIAL_MAX_BLOCK_COUNT;
int loopcount = 0, loopoffset = 0;
- blocks = (UINT8**)malloc(max_block_count * sizeof(UINT8*));
+ blocks = (uint8_t**)malloc(max_block_count * sizeof(uint8_t*));
memset(blocks,0,max_block_count);
block_count = 0;
while (pos < caslen)
{
- UINT32 datasize;
- UINT8 blocktype = casdata[pos];
+ uint32_t datasize;
+ uint8_t blocktype = casdata[pos];
if (block_count == max_block_count)
{
void *old_blocks = blocks;
int old_max_block_count = max_block_count;
max_block_count = max_block_count + BLOCK_COUNT_INCREMENTS;
- blocks = (UINT8**)malloc(max_block_count * sizeof(UINT8*)); // SHOULD NOT BE USING auto_alloc_array()
+ blocks = (uint8_t**)malloc(max_block_count * sizeof(uint8_t*)); // SHOULD NOT BE USING auto_alloc_array()
memset(blocks, 0, max_block_count);
- memcpy(blocks, old_blocks, old_max_block_count * sizeof(UINT8*));
+ memcpy(blocks, old_blocks, old_max_block_count * sizeof(uint8_t*));
free(old_blocks);
}
- blocks[block_count] = (UINT8*)&casdata[pos];
+ blocks[block_count] = (uint8_t*)&casdata[pos];
pos += 1;
@@ -217,7 +217,7 @@ static inline int tcycles_to_samplecount( int tcycles )
return (int) ((0.5 + (((double)TZX_WAV_FREQUENCY / 3500000) * (double)tcycles)) * (double) t_scale);
}
-static void tzx_output_wave( INT16 **buffer, int length )
+static void tzx_output_wave( int16_t **buffer, int length )
{
if (buffer == nullptr)
{
@@ -231,7 +231,7 @@ static void tzx_output_wave( INT16 **buffer, int length )
}
}
-static int tzx_cas_handle_block( INT16 **buffer, const UINT8 *bytes, int pause, int data_size, int pilot, int pilot_length, int sync1, int sync2, int bit0, int bit1, int bits_in_last_byte )
+static int tzx_cas_handle_block( int16_t **buffer, const uint8_t *bytes, int pause, int data_size, int pilot, int pilot_length, int sync1, int sync2, int bit0, int bit1, int bits_in_last_byte )
{
int pilot_samples = tcycles_to_samplecount(pilot);
int sync1_samples = tcycles_to_samplecount(sync1);
@@ -268,7 +268,7 @@ static int tzx_cas_handle_block( INT16 **buffer, const UINT8 *bytes, int pause,
/* data */
for (data_index = 0; data_index < data_size; data_index++)
{
- UINT8 byte = bytes[data_index];
+ uint8_t byte = bytes[data_index];
int bits_to_go = (data_index == (data_size - 1)) ? bits_in_last_byte : 8;
for ( ; bits_to_go > 0; byte <<= 1, bits_to_go--)
@@ -297,7 +297,7 @@ static int tzx_cas_handle_block( INT16 **buffer, const UINT8 *bytes, int pause,
return size;
}
-static int tzx_handle_direct(INT16 **buffer, const UINT8 *bytes, int pause, int data_size, int tstates, int bits_in_last_byte)
+static int tzx_handle_direct(int16_t **buffer, const uint8_t *bytes, int pause, int data_size, int tstates, int bits_in_last_byte)
{
int size = 0;
int samples = tcycles_to_samplecount(tstates);
@@ -305,7 +305,7 @@ static int tzx_handle_direct(INT16 **buffer, const UINT8 *bytes, int pause, int
/* data */
for (int data_index = 0; data_index < data_size; data_index++)
{
- UINT8 byte = bytes[data_index];
+ uint8_t byte = bytes[data_index];
int bits_to_go = (data_index == (data_size - 1)) ? bits_in_last_byte : 8;
for ( ; bits_to_go > 0; byte <<= 1, bits_to_go--)
@@ -335,12 +335,12 @@ static int tzx_handle_direct(INT16 **buffer, const UINT8 *bytes, int pause, int
}
-static inline int tzx_handle_symbol(INT16 **buffer, const UINT8 *symtable, UINT8 symbol, int maxp)
+static inline int tzx_handle_symbol(int16_t **buffer, const uint8_t *symtable, uint8_t symbol, int maxp)
{
int size = 0;
- const UINT8 *cursymb = symtable + (2 * maxp + 1)*symbol;
+ const uint8_t *cursymb = symtable + (2 * maxp + 1)*symbol;
- UINT8 starttype = cursymb[0];
+ uint8_t starttype = cursymb[0];
// printf("start polarity %01x (max number of symbols is %d)\n", starttype, maxp);
@@ -370,7 +370,7 @@ static inline int tzx_handle_symbol(INT16 **buffer, const UINT8 *symtable, UINT8
for (int i = 0; i < maxp; i++)
{
- UINT16 pulse_length = cursymb[1 + (i*2)] | (cursymb[2 + (i*2)] << 8);
+ uint16_t pulse_length = cursymb[1 + (i*2)] | (cursymb[2 + (i*2)] << 8);
// printf("pulse_length %04x\n", pulse_length);
// shorter lists can be terminated with a pulse_length of 0
@@ -395,12 +395,12 @@ static inline int tzx_handle_symbol(INT16 **buffer, const UINT8 *symtable, UINT8
return size;
}
-static inline int stream_get_bit(const UINT8 *bytes, UINT8 &stream_bit, UINT32 &stream_byte)
+static inline int stream_get_bit(const uint8_t *bytes, uint8_t &stream_bit, uint32_t &stream_byte)
{
// get bit here
- UINT8 retbit = 0;
+ uint8_t retbit = 0;
- UINT8 byte = bytes[stream_byte];
+ uint8_t byte = bytes[stream_byte];
byte = byte << stream_bit;
if (byte & 0x80) retbit = 1;
@@ -417,7 +417,7 @@ static inline int stream_get_bit(const UINT8 *bytes, UINT8 &stream_bit, UINT32 &
return retbit;
}
-static int tzx_handle_generalized(INT16 **buffer, const UINT8 *bytes, int pause, int data_size, UINT32 totp, int npp, int asp, UINT32 totd, int npd, int asd )
+static int tzx_handle_generalized(int16_t **buffer, const uint8_t *bytes, int pause, int data_size, uint32_t totp, int npp, int asp, uint32_t totd, int npd, int asd )
{
int size = 0;
@@ -425,14 +425,14 @@ static int tzx_handle_generalized(INT16 **buffer, const UINT8 *bytes, int pause,
{
// printf("pilot block table %04x\n", totp);
- const UINT8 *symtable = bytes;
- const UINT8 *table2 = symtable + (2 * npp + 1)*asp;
+ const uint8_t *symtable = bytes;
+ const uint8_t *table2 = symtable + (2 * npp + 1)*asp;
// the Pilot and sync data stream has an RLE encoding
for (int i = 0; i < totp; i+=3)
{
- UINT8 symbol = table2[i + 0];
- UINT16 repetitions = table2[i + 1] + (table2[i + 2] << 8);
+ uint8_t symbol = table2[i + 0];
+ uint16_t repetitions = table2[i + 1] + (table2[i + 2] << 8);
//printf("symbol %02x repititions %04x\n", symbol, repetitions); // does 1 mean repeat once, or that it only occurs once?
for (int j = 0; j < repetitions; j++)
@@ -456,18 +456,18 @@ static int tzx_handle_generalized(INT16 **buffer, const UINT8 *bytes, int pause,
{
printf("data block table %04x (has %0d symbols, max symbol length is %d)\n", totd, asd, npd);
- const UINT8 *symtable = bytes;
- const UINT8 *table2 = bytes + (2 * npd + 1)*asd;
+ const uint8_t *symtable = bytes;
+ const uint8_t *table2 = bytes + (2 * npd + 1)*asd;
int NB = ceil(compute_log2(asd)); // number of bits needed to represent each symbol
printf("NB is %d\n", NB);
- UINT8 stream_bit = 0;
- UINT32 stream_byte = 0;
+ uint8_t stream_bit = 0;
+ uint32_t stream_byte = 0;
for (int i = 0; i < totd; i++)
{
- UINT8 symbol = 0;
+ uint8_t symbol = 0;
for (int j = 0; j < NB; j++)
{
@@ -503,7 +503,7 @@ static int tzx_handle_generalized(INT16 **buffer, const UINT8 *bytes, int pause,
-static void ascii_block_common_log( const char *block_type_string, UINT8 block_type )
+static void ascii_block_common_log( const char *block_type_string, uint8_t block_type )
{
LOG_FORMATS("%s (type %02x) encountered.\n", block_type_string, block_type);
LOG_FORMATS("This block contains info on the .tzx file you are loading.\n");
@@ -533,7 +533,7 @@ static const char *const hw_info[] =
/* Will go through blocks and calculate number of samples needed.
If buffer is not nullptr the sample data will also be written. */
-static int tzx_cas_do_work( INT16 **buffer )
+static int tzx_cas_do_work( int16_t **buffer )
{
int current_block = 0;
int size = 0;
@@ -545,13 +545,13 @@ static int tzx_cas_do_work( INT16 **buffer )
while (current_block < block_count)
{
int pause_time;
- UINT32 data_size;
+ uint32_t data_size;
int text_size, total_size, i;
int pilot, pilot_length, sync1, sync2;
int bit0, bit1, bits_in_last_byte;
- UINT8 *cur_block = blocks[current_block];
- UINT8 block_type = cur_block[0];
- UINT16 tstates = 0;
+ uint8_t *cur_block = blocks[current_block];
+ uint8_t block_type = cur_block[0];
+ uint16_t tstates = 0;
/* Uncomment this to include into error.log a list of the types each block */
LOG_FORMATS("tzx_cas_fill_wave: block %d, block_type %02x\n", current_block, block_type);
@@ -749,12 +749,12 @@ static int tzx_cas_do_work( INT16 **buffer )
data_size = cur_block[1] + (cur_block[2] << 8) + (cur_block[3] << 16) + (cur_block[4] << 24);
pause_time= cur_block[5] + (cur_block[6] << 8);
- UINT32 totp = cur_block[7] + (cur_block[8] << 8) + (cur_block[9] << 16) + (cur_block[10] << 24);
+ uint32_t totp = cur_block[7] + (cur_block[8] << 8) + (cur_block[9] << 16) + (cur_block[10] << 24);
int npp = cur_block[11];
int asp = cur_block[12];
if (asp == 0) asp = 256;
- UINT32 totd = cur_block[13] + (cur_block[14] << 8) + (cur_block[15] << 16) + (cur_block[16] << 24);
+ uint32_t totd = cur_block[13] + (cur_block[14] << 8) + (cur_block[15] << 16) + (cur_block[16] << 24);
int npd = cur_block[17];
int asd = cur_block[18];
if (asd == 0) asd = 256;
@@ -770,7 +770,7 @@ static int tzx_cas_do_work( INT16 **buffer )
return size;
}
-static int tzx_cas_to_wav_size( const UINT8 *casdata, int caslen )
+static int tzx_cas_to_wav_size( const uint8_t *casdata, int caslen )
{
int size = 0;
@@ -813,28 +813,28 @@ cleanup:
return -1;
}
-static int tzx_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes )
+static int tzx_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes )
{
- INT16 *p = buffer;
+ int16_t *p = buffer;
int size = 0;
t_scale = 1.0;
size = tzx_cas_do_work(&p);
return size;
}
-static int cdt_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes )
+static int cdt_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes )
{
- INT16 *p = buffer;
+ int16_t *p = buffer;
int size = 0;
t_scale = (40 / 35); /* scale to 4MHz */
size = tzx_cas_do_work(&p);
return size;
}
-static int tap_cas_to_wav_size( const UINT8 *casdata, int caslen )
+static int tap_cas_to_wav_size( const uint8_t *casdata, int caslen )
{
int size = 0;
- const UINT8 *p = casdata;
+ const uint8_t *p = casdata;
while (p < casdata + caslen)
{
@@ -850,9 +850,9 @@ static int tap_cas_to_wav_size( const UINT8 *casdata, int caslen )
return size;
}
-static int tap_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes )
+static int tap_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes )
{
- INT16 *p = buffer;
+ int16_t *p = buffer;
int size = 0;
while (size < length)
diff --git a/src/lib/formats/uef_cas.cpp b/src/lib/formats/uef_cas.cpp
index 39a03349bc2..d3b95022f9e 100644
--- a/src/lib/formats/uef_cas.cpp
+++ b/src/lib/formats/uef_cas.cpp
@@ -31,8 +31,8 @@ Not nice, but it works...
#define WAVE_HIGH 32767
#define WAVE_NULL 0
-static const UINT8 UEF_HEADER[10] = { 0x55, 0x45, 0x46, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x21, 0x00 };
-static const UINT8 GZ_HEADER[2] = { 0x1f, 0x8b };
+static const uint8_t UEF_HEADER[10] = { 0x55, 0x45, 0x46, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x21, 0x00 };
+static const uint8_t GZ_HEADER[2] = { 0x1f, 0x8b };
/*
bytes are stored as
@@ -49,8 +49,8 @@ static const UINT8 GZ_HEADER[2] = { 0x1f, 0x8b };
#define COMMENT 0x10 /* bit 4 set: file comment present */
#define RESERVED 0xE0 /* bits 5..7: reserved */
-static const UINT8* skip_gz_header( const UINT8 *p ) {
- UINT8 method, flags;
+static const uint8_t* skip_gz_header( const uint8_t *p ) {
+ uint8_t method, flags;
/* skip initial 1f 8b header */
p += 2;
/* get method and flags */
@@ -82,9 +82,9 @@ static const UINT8* skip_gz_header( const UINT8 *p ) {
return p;
}
-static UINT8 *gz_ptr = nullptr;
+static uint8_t *gz_ptr = nullptr;
-static float get_uef_float( const UINT8 *Float)
+static float get_uef_float( const uint8_t *Float)
{
int Mantissa;
float Result;
@@ -112,19 +112,19 @@ static float get_uef_float( const UINT8 *Float)
return Result;
}
-static int uef_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
+static int uef_cas_to_wav_size( const uint8_t *casdata, int caslen ) {
int pos, size;
if ( casdata[0] == 0x1f && casdata[1] == 0x8b ) {
int err;
z_stream d_stream;
int inflate_size = ( casdata[ caslen - 1 ] << 24 ) | ( casdata[ caslen - 2 ] << 16 ) | ( casdata[ caslen - 3 ] << 8 ) | casdata[ caslen - 4 ];
- const UINT8 *in_ptr = skip_gz_header( casdata );
+ const uint8_t *in_ptr = skip_gz_header( casdata );
if ( in_ptr == nullptr ) {
goto cleanup;
}
- gz_ptr = (UINT8 *)malloc( inflate_size );
+ gz_ptr = (uint8_t *)malloc( inflate_size );
d_stream.zalloc = nullptr;
d_stream.zfree = nullptr;
@@ -222,7 +222,7 @@ cleanup:
return -1;
}
-static INT16* uef_cas_fill_bit( INT16 *buffer, int bit ) {
+static int16_t* uef_cas_fill_bit( int16_t *buffer, int bit ) {
if ( bit ) {
*buffer = WAVE_LOW; buffer++;
*buffer = WAVE_HIGH; buffer++;
@@ -237,9 +237,9 @@ static INT16* uef_cas_fill_bit( INT16 *buffer, int bit ) {
return buffer;
}
-static int uef_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
+static int uef_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) {
int pos;
- INT16 *p = buffer;
+ int16_t *p = buffer;
if ( bytes[0] == 0x1f && bytes[1] == 0x8b ) {
if ( gz_ptr == nullptr ) {
@@ -255,12 +255,12 @@ static int uef_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
int chunk_length = ( bytes[pos+5] << 24 ) | ( bytes[pos+4] << 16 ) | ( bytes[pos+3] << 8 ) | bytes[pos+2];
int baud_length, i, j;
- UINT8 *c;
+ uint8_t *c;
pos += 6;
switch( chunk_type ) {
case 0x0100: /* implicit start/stop bit data block */
for( j = 0; j < chunk_length; j++ ) {
- UINT8 byte = bytes[pos+j];
+ uint8_t byte = bytes[pos+j];
p = uef_cas_fill_bit( p, 0 );
for( i = 0; i < 8; i++ ) {
p = uef_cas_fill_bit( p, byte & 1 );
@@ -278,7 +278,7 @@ static int uef_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
j = ( chunk_length * 10 ) - bytes[pos];
c = bytes + pos;
while( j ) {
- UINT8 byte = *c;
+ uint8_t byte = *c;
for( i = 0; i < 8 && i < j; i++ ) {
p = uef_cas_fill_bit( p, byte & 1 );
byte = byte >> 1;
@@ -324,7 +324,7 @@ static const struct CassetteLegacyWaveFiller uef_legacy_fill_wave = {
};
static cassette_image::error uef_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) {
- UINT8 header[10];
+ uint8_t header[10];
cassette_image_read(cassette, header, 0, sizeof(header));
if (memcmp(&header[0], GZ_HEADER, sizeof(GZ_HEADER)) && memcmp(&header[0], UEF_HEADER, sizeof(UEF_HEADER))) {
diff --git a/src/lib/formats/upd765_dsk.cpp b/src/lib/formats/upd765_dsk.cpp
index 97d0daa7d6a..ae11f7080dc 100644
--- a/src/lib/formats/upd765_dsk.cpp
+++ b/src/lib/formats/upd765_dsk.cpp
@@ -16,21 +16,21 @@ upd765_format::upd765_format(const format *_formats)
formats = _formats;
}
-int upd765_format::find_size(io_generic *io, UINT32 form_factor) const
+int upd765_format::find_size(io_generic *io, uint32_t form_factor) const
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
for(int i=0; formats[i].form_factor; i++) {
const format &f = formats[i];
if(form_factor != floppy_image::FF_UNKNOWN && form_factor != f.form_factor)
continue;
- if(size == (UINT64) compute_track_size(f) * f.track_count * f.head_count)
+ if(size == (uint64_t) compute_track_size(f) * f.track_count * f.head_count)
return i;
}
return -1;
}
-int upd765_format::identify(io_generic *io, UINT32 form_factor)
+int upd765_format::identify(io_generic *io, uint32_t form_factor)
{
int type = find_size(io, form_factor);
@@ -52,7 +52,7 @@ int upd765_format::compute_track_size(const format &f) const
return track_size;
}
-void upd765_format::build_sector_description(const format &f, UINT8 *sectdata, desc_s *sectors, int track, int head) const
+void upd765_format::build_sector_description(const format &f, uint8_t *sectdata, desc_s *sectors, int track, int head) const
{
if(f.sector_base_id == -1) {
for(int i=0; i<f.sector_count; i++) {
@@ -174,7 +174,7 @@ floppy_image_format_t::desc_e* upd765_format::get_desc_mfm(const format &f, int
return desc;
}
-bool upd765_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool upd765_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
int type = find_size(io, form_factor);
if(type == -1)
@@ -214,7 +214,7 @@ bool upd765_format::load(io_generic *io, UINT32 form_factor, floppy_image *image
int track_size = compute_track_size(f);
- UINT8 sectdata[40*512];
+ uint8_t sectdata[40*512];
desc_s sectors[40];
for(int track=0; track < f.track_count; track++)
@@ -337,7 +337,7 @@ bool upd765_format::save(io_generic *io, floppy_image *image)
const format &f = formats[chosen_candidate];
int track_size = compute_track_size(f);
- UINT8 sectdata[40*512];
+ uint8_t sectdata[40*512];
desc_s sectors[40];
for(int track=0; track < f.track_count; track++)
@@ -352,8 +352,8 @@ bool upd765_format::save(io_generic *io, floppy_image *image)
void upd765_format::check_compatibility(floppy_image *image, std::vector<int> &candidates)
{
- UINT8 bitstream[500000/8];
- UINT8 sectdata[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sectdata[50000];
desc_xs sectors[256];
int track_size;
@@ -406,8 +406,8 @@ void upd765_format::check_compatibility(floppy_image *image, std::vector<int> &c
void upd765_format::extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head)
{
- UINT8 bitstream[500000/8];
- UINT8 sectdata[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sectdata[50000];
desc_xs sectors[256];
int track_size;
@@ -431,7 +431,7 @@ void upd765_format::extract_sectors(floppy_image *image, const format &f, desc_s
memset((void *)ds.data, 0, ds.size);
else if(xs.size < ds.size) {
memcpy((void *)ds.data, xs.data, xs.size);
- memset((UINT8 *)ds.data + xs.size, 0, xs.size - ds.size);
+ memset((uint8_t *)ds.data + xs.size, 0, xs.size - ds.size);
} else
memcpy((void *)ds.data, xs.data, ds.size);
}
diff --git a/src/lib/formats/upd765_dsk.h b/src/lib/formats/upd765_dsk.h
index a108931d89b..5bd675de9e8 100644
--- a/src/lib/formats/upd765_dsk.h
+++ b/src/lib/formats/upd765_dsk.h
@@ -17,9 +17,9 @@ class upd765_format : public floppy_image_format_t
{
public:
struct format {
- UINT32 form_factor; // See floppy_image for possible values
- UINT32 variant; // See floppy_image for possible values
- UINT32 encoding; // See floppy_image for possible values
+ uint32_t form_factor; // See floppy_image for possible values
+ uint32_t variant; // See floppy_image for possible values
+ uint32_t encoding; // See floppy_image for possible values
int cell_size; // See floppy_image_format_t for details
int sector_count;
@@ -38,17 +38,17 @@ public:
// End the array with {}
upd765_format(const format *formats);
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual bool supports_save() const override;
protected:
floppy_image_format_t::desc_e* get_desc_fm(const format &f, int &current_size, int &end_gap_index);
floppy_image_format_t::desc_e* get_desc_mfm(const format &f, int &current_size, int &end_gap_index);
- int find_size(io_generic *io, UINT32 form_factor) const;
+ int find_size(io_generic *io, uint32_t form_factor) const;
int compute_track_size(const format &f) const;
- virtual void build_sector_description(const format &d, UINT8 *sectdata, desc_s *sectors, int track, int head) const;
+ virtual void build_sector_description(const format &d, uint8_t *sectdata, desc_s *sectors, int track, int head) const;
void check_compatibility(floppy_image *image, std::vector<int> &candidates);
void extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head);
diff --git a/src/lib/formats/vdk_dsk.cpp b/src/lib/formats/vdk_dsk.cpp
index 896815c26ad..308f544e2d3 100644
--- a/src/lib/formats/vdk_dsk.cpp
+++ b/src/lib/formats/vdk_dsk.cpp
@@ -32,9 +32,9 @@ const char *vdk_format::extensions() const
return "vdk";
}
-int vdk_format::identify(io_generic *io, UINT32 form_factor)
+int vdk_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 id[2];
+ uint8_t id[2];
io_generic_read(io, id, 0, 2);
if (id[0] == 'd' && id[1] == 'k')
@@ -43,9 +43,9 @@ int vdk_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool vdk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool vdk_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 header[0x100];
+ uint8_t header[0x100];
io_generic_read(io, header, 0, 0x100);
int header_size = header[3] * 0x100 + header[2];
@@ -59,7 +59,7 @@ bool vdk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
for (int head = 0; head < head_count ; head++)
{
desc_pc_sector sectors[SECTOR_COUNT];
- UINT8 sector_data[SECTOR_COUNT * SECTOR_SIZE];
+ uint8_t sector_data[SECTOR_COUNT * SECTOR_SIZE];
int sector_offset = 0;
for (int i = 0; i < SECTOR_COUNT; i++)
@@ -88,16 +88,16 @@ bool vdk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
bool vdk_format::save(io_generic *io, floppy_image *image)
{
- UINT8 bitstream[500000/8];
- UINT8 sector_data[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sector_data[50000];
desc_xs sectors[256];
- UINT64 file_offset = 0;
+ uint64_t file_offset = 0;
int track_count, head_count;
image->get_actual_geometry(track_count, head_count);
// write header
- UINT8 header[12];
+ uint8_t header[12];
header[0] = 'd';
header[1] = 'k';
diff --git a/src/lib/formats/vdk_dsk.h b/src/lib/formats/vdk_dsk.h
index b685cb32f8b..270c1ff9071 100644
--- a/src/lib/formats/vdk_dsk.h
+++ b/src/lib/formats/vdk_dsk.h
@@ -26,8 +26,8 @@ public:
virtual const char *description() const override;
virtual const char *extensions() const override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual bool supports_save() const override;
diff --git a/src/lib/formats/vg5k_cas.cpp b/src/lib/formats/vg5k_cas.cpp
index 2c298f79304..898507e7139 100644
--- a/src/lib/formats/vg5k_cas.cpp
+++ b/src/lib/formats/vg5k_cas.cpp
@@ -20,7 +20,7 @@ static int k7_size;
/*******************************************************************
Generate one high-low cycle of sample data
********************************************************************/
-static inline int vg5k_cas_cycle(INT16 *buffer, int sample_pos, int len)
+static inline int vg5k_cas_cycle(int16_t *buffer, int sample_pos, int len)
{
int i = 0;
@@ -45,7 +45,7 @@ static inline int vg5k_cas_cycle(INT16 *buffer, int sample_pos, int len)
/*******************************************************************
Generate n samples of silence
********************************************************************/
-static inline int vg5k_cas_silence(INT16 *buffer, int sample_pos, int len)
+static inline int vg5k_cas_silence(int16_t *buffer, int sample_pos, int len)
{
int i = 0;
@@ -60,7 +60,7 @@ static inline int vg5k_cas_silence(INT16 *buffer, int sample_pos, int len)
/*******************************************************************
Generate the end-byte samples
********************************************************************/
-static inline int vg5k_cas_eob(INT16 *buffer, int sample_pos)
+static inline int vg5k_cas_eob(int16_t *buffer, int sample_pos)
{
int i, samples = 0;
@@ -73,7 +73,7 @@ static inline int vg5k_cas_eob(INT16 *buffer, int sample_pos)
}
-static inline int vg5k_cas_byte(INT16 *buffer, int sample_pos, UINT8 data)
+static inline int vg5k_cas_byte(int16_t *buffer, int sample_pos, uint8_t data)
{
/* Writing an entire byte */
int i, samples;
@@ -100,7 +100,7 @@ static inline int vg5k_cas_byte(INT16 *buffer, int sample_pos, UINT8 data)
/*******************************************************************
Generate n sample of synchro
********************************************************************/
-static inline int vg5k_k7_synchro(INT16 *buffer, int sample_pos, int len)
+static inline int vg5k_k7_synchro(int16_t *buffer, int sample_pos, int len)
{
int i, samples = 0;
@@ -113,7 +113,7 @@ static inline int vg5k_k7_synchro(INT16 *buffer, int sample_pos, int len)
}
-static int vg5k_handle_tap(INT16 *buffer, const UINT8 *casdata)
+static int vg5k_handle_tap(int16_t *buffer, const uint8_t *casdata)
{
int data_pos, sample_count;
@@ -127,7 +127,7 @@ static int vg5k_handle_tap(INT16 *buffer, const UINT8 *casdata)
/* on the entire file*/
while( data_pos < k7_size )
{
- UINT16 block_size = 0;
+ uint16_t block_size = 0;
/* Identify type of block */
if (casdata[data_pos] == 0xd3)
@@ -183,7 +183,7 @@ static int vg5k_handle_tap(INT16 *buffer, const UINT8 *casdata)
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int vg5k_k7_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int vg5k_k7_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return vg5k_handle_tap(buffer, bytes);
}
@@ -192,7 +192,7 @@ static int vg5k_k7_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
/*******************************************************************
Calculate the number of samples needed for this tape image classical
********************************************************************/
-static int vg5k_k7_to_wav_size(const UINT8 *casdata, int caslen)
+static int vg5k_k7_to_wav_size(const uint8_t *casdata, int caslen)
{
k7_size = caslen ;
diff --git a/src/lib/formats/victor9k_dsk.cpp b/src/lib/formats/victor9k_dsk.cpp
index 5f0936a8048..1fbba7502be 100644
--- a/src/lib/formats/victor9k_dsk.cpp
+++ b/src/lib/formats/victor9k_dsk.cpp
@@ -119,18 +119,18 @@ const char *victor9k_format::extensions() const
return "img";
}
-int victor9k_format::find_size(io_generic *io, UINT32 form_factor)
+int victor9k_format::find_size(io_generic *io, uint32_t form_factor)
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
for(int i=0; formats[i].sector_count; i++) {
const format &f = formats[i];
- if(size == (UINT32) f.sector_count*f.sector_base_size*f.head_count)
+ if(size == (uint32_t) f.sector_count*f.sector_base_size*f.head_count)
return i;
}
return -1;
}
-int victor9k_format::identify(io_generic *io, UINT32 form_factor)
+int victor9k_format::identify(io_generic *io, uint32_t form_factor)
{
int type = find_size(io, form_factor);
@@ -140,7 +140,7 @@ int victor9k_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-void victor9k_format::log_boot_sector(UINT8 *data)
+void victor9k_format::log_boot_sector(uint8_t *data)
{
// System disc ID
osd_printf_verbose("System disc: %s\n", ((data[0] == 0xff) && (data[1] == 0x00)) ? "yes" : "no");
@@ -237,7 +237,7 @@ floppy_image_format_t::desc_e* victor9k_format::get_sector_desc(const format &f,
return desc;
}
-void victor9k_format::build_sector_description(const format &f, UINT8 *sectdata, UINT32 sect_offs, desc_s *sectors, int sector_count) const
+void victor9k_format::build_sector_description(const format &f, uint8_t *sectdata, uint32_t sect_offs, desc_s *sectors, int sector_count) const
{
for (int i = 0; i < sector_count; i++) {
sectors[i].data = sectdata + sect_offs;
@@ -248,7 +248,7 @@ void victor9k_format::build_sector_description(const format &f, UINT8 *sectdata,
}
}
-bool victor9k_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool victor9k_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
int type = find_size(io, form_factor);
if(type == -1)
@@ -256,8 +256,8 @@ bool victor9k_format::load(io_generic *io, UINT32 form_factor, floppy_image *ima
const format &f = formats[type];
- UINT64 size = io_generic_size(io);
- std::vector<UINT8> img;
+ uint64_t size = io_generic_size(io);
+ std::vector<uint8_t> img;
img.resize(size);
io_generic_read(io, &img[0], 0, size);
@@ -332,7 +332,7 @@ const victor9k_format::format victor9k_format::formats[] = {
{}
};
-const UINT32 victor9k_format::cell_size[9] =
+const uint32_t victor9k_format::cell_size[9] =
{
1789, 1896, 2009, 2130, 2272, 2428, 2613, 2847, 2961
};
@@ -398,7 +398,7 @@ bool victor9k_format::save(io_generic *io, floppy_image *image)
for(int track=0; track < f.track_count; track++) {
int sector_count = sectors_per_track[head][track];
int track_size = compute_track_size(f, head, track);
- UINT8 sectdata[40*512];
+ uint8_t sectdata[40*512];
desc_s sectors[40];
int offset = get_image_offset(f, head, track);
@@ -413,8 +413,8 @@ bool victor9k_format::save(io_generic *io, floppy_image *image)
void victor9k_format::extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head, int sector_count)
{
- UINT8 bitstream[500000/8];
- UINT8 sectdata[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sectdata[50000];
desc_xs sectors[256];
int track_size;
@@ -429,7 +429,7 @@ void victor9k_format::extract_sectors(floppy_image *image, const format &f, desc
memset((void *)ds.data, 0, ds.size);
else if(xs.size < ds.size) {
memcpy((void *)ds.data, xs.data, xs.size);
- memset((UINT8 *)ds.data + xs.size, 0, xs.size - ds.size);
+ memset((uint8_t *)ds.data + xs.size, 0, xs.size - ds.size);
} else
memcpy((void *)ds.data, xs.data, ds.size);
}
diff --git a/src/lib/formats/victor9k_dsk.h b/src/lib/formats/victor9k_dsk.h
index c463803b781..0c3f89c9f59 100644
--- a/src/lib/formats/victor9k_dsk.h
+++ b/src/lib/formats/victor9k_dsk.h
@@ -18,13 +18,13 @@
class victor9k_format : public floppy_image_format_t {
public:
struct format {
- UINT32 form_factor; // See floppy_image for possible values
- UINT32 variant; // See floppy_image for possible values
+ uint32_t form_factor; // See floppy_image for possible values
+ uint32_t variant; // See floppy_image for possible values
- UINT16 sector_count;
- UINT8 track_count;
- UINT8 head_count;
- UINT16 sector_base_size;
+ uint16_t sector_count;
+ uint8_t track_count;
+ uint8_t head_count;
+ uint16_t sector_base_size;
};
victor9k_format();
@@ -33,8 +33,8 @@ public:
virtual const char *description() const override;
virtual const char *extensions() const override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual bool supports_save() const override { return true; }
@@ -43,15 +43,15 @@ public:
protected:
static const format formats[];
- static const UINT32 cell_size[9];
+ static const uint32_t cell_size[9];
static const int sectors_per_track[2][80];
static const int speed_zone[2][80];
static const int rpm[9];
- int find_size(io_generic *io, UINT32 form_factor);
- void log_boot_sector(UINT8 *data);
+ int find_size(io_generic *io, uint32_t form_factor);
+ void log_boot_sector(uint8_t *data);
floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count);
- void build_sector_description(const format &f, UINT8 *sectdata, UINT32 sect_offs, desc_s *sectors, int sector_count) const;
+ void build_sector_description(const format &f, uint8_t *sectdata, uint32_t sect_offs, desc_s *sectors, int sector_count) const;
int get_image_offset(const format &f, int head, int track);
int compute_track_size(const format &f, int head, int track);
void extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head, int sector_count);
diff --git a/src/lib/formats/vt_cas.cpp b/src/lib/formats/vt_cas.cpp
index d3284d4d301..9dbc68f8074 100644
--- a/src/lib/formats/vt_cas.cpp
+++ b/src/lib/formats/vt_cas.cpp
@@ -10,7 +10,7 @@
#define SILENCE 8000
-static int generic_fill_wave(INT16 *buffer, int length, UINT8 *code, int bitsamples, int bytesamples, int lo, INT16 *(*fill_wave_byte)(INT16 *buffer, int byte))
+static int generic_fill_wave(int16_t *buffer, int length, uint8_t *code, int bitsamples, int bytesamples, int lo, int16_t *(*fill_wave_byte)(int16_t *buffer, int byte))
{
static int nullbyte;
@@ -66,7 +66,7 @@ static int generic_fill_wave(INT16 *buffer, int length, UINT8 *code, int bitsamp
#define V1_BITSAMPLES 6
#define V1_BYTESAMPLES 8*V1_BITSAMPLES
-static INT16 *vtech1_fill_wave_byte(INT16 *buffer, int byte)
+static int16_t *vtech1_fill_wave_byte(int16_t *buffer, int byte)
{
int i;
@@ -92,7 +92,7 @@ static INT16 *vtech1_fill_wave_byte(INT16 *buffer, int byte)
return buffer;
}
-static int vtech1_cassette_fill_wave(INT16 *buffer, int length, UINT8 *code)
+static int vtech1_cassette_fill_wave(int16_t *buffer, int length, uint8_t *code)
{
return generic_fill_wave(buffer, length, code, V1_BITSAMPLES, V1_BYTESAMPLES, V1_LO, vtech1_fill_wave_byte);
}
@@ -140,7 +140,7 @@ CASSETTE_FORMATLIST_END
#define VT2_BITSAMPLES 18
#define VT2_BYTESAMPLES 8*VT2_BITSAMPLES
-static const INT16 vtech2_bit0[VT2_BITSAMPLES] =
+static const int16_t vtech2_bit0[VT2_BITSAMPLES] =
{
/* short cycle, long cycles */
VT2_HI,VT2_HI,VT2_HI,VT2_LO,VT2_LO,VT2_LO,
@@ -148,7 +148,7 @@ static const INT16 vtech2_bit0[VT2_BITSAMPLES] =
VT2_LO,VT2_LO,VT2_LO,VT2_LO,VT2_LO,VT2_LO
};
-static const INT16 vtech2_bit1[VT2_BITSAMPLES] =
+static const int16_t vtech2_bit1[VT2_BITSAMPLES] =
{
/* three short cycle */
VT2_HI,VT2_HI,VT2_HI,VT2_LO,VT2_LO,VT2_LO,
@@ -157,7 +157,7 @@ static const INT16 vtech2_bit1[VT2_BITSAMPLES] =
};
-static INT16 *vtech2_fill_wave_bit(INT16 *buffer, int bit)
+static int16_t *vtech2_fill_wave_bit(int16_t *buffer, int bit)
{
int i;
if( bit )
@@ -174,7 +174,7 @@ static INT16 *vtech2_fill_wave_bit(INT16 *buffer, int bit)
}
-static INT16 *vtech2_fill_wave_byte(INT16 *buffer, int byte)
+static int16_t *vtech2_fill_wave_byte(int16_t *buffer, int byte)
{
buffer = vtech2_fill_wave_bit(buffer, (byte >> 7) & 1);
buffer = vtech2_fill_wave_bit(buffer, (byte >> 6) & 1);
@@ -187,7 +187,7 @@ static INT16 *vtech2_fill_wave_byte(INT16 *buffer, int byte)
return buffer;
}
-static int vtech2_cassette_fill_wave(INT16 *buffer, int length, UINT8 *code)
+static int vtech2_cassette_fill_wave(int16_t *buffer, int length, uint8_t *code)
{
return generic_fill_wave(buffer, length, code, VT2_BITSAMPLES, VT2_BYTESAMPLES, VT2_LO, vtech2_fill_wave_byte);
}
diff --git a/src/lib/formats/wavfile.cpp b/src/lib/formats/wavfile.cpp
index 70fb992c97a..29f33c4102b 100644
--- a/src/lib/formats/wavfile.cpp
+++ b/src/lib/formats/wavfile.cpp
@@ -23,25 +23,25 @@ static const char data_tag_id[4] = { 'd', 'a', 't', 'a' };
-static UINT32 get_leuint32(const void *ptr)
+static uint32_t get_leuint32(const void *ptr)
{
- UINT32 value;
+ uint32_t value;
memcpy(&value, ptr, sizeof(value));
return little_endianize_int32(value);
}
-static UINT16 get_leuint16(const void *ptr)
+static uint16_t get_leuint16(const void *ptr)
{
- UINT16 value;
+ uint16_t value;
memcpy(&value, ptr, sizeof(value));
return little_endianize_int16(value);
}
-static void put_leuint32(void *ptr, UINT32 value)
+static void put_leuint32(void *ptr, uint32_t value)
{
value = little_endianize_int32(value);
memcpy(ptr, &value, sizeof(value));
@@ -49,7 +49,7 @@ static void put_leuint32(void *ptr, UINT32 value)
-static void put_leuint16(void *ptr, UINT16 value)
+static void put_leuint16(void *ptr, uint16_t value)
{
value = little_endianize_int16(value);
memcpy(ptr, &value, sizeof(value));
@@ -60,19 +60,19 @@ static void put_leuint16(void *ptr, UINT16 value)
static cassette_image::error wavfile_process(cassette_image *cassette, struct CassetteOptions *opts,
int read_waveform)
{
- UINT8 file_header[12];
- UINT8 tag_header[8];
- UINT8 format_tag[16];
- UINT32 stated_size;
- UINT64 file_size;
- UINT32 tag_size;
- UINT32 tag_samples;
- UINT64 offset;
+ uint8_t file_header[12];
+ uint8_t tag_header[8];
+ uint8_t format_tag[16];
+ uint32_t stated_size;
+ uint64_t file_size;
+ uint32_t tag_size;
+ uint32_t tag_samples;
+ uint64_t offset;
int format_specified = FALSE;
- UINT16 format_type = 0;
- UINT32 bytes_per_second = 0;
-// UINT16 block_align = 0;
+ uint16_t format_type = 0;
+ uint32_t bytes_per_second = 0;
+// uint16_t block_align = 0;
int waveform_flags = 0;
/* read header */
@@ -89,7 +89,7 @@ static cassette_image::error wavfile_process(cassette_image *cassette, struct Ca
stated_size = get_leuint32(&file_header[4]) + 8;
file_size = cassette_image_size(cassette);
if (stated_size > file_size)
- stated_size = (UINT32) file_size;
+ stated_size = (uint32_t) file_size;
while(offset < stated_size)
{
@@ -177,24 +177,24 @@ static cassette_image::error wavfile_load(cassette_image *cassette)
static cassette_image::error wavfile_save(cassette_image *cassette, const struct CassetteInfo *info)
{
cassette_image::error err;
- UINT8 consolidated_header[12 + 8 + 16 + 8];
- UINT8 *header = &consolidated_header[0];
- UINT8 *format_tag_header = &consolidated_header[12];
- UINT8 *format_tag_data = &consolidated_header[12 + 8];
- UINT8 *data_tag_header = &consolidated_header[12 + 8 + 16];
- UINT32 file_size;
- UINT32 bytes_per_second;
- UINT16 bits_per_sample;
- UINT32 data_size;
+ uint8_t consolidated_header[12 + 8 + 16 + 8];
+ uint8_t *header = &consolidated_header[0];
+ uint8_t *format_tag_header = &consolidated_header[12];
+ uint8_t *format_tag_data = &consolidated_header[12 + 8];
+ uint8_t *data_tag_header = &consolidated_header[12 + 8 + 16];
+ uint32_t file_size;
+ uint32_t bytes_per_second;
+ uint16_t bits_per_sample;
+ uint32_t data_size;
size_t bytes_per_sample = 2;
int waveform_flags = CASSETTE_WAVEFORM_16BITLE;
- UINT16 block_align;
+ uint16_t block_align;
- bits_per_sample = (UINT16) (bytes_per_sample * 8);
+ bits_per_sample = (uint16_t) (bytes_per_sample * 8);
bytes_per_second = info->sample_frequency * bytes_per_sample * info->channels;
- data_size = (UINT32) (info->sample_count * bytes_per_sample * info->channels);
+ data_size = (uint32_t) (info->sample_count * bytes_per_sample * info->channels);
file_size = data_size + sizeof(consolidated_header) - 8;
- block_align = (UINT16) (bytes_per_sample * info->channels);
+ block_align = (uint16_t) (bytes_per_sample * info->channels);
/* set up header */
memcpy(&header[0], magic1, 4);
@@ -257,8 +257,8 @@ void wavfile_testload(const char *fname)
FILE *f;
long offset;
int freq, samples, i;
- INT32 cassamp;
- INT16 wavsamp;
+ int32_t cassamp;
+ int16_t wavsamp;
f = fopen(fname, "rb");
if (!f)
@@ -280,7 +280,7 @@ void wavfile_testload(const char *fname)
fseek(f, offset + i * 2, SEEK_SET);
fread(&wavsamp, 1, 2, f);
- assert(cassamp == (((UINT32) wavsamp) << 16));
+ assert(cassamp == (((uint32_t) wavsamp) << 16));
}
cassette_close(cassette);
diff --git a/src/lib/formats/wd177x_dsk.cpp b/src/lib/formats/wd177x_dsk.cpp
index 527fb69a234..52e8db2f1f2 100644
--- a/src/lib/formats/wd177x_dsk.cpp
+++ b/src/lib/formats/wd177x_dsk.cpp
@@ -19,21 +19,21 @@ wd177x_format::wd177x_format(const format *_formats)
/*
Default implementation for find_size. May be overwritten by subclasses.
*/
-int wd177x_format::find_size(io_generic *io, UINT32 form_factor)
+int wd177x_format::find_size(io_generic *io, uint32_t form_factor)
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
for(int i=0; formats[i].form_factor; i++) {
const format &f = formats[i];
if(form_factor != floppy_image::FF_UNKNOWN && form_factor != f.form_factor)
continue;
- if(size == (UINT64)compute_track_size(f) * f.track_count * f.head_count)
+ if(size == (uint64_t)compute_track_size(f) * f.track_count * f.head_count)
return i;
}
return -1;
}
-int wd177x_format::identify(io_generic *io, UINT32 form_factor)
+int wd177x_format::identify(io_generic *io, uint32_t form_factor)
{
int type = find_size(io, form_factor);
@@ -55,7 +55,7 @@ int wd177x_format::compute_track_size(const format &f) const
return track_size;
}
-void wd177x_format::build_sector_description(const format &f, UINT8 *sectdata, desc_s *sectors) const
+void wd177x_format::build_sector_description(const format &f, uint8_t *sectdata, desc_s *sectors) const
{
if(f.sector_base_id == -1) {
for(int i=0; i<f.sector_count; i++) {
@@ -164,7 +164,7 @@ floppy_image_format_t::desc_e* wd177x_format::get_desc_mfm(const format &f, int
return desc;
}
-bool wd177x_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool wd177x_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
int type = find_size(io, form_factor);
if(type == -1)
@@ -198,7 +198,7 @@ bool wd177x_format::load(io_generic *io, UINT32 form_factor, floppy_image *image
int track_size = compute_track_size(f);
- UINT8 sectdata[40*512];
+ uint8_t sectdata[40*512];
desc_s sectors[40];
build_sector_description(f, sectdata, sectors);
@@ -328,7 +328,7 @@ bool wd177x_format::save(io_generic *io, floppy_image *image)
const format &f = formats[chosen_candidate];
int track_size = compute_track_size(f);
- UINT8 sectdata[40*512];
+ uint8_t sectdata[40*512];
desc_s sectors[40];
build_sector_description(f, sectdata, sectors);
@@ -364,8 +364,8 @@ int wd177x_format::get_track_dam_mfm(const format &f, int head, int track)
void wd177x_format::check_compatibility(floppy_image *image, std::vector<int> &candidates)
{
- UINT8 bitstream[500000/8];
- UINT8 sectdata[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sectdata[50000];
desc_xs sectors[256];
int track_size;
@@ -417,8 +417,8 @@ void wd177x_format::check_compatibility(floppy_image *image, std::vector<int> &c
void wd177x_format::extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head)
{
- UINT8 bitstream[500000/8];
- UINT8 sectdata[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sectdata[50000];
desc_xs sectors[256];
int track_size;
@@ -442,7 +442,7 @@ void wd177x_format::extract_sectors(floppy_image *image, const format &f, desc_s
memset((void *)ds.data, 0, ds.size);
else if(xs.size < ds.size) {
memcpy((void *)ds.data, xs.data, xs.size);
- memset((UINT8 *)ds.data + xs.size, 0, xs.size - ds.size);
+ memset((uint8_t *)ds.data + xs.size, 0, xs.size - ds.size);
} else
memcpy((void *)ds.data, xs.data, ds.size);
}
diff --git a/src/lib/formats/wd177x_dsk.h b/src/lib/formats/wd177x_dsk.h
index 6c93000b02c..0061212d14b 100644
--- a/src/lib/formats/wd177x_dsk.h
+++ b/src/lib/formats/wd177x_dsk.h
@@ -17,9 +17,9 @@ class wd177x_format : public floppy_image_format_t
{
public:
struct format {
- UINT32 form_factor; // See floppy_image for possible values
- UINT32 variant; // See floppy_image for possible values
- UINT32 encoding; // See floppy_image for possible values
+ uint32_t form_factor; // See floppy_image for possible values
+ uint32_t variant; // See floppy_image for possible values
+ uint32_t encoding; // See floppy_image for possible values
int cell_size; // See floppy_image_format_t for details
int sector_count;
@@ -37,8 +37,8 @@ public:
// End the array with {}
wd177x_format(const format *formats);
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual bool save(io_generic *io, floppy_image *image) override;
virtual bool supports_save() const override;
@@ -49,13 +49,13 @@ protected:
virtual floppy_image_format_t::desc_e* get_desc_fm(const format &f, int &current_size, int &end_gap_index);
virtual floppy_image_format_t::desc_e* get_desc_mfm(const format &f, int &current_size, int &end_gap_index);
- virtual int find_size(io_generic *io, UINT32 form_factor);
+ virtual int find_size(io_generic *io, uint32_t form_factor);
virtual int get_image_offset(const format &f, int head, int track);
virtual int get_track_dam_fm(const format &f, int head, int track);
virtual int get_track_dam_mfm(const format &f, int head, int track);
int compute_track_size(const format &f) const;
- void build_sector_description(const format &d, UINT8 *sectdata, desc_s *sectors) const;
+ void build_sector_description(const format &d, uint8_t *sectdata, desc_s *sectors) const;
void check_compatibility(floppy_image *image, std::vector<int> &candidates);
void extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head);
};
diff --git a/src/lib/formats/x07_cas.cpp b/src/lib/formats/x07_cas.cpp
index 93c34705105..b49d7c8d643 100644
--- a/src/lib/formats/x07_cas.cpp
+++ b/src/lib/formats/x07_cas.cpp
@@ -21,7 +21,7 @@
// image size
static int x07_image_size;
-static int x07_put_samples(INT16 *buffer, int sample_pos, int count, int level)
+static int x07_put_samples(int16_t *buffer, int sample_pos, int count, int level)
{
if (buffer)
{
@@ -32,7 +32,7 @@ static int x07_put_samples(INT16 *buffer, int sample_pos, int count, int level)
return count;
}
-static int x07_output_bit(INT16 *buffer, int sample_pos, UINT8 bit)
+static int x07_output_bit(int16_t *buffer, int sample_pos, uint8_t bit)
{
int samples = 0;
@@ -52,7 +52,7 @@ static int x07_output_bit(INT16 *buffer, int sample_pos, UINT8 bit)
return samples;
}
-static int x07_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
+static int x07_output_byte(int16_t *buffer, int sample_pos, uint8_t byte)
{
int samples = 0;
@@ -71,7 +71,7 @@ static int x07_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
return samples;
}
-static int x07_handle_cassette(INT16 *buffer, const UINT8 *bytes)
+static int x07_handle_cassette(int16_t *buffer, const uint8_t *bytes)
{
int sample_count = 0;
int img_start = 0;
@@ -124,7 +124,7 @@ static int x07_handle_cassette(INT16 *buffer, const UINT8 *bytes)
Generate samples for the tape image
********************************************************************/
-static int x07_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int x07_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
return x07_handle_cassette(buffer, bytes);
}
@@ -133,7 +133,7 @@ static int x07_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
Calculate the number of samples needed for this tape image
********************************************************************/
-static int x07_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int x07_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
{
x07_image_size = length;
diff --git a/src/lib/formats/x1_tap.cpp b/src/lib/formats/x1_tap.cpp
index 33ecefd683f..b4fe65b8e8c 100644
--- a/src/lib/formats/x1_tap.cpp
+++ b/src/lib/formats/x1_tap.cpp
@@ -32,7 +32,7 @@ static int cas_size;
static int samplerate;
static int new_format;
-static int x1_fill_wave(INT16* buffer, UINT8 data, int sample_pos)
+static int x1_fill_wave(int16_t* buffer, uint8_t data, int sample_pos)
{
int x;
int sample_count = 0;
@@ -48,7 +48,7 @@ static int x1_fill_wave(INT16* buffer, UINT8 data, int sample_pos)
return sample_count;
}
-static int x1_handle_tap(INT16* buffer, const UINT8* casdata)
+static int x1_handle_tap(int16_t* buffer, const uint8_t* casdata)
{
int sample_count = 0;
int data_pos = new_format ? 0x28 : 0x04;
@@ -71,9 +71,9 @@ static int x1_handle_tap(INT16* buffer, const UINT8* casdata)
/*******************************************************************
Calculate the number of samples needed for this tape image
********************************************************************/
-static int x1_cas_to_wav_size (const UINT8 *casdata, int caslen)
+static int x1_cas_to_wav_size (const uint8_t *casdata, int caslen)
{
- UINT32 ret;
+ uint32_t ret;
if (!memcmp(casdata, "TAPE", 4)) // new TAP format
{
@@ -98,7 +98,7 @@ static int x1_cas_to_wav_size (const UINT8 *casdata, int caslen)
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int x1_cas_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int x1_cas_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return x1_handle_tap(buffer,bytes);
}
diff --git a/src/lib/formats/zx81_p.cpp b/src/lib/formats/zx81_p.cpp
index 7a5f82fd8f1..7f359ccaca3 100644
--- a/src/lib/formats/zx81_p.cpp
+++ b/src/lib/formats/zx81_p.cpp
@@ -55,13 +55,13 @@ medium transfer rate is approx. 307 bps (38 bytes/sec) for files that contain
#define ZX81_DATA_LENGTH_OFFSET 0x0b
#define ZX80_DATA_LENGTH_OFFSET 0x04
-static UINT8 zx_file_name[128];
-static UINT16 real_data_length = 0;
-static UINT8 zx_file_name_length = 0;
+static uint8_t zx_file_name[128];
+static uint16_t real_data_length = 0;
+static uint8_t zx_file_name_length = 0;
/* common functions */
-static INT16 *zx81_emit_level(INT16 *p, int count, int level)
+static int16_t *zx81_emit_level(int16_t *p, int count, int level)
{
int i;
@@ -70,7 +70,7 @@ static INT16 *zx81_emit_level(INT16 *p, int count, int level)
return p;
}
-static INT16* zx81_emit_pulse(INT16 *p)
+static int16_t* zx81_emit_pulse(int16_t *p)
{
p = zx81_emit_level (p, ZX81_PULSE_LENGTH/8, WAVEENTRY_LOW);
p = zx81_emit_level (p, ZX81_PULSE_LENGTH/8, WAVEENTRY_LOW);
@@ -84,14 +84,14 @@ static INT16* zx81_emit_pulse(INT16 *p)
return p;
}
-static INT16* zx81_emit_pause(INT16 *p)
+static int16_t* zx81_emit_pause(int16_t *p)
{
p = zx81_emit_level (p, ZX81_PAUSE_LENGTH, WAVEENTRY_ZERO);
return p;
}
-static INT16* zx81_output_bit(INT16 *p, UINT8 bit)
+static int16_t* zx81_output_bit(int16_t *p, uint8_t bit)
{
int i;
@@ -107,7 +107,7 @@ static INT16* zx81_output_bit(INT16 *p, UINT8 bit)
return p;
}
-static INT16* zx81_output_byte(INT16 *p, UINT8 byte)
+static int16_t* zx81_output_byte(int16_t *p, uint8_t byte)
{
int i;
@@ -117,9 +117,9 @@ static INT16* zx81_output_byte(INT16 *p, UINT8 byte)
return p;
}
-static UINT16 zx81_cassette_calculate_number_of_1(const UINT8 *bytes, UINT16 length)
+static uint16_t zx81_cassette_calculate_number_of_1(const uint8_t *bytes, uint16_t length)
{
- UINT16 number_of_1 = 0;
+ uint16_t number_of_1 = 0;
int i,j;
for (i=0; i<length; i++)
@@ -132,7 +132,7 @@ static UINT16 zx81_cassette_calculate_number_of_1(const UINT8 *bytes, UINT16 len
/* ZX-81 functions */
-static const UINT8 zx81_chars[]={
+static const uint8_t zx81_chars[]={
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*00h-07h*/
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*08h-0fh*/
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*10h-17h*/
@@ -154,11 +154,11 @@ static const UINT8 zx81_chars[]={
static void zx81_fill_file_name(const char* name)
{
for (zx_file_name_length=0; (zx_file_name_length<128) && name[zx_file_name_length]; zx_file_name_length++)
- zx_file_name[zx_file_name_length] = ((UINT8) name[zx_file_name_length]<0x80) ? zx81_chars[(UINT8) name[zx_file_name_length]] : 0x00;
+ zx_file_name[zx_file_name_length] = ((uint8_t) name[zx_file_name_length]<0x80) ? zx81_chars[(uint8_t) name[zx_file_name_length]] : 0x00;
zx_file_name[zx_file_name_length-1] |= 0x80;
}
-static int zx81_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int zx81_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
{
unsigned int number_of_0_data = 0;
unsigned int number_of_1_data = 0;
@@ -176,9 +176,9 @@ static int zx81_cassette_calculate_size_in_samples(const UINT8 *bytes, int lengt
return (number_of_0_data+number_of_0_name)*ZX81_LOW_BIT_LENGTH + (number_of_1_data+number_of_1_name)*ZX81_HIGH_BIT_LENGTH + ZX81_PILOT_LENGTH;
}
-static int zx81_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int zx81_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
- INT16 * p = buffer;
+ int16_t * p = buffer;
int i;
/* pilot */
@@ -235,7 +235,7 @@ CASSETTE_FORMATLIST_END
/* ZX-80 functions */
-static int zx80_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int zx80_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
{
unsigned int number_of_0_data = 0;
unsigned int number_of_1_data = 0;
@@ -248,9 +248,9 @@ static int zx80_cassette_calculate_size_in_samples(const UINT8 *bytes, int lengt
return number_of_0_data*ZX81_LOW_BIT_LENGTH + number_of_1_data*ZX81_HIGH_BIT_LENGTH + ZX81_PILOT_LENGTH;
}
-static int zx80_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int zx80_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
- INT16 * p = buffer;
+ int16_t * p = buffer;
int i;
/* pilot */
diff --git a/src/lib/util/avhuff.cpp b/src/lib/util/avhuff.cpp
index dbec214076a..9975287f4c1 100644
--- a/src/lib/util/avhuff.cpp
+++ b/src/lib/util/avhuff.cpp
@@ -123,7 +123,7 @@ inline int rlecount_to_code(int rlecount)
// encode_one - encode data
//-------------------------------------------------
-inline void avhuff_encoder::deltarle_encoder::encode_one(bitstream_out &bitbuf, UINT16 *&rleptr)
+inline void avhuff_encoder::deltarle_encoder::encode_one(bitstream_out &bitbuf, uint16_t *&rleptr)
{
// return RLE data if we still have some
if (m_rlecount != 0)
@@ -133,7 +133,7 @@ inline void avhuff_encoder::deltarle_encoder::encode_one(bitstream_out &bitbuf,
}
// fetch the data and process
- UINT16 data = *rleptr++;
+ uint16_t data = *rleptr++;
m_encoder.encode_one(bitbuf, data);
if (data >= 0x100)
m_rlecount = code_to_rlecount(data) - 1;
@@ -143,7 +143,7 @@ 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)
+inline uint32_t avhuff_decoder::deltarle_decoder::decode_one(bitstream_in &bitbuf)
{
// return RLE data if we still have some
if (m_rlecount != 0)
@@ -156,7 +156,7 @@ inline UINT32 avhuff_decoder::deltarle_decoder::decode_one(bitstream_in &bitbuf)
int data = m_decoder.decode_one(bitbuf);
if (data < 0x100)
{
- m_prevdata += UINT8(data);
+ m_prevdata += uint8_t(data);
return m_prevdata;
}
else
@@ -189,7 +189,7 @@ m_flac_encoder.set_strip_metadata(true);
}
/**
- * @fn avhuff_error avhuff_encoder::encode_data(const UINT8 *source, UINT8 *dest, UINT32 &complength)
+ * @fn avhuff_error avhuff_encoder::encode_data(const uint8_t *source, uint8_t *dest, uint32_t &complength)
*
* @brief -------------------------------------------------
* encode_data - encode a block of data into a compressed data stream
@@ -202,18 +202,18 @@ m_flac_encoder.set_strip_metadata(true);
* @return An avhuff_error.
*/
-avhuff_error avhuff_encoder::encode_data(const UINT8 *source, UINT8 *dest, UINT32 &complength)
+avhuff_error avhuff_encoder::encode_data(const uint8_t *source, uint8_t *dest, uint32_t &complength)
{
// validate the header
if (source[0] != 'c' || source[1] != 'h' || source[2] != 'a' || source[3] != 'v')
return AVHERR_INVALID_DATA;
// extract info from the header
- UINT32 metasize = source[4];
- UINT32 channels = source[5];
- UINT32 samples = (source[6] << 8) + source[7];
- UINT32 width = (source[8] << 8) + source[9];
- UINT32 height = (source[10] << 8) + source[11];
+ uint32_t metasize = source[4];
+ uint32_t channels = source[5];
+ uint32_t samples = (source[6] << 8) + source[7];
+ uint32_t width = (source[8] << 8) + source[9];
+ uint32_t height = (source[10] << 8) + source[11];
source += 12;
// write the basics to the new header
@@ -227,7 +227,7 @@ avhuff_error avhuff_encoder::encode_data(const UINT8 *source, UINT8 *dest, UINT3
dest[7] = height;
// starting offsets
- UINT32 dstoffs = 10 + 2 * channels;
+ uint32_t dstoffs = 10 + 2 * channels;
// copy the metadata first
if (metasize > 0)
@@ -247,7 +247,7 @@ avhuff_error avhuff_encoder::encode_data(const UINT8 *source, UINT8 *dest, UINT3
return err;
// advance the pointers past the data
- UINT16 treesize = (dest[8] << 8) + dest[9];
+ uint16_t treesize = (dest[8] << 8) + dest[9];
if (treesize != 0xffff)
dstoffs += treesize;
for (int chnum = 0; chnum < channels; chnum++)
@@ -263,7 +263,7 @@ avhuff_error avhuff_encoder::encode_data(const UINT8 *source, UINT8 *dest, UINT3
if (width > 0 && height > 0)
{
// encode the video
- UINT32 vidlength = 0;
+ uint32_t vidlength = 0;
avhuff_error err = encode_video(source, width, height, dest + dstoffs, vidlength);
if (err != AVHERR_NONE)
return err;
@@ -278,7 +278,7 @@ avhuff_error avhuff_encoder::encode_data(const UINT8 *source, UINT8 *dest, UINT3
}
/**
- * @fn UINT32 avhuff_encoder::raw_data_size(const UINT8 *data)
+ * @fn uint32_t avhuff_encoder::raw_data_size(const uint8_t *data)
*
* @brief -------------------------------------------------
* raw_data_size - return the raw data size of a raw stream based on the header
@@ -286,10 +286,10 @@ avhuff_error avhuff_encoder::encode_data(const UINT8 *source, UINT8 *dest, UINT3
*
* @param data The data.
*
- * @return An UINT32.
+ * @return An uint32_t.
*/
-UINT32 avhuff_encoder::raw_data_size(const UINT8 *data)
+uint32_t avhuff_encoder::raw_data_size(const uint8_t *data)
{
// make sure we have a correct header
int size = 0;
@@ -308,7 +308,7 @@ UINT32 avhuff_encoder::raw_data_size(const UINT8 *data)
}
/**
- * @fn avhuff_error avhuff_encoder::assemble_data(std::vector<UINT8> &buffer, bitmap_yuy16 &bitmap, UINT8 channels, UINT32 numsamples, INT16 **samples, UINT8 *metadata, UINT32 metadatasize)
+ * @fn avhuff_error avhuff_encoder::assemble_data(std::vector<uint8_t> &buffer, bitmap_yuy16 &bitmap, uint8_t channels, uint32_t numsamples, int16_t **samples, uint8_t *metadata, uint32_t metadatasize)
*
* @brief -------------------------------------------------
* assemble_data - assemble a datastream from raw bits
@@ -325,7 +325,7 @@ UINT32 avhuff_encoder::raw_data_size(const UINT8 *data)
* @return An avhuff_error.
*/
-avhuff_error avhuff_encoder::assemble_data(std::vector<UINT8> &buffer, bitmap_yuy16 &bitmap, UINT8 channels, UINT32 numsamples, INT16 **samples, UINT8 *metadata, UINT32 metadatasize)
+avhuff_error avhuff_encoder::assemble_data(std::vector<uint8_t> &buffer, bitmap_yuy16 &bitmap, uint8_t channels, uint32_t numsamples, int16_t **samples, uint8_t *metadata, uint32_t metadatasize)
{
// sanity check the inputs
if (metadatasize > 255)
@@ -337,7 +337,7 @@ avhuff_error avhuff_encoder::assemble_data(std::vector<UINT8> &buffer, bitmap_yu
// fill in the header
buffer.resize(12 + metadatasize + numsamples * channels * 2 + bitmap.width() * bitmap.height() * 2);
- UINT8 *dest = &buffer[0];
+ uint8_t *dest = &buffer[0];
*dest++ = 'c';
*dest++ = 'h';
*dest++ = 'a';
@@ -357,18 +357,18 @@ avhuff_error avhuff_encoder::assemble_data(std::vector<UINT8> &buffer, bitmap_yu
dest += metadatasize;
// copy the audio streams
- for (UINT8 curchan = 0; curchan < channels; curchan++)
- for (UINT32 cursamp = 0; cursamp < numsamples; cursamp++)
+ for (uint8_t curchan = 0; curchan < channels; curchan++)
+ for (uint32_t cursamp = 0; cursamp < numsamples; cursamp++)
{
*dest++ = samples[curchan][cursamp] >> 8;
*dest++ = samples[curchan][cursamp] & 0xff;
}
// copy the video data
- for (INT32 y = 0; y < bitmap.height(); y++)
+ for (int32_t y = 0; y < bitmap.height(); y++)
{
- UINT16 *src = &bitmap.pix(y);
- for (INT32 x = 0; x < bitmap.width(); x++)
+ uint16_t *src = &bitmap.pix(y);
+ for (int32_t x = 0; x < bitmap.width(); x++)
{
*dest++ = src[x] >> 8;
*dest++ = src[x] & 0xff;
@@ -378,7 +378,7 @@ avhuff_error avhuff_encoder::assemble_data(std::vector<UINT8> &buffer, bitmap_yu
}
/**
- * @fn avhuff_error avhuff_encoder::encode_audio(const UINT8 *source, int channels, int samples, UINT8 *dest, UINT8 *sizes)
+ * @fn avhuff_error avhuff_encoder::encode_audio(const uint8_t *source, int channels, int samples, uint8_t *dest, uint8_t *sizes)
*
* @brief -------------------------------------------------
* encode_audio - encode raw audio data to the destination
@@ -393,13 +393,13 @@ avhuff_error avhuff_encoder::assemble_data(std::vector<UINT8> &buffer, bitmap_yu
* @return An avhuff_error.
*/
-avhuff_error avhuff_encoder::encode_audio(const UINT8 *source, int channels, int samples, UINT8 *dest, UINT8 *sizes)
+avhuff_error avhuff_encoder::encode_audio(const uint8_t *source, int channels, int samples, uint8_t *dest, uint8_t *sizes)
{
#if AVHUFF_USE_FLAC
// input data is big-endian; determine our platform endianness
- UINT16 be_test = 0;
- *(UINT8 *)&be_test = 1;
+ uint16_t be_test = 0;
+ *(uint8_t *)&be_test = 1;
bool swap_endian = (be_test == 1);
// set huffman tree size to 0xffff to indicate FLAC
@@ -412,11 +412,11 @@ avhuff_error avhuff_encoder::encode_audio(const UINT8 *source, int channels, int
{
// encode the data
m_flac_encoder.reset(dest, samples * 2);
- if (!m_flac_encoder.encode_interleaved(reinterpret_cast<const INT16 *>(source) + chnum * samples, samples, swap_endian))
+ if (!m_flac_encoder.encode_interleaved(reinterpret_cast<const int16_t *>(source) + chnum * samples, samples, swap_endian))
return AVHERR_COMPRESSION_ERROR;
// set the size for this channel
- UINT32 cursize = m_flac_encoder.finish();
+ uint32_t cursize = m_flac_encoder.finish();
sizes[chnum * 2 + 2] = cursize >> 8;
sizes[chnum * 2 + 3] = cursize;
dest += cursize;
@@ -426,7 +426,7 @@ avhuff_error avhuff_encoder::encode_audio(const UINT8 *source, int channels, int
// expand the delta buffer if needed
m_audiobuffer.resize(channels * samples * 2);
- UINT8 *deltabuf = m_audiobuffer;
+ uint8_t *deltabuf = m_audiobuffer;
// iterate over channels to compute deltas
m_audiohi_encoder.histo_reset();
@@ -434,13 +434,13 @@ avhuff_error avhuff_encoder::encode_audio(const UINT8 *source, int channels, int
for (int chnum = 0; chnum < channels; chnum++)
{
// extract audio data into hi and lo deltas stored in big-endian order
- INT16 prevsample = 0;
+ int16_t prevsample = 0;
for (int sampnum = 0; sampnum < samples; sampnum++)
{
- INT16 newsample = (source[0] << 8) | source[1];
+ int16_t newsample = (source[0] << 8) | source[1];
source += 2;
- INT16 delta = newsample - prevsample;
+ int16_t delta = newsample - prevsample;
prevsample = newsample;
m_audiohi_encoder.histo_one(*deltabuf++ = delta >> 8);
m_audiolo_encoder.histo_one(*deltabuf++ = delta);
@@ -466,17 +466,17 @@ avhuff_error avhuff_encoder::encode_audio(const UINT8 *source, int channels, int
return AVHERR_COMPRESSION_ERROR;
// note the size of the two trees
- UINT32 huffsize = bitbuf.flush();
+ uint32_t huffsize = bitbuf.flush();
sizes[0] = huffsize >> 8;
sizes[1] = huffsize;
// iterate over channels
- UINT32 totalsize = huffsize;
+ uint32_t totalsize = huffsize;
int chnum;
for (chnum = 0; chnum < channels; chnum++)
{
// encode the data
- const UINT8 *input = m_audiobuffer + chnum * samples * 2;
+ const uint8_t *input = m_audiobuffer + chnum * samples * 2;
for (int sampnum = 0; sampnum < samples; sampnum++)
{
m_audiohi_encoder.encode_one(bitbuf, *input++);
@@ -484,7 +484,7 @@ avhuff_error avhuff_encoder::encode_audio(const UINT8 *source, int channels, int
}
// store the size of this stream
- UINT32 cursize = bitbuf.flush() - totalsize;
+ uint32_t cursize = bitbuf.flush() - totalsize;
totalsize += cursize;
if (totalsize >= channels * samples * 2)
break;
@@ -496,7 +496,7 @@ avhuff_error avhuff_encoder::encode_audio(const UINT8 *source, int channels, int
if (chnum < channels)
{
memcpy(dest, m_audiobuffer, channels * samples * 2);
- UINT32 size = samples * 2;
+ uint32_t size = samples * 2;
sizes[0] = sizes[1] = 0;
for (chnum = 0; chnum < channels; chnum++)
{
@@ -511,7 +511,7 @@ avhuff_error avhuff_encoder::encode_audio(const UINT8 *source, int channels, int
}
/**
- * @fn avhuff_error avhuff_encoder::encode_video(const UINT8 *source, int width, int height, UINT8 *dest, UINT32 &complength)
+ * @fn avhuff_error avhuff_encoder::encode_video(const uint8_t *source, int width, int height, uint8_t *dest, uint32_t &complength)
*
* @brief -------------------------------------------------
* encode_video - encode raw video data to the destination
@@ -526,14 +526,14 @@ avhuff_error avhuff_encoder::encode_audio(const UINT8 *source, int channels, int
* @return An avhuff_error.
*/
-avhuff_error avhuff_encoder::encode_video(const UINT8 *source, int width, int height, UINT8 *dest, UINT32 &complength)
+avhuff_error avhuff_encoder::encode_video(const uint8_t *source, int width, int height, uint8_t *dest, uint32_t &complength)
{
// only lossless supported at this time
return encode_video_lossless(source, width, height, dest, complength);
}
/**
- * @fn avhuff_error avhuff_encoder::encode_video_lossless(const UINT8 *source, int width, int height, UINT8 *dest, UINT32 &complength)
+ * @fn avhuff_error avhuff_encoder::encode_video_lossless(const uint8_t *source, int width, int height, uint8_t *dest, uint32_t &complength)
*
* @brief -------------------------------------------------
* encode_video_lossless - do a lossless video encoding using deltas and huffman
@@ -549,16 +549,16 @@ avhuff_error avhuff_encoder::encode_video(const UINT8 *source, int width, int he
* @return An avhuff_error.
*/
-avhuff_error avhuff_encoder::encode_video_lossless(const UINT8 *source, int width, int height, UINT8 *dest, UINT32 &complength)
+avhuff_error avhuff_encoder::encode_video_lossless(const uint8_t *source, int width, int height, uint8_t *dest, uint32_t &complength)
{
// set up the output; first byte is 0x80 to indicate lossless encoding
bitstream_out bitbuf(dest, width * height * 2);
bitbuf.write(0x80, 8);
// compute the histograms for the data
- UINT16 *yrle = m_ycontext.rle_and_histo_bitmap(source + 0, width, 2, height);
- UINT16 *cbrle = m_cbcontext.rle_and_histo_bitmap(source + 1, width / 2, 4, height);
- UINT16 *crrle = m_crcontext.rle_and_histo_bitmap(source + 3, width / 2, 4, height);
+ uint16_t *yrle = m_ycontext.rle_and_histo_bitmap(source + 0, width, 2, height);
+ uint16_t *cbrle = m_cbcontext.rle_and_histo_bitmap(source + 1, width / 2, 4, height);
+ uint16_t *crrle = m_crcontext.rle_and_histo_bitmap(source + 3, width / 2, 4, height);
// export the trees to the data stream
huffman_error hufferr = m_ycontext.export_tree_rle(bitbuf);
@@ -575,12 +575,12 @@ avhuff_error avhuff_encoder::encode_video_lossless(const UINT8 *source, int widt
bitbuf.flush();
// encode the data using the trees
- for (UINT32 sy = 0; sy < height; sy++)
+ for (uint32_t sy = 0; sy < height; sy++)
{
m_ycontext.flush_rle();
m_cbcontext.flush_rle();
m_crcontext.flush_rle();
- for (UINT32 sx = 0; sx < width / 2; sx++)
+ for (uint32_t sx = 0; sx < width / 2; sx++)
{
m_ycontext.encode_one(bitbuf, yrle);
m_cbcontext.encode_one(bitbuf, cbrle);
@@ -601,7 +601,7 @@ avhuff_error avhuff_encoder::encode_video_lossless(const UINT8 *source, int widt
//**************************************************************************
/**
- * @fn UINT16 *avhuff_encoder::deltarle_encoder::rle_and_histo_bitmap(const UINT8 *source, UINT32 items_per_row, UINT32 item_advance, UINT32 row_count)
+ * @fn uint16_t *avhuff_encoder::deltarle_encoder::rle_and_histo_bitmap(const uint8_t *source, uint32_t items_per_row, uint32_t item_advance, uint32_t row_count)
*
* @brief -------------------------------------------------
* rle_and_histo_bitmap - RLE compress and histogram a bitmap's worth of data
@@ -612,25 +612,25 @@ avhuff_error avhuff_encoder::encode_video_lossless(const UINT8 *source, int widt
* @param item_advance The item advance.
* @param row_count Number of rows.
*
- * @return null if it fails, else an UINT16*.
+ * @return null if it fails, else an uint16_t*.
*/
-UINT16 *avhuff_encoder::deltarle_encoder::rle_and_histo_bitmap(const UINT8 *source, UINT32 items_per_row, UINT32 item_advance, UINT32 row_count)
+uint16_t *avhuff_encoder::deltarle_encoder::rle_and_histo_bitmap(const uint8_t *source, uint32_t items_per_row, uint32_t item_advance, uint32_t row_count)
{
// resize our RLE buffer
m_rlebuffer.resize(items_per_row * row_count);
- UINT16 *dest = &m_rlebuffer[0];
+ uint16_t *dest = &m_rlebuffer[0];
// iterate over rows
m_encoder.histo_reset();
- UINT8 prevdata = 0;
- for (UINT32 row = 0; row < row_count; row++)
+ uint8_t prevdata = 0;
+ for (uint32_t row = 0; row < row_count; row++)
{
- const UINT8 *end = source + items_per_row * item_advance;
+ const uint8_t *end = source + items_per_row * item_advance;
for ( ; source < end; source += item_advance)
{
// fetch current data
- UINT8 curdelta = *source - prevdata;
+ uint8_t curdelta = *source - prevdata;
prevdata = *source;
// 0 deltas scan forward for a count
@@ -639,7 +639,7 @@ UINT16 *avhuff_encoder::deltarle_encoder::rle_and_histo_bitmap(const UINT8 *sour
int zerocount = 1;
// count the number of consecutive values
- const UINT8 *scandata;
+ const uint8_t *scandata;
for (scandata = source + item_advance; scandata < end; scandata += item_advance)
if (*scandata == prevdata)
zerocount++;
@@ -712,7 +712,7 @@ void avhuff_decoder::configure(const avhuff_decompress_config &config)
}
/**
- * @fn avhuff_error avhuff_decoder::decode_data(const UINT8 *source, UINT32 complength, UINT8 *dest)
+ * @fn avhuff_error avhuff_decoder::decode_data(const uint8_t *source, uint32_t complength, uint8_t *dest)
*
* @brief -------------------------------------------------
* decode_data - decode both audio and video from a raw data stream
@@ -725,22 +725,22 @@ void avhuff_decoder::configure(const avhuff_decompress_config &config)
* @return An avhuff_error.
*/
-avhuff_error avhuff_decoder::decode_data(const UINT8 *source, UINT32 complength, UINT8 *dest)
+avhuff_error avhuff_decoder::decode_data(const uint8_t *source, uint32_t complength, uint8_t *dest)
{
// extract info from the header
if (complength < 8)
return AVHERR_INVALID_DATA;
- UINT32 metasize = source[0];
- UINT32 channels = source[1];
- UINT32 samples = (source[2] << 8) + source[3];
- UINT32 width = (source[4] << 8) + source[5];
- UINT32 height = (source[6] << 8) + source[7];
+ uint32_t metasize = source[0];
+ uint32_t channels = source[1];
+ uint32_t samples = (source[2] << 8) + source[3];
+ uint32_t width = (source[4] << 8) + source[5];
+ uint32_t height = (source[6] << 8) + source[7];
// validate that the sizes make sense
if (complength < 10 + 2 * channels)
return AVHERR_INVALID_DATA;
- UINT32 totalsize = 10 + 2 * channels;
- UINT32 treesize = (source[8] << 8) | source[9];
+ uint32_t totalsize = 10 + 2 * channels;
+ uint32_t treesize = (source[8] << 8) | source[9];
if (treesize != 0xffff)
totalsize += treesize;
for (int chnum = 0; chnum < channels; chnum++)
@@ -749,11 +749,11 @@ avhuff_error avhuff_decoder::decode_data(const UINT8 *source, UINT32 complength,
return AVHERR_INVALID_DATA;
// starting offsets
- UINT32 srcoffs = 10 + 2 * channels;
+ uint32_t srcoffs = 10 + 2 * channels;
// if we are decoding raw, set up the output parameters
- UINT8 *metastart, *videostart, *audiostart[16];
- UINT32 audioxor, videoxor, videostride;
+ uint8_t *metastart, *videostart, *audiostart[16];
+ uint32_t audioxor, videoxor, videostride;
if (dest != nullptr)
{
// create a header
@@ -792,13 +792,13 @@ avhuff_error avhuff_decoder::decode_data(const UINT8 *source, UINT32 complength,
// determine the start of each piece of data
metastart = m_config.metadata;
for (int chnum = 0; chnum < channels; chnum++)
- audiostart[chnum] = (UINT8 *)m_config.audio[chnum];
- videostart = (m_config.video.valid()) ? reinterpret_cast<UINT8 *>(&m_config.video.pix(0)) : nullptr;
+ audiostart[chnum] = (uint8_t *)m_config.audio[chnum];
+ videostart = (m_config.video.valid()) ? reinterpret_cast<uint8_t *>(&m_config.video.pix(0)) : nullptr;
videostride = (m_config.video.valid()) ? m_config.video.rowpixels() * 2 : 0;
// data is assumed to be native-endian
- UINT16 betest = 0;
- *(UINT8 *)&betest = 1;
+ uint16_t betest = 0;
+ *(uint8_t *)&betest = 1;
audioxor = videoxor = (betest == 1) ? 1 : 0;
// verify against sizes
@@ -853,7 +853,7 @@ avhuff_error avhuff_decoder::decode_data(const UINT8 *source, UINT32 complength,
}
/**
- * @fn avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const UINT8 *source, UINT8 **dest, UINT32 dxor, const UINT8 *sizes)
+ * @fn avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const uint8_t *source, uint8_t **dest, uint32_t dxor, const uint8_t *sizes)
*
* @brief -------------------------------------------------
* decode_audio - decode audio from a compressed data stream
@@ -872,10 +872,10 @@ avhuff_error avhuff_decoder::decode_data(const UINT8 *source, UINT32 complength,
* @return An avhuff_error.
*/
-avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const UINT8 *source, UINT8 **dest, UINT32 dxor, const UINT8 *sizes)
+avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const uint8_t *source, uint8_t **dest, uint32_t dxor, const uint8_t *sizes)
{
// extract the huffman trees
- UINT16 treesize = (sizes[0] << 8) | sizes[1];
+ uint16_t treesize = (sizes[0] << 8) | sizes[1];
#if AVHUFF_USE_FLAC
@@ -883,8 +883,8 @@ avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const UINT8
if (treesize == 0xffff)
{
// output data is big-endian; determine our platform endianness
- UINT16 be_test = 0;
- *(UINT8 *)&be_test = 1;
+ uint16_t be_test = 0;
+ *(uint8_t *)&be_test = 1;
bool swap_endian = (be_test == 1);
if (dxor != 0)
swap_endian = !swap_endian;
@@ -893,16 +893,16 @@ avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const UINT8
for (int chnum = 0; chnum < channels; chnum++)
{
// extract the size of this channel
- UINT16 size = (sizes[chnum * 2 + 2] << 8) | sizes[chnum * 2 + 3];
+ uint16_t size = (sizes[chnum * 2 + 2] << 8) | sizes[chnum * 2 + 3];
// only process if the data is requested
- UINT8 *curdest = dest[chnum];
+ uint8_t *curdest = dest[chnum];
if (curdest != nullptr)
{
// reset and decode
if (!m_flac_decoder.reset(48000, 1, samples, source, size))
throw CHDERR_DECOMPRESSION_ERROR;
- if (!m_flac_decoder.decode_interleaved(reinterpret_cast<INT16 *>(curdest), samples, swap_endian))
+ if (!m_flac_decoder.decode_interleaved(reinterpret_cast<int16_t *>(curdest), samples, swap_endian))
throw CHDERR_DECOMPRESSION_ERROR;
// finish up
@@ -937,24 +937,24 @@ avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const UINT8
for (int chnum = 0; chnum < channels; chnum++)
{
// extract the size of this channel
- UINT16 size = (sizes[chnum * 2 + 2] << 8) | sizes[chnum * 2 + 3];
+ uint16_t size = (sizes[chnum * 2 + 2] << 8) | sizes[chnum * 2 + 3];
// only process if the data is requested
- UINT8 *curdest = dest[chnum];
+ uint8_t *curdest = dest[chnum];
if (curdest != nullptr)
{
- INT16 prevsample = 0;
+ int16_t prevsample = 0;
// if no huffman length, just copy the data
if (treesize == 0)
{
- const UINT8 *cursource = source;
+ const uint8_t *cursource = source;
for (int sampnum = 0; sampnum < samples; sampnum++)
{
- INT16 delta = (cursource[0] << 8) | cursource[1];
+ int16_t delta = (cursource[0] << 8) | cursource[1];
cursource += 2;
- INT16 newsample = prevsample + delta;
+ int16_t newsample = prevsample + delta;
prevsample = newsample;
curdest[0 ^ dxor] = newsample >> 8;
@@ -969,10 +969,10 @@ avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const UINT8
bitstream_in bitbuf(source, size);
for (int sampnum = 0; sampnum < samples; sampnum++)
{
- INT16 delta = m_audiohi_decoder.decode_one(bitbuf) << 8;
+ int16_t delta = m_audiohi_decoder.decode_one(bitbuf) << 8;
delta |= m_audiolo_decoder.decode_one(bitbuf);
- INT16 newsample = prevsample + delta;
+ int16_t newsample = prevsample + delta;
prevsample = newsample;
curdest[0 ^ dxor] = newsample >> 8;
@@ -991,7 +991,7 @@ avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const UINT8
}
/**
- * @fn avhuff_error avhuff_decoder::decode_video(int width, int height, const UINT8 *source, UINT32 complength, UINT8 *dest, UINT32 dstride, UINT32 dxor)
+ * @fn avhuff_error avhuff_decoder::decode_video(int width, int height, const uint8_t *source, uint32_t complength, uint8_t *dest, uint32_t dstride, uint32_t dxor)
*
* @brief -------------------------------------------------
* decode_video - decode video from a compressed data stream
@@ -1008,7 +1008,7 @@ avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const UINT8
* @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)
+avhuff_error avhuff_decoder::decode_video(int width, int height, const uint8_t *source, uint32_t complength, uint8_t *dest, uint32_t dstride, uint32_t dxor)
{
// if the high bit of the first byte is set, we decode losslessly
if (source[0] & 0x80)
@@ -1018,7 +1018,7 @@ avhuff_error avhuff_decoder::decode_video(int width, int height, const UINT8 *so
}
/**
- * @fn avhuff_error avhuff_decoder::decode_video_lossless(int width, int height, const UINT8 *source, UINT32 complength, UINT8 *dest, UINT32 dstride, UINT32 dxor)
+ * @fn avhuff_error avhuff_decoder::decode_video_lossless(int width, int height, const uint8_t *source, uint32_t complength, uint8_t *dest, uint32_t dstride, uint32_t dxor)
*
* @brief -------------------------------------------------
* decode_video_lossless - do a lossless video decoding using deltas and huffman
@@ -1036,7 +1036,7 @@ avhuff_error avhuff_decoder::decode_video(int width, int height, const UINT8 *so
* @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)
+avhuff_error avhuff_decoder::decode_video_lossless(int width, int height, const uint8_t *source, uint32_t complength, uint8_t *dest, uint32_t dstride, uint32_t dxor)
{
// skip the first byte
bitstream_in bitbuf(source, complength);
@@ -1060,10 +1060,10 @@ avhuff_error avhuff_decoder::decode_video_lossless(int width, int height, const
m_ycontext.reset();
m_cbcontext.reset();
m_crcontext.reset();
- for (UINT32 dy = 0; dy < height; dy++)
+ for (uint32_t dy = 0; dy < height; dy++)
{
- UINT8 *row = dest + dy * dstride;
- for (UINT32 dx = 0; dx < width / 2; dx++)
+ uint8_t *row = dest + dy * dstride;
+ for (uint32_t dx = 0; dx < width / 2; dx++)
{
row[0 ^ dxor] = m_ycontext.decode_one(bitbuf);
row[1 ^ dxor] = m_cbcontext.decode_one(bitbuf);
diff --git a/src/lib/util/avhuff.h b/src/lib/util/avhuff.h
index ca1bd4cec49..9d00ed423e6 100644
--- a/src/lib/util/avhuff.h
+++ b/src/lib/util/avhuff.h
@@ -66,12 +66,12 @@ public:
}
bitmap_yuy16 video; // pointer to video bitmap
- UINT32 maxsamples; // maximum number of samples per channel
- UINT32 * actsamples; // actual number of samples per channel
- INT16 * audio[16]; // pointer to individual audio channels
- UINT32 maxmetalength; // maximum length of metadata
- UINT32 * actmetalength; // actual length of metadata
- UINT8 * metadata; // pointer to metadata buffer
+ uint32_t maxsamples; // maximum number of samples per channel
+ uint32_t * actsamples; // actual number of samples per channel
+ int16_t * audio[16]; // pointer to individual audio channels
+ uint32_t maxmetalength; // maximum length of metadata
+ uint32_t * actmetalength; // actual length of metadata
+ uint8_t * metadata; // pointer to metadata buffer
};
@@ -85,12 +85,12 @@ public:
avhuff_encoder();
// encode/decode
- avhuff_error encode_data(const UINT8 *source, UINT8 *dest, UINT32 &complength);
+ avhuff_error encode_data(const uint8_t *source, uint8_t *dest, uint32_t &complength);
// static helpers
- static UINT32 raw_data_size(const UINT8 *data);
- static UINT32 raw_data_size(UINT32 width, UINT32 height, UINT8 channels, UINT32 numsamples, UINT32 metadatasize = 0) { return 12 + channels * numsamples * 2 + width * height * 2; }
- static avhuff_error assemble_data(std::vector<UINT8> &buffer, bitmap_yuy16 &bitmap, UINT8 channels, UINT32 numsamples, INT16 **samples, UINT8 *metadata = nullptr, UINT32 metadatasize = 0);
+ static uint32_t raw_data_size(const uint8_t *data);
+ static uint32_t raw_data_size(uint32_t width, uint32_t height, uint8_t channels, uint32_t numsamples, uint32_t metadatasize = 0) { return 12 + channels * numsamples * 2 + width * height * 2; }
+ static avhuff_error assemble_data(std::vector<uint8_t> &buffer, bitmap_yuy16 &bitmap, uint8_t channels, uint32_t numsamples, int16_t **samples, uint8_t *metadata = nullptr, uint32_t metadatasize = 0);
private:
// delta-RLE Huffman encoder
@@ -102,24 +102,24 @@ private:
: m_rlecount(0) { }
// histogramming
- UINT16 *rle_and_histo_bitmap(const UINT8 *source, UINT32 items_per_row, UINT32 item_advance, UINT32 row_count);
+ uint16_t *rle_and_histo_bitmap(const uint8_t *source, uint32_t items_per_row, uint32_t item_advance, uint32_t row_count);
// encoding
void flush_rle() { m_rlecount = 0; }
- void encode_one(bitstream_out &bitbuf, UINT16 *&rleptr);
+ void encode_one(bitstream_out &bitbuf, uint16_t *&rleptr);
huffman_error export_tree_rle(bitstream_out &bitbuf) { return m_encoder.export_tree_rle(bitbuf); }
private:
// internal state
int m_rlecount;
huffman_encoder<256 + 16> m_encoder;
- std::vector<UINT16> m_rlebuffer;
+ std::vector<uint16_t> m_rlebuffer;
};
// internal helpers
- avhuff_error encode_audio(const UINT8 *source, int channels, int samples, UINT8 *dest, UINT8 *sizes);
- avhuff_error encode_video(const UINT8 *source, int width, int height, UINT8 *dest, UINT32 &complength);
- avhuff_error encode_video_lossless(const UINT8 *source, int width, int height, UINT8 *dest, UINT32 &complength);
+ avhuff_error encode_audio(const uint8_t *source, int channels, int samples, uint8_t *dest, uint8_t *sizes);
+ avhuff_error encode_video(const uint8_t *source, int width, int height, uint8_t *dest, uint32_t &complength);
+ avhuff_error encode_video_lossless(const uint8_t *source, int width, int height, uint8_t *dest, uint32_t &complength);
// video encoding contexts
deltarle_encoder m_ycontext;
@@ -127,7 +127,7 @@ private:
deltarle_encoder m_crcontext;
// audio encoding contexts
- std::vector<UINT8> m_audiobuffer;
+ std::vector<uint8_t> m_audiobuffer;
#if AVHUFF_USE_FLAC
flac_encoder m_flac_encoder;
#else
@@ -150,7 +150,7 @@ public:
void configure(const avhuff_decompress_config &config);
// encode/decode
- avhuff_error decode_data(const UINT8 *source, UINT32 complength, UINT8 *dest);
+ avhuff_error decode_data(const uint8_t *source, uint32_t complength, uint8_t *dest);
private:
// delta-RLE Huffman decoder
@@ -166,21 +166,21 @@ private:
// decoding
void flush_rle() { m_rlecount = 0; }
- UINT32 decode_one(bitstream_in &bitbuf);
+ uint32_t decode_one(bitstream_in &bitbuf);
huffman_error import_tree_rle(bitstream_in &bitbuf) { return m_decoder.import_tree_rle(bitbuf); }
private:
// internal state
int m_rlecount;
- UINT8 m_prevdata;
+ uint8_t m_prevdata;
huffman_decoder<256 + 16> m_decoder;
};
// internal helpers
- avhuff_error decode_audio(int channels, int samples, const UINT8 *source, UINT8 **dest, UINT32 dxor, const UINT8 *sizes);
- avhuff_error decode_video(int width, int height, const UINT8 *source, UINT32 complength, UINT8 *dest, UINT32 dstride, UINT32 dxor);
- avhuff_error decode_video_lossless(int width, int height, const UINT8 *source, UINT32 complength, UINT8 *dest, UINT32 dstride, UINT32 dxor);
+ avhuff_error decode_audio(int channels, int samples, const uint8_t *source, uint8_t **dest, uint32_t dxor, const uint8_t *sizes);
+ avhuff_error decode_video(int width, int height, const uint8_t *source, uint32_t complength, uint8_t *dest, uint32_t dstride, uint32_t dxor);
+ avhuff_error decode_video_lossless(int width, int height, const uint8_t *source, uint32_t complength, uint8_t *dest, uint32_t dstride, uint32_t dxor);
// internal state
avhuff_decompress_config m_config;
diff --git a/src/lib/util/bitmap.cpp b/src/lib/util/bitmap.cpp
index 2436e474136..b70d7ce1c8b 100644
--- a/src/lib/util/bitmap.cpp
+++ b/src/lib/util/bitmap.cpp
@@ -21,9 +21,9 @@
//**************************************************************************
/** @brief alignment values; 128 bytes is the largest cache line on typical architectures today. */
-const UINT32 BITMAP_OVERALL_ALIGN = 128;
+const uint32_t BITMAP_OVERALL_ALIGN = 128;
/** @brief The bitmap rowbytes align. */
-const UINT32 BITMAP_ROWBYTES_ALIGN = 128;
+const uint32_t BITMAP_ROWBYTES_ALIGN = 128;
@@ -36,7 +36,7 @@ const UINT32 BITMAP_ROWBYTES_ALIGN = 128;
// rowpixels value
//-------------------------------------------------
-inline INT32 bitmap_t::compute_rowpixels(int width, int xslop)
+inline int32_t bitmap_t::compute_rowpixels(int width, int xslop)
{
int rowpixels_align = BITMAP_ROWBYTES_ALIGN / (m_bpp / 8);
return ((width + 2 * xslop + (rowpixels_align - 1)) / rowpixels_align) * rowpixels_align;
@@ -51,7 +51,7 @@ inline INT32 bitmap_t::compute_rowpixels(int width, int xslop)
inline void bitmap_t::compute_base(int xslop, int yslop)
{
m_base = m_alloc + (m_rowpixels * yslop + xslop) * (m_bpp / 8);
- UINT64 aligned_base = ((reinterpret_cast<UINT64>(m_base) + (BITMAP_OVERALL_ALIGN - 1)) / BITMAP_OVERALL_ALIGN) * BITMAP_OVERALL_ALIGN;
+ uint64_t aligned_base = ((reinterpret_cast<uint64_t>(m_base) + (BITMAP_OVERALL_ALIGN - 1)) / BITMAP_OVERALL_ALIGN) * BITMAP_OVERALL_ALIGN;
m_base = reinterpret_cast<void *>(aligned_base);
}
@@ -191,7 +191,7 @@ void bitmap_t::allocate(int width, int height, int xslop, int yslop)
// allocate memory for the bitmap itself
m_allocbytes = m_rowpixels * (m_height + 2 * yslop) * m_bpp / 8;
m_allocbytes += BITMAP_OVERALL_ALIGN - 1;
- m_alloc = new UINT8[m_allocbytes];
+ m_alloc = new uint8_t[m_allocbytes];
// clear to 0 by default
memset(m_alloc, 0, m_allocbytes);
@@ -225,7 +225,7 @@ void bitmap_t::resize(int width, int height, int xslop, int yslop)
// determine how much memory we need for the new bitmap
int new_rowpixels = compute_rowpixels(width, xslop);
- UINT32 new_allocbytes = new_rowpixels * (height + 2 * yslop) * m_bpp / 8;
+ uint32_t new_allocbytes = new_rowpixels * (height + 2 * yslop) * m_bpp / 8;
new_allocbytes += BITMAP_OVERALL_ALIGN - 1;
// if we need more memory, just realloc
@@ -354,7 +354,7 @@ void bitmap_t::set_palette(palette_t *palette)
}
/**
- * @fn void bitmap_t::fill(UINT32 color, const rectangle &cliprect)
+ * @fn void bitmap_t::fill(uint32_t color, const rectangle &cliprect)
*
* @brief -------------------------------------------------
* fill -- fill a bitmap with a solid color
@@ -364,7 +364,7 @@ void bitmap_t::set_palette(palette_t *palette)
* @param cliprect The cliprect.
*/
-void bitmap_t::fill(UINT32 color, const rectangle &cliprect)
+void bitmap_t::fill(uint32_t color, const rectangle &cliprect)
{
// if we have a cliprect, intersect with that
rectangle fill = cliprect;
@@ -377,29 +377,29 @@ void bitmap_t::fill(UINT32 color, const rectangle &cliprect)
{
case 8:
// 8bpp always uses memset
- for (INT32 y = fill.min_y; y <= fill.max_y; y++)
- memset(raw_pixptr(y, fill.min_x), (UINT8)color, fill.width());
+ for (int32_t y = fill.min_y; y <= fill.max_y; y++)
+ memset(raw_pixptr(y, fill.min_x), (uint8_t)color, fill.width());
break;
case 16:
// 16bpp can use memset if the bytes are equal
- if ((UINT8)(color >> 8) == (UINT8)color)
+ if ((uint8_t)(color >> 8) == (uint8_t)color)
{
- for (INT32 y = fill.min_y; y <= fill.max_y; y++)
- memset(raw_pixptr(y, fill.min_x), (UINT8)color, fill.width() * 2);
+ for (int32_t y = fill.min_y; y <= fill.max_y; y++)
+ memset(raw_pixptr(y, fill.min_x), (uint8_t)color, fill.width() * 2);
}
else
{
// Fill the first line the hard way
- UINT16 *destrow = &pixt<UINT16>(fill.min_y);
- for (INT32 x = fill.min_x; x <= fill.max_x; x++)
- destrow[x] = (UINT16)color;
+ uint16_t *destrow = &pixt<uint16_t>(fill.min_y);
+ for (int32_t x = fill.min_x; x <= fill.max_x; x++)
+ destrow[x] = (uint16_t)color;
// For the other lines, just copy the first one
- void *destrow0 = &pixt<UINT16>(fill.min_y, fill.min_x);
- for (INT32 y = fill.min_y + 1; y <= fill.max_y; y++)
+ void *destrow0 = &pixt<uint16_t>(fill.min_y, fill.min_x);
+ for (int32_t y = fill.min_y + 1; y <= fill.max_y; y++)
{
- destrow = &pixt<UINT16>(y, fill.min_x);
+ destrow = &pixt<uint16_t>(y, fill.min_x);
memcpy(destrow, destrow0, fill.width() * 2);
}
}
@@ -407,23 +407,23 @@ void bitmap_t::fill(UINT32 color, const rectangle &cliprect)
case 32:
// 32bpp can use memset if the bytes are equal
- if ((UINT8)(color >> 8) == (UINT8)color && (UINT16)(color >> 16) == (UINT16)color)
+ if ((uint8_t)(color >> 8) == (uint8_t)color && (uint16_t)(color >> 16) == (uint16_t)color)
{
- for (INT32 y = fill.min_y; y <= fill.max_y; y++)
- memset(&pixt<UINT32>(y, fill.min_x), (UINT8)color, fill.width() * 4);
+ for (int32_t y = fill.min_y; y <= fill.max_y; y++)
+ memset(&pixt<uint32_t>(y, fill.min_x), (uint8_t)color, fill.width() * 4);
}
else
{
// Fill the first line the hard way
- UINT32 *destrow = &pixt<UINT32>(fill.min_y);
- for (INT32 x = fill.min_x; x <= fill.max_x; x++)
- destrow[x] = (UINT32)color;
+ uint32_t *destrow = &pixt<uint32_t>(fill.min_y);
+ for (int32_t x = fill.min_x; x <= fill.max_x; x++)
+ destrow[x] = (uint32_t)color;
// For the other lines, just copy the first one
- UINT32 *destrow0 = &pixt<UINT32>(fill.min_y, fill.min_x);
- for (INT32 y = fill.min_y + 1; y <= fill.max_y; y++)
+ uint32_t *destrow0 = &pixt<uint32_t>(fill.min_y, fill.min_x);
+ for (int32_t y = fill.min_y + 1; y <= fill.max_y; y++)
{
- destrow = &pixt<UINT32>(y, fill.min_x);
+ destrow = &pixt<uint32_t>(y, fill.min_x);
memcpy(destrow, destrow0, fill.width() * 4);
}
}
@@ -431,23 +431,23 @@ void bitmap_t::fill(UINT32 color, const rectangle &cliprect)
case 64:
// 64bpp can use memset if the bytes are equal
- if ((UINT8)(color >> 8) == (UINT8)color && (UINT16)(color >> 16) == (UINT16)color)
+ if ((uint8_t)(color >> 8) == (uint8_t)color && (uint16_t)(color >> 16) == (uint16_t)color)
{
- for (INT32 y = fill.min_y; y <= fill.max_y; y++)
- memset(&pixt<UINT64>(y, fill.min_x), (UINT8)color, fill.width() * 8);
+ for (int32_t y = fill.min_y; y <= fill.max_y; y++)
+ memset(&pixt<uint64_t>(y, fill.min_x), (uint8_t)color, fill.width() * 8);
}
else
{
// Fill the first line the hard way
- UINT64 *destrow = &pixt<UINT64>(fill.min_y);
- for (INT32 x = fill.min_x; x <= fill.max_x; x++)
- destrow[x] = (UINT64)color;
+ uint64_t *destrow = &pixt<uint64_t>(fill.min_y);
+ for (int32_t x = fill.min_x; x <= fill.max_x; x++)
+ destrow[x] = (uint64_t)color;
// For the other lines, just copy the first one
- UINT64 *destrow0 = &pixt<UINT64>(fill.min_y, fill.min_x);
- for (INT32 y = fill.min_y + 1; y <= fill.max_y; y++)
+ uint64_t *destrow0 = &pixt<uint64_t>(fill.min_y, fill.min_x);
+ for (int32_t y = fill.min_y + 1; y <= fill.max_y; y++)
{
- destrow = &pixt<UINT64>(y, fill.min_x);
+ destrow = &pixt<uint64_t>(y, fill.min_x);
memcpy(destrow, destrow0, fill.width() * 8);
}
}
diff --git a/src/lib/util/bitmap.h b/src/lib/util/bitmap.h
index 23d05af90df..7d367bcb5cb 100644
--- a/src/lib/util/bitmap.h
+++ b/src/lib/util/bitmap.h
@@ -45,14 +45,14 @@ public:
// construction/destruction
rectangle()
: min_x(0), max_x(0), min_y(0), max_y(0) { }
- rectangle(INT32 minx, INT32 maxx, INT32 miny, INT32 maxy)
+ rectangle(int32_t minx, int32_t maxx, int32_t miny, int32_t maxy)
: min_x(minx), max_x(maxx), min_y(miny), max_y(maxy) { }
// getters
- INT32 left() const { return min_x; }
- INT32 right() const { return max_x; }
- INT32 top() const { return min_y; }
- INT32 bottom() const { return max_y; }
+ int32_t left() const { return min_x; }
+ int32_t right() const { return max_x; }
+ int32_t top() const { return min_y; }
+ int32_t bottom() const { return max_y; }
// compute intersection with another rect
rectangle &operator&=(const rectangle &src)
@@ -84,32 +84,32 @@ public:
// other helpers
bool empty() const { return (min_x > max_x || min_y > max_y); }
- bool contains(INT32 x, INT32 y) const { return (x >= min_x && x <= max_x && y >= min_y && y <= max_y); }
+ bool contains(int32_t x, int32_t y) const { return (x >= min_x && x <= max_x && y >= min_y && y <= max_y); }
bool contains(const rectangle &rect) const { return (min_x <= rect.min_x && max_x >= rect.max_x && min_y <= rect.min_y && max_y >= rect.max_y); }
- INT32 width() const { return max_x + 1 - min_x; }
- INT32 height() const { return max_y + 1 - min_y; }
- INT32 xcenter() const { return (min_x + max_x + 1) / 2; }
- INT32 ycenter() const { return (min_y + max_y + 1) / 2; }
+ int32_t width() const { return max_x + 1 - min_x; }
+ int32_t height() const { return max_y + 1 - min_y; }
+ int32_t xcenter() const { return (min_x + max_x + 1) / 2; }
+ int32_t ycenter() const { return (min_y + max_y + 1) / 2; }
// setters
- void set(INT32 minx, INT32 maxx, INT32 miny, INT32 maxy) { min_x = minx; max_x = maxx; min_y = miny; max_y = maxy; }
- void setx(INT32 minx, INT32 maxx) { min_x = minx; max_x = maxx; }
- void sety(INT32 miny, INT32 maxy) { min_y = miny; max_y = maxy; }
- void set_width(INT32 width) { max_x = min_x + width - 1; }
- void set_height(INT32 height) { max_y = min_y + height - 1; }
- void set_origin(INT32 x, INT32 y) { max_x += x - min_x; max_y += y - min_y; min_x = x; min_y = y; }
- void set_size(INT32 width, INT32 height) { set_width(width); set_height(height); }
+ void set(int32_t minx, int32_t maxx, int32_t miny, int32_t maxy) { min_x = minx; max_x = maxx; min_y = miny; max_y = maxy; }
+ void setx(int32_t minx, int32_t maxx) { min_x = minx; max_x = maxx; }
+ void sety(int32_t miny, int32_t maxy) { min_y = miny; max_y = maxy; }
+ void set_width(int32_t width) { max_x = min_x + width - 1; }
+ void set_height(int32_t height) { max_y = min_y + height - 1; }
+ void set_origin(int32_t x, int32_t y) { max_x += x - min_x; max_y += y - min_y; min_x = x; min_y = y; }
+ void set_size(int32_t width, int32_t height) { set_width(width); set_height(height); }
// offset helpers
- void offset(INT32 xdelta, INT32 ydelta) { min_x += xdelta; max_x += xdelta; min_y += ydelta; max_y += ydelta; }
- void offsetx(INT32 delta) { min_x += delta; max_x += delta; }
- void offsety(INT32 delta) { min_y += delta; max_y += delta; }
+ void offset(int32_t xdelta, int32_t ydelta) { min_x += xdelta; max_x += xdelta; min_y += ydelta; max_y += ydelta; }
+ void offsetx(int32_t delta) { min_x += delta; max_x += delta; }
+ void offsety(int32_t delta) { min_y += delta; max_y += delta; }
// internal state
- INT32 min_x; // minimum X, or left coordinate
- INT32 max_x; // maximum X, or right coordinate (inclusive)
- INT32 min_y; // minimum Y, or top coordinate
- INT32 max_y; // maximum Y, or bottom coordinate (inclusive)
+ int32_t min_x; // minimum X, or left coordinate
+ int32_t max_x; // maximum X, or right coordinate (inclusive)
+ int32_t min_y; // minimum Y, or top coordinate
+ int32_t max_y; // maximum Y, or bottom coordinate (inclusive)
};
@@ -135,11 +135,11 @@ public:
void reset();
// getters
- INT32 width() const { return m_width; }
- INT32 height() const { return m_height; }
- INT32 rowpixels() const { return m_rowpixels; }
- INT32 rowbytes() const { return m_rowpixels * m_bpp / 8; }
- UINT8 bpp() const { return m_bpp; }
+ int32_t width() const { return m_width; }
+ int32_t height() const { return m_height; }
+ int32_t rowpixels() const { return m_rowpixels; }
+ int32_t rowbytes() const { return m_rowpixels * m_bpp / 8; }
+ uint8_t bpp() const { return m_bpp; }
bitmap_format format() const { return m_format; }
bool valid() const { return (m_base != nullptr); }
palette_t *palette() const { return m_palette; }
@@ -151,9 +151,9 @@ public:
// operations
void set_palette(palette_t *palette);
- void fill(UINT32 color) { fill(color, m_cliprect); }
- void fill(UINT32 color, const rectangle &cliprect);
- void plot_box(int x, int y, int width, int height, UINT32 color)
+ void fill(uint32_t color) { fill(color, m_cliprect); }
+ void fill(uint32_t color, const rectangle &cliprect);
+ void plot_box(int x, int y, int width, int height, uint32_t color)
{
rectangle clip(x, x + width - 1, y, y + height - 1);
fill(color, clip);
@@ -161,8 +161,8 @@ public:
// pixel access
template<typename _PixelType>
- _PixelType &pixt(INT32 y, INT32 x = 0) const { return *(reinterpret_cast<_PixelType *>(m_base) + y * m_rowpixels + x); }
- void *raw_pixptr(INT32 y, INT32 x = 0) const { return reinterpret_cast<UINT8 *>(m_base) + (y * m_rowpixels + x) * m_bpp / 8; }
+ _PixelType &pixt(int32_t y, int32_t x = 0) const { return *(reinterpret_cast<_PixelType *>(m_base) + y * m_rowpixels + x); }
+ void *raw_pixptr(int32_t y, int32_t x = 0) const { return reinterpret_cast<uint8_t *>(m_base) + (y * m_rowpixels + x) * m_bpp / 8; }
protected:
// for use by subclasses only to ensure type correctness
@@ -171,18 +171,18 @@ protected:
private:
// internal helpers
- INT32 compute_rowpixels(int width, int xslop);
+ int32_t compute_rowpixels(int width, int xslop);
void compute_base(int xslop, int yslop);
// internal state
- UINT8 * m_alloc; // pointer to allocated pixel memory
- UINT32 m_allocbytes; // size of our allocation
+ uint8_t * m_alloc; // pointer to allocated pixel memory
+ uint32_t m_allocbytes; // size of our allocation
void * m_base; // pointer to pixel (0,0) (adjusted for padding)
- INT32 m_rowpixels; // pixels per row (including padding)
- INT32 m_width; // width of the bitmap
- INT32 m_height; // height of the bitmap
+ int32_t m_rowpixels; // pixels per row (including padding)
+ int32_t m_width; // width of the bitmap
+ int32_t m_height; // height of the bitmap
bitmap_format m_format; // format of the bitmap
- UINT8 m_bpp; // bits per pixel
+ uint8_t m_bpp; // bits per pixel
palette_t * m_palette; // optional palette
rectangle m_cliprect; // a clipping rectangle covering the full bitmap
};
@@ -200,17 +200,17 @@ private:
protected:
// construction/destruction -- subclasses only
bitmap8_t(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, 8, width, height, xslop, yslop) { }
- bitmap8_t(bitmap_format format, UINT8 *base, int width, int height, int rowpixels) : bitmap_t(format, 8, base, width, height, rowpixels) { assert(valid_format(format)); }
+ bitmap8_t(bitmap_format format, uint8_t *base, int width, int height, int rowpixels) : bitmap_t(format, 8, base, width, height, rowpixels) { assert(valid_format(format)); }
bitmap8_t(bitmap_format format, bitmap8_t &source, const rectangle &subrect) : bitmap_t(format, 8, source, subrect) { }
public:
// getters
- UINT8 bpp() const { return 8; }
+ uint8_t bpp() const { return 8; }
// pixel accessors
- typedef UINT8 pixel_t;
- pixel_t &pix(INT32 y, INT32 x = 0) const { return pixt<pixel_t>(y, x); }
- pixel_t &pix8(INT32 y, INT32 x = 0) const { return pixt<pixel_t>(y, x); }
+ typedef uint8_t pixel_t;
+ pixel_t &pix(int32_t y, int32_t x = 0) const { return pixt<pixel_t>(y, x); }
+ pixel_t &pix8(int32_t y, int32_t x = 0) const { return pixt<pixel_t>(y, x); }
};
// 16bpp bitmaps
@@ -223,17 +223,17 @@ private:
protected:
// construction/destruction -- subclasses only
bitmap16_t(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, 16, width, height, xslop, yslop) { assert(valid_format(format)); }
- bitmap16_t(bitmap_format format, UINT16 *base, int width, int height, int rowpixels) : bitmap_t(format, 16, base, width, height, rowpixels) { assert(valid_format(format)); }
+ bitmap16_t(bitmap_format format, uint16_t *base, int width, int height, int rowpixels) : bitmap_t(format, 16, base, width, height, rowpixels) { assert(valid_format(format)); }
bitmap16_t(bitmap_format format, bitmap16_t &source, const rectangle &subrect) : bitmap_t(format, 16, source, subrect) { }
public:
// getters
- UINT8 bpp() const { return 16; }
+ uint8_t bpp() const { return 16; }
// pixel accessors
- typedef UINT16 pixel_t;
- pixel_t &pix(INT32 y, INT32 x = 0) const { return pixt<pixel_t>(y, x); }
- pixel_t &pix16(INT32 y, INT32 x = 0) const { return pixt<pixel_t>(y, x); }
+ typedef uint16_t pixel_t;
+ pixel_t &pix(int32_t y, int32_t x = 0) const { return pixt<pixel_t>(y, x); }
+ pixel_t &pix16(int32_t y, int32_t x = 0) const { return pixt<pixel_t>(y, x); }
};
// 32bpp bitmaps
@@ -246,17 +246,17 @@ private:
protected:
// construction/destruction -- subclasses only
bitmap32_t(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, 32, width, height, xslop, yslop) { assert(valid_format(format)); }
- bitmap32_t(bitmap_format format, UINT32 *base, int width, int height, int rowpixels) : bitmap_t(format, 32, base, width, height, rowpixels) { assert(valid_format(format)); }
+ bitmap32_t(bitmap_format format, uint32_t *base, int width, int height, int rowpixels) : bitmap_t(format, 32, base, width, height, rowpixels) { assert(valid_format(format)); }
bitmap32_t(bitmap_format format, bitmap32_t &source, const rectangle &subrect) : bitmap_t(format, 32, source, subrect) { }
public:
// getters
- UINT8 bpp() const { return 32; }
+ uint8_t bpp() const { return 32; }
// pixel accessors
- typedef UINT32 pixel_t;
- pixel_t &pix(INT32 y, INT32 x = 0) const { return pixt<pixel_t>(y, x); }
- pixel_t &pix32(INT32 y, INT32 x = 0) const { return pixt<pixel_t>(y, x); }
+ typedef uint32_t pixel_t;
+ pixel_t &pix(int32_t y, int32_t x = 0) const { return pixt<pixel_t>(y, x); }
+ pixel_t &pix32(int32_t y, int32_t x = 0) const { return pixt<pixel_t>(y, x); }
};
// 64bpp bitmaps
@@ -269,17 +269,17 @@ private:
protected:
// construction/destruction -- subclasses only
bitmap64_t(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, 64, width, height, xslop, yslop) { assert(valid_format(format)); }
- bitmap64_t(bitmap_format format, UINT64 *base, int width, int height, int rowpixels) : bitmap_t(format, 64, base, width, height, rowpixels) { assert(valid_format(format)); }
+ bitmap64_t(bitmap_format format, uint64_t *base, int width, int height, int rowpixels) : bitmap_t(format, 64, base, width, height, rowpixels) { assert(valid_format(format)); }
bitmap64_t(bitmap_format format, bitmap64_t &source, const rectangle &subrect) : bitmap_t(format, 64, source, subrect) { }
public:
// getters
- UINT8 bpp() const { return 64; }
+ uint8_t bpp() const { return 64; }
// pixel accessors
- typedef UINT64 pixel_t;
- pixel_t &pix(INT32 y, INT32 x = 0) const { return pixt<pixel_t>(y, x); }
- pixel_t &pix64(INT32 y, INT32 x = 0) const { return pixt<pixel_t>(y, x); }
+ typedef uint64_t pixel_t;
+ pixel_t &pix(int32_t y, int32_t x = 0) const { return pixt<pixel_t>(y, x); }
+ pixel_t &pix64(int32_t y, int32_t x = 0) const { return pixt<pixel_t>(y, x); }
};
@@ -293,9 +293,9 @@ class bitmap_ind8 : public bitmap8_t
public:
// construction/destruction
bitmap_ind8(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap8_t(k_bitmap_format, width, height, xslop, yslop) { }
- bitmap_ind8(UINT8 *base, int width, int height, int rowpixels) : bitmap8_t(k_bitmap_format, base, width, height, rowpixels) { }
+ bitmap_ind8(uint8_t *base, int width, int height, int rowpixels) : bitmap8_t(k_bitmap_format, base, width, height, rowpixels) { }
bitmap_ind8(bitmap_ind8 &source, const rectangle &subrect) : bitmap8_t(k_bitmap_format, source, subrect) { }
- void wrap(UINT8 *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); }
+ void wrap(uint8_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); }
void wrap(const bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); }
// getters
@@ -310,9 +310,9 @@ class bitmap_ind16 : public bitmap16_t
public:
// construction/destruction
bitmap_ind16(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap16_t(k_bitmap_format, width, height, xslop, yslop) { }
- bitmap_ind16(UINT16 *base, int width, int height, int rowpixels) : bitmap16_t(k_bitmap_format, base, width, height, rowpixels) { }
+ bitmap_ind16(uint16_t *base, int width, int height, int rowpixels) : bitmap16_t(k_bitmap_format, base, width, height, rowpixels) { }
bitmap_ind16(bitmap_ind16 &source, const rectangle &subrect) : bitmap16_t(k_bitmap_format, source, subrect) { }
- void wrap(UINT16 *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); }
+ void wrap(uint16_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); }
void wrap(const bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); }
// getters
@@ -327,9 +327,9 @@ class bitmap_ind32 : public bitmap32_t
public:
// construction/destruction
bitmap_ind32(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap32_t(k_bitmap_format, width, height, xslop, yslop) { }
- bitmap_ind32(UINT32 *base, int width, int height, int rowpixels) : bitmap32_t(k_bitmap_format, base, width, height, rowpixels) { }
+ bitmap_ind32(uint32_t *base, int width, int height, int rowpixels) : bitmap32_t(k_bitmap_format, base, width, height, rowpixels) { }
bitmap_ind32(bitmap_ind32 &source, const rectangle &subrect) : bitmap32_t(k_bitmap_format, source, subrect) { }
- void wrap(UINT32 *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); }
+ void wrap(uint32_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); }
void wrap(const bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); }
// getters
@@ -344,9 +344,9 @@ class bitmap_ind64 : public bitmap64_t
public:
// construction/destruction
bitmap_ind64(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap64_t(k_bitmap_format, width, height, xslop, yslop) { }
- bitmap_ind64(UINT64 *base, int width, int height, int rowpixels) : bitmap64_t(k_bitmap_format, base, width, height, rowpixels) { }
+ bitmap_ind64(uint64_t *base, int width, int height, int rowpixels) : bitmap64_t(k_bitmap_format, base, width, height, rowpixels) { }
bitmap_ind64(bitmap_ind64 &source, const rectangle &subrect) : bitmap64_t(k_bitmap_format, source, subrect) { }
- void wrap(UINT64 *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); }
+ void wrap(uint64_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); }
void wrap(const bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); }
// getters
@@ -364,9 +364,9 @@ class bitmap_yuy16 : public bitmap16_t
public:
// construction/destruction
bitmap_yuy16(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap16_t(k_bitmap_format, width, height, xslop, yslop) { }
- bitmap_yuy16(UINT16 *base, int width, int height, int rowpixels) : bitmap16_t(k_bitmap_format, base, width, height, rowpixels) { }
+ bitmap_yuy16(uint16_t *base, int width, int height, int rowpixels) : bitmap16_t(k_bitmap_format, base, width, height, rowpixels) { }
bitmap_yuy16(bitmap_yuy16 &source, const rectangle &subrect) : bitmap16_t(k_bitmap_format, source, subrect) { }
- void wrap(UINT16 *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); }
+ void wrap(uint16_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); }
void wrap(const bitmap_yuy16 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); }
// getters
@@ -381,9 +381,9 @@ class bitmap_rgb32 : public bitmap32_t
public:
// construction/destruction
bitmap_rgb32(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap32_t(k_bitmap_format, width, height, xslop, yslop) { }
- bitmap_rgb32(UINT32 *base, int width, int height, int rowpixels) : bitmap32_t(k_bitmap_format, base, width, height, rowpixels) { }
+ bitmap_rgb32(uint32_t *base, int width, int height, int rowpixels) : bitmap32_t(k_bitmap_format, base, width, height, rowpixels) { }
bitmap_rgb32(bitmap_rgb32 &source, const rectangle &subrect) : bitmap32_t(k_bitmap_format, source, subrect) { }
- void wrap(UINT32 *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); }
+ void wrap(uint32_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); }
void wrap(const bitmap_rgb32 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); }
// getters
@@ -398,9 +398,9 @@ class bitmap_argb32 : public bitmap32_t
public:
// construction/destruction
bitmap_argb32(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap32_t(k_bitmap_format, width, height, xslop, yslop) { }
- bitmap_argb32(UINT32 *base, int width, int height, int rowpixels) : bitmap32_t(k_bitmap_format, base, width, height, rowpixels) { }
+ bitmap_argb32(uint32_t *base, int width, int height, int rowpixels) : bitmap32_t(k_bitmap_format, base, width, height, rowpixels) { }
bitmap_argb32(bitmap_argb32 &source, const rectangle &subrect) : bitmap32_t(k_bitmap_format, source, subrect) { }
- void wrap(UINT32 *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); }
+ void wrap(uint32_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); }
void wrap(const bitmap_argb32 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); }
// getters
diff --git a/src/lib/util/bitstream.h b/src/lib/util/bitstream.h
index 2f36271d296..0056c4ce38e 100644
--- a/src/lib/util/bitstream.h
+++ b/src/lib/util/bitstream.h
@@ -25,25 +25,25 @@ class bitstream_in
{
public:
// construction/destruction
- bitstream_in(const void *src, UINT32 srclength);
+ bitstream_in(const void *src, uint32_t srclength);
// getters
bool overflow() const { return ((m_doffset - m_bits / 8) > m_dlength); }
- UINT32 read_offset() const;
+ uint32_t read_offset() const;
// operations
- UINT32 read(int numbits);
- UINT32 peek(int numbits);
+ uint32_t read(int numbits);
+ uint32_t peek(int numbits);
void remove(int numbits);
- UINT32 flush();
+ uint32_t flush();
private:
// internal state
- UINT32 m_buffer; // current bit accumulator
+ uint32_t m_buffer; // current bit accumulator
int m_bits; // number of bits in the accumulator
- const UINT8 * m_read; // read pointer
- UINT32 m_doffset; // byte offset within the data
- UINT32 m_dlength; // length of the data
+ const uint8_t * m_read; // read pointer
+ uint32_t m_doffset; // byte offset within the data
+ uint32_t m_dlength; // length of the data
};
@@ -52,22 +52,22 @@ class bitstream_out
{
public:
// construction/destruction
- bitstream_out(void *dest, UINT32 destlength);
+ bitstream_out(void *dest, uint32_t destlength);
// getters
bool overflow() const { return (m_doffset > m_dlength); }
// operations
- void write(UINT32 newbits, int numbits);
- UINT32 flush();
+ void write(uint32_t newbits, int numbits);
+ uint32_t flush();
private:
// internal state
- UINT32 m_buffer; // current bit accumulator
+ uint32_t m_buffer; // current bit accumulator
int m_bits; // number of bits in the accumulator
- UINT8 * m_write; // write pointer
- UINT32 m_doffset; // byte offset within the data
- UINT32 m_dlength; // length of the data
+ uint8_t * m_write; // write pointer
+ uint32_t m_doffset; // byte offset within the data
+ uint32_t m_dlength; // length of the data
};
@@ -80,10 +80,10 @@ private:
// bitstream_in - constructor
//-------------------------------------------------
-inline bitstream_in::bitstream_in(const void *src, UINT32 srclength)
+inline bitstream_in::bitstream_in(const void *src, uint32_t srclength)
: m_buffer(0),
m_bits(0),
- m_read(reinterpret_cast<const UINT8 *>(src)),
+ m_read(reinterpret_cast<const uint8_t *>(src)),
m_doffset(0),
m_dlength(srclength)
{
@@ -95,7 +95,7 @@ inline bitstream_in::bitstream_in(const void *src, UINT32 srclength)
// but don't advance the input pointer
//-------------------------------------------------
-inline UINT32 bitstream_in::peek(int numbits)
+inline uint32_t bitstream_in::peek(int numbits)
{
if (numbits == 0)
return 0;
@@ -133,9 +133,9 @@ inline void bitstream_in::remove(int numbits)
// read - fetch the requested number of bits
//-------------------------------------------------
-inline UINT32 bitstream_in::read(int numbits)
+inline uint32_t bitstream_in::read(int numbits)
{
- UINT32 result = peek(numbits);
+ uint32_t result = peek(numbits);
remove(numbits);
return result;
}
@@ -145,9 +145,9 @@ inline UINT32 bitstream_in::read(int numbits)
// read_offset - return the current read offset
//-------------------------------------------------
-inline UINT32 bitstream_in::read_offset() const
+inline uint32_t bitstream_in::read_offset() const
{
- UINT32 result = m_doffset;
+ uint32_t result = m_doffset;
int bits = m_bits;
while (bits >= 8)
{
@@ -162,7 +162,7 @@ inline UINT32 bitstream_in::read_offset() const
// flush - flush to the nearest byte
//-------------------------------------------------
-inline UINT32 bitstream_in::flush()
+inline uint32_t bitstream_in::flush()
{
while (m_bits >= 8)
{
@@ -178,10 +178,10 @@ inline UINT32 bitstream_in::flush()
// bitstream_out - constructor
//-------------------------------------------------
-inline bitstream_out::bitstream_out(void *dest, UINT32 destlength)
+inline bitstream_out::bitstream_out(void *dest, uint32_t destlength)
: m_buffer(0),
m_bits(0),
- m_write(reinterpret_cast<UINT8 *>(dest)),
+ m_write(reinterpret_cast<uint8_t *>(dest)),
m_doffset(0),
m_dlength(destlength)
{
@@ -194,7 +194,7 @@ inline bitstream_out::bitstream_out(void *dest, UINT32 destlength)
// data stream
//-------------------------------------------------
-inline void bitstream_out::write(UINT32 newbits, int numbits)
+inline void bitstream_out::write(uint32_t newbits, int numbits)
{
// flush the buffer if we're going to overflow it
if (m_bits + numbits > 32)
@@ -224,7 +224,7 @@ inline void bitstream_out::write(UINT32 newbits, int numbits)
// final output size in bytes
//-------------------------------------------------
-inline UINT32 bitstream_out::flush()
+inline uint32_t bitstream_out::flush()
{
while (m_bits > 0)
{
diff --git a/src/lib/util/cdrom.cpp b/src/lib/util/cdrom.cpp
index 7b5dae18a4e..3da270b55e3 100644
--- a/src/lib/util/cdrom.cpp
+++ b/src/lib/util/cdrom.cpp
@@ -130,7 +130,7 @@ struct cdrom_file
-------------------------------------------------*/
/**
- * @fn static inline UINT32 physical_to_chd_lba(cdrom_file *file, UINT32 physlba, UINT32 &tracknum)
+ * @fn static inline uint32_t physical_to_chd_lba(cdrom_file *file, uint32_t physlba, uint32_t &tracknum)
*
* @brief Physical to chd lba.
*
@@ -138,12 +138,12 @@ struct cdrom_file
* @param physlba The physlba.
* @param [in,out] tracknum The tracknum.
*
- * @return An UINT32.
+ * @return An uint32_t.
*/
-static inline UINT32 physical_to_chd_lba(cdrom_file *file, UINT32 physlba, UINT32 &tracknum)
+static inline uint32_t physical_to_chd_lba(cdrom_file *file, uint32_t physlba, uint32_t &tracknum)
{
- UINT32 chdlba;
+ uint32_t chdlba;
int track;
/* loop until our current LBA is less than the start LBA of the next track */
@@ -164,7 +164,7 @@ static inline UINT32 physical_to_chd_lba(cdrom_file *file, UINT32 physlba, UINT3
-------------------------------------------------*/
/**
- * @fn static inline UINT32 logical_to_chd_lba(cdrom_file *file, UINT32 loglba, UINT32 &tracknum)
+ * @fn static inline uint32_t logical_to_chd_lba(cdrom_file *file, uint32_t loglba, uint32_t &tracknum)
*
* @brief Logical to chd lba.
*
@@ -172,12 +172,12 @@ static inline UINT32 physical_to_chd_lba(cdrom_file *file, UINT32 physlba, UINT3
* @param loglba The loglba.
* @param [in,out] tracknum The tracknum.
*
- * @return An UINT32.
+ * @return An uint32_t.
*/
-static inline UINT32 logical_to_chd_lba(cdrom_file *file, UINT32 loglba, UINT32 &tracknum)
+static inline uint32_t logical_to_chd_lba(cdrom_file *file, uint32_t loglba, uint32_t &tracknum)
{
- UINT32 chdlba, physlba;
+ uint32_t chdlba, physlba;
int track;
/* loop until our current LBA is less than the start LBA of the next track */
@@ -221,7 +221,7 @@ cdrom_file *cdrom_open(const char *inputfile)
{
int i;
cdrom_file *file;
- UINT32 physofs, logofs;
+ uint32_t physofs, logofs;
/* allocate memory for the CD-ROM file */
file = new (std::nothrow) cdrom_file();
@@ -317,7 +317,7 @@ cdrom_file *cdrom_open(chd_file *chd)
{
int i;
cdrom_file *file;
- UINT32 physofs, chdofs, logofs;
+ uint32_t physofs, chdofs, logofs;
chd_error err;
/* punt if no CHD */
@@ -432,7 +432,7 @@ void cdrom_close(cdrom_file *file)
***************************************************************************/
/**
- * @fn chd_error read_partial_sector(cdrom_file *file, void *dest, UINT32 lbasector, UINT32 chdsector, UINT32 tracknum, UINT32 startoffs, UINT32 length)
+ * @fn chd_error read_partial_sector(cdrom_file *file, void *dest, uint32_t lbasector, uint32_t chdsector, uint32_t tracknum, uint32_t startoffs, uint32_t length)
*
* @brief Reads partial sector.
*
@@ -447,7 +447,7 @@ void cdrom_close(cdrom_file *file)
* @return The partial sector.
*/
-chd_error read_partial_sector(cdrom_file *file, void *dest, UINT32 lbasector, UINT32 chdsector, UINT32 tracknum, UINT32 startoffs, UINT32 length, bool phys=false)
+chd_error read_partial_sector(cdrom_file *file, void *dest, uint32_t lbasector, uint32_t chdsector, uint32_t tracknum, uint32_t startoffs, uint32_t length, bool phys=false)
{
chd_error result = CHDERR_NONE;
bool needswap = false;
@@ -466,7 +466,7 @@ chd_error read_partial_sector(cdrom_file *file, void *dest, UINT32 lbasector, UI
// if a CHD, just read
if (file->chd != nullptr)
{
- result = file->chd->read_bytes(UINT64(chdsector) * UINT64(CD_FRAME_SIZE) + startoffs, dest, length);
+ result = file->chd->read_bytes(uint64_t(chdsector) * uint64_t(CD_FRAME_SIZE) + startoffs, dest, length);
/* swap CDDA in the case of LE GDROMs */
if ((file->cdtoc.flags & CD_FLAG_GDROMLE) && (file->cdtoc.tracks[tracknum].trktype == CD_TRACK_AUDIO))
needswap = true;
@@ -476,7 +476,7 @@ chd_error read_partial_sector(cdrom_file *file, void *dest, UINT32 lbasector, UI
// else read from the appropriate file
util::core_file &srcfile = *file->fhandle[tracknum];
- UINT64 sourcefileoffset = file->track_info.track[tracknum].offset;
+ uint64_t sourcefileoffset = file->track_info.track[tracknum].offset;
int bytespersector = file->cdtoc.tracks[tracknum].datasize + file->cdtoc.tracks[tracknum].subsize;
sourcefileoffset += chdsector * bytespersector + startoffs;
@@ -491,7 +491,7 @@ chd_error read_partial_sector(cdrom_file *file, void *dest, UINT32 lbasector, UI
if (needswap)
{
- UINT8 *buffer = (UINT8 *)dest - startoffs;
+ uint8_t *buffer = (uint8_t *)dest - startoffs;
for (int swapindex = startoffs; swapindex < 2352; swapindex += 2 )
{
int swaptemp = buffer[ swapindex ];
@@ -509,7 +509,7 @@ chd_error read_partial_sector(cdrom_file *file, void *dest, UINT32 lbasector, UI
-------------------------------------------------*/
/**
- * @fn UINT32 cdrom_read_data(cdrom_file *file, UINT32 lbasector, void *buffer, UINT32 datatype, bool phys)
+ * @fn uint32_t cdrom_read_data(cdrom_file *file, uint32_t lbasector, void *buffer, uint32_t datatype, bool phys)
*
* @brief Cdrom read data.
*
@@ -519,17 +519,17 @@ chd_error read_partial_sector(cdrom_file *file, void *dest, UINT32 lbasector, UI
* @param datatype The datatype.
* @param phys true to physical.
*
- * @return An UINT32.
+ * @return An uint32_t.
*/
-UINT32 cdrom_read_data(cdrom_file *file, UINT32 lbasector, void *buffer, UINT32 datatype, bool phys)
+uint32_t cdrom_read_data(cdrom_file *file, uint32_t lbasector, void *buffer, uint32_t datatype, bool phys)
{
if (file == nullptr)
return 0;
// compute CHD sector and tracknumber
- UINT32 tracknum = 0;
- UINT32 chdsector;
+ uint32_t tracknum = 0;
+ uint32_t chdsector;
if (phys)
{
@@ -541,7 +541,7 @@ UINT32 cdrom_read_data(cdrom_file *file, UINT32 lbasector, void *buffer, UINT32
}
/* copy out the requested sector */
- UINT32 tracktype = file->cdtoc.tracks[tracknum].trktype;
+ uint32_t tracktype = file->cdtoc.tracks[tracknum].trktype;
if ((datatype == tracktype) || (datatype == CD_TRACK_RAW_DONTCARE))
{
@@ -558,10 +558,10 @@ UINT32 cdrom_read_data(cdrom_file *file, UINT32 lbasector, void *buffer, UINT32
/* return 2352 byte mode 1 raw sector from 2048 bytes of mode 1 data */
if ((datatype == CD_TRACK_MODE1_RAW) && (tracktype == CD_TRACK_MODE1))
{
- UINT8 *bufptr = (UINT8 *)buffer;
- UINT32 msf = lba_to_msf(lbasector);
+ uint8_t *bufptr = (uint8_t *)buffer;
+ uint32_t msf = lba_to_msf(lbasector);
- static const UINT8 syncbytes[12] = {0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00};
+ static const uint8_t syncbytes[12] = {0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00};
memcpy(bufptr, syncbytes, 12);
bufptr[12] = msf>>16;
bufptr[13] = msf>>8;
@@ -595,7 +595,7 @@ UINT32 cdrom_read_data(cdrom_file *file, UINT32 lbasector, void *buffer, UINT32
-------------------------------------------------*/
/**
- * @fn UINT32 cdrom_read_subcode(cdrom_file *file, UINT32 lbasector, void *buffer, bool phys)
+ * @fn uint32_t cdrom_read_subcode(cdrom_file *file, uint32_t lbasector, void *buffer, bool phys)
*
* @brief Cdrom read subcode.
*
@@ -604,17 +604,17 @@ UINT32 cdrom_read_data(cdrom_file *file, UINT32 lbasector, void *buffer, UINT32
* @param [in,out] buffer If non-null, the buffer.
* @param phys true to physical.
*
- * @return An UINT32.
+ * @return An uint32_t.
*/
-UINT32 cdrom_read_subcode(cdrom_file *file, UINT32 lbasector, void *buffer, bool phys)
+uint32_t cdrom_read_subcode(cdrom_file *file, uint32_t lbasector, void *buffer, bool phys)
{
if (file == nullptr)
return ~0;
// compute CHD sector and tracknumber
- UINT32 tracknum = 0;
- UINT32 chdsector;
+ uint32_t tracknum = 0;
+ uint32_t chdsector;
if (phys)
{
@@ -645,19 +645,19 @@ UINT32 cdrom_read_subcode(cdrom_file *file, UINT32 lbasector, void *buffer, bool
-------------------------------------------------*/
/**
- * @fn UINT32 cdrom_get_track(cdrom_file *file, UINT32 frame)
+ * @fn uint32_t cdrom_get_track(cdrom_file *file, uint32_t frame)
*
* @brief Cdrom get track.
*
* @param [in,out] file If non-null, the file.
* @param frame The frame.
*
- * @return An UINT32.
+ * @return An uint32_t.
*/
-UINT32 cdrom_get_track(cdrom_file *file, UINT32 frame)
+uint32_t cdrom_get_track(cdrom_file *file, uint32_t frame)
{
- UINT32 track = 0;
+ uint32_t track = 0;
if (file == nullptr)
return ~0;
@@ -675,17 +675,17 @@ UINT32 cdrom_get_track(cdrom_file *file, UINT32 frame)
-------------------------------------------------*/
/**
- * @fn UINT32 cdrom_get_track_start(cdrom_file *file, UINT32 track)
+ * @fn uint32_t cdrom_get_track_start(cdrom_file *file, uint32_t track)
*
* @brief Cdrom get track start.
*
* @param [in,out] file If non-null, the file.
* @param track The track.
*
- * @return An UINT32.
+ * @return An uint32_t.
*/
-UINT32 cdrom_get_track_start(cdrom_file *file, UINT32 track)
+uint32_t cdrom_get_track_start(cdrom_file *file, uint32_t track)
{
if (file == nullptr)
return ~0;
@@ -703,17 +703,17 @@ UINT32 cdrom_get_track_start(cdrom_file *file, UINT32 track)
-------------------------------------------------*/
/**
- * @fn UINT32 cdrom_get_track_start_phys(cdrom_file *file, UINT32 track)
+ * @fn uint32_t cdrom_get_track_start_phys(cdrom_file *file, uint32_t track)
*
* @brief Cdrom get track start physical.
*
* @param [in,out] file If non-null, the file.
* @param track The track.
*
- * @return An UINT32.
+ * @return An uint32_t.
*/
-UINT32 cdrom_get_track_start_phys(cdrom_file *file, UINT32 track)
+uint32_t cdrom_get_track_start_phys(cdrom_file *file, uint32_t track)
{
if (file == nullptr)
return ~0;
@@ -843,7 +843,7 @@ const cdrom_toc *cdrom_get_toc(cdrom_file *file)
-------------------------------------------------*/
/**
- * @fn static void cdrom_get_info_from_type_string(const char *typestring, UINT32 *trktype, UINT32 *datasize)
+ * @fn static void cdrom_get_info_from_type_string(const char *typestring, uint32_t *trktype, uint32_t *datasize)
*
* @brief Cdrom get information from type string.
*
@@ -852,7 +852,7 @@ const cdrom_toc *cdrom_get_toc(cdrom_file *file)
* @param [in,out] datasize If non-null, the datasize.
*/
-static void cdrom_get_info_from_type_string(const char *typestring, UINT32 *trktype, UINT32 *datasize)
+static void cdrom_get_info_from_type_string(const char *typestring, uint32_t *trktype, uint32_t *datasize)
{
if (!strcmp(typestring, "MODE1"))
{
@@ -1035,7 +1035,7 @@ void cdrom_convert_subtype_string_to_pregap_info(const char *typestring, cdrom_t
-------------------------------------------------*/
/**
- * @fn const char *cdrom_get_type_string(UINT32 trktype)
+ * @fn const char *cdrom_get_type_string(uint32_t trktype)
*
* @brief Cdrom get type string.
*
@@ -1044,7 +1044,7 @@ void cdrom_convert_subtype_string_to_pregap_info(const char *typestring, cdrom_t
* @return null if it fails, else a char*.
*/
-const char *cdrom_get_type_string(UINT32 trktype)
+const char *cdrom_get_type_string(uint32_t trktype)
{
switch (trktype)
{
@@ -1067,7 +1067,7 @@ const char *cdrom_get_type_string(UINT32 trktype)
-------------------------------------------------*/
/**
- * @fn const char *cdrom_get_subtype_string(UINT32 subtype)
+ * @fn const char *cdrom_get_subtype_string(uint32_t subtype)
*
* @brief Cdrom get subtype string.
*
@@ -1076,7 +1076,7 @@ const char *cdrom_get_type_string(UINT32 trktype)
* @return null if it fails, else a char*.
*/
-const char *cdrom_get_subtype_string(UINT32 subtype)
+const char *cdrom_get_subtype_string(uint32_t subtype)
{
switch (subtype)
{
@@ -1225,13 +1225,13 @@ chd_error cdrom_parse_metadata(chd_file *chd, cdrom_toc *toc)
printf("toc->numtrks = %u?!\n", toc->numtrks);
/* look for old-style metadata */
- std::vector<UINT8> oldmetadata;
+ std::vector<uint8_t> oldmetadata;
err = chd->read_metadata(CDROM_OLD_METADATA_TAG, 0, oldmetadata);
if (err != CHDERR_NONE)
return err;
/* reconstruct the TOC from it */
- UINT32 *mrp = reinterpret_cast<UINT32 *>(&oldmetadata[0]);
+ uint32_t *mrp = reinterpret_cast<uint32_t *>(&oldmetadata[0]);
toc->numtrks = *mrp++;
for (i = 0; i < CD_MAX_TRACKS; i++)
@@ -1334,7 +1334,7 @@ chd_error cdrom_write_metadata(chd_file *chd, const cdrom_toc *toc)
* -------------------------------------------------.
*/
-static const UINT8 ecclow[256] =
+static const uint8_t ecclow[256] =
{
0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e,
0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e, 0x30, 0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e,
@@ -1355,7 +1355,7 @@ static const UINT8 ecclow[256] =
};
/** @brief The ecchigh[ 256]. */
-static const UINT8 ecchigh[256] =
+static const uint8_t ecchigh[256] =
{
0x00, 0xf4, 0xf5, 0x01, 0xf7, 0x03, 0x02, 0xf6, 0xf3, 0x07, 0x06, 0xf2, 0x04, 0xf0, 0xf1, 0x05,
0xfb, 0x0f, 0x0e, 0xfa, 0x0c, 0xf8, 0xf9, 0x0d, 0x08, 0xfc, 0xfd, 0x09, 0xff, 0x0b, 0x0a, 0xfe,
@@ -1382,7 +1382,7 @@ static const UINT8 ecchigh[256] =
* -------------------------------------------------.
*/
-static const UINT16 poffsets[ECC_P_NUM_BYTES][ECC_P_COMP] =
+static const uint16_t poffsets[ECC_P_NUM_BYTES][ECC_P_COMP] =
{
{ 0x000,0x056,0x0ac,0x102,0x158,0x1ae,0x204,0x25a,0x2b0,0x306,0x35c,0x3b2,0x408,0x45e,0x4b4,0x50a,0x560,0x5b6,0x60c,0x662,0x6b8,0x70e,0x764,0x7ba },
{ 0x001,0x057,0x0ad,0x103,0x159,0x1af,0x205,0x25b,0x2b1,0x307,0x35d,0x3b3,0x409,0x45f,0x4b5,0x50b,0x561,0x5b7,0x60d,0x663,0x6b9,0x70f,0x765,0x7bb },
@@ -1479,7 +1479,7 @@ static const UINT16 poffsets[ECC_P_NUM_BYTES][ECC_P_COMP] =
* -------------------------------------------------.
*/
-static const UINT16 qoffsets[ECC_Q_NUM_BYTES][ECC_Q_COMP] =
+static const uint16_t qoffsets[ECC_Q_NUM_BYTES][ECC_Q_COMP] =
{
{ 0x000,0x058,0x0b0,0x108,0x160,0x1b8,0x210,0x268,0x2c0,0x318,0x370,0x3c8,0x420,0x478,0x4d0,0x528,0x580,0x5d8,0x630,0x688,0x6e0,0x738,0x790,0x7e8,0x840,0x898,0x034,0x08c,0x0e4,0x13c,0x194,0x1ec,0x244,0x29c,0x2f4,0x34c,0x3a4,0x3fc,0x454,0x4ac,0x504,0x55c,0x5b4 },
{ 0x001,0x059,0x0b1,0x109,0x161,0x1b9,0x211,0x269,0x2c1,0x319,0x371,0x3c9,0x421,0x479,0x4d1,0x529,0x581,0x5d9,0x631,0x689,0x6e1,0x739,0x791,0x7e9,0x841,0x899,0x035,0x08d,0x0e5,0x13d,0x195,0x1ed,0x245,0x29d,0x2f5,0x34d,0x3a5,0x3fd,0x455,0x4ad,0x505,0x55d,0x5b5 },
@@ -1542,14 +1542,14 @@ static const UINT16 qoffsets[ECC_Q_NUM_BYTES][ECC_Q_COMP] =
// particular to a mode
//-------------------------------------------------
-inline UINT8 ecc_source_byte(const UINT8 *sector, UINT32 offset)
+inline uint8_t ecc_source_byte(const uint8_t *sector, uint32_t offset)
{
// in mode 2 always treat these as 0 bytes
return (sector[MODE_OFFSET] == 2 && offset < 4) ? 0x00 : sector[SYNC_OFFSET + SYNC_NUM_BYTES + offset];
}
/**
- * @fn void ecc_compute_bytes(const UINT8 *sector, const UINT16 *row, int rowlen, UINT8 &val1, UINT8 &val2)
+ * @fn void ecc_compute_bytes(const uint8_t *sector, const uint16_t *row, int rowlen, uint8_t &val1, uint8_t &val2)
*
* @brief -------------------------------------------------
* ecc_compute_bytes - calculate an ECC value (P or Q)
@@ -1562,7 +1562,7 @@ inline UINT8 ecc_source_byte(const UINT8 *sector, UINT32 offset)
* @param [in,out] val2 The second value.
*/
-void ecc_compute_bytes(const UINT8 *sector, const UINT16 *row, int rowlen, UINT8 &val1, UINT8 &val2)
+void ecc_compute_bytes(const uint8_t *sector, const uint16_t *row, int rowlen, uint8_t &val1, uint8_t &val2)
{
val1 = val2 = 0;
for (int component = 0; component < rowlen; component++)
@@ -1576,7 +1576,7 @@ void ecc_compute_bytes(const UINT8 *sector, const UINT16 *row, int rowlen, UINT8
}
/**
- * @fn bool ecc_verify(const UINT8 *sector)
+ * @fn bool ecc_verify(const uint8_t *sector)
*
* @brief -------------------------------------------------
* ecc_verify - verify the P and Q ECC codes in a sector
@@ -1587,12 +1587,12 @@ void ecc_compute_bytes(const UINT8 *sector, const UINT16 *row, int rowlen, UINT8
* @return true if it succeeds, false if it fails.
*/
-bool ecc_verify(const UINT8 *sector)
+bool ecc_verify(const uint8_t *sector)
{
// first verify P bytes
for (int byte = 0; byte < ECC_P_NUM_BYTES; byte++)
{
- UINT8 val1, val2;
+ uint8_t val1, val2;
ecc_compute_bytes(sector, poffsets[byte], ECC_P_COMP, val1, val2);
if (sector[ECC_P_OFFSET + byte] != val1 || sector[ECC_P_OFFSET + ECC_P_NUM_BYTES + byte] != val2)
return false;
@@ -1601,7 +1601,7 @@ bool ecc_verify(const UINT8 *sector)
// then verify Q bytes
for (int byte = 0; byte < ECC_Q_NUM_BYTES; byte++)
{
- UINT8 val1, val2;
+ uint8_t val1, val2;
ecc_compute_bytes(sector, qoffsets[byte], ECC_Q_COMP, val1, val2);
if (sector[ECC_Q_OFFSET + byte] != val1 || sector[ECC_Q_OFFSET + ECC_Q_NUM_BYTES + byte] != val2)
return false;
@@ -1610,7 +1610,7 @@ bool ecc_verify(const UINT8 *sector)
}
/**
- * @fn void ecc_generate(UINT8 *sector)
+ * @fn void ecc_generate(uint8_t *sector)
*
* @brief -------------------------------------------------
* ecc_generate - generate the P and Q ECC codes for a sector, overwriting any
@@ -1620,7 +1620,7 @@ bool ecc_verify(const UINT8 *sector)
* @param [in,out] sector If non-null, the sector.
*/
-void ecc_generate(UINT8 *sector)
+void ecc_generate(uint8_t *sector)
{
// first verify P bytes
for (int byte = 0; byte < ECC_P_NUM_BYTES; byte++)
@@ -1632,7 +1632,7 @@ void ecc_generate(UINT8 *sector)
}
/**
- * @fn void ecc_clear(UINT8 *sector)
+ * @fn void ecc_clear(uint8_t *sector)
*
* @brief -------------------------------------------------
* ecc_clear - erase the ECC P and Q cods to 0 within a sector
@@ -1641,7 +1641,7 @@ void ecc_generate(UINT8 *sector)
* @param [in,out] sector If non-null, the sector.
*/
-void ecc_clear(UINT8 *sector)
+void ecc_clear(uint8_t *sector)
{
memset(&sector[ECC_P_OFFSET], 0, 2 * ECC_P_NUM_BYTES);
memset(&sector[ECC_Q_OFFSET], 0, 2 * ECC_Q_NUM_BYTES);
diff --git a/src/lib/util/cdrom.h b/src/lib/util/cdrom.h
index c495a405513..21665c1326f 100644
--- a/src/lib/util/cdrom.h
+++ b/src/lib/util/cdrom.h
@@ -23,7 +23,7 @@
***************************************************************************/
// tracks are padded to a multiple of this many frames
-const UINT32 CD_TRACK_PADDING = 4;
+const uint32_t CD_TRACK_PADDING = 4;
#define CD_MAX_TRACKS (99) /* AFAIK the theoretical limit */
#define CD_MAX_SECTOR_DATA (2352)
@@ -67,33 +67,33 @@ struct cdrom_file;
struct cdrom_track_info
{
/* fields used by CHDMAN and in MAME */
- UINT32 trktype; /* track type */
- UINT32 subtype; /* subcode data type */
- UINT32 datasize; /* size of data in each sector of this track */
- UINT32 subsize; /* size of subchannel data in each sector of this track */
- UINT32 frames; /* number of frames in this track */
- UINT32 extraframes; /* number of "spillage" frames in this track */
- UINT32 pregap; /* number of pregap frames */
- UINT32 postgap; /* number of postgap frames */
- UINT32 pgtype; /* type of sectors in pregap */
- UINT32 pgsub; /* type of subchannel data in pregap */
- UINT32 pgdatasize; /* size of data in each sector of the pregap */
- UINT32 pgsubsize; /* size of subchannel data in each sector of the pregap */
+ uint32_t trktype; /* track type */
+ uint32_t subtype; /* subcode data type */
+ uint32_t datasize; /* size of data in each sector of this track */
+ uint32_t subsize; /* size of subchannel data in each sector of this track */
+ uint32_t frames; /* number of frames in this track */
+ uint32_t extraframes; /* number of "spillage" frames in this track */
+ uint32_t pregap; /* number of pregap frames */
+ uint32_t postgap; /* number of postgap frames */
+ uint32_t pgtype; /* type of sectors in pregap */
+ uint32_t pgsub; /* type of subchannel data in pregap */
+ uint32_t pgdatasize; /* size of data in each sector of the pregap */
+ uint32_t pgsubsize; /* size of subchannel data in each sector of the pregap */
/* fields used in CHDMAN only */
- UINT32 padframes; /* number of frames of padding to add to the end of the track; needed for GDI */
+ uint32_t padframes; /* number of frames of padding to add to the end of the track; needed for GDI */
/* fields used in MAME/MESS only */
- UINT32 logframeofs; /* logical frame of actual track data - offset by pregap size if pregap not physically present */
- UINT32 physframeofs; /* physical frame of actual track data in CHD data */
- UINT32 chdframeofs; /* frame number this track starts at on the CHD */
+ uint32_t logframeofs; /* logical frame of actual track data - offset by pregap size if pregap not physically present */
+ uint32_t physframeofs; /* physical frame of actual track data in CHD data */
+ uint32_t chdframeofs; /* frame number this track starts at on the CHD */
};
struct cdrom_toc
{
- UINT32 numtrks; /* number of tracks */
- UINT32 flags; /* see FLAG_ above */
+ uint32_t numtrks; /* number of tracks */
+ uint32_t flags; /* see FLAG_ above */
cdrom_track_info tracks[CD_MAX_TRACKS];
};
@@ -110,13 +110,13 @@ void cdrom_close(cdrom_file *file);
cdrom_file *cdrom_open(const char *inputfile);
/* core read access */
-UINT32 cdrom_read_data(cdrom_file *file, UINT32 lbasector, void *buffer, UINT32 datatype, bool phys=false);
-UINT32 cdrom_read_subcode(cdrom_file *file, UINT32 lbasector, void *buffer, bool phys=false);
+uint32_t cdrom_read_data(cdrom_file *file, uint32_t lbasector, void *buffer, uint32_t datatype, bool phys=false);
+uint32_t cdrom_read_subcode(cdrom_file *file, uint32_t lbasector, void *buffer, bool phys=false);
/* handy utilities */
-UINT32 cdrom_get_track(cdrom_file *file, UINT32 frame);
-UINT32 cdrom_get_track_start(cdrom_file *file, UINT32 track);
-UINT32 cdrom_get_track_start_phys(cdrom_file *file, UINT32 track);
+uint32_t cdrom_get_track(cdrom_file *file, uint32_t frame);
+uint32_t cdrom_get_track_start(cdrom_file *file, uint32_t track);
+uint32_t cdrom_get_track_start_phys(cdrom_file *file, uint32_t track);
/* TOC utilities */
int cdrom_get_last_track(cdrom_file *file);
@@ -129,15 +129,15 @@ void cdrom_convert_type_string_to_track_info(const char *typestring, cdrom_track
void cdrom_convert_type_string_to_pregap_info(const char *typestring, cdrom_track_info *info);
void cdrom_convert_subtype_string_to_track_info(const char *typestring, cdrom_track_info *info);
void cdrom_convert_subtype_string_to_pregap_info(const char *typestring, cdrom_track_info *info);
-const char *cdrom_get_type_string(UINT32 trktype);
-const char *cdrom_get_subtype_string(UINT32 subtype);
+const char *cdrom_get_type_string(uint32_t trktype);
+const char *cdrom_get_subtype_string(uint32_t subtype);
chd_error cdrom_parse_metadata(chd_file *chd, cdrom_toc *toc);
chd_error cdrom_write_metadata(chd_file *chd, const cdrom_toc *toc);
// ECC utilities
-bool ecc_verify(const UINT8 *sector);
-void ecc_generate(UINT8 *sector);
-void ecc_clear(UINT8 *sector);
+bool ecc_verify(const uint8_t *sector);
+void ecc_generate(uint8_t *sector);
+void ecc_clear(uint8_t *sector);
@@ -145,14 +145,14 @@ void ecc_clear(UINT8 *sector);
INLINE FUNCTIONS
***************************************************************************/
-static inline UINT32 msf_to_lba(UINT32 msf)
+static inline uint32_t msf_to_lba(uint32_t msf)
{
return ( ((msf&0x00ff0000)>>16) * 60 * 75) + (((msf&0x0000ff00)>>8) * 75) + ((msf&0x000000ff)>>0);
}
-static inline UINT32 lba_to_msf(UINT32 lba)
+static inline uint32_t lba_to_msf(uint32_t lba)
{
- UINT8 m, s, f;
+ uint8_t m, s, f;
m = lba / (60 * 75);
lba -= m * (60 * 75);
@@ -167,9 +167,9 @@ static inline UINT32 lba_to_msf(UINT32 lba)
// segacd needs it like this.. investigate
// Angelo also says PCE tracks often start playing at the
// wrong address.. related?
-static inline UINT32 lba_to_msf_alt(int lba)
+static inline uint32_t lba_to_msf_alt(int lba)
{
- UINT32 ret = 0;
+ uint32_t ret = 0;
ret |= ((lba / (60 * 75))&0xff)<<16;
ret |= (((lba / 75) % 60)&0xff)<<8;
diff --git a/src/lib/util/chd.cpp b/src/lib/util/chd.cpp
index 8bce55cb947..19836a8ee2a 100644
--- a/src/lib/util/chd.cpp
+++ b/src/lib/util/chd.cpp
@@ -35,10 +35,10 @@ const char *CDROM_TRACK_METADATA2_FORMAT = "TRACK:%d TYPE:%s SUBTYPE:%s FRAMES:%
const char *GDROM_TRACK_METADATA_FORMAT = "TRACK:%d TYPE:%s SUBTYPE:%s FRAMES:%d PAD:%d PREGAP:%d PGTYPE:%s PGSUB:%s POSTGAP:%d";
const char *AV_METADATA_FORMAT = "FPS:%d.%06d WIDTH:%d HEIGHT:%d INTERLACED:%d CHANNELS:%d SAMPLERATE:%d";
-static const UINT32 METADATA_HEADER_SIZE = 16; // metadata header size
+static const uint32_t METADATA_HEADER_SIZE = 16; // metadata header size
-static const UINT8 V34_MAP_ENTRY_FLAG_TYPE_MASK = 0x0f; // what type of hunk
-static const UINT8 V34_MAP_ENTRY_FLAG_NO_CRC = 0x10; // no CRC is present
+static const uint8_t V34_MAP_ENTRY_FLAG_TYPE_MASK = 0x0f; // what type of hunk
+static const uint8_t V34_MAP_ENTRY_FLAG_NO_CRC = 0x10; // no CRC is present
@@ -101,12 +101,12 @@ enum
// description of where a metadata entry lives within the file
struct chd_file::metadata_entry
{
- UINT64 offset; // offset within the file of the header
- UINT64 next; // offset within the file of the next header
- UINT64 prev; // offset within the file of the previous header
- UINT32 length; // length of the metadata
- UINT32 metatag; // metadata tag
- UINT8 flags; // flag bits
+ uint64_t offset; // offset within the file of the header
+ uint64_t next; // offset within the file of the next header
+ uint64_t prev; // offset within the file of the previous header
+ uint32_t length; // length of the metadata
+ uint32_t metatag; // metadata tag
+ uint8_t flags; // flag bits
};
@@ -114,7 +114,7 @@ struct chd_file::metadata_entry
struct chd_file::metadata_hash
{
- UINT8 tag[4]; // tag of the metadata in big-endian
+ uint8_t tag[4]; // tag of the metadata in big-endian
util::sha1_t sha1; // hash data
};
@@ -129,9 +129,9 @@ struct chd_file::metadata_hash
// a byte buffer
//-------------------------------------------------
-inline UINT64 chd_file::be_read(const UINT8 *base, int numbytes)
+inline uint64_t chd_file::be_read(const uint8_t *base, int numbytes)
{
- UINT64 result = 0;
+ uint64_t result = 0;
while (numbytes--)
result = (result << 8) | *base++;
return result;
@@ -143,7 +143,7 @@ inline UINT64 chd_file::be_read(const UINT8 *base, int numbytes)
// buffer
//-------------------------------------------------
-inline void chd_file::be_write(UINT8 *base, UINT64 value, int numbytes)
+inline void chd_file::be_write(uint8_t *base, uint64_t value, int numbytes)
{
base += numbytes;
while (numbytes--)
@@ -159,7 +159,7 @@ inline void chd_file::be_write(UINT8 *base, UINT64 value, int numbytes)
// stream in bigendian order
//-------------------------------------------------
-inline util::sha1_t chd_file::be_read_sha1(const UINT8 *base)
+inline util::sha1_t chd_file::be_read_sha1(const uint8_t *base)
{
util::sha1_t result;
memcpy(&result.m_raw[0], base, sizeof(result.m_raw));
@@ -172,7 +172,7 @@ inline util::sha1_t chd_file::be_read_sha1(const UINT8 *base)
// stream in bigendian order
//-------------------------------------------------
-inline void chd_file::be_write_sha1(UINT8 *base, util::sha1_t value)
+inline void chd_file::be_write_sha1(uint8_t *base, util::sha1_t value)
{
memcpy(base, &value.m_raw[0], sizeof(value.m_raw));
}
@@ -183,7 +183,7 @@ inline void chd_file::be_write_sha1(UINT8 *base, util::sha1_t value)
// offset; on failure throw an error
//-------------------------------------------------
-inline void chd_file::file_read(UINT64 offset, void *dest, UINT32 length)
+inline void chd_file::file_read(uint64_t offset, void *dest, uint32_t length)
{
// no file = failure
if (m_file == nullptr)
@@ -191,7 +191,7 @@ inline void chd_file::file_read(UINT64 offset, void *dest, UINT32 length)
// seek and read
m_file->seek(offset, SEEK_SET);
- UINT32 count = m_file->read(dest, length);
+ uint32_t count = m_file->read(dest, length);
if (count != length)
throw CHDERR_READ_ERROR;
}
@@ -202,7 +202,7 @@ inline void chd_file::file_read(UINT64 offset, void *dest, UINT32 length)
// offset; on failure throw an error
//-------------------------------------------------
-inline void chd_file::file_write(UINT64 offset, const void *source, UINT32 length)
+inline void chd_file::file_write(uint64_t offset, const void *source, uint32_t length)
{
// no file = failure
if (m_file == nullptr)
@@ -210,7 +210,7 @@ inline void chd_file::file_write(UINT64 offset, const void *source, UINT32 lengt
// seek and write
m_file->seek(offset, SEEK_SET);
- UINT32 count = m_file->write(source, length);
+ uint32_t count = m_file->write(source, length);
if (count != length)
throw CHDERR_WRITE_ERROR;
}
@@ -222,7 +222,7 @@ inline void chd_file::file_write(UINT64 offset, const void *source, UINT32 lengt
// alignment; on failure throw an error
//-------------------------------------------------
-inline UINT64 chd_file::file_append(const void *source, UINT32 length, UINT32 alignment)
+inline uint64_t chd_file::file_append(const void *source, uint32_t length, uint32_t alignment)
{
// no file = failure
if (m_file == nullptr)
@@ -232,18 +232,18 @@ inline UINT64 chd_file::file_append(const void *source, UINT32 length, UINT32 al
m_file->seek(0, SEEK_END);
if (alignment != 0)
{
- UINT64 offset = m_file->tell();
- UINT32 delta = offset % alignment;
+ uint64_t offset = m_file->tell();
+ uint32_t delta = offset % alignment;
if (delta != 0)
{
// pad with 0's from a local buffer
- UINT8 buffer[1024];
+ uint8_t buffer[1024];
memset(buffer, 0, sizeof(buffer));
delta = alignment - delta;
while (delta != 0)
{
- UINT32 bytes_to_write = (std::min<std::size_t>)(sizeof(buffer), delta);
- UINT32 count = m_file->write(buffer, bytes_to_write);
+ uint32_t bytes_to_write = (std::min<std::size_t>)(sizeof(buffer), delta);
+ uint32_t count = m_file->write(buffer, bytes_to_write);
if (count != bytes_to_write)
throw CHDERR_WRITE_ERROR;
delta -= bytes_to_write;
@@ -252,8 +252,8 @@ inline UINT64 chd_file::file_append(const void *source, UINT32 length, UINT32 al
}
// write the real data
- UINT64 offset = m_file->tell();
- UINT32 count = m_file->write(source, length);
+ uint64_t offset = m_file->tell();
+ uint32_t count = m_file->write(source, length);
if (count != length)
throw CHDERR_READ_ERROR;
return offset;
@@ -265,9 +265,9 @@ inline UINT64 chd_file::file_append(const void *source, UINT32 length, UINT32 al
// necessary to represent all numbers 0..value
//-------------------------------------------------
-inline UINT8 chd_file::bits_for_value(UINT64 value)
+inline uint8_t chd_file::bits_for_value(uint64_t value)
{
- UINT8 result = 0;
+ uint8_t result = 0;
while (value != 0)
value >>= 1, result++;
return result;
@@ -325,7 +325,7 @@ util::sha1_t chd_file::sha1()
try
{
// read the big-endian version
- UINT8 rawbuf[sizeof(util::sha1_t)];
+ uint8_t rawbuf[sizeof(util::sha1_t)];
file_read(m_sha1_offset, rawbuf, sizeof(rawbuf));
return be_read_sha1(rawbuf);
}
@@ -358,7 +358,7 @@ util::sha1_t chd_file::raw_sha1()
throw CHDERR_UNSUPPORTED_VERSION;
// read the big-endian version
- UINT8 rawbuf[sizeof(util::sha1_t)];
+ uint8_t rawbuf[sizeof(util::sha1_t)];
file_read(m_rawsha1_offset, rawbuf, sizeof(rawbuf));
return be_read_sha1(rawbuf);
}
@@ -391,7 +391,7 @@ util::sha1_t chd_file::parent_sha1()
throw CHDERR_UNSUPPORTED_VERSION;
// read the big-endian version
- UINT8 rawbuf[sizeof(util::sha1_t)];
+ uint8_t rawbuf[sizeof(util::sha1_t)];
file_read(m_parentsha1_offset, rawbuf, sizeof(rawbuf));
return be_read_sha1(rawbuf);
}
@@ -403,7 +403,7 @@ util::sha1_t chd_file::parent_sha1()
}
/**
- * @fn chd_error chd_file::hunk_info(UINT32 hunknum, chd_codec_type &compressor, UINT32 &compbytes)
+ * @fn chd_error chd_file::hunk_info(uint32_t hunknum, chd_codec_type &compressor, uint32_t &compbytes)
*
* @brief -------------------------------------------------
* hunk_info - return information about this hunk
@@ -416,14 +416,14 @@ util::sha1_t chd_file::parent_sha1()
* @return A chd_error.
*/
-chd_error chd_file::hunk_info(UINT32 hunknum, chd_codec_type &compressor, UINT32 &compbytes)
+chd_error chd_file::hunk_info(uint32_t hunknum, chd_codec_type &compressor, uint32_t &compbytes)
{
// error if invalid
if (hunknum >= m_hunkcount)
return CHDERR_HUNK_OUT_OF_RANGE;
// get the map pointer
- UINT8 *rawmap;
+ uint8_t *rawmap;
switch (m_version)
{
// v3/v4 map entries
@@ -526,11 +526,11 @@ chd_error chd_file::hunk_info(UINT32 hunknum, chd_codec_type &compressor, UINT32
void chd_file::set_raw_sha1(util::sha1_t rawdata)
{
// create a big-endian version
- UINT8 rawbuf[sizeof(util::sha1_t)];
+ uint8_t rawbuf[sizeof(util::sha1_t)];
be_write_sha1(rawbuf, rawdata);
// write to the header
- UINT64 offset = (m_rawsha1_offset != 0) ? m_rawsha1_offset : m_sha1_offset;
+ uint64_t offset = (m_rawsha1_offset != 0) ? m_rawsha1_offset : m_sha1_offset;
assert(offset != 0);
file_write(offset, rawbuf, sizeof(rawbuf));
@@ -558,7 +558,7 @@ void chd_file::set_parent_sha1(util::sha1_t parent)
throw CHDERR_INVALID_FILE;
// create a big-endian version
- UINT8 rawbuf[sizeof(util::sha1_t)];
+ uint8_t rawbuf[sizeof(util::sha1_t)];
be_write_sha1(rawbuf, parent);
// write to the header
@@ -567,7 +567,7 @@ void chd_file::set_parent_sha1(util::sha1_t parent)
}
/**
- * @fn chd_error chd_file::create(util::core_file &file, UINT64 logicalbytes, UINT32 hunkbytes, UINT32 unitbytes, chd_codec_type compression[4])
+ * @fn chd_error chd_file::create(util::core_file &file, uint64_t logicalbytes, uint32_t hunkbytes, uint32_t unitbytes, chd_codec_type compression[4])
*
* @brief -------------------------------------------------
* create - create a new file with no parent using an existing opened file handle
@@ -582,7 +582,7 @@ void chd_file::set_parent_sha1(util::sha1_t parent)
* @return A chd_error.
*/
-chd_error chd_file::create(util::core_file &file, UINT64 logicalbytes, UINT32 hunkbytes, UINT32 unitbytes, chd_codec_type compression[4])
+chd_error chd_file::create(util::core_file &file, uint64_t logicalbytes, uint32_t hunkbytes, uint32_t unitbytes, chd_codec_type compression[4])
{
// make sure we don't already have a file open
if (m_file != nullptr)
@@ -602,7 +602,7 @@ chd_error chd_file::create(util::core_file &file, UINT64 logicalbytes, UINT32 hu
}
/**
- * @fn chd_error chd_file::create(util::core_file &file, UINT64 logicalbytes, UINT32 hunkbytes, chd_codec_type compression[4], chd_file &parent)
+ * @fn chd_error chd_file::create(util::core_file &file, uint64_t logicalbytes, uint32_t hunkbytes, chd_codec_type compression[4], chd_file &parent)
*
* @brief -------------------------------------------------
* create - create a new file with a parent using an existing opened file handle
@@ -617,7 +617,7 @@ chd_error chd_file::create(util::core_file &file, UINT64 logicalbytes, UINT32 hu
* @return A chd_error.
*/
-chd_error chd_file::create(util::core_file &file, UINT64 logicalbytes, UINT32 hunkbytes, chd_codec_type compression[4], chd_file &parent)
+chd_error chd_file::create(util::core_file &file, uint64_t logicalbytes, uint32_t hunkbytes, chd_codec_type compression[4], chd_file &parent)
{
// make sure we don't already have a file open
if (m_file != nullptr)
@@ -637,7 +637,7 @@ chd_error chd_file::create(util::core_file &file, UINT64 logicalbytes, UINT32 hu
}
/**
- * @fn chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hunkbytes, UINT32 unitbytes, chd_codec_type compression[4])
+ * @fn chd_error chd_file::create(const char *filename, uint64_t logicalbytes, uint32_t hunkbytes, uint32_t unitbytes, chd_codec_type compression[4])
*
* @brief -------------------------------------------------
* create - create a new file with no parent using a filename
@@ -652,7 +652,7 @@ chd_error chd_file::create(util::core_file &file, UINT64 logicalbytes, UINT32 hu
* @return A chd_error.
*/
-chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hunkbytes, UINT32 unitbytes, chd_codec_type compression[4])
+chd_error chd_file::create(const char *filename, uint64_t logicalbytes, uint32_t hunkbytes, uint32_t unitbytes, chd_codec_type compression[4])
{
// make sure we don't already have a file open
if (m_file != nullptr)
@@ -682,7 +682,7 @@ chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hun
}
/**
- * @fn chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hunkbytes, chd_codec_type compression[4], chd_file &parent)
+ * @fn chd_error chd_file::create(const char *filename, uint64_t logicalbytes, uint32_t hunkbytes, chd_codec_type compression[4], chd_file &parent)
*
* @brief -------------------------------------------------
* create - create a new file with a parent using a filename
@@ -697,7 +697,7 @@ chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hun
* @return A chd_error.
*/
-chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hunkbytes, chd_codec_type compression[4], chd_file &parent)
+chd_error chd_file::create(const char *filename, uint64_t logicalbytes, uint32_t hunkbytes, chd_codec_type compression[4], chd_file &parent)
{
// make sure we don't already have a file open
if (m_file != nullptr)
@@ -747,7 +747,7 @@ chd_error chd_file::open(const char *filename, bool writeable, chd_file *parent)
return CHDERR_ALREADY_OPEN;
// open the file
- const UINT32 openflags = writeable ? (OPEN_FLAG_READ | OPEN_FLAG_WRITE) : OPEN_FLAG_READ;
+ const uint32_t openflags = writeable ? (OPEN_FLAG_READ | OPEN_FLAG_WRITE) : OPEN_FLAG_READ;
util::core_file::ptr file;
const osd_file::error filerr = util::core_file::open(filename, openflags, file);
if (filerr != osd_file::error::NONE)
@@ -847,7 +847,7 @@ void chd_file::close()
}
/**
- * @fn chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer)
+ * @fn chd_error chd_file::read_hunk(uint32_t hunknum, void *buffer)
*
* @brief -------------------------------------------------
* read - read a single hunk from the CHD file
@@ -869,7 +869,7 @@ void chd_file::close()
* @return The hunk.
*/
-chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer)
+chd_error chd_file::read_hunk(uint32_t hunknum, void *buffer)
{
// wrap this for clean reporting
try
@@ -883,11 +883,11 @@ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer)
throw CHDERR_HUNK_OUT_OF_RANGE;
// get a pointer to the map entry
- UINT64 blockoffs;
- UINT32 blocklen;
- UINT32 blockcrc;
- UINT8 *rawmap;
- UINT8 *dest = reinterpret_cast<UINT8 *>(buffer);
+ uint64_t blockoffs;
+ uint32_t blocklen;
+ uint32_t blockcrc;
+ uint8_t *rawmap;
+ uint8_t *dest = reinterpret_cast<uint8_t *>(buffer);
switch (m_version)
{
// v3/v4 map entries
@@ -914,7 +914,7 @@ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer)
case V34_MAP_ENTRY_TYPE_MINI:
be_write(dest, blockoffs, 8);
- for (UINT32 bytes = 8; bytes < m_hunkbytes; bytes++)
+ for (uint32_t bytes = 8; bytes < m_hunkbytes; bytes++)
dest[bytes] = dest[bytes - 8];
if (!(rawmap[15] & V34_MAP_ENTRY_FLAG_NO_CRC) && util::crc32_creator::simple(dest, m_hunkbytes) != blockcrc)
throw CHDERR_DECOMPRESSION_ERROR;
@@ -937,7 +937,7 @@ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer)
// uncompressed case
if (!compressed())
{
- blockoffs = UINT64(be_read(rawmap, 4)) * UINT64(m_hunkbytes);
+ blockoffs = uint64_t(be_read(rawmap, 4)) * uint64_t(m_hunkbytes);
if (blockoffs != 0)
file_read(blockoffs, dest, m_hunkbytes);
else if (m_parent_missing)
@@ -979,7 +979,7 @@ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer)
case COMPRESSION_PARENT:
if (m_parent_missing)
throw CHDERR_REQUIRES_PARENT;
- return m_parent->read_bytes(UINT64(blockoffs) * UINT64(m_parent->unit_bytes()), dest, m_hunkbytes);
+ return m_parent->read_bytes(uint64_t(blockoffs) * uint64_t(m_parent->unit_bytes()), dest, m_hunkbytes);
}
break;
}
@@ -996,7 +996,7 @@ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer)
}
/**
- * @fn chd_error chd_file::write_hunk(UINT32 hunknum, const void *buffer)
+ * @fn chd_error chd_file::write_hunk(uint32_t hunknum, const void *buffer)
*
* @brief -------------------------------------------------
* write - write a single hunk to the CHD file
@@ -1014,7 +1014,7 @@ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer)
* @return A chd_error.
*/
-chd_error chd_file::write_hunk(UINT32 hunknum, const void *buffer)
+chd_error chd_file::write_hunk(uint32_t hunknum, const void *buffer)
{
// wrap this for clean reporting
try
@@ -1036,16 +1036,16 @@ chd_error chd_file::write_hunk(UINT32 hunknum, const void *buffer)
throw CHDERR_FILE_NOT_WRITEABLE;
// see if we have allocated the space on disk for this hunk
- UINT8 *rawmap = &m_rawmap[hunknum * 4];
- UINT32 rawentry = be_read(rawmap, 4);
+ uint8_t *rawmap = &m_rawmap[hunknum * 4];
+ uint32_t rawentry = be_read(rawmap, 4);
// if not, allocate one now
if (rawentry == 0)
{
// first make sure we need to allocate it
bool all_zeros = true;
- const UINT32 *scan = reinterpret_cast<const UINT32 *>(buffer);
- for (UINT32 index = 0; index < m_hunkbytes / 4; index++)
+ const uint32_t *scan = reinterpret_cast<const uint32_t *>(buffer);
+ for (uint32_t index = 0; index < m_hunkbytes / 4; index++)
if (scan[index] != 0)
{
all_zeros = false;
@@ -1070,7 +1070,7 @@ chd_error chd_file::write_hunk(UINT32 hunknum, const void *buffer)
// otherwise, just overwrite
else
- file_write(UINT64(rawentry) * UINT64(m_hunkbytes), buffer, m_hunkbytes);
+ file_write(uint64_t(rawentry) * uint64_t(m_hunkbytes), buffer, m_hunkbytes);
return CHDERR_NONE;
}
@@ -1082,7 +1082,7 @@ chd_error chd_file::write_hunk(UINT32 hunknum, const void *buffer)
}
/**
- * @fn chd_error chd_file::read_units(UINT64 unitnum, void *buffer, UINT32 count)
+ * @fn chd_error chd_file::read_units(uint64_t unitnum, void *buffer, uint32_t count)
*
* @brief -------------------------------------------------
* read_units - read the given number of units from the CHD
@@ -1095,13 +1095,13 @@ chd_error chd_file::write_hunk(UINT32 hunknum, const void *buffer)
* @return The units.
*/
-chd_error chd_file::read_units(UINT64 unitnum, void *buffer, UINT32 count)
+chd_error chd_file::read_units(uint64_t unitnum, void *buffer, uint32_t count)
{
- return read_bytes(unitnum * UINT64(m_unitbytes), buffer, count * m_unitbytes);
+ return read_bytes(unitnum * uint64_t(m_unitbytes), buffer, count * m_unitbytes);
}
/**
- * @fn chd_error chd_file::write_units(UINT64 unitnum, const void *buffer, UINT32 count)
+ * @fn chd_error chd_file::write_units(uint64_t unitnum, const void *buffer, uint32_t count)
*
* @brief -------------------------------------------------
* write_units - write the given number of units to the CHD
@@ -1114,13 +1114,13 @@ chd_error chd_file::read_units(UINT64 unitnum, void *buffer, UINT32 count)
* @return A chd_error.
*/
-chd_error chd_file::write_units(UINT64 unitnum, const void *buffer, UINT32 count)
+chd_error chd_file::write_units(uint64_t unitnum, const void *buffer, uint32_t count)
{
- return write_bytes(unitnum * UINT64(m_unitbytes), buffer, count * m_unitbytes);
+ return write_bytes(unitnum * uint64_t(m_unitbytes), buffer, count * m_unitbytes);
}
/**
- * @fn chd_error chd_file::read_bytes(UINT64 offset, void *buffer, UINT32 bytes)
+ * @fn chd_error chd_file::read_bytes(uint64_t offset, void *buffer, uint32_t bytes)
*
* @brief -------------------------------------------------
* read_bytes - read from the CHD at a byte level, using the cache to handle partial
@@ -1134,17 +1134,17 @@ chd_error chd_file::write_units(UINT64 unitnum, const void *buffer, UINT32 count
* @return The bytes.
*/
-chd_error chd_file::read_bytes(UINT64 offset, void *buffer, UINT32 bytes)
+chd_error chd_file::read_bytes(uint64_t offset, void *buffer, uint32_t bytes)
{
// iterate over hunks
- UINT32 first_hunk = offset / m_hunkbytes;
- UINT32 last_hunk = (offset + bytes - 1) / m_hunkbytes;
- UINT8 *dest = reinterpret_cast<UINT8 *>(buffer);
- for (UINT32 curhunk = first_hunk; curhunk <= last_hunk; curhunk++)
+ uint32_t first_hunk = offset / m_hunkbytes;
+ uint32_t last_hunk = (offset + bytes - 1) / m_hunkbytes;
+ uint8_t *dest = reinterpret_cast<uint8_t *>(buffer);
+ for (uint32_t curhunk = first_hunk; curhunk <= last_hunk; curhunk++)
{
// determine start/end boundaries
- UINT32 startoffs = (curhunk == first_hunk) ? (offset % m_hunkbytes) : 0;
- UINT32 endoffs = (curhunk == last_hunk) ? ((offset + bytes - 1) % m_hunkbytes) : (m_hunkbytes - 1);
+ uint32_t startoffs = (curhunk == first_hunk) ? (offset % m_hunkbytes) : 0;
+ uint32_t endoffs = (curhunk == last_hunk) ? ((offset + bytes - 1) % m_hunkbytes) : (m_hunkbytes - 1);
// if it's a full block, just read directly from disk unless it's the cached hunk
chd_error err = CHDERR_NONE;
@@ -1173,7 +1173,7 @@ chd_error chd_file::read_bytes(UINT64 offset, void *buffer, UINT32 bytes)
}
/**
- * @fn chd_error chd_file::write_bytes(UINT64 offset, const void *buffer, UINT32 bytes)
+ * @fn chd_error chd_file::write_bytes(uint64_t offset, const void *buffer, uint32_t bytes)
*
* @brief -------------------------------------------------
* write_bytes - write to the CHD at a byte level, using the cache to handle partial
@@ -1187,17 +1187,17 @@ chd_error chd_file::read_bytes(UINT64 offset, void *buffer, UINT32 bytes)
* @return A chd_error.
*/
-chd_error chd_file::write_bytes(UINT64 offset, const void *buffer, UINT32 bytes)
+chd_error chd_file::write_bytes(uint64_t offset, const void *buffer, uint32_t bytes)
{
// iterate over hunks
- UINT32 first_hunk = offset / m_hunkbytes;
- UINT32 last_hunk = (offset + bytes - 1) / m_hunkbytes;
- const UINT8 *source = reinterpret_cast<const UINT8 *>(buffer);
- for (UINT32 curhunk = first_hunk; curhunk <= last_hunk; curhunk++)
+ uint32_t first_hunk = offset / m_hunkbytes;
+ uint32_t last_hunk = (offset + bytes - 1) / m_hunkbytes;
+ const uint8_t *source = reinterpret_cast<const uint8_t *>(buffer);
+ for (uint32_t curhunk = first_hunk; curhunk <= last_hunk; curhunk++)
{
// determine start/end boundaries
- UINT32 startoffs = (curhunk == first_hunk) ? (offset % m_hunkbytes) : 0;
- UINT32 endoffs = (curhunk == last_hunk) ? ((offset + bytes - 1) % m_hunkbytes) : (m_hunkbytes - 1);
+ uint32_t startoffs = (curhunk == first_hunk) ? (offset % m_hunkbytes) : 0;
+ uint32_t endoffs = (curhunk == last_hunk) ? ((offset + bytes - 1) % m_hunkbytes) : (m_hunkbytes - 1);
// if it's a full block, just write directly to disk unless it's the cached hunk
chd_error err = CHDERR_NONE;
@@ -1227,7 +1227,7 @@ chd_error chd_file::write_bytes(UINT64 offset, const void *buffer, UINT32 bytes)
}
/**
- * @fn chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, std::string &output)
+ * @fn chd_error chd_file::read_metadata(chd_metadata_tag searchtag, uint32_t searchindex, std::string &output)
*
* @brief -------------------------------------------------
* read_metadata - read the indexed metadata of the given type
@@ -1243,7 +1243,7 @@ chd_error chd_file::write_bytes(UINT64 offset, const void *buffer, UINT32 bytes)
* @return The metadata.
*/
-chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, std::string &output)
+chd_error chd_file::read_metadata(chd_metadata_tag searchtag, uint32_t searchindex, std::string &output)
{
// wrap this for clean reporting
try
@@ -1271,7 +1271,7 @@ 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, std::vector<UINT8> &output)
+ * @fn chd_error chd_file::read_metadata(chd_metadata_tag searchtag, uint32_t searchindex, std::vector<uint8_t> &output)
*
* @brief Reads a metadata.
*
@@ -1285,7 +1285,7 @@ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex
* @return The metadata.
*/
-chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, std::vector<UINT8> &output)
+chd_error chd_file::read_metadata(chd_metadata_tag searchtag, uint32_t searchindex, std::vector<uint8_t> &output)
{
// wrap this for clean reporting
try
@@ -1309,7 +1309,7 @@ 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)
+ * @fn chd_error chd_file::read_metadata(chd_metadata_tag searchtag, uint32_t searchindex, void *output, uint32_t outputlen, uint32_t &resultlen)
*
* @brief Reads a metadata.
*
@@ -1325,7 +1325,7 @@ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex
* @return The metadata.
*/
-chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, void *output, UINT32 outputlen, UINT32 &resultlen)
+chd_error chd_file::read_metadata(chd_metadata_tag searchtag, uint32_t searchindex, void *output, uint32_t outputlen, uint32_t &resultlen)
{
// wrap this for clean reporting
try
@@ -1349,7 +1349,7 @@ 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, std::vector<UINT8> &output, chd_metadata_tag &resulttag, UINT8 &resultflags)
+ * @fn chd_error chd_file::read_metadata(chd_metadata_tag searchtag, uint32_t searchindex, std::vector<uint8_t> &output, chd_metadata_tag &resulttag, uint8_t &resultflags)
*
* @brief Reads a metadata.
*
@@ -1365,7 +1365,7 @@ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex
* @return The metadata.
*/
-chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, std::vector<UINT8> &output, chd_metadata_tag &resulttag, UINT8 &resultflags)
+chd_error chd_file::read_metadata(chd_metadata_tag searchtag, uint32_t searchindex, std::vector<uint8_t> &output, chd_metadata_tag &resulttag, uint8_t &resultflags)
{
// wrap this for clean reporting
try
@@ -1391,7 +1391,7 @@ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex
}
/**
- * @fn chd_error chd_file::write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const void *inputbuf, UINT32 inputlen, UINT8 flags)
+ * @fn chd_error chd_file::write_metadata(chd_metadata_tag metatag, uint32_t metaindex, const void *inputbuf, uint32_t inputlen, uint8_t flags)
*
* @brief -------------------------------------------------
* write_metadata - write the indexed metadata of the given type
@@ -1406,7 +1406,7 @@ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex
* @return A chd_error.
*/
-chd_error chd_file::write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const void *inputbuf, UINT32 inputlen, UINT8 flags)
+chd_error chd_file::write_metadata(chd_metadata_tag metatag, uint32_t metaindex, const void *inputbuf, uint32_t inputlen, uint8_t flags)
{
// wrap this for clean reporting
try
@@ -1428,7 +1428,7 @@ chd_error chd_file::write_metadata(chd_metadata_tag metatag, UINT32 metaindex, c
// if the lengths don't match, we need to update the length in our header
if (inputlen != metaentry.length)
{
- UINT8 length[3];
+ uint8_t length[3];
be_write(length, inputlen, 3);
file_write(metaentry.offset + 5, length, sizeof(length));
}
@@ -1446,14 +1446,14 @@ chd_error chd_file::write_metadata(chd_metadata_tag metatag, UINT32 metaindex, c
if (!finished)
{
// now build us a new entry
- UINT8 raw_meta_header[METADATA_HEADER_SIZE];
+ uint8_t raw_meta_header[METADATA_HEADER_SIZE];
be_write(&raw_meta_header[0], metatag, 4);
raw_meta_header[4] = flags;
be_write(&raw_meta_header[5], (inputlen & 0x00ffffff) | (flags << 24), 3);
be_write(&raw_meta_header[8], 0, 8);
// append the new header, then the data
- UINT64 offset = file_append(raw_meta_header, sizeof(raw_meta_header));
+ uint64_t offset = file_append(raw_meta_header, sizeof(raw_meta_header));
file_append(inputbuf, inputlen);
// set the previous entry to point to us
@@ -1473,7 +1473,7 @@ chd_error chd_file::write_metadata(chd_metadata_tag metatag, UINT32 metaindex, c
}
/**
- * @fn chd_error chd_file::delete_metadata(chd_metadata_tag metatag, UINT32 metaindex)
+ * @fn chd_error chd_file::delete_metadata(chd_metadata_tag metatag, uint32_t metaindex)
*
* @brief -------------------------------------------------
* delete_metadata - remove the given metadata from the list
@@ -1488,7 +1488,7 @@ chd_error chd_file::write_metadata(chd_metadata_tag metatag, UINT32 metaindex, c
* @return A chd_error.
*/
-chd_error chd_file::delete_metadata(chd_metadata_tag metatag, UINT32 metaindex)
+chd_error chd_file::delete_metadata(chd_metadata_tag metatag, uint32_t metaindex)
{
// wrap this for clean reporting
try
@@ -1530,7 +1530,7 @@ chd_error chd_file::clone_all_metadata(chd_file &source)
try
{
// iterate over metadata entries in the source
- std::vector<UINT8> filedata;
+ std::vector<uint8_t> filedata;
metadata_entry metaentry;
metaentry.metatag = 0;
metaentry.length = 0;
@@ -1543,7 +1543,7 @@ chd_error chd_file::clone_all_metadata(chd_file &source)
source.file_read(metaentry.offset + METADATA_HEADER_SIZE, &filedata[0], metaentry.length);
// write it to the destination
- chd_error err = write_metadata(metaentry.metatag, (UINT32)-1, &filedata[0], metaentry.length, metaentry.flags);
+ chd_error err = write_metadata(metaentry.metatag, (uint32_t)-1, &filedata[0], metaentry.length, metaentry.flags);
if (err != CHDERR_NONE)
throw err;
}
@@ -1577,7 +1577,7 @@ util::sha1_t chd_file::compute_overall_sha1(util::sha1_t rawsha1)
return rawsha1;
// iterate over metadata
- std::vector<UINT8> filedata;
+ std::vector<uint8_t> filedata;
std::vector<metadata_hash> hasharray;
metadata_entry metaentry;
for (bool has_data = metadata_find(CHDMETATAG_WILDCARD, 0, metaentry); has_data; has_data = metadata_find(CHDMETATAG_WILDCARD, 0, metaentry, true))
@@ -1704,17 +1704,17 @@ const char *chd_file::error_string(chd_error err)
//**************************************************************************
/**
- * @fn UINT32 chd_file::guess_unitbytes()
+ * @fn uint32_t chd_file::guess_unitbytes()
*
* @brief -------------------------------------------------
* guess_unitbytes - for older CHD formats, take a guess at the bytes/unit based on
* metadata
* -------------------------------------------------.
*
- * @return An UINT32.
+ * @return An uint32_t.
*/
-UINT32 chd_file::guess_unitbytes()
+uint32_t chd_file::guess_unitbytes()
{
// look for hard disk metadata; if found, then the unit size == sector size
std::string metadata;
@@ -1735,7 +1735,7 @@ UINT32 chd_file::guess_unitbytes()
}
/**
- * @fn void chd_file::parse_v3_header(UINT8 *rawheader, sha1_t &parentsha1)
+ * @fn void chd_file::parse_v3_header(uint8_t *rawheader, sha1_t &parentsha1)
*
* @brief -------------------------------------------------
* parse_v3_header - parse the header from a v3 file and configure core parameters
@@ -1750,7 +1750,7 @@ UINT32 chd_file::guess_unitbytes()
* @param [in,out] parentsha1 The first parentsha.
*/
-void chd_file::parse_v3_header(UINT8 *rawheader, util::sha1_t &parentsha1)
+void chd_file::parse_v3_header(uint8_t *rawheader, util::sha1_t &parentsha1)
{
// verify header length
if (be_read(&rawheader[8], 4) != V3_HEADER_SIZE)
@@ -1764,7 +1764,7 @@ void chd_file::parse_v3_header(UINT8 *rawheader, util::sha1_t &parentsha1)
m_hunkcount = be_read(&rawheader[24], 4);
// extract parent SHA-1
- UINT32 flags = be_read(&rawheader[16], 4);
+ uint32_t flags = be_read(&rawheader[16], 4);
m_allow_writes = (flags & 2) == 0;
// determine compression
@@ -1798,7 +1798,7 @@ void chd_file::parse_v3_header(UINT8 *rawheader, util::sha1_t &parentsha1)
}
/**
- * @fn void chd_file::parse_v4_header(UINT8 *rawheader, sha1_t &parentsha1)
+ * @fn void chd_file::parse_v4_header(uint8_t *rawheader, sha1_t &parentsha1)
*
* @brief -------------------------------------------------
* parse_v4_header - parse the header from a v4 file and configure core parameters
@@ -1813,7 +1813,7 @@ void chd_file::parse_v3_header(UINT8 *rawheader, util::sha1_t &parentsha1)
* @param [in,out] parentsha1 The first parentsha.
*/
-void chd_file::parse_v4_header(UINT8 *rawheader, util::sha1_t &parentsha1)
+void chd_file::parse_v4_header(uint8_t *rawheader, util::sha1_t &parentsha1)
{
// verify header length
if (be_read(&rawheader[8], 4) != V4_HEADER_SIZE)
@@ -1827,7 +1827,7 @@ void chd_file::parse_v4_header(UINT8 *rawheader, util::sha1_t &parentsha1)
m_hunkcount = be_read(&rawheader[24], 4);
// extract parent SHA-1
- UINT32 flags = be_read(&rawheader[16], 4);
+ uint32_t flags = be_read(&rawheader[16], 4);
m_allow_writes = (flags & 2) == 0;
// determine compression
@@ -1861,7 +1861,7 @@ void chd_file::parse_v4_header(UINT8 *rawheader, util::sha1_t &parentsha1)
}
/**
- * @fn void chd_file::parse_v5_header(UINT8 *rawheader, sha1_t &parentsha1)
+ * @fn void chd_file::parse_v5_header(uint8_t *rawheader, sha1_t &parentsha1)
*
* @brief -------------------------------------------------
* parse_v5_header - read the header from a v5 file and configure core parameters
@@ -1873,7 +1873,7 @@ void chd_file::parse_v4_header(UINT8 *rawheader, util::sha1_t &parentsha1)
* @param [in,out] parentsha1 The first parentsha.
*/
-void chd_file::parse_v5_header(UINT8 *rawheader, util::sha1_t &parentsha1)
+void chd_file::parse_v5_header(uint8_t *rawheader, util::sha1_t &parentsha1)
{
// verify header length
if (be_read(&rawheader[8], 4) != V5_HEADER_SIZE)
@@ -1931,29 +1931,29 @@ chd_error chd_file::compress_v5_map()
util::crc16_t mapcrc = util::crc16_creator::simple(&m_rawmap[0], m_hunkcount * 12);
// create a buffer to hold the RLE data
- std::vector<UINT8> compression_rle(m_hunkcount);
- UINT8 *dest = &compression_rle[0];
+ std::vector<uint8_t> compression_rle(m_hunkcount);
+ uint8_t *dest = &compression_rle[0];
// use a huffman encoder for 16 different codes, maximum length is 8 bits
huffman_encoder<16, 8> encoder;
encoder.histo_reset();
// RLE-compress the compression type since we expect runs of the same
- UINT32 max_self = 0;
- UINT32 last_self = 0;
- UINT64 max_parent = 0;
- UINT64 last_parent = 0;
- UINT32 max_complen = 0;
- UINT8 lastcomp = 0;
+ uint32_t max_self = 0;
+ uint32_t last_self = 0;
+ uint64_t max_parent = 0;
+ uint64_t last_parent = 0;
+ uint32_t max_complen = 0;
+ uint8_t lastcomp = 0;
int count = 0;
for (int hunknum = 0; hunknum < m_hunkcount; hunknum++)
{
- UINT8 curcomp = m_rawmap[hunknum * 12 + 0];
+ uint8_t curcomp = m_rawmap[hunknum * 12 + 0];
// promote self block references to more compact forms
if (curcomp == COMPRESSION_SELF)
{
- UINT32 refhunk = be_read(&m_rawmap[hunknum * 12 + 4], 6);
+ uint32_t refhunk = be_read(&m_rawmap[hunknum * 12 + 4], 6);
if (refhunk == last_self)
curcomp = COMPRESSION_SELF_0;
else if (refhunk == last_self + 1)
@@ -1966,21 +1966,21 @@ chd_error chd_file::compress_v5_map()
// promote parent block references to more compact forms
else if (curcomp == COMPRESSION_PARENT)
{
- UINT32 refunit = be_read(&m_rawmap[hunknum * 12 + 4], 6);
- if (refunit == (UINT64(hunknum) * UINT64(m_hunkbytes)) / m_unitbytes)
+ uint32_t refunit = be_read(&m_rawmap[hunknum * 12 + 4], 6);
+ if (refunit == (uint64_t(hunknum) * uint64_t(m_hunkbytes)) / m_unitbytes)
curcomp = COMPRESSION_PARENT_SELF;
else if (refunit == last_parent)
curcomp = COMPRESSION_PARENT_0;
else if (refunit == last_parent + m_hunkbytes / m_unitbytes)
curcomp = COMPRESSION_PARENT_1;
else
- max_parent = std::max(max_parent, UINT64(refunit));
+ max_parent = std::max(max_parent, uint64_t(refunit));
last_parent = refunit;
}
// track maximum compressed length
else //if (curcomp >= COMPRESSION_TYPE_0 && curcomp <= COMPRESSION_TYPE_3)
- max_complen = std::max(max_complen, UINT32(be_read(&m_rawmap[hunknum * 12 + 1], 3)));
+ max_complen = std::max(max_complen, uint32_t(be_read(&m_rawmap[hunknum * 12 + 1], 3)));
// track repeats
if (curcomp == lastcomp)
@@ -2014,7 +2014,7 @@ chd_error chd_file::compress_v5_map()
}
// compute a tree and export it to the buffer
- std::vector<UINT8> compressed(m_hunkcount * 6);
+ std::vector<uint8_t> compressed(m_hunkcount * 6);
bitstream_out bitbuf(&compressed[16], compressed.size() - 16);
huffman_error err = encoder.compute_tree_from_histo();
if (err != HUFFERR_NONE)
@@ -2024,31 +2024,31 @@ chd_error chd_file::compress_v5_map()
throw CHDERR_COMPRESSION_ERROR;
// encode the data
- for (UINT8 *src = &compression_rle[0]; src < dest; src++)
+ for (uint8_t *src = &compression_rle[0]; src < dest; src++)
encoder.encode_one(bitbuf, *src);
// determine the number of bits we need to hold the a length
// and a hunk index
- UINT8 lengthbits = bits_for_value(max_complen);
- UINT8 selfbits = bits_for_value(max_self);
- UINT8 parentbits = bits_for_value(max_parent);
+ uint8_t lengthbits = bits_for_value(max_complen);
+ uint8_t selfbits = bits_for_value(max_self);
+ uint8_t parentbits = bits_for_value(max_parent);
// for each compression type, output the relevant data
lastcomp = 0;
count = 0;
- UINT8 *src = &compression_rle[0];
- UINT64 firstoffs = 0;
+ uint8_t *src = &compression_rle[0];
+ uint64_t firstoffs = 0;
for (int hunknum = 0; hunknum < m_hunkcount; hunknum++)
{
- UINT8 *rawmap = &m_rawmap[hunknum * 12];
- UINT32 length = be_read(&rawmap[1], 3);
- UINT64 offset = be_read(&rawmap[4], 6);
- UINT16 crc = be_read(&rawmap[10], 2);
+ uint8_t *rawmap = &m_rawmap[hunknum * 12];
+ uint32_t length = be_read(&rawmap[1], 3);
+ uint64_t offset = be_read(&rawmap[4], 6);
+ uint16_t crc = be_read(&rawmap[10], 2);
// if no count remaining, fetch the next entry
if (count == 0)
{
- UINT8 val = *src++;
+ uint8_t val = *src++;
if (val == COMPRESSION_RLE_SMALL)
count = 2 + *src++;
else if (val == COMPRESSION_RLE_LARGE)
@@ -2080,12 +2080,12 @@ chd_error chd_file::compress_v5_map()
break;
case COMPRESSION_SELF:
- assert(offset < (UINT64(1) << selfbits));
+ assert(offset < (uint64_t(1) << selfbits));
bitbuf.write(offset, selfbits);
break;
case COMPRESSION_PARENT:
- assert(offset < (UINT64(1) << parentbits));
+ assert(offset < (uint64_t(1) << parentbits));
bitbuf.write(offset, parentbits);
break;
@@ -2099,7 +2099,7 @@ chd_error chd_file::compress_v5_map()
}
// write the map header
- UINT32 complen = bitbuf.flush();
+ uint32_t complen = bitbuf.flush();
assert(!bitbuf.overflow());
be_write(&compressed[0], complen, 4);
be_write(&compressed[4], firstoffs, 6);
@@ -2113,7 +2113,7 @@ chd_error chd_file::compress_v5_map()
m_mapoffset = file_append(&compressed[0], complen + 16);
// then write the map offset
- UINT8 rawbuf[sizeof(UINT64)];
+ uint8_t rawbuf[sizeof(uint64_t)];
be_write(rawbuf, m_mapoffset, 8);
file_write(m_mapoffset_offset, rawbuf, sizeof(rawbuf));
return CHDERR_NONE;
@@ -2145,17 +2145,17 @@ void chd_file::decompress_v5_map()
}
// read the reader
- UINT8 rawbuf[16];
+ uint8_t rawbuf[16];
file_read(m_mapoffset, rawbuf, sizeof(rawbuf));
- UINT32 mapbytes = be_read(&rawbuf[0], 4);
- UINT64 firstoffs = be_read(&rawbuf[4], 6);
- UINT16 mapcrc = be_read(&rawbuf[10], 2);
- UINT8 lengthbits = rawbuf[12];
- UINT8 selfbits = rawbuf[13];
- UINT8 parentbits = rawbuf[14];
+ uint32_t mapbytes = be_read(&rawbuf[0], 4);
+ uint64_t firstoffs = be_read(&rawbuf[4], 6);
+ uint16_t mapcrc = be_read(&rawbuf[10], 2);
+ uint8_t lengthbits = rawbuf[12];
+ uint8_t selfbits = rawbuf[13];
+ uint8_t parentbits = rawbuf[14];
// now read the map
- std::vector<UINT8> compressed(mapbytes);
+ std::vector<uint8_t> compressed(mapbytes);
file_read(m_mapoffset + 16, &compressed[0], mapbytes);
bitstream_in bitbuf(&compressed[0], compressed.size());
@@ -2164,16 +2164,16 @@ void chd_file::decompress_v5_map()
huffman_error err = decoder.import_tree_rle(bitbuf);
if (err != HUFFERR_NONE)
throw CHDERR_DECOMPRESSION_ERROR;
- UINT8 lastcomp = 0;
+ uint8_t lastcomp = 0;
int repcount = 0;
for (int hunknum = 0; hunknum < m_hunkcount; hunknum++)
{
- UINT8 *rawmap = &m_rawmap[hunknum * 12];
+ uint8_t *rawmap = &m_rawmap[hunknum * 12];
if (repcount > 0)
rawmap[0] = lastcomp, repcount--;
else
{
- UINT8 val = decoder.decode_one(bitbuf);
+ uint8_t val = decoder.decode_one(bitbuf);
if (val == COMPRESSION_RLE_SMALL)
rawmap[0] = lastcomp, repcount = 2 + decoder.decode_one(bitbuf);
else if (val == COMPRESSION_RLE_LARGE)
@@ -2184,15 +2184,15 @@ void chd_file::decompress_v5_map()
}
// then iterate through the hunks and extract the needed data
- UINT64 curoffset = firstoffs;
- UINT32 last_self = 0;
- UINT64 last_parent = 0;
+ uint64_t curoffset = firstoffs;
+ uint32_t last_self = 0;
+ uint64_t last_parent = 0;
for (int hunknum = 0; hunknum < m_hunkcount; hunknum++)
{
- UINT8 *rawmap = &m_rawmap[hunknum * 12];
- UINT64 offset = curoffset;
- UINT32 length = 0;
- UINT16 crc = 0;
+ uint8_t *rawmap = &m_rawmap[hunknum * 12];
+ uint64_t offset = curoffset;
+ uint32_t length = 0;
+ uint16_t crc = 0;
switch (rawmap[0])
{
// base types
@@ -2228,7 +2228,7 @@ void chd_file::decompress_v5_map()
case COMPRESSION_PARENT_SELF:
rawmap[0] = COMPRESSION_PARENT;
- last_parent = offset = (UINT64(hunknum) * UINT64(m_hunkbytes)) / m_unitbytes;
+ last_parent = offset = (uint64_t(hunknum) * uint64_t(m_hunkbytes)) / m_unitbytes;
break;
case COMPRESSION_PARENT_1:
@@ -2297,7 +2297,7 @@ chd_error chd_file::create_common()
}
// create our V5 header
- UINT8 rawheader[V5_HEADER_SIZE];
+ uint8_t rawheader[V5_HEADER_SIZE];
memcpy(&rawheader[0], "MComprHD", 8);
be_write(&rawheader[8], V5_HEADER_SIZE, 4);
be_write(&rawheader[12], m_version, 4);
@@ -2328,12 +2328,12 @@ chd_error chd_file::create_common()
// write out the map (if not compressed)
if (!compressed())
{
- UINT32 mapsize = m_mapentrybytes * m_hunkcount;
- UINT8 buffer[4096] = { 0 };
- UINT64 offset = m_mapoffset;
+ uint32_t mapsize = m_mapentrybytes * m_hunkcount;
+ uint8_t buffer[4096] = { 0 };
+ uint64_t offset = m_mapoffset;
while (mapsize != 0)
{
- UINT32 bytes_to_write = (std::min<size_t>)(mapsize, sizeof(buffer));
+ uint32_t bytes_to_write = (std::min<size_t>)(mapsize, sizeof(buffer));
file_write(offset, buffer, bytes_to_write);
offset += bytes_to_write;
mapsize -= bytes_to_write;
@@ -2390,7 +2390,7 @@ chd_error chd_file::open_common(bool writeable)
m_allow_reads = true;
// read the raw header
- UINT8 rawheader[MAX_HEADER_SIZE];
+ uint8_t rawheader[MAX_HEADER_SIZE];
file_read(0, rawheader, sizeof(rawheader));
// verify the signature
@@ -2473,7 +2473,7 @@ void chd_file::create_open_common()
}
/**
- * @fn void chd_file::verify_proper_compression_append(UINT32 hunknum)
+ * @fn void chd_file::verify_proper_compression_append(uint32_t hunknum)
*
* @brief -------------------------------------------------
* verify_proper_compression_append - verify that the given hunk is a proper candidate
@@ -2491,7 +2491,7 @@ void chd_file::create_open_common()
* @param hunknum The hunknum.
*/
-void chd_file::verify_proper_compression_append(UINT32 hunknum)
+void chd_file::verify_proper_compression_append(uint32_t hunknum)
{
// punt if no file
if (m_file == nullptr)
@@ -2510,7 +2510,7 @@ void chd_file::verify_proper_compression_append(UINT32 hunknum)
throw CHDERR_FILE_NOT_WRITEABLE;
// only permitted to write new blocks
- UINT8 *rawmap = &m_rawmap[hunknum * 12];
+ uint8_t *rawmap = &m_rawmap[hunknum * 12];
if (rawmap[0] != 0xff)
throw CHDERR_COMPRESSION_ERROR;
@@ -2521,7 +2521,7 @@ void chd_file::verify_proper_compression_append(UINT32 hunknum)
}
/**
- * @fn void chd_file::hunk_write_compressed(UINT32 hunknum, INT8 compression, const UINT8 *compressed, UINT32 complength, crc16_t crc16)
+ * @fn void chd_file::hunk_write_compressed(uint32_t hunknum, int8_t compression, const uint8_t *compressed, uint32_t complength, crc16_t crc16)
*
* @brief -------------------------------------------------
* hunk_write_compressed - write a hunk to a compressed CHD, discovering the best
@@ -2535,16 +2535,16 @@ void chd_file::verify_proper_compression_append(UINT32 hunknum)
* @param crc16 The CRC 16.
*/
-void chd_file::hunk_write_compressed(UINT32 hunknum, INT8 compression, const UINT8 *compressed, UINT32 complength, util::crc16_t crc16)
+void chd_file::hunk_write_compressed(uint32_t hunknum, int8_t compression, const uint8_t *compressed, uint32_t complength, util::crc16_t crc16)
{
// verify that we are appending properly to a compressed file
verify_proper_compression_append(hunknum);
// write the final result
- UINT64 offset = file_append(compressed, complength);
+ uint64_t offset = file_append(compressed, complength);
// update the map entry
- UINT8 *rawmap = &m_rawmap[hunknum * 12];
+ uint8_t *rawmap = &m_rawmap[hunknum * 12];
rawmap[0] = (compression == -1) ? COMPRESSION_NONE : compression;
be_write(&rawmap[1], complength, 3);
be_write(&rawmap[4], offset, 6);
@@ -2552,7 +2552,7 @@ void chd_file::hunk_write_compressed(UINT32 hunknum, INT8 compression, const UIN
}
/**
- * @fn void chd_file::hunk_copy_from_self(UINT32 hunknum, UINT32 otherhunk)
+ * @fn void chd_file::hunk_copy_from_self(uint32_t hunknum, uint32_t otherhunk)
*
* @brief -------------------------------------------------
* hunk_copy_from_self - mark a hunk as being a copy of another hunk in the same CHD
@@ -2565,7 +2565,7 @@ void chd_file::hunk_write_compressed(UINT32 hunknum, INT8 compression, const UIN
* @param otherhunk The otherhunk.
*/
-void chd_file::hunk_copy_from_self(UINT32 hunknum, UINT32 otherhunk)
+void chd_file::hunk_copy_from_self(uint32_t hunknum, uint32_t otherhunk)
{
// verify that we are appending properly to a compressed file
verify_proper_compression_append(hunknum);
@@ -2575,7 +2575,7 @@ void chd_file::hunk_copy_from_self(UINT32 hunknum, UINT32 otherhunk)
throw CHDERR_INVALID_PARAMETER;
// update the map entry
- UINT8 *rawmap = &m_rawmap[hunknum * 12];
+ uint8_t *rawmap = &m_rawmap[hunknum * 12];
rawmap[0] = COMPRESSION_SELF;
be_write(&rawmap[1], 0, 3);
be_write(&rawmap[4], otherhunk, 6);
@@ -2583,7 +2583,7 @@ void chd_file::hunk_copy_from_self(UINT32 hunknum, UINT32 otherhunk)
}
/**
- * @fn void chd_file::hunk_copy_from_parent(UINT32 hunknum, UINT64 parentunit)
+ * @fn void chd_file::hunk_copy_from_parent(uint32_t hunknum, uint64_t parentunit)
*
* @brief -------------------------------------------------
* hunk_copy_from_parent - mark a hunk as being a copy of a hunk from a parent CHD
@@ -2593,13 +2593,13 @@ void chd_file::hunk_copy_from_self(UINT32 hunknum, UINT32 otherhunk)
* @param parentunit The parentunit.
*/
-void chd_file::hunk_copy_from_parent(UINT32 hunknum, UINT64 parentunit)
+void chd_file::hunk_copy_from_parent(uint32_t hunknum, uint64_t parentunit)
{
// verify that we are appending properly to a compressed file
verify_proper_compression_append(hunknum);
// update the map entry
- UINT8 *rawmap = &m_rawmap[hunknum * 12];
+ uint8_t *rawmap = &m_rawmap[hunknum * 12];
rawmap[0] = COMPRESSION_PARENT;
be_write(&rawmap[1], 0, 3);
be_write(&rawmap[4], parentunit, 6);
@@ -2607,7 +2607,7 @@ void chd_file::hunk_copy_from_parent(UINT32 hunknum, UINT64 parentunit)
}
/**
- * @fn bool chd_file::metadata_find(chd_metadata_tag metatag, INT32 metaindex, metadata_entry &metaentry, bool resume)
+ * @fn bool chd_file::metadata_find(chd_metadata_tag metatag, int32_t metaindex, metadata_entry &metaentry, bool resume)
*
* @brief -------------------------------------------------
* metadata_find - find a metadata entry
@@ -2621,7 +2621,7 @@ void chd_file::hunk_copy_from_parent(UINT32 hunknum, UINT64 parentunit)
* @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)
+bool chd_file::metadata_find(chd_metadata_tag metatag, int32_t metaindex, metadata_entry &metaentry, bool resume)
{
// start at the beginning unless we're resuming a previous search
if (!resume)
@@ -2639,7 +2639,7 @@ bool chd_file::metadata_find(chd_metadata_tag metatag, INT32 metaindex, metadata
while (metaentry.offset != 0)
{
// read the raw header
- UINT8 raw_meta_header[METADATA_HEADER_SIZE];
+ uint8_t raw_meta_header[METADATA_HEADER_SIZE];
file_read(metaentry.offset, raw_meta_header, sizeof(raw_meta_header));
// extract the data
@@ -2663,7 +2663,7 @@ bool chd_file::metadata_find(chd_metadata_tag metatag, INT32 metaindex, metadata
}
/**
- * @fn void chd_file::metadata_set_previous_next(UINT64 prevoffset, UINT64 nextoffset)
+ * @fn void chd_file::metadata_set_previous_next(uint64_t prevoffset, uint64_t nextoffset)
*
* @brief -------------------------------------------------
* metadata_set_previous_next - set the 'next' offset of a piece of metadata
@@ -2673,9 +2673,9 @@ bool chd_file::metadata_find(chd_metadata_tag metatag, INT32 metaindex, metadata
* @param nextoffset The nextoffset.
*/
-void chd_file::metadata_set_previous_next(UINT64 prevoffset, UINT64 nextoffset)
+void chd_file::metadata_set_previous_next(uint64_t prevoffset, uint64_t nextoffset)
{
- UINT64 offset = 0;
+ uint64_t offset = 0;
// if we were the first entry, make the next entry the first
if (prevoffset == 0)
@@ -2689,7 +2689,7 @@ void chd_file::metadata_set_previous_next(UINT64 prevoffset, UINT64 nextoffset)
offset = prevoffset + 8;
// create a big-endian version
- UINT8 rawbuf[sizeof(UINT64)];
+ uint8_t rawbuf[sizeof(uint64_t)];
be_write(rawbuf, nextoffset, 8);
// write to the header and update our local copy
@@ -2714,7 +2714,7 @@ void chd_file::metadata_update_hash()
util::sha1_t fullsha1 = compute_overall_sha1(raw_sha1());
// create a big-endian version
- UINT8 rawbuf[sizeof(util::sha1_t)];
+ uint8_t rawbuf[sizeof(util::sha1_t)];
be_write_sha1(&rawbuf[0], fullsha1);
// write to the header
@@ -2863,9 +2863,9 @@ chd_error chd_file_compressor::compress_continue(double &progress, double &ratio
while (m_read_queue_offset < m_logicalbytes && osd_work_queue_items(m_read_queue) < 2)
{
// see if we have enough free work items to read the next half of a buffer
- UINT32 startitem = m_read_queue_offset / hunk_bytes();
- UINT32 enditem = startitem + WORK_BUFFER_HUNKS / 2;
- UINT32 curitem;
+ uint32_t startitem = m_read_queue_offset / hunk_bytes();
+ uint32_t enditem = startitem + WORK_BUFFER_HUNKS / 2;
+ uint32_t curitem;
for (curitem = startitem; curitem < enditem; curitem++)
if (m_work_item[curitem % WORK_BUFFER_HUNKS].m_status != WS_READY)
break;
@@ -2899,11 +2899,11 @@ chd_error chd_file_compressor::compress_continue(double &progress, double &ratio
// for parent walking, just add to the hashmap
if (m_walking_parent)
{
- UINT32 uph = hunk_bytes() / unit_bytes();
- UINT32 units = uph;
+ uint32_t uph = hunk_bytes() / unit_bytes();
+ uint32_t units = uph;
if (item.m_hunknum == hunk_count() - 1 || !compressed())
units = 1;
- for (UINT32 unit = 0; unit < units; unit++)
+ for (uint32_t unit = 0; unit < units; unit++)
if (m_parent_map.find(item.m_hash[unit].m_crc16, item.m_hash[unit].m_sha1) == hashmap::NOT_FOUND)
m_parent_map.add(item.m_hunknum * uph + unit, item.m_hash[unit].m_crc16, item.m_hash[unit].m_sha1);
}
@@ -2917,7 +2917,7 @@ chd_error chd_file_compressor::compress_continue(double &progress, double &ratio
// writes of all-0 data don't actually take space, so see if we count this
chd_codec_type codec = CHD_CODEC_NONE;
- UINT32 complen;
+ uint32_t complen;
hunk_info(item.m_hunknum, codec, complen);
if (codec == CHD_CODEC_NONE)
m_total_out += m_hunkbytes;
@@ -2927,7 +2927,7 @@ chd_error chd_file_compressor::compress_continue(double &progress, double &ratio
else do
{
// first see if the hunk is in the parent or self maps
- UINT64 selfhunk = m_current_map.find(item.m_hash[0].m_crc16, item.m_hash[0].m_sha1);
+ uint64_t selfhunk = m_current_map.find(item.m_hash[0].m_crc16, item.m_hash[0].m_sha1);
if (selfhunk != hashmap::NOT_FOUND)
{
hunk_copy_from_self(item.m_hunknum, selfhunk);
@@ -2937,7 +2937,7 @@ chd_error chd_file_compressor::compress_continue(double &progress, double &ratio
// if not, see if it's in the parent map
if (m_parent != nullptr)
{
- UINT64 parentunit = m_parent_map.find(item.m_hash[0].m_crc16, item.m_hash[0].m_sha1);
+ uint64_t parentunit = m_parent_map.find(item.m_hash[0].m_crc16, item.m_hash[0].m_sha1);
if (parentunit != hashmap::NOT_FOUND)
{
hunk_copy_from_parent(item.m_hunknum, parentunit);
@@ -3028,10 +3028,10 @@ void *chd_file_compressor::async_walk_parent_static(void *param, int threadid)
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
- UINT32 units = hunk_bytes() / unit_bytes();
+ uint32_t units = hunk_bytes() / unit_bytes();
if (item.m_hunknum == m_hunkcount - 1 || !compressed())
units = 1;
- for (UINT32 unit = 0; unit < units; unit++)
+ for (uint32_t unit = 0; unit < units; unit++)
{
item.m_hash[unit].m_crc16 = util::crc16_creator::simple(item.m_data + unit * unit_bytes(), hunk_bytes());
item.m_hash[unit].m_sha1 = util::sha1_creator::simple(item.m_data + unit * unit_bytes(), hunk_bytes());
@@ -3121,8 +3121,8 @@ void chd_file_compressor::async_read()
return;
// determine parameters for the read
- UINT32 work_buffer_bytes = WORK_BUFFER_HUNKS * hunk_bytes();
- UINT32 numbytes = work_buffer_bytes / 2;
+ uint32_t work_buffer_bytes = WORK_BUFFER_HUNKS * hunk_bytes();
+ uint32_t numbytes = work_buffer_bytes / 2;
if (m_read_done_offset + numbytes > logical_bytes())
numbytes = logical_bytes() - m_read_done_offset;
@@ -3130,15 +3130,15 @@ void chd_file_compressor::async_read()
try
{
// do the read
- UINT8 *dest = &m_work_buffer[0] + (m_read_done_offset % work_buffer_bytes);
+ uint8_t *dest = &m_work_buffer[0] + (m_read_done_offset % work_buffer_bytes);
assert(dest == &m_work_buffer[0] || dest == &m_work_buffer[work_buffer_bytes/2]);
- UINT64 end_offset = m_read_done_offset + numbytes;
+ uint64_t end_offset = m_read_done_offset + numbytes;
// if walking the parent, read in hunks from the parent CHD
if (m_walking_parent)
{
- UINT8 *curdest = dest;
- for (UINT64 curoffs = m_read_done_offset; curoffs < end_offset + 1; curoffs += hunk_bytes())
+ uint8_t *curdest = dest;
+ for (uint64_t curoffs = m_read_done_offset; curoffs < end_offset + 1; curoffs += hunk_bytes())
{
m_parent->read_hunk(curoffs / hunk_bytes(), curdest);
curdest += hunk_bytes();
@@ -3150,9 +3150,9 @@ void chd_file_compressor::async_read()
read_data(dest, m_read_done_offset, numbytes);
// spawn off work for each hunk
- for (UINT64 curoffs = m_read_done_offset; curoffs < end_offset; curoffs += hunk_bytes())
+ for (uint64_t curoffs = m_read_done_offset; curoffs < end_offset; curoffs += hunk_bytes())
{
- UINT32 hunknum = curoffs / hunk_bytes();
+ uint32_t hunknum = curoffs / hunk_bytes();
work_item &item = m_work_item[hunknum % WORK_BUFFER_HUNKS];
assert(item.m_status == WS_READING);
item.m_status = WS_QUEUED;
@@ -3242,7 +3242,7 @@ void chd_file_compressor::hashmap::reset()
}
/**
- * @fn UINT64 chd_file_compressor::hashmap::find(crc16_t crc16, sha1_t sha1)
+ * @fn uint64_t chd_file_compressor::hashmap::find(crc16_t crc16, sha1_t sha1)
*
* @brief -------------------------------------------------
* find - find an item in the CRC map
@@ -3251,10 +3251,10 @@ void chd_file_compressor::hashmap::reset()
* @param crc16 The CRC 16.
* @param sha1 The first sha.
*
- * @return An UINT64.
+ * @return An uint64_t.
*/
-UINT64 chd_file_compressor::hashmap::find(util::crc16_t crc16, util::sha1_t sha1)
+uint64_t chd_file_compressor::hashmap::find(util::crc16_t crc16, util::sha1_t sha1)
{
// look up the entry in the map
for (entry_t *entry = m_map[crc16]; entry != nullptr; entry = entry->m_next)
@@ -3264,7 +3264,7 @@ UINT64 chd_file_compressor::hashmap::find(util::crc16_t crc16, util::sha1_t sha1
}
/**
- * @fn void chd_file_compressor::hashmap::add(UINT64 itemnum, crc16_t crc16, sha1_t sha1)
+ * @fn void chd_file_compressor::hashmap::add(uint64_t itemnum, crc16_t crc16, sha1_t sha1)
*
* @brief -------------------------------------------------
* add - add an item to the CRC map
@@ -3275,7 +3275,7 @@ UINT64 chd_file_compressor::hashmap::find(util::crc16_t crc16, util::sha1_t sha1
* @param sha1 The first sha.
*/
-void chd_file_compressor::hashmap::add(UINT64 itemnum, util::crc16_t crc16, util::sha1_t sha1)
+void chd_file_compressor::hashmap::add(uint64_t itemnum, util::crc16_t crc16, util::sha1_t sha1)
{
// add to the appropriate map
if (m_block_list->m_nextalloc == ARRAY_LENGTH(m_block_list->m_array))
diff --git a/src/lib/util/chd.h b/src/lib/util/chd.h
index 51c6fed0b54..a85ae1b9c10 100644
--- a/src/lib/util/chd.h
+++ b/src/lib/util/chd.h
@@ -33,17 +33,17 @@
V1 header:
[ 0] char tag[8]; // 'MComprHD'
- [ 8] UINT32 length; // length of header (including tag and length fields)
- [ 12] UINT32 version; // drive format version
- [ 16] UINT32 flags; // flags (see below)
- [ 20] UINT32 compression; // compression type
- [ 24] UINT32 hunksize; // 512-byte sectors per hunk
- [ 28] UINT32 totalhunks; // total # of hunks represented
- [ 32] UINT32 cylinders; // number of cylinders on hard disk
- [ 36] UINT32 heads; // number of heads on hard disk
- [ 40] UINT32 sectors; // number of sectors on hard disk
- [ 44] UINT8 md5[16]; // MD5 checksum of raw data
- [ 60] UINT8 parentmd5[16]; // MD5 checksum of parent file
+ [ 8] uint32_t length; // length of header (including tag and length fields)
+ [ 12] uint32_t version; // drive format version
+ [ 16] uint32_t flags; // flags (see below)
+ [ 20] uint32_t compression; // compression type
+ [ 24] uint32_t hunksize; // 512-byte sectors per hunk
+ [ 28] uint32_t totalhunks; // total # of hunks represented
+ [ 32] uint32_t cylinders; // number of cylinders on hard disk
+ [ 36] uint32_t heads; // number of heads on hard disk
+ [ 40] uint32_t sectors; // number of sectors on hard disk
+ [ 44] uint8_t md5[16]; // MD5 checksum of raw data
+ [ 60] uint8_t parentmd5[16]; // MD5 checksum of parent file
[ 76] (V1 header length)
Flags:
@@ -56,26 +56,26 @@
V1 map format:
- [ 0] UINT64 offset : 44; // starting offset within the file
- [ 0] UINT64 length : 20; // length of data; if == hunksize, data is uncompressed
+ [ 0] uint64_t offset : 44; // starting offset within the file
+ [ 0] uint64_t length : 20; // length of data; if == hunksize, data is uncompressed
=========================================================================
V2 header:
[ 0] char tag[8]; // 'MComprHD'
- [ 8] UINT32 length; // length of header (including tag and length fields)
- [ 12] UINT32 version; // drive format version
- [ 16] UINT32 flags; // flags (see below)
- [ 20] UINT32 compression; // compression type
- [ 24] UINT32 hunksize; // seclen-byte sectors per hunk
- [ 28] UINT32 totalhunks; // total # of hunks represented
- [ 32] UINT32 cylinders; // number of cylinders on hard disk
- [ 36] UINT32 heads; // number of heads on hard disk
- [ 40] UINT32 sectors; // number of sectors on hard disk
- [ 44] UINT8 md5[16]; // MD5 checksum of raw data
- [ 60] UINT8 parentmd5[16]; // MD5 checksum of parent file
- [ 76] UINT32 seclen; // number of bytes per sector
+ [ 8] uint32_t length; // length of header (including tag and length fields)
+ [ 12] uint32_t version; // drive format version
+ [ 16] uint32_t flags; // flags (see below)
+ [ 20] uint32_t compression; // compression type
+ [ 24] uint32_t hunksize; // seclen-byte sectors per hunk
+ [ 28] uint32_t totalhunks; // total # of hunks represented
+ [ 32] uint32_t cylinders; // number of cylinders on hard disk
+ [ 36] uint32_t heads; // number of heads on hard disk
+ [ 40] uint32_t sectors; // number of sectors on hard disk
+ [ 44] uint8_t md5[16]; // MD5 checksum of raw data
+ [ 60] uint8_t parentmd5[16]; // MD5 checksum of parent file
+ [ 76] uint32_t seclen; // number of bytes per sector
[ 80] (V2 header length)
Flags and map format are same as V1
@@ -85,18 +85,18 @@
V3 header:
[ 0] char tag[8]; // 'MComprHD'
- [ 8] UINT32 length; // length of header (including tag and length fields)
- [ 12] UINT32 version; // drive format version
- [ 16] UINT32 flags; // flags (see below)
- [ 20] UINT32 compression; // compression type
- [ 24] UINT32 totalhunks; // total # of hunks represented
- [ 28] UINT64 logicalbytes; // logical size of the data (in bytes)
- [ 36] UINT64 metaoffset; // offset to the first blob of metadata
- [ 44] UINT8 md5[16]; // MD5 checksum of raw data
- [ 60] UINT8 parentmd5[16]; // MD5 checksum of parent file
- [ 76] UINT32 hunkbytes; // number of bytes per hunk
- [ 80] UINT8 sha1[20]; // SHA1 checksum of raw data
- [100] UINT8 parentsha1[20];// SHA1 checksum of parent file
+ [ 8] uint32_t length; // length of header (including tag and length fields)
+ [ 12] uint32_t version; // drive format version
+ [ 16] uint32_t flags; // flags (see below)
+ [ 20] uint32_t compression; // compression type
+ [ 24] uint32_t totalhunks; // total # of hunks represented
+ [ 28] uint64_t logicalbytes; // logical size of the data (in bytes)
+ [ 36] uint64_t metaoffset; // offset to the first blob of metadata
+ [ 44] uint8_t md5[16]; // MD5 checksum of raw data
+ [ 60] uint8_t parentmd5[16]; // MD5 checksum of parent file
+ [ 76] uint32_t hunkbytes; // number of bytes per hunk
+ [ 80] uint8_t sha1[20]; // SHA1 checksum of raw data
+ [100] uint8_t parentsha1[20];// SHA1 checksum of parent file
[120] (V3 header length)
Flags are the same as V1
@@ -108,28 +108,28 @@
V3 map format:
- [ 0] UINT64 offset; // starting offset within the file
- [ 8] UINT32 crc32; // 32-bit CRC of the uncompressed data
- [ 12] UINT16 length_lo; // lower 16 bits of length
- [ 14] UINT8 length_hi; // upper 8 bits of length
- [ 15] UINT8 flags; // flags, indicating compression info
+ [ 0] uint64_t offset; // starting offset within the file
+ [ 8] uint32_t crc32; // 32-bit CRC of the uncompressed data
+ [ 12] uint16_t length_lo; // lower 16 bits of length
+ [ 14] uint8_t length_hi; // upper 8 bits of length
+ [ 15] uint8_t flags; // flags, indicating compression info
=========================================================================
V4 header:
[ 0] char tag[8]; // 'MComprHD'
- [ 8] UINT32 length; // length of header (including tag and length fields)
- [ 12] UINT32 version; // drive format version
- [ 16] UINT32 flags; // flags (see below)
- [ 20] UINT32 compression; // compression type
- [ 24] UINT32 totalhunks; // total # of hunks represented
- [ 28] UINT64 logicalbytes; // logical size of the data (in bytes)
- [ 36] UINT64 metaoffset; // offset to the first blob of metadata
- [ 44] UINT32 hunkbytes; // number of bytes per hunk
- [ 48] UINT8 sha1[20]; // combined raw+meta SHA1
- [ 68] UINT8 parentsha1[20];// combined raw+meta SHA1 of parent
- [ 88] UINT8 rawsha1[20]; // raw data SHA1
+ [ 8] uint32_t length; // length of header (including tag and length fields)
+ [ 12] uint32_t version; // drive format version
+ [ 16] uint32_t flags; // flags (see below)
+ [ 20] uint32_t compression; // compression type
+ [ 24] uint32_t totalhunks; // total # of hunks represented
+ [ 28] uint64_t logicalbytes; // logical size of the data (in bytes)
+ [ 36] uint64_t metaoffset; // offset to the first blob of metadata
+ [ 44] uint32_t hunkbytes; // number of bytes per hunk
+ [ 48] uint8_t sha1[20]; // combined raw+meta SHA1
+ [ 68] uint8_t parentsha1[20];// combined raw+meta SHA1 of parent
+ [ 88] uint8_t rawsha1[20]; // raw data SHA1
[108] (V4 header length)
Flags are the same as V1
@@ -147,17 +147,17 @@
V5 header:
[ 0] char tag[8]; // 'MComprHD'
- [ 8] UINT32 length; // length of header (including tag and length fields)
- [ 12] UINT32 version; // drive format version
- [ 16] UINT32 compressors[4];// which custom compressors are used?
- [ 32] UINT64 logicalbytes; // logical size of the data (in bytes)
- [ 40] UINT64 mapoffset; // offset to the map
- [ 48] UINT64 metaoffset; // offset to the first blob of metadata
- [ 56] UINT32 hunkbytes; // number of bytes per hunk (512k maximum)
- [ 60] UINT32 unitbytes; // number of bytes per unit within each hunk
- [ 64] UINT8 rawsha1[20]; // raw data SHA1
- [ 84] UINT8 sha1[20]; // combined raw+meta SHA1
- [104] UINT8 parentsha1[20];// combined raw+meta SHA1 of parent
+ [ 8] uint32_t length; // length of header (including tag and length fields)
+ [ 12] uint32_t version; // drive format version
+ [ 16] uint32_t compressors[4];// which custom compressors are used?
+ [ 32] uint64_t logicalbytes; // logical size of the data (in bytes)
+ [ 40] uint64_t mapoffset; // offset to the map
+ [ 48] uint64_t metaoffset; // offset to the first blob of metadata
+ [ 56] uint32_t hunkbytes; // number of bytes per hunk (512k maximum)
+ [ 60] uint32_t unitbytes; // number of bytes per unit within each hunk
+ [ 64] uint8_t rawsha1[20]; // raw data SHA1
+ [ 84] uint8_t sha1[20]; // combined raw+meta SHA1
+ [104] uint8_t parentsha1[20];// combined raw+meta SHA1 of parent
[124] (V5 header length)
If parentsha1 != 0, we have a parent (no need for flags)
@@ -165,25 +165,25 @@
V5 uncompressed map format:
- [ 0] UINT32 offset; // starting offset / hunk size
+ [ 0] uint32_t offset; // starting offset / hunk size
V5 compressed map format header:
- [ 0] UINT32 length; // length of compressed map
+ [ 0] uint32_t length; // length of compressed map
[ 4] UINT48 datastart; // offset of first block
- [ 10] UINT16 crc; // crc-16 of the map
- [ 12] UINT8 lengthbits; // bits used to encode complength
- [ 13] UINT8 hunkbits; // bits used to encode self-refs
- [ 14] UINT8 parentunitbits; // bits used to encode parent unit refs
- [ 15] UINT8 reserved; // future use
+ [ 10] uint16_t crc; // crc-16 of the map
+ [ 12] uint8_t lengthbits; // bits used to encode complength
+ [ 13] uint8_t hunkbits; // bits used to encode self-refs
+ [ 14] uint8_t parentunitbits; // bits used to encode parent unit refs
+ [ 15] uint8_t reserved; // future use
[ 16] (compressed header length)
Each compressed map entry, once expanded, looks like:
- [ 0] UINT8 compression; // compression type
+ [ 0] uint8_t compression; // compression type
[ 1] UINT24 complength; // compressed length
[ 4] UINT48 offset; // offset
- [ 10] UINT16 crc; // crc-16 of the data
+ [ 10] uint16_t crc; // crc-16 of the data
***************************************************************************/
@@ -198,14 +198,14 @@ const chd_codec_type CHD_CODEC_PARENT = 2; // copy of a parent's hunk
const chd_codec_type CHD_CODEC_MINI = 3; // legacy "mini" 8-byte repeat
// core types
-typedef UINT32 chd_metadata_tag;
+typedef uint32_t chd_metadata_tag;
// metadata parameters
const chd_metadata_tag CHDMETATAG_WILDCARD = 0;
-const UINT32 CHDMETAINDEX_APPEND = ~0;
+const uint32_t CHDMETAINDEX_APPEND = ~0;
// metadata flags
-const UINT8 CHD_MDFLAGS_CHECKSUM = 0x01; // indicates data is checksummed
+const uint8_t CHD_MDFLAGS_CHECKSUM = 0x01; // indicates data is checksummed
// standard hard disk metadata
const chd_metadata_tag HARD_DISK_METADATA_TAG = CHD_MAKE_TAG('G','D','D','D');
@@ -292,11 +292,11 @@ class chd_file
friend class chd_verifier;
// constants
- static const UINT32 HEADER_VERSION = 5;
- static const UINT32 V3_HEADER_SIZE = 120;
- static const UINT32 V4_HEADER_SIZE = 108;
- static const UINT32 V5_HEADER_SIZE = 124;
- static const UINT32 MAX_HEADER_SIZE = V5_HEADER_SIZE;
+ static const uint32_t HEADER_VERSION = 5;
+ static const uint32_t V3_HEADER_SIZE = 120;
+ static const uint32_t V4_HEADER_SIZE = 108;
+ static const uint32_t V5_HEADER_SIZE = 124;
+ static const uint32_t MAX_HEADER_SIZE = V5_HEADER_SIZE;
public:
// construction/destruction
@@ -308,29 +308,29 @@ public:
// getters
bool opened() const { return (m_file != nullptr); }
- UINT32 version() const { return m_version; }
- UINT64 logical_bytes() const { return m_logicalbytes; }
- UINT32 hunk_bytes() const { return m_hunkbytes; }
- UINT32 hunk_count() const { return m_hunkcount; }
- UINT32 unit_bytes() const { return m_unitbytes; }
- UINT64 unit_count() const { return m_unitcount; }
+ uint32_t version() const { return m_version; }
+ uint64_t logical_bytes() const { return m_logicalbytes; }
+ uint32_t hunk_bytes() const { return m_hunkbytes; }
+ uint32_t hunk_count() const { return m_hunkcount; }
+ uint32_t unit_bytes() const { return m_unitbytes; }
+ uint64_t unit_count() const { return m_unitcount; }
bool compressed() const { return (m_compression[0] != CHD_CODEC_NONE); }
chd_codec_type compression(int index) const { return m_compression[index]; }
chd_file *parent() const { return m_parent; }
util::sha1_t sha1();
util::sha1_t raw_sha1();
util::sha1_t parent_sha1();
- chd_error hunk_info(UINT32 hunknum, chd_codec_type &compressor, UINT32 &compbytes);
+ chd_error hunk_info(uint32_t hunknum, chd_codec_type &compressor, uint32_t &compbytes);
// setters
void set_raw_sha1(util::sha1_t rawdata);
void set_parent_sha1(util::sha1_t parent);
// file create
- chd_error create(const char *filename, UINT64 logicalbytes, UINT32 hunkbytes, UINT32 unitbytes, chd_codec_type compression[4]);
- chd_error create(util::core_file &file, UINT64 logicalbytes, UINT32 hunkbytes, UINT32 unitbytes, chd_codec_type compression[4]);
- chd_error create(const char *filename, UINT64 logicalbytes, UINT32 hunkbytes, chd_codec_type compression[4], chd_file &parent);
- chd_error create(util::core_file &file, UINT64 logicalbytes, UINT32 hunkbytes, chd_codec_type compression[4], chd_file &parent);
+ chd_error create(const char *filename, uint64_t logicalbytes, uint32_t hunkbytes, uint32_t unitbytes, chd_codec_type compression[4]);
+ chd_error create(util::core_file &file, uint64_t logicalbytes, uint32_t hunkbytes, uint32_t unitbytes, chd_codec_type compression[4]);
+ chd_error create(const char *filename, uint64_t logicalbytes, uint32_t hunkbytes, chd_codec_type compression[4], chd_file &parent);
+ chd_error create(util::core_file &file, uint64_t logicalbytes, uint32_t hunkbytes, chd_codec_type compression[4], chd_file &parent);
// file open
chd_error open(const char *filename, bool writeable = false, chd_file *parent = nullptr);
@@ -340,22 +340,22 @@ public:
void close();
// read/write
- chd_error read_hunk(UINT32 hunknum, void *buffer);
- chd_error write_hunk(UINT32 hunknum, const void *buffer);
- chd_error read_units(UINT64 unitnum, void *buffer, UINT32 count = 1);
- chd_error write_units(UINT64 unitnum, const void *buffer, UINT32 count = 1);
- chd_error read_bytes(UINT64 offset, void *buffer, UINT32 bytes);
- chd_error write_bytes(UINT64 offset, const void *buffer, UINT32 bytes);
+ chd_error read_hunk(uint32_t hunknum, void *buffer);
+ chd_error write_hunk(uint32_t hunknum, const void *buffer);
+ chd_error read_units(uint64_t unitnum, void *buffer, uint32_t count = 1);
+ chd_error write_units(uint64_t unitnum, const void *buffer, uint32_t count = 1);
+ chd_error read_bytes(uint64_t offset, void *buffer, uint32_t bytes);
+ chd_error write_bytes(uint64_t offset, const void *buffer, uint32_t bytes);
// metadata management
- chd_error read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, std::string &output);
- chd_error read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, std::vector<UINT8> &output);
- chd_error read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, void *output, UINT32 outputlen, UINT32 &resultlen);
- chd_error read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, std::vector<UINT8> &output, chd_metadata_tag &resulttag, UINT8 &resultflags);
- chd_error write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const void *inputbuf, UINT32 inputlen, UINT8 flags = CHD_MDFLAGS_CHECKSUM);
- chd_error write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const std::string &input, UINT8 flags = CHD_MDFLAGS_CHECKSUM) { return write_metadata(metatag, metaindex, input.c_str(), input.length() + 1, flags); }
- chd_error write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const std::vector<UINT8> &input, UINT8 flags = CHD_MDFLAGS_CHECKSUM) { return write_metadata(metatag, metaindex, &input[0], input.size(), flags); }
- chd_error delete_metadata(chd_metadata_tag metatag, UINT32 metaindex);
+ chd_error read_metadata(chd_metadata_tag searchtag, uint32_t searchindex, std::string &output);
+ chd_error read_metadata(chd_metadata_tag searchtag, uint32_t searchindex, std::vector<uint8_t> &output);
+ chd_error read_metadata(chd_metadata_tag searchtag, uint32_t searchindex, void *output, uint32_t outputlen, uint32_t &resultlen);
+ chd_error read_metadata(chd_metadata_tag searchtag, uint32_t searchindex, std::vector<uint8_t> &output, chd_metadata_tag &resulttag, uint8_t &resultflags);
+ chd_error write_metadata(chd_metadata_tag metatag, uint32_t metaindex, const void *inputbuf, uint32_t inputlen, uint8_t flags = CHD_MDFLAGS_CHECKSUM);
+ chd_error write_metadata(chd_metadata_tag metatag, uint32_t metaindex, const std::string &input, uint8_t flags = CHD_MDFLAGS_CHECKSUM) { return write_metadata(metatag, metaindex, input.c_str(), input.length() + 1, flags); }
+ chd_error write_metadata(chd_metadata_tag metatag, uint32_t metaindex, const std::vector<uint8_t> &input, uint8_t flags = CHD_MDFLAGS_CHECKSUM) { return write_metadata(metatag, metaindex, &input[0], input.size(), flags); }
+ chd_error delete_metadata(chd_metadata_tag metatag, uint32_t metaindex);
chd_error clone_all_metadata(chd_file &source);
// hashing helper
@@ -372,31 +372,31 @@ private:
struct metadata_hash;
// inline helpers
- UINT64 be_read(const UINT8 *base, int numbytes);
- void be_write(UINT8 *base, UINT64 value, int numbytes);
- util::sha1_t be_read_sha1(const UINT8 *base);
- void be_write_sha1(UINT8 *base, util::sha1_t value);
- void file_read(UINT64 offset, void *dest, UINT32 length);
- void file_write(UINT64 offset, const void *source, UINT32 length);
- UINT64 file_append(const void *source, UINT32 length, UINT32 alignment = 0);
- UINT8 bits_for_value(UINT64 value);
+ uint64_t be_read(const uint8_t *base, int numbytes);
+ void be_write(uint8_t *base, uint64_t value, int numbytes);
+ util::sha1_t be_read_sha1(const uint8_t *base);
+ void be_write_sha1(uint8_t *base, util::sha1_t value);
+ void file_read(uint64_t offset, void *dest, uint32_t length);
+ void file_write(uint64_t offset, const void *source, uint32_t length);
+ uint64_t file_append(const void *source, uint32_t length, uint32_t alignment = 0);
+ uint8_t bits_for_value(uint64_t value);
// internal helpers
- UINT32 guess_unitbytes();
- void parse_v3_header(UINT8 *rawheader, util::sha1_t &parentsha1);
- void parse_v4_header(UINT8 *rawheader, util::sha1_t &parentsha1);
- void parse_v5_header(UINT8 *rawheader, util::sha1_t &parentsha1);
+ uint32_t guess_unitbytes();
+ void parse_v3_header(uint8_t *rawheader, util::sha1_t &parentsha1);
+ void parse_v4_header(uint8_t *rawheader, util::sha1_t &parentsha1);
+ void parse_v5_header(uint8_t *rawheader, util::sha1_t &parentsha1);
chd_error compress_v5_map();
void decompress_v5_map();
chd_error create_common();
chd_error open_common(bool writeable);
void create_open_common();
- void verify_proper_compression_append(UINT32 hunknum);
- void hunk_write_compressed(UINT32 hunknum, INT8 compression, const UINT8 *compressed, UINT32 complength, util::crc16_t crc16);
- void hunk_copy_from_self(UINT32 hunknum, UINT32 otherhunk);
- void hunk_copy_from_parent(UINT32 hunknum, UINT64 parentunit);
- bool metadata_find(chd_metadata_tag metatag, INT32 metaindex, metadata_entry &metaentry, bool resume = false);
- void metadata_set_previous_next(UINT64 prevoffset, UINT64 nextoffset);
+ void verify_proper_compression_append(uint32_t hunknum);
+ void hunk_write_compressed(uint32_t hunknum, int8_t compression, const uint8_t *compressed, uint32_t complength, util::crc16_t crc16);
+ void hunk_copy_from_self(uint32_t hunknum, uint32_t otherhunk);
+ void hunk_copy_from_parent(uint32_t hunknum, uint64_t parentunit);
+ bool metadata_find(chd_metadata_tag metatag, int32_t metaindex, metadata_entry &metaentry, bool resume = false);
+ void metadata_set_previous_next(uint64_t prevoffset, uint64_t nextoffset);
void metadata_update_hash();
static int CLIB_DECL metadata_hash_compare(const void *elem1, const void *elem2);
@@ -407,36 +407,36 @@ private:
bool m_allow_writes; // permit writes to this CHD?
// core parameters from the header
- UINT32 m_version; // version of the header
- UINT64 m_logicalbytes; // logical size of the raw CHD data in bytes
- UINT64 m_mapoffset; // offset of map
- UINT64 m_metaoffset; // offset to first metadata bit
- UINT32 m_hunkbytes; // size of each raw hunk in bytes
- UINT32 m_hunkcount; // number of hunks represented
- UINT32 m_unitbytes; // size of each unit in bytes
- UINT64 m_unitcount; // number of units represented
+ uint32_t m_version; // version of the header
+ uint64_t m_logicalbytes; // logical size of the raw CHD data in bytes
+ uint64_t m_mapoffset; // offset of map
+ uint64_t m_metaoffset; // offset to first metadata bit
+ uint32_t m_hunkbytes; // size of each raw hunk in bytes
+ uint32_t m_hunkcount; // number of hunks represented
+ uint32_t m_unitbytes; // size of each unit in bytes
+ uint64_t m_unitcount; // number of units represented
chd_codec_type m_compression[4]; // array of compression types used
chd_file * m_parent; // pointer to parent file, or nullptr if none
bool m_parent_missing; // are we missing our parent?
// key offsets within the header
- UINT64 m_mapoffset_offset; // offset of map offset field
- UINT64 m_metaoffset_offset;// offset of metaoffset field
- UINT64 m_sha1_offset; // offset of SHA1 field
- UINT64 m_rawsha1_offset; // offset of raw SHA1 field
- UINT64 m_parentsha1_offset;// offset of paren SHA1 field
+ uint64_t m_mapoffset_offset; // offset of map offset field
+ uint64_t m_metaoffset_offset;// offset of metaoffset field
+ uint64_t m_sha1_offset; // offset of SHA1 field
+ uint64_t m_rawsha1_offset; // offset of raw SHA1 field
+ uint64_t m_parentsha1_offset;// offset of paren SHA1 field
// map information
- UINT32 m_mapentrybytes; // length of each entry in a map
- std::vector<UINT8> m_rawmap; // raw map data
+ uint32_t m_mapentrybytes; // length of each entry in a map
+ std::vector<uint8_t> m_rawmap; // raw map data
// compression management
chd_decompressor * m_decompressor[4]; // array of decompression codecs
- std::vector<UINT8> m_compressed; // temporary buffer for compressed data
+ std::vector<uint8_t> m_compressed; // temporary buffer for compressed data
// caching
- std::vector<UINT8> m_cache; // single-hunk cache for partial reads/writes
- UINT32 m_cachehunk; // which hunk is in the cache?
+ std::vector<uint8_t> m_cache; // single-hunk cache for partial reads/writes
+ uint32_t m_cachehunk; // which hunk is in the cache?
};
@@ -456,7 +456,7 @@ public:
protected:
// required override: read more data
- virtual UINT32 read_data(void *dest, UINT64 offset, UINT32 length) = 0;
+ virtual uint32_t read_data(void *dest, uint64_t offset, uint32_t length) = 0;
private:
// hash map for looking up values
@@ -469,17 +469,17 @@ private:
// operations
void reset();
- UINT64 find(util::crc16_t crc16, util::sha1_t sha1);
- void add(UINT64 itemnum, util::crc16_t crc16, util::sha1_t sha1);
+ uint64_t find(util::crc16_t crc16, util::sha1_t sha1);
+ void add(uint64_t itemnum, util::crc16_t crc16, util::sha1_t sha1);
// constants
- static const UINT64 NOT_FOUND = ~UINT64(0);
+ static const uint64_t NOT_FOUND = ~uint64_t(0);
private:
// internal entry
struct entry_t
{
entry_t * m_next; // next entry in list
- UINT64 m_itemnum; // item number
+ uint64_t m_itemnum; // item number
util::sha1_t m_sha1; // SHA-1 of the block
};
@@ -490,7 +490,7 @@ private:
: m_next(prev), m_nextalloc(0) { }
entry_block * m_next; // next block in list
- UINT32 m_nextalloc; // next to be allocated
+ uint32_t m_nextalloc; // next to be allocated
entry_t m_array[16384]; // array of entries
};
@@ -534,12 +534,12 @@ private:
chd_file_compressor *m_compressor; // pointer back to the compressor
// TODO: had to change this to be able to use atomic_* functions on this
//volatile work_status m_status; // current status of this item
- std::atomic<INT32> m_status; // current status of this item
- UINT32 m_hunknum; // number of the hunk we're working on
- UINT8 * m_data; // pointer to the data we are working on
- UINT8 * m_compressed; // pointer to the compressed data
- UINT32 m_complen; // compressed data length
- INT8 m_compression; // type of compression used
+ std::atomic<int32_t> m_status; // current status of this item
+ uint32_t m_hunknum; // number of the hunk we're working on
+ uint8_t * m_data; // pointer to the data we are working on
+ uint8_t * m_compressed; // pointer to the compressed data
+ uint32_t m_complen; // compressed data length
+ int8_t m_compression; // type of compression used
chd_compressor_group *m_codecs; // codec instance
std::vector<hash_pair> m_hash; // array of hashes
};
@@ -554,8 +554,8 @@ private:
// current compression status
bool m_walking_parent; // are we building the parent map?
- UINT64 m_total_in; // total bytes in
- UINT64 m_total_out; // total bytes out
+ uint64_t m_total_in; // total bytes in
+ uint64_t m_total_out; // total bytes out
util::sha1_creator m_compsha1; // running SHA-1 on raw data
// hash lookup maps
@@ -564,20 +564,20 @@ private:
// read I/O thread
osd_work_queue * m_read_queue; // work queue for reading
- UINT64 m_read_queue_offset;// next offset to enqueue
- UINT64 m_read_done_offset; // next offset that will complete
+ uint64_t m_read_queue_offset;// next offset to enqueue
+ uint64_t m_read_done_offset; // next offset that will complete
bool m_read_error; // error during reading?
// work item thread
static const int WORK_BUFFER_HUNKS = 256;
osd_work_queue * m_work_queue; // queue for doing work on other threads
- std::vector<UINT8> m_work_buffer; // buffer containing hunk data to work on
- std::vector<UINT8> m_compressed_buffer;// buffer containing compressed data
+ std::vector<uint8_t> m_work_buffer; // buffer containing hunk data to work on
+ std::vector<uint8_t> m_compressed_buffer;// buffer containing compressed data
work_item m_work_item[WORK_BUFFER_HUNKS]; // status of each hunk
chd_compressor_group * m_codecs[WORK_MAX_THREADS]; // codecs to use
// output state
- UINT32 m_write_hunk; // next hunk to write
+ uint32_t m_write_hunk; // next hunk to write
};
diff --git a/src/lib/util/chdcd.cpp b/src/lib/util/chdcd.cpp
index 76da08b6b9e..f6176cd4cd9 100644
--- a/src/lib/util/chdcd.cpp
+++ b/src/lib/util/chdcd.cpp
@@ -76,7 +76,7 @@ static std::string get_file_path(std::string &path)
-------------------------------------------------*/
/**
- * @fn static UINT64 get_file_size(const char *filename)
+ * @fn static uint64_t get_file_size(const char *filename)
*
* @brief Gets file size.
*
@@ -85,7 +85,7 @@ static std::string get_file_path(std::string &path)
* @return The file size.
*/
-static UINT64 get_file_size(const char *filename)
+static uint64_t get_file_size(const char *filename)
{
osd_file::ptr file;
std::uint64_t filesize = 0;
@@ -120,7 +120,7 @@ static int tokenize( const char *linebuffer, int i, int linebuffersize, char *to
int singlequote = 0;
int doublequote = 0;
- while ((i < linebuffersize) && isspace((UINT8)linebuffer[i]))
+ while ((i < linebuffersize) && isspace((uint8_t)linebuffer[i]))
{
i++;
}
@@ -135,7 +135,7 @@ static int tokenize( const char *linebuffer, int i, int linebuffersize, char *to
{
singlequote = !singlequote;
}
- else if (!singlequote && !doublequote && isspace((UINT8)linebuffer[i]))
+ else if (!singlequote && !doublequote && isspace((uint8_t)linebuffer[i]))
{
break;
}
@@ -196,24 +196,24 @@ static int msf_to_frames( char *token )
-------------------------------------------------*/
/**
- * @fn static UINT32 parse_wav_sample(const char *filename, UINT32 *dataoffs)
+ * @fn static uint32_t parse_wav_sample(const char *filename, uint32_t *dataoffs)
*
* @brief Parse WAV sample.
*
* @param filename Filename of the file.
* @param [in,out] dataoffs If non-null, the dataoffs.
*
- * @return An UINT32.
+ * @return An uint32_t.
*/
-static UINT32 parse_wav_sample(const char *filename, UINT32 *dataoffs)
+static uint32_t parse_wav_sample(const char *filename, uint32_t *dataoffs)
{
unsigned long offset = 0;
- UINT32 length, rate, filesize;
- UINT16 bits, temp16;
+ uint32_t length, rate, filesize;
+ uint16_t bits, temp16;
char buf[32];
osd_file::ptr file;
- UINT64 fsize = 0;
+ uint64_t fsize = 0;
std::uint32_t actual;
osd_file::error filerr = osd_file::open(filename, OPEN_FLAG_READ, file, fsize);
@@ -361,7 +361,7 @@ static UINT32 parse_wav_sample(const char *filename, UINT32 *dataoffs)
}
/**
- * @fn UINT16 read_uint16(FILE *infile)
+ * @fn uint16_t read_uint16(FILE *infile)
*
* @brief Reads uint 16.
*
@@ -370,9 +370,9 @@ static UINT32 parse_wav_sample(const char *filename, UINT32 *dataoffs)
* @return The uint 16.
*/
-UINT16 read_uint16(FILE *infile)
+uint16_t read_uint16(FILE *infile)
{
- UINT16 res = 0;
+ uint16_t res = 0;
unsigned char buffer[2];
fread(buffer, 2, 1, infile);
@@ -383,7 +383,7 @@ UINT16 read_uint16(FILE *infile)
}
/**
- * @fn UINT32 read_uint32(FILE *infile)
+ * @fn uint32_t read_uint32(FILE *infile)
*
* @brief Reads uint 32.
*
@@ -392,9 +392,9 @@ UINT16 read_uint16(FILE *infile)
* @return The uint 32.
*/
-UINT32 read_uint32(FILE *infile)
+uint32_t read_uint32(FILE *infile)
{
- UINT32 res = 0;
+ uint32_t res = 0;
unsigned char buffer[4];
fread(buffer, 4, 1, infile);
@@ -405,7 +405,7 @@ UINT32 read_uint32(FILE *infile)
}
/**
- * @fn UINT64 read_uint64(FILE *infile)
+ * @fn uint64_t read_uint64(FILE *infile)
*
* @brief Reads uint 64.
*
@@ -414,10 +414,10 @@ UINT32 read_uint32(FILE *infile)
* @return The uint 64.
*/
-UINT64 read_uint64(FILE *infile)
+uint64_t read_uint64(FILE *infile)
{
- UINT64 res0 = U64(0), res1 = U64(0);
- UINT64 res;
+ uint64_t res0 = U64(0), res1 = U64(0);
+ uint64_t res;
unsigned char buffer[8];
fread(buffer, 8, 1, infile);
@@ -450,7 +450,7 @@ chd_error chdcd_parse_nero(const char *tocfname, cdrom_toc &outtoc, chdcd_track_
{
FILE *infile;
unsigned char buffer[12];
- UINT32 chain_offs, chunk_size;
+ uint32_t chain_offs, chunk_size;
int done = 0;
std::string path = std::string(tocfname);
@@ -491,8 +491,8 @@ chd_error chdcd_parse_nero(const char *tocfname, cdrom_toc &outtoc, chdcd_track_
while (!done)
{
- UINT32 offset;
- UINT8 start, end;
+ uint32_t offset;
+ uint8_t start, end;
int track;
fseek(infile, chain_offs, SEEK_SET);
@@ -518,8 +518,8 @@ chd_error chdcd_parse_nero(const char *tocfname, cdrom_toc &outtoc, chdcd_track_
offset = 0;
for (track = start; track <= end; track++)
{
- UINT32 size, mode;
- UINT64 index0, index1, track_end;
+ uint32_t size, mode;
+ uint64_t index0, index1, track_end;
fseek(infile, 12, SEEK_CUR); // skip ISRC code
size = read_uint16(infile);
@@ -529,9 +529,9 @@ chd_error chdcd_parse_nero(const char *tocfname, cdrom_toc &outtoc, chdcd_track_
index1 = read_uint64(infile);
track_end = read_uint64(infile);
-// printf("Track %d: sector size %d mode %x index0 %llx index1 %llx track_end %llx (pregap %d sectors, length %d sectors)\n", track, size, mode, index0, index1, track_end, (UINT32)(index1-index0)/size, (UINT32)(track_end-index1)/size);
+// printf("Track %d: sector size %d mode %x index0 %llx index1 %llx track_end %llx (pregap %d sectors, length %d sectors)\n", track, size, mode, index0, index1, track_end, (uint32_t)(index1-index0)/size, (uint32_t)(track_end-index1)/size);
outinfo.track[track-1].fname.assign(tocfname);
- outinfo.track[track-1].offset = offset + (UINT32)(index1-index0);
+ outinfo.track[track-1].offset = offset + (uint32_t)(index1-index0);
outinfo.track[track-1].idx0offs = 0;
outinfo.track[track-1].idx1offs = 0;
@@ -588,8 +588,8 @@ chd_error chdcd_parse_nero(const char *tocfname, cdrom_toc &outtoc, chdcd_track_
outtoc.tracks[track-1].subtype = CD_SUB_NONE;
outtoc.tracks[track-1].subsize = 0;
- outtoc.tracks[track-1].pregap = (UINT32)(index1-index0)/size;
- outtoc.tracks[track-1].frames = (UINT32)(track_end-index1)/size;
+ outtoc.tracks[track-1].pregap = (uint32_t)(index1-index0)/size;
+ outtoc.tracks[track-1].frames = (uint32_t)(track_end-index1)/size;
outtoc.tracks[track-1].postgap = 0;
outtoc.tracks[track-1].pgtype = 0;
outtoc.tracks[track-1].pgsub = CD_SUB_NONE;
@@ -597,7 +597,7 @@ chd_error chdcd_parse_nero(const char *tocfname, cdrom_toc &outtoc, chdcd_track_
outtoc.tracks[track-1].pgsubsize = 0;
outtoc.tracks[track-1].padframes = 0;
- offset += (UINT32)track_end-index1;
+ offset += (uint32_t)track_end-index1;
}
}
@@ -649,7 +649,7 @@ chd_error chdcd_parse_iso(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i
memset(&outtoc, 0, sizeof(outtoc));
outinfo.reset();
- UINT64 size = get_file_size(tocfname);
+ uint64_t size = get_file_size(tocfname);
fclose(infile);
@@ -846,7 +846,7 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i
int i, trknum;
static char token[512];
std::string lastfname;
- UINT32 wavlen, wavoffs;
+ uint32_t wavlen, wavoffs;
std::string path = std::string(tocfname);
infile = fopen(tocfname, "rt");
@@ -1039,7 +1039,7 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i
/* now go over the files again and set the lengths */
for (trknum = 0; trknum < outtoc.numtrks; trknum++)
{
- UINT64 tlen = 0;
+ uint64_t tlen = 0;
// this is true for cue/bin and cue/iso, and we need it for cue/wav since .WAV is little-endian
if (outtoc.tracks[trknum].trktype == CD_TRACK_AUDIO)
@@ -1226,7 +1226,7 @@ chd_error chdcd_parse_toc(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i
/* it's a decimal offset, use it */
f = strtoul(&token[1], nullptr, 10);
}
- else if (isdigit((UINT8)token[0]))
+ else if (isdigit((uint8_t)token[0]))
{
/* convert the time to an offset */
f = msf_to_frames( token );
@@ -1242,14 +1242,14 @@ chd_error chdcd_parse_toc(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i
TOKENIZE
- if (isdigit((UINT8)token[0]))
+ if (isdigit((uint8_t)token[0]))
{
// this could be the length or an offset from the previous field.
f = msf_to_frames( token );
TOKENIZE
- if (isdigit((UINT8)token[0]))
+ if (isdigit((uint8_t)token[0]))
{
// it was an offset.
f *= (outtoc.tracks[trknum].datasize + outtoc.tracks[trknum].subsize);
diff --git a/src/lib/util/chdcd.h b/src/lib/util/chdcd.h
index 6adcf29ce7b..3f31bad7e00 100644
--- a/src/lib/util/chdcd.h
+++ b/src/lib/util/chdcd.h
@@ -19,10 +19,10 @@ struct chdcd_track_input_entry
void reset() { fname.clear(); offset = idx0offs = idx1offs = 0; swap = false; }
std::string fname; // filename for each track
- UINT32 offset; // offset in the data file for each track
+ uint32_t offset; // offset in the data file for each track
bool swap; // data needs to be byte swapped
- UINT32 idx0offs;
- UINT32 idx1offs;
+ uint32_t idx0offs;
+ uint32_t idx1offs;
};
struct chdcd_track_input_info
diff --git a/src/lib/util/chdcodec.cpp b/src/lib/util/chdcodec.cpp
index e2758f08a9e..71763163a87 100644
--- a/src/lib/util/chdcodec.cpp
+++ b/src/lib/util/chdcodec.cpp
@@ -25,7 +25,7 @@
// GLOBAL VARIABLES
//**************************************************************************
-static const UINT8 s_cd_sync_header[12] = { 0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00 };
+static const uint8_t s_cd_sync_header[12] = { 0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00 };
@@ -52,7 +52,7 @@ private:
static void fast_free(voidpf opaque, voidpf address);
static const int MAX_ZLIB_ALLOCS = 64;
- UINT32 * m_allocptr[MAX_ZLIB_ALLOCS];
+ uint32_t * m_allocptr[MAX_ZLIB_ALLOCS];
};
@@ -63,11 +63,11 @@ class chd_zlib_compressor : public chd_compressor
{
public:
// construction/destruction
- chd_zlib_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy);
+ chd_zlib_compressor(chd_file &chd, uint32_t hunkbytes, bool lossy);
~chd_zlib_compressor();
// core functionality
- virtual UINT32 compress(const UINT8 *src, UINT32 srclen, UINT8 *dest) override;
+ virtual uint32_t compress(const uint8_t *src, uint32_t srclen, uint8_t *dest) override;
private:
// internal state
@@ -83,11 +83,11 @@ class chd_zlib_decompressor : public chd_decompressor
{
public:
// construction/destruction
- chd_zlib_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy);
+ chd_zlib_decompressor(chd_file &chd, uint32_t hunkbytes, bool lossy);
~chd_zlib_decompressor();
// core functionality
- virtual void decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) override;
+ virtual void decompress(const uint8_t *src, uint32_t complen, uint8_t *dest, uint32_t destlen) override;
private:
// internal state
@@ -112,7 +112,7 @@ private:
static void fast_free(void *p, void *address);
static const int MAX_LZMA_ALLOCS = 64;
- UINT32 * m_allocptr[MAX_LZMA_ALLOCS];
+ uint32_t * m_allocptr[MAX_LZMA_ALLOCS];
};
@@ -123,14 +123,14 @@ class chd_lzma_compressor : public chd_compressor
{
public:
// construction/destruction
- chd_lzma_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy);
+ chd_lzma_compressor(chd_file &chd, uint32_t hunkbytes, bool lossy);
~chd_lzma_compressor();
// core functionality
- virtual UINT32 compress(const UINT8 *src, UINT32 srclen, UINT8 *dest) override;
+ virtual uint32_t compress(const uint8_t *src, uint32_t srclen, uint8_t *dest) override;
// helpers
- static void configure_properties(CLzmaEncProps &props, UINT32 hunkbytes);
+ static void configure_properties(CLzmaEncProps &props, uint32_t hunkbytes);
private:
// internal state
@@ -146,11 +146,11 @@ class chd_lzma_decompressor : public chd_decompressor
{
public:
// construction/destruction
- chd_lzma_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy);
+ chd_lzma_decompressor(chd_file &chd, uint32_t hunkbytes, bool lossy);
~chd_lzma_decompressor();
// core functionality
- virtual void decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) override;
+ virtual void decompress(const uint8_t *src, uint32_t complen, uint8_t *dest, uint32_t destlen) override;
private:
// internal state
@@ -166,10 +166,10 @@ class chd_huffman_compressor : public chd_compressor
{
public:
// construction/destruction
- chd_huffman_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy);
+ chd_huffman_compressor(chd_file &chd, uint32_t hunkbytes, bool lossy);
// core functionality
- virtual UINT32 compress(const UINT8 *src, UINT32 srclen, UINT8 *dest) override;
+ virtual uint32_t compress(const uint8_t *src, uint32_t srclen, uint8_t *dest) override;
private:
// internal state
@@ -184,10 +184,10 @@ class chd_huffman_decompressor : public chd_decompressor
{
public:
// construction/destruction
- chd_huffman_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy);
+ chd_huffman_decompressor(chd_file &chd, uint32_t hunkbytes, bool lossy);
// core functionality
- virtual void decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) override;
+ virtual void decompress(const uint8_t *src, uint32_t complen, uint8_t *dest, uint32_t destlen) override;
private:
// internal state
@@ -202,13 +202,13 @@ class chd_flac_compressor : public chd_compressor
{
public:
// construction/destruction
- chd_flac_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy);
+ chd_flac_compressor(chd_file &chd, uint32_t hunkbytes, bool lossy);
// core functionality
- virtual UINT32 compress(const UINT8 *src, UINT32 srclen, UINT8 *dest) override;
+ virtual uint32_t compress(const uint8_t *src, uint32_t srclen, uint8_t *dest) override;
// static helpers
- static UINT32 blocksize(UINT32 bytes);
+ static uint32_t blocksize(uint32_t bytes);
private:
// internal state
@@ -224,10 +224,10 @@ class chd_flac_decompressor : public chd_decompressor
{
public:
// construction/destruction
- chd_flac_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy);
+ chd_flac_decompressor(chd_file &chd, uint32_t hunkbytes, bool lossy);
// core functionality
- virtual void decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) override;
+ virtual void decompress(const uint8_t *src, uint32_t complen, uint8_t *dest, uint32_t destlen) override;
private:
// internal state
@@ -243,14 +243,14 @@ class chd_cd_flac_compressor : public chd_compressor
{
public:
// construction/destruction
- chd_cd_flac_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy);
+ chd_cd_flac_compressor(chd_file &chd, uint32_t hunkbytes, bool lossy);
~chd_cd_flac_compressor();
// core functionality
- virtual UINT32 compress(const UINT8 *src, UINT32 srclen, UINT8 *dest) override;
+ virtual uint32_t compress(const uint8_t *src, uint32_t srclen, uint8_t *dest) override;
// static helpers
- static UINT32 blocksize(UINT32 bytes);
+ static uint32_t blocksize(uint32_t bytes);
private:
// internal state
@@ -258,7 +258,7 @@ private:
flac_encoder m_encoder;
z_stream m_deflater;
chd_zlib_allocator m_allocator;
- std::vector<UINT8> m_buffer;
+ std::vector<uint8_t> m_buffer;
};
@@ -269,11 +269,11 @@ class chd_cd_flac_decompressor : public chd_decompressor
{
public:
// construction/destruction
- chd_cd_flac_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy);
+ chd_cd_flac_decompressor(chd_file &chd, uint32_t hunkbytes, bool lossy);
~chd_cd_flac_decompressor();
// core functionality
- virtual void decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) override;
+ virtual void decompress(const uint8_t *src, uint32_t complen, uint8_t *dest, uint32_t destlen) override;
private:
// internal state
@@ -281,7 +281,7 @@ private:
flac_decoder m_decoder;
z_stream m_inflater;
chd_zlib_allocator m_allocator;
- std::vector<UINT8> m_buffer;
+ std::vector<uint8_t> m_buffer;
};
@@ -292,7 +292,7 @@ class chd_cd_compressor : public chd_compressor
{
public:
// construction/destruction
- chd_cd_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
+ chd_cd_compressor(chd_file &chd, uint32_t hunkbytes, bool lossy)
: chd_compressor(chd, hunkbytes, lossy),
m_base_compressor(chd, (hunkbytes / CD_FRAME_SIZE) * CD_MAX_SECTOR_DATA, lossy),
m_subcode_compressor(chd, (hunkbytes / CD_FRAME_SIZE) * CD_MAX_SUBCODE_DATA, lossy),
@@ -304,25 +304,25 @@ public:
}
// core functionality
- virtual UINT32 compress(const UINT8 *src, UINT32 srclen, UINT8 *dest) override
+ virtual uint32_t compress(const uint8_t *src, uint32_t srclen, uint8_t *dest) override
{
// determine header bytes
- UINT32 frames = srclen / CD_FRAME_SIZE;
- UINT32 complen_bytes = (srclen < 65536) ? 2 : 3;
- UINT32 ecc_bytes = (frames + 7) / 8;
- UINT32 header_bytes = ecc_bytes + complen_bytes;
+ uint32_t frames = srclen / CD_FRAME_SIZE;
+ uint32_t complen_bytes = (srclen < 65536) ? 2 : 3;
+ uint32_t ecc_bytes = (frames + 7) / 8;
+ uint32_t header_bytes = ecc_bytes + complen_bytes;
// clear out destination header
memset(dest, 0, header_bytes);
// copy audio data followed by subcode data
- for (UINT32 framenum = 0; framenum < frames; framenum++)
+ for (uint32_t framenum = 0; framenum < frames; framenum++)
{
memcpy(&m_buffer[framenum * CD_MAX_SECTOR_DATA], &src[framenum * CD_FRAME_SIZE], CD_MAX_SECTOR_DATA);
memcpy(&m_buffer[frames * CD_MAX_SECTOR_DATA + framenum * CD_MAX_SUBCODE_DATA], &src[framenum * CD_FRAME_SIZE + CD_MAX_SECTOR_DATA], CD_MAX_SUBCODE_DATA);
// clear out ECC data if we can
- UINT8 *sector = &m_buffer[framenum * CD_MAX_SECTOR_DATA];
+ uint8_t *sector = &m_buffer[framenum * CD_MAX_SECTOR_DATA];
if (memcmp(sector, s_cd_sync_header, sizeof(s_cd_sync_header)) == 0 && ecc_verify(sector))
{
dest[framenum / 8] |= 1 << (framenum % 8);
@@ -332,7 +332,7 @@ public:
}
// encode the base portion
- UINT32 complen = m_base_compressor.compress(&m_buffer[0], frames * CD_MAX_SECTOR_DATA, &dest[header_bytes]);
+ uint32_t complen = m_base_compressor.compress(&m_buffer[0], frames * CD_MAX_SECTOR_DATA, &dest[header_bytes]);
if (complen >= srclen)
throw CHDERR_COMPRESSION_ERROR;
@@ -350,7 +350,7 @@ private:
// internal state
_BaseCompressor m_base_compressor;
_SubcodeCompressor m_subcode_compressor;
- std::vector<UINT8> m_buffer;
+ std::vector<uint8_t> m_buffer;
};
@@ -361,7 +361,7 @@ class chd_cd_decompressor : public chd_decompressor
{
public:
// construction/destruction
- chd_cd_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
+ chd_cd_decompressor(chd_file &chd, uint32_t hunkbytes, bool lossy)
: chd_decompressor(chd, hunkbytes, lossy),
m_base_decompressor(chd, (hunkbytes / CD_FRAME_SIZE) * CD_MAX_SECTOR_DATA, lossy),
m_subcode_decompressor(chd, (hunkbytes / CD_FRAME_SIZE) * CD_MAX_SUBCODE_DATA, lossy),
@@ -373,16 +373,16 @@ public:
}
// core functionality
- virtual void decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) override
+ virtual void decompress(const uint8_t *src, uint32_t complen, uint8_t *dest, uint32_t destlen) override
{
// determine header bytes
- UINT32 frames = destlen / CD_FRAME_SIZE;
- UINT32 complen_bytes = (destlen < 65536) ? 2 : 3;
- UINT32 ecc_bytes = (frames + 7) / 8;
- UINT32 header_bytes = ecc_bytes + complen_bytes;
+ uint32_t frames = destlen / CD_FRAME_SIZE;
+ uint32_t complen_bytes = (destlen < 65536) ? 2 : 3;
+ uint32_t ecc_bytes = (frames + 7) / 8;
+ uint32_t header_bytes = ecc_bytes + complen_bytes;
// extract compressed length of base
- UINT32 complen_base = (src[ecc_bytes + 0] << 8) | src[ecc_bytes + 1];
+ uint32_t complen_base = (src[ecc_bytes + 0] << 8) | src[ecc_bytes + 1];
if (complen_bytes > 2)
complen_base = (complen_base << 8) | src[ecc_bytes + 2];
@@ -391,13 +391,13 @@ public:
m_subcode_decompressor.decompress(&src[header_bytes + complen_base], complen - complen_base - header_bytes, &m_buffer[frames * CD_MAX_SECTOR_DATA], frames * CD_MAX_SUBCODE_DATA);
// reassemble the data
- for (UINT32 framenum = 0; framenum < frames; framenum++)
+ for (uint32_t framenum = 0; framenum < frames; framenum++)
{
memcpy(&dest[framenum * CD_FRAME_SIZE], &m_buffer[framenum * CD_MAX_SECTOR_DATA], CD_MAX_SECTOR_DATA);
memcpy(&dest[framenum * CD_FRAME_SIZE + CD_MAX_SECTOR_DATA], &m_buffer[frames * CD_MAX_SECTOR_DATA + framenum * CD_MAX_SUBCODE_DATA], CD_MAX_SUBCODE_DATA);
// reconstitute the ECC data and sync header
- UINT8 *sector = &dest[framenum * CD_FRAME_SIZE];
+ uint8_t *sector = &dest[framenum * CD_FRAME_SIZE];
if ((src[framenum / 8] & (1 << (framenum % 8))) != 0)
{
memcpy(sector, s_cd_sync_header, sizeof(s_cd_sync_header));
@@ -410,7 +410,7 @@ private:
// internal state
_BaseDecompressor m_base_decompressor;
_SubcodeDecompressor m_subcode_decompressor;
- std::vector<UINT8> m_buffer;
+ std::vector<uint8_t> m_buffer;
};
@@ -421,10 +421,10 @@ class chd_avhuff_compressor : public chd_compressor
{
public:
// construction/destruction
- chd_avhuff_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy);
+ chd_avhuff_compressor(chd_file &chd, uint32_t hunkbytes, bool lossy);
// core functionality
- virtual UINT32 compress(const UINT8 *src, UINT32 srclen, UINT8 *dest) override;
+ virtual uint32_t compress(const uint8_t *src, uint32_t srclen, uint8_t *dest) override;
private:
// internal helpers
@@ -443,10 +443,10 @@ class chd_avhuff_decompressor : public chd_decompressor
{
public:
// construction/destruction
- chd_avhuff_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy);
+ chd_avhuff_decompressor(chd_file &chd, uint32_t hunkbytes, bool lossy);
// core functionality
- virtual void decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) override;
+ virtual void decompress(const uint8_t *src, uint32_t complen, uint8_t *dest, uint32_t destlen) override;
virtual void configure(int param, void *config) override;
private:
@@ -488,7 +488,7 @@ const chd_codec_list::codec_entry chd_codec_list::s_codec_list[] =
// chd_codec - constructor
//-------------------------------------------------
-chd_codec::chd_codec(chd_file &chd, UINT32 hunkbytes, bool lossy)
+chd_codec::chd_codec(chd_file &chd, uint32_t hunkbytes, bool lossy)
: m_chd(chd),
m_hunkbytes(hunkbytes),
m_lossy(lossy)
@@ -525,7 +525,7 @@ void chd_codec::configure(int param, void *config)
// chd_compressor - constructor
//-------------------------------------------------
-chd_compressor::chd_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
+chd_compressor::chd_compressor(chd_file &chd, uint32_t hunkbytes, bool lossy)
: chd_codec(chd, hunkbytes, lossy)
{
}
@@ -540,7 +540,7 @@ chd_compressor::chd_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
// chd_decompressor - constructor
//-------------------------------------------------
-chd_decompressor::chd_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
+chd_decompressor::chd_decompressor(chd_file &chd, uint32_t hunkbytes, bool lossy)
: chd_codec(chd, hunkbytes, lossy)
{
}
@@ -614,7 +614,7 @@ const chd_codec_list::codec_entry *chd_codec_list::find_in_list(chd_codec_type t
// chd_compressor_group - constructor
//-------------------------------------------------
-chd_compressor_group::chd_compressor_group(chd_file &chd, UINT32 compressor_list[4])
+chd_compressor_group::chd_compressor_group(chd_file &chd, uint32_t compressor_list[4])
: m_hunkbytes(chd.hunk_bytes()),
m_compress_test(m_hunkbytes)
#if CHDCODEC_VERIFY_COMPRESSION
@@ -658,11 +658,11 @@ chd_compressor_group::~chd_compressor_group()
// compression for this hunk
//-------------------------------------------------
-INT8 chd_compressor_group::find_best_compressor(const UINT8 *src, UINT8 *compressed, UINT32 &complen)
+int8_t chd_compressor_group::find_best_compressor(const uint8_t *src, uint8_t *compressed, uint32_t &complen)
{
// determine best compression technique
complen = m_hunkbytes;
- INT8 compression = -1;
+ int8_t compression = -1;
for (int codecnum = 0; codecnum < ARRAY_LENGTH(m_compressor); codecnum++)
if (m_compressor[codecnum] != nullptr)
{
@@ -670,7 +670,7 @@ INT8 chd_compressor_group::find_best_compressor(const UINT8 *src, UINT8 *compres
try
{
// if this is the best one, copy the data into the permanent buffer
- UINT32 compbytes = m_compressor[codecnum]->compress(src, m_hunkbytes, &m_compress_test[0]);
+ uint32_t compbytes = m_compressor[codecnum]->compress(src, m_hunkbytes, &m_compress_test[0]);
#if CHDCODEC_VERIFY_COMPRESSION
try
{
@@ -768,7 +768,7 @@ voidpf chd_zlib_allocator::fast_alloc(voidpf opaque, uInt items, uInt size)
// reuse a hunk if we can
for (int scan = 0; scan < MAX_ZLIB_ALLOCS; scan++)
{
- UINT32 *ptr = codec->m_allocptr[scan];
+ uint32_t *ptr = codec->m_allocptr[scan];
if (ptr != nullptr && size == *ptr)
{
// set the low bit of the size so we don't match next time
@@ -778,7 +778,7 @@ voidpf chd_zlib_allocator::fast_alloc(voidpf opaque, uInt items, uInt size)
}
// alloc a new one and put it into the list
- UINT32 *ptr = reinterpret_cast<UINT32 *>(new UINT8[size + sizeof(UINT32)]);
+ uint32_t *ptr = reinterpret_cast<uint32_t *>(new uint8_t[size + sizeof(uint32_t)]);
for (int scan = 0; scan < MAX_ZLIB_ALLOCS; scan++)
if (codec->m_allocptr[scan] == nullptr)
{
@@ -802,7 +802,7 @@ void chd_zlib_allocator::fast_free(voidpf opaque, voidpf address)
chd_zlib_allocator *codec = reinterpret_cast<chd_zlib_allocator *>(opaque);
// find the hunk
- UINT32 *ptr = reinterpret_cast<UINT32 *>(address) - 1;
+ uint32_t *ptr = reinterpret_cast<uint32_t *>(address) - 1;
for (int scan = 0; scan < MAX_ZLIB_ALLOCS; scan++)
if (ptr == codec->m_allocptr[scan])
{
@@ -822,7 +822,7 @@ void chd_zlib_allocator::fast_free(voidpf opaque, voidpf address)
// chd_zlib_compressor - constructor
//-------------------------------------------------
-chd_zlib_compressor::chd_zlib_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
+chd_zlib_compressor::chd_zlib_compressor(chd_file &chd, uint32_t hunkbytes, bool lossy)
: chd_compressor(chd, hunkbytes, lossy)
{
// initialize the deflater
@@ -853,7 +853,7 @@ chd_zlib_compressor::~chd_zlib_compressor()
// compress - compress data using the ZLIB codec
//-------------------------------------------------
-UINT32 chd_zlib_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *dest)
+uint32_t chd_zlib_compressor::compress(const uint8_t *src, uint32_t srclen, uint8_t *dest)
{
// reset the decompressor
m_deflater.next_in = const_cast<Bytef *>(src);
@@ -887,7 +887,7 @@ UINT32 chd_zlib_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *des
// chd_zlib_decompressor - constructor
//-------------------------------------------------
-chd_zlib_decompressor::chd_zlib_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
+chd_zlib_decompressor::chd_zlib_decompressor(chd_file &chd, uint32_t hunkbytes, bool lossy)
: chd_decompressor(chd, hunkbytes, lossy)
{
// init the inflater
@@ -919,7 +919,7 @@ chd_zlib_decompressor::~chd_zlib_decompressor()
// codec
//-------------------------------------------------
-void chd_zlib_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen)
+void chd_zlib_decompressor::decompress(const uint8_t *src, uint32_t complen, uint8_t *dest, uint32_t destlen)
{
// reset the decompressor
m_inflater.next_in = const_cast<Bytef *>(src);
@@ -988,7 +988,7 @@ void *chd_lzma_allocator::fast_alloc(void *p, size_t size)
// reuse a hunk if we can
for (int scan = 0; scan < MAX_LZMA_ALLOCS; scan++)
{
- UINT32 *ptr = codec->m_allocptr[scan];
+ uint32_t *ptr = codec->m_allocptr[scan];
if (ptr != nullptr && size == *ptr)
{
// set the low bit of the size so we don't match next time
@@ -998,7 +998,7 @@ void *chd_lzma_allocator::fast_alloc(void *p, size_t size)
}
// alloc a new one and put it into the list
- UINT32 *ptr = reinterpret_cast<UINT32 *>(new UINT8[size + sizeof(UINT32)]);
+ uint32_t *ptr = reinterpret_cast<uint32_t *>(new uint8_t[size + sizeof(uint32_t)]);
for (int scan = 0; scan < MAX_LZMA_ALLOCS; scan++)
if (codec->m_allocptr[scan] == nullptr)
{
@@ -1025,7 +1025,7 @@ void chd_lzma_allocator::fast_free(void *p, void *address)
chd_lzma_allocator *codec = reinterpret_cast<chd_lzma_allocator *>(p);
// find the hunk
- UINT32 *ptr = reinterpret_cast<UINT32 *>(address) - 1;
+ uint32_t *ptr = reinterpret_cast<uint32_t *>(address) - 1;
for (int scan = 0; scan < MAX_LZMA_ALLOCS; scan++)
if (ptr == codec->m_allocptr[scan])
{
@@ -1045,7 +1045,7 @@ void chd_lzma_allocator::fast_free(void *p, void *address)
// chd_lzma_compressor - constructor
//-------------------------------------------------
-chd_lzma_compressor::chd_lzma_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
+chd_lzma_compressor::chd_lzma_compressor(chd_file &chd, uint32_t hunkbytes, bool lossy)
: chd_compressor(chd, hunkbytes, lossy)
{
// initialize the properties
@@ -1066,7 +1066,7 @@ chd_lzma_compressor::~chd_lzma_compressor()
// compress - compress data using the LZMA codec
//-------------------------------------------------
-UINT32 chd_lzma_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *dest)
+uint32_t chd_lzma_compressor::compress(const uint8_t *src, uint32_t srclen, uint8_t *dest)
{
// allocate the encoder
CLzmaEncHandle encoder = LzmaEnc_Create(&m_allocator);
@@ -1104,7 +1104,7 @@ UINT32 chd_lzma_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *des
// codec
//-------------------------------------------------
-void chd_lzma_compressor::configure_properties(CLzmaEncProps &props, UINT32 hunkbytes)
+void chd_lzma_compressor::configure_properties(CLzmaEncProps &props, uint32_t hunkbytes)
{
LzmaEncProps_Init(&props);
props.level = 9;
@@ -1122,7 +1122,7 @@ void chd_lzma_compressor::configure_properties(CLzmaEncProps &props, UINT32 hunk
// chd_lzma_decompressor - constructor
//-------------------------------------------------
-chd_lzma_decompressor::chd_lzma_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
+chd_lzma_decompressor::chd_lzma_decompressor(chd_file &chd, uint32_t hunkbytes, bool lossy)
: chd_decompressor(chd, hunkbytes, lossy)
{
// construct the decoder
@@ -1177,7 +1177,7 @@ chd_lzma_decompressor::~chd_lzma_decompressor()
// codec
//-------------------------------------------------
-void chd_lzma_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen)
+void chd_lzma_decompressor::decompress(const uint8_t *src, uint32_t complen, uint8_t *dest, uint32_t destlen)
{
// initialize
LzmaDec_Init(&m_decoder);
@@ -1201,7 +1201,7 @@ void chd_lzma_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 *
// chd_huffman_compressor - constructor
//-------------------------------------------------
-chd_huffman_compressor::chd_huffman_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
+chd_huffman_compressor::chd_huffman_compressor(chd_file &chd, uint32_t hunkbytes, bool lossy)
: chd_compressor(chd, hunkbytes, lossy)
{
}
@@ -1212,9 +1212,9 @@ chd_huffman_compressor::chd_huffman_compressor(chd_file &chd, UINT32 hunkbytes,
// codec
//-------------------------------------------------
-UINT32 chd_huffman_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *dest)
+uint32_t chd_huffman_compressor::compress(const uint8_t *src, uint32_t srclen, uint8_t *dest)
{
- UINT32 complen;
+ uint32_t complen;
if (m_encoder.encode(src, srclen, dest, srclen, complen) != HUFFERR_NONE)
throw CHDERR_COMPRESSION_ERROR;
return complen;
@@ -1230,7 +1230,7 @@ UINT32 chd_huffman_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *
// chd_huffman_decompressor - constructor
//-------------------------------------------------
-chd_huffman_decompressor::chd_huffman_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
+chd_huffman_decompressor::chd_huffman_decompressor(chd_file &chd, uint32_t hunkbytes, bool lossy)
: chd_decompressor(chd, hunkbytes, lossy)
{
}
@@ -1241,7 +1241,7 @@ chd_huffman_decompressor::chd_huffman_decompressor(chd_file &chd, UINT32 hunkbyt
// codec
//-------------------------------------------------
-void chd_huffman_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen)
+void chd_huffman_decompressor::decompress(const uint8_t *src, uint32_t complen, uint8_t *dest, uint32_t destlen)
{
if (m_decoder.decode(src, complen, dest, destlen) != HUFFERR_NONE)
throw CHDERR_COMPRESSION_ERROR;
@@ -1257,12 +1257,12 @@ void chd_huffman_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT
// chd_flac_compressor - constructor
//-------------------------------------------------
-chd_flac_compressor::chd_flac_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
+chd_flac_compressor::chd_flac_compressor(chd_file &chd, uint32_t hunkbytes, bool lossy)
: chd_compressor(chd, hunkbytes, lossy)
{
// determine whether we want native or swapped samples
- UINT16 native_endian = 0;
- *reinterpret_cast<UINT8 *>(&native_endian) = 1;
+ uint16_t native_endian = 0;
+ *reinterpret_cast<uint8_t *>(&native_endian) = 1;
m_big_endian = (native_endian == 0x100);
// configure the encoder
@@ -1277,22 +1277,22 @@ chd_flac_compressor::chd_flac_compressor(chd_file &chd, UINT32 hunkbytes, bool l
// compress - compress data using the FLAC codec
//-------------------------------------------------
-UINT32 chd_flac_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *dest)
+uint32_t chd_flac_compressor::compress(const uint8_t *src, uint32_t srclen, uint8_t *dest)
{
// reset and encode big-endian
m_encoder.reset(dest + 1, hunkbytes() - 1);
- if (!m_encoder.encode_interleaved(reinterpret_cast<const INT16 *>(src), srclen / 4, !m_big_endian))
+ if (!m_encoder.encode_interleaved(reinterpret_cast<const int16_t *>(src), srclen / 4, !m_big_endian))
throw CHDERR_COMPRESSION_ERROR;
- UINT32 complen_be = m_encoder.finish();
+ uint32_t complen_be = m_encoder.finish();
// reset and encode little-endian
m_encoder.reset(dest + 1, hunkbytes() - 1);
- if (!m_encoder.encode_interleaved(reinterpret_cast<const INT16 *>(src), srclen / 4, m_big_endian))
+ if (!m_encoder.encode_interleaved(reinterpret_cast<const int16_t *>(src), srclen / 4, m_big_endian))
throw CHDERR_COMPRESSION_ERROR;
- UINT32 complen_le = m_encoder.finish();
+ uint32_t complen_le = m_encoder.finish();
// pick the best one and add a byte
- UINT32 complen = std::min(complen_le, complen_be);
+ uint32_t complen = std::min(complen_le, complen_be);
if (complen + 1 >= hunkbytes())
throw CHDERR_COMPRESSION_ERROR;
@@ -1302,7 +1302,7 @@ UINT32 chd_flac_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *des
{
dest[0] = 'B';
m_encoder.reset(dest + 1, hunkbytes() - 1);
- if (!m_encoder.encode_interleaved(reinterpret_cast<const INT16 *>(src), srclen / 4, !m_big_endian))
+ if (!m_encoder.encode_interleaved(reinterpret_cast<const int16_t *>(src), srclen / 4, !m_big_endian))
throw CHDERR_COMPRESSION_ERROR;
m_encoder.finish();
}
@@ -1314,11 +1314,11 @@ UINT32 chd_flac_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *des
// blocksize - return the optimal block size
//-------------------------------------------------
-UINT32 chd_flac_compressor::blocksize(UINT32 bytes)
+uint32_t chd_flac_compressor::blocksize(uint32_t bytes)
{
// determine FLAC block size, which must be 16-65535
// clamp to 2k since that's supposed to be the sweet spot
- UINT32 hunkbytes = bytes / 4;
+ uint32_t hunkbytes = bytes / 4;
while (hunkbytes > 2048)
hunkbytes /= 2;
return hunkbytes;
@@ -1334,12 +1334,12 @@ UINT32 chd_flac_compressor::blocksize(UINT32 bytes)
// chd_flac_decompressor - constructor
//-------------------------------------------------
-chd_flac_decompressor::chd_flac_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
+chd_flac_decompressor::chd_flac_decompressor(chd_file &chd, uint32_t hunkbytes, bool lossy)
: chd_decompressor(chd, hunkbytes, lossy)
{
// determine whether we want native or swapped samples
- UINT16 native_endian = 0;
- *reinterpret_cast<UINT8 *>(&native_endian) = 1;
+ uint16_t native_endian = 0;
+ *reinterpret_cast<uint8_t *>(&native_endian) = 1;
m_big_endian = (native_endian == 0x100);
}
@@ -1349,7 +1349,7 @@ chd_flac_decompressor::chd_flac_decompressor(chd_file &chd, UINT32 hunkbytes, bo
// codec
//-------------------------------------------------
-void chd_flac_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen)
+void chd_flac_decompressor::decompress(const uint8_t *src, uint32_t complen, uint8_t *dest, uint32_t destlen)
{
// determine the endianness
bool swap_endian;
@@ -1363,7 +1363,7 @@ void chd_flac_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 *
// reset and decode
if (!m_decoder.reset(44100, 2, chd_flac_compressor::blocksize(destlen), src + 1, complen - 1))
throw CHDERR_DECOMPRESSION_ERROR;
- if (!m_decoder.decode_interleaved(reinterpret_cast<INT16 *>(dest), destlen / 4, swap_endian))
+ if (!m_decoder.decode_interleaved(reinterpret_cast<int16_t *>(dest), destlen / 4, swap_endian))
throw CHDERR_DECOMPRESSION_ERROR;
// finish up
@@ -1380,7 +1380,7 @@ void chd_flac_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 *
// chd_cd_flac_compressor - constructor
//-------------------------------------------------
-chd_cd_flac_compressor::chd_cd_flac_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
+chd_cd_flac_compressor::chd_cd_flac_compressor(chd_file &chd, uint32_t hunkbytes, bool lossy)
: chd_compressor(chd, hunkbytes, lossy),
m_buffer(hunkbytes)
{
@@ -1389,8 +1389,8 @@ chd_cd_flac_compressor::chd_cd_flac_compressor(chd_file &chd, UINT32 hunkbytes,
throw CHDERR_CODEC_ERROR;
// determine whether we want native or swapped samples
- UINT16 native_endian = 0;
- *reinterpret_cast<UINT8 *>(&native_endian) = 1;
+ uint16_t native_endian = 0;
+ *reinterpret_cast<uint8_t *>(&native_endian) = 1;
m_swap_endian = (native_endian == 1);
// configure the encoder
@@ -1428,11 +1428,11 @@ chd_cd_flac_compressor::~chd_cd_flac_compressor()
// and use zlib on the subcode data
//-------------------------------------------------
-UINT32 chd_cd_flac_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *dest)
+uint32_t chd_cd_flac_compressor::compress(const uint8_t *src, uint32_t srclen, uint8_t *dest)
{
// copy audio data followed by subcode data
- UINT32 frames = hunkbytes() / CD_FRAME_SIZE;
- for (UINT32 framenum = 0; framenum < frames; framenum++)
+ uint32_t frames = hunkbytes() / CD_FRAME_SIZE;
+ for (uint32_t framenum = 0; framenum < frames; framenum++)
{
memcpy(&m_buffer[framenum * CD_MAX_SECTOR_DATA], &src[framenum * CD_FRAME_SIZE], CD_MAX_SECTOR_DATA);
memcpy(&m_buffer[frames * CD_MAX_SECTOR_DATA + framenum * CD_MAX_SUBCODE_DATA], &src[framenum * CD_FRAME_SIZE + CD_MAX_SECTOR_DATA], CD_MAX_SUBCODE_DATA);
@@ -1440,12 +1440,12 @@ UINT32 chd_cd_flac_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *
// reset and encode the audio portion
m_encoder.reset(dest, hunkbytes());
- UINT8 *buffer = &m_buffer[0];
- if (!m_encoder.encode_interleaved(reinterpret_cast<INT16 *>(buffer), frames * CD_MAX_SECTOR_DATA/4, m_swap_endian))
+ uint8_t *buffer = &m_buffer[0];
+ if (!m_encoder.encode_interleaved(reinterpret_cast<int16_t *>(buffer), frames * CD_MAX_SECTOR_DATA/4, m_swap_endian))
throw CHDERR_COMPRESSION_ERROR;
// finish up
- UINT32 complen = m_encoder.finish();
+ uint32_t complen = m_encoder.finish();
// deflate the subcode data
m_deflater.next_in = const_cast<Bytef *>(&m_buffer[frames * CD_MAX_SECTOR_DATA]);
@@ -1469,7 +1469,7 @@ UINT32 chd_cd_flac_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *
}
/**
- * @fn UINT32 chd_cd_flac_compressor::blocksize(UINT32 bytes)
+ * @fn uint32_t chd_cd_flac_compressor::blocksize(uint32_t bytes)
*
* @brief -------------------------------------------------
* blocksize - return the optimal block size
@@ -1477,13 +1477,13 @@ UINT32 chd_cd_flac_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *
*
* @param bytes The bytes.
*
- * @return An UINT32.
+ * @return An uint32_t.
*/
-UINT32 chd_cd_flac_compressor::blocksize(UINT32 bytes)
+uint32_t chd_cd_flac_compressor::blocksize(uint32_t bytes)
{
// for CDs it seems that CD_MAX_SECTOR_DATA is the right target
- UINT32 blocksize = bytes / 4;
+ uint32_t blocksize = bytes / 4;
while (blocksize > CD_MAX_SECTOR_DATA)
blocksize /= 2;
return blocksize;
@@ -1496,7 +1496,7 @@ UINT32 chd_cd_flac_compressor::blocksize(UINT32 bytes)
//**************************************************************************
/**
- * @fn chd_cd_flac_decompressor::chd_cd_flac_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
+ * @fn chd_cd_flac_decompressor::chd_cd_flac_decompressor(chd_file &chd, uint32_t hunkbytes, bool lossy)
*
* @brief -------------------------------------------------
* chd_cd_flac_decompressor - constructor
@@ -1509,7 +1509,7 @@ UINT32 chd_cd_flac_compressor::blocksize(UINT32 bytes)
* @param lossy true to lossy.
*/
-chd_cd_flac_decompressor::chd_cd_flac_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
+chd_cd_flac_decompressor::chd_cd_flac_decompressor(chd_file &chd, uint32_t hunkbytes, bool lossy)
: chd_decompressor(chd, hunkbytes, lossy),
m_buffer(hunkbytes)
{
@@ -1518,8 +1518,8 @@ chd_cd_flac_decompressor::chd_cd_flac_decompressor(chd_file &chd, UINT32 hunkbyt
throw CHDERR_CODEC_ERROR;
// determine whether we want native or swapped samples
- UINT16 native_endian = 0;
- *reinterpret_cast<UINT8 *>(&native_endian) = 1;
+ uint16_t native_endian = 0;
+ *reinterpret_cast<uint8_t *>(&native_endian) = 1;
m_swap_endian = (native_endian == 1);
// init the inflater
@@ -1549,7 +1549,7 @@ chd_cd_flac_decompressor::~chd_cd_flac_decompressor()
}
/**
- * @fn void chd_cd_flac_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen)
+ * @fn void chd_cd_flac_decompressor::decompress(const uint8_t *src, uint32_t complen, uint8_t *dest, uint32_t destlen)
*
* @brief -------------------------------------------------
* decompress - decompress data using the FLAC codec
@@ -1564,18 +1564,18 @@ chd_cd_flac_decompressor::~chd_cd_flac_decompressor()
* @param destlen The destlen.
*/
-void chd_cd_flac_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen)
+void chd_cd_flac_decompressor::decompress(const uint8_t *src, uint32_t complen, uint8_t *dest, uint32_t destlen)
{
// reset and decode
- UINT32 frames = destlen / CD_FRAME_SIZE;
+ uint32_t frames = destlen / CD_FRAME_SIZE;
if (!m_decoder.reset(44100, 2, chd_cd_flac_compressor::blocksize(frames * CD_MAX_SECTOR_DATA), src, complen))
throw CHDERR_DECOMPRESSION_ERROR;
- UINT8 *buffer = &m_buffer[0];
- if (!m_decoder.decode_interleaved(reinterpret_cast<INT16 *>(buffer), frames * CD_MAX_SECTOR_DATA/4, m_swap_endian))
+ uint8_t *buffer = &m_buffer[0];
+ if (!m_decoder.decode_interleaved(reinterpret_cast<int16_t *>(buffer), frames * CD_MAX_SECTOR_DATA/4, m_swap_endian))
throw CHDERR_DECOMPRESSION_ERROR;
// inflate the subcode data
- UINT32 offset = m_decoder.finish();
+ uint32_t offset = m_decoder.finish();
m_inflater.next_in = const_cast<Bytef *>(src + offset);
m_inflater.avail_in = complen - offset;
m_inflater.total_in = 0;
@@ -1594,7 +1594,7 @@ void chd_cd_flac_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT
throw CHDERR_DECOMPRESSION_ERROR;
// reassemble the data
- for (UINT32 framenum = 0; framenum < frames; framenum++)
+ for (uint32_t framenum = 0; framenum < frames; framenum++)
{
memcpy(&dest[framenum * CD_FRAME_SIZE], &m_buffer[framenum * CD_MAX_SECTOR_DATA], CD_MAX_SECTOR_DATA);
memcpy(&dest[framenum * CD_FRAME_SIZE + CD_MAX_SECTOR_DATA], &m_buffer[frames * CD_MAX_SECTOR_DATA + framenum * CD_MAX_SUBCODE_DATA], CD_MAX_SUBCODE_DATA);
@@ -1608,7 +1608,7 @@ void chd_cd_flac_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT
//**************************************************************************
/**
- * @fn chd_avhuff_compressor::chd_avhuff_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
+ * @fn chd_avhuff_compressor::chd_avhuff_compressor(chd_file &chd, uint32_t hunkbytes, bool lossy)
*
* @brief -------------------------------------------------
* chd_avhuff_compressor - constructor
@@ -1619,7 +1619,7 @@ void chd_cd_flac_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT
* @param lossy true to lossy.
*/
-chd_avhuff_compressor::chd_avhuff_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
+chd_avhuff_compressor::chd_avhuff_compressor(chd_file &chd, uint32_t hunkbytes, bool lossy)
: chd_compressor(chd, hunkbytes, lossy),
m_postinit(false)
{
@@ -1635,7 +1635,7 @@ chd_avhuff_compressor::chd_avhuff_compressor(chd_file &chd, UINT32 hunkbytes, bo
}
/**
- * @fn UINT32 chd_avhuff_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *dest)
+ * @fn uint32_t chd_avhuff_compressor::compress(const uint8_t *src, uint32_t srclen, uint8_t *dest)
*
* @brief -------------------------------------------------
* compress - compress data using the A/V codec
@@ -1650,10 +1650,10 @@ chd_avhuff_compressor::chd_avhuff_compressor(chd_file &chd, UINT32 hunkbytes, bo
* @param srclen The srclen.
* @param [in,out] dest If non-null, destination for the.
*
- * @return An UINT32.
+ * @return An uint32_t.
*/
-UINT32 chd_avhuff_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *dest)
+uint32_t chd_avhuff_compressor::compress(const uint8_t *src, uint32_t srclen, uint8_t *dest)
{
// if we haven't yet set up the avhuff code, do it now
if (!m_postinit)
@@ -1669,7 +1669,7 @@ UINT32 chd_avhuff_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *d
}
// encode the audio and video
- UINT32 complen;
+ uint32_t complen;
avhuff_error averr = m_encoder.encode_data(src, dest, complen);
if (averr != AVHERR_NONE || complen > srclen)
throw CHDERR_COMPRESSION_ERROR;
@@ -1703,9 +1703,9 @@ void chd_avhuff_compressor::postinit()
throw CHDERR_INVALID_METADATA;
// compute the bytes per frame
- UINT32 fps_times_1million = fps * 1000000 + fpsfrac;
- UINT32 max_samples_per_frame = (UINT64(rate) * 1000000 + fps_times_1million - 1) / fps_times_1million;
- UINT32 bytes_per_frame = 12 + channels * max_samples_per_frame * 2 + width * height * 2;
+ uint32_t fps_times_1million = fps * 1000000 + fpsfrac;
+ uint32_t max_samples_per_frame = (uint64_t(rate) * 1000000 + fps_times_1million - 1) / fps_times_1million;
+ uint32_t bytes_per_frame = 12 + channels * max_samples_per_frame * 2 + width * height * 2;
if (bytes_per_frame > hunkbytes())
throw CHDERR_INVALID_METADATA;
@@ -1720,7 +1720,7 @@ void chd_avhuff_compressor::postinit()
//**************************************************************************
/**
- * @fn chd_avhuff_decompressor::chd_avhuff_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
+ * @fn chd_avhuff_decompressor::chd_avhuff_decompressor(chd_file &chd, uint32_t hunkbytes, bool lossy)
*
* @brief -------------------------------------------------
* chd_avhuff_decompressor - constructor
@@ -1731,13 +1731,13 @@ void chd_avhuff_compressor::postinit()
* @param lossy true to lossy.
*/
-chd_avhuff_decompressor::chd_avhuff_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
+chd_avhuff_decompressor::chd_avhuff_decompressor(chd_file &chd, uint32_t hunkbytes, bool lossy)
: chd_decompressor(chd, hunkbytes, lossy)
{
}
/**
- * @fn void chd_avhuff_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen)
+ * @fn void chd_avhuff_decompressor::decompress(const uint8_t *src, uint32_t complen, uint8_t *dest, uint32_t destlen)
*
* @brief -------------------------------------------------
* decompress - decompress data using the A/V codec
@@ -1752,7 +1752,7 @@ chd_avhuff_decompressor::chd_avhuff_decompressor(chd_file &chd, UINT32 hunkbytes
* @param destlen The destlen.
*/
-void chd_avhuff_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen)
+void chd_avhuff_decompressor::decompress(const uint8_t *src, uint32_t complen, uint8_t *dest, uint32_t destlen)
{
// decode the audio and video
avhuff_error averr = m_decoder.decode_data(src, complen, dest);
diff --git a/src/lib/util/chdcodec.h b/src/lib/util/chdcodec.h
index 0b56cbdeb9c..899b5363592 100644
--- a/src/lib/util/chdcodec.h
+++ b/src/lib/util/chdcodec.h
@@ -36,7 +36,7 @@
class chd_file;
// base types
-typedef UINT32 chd_codec_type;
+typedef uint32_t chd_codec_type;
// ======================> chd_codec
@@ -46,7 +46,7 @@ class chd_codec
{
protected:
// can't create these directly
- chd_codec(chd_file &file, UINT32 hunkbytes, bool lossy);
+ chd_codec(chd_file &file, uint32_t hunkbytes, bool lossy);
public:
// allow public deletion
@@ -54,7 +54,7 @@ public:
// accessors
chd_file &chd() const { return m_chd; }
- UINT32 hunkbytes() const { return m_hunkbytes; }
+ uint32_t hunkbytes() const { return m_hunkbytes; }
bool lossy() const { return m_lossy; }
// implementation
@@ -63,7 +63,7 @@ public:
private:
// internal state
chd_file & m_chd;
- UINT32 m_hunkbytes;
+ uint32_t m_hunkbytes;
bool m_lossy;
};
@@ -75,11 +75,11 @@ class chd_compressor : public chd_codec
{
protected:
// can't create these directly
- chd_compressor(chd_file &file, UINT32 hunkbytes, bool lossy);
+ chd_compressor(chd_file &file, uint32_t hunkbytes, bool lossy);
public:
// implementation
- virtual UINT32 compress(const UINT8 *src, UINT32 srclen, UINT8 *dest) = 0;
+ virtual uint32_t compress(const uint8_t *src, uint32_t srclen, uint8_t *dest) = 0;
};
@@ -90,11 +90,11 @@ class chd_decompressor : public chd_codec
{
protected:
// can't create these directly
- chd_decompressor(chd_file &file, UINT32 hunkbytes, bool lossy);
+ chd_decompressor(chd_file &file, uint32_t hunkbytes, bool lossy);
public:
// implementation
- virtual void decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) = 0;
+ virtual void decompress(const uint8_t *src, uint32_t complen, uint8_t *dest, uint32_t destlen) = 0;
};
@@ -119,18 +119,18 @@ private:
chd_codec_type m_type;
bool m_lossy;
const char * m_name;
- chd_compressor * (*m_construct_compressor)(chd_file &, UINT32, bool);
- chd_decompressor * (*m_construct_decompressor)(chd_file &, UINT32, bool);
+ chd_compressor * (*m_construct_compressor)(chd_file &, uint32_t, bool);
+ chd_decompressor * (*m_construct_decompressor)(chd_file &, uint32_t, bool);
};
// internal helper functions
static const codec_entry *find_in_list(chd_codec_type type);
template<class _CompressorClass>
- static chd_compressor *construct_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy) { return new _CompressorClass(chd, hunkbytes, lossy); }
+ static chd_compressor *construct_compressor(chd_file &chd, uint32_t hunkbytes, bool lossy) { return new _CompressorClass(chd, hunkbytes, lossy); }
template<class _DecompressorClass>
- static chd_decompressor *construct_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy) { return new _DecompressorClass(chd, hunkbytes, lossy); }
+ static chd_decompressor *construct_decompressor(chd_file &chd, uint32_t hunkbytes, bool lossy) { return new _DecompressorClass(chd, hunkbytes, lossy); }
// the static list
static const codec_entry s_codec_list[];
@@ -148,16 +148,16 @@ public:
~chd_compressor_group();
// find the best compressor
- INT8 find_best_compressor(const UINT8 *src, UINT8 *compressed, UINT32 &complen);
+ int8_t find_best_compressor(const uint8_t *src, uint8_t *compressed, uint32_t &complen);
private:
// internal state
- UINT32 m_hunkbytes; // number of bytes in a hunk
+ uint32_t m_hunkbytes; // number of bytes in a hunk
chd_compressor * m_compressor[4]; // array of active codecs
- std::vector<UINT8> m_compress_test; // test buffer for compression
+ std::vector<uint8_t> m_compress_test; // test buffer for compression
#if CHDCODEC_VERIFY_COMPRESSION
chd_decompressor * m_decompressor[4]; // array of active codecs
- std::vector<UINT8> m_decompressed; // verification buffer
+ std::vector<uint8_t> m_decompressed; // verification buffer
#endif
};
diff --git a/src/lib/util/corefile.cpp b/src/lib/util/corefile.cpp
index 699ef91027b..76b788174ab 100644
--- a/src/lib/util/corefile.cpp
+++ b/src/lib/util/corefile.cpp
@@ -1221,7 +1221,7 @@ osd_file::error core_file::load(std::string const &filename, void **data, std::u
return osd_file::error::NONE;
}
-osd_file::error core_file::load(std::string const &filename, std::vector<UINT8> &data)
+osd_file::error core_file::load(std::string const &filename, std::vector<uint8_t> &data)
{
ptr file;
@@ -1320,7 +1320,7 @@ bool core_filename_ends_with(const std::string &filename, const std::string &ext
// work backwards checking for a match
while (matches && extlen > 0 && namelen > 0)
{
- if (tolower((UINT8)filename[--namelen]) != tolower((UINT8)extension[--extlen]))
+ if (tolower((uint8_t)filename[--namelen]) != tolower((uint8_t)extension[--extlen]))
matches = false;
}
diff --git a/src/lib/util/corefile.h b/src/lib/util/corefile.h
index 70b966c394c..2c4a5da8217 100644
--- a/src/lib/util/corefile.h
+++ b/src/lib/util/corefile.h
@@ -101,7 +101,7 @@ public:
// open a file with the specified filename, read it into memory, and return a pointer
static osd_file::error load(std::string const &filename, void **data, std::uint32_t &length);
- static osd_file::error load(std::string const &filename, std::vector<UINT8> &data);
+ static osd_file::error load(std::string const &filename, std::vector<uint8_t> &data);
// ----- file write -----
diff --git a/src/lib/util/corestr.cpp b/src/lib/util/corestr.cpp
index 7daad5cc0cb..ed9c8e77b0a 100644
--- a/src/lib/util/corestr.cpp
+++ b/src/lib/util/corestr.cpp
@@ -22,8 +22,8 @@ int core_stricmp(const char *s1, const char *s2)
{
for (;;)
{
- int c1 = tolower((UINT8)*s1++);
- int c2 = tolower((UINT8)*s2++);
+ int c1 = tolower((uint8_t)*s1++);
+ int c2 = tolower((uint8_t)*s2++);
if (c1 == 0 || c1 != c2)
return c1 - c2;
}
@@ -39,8 +39,8 @@ int core_strnicmp(const char *s1, const char *s2, size_t n)
size_t i;
for (i = 0; i < n; i++)
{
- int c1 = tolower((UINT8)*s1++);
- int c2 = tolower((UINT8)*s2++);
+ int c1 = tolower((uint8_t)*s1++);
+ int c2 = tolower((uint8_t)*s2++);
if (c1 == 0 || c1 != c2)
return c1 - c2;
}
@@ -166,7 +166,7 @@ std::string strtrimspace(std::string& str)
int start = 0;
for (auto & elem : str)
{
- if (!isspace(UINT8(elem))) break;
+ if (!isspace(uint8_t(elem))) break;
start++;
}
int end = str.length();
@@ -174,7 +174,7 @@ std::string strtrimspace(std::string& str)
{
for (size_t i = str.length() - 1; i > 0; i--)
{
- if (!isspace(UINT8(str[i]))) break;
+ if (!isspace(uint8_t(str[i]))) break;
end--;
}
}
diff --git a/src/lib/util/coreutil.cpp b/src/lib/util/coreutil.cpp
index 90bcab9ab1a..8ff9585d476 100644
--- a/src/lib/util/coreutil.cpp
+++ b/src/lib/util/coreutil.cpp
@@ -27,9 +27,9 @@ int bcd_adjust(int value)
}
-UINT32 dec_2_bcd(UINT32 a)
+uint32_t dec_2_bcd(uint32_t a)
{
- UINT32 result = 0;
+ uint32_t result = 0;
int shift = 0;
while (a != 0)
@@ -42,10 +42,10 @@ UINT32 dec_2_bcd(UINT32 a)
}
-UINT32 bcd_2_dec(UINT32 a)
+uint32_t bcd_2_dec(uint32_t a)
{
- UINT32 result = 0;
- UINT32 scale = 1;
+ uint32_t result = 0;
+ uint32_t scale = 1;
while (a != 0)
{
@@ -106,19 +106,19 @@ int gregorian_days_in_month(int month, int year)
void rand_memory(void *memory, size_t length)
{
- static UINT32 seed = 0;
- UINT8 *bytes = (UINT8 *) memory;
+ static uint32_t seed = 0;
+ uint8_t *bytes = (uint8_t *) memory;
size_t i;
for (i = 0; i < length; i++)
{
seed = seed * 214013 + 2531011;
- bytes[i] = (UINT8) (seed >> 16);
+ bytes[i] = (uint8_t) (seed >> 16);
}
}
-UINT32 core_crc32(UINT32 crc, const UINT8 *buf, UINT32 len)
+uint32_t core_crc32(uint32_t crc, const uint8_t *buf, uint32_t len)
{
return crc32(crc, buf, len);
}
diff --git a/src/lib/util/coreutil.h b/src/lib/util/coreutil.h
index 839e72686ea..167f696970e 100644
--- a/src/lib/util/coreutil.h
+++ b/src/lib/util/coreutil.h
@@ -21,8 +21,8 @@
***************************************************************************/
int bcd_adjust(int value);
-UINT32 dec_2_bcd(UINT32 a);
-UINT32 bcd_2_dec(UINT32 a);
+uint32_t dec_2_bcd(uint32_t a);
+uint32_t bcd_2_dec(uint32_t a);
/***************************************************************************
@@ -39,6 +39,6 @@ int gregorian_days_in_month(int month, int year);
void rand_memory(void *memory, size_t length);
-UINT32 core_crc32(UINT32 crc, const UINT8 *buf, UINT32 len);
+uint32_t core_crc32(uint32_t crc, const uint8_t *buf, uint32_t len);
#endif /* __COREUTIL_H__ */
diff --git a/src/lib/util/flac.cpp b/src/lib/util/flac.cpp
index 46d349c3452..cd84dfbca13 100644
--- a/src/lib/util/flac.cpp
+++ b/src/lib/util/flac.cpp
@@ -28,7 +28,7 @@ flac_encoder::flac_encoder()
}
-flac_encoder::flac_encoder(void *buffer, UINT32 buflength)
+flac_encoder::flac_encoder(void *buffer, uint32_t buflength)
{
init_common();
reset(buffer, buflength);
@@ -86,7 +86,7 @@ bool flac_encoder::reset()
// reset - reset state with new memory parameters
//-------------------------------------------------
-bool flac_encoder::reset(void *buffer, UINT32 buflength)
+bool flac_encoder::reset(void *buffer, uint32_t buflength)
{
// configure the output
m_compressed_start = reinterpret_cast<FLAC__byte *>(buffer);
@@ -115,24 +115,24 @@ bool flac_encoder::reset(util::core_file &file)
// interleaved samples
//-------------------------------------------------
-bool flac_encoder::encode_interleaved(const INT16 *samples, UINT32 samples_per_channel, bool swap_endian)
+bool flac_encoder::encode_interleaved(const int16_t *samples, uint32_t samples_per_channel, bool swap_endian)
{
int shift = swap_endian ? 8 : 0;
// loop over source samples
int num_channels = FLAC__stream_encoder_get_channels(m_encoder);
- UINT32 srcindex = 0;
+ uint32_t srcindex = 0;
while (samples_per_channel != 0)
{
// process in batches of 2k samples
FLAC__int32 converted_buffer[2048];
FLAC__int32 *dest = converted_buffer;
- UINT32 cur_samples = (std::min<size_t>)(ARRAY_LENGTH(converted_buffer) / num_channels, samples_per_channel);
+ uint32_t cur_samples = (std::min<size_t>)(ARRAY_LENGTH(converted_buffer) / num_channels, samples_per_channel);
// convert a buffers' worth
- for (UINT32 sampnum = 0; sampnum < cur_samples; sampnum++)
+ for (uint32_t sampnum = 0; sampnum < cur_samples; sampnum++)
for (int channel = 0; channel < num_channels; channel++, srcindex++)
- *dest++ = INT16((UINT16(samples[srcindex]) << shift) | (UINT16(samples[srcindex]) >> shift));
+ *dest++ = int16_t((uint16_t(samples[srcindex]) << shift) | (uint16_t(samples[srcindex]) >> shift));
// process this batch
if (!FLAC__stream_encoder_process_interleaved(m_encoder, converted_buffer, cur_samples))
@@ -148,24 +148,24 @@ bool flac_encoder::encode_interleaved(const INT16 *samples, UINT32 samples_per_c
// sample streams
//-------------------------------------------------
-bool flac_encoder::encode(INT16 *const *samples, UINT32 samples_per_channel, bool swap_endian)
+bool flac_encoder::encode(int16_t *const *samples, uint32_t samples_per_channel, bool swap_endian)
{
int shift = swap_endian ? 8 : 0;
// loop over source samples
int num_channels = FLAC__stream_encoder_get_channels(m_encoder);
- UINT32 srcindex = 0;
+ uint32_t srcindex = 0;
while (samples_per_channel != 0)
{
// process in batches of 2k samples
FLAC__int32 converted_buffer[2048];
FLAC__int32 *dest = converted_buffer;
- UINT32 cur_samples = (std::min<size_t>)(ARRAY_LENGTH(converted_buffer) / num_channels, samples_per_channel);
+ uint32_t cur_samples = (std::min<size_t>)(ARRAY_LENGTH(converted_buffer) / num_channels, samples_per_channel);
// convert a buffers' worth
- for (UINT32 sampnum = 0; sampnum < cur_samples; sampnum++, srcindex++)
+ for (uint32_t sampnum = 0; sampnum < cur_samples; sampnum++, srcindex++)
for (int channel = 0; channel < num_channels; channel++)
- *dest++ = INT16((UINT16(samples[channel][srcindex]) << shift) | (UINT16(samples[channel][srcindex]) >> shift));
+ *dest++ = int16_t((uint16_t(samples[channel][srcindex]) << shift) | (uint16_t(samples[channel][srcindex]) >> shift));
// process this batch
if (!FLAC__stream_encoder_process_interleaved(m_encoder, converted_buffer, cur_samples))
@@ -181,7 +181,7 @@ bool flac_encoder::encode(INT16 *const *samples, UINT32 samples_per_channel, boo
// stream
//-------------------------------------------------
-UINT32 flac_encoder::finish()
+uint32_t flac_encoder::finish()
{
// process the data and return the amount written
FLAC__stream_encoder_finish(m_encoder);
@@ -297,7 +297,7 @@ flac_decoder::flac_decoder()
// flac_decoder - constructor
//-------------------------------------------------
-flac_decoder::flac_decoder(const void *buffer, UINT32 length, const void *buffer2, UINT32 length2)
+flac_decoder::flac_decoder(const void *buffer, uint32_t length, const void *buffer2, uint32_t length2)
: m_decoder(FLAC__stream_decoder_new()),
m_file(nullptr),
m_compressed_offset(0),
@@ -363,7 +363,7 @@ bool flac_decoder::reset()
// reset - reset state with new memory parameters
//-------------------------------------------------
-bool flac_decoder::reset(const void *buffer, UINT32 length, const void *buffer2, UINT32 length2)
+bool flac_decoder::reset(const void *buffer, uint32_t length, const void *buffer2, uint32_t length2)
{
m_file = nullptr;
m_compressed_start = reinterpret_cast<const FLAC__byte *>(buffer);
@@ -379,10 +379,10 @@ bool flac_decoder::reset(const void *buffer, UINT32 length, const void *buffer2,
// and a custom-generated header
//-------------------------------------------------
-bool flac_decoder::reset(UINT32 sample_rate, UINT8 num_channels, UINT32 block_size, const void *buffer, UINT32 length)
+bool flac_decoder::reset(uint32_t sample_rate, uint8_t num_channels, uint32_t block_size, const void *buffer, uint32_t length)
{
// modify the template header with our parameters
- static const UINT8 s_header_template[0x2a] =
+ static const uint8_t s_header_template[0x2a] =
{
0x66, 0x4C, 0x61, 0x43, // +00: 'fLaC' stream header
0x80, // +04: metadata block type 0 (STREAMINFO),
@@ -436,7 +436,7 @@ bool flac_decoder::reset(util::core_file &file)
// sound stream
//-------------------------------------------------
-bool flac_decoder::decode_interleaved(INT16 *samples, UINT32 num_samples, bool swap_endian)
+bool flac_decoder::decode_interleaved(int16_t *samples, uint32_t num_samples, bool swap_endian)
{
// configure the uncompressed buffer
memset(m_uncompressed_start, 0, sizeof(m_uncompressed_start));
@@ -458,7 +458,7 @@ bool flac_decoder::decode_interleaved(INT16 *samples, UINT32 num_samples, bool s
// data streams
//-------------------------------------------------
-bool flac_decoder::decode(INT16 **samples, UINT32 num_samples, bool swap_endian)
+bool flac_decoder::decode(int16_t **samples, uint32_t num_samples, bool swap_endian)
{
// make sure we don't have too many channels
int chans = channels();
@@ -485,7 +485,7 @@ bool flac_decoder::decode(INT16 **samples, UINT32 num_samples, bool swap_endian)
// finish - finish up the decode
//-------------------------------------------------
-UINT32 flac_decoder::finish()
+uint32_t flac_decoder::finish()
{
// get the final decoding position and move forward
FLAC__uint64 position = 0;
@@ -513,7 +513,7 @@ FLAC__StreamDecoderReadStatus flac_decoder::read_callback_static(const FLAC__Str
FLAC__StreamDecoderReadStatus flac_decoder::read_callback(FLAC__byte buffer[], size_t *bytes)
{
- UINT32 expected = *bytes;
+ uint32_t expected = *bytes;
// if a file, just read
if (m_file != nullptr)
@@ -523,10 +523,10 @@ FLAC__StreamDecoderReadStatus flac_decoder::read_callback(FLAC__byte buffer[], s
else
{
// copy from primary buffer first
- UINT32 outputpos = 0;
+ uint32_t outputpos = 0;
if (outputpos < *bytes && m_compressed_offset < m_compressed_length)
{
- UINT32 bytes_to_copy = (std::min<size_t>)(*bytes - outputpos, m_compressed_length - m_compressed_offset);
+ uint32_t bytes_to_copy = (std::min<size_t>)(*bytes - outputpos, m_compressed_length - m_compressed_offset);
memcpy(&buffer[outputpos], m_compressed_start + m_compressed_offset, bytes_to_copy);
outputpos += bytes_to_copy;
m_compressed_offset += bytes_to_copy;
@@ -535,7 +535,7 @@ FLAC__StreamDecoderReadStatus flac_decoder::read_callback(FLAC__byte buffer[], s
// once we're out of that, copy from the secondary buffer
if (outputpos < *bytes && m_compressed_offset < m_compressed_length + m_compressed2_length)
{
- UINT32 bytes_to_copy = (std::min<size_t>)(*bytes - outputpos, m_compressed2_length - (m_compressed_offset - m_compressed_length));
+ uint32_t bytes_to_copy = (std::min<size_t>)(*bytes - outputpos, m_compressed2_length - (m_compressed_offset - m_compressed_length));
memcpy(&buffer[outputpos], m_compressed2_start + m_compressed_offset - m_compressed_length, bytes_to_copy);
outputpos += bytes_to_copy;
m_compressed_offset += bytes_to_copy;
@@ -597,10 +597,10 @@ FLAC__StreamDecoderWriteStatus flac_decoder::write_callback(const ::FLAC__Frame
int blocksize = frame->header.blocksize;
if (m_uncompressed_start[1] == nullptr)
{
- INT16 *dest = m_uncompressed_start[0] + m_uncompressed_offset * frame->header.channels;
+ int16_t *dest = m_uncompressed_start[0] + m_uncompressed_offset * frame->header.channels;
for (int sampnum = 0; sampnum < blocksize && m_uncompressed_offset < m_uncompressed_length; sampnum++, m_uncompressed_offset++)
for (int chan = 0; chan < frame->header.channels; chan++)
- *dest++ = INT16((UINT16(buffer[chan][sampnum]) << shift) | (UINT16(buffer[chan][sampnum]) >> shift));
+ *dest++ = int16_t((uint16_t(buffer[chan][sampnum]) << shift) | (uint16_t(buffer[chan][sampnum]) >> shift));
}
// non-interleaved case
@@ -609,7 +609,7 @@ FLAC__StreamDecoderWriteStatus flac_decoder::write_callback(const ::FLAC__Frame
for (int sampnum = 0; sampnum < blocksize && m_uncompressed_offset < m_uncompressed_length; sampnum++, m_uncompressed_offset++)
for (int chan = 0; chan < frame->header.channels; chan++)
if (m_uncompressed_start[chan] != nullptr)
- m_uncompressed_start[chan][m_uncompressed_offset] = INT16((UINT16(buffer[chan][sampnum]) << shift) | (UINT16(buffer[chan][sampnum]) >> shift));
+ m_uncompressed_start[chan][m_uncompressed_offset] = int16_t((uint16_t(buffer[chan][sampnum]) << shift) | (uint16_t(buffer[chan][sampnum]) >> shift));
}
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
diff --git a/src/lib/util/flac.h b/src/lib/util/flac.h
index 2bb41964a43..f5951945b07 100644
--- a/src/lib/util/flac.h
+++ b/src/lib/util/flac.h
@@ -30,14 +30,14 @@ class flac_encoder
public:
// construction/destruction
flac_encoder();
- flac_encoder(void *buffer, UINT32 buflength);
+ flac_encoder(void *buffer, uint32_t buflength);
flac_encoder(util::core_file &file);
~flac_encoder();
// configuration
- void set_sample_rate(UINT32 sample_rate) { m_sample_rate = sample_rate; }
- void set_num_channels(UINT8 num_channels) { m_channels = num_channels; }
- void set_block_size(UINT32 block_size) { m_block_size = block_size; }
+ void set_sample_rate(uint32_t sample_rate) { m_sample_rate = sample_rate; }
+ void set_num_channels(uint8_t num_channels) { m_channels = num_channels; }
+ void set_block_size(uint32_t block_size) { m_block_size = block_size; }
void set_strip_metadata(bool strip) { m_strip_metadata = strip; }
// getters (valid after reset)
@@ -46,15 +46,15 @@ public:
// reset
bool reset();
- bool reset(void *buffer, UINT32 buflength);
+ bool reset(void *buffer, uint32_t buflength);
bool reset(util::core_file &file);
// encode a buffer
- bool encode_interleaved(const INT16 *samples, UINT32 samples_per_channel, bool swap_endian = false);
- bool encode(INT16 *const *samples, UINT32 samples_per_channel, bool swap_endian = false);
+ bool encode_interleaved(const int16_t *samples, uint32_t samples_per_channel, bool swap_endian = false);
+ bool encode(int16_t *const *samples, uint32_t samples_per_channel, bool swap_endian = false);
// finish up
- UINT32 finish();
+ uint32_t finish();
private:
// internal helpers
@@ -65,18 +65,18 @@ private:
// internal state
FLAC__StreamEncoder * m_encoder; // actual encoder
util::core_file * m_file; // output file
- UINT32 m_compressed_offset; // current offset with the compressed stream
+ uint32_t m_compressed_offset; // current offset with the compressed stream
FLAC__byte * m_compressed_start; // start of compressed data
- UINT32 m_compressed_length; // length of the compressed stream
+ uint32_t m_compressed_length; // length of the compressed stream
// parameters
- UINT32 m_sample_rate; // sample rate
- UINT8 m_channels; // number of channels
- UINT32 m_block_size; // block size
+ uint32_t m_sample_rate; // sample rate
+ uint8_t m_channels; // number of channels
+ uint32_t m_block_size; // block size
// header stripping
bool m_strip_metadata; // strip the metadata?
- UINT32 m_ignore_bytes; // how many bytes to ignore when writing
+ uint32_t m_ignore_bytes; // how many bytes to ignore when writing
bool m_found_audio; // have we hit the audio yet?
};
@@ -88,30 +88,30 @@ class flac_decoder
public:
// construction/destruction
flac_decoder();
- flac_decoder(const void *buffer, UINT32 length, const void *buffer2 = nullptr, UINT32 length2 = 0);
+ flac_decoder(const void *buffer, uint32_t length, const void *buffer2 = nullptr, uint32_t length2 = 0);
flac_decoder(util::core_file &file);
~flac_decoder();
// getters (valid after reset)
- UINT32 sample_rate() const { return m_sample_rate; }
- UINT8 channels() const { return m_channels; }
- UINT8 bits_per_sample() const { return m_bits_per_sample; }
- UINT32 total_samples() const { return FLAC__stream_decoder_get_total_samples(m_decoder); }
+ uint32_t sample_rate() const { return m_sample_rate; }
+ uint8_t channels() const { return m_channels; }
+ uint8_t bits_per_sample() const { return m_bits_per_sample; }
+ uint32_t total_samples() const { return FLAC__stream_decoder_get_total_samples(m_decoder); }
FLAC__StreamDecoderState state() const { return FLAC__stream_decoder_get_state(m_decoder); }
const char *state_string() const { return FLAC__stream_decoder_get_resolved_state_string(m_decoder); }
// reset
bool reset();
- bool reset(const void *buffer, UINT32 length, const void *buffer2 = nullptr, UINT32 length2 = 0);
- bool reset(UINT32 sample_rate, UINT8 num_channels, UINT32 block_size, const void *buffer, UINT32 length);
+ bool reset(const void *buffer, uint32_t length, const void *buffer2 = nullptr, uint32_t length2 = 0);
+ bool reset(uint32_t sample_rate, uint8_t num_channels, uint32_t block_size, const void *buffer, uint32_t length);
bool reset(util::core_file &file);
// decode to a buffer; num_samples must be a multiple of the block size
- bool decode_interleaved(INT16 *samples, UINT32 num_samples, bool swap_endian = false);
- bool decode(INT16 **samples, UINT32 num_samples, bool swap_endian = false);
+ bool decode_interleaved(int16_t *samples, uint32_t num_samples, bool swap_endian = false);
+ bool decode(int16_t **samples, uint32_t num_samples, bool swap_endian = false);
// finish up
- UINT32 finish();
+ uint32_t finish();
private:
// internal helpers
@@ -126,19 +126,19 @@ private:
// output state
FLAC__StreamDecoder * m_decoder; // actual encoder
util::core_file * m_file; // output file
- UINT32 m_sample_rate; // decoded sample rate
- UINT8 m_channels; // decoded number of channels
- UINT8 m_bits_per_sample; // decoded bits per sample
- UINT32 m_compressed_offset; // current offset in compressed data
+ uint32_t m_sample_rate; // decoded sample rate
+ uint8_t m_channels; // decoded number of channels
+ uint8_t m_bits_per_sample; // decoded bits per sample
+ uint32_t m_compressed_offset; // current offset in compressed data
const FLAC__byte * m_compressed_start; // start of compressed data
- UINT32 m_compressed_length; // length of compressed data
+ uint32_t m_compressed_length; // length of compressed data
const FLAC__byte * m_compressed2_start; // start of compressed data
- UINT32 m_compressed2_length; // length of compressed data
- INT16 * m_uncompressed_start[8];// pointer to start of uncompressed data (up to 8 streams)
- UINT32 m_uncompressed_offset; // current position in uncompressed data
- UINT32 m_uncompressed_length; // length of uncompressed data
+ uint32_t m_compressed2_length; // length of compressed data
+ int16_t * m_uncompressed_start[8];// pointer to start of uncompressed data (up to 8 streams)
+ uint32_t m_uncompressed_offset; // current position in uncompressed data
+ uint32_t m_uncompressed_length; // length of uncompressed data
bool m_uncompressed_swap; // swap uncompressed sample data
- UINT8 m_custom_header[0x2a]; // custom header
+ uint8_t m_custom_header[0x2a]; // custom header
};
diff --git a/src/lib/util/harddisk.cpp b/src/lib/util/harddisk.cpp
index 6bb121f36b2..31c6a36ed28 100644
--- a/src/lib/util/harddisk.cpp
+++ b/src/lib/util/harddisk.cpp
@@ -119,7 +119,7 @@ hard_disk_info *hard_disk_get_info(hard_disk_file *file)
-------------------------------------------------*/
/**
- * @fn UINT32 hard_disk_read(hard_disk_file *file, UINT32 lbasector, void *buffer)
+ * @fn uint32_t hard_disk_read(hard_disk_file *file, uint32_t lbasector, void *buffer)
*
* @brief Hard disk read.
*
@@ -127,10 +127,10 @@ hard_disk_info *hard_disk_get_info(hard_disk_file *file)
* @param lbasector The lbasector.
* @param [in,out] buffer If non-null, the buffer.
*
- * @return An UINT32.
+ * @return An uint32_t.
*/
-UINT32 hard_disk_read(hard_disk_file *file, UINT32 lbasector, void *buffer)
+uint32_t hard_disk_read(hard_disk_file *file, uint32_t lbasector, void *buffer)
{
chd_error err = file->chd->read_units(lbasector, buffer);
return (err == CHDERR_NONE);
@@ -143,7 +143,7 @@ UINT32 hard_disk_read(hard_disk_file *file, UINT32 lbasector, void *buffer)
-------------------------------------------------*/
/**
- * @fn UINT32 hard_disk_write(hard_disk_file *file, UINT32 lbasector, const void *buffer)
+ * @fn uint32_t hard_disk_write(hard_disk_file *file, uint32_t lbasector, const void *buffer)
*
* @brief Hard disk write.
*
@@ -151,10 +151,10 @@ UINT32 hard_disk_read(hard_disk_file *file, UINT32 lbasector, void *buffer)
* @param lbasector The lbasector.
* @param buffer The buffer.
*
- * @return An UINT32.
+ * @return An uint32_t.
*/
-UINT32 hard_disk_write(hard_disk_file *file, UINT32 lbasector, const void *buffer)
+uint32_t hard_disk_write(hard_disk_file *file, uint32_t lbasector, const void *buffer)
{
chd_error err = file->chd->write_units(lbasector, buffer);
return (err == CHDERR_NONE);
diff --git a/src/lib/util/harddisk.h b/src/lib/util/harddisk.h
index 5b32c905d94..727f9a3fd07 100644
--- a/src/lib/util/harddisk.h
+++ b/src/lib/util/harddisk.h
@@ -25,10 +25,10 @@ struct hard_disk_file;
struct hard_disk_info
{
- UINT32 cylinders;
- UINT32 heads;
- UINT32 sectors;
- UINT32 sectorbytes;
+ uint32_t cylinders;
+ uint32_t heads;
+ uint32_t sectors;
+ uint32_t sectorbytes;
};
@@ -43,7 +43,7 @@ void hard_disk_close(hard_disk_file *file);
chd_file *hard_disk_get_chd(hard_disk_file *file);
hard_disk_info *hard_disk_get_info(hard_disk_file *file);
-UINT32 hard_disk_read(hard_disk_file *file, UINT32 lbasector, void *buffer);
-UINT32 hard_disk_write(hard_disk_file *file, UINT32 lbasector, const void *buffer);
+uint32_t hard_disk_read(hard_disk_file *file, uint32_t lbasector, void *buffer);
+uint32_t hard_disk_write(hard_disk_file *file, uint32_t lbasector, const void *buffer);
#endif /* __HARDDISK_H__ */
diff --git a/src/lib/util/hash.cpp b/src/lib/util/hash.cpp
index 9ba632240dc..4593ad181a4 100644
--- a/src/lib/util/hash.cpp
+++ b/src/lib/util/hash.cpp
@@ -362,7 +362,7 @@ void hash_collection::begin(const char *types)
// buffer - add the given buffer to the hash
//-------------------------------------------------
-void hash_collection::buffer(const UINT8 *data, UINT32 length)
+void hash_collection::buffer(const uint8_t *data, uint32_t length)
{
assert(m_creator != nullptr);
diff --git a/src/lib/util/hash.h b/src/lib/util/hash.h
index ec628a949f2..23c8702958e 100644
--- a/src/lib/util/hash.h
+++ b/src/lib/util/hash.h
@@ -75,8 +75,8 @@ public:
bool remove(char type);
// CRC-specific helpers
- bool crc(UINT32 &result) const { result = m_crc32; return m_has_crc32; }
- void add_crc(UINT32 crc) { m_crc32 = crc; m_has_crc32 = true; }
+ bool crc(uint32_t &result) const { result = m_crc32; return m_has_crc32; }
+ void add_crc(uint32_t crc) { m_crc32 = crc; m_has_crc32 = true; }
// SHA1-specific helpers
bool sha1(sha1_t &result) const { result = m_sha1; return m_has_sha1; }
@@ -90,9 +90,9 @@ public:
// creation
void begin(const char *types = nullptr);
- void buffer(const UINT8 *data, UINT32 length);
+ void buffer(const uint8_t *data, uint32_t length);
void end();
- void compute(const UINT8 *data, UINT32 length, const char *types = nullptr) { begin(types); buffer(data, length); end(); }
+ void compute(const uint8_t *data, uint32_t length, const char *types = nullptr) { begin(types); buffer(data, length); end(); }
private:
// internal helpers
diff --git a/src/lib/util/hashing.cpp b/src/lib/util/hashing.cpp
index dd6b9847f15..448cdc5d6ec 100644
--- a/src/lib/util/hashing.cpp
+++ b/src/lib/util/hashing.cpp
@@ -184,7 +184,7 @@ std::string crc32_t::as_string() const
// the currently-accumulated value
//-------------------------------------------------
-void crc32_creator::append(const void *data, UINT32 length)
+void crc32_creator::append(const void *data, uint32_t length)
{
m_accum.m_raw = crc32(m_accum, reinterpret_cast<const Bytef *>(data), length);
}
@@ -236,7 +236,7 @@ std::string crc16_t::as_string() const
}
/**
- * @fn void crc16_creator::append(const void *data, UINT32 length)
+ * @fn void crc16_creator::append(const void *data, uint32_t length)
*
* @brief -------------------------------------------------
* append - hash a block of data, appending to the currently-accumulated value
@@ -246,9 +246,9 @@ std::string crc16_t::as_string() const
* @param length The length.
*/
-void crc16_creator::append(const void *data, UINT32 length)
+void crc16_creator::append(const void *data, uint32_t length)
{
- static const UINT16 s_table[256] =
+ static const uint16_t s_table[256] =
{
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
@@ -284,10 +284,10 @@ void crc16_creator::append(const void *data, UINT32 length)
0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
};
- const UINT8 *src = reinterpret_cast<const UINT8 *>(data);
+ const uint8_t *src = reinterpret_cast<const uint8_t *>(data);
// fetch the current value into a local and rip through the source data
- UINT16 crc = m_accum.m_raw;
+ uint16_t crc = m_accum.m_raw;
while (length-- != 0)
crc = (crc << 8) ^ s_table[(crc >> 8) ^ *src++];
m_accum.m_raw = crc;
diff --git a/src/lib/util/hashing.h b/src/lib/util/hashing.h
index 8b58d3afc8b..906bad047b4 100644
--- a/src/lib/util/hashing.h
+++ b/src/lib/util/hashing.h
@@ -33,10 +33,10 @@ struct sha1_t
{
bool operator==(const sha1_t &rhs) const { return memcmp(m_raw, rhs.m_raw, sizeof(m_raw)) == 0; }
bool operator!=(const sha1_t &rhs) const { return memcmp(m_raw, rhs.m_raw, sizeof(m_raw)) != 0; }
- operator UINT8 *() { return m_raw; }
+ operator uint8_t *() { return m_raw; }
bool from_string(const char *string, int length = -1);
std::string as_string() const;
- UINT8 m_raw[20];
+ uint8_t m_raw[20];
static const sha1_t null;
};
@@ -51,7 +51,7 @@ public:
void reset() { sha1_init(&m_context); }
// append data
- void append(const void *data, UINT32 length) { sha1_update(&m_context, length, reinterpret_cast<const UINT8 *>(data)); }
+ void append(const void *data, uint32_t length) { sha1_update(&m_context, length, reinterpret_cast<const uint8_t *>(data)); }
// finalize and compute the final digest
sha1_t finish()
@@ -63,7 +63,7 @@ public:
}
// static wrapper to just get the digest from a block
- static sha1_t simple(const void *data, UINT32 length)
+ static sha1_t simple(const void *data, uint32_t length)
{
sha1_creator creator;
creator.append(data, length);
@@ -84,10 +84,10 @@ struct md5_t
{
bool operator==(const md5_t &rhs) const { return memcmp(m_raw, rhs.m_raw, sizeof(m_raw)) == 0; }
bool operator!=(const md5_t &rhs) const { return memcmp(m_raw, rhs.m_raw, sizeof(m_raw)) != 0; }
- operator UINT8 *() { return m_raw; }
+ operator uint8_t *() { return m_raw; }
bool from_string(const char *string, int length = -1);
std::string as_string() const;
- UINT8 m_raw[16];
+ uint8_t m_raw[16];
static const md5_t null;
};
@@ -102,7 +102,7 @@ public:
void reset() { MD5Init(&m_context); }
// append data
- void append(const void *data, UINT32 length) { MD5Update(&m_context, reinterpret_cast<const unsigned char *>(data), length); }
+ void append(const void *data, uint32_t length) { MD5Update(&m_context, reinterpret_cast<const unsigned char *>(data), length); }
// finalize and compute the final digest
md5_t finish()
@@ -113,7 +113,7 @@ public:
}
// static wrapper to just get the digest from a block
- static md5_t simple(const void *data, UINT32 length)
+ static md5_t simple(const void *data, uint32_t length)
{
md5_creator creator;
creator.append(data, length);
@@ -134,11 +134,11 @@ struct crc32_t
{
bool operator==(const crc32_t &rhs) const { return m_raw == rhs.m_raw; }
bool operator!=(const crc32_t &rhs) const { return m_raw != rhs.m_raw; }
- crc32_t &operator=(const UINT32 crc) { m_raw = crc; return *this; }
- operator UINT32() const { return m_raw; }
+ crc32_t &operator=(const uint32_t crc) { m_raw = crc; return *this; }
+ operator uint32_t() const { return m_raw; }
bool from_string(const char *string, int length = -1);
std::string as_string() const;
- UINT32 m_raw;
+ uint32_t m_raw;
static const crc32_t null;
};
@@ -153,13 +153,13 @@ public:
void reset() { m_accum.m_raw = 0; }
// append data
- void append(const void *data, UINT32 length);
+ void append(const void *data, uint32_t length);
// finalize and compute the final digest
crc32_t finish() { return m_accum; }
// static wrapper to just get the digest from a block
- static crc32_t simple(const void *data, UINT32 length)
+ static crc32_t simple(const void *data, uint32_t length)
{
crc32_creator creator;
creator.append(data, length);
@@ -180,11 +180,11 @@ struct crc16_t
{
bool operator==(const crc16_t &rhs) const { return m_raw == rhs.m_raw; }
bool operator!=(const crc16_t &rhs) const { return m_raw != rhs.m_raw; }
- crc16_t &operator=(const UINT16 crc) { m_raw = crc; return *this; }
- operator UINT16() const { return m_raw; }
+ crc16_t &operator=(const uint16_t crc) { m_raw = crc; return *this; }
+ operator uint16_t() const { return m_raw; }
bool from_string(const char *string, int length = -1);
std::string as_string() const;
- UINT16 m_raw;
+ uint16_t m_raw;
static const crc16_t null;
};
@@ -199,13 +199,13 @@ public:
void reset() { m_accum.m_raw = 0xffff; }
// append data
- void append(const void *data, UINT32 length);
+ void append(const void *data, uint32_t length);
// finalize and compute the final digest
crc16_t finish() { return m_accum; }
// static wrapper to just get the digest from a block
- static crc16_t simple(const void *data, UINT32 length)
+ static crc16_t simple(const void *data, uint32_t length)
{
crc16_creator creator;
creator.append(data, length);
diff --git a/src/lib/util/huffman.cpp b/src/lib/util/huffman.cpp
index c38d78853fb..d3a73315ea9 100644
--- a/src/lib/util/huffman.cpp
+++ b/src/lib/util/huffman.cpp
@@ -121,7 +121,7 @@
// decoding context
//-------------------------------------------------
-huffman_context_base::huffman_context_base(int numcodes, int maxbits, lookup_value *lookup, UINT32 *histo, node_t *nodes)
+huffman_context_base::huffman_context_base(int numcodes, int maxbits, lookup_value *lookup, uint32_t *histo, node_t *nodes)
: m_numcodes(numcodes),
m_maxbits(maxbits),
m_prevdata(0),
@@ -268,8 +268,8 @@ huffman_error huffman_context_base::import_tree_huffman(bitstream_in &bitbuf)
smallhuff.build_lookup_table();
// determine the maximum length of an RLE count
- UINT32 temp = m_numcodes - 9;
- UINT8 rlefullbits = 0;
+ uint32_t temp = m_numcodes - 9;
+ uint8_t rlefullbits = 0;
while (temp != 0)
temp >>= 1, rlefullbits++;
@@ -316,10 +316,10 @@ huffman_error huffman_context_base::import_tree_huffman(bitstream_in &bitbuf)
huffman_error huffman_context_base::export_tree_huffman(bitstream_out &bitbuf)
{
// first RLE compress the lengths of all the nodes
- std::vector<UINT8> rle_data(m_numcodes);
- UINT8 *dest = &rle_data[0];
- std::vector<UINT16> rle_lengths(m_numcodes/3);
- UINT16 *lengths = &rle_lengths[0];
+ std::vector<uint8_t> rle_data(m_numcodes);
+ uint8_t *dest = &rle_data[0];
+ std::vector<uint16_t> rle_lengths(m_numcodes/3);
+ uint16_t *lengths = &rle_lengths[0];
int last = ~0;
int repcount = 0;
@@ -387,17 +387,17 @@ huffman_error huffman_context_base::export_tree_huffman(bitstream_out &bitbuf)
bitbuf.write(7, 3);
// determine the maximum length of an RLE count
- UINT32 temp = m_numcodes - 9;
- UINT8 rlefullbits = 0;
+ uint32_t temp = m_numcodes - 9;
+ uint8_t rlefullbits = 0;
while (temp != 0)
temp >>= 1, rlefullbits++;
// now encode the RLE data
lengths = &rle_lengths[0];
- for (UINT8 *src = &rle_data[0]; src < dest; src++)
+ for (uint8_t *src = &rle_data[0]; src < dest; src++)
{
// encode the data
- UINT8 data = *src;
+ uint8_t data = *src;
smallhuff.encode_one(bitbuf, data);
// if this is an RLE token, encode the length following
@@ -424,17 +424,17 @@ huffman_error huffman_context_base::export_tree_huffman(bitstream_out &bitbuf)
huffman_error huffman_context_base::compute_tree_from_histo()
{
// compute the number of data items in the histogram
- UINT32 sdatacount = 0;
+ uint32_t sdatacount = 0;
for (int i = 0; i < m_numcodes; i++)
sdatacount += m_datahisto[i];
// binary search to achieve the optimum encoding
- UINT32 lowerweight = 0;
- UINT32 upperweight = sdatacount * 2;
+ uint32_t lowerweight = 0;
+ uint32_t upperweight = sdatacount * 2;
while (1)
{
// build a tree using the current weight
- UINT32 curweight = (upperweight + lowerweight) / 2;
+ uint32_t curweight = (upperweight + lowerweight) / 2;
int curmaxbits = build_tree(sdatacount, curweight);
// apply binary search here
@@ -520,7 +520,7 @@ int CLIB_DECL huffman_context_base::tree_node_compare(const void *item1, const v
// data distribution
//-------------------------------------------------
-int huffman_context_base::build_tree(UINT32 totaldata, UINT32 totalweight)
+int huffman_context_base::build_tree(uint32_t totaldata, uint32_t totalweight)
{
// make a list of all non-zero nodes
std::vector<node_t *> list(m_numcodes * 2);
@@ -534,7 +534,7 @@ int huffman_context_base::build_tree(UINT32 totaldata, UINT32 totalweight)
m_huffnode[curcode].m_bits = curcode;
// scale the weight by the current effective length, ensuring we don't go to 0
- m_huffnode[curcode].m_weight = UINT64(m_datahisto[curcode]) * UINT64(totalweight) / UINT64(totaldata);
+ m_huffnode[curcode].m_weight = uint64_t(m_datahisto[curcode]) * uint64_t(totalweight) / uint64_t(totaldata);
if (m_huffnode[curcode].m_weight == 0)
m_huffnode[curcode].m_weight = 1;
}
@@ -613,7 +613,7 @@ int huffman_context_base::build_tree(UINT32 totaldata, UINT32 totalweight)
huffman_error huffman_context_base::assign_canonical_codes()
{
// build up a histogram of bit lengths
- UINT32 bithisto[33] = { 0 };
+ uint32_t bithisto[33] = { 0 };
for (int curcode = 0; curcode < m_numcodes; curcode++)
{
node_t &node = m_huffnode[curcode];
@@ -624,10 +624,10 @@ huffman_error huffman_context_base::assign_canonical_codes()
}
// for each code length, determine the starting code number
- UINT32 curstart = 0;
+ uint32_t curstart = 0;
for (int codelen = 32; codelen > 0; codelen--)
{
- UINT32 nextstart = (curstart + bithisto[codelen]) >> 1;
+ uint32_t nextstart = (curstart + bithisto[codelen]) >> 1;
if (codelen != 1 && nextstart * 2 != (curstart + bithisto[codelen]))
return HUFFERR_INTERNAL_INCONSISTENCY;
bithisto[codelen] = curstart;
@@ -691,11 +691,11 @@ huffman_8bit_encoder::huffman_8bit_encoder()
// encode - encode a full buffer
//-------------------------------------------------
-huffman_error huffman_8bit_encoder::encode(const UINT8 *source, UINT32 slength, UINT8 *dest, UINT32 dlength, UINT32 &complength)
+huffman_error huffman_8bit_encoder::encode(const uint8_t *source, uint32_t slength, uint8_t *dest, uint32_t dlength, uint32_t &complength)
{
// first compute the histogram
histo_reset();
- for (UINT32 cur = 0; cur < slength; cur++)
+ for (uint32_t cur = 0; cur < slength; cur++)
histo_one(source[cur]);
// then compute the tree
@@ -710,7 +710,7 @@ huffman_error huffman_8bit_encoder::encode(const UINT8 *source, UINT32 slength,
return err;
// then encode the data
- for (UINT32 cur = 0; cur < slength; cur++)
+ for (uint32_t cur = 0; cur < slength; cur++)
encode_one(bitbuf, source[cur]);
complength = bitbuf.flush();
return bitbuf.overflow() ? HUFFERR_OUTPUT_BUFFER_TOO_SMALL : HUFFERR_NONE;
@@ -731,7 +731,7 @@ huffman_8bit_decoder::huffman_8bit_decoder()
}
/**
- * @fn huffman_error huffman_8bit_decoder::decode(const UINT8 *source, UINT32 slength, UINT8 *dest, UINT32 dlength)
+ * @fn huffman_error huffman_8bit_decoder::decode(const uint8_t *source, uint32_t slength, uint8_t *dest, uint32_t dlength)
*
* @brief -------------------------------------------------
* decode - decode a full buffer
@@ -745,7 +745,7 @@ huffman_8bit_decoder::huffman_8bit_decoder()
* @return A huffman_error.
*/
-huffman_error huffman_8bit_decoder::decode(const UINT8 *source, UINT32 slength, UINT8 *dest, UINT32 dlength)
+huffman_error huffman_8bit_decoder::decode(const uint8_t *source, uint32_t slength, uint8_t *dest, uint32_t dlength)
{
// first import the tree
bitstream_in bitbuf(source, slength);
@@ -754,7 +754,7 @@ huffman_error huffman_8bit_decoder::decode(const UINT8 *source, UINT32 slength,
return err;
// then decode the data
- for (UINT32 cur = 0; cur < dlength; cur++)
+ for (uint32_t cur = 0; cur < dlength; cur++)
dest[cur] = decode_one(bitbuf);
bitbuf.flush();
return bitbuf.overflow() ? HUFFERR_INPUT_BUFFER_TOO_SMALL : HUFFERR_NONE;
diff --git a/src/lib/util/huffman.h b/src/lib/util/huffman.h
index a2bed42bbf9..2814eb127dd 100644
--- a/src/lib/util/huffman.h
+++ b/src/lib/util/huffman.h
@@ -44,20 +44,20 @@ enum huffman_error
class huffman_context_base
{
protected:
- typedef UINT16 lookup_value;
+ typedef uint16_t lookup_value;
// a node in the huffman tree
struct node_t
{
node_t * m_parent; // pointer to parent node
- UINT32 m_count; // number of hits on this node
- UINT32 m_weight; // assigned weight of this node
- UINT32 m_bits; // bits used to encode the node
- UINT8 m_numbits; // number of bits needed for this node
+ uint32_t m_count; // number of hits on this node
+ uint32_t m_weight; // assigned weight of this node
+ uint32_t m_bits; // bits used to encode the node
+ uint8_t m_numbits; // number of bits needed for this node
};
// construction/destruction
- huffman_context_base(int numcodes, int maxbits, lookup_value *lookup, UINT32 *histo, node_t *nodes);
+ huffman_context_base(int numcodes, int maxbits, lookup_value *lookup, uint32_t *histo, node_t *nodes);
// tree creation
huffman_error compute_tree_from_histo();
@@ -73,18 +73,18 @@ protected:
// internal helpers
void write_rle_tree_bits(bitstream_out &bitbuf, int value, int repcount, int numbits);
static int CLIB_DECL tree_node_compare(const void *item1, const void *item2);
- int build_tree(UINT32 totaldata, UINT32 totalweight);
+ int build_tree(uint32_t totaldata, uint32_t totalweight);
huffman_error assign_canonical_codes();
void build_lookup_table();
protected:
// internal state
- UINT32 m_numcodes; // number of total codes being processed
- UINT8 m_maxbits; // maximum bits per code
- UINT8 m_prevdata; // value of the previous data (for delta-RLE encoding)
+ uint32_t m_numcodes; // number of total codes being processed
+ uint8_t m_maxbits; // maximum bits per code
+ uint8_t m_prevdata; // value of the previous data (for delta-RLE encoding)
int m_rleremaining; // number of RLE bytes remaining (for delta-RLE encoding)
lookup_value * m_lookup; // pointer to the lookup table
- UINT32 * m_datahisto; // histogram of data values
+ uint32_t * m_datahisto; // histogram of data values
node_t * m_huffnode; // array of nodes
};
@@ -102,8 +102,8 @@ public:
// single item operations
void histo_reset() { memset(m_datahisto_array, 0, sizeof(m_datahisto_array)); }
- void histo_one(UINT32 data);
- void encode_one(bitstream_out &bitbuf, UINT32 data);
+ void histo_one(uint32_t data);
+ void encode_one(bitstream_out &bitbuf, uint32_t data);
// expose tree computation and export
using huffman_context_base::compute_tree_from_histo;
@@ -112,7 +112,7 @@ public:
private:
// array versions of the info we need
- UINT32 m_datahisto_array[_NumCodes];
+ uint32_t m_datahisto_array[_NumCodes];
node_t m_huffnode_array[_NumCodes * 2];
};
@@ -129,7 +129,7 @@ public:
: huffman_context_base(_NumCodes, _MaxBits, m_lookup_array, nullptr, m_huffnode_array) { }
// single item operations
- UINT32 decode_one(bitstream_in &bitbuf);
+ uint32_t decode_one(bitstream_in &bitbuf);
// expose tree import
using huffman_context_base::import_tree_rle;
@@ -152,7 +152,7 @@ public:
huffman_8bit_encoder();
// operations
- huffman_error encode(const UINT8 *source, UINT32 slength, UINT8 *dest, UINT32 destlength, UINT32 &complength);
+ huffman_error encode(const uint8_t *source, uint32_t slength, uint8_t *dest, uint32_t destlength, uint32_t &complength);
};
@@ -166,7 +166,7 @@ public:
huffman_8bit_decoder();
// operations
- huffman_error decode(const UINT8 *source, UINT32 slength, UINT8 *dest, UINT32 destlength);
+ huffman_error decode(const uint8_t *source, uint32_t slength, uint8_t *dest, uint32_t destlength);
};
@@ -180,7 +180,7 @@ public:
//-------------------------------------------------
template<int _NumCodes, int _MaxBits>
-inline void huffman_encoder<_NumCodes, _MaxBits>::histo_one(UINT32 data)
+inline void huffman_encoder<_NumCodes, _MaxBits>::histo_one(uint32_t data)
{
m_datahisto[data]++;
}
@@ -192,7 +192,7 @@ inline void huffman_encoder<_NumCodes, _MaxBits>::histo_one(UINT32 data)
//-------------------------------------------------
template<int _NumCodes, int _MaxBits>
-inline void huffman_encoder<_NumCodes, _MaxBits>::encode_one(bitstream_out &bitbuf, UINT32 data)
+inline void huffman_encoder<_NumCodes, _MaxBits>::encode_one(bitstream_out &bitbuf, uint32_t data)
{
// write the data
node_t &node = m_huffnode[data];
@@ -206,10 +206,10 @@ inline void huffman_encoder<_NumCodes, _MaxBits>::encode_one(bitstream_out &bitb
//-------------------------------------------------
template<int _NumCodes, int _MaxBits>
-inline UINT32 huffman_decoder<_NumCodes, _MaxBits>::decode_one(bitstream_in &bitbuf)
+inline uint32_t huffman_decoder<_NumCodes, _MaxBits>::decode_one(bitstream_in &bitbuf)
{
// peek ahead to get maxbits worth of data
- UINT32 bits = bitbuf.peek(m_maxbits);
+ uint32_t bits = bitbuf.peek(m_maxbits);
// look it up, then remove the actual number of bits for this code
lookup_value lookup = m_lookup[bits];
diff --git a/src/lib/util/jedparse.cpp b/src/lib/util/jedparse.cpp
index 9bed1164303..c2c9a139a6a 100644
--- a/src/lib/util/jedparse.cpp
+++ b/src/lib/util/jedparse.cpp
@@ -38,8 +38,8 @@
struct jed_parse_info
{
- UINT16 checksum; /* checksum value */
- UINT32 explicit_numfuses; /* explicitly specified number of fuses */
+ uint16_t checksum; /* checksum value */
+ uint32_t explicit_numfuses; /* explicitly specified number of fuses */
};
@@ -86,10 +86,10 @@ static int isdelim(char c)
character stream
-------------------------------------------------*/
-static UINT32 suck_number(const UINT8 **psrc)
+static uint32_t suck_number(const uint8_t **psrc)
{
- const UINT8 *src = *psrc;
- UINT32 value = 0;
+ const uint8_t *src = *psrc;
+ uint32_t value = 0;
/* skip delimiters */
while (isdelim(*src))
@@ -117,7 +117,7 @@ static UINT32 suck_number(const UINT8 **psrc)
process_field - process a single JEDEC field
-------------------------------------------------*/
-static void process_field(jed_data *data, const UINT8 *cursrc, const UINT8 *srcend, jed_parse_info *pinfo)
+static void process_field(jed_data *data, const uint8_t *cursrc, const uint8_t *srcend, jed_parse_info *pinfo)
{
/* switch off of the field type */
switch (*cursrc)
@@ -147,7 +147,7 @@ static void process_field(jed_data *data, const UINT8 *cursrc, const UINT8 *srce
/* fuse states */
case 'L':
{
- UINT32 curfuse;
+ uint32_t curfuse;
/* read the fuse number */
cursrc++;
@@ -189,11 +189,11 @@ static void process_field(jed_data *data, const UINT8 *cursrc, const UINT8 *srce
int jed_parse(const void *data, size_t length, jed_data *result)
{
- const UINT8 *cursrc = (const UINT8 *)data;
- const UINT8 *srcend = cursrc + length;
- const UINT8 *scan;
+ const uint8_t *cursrc = (const uint8_t *)data;
+ const uint8_t *srcend = cursrc + length;
+ const uint8_t *scan;
jed_parse_info pinfo;
- UINT16 checksum;
+ uint16_t checksum;
int i;
/* initialize the output and the intermediate info struct */
@@ -218,7 +218,7 @@ int jed_parse(const void *data, size_t length, jed_data *result)
checksum += *scan;
if (scan + 4 < srcend && ishex(scan[1]) && ishex(scan[2]) && ishex(scan[3]) && ishex(scan[4]))
{
- UINT16 dessum = (hexval(scan[1]) << 12) | (hexval(scan[2]) << 8) | (hexval(scan[3]) << 4) | hexval(scan[4] << 0);
+ uint16_t dessum = (hexval(scan[1]) << 12) | (hexval(scan[2]) << 8) | (hexval(scan[3]) << 4) | hexval(scan[4] << 0);
if (dessum != 0 && dessum != checksum)
return JEDERR_BAD_XMIT_SUM;
}
@@ -283,13 +283,13 @@ int jed_parse(const void *data, size_t length, jed_data *result)
size_t jed_output(const jed_data *data, void *result, size_t length)
{
- UINT8 *curdst = (UINT8 *)result;
- UINT8 *dstend = curdst + length;
+ uint8_t *curdst = (uint8_t *)result;
+ uint8_t *dstend = curdst + length;
int i, zeros, ones;
char tempbuf[256];
- UINT16 checksum;
- UINT8 defbyte;
- UINT8 *temp;
+ uint16_t checksum;
+ uint8_t defbyte;
+ uint8_t *temp;
/* always start the DST with a standard header and an STX */
tempbuf[0] = 0x02;
@@ -355,7 +355,7 @@ size_t jed_output(const jed_data *data, void *result, size_t length)
/* now compute the transmission checksum */
checksum = 0;
- for (temp = (UINT8 *)result; temp < curdst && temp < dstend; temp++)
+ for (temp = (uint8_t *)result; temp < curdst && temp < dstend; temp++)
checksum += *temp & 0x7f;
checksum += 0x03;
@@ -367,7 +367,7 @@ size_t jed_output(const jed_data *data, void *result, size_t length)
curdst += strlen(tempbuf);
/* return the final size */
- return curdst - (UINT8 *)result;
+ return curdst - (uint8_t *)result;
}
@@ -379,7 +379,7 @@ size_t jed_output(const jed_data *data, void *result, size_t length)
int jedbin_parse(const void *data, size_t length, jed_data *result)
{
- const UINT8 *cursrc = (const UINT8 *)data;
+ const uint8_t *cursrc = (const uint8_t *)data;
/* initialize the output */
memset(result, 0, sizeof(*result));
@@ -424,7 +424,7 @@ int jedbin_parse(const void *data, size_t length, jed_data *result)
size_t jedbin_output(const jed_data *data, void *result, size_t length)
{
- UINT8 *curdst = (UINT8 *)result;
+ uint8_t *curdst = (uint8_t *)result;
/* ensure we have enough room */
if (length >= 4 + (data->numfuses + 7) / 8)
diff --git a/src/lib/util/jedparse.h b/src/lib/util/jedparse.h
index 0f23462b995..e2eca46b236 100644
--- a/src/lib/util/jedparse.h
+++ b/src/lib/util/jedparse.h
@@ -35,8 +35,8 @@
struct jed_data
{
- UINT32 numfuses; /* number of defined fuses */
- UINT8 fusemap[JED_MAX_FUSES / 8];/* array of bit-packed data */
+ uint32_t numfuses; /* number of defined fuses */
+ uint8_t fusemap[JED_MAX_FUSES / 8];/* array of bit-packed data */
};
@@ -63,7 +63,7 @@ size_t jedbin_output(const jed_data *data, void *result, size_t length);
INLINE FUNCTIONS
***************************************************************************/
-static inline int jed_get_fuse(const jed_data *data, UINT32 fusenum)
+static inline int jed_get_fuse(const jed_data *data, uint32_t fusenum)
{
if (fusenum < JED_MAX_FUSES)
return (data->fusemap[fusenum / 8] >> (fusenum % 8)) & 1;
@@ -72,7 +72,7 @@ static inline int jed_get_fuse(const jed_data *data, UINT32 fusenum)
}
-static inline void jed_set_fuse(jed_data *data, UINT32 fusenum, UINT8 value)
+static inline void jed_set_fuse(jed_data *data, uint32_t fusenum, uint8_t value)
{
if (fusenum < JED_MAX_FUSES)
{
diff --git a/src/lib/util/options.cpp b/src/lib/util/options.cpp
index f799ad06c97..7e40ab736de 100644
--- a/src/lib/util/options.cpp
+++ b/src/lib/util/options.cpp
@@ -53,7 +53,7 @@ const char *const core_options::s_option_unadorned[MAX_UNADORNED_OPTIONS] =
// entry - constructor
//-------------------------------------------------
-core_options::entry::entry(const char *name, const char *description, UINT32 flags, const char *defvalue)
+core_options::entry::entry(const char *name, const char *description, uint32_t flags, const char *defvalue)
: m_next(nullptr),
m_flags(flags),
m_seqid(0),
@@ -139,7 +139,7 @@ void core_options::entry::set_description(const char *description)
}
-void core_options::entry::set_flag(UINT32 mask, UINT32 flag)
+void core_options::entry::set_flag(uint32_t mask, uint32_t flag)
{
m_flags = ( m_flags & mask ) | flag;
}
@@ -254,7 +254,7 @@ bool core_options::operator!=(const core_options &rhs)
// options set
//-------------------------------------------------
-void core_options::add_entry(const char *name, const char *description, UINT32 flags, const char *defvalue, bool override_existing)
+void core_options::add_entry(const char *name, const char *description, uint32_t flags, const char *defvalue, bool override_existing)
{
// allocate a new entry
auto newentry = global_alloc(entry(name, description, flags, defvalue));
@@ -410,7 +410,7 @@ bool core_options::parse_ini_file(util::core_file &inifile, int priority, int ig
// find the extent of the name
char *optionname;
for (optionname = buffer; *optionname != 0; optionname++)
- if (!isspace((UINT8)*optionname))
+ if (!isspace((uint8_t)*optionname))
break;
// skip comments
@@ -420,7 +420,7 @@ bool core_options::parse_ini_file(util::core_file &inifile, int priority, int ig
// scan forward to find the first space
char *temp;
for (temp = optionname; *temp != 0; temp++)
- if (isspace((UINT8)*temp))
+ if (isspace((uint8_t)*temp))
break;
// if we hit the end early, print a warning and continue
@@ -601,7 +601,7 @@ int core_options::priority(const char *name) const
// seqid - return the seqid for a given option
//-------------------------------------------------
-UINT32 core_options::seqid(const char *name) const
+uint32_t core_options::seqid(const char *name) const
{
auto curentry = m_entrymap.find(name);
return (curentry != m_entrymap.end()) ? curentry->second->seqid() : 0;
@@ -655,7 +655,7 @@ bool core_options::set_value(const char *name, float value, int priority, std::s
}
-void core_options::set_flag(const char *name, UINT32 mask, UINT32 flag)
+void core_options::set_flag(const char *name, uint32_t mask, uint32_t flag)
{
// find the entry first
auto curentry = m_entrymap.find(name);
diff --git a/src/lib/util/options.h b/src/lib/util/options.h
index d25a29ef1db..c99b99d3f5b 100644
--- a/src/lib/util/options.h
+++ b/src/lib/util/options.h
@@ -21,7 +21,7 @@
//**************************************************************************
// option types
-const UINT32 OPTION_TYPE_MASK = 0x0007; // up to 8 different types
+const uint32_t OPTION_TYPE_MASK = 0x0007; // up to 8 different types
enum
{
OPTION_INVALID, // invalid
@@ -40,7 +40,7 @@ const int OPTION_PRIORITY_NORMAL = 100; // normal priority
const int OPTION_PRIORITY_HIGH = 150; // high priority
const int OPTION_PRIORITY_MAXIMUM = 255; // maximum priority
-const UINT32 OPTION_FLAG_INTERNAL = 0x40000000;
+const uint32_t OPTION_FLAG_INTERNAL = 0x40000000;
//**************************************************************************
@@ -52,7 +52,7 @@ struct options_entry
{
const char * name; // name on the command line
const char * defvalue; // default value of this argument
- UINT32 flags; // flags to describe the option
+ uint32_t flags; // flags to describe the option
const char * description; // description for -showusage
};
@@ -70,7 +70,7 @@ public:
friend class simple_list<entry>;
// construction/destruction
- entry(const char *name, const char *description, UINT32 flags = 0, const char *defvalue = nullptr);
+ entry(const char *name, const char *description, uint32_t flags = 0, const char *defvalue = nullptr);
public:
// getters
@@ -81,9 +81,9 @@ public:
const char *default_value() const { return m_defdata.c_str(); }
const char *minimum() const { return m_minimum.c_str(); }
const char *maximum() const { return m_maximum.c_str(); }
- UINT32 seqid() const { return m_seqid; }
+ uint32_t seqid() const { return m_seqid; }
int type() const { return (m_flags & OPTION_TYPE_MASK); }
- UINT32 flags() const { return m_flags; }
+ uint32_t flags() const { return m_flags; }
bool is_header() const { return type() == OPTION_HEADER; }
bool is_command() const { return type() == OPTION_COMMAND; }
bool is_internal() const { return (m_flags & OPTION_FLAG_INTERNAL)!=0; }
@@ -95,15 +95,15 @@ public:
void set_value(const char *newvalue, int priority);
void set_default_value(const char *defvalue);
void set_description(const char *description);
- void set_flag(UINT32 mask, UINT32 flag);
+ void set_flag(uint32_t mask, uint32_t flag);
void mark_changed() { m_changed = true; }
void revert(int priority_hi, int priority_lo);
private:
// internal state
entry * m_next; // link to the next data
- UINT32 m_flags; // flags from the entry
- UINT32 m_seqid; // sequence ID; bumped on each change
+ uint32_t m_flags; // flags from the entry
+ uint32_t m_seqid; // sequence ID; bumped on each change
bool m_error_reported; // have we reported an error on this option yet?
int m_priority; // priority of the data set
const char * m_description; // description for this item
@@ -139,7 +139,7 @@ public:
auto_iterator end() const { return m_entrylist.end(); }
// configuration
- void add_entry(const char *name, const char *description, UINT32 flags = 0, const char *defvalue = nullptr, bool override_existing = false);
+ void add_entry(const char *name, const char *description, uint32_t flags = 0, const char *defvalue = nullptr, bool override_existing = false);
void add_entry(const options_entry &data, bool override_existing = false) { add_entry(data.name, data.description, data.flags, data.defvalue, override_existing); }
void add_entries(const options_entry *entrylist, bool override_existing = false);
void set_default_value(const char *name, const char *defvalue);
@@ -164,7 +164,7 @@ public:
bool bool_value(const char *name) const { return (atoi(value(name)) != 0); }
int int_value(const char *name) const { return atoi(value(name)); }
float float_value(const char *name) const { return atof(value(name)); }
- UINT32 seqid(const char *name) const;
+ uint32_t seqid(const char *name) const;
bool exists(const char *name) const;
bool is_changed(const char *name) const;
@@ -172,7 +172,7 @@ public:
bool set_value(const char *name, const char *value, int priority, std::string &error_string);
bool set_value(const char *name, int value, int priority, std::string &error_string);
bool set_value(const char *name, float value, int priority, std::string &error_string);
- void set_flag(const char *name, UINT32 mask, UINT32 flags);
+ void set_flag(const char *name, uint32_t mask, uint32_t flags);
void mark_changed(const char *name);
// misc
diff --git a/src/lib/util/palette.cpp b/src/lib/util/palette.cpp
index 196031d3694..c6a9e07d9d6 100644
--- a/src/lib/util/palette.cpp
+++ b/src/lib/util/palette.cpp
@@ -38,7 +38,7 @@ const rgb_t rgb_t::amber(247, 170, 0);
// entry for brightness
//-------------------------------------------------
-inline rgb_t palette_t::adjust_palette_entry(rgb_t entry, float brightness, float contrast, const UINT8 *gamma_map)
+inline rgb_t palette_t::adjust_palette_entry(rgb_t entry, float brightness, float contrast, const uint8_t *gamma_map)
{
int r = rgb_t::clamp(float(gamma_map[entry.r()]) * contrast + brightness);
int g = rgb_t::clamp(float(gamma_map[entry.g()]) * contrast + brightness);
@@ -69,7 +69,7 @@ palette_client::dirty_state::dirty_state()
// min/max values
//-------------------------------------------------
-const UINT32 *palette_client::dirty_state::dirty_list(UINT32 &mindirty, UINT32 &maxdirty)
+const uint32_t *palette_client::dirty_state::dirty_list(uint32_t &mindirty, uint32_t &maxdirty)
{
// fill in the mindirty/maxdirty
mindirty = m_mindirty;
@@ -85,10 +85,10 @@ const UINT32 *palette_client::dirty_state::dirty_list(UINT32 &mindirty, UINT32 &
// dirty
//-------------------------------------------------
-void palette_client::dirty_state::resize(UINT32 colors)
+void palette_client::dirty_state::resize(uint32_t colors)
{
// resize to the correct number of dwords and mark all entries dirty
- UINT32 dirty_dwords = (colors + 31) / 32;
+ uint32_t dirty_dwords = (colors + 31) / 32;
m_dirty.resize(dirty_dwords);
memset(&m_dirty[0], 0xff, dirty_dwords*4);
@@ -105,7 +105,7 @@ void palette_client::dirty_state::resize(UINT32 colors)
// mark_dirty - mark a single entry dirty
//-------------------------------------------------
-void palette_client::dirty_state::mark_dirty(UINT32 index)
+void palette_client::dirty_state::mark_dirty(uint32_t index)
{
m_dirty[index / 32] |= 1 << (index % 32);
m_mindirty = std::min(m_mindirty, index);
@@ -121,7 +121,7 @@ void palette_client::dirty_state::mark_dirty(UINT32 index)
void palette_client::dirty_state::reset()
{
// erase relevant entries in the new live one
- memset(&m_dirty[m_mindirty / 32], 0, ((m_maxdirty / 32) + 1 - (m_mindirty / 32)) * sizeof(UINT32));
+ memset(&m_dirty[m_mindirty / 32], 0, ((m_maxdirty / 32) + 1 - (m_mindirty / 32)) * sizeof(uint32_t));
m_mindirty = m_dirty.size() * 32 - 1;
m_maxdirty = 0;
}
@@ -146,7 +146,7 @@ palette_client::palette_client(palette_t &palette)
palette.ref();
// resize the dirty lists
- UINT32 total_colors = palette.num_colors() * palette.num_groups();
+ uint32_t total_colors = palette.num_colors() * palette.num_groups();
m_dirty[0].resize(total_colors);
m_dirty[1].resize(total_colors);
@@ -180,10 +180,10 @@ palette_client::~palette_client()
// list for a client
//-------------------------------------------------
-const UINT32 *palette_client::dirty_list(UINT32 &mindirty, UINT32 &maxdirty)
+const uint32_t *palette_client::dirty_list(uint32_t &mindirty, uint32_t &maxdirty)
{
// if nothing to report, report nothing and don't swap
- const UINT32 *result = m_live->dirty_list(mindirty, maxdirty);
+ const uint32_t *result = m_live->dirty_list(mindirty, maxdirty);
if (result == nullptr)
return nullptr;
@@ -207,7 +207,7 @@ const UINT32 *palette_client::dirty_list(UINT32 &mindirty, UINT32 &maxdirty)
// alloc - static allocator
//-------------------------------------------------
-palette_t *palette_t::alloc(UINT32 numcolors, UINT32 numgroups)
+palette_t *palette_t::alloc(uint32_t numcolors, uint32_t numgroups)
{
return new palette_t(numcolors, numgroups);
}
@@ -217,7 +217,7 @@ palette_t *palette_t::alloc(UINT32 numcolors, UINT32 numgroups)
// palette_t - constructor
//-------------------------------------------------
-palette_t::palette_t(UINT32 numcolors, UINT32 numgroups)
+palette_t::palette_t(uint32_t numcolors, uint32_t numgroups)
: m_refcount(1),
m_numcolors(numcolors),
m_numgroups(numgroups),
@@ -233,25 +233,25 @@ palette_t::palette_t(UINT32 numcolors, UINT32 numgroups)
m_client_list(nullptr)
{
// initialize gamma map
- for (UINT32 index = 0; index < 256; index++)
+ for (uint32_t index = 0; index < 256; index++)
m_gamma_map[index] = index;
// initialize the per-entry data
- for (UINT32 index = 0; index < numcolors; index++)
+ for (uint32_t index = 0; index < numcolors; index++)
{
m_entry_color[index] = rgb_t::black;
m_entry_contrast[index] = 1.0f;
}
// initialize the per-group data
- for (UINT32 index = 0; index < numgroups; index++)
+ for (uint32_t index = 0; index < numgroups; index++)
{
m_group_bright[index] = 0.0f;
m_group_contrast[index] = 1.0f;
}
// initialize the expanded data
- for (UINT32 index = 0; index < numcolors * numgroups; index++)
+ for (uint32_t index = 0; index < numcolors * numgroups; index++)
{
m_adjusted_color[index] = rgb_t::black;
m_adjusted_rgb15[index] = rgb_t::black.as_rgb15();
@@ -359,7 +359,7 @@ void palette_t::set_gamma(float gamma)
// given palette index
//-------------------------------------------------
-void palette_t::entry_set_color(UINT32 index, rgb_t rgb)
+void palette_t::entry_set_color(uint32_t index, rgb_t rgb)
{
// if out of range, or unchanged, ignore
if (index >= m_numcolors || m_entry_color[index] == rgb)
@@ -379,7 +379,7 @@ void palette_t::entry_set_color(UINT32 index, rgb_t rgb)
// given palette index
//-------------------------------------------------
-void palette_t::entry_set_red_level(UINT32 index, UINT8 level)
+void palette_t::entry_set_red_level(uint32_t index, uint8_t level)
{
// if out of range, or unchanged, ignore
if (index >= m_numcolors || m_entry_color[index].r() == level)
@@ -399,7 +399,7 @@ void palette_t::entry_set_red_level(UINT32 index, UINT8 level)
// given palette index
//-------------------------------------------------
-void palette_t::entry_set_green_level(UINT32 index, UINT8 level)
+void palette_t::entry_set_green_level(uint32_t index, uint8_t level)
{
// if out of range, or unchanged, ignore
if (index >= m_numcolors || m_entry_color[index].g() == level)
@@ -419,7 +419,7 @@ void palette_t::entry_set_green_level(UINT32 index, UINT8 level)
// given palette index
//-------------------------------------------------
-void palette_t::entry_set_blue_level(UINT32 index, UINT8 level)
+void palette_t::entry_set_blue_level(uint32_t index, uint8_t level)
{
// if out of range, or unchanged, ignore
if (index >= m_numcolors || m_entry_color[index].b() == level)
@@ -439,7 +439,7 @@ void palette_t::entry_set_blue_level(UINT32 index, UINT8 level)
// adjustment for a single palette index
//-------------------------------------------------
-void palette_t::entry_set_contrast(UINT32 index, float contrast)
+void palette_t::entry_set_contrast(uint32_t index, float contrast)
{
// if out of range, or unchanged, ignore
if (index >= m_numcolors || m_entry_contrast[index] == contrast)
@@ -459,7 +459,7 @@ void palette_t::entry_set_contrast(UINT32 index, float contrast)
// brightness for a palette group
//-------------------------------------------------
-void palette_t::group_set_brightness(UINT32 group, float brightness)
+void palette_t::group_set_brightness(uint32_t group, float brightness)
{
// convert incoming value to normalized result
brightness = (brightness - 1.0f) * 256.0f;
@@ -482,7 +482,7 @@ void palette_t::group_set_brightness(UINT32 group, float brightness)
// contrast for a palette group
//-------------------------------------------------
-void palette_t::group_set_contrast(UINT32 group, float contrast)
+void palette_t::group_set_contrast(uint32_t group, float contrast)
{
// if out of range, or unchanged, ignore
if (group >= m_numgroups || m_group_contrast[group] == contrast)
@@ -502,43 +502,43 @@ void palette_t::group_set_contrast(UINT32 group, float contrast)
// entries
//-------------------------------------------------
-void palette_t::normalize_range(UINT32 start, UINT32 end, int lum_min, int lum_max)
+void palette_t::normalize_range(uint32_t start, uint32_t end, int lum_min, int lum_max)
{
// clamp within range
start = std::max(start, 0U);
end = std::min(end, m_numcolors - 1);
// find the minimum and maximum brightness of all the colors in the range
- INT32 ymin = 1000 * 255, ymax = 0;
- for (UINT32 index = start; index <= end; index++)
+ int32_t ymin = 1000 * 255, ymax = 0;
+ for (uint32_t index = start; index <= end; index++)
{
rgb_t rgb = m_entry_color[index];
- UINT32 y = 299 * rgb.r() + 587 * rgb.g() + 114 * rgb.b();
- ymin = (std::min<UINT32>)(ymin, y);
- ymax = (std::max<UINT32>)(ymax, y);
+ uint32_t y = 299 * rgb.r() + 587 * rgb.g() + 114 * rgb.b();
+ ymin = (std::min<uint32_t>)(ymin, y);
+ ymax = (std::max<uint32_t>)(ymax, y);
}
// determine target minimum/maximum
- INT32 tmin = (lum_min < 0) ? ((ymin + 500) / 1000) : lum_min;
- INT32 tmax = (lum_max < 0) ? ((ymax + 500) / 1000) : lum_max;
+ int32_t tmin = (lum_min < 0) ? ((ymin + 500) / 1000) : lum_min;
+ int32_t tmax = (lum_max < 0) ? ((ymax + 500) / 1000) : lum_max;
// now normalize the palette
- for (UINT32 index = start; index <= end; index++)
+ for (uint32_t index = start; index <= end; index++)
{
rgb_t rgb = m_entry_color[index];
- INT32 y = 299 * rgb.r() + 587 * rgb.g() + 114 * rgb.b();
- INT32 u = ((INT32)rgb.b()-y /1000)*492 / 1000;
- INT32 v = ((INT32)rgb.r()-y / 1000)*877 / 1000;
- INT32 target = tmin + ((y - ymin) * (tmax - tmin + 1)) / (ymax - ymin);
- UINT8 r = rgb_t::clamp(target + 1140 * v / 1000);
- UINT8 g = rgb_t::clamp(target - 395 * u / 1000 - 581 * v / 1000);
- UINT8 b = rgb_t::clamp(target + 2032 * u / 1000);
+ int32_t y = 299 * rgb.r() + 587 * rgb.g() + 114 * rgb.b();
+ int32_t u = ((int32_t)rgb.b()-y /1000)*492 / 1000;
+ int32_t v = ((int32_t)rgb.r()-y / 1000)*877 / 1000;
+ int32_t target = tmin + ((y - ymin) * (tmax - tmin + 1)) / (ymax - ymin);
+ uint8_t r = rgb_t::clamp(target + 1140 * v / 1000);
+ uint8_t g = rgb_t::clamp(target - 395 * u / 1000 - 581 * v / 1000);
+ uint8_t b = rgb_t::clamp(target + 2032 * u / 1000);
entry_set_color(index, rgb_t(r, g, b));
}
}
/**
- * @fn void palette_t::update_adjusted_color(UINT32 group, UINT32 index)
+ * @fn void palette_t::update_adjusted_color(uint32_t group, uint32_t index)
*
* @brief -------------------------------------------------
* update_adjusted_color - update a color index by group and index pair
@@ -548,7 +548,7 @@ void palette_t::normalize_range(UINT32 start, UINT32 end, int lum_min, int lum_m
* @param index Zero-based index of the.
*/
-void palette_t::update_adjusted_color(UINT32 group, UINT32 index)
+void palette_t::update_adjusted_color(uint32_t group, uint32_t index)
{
// compute the adjusted value
rgb_t adjusted = adjust_palette_entry(m_entry_color[index],
@@ -557,7 +557,7 @@ void palette_t::update_adjusted_color(UINT32 group, UINT32 index)
m_gamma_map);
// if not different, ignore
- UINT32 finalindex = group * m_numcolors + index;
+ uint32_t finalindex = group * m_numcolors + index;
if (m_adjusted_color[finalindex] == adjusted)
return;
diff --git a/src/lib/util/palette.h b/src/lib/util/palette.h
index a7054a93501..bfc591d7b2a 100644
--- a/src/lib/util/palette.h
+++ b/src/lib/util/palette.h
@@ -25,7 +25,7 @@
class palette_t;
// an rgb15_t is a single combined 15-bit R,G,B value
-typedef UINT16 rgb15_t;
+typedef uint16_t rgb15_t;
// ======================> rgb_t
@@ -36,33 +36,33 @@ class rgb_t
public:
// construction/destruction
rgb_t(): m_data(0) { }
- rgb_t(UINT32 data) { m_data = data; }
- rgb_t(UINT8 r, UINT8 g, UINT8 b) { m_data = (255 << 24) | (r << 16) | (g << 8) | b; }
- rgb_t(UINT8 a, UINT8 r, UINT8 g, UINT8 b) { m_data = (a << 24) | (r << 16) | (g << 8) | b; }
+ rgb_t(uint32_t data) { m_data = data; }
+ rgb_t(uint8_t r, uint8_t g, uint8_t b) { m_data = (255 << 24) | (r << 16) | (g << 8) | b; }
+ rgb_t(uint8_t a, uint8_t r, uint8_t g, uint8_t b) { m_data = (a << 24) | (r << 16) | (g << 8) | b; }
// getters
- UINT8 a() const { return m_data >> 24; }
- UINT8 r() const { return m_data >> 16; }
- UINT8 g() const { return m_data >> 8; }
- UINT8 b() const { return m_data >> 0; }
+ uint8_t a() const { return m_data >> 24; }
+ uint8_t r() const { return m_data >> 16; }
+ uint8_t g() const { return m_data >> 8; }
+ uint8_t b() const { return m_data >> 0; }
rgb15_t as_rgb15() const { return ((r() >> 3) << 10) | ((g() >> 3) << 5) | ((b() >> 3) << 0); }
- UINT8 brightness() const { return (r() * 222 + g() * 707 + b() * 71) / 1000; }
- UINT32 const *ptr() const { return &m_data; }
+ uint8_t brightness() const { return (r() * 222 + g() * 707 + b() * 71) / 1000; }
+ uint32_t const *ptr() const { return &m_data; }
// setters
- rgb_t &set_a(UINT8 a) { m_data &= ~0xff000000; m_data |= a << 24; return *this; }
- rgb_t &set_r(UINT8 r) { m_data &= ~0x00ff0000; m_data |= r << 16; return *this; }
- rgb_t &set_g(UINT8 g) { m_data &= ~0x0000ff00; m_data |= g << 8; return *this; }
- rgb_t &set_b(UINT8 b) { m_data &= ~0x000000ff; m_data |= b << 0; return *this; }
+ rgb_t &set_a(uint8_t a) { m_data &= ~0xff000000; m_data |= a << 24; return *this; }
+ rgb_t &set_r(uint8_t r) { m_data &= ~0x00ff0000; m_data |= r << 16; return *this; }
+ rgb_t &set_g(uint8_t g) { m_data &= ~0x0000ff00; m_data |= g << 8; return *this; }
+ rgb_t &set_b(uint8_t b) { m_data &= ~0x000000ff; m_data |= b << 0; return *this; }
// implicit conversion operators
- operator UINT32() const { return m_data; }
+ operator uint32_t() const { return m_data; }
// operations
- rgb_t &scale8(UINT8 scale) { m_data = rgb_t(clamphi((a() * scale) >> 8), clamphi((r() * scale) >> 8), clamphi((g() * scale) >> 8), clamphi((b() * scale) >> 8)); return *this; }
+ rgb_t &scale8(uint8_t scale) { m_data = rgb_t(clamphi((a() * scale) >> 8), clamphi((r() * scale) >> 8), clamphi((g() * scale) >> 8), clamphi((b() * scale) >> 8)); return *this; }
// assignment operators
- rgb_t &operator=(UINT32 rhs) { m_data = rhs; return *this; }
+ rgb_t &operator=(uint32_t rhs) { m_data = rhs; return *this; }
rgb_t &operator+=(const rgb_t &rhs) { m_data = rgb_t(clamphi(a() + rhs.a()), clamphi(r() + rhs.r()), clamphi(g() + rhs.g()), clamphi(b() + rhs.b())); return *this; }
rgb_t &operator-=(const rgb_t &rhs) { m_data = rgb_t(clamplo(a() - rhs.a()), clamplo(r() - rhs.r()), clamplo(g() - rhs.g()), clamplo(b() - rhs.b())); return *this; }
@@ -71,9 +71,9 @@ public:
rgb_t operator-(const rgb_t &rhs) const { rgb_t result = *this; result -= rhs; return result; }
// static helpers
- static UINT8 clamp(INT32 value) { return (value < 0) ? 0 : (value > 255) ? 255 : value; }
- static UINT8 clamphi(INT32 value) { return (value > 255) ? 255 : value; }
- static UINT8 clamplo(INT32 value) { return (value < 0) ? 0 : value; }
+ static uint8_t clamp(int32_t value) { return (value < 0) ? 0 : (value > 255) ? 255 : value; }
+ static uint8_t clamphi(int32_t value) { return (value > 255) ? 255 : value; }
+ static uint8_t clamplo(int32_t value) { return (value < 0) ? 0 : value; }
// constants
static const rgb_t black;
@@ -83,7 +83,7 @@ public:
static const rgb_t transparent;
private:
- UINT32 m_data;
+ uint32_t m_data;
};
@@ -100,10 +100,10 @@ public:
// getters
palette_client *next() const { return m_next; }
palette_t &palette() const { return m_palette; }
- const UINT32 *dirty_list(UINT32 &mindirty, UINT32 &maxdirty);
+ const uint32_t *dirty_list(uint32_t &mindirty, uint32_t &maxdirty);
// dirty marking
- void mark_dirty(UINT32 index) { m_live->mark_dirty(index); }
+ void mark_dirty(uint32_t index) { m_live->mark_dirty(index); }
private:
// internal object to track dirty states
@@ -114,16 +114,16 @@ private:
dirty_state();
// operations
- const UINT32 *dirty_list(UINT32 &mindirty, UINT32 &maxdirty);
- void resize(UINT32 colors);
- void mark_dirty(UINT32 index);
+ const uint32_t *dirty_list(uint32_t &mindirty, uint32_t &maxdirty);
+ void resize(uint32_t colors);
+ void mark_dirty(uint32_t index);
void reset();
private:
// internal state
- std::vector<UINT32> m_dirty; // bitmap of dirty entries
- UINT32 m_mindirty; // minimum dirty entry
- UINT32 m_maxdirty; // minimum dirty entry
+ std::vector<uint32_t> m_dirty; // bitmap of dirty entries
+ uint32_t m_mindirty; // minimum dirty entry
+ uint32_t m_maxdirty; // minimum dirty entry
};
// internal state
@@ -144,7 +144,7 @@ class palette_t
public:
// static constructor: used to ensure same new/delete is used
- static palette_t *alloc(UINT32 numcolors, UINT32 numgroups = 1);
+ static palette_t *alloc(uint32_t numcolors, uint32_t numgroups = 1);
// reference counting
void ref() { m_refcount++; }
@@ -154,8 +154,8 @@ public:
int num_colors() const { return m_numcolors; }
int num_groups() const { return m_numgroups; }
int max_index() const { return m_numcolors * m_numgroups + 2; }
- UINT32 black_entry() const { return m_numcolors * m_numgroups + 0; }
- UINT32 white_entry() const { return m_numcolors * m_numgroups + 1; }
+ uint32_t black_entry() const { return m_numcolors * m_numgroups + 0; }
+ uint32_t white_entry() const { return m_numcolors * m_numgroups + 1; }
// overall adjustments
void set_brightness(float brightness);
@@ -163,16 +163,16 @@ public:
void set_gamma(float gamma);
// entry getters
- rgb_t entry_color(UINT32 index) const { return (index < m_numcolors) ? m_entry_color[index] : rgb_t::black; }
- rgb_t entry_adjusted_color(UINT32 index) const { return (index < m_numcolors * m_numgroups) ? m_adjusted_color[index] : rgb_t::black; }
- float entry_contrast(UINT32 index) const { return (index < m_numcolors) ? m_entry_contrast[index] : 1.0f; }
+ rgb_t entry_color(uint32_t index) const { return (index < m_numcolors) ? m_entry_color[index] : rgb_t::black; }
+ rgb_t entry_adjusted_color(uint32_t index) const { return (index < m_numcolors * m_numgroups) ? m_adjusted_color[index] : rgb_t::black; }
+ float entry_contrast(uint32_t index) const { return (index < m_numcolors) ? m_entry_contrast[index] : 1.0f; }
// entry setters
- void entry_set_color(UINT32 index, rgb_t rgb);
- void entry_set_red_level(UINT32 index, UINT8 level);
- void entry_set_green_level(UINT32 index, UINT8 level);
- void entry_set_blue_level(UINT32 index, UINT8 level);
- void entry_set_contrast(UINT32 index, float contrast);
+ void entry_set_color(uint32_t index, rgb_t rgb);
+ void entry_set_red_level(uint32_t index, uint8_t level);
+ void entry_set_green_level(uint32_t index, uint8_t level);
+ void entry_set_blue_level(uint32_t index, uint8_t level);
+ void entry_set_contrast(uint32_t index, float contrast);
// entry list getters
const rgb_t *entry_list_raw() const { return &m_entry_color[0]; }
@@ -180,30 +180,30 @@ public:
const rgb_t *entry_list_adjusted_rgb15() const { return &m_adjusted_rgb15[0]; }
// group adjustments
- void group_set_brightness(UINT32 group, float brightness);
- void group_set_contrast(UINT32 group, float contrast);
+ void group_set_brightness(uint32_t group, float brightness);
+ void group_set_contrast(uint32_t group, float contrast);
// utilities
- void normalize_range(UINT32 start, UINT32 end, int lum_min = 0, int lum_max = 255);
+ void normalize_range(uint32_t start, uint32_t end, int lum_min = 0, int lum_max = 255);
private:
// construction/destruction
- palette_t(UINT32 numcolors, UINT32 numgroups = 1);
+ palette_t(uint32_t numcolors, uint32_t numgroups = 1);
~palette_t();
// internal helpers
- rgb_t adjust_palette_entry(rgb_t entry, float brightness, float contrast, const UINT8 *gamma_map);
- void update_adjusted_color(UINT32 group, UINT32 index);
+ rgb_t adjust_palette_entry(rgb_t entry, float brightness, float contrast, const uint8_t *gamma_map);
+ void update_adjusted_color(uint32_t group, uint32_t index);
// internal state
- UINT32 m_refcount; // reference count on the palette
- UINT32 m_numcolors; // number of colors in the palette
- UINT32 m_numgroups; // number of groups in the palette
+ uint32_t m_refcount; // reference count on the palette
+ uint32_t m_numcolors; // number of colors in the palette
+ uint32_t m_numgroups; // number of groups in the palette
float m_brightness; // overall brightness value
float m_contrast; // overall contrast value
float m_gamma; // overall gamma value
- UINT8 m_gamma_map[256]; // gamma map
+ uint8_t m_gamma_map[256]; // gamma map
std::vector<rgb_t> m_entry_color; // array of raw colors
std::vector<float> m_entry_contrast; // contrast value for each entry
@@ -227,7 +227,7 @@ private:
//-------------------------------------------------
template<int _NumBits>
-inline UINT8 palexpand(UINT8 bits)
+inline uint8_t palexpand(uint8_t bits)
{
if (_NumBits == 1) { return (bits & 1) ? 0xff : 0x00; }
if (_NumBits == 2) { bits &= 3; return (bits << 6) | (bits << 4) | (bits << 2) | bits; }
@@ -244,13 +244,13 @@ inline UINT8 palexpand(UINT8 bits)
// palxbit - convert an x-bit value to 8 bits
//-------------------------------------------------
-inline UINT8 pal1bit(UINT8 bits) { return palexpand<1>(bits); }
-inline UINT8 pal2bit(UINT8 bits) { return palexpand<2>(bits); }
-inline UINT8 pal3bit(UINT8 bits) { return palexpand<3>(bits); }
-inline UINT8 pal4bit(UINT8 bits) { return palexpand<4>(bits); }
-inline UINT8 pal5bit(UINT8 bits) { return palexpand<5>(bits); }
-inline UINT8 pal6bit(UINT8 bits) { return palexpand<6>(bits); }
-inline UINT8 pal7bit(UINT8 bits) { return palexpand<7>(bits); }
+inline uint8_t pal1bit(uint8_t bits) { return palexpand<1>(bits); }
+inline uint8_t pal2bit(uint8_t bits) { return palexpand<2>(bits); }
+inline uint8_t pal3bit(uint8_t bits) { return palexpand<3>(bits); }
+inline uint8_t pal4bit(uint8_t bits) { return palexpand<4>(bits); }
+inline uint8_t pal5bit(uint8_t bits) { return palexpand<5>(bits); }
+inline uint8_t pal6bit(uint8_t bits) { return palexpand<6>(bits); }
+inline uint8_t pal7bit(uint8_t bits) { return palexpand<7>(bits); }
//-------------------------------------------------
@@ -259,7 +259,7 @@ inline UINT8 pal7bit(UINT8 bits) { return palexpand<7>(bits); }
//-------------------------------------------------
template<int _RBits, int _GBits, int _BBits>
-inline rgb_t rgbexpand(UINT32 data, UINT8 rshift, UINT8 gshift, UINT8 bshift)
+inline rgb_t rgbexpand(uint32_t data, uint8_t rshift, uint8_t gshift, uint8_t bshift)
{
return rgb_t(palexpand<_RBits>(data >> rshift), palexpand<_GBits>(data >> gshift), palexpand<_BBits>(data >> bshift));
}
@@ -267,14 +267,14 @@ inline rgb_t rgbexpand(UINT32 data, UINT8 rshift, UINT8 gshift, UINT8 bshift)
//-------------------------------------------------
// palxxx - create an x-x-x color by extracting
-// bits from a UINT32
+// bits from a uint32_t
//-------------------------------------------------
-inline rgb_t pal332(UINT32 data, UINT8 rshift, UINT8 gshift, UINT8 bshift) { return rgbexpand<3,3,2>(data, rshift, gshift, bshift); }
-inline rgb_t pal444(UINT32 data, UINT8 rshift, UINT8 gshift, UINT8 bshift) { return rgbexpand<4,4,4>(data, rshift, gshift, bshift); }
-inline rgb_t pal555(UINT32 data, UINT8 rshift, UINT8 gshift, UINT8 bshift) { return rgbexpand<5,5,5>(data, rshift, gshift, bshift); }
-inline rgb_t pal565(UINT32 data, UINT8 rshift, UINT8 gshift, UINT8 bshift) { return rgbexpand<5,6,5>(data, rshift, gshift, bshift); }
-inline rgb_t pal888(UINT32 data, UINT8 rshift, UINT8 gshift, UINT8 bshift) { return rgbexpand<8,8,8>(data, rshift, gshift, bshift); }
+inline rgb_t pal332(uint32_t data, uint8_t rshift, uint8_t gshift, uint8_t bshift) { return rgbexpand<3,3,2>(data, rshift, gshift, bshift); }
+inline rgb_t pal444(uint32_t data, uint8_t rshift, uint8_t gshift, uint8_t bshift) { return rgbexpand<4,4,4>(data, rshift, gshift, bshift); }
+inline rgb_t pal555(uint32_t data, uint8_t rshift, uint8_t gshift, uint8_t bshift) { return rgbexpand<5,5,5>(data, rshift, gshift, bshift); }
+inline rgb_t pal565(uint32_t data, uint8_t rshift, uint8_t gshift, uint8_t bshift) { return rgbexpand<5,6,5>(data, rshift, gshift, bshift); }
+inline rgb_t pal888(uint32_t data, uint8_t rshift, uint8_t gshift, uint8_t bshift) { return rgbexpand<8,8,8>(data, rshift, gshift, bshift); }
#endif // __PALETTE_H__
diff --git a/src/lib/util/plaparse.cpp b/src/lib/util/plaparse.cpp
index 74bc8edcc69..d1e7c679f97 100644
--- a/src/lib/util/plaparse.cpp
+++ b/src/lib/util/plaparse.cpp
@@ -33,11 +33,11 @@
struct parse_info
{
- UINT32 inputs; /* number of input columns */
- UINT32 outputs; /* number of output columns */
- UINT32 terms; /* number of terms */
- UINT32 xorval[JED_MAX_FUSES/64]; /* output polarity */
- UINT32 xorptr;
+ uint32_t inputs; /* number of input columns */
+ uint32_t outputs; /* number of output columns */
+ uint32_t terms; /* number of terms */
+ uint32_t xorval[JED_MAX_FUSES/64]; /* output polarity */
+ uint32_t xorptr;
};
@@ -61,9 +61,9 @@ static bool iscrlf(char c)
character stream
-------------------------------------------------*/
-static UINT32 suck_number(const UINT8 **src, const UINT8 *srcend)
+static uint32_t suck_number(const uint8_t **src, const uint8_t *srcend)
{
- UINT32 value = 0;
+ uint32_t value = 0;
// find first digit
while (*src < srcend && !iscrlf(**src) && !isdigit(**src))
@@ -89,10 +89,10 @@ static UINT32 suck_number(const UINT8 **src, const UINT8 *srcend)
process_terms - process input/output matrix
-------------------------------------------------*/
-static bool process_terms(jed_data *data, const UINT8 **src, const UINT8 *srcend, parse_info *pinfo)
+static bool process_terms(jed_data *data, const uint8_t **src, const uint8_t *srcend, parse_info *pinfo)
{
- UINT32 curinput = 0;
- UINT32 curoutput = 0;
+ uint32_t curinput = 0;
+ uint32_t curoutput = 0;
bool outputs = false;
// symbols for 0, 1, dont_care, no_meaning
@@ -195,7 +195,7 @@ static bool process_terms(jed_data *data, const UINT8 **src, const UINT8 *srcend
process_field - process a single field
-------------------------------------------------*/
-static bool process_field(jed_data *data, const UINT8 **src, const UINT8 *srcend, parse_info *pinfo)
+static bool process_field(jed_data *data, const uint8_t **src, const uint8_t *srcend, parse_info *pinfo)
{
// valid keywords
static const char *const keywords[] = { "i", "o", "p", "phase", "e", "\0" };
@@ -213,7 +213,7 @@ static bool process_field(jed_data *data, const UINT8 **src, const UINT8 *srcend
// find keyword
char dest[0x10];
memset(dest, 0, ARRAY_LENGTH(dest));
- const UINT8 *seek = *src;
+ const uint8_t *seek = *src;
int destptr = 0;
while (seek < srcend && isalpha(*seek) && destptr < ARRAY_LENGTH(dest) - 1)
@@ -223,7 +223,7 @@ static bool process_field(jed_data *data, const UINT8 **src, const UINT8 *srcend
destptr++;
}
- UINT8 find = 0;
+ uint8_t find = 0;
while (strlen(keywords[find]) && strcmp(dest, keywords[find]))
find++;
@@ -308,8 +308,8 @@ static bool process_field(jed_data *data, const UINT8 **src, const UINT8 *srcend
int pla_parse(const void *data, size_t length, jed_data *result)
{
- const UINT8 *src = (const UINT8 *)data;
- const UINT8 *srcend = src + length;
+ const uint8_t *src = (const uint8_t *)data;
+ const uint8_t *srcend = src + length;
parse_info pinfo;
memset(&pinfo, 0, sizeof(pinfo));
diff --git a/src/lib/util/png.cpp b/src/lib/util/png.cpp
index 11c0bb4db7b..d1189d5ffc2 100644
--- a/src/lib/util/png.cpp
+++ b/src/lib/util/png.cpp
@@ -26,7 +26,7 @@ struct image_data_chunk
{
image_data_chunk * next;
int length;
- UINT8 * data;
+ uint8_t * data;
};
@@ -35,8 +35,8 @@ struct png_private
png_info * pnginfo;
image_data_chunk * idata;
image_data_chunk ** idata_next;
- UINT8 bpp;
- UINT32 rowbytes;
+ uint8_t bpp;
+ uint32_t rowbytes;
};
@@ -53,41 +53,41 @@ static const int samples[] = { 1, 0, 3, 1, 2, 0, 4 };
INLINE FUNCTIONS
***************************************************************************/
-static inline UINT8 fetch_8bit(UINT8 *v)
+static inline uint8_t fetch_8bit(uint8_t *v)
{
return *v;
}
#ifdef UNUSED_FUNCTION
-static inline UINT16 fetch_16bit(UINT8 *v)
+static inline uint16_t fetch_16bit(uint8_t *v)
{
- return big_endianize_int16(*(UINT16 *)v);
+ return big_endianize_int16(*(uint16_t *)v);
}
#endif
-static inline UINT32 fetch_32bit(UINT8 *v)
+static inline uint32_t fetch_32bit(uint8_t *v)
{
- return big_endianize_int32(*(UINT32 *)v);
+ return big_endianize_int32(*(uint32_t *)v);
}
-static inline void put_8bit(UINT8 *v, UINT8 data)
+static inline void put_8bit(uint8_t *v, uint8_t data)
{
*v = data;
}
#ifdef UNUSED_FUNCTION
-static inline void put_16bit(UINT8 *v, UINT16 data)
+static inline void put_16bit(uint8_t *v, uint16_t data)
{
- *(UINT16 *)v = big_endianize_int16(data);
+ *(uint16_t *)v = big_endianize_int16(data);
}
#endif
-static inline void put_32bit(UINT8 *v, UINT32 data)
+static inline void put_32bit(uint8_t *v, uint32_t data)
{
- *(UINT32 *)v = big_endianize_int32(data);
+ *(uint32_t *)v = big_endianize_int32(data);
}
@@ -150,7 +150,7 @@ void png_free(png_info *pnginfo)
static png_error verify_header(util::core_file &fp)
{
- UINT8 signature[8];
+ uint8_t signature[8];
/* read 8 bytes */
if (fp.read(signature, 8) != 8)
@@ -168,10 +168,10 @@ static png_error verify_header(util::core_file &fp)
read_chunk - read the next PNG chunk
-------------------------------------------------*/
-static png_error read_chunk(util::core_file &fp, UINT8 **data, UINT32 *type, UINT32 *length)
+static png_error read_chunk(util::core_file &fp, uint8_t **data, uint32_t *type, uint32_t *length)
{
- UINT32 crc, chunk_crc;
- UINT8 tempbuff[4];
+ uint32_t crc, chunk_crc;
+ uint8_t tempbuff[4];
/* fetch the length of this chunk */
if (fp.read(tempbuff, 4) != 4)
@@ -195,7 +195,7 @@ static png_error read_chunk(util::core_file &fp, UINT8 **data, UINT32 *type, UIN
if (*length != 0)
{
/* allocate memory for this chunk */
- *data = (UINT8 *)malloc(*length);
+ *data = (uint8_t *)malloc(*length);
if (*data == nullptr)
return PNGERR_OUT_OF_MEMORY;
@@ -235,7 +235,7 @@ static png_error read_chunk(util::core_file &fp, UINT8 **data, UINT32 *type, UIN
process_chunk - process a PNG chunk
-------------------------------------------------*/
-static png_error process_chunk(png_private *png, UINT8 *data, UINT32 type, UINT32 length, int *keepmem)
+static png_error process_chunk(png_private *png, uint8_t *data, uint32_t type, uint32_t length, int *keepmem)
{
/* default to not keeping memory */
*keepmem = FALSE;
@@ -336,7 +336,7 @@ static png_error process_chunk(png_private *png, UINT8 *data, UINT32 type, UINT3
unfilter_row - unfilter a single row of pixels
-------------------------------------------------*/
-static png_error unfilter_row(int type, UINT8 *src, UINT8 *dst, UINT8 *dstprev, int bpp, int rowbytes)
+static png_error unfilter_row(int type, uint8_t *src, uint8_t *dst, uint8_t *dstprev, int bpp, int rowbytes)
{
int x;
@@ -387,13 +387,13 @@ static png_error unfilter_row(int type, UINT8 *src, UINT8 *dst, UINT8 *dstprev,
case PNG_PF_Paeth:
for (x = 0; x < rowbytes; x++)
{
- INT32 pa = (x < bpp) ? 0 : dst[-bpp];
- INT32 pc = (x < bpp || dstprev == nullptr) ? 0 : dstprev[-bpp];
- INT32 pb = (dstprev == nullptr) ? 0 : *dstprev++;
- INT32 prediction = pa + pb - pc;
- INT32 da = abs(prediction - pa);
- INT32 db = abs(prediction - pb);
- INT32 dc = abs(prediction - pc);
+ int32_t pa = (x < bpp) ? 0 : dst[-bpp];
+ int32_t pc = (x < bpp || dstprev == nullptr) ? 0 : dstprev[-bpp];
+ int32_t pb = (dstprev == nullptr) ? 0 : *dstprev++;
+ int32_t prediction = pa + pb - pc;
+ int32_t da = abs(prediction - pa);
+ int32_t db = abs(prediction - pb);
+ int32_t dc = abs(prediction - pc);
if (da <= db && da <= dc)
*dst++ = *src++ + pa;
else if (db <= dc)
@@ -421,7 +421,7 @@ static png_error process_image(png_private *png)
int rowbytes, bpp, imagesize;
png_error error = PNGERR_NONE;
image_data_chunk *idat;
- UINT8 *src, *dst;
+ uint8_t *src, *dst;
z_stream stream;
int zerr, y;
@@ -431,7 +431,7 @@ static png_error process_image(png_private *png)
imagesize = png->pnginfo->height * (rowbytes + 1);
/* allocate memory for the filtered image */
- png->pnginfo->image = (UINT8 *)malloc(imagesize);
+ png->pnginfo->image = (uint8_t *)malloc(imagesize);
if (png->pnginfo->image == nullptr)
return PNGERR_OUT_OF_MEMORY;
@@ -504,7 +504,7 @@ handle_error:
png_error png_read_file(util::core_file &fp, png_info *pnginfo)
{
- UINT8 *chunk_data = nullptr;
+ uint8_t *chunk_data = nullptr;
png_private png;
png_error error;
@@ -522,7 +522,7 @@ png_error png_read_file(util::core_file &fp, png_info *pnginfo)
/* loop until we hit an IEND chunk */
for ( ; ; )
{
- UINT32 chunk_type, chunk_length;
+ uint32_t chunk_type, chunk_length;
int keepmem;
/* read a chunk */
@@ -583,7 +583,7 @@ png_error png_read_bitmap(util::core_file &fp, bitmap_argb32 &bitmap)
{
png_error result;
png_info png;
- UINT8 *src;
+ uint8_t *src;
int x, y;
/* read the PNG data */
@@ -614,7 +614,7 @@ png_error png_read_bitmap(util::core_file &fp, bitmap_argb32 &bitmap)
for (x = 0; x < png.width; x++, src++)
{
/* determine alpha and expand to 32bpp */
- UINT8 alpha = (*src < png.num_trans) ? png.trans[*src] : 0xff;
+ uint8_t alpha = (*src < png.num_trans) ? png.trans[*src] : 0xff;
bitmap.pix32(y, x) = (alpha << 24) | (png.palette[*src * 3] << 16) | (png.palette[*src * 3 + 1] << 8) | png.palette[*src * 3 + 2];
}
}
@@ -657,14 +657,14 @@ png_error png_read_bitmap(util::core_file &fp, bitmap_argb32 &bitmap)
png_error png_expand_buffer_8bit(png_info *pnginfo)
{
int i,j, k;
- UINT8 *inp, *outp, *outbuf;
+ uint8_t *inp, *outp, *outbuf;
/* nothing to do if we're at 8 or greater already */
if (pnginfo->bit_depth >= 8)
return PNGERR_NONE;
/* allocate a new buffer at 8-bit */
- outbuf = (UINT8 *)malloc(pnginfo->width * pnginfo->height);
+ outbuf = (uint8_t *)malloc(pnginfo->width * pnginfo->height);
if (outbuf == nullptr)
return PNGERR_OUT_OF_MEMORY;
@@ -747,10 +747,10 @@ png_error png_add_text(png_info *pnginfo, const char *keyword, const char *text)
the given file
-------------------------------------------------*/
-static png_error write_chunk(util::core_file &fp, const UINT8 *data, UINT32 type, UINT32 length)
+static png_error write_chunk(util::core_file &fp, const uint8_t *data, uint32_t type, uint32_t length)
{
- UINT8 tempbuff[8];
- UINT32 crc;
+ uint8_t tempbuff[8];
+ uint32_t crc;
/* stuff the length/type into the buffer */
put_32bit(tempbuff + 0, length);
@@ -783,13 +783,13 @@ static png_error write_chunk(util::core_file &fp, const UINT8 *data, UINT32 type
chunk to the given file by deflating it
-------------------------------------------------*/
-static png_error write_deflated_chunk(util::core_file &fp, UINT8 *data, UINT32 type, UINT32 length)
+static png_error write_deflated_chunk(util::core_file &fp, uint8_t *data, uint32_t type, uint32_t length)
{
- UINT64 lengthpos = fp.tell();
- UINT8 tempbuff[8192];
- UINT32 zlength = 0;
+ uint64_t lengthpos = fp.tell();
+ uint8_t tempbuff[8192];
+ uint32_t zlength = 0;
z_stream stream;
- UINT32 crc;
+ uint32_t crc;
int zerr;
/* stuff the length/type into the buffer */
@@ -883,7 +883,7 @@ static png_error convert_bitmap_to_image_palette(png_info *pnginfo, const bitmap
rowbytes = pnginfo->width;
/* allocate memory for the palette */
- pnginfo->palette = (UINT8 *)malloc(3 * 256);
+ pnginfo->palette = (uint8_t *)malloc(3 * 256);
if (pnginfo->palette == nullptr)
return PNGERR_OUT_OF_MEMORY;
@@ -898,7 +898,7 @@ static png_error convert_bitmap_to_image_palette(png_info *pnginfo, const bitmap
}
/* allocate memory for the image */
- pnginfo->image = (UINT8 *)malloc(pnginfo->height * (rowbytes + 1));
+ pnginfo->image = (uint8_t *)malloc(pnginfo->height * (rowbytes + 1));
if (pnginfo->image == nullptr)
{
free(pnginfo->palette);
@@ -908,8 +908,8 @@ static png_error convert_bitmap_to_image_palette(png_info *pnginfo, const bitmap
/* copy in the pixels, specifying a nullptr filter */
for (y = 0; y < pnginfo->height; y++)
{
- UINT16 *src = reinterpret_cast<UINT16 *>(bitmap.raw_pixptr(y));
- UINT8 *dst = pnginfo->image + y * (rowbytes + 1);
+ uint16_t *src = reinterpret_cast<uint16_t *>(bitmap.raw_pixptr(y));
+ uint8_t *dst = pnginfo->image + y * (rowbytes + 1);
/* store the filter byte, then copy the data */
*dst++ = 0;
@@ -940,14 +940,14 @@ static png_error convert_bitmap_to_image_rgb(png_info *pnginfo, const bitmap_t &
rowbytes = pnginfo->width * (alpha ? 4 : 3);
/* allocate memory for the image */
- pnginfo->image = (UINT8 *)malloc(pnginfo->height * (rowbytes + 1));
+ pnginfo->image = (uint8_t *)malloc(pnginfo->height * (rowbytes + 1));
if (pnginfo->image == nullptr)
return PNGERR_OUT_OF_MEMORY;
/* copy in the pixels, specifying a nullptr filter */
for (y = 0; y < pnginfo->height; y++)
{
- UINT8 *dst = pnginfo->image + y * (rowbytes + 1);
+ uint8_t *dst = pnginfo->image + y * (rowbytes + 1);
/* store the filter byte, then copy the data */
*dst++ = 0;
@@ -955,7 +955,7 @@ static png_error convert_bitmap_to_image_rgb(png_info *pnginfo, const bitmap_t &
/* 16bpp palettized format */
if (bitmap.format() == BITMAP_FORMAT_IND16)
{
- UINT16 *src16 = reinterpret_cast<UINT16 *>(bitmap.raw_pixptr(y));
+ uint16_t *src16 = reinterpret_cast<uint16_t *>(bitmap.raw_pixptr(y));
for (x = 0; x < pnginfo->width; x++)
{
rgb_t color = palette[*src16++];
@@ -968,7 +968,7 @@ static png_error convert_bitmap_to_image_rgb(png_info *pnginfo, const bitmap_t &
/* 32-bit RGB direct */
else if (bitmap.format() == BITMAP_FORMAT_RGB32)
{
- UINT32 *src32 = reinterpret_cast<UINT32 *>(bitmap.raw_pixptr(y));
+ uint32_t *src32 = reinterpret_cast<uint32_t *>(bitmap.raw_pixptr(y));
for (x = 0; x < pnginfo->width; x++)
{
rgb_t raw = *src32++;
@@ -981,7 +981,7 @@ static png_error convert_bitmap_to_image_rgb(png_info *pnginfo, const bitmap_t &
/* 32-bit ARGB direct */
else if (bitmap.format() == BITMAP_FORMAT_ARGB32)
{
- UINT32 *src32 = reinterpret_cast<UINT32 *>(bitmap.raw_pixptr(y));
+ uint32_t *src32 = reinterpret_cast<uint32_t *>(bitmap.raw_pixptr(y));
for (x = 0; x < pnginfo->width; x++)
{
rgb_t raw = *src32++;
@@ -1008,7 +1008,7 @@ static png_error convert_bitmap_to_image_rgb(png_info *pnginfo, const bitmap_t &
static png_error write_png_stream(util::core_file &fp, png_info *pnginfo, const bitmap_t &bitmap, int palette_length, const rgb_t *palette)
{
- UINT8 tempbuff[16];
+ uint8_t tempbuff[16];
png_text *text;
png_error error;
@@ -1048,7 +1048,7 @@ static png_error write_png_stream(util::core_file &fp, png_info *pnginfo, const
/* write TEXT chunks */
for (text = pnginfo->textlist; text != nullptr; text = text->next)
{
- error = write_chunk(fp, (UINT8 *)text->keyword, PNG_CN_tEXt, (UINT32)strlen(text->keyword) + 1 + (UINT32)strlen(text->text));
+ error = write_chunk(fp, (uint8_t *)text->keyword, PNG_CN_tEXt, (uint32_t)strlen(text->keyword) + 1 + (uint32_t)strlen(text->text));
if (error != PNGERR_NONE)
goto handle_error;
}
@@ -1110,7 +1110,7 @@ png_error png_write_bitmap(util::core_file &fp, png_info *info, bitmap_t &bitmap
png_error mng_capture_start(util::core_file &fp, bitmap_t &bitmap, double rate)
{
- UINT8 mhdr[28];
+ uint8_t mhdr[28];
png_error error;
if (fp.write(MNG_Signature, 8) != 8)
diff --git a/src/lib/util/png.h b/src/lib/util/png.h
index 00522f12f5c..ed74fc6fc8f 100644
--- a/src/lib/util/png.h
+++ b/src/lib/util/png.h
@@ -89,24 +89,24 @@ struct png_text
struct png_info
{
- UINT8 * image;
- UINT32 width, height;
- UINT32 xres, yres;
+ uint8_t * image;
+ uint32_t width, height;
+ uint32_t xres, yres;
rectangle screen;
double xscale, yscale;
double source_gamma;
- UINT32 resolution_unit;
- UINT8 bit_depth;
- UINT8 color_type;
- UINT8 compression_method;
- UINT8 filter_method;
- UINT8 interlace_method;
-
- UINT8 * palette;
- UINT32 num_palette;
-
- UINT8 * trans;
- UINT32 num_trans;
+ uint32_t resolution_unit;
+ uint8_t bit_depth;
+ uint8_t color_type;
+ uint8_t compression_method;
+ uint8_t filter_method;
+ uint8_t interlace_method;
+
+ uint8_t * palette;
+ uint32_t num_palette;
+
+ uint8_t * trans;
+ uint32_t num_trans;
png_text * textlist;
};
diff --git a/src/lib/util/pool.cpp b/src/lib/util/pool.cpp
index f1f42bb58bf..1acb8d0d6e6 100644
--- a/src/lib/util/pool.cpp
+++ b/src/lib/util/pool.cpp
@@ -32,7 +32,7 @@
struct objtype_entry
{
objtype_entry * next;
- UINT32 type;
+ uint32_t type;
const char * friendly;
void (*destructor)(void *, size_t);
};
diff --git a/src/lib/util/pool.h b/src/lib/util/pool.h
index 341d57a6626..a43dacd87b2 100644
--- a/src/lib/util/pool.h
+++ b/src/lib/util/pool.h
@@ -37,7 +37,7 @@
***************************************************************************/
/* pool types are UINT32s */
-typedef UINT32 object_type;
+typedef uint32_t object_type;
/* opaque type representing a pool of objects */
struct object_pool;
diff --git a/src/lib/util/sha1.cpp b/src/lib/util/sha1.cpp
index 700c691622e..f1f00a60310 100644
--- a/src/lib/util/sha1.cpp
+++ b/src/lib/util/sha1.cpp
@@ -31,15 +31,15 @@
#include <stdlib.h>
#include <string.h>
-static unsigned int READ_UINT32(const UINT8* data)
+static unsigned int READ_UINT32(const uint8_t* data)
{
- return ((UINT32)data[0] << 24) |
- ((UINT32)data[1] << 16) |
- ((UINT32)data[2] << 8) |
- ((UINT32)data[3]);
+ return ((uint32_t)data[0] << 24) |
+ ((uint32_t)data[1] << 16) |
+ ((uint32_t)data[2] << 8) |
+ ((uint32_t)data[3]);
}
-static void WRITE_UINT32(unsigned char* data, UINT32 val)
+static void WRITE_UINT32(unsigned char* data, uint32_t val)
{
data[0] = (val >> 24) & 0xFF;
data[1] = (val >> 16) & 0xFF;
@@ -154,7 +154,7 @@ sha1_init(struct sha1_ctx *ctx)
Note that this function destroys the data area */
/**
- * @fn static void sha1_transform(UINT32 *state, UINT32 *data)
+ * @fn static void sha1_transform(uint32_t *state, uint32_t *data)
*
* @brief Sha 1 transform.
*
@@ -163,9 +163,9 @@ sha1_init(struct sha1_ctx *ctx)
*/
static void
-sha1_transform(UINT32 *state, UINT32 *data)
+sha1_transform(uint32_t *state, uint32_t *data)
{
- UINT32 A, B, C, D, E; /* Local vars */
+ uint32_t A, B, C, D, E; /* Local vars */
/* Set up first buffer and local data buffer */
A = state[0];
@@ -268,7 +268,7 @@ sha1_transform(UINT32 *state, UINT32 *data)
}
/**
- * @fn static void sha1_block(struct sha1_ctx *ctx, const UINT8 *block)
+ * @fn static void sha1_block(struct sha1_ctx *ctx, const uint8_t *block)
*
* @brief Sha 1 block.
*
@@ -277,9 +277,9 @@ sha1_transform(UINT32 *state, UINT32 *data)
*/
static void
-sha1_block(struct sha1_ctx *ctx, const UINT8 *block)
+sha1_block(struct sha1_ctx *ctx, const uint8_t *block)
{
- UINT32 data[SHA1_DATA_LENGTH];
+ uint32_t data[SHA1_DATA_LENGTH];
int i;
/* Update block count */
@@ -294,7 +294,7 @@ sha1_block(struct sha1_ctx *ctx, const UINT8 *block)
}
/**
- * @fn void sha1_update(struct sha1_ctx *ctx, unsigned length, const UINT8 *buffer)
+ * @fn void sha1_update(struct sha1_ctx *ctx, unsigned length, const uint8_t *buffer)
*
* @brief Sha 1 update.
*
@@ -305,7 +305,7 @@ sha1_block(struct sha1_ctx *ctx, const UINT8 *block)
void
sha1_update(struct sha1_ctx *ctx,
- unsigned length, const UINT8 *buffer)
+ unsigned length, const uint8_t *buffer)
{
if (ctx->index)
{ /* Try to fill partial block */
@@ -350,7 +350,7 @@ sha1_update(struct sha1_ctx *ctx,
void
sha1_final(struct sha1_ctx *ctx)
{
- UINT32 data[SHA1_DATA_LENGTH];
+ uint32_t data[SHA1_DATA_LENGTH];
int i;
int words;
@@ -391,7 +391,7 @@ sha1_final(struct sha1_ctx *ctx)
}
/**
- * @fn void sha1_digest(const struct sha1_ctx *ctx, unsigned length, UINT8 *digest)
+ * @fn void sha1_digest(const struct sha1_ctx *ctx, unsigned length, uint8_t *digest)
*
* @brief Sha 1 digest.
*
@@ -403,7 +403,7 @@ sha1_final(struct sha1_ctx *ctx)
void
sha1_digest(const struct sha1_ctx *ctx,
unsigned length,
- UINT8 *digest)
+ uint8_t *digest)
{
unsigned i;
unsigned words;
@@ -419,7 +419,7 @@ sha1_digest(const struct sha1_ctx *ctx,
if (leftover)
{
- UINT32 word;
+ uint32_t word;
unsigned j = leftover;
assert(i < _SHA1_DIGEST_LENGTH);
diff --git a/src/lib/util/sha1.h b/src/lib/util/sha1.h
index ba5866c5819..177caf9f6dc 100644
--- a/src/lib/util/sha1.h
+++ b/src/lib/util/sha1.h
@@ -38,9 +38,9 @@
struct sha1_ctx
{
- UINT32 digest[_SHA1_DIGEST_LENGTH]; /* Message digest */
- UINT32 count_low, count_high; /* 64-bit block count */
- UINT8 block[SHA1_DATA_SIZE]; /* SHA1 data buffer */
+ uint32_t digest[_SHA1_DIGEST_LENGTH]; /* Message digest */
+ uint32_t count_low, count_high; /* 64-bit block count */
+ uint8_t block[SHA1_DATA_SIZE]; /* SHA1 data buffer */
unsigned int index; /* index into buffer */
};
@@ -50,7 +50,7 @@ sha1_init(struct sha1_ctx *ctx);
void
sha1_update(struct sha1_ctx *ctx,
unsigned length,
- const UINT8 *data);
+ const uint8_t *data);
void
sha1_final(struct sha1_ctx *ctx);
@@ -58,6 +58,6 @@ sha1_final(struct sha1_ctx *ctx);
void
sha1_digest(const struct sha1_ctx *ctx,
unsigned length,
- UINT8 *digest);
+ uint8_t *digest);
#endif /* NETTLE_SHA1_H_INCLUDED */
diff --git a/src/lib/util/vbiparse.cpp b/src/lib/util/vbiparse.cpp
index 854b5fbd384..42249ab6794 100644
--- a/src/lib/util/vbiparse.cpp
+++ b/src/lib/util/vbiparse.cpp
@@ -40,10 +40,10 @@
code from a line of video data
-------------------------------------------------*/
-int vbi_parse_manchester_code(const UINT16 *source, int sourcewidth, int sourceshift, int expectedbits, UINT32 *result)
+int vbi_parse_manchester_code(const uint16_t *source, int sourcewidth, int sourceshift, int expectedbits, uint32_t *result)
{
- UINT8 srcabs[MAX_SOURCE_WIDTH];
- UINT8 min, max, mid, srcabsval;
+ uint8_t srcabs[MAX_SOURCE_WIDTH];
+ uint8_t min, max, mid, srcabsval;
double clock, bestclock;
int x, firstedge;
int besterr;
@@ -57,7 +57,7 @@ int vbi_parse_manchester_code(const UINT16 *source, int sourcewidth, int sources
max = 0x00;
for (x = 0; x < sourcewidth; x++)
{
- UINT8 rawsrc = source[x] >> sourceshift;
+ uint8_t rawsrc = source[x] >> sourceshift;
min = std::min(min, rawsrc);
max = std::max(max, rawsrc);
}
@@ -75,7 +75,7 @@ int vbi_parse_manchester_code(const UINT16 *source, int sourcewidth, int sources
srcabsval = (source[0] > mid);
for (x = 0; x < sourcewidth; x++)
{
- UINT8 rawsrc = source[x] >> sourceshift;
+ uint8_t rawsrc = source[x] >> sourceshift;
if (rawsrc >= max)
srcabsval = 1;
else if (rawsrc <= min)
@@ -147,13 +147,13 @@ int vbi_parse_manchester_code(const UINT16 *source, int sourcewidth, int sources
/* compute left and right average values */
leftavg = 0;
for (tx = leftstart; tx <= leftend; tx++)
- leftavg += (UINT8)(source[tx] >> sourceshift) - mid;
+ leftavg += (uint8_t)(source[tx] >> sourceshift) - mid;
leftabs = (leftavg >= 0);
leftavg = (leftavg < 0) ? -leftavg : leftavg;
rightavg = 0;
for (tx = rightstart; tx <= rightend; tx++)
- rightavg += (UINT8)(source[tx] >> sourceshift) - mid;
+ rightavg += (uint8_t)(source[tx] >> sourceshift) - mid;
rightabs = (rightavg >= 0);
rightavg = (rightavg < 0) ? -rightavg : rightavg;
@@ -174,7 +174,7 @@ int vbi_parse_manchester_code(const UINT16 *source, int sourcewidth, int sources
flag" from a line of video data
-------------------------------------------------*/
-int vbi_parse_white_flag(const UINT16 *source, int sourcewidth, int sourceshift)
+int vbi_parse_white_flag(const uint16_t *source, int sourcewidth, int sourceshift)
{
int histo[256] = { 0 };
int minval = 0xff;
@@ -187,7 +187,7 @@ int vbi_parse_white_flag(const UINT16 *source, int sourcewidth, int sourceshift)
/* compute a histogram of values */
for (x = 0; x < sourcewidth; x++)
{
- UINT8 yval = source[x] >> sourceshift;
+ uint8_t yval = source[x] >> sourceshift;
histo[yval]++;
}
@@ -261,7 +261,7 @@ int vbi_parse_white_flag(const UINT16 *source, int sourcewidth, int sourceshift)
thresh = minval + 3 * (maxval - minval) / 4;
for (x = 0; x < sourcewidth; x++)
{
- UINT8 yval = source[x] >> sourceshift;
+ uint8_t yval = source[x] >> sourceshift;
above += (yval >= thresh);
}
/* if at least 80% of the pixels are above the threshold, we'll call it white */
@@ -277,7 +277,7 @@ int vbi_parse_white_flag(const UINT16 *source, int sourcewidth, int sourceshift)
-------------------------------------------------*/
/**
- * @fn void vbi_parse_all(const UINT16 *source, int sourcerowpixels, int sourcewidth, int sourceshift, vbi_metadata *vbi)
+ * @fn void vbi_parse_all(const uint16_t *source, int sourcerowpixels, int sourcewidth, int sourceshift, vbi_metadata *vbi)
*
* @brief Vbi parse all.
*
@@ -288,10 +288,10 @@ int vbi_parse_white_flag(const UINT16 *source, int sourcewidth, int 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)
+void vbi_parse_all(const uint16_t *source, int sourcerowpixels, int sourcewidth, int sourceshift, vbi_metadata *vbi)
{
- UINT32 bits[2][24];
- UINT8 bitnum;
+ uint32_t bits[2][24];
+ uint8_t bitnum;
/* first reset it all */
memset(vbi, 0, sizeof(*vbi));
@@ -351,7 +351,7 @@ void vbi_parse_all(const UINT16 *source, int sourcerowpixels, int sourcewidth, i
-------------------------------------------------*/
/**
- * @fn void vbi_metadata_pack(UINT8 *dest, UINT32 framenum, const vbi_metadata *vbi)
+ * @fn void vbi_metadata_pack(uint8_t *dest, uint32_t framenum, const vbi_metadata *vbi)
*
* @brief Vbi metadata pack.
*
@@ -360,7 +360,7 @@ void vbi_parse_all(const UINT16 *source, int sourcerowpixels, int sourcewidth, i
* @param vbi The vbi.
*/
-void vbi_metadata_pack(UINT8 *dest, UINT32 framenum, const vbi_metadata *vbi)
+void vbi_metadata_pack(uint8_t *dest, uint32_t framenum, const vbi_metadata *vbi)
{
dest[0] = framenum >> 16;
dest[1] = framenum >> 8;
@@ -387,7 +387,7 @@ void vbi_metadata_pack(UINT8 *dest, UINT32 framenum, const vbi_metadata *vbi)
-------------------------------------------------*/
/**
- * @fn void vbi_metadata_unpack(vbi_metadata *vbi, UINT32 *framenum, const UINT8 *source)
+ * @fn void vbi_metadata_unpack(vbi_metadata *vbi, uint32_t *framenum, const uint8_t *source)
*
* @brief Vbi metadata unpack.
*
@@ -396,7 +396,7 @@ void vbi_metadata_pack(UINT8 *dest, UINT32 framenum, const vbi_metadata *vbi)
* @param source Source for the.
*/
-void vbi_metadata_unpack(vbi_metadata *vbi, UINT32 *framenum, const UINT8 *source)
+void vbi_metadata_unpack(vbi_metadata *vbi, uint32_t *framenum, const uint8_t *source)
{
if (framenum != nullptr)
*framenum = (source[0] << 16) | (source[1] << 8) | source[2];
diff --git a/src/lib/util/vbiparse.h b/src/lib/util/vbiparse.h
index 687f984622c..ed67a3fee9f 100644
--- a/src/lib/util/vbiparse.h
+++ b/src/lib/util/vbiparse.h
@@ -61,11 +61,11 @@
struct vbi_metadata
{
- UINT8 white; /* white flag: on or off */
- UINT32 line16; /* line 16 code */
- UINT32 line17; /* line 17 code */
- UINT32 line18; /* line 18 code */
- UINT32 line1718; /* most plausible value from lines 17/18 */
+ uint8_t white; /* white flag: on or off */
+ uint32_t line16; /* line 16 code */
+ uint32_t line17; /* line 17 code */
+ uint32_t line18; /* line 18 code */
+ uint32_t line1718; /* most plausible value from lines 17/18 */
};
@@ -75,19 +75,19 @@ struct vbi_metadata
***************************************************************************/
/* parse a Manchester code from a line of video data */
-int vbi_parse_manchester_code(const UINT16 *source, int sourcewidth, int sourceshift, int expectedbits, UINT32 *result);
+int vbi_parse_manchester_code(const uint16_t *source, int sourcewidth, int sourceshift, int expectedbits, uint32_t *result);
/* compute the "white flag" from a line of video data */
-int vbi_parse_white_flag(const UINT16 *source, int sourcewidth, int sourceshift);
+int vbi_parse_white_flag(const uint16_t *source, int sourcewidth, int sourceshift);
/* parse everything from a video frame */
-void vbi_parse_all(const UINT16 *source, int sourcerowpixels, int sourcewidth, int sourceshift, vbi_metadata *vbi);
+void vbi_parse_all(const uint16_t *source, int sourcerowpixels, int sourcewidth, int sourceshift, vbi_metadata *vbi);
/* pack the VBI data down into a smaller form for storage */
-void vbi_metadata_pack(UINT8 *dest, UINT32 framenum, const vbi_metadata *vbi);
+void vbi_metadata_pack(uint8_t *dest, uint32_t framenum, const vbi_metadata *vbi);
/* unpack the VBI data from a smaller form into the full structure */
-void vbi_metadata_unpack(vbi_metadata *vbi, UINT32 *framenum, const UINT8 *source);
+void vbi_metadata_unpack(vbi_metadata *vbi, uint32_t *framenum, const uint8_t *source);
#endif /* __VBIPARSE_H__ */
diff --git a/src/lib/util/wavwrite.cpp b/src/lib/util/wavwrite.cpp
index d052287216d..0667e9dcaff 100644
--- a/src/lib/util/wavwrite.cpp
+++ b/src/lib/util/wavwrite.cpp
@@ -8,16 +8,16 @@
struct wav_file
{
FILE *file;
- UINT32 total_offs;
- UINT32 data_offs;
+ uint32_t total_offs;
+ uint32_t data_offs;
};
wav_file *wav_open(const char *filename, int sample_rate, int channels)
{
wav_file *wav;
- UINT32 bps, temp32;
- UINT16 align, temp16;
+ uint32_t bps, temp32;
+ uint16_t align, temp16;
/* allocate memory for the wav struct */
wav = global_alloc_nothrow(wav_file);
@@ -90,8 +90,8 @@ wav_file *wav_open(const char *filename, int sample_rate, int channels)
void wav_close(wav_file *wav)
{
- UINT32 total;
- UINT32 temp32;
+ uint32_t total;
+ uint32_t temp32;
if (!wav) return;
@@ -114,7 +114,7 @@ void wav_close(wav_file *wav)
}
-void wav_add_data_16(wav_file *wav, INT16 *data, int samples)
+void wav_add_data_16(wav_file *wav, int16_t *data, int samples)
{
if (!wav) return;
@@ -124,9 +124,9 @@ void wav_add_data_16(wav_file *wav, INT16 *data, int samples)
}
-void wav_add_data_32(wav_file *wav, INT32 *data, int samples, int shift)
+void wav_add_data_32(wav_file *wav, int32_t *data, int samples, int shift)
{
- std::vector<INT16> temp;
+ std::vector<int16_t> temp;
int i;
if (!wav || !samples) return;
@@ -147,9 +147,9 @@ void wav_add_data_32(wav_file *wav, INT32 *data, int samples, int shift)
}
-void wav_add_data_16lr(wav_file *wav, INT16 *left, INT16 *right, int samples)
+void wav_add_data_16lr(wav_file *wav, int16_t *left, int16_t *right, int samples)
{
- std::vector<INT16> temp;
+ std::vector<int16_t> temp;
int i;
if (!wav || !samples) return;
@@ -167,9 +167,9 @@ void wav_add_data_16lr(wav_file *wav, INT16 *left, INT16 *right, int samples)
}
-void wav_add_data_32lr(wav_file *wav, INT32 *left, INT32 *right, int samples, int shift)
+void wav_add_data_32lr(wav_file *wav, int32_t *left, int32_t *right, int samples, int shift)
{
- std::vector<INT16> temp;
+ std::vector<int16_t> temp;
int i;
if (!wav || !samples) return;
diff --git a/src/lib/util/wavwrite.h b/src/lib/util/wavwrite.h
index 376856fb16f..da94a9d3782 100644
--- a/src/lib/util/wavwrite.h
+++ b/src/lib/util/wavwrite.h
@@ -10,9 +10,9 @@ struct wav_file;
wav_file *wav_open(const char *filename, int sample_rate, int channels);
void wav_close(wav_file*wavptr);
-void wav_add_data_16(wav_file *wavptr, INT16 *data, int samples);
-void wav_add_data_32(wav_file *wavptr, INT32 *data, int samples, int shift);
-void wav_add_data_16lr(wav_file *wavptr, INT16 *left, INT16 *right, int samples);
-void wav_add_data_32lr(wav_file *wavptr, INT32 *left, INT32 *right, int samples, int shift);
+void wav_add_data_16(wav_file *wavptr, int16_t *data, int samples);
+void wav_add_data_32(wav_file *wavptr, int32_t *data, int samples, int shift);
+void wav_add_data_16lr(wav_file *wavptr, int16_t *left, int16_t *right, int samples);
+void wav_add_data_32lr(wav_file *wavptr, int32_t *left, int32_t *right, int samples, int shift);
#endif /* __WAVWRITE_H__ */
diff --git a/src/lib/util/xmlfile.cpp b/src/lib/util/xmlfile.cpp
index b1ed844dc71..98689283c4e 100644
--- a/src/lib/util/xmlfile.cpp
+++ b/src/lib/util/xmlfile.cpp
@@ -32,7 +32,7 @@ struct xml_parse_info
XML_Parser parser;
xml_data_node * rootnode;
xml_data_node * curnode;
- UINT32 flags;
+ uint32_t flags;
};
@@ -103,7 +103,7 @@ static const char *copystring_lower(const char *input)
if (newstr != nullptr)
{
for (i = 0; input[i] != 0; i++)
- newstr[i] = tolower((UINT8)input[i]);
+ newstr[i] = tolower((uint8_t)input[i]);
newstr[i] = 0;
}
@@ -635,7 +635,7 @@ const char *xml_normalize_string(const char *string)
static void *expat_malloc(size_t size)
{
- UINT32 *result = (UINT32 *)malloc(size + 4 * sizeof(UINT32));
+ uint32_t *result = (uint32_t *)malloc(size + 4 * sizeof(uint32_t));
*result = size;
return &result[4];
}
@@ -651,7 +651,7 @@ static void *expat_malloc(size_t size)
static void expat_free(void *ptr)
{
if (ptr != nullptr)
- free(&((UINT32 *)ptr)[-4]);
+ free(&((uint32_t *)ptr)[-4]);
}
/**
@@ -672,7 +672,7 @@ static void *expat_realloc(void *ptr, size_t size)
return nullptr;
if (ptr != nullptr)
{
- UINT32 oldsize = ((UINT32 *)ptr)[-4];
+ uint32_t oldsize = ((uint32_t *)ptr)[-4];
memcpy(newptr, ptr, oldsize);
expat_free(ptr);
}
@@ -856,11 +856,11 @@ static void expat_element_end(void *data, const XML_Char *name)
char *end = start + strlen(start);
/* first strip leading spaces */
- while (*start && isspace((UINT8)*start))
+ while (*start && isspace((uint8_t)*start))
start++;
/* then strip trailing spaces */
- while (end > start && isspace((UINT8)end[-1]))
+ while (end > start && isspace((uint8_t)end[-1]))
end--;
/* if nothing left, just free it */
diff --git a/src/lib/util/xmlfile.h b/src/lib/util/xmlfile.h
index e116366643f..eac3cdff4c2 100644
--- a/src/lib/util/xmlfile.h
+++ b/src/lib/util/xmlfile.h
@@ -81,7 +81,7 @@ struct xml_parse_options
{
xml_parse_error * error;
void (*init_parser)(struct XML_ParserStruct *parser);
- UINT32 flags;
+ uint32_t flags;
};
diff --git a/src/lib/util/zippath.cpp b/src/lib/util/zippath.cpp
index 1eb2eba9274..2ee9082a817 100644
--- a/src/lib/util/zippath.cpp
+++ b/src/lib/util/zippath.cpp
@@ -363,7 +363,7 @@ done:
// -------------------------------------------------
/**
- * @fn osd_file::error zippath_fopen(const std::string &filename, UINT32 openflags, util::core_file::ptr &file, std::string &revised_path)
+ * @fn osd_file::error zippath_fopen(const std::string &filename, uint32_t openflags, util::core_file::ptr &file, std::string &revised_path)
*
* @brief Zippath fopen.
*
@@ -375,7 +375,7 @@ done:
* @return A osd_file::error.
*/
-osd_file::error zippath_fopen(const std::string &filename, UINT32 openflags, util::core_file::ptr &file, std::string &revised_path)
+osd_file::error zippath_fopen(const std::string &filename, uint32_t openflags, util::core_file::ptr &file, std::string &revised_path)
{
osd_file::error filerr = osd_file::error::NOT_FOUND;
archive_file::error ziperr;
diff --git a/src/lib/util/zippath.h b/src/lib/util/zippath.h
index 9c5b361b076..89656e6cf10 100644
--- a/src/lib/util/zippath.h
+++ b/src/lib/util/zippath.h
@@ -49,7 +49,7 @@ std::string zippath_combine(const std::string &path1, const std::string &path2);
// ----- file operations -----
// opens a zip path file
-osd_file::error zippath_fopen(const std::string &filename, UINT32 openflags, util::core_file::ptr &file, std::string &revised_path);
+osd_file::error zippath_fopen(const std::string &filename, uint32_t openflags, util::core_file::ptr &file, std::string &revised_path);
// ----- directory operations ----- */