summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/formats/camplynx_cas.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/formats/camplynx_cas.cpp')
-rw-r--r--src/lib/formats/camplynx_cas.cpp37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/lib/formats/camplynx_cas.cpp b/src/lib/formats/camplynx_cas.cpp
index bcf6c1caa6b..545814b954f 100644
--- a/src/lib/formats/camplynx_cas.cpp
+++ b/src/lib/formats/camplynx_cas.cpp
@@ -23,10 +23,13 @@ Each byte is 8 bits (MSB first) with no start or stop bits.
********************************************************************/
-#include "emu.h" // for popmessage and <string>
-
#include "camplynx_cas.h"
+#include "multibyte.h"
+
+#include "osdcore.h" // osd_printf_*
+
+
#define WAVEENTRY_LOW -32768
#define WAVEENTRY_HIGH 32767
@@ -128,7 +131,7 @@ static int camplynx_handle_cassette(int16_t *buffer, const uint8_t *bytes)
/* tell user how to load the tape */
if (buffer)
- osd_printf_info("%s\n", pgmname.c_str());
+ osd_printf_info("%s\n", pgmname);
/* second SYNC + A5 */
for (i = 0; i < 555; i++)
@@ -143,13 +146,13 @@ static int camplynx_handle_cassette(int16_t *buffer, const uint8_t *bytes)
switch (file_type)
{
case 'A':
- data_size = 5 + ((bytes[byte_count + 4]) << 8 | bytes[byte_count + 3]) + 12;
+ data_size = 5 + get_u16le(&bytes[byte_count + 3]) + 12;
break;
case 'B':
- data_size = 3 + ((bytes[byte_count + 2]) << 8 | bytes[byte_count + 1]) + 3;
+ data_size = 3 + get_u16le(&bytes[byte_count + 1]) + 3;
break;
case 'M':
- data_size = 3 + ((bytes[byte_count + 2]) << 8 | bytes[byte_count + 1]) + 7;
+ data_size = 3 + get_u16le(&bytes[byte_count + 1]) + 7;
break;
}
@@ -176,7 +179,7 @@ static int camplynx_handle_cassette(int16_t *buffer, const uint8_t *bytes)
Generate samples for the tape image
********************************************************************/
-static int camplynx_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
+static int camplynx_cassette_fill_wave(int16_t *buffer, int length, const uint8_t *bytes, int)
{
return camplynx_handle_cassette(buffer, bytes);
}
@@ -192,7 +195,7 @@ static int camplynx_cassette_calculate_size_in_samples(const uint8_t *bytes, int
return camplynx_handle_cassette(nullptr, bytes);
}
-static const struct CassetteLegacyWaveFiller lynx48k_legacy_fill_wave =
+static const cassette_image::LegacyWaveFiller lynx48k_legacy_fill_wave =
{
camplynx_cassette_fill_wave, /* fill_wave */
-1, /* chunk_size */
@@ -203,7 +206,7 @@ static const struct CassetteLegacyWaveFiller lynx48k_legacy_fill_wave =
0 /* trailer_samples */
};
-static const struct CassetteLegacyWaveFiller lynx128k_legacy_fill_wave =
+static const cassette_image::LegacyWaveFiller lynx128k_legacy_fill_wave =
{
camplynx_cassette_fill_wave, /* fill_wave */
-1, /* chunk_size */
@@ -214,27 +217,27 @@ static const struct CassetteLegacyWaveFiller lynx128k_legacy_fill_wave =
0 /* trailer_samples */
};
-static cassette_image::error lynx48k_cassette_identify(cassette_image *cassette, struct CassetteOptions *opts)
+static cassette_image::error lynx48k_cassette_identify(cassette_image *cassette, cassette_image::Options *opts)
{
- return cassette_legacy_identify(cassette, opts, &lynx48k_legacy_fill_wave);
+ return cassette->legacy_identify(opts, &lynx48k_legacy_fill_wave);
}
-static cassette_image::error lynx128k_cassette_identify(cassette_image *cassette, struct CassetteOptions *opts)
+static cassette_image::error lynx128k_cassette_identify(cassette_image *cassette, cassette_image::Options *opts)
{
- return cassette_legacy_identify(cassette, opts, &lynx128k_legacy_fill_wave);
+ return cassette->legacy_identify(opts, &lynx128k_legacy_fill_wave);
}
static cassette_image::error lynx48k_cassette_load(cassette_image *cassette)
{
- return cassette_legacy_construct(cassette, &lynx48k_legacy_fill_wave);
+ return cassette->legacy_construct(&lynx48k_legacy_fill_wave);
}
static cassette_image::error lynx128k_cassette_load(cassette_image *cassette)
{
- return cassette_legacy_construct(cassette, &lynx128k_legacy_fill_wave);
+ return cassette->legacy_construct(&lynx128k_legacy_fill_wave);
}
-static const struct CassetteFormat lynx48k_cassette_image_format =
+static const cassette_image::Format lynx48k_cassette_image_format =
{
"tap",
lynx48k_cassette_identify,
@@ -242,7 +245,7 @@ static const struct CassetteFormat lynx48k_cassette_image_format =
nullptr
};
-static const struct CassetteFormat lynx128k_cassette_image_format =
+static const cassette_image::Format lynx128k_cassette_image_format =
{
"tap",
lynx128k_cassette_identify,